diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..a8a7f2a153 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Shipped as committed: its SBOM records the SHA-256 of these exact bytes +application/src/main/data/resources/js_extensions/gateway-management-extension.js -text diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 52bba5966c..9054be4e7b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -157,6 +157,32 @@ Open a pull request against `master`. Fill out the pull request template, and ma - The change builds cleanly: `mvn -pl -am -DskipTests -Dpkg.skip=true test-compile` at minimum for the modules you touched. - You have signed the Contributor License Agreement (see below). +### Pull request titles + +The release notes are generated from pull request titles, word for word. Write the title for the +people who read them — users and customers, not reviewers: + +- **Describe the change in behavior, as a user sees it.** Name the feature or screen and what now + works differently. Leave out class names, exceptions, library versions and other internals a + user can't relate to; they belong in the description. +- **Use the past tense, starting with a verb** such as `Fixed`, `Added`, `Updated`, `Improved`, + `Removed`, `Renamed` or `Made`. Not `Fix`, `Add` or `Update`. +- **Leave out code-scope prefixes and suffixes** such as `fix(ui):`, ticket keys or branch names + (`(lts-4.3)`). A product-area prefix a user recognizes is fine, followed by the verb: + `IoT Hub: added filtering of the catalogue by the creator's verification status`. + +The section an entry appears under (`UI`, `Bug: UI`, `Edge`, …) comes from the pull request's +labels, not its title, so don't repeat the area or the change type in the title. Changes users +don't see — CI, build, a second backport of the same fix — get the `Ignore for release` label +and stay out of the release notes. For anything else, such as docs or refactoring, decide +whether users would want to read about it in the release notes, and add the label if not. + +| Instead of | Write | +|----------------------------------------------------------------|------------------------------------------------------------------------------------------------| +| `fix(ui): update moment-timezone to 0.6.5 (tzdata 2026e)` | `Updated UI time zone data to reflect 2026 daylight saving time changes in Canada, Morocco and Moldova` | +| `Warn that updating a solution template recreates everything it installed` | `Added a warning that updating a solution template recreates everything it installed` | +| `Fix empty Provisioning step when navigating the device install wizard via the stepper header` | `Fixed empty Provisioning step when navigating the device install wizard via the stepper header` | + ## Contributor License Agreement Before we can merge your pull request, you need to sign the ThingsBoard diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000000..145fd61df5 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,14 @@ +# Maintainers + +This file lists the maintainers of the ThingsBoard project. +Maintainers review and merge pull requests, triage issues, and drive project releases. + +| Name | GitHub | Email | +|---------------------|--------------------------------------------------------|---------------------------| +| Andrii Shvaika | [@ashvayka](https://github.com/ashvayka) | ashvayka@thingsboard.io | +| Igor Kulikov | [@ikulikov](https://github.com/ikulikov) | ikulikov@thingsboard.io | +| Viacheslav Klimov | [@ViacheslavKlimov](https://github.com/ViacheslavKlimov) | vklimov@thingsboard.io | +| Vladyslav Prykhodko | [@vvlladd28](https://github.com/vvlladd28) | vprykhodko@thingsboard.io | +| Sergey Matvienko | [@smatvienko-tb](https://github.com/smatvienko-tb) | smatvienko@thingsboard.io | + +For security issues, please follow the process described in [security.md](security.md) instead of contacting maintainers directly. diff --git a/application/pom.xml b/application/pom.xml index 1dcafd6e9c..d409208c29 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -27,6 +27,7 @@ java process-resources package + ${pkg.package.phase} thingsboard ${project.build.directory}/windows true @@ -577,6 +578,10 @@ + + org.cyclonedx + cyclonedx-maven-plugin + org.apache.maven.plugins maven-jar-plugin @@ -593,6 +598,83 @@ org.apache.maven.plugins maven-assembly-plugin + + org.apache.maven.plugins + maven-enforcer-plugin + + + + check-gateway-extension-sbom + validate + + enforce + + + + + + src/main/sbom/gateway-management-extension.cdx.json does not describe src/main/data/resources/js_extensions/gateway-management-extension.js: it does not contain the SHA-256 of that file. Take both files from the same build in the gateway-management-extensions-dist repository. + + + + + + + + org.thingsboard + sbom-maven-plugin + + + merge-ui-sbom + + merge + + + org.thingsboard:ui-ngx + ${skip.ui.build} + + + + package-sbom + + + + ${project.basedir}/src/main/sbom/gateway-management-extension.cdx.json + ${project.build.directory}/data/resources/js_extensions/gateway-management-extension.js + + + data + lwm2m-registry + LwM2M object model XML files from the OMNA LwM2M Registry. Licenses vary per file, mostly BSD-3-Clause. + + Open Mobile Alliance + + https://github.com/OpenMobileAlliance/lwm2m-registry + + + ${project.build.directory}/data/lwm2m-registry + + + cryptographic-asset + DigiCert Global Root G2 + Root CA certificate for Azure IoT Hub connections. + + DigiCert, Inc. + + https://www.digicert.com + + + ${project.build.directory}/data/certs/azure/DigiCertGlobalRootG2.crt.pem + + + + + + org.xolstice.maven.plugins protobuf-maven-plugin diff --git a/application/src/main/data/json/system/widget_types/basic_gpio_control.json b/application/src/main/data/json/system/widget_types/basic_gpio_control.json index 1b7deb52cf..4178099658 100644 --- a/application/src/main/data/json/system/widget_types/basic_gpio_control.json +++ b/application/src/main/data/json/system/widget_types/basic_gpio_control.json @@ -9,9 +9,9 @@ "sizeX": 4, "sizeY": 2, "resources": [], - "templateHtml": "
\n
\n
\n
\n {{ cell.label }}\n
\n {{cell.pin}}\n \n \n \n \n {{cell.pin}}\n
\n {{ cell.label }}\n
\n
\n \n \n \n
\n
\n
\n {{rpcErrorText}}\n \n
", + "templateHtml": "
\n
\n
\n
\n {{ cell.label }}\n
\n {{cell.pin}}\n \n \n \n \n {{cell.pin}}\n
\n {{ cell.label }}\n
\n
\n \n \n \n
\n
\n
\n {{ rpcErrorMessage() }}\n \n
", "templateCss": ".error {\n font-size: 14px !important;\n color: maroon;/*rgb(250,250,250);*/\n background-color: transparent;\n padding: 6px;\n}\n\n.error span {\n margin: auto;\n}\n\n.gpio-panel {\n padding-top: 10px;\n white-space: nowrap;\n}\n\n.gpio-panel section.flex-1 {\n min-width: 0px;\n}\n\n\n.switch-panel {\n margin: 0;\n height: 32px;\n width: 66px;\n min-width: 66px;\n}\n\n.switch-panel mat-slide-toggle {\n margin: 0;\n width: 36px;\n min-width: 36px;\n}\n\n.switch-panel.col-0 mat-slide-toggle {\n margin-left: 8px;\n margin-right: 4px;\n}\n\n.switch-panel.col-1 mat-slide-toggle {\n margin-left: 4px;\n margin-right: 8px;\n}\n\n.gpio-row {\n height: 32px;\n}\n\n.pin {\n margin-top: auto;\n margin-bottom: auto;\n color: white;\n font-size: 12px;\n width: 16px;\n min-width: 16px;\n}\n\n.switch-panel.col-0 .pin {\n margin-left: auto;\n padding-left: 2px;\n text-align: right;\n}\n\n.switch-panel.col-1 .pin {\n margin-right: auto;\n\n text-align: left;\n}\n\n.gpio-left-label {\n margin-right: 8px;\n}\n\n.gpio-right-label {\n margin-left: 8px;\n}", - "controllerScript": "var namespace;\nvar cssParser = new cssjs();\n\nself.onInit = function() {\n var utils = self.ctx.$injector.get(self.ctx.servicesMap.get('utils'));\n namespace = 'gpio-control-' + utils.guid();\n cssParser.testMode = false;\n cssParser.cssPreviewNamespace = namespace;\n self.ctx.$container.addClass(namespace);\n self.ctx.ngZone.run(function() {\n init(); \n });\n}\n\nfunction init() {\n \n var i, gpio;\n var scope = self.ctx.$scope;\n var settings = self.ctx.settings;\n scope.gpioList = [];\n for (var g = 0; g < settings.gpioList.length; g++) {\n gpio = settings.gpioList[g];\n scope.gpioList.push(\n {\n row: gpio.row,\n col: gpio.col,\n pin: gpio.pin,\n label: gpio.label,\n enabled: false\n }\n );\n }\n\n scope.requestTimeout = settings.requestTimeout || 1000;\n\n scope.switchPanelBackgroundColor = settings.switchPanelBackgroundColor || tinycolor('green').lighten(2).toRgbString();\n\n scope.gpioStatusRequest = {\n method: \"getGpioStatus\",\n paramsBody: \"{}\"\n };\n \n if (settings.gpioStatusRequest) {\n scope.gpioStatusRequest.method = settings.gpioStatusRequest.method || scope.gpioStatusRequest.method;\n scope.gpioStatusRequest.paramsBody = settings.gpioStatusRequest.paramsBody || scope.gpioStatusRequest.paramsBody;\n }\n \n scope.gpioStatusChangeRequest = {\n method: \"setGpioStatus\",\n paramsBody: \"{\\n \\\"pin\\\": \\\"{$pin}\\\",\\n \\\"enabled\\\": \\\"{$enabled}\\\"\\n}\"\n };\n \n if (settings.gpioStatusChangeRequest) {\n scope.gpioStatusChangeRequest.method = settings.gpioStatusChangeRequest.method || scope.gpioStatusChangeRequest.method;\n scope.gpioStatusChangeRequest.paramsBody = settings.gpioStatusChangeRequest.paramsBody || scope.gpioStatusChangeRequest.paramsBody;\n }\n \n scope.parseGpioStatusFunction = \"return body[pin] === true;\";\n \n if (settings.parseGpioStatusFunction && settings.parseGpioStatusFunction.length > 0) {\n scope.parseGpioStatusFunction = settings.parseGpioStatusFunction;\n }\n \n scope.parseGpioStatusFunction = new Function(\"body, pin\", scope.parseGpioStatusFunction);\n \n function requestGpioStatus() {\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusRequest.method, \n scope.gpioStatusRequest.paramsBody, \n scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n for (var g = 0; g < scope.gpioList.length; g++) {\n var gpio = scope.gpioList[g];\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled; \n self.ctx.detectChanges();\n }\n }\n );\n }\n \n function changeGpioStatus(gpio) {\n var pin = gpio.pin + '';\n var enabled = !gpio.enabled;\n enabled = enabled === true ? 'true' : 'false';\n var paramsBody = scope.gpioStatusChangeRequest.paramsBody;\n var requestBody = JSON.parse(paramsBody.replace(\"\\\"{$pin}\\\"\", pin).replace(\"\\\"{$enabled}\\\"\", enabled));\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusChangeRequest.method, \n requestBody, scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled;\n self.ctx.detectChanges();\n }\n );\n }\n \n scope.gpioCells = {};\n var rowCount = 0;\n for (i = 0; i < scope.gpioList.length; i++) {\n gpio = scope.gpioList[i];\n scope.gpioCells[gpio.row+'_'+gpio.col] = gpio;\n rowCount = Math.max(rowCount, gpio.row+1);\n }\n \n scope.prefferedRowHeight = 32;\n scope.rows = [];\n for (i = 0; i < rowCount; i++) {\n var row = [];\n for (var c =0; c<2;c++) {\n if (scope.gpioCells[i+'_'+c]) {\n row[c] = scope.gpioCells[i+'_'+c];\n } else {\n row[c] = null;\n }\n }\n scope.rows.push(row);\n }\n\n scope.gpioClick = function($event, gpio) {\n if (scope.rpcEnabled && !scope.executingRpcRequest) {\n changeGpioStatus(gpio);\n }\n };\n \n scope.gpioToggleChange = function($event, gpio) {\n gpio.enabled = !$event.checked;\n $event.source.toggle();\n self.ctx.detectChanges();\n }\n \n if (scope.rpcEnabled) {\n requestGpioStatus(); \n }\n \n self.onResize();\n}\n\nself.onResize = function() {\n var scope = self.ctx.$scope;\n var rowCount = scope.rows.length;\n var prefferedRowHeight = (self.ctx.height - 35)/rowCount;\n prefferedRowHeight = Math.min(32, prefferedRowHeight);\n prefferedRowHeight = Math.max(12, prefferedRowHeight);\n scope.prefferedRowHeight = prefferedRowHeight;\n var ratio = prefferedRowHeight/32;\n \n var css = '.mat-slide-toggle .mat-slide-toggle-bar {\\n' +\n ' height: ' + 14*ratio+'px;\\n'+\n ' width: ' + 36*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb-container {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-ripple {\\n' +\n ' height: ' + 40*ratio+'px;\\n'+\n ' width: ' + 40*ratio+'px;\\n'+\n ' top: calc(50% - '+20*ratio+'px);\\n'+\n ' left: calc(50% - '+20*ratio+'px);\\n'+\n '}\\n';\n css += '.gpio-left-label, .gpio-right-label {\\n' +\n ' font-size: ' + 16*ratio+'px;\\n'+\n '}\\n';\n var pinsFontSize = Math.max(9, 12*ratio);\n css += '.pin {\\n' +\n ' font-size: ' + pinsFontSize+'px;\\n'+\n '}\\n';\n\n cssParser.createStyleElement(namespace, css);\n \n self.ctx.detectChanges();\n}\n\nself.onDestroy = function() {\n}\n", + "controllerScript": "var namespace;\nvar cssParser = new cssjs();\n\nself.onInit = function() {\n var utils = self.ctx.$injector.get(self.ctx.servicesMap.get('utils'));\n namespace = 'gpio-control-' + utils.guid();\n cssParser.testMode = false;\n cssParser.cssPreviewNamespace = namespace;\n self.ctx.$container.addClass(namespace);\n self.ctx.ngZone.run(function() {\n init(); \n });\n}\n\nfunction init() {\n \n var i, gpio;\n var scope = self.ctx.$scope;\n var settings = self.ctx.settings;\n scope.gpioList = [];\n for (var g = 0; g < settings.gpioList.length; g++) {\n gpio = settings.gpioList[g];\n scope.gpioList.push(\n {\n row: gpio.row,\n col: gpio.col,\n pin: gpio.pin,\n label: gpio.label,\n enabled: false\n }\n );\n }\n\n scope.requestTimeout = settings.requestTimeout || 1000;\n\n scope.switchPanelBackgroundColor = settings.switchPanelBackgroundColor || tinycolor('green').lighten(2).toRgbString();\n\n scope.gpioStatusRequest = {\n method: \"getGpioStatus\",\n paramsBody: \"{}\"\n };\n \n if (settings.gpioStatusRequest) {\n scope.gpioStatusRequest.method = settings.gpioStatusRequest.method || scope.gpioStatusRequest.method;\n scope.gpioStatusRequest.paramsBody = settings.gpioStatusRequest.paramsBody || scope.gpioStatusRequest.paramsBody;\n }\n \n scope.gpioStatusChangeRequest = {\n method: \"setGpioStatus\",\n paramsBody: \"{\\n \\\"pin\\\": \\\"{$pin}\\\",\\n \\\"enabled\\\": \\\"{$enabled}\\\"\\n}\"\n };\n \n if (settings.gpioStatusChangeRequest) {\n scope.gpioStatusChangeRequest.method = settings.gpioStatusChangeRequest.method || scope.gpioStatusChangeRequest.method;\n scope.gpioStatusChangeRequest.paramsBody = settings.gpioStatusChangeRequest.paramsBody || scope.gpioStatusChangeRequest.paramsBody;\n }\n \n scope.parseGpioStatusFunction = \"return body[pin] === true;\";\n \n if (settings.parseGpioStatusFunction && settings.parseGpioStatusFunction.length > 0) {\n scope.parseGpioStatusFunction = settings.parseGpioStatusFunction;\n }\n \n scope.parseGpioStatusFunction = new Function(\"body, pin\", scope.parseGpioStatusFunction);\n \n function requestGpioStatus() {\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusRequest.method, \n scope.gpioStatusRequest.paramsBody, \n scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n for (var g = 0; g < scope.gpioList.length; g++) {\n var gpio = scope.gpioList[g];\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled; \n self.ctx.detectChanges();\n }\n }\n );\n }\n \n function changeGpioStatus(gpio) {\n var pin = gpio.pin + '';\n var enabled = !gpio.enabled;\n enabled = enabled === true ? 'true' : 'false';\n var paramsBody = scope.gpioStatusChangeRequest.paramsBody;\n var requestBody = JSON.parse(paramsBody.replace(\"\\\"{$pin}\\\"\", pin).replace(\"\\\"{$enabled}\\\"\", enabled));\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusChangeRequest.method, \n requestBody, scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled;\n self.ctx.detectChanges();\n }\n );\n }\n \n scope.gpioCells = {};\n var rowCount = 0;\n for (i = 0; i < scope.gpioList.length; i++) {\n gpio = scope.gpioList[i];\n scope.gpioCells[gpio.row+'_'+gpio.col] = gpio;\n rowCount = Math.max(rowCount, gpio.row+1);\n }\n \n scope.prefferedRowHeight = 32;\n scope.rows = [];\n for (i = 0; i < rowCount; i++) {\n var row = [];\n for (var c =0; c<2;c++) {\n if (scope.gpioCells[i+'_'+c]) {\n row[c] = scope.gpioCells[i+'_'+c];\n } else {\n row[c] = null;\n }\n }\n scope.rows.push(row);\n }\n\n scope.gpioClick = function($event, gpio) {\n if (scope.rpcEnabled && !scope.executingRpcRequest) {\n changeGpioStatus(gpio);\n }\n };\n \n scope.rpcErrorMessage = function() {\n return scope.rpcErrorText ? scope.rpcErrorText.replace(/<\\/?br\\s*\\/?>/gi, '. ') : '';\n };\n \n scope.gpioToggleChange = function($event, gpio) {\n gpio.enabled = !$event.checked;\n $event.source.toggle();\n self.ctx.detectChanges();\n }\n \n if (scope.rpcEnabled) {\n requestGpioStatus(); \n }\n \n self.onResize();\n}\n\nself.onResize = function() {\n var scope = self.ctx.$scope;\n var rowCount = scope.rows.length;\n var prefferedRowHeight = (self.ctx.height - 35)/rowCount;\n prefferedRowHeight = Math.min(32, prefferedRowHeight);\n prefferedRowHeight = Math.max(12, prefferedRowHeight);\n scope.prefferedRowHeight = prefferedRowHeight;\n var ratio = prefferedRowHeight/32;\n \n var css = '.mat-slide-toggle .mat-slide-toggle-bar {\\n' +\n ' height: ' + 14*ratio+'px;\\n'+\n ' width: ' + 36*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb-container {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-ripple {\\n' +\n ' height: ' + 40*ratio+'px;\\n'+\n ' width: ' + 40*ratio+'px;\\n'+\n ' top: calc(50% - '+20*ratio+'px);\\n'+\n ' left: calc(50% - '+20*ratio+'px);\\n'+\n '}\\n';\n css += '.gpio-left-label, .gpio-right-label {\\n' +\n ' font-size: ' + 16*ratio+'px;\\n'+\n '}\\n';\n var pinsFontSize = Math.max(9, 12*ratio);\n css += '.pin {\\n' +\n ' font-size: ' + pinsFontSize+'px;\\n'+\n '}\\n';\n\n cssParser.createStyleElement(namespace, css);\n \n self.ctx.detectChanges();\n}\n\nself.onDestroy = function() {\n}\n\nself.typeParameters = function() {\n return {\n displayRpcMessageToast: false\n };\n}\n", "settingsSchema": "", "dataKeySettingsSchema": "{}\n", "settingsDirective": "tb-gpio-control-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/led_indicator.json b/application/src/main/data/json/system/widget_types/led_indicator.json index 88e845b646..c00a6032ba 100644 --- a/application/src/main/data/json/system/widget_types/led_indicator.json +++ b/application/src/main/data/json/system/widget_types/led_indicator.json @@ -11,7 +11,7 @@ "resources": [], "templateHtml": "", "templateCss": "", - "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n", + "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n\nself.typeParameters = function() {\n return {\n displayRpcMessageToast: false\n };\n}\n", "dataKeySettingsSchema": "{}\n", "settingsDirective": "tb-led-indicator-widget-settings", "defaultConfig": "{\"targetDeviceAliases\":[],\"showTitle\":false,\"backgroundColor\":\"#e6e7e8\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"requestTimeout\":500,\"initialValue\":false,\"title\":\"Led indicator\",\"ledColor\":\"#4caf50\",\"valueAttribute\":\"value\",\"retrieveValueMethod\":\"attribute\",\"parseValueFunction\":\"return data ? true : false;\",\"performCheckStatus\":true,\"checkStatusMethod\":\"checkStatus\"},\"title\":\"Led indicator\",\"dropShadow\":true,\"enableFullscreen\":false,\"widgetStyle\":{},\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"showLegend\":false,\"actions\":{},\"decimals\":2}" diff --git a/application/src/main/data/json/system/widget_types/raspberry_pi_gpio_control.json b/application/src/main/data/json/system/widget_types/raspberry_pi_gpio_control.json index 5312c55b7f..d5315e4868 100644 --- a/application/src/main/data/json/system/widget_types/raspberry_pi_gpio_control.json +++ b/application/src/main/data/json/system/widget_types/raspberry_pi_gpio_control.json @@ -9,9 +9,9 @@ "sizeX": 6, "sizeY": 10.5, "resources": [], - "templateHtml": "
\n
\n
\n
\n {{ cell.label }}\n
\n {{cell.pin}}\n \n \n \n \n {{cell.pin}}\n
\n {{ cell.label }}\n
\n
\n \n \n \n
\n
\n
\n {{rpcErrorText}}\n \n
", + "templateHtml": "
\n
\n
\n
\n {{ cell.label }}\n
\n {{cell.pin}}\n \n \n \n \n {{cell.pin}}\n
\n {{ cell.label }}\n
\n
\n \n \n \n
\n
\n
\n {{ rpcErrorMessage() }}\n \n
", "templateCss": ".error {\n font-size: 14px !important;\n color: maroon;/*rgb(250,250,250);*/\n background-color: transparent;\n padding: 6px;\n}\n\n.error span {\n margin: auto;\n}\n\n.gpio-panel {\n padding-top: 10px;\n white-space: nowrap;\n}\n\n.gpio-panel section.flex-1 {\n min-width: 0px;\n}\n\n\n.switch-panel {\n margin: 0;\n height: 32px;\n width: 66px;\n min-width: 66px;\n}\n\n.switch-panel mat-slide-toggle {\n margin: 0;\n width: 36px;\n min-width: 36px;\n}\n\n.switch-panel.col-0 mat-slide-toggle {\n margin-left: 8px;\n margin-right: 4px;\n}\n\n.switch-panel.col-1 mat-slide-toggle {\n margin-left: 4px;\n margin-right: 8px;\n}\n\n.gpio-row {\n height: 32px;\n}\n\n.pin {\n margin-top: auto;\n margin-bottom: auto;\n color: white;\n font-size: 12px;\n width: 16px;\n min-width: 16px;\n}\n\n.switch-panel.col-0 .pin {\n margin-left: auto;\n padding-left: 2px;\n text-align: right;\n}\n\n.switch-panel.col-1 .pin {\n margin-right: auto;\n\n text-align: left;\n}\n\n.gpio-left-label {\n margin-right: 8px;\n}\n\n.gpio-right-label {\n margin-left: 8px;\n}", - "controllerScript": "var namespace;\nvar cssParser = new cssjs();\n\nself.onInit = function() {\n var utils = self.ctx.$injector.get(self.ctx.servicesMap.get('utils'));\n namespace = 'gpio-control-' + utils.guid();\n cssParser.testMode = false;\n cssParser.cssPreviewNamespace = namespace;\n self.ctx.$container.addClass(namespace);\n self.ctx.ngZone.run(function() {\n init(); \n });\n}\n\nfunction init() {\n \n var i, gpio;\n var scope = self.ctx.$scope;\n var settings = self.ctx.settings;\n scope.gpioList = [];\n for (var g = 0; g < settings.gpioList.length; g++) {\n gpio = settings.gpioList[g];\n scope.gpioList.push(\n {\n row: gpio.row,\n col: gpio.col,\n pin: gpio.pin,\n label: gpio.label,\n enabled: false\n }\n );\n }\n\n scope.requestTimeout = settings.requestTimeout || 1000;\n\n scope.switchPanelBackgroundColor = settings.switchPanelBackgroundColor || tinycolor('green').lighten(2).toRgbString();\n\n scope.gpioStatusRequest = {\n method: \"getGpioStatus\",\n paramsBody: \"{}\"\n };\n \n if (settings.gpioStatusRequest) {\n scope.gpioStatusRequest.method = settings.gpioStatusRequest.method || scope.gpioStatusRequest.method;\n scope.gpioStatusRequest.paramsBody = settings.gpioStatusRequest.paramsBody || scope.gpioStatusRequest.paramsBody;\n }\n \n scope.gpioStatusChangeRequest = {\n method: \"setGpioStatus\",\n paramsBody: \"{\\n \\\"pin\\\": \\\"{$pin}\\\",\\n \\\"enabled\\\": \\\"{$enabled}\\\"\\n}\"\n };\n \n if (settings.gpioStatusChangeRequest) {\n scope.gpioStatusChangeRequest.method = settings.gpioStatusChangeRequest.method || scope.gpioStatusChangeRequest.method;\n scope.gpioStatusChangeRequest.paramsBody = settings.gpioStatusChangeRequest.paramsBody || scope.gpioStatusChangeRequest.paramsBody;\n }\n \n scope.parseGpioStatusFunction = \"return body[pin] === true;\";\n \n if (settings.parseGpioStatusFunction && settings.parseGpioStatusFunction.length > 0) {\n scope.parseGpioStatusFunction = settings.parseGpioStatusFunction;\n }\n \n scope.parseGpioStatusFunction = new Function(\"body, pin\", scope.parseGpioStatusFunction);\n \n function requestGpioStatus() {\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusRequest.method, \n scope.gpioStatusRequest.paramsBody, \n scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n for (var g = 0; g < scope.gpioList.length; g++) {\n var gpio = scope.gpioList[g];\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled; \n self.ctx.detectChanges();\n }\n }\n );\n }\n \n function changeGpioStatus(gpio) {\n var pin = gpio.pin + '';\n var enabled = !gpio.enabled;\n enabled = enabled === true ? 'true' : 'false';\n var paramsBody = scope.gpioStatusChangeRequest.paramsBody;\n var requestBody = JSON.parse(paramsBody.replace(\"\\\"{$pin}\\\"\", pin).replace(\"\\\"{$enabled}\\\"\", enabled));\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusChangeRequest.method, \n requestBody, scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled;\n self.ctx.detectChanges();\n }\n );\n }\n \n scope.gpioCells = {};\n var rowCount = 0;\n for (i = 0; i < scope.gpioList.length; i++) {\n gpio = scope.gpioList[i];\n scope.gpioCells[gpio.row+'_'+gpio.col] = gpio;\n rowCount = Math.max(rowCount, gpio.row+1);\n }\n \n scope.prefferedRowHeight = 32;\n scope.rows = [];\n for (i = 0; i < rowCount; i++) {\n var row = [];\n for (var c =0; c<2;c++) {\n if (scope.gpioCells[i+'_'+c]) {\n row[c] = scope.gpioCells[i+'_'+c];\n } else {\n row[c] = null;\n }\n }\n scope.rows.push(row);\n }\n\n scope.gpioClick = function($event, gpio) {\n if (scope.rpcEnabled && !scope.executingRpcRequest) {\n changeGpioStatus(gpio);\n }\n };\n \n scope.gpioToggleChange = function($event, gpio) {\n gpio.enabled = !$event.checked;\n $event.source.toggle();\n self.ctx.detectChanges();\n }\n \n if (scope.rpcEnabled) {\n requestGpioStatus(); \n }\n \n self.onResize();\n}\n\nself.onResize = function() {\n var scope = self.ctx.$scope;\n var rowCount = scope.rows.length;\n var prefferedRowHeight = (self.ctx.height - 35)/rowCount;\n prefferedRowHeight = Math.min(32, prefferedRowHeight);\n prefferedRowHeight = Math.max(12, prefferedRowHeight);\n scope.prefferedRowHeight = prefferedRowHeight;\n var ratio = prefferedRowHeight/32;\n \n var css = '.mat-slide-toggle .mat-slide-toggle-bar {\\n' +\n ' height: ' + 14*ratio+'px;\\n'+\n ' width: ' + 36*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb-container {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-ripple {\\n' +\n ' height: ' + 40*ratio+'px;\\n'+\n ' width: ' + 40*ratio+'px;\\n'+\n ' top: calc(50% - '+20*ratio+'px);\\n'+\n ' left: calc(50% - '+20*ratio+'px);\\n'+\n '}\\n';\n css += '.gpio-left-label, .gpio-right-label {\\n' +\n ' font-size: ' + 16*ratio+'px;\\n'+\n '}\\n';\n var pinsFontSize = Math.max(9, 12*ratio);\n css += '.pin {\\n' +\n ' font-size: ' + pinsFontSize+'px;\\n'+\n '}\\n';\n\n cssParser.createStyleElement(namespace, css);\n \n self.ctx.detectChanges();\n}\n\nself.onDestroy = function() {\n}\n", + "controllerScript": "var namespace;\nvar cssParser = new cssjs();\n\nself.onInit = function() {\n var utils = self.ctx.$injector.get(self.ctx.servicesMap.get('utils'));\n namespace = 'gpio-control-' + utils.guid();\n cssParser.testMode = false;\n cssParser.cssPreviewNamespace = namespace;\n self.ctx.$container.addClass(namespace);\n self.ctx.ngZone.run(function() {\n init(); \n });\n}\n\nfunction init() {\n \n var i, gpio;\n var scope = self.ctx.$scope;\n var settings = self.ctx.settings;\n scope.gpioList = [];\n for (var g = 0; g < settings.gpioList.length; g++) {\n gpio = settings.gpioList[g];\n scope.gpioList.push(\n {\n row: gpio.row,\n col: gpio.col,\n pin: gpio.pin,\n label: gpio.label,\n enabled: false\n }\n );\n }\n\n scope.requestTimeout = settings.requestTimeout || 1000;\n\n scope.switchPanelBackgroundColor = settings.switchPanelBackgroundColor || tinycolor('green').lighten(2).toRgbString();\n\n scope.gpioStatusRequest = {\n method: \"getGpioStatus\",\n paramsBody: \"{}\"\n };\n \n if (settings.gpioStatusRequest) {\n scope.gpioStatusRequest.method = settings.gpioStatusRequest.method || scope.gpioStatusRequest.method;\n scope.gpioStatusRequest.paramsBody = settings.gpioStatusRequest.paramsBody || scope.gpioStatusRequest.paramsBody;\n }\n \n scope.gpioStatusChangeRequest = {\n method: \"setGpioStatus\",\n paramsBody: \"{\\n \\\"pin\\\": \\\"{$pin}\\\",\\n \\\"enabled\\\": \\\"{$enabled}\\\"\\n}\"\n };\n \n if (settings.gpioStatusChangeRequest) {\n scope.gpioStatusChangeRequest.method = settings.gpioStatusChangeRequest.method || scope.gpioStatusChangeRequest.method;\n scope.gpioStatusChangeRequest.paramsBody = settings.gpioStatusChangeRequest.paramsBody || scope.gpioStatusChangeRequest.paramsBody;\n }\n \n scope.parseGpioStatusFunction = \"return body[pin] === true;\";\n \n if (settings.parseGpioStatusFunction && settings.parseGpioStatusFunction.length > 0) {\n scope.parseGpioStatusFunction = settings.parseGpioStatusFunction;\n }\n \n scope.parseGpioStatusFunction = new Function(\"body, pin\", scope.parseGpioStatusFunction);\n \n function requestGpioStatus() {\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusRequest.method, \n scope.gpioStatusRequest.paramsBody, \n scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n for (var g = 0; g < scope.gpioList.length; g++) {\n var gpio = scope.gpioList[g];\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled; \n self.ctx.detectChanges();\n }\n }\n );\n }\n \n function changeGpioStatus(gpio) {\n var pin = gpio.pin + '';\n var enabled = !gpio.enabled;\n enabled = enabled === true ? 'true' : 'false';\n var paramsBody = scope.gpioStatusChangeRequest.paramsBody;\n var requestBody = JSON.parse(paramsBody.replace(\"\\\"{$pin}\\\"\", pin).replace(\"\\\"{$enabled}\\\"\", enabled));\n self.ctx.controlApi.sendTwoWayCommand(scope.gpioStatusChangeRequest.method, \n requestBody, scope.requestTimeout)\n .subscribe(\n function success(responseBody) {\n var enabled = scope.parseGpioStatusFunction.apply(this, [responseBody, gpio.pin]);\n gpio.enabled = enabled;\n self.ctx.detectChanges();\n }\n );\n }\n \n scope.gpioCells = {};\n var rowCount = 0;\n for (i = 0; i < scope.gpioList.length; i++) {\n gpio = scope.gpioList[i];\n scope.gpioCells[gpio.row+'_'+gpio.col] = gpio;\n rowCount = Math.max(rowCount, gpio.row+1);\n }\n \n scope.prefferedRowHeight = 32;\n scope.rows = [];\n for (i = 0; i < rowCount; i++) {\n var row = [];\n for (var c =0; c<2;c++) {\n if (scope.gpioCells[i+'_'+c]) {\n row[c] = scope.gpioCells[i+'_'+c];\n } else {\n row[c] = null;\n }\n }\n scope.rows.push(row);\n }\n\n scope.gpioClick = function($event, gpio) {\n if (scope.rpcEnabled && !scope.executingRpcRequest) {\n changeGpioStatus(gpio);\n }\n };\n \n scope.rpcErrorMessage = function() {\n return scope.rpcErrorText ? scope.rpcErrorText.replace(/<\\/?br\\s*\\/?>/gi, '. ') : '';\n };\n \n scope.gpioToggleChange = function($event, gpio) {\n gpio.enabled = !$event.checked;\n $event.source.toggle();\n self.ctx.detectChanges();\n }\n \n if (scope.rpcEnabled) {\n requestGpioStatus(); \n }\n \n self.onResize();\n}\n\nself.onResize = function() {\n var scope = self.ctx.$scope;\n var rowCount = scope.rows.length;\n var prefferedRowHeight = (self.ctx.height - 35)/rowCount;\n prefferedRowHeight = Math.min(32, prefferedRowHeight);\n prefferedRowHeight = Math.max(12, prefferedRowHeight);\n scope.prefferedRowHeight = prefferedRowHeight;\n var ratio = prefferedRowHeight/32;\n \n var css = '.mat-slide-toggle .mat-slide-toggle-bar {\\n' +\n ' height: ' + 14*ratio+'px;\\n'+\n ' width: ' + 36*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb-container {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-thumb {\\n' +\n ' height: ' + 20*ratio+'px;\\n'+\n ' width: ' + 20*ratio+'px;\\n'+\n '}\\n';\n css += '.mat-slide-toggle .mat-slide-toggle-ripple {\\n' +\n ' height: ' + 40*ratio+'px;\\n'+\n ' width: ' + 40*ratio+'px;\\n'+\n ' top: calc(50% - '+20*ratio+'px);\\n'+\n ' left: calc(50% - '+20*ratio+'px);\\n'+\n '}\\n';\n css += '.gpio-left-label, .gpio-right-label {\\n' +\n ' font-size: ' + 16*ratio+'px;\\n'+\n '}\\n';\n var pinsFontSize = Math.max(9, 12*ratio);\n css += '.pin {\\n' +\n ' font-size: ' + pinsFontSize+'px;\\n'+\n '}\\n';\n\n cssParser.createStyleElement(namespace, css);\n \n self.ctx.detectChanges();\n}\n\nself.onDestroy = function() {\n}\n\nself.typeParameters = function() {\n return {\n displayRpcMessageToast: false\n };\n}\n", "settingsSchema": "", "dataKeySettingsSchema": "{}\n", "settingsDirective": "tb-gpio-control-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/round_switch.json b/application/src/main/data/json/system/widget_types/round_switch.json index bb826771ff..cad0f8ec3c 100644 --- a/application/src/main/data/json/system/widget_types/round_switch.json +++ b/application/src/main/data/json/system/widget_types/round_switch.json @@ -11,7 +11,7 @@ "resources": [], "templateHtml": "", "templateCss": "", - "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n", + "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n\nself.typeParameters = function() {\n return {\n displayRpcMessageToast: false\n };\n}\n", "dataKeySettingsSchema": "{}\n", "settingsDirective": "tb-round-switch-widget-settings", "defaultConfig": "{\"targetDeviceAliases\":[],\"showTitle\":false,\"backgroundColor\":\"#e6e7e8\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"requestTimeout\":500,\"initialValue\":false,\"getValueMethod\":\"getValue\",\"setValueMethod\":\"setValue\",\"title\":\"Round switch\",\"retrieveValueMethod\":\"rpc\",\"valueKey\":\"value\",\"parseValueFunction\":\"return data ? true : false;\",\"convertValueFunction\":\"return value;\"},\"title\":\"Round switch\",\"dropShadow\":true,\"enableFullscreen\":false,\"widgetStyle\":{},\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"showLegend\":false,\"actions\":{},\"decimals\":2}" diff --git a/application/src/main/data/json/system/widget_types/slide_toggle_control.json b/application/src/main/data/json/system/widget_types/slide_toggle_control.json index b614af2aeb..9fabfc39d0 100644 --- a/application/src/main/data/json/system/widget_types/slide_toggle_control.json +++ b/application/src/main/data/json/system/widget_types/slide_toggle_control.json @@ -11,7 +11,7 @@ "resources": [], "templateHtml": "", "templateCss": "", - "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n", + "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n\nself.typeParameters = function() {\n return {\n displayRpcMessageToast: false\n };\n}\n", "dataKeySettingsSchema": "{}\n", "settingsDirective": "tb-slide-toggle-widget-settings", "defaultConfig": "{\"targetDeviceAliases\":[],\"showTitle\":false,\"backgroundColor\":\"#ffffff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"requestTimeout\":500,\"initialValue\":false,\"getValueMethod\":\"getValue\",\"setValueMethod\":\"setValue\",\"title\":\"Slide toggle control\",\"retrieveValueMethod\":\"rpc\",\"valueKey\":\"value\",\"parseValueFunction\":\"return data ? true : false;\",\"convertValueFunction\":\"return value;\",\"requestPersistent\":false,\"labelPosition\":\"after\",\"sliderColor\":\"accent\"},\"title\":\"Slide Toggle Control\",\"dropShadow\":true,\"enableFullscreen\":false,\"widgetStyle\":{},\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"showLegend\":false,\"actions\":{},\"decimals\":2,\"widgetCss\":\"\",\"noDataDisplayMessage\":\"\"}" diff --git a/application/src/main/data/json/system/widget_types/switch_control.json b/application/src/main/data/json/system/widget_types/switch_control.json index 6cc7e7c7eb..fe42b8cb8f 100644 --- a/application/src/main/data/json/system/widget_types/switch_control.json +++ b/application/src/main/data/json/system/widget_types/switch_control.json @@ -11,7 +11,7 @@ "resources": [], "templateHtml": "", "templateCss": "", - "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n", + "controllerScript": "self.onInit = function() {\n}\n\nself.onResize = function() {\n}\n\nself.onDestroy = function() {\n}\n\nself.typeParameters = function() {\n return {\n displayRpcMessageToast: false\n };\n}\n", "dataKeySettingsSchema": "{}\n", "settingsDirective": "tb-switch-control-widget-settings", "defaultConfig": "{\"targetDeviceAliases\":[],\"showTitle\":false,\"backgroundColor\":\"#e6e7e8\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"requestTimeout\":500,\"initialValue\":false,\"getValueMethod\":\"getValue\",\"setValueMethod\":\"setValue\",\"showOnOffLabels\":true,\"title\":\"Switch control\"},\"title\":\"Switch Control\",\"dropShadow\":true,\"enableFullscreen\":false,\"widgetStyle\":{},\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"showLegend\":false,\"actions\":{},\"decimals\":2}" diff --git a/application/src/main/data/resources/js_extensions/gateway-management-extension.js b/application/src/main/data/resources/js_extensions/gateway-management-extension.js index 2b5e43a4aa..d86f6a9abc 100644 --- a/application/src/main/data/resources/js_extensions/gateway-management-extension.js +++ b/application/src/main/data/resources/js_extensions/gateway-management-extension.js @@ -1,10 +1,4 @@ -System.register(["@angular/core","@angular/material/sort","@angular/material/table","@angular/material/paginator","@shared/public-api","@core/public-api","@angular/common","@ngx-translate/core","@angular/forms","rxjs","rxjs/operators","@angular/material/dialog","tslib","@angular/material/tooltip","@angular/cdk/collections","@ngrx/store","@angular/router","@home/components/public-api","@angular/platform-browser","@home/components/widget/widget.component","@shared/components/dialog/json-object-edit-dialog.component","@shared/import-export/import-export.service","@shared/components/popover.component","@shared/components/popover.service","@shared/decorators/coercion","@angular/material/core"],(function(e){"use strict";var t,n,i,a,r,o,s,l,p,c,d,u,m,h,g,f,y,v,x,b,w,S,C,_,T,E,I,M,k,P,D,A,O,R,B,F,N,L,V,q,G,z,U,j,H,W,$,K,Y,X,Z,Q,J,ee,te,ne,ie,ae,re,oe,se,le,pe,ce,de,ue,me,he,ge,fe,ye,ve,xe,be,we,Se,Ce,_e,Te,Ee,Ie,Me,ke,Pe,De,Ae,Oe,Re,Be,Fe,Ne,Le,Ve,qe,Ge,ze,Ue,je,He,We,$e,Ke,Ye,Xe,Ze,Qe,Je,et,tt,nt,it,at,rt,ot,st,lt,pt,ct,dt,ut,mt;return{setters:[function(e){t=e,n=e.assertInInjectionContext,i=e.inject,a=e.DestroyRef,e.ɵRuntimeError,e.ɵgetOutputDestroyRef,r=e.Injector,o=e.effect,s=e.untracked,e.assertNotInReactiveContext,e.signal,e.computed,l=e.input,p=e.output,c=e.forwardRef,d=e.ChangeDetectionStrategy,u=e.EventEmitter,m=e.booleanAttribute,h=e.ChangeDetectorRef,g=e.SecurityContext,f=e.KeyValueDiffers,y=e.ɵNG_COMP_DEF},function(e){v=e.MatSort},function(e){x=e.MatTableDataSource},function(e){b=e.MatPaginator},function(e){w=e.helpBaseUrl,S=e.Direction,C=e.PageLink,_=e.DataKeyType,T=e.SharedModule,E=e,I=e.coerceBoolean,M=e.emptyPageData,k=e.isClientSideTelemetryType,P=e.TelemetrySubscriber,D=e.coerceNumber,A=e.AttributeScope,O=e.DialogComponent,R=e.defaultLegendConfig,B=e.widgetType,F=e.NULL_UUID,N=e.DatasourceType,L=e.EntityType,V=e.AliasFilterType,q=e.createDefaultEntityDataPageLink,G=e.EntityKeyType,z=e.EntityKeyValueType,U=e.FilterPredicateType,j=e.StringOperation,H=e.ContentType,W=e.PageComponent,$=e.TbTableDatasource,K=e.HOUR,Y=e.DeviceCredentialsType},function(e){X=e.mergeDeep,Z=e.isLiteralObject,Q=e.isEqual,J=e.WINDOW,ee=e,te=e.deleteNullProperties,ne=e.DialogService,ie=e.isNumber,ae=e.isString,re=e.isDefinedAndNotNull,oe=e.formatValue,se=e.deepClone,le=e.isObject,pe=e.generateSecret,ce=e.camelCase,de=e.isUndefinedOrNull,ue=e.deepTrim},function(e){me=e.CommonModule},function(e){he=e,ge=e.TranslateService,fe=e.TranslateModule},function(e){ye=e,ve=e.NG_VALUE_ACCESSOR,xe=e.Validators,be=e.NG_VALIDATORS,we=e.FormBuilder,Se=e.FormControl},function(e){Ce=e.Observable,_e=e.ReplaySubject,Te=e.shareReplay,Ee=e.combineLatest,Ie=e.Subject,Me=e.fromEvent,ke=e.BehaviorSubject,Pe=e.of,De=e.zip,Ae=e.forkJoin,Oe=e.merge},function(e){Re=e.takeUntil,Be=e.map,Fe=e.distinctUntilChanged,Ne=e.debounceTime,Le=e.filter,Ve=e.tap,qe=e.catchError,Ge=e.publishReplay,ze=e.refCount,Ue=e.take,je=e.takeWhile,He=e.switchMap,We=e.startWith,$e=e.mergeMap},function(e){Ke=e.MatDialog,Ye=e.MAT_DIALOG_DATA,Xe=e},function(e){Ze=e.__decorate,Qe=e.__extends},function(e){Je=e,et=e.MatTooltip},function(e){tt=e.SelectionModel},function(e){nt=e},function(e){it=e},function(e){at=e.calculateAxisSize,rt=e.measureAxisNameSize},function(e){ot=e},function(e){st=e},function(e){lt=e.JsonObjectEditDialogComponent},function(e){pt=e},function(e){ct=e},function(e){dt=e},function(e){ut=e.coerceBoolean},function(e){mt=e.ErrorStateMatcher}],execute:function(){e("getDefaultConfig",an);const ht=e("jsonRequired",(e=>e.value?null:{required:!0}));var gt,ft,yt;e("GatewayLogLevel",gt),function(e){e.NONE="NONE",e.CRITICAL="CRITICAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e.DEBUG="DEBUG",e.TRACE="TRACE"}(gt||e("GatewayLogLevel",gt={})),e("GatewayVersion",ft),function(e){e.v3_8_5="3.8.5",e.v3_7_3="3.7.3",e.v3_7_2="3.7.2",e.v3_7_0="3.7",e.v3_6_3="3.6.3",e.v3_6_2="3.6.2",e.v3_6_0="3.6",e.v3_5_2="3.5.2",e.Legacy="legacy"}(ft||e("GatewayVersion",ft={})),e("ConnectorType",yt),function(e){e.MQTT="mqtt",e.MODBUS="modbus",e.GRPC="grpc",e.OPCUA="opcua",e.BLE="ble",e.REQUEST="request",e.CAN="can",e.BACNET="bacnet",e.ODBC="odbc",e.REST="rest",e.SNMP="snmp",e.FTP="ftp",e.SOCKET="socket",e.XMPP="xmpp",e.OCPP="ocpp",e.CUSTOM="custom",e.KNX="knx",e.S7="s7"}(yt||e("ConnectorType",yt={}));const vt=e("GatewayConnectorDefaultTypesTranslatesMap",new Map([[yt.MQTT,"MQTT"],[yt.MODBUS,"MODBUS"],[yt.GRPC,"GRPC"],[yt.OPCUA,"OPCUA"],[yt.BLE,"BLE"],[yt.REQUEST,"REQUEST"],[yt.CAN,"CAN"],[yt.BACNET,"BACNET"],[yt.ODBC,"ODBC"],[yt.REST,"REST"],[yt.SNMP,"SNMP"],[yt.FTP,"FTP"],[yt.SOCKET,"SOCKET"],[yt.XMPP,"XMPP"],[yt.OCPP,"OCPP"],[yt.CUSTOM,"CUSTOM"],[yt.KNX,"KNX"],[yt.S7,"S7"]])),xt=e("GatewayConnectorHelpLinksMap",new Map([[yt.MQTT,`${w}/docs/iot-gateway/config/mqtt/`],[yt.MODBUS,`${w}/docs/iot-gateway/config/modbus/`],[yt.OPCUA,`${w}/docs/iot-gateway/config/opc-ua/`],[yt.BLE,`${w}/docs/iot-gateway/config/ble/`],[yt.REQUEST,`${w}/docs/iot-gateway/config/request/`],[yt.CAN,`${w}/docs/iot-gateway/config/can/`],[yt.BACNET,`${w}/docs/iot-gateway/config/bacnet/`],[yt.ODBC,`${w}/docs/iot-gateway/config/odbc/`],[yt.REST,`${w}/docs/iot-gateway/config/rest/`],[yt.SNMP,`${w}/docs/iot-gateway/config/snmp/`],[yt.FTP,`${w}/docs/iot-gateway/config/ftp/`],[yt.SOCKET,`${w}/docs/iot-gateway/config/socket/`],[yt.XMPP,`${w}/docs/iot-gateway/config/xmpp/`],[yt.OCPP,`${w}/docs/iot-gateway/config/ocpp/`],[yt.KNX,`${w}/docs/iot-gateway/config/knx/`],[yt.S7,`${w}/docs/iot-gateway/config/s7/`]])),bt=e("ConnectorsTypesByVersion",new Map([[ft.v3_8_5,Object.values(yt)],[ft.v3_7_0,Object.values(yt).filter((e=>e!==yt.S7))],[ft.Legacy,Object.values(yt).filter((e=>![yt.KNX,yt.S7].includes(e)))]]));var wt,St;e("SocketEncoding",wt),function(e){e.UTF8="utf-8",e.HEX="hex",e.UTF16="utf-16",e.UTF32="utf-32",e.UTF16BE="utf-16-be",e.UTF16LE="utf-16-le",e.UTF32BE="utf-32-be",e.UTF32LE="utf-32-le"}(wt||e("SocketEncoding",wt={})),e("HTTPMethods",St),function(e){e.DELETE="DELETE",e.GET="GET",e.HEAD="HEAD",e.OPTIONS="OPTIONS",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT"}(St||e("HTTPMethods",St={}));var Ct,_t={gateway:{active:"Active",address:"Address","address-required":"Address required","add-entry":"Add configuration","add-attribute":"Add attribute","add-attribute-update":"Add attribute update","add-attribute-request":"Add attribute request","add-key":"Add key","add-timeseries":"Add time series","add-mapping":"Add mapping","add-slave":"Add Slave",arguments:"Arguments","add-rpc-method":"Add method","add-rpc-request":"Add request","add-value":"Add argument","advanced-settings":"Advanced settings",application:"Application",bacnet:{"device-timeout":"Discovery timeout","network-number":"Network number","alt-responses-address":"Alternative responses address","apdu-length":"APDU Length","object-name":"Object Name","object-type":{"analog-input":"Analog Input","analog-output":"Analog Output","analog-value":"Analog Value","binary-input":"Binary Input","binary-output":"Binary Output","binary-value":"Binary Value"},"request-type":{label:"Request Type",write:"Write Property",read:"Read Property"},"property-id":{"present-value":"Present Value","status-flags":"Status Flags","cov-increment":"COV Increment","event-state":"Event State","out-of-service":"Out of Service",polarity:"Polarity","priority-array":"Priority Array","relinquish-default":"Relinquish Default","current-command-priority":"Current Command Priority","event-message-texts":"Event Message Texts","event-message-texts-config":"Event Message Texts Config","event-algorithm-inhibit-reference":"Event Algorithm Inhibit Reference","time-delay-normal":"Time Delay Normal"},segmentation:{label:"Segmentation",no:"None",both:"Both",transmit:"Transmit",receive:"Receive"}},baudrate:"Baudrate","buffer-size":"Buffer size","buffer-size-required":"Buffer size is required","buffer-size-range":"Buffer size should be greater than 0",bytesize:"Bytesize",boolean:"Boolean",bit:"Bit","bit-target-type":"Bit target type","delete-value":"Delete value","delete-argument":"Delete argument","delete-rpc-method":"Delete method","delete-rpc-request":"Delete request","delete-attribute-update":"Delete attribute update","delete-attribute-request":"Delete attribute request",advanced:"Advanced","add-device":"Add device","address-filter":"Address filter","address-filter-required":"Address filter is required","advanced-connection-settings":"Advanced connection settings","advanced-configuration-settings":"Advanced configuration settings",attributes:"Attributes","attribute-updates":"Attribute updates","attribute-on-platform":"Attribute on platform","attribute-requests":"Attribute requests","attribute-filter":"Attribute filter","attribute-filter-hint":"Filter for incoming attribute name from platform, supports regular expression.","attribute-filter-required":"Attribute filter required.","attribute-name-expression":"Attribute name expression","attribute-name-expression-required":"Attribute name expression required.","attribute-name-expression-hint":"Hint for Attribute name expression",basic:"Basic","byte-order":"Byte order","word-order":"Word order",broker:{connection:"Connection to broker",name:"Broker name","name-required":"Broker name required.","security-types":{anonymous:"Anonymous",basic:"Basic",certificates:"Certificates"}},certificate:"Certificate","CA-certificate-path":"Path to CA certificate file","path-to-CA-cert-required":"Path to CA certificate file is required.","change-connector-title":"Confirm connector change","change-connector-text":"Switching connectors will discard any unsaved changes. Continue?","checking-device-activity":"Checking device activity",command:"Docker commands","command-copied-message":"Docker command has been copied to clipboard",configuration:"Configuration","add-connector":"Add connector","delete-connector":"Delete connector","connector-add":"Add new connector","connector-enabled":"Enable connector","connector-name":"Connector name",connector:"Connector",converter:"Converter","connector-name-required":"Connector name is required.","connector-type":"Connector type","connector-type-required":"Connector type is required.",connectors:"Connectors","connectors-config":"Connectors configuration","connectors-table-enabled":"Enabled","connectors-table-name":"Name","connectors-table-type":"Type","connectors-table-status":"Status","connectors-table-actions":"Actions","connectors-table-key":"Key","connectors-table-class":"Class","connection-timeout":"Connection timeout (s)","connect-attempt-time":"Connect attempt time (ms)","connect-attempt-count":"Connect attempt count","copy-username":"Copy username","copy-password":"Copy password","copy-client-id":"Copy client ID","connector-created":"Connector created","connector-updated":"Connector updated","create-new-one":"Create new one!","rpc-command-save-template":"Save Template","rpc-command-send":"Send","rpc-command-result":"Response","rpc-command-edit-params":"Edit parameters","gateway-configuration":"General Configuration","docker-label":"Use the following instruction to run IoT Gateway in Docker compose with credentials for selected device","install-docker-compose":"Use the instructions to download, install and setup docker compose",integer:"Integer",inactive:"Inactive",device:"Device",devices:"Devices","device-profile":"Device profile","device-info-settings":"Device info settings","device-info":{"entity-field":"Entity field",source:"Source",expression:"Value / Expression","expression-hint":"Show help",name:"Name","profile-name":"Profile name","device-name-expression":"Device name expression","device-name-expression-required":"Device name expression is required.","device-profile-expression-required":"Device profile expression is required."},"device-name-filter":"Device name filter","device-name-filter-hint":"This field supports regular expressions to filter incoming data by device name.","device-name-filter-required":"Device name filter is required.",details:"Details","delete-mapping-title":"Are you sure you want to delete the mapping related with '{{name}}'?","delete-mapping-description":"Be careful, after the confirmation mapping configuration and all related data will become unrecoverable.","delete-slave-title":"Are you sure you want to delete the server '{{name}}'?","delete-slave-description":"Be careful, after the confirmation server configuration and all related data will become unrecoverable.","delete-device-title":"Are you sure you want to delete the device '{{name}}'?","delete-device-description":"Be careful, after the confirmation the device configuration and all related data will become unrecoverable.",divider:"Divider","download-configuration-file":"Download configuration file","download-docker-compose":"Download docker-compose.yml for your gateway","enable-remote-logging":"Enable remote logging","ellipsis-chips-text":"+ {{count}} more","launch-gateway":"Launch gateway","launch-docker-compose":"Start the gateway using the following command in the terminal from folder with docker-compose.yml file","logs-configuration":"Logs configuration","create-new-gateway":"Create a new gateway","create-new-gateway-text":"Are you sure you want create a new gateway with name: '{{gatewayName}}'?","created-time":"Created time","configuration-delete-dialog-header":"Configurations will be deleted","configuration-delete-dialog-body":"Turning off Remote Configuration is possible only if there is physical access to the Gateway. All previous configurations will be deleted.

\nTo turn off configuration, enter gateway name below","configuration-delete-dialog-input":"Gateway name","configuration-delete-dialog-input-required":"Gateway name is mandatory","configuration-delete-dialog-confirm":"Turn Off","connector-duplicate-name":"Connector with such name already exists.","connection-type":"Connection type","connector-side":"Connector side","payload-type":"Payload type","platform-side":"Platform side",JSON:"JSON","JSON-hint":"Converter for this payload type processes MQTT messages in JSON format. It uses JSON Path expressions to extract vital details such as device names, device profile names, attributes, and time series from the message. And regular expressions to get device details from topics.",byte:"Byte",bytes:"Bytes","bytes-hint":"Converter for this payload type designed for binary MQTT payloads, this converter directly interprets binary data to retrieve device names and device profile names, along with attributes and time series, using specific byte positions for data extraction.",custom:"Custom","custom-hint":"This option allows you to use a custom converter for specific data tasks. You need to add your custom converter to the extension folder and enter its class name in the UI settings. Any keys you provide will be sent as configuration to your custom converter.","client-cert-path":"Path to client certificate file","path-to-client-cert-required":"Path to client certificate file is required.","client-id":"Client ID","data-conversion":"Data conversion","data-mapping":"Data mapping","data-mapping-hint":"Data mapping provides the capability to parse and convert the data received from a MQTT client in incoming messages into specific attributes and time series data keys.","opcua-data-mapping-hint":"Data mapping provides the capability to parse and convert the data received from a OPCUA server into specific data keys.",delete:"Delete configuration","delete-attribute":"Delete attribute","delete-key":"Delete key","delete-timeseries":"Delete time series",default:"Default","device-node":"Device node","device-node-required":"Device node required.","device-node-hint":"Path or identifier for device node on OPC UA server. Relative paths from it for attributes and time series can be used.","device-name":"Device name","device-profile-label":"Device profile","device-name-required":"Device name required","device-profile-required":"Device profile required","download-tip":"Download configuration file","drop-file":"Drop file here or",enable:"Enable",encoding:"Encoding","enable-subscription":"Enable subscription",extension:"Extension","extension-hint":"Put your converter classname in the field. Custom converter with such class should be in extension/mqtt folder.","extension-required":"Extension is required.","extension-configuration":"Extension configuration","extension-configuration-hint":"Configuration for converter. These arguments will be passed as a config to convert function.","fill-connector-defaults":"Fill configuration with default values","fill-connector-defaults-hint":"This property allows to fill connector configuration with default values on it's creation.","from-device-request-settings":"Input request parsing","from-device-request-settings-hint":"These fields support JSONPath expressions to extract a name from incoming message.","function-code":"Function code","function-codes":{"read-coils":"01 - Read Coils","read-discrete-inputs":"02 - Read Discrete Inputs","read-multiple-holding-registers":"03 - Read Multiple Holding Registers","read-input-registers":"04 - Read Input Registers","write-single-coil":"05 - Write Single Coil","write-single-holding-register":"06 - Write Single Holding Register","write-multiple-coils":"15 - Write Multiple Coils","write-multiple-holding-registers":"16 - Write Multiple Holding Registers"},"to-device-response-settings":"Output request processing","to-device-response-settings-hint":"For these fields you can use the following variables and they will be replaced with actual values: ${deviceName}, ${attributeKey}, ${attributeValue}",gateway:"Gateway","gateway-exists":"Device with same name is already exists.","gateway-status":"Gateway status","gateway-name":"Gateway name","gateway-name-required":"Gateway name is required.","gateway-saved":"Gateway configuration successfully saved.","generate-client-id":"Generate Client ID",grpc:"GRPC","grpc-keep-alive-timeout":"Keep alive timeout (in ms)","grpc-keep-alive-timeout-required":"Keep alive timeout is required","grpc-keep-alive-timeout-min":"Keep alive timeout can not be less then 1","grpc-keep-alive-timeout-pattern":"Keep alive timeout is not valid","grpc-keep-alive":"Keep alive (in ms)","grpc-keep-alive-required":"Keep alive is required","grpc-keep-alive-min":"Keep alive can not be less then 1","grpc-keep-alive-pattern":"Keep alive is not valid","grpc-min-time-between-pings":"Min time between pings (in ms)","grpc-min-time-between-pings-required":"Min time between pings is required","grpc-min-time-between-pings-min":"Min time between pings can not be less then 1","grpc-min-time-between-pings-pattern":"Min time between pings is not valid","grpc-min-ping-interval-without-data":"Min ping interval without data (in ms)","grpc-min-ping-interval-without-data-required":"Min ping interval without data is required","grpc-min-ping-interval-without-data-min":"Min ping interval without data can not be less then 1","grpc-min-ping-interval-without-data-pattern":"Min ping interval without data is not valid","grpc-max-pings-without-data":"Max pings without data","grpc-max-pings-without-data-required":"Max pings without data is required","grpc-max-pings-without-data-min":"Max pings without data can not be less then 1","grpc-max-pings-without-data-pattern":"Max pings without data is not valid",info:"Info",identity:"Identity","inactivity-check-period-seconds":"Inactivity check period (in sec)","inactivity-check-period-seconds-required":"Inactivity check period is required","inactivity-check-period-seconds-min":"Inactivity check period can not be less then 1","inactivity-check-period-seconds-pattern":"Inactivity check period is not valid","inactivity-timeout-seconds":"Inactivity timeout (in sec)","inactivity-timeout-seconds-required":"Inactivity timeout is required","inactivity-timeout-seconds-min":"Inactivity timeout can not be less then 1","inactivity-timeout-seconds-pattern":"Inactivity timeout is not valid","unit-id":"Unit ID",host:"Host","host-required":"Host is required.",holding_registers:"Holding registers",coils_initializer:"Coils initializer",input_registers:"Input registers",discrete_inputs:"Discrete inputs","json-parse":"Not valid JSON.","json-required":"Field cannot be empty.","JSONPath-hint":"Supports constants and JSONPath expressions to extract data.",logs:{logs:"Logs",days:"days",hours:"hours",minutes:"minutes",seconds:"seconds","date-format":"Date format","date-format-required":"Date format required","log-format":"Log format","log-type":"Log type","log-format-required":"Log format required",columns:{general:"General",service:"Service",connection:"Connection",storage:"Storage",extension:"Extension"},remote:"Remote logging","remote-logs":"Remote logs",local:"Local logging",level:"Log level","file-path":"File path","file-path-required":"File path required","saving-period":"Log saving period","saving-period-min":"Log saving period can not be less then 1","saving-period-required":"Log saving period required","backup-count":"Backup count","backup-count-min":"Backup count can not be less then 1","backup-count-required":"Backup count required"},"max-number-of-workers":"Max number of workers","max-number-of-workers-hint":"Maximal number of workers threads for converters \n(The amount of workers changes dynamically, depending on load) \nRecommended amount 50-150.","max-number-of-workers-required":"Max number of workers is required.","max-messages-queue-for-worker":"Max messages queue per worker","max-messages-queue-for-worker-hint":"Maximal messages count that will be in the queue \nfor each converter worker.","max-messages-queue-for-worker-required":"Max messages queue per worker is required.",method:"Method","method-name":"Method name","method-required":"Method name is required.","min-pack-send-delay":"Min pack send delay (in ms)","min-pack-send-delay-required":"Min pack send delay is required","min-pack-send-delay-min":"Min pack send delay can not be less then 10","min-pack-send-delay-pattern":"Min pack send delay is not valid",multiplier:"Multiplier",mode:"Mode","model-name":"Model name",modifier:"Modifier","modifier-invalid":"Modifier is not valid","mqtt-version":"MQTT version",name:"Name","name-required":"Name is required.","network-mask":"Network mask","no-attributes":"No attributes","no-attribute-updates":"No attribute updates","no-attribute-requests":"No attribute requests","no-connectors":"No connectors","no-data":"No configurations","no-gateway-found":"No gateway found.","no-gateway-matching":" '{{item}}' not found.","no-timeseries":"No time series","no-keys":"No keys","no-value":"No arguments","no-rpc-methods":"No RPC methods","no-rpc-requests":"No RPC requests","path-hint":"The path is local to the gateway file system","path-logs":"Path to log files","path-logs-required":"Path is required.",password:"Password","password-required":"Password is required.","permit-without-calls":"Keep alive permit without calls","property-id":"Property ID","poll-period":"Poll period (ms)","poll-period-error":"Poll period should be at least {{min}} (ms).",port:"Port","port-required":"Port is required.","port-limits-error":"Port should be number from {{min}} to {{max}}.","private-key-path":"Path to private key file","path-to-private-key-required":"Path to private key file is required.",parity:"Parity","product-code":"Product code","product-name":"Product name",raw:"Raw",retain:"Retain","retain-hint":"This flag tells the broker to store the message for a topic\nand ensures any new client subscribing to that topic\nwill receive the stored message.",remote:"Remote configuration","remote-logging-level":"Logging level","remove-entry":"Remove configuration","remote-shell":"Remote shell","remote-configuration":"Remote Configuration","request-expression":"Request expression","request-expression-required":"Request expression is required",retries:"Retries","retries-on-empty":"Retries on empty","retries-on-invalid":"Retries on invalid",response:"Response",rest:{"add-http-header":"Add HTTP header","no-http-headers":"No HTTP headers","delete-http-header":"Delete HTTP header","ssl-verify":"SSL verify",endpoint:"Endpoint","http-methods":"HTTP methods","http-method":"HTTP method","on-error":"On error","on-success":"On success",tries:"Tries","http-headers":"HTTP headers","allow-redirects":"Allow redirects","request-url-expression":"Request URL expression","response-attribute":"Response attribute","response-expected":"Expected","response-type":{default:"Default",const:"Constant",advanced:"Advanced"}},rpc:{rpc:"RPC",title:"{{type}} Connector RPC parameters","templates-title":"Connector RPC Templates",methodFilter:"Method filter","method-name":"Method name",requestTopicExpression:"Request topic expression",responseTopicExpression:"Response topic expression",responseTimeout:"Response timeout",valueExpression:"Value expression",tag:"Tag",type:"Type",functionCode:"Function Code",objectsCount:"Objects Count",address:"Address",method:"Method",requestType:"Request Type",requestTimeout:"Request Timeout",deviceName:"Device name","loading-devices":"Loading devices...","devices-load-error":"Failed to load devices","no-devices-found":"No devices found",deviceType:"Device type",addressType:"Address type",data:"Data",dataType:"Data type",dbNumber:"DB number","db-number-required":"DB number is required.","db-number-min":"DB number must be greater than or equal to 0.",start:"Start","start-required":"Start is required.","start-min":"Start must be greater than or equal to 0.",size:"Size","size-required":"Size is required.","size-min":"Size must be greater than or equal to 0.",bit:"Bit","bit-required":"Bit is required.","bit-range":"Bit must be between 1 and 7.","tag-required":"Tag is required.","tag-pattern":"Tag is not valid.",vmAddress:"VM address","vm-address-required":"VM address is required.","vm-address-pattern":"VM address is not valid.",objectType:"Object type",identifier:"Identifier",propertyId:"Property ID",methodRPC:"Method RPC name",withResponse:"With Response",characteristicUUID:"Characteristic UUID",methodProcessing:"Method Processing",nodeID:"Node ID",isExtendedID:"Is Extended ID",isFD:"Is FD",bitrateSwitch:"Bitrate Switch",dataInHEX:"Data In HEX",dataLength:"Data Length",dataByteorder:"Data Byte Order",dataBefore:"Data Before",dataAfter:"Data After",dataExpression:"Data Expression",oid:"OID","add-oid":"Add OID","add-header":"Add header","add-security":"Add security",remove:"Remove",requestFilter:"Request Filter",requestUrlExpression:"Request URL Expression",httpMethod:"HTTP Method",timeout:"Timeout",tries:"Tries",httpHeaders:"HTTP Headers","header-name":"Header name",hint:{"modbus-response-reading":"RPC response will return all subtracted values from all connected devices when the reading functions are selected.","modbus-writing-functions":"RPC will write a filled value to all connected devices when the writing functions are selected.","opc-method":"A filled method name is the OPC-UA method that will processed on the server side (make sure your node has the requested method)."},"security-name":"Security name",value:"Value",security:"Security",responseValueExpression:"Response Value Expression",requestValueExpression:"Request Value Expression",arguments:"Arguments","add-argument":"Add argument","write-property":"Write property","read-property":"Read property","analog-output":"Analog output","analog-input":"Analog input","binary-output":"Binary output","binary-input":"Binary input","binary-value":"Binary value","analog-value":"Analog value",write:"Write",read:"Read",scan:"Scan",oids:"OIDS",set:"Set",multiset:"Multiset",get:"Get","bulk-walk":"Bulk walk",table:"Table","multi-get":"Multiget","get-next":"Get next","bulk-get":"Bulk get",walk:"Walk","save-template":"Save template","template-name":"Template name","template-name-required":"Template name is required.","template-name-duplicate":"Template with such name already exists, it will be updated.",command:"Command",params:"Params","json-value-invalid":"JSON value has an invalid format"},"rpc-methods":"RPC methods","rpc-requests":"RPC requests",request:{"connect-request":"Connect request","disconnect-request":"Disconnect request","attribute-request":"Attribute request","attribute-update":"Attribute update","rpc-connection":"RPC command"},"request-type":"Request type","request-timeout":"Request timeout (ms)","requests-mapping":"Requests mapping","requests-mapping-hint":"MQTT Connector requests allows you to connect, disconnect, process attribute requests from the device, handle attribute updates on the server and RPC processing configuration.","request-topic-expression":"Request topic expression","request-client-certificate":"Request client certificate","request-topic-expression-required":"Request topic expression is required.","response-timeout":"Response timeout","response-timeout-required":"Response timeout is required.","response-timeout-limits-error":"Timeout must be more then {{min}} ms.","response-topic-Qos":"Response topic QoS","response-topic-Qos-hint":"MQTT Quality of Service (QoS) is an agreement between the message sender and receiver that defines the level of delivery guarantee for a specific message.","response-topic-expression":"Response topic expression","response-topic-expression-required":"Response topic expression is required.","response-value-expression":"Response value expression","response-value-expression-required":"Response value expression is required.","vendor-name":"Vendor name","vendor-url":"Vendor URL",value:"Value",values:"Values","value-required":"Value is required.","value-pattern":"Value is not valid.","value-expression":"Value expression","value-expression-required":"Value expression is required.","with-response":"With response","without-response":"Without response",other:"Other",socket:"Socket","save-tip":"Save configuration file","scan-period":"Scan period (ms)","scan-period-error":"Scan period should be at least {{min}} (ms).","sub-check-period":"Subscription check period (ms)","sub-check-period-error":"Subscription check period should be at least {{min}} (ms).",security:"Security","security-policy":"Security policy","security-type":"Security type","security-types":{"access-token":"Access Token","username-password":"Username and Password",tls:"TLS","tls-access-token":"TLS + Access Token","tls-private-key":"TLS + Private Key"},"select-connector":"Select connector to display config","send-change-data":"Send data only on change","send-data-to-platform":"Send data to platform","send-data-on-change":"Send data only on change","send-change-data-hint":"The values will be saved to the database only if they are different from the corresponding values in the previous converted message. This functionality applies to both attributes and time series in the converter output.",server:"Server","server-hostname":"Server hostname","server-slave":"Server (Slave)","servers-slaves":"Servers (Slaves)","server-port":"Server port","server-url":"Server endpoint url","server-connection":"Server Connection","server-config":"Server configuration","server-slave-config":"Server (Slave) configuration","server-url-required":"Server endpoint url is required.",stopbits:"Stopbits",strict:"Strict",set:"Set","show-map":"Show map",statistics:{entry:"Statistic entry","custom-send-period":"Custom send period (in sec)","custom-send-period-pattern":"Custom send period is not valid","custom-send-period-min":"Custom send period can not be less then 60","custom-send-period-required":"Custom send period is required","create-command":"Create command",attributes:"Attributes","name-already-exists":"Attribute name already exists.",telemetry:"Telemetry","storage-message-count":"Storage message count","messages-from-platform":"Messages from platform","pushed-datapoints":"Pushed datapoints","messages-pulled-from-storage":"Messages pulled from storage","messages-pushed-to-platform":"Messages pushed to platform","messages-sent-to-platform":"Messages sent to platform","process-cpu-usage":"Gateway process CPU usage",memory:"Gateway process memory usage","machine-resources":"Machine resources","free-disk":"Free disk",statistic:"Statistic",statistics:"Statistics","general-statistics":"General statistics","custom-statistics":"Custom statistics","copy-message":"Copy message","statistic-commands-empty":'No configured statistic keys found. You can configure them in "Statistics" tab in general configuration.',"statistics-button":"Go to configuration",commands:"Commands",name:"Time series name","time-series-name-already-exists":"Time series name already exists.","send-period":"Statistic send period (in sec)","send-period-required":"Statistic send period is required","send-period-min":"Statistic send period can not be less then 60","send-period-pattern":"Statistic send period is not valid","check-connectors-configuration":"Check connectors configuration (in sec)",messages:"Messages","max-payload-size-bytes":"Max payload size in bytes","max-payload-size-bytes-required":"Max payload size in bytes is required","max-payload-size-bytes-min":"Max payload size in bytes can not be less then 100","max-payload-size-bytes-pattern":"Max payload size in bytes is not valid","min-pack-size-to-send":"Min packet size to send","min-pack-size-to-send-required":"Min packet size to send is required","min-pack-size-to-send-min":"Min packet size to send can not be less then 100","min-pack-size-to-send-pattern":"Min packet size to send is not valid","no-config-commands-found":"No configuration commands found","delete-command":"Delete command '{{command}}'?","delete-command-data":"All command data will be deleted.","edit-command":"Edit command","change-command-title":"Discard command change","change-command-text":"Cancelling command edit will discard any unsaved changes. Continue?","no-command-found":"No command found","no-commands-matching":"No command matching '{{command}}' were found.","check-connectors-configuration-required":"Check connectors configuration is required","check-connectors-configuration-min":"Check connectors configuration can not be less then 1","check-connectors-configuration-pattern":"Check connectors configuration is not valid","install-cmd":"Install command",add:"Add command",timeout:"Timeout (in sec)","timeout-required":"Timeout is required","timeout-min":"Timeout can not be less then 1","timeout-pattern":"Timeout is not valid","time-series-name-required":"Time series name is required","time-series-name-pattern":"Time series name is not valid",command:"Command","command-required":"Command is required","command-pattern":"Command is not valid",remove:"Remove command"},storage:"Storage","storage-max-files":"Maximum number of files","storage-max-files-min":"Minimum number is 1.","storage-max-files-pattern":"Number is not valid.","storage-max-files-required":"Number is required.","storage-max-records":"Maximum records in storage","storage-max-records-min":"Minimum number of records is 1.","storage-max-records-pattern":"Number is not valid.","storage-max-records-required":"Maximum records is required.","storage-read-record-count":"Read record count in storage","storage-read-record-count-min":"Minimum number of records is 1.","storage-read-record-count-pattern":"Number is not valid.","storage-read-record-count-required":"Read record count is required.","storage-max-read-record-count-storage":"Max read record count in storage","storage-max-read-record-count":"Max read record count","storage-max-read-record-count-min":"Minimum number of records is 1.","storage-max-read-record-count-pattern":"Number is not valid.","storage-max-read-record-count-required":"Max read record count is required.","storage-data-folder-path":"Data folder path","storage-data-folder-path-required":"Data folder path is required.","storage-data-folder-path-pattern":"Data folder path path path must start with './' and end with '/', without dots in folder names.","storage-pack-size":"Maximum event pack size","storage-pack-size-min":"Minimum number is 1.","storage-pack-size-pattern":"Number is not valid.","storage-pack-size-required":"Maximum event pack size is required.","storage-path":"Storage path","storage-path-required":"Storage path is required.","storage-path-pattern":"Storage path path must start with './' and end with '/', without dots in folder names.","storage-type":"Storage type","storage-types":{"file-storage":"File storage","memory-storage":"Memory storage",sqlite:"SQLITE"},suffix:{s:"s",ms:"ms"},"report-strategy":{label:"Report strategy","on-change":"On value change","on-report-period":"On report period","on-change-or-report-period":"On value change or report period","report-period":"Report period","on-received":"On received"},"source-type":{msg:"Message",topic:"Topic",const:"Constant",identifier:"Identifier",path:"Path",expression:"Expression",request:"From request"},"workers-settings":"Workers settings",thingsboard:"ThingsBoard",general:"General",timeseries:"Time series",key:"Key",keys:"Keys","key-required":"Key is required.","thingsboard-host":"Platform host","thingsboard-host-required":"Host is required.","thingsboard-port":"Platform port","thingsboard-port-max":"Maximum port number is 65535.","thingsboard-port-min":"Minimum port number is 1.","thingsboard-port-pattern":"Port is not valid.","thingsboard-port-required":"Port is required.",tidy:"Tidy","tidy-tip":"Tidy config JSON",timeout:"Timeout","timeout-error":"Timeout should be at least {{min}} (ms).","title-connectors-json":"Connector {{typeName}} configuration",type:"Type","topic-filter":"Topic filter","topic-required":"Topic filter is required.","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","tls-connection":"TLS Connection","master-connections":"Master Connections","method-filter":"Method filter","method-filter-hint":"Regular expression to filter incoming RPC method from platform.","method-filter-required":"Method filter is required.","messages-ttl-check-in-hours":"Messages TTL check in hours","messages-ttl-check-in-hours-required":"Messages TTL check in hours is required.","messages-ttl-check-in-hours-min":"Min number is 1.","messages-ttl-check-in-hours-pattern":"Number is not valid.","messages-ttl-in-days":"Messages TTL in days","messages-ttl-in-days-required":"Messages TTL in days is required.","messages-ttl-in-days-min":"Min number is 1.","messages-ttl-in-days-pattern":"Number is not valid.","size-limit":"Size limit","size-limit-hint":"Maximum size of each SQLite file in megabytes. When exceeded, triggers rotation to a new DB file.","size-limit-required":"Size limit is required.","size-limit-min":"Min size limit is 1.","size-limit-pattern":"Number is not valid.","max-db-amount":"Maximum DB amount","max-db-amount-hint":"Maximum number of rotated DB files to keep on disk. When reached, further writes are dropped until cleanup.","max-db-amount-required":"Maximum DB amount is required.","max-db-amount-min":"Min number is 1.","max-db-amount-pattern":"Number is not valid.","oversize-check-period":"Oversize check period","oversize-check-period-hint":"How frequently (in minutes) to check the current DB’s file size against size_limit.","oversize-check-period-required":"Oversize check period is required.","oversize-check-period-min":"Min number is 1.","oversize-check-period-pattern":"Number is not valid.","writing-batch-size":"Writing batch size","writing-batch-size-hint":"Maximum number of messages collected before writing to the DB during single write request.","writing-batch-size-required":"Writing batch size is required.","writing-batch-size-min":"Min number is 1.","writing-batch-size-pattern":"Number is not valid.","mqtt-qos":"QoS","mqtt-qos-required":"QoS is required","mqtt-qos-range":"QoS values range is from 0 to 1",qos:{"at-most-once":"0 - At most once","at-least-once":"1 - At least once","exactly-once":"2 - Exactly once"},"objects-count":"Objects count","object-id":"Object ID","objects-count-required":"Objects count is required","wait-after-failed-attempts":"Wait after failed attempts (ms)","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON",username:"Username","username-required":"Username is required.","unit-id-required":"Unit ID is required.","vendor-id":"Vendor ID","write-coil":"Write Coil","write-coils":"Write Coils","write-register":"Write Register","write-registers":"Write Registers","general-configuration-widget":{"general-configuration":"General configuration","connectors-configuration":"Connectors configuration",logs:"Logs",statistics:"Statistics","remote-shell":"Remote Shell",rpc:"RPC"},"statistics-nav-widget":{"storage-statistics":"Storage","machine-statistics":"Machine","custom-statistics":"Custom"},"status-widget":{status:"Status","gateway-name":"Gateway name","gateway-version":"Gateway version","gateway-type":"Gateway type",devices:"Devices","active-inactive":"(Active | Inactive)",connectors:"Connectors","enabled-disabled":"(Enabled | Disabled)",errors:"Errors"},hints:{"enable-general-statistics":"Enables gateway statistics (machine, storage, connectors).","enable-custom-statistics":"Enables collecting statistics using custom commands.","buffer-size":"Buffer size for received data blocks.",encoding:"Encoding used for writing received string data to storage.",method:"Name for method on a platform.","modbus-master":"Configuration sections for connecting to Modbus servers and reading data from them.","modbus-server":"Configuration section for the Modbus server, storing data and sending updates to the platform when changes occur or at fixed intervals.","remote-configuration":"Enables remote configuration and management of the gateway","remote-shell":"Enables remote control of the operating system with the gateway from the Remote Shell widget",host:"Hostname or IP address of platform server",port:"Port of MQTT service on platform server",token:"Access token for the gateway from platform server","client-id":"MQTT client id for the gateway form platform server",username:"MQTT username for the gateway form platform server",password:"MQTT password for the gateway form platform server","ca-cert":"Path to CA certificate file","date-form":"Date format in log message","object-id-required":"Object ID is required","vendor-id-required":"Vendor ID is required","data-folder":"Path to the folder that will contain data (Relative or Absolute)","log-format":"Log message format","remote-log":"Enables remote logging and logs reading from the gateway","backup-count":"If backup count is > 0, when a rollover is done, no more than backup count files are kept - the oldest ones are deleted",storage:"Provides configuration for saving incoming data before it is sent to the platform","max-file-count":"Maximum number of files that will be created","max-read-count":"Number of messages to retrieve from the storage and send to platform","max-records":"Maximum count of records that will be stored in one file","read-record-count":"Number of messages to retrieve from the storage and send to platform","max-records-count":"Maximum number of data entries in storage before sending to platform","ttl-check-hour":"How often will the Gateway check data for obsolescence","ttl-messages-day":"Maximum number of days that the storage will retain data","username-required-with-password":"Username required if password is specified",commands:"Commands for collecting additional statistic",attribute:"Statistic telemetry key",timeout:"Timeout for command executing",command:"The result of the command execution, will be used as the value for telemetry","check-device-activity":"Enables monitor the activity of each connected device","inactivity-timeout":"Time after whose the gateway will disconnect device","inactivity-period":"Periodicity of device activity check","minimal-pack-delay":"Delay between sending packs of messages (Decreasing this setting results in increased CPU usage)",qos:"Quality of Service in MQTT messaging (0 - at most once, 1 - at least once)","server-port":"Network port on which GRPC server will listen for incoming connections.","grpc-keep-alive-timeout":"Maximum time the server should wait for a keepalive ping response before considering the connection dead.","grpc-keep-alive":"Duration between two successive keepalive ping messages when there is no active RPC call.","grpc-min-time-between-pings":"Minimum amount of time the server should wait between sending keepalive ping messages","grpc-max-pings-without-data":"Maximum number of keepalive ping messages that the server can send without receiving any data before it considers the connection dead.","grpc-min-ping-interval-without-data":"Minimum amount of time the server should wait between sending keepalive ping messages when there is no data being sent or received.","permit-without-calls":"Allow server to keep the GRPC connection alive even when there are no active RPC calls.","path-in-os":"Path in gateway os.",memory:"Your data will be stored in the in-memory queue, it is a fastest but no persistence guarantee.",file:"Your data will be stored in separated files and will be saved even after the gateway restart.",sqlite:"Your data will be stored in file based database. And will be saved even after the gateway restart.","opc-timeout":"Timeout in milliseconds for connecting to OPC-UA server.","security-policy":"Security Policy defines the security mechanisms to be applied.","install-cmd":"Packages that will be installed for command executing.","scan-period":"Period in milliseconds to rescan the server.","sub-check-period":"Period to check the subscriptions in the OPC-UA server.","enable-subscription":"If true - the gateway will subscribe to interesting nodes and wait for data update and if false - the gateway will rescan OPC-UA server every scanPeriodInMillis.","show-map":"Show nodes on scanning.","method-name":"Name of method on OPC-UA server.",arguments:"Arguments for the method (will be overwritten by arguments from the RPC request).","min-pack-size-to-send":"Minimum package size for sending.","max-payload-size-bytes":"Maximum package size in bytes","poll-period":"Period in milliseconds to read data from nodes.","poll-period-required":"Poll period is required.","report-period-required":"Report period is required.","report-period-range":"Report period must be greater than 100.","timeout-pattern":"Timeout is not valid",rest:{"endpoint-required":"Endpoint is required.","endpoint-pattern":"Endpoint is not valid.","device-name-filter-required":"Device name filter is required.","device-name-filter-pattern":"Device name filter is not valid.","request-url-expression-required":"Request URL expression is required.","request-url-expression-pattern":"Request URL expression is not valid.","value-expression-required":"Value expression is required.","value-expression-pattern":"Value expression is not valid.","method-filter-required":"Method filter is required.","method-filter-pattern":"Method filter is not valid.","scope-type":"Attribute scope on platform.","tries-min":"Request tries number should be greater than 0.","tries-pattern":"Request tries is invalid.","http-methods-required":"HTTP methods are required.",host:"Domain or IP address of the server.",port:"Port on the server for listening clients connection.","ssl-verify":"Enable SSL certificate verification.",cert:"Path to the certificate file.",key:"Path to the private key file",endpoint:"Endpoint path on the server.","http-methods":"HTTP methods allowed for endpoint.","http-method":"Request to external URL HTTP method.",JSON:"Converter for this payload type processes REST messages in JSON format. It uses JSON Path expressions to extract vital details such as device names, device profile names, attributes, and time series from the request body.",extension:"Custom converter classname. File with this class should be in extension/rest folder.","response-attribute-required":"Response attribute is required.","response-attribute-pattern":"Response attribute is not valid.","update-ssl":"Verify SSL certificate on the external server.","attribute-filter":"Filter for incoming attribute name from platform, support regular expression.","value-expression":"Used to create request body for request to external server. Supports ${deviceName}, ${deviceType}, ${attributeName}, ${attributeValue} variables.","attribute-url-expression":"Used to create request URL for request to external server. Supports ${deviceName}, ${deviceType}, ${attributeName}, ${attributeValue} variables.","method-filter":"Filter for RPC requests from the platform based on the method name. Supports regular expressions.","attribute-name-expression-required":"Attribute name expression is required.","attribute-name-expression-pattern":"Attribute name expression is not valid.","attribute-filter-required":"Attribute filter is required.","attribute-filter-pattern":"Attribute filter is not valid."},socket:{"attribute-on-platform-required":"Attribute on platform is required","attribute-requests-type":"The type of requested attribute can be “shared” or “client.“","with-response":"Boolean flag that specifies whether to send a response back to platform.","key-telemetry":"Name for telemetry on platform.","key-attribute":"Name for attribute on platform."},modbus:{"bit-target-type":"The response type can be either an integer (1/0) or a boolean (True/False).",bit:"Specify the index of the bit to read from the array, or leave it blank to read the entire array.","max-bit":"The bit value must not exceed the objects count.","framer-type":"Type of a framer (Socket, RTU, or ASCII), if needed.",host:"Hostname or IP address of Modbus server.",port:"Modbus server port for connection.","unit-id":"Modbus slave ID.","connection-timeout":"Connection timeout (in seconds) for the Modbus server.","byte-order":"Byte order for reading data.","word-order":"Word order when reading multiple registers.",retries:"Retrying sending data to the master.","retries-on-empty":"Retry sending data to the master if the data is empty.","retries-on-invalid":"Retry sending data to the master if it fails.","poll-period":"Period in milliseconds to check attributes and telemetry on the slave.","connect-attempt-time":"A waiting period in milliseconds before establishing a connection to the master.","connect-attempt-count":"The number of connection attempts made through the gateway.","wait-after-failed-attempts":"A waiting period in milliseconds before attempting to send data to the master.","serial-port":"Serial port for connection.",baudrate:"Baud rate for the serial device.",stopbits:"The number of stop bits sent after each character in a message to indicate the end of the byte.",bytesize:"The number of bits in a byte of serial data. This can be one of 5, 6, 7, or 8.",parity:"The type of checksum used to verify data integrity. Options: (E)ven, (O)dd, (N)one.",strict:"Use inter-character timeout for baudrates ≤ 19200.","objects-count":"Depends on the selected type.",address:"Register address to verify.",key:"Key to be used as the attribute key for the platform instance.",method:"Method name to be used for the platform instance.","data-keys":"For more information about function codes and data types click on help icon",modifier:"The retrieved value will be adjusted (by multiplying or dividing it) based on the specified modifier value."},bacnet:{"object-id":"The gateway object identifier in the BACnet network.","vendor-id":"The gateway vendor identifier in the BACnet network","apdu-length":"Maximal length of the APDU.",segmentation:"Segmentation type for transmitting large BACnet messages.","key-object-id":"Object id in the BACnet device.","property-id":"Property id in the BACnet device.","request-type":"“writeProperty” to write data and “readProperty” to read data.","request-timeout":"Timeout to wait the response from the BACnet device, milliseconds.","device-timeout":"Period of time when the connector will try to discover BACnet devices.","network-number":"Identifier of the network segment."}}}},Tt={gateway:{"add-entry":"إضافة تكوين",advanced:"متقدم","checking-device-activity":"فحص نشاط الجهاز",command:"أوامر Docker","command-copied-message":"تم نسخ أمر Docker إلى الحافظة",configuration:"التكوين","connector-add":"إضافة موصل جديد","connector-enabled":"تمكين الموصل","connector-name":"اسم الموصل","connector-name-required":"اسم الموصل مطلوب.","connector-type":"نوع الموصل","connector-type-required":"نوع الموصل مطلوب.",connectors:"الموصلات","connectors-config":"تكوينات الموصلات","connectors-table-enabled":"ممكّن","connectors-table-name":"الاسم","connectors-table-type":"النوع","connectors-table-status":"الحالة","connectors-table-actions":"الإجراءات","connectors-table-key":"المفتاح","connectors-table-class":"الفئة","rpc-command-send":"إرسال","rpc-command-result":"الاستجابة","rpc-command-edit-params":"تحرير المعلمات","gateway-configuration":"تكوين عام","docker-label":"استخدم التعليمات التالية لتشغيل IoT Gateway في Docker compose مع بيانات اعتماد للجهاز المحدد","install-docker-compose":"استخدم التعليمات لتنزيل وتثبيت وإعداد docker compose","download-configuration-file":"تنزيل ملف التكوين","download-docker-compose":"تنزيل docker-compose.yml لبوابتك","launch-gateway":"تشغيل البوابة","launch-docker-compose":"بدء تشغيل البوابة باستخدام الأمر التالي في الطرفية من المجلد الذي يحتوي على ملف docker-compose.yml","create-new-gateway":"إنشاء بوابة جديدة","create-new-gateway-text":"هل أنت متأكد أنك تريد إنشاء بوابة جديدة باسم: '{{gatewayName}}'؟","created-time":"وقت الإنشاء","configuration-delete-dialog-header":"سيتم حذف التكوينات","configuration-delete-dialog-body":"يمكن تعطيل التكوين عن بُعد فقط إذا كان هناك وصول جسدي إلى البوابة. ستتم حذف جميع التكوينات السابقة.

\n لتعطيل التكوين، أدخل اسم البوابة أدناه","configuration-delete-dialog-input":"اسم البوابة","configuration-delete-dialog-input-required":"اسم البوابة إلزامي","configuration-delete-dialog-confirm":"إيقاف التشغيل",delete:"حذف التكوين","download-tip":"تنزيل ملف التكوين","drop-file":"أفلق الملف هنا أو",gateway:"البوابة","gateway-exists":"الجهاز بنفس الاسم موجود بالفعل.","gateway-name":"اسم البوابة","gateway-name-required":"اسم البوابة مطلوب.","gateway-saved":"تم حفظ تكوين البوابة بنجاح.",grpc:"GRPC","grpc-keep-alive-timeout":"مهلة البقاء على قيد الحياة (بالمللي ثانية)","grpc-keep-alive-timeout-required":"مهلة البقاء على قيد الحياة مطلوبة","grpc-keep-alive-timeout-min":"مهلة البقاء على قيد الحياة لا يمكن أن تكون أقل من 1","grpc-keep-alive-timeout-pattern":"مهلة البقاء على قيد الحياة غير صالحة","grpc-keep-alive":"البقاء على قيد الحياة (بالمللي ثانية)","grpc-keep-alive-required":"البقاء على قيد الحياة مطلوب","grpc-keep-alive-min":"البقاء على قيد الحياة لا يمكن أن يكون أقل من 1","grpc-keep-alive-pattern":"البقاء على قيد الحياة غير صالح","grpc-min-time-between-pings":"الحد الأدنى للوقت بين البينغات (بالمللي ثانية)","grpc-min-time-between-pings-required":"الحد الأدنى للوقت بين البينغات مطلوب","grpc-min-time-between-pings-min":"الحد الأدنى للوقت بين البينغات لا يمكن أن يكون أقل من 1","grpc-min-time-between-pings-pattern":"الحد الأدنى للوقت بين البينغات غير صالح","grpc-min-ping-interval-without-data":"الحد الأدنى لفاصل البينغ بدون بيانات (بالمللي ثانية)","grpc-min-ping-interval-without-data-required":"الحد الأدنى لفاصل البينغ بدون بيانات مطلوب","grpc-min-ping-interval-without-data-min":"الحد الأدنى لفاصل البينغ بدون بيانات لا يمكن أن يكون أقل من 1","grpc-min-ping-interval-without-data-pattern":"الحد الأدنى لفاصل البينغ بدون بيانات غير صالح","grpc-max-pings-without-data":"الحد الأقصى لعدد البينغات بدون بيانات","grpc-max-pings-without-data-required":"الحد الأقصى لعدد البينغات بدون بيانات مطلوب","grpc-max-pings-without-data-min":"الحد الأقصى لعدد البينغات بدون بيانات لا يمكن أن يكون أقل من 1","grpc-max-pings-without-data-pattern":"الحد الأقصى لعدد البينغات بدون بيانات غير صالح","inactivity-check-period-seconds":"فترة فحص الخمول (بالثواني)","inactivity-check-period-seconds-required":"فترة فحص الخمول مطلوبة","inactivity-check-period-seconds-min":"فترة فحص الخمول لا يمكن أن تكون أقل من 1","inactivity-check-period-seconds-pattern":"فترة فحص الخمول غير صالحة","inactivity-timeout-seconds":"فترة الخمول (بالثواني)","inactivity-timeout-seconds-required":"فترة الخمول مطلوبة","inactivity-timeout-seconds-min":"فترة الخمول لا يمكن أن تكون أقل من 1","inactivity-timeout-seconds-pattern":"فترة الخمول غير صالحة","json-parse":"JSON غير صالح.","json-required":"الحقل لا يمكن أن يكون فارغًا.",logs:{logs:"السجلات",days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثواني","date-format":"تنسيق التاريخ","date-format-required":"تنسيق التاريخ مطلوب","log-format":"تنسيق السجل","log-type":"نوع السجل","log-format-required":"تنسيق السجل مطلوب",remote:"التسجيل عن بُعد","remote-logs":"السجلات عن بُعد",local:"التسجيل المحلي",level:"مستوى السجل","file-path":"مسار الملف","file-path-required":"مسار الملف مطلوب","saving-period":"فترة حفظ السجل","saving-period-min":"فترة حفظ السجل لا يمكن أن تكون أقل من 1","saving-period-required":"فترة حفظ السجل مطلوبة","backup-count":"عدد النسخ الاحتياطية","backup-count-min":"عدد النسخ الاحتياطية لا يمكن أن يكون أقل من 1","backup-count-required":"عدد النسخ الاحتياطية مطلوب"},"min-pack-send-delay":"الحد الأدنى لتأخير إرسال الحزمة (بالمللي ثانية)","min-pack-send-delay-required":"الحد الأدنى لتأخير إرسال الحزمة مطلوب","min-pack-send-delay-min":"لا يمكن أن يكون الحد الأدنى لتأخير إرسال الحزمة أقل من 0","no-connectors":"لا توجد موصلات","no-data":"لا توجد تكوينات","no-gateway-found":"لم يتم العثور على بوابة.","no-gateway-matching":"'{{item}}' غير موجود.","path-logs":"مسار إلى ملفات السجل","path-logs-required":"المسار مطلوب.","permit-without-calls":"البقاء على الحياة يسمح بدون مكالمات",remote:"التكوين عن بُعد","remote-logging-level":"مستوى التسجيل","remove-entry":"إزالة التكوين","remote-shell":"قشرة عن بُعد","remote-configuration":"التكوين عن بُعد",other:"آخر","save-tip":"حفظ ملف التكوين","security-type":"نوع الأمان","security-types":{"access-token":"رمز الوصول","username-password":"اسم المستخدم وكلمة المرور",tls:"TLS","tls-access-token":"TLS + رمز الوصول","tls-private-key":"TLS + المفتاح الخاص"},"server-port":"منفذ الخادم",statistics:{statistic:"إحصائية",statistics:"الإحصائيات","statistic-commands-empty":"لا تتوفر إحصائيات",commands:"الأوامر","send-period":"فترة إرسال الإحصائيات (بالثواني)","send-period-required":"فترة إرسال الإحصائيات مطلوبة","send-period-min":"لا يمكن أن تكون فترة إرسال الإحصائيات أقل من 60","send-period-pattern":"فترة إرسال الإحصائيات غير صالحة","check-connectors-configuration":"فترة فحص تكوين الموصلات (بالثواني)","check-connectors-configuration-required":"فترة فحص تكوين الموصلات مطلوبة","check-connectors-configuration-min":"لا يمكن أن تكون فترة فحص تكوين الموصلات أقل من 1","check-connectors-configuration-pattern":"فترة فحص تكوين الموصلات غير صالحة",add:"إضافة أمر",timeout:"المهلة","timeout-required":"المهلة مطلوبة","timeout-min":"لا يمكن أن تكون المهلة أقل من 1","timeout-pattern":"المهلة غير صالحة","attribute-name":"اسم السمة","attribute-name-required":"اسم السمة مطلوب",command:"الأمر","command-required":"الأمر مطلوب","command-pattern":"الأمر غير صالح",remove:"إزالة الأمر"},storage:"التخزين","storage-max-file-records":"السجلات القصوى في الملف","storage-max-files":"الحد الأقصى لعدد الملفات","storage-max-files-min":"الحد الأدنى هو 1.","storage-max-files-pattern":"العدد غير صالح.","storage-max-files-required":"العدد مطلوب.","storage-max-records":"السجلات القصوى في التخزين","storage-max-records-min":"الحد الأدنى لعدد السجلات هو 1.","storage-max-records-pattern":"العدد غير صالح.","storage-max-records-required":"السجلات القصوى مطلوبة.","storage-read-record-count":"عدد قراءة السجلات في التخزين","storage-read-record-count-min":"الحد الأدنى لعدد السجلات هو 1.","storage-read-record-count-pattern":"العدد غير صالح.","storage-read-record-count-required":"عدد قراءة السجلات مطلوب.","storage-max-read-record-count":"الحد الأقصى لعدد قراءة السجلات في التخزين","storage-max-read-record-count-min":"الحد الأدنى لعدد السجلات هو 1.","storage-max-read-record-count-pattern":"العدد غير صالح.","storage-max-read-record-count-required":"عدد القراءة القصوى مطلوب.","storage-data-folder-path":"مسار مجلد البيانات","storage-data-folder-path-required":"مسار مجلد البيانات مطلوب.","storage-pack-size":"الحد الأقصى لحجم حزمة الحدث","storage-pack-size-min":"الحد الأدنى هو 1.","storage-pack-size-pattern":"العدد غير صالح.","storage-pack-size-required":"الحجم الأقصى لحزمة الحدث مطلوب.","storage-path":"مسار التخزين","storage-path-required":"مسار التخزين مطلوب.","storage-type":"نوع التخزين","storage-types":{"file-storage":"تخزين الملفات","memory-storage":"تخزين الذاكرة",sqlite:"SQLITE"},thingsboard:"ثينغزبورد",general:"عام","thingsboard-host":"مضيف ثينغزبورد","thingsboard-host-required":"المضيف مطلوب.","thingsboard-port":"منفذ ثينغزبورد","thingsboard-port-max":"الحد الأقصى لرقم المنفذ هو 65535.","thingsboard-port-min":"الحد الأدنى لرقم المنفذ هو 1.","thingsboard-port-pattern":"المنفذ غير صالح.","thingsboard-port-required":"المنفذ مطلوب.",tidy:"ترتيب","tidy-tip":"ترتيب تكوين JSON","title-connectors-json":"تكوين موصل {{typeName}}","tls-path-ca-certificate":"المسار إلى شهادة CA على البوابة","tls-path-client-certificate":"المسار إلى شهادة العميل على البوابة","messages-ttl-check-in-hours":"فحص TTL الرسائل بالساعات","messages-ttl-check-in-hours-required":"يجب تحديد فحص TTL الرسائل بالساعات.","messages-ttl-check-in-hours-min":"الحد الأدنى هو 1.","messages-ttl-check-in-hours-pattern":"الرقم غير صالح.","messages-ttl-in-days":"TTL الرسائل بالأيام","messages-ttl-in-days-required":"يجب تحديد TTL الرسائل بالأيام.","messages-ttl-in-days-min":"الحد الأدنى هو 1.","messages-ttl-in-days-pattern":"الرقم غير صالح.","mqtt-qos":"جودة الخدمة (QoS)","mqtt-qos-required":"جودة الخدمة (QoS) مطلوبة","mqtt-qos-range":"تتراوح قيم جودة الخدمة (QoS) من 0 إلى 1","tls-path-private-key":"المسار إلى المفتاح الخاص على البوابة","toggle-fullscreen":"تبديل وضع ملء الشاشة","transformer-json-config":"تكوين JSON*","update-config":"إضافة/تحديث تكوين JSON",hints:{"remote-configuration":"يمكنك تمكين التكوين وإدارة البوابة عن بُعد","remote-shell":"يمكنك تمكين التحكم البعيد في نظام التشغيل مع البوابة من عنصر واجهة المستخدم قشرة عن بُعد",host:"اسم المضيف أو عنوان IP لخادم ثينغزبورد",port:"منفذ خدمة MQTT على خادم ثينغزبورد",token:"رمز الوصول للبوابة من خادم ثينغزبورد","client-id":"معرف عميل MQTT للبوابة من خادم ثينغزبورد",username:"اسم المستخدم MQTT للبوابة من خادم ثينغزبورد",password:"كلمة المرور MQTT للبوابة من خادم ثينغزبورد","ca-cert":"المسار إلى ملف شهادة CA","date-form":"تنسيق التاريخ في رسالة السجل","data-folder":"المسار إلى المجلد الذي سيحتوي على البيانات (نسبي أو مطلق)","log-format":"تنسيق رسالة السجل","remote-log":"يمكنك تمكين التسجيل البعيد وقراءة السجلات من البوابة","backup-count":"إذا كان عدد النسخ الاحتياطية > 0، عند عملية تدوير، لا يتم الاحتفاظ بأكثر من عدد النسخ الاحتياطية المحددة - يتم حذف الأقدم",storage:"يوفر تكوينًا لحفظ البيانات الواردة قبل إرسالها إلى المنصة","max-file-count":"العدد الأقصى لعدد الملفات التي سيتم إنشاؤها","max-read-count":"عدد الرسائل للحصول عليها من التخزين وإرسالها إلى ثينغزبورد","max-records":"العدد الأقصى للسجلات التي ستخزن في ملف واحد","read-record-count":"عدد الرسائل للحصول عليها من التخزين وإرسالها إلى ثينغزبورد","max-records-count":"العدد الأقصى للبيانات في التخزين قبل إرسالها إلى ثينغزبورد","ttl-check-hour":"كم مرة سيتحقق البوابة من البيانات القديمة","ttl-messages-day":"الحد الأقصى لعدد الأيام التي ستحتفظ فيها التخزين بالبيانات",commands:"الأوامر لجمع الإحصائيات الإضافية",attribute:"مفتاح تلقي الإحصائيات",timeout:"مهلة زمنية لتنفيذ الأمر",command:"سيتم استخدام نتيجة تنفيذ الأمر كقيمة لتلقي الإحصائيات","check-device-activity":"يمكنك تمكين مراقبة نشاط كل جهاز متصل","inactivity-timeout":"الوقت بعد الذي ستفصل البوابة الجهاز","inactivity-period":"تكرار فحص نشاط الجهاز","minimal-pack-delay":"التأخير بين إرسال حزم الرسائل (يؤدي تقليل هذا الإعداد إلى زيادة استخدام وحدة المعالجة المركزية)",qos:"جودة الخدمة في رسائل MQTT (0 - على الأكثر مرة واحدة، 1 - على الأقل مرة واحدة)","server-port":"منفذ الشبكة الذي سيستمع فيه خادم GRPC للاستفسارات الواردة.","grpc-keep-alive-timeout":"الحد الأقصى للوقت الذي يجب أن ينتظره الخادم لاستجابة رسالة الحفاظ على الاتصال قبل اعتبار الاتصال ميتًا.","grpc-keep-alive":"المدة بين رسائل حفظ الاتصال المتعاقبة عند عدم وجود استدعاء RPC نشط.","grpc-min-time-between-pings":"الحد الأدنى للوقت الذي يجب فيه أن ينتظر الخادم بين إرسال رسائل حفظ الاتصال","grpc-max-pings-without-data":"الحد الأقصى لعدد رسائل حفظ الاتصال التي يمكن للخادم إرسالها دون تلقي أي بيانات قبل اعتبار الاتصال ميتًا.","grpc-min-ping-interval-without-data":"الحد الأدنى للوقت الذي يجب فيه أن ينتظر الخادم بين إرسال رسائل حفظ الاتصال عند عدم إرسال أو استلام بيانات.","permit-without-calls":"السماح للخادم بإبقاء اتصال GRPC حيًا حتى عندما لا تكون هناك استدعاءات RPC نشطة."}}},Et={gateway:{"add-entry":"Afegir configuració","connector-add":"Afegir conector","connector-enabled":"Activar conector","connector-name":"Nom conector","connector-name-required":"Cal nom conector.","connector-type":"Tipus conector","connector-type-required":"Cal tipus conector.",connectors:"Configuració de conectors","create-new-gateway":"Crear un gateway nou","create-new-gateway-text":"Crear un nou gateway amb el nom: '{{gatewayName}}'?",delete:"Esborrar configuració","download-tip":"Descarregar fitxer de configuració",gateway:"Gateway","gateway-exists":"Ja existeix un dispositiu amb el mateix nom.","gateway-name":"Nom de Gateway","gateway-name-required":"Cal un nom de gateway.","gateway-saved":"Configuració de gateway gravada satisfactòriament.","json-parse":"JSON no vàlid.","json-required":"El camp no pot ser buit.","no-connectors":"No hi ha conectors","no-data":"No hi ha configuracions","no-gateway-found":"No s'ha trobat cap gateway.","no-gateway-matching":" '{{item}}' no trobat.","path-logs":"Ruta als fitxers de log","path-logs-required":"Cal ruta.",remote:"Configuració remota","remote-logging-level":"Nivel de logging","remove-entry":"Esborrar configuració","save-tip":"Gravar fitxer de configuració","security-type":"Tipus de seguretat","security-types":{"access-token":"Token d'accés",tls:"TLS"},storage:"Grabació","storage-max-file-records":"Número màxim de registres en fitxer","storage-max-files":"Número màxim de fitxers","storage-max-files-min":"El número mínim és 1.","storage-max-files-pattern":"Número no vàlid.","storage-max-files-required":"Cal número.","storage-max-records":"Màxim de registres en el magatzem","storage-max-records-min":"El número mínim és 1.","storage-max-records-pattern":"Número no vàlid.","storage-max-records-required":"Cal número.","storage-pack-size":"Mida màxim de esdeveniments","storage-pack-size-min":"El número mínim és 1.","storage-pack-size-pattern":"Número no vàlid.","storage-pack-size-required":"Cal número.","storage-path":"Ruta de magatzem","storage-path-required":"Cal ruta de magatzem.","storage-type":"Tipus de magatzem","storage-types":{"file-storage":"Magatzem fitxer","memory-storage":"Magatzem en memoria"},thingsboard:"ThingsBoard","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"Cal Host.","thingsboard-port":"Port ThingsBoard","thingsboard-port-max":"El port màxim és 65535.","thingsboard-port-min":"El port mínim és 1.","thingsboard-port-pattern":"Port no vàlid.","thingsboard-port-required":"Cal port.",tidy:"Endreçat","tidy-tip":"Endreçat JSON","title-connectors-json":"Configuració conector {{typeName}}","tls-path-ca-certificate":"Ruta al certificat CA al gateway","tls-path-client-certificate":"Ruta al certificat client al gateway","tls-path-private-key":"Ruta a la clau privada al gateway","toggle-fullscreen":"Pantalla completa fullscreen","transformer-json-config":"Configuració JSON*","update-config":"Afegir/actualizar configuració JSON"}},It={gateway:{"add-entry":"Přidat konfiguraci","connector-add":"Přidat nový konektor","connector-enabled":"Povolit konektor","connector-name":"Název konektoru","connector-name-required":"Název konektoru je povinný.","connector-type":"Typ konektoru","connector-type-required":"Typ konektoru je povinný.",connectors:"Konfigurace konektoru","create-new-gateway":"Vytvořit novou bránu","create-new-gateway-text":"Jste si jisti, že chcete vytvořit novou bránu s názvem: '{{gatewayName}}'?",delete:"Smazat konfiguraci","download-tip":"Stáhnout soubor konfigurace",gateway:"Brána","gateway-exists":"Zařízení se shodným názvem již existuje.","gateway-name":"Název brány","gateway-name-required":"Název brány je povinný.","gateway-saved":"Konfigurace brány byla úspěšně uložena.","json-parse":"Neplatný JSON.","json-required":"Pole nemůže být prázdné.","no-connectors":"Žádné konektory","no-data":"Žádné konfigurace","no-gateway-found":"Žádné brány nebyly nalezeny.","no-gateway-matching":" '{{item}}' nenalezena.","path-logs":"Cesta k souborům logu","path-logs-required":"Cesta je povinná.",remote:"Vzdálená konfigurace","remote-logging-level":"Úroveň logování","remove-entry":"Odstranit konfiguraci","save-tip":"Uložit soubor konfigurace","security-type":"Typ zabezpečení","security-types":{"access-token":"Přístupový token",tls:"TLS"},storage:"Úložiště","storage-max-file-records":"Maximální počet záznamů v souboru","storage-max-files":"Maximální počet souborů","storage-max-files-min":"Minimální počet je 1.","storage-max-files-pattern":"Počet není platný.","storage-max-files-required":"Počet je povinný.","storage-max-records":"Maximální počet záznamů v úložišti","storage-max-records-min":"Minimální počet záznamů je 1.","storage-max-records-pattern":"Počet není platný.","storage-max-records-required":"Maximální počet záznamů je povinný.","storage-pack-size":"Maximální velikost souboru událostí","storage-pack-size-min":"Minimální počet je 1.","storage-pack-size-pattern":"Počet není platný.","storage-pack-size-required":"Maximální velikost souboru událostí je povinná.","storage-path":"Cesta k úložišti","storage-path-required":"Cesta k úložišti je povinná.","storage-type":"Typ úložiště","storage-types":{"file-storage":"Soubor","memory-storage":"Paměť"},thingsboard:"ThingsBoard","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"Host je povinný.","thingsboard-port":"Port ThingsBoard","thingsboard-port-max":"Maximální číslo portu je 65535.","thingsboard-port-min":"Minimální číslo portu je 1.","thingsboard-port-pattern":"Port není platný.","thingsboard-port-required":"Port je povinný.",tidy:"Uspořádat","tidy-tip":"Uspořádat JSON konfiguraci","title-connectors-json":"Konfigurace {{typeName}} konektoru","tls-path-ca-certificate":"Cesta k certifikátu CA brány","tls-path-client-certificate":"Cesta k certifikátu klienta brány","tls-path-private-key":"Cesta k privátnímu klíči brány","toggle-fullscreen":"Přepnout do režimu celé obrazovky","transformer-json-config":"JSON* konfigurace","update-config":"Přidat/editovat JSON konfiguraci"}},Mt={gateway:{"add-entry":"Tilføj konfiguration","connector-add":"Tilføj ny stikforbindelse","connector-enabled":"Aktivér stikforbindelse","connector-name":"Navn på stikforbindelse","connector-name-required":"Navn på stikforbindelse er påkrævet.","connector-type":"Stikforbindelsestype","connector-type-required":"Stikforbindelsestype er påkrævet.",connectors:"Konfiguration af stikforbindelser","create-new-gateway":"Opret en ny gateway","create-new-gateway-text":"",delete:"Slet konfiguration","download-tip":"Download konfigurationsfil",gateway:"Gateway","gateway-exists":"Enhed med samme navn findes allerede.","gateway-name":"Gateway-navn","gateway-name-required":"Gateway-navn er påkrævet.","gateway-saved":"Gateway-konfigurationen blev gemt.","json-parse":"Ikke gyldig JSON.","json-required":"Feltet må ikke være tomt.","no-connectors":"Ingen stikforbindelser","no-data":"Ingen konfigurationer","no-gateway-found":"Ingen gateway fundet.","no-gateway-matching":"","path-logs":"Sti til logfiler","path-logs-required":"Sti er påkrævet.",remote:"Fjernkonfiguration","remote-logging-level":"Logføringsniveau","remove-entry":"Fjern konfiguration","save-tip":"Gem konfigurationsfil","security-type":"Sikkerhedstype","security-types":{"access-token":"Adgangstoken",tls:"TLS"},storage:"Lagring","storage-max-file-records":"Maks. antal poster i fil","storage-max-files":"Maks. antal filer","storage-max-files-min":"Min. antal er 1.","storage-max-files-pattern":"Antal er ikke gyldigt.","storage-max-files-required":"Antal er påkrævet.","storage-max-records":"Maks. antal poster i lagring","storage-max-records-min":"Min. antal poster er 1.","storage-max-records-pattern":"Antal er ikke gyldigt.","storage-max-records-required":"Maks. antal poster er påkrævet.","storage-pack-size":"Maks. antal pakkestørrelse for begivenhed","storage-pack-size-min":"Min. antal er 1.","storage-pack-size-pattern":"Antal er ikke gyldigt.","storage-pack-size-required":"Maks. antal pakkestørrelse for begivenhed er påkrævet.","storage-path":"Lagringssti","storage-path-required":"Lagringssti er påkrævet.","storage-type":"Lagringstype","storage-types":{"file-storage":"Lagring af filter","memory-storage":"Lagring af hukommelse"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard-vært","thingsboard-host-required":"Vært er påkrævet.","thingsboard-port":"ThingsBoard-port","thingsboard-port-max":"Maks. portnummer er 65535.","thingsboard-port-min":"Min. portnummer er 1.","thingsboard-port-pattern":"Port er ikke gyldig.","thingsboard-port-required":"Port er påkrævet.",tidy:"Tidy","tidy-tip":"Tidy konfig. JSON","title-connectors-json":"","tls-path-ca-certificate":"Sti til CA-certifikat på gateway","tls-path-client-certificate":"Sti til klientcertifikat på gateway","tls-path-private-key":"Sti til privat nøgle på gateway","toggle-fullscreen":"Skift til fuld skærm","transformer-json-config":"Konfiguration JSON*","update-config":"Tilføj/opdater konfiguration JSON"}},kt={gateway:{"add-entry":"Añadir configuración",advanced:"Avanzado","checking-device-activity":"Probando actividad de dispositivo",command:"Comandos Docker","command-copied-message":"Se han copiado los comandos al portapapeles",configuration:"Configuración","connector-add":"Añadir conector","connector-enabled":"Activar conector","connector-name":"Nombre conector","connector-name-required":"Se requiere nombre conector.","connector-type":"Tipo conector","connector-type-required":"Se requiere tipo conector.",connectors:"Conectores","connectors-config":"Configuración de conectores","connectors-table-enabled":"Enabled","connectors-table-name":"Nombre","connectors-table-type":"Tipo","connectors-table-status":"Estado","connectors-table-actions":"Acciones","connectors-table-key":"Clave","connectors-table-class":"Clase","rpc-command-send":"Enviar","rpc-command-result":"Resultado","rpc-command-edit-params":"Editar parametros","gateway-configuration":"Configuración General","create-new-gateway":"Crear un gateway nuevo","create-new-gateway-text":"Crear un nuevo gateway con el nombre: '{{gatewayName}}'?","created-time":"Hora de creación","configuration-delete-dialog-header":"Las configuraciones se borrarán","configuration-delete-dialog-body":"Sólo es posible desactivar la configuración remota, si hay acceso físico al gateway. Se borrarán todas las configuraciones previas.

\nPara desactivar la configuración, introduce el nombre del gateway aquí","configuration-delete-dialog-input":"Nombre Gateway","configuration-delete-dialog-input-required":"Se requiere nombre de gateway","configuration-delete-dialog-confirm":"Desactivar",delete:"Borrar configuración","download-tip":"Descargar fichero de configuración","drop-file":"Arrastra un fichero o",gateway:"Gateway","gateway-exists":"Ya existe un dispositivo con el mismo nombre.","gateway-name":"Nombre de Gateway","gateway-name-required":"Se requiere un nombre de gateway.","gateway-saved":"Configuración de gateway grabada satisfactoriamente.",grpc:"GRPC","grpc-keep-alive-timeout":"Timeout Keep alive (en ms)","grpc-keep-alive-timeout-required":"Se requiere Timeout Keep alive","grpc-keep-alive-timeout-min":"El valor no puede ser menor de 1","grpc-keep-alive-timeout-pattern":"El valor no es válido","grpc-keep-alive":"Keep alive (en ms)","grpc-keep-alive-required":"Se requiere keep alive","grpc-keep-alive-min":"El valor no puede ser menor de 1","grpc-keep-alive-pattern":"El valor keep alive no es válido","grpc-min-time-between-pings":"Tiempo mínimo entre pings (en ms)","grpc-min-time-between-pings-required":"Se requiere tiempo mínimo entre pings","grpc-min-time-between-pings-min":"El valor no puede ser menor de 1","grpc-min-time-between-pings-pattern":"El valor de tiempo mínimo entre pings no es válido","grpc-min-ping-interval-without-data":"Intervalo mínimo sin datos (en ms)","grpc-min-ping-interval-without-data-required":"Se requiere intervalo","grpc-min-ping-interval-without-data-min":"El valor no puede ser menor de 1","grpc-min-ping-interval-without-data-pattern":"El valor de intervalo no es válido","grpc-max-pings-without-data":"Intervalo máximo sin datos","grpc-max-pings-without-data-required":"Se requiere intervalo","grpc-max-pings-without-data-min":"El valor no puede ser menor de 1","grpc-max-pings-without-data-pattern":"El valor de intervalo no es válido","inactivity-check-period-seconds":"Periodo de control de inactividad (en segundos)","inactivity-check-period-seconds-required":"Se requiere periodo","inactivity-check-period-seconds-min":"El valor no puede ser menor de 1","inactivity-check-period-seconds-pattern":"El valor del periodo no es válido","inactivity-timeout-seconds":"Timeout de inactividad (en segundos)","inactivity-timeout-seconds-required":"Se requiere timeout de inactividad","inactivity-timeout-seconds-min":"El valor no puede ser menor de 1","inactivity-timeout-seconds-pattern":"El valor de inactividad no es válido","json-parse":"JSON no válido.","json-required":"El campo no puede estar vacío.",logs:{logs:"Registros",days:"días",hours:"horas",minutes:"minutos",seconds:"segundos","date-format":"Formato de fecha","date-format-required":"Se requiere formato de fecha","log-format":"Formato de registro","log-type":"Tipo de registro","log-format-required":"Se requiere tipo de registro",remote:"Registro remoto","remote-logs":"Registro remoto",local:"Registro local",level:"Nivel de registro","file-path":"Ruta de fichero","file-path-required":"Se requiere ruta de fichero","saving-period":"Periodo de guardado de registros","saving-period-min":"El periodo no puede ser menor que 1","saving-period-required":"Se requiere periodo de guardado","backup-count":"Número de backups","backup-count-min":"El número de backups no puede ser menor que 1","backup-count-required":"Se requiere número de backups"},"min-pack-send-delay":"Tiempo de espera, envío de paquetes (en ms)","min-pack-send-delay-required":"Se requiere tiempo de espera","min-pack-send-delay-min":"El tiempo de espera no puede ser menor que 0","no-connectors":"No hay conectores","no-data":"No hay configuraciones","no-gateway-found":"No se ha encontrado ningún gateway.","no-gateway-matching":" '{{item}}' no encontrado.","path-logs":"Ruta a los archivos de log","path-logs-required":"Ruta requerida.","permit-without-calls":"Permitir Keep alive si llamadas",remote:"Configuración remota","remote-logging-level":"Nivel de logging","remove-entry":"Borrar configuración","remote-shell":"Consola remota","remote-configuration":"Configuración remota",other:"otros","save-tip":"Grabar fichero de configuración","security-type":"Tipo de seguridad","security-types":{"access-token":"Tóken de acceso","username-password":"Usuario y contraseña",tls:"TLS","tls-access-token":"TLS + Tóken de acceso","tls-private-key":"TLS + Clave privada"},"server-port":"Puerto del servidor",statistics:{statistic:"Estadística",statistics:"Estadísticas","statistic-commands-empty":"No hay estadísticas",commands:"Comandos","send-period":"Periodo de envío de estadísticas (en segundos)","send-period-required":"Se requiere periodo de envío","send-period-min":"El periodo de envío no puede ser menor de 60","send-period-pattern":"El periodo de envío no es válido","check-connectors-configuration":"Revisar configuración de conectores (en segundos)","check-connectors-configuration-required":"Se requiere un valor","check-connectors-configuration-min":"El valor no puede ser menor de 1","check-connectors-configuration-pattern":"La configuración no es válida",add:"Añadir comando",timeout:"Timeout","timeout-required":"Se requiere timeout","timeout-min":"El timeout no puede ser menor de 1","timeout-pattern":"El timeout no es válido","attribute-name":"Nombre de atributo","attribute-name-required":"Se requiere nombre de atributo",command:"Comando","command-required":"Se requiere comando",remove:"Borrar comando"},storage:"Grabación","storage-max-file-records":"Número máximo de registros en fichero","storage-max-files":"Número máximo de ficheros","storage-max-files-min":"El número mínimo es 1.","storage-max-files-pattern":"Número no válido.","storage-max-files-required":"Se requiere número.","storage-max-records":"Máximo de registros en el almacén","storage-max-records-min":"El número mínimo es 1.","storage-max-records-pattern":"Número no válido.","storage-max-records-required":"Se requiere número.","storage-read-record-count":"Leer número de entradas en almacén","storage-read-record-count-min":"El número mínimo de entradas es 1.","storage-read-record-count-pattern":"El número no es válido.","storage-read-record-count-required":"Se requiere número de entradas.","storage-max-read-record-count":"Número máximo de entradas en el almacén","storage-max-read-record-count-min":"El número mínimo es 1.","storage-max-read-record-count-pattern":"El número no es válido","storage-max-read-record-count-required":"Se requiere número máximo de entradas.","storage-data-folder-path":"Ruta de carpeta de datos","storage-data-folder-path-required":"Se requiere ruta.","storage-pack-size":"Tamaño máximo de eventos","storage-pack-size-min":"El número mínimo es 1.","storage-pack-size-pattern":"Número no válido.","storage-pack-size-required":"Se requiere número.","storage-path":"Ruta de almacén","storage-path-required":"Se requiere ruta de almacén.","storage-type":"Tipo de almacén","storage-types":{"file-storage":"Almacén en fichero","memory-storage":"Almacén en memoria",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"General","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"Se requiere Host.","thingsboard-port":"Puerto ThingsBoard","thingsboard-port-max":"El puerto máximo es 65535.","thingsboard-port-min":"El puerto mínimo es 1.","thingsboard-port-pattern":"Puerto no válido.","thingsboard-port-required":"Se requiere puerto.",tidy:"Tidy","tidy-tip":"Tidy JSON","title-connectors-json":"Configuración conector {{typeName}}","tls-path-ca-certificate":"Ruta al certificado CA en el gateway","tls-path-client-certificate":"Ruta al certificado cliente en el gateway","messages-ttl-check-in-hours":"Comprobación de TTL de mensajes en horas","messages-ttl-check-in-hours-required":"Campo requerido.","messages-ttl-check-in-hours-min":"El mínimo es 1.","messages-ttl-check-in-hours-pattern":"El número no es válido.","messages-ttl-in-days":"TTL (Time to live) de mensages en días","messages-ttl-in-days-required":"Se requiere TTL de mensajes.","messages-ttl-in-days-min":"El número mínimo es 1.","messages-ttl-in-days-pattern":"El número no es válido.","mqtt-qos":"QoS","mqtt-qos-required":"Se requiere QoS","mqtt-qos-range":"El rango de valores es desde 0 a 1","tls-path-private-key":"Ruta a la clave privada en el gateway","toggle-fullscreen":"Pantalla completa fullscreen","transformer-json-config":"Configuración JSON*","update-config":"Añadir/actualizar configuración JSON",hints:{"remote-configuration":"Habilita la administración y configuración remota del gateway","remote-shell":"Habilita el control remoto del sistema operativo del gateway desde el widget terminal remoto",host:"Hostname o dirección IP del servidor Thingsboard",port:"Puerto del servicio MQTT en el servidor Thingsboard",token:"Access token para el gateway","client-id":"ID de cliente MQTT para el gateway",username:"Usuario MQTT para el gateway",password:"Contraseña MQTT para el gateway","ca-cert":"Ruta al fichero del certificado CA","date-form":"Formato de fecha en los mensajes de registro","data-folder":"Ruta a la carpeta que contendrá los datos (Relativa o absoluta)","log-format":"Formato de mensajes en registro","remote-log":"Habilita el registro remoto y la posterior lectura desde el gateway","backup-count":"Si el contaje de copias de seguridad es mayor que 0, cuando se realice una renovación, no se conservan más que los archivos de recuento de copias de seguridad, los más antíguos se eliminarán",storage:"Provee la configuración para el grabado de datos entrantes antes de que se envíen a la plataforma","max-file-count":"Número máximo de ficheros que se crearán","max-read-count":"Númeo máximo de mensajes a obtener desde el disco y enviados a la plataforma","max-records":"Número máximo de registros que se guardarán en un solo fichero","read-record-count":"Número de mensages a obtener desde el almacenamiento y enviados a la plataforma","max-records-count":"Número máximo de datos en almacenamiento antes de enviar a la plataforma","ttl-check-hour":"Con qué frecuencia el gateway comprobará si los datos están obsoletos","ttl-messages-day":"Número máximo de días para la retención de datos en el almacén",commands:"Comandos para recoger estadísticas adicionales",attribute:"Clave de telemetría para estadísticas",timeout:"Timeout para la ejecución de comandos",command:"El resultado de la ejecución del comando, se usará como valor para la telemetría","check-device-activity":"Habilita la monitorización de cada uno de los dispositivos conectados","inactivity-timeout":"Tiempo tras que el gateway desconectará el dispositivo","inactivity-period":"Periodo de monitorización de actividad en el dispositivo","minimal-pack-delay":"Tiempo de espera entre envío de paquetes de mensajes (Un valor muy bajo, resultará en un aumento de uso de la CPU en el gateway)",qos:"Quality of Service en los mensajes MQTT (0 - at most once, 1 - at least once)","server-port":"Puerto de red en el cual el servidor GRPC escuchará conexiones entrantes.","grpc-keep-alive-timeout":"Tiempo máximo, el cual el servidor esperara un ping keepalive antes de considerar la conexión terminada.","grpc-keep-alive":"Duración entre dos pings keepalive cuando no haya llamada RPC activa.","grpc-min-time-between-pings":"Mínimo tiempo que el servidor debe esperar entre envíos de mensajes de ping","grpc-max-pings-without-data":"Número máximo de pings keepalive que el servidor puede enviar sin recibir ningún dato antes de considerar la conexión terminada.","grpc-min-ping-interval-without-data":"Mínimo tiempo que el servidor debe esperar entre envíos de ping keepalive cuando no haya ningún dato en envío o recepción.","permit-without-calls":"Permitir al servidor mantener la conexión GRPC abierta, cuando no haya llamadas RPC activas."}}},Pt={gateway:{"add-entry":"설정 추가","connector-add":"새로운 연결자 추가","connector-enabled":"Enable connector","connector-name":"Connector name","connector-name-required":"Connector name is required.","connector-type":"Connector type","connector-type-required":"Connector type is required.",connectors:"Connectors configuration","create-new-gateway":"Create a new gateway","create-new-gateway-text":"Are you sure you want create a new gateway with name: '{{gatewayName}}'?",delete:"Delete configuration","download-tip":"Download configuration file",gateway:"Gateway","gateway-exists":"Device with same name is already exists.","gateway-name":"Gateway name","gateway-name-required":"Gateway name is required.","gateway-saved":"Gateway configuration successfully saved.","json-parse":"Not valid JSON.","json-required":"Field cannot be empty.","no-connectors":"No connectors","no-data":"No configurations","no-gateway-found":"No gateway found.","no-gateway-matching":" '{{item}}' not found.","path-logs":"Path to log files","path-logs-required":"Path is required.",remote:"Remote configuration","remote-logging-level":"Logging level","remove-entry":"Remove configuration","save-tip":"Save configuration file","security-type":"Security type","security-types":{"access-token":"Access Token",tls:"TLS"},storage:"Storage","storage-max-file-records":"Maximum records in file","storage-max-files":"Maximum number of files","storage-max-files-min":"Minimum number is 1.","storage-max-files-pattern":"Number is not valid.","storage-max-files-required":"Number is required.","storage-max-records":"Maximum records in storage","storage-max-records-min":"Minimum number of records is 1.","storage-max-records-pattern":"Number is not valid.","storage-max-records-required":"Maximum records is required.","storage-pack-size":"Maximum event pack size","storage-pack-size-min":"Minimum number is 1.","storage-pack-size-pattern":"Number is not valid.","storage-pack-size-required":"Maximum event pack size is required.","storage-path":"Storage path","storage-path-required":"Storage path is required.","storage-type":"Storage type","storage-types":{"file-storage":"File storage","memory-storage":"Memory storage"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard host","thingsboard-host-required":"Host is required.","thingsboard-port":"ThingsBoard port","thingsboard-port-max":"Maximum port number is 65535.","thingsboard-port-min":"Minimum port number is 1.","thingsboard-port-pattern":"Port is not valid.","thingsboard-port-required":"Port is required.",tidy:"Tidy","tidy-tip":"Tidy config JSON","title-connectors-json":"Connector {{typeName}} configuration","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON"}},Dt={gateway:{"add-entry":"Add configuration",advanced:"Advanced","checking-device-activity":"Checking device activity",command:"Docker commands","command-copied-message":"Docker command has been copied to clipboard",configuration:"Configuration","connector-add":"Add new connector","connector-enabled":"Enable connector","connector-name":"Connector name","connector-name-required":"Connector name is required.","connector-type":"Connector type","connector-type-required":"Connector type is required.",connectors:"Connectors","connectors-config":"Connectors configuration","connectors-table-enabled":"Enabled","connectors-table-name":"Name","connectors-table-type":"Type","connectors-table-status":"Status","connectors-table-actions":"Actions","connectors-table-key":"Key","connectors-table-class":"Class","rpc-command-send":"Send","rpc-command-result":"Result","rpc-command-edit-params":"Edit parameters","gateway-configuration":"General Configuration","docker-label":"In order to run ThingsBoard IoT gateway in docker with credentials for this device you can use the following commands.","create-new-gateway":"Create a new gateway","create-new-gateway-text":"Are you sure you want create a new gateway with name: '{{gatewayName}}'?","created-time":"Created time","configuration-delete-dialog-header":"Configurations will be deleted","configuration-delete-dialog-body":"Turning off Remote Configuration is possible only if there is physical access to the Gateway. All previous configurations will be deleted.

\nTo turn off configuration, enter gateway name below","configuration-delete-dialog-input":"Gateway name","configuration-delete-dialog-input-required":"Gateway name is mandatory","configuration-delete-dialog-confirm":"Turn Off",delete:"Delete configuration","download-tip":"Download configuration file","drop-file":"Drop file here or",gateway:"Gateway","gateway-exists":"Device with same name is already exists.","gateway-name":"Gateway name","gateway-name-required":"Gateway name is required.","gateway-saved":"Gateway configuration successfully saved.",grpc:"GRPC","grpc-keep-alive-timeout":"Keep alive timeout (in ms)","grpc-keep-alive-timeout-required":"Keep alive timeout is required","grpc-keep-alive-timeout-min":"Keep alive timeout can not be less then 1","grpc-keep-alive-timeout-pattern":"Keep alive timeout is not valid","grpc-keep-alive":"Keep alive (in ms)","grpc-keep-alive-required":"Keep alive is required","grpc-keep-alive-min":"Keep alive can not be less then 1","grpc-keep-alive-pattern":"Keep alive is not valid","grpc-min-time-between-pings":"Min time between pings (in ms)","grpc-min-time-between-pings-required":"Min time between pings is required","grpc-min-time-between-pings-min":"Min time between pings can not be less then 1","grpc-min-time-between-pings-pattern":"Min time between pings is not valid","grpc-min-ping-interval-without-data":"Min ping interval without data (in ms)","grpc-min-ping-interval-without-data-required":"Min ping interval without data is required","grpc-min-ping-interval-without-data-min":"Min ping interval without data can not be less then 1","grpc-min-ping-interval-without-data-pattern":"Min ping interval without data is not valid","grpc-max-pings-without-data":"Max pings without data","grpc-max-pings-without-data-required":"Max pings without data is required","grpc-max-pings-without-data-min":"Max pings without data can not be less then 1","grpc-max-pings-without-data-pattern":"Max pings without data is not valid","inactivity-check-period-seconds":"Inactivity check period (in sec)","inactivity-check-period-seconds-required":"Inactivity check period is required","inactivity-check-period-seconds-min":"Inactivity check period can not be less then 1","inactivity-check-period-seconds-pattern":"Inactivity check period is not valid","inactivity-timeout-seconds":"Inactivity timeout (in sec)","inactivity-timeout-seconds-required":"Inactivity timeout is required","inactivity-timeout-seconds-min":"Inactivity timeout can not be less then 1","inactivity-timeout-seconds-pattern":"Inactivity timeout is not valid","json-parse":"Not valid JSON.","json-required":"Field cannot be empty.",logs:{logs:"Logs",days:"days",hours:"hours",minutes:"minutes",seconds:"seconds","date-format":"Date format","date-format-required":"Date format required","log-format":"Log format","log-type":"Log type","log-format-required":"Log format required",remote:"Remote logging","remote-logs":"Remote logs",local:"Local logging",level:"Log level","file-path":"File path","file-path-required":"File path required","saving-period":"Log saving period","saving-period-min":"Log saving period can not be less then 1","saving-period-required":"Log saving period required","backup-count":"Backup count","backup-count-min":"Backup count can not be less then 1","backup-count-required":"Backup count required"},"min-pack-send-delay":"Min pack send delay (in ms)","min-pack-send-delay-required":"Min pack send delay is required","min-pack-send-delay-min":"Min pack send delay can not be less then 0","no-connectors":"No connectors","no-data":"No configurations","no-gateway-found":"No gateway found.","no-gateway-matching":" '{{item}}' not found.","path-logs":"Path to log files","path-logs-required":"Path is required.","permit-without-calls":"Keep alive permit without calls",remote:"Remote configuration","remote-logging-level":"Logging level","remove-entry":"Remove configuration","remote-shell":"Remote shell","remote-configuration":"Remote Configuration",other:"Other","save-tip":"Save configuration file","security-type":"Security type","security-types":{"access-token":"Access Token","username-password":"Username and Password",tls:"TLS","tls-access-token":"TLS + Access Token","tls-private-key":"TLS + Private Key"},"server-port":"Server port",statistics:{statistic:"Statistic",statistics:"Statistics","statistic-commands-empty":"No statistics available",commands:"Commands","send-period":"Statistic send period (in sec)","send-period-required":"Statistic send period is required","send-period-min":"Statistic send period can not be less then 60","send-period-pattern":"Statistic send period is not valid","check-connectors-configuration":"Check connectors configuration (in sec)","check-connectors-configuration-required":"Check connectors configuration is required","check-connectors-configuration-min":"Check connectors configuration can not be less then 1","check-connectors-configuration-pattern":"Check connectors configuration is not valid",add:"Add command",timeout:"Timeout","timeout-required":"Timeout is required","timeout-min":"Timeout can not be less then 1","timeout-pattern":"Timeout is not valid","attribute-name":"Attribute name","attribute-name-required":"Attribute name is required",command:"Command","command-required":"Command is required",remove:"Remove command"},storage:"Storage","storage-max-file-records":"Maximum records in file","storage-max-files":"Maximum number of files","storage-max-files-min":"Minimum number is 1.","storage-max-files-pattern":"Number is not valid.","storage-max-files-required":"Number is required.","storage-max-records":"Maximum records in storage","storage-max-records-min":"Minimum number of records is 1.","storage-max-records-pattern":"Number is not valid.","storage-max-records-required":"Maximum records is required.","storage-read-record-count":"Read record count in storage","storage-read-record-count-min":"Minimum number of records is 1.","storage-read-record-count-pattern":"Number is not valid.","storage-read-record-count-required":"Read record count is required.","storage-max-read-record-count":"Max read record count in storage","storage-max-read-record-count-min":"Minimum number of records is 1.","storage-max-read-record-count-pattern":"Number is not valid.","storage-max-read-record-count-required":"Max Read record count is required.","storage-data-folder-path":"Data folder path","storage-data-folder-path-required":"Data folder path is required.","storage-pack-size":"Maximum event pack size","storage-pack-size-min":"Minimum number is 1.","storage-pack-size-pattern":"Number is not valid.","storage-pack-size-required":"Maximum event pack size is required.","storage-path":"Storage path","storage-path-required":"Storage path is required.","storage-type":"Storage type","storage-types":{"file-storage":"File storage","memory-storage":"Memory storage",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"General","thingsboard-host":"ThingsBoard host","thingsboard-host-required":"Host is required.","thingsboard-port":"ThingsBoard port","thingsboard-port-max":"Maximum port number is 65535.","thingsboard-port-min":"Minimum port number is 1.","thingsboard-port-pattern":"Port is not valid.","thingsboard-port-required":"Port is required.",tidy:"Tidy","tidy-tip":"Tidy config JSON","title-connectors-json":"Connector {{typeName}} configuration","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","messages-ttl-check-in-hours":"Messages TTL check in hours","messages-ttl-check-in-hours-required":"Messages TTL check in hours is required.","messages-ttl-check-in-hours-min":"Min number is 1.","messages-ttl-check-in-hours-pattern":"Number is not valid.","messages-ttl-in-days":"Messages TTL in days","messages-ttl-in-days-required":"Messages TTL in days is required.","messages-ttl-in-days-min":"Min number is 1.","messages-ttl-in-days-pattern":"Number is not valid.","mqtt-qos":"QoS","mqtt-qos-required":"QoS is required","mqtt-qos-range":"QoS values range is from 0 to 1","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON",hints:{"remote-configuration":"Enables remote configuration and management of the gateway","remote-shell":"Enables remote control of the operating system with the gateway from the Remote Shell widget",host:"Hostname or IP address of ThingsBoard server",port:"Port of MQTT service on ThingsBoard server",token:"Access token for the gateway from ThingsBoard server","client-id":"MQTT client id for the gateway form ThingsBoard server",username:"MQTT username for the gateway form ThingsBoard server",password:"MQTT password for the gateway form ThingsBoard server","ca-cert":"Path to CA certificate file","date-form":"Date format in log message","data-folder":"Path to folder, that will contains data (Relative or Absolute)","log-format":"Log message format","remote-log":"Enables remote logging and logs reading from the gateway","backup-count":"If backup count is > 0, when a rollover is done, no more than backup count files are kept - the oldest ones are deleted",storage:"Provides configuration for saving incoming data before it is sent to the platform","max-file-count":"Maximum count of file that will be created","max-read-count":"Count of messages to get from storage and send to ThingsBoard","max-records":"Maximum count of records that will be stored in one file","read-record-count":"Count of messages to get from storage and send to ThingsBoard","max-records-count":"Maximum count of data in storage before send to ThingsBoard","ttl-check-hour":"How often will Gateway check data for obsolescence","ttl-messages-day":"Maximum days that storage will save data",commands:"Commands for collecting additional statistic",attribute:"Statistic telemetry key",timeout:"Timeout for command executing",command:"The result of the command execution, will be used as the value for telemetry","check-device-activity":"Enables monitor the activity of each connected device","inactivity-timeout":"Time after whose the gateway will disconnect device","inactivity-period":"Periodicity of device activity check","minimal-pack-delay":"Delay between sending packs of messages (Decreasing this setting results in increased CPU usage)",qos:"Quality of Service in MQTT messaging (0 - at most once, 1 - at least once)","server-port":"Network port on which GRPC server will listen for incoming connections.","grpc-keep-alive-timeout":"Maximum time the server should wait for a keepalive ping response before considering the connection dead.","grpc-keep-alive":"Duration between two successive keepalive ping messages when there is no active RPC call.","grpc-min-time-between-pings":"Minimum amount of time the server should wait between sending keepalive ping messages","grpc-max-pings-without-data":"Maximum number of keepalive ping messages that the server can send without receiving any data before it considers the connection dead.","grpc-min-ping-interval-without-data":"Minimum amount of time the server should wait between sending keepalive ping messages when there is no data being sent or received.","permit-without-calls":"Allow server to keep the GRPC connection alive even when there are no active RPC calls."}}},At={gateway:{"add-entry":"Configuratie toevoegen","connector-add":"Nieuwe connector toevoegen","connector-enabled":"Connector inschakelen","connector-name":"Naam van de connector","connector-name-required":"De naam van de connector is vereist.","connector-type":"Type aansluiting","connector-type-required":"Het type connector is vereist.",connectors:"Configuratie van connectoren","create-new-gateway":"Een nieuwe gateway maken","create-new-gateway-text":"Weet u zeker dat u een nieuwe gateway wilt maken met de naam: '{{gatewayName}}'?",delete:"Configuratie verwijderen","download-tip":"Configuratiebestand downloaden",gateway:"Gateway","gateway-exists":"Device met dezelfde naam bestaat al.","gateway-name":"Naam van de gateway","gateway-name-required":"De naam van de gateway is vereist.","gateway-saved":"Gatewayconfiguratie succesvol opgeslagen.","json-parse":"Ongeldige JSON.","json-required":"Het veld mag niet leeg zijn.","no-connectors":"Geen connectoren","no-data":"Geen configuraties","no-gateway-found":"Geen gateway gevonden.","no-gateway-matching":"'{{item}}' niet gevonden.","path-logs":"Pad naar logbestanden","path-logs-required":"Pad is vereist.",remote:"Configuratie op afstand","remote-logging-level":"Registratie niveau","remove-entry":"Configuratie verwijderen","save-tip":"Configuratiebestand opslaan","security-type":"Soort beveiliging","security-types":{"access-token":"Toegang tot token",tls:"TLS (TLS)"},storage:"Opslag","storage-max-file-records":"Maximum aantal records in bestand","storage-max-files":"Maximaal aantal bestanden","storage-max-files-min":"Minimum aantal is 1.","storage-max-files-pattern":"Nummer is niet geldig.","storage-max-files-required":"Nummer is vereist.","storage-max-records":"Maximum aantal records in opslag","storage-max-records-min":"Minimum aantal records is 1.","storage-max-records-pattern":"Nummer is niet geldig.","storage-max-records-required":"Maximale records zijn vereist.","storage-pack-size":"Maximale pakketgrootte voor events","storage-pack-size-min":"Minimum aantal is 1.","storage-pack-size-pattern":"Nummer is niet geldig.","storage-pack-size-required":"De maximale pakketgrootte van het event is vereist.","storage-path":"Opslag pad","storage-path-required":"Opslagpad is vereist.","storage-type":"Type opslag","storage-types":{"file-storage":"Opslag van bestanden","memory-storage":"Geheugen opslag"},thingsboard:"Dingen Bord","thingsboard-host":"ThingsBoard-gastheer","thingsboard-host-required":"Server host is vereist.","thingsboard-port":"ThingsBoard-poort","thingsboard-port-max":"Het maximale poortnummer is 65535.","thingsboard-port-min":"Het minimale poortnummer is 1.","thingsboard-port-pattern":"Poort is niet geldig.","thingsboard-port-required":"Poort is vereist.",tidy:"Ordelijk","tidy-tip":"Opgeruimde configuratie JSON","title-connectors-json":"Configuratie van connector {{typeName}}","tls-path-ca-certificate":"Pad naar CA-certificaat op gateway","tls-path-client-certificate":"Pad naar clientcertificaat op gateway","tls-path-private-key":"Pad naar privésleutel op gateway","toggle-fullscreen":"Volledig scherm in- en uitschakelen","transformer-json-config":"Configuratie JSON*","update-config":"Configuratie JSON toevoegen/bijwerken"}},Ot={gateway:{"add-entry":"Dodaj konfigurację",advanced:"Advanced","checking-device-activity":"Checking device activity",command:"Docker commands","command-copied-message":"Docker command has been copied to clipboard",configuration:"Configuration","connector-add":"Dodaj nowe złącze","connector-enabled":"Włącz złącze","connector-name":"Nazwa złącza","connector-name-required":"Nazwa złącza jest wymagana.","connector-type":"Typ złącza","connector-type-required":"Typ złącza jest wymagany.",connectors:"Konfiguracja złączy","connectors-config":"Connectors configuration","connectors-table-enabled":"Enabled","connectors-table-name":"Name","connectors-table-type":"Type","connectors-table-status":"Status","connectors-table-actions":"Actions","connectors-table-key":"Key","connectors-table-class":"Class","rpc-command-send":"Send","rpc-command-result":"Result","rpc-command-edit-params":"Edit parameters","gateway-configuration":"General Configuration","docker-label":"In order to run ThingsBoard IoT gateway in docker with credentials for this device you can use the following commands.","create-new-gateway":"Utwórz nowy gateway","create-new-gateway-text":"Czy na pewno chcesz utworzyć nowy gateway o nazwie: '{{gatewayName}}'?","created-time":"Created time","configuration-delete-dialog-header":"Configurations will be deleted","configuration-delete-dialog-body":"Turning off Remote Configuration is possible only if there is physical access to the Gateway. All previous configurations will be deleted.

\nTo turn off configuration, enter gateway name below","configuration-delete-dialog-input":"Gateway name","configuration-delete-dialog-input-required":"Gateway name is mandatory","configuration-delete-dialog-confirm":"Turn Off",delete:"Usuń konfigurację","download-tip":"Pobierz plik konfiguracyjny","drop-file":"Drop file here or",gateway:"Wejście","gateway-exists":"Urządzenie o tej samej nazwie już istnieje.","gateway-name":"Nazwa Gateway","gateway-name-required":"Nazwa Gateway'a jest wymagana.","gateway-saved":"Konfiguracja Gatewey'a została pomyślnie zapisana.",grpc:"GRPC","grpc-keep-alive-timeout":"Keep alive timeout (in ms)","grpc-keep-alive-timeout-required":"Keep alive timeout is required","grpc-keep-alive-timeout-min":"Keep alive timeout can not be less then 1","grpc-keep-alive-timeout-pattern":"Keep alive timeout is not valid","grpc-keep-alive":"Keep alive (in ms)","grpc-keep-alive-required":"Keep alive is required","grpc-keep-alive-min":"Keep alive can not be less then 1","grpc-keep-alive-pattern":"Keep alive is not valid","grpc-min-time-between-pings":"Min time between pings (in ms)","grpc-min-time-between-pings-required":"Min time between pings is required","grpc-min-time-between-pings-min":"Min time between pings can not be less then 1","grpc-min-time-between-pings-pattern":"Min time between pings is not valid","grpc-min-ping-interval-without-data":"Min ping interval without data (in ms)","grpc-min-ping-interval-without-data-required":"Min ping interval without data is required","grpc-min-ping-interval-without-data-min":"Min ping interval without data can not be less then 1","grpc-min-ping-interval-without-data-pattern":"Min ping interval without data is not valid","grpc-max-pings-without-data":"Max pings without data","grpc-max-pings-without-data-required":"Max pings without data is required","grpc-max-pings-without-data-min":"Max pings without data can not be less then 1","grpc-max-pings-without-data-pattern":"Max pings without data is not valid","inactivity-check-period-seconds":"Inactivity check period (in sec)","inactivity-check-period-seconds-required":"Inactivity check period is required","inactivity-check-period-seconds-min":"Inactivity check period can not be less then 1","inactivity-check-period-seconds-pattern":"Inactivity check period is not valid","inactivity-timeout-seconds":"Inactivity timeout (in sec)","inactivity-timeout-seconds-required":"Inactivity timeout is required","inactivity-timeout-seconds-min":"Inactivity timeout can not be less then 1","inactivity-timeout-seconds-pattern":"Inactivity timeout is not valid","json-parse":"Nieprawidłowy JSON.","json-required":"Pole nie może być puste.",logs:{logs:"Logs",days:"days",hours:"hours",minutes:"minutes",seconds:"seconds","date-format":"Date format","date-format-required":"Date format required","log-format":"Log format","log-type":"Log type","log-format-required":"Log format required",remote:"Remote logging","remote-logs":"Remote logs",local:"Local logging",level:"Log level","file-path":"File path","file-path-required":"File path required","saving-period":"Log saving period","saving-period-min":"Log saving period can not be less then 1","saving-period-required":"Log saving period required","backup-count":"Backup count","backup-count-min":"Backup count can not be less then 1","backup-count-required":"Backup count required"},"min-pack-send-delay":"Min pack send delay (in ms)","min-pack-send-delay-required":"Min pack send delay is required","min-pack-send-delay-min":"Min pack send delay can not be less then 0","no-connectors":"Brak złączy","no-data":"Brak konfiguracji","no-gateway-found":"Nie znaleziono gateway'a.","no-gateway-matching":" '{{item}}' nie znaleziono.","path-logs":"Ścieżka do plików dziennika","path-logs-required":"Ścieżka jest wymagana.","permit-without-calls":"Keep alive permit without calls",remote:"Zdalna konfiguracja","remote-logging-level":"Poziom logowania","remove-entry":"Usuń konfigurację","remote-shell":"Remote shell","remote-configuration":"Remote Configuration",other:"Other","save-tip":"Zapisz plik konfiguracyjny","security-type":"Rodzaj zabezpieczenia","security-types":{"access-token":"Token dostępu","username-password":"Username and Password",tls:"TLS","tls-access-token":"TLS + Access Token","tls-private-key":"TLS + Private Key"},"server-port":"Server port",statistics:{statistic:"Statistic",statistics:"Statistics","statistic-commands-empty":"No statistics available",commands:"Commands","send-period":"Statistic send period (in sec)","send-period-required":"Statistic send period is required","send-period-min":"Statistic send period can not be less then 60","send-period-pattern":"Statistic send period is not valid","check-connectors-configuration":"Check connectors configuration (in sec)","check-connectors-configuration-required":"Check connectors configuration is required","check-connectors-configuration-min":"Check connectors configuration can not be less then 1","check-connectors-configuration-pattern":"Check connectors configuration is not valid",add:"Add command",timeout:"Timeout","timeout-required":"Timeout is required","timeout-min":"Timeout can not be less then 1","timeout-pattern":"Timeout is not valid","attribute-name":"Attribute name","attribute-name-required":"Attribute name is required",command:"Command","command-required":"Command is required",remove:"Remove command"},storage:"Składowanie","storage-max-file-records":"Maksymalna liczba rekordów w pliku","storage-max-files":"Maksymalna liczba plików","storage-max-files-min":"Minimalna liczba to 1.","storage-max-files-pattern":"Numer jest nieprawidłowy.","storage-max-files-required":"Numer jest wymagany.","storage-max-records":"Maksymalna liczba rekordów w pamięci","storage-max-records-min":"Minimalna liczba rekordów to 1.","storage-max-records-pattern":"Numer jest nieprawidłowy.","storage-max-records-required":"Maksymalna liczba rekordów jest wymagana.","storage-read-record-count":"Read record count in storage","storage-read-record-count-min":"Minimum number of records is 1.","storage-read-record-count-pattern":"Number is not valid.","storage-read-record-count-required":"Read record count is required.","storage-max-read-record-count":"Max read record count in storage","storage-max-read-record-count-min":"Minimum number of records is 1.","storage-max-read-record-count-pattern":"Number is not valid.","storage-max-read-record-count-required":"Max Read record count is required.","storage-data-folder-path":"Data folder path","storage-data-folder-path-required":"Data folder path is required.","storage-pack-size":"Maksymalny rozmiar pakietu wydarzeń","storage-pack-size-min":"Minimalna liczba to 1.","storage-pack-size-pattern":"Numer jest nieprawidłowy.","storage-pack-size-required":"Maksymalny rozmiar pakietu wydarzeń jest wymagany.","storage-path":"Ścieżka przechowywania","storage-path-required":"Ścieżka do przechowywania jest wymagana.","storage-type":"Typ składowania","storage-types":{"file-storage":"Nośnik danych","memory-storage":"Przechowywanie pamięci",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"General","thingsboard-host":"Gospodarz ThingsBoard","thingsboard-host-required":"Host jest wymagany.","thingsboard-port":"Port ThingsBoard","thingsboard-port-max":"Maksymalny numer portu to 65535.","thingsboard-port-min":"Minimalny numer portu to 1.","thingsboard-port-pattern":"Port jest nieprawidłowy.","thingsboard-port-required":"Port jest wymagany.",tidy:"Uporządkuj","tidy-tip":"Uporządkowana konfiguracja JSON","title-connectors-json":"Złącze {{typeName}} konfiguracja","tls-path-ca-certificate":"Ścieżka do certyfikatu CA na gateway","tls-path-client-certificate":"Ścieżka do certyfikatu klienta na gateway","messages-ttl-check-in-hours":"Messages TTL check in hours","messages-ttl-check-in-hours-required":"Messages TTL check in hours is required.","messages-ttl-check-in-hours-min":"Min number is 1.","messages-ttl-check-in-hours-pattern":"Number is not valid.","messages-ttl-in-days":"Messages TTL in days","messages-ttl-in-days-required":"Messages TTL in days is required.","messages-ttl-in-days-min":"Min number is 1.","messages-ttl-in-days-pattern":"Number is not valid.","mqtt-qos":"QoS","mqtt-qos-required":"QoS is required","mqtt-qos-range":"QoS values range is from 0 to 1","tls-path-private-key":"Ścieżka do klucza prywatnego na bramce","toggle-fullscreen":"Przełącz tryb pełnoekranowy","transformer-json-config":"Konfiguracja JSON*","update-config":"Dodaj/zaktualizuj konfigurację JSON",hints:{"remote-configuration":"Enables remote configuration and management of the gateway","remote-shell":"Enables remote control of the operating system with the gateway from the Remote Shell widget",host:"Hostname or IP address of ThingsBoard server",port:"Port of MQTT service on ThingsBoard server",token:"Access token for the gateway from ThingsBoard server","client-id":"MQTT client id for the gateway form ThingsBoard server",username:"MQTT username for the gateway form ThingsBoard server",password:"MQTT password for the gateway form ThingsBoard server","ca-cert":"Path to CA certificate file","date-form":"Date format in log message","data-folder":"Path to folder, that will contains data (Relative or Absolute)","log-format":"Log message format","remote-log":"Enables remote logging and logs reading from the gateway","backup-count":"If backup count is > 0, when a rollover is done, no more than backup count files are kept - the oldest ones are deleted",storage:"Provides configuration for saving incoming data before it is sent to the platform","max-file-count":"Maximum count of file that will be created","max-read-count":"Count of messages to get from storage and send to ThingsBoard","max-records":"Maximum count of records that will be stored in one file","read-record-count":"Count of messages to get from storage and send to ThingsBoard","max-records-count":"Maximum count of data in storage before send to ThingsBoard","ttl-check-hour":"How often will Gateway check data for obsolescence","ttl-messages-day":"Maximum days that storage will save data",commands:"Commands for collecting additional statistic",attribute:"Statistic telemetry key",timeout:"Timeout for command executing",command:"The result of the command execution, will be used as the value for telemetry","check-device-activity":"Enables monitor the activity of each connected device","inactivity-timeout":"Time after whose the gateway will disconnect device","inactivity-period":"Periodicity of device activity check","minimal-pack-delay":"Delay between sending packs of messages (Decreasing this setting results in increased CPU usage)",qos:"Quality of Service in MQTT messaging (0 - at most once, 1 - at least once)","server-port":"Network port on which GRPC server will listen for incoming connections.","grpc-keep-alive-timeout":"Maximum time the server should wait for a keepalive ping response before considering the connection dead.","grpc-keep-alive":"Duration between two successive keepalive ping messages when there is no active RPC call.","grpc-min-time-between-pings":"Minimum amount of time the server should wait between sending keepalive ping messages","grpc-max-pings-without-data":"Maximum number of keepalive ping messages that the server can send without receiving any data before it considers the connection dead.","grpc-min-ping-interval-without-data":"Minimum amount of time the server should wait between sending keepalive ping messages when there is no data being sent or received.","permit-without-calls":"Allow server to keep the GRPC connection alive even when there are no active RPC calls."}}},Rt={gateway:{"add-entry":"Adicionar configuração","connector-add":"Adicionar novo conector","connector-enabled":"Habilitar conector","connector-name":"Nome do conector","connector-name-required":"O nome do conector é obrigatório.","connector-type":"Tipo de conector","connector-type-required":"O tipo de conector é obrigatório.",connectors:"Configuração de conectores","create-new-gateway":"Criar um novo gateway","create-new-gateway-text":"Tem certeza de que deseja criar um novo gateway com o nome: '{{gatewayName}}'?",delete:"Excluir configuração","download-tip":"Download de arquivo de configuração",gateway:"Gateway","gateway-exists":"Já existe um dispositivo com o mesmo nome.","gateway-name":"Nome do gateway","gateway-name-required":"O nome do gateway é obrigatório.","gateway-saved":"A configuração do gateway foi salva corretamente.","json-parse":"JSON inválido.","json-required":"O campo não pode estar em branco.","no-connectors":"Sem conectores","no-data":"Sem configurações","no-gateway-found":"Nenhum gateway encontrado.","no-gateway-matching":" '{{item}}' não encontrado.","path-logs":"Caminho para arquivos de log","path-logs-required":"O caminho é obrigatório",remote:"Configuração remota","remote-logging-level":"Nível de registro em log","remove-entry":"Remover configuração","save-tip":"Salvar arquivo de configuração","security-type":"Tipo de segurança","security-types":{"access-token":"Token de Acesso",tls:"TLS"},storage:"Armazenamento","storage-max-file-records":"Número máximo de registros em arquivo","storage-max-files":"Número máximo de arquivos","storage-max-files-min":"O número mínimo é 1.","storage-max-files-pattern":"O número não é válido.","storage-max-files-required":"O número é obrigatório.","storage-max-records":"Número máximo de registros em armazenamento","storage-max-records-min":"O número mínimo de registros é 1.","storage-max-records-pattern":"O número não é válido.","storage-max-records-required":"O número máximo de registros é obrigatório.","storage-pack-size":"Tamanho máximo de pacote de eventos","storage-pack-size-min":"O número mínimo é 1.","storage-pack-size-pattern":"O número não é válido.","storage-pack-size-required":"O tamanho máximo de pacote de eventos é obrigatório.","storage-path":"Caminho de armazenamento","storage-path-required":"O caminho de armazenamento é obrigatório.","storage-type":"Tipo de armazenamento","storage-types":{"file-storage":"Armazenamento de arquivo","memory-storage":"Armazenamento de memória"},thingsboard:"ThingsBoard","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"O host é obrigatório.","thingsboard-port":"Porta ThingsBoard","thingsboard-port-max":"O número máximo de portas é 65535.","thingsboard-port-min":"O número mínimo de portas é 1.","thingsboard-port-pattern":"A porta não é válida.","thingsboard-port-required":"A porta é obrigatória.",tidy:"Tidy","tidy-tip":"Config Tidy JSON","title-connectors-json":"Configuração do conector {{typeName}}","tls-path-ca-certificate":"Caminho para certificado de Autoridade de Certificação no gateway","tls-path-client-certificate":"Caminho para certificado de cliente no gateway","tls-path-private-key":"Caminho para chave privada no gateway","toggle-fullscreen":"Alternar tela inteira","transformer-json-config":"Configuração JSON*","update-config":"Adicionar/atualizar configuração de JSON"}},Bt={gateway:{"add-entry":"Dodaj konfiguracijo","connector-add":"Dodaj nov priključek","connector-enabled":"Omogoči priključek","connector-name":"Ime priključka","connector-name-required":"Ime priključka je obvezno.","connector-type":"Vrsta priključka","connector-type-required":"Zahteva se vrsta priključka.",connectors:"Konfiguracija priključkov","create-new-gateway":"Ustvari nov prehod","create-new-gateway-text":"Ali ste prepričani, da želite ustvariti nov prehod z imenom: '{{gatewayName}}'?",delete:"Izbriši konfiguracijo","download-tip":"Prenos konfiguracijske datoteke",gateway:"Prehod","gateway-exists":"Naprava z istim imenom že obstaja.","gateway-name":"Ime prehoda","gateway-name-required":"Ime prehoda je obvezno.","gateway-saved":"Konfiguracija prehoda je uspešno shranjena.","json-parse":"Neveljaven JSON.","json-required":"Polje ne sme biti prazno.","no-connectors":"Ni priključkov","no-data":"Brez konfiguracij","no-gateway-found":"Prehod ni najden.","no-gateway-matching":" '{{item}}' ni mogoče najti.","path-logs":"Pot do dnevniških datotek","path-logs-required":"Pot je obvezna.",remote:"Oddaljena konfiguracija","remote-logging-level":"Raven beleženja","remove-entry":"Odstrani konfiguracijo","save-tip":"Shrani konfiguracijsko datoteko","security-type":"Vrsta zaščite","security-types":{"access-token":"Dostopni žeton",tls:"TLS"},storage:"Shramba","storage-max-file-records":"Največ zapisov v datoteki","storage-max-files":"Največje število datotek","storage-max-files-min":"Najmanjše število je 1.","storage-max-files-pattern":"Številka ni veljavna.","storage-max-files-required":"Številka je obvezna.","storage-max-records":"Največ zapisov v pomnilniku","storage-max-records-min":"Najmanjše število zapisov je 1.","storage-max-records-pattern":"Številka ni veljavna.","storage-max-records-required":"Zahtevan je največ zapisov.","storage-pack-size":"Največja velikost paketa dogodkov","storage-pack-size-min":"Najmanjše število je 1.","storage-pack-size-pattern":"Številka ni veljavna.","storage-pack-size-required":"Zahtevana je največja velikost paketa dogodkov.","storage-path":"Pot pomnilnika","storage-path-required":"Zahtevana je pot do pomnilnika.","storage-type":"Vrsta pomnilnika","storage-types":{"file-storage":"Shramba datotek","memory-storage":"Spomin pomnilnika"},thingsboard:"ThingsBoard","thingsboard-host":"Gostitelj ThingsBoard","thingsboard-host-required":"Potreben je gostitelj.","thingsboard-port":"Vrata ThingsBoard","thingsboard-port-max":"Največja številka vrat je 65535.","thingsboard-port-min":"Najmanjša številka vrat je 1.","thingsboard-port-pattern":"Vrata niso veljavna.","thingsboard-port-required":"Potrebna so vrata.",tidy:"Urejeno","tidy-tip":"Urejena konfiguracija JSON","title-connectors-json":"Konfiguracija konektorja {{typeName}}","tls-path-ca-certificate":"Pot do potrdila CA na prehodu","tls-path-client-certificate":"Pot do potrdila stranke na prehodu","tls-path-private-key":"Pot do zasebnega ključa na prehodu","toggle-fullscreen":"Preklop na celozaslonski način","transformer-json-config":"Konfiguracija JSON *","update-config":"Dodaj / posodobi konfiguracijo JSON"}},Ft={gateway:{"add-entry":"Yapılandırma ekle","connector-add":"Yeni bağlayıcı ekle","connector-enabled":"Bağlayıcıyı etkinleştir","connector-name":"Bağlayıcı adı","connector-name-required":"Bağlayıcı adı gerekli.","connector-type":"Bağlayıcı tipi","connector-type-required":"Bağlayıcı türü gerekli.",connectors:"Bağlayıcıların yapılandırması","create-new-gateway":"Yeni bir ağ geçidi oluştur","create-new-gateway-text":"'{{gatewayName}}' adında yeni bir ağ geçidi oluşturmak istediğinizden emin misiniz?",delete:"Yapılandırmayı sil","download-tip":"Yapılandırma dosyasını indirin",gateway:"Ağ geçidi","gateway-exists":"Aynı ada sahip cihaz zaten var.","gateway-name":"Ağ geçidi adı","gateway-name-required":"Ağ geçidi adı gerekli.","gateway-saved":"Ağ geçidi yapılandırması başarıyla kaydedildi.","json-parse":"Geçerli bir JSON değil.","json-required":"Alan boş olamaz.","no-connectors":"Bağlayıcı yok","no-data":"Yapılandırma yok","no-gateway-found":"Ağ geçidi bulunamadı.","no-gateway-matching":" '{{item}}' bulunamadı.","path-logs":"Log dosyaları yolu","path-logs-required":"Log dosyaları dizini gerekli.",remote:"Uzaktan yapılandırma","remote-logging-level":"Loglama seviyesi","remove-entry":"Yapılandırmayı kaldır","save-tip":"Yapılandırma dosyasını kaydet","security-type":"Güvenlik türü","security-types":{"access-token":"Access Token",tls:"TLS"},storage:"Depolama","storage-max-file-records":"Dosyadaki maksimum kayıt","storage-max-files":"Maksimum dosya sayısı","storage-max-files-min":"Minimum sayı 1'dir.","storage-max-files-pattern":"Sayı geçerli değil.","storage-max-files-required":"Sayı gerekli.","storage-max-records":"Depodaki maksimum kayıt","storage-max-records-min":"Minimum kayıt sayısı 1'dir.","storage-max-records-pattern":"Sayı geçerli değil.","storage-max-records-required":"Maksimum kayıt gerekli.","storage-pack-size":"Maksimum etkinlik paketi boyutu","storage-pack-size-min":"Minimum sayı 1'dir.","storage-pack-size-pattern":"Sayı geçerli değil.","storage-pack-size-required":"Maksimum etkinlik paketi boyutu gerekli.","storage-path":"Depolama yolu","storage-path-required":"Depolama yolu gerekli.","storage-type":"Depolama türü","storage-types":{"file-storage":"Dosya depolama","memory-storage":"Bellek depolama"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard host","thingsboard-host-required":"Host gerekli.","thingsboard-port":"ThingsBoard port","thingsboard-port-max":"Maksimum port numarası 65535.","thingsboard-port-min":"Minimum port numarası 1'dir.","thingsboard-port-pattern":"Port geçerli değil.","thingsboard-port-required":"Port gerekli.",tidy:"Tidy","tidy-tip":"Tidy config JSON","title-connectors-json":"Connector {{typeName}} configuration","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON"}},Nt={gateway:{"add-entry":"添加配置",advanced:"高级","checking-device-activity":"检查设备活动",command:"Docker命令","command-copied-message":"Docker命令已复制到剪贴板",configuration:"配置","connector-add":"添加连接器","connector-enabled":"启用连接器","connector-name":"连接器名称","connector-name-required":"连接器名称必填。","connector-type":"连接器类型","connector-type-required":"连接器类型必填。",connectors:"连接器配置","connectors-config":"连接器配置","connectors-table-enabled":"已启用","connectors-table-name":"名称","connectors-table-type":"类型","connectors-table-status":"状态","connectors-table-actions":"操作","connectors-table-key":"键","connectors-table-class":"类","rpc-command-send":"发送","rpc-command-result":"结果","rpc-command-edit-params":"编辑参数","gateway-configuration":"通用配置","create-new-gateway":"创建网关","create-new-gateway-text":"确定要创建名为 '{{gatewayName}}' 的新网关?","created-time":"创建时间","configuration-delete-dialog-header":"配置将被删除","configuration-delete-dialog-body":"只有对网关进行物理访问时,才有可能关闭远程配置。所有先前的配置都将被删除。

\n要关闭配置,请在下面输入网关名称","configuration-delete-dialog-input":"网关名称","configuration-delete-dialog-input-required":"网关名称是必需的","configuration-delete-dialog-confirm":"关闭",delete:"删除配置","download-tip":"下载配置","drop-file":"将文件拖放到此处或",gateway:"网关","gateway-exists":"同名设备已存在。","gateway-name":"网关名称","gateway-name-required":"网关名称必填。","gateway-saved":"已成功保存网关配置。",grpc:"GRPC","grpc-keep-alive-timeout":"保持连接超时(毫秒)","grpc-keep-alive-timeout-required":"需要保持连接超时","grpc-keep-alive-timeout-min":"保持连接超时不能小于1","grpc-keep-alive-timeout-pattern":"保持连接超时无效","grpc-keep-alive":"保持连接(毫秒)","grpc-keep-alive-required":"需要保持连接","grpc-keep-alive-min":"保持连接不能小于1","grpc-keep-alive-pattern":"保持连接无效","grpc-min-time-between-pings":"最小Ping间隔(毫秒)","grpc-min-time-between-pings-required":"需要最小Ping间隔","grpc-min-time-between-pings-min":"最小Ping间隔不能小于1","grpc-min-time-between-pings-pattern":"最小Ping间隔无效","grpc-min-ping-interval-without-data":"无数据时的最小Ping间隔(毫秒)","grpc-min-ping-interval-without-data-required":"需要无数据时的最小Ping间隔","grpc-min-ping-interval-without-data-min":"无数据时的最小Ping间隔不能小于1","grpc-min-ping-interval-without-data-pattern":"无数据时的最小Ping间隔无效","grpc-max-pings-without-data":"无数据时的最大Ping数","grpc-max-pings-without-data-required":"需要无数据时的最大Ping数","grpc-max-pings-without-data-min":"无数据时的最大Ping数不能小于1","grpc-max-pings-without-data-pattern":"无数据时的最大Ping数无效","inactivity-check-period-seconds":"不活跃检查期(秒)","inactivity-check-period-seconds-required":"需要不活跃检查期","inactivity-check-period-seconds-min":"不活跃检查期不能小于1","inactivity-check-period-seconds-pattern":"不活跃检查期无效","inactivity-timeout-seconds":"不活跃超时(秒)","inactivity-timeout-seconds-required":"需要不活跃超时","inactivity-timeout-seconds-min":"不活跃超时不能小于1","inactivity-timeout-seconds-pattern":"不活跃超时无效","json-parse":"无效的JSON。","json-required":"字段不能为空。",logs:{logs:"日志",days:"天",hours:"小时",minutes:"分钟",seconds:"秒","date-format":"日期格式","date-format-required":"需要日期格式","log-format":"日志格式","log-type":"日志类型","log-format-required":"需要日志格式",remote:"远程日志记录","remote-logs":"远程日志",local:"本地日志记录",level:"日志级别","file-path":"文件路径","file-path-required":"需要文件路径","saving-period":"日志保存期限","saving-period-min":"日志保存期限不能小于1","saving-period-required":"需要日志保存期限","backup-count":"备份数量","backup-count-min":"备份数量不能小于1","backup-count-required":"需要备份数量"},"min-pack-send-delay":"最小包发送延迟(毫秒)","min-pack-send-delay-required":"最小包发送延迟是必需的","min-pack-send-delay-min":"最小包发送延迟不能小于0","no-connectors":"无连接器","no-data":"没有配置","no-gateway-found":"未找到网关。","no-gateway-matching":"未找到 '{{item}}' 。","path-logs":"日志文件的路径","path-logs-required":"路径是必需的。","permit-without-calls":"保持连接许可,无需响应",remote:"远程配置","remote-logging-level":"日志记录级别","remove-entry":"删除配置","remote-shell":"远程Shell","remote-configuration":"远程配置",other:"其他","save-tip":"保存配置","security-type":"安全类型","security-types":{"access-token":"访问令牌","username-password":"用户名和密码",tls:"TLS","tls-access-token":"TLS + 访问令牌","tls-private-key":"TLS + 私钥"},"server-port":"服务器端口",statistics:{statistic:"统计信息",statistics:"统计信息","statistic-commands-empty":"无可用统计信息",commands:"命令","send-period":"统计信息发送周期(秒)","send-period-required":"统计信息发送周期是必需的","send-period-min":"统计信息发送周期不能小于60","send-period-pattern":"统计信息发送周期无效","check-connectors-configuration":"检查连接器配置(秒)","check-connectors-configuration-required":"检查连接器配置是必需的","check-connectors-configuration-min":"检查连接器配置不能小于1","check-connectors-configuration-pattern":"检查连接器配置无效",add:"添加命令",timeout:"超时时间","timeout-required":"超时时间是必需的","timeout-min":"超时时间不能小于1","timeout-pattern":"超时时间无效","attribute-name":"属性名称","attribute-name-required":"属性名称是必需的",command:"命令","command-required":"命令是必需的","command-pattern":"命令无效",remove:"删除命令"},storage:"存储","storage-max-file-records":"文件中的最大记录数","storage-max-files":"最大文件数","storage-max-files-min":"最小值为1。","storage-max-files-pattern":"数字无效。","storage-max-files-required":"数字是必需的。","storage-max-records":"存储中的最大记录数","storage-max-records-min":"最小记录数为1。","storage-max-records-pattern":"数字无效。","storage-max-records-required":"最大记录项必填。","storage-read-record-count":"存储中的读取记录数","storage-read-record-count-min":"最小记录数为1。","storage-read-record-count-pattern":"数字不合法。","storage-read-record-count-required":"需要读取记录数。","storage-max-read-record-count":"存储中的最大读取记录数","storage-max-read-record-count-min":"最小记录数为1。","storage-max-read-record-count-pattern":"数字不合法。","storage-max-read-record-count-required":"最大读取记录数必需。","storage-data-folder-path":"数据文件夹路径","storage-data-folder-path-required":"需要数据文件夹路径。","storage-pack-size":"最大事件包大小","storage-pack-size-min":"最小值为1。","storage-pack-size-pattern":"数字无效。","storage-pack-size-required":"最大事件包大小必填。","storage-path":"存储路径","storage-path-required":"存储路径必填。","storage-type":"存储类型","storage-types":{"file-storage":"文件存储","memory-storage":"内存存储",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"常规","thingsboard-host":"ThingsBoard主机","thingsboard-host-required":"主机必填。","thingsboard-port":"ThingsBoard端口","thingsboard-port-max":"最大端口号为65535。","thingsboard-port-min":"最小端口号为1。","thingsboard-port-pattern":"端口无效。","thingsboard-port-required":"端口必填。",tidy:"整理","tidy-tip":"整理配置JSON","title-connectors-json":"连接器 {{typeName}} 配置","tls-path-ca-certificate":"网关上CA证书的路径","tls-path-client-certificate":"网关上客户端证书的路径","messages-ttl-check-in-hours":"消息TTL检查小时数","messages-ttl-check-in-hours-required":"需要提供消息TTL检查小时数。","messages-ttl-check-in-hours-min":"最小值为1。","messages-ttl-check-in-hours-pattern":"数字无效。","messages-ttl-in-days":"消息TTL天数","messages-ttl-in-days-required":"需要提供消息TTL天数。","messages-ttl-in-days-min":"最小值为1。","messages-ttl-in-days-pattern":"数字无效。","mqtt-qos":"QoS","mqtt-qos-required":"需要提供QoS","mqtt-qos-range":"QoS值的范围是从0到1","tls-path-private-key":"网关上私钥的路径","toggle-fullscreen":"切换全屏","transformer-json-config":"配置JSON*","update-config":"添加/更新配置JSON",hints:{"remote-configuration":"启用对网关的远程配置和管理","remote-shell":"通过远程Shell小部件启用对网关操作系统的远程控制",host:"ThingsBoard 主机名或IP地址",port:"ThingsBoard MQTT服务端口",token:"ThingsBoard 网关访问令牌","client-id":"ThingsBoard 网关MQTT客户端ID",username:"ThingsBoard 网关MQTT用户名",password:"ThingsBoard 网关MQTT密码","ca-cert":"CA证书文件的路径","date-form":"日志消息中的日期格式","data-folder":"包含数据的文件夹的路径(相对或绝对路径)","log-format":"日志消息格式","remote-log":"启用对网关的远程日志记录和日志读取","backup-count":"如果备份计数大于0,则在执行轮换时,最多保留备份计数个文件-最旧的文件将被删除",storage:"提供将数据发送到平台之前保存传入数据的配置","max-file-count":"将创建的文件的最大数量","max-read-count":"从存储中获取的消息计数并发送到ThingsBoard","max-records":"一个文件中存储的最大记录数","read-record-count":"从存储中获取的消息计数并发送到ThingsBoard","max-records-count":"在将数据发送到ThingsBoard之前,存储中的最大数据计数","ttl-check-hour":"网关多久检查一次数据是否过时","ttl-messages-day":"存储将保存数据的最大天数",commands:"用于收集附加统计信息的命令",attribute:"统计遥测键",timeout:"命令执行的超时时间",command:"命令执行的结果,将用作遥测的值","check-device-activity":"启用监视每个连接设备的活动","inactivity-timeout":"在此时间后,网关将断开设备的连接","inactivity-period":"设备活动检查的周期","minimal-pack-delay":"发送消息包之间的延迟(减小此设置会导致增加CPU使用率)",qos:"MQTT消息传递的服务质量(0-至多一次,1-至少一次)","server-port":"GRPC服务器侦听传入连接的网络端口","grpc-keep-alive-timeout":"在考虑连接死亡之前,服务器等待keepalive ping响应的最长时间","grpc-keep-alive":"没有活动RPC调用时两个连续keepalive ping消息之间的持续时间","grpc-min-time-between-pings":"服务器在发送keepalive ping消息之间应等待的最小时间量","grpc-max-pings-without-data":"在没有接收到任何数据之前,服务器可以发送的keepalive ping消息的最大数量,然后将连接视为死亡","grpc-min-ping-interval-without-data":"在没有发送或接收数据时,服务器在发送keepalive ping消息之间应等待的最小时间量","permit-without-calls":"允许服务器在没有活动RPC调用时保持GRPC连接活动"},"docker-label":"使用以下指令在 Docker compose 中运行 IoT 网关,并为选定的设备提供凭据","install-docker-compose":"使用以下说明下载、安装和设置 Docker Compose","download-configuration-file":"下载配置文件","download-docker-compose":"下载您的网关的 docker-compose.yml 文件","launch-gateway":"启动网关","launch-docker-compose":"在包含 docker-compose.yml 文件的文件夹中,使用以下命令在终端中启动网关"}},Lt={gateway:{"add-entry":"增加配置","connector-add":"增加新連接器","connector-enabled":"啟用連接器","connector-name":"連接器名稱","connector-name-required":"需要連接器名稱。","connector-type":"連接器類型","connector-type-required":"需要連接器類型。",connectors:"連接器配置","create-new-gateway":"建立新閘道","create-new-gateway-text":"您確定要建立一個名稱為:'{{gatewayName}}'的新閘道嗎?",delete:"刪除配置","download-tip":"下載配置文件",gateway:"閘道","gateway-exists":"同名設備已存在。","gateway-name":"閘道名稱","gateway-name-required":"需要閘道名稱。","gateway-saved":"閘道配置已成功保存。","json-parse":"無效的JSON","json-required":"欄位不能為空。","no-connectors":"無連接器","no-data":"無配置","no-gateway-found":"未找到閘道。","no-gateway-matching":" 未找到'{{item}}'。","path-logs":"日誌文件的路徑","path-logs-required":"需要路徑。",remote:"移除配置","remote-logging-level":"日誌記錄級別","remove-entry":"移除配置","save-tip":"保存配置文件","security-type":"安全類型","security-types":{"access-token":"訪問Token",tls:"TLS"},storage:"貯存","storage-max-file-records":"文件中的最大紀錄","storage-max-files":"最大文件數","storage-max-files-min":"最小數量為1。","storage-max-files-pattern":"號碼無效。","storage-max-files-required":"需要號碼。","storage-max-records":"存儲中的最大紀錄","storage-max-records-min":"最小紀錄數為1。","storage-max-records-pattern":"號碼無效。","storage-max-records-required":"需要最大紀錄數","storage-pack-size":"最大事件包大小","storage-pack-size-min":"最小數量為1。","storage-pack-size-pattern":"號碼無效.","storage-pack-size-required":"需要最大事件包大小","storage-path":"存儲路徑","storage-path-required":"需要存儲路徑。","storage-type":"存儲類型","storage-types":{"file-storage":"文件存儲","memory-storage":"記憶體存儲"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard主機","thingsboard-host-required":"需要主機。","thingsboard-port":"ThingsBoard連接埠","thingsboard-port-max":"最大埠號為 65535。","thingsboard-port-min":"最小埠號為1。","thingsboard-port-pattern":"連接埠無效。","thingsboard-port-required":"需要連接埠。",tidy:"整理","tidy-tip":"整理配置JSON","title-connectors-json":"連接器{{typeName}}配置","tls-path-ca-certificate":"閘道上CA證書的路徑","tls-path-client-certificate":"閘道上用戶端憑據的路徑","tls-path-private-key":"閘道上的私鑰路徑","toggle-fullscreen":"切換全螢幕","transformer-json-config":"配置JSON*","update-config":"增加/更新配置JSON"}};e("AvailableLanguages",Ct),function(e){e.English="en_US",e.Arabic="ar_AE",e.Catalan="ca_ES",e.Czech="cs_CZ",e.Danish="da_DK",e.Spanish="es_ES",e.Korean="ko_KR",e.Lithuanian="lt_LT",e.Dutch="nl_BE",e.Polish="pl_PL",e.PortugueseBrazil="pt_BR",e.Slovenian="sl_SI",e.Turkish="tr_TR",e.ChineseSimplified="zh_CN",e.ChineseTraditional="zh_TW"}(Ct||e("AvailableLanguages",Ct={}));const Vt=new Map([[Ct.English,_t],[Ct.Arabic,Tt],[Ct.Catalan,Et],[Ct.Czech,It],[Ct.Danish,Mt],[Ct.Spanish,kt],[Ct.Korean,Pt],[Ct.Lithuanian,Dt],[Ct.Dutch,At],[Ct.Polish,Ot],[Ct.PortugueseBrazil,Rt],[Ct.Slovenian,Bt],[Ct.Turkish,Ft],[Ct.ChineseSimplified,Nt],[Ct.ChineseTraditional,Lt]]),qt=e("addGatewayLocale",(e=>{const t=Ct.English,n=e.currentLang??t,i=e.translations[n]?.gateway?n:t,a=Vt.get(n)?.gateway?n:t,r=[a===t?void 0:Vt.get(t)?.gateway,Vt.get(a)?.gateway,e.translations[i]?.gateway].filter(Gt);if(!r.length)return;const o=1===r.length?r[0]:X({},...r);e.setTranslation(i,{gateway:o},!0)})),Gt=e=>Z(e)&&0!==Object.keys(e).length;var zt={3.6:{socket:{type:"TCP",address:"127.0.0.1",port:5e4,bufferSize:1024},devices:[{address:"*:*",deviceName:"Device Example",deviceType:"default",encoding:"utf-8",telemetry:[{key:"temp",byteFrom:0,byteTo:-1},{key:"hum",byteFrom:0,byteTo:2}],attributes:[{key:"name",byteFrom:0,byteTo:-1},{key:"num",byteFrom:2,byteTo:4}],attributeRequests:[{type:"shared",requestExpressionSource:"constant",attributeNameExpressionSource:"constant",requestExpression:"${[0:3]==atr}",attributeNameExpression:"[3:]"}],attributeUpdates:[{encoding:"utf-16",attributeOnThingsBoard:"sharedName"}],serverSideRpc:[{methodRPC:"rpcMethod1",withResponse:!0,encoding:"utf-8"}]}]},legacy:{type:"TCP",address:"127.0.0.1",port:5e4,bufferSize:1024,devices:[{address:"*:*",deviceName:"Device Example",deviceType:"default",encoding:"utf-8",telemetry:[{key:"temp",byteFrom:0,byteTo:-1},{key:"hum",byteFrom:0,byteTo:2}],attributes:[{key:"name",byteFrom:0,byteTo:-1},{key:"num",byteFrom:2,byteTo:4}],attributeRequests:[{type:"shared",requestExpression:"${[0:3]==atr}",attributeNameExpression:"[3:]"}],attributeUpdates:[{encoding:"utf-16",attributeOnThingsBoard:"sharedName"}],serverSideRpc:[{methodRPC:"rpcMethod1",withResponse:!0,methodProcessing:"write",encoding:"utf-8"}]}]}},Ut={broker:{host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,cleanSession:!0,cleanStart:!0,sessionExpiryInterval:0,security:{type:"anonymous"}},mapping:[{topicFilter:"data/",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"double",key:"power",value:"${power}"},{type:"integer",key:"frequency",value:"${frequency}"}],timeseries:[{type:"double",key:"temperature",value:"${temperature}"},{type:"double",key:"humidity",value:"${humidity}"},{type:"boolean",key:"relay",value:"${relay}"}]}},{topicFilter:"sensor/+/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/data)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"},timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"string",key:"humidity",value:"${hum}"}]}},{topicFilter:"sensor/raw_data",subscriptionQos:1,converter:{type:"bytes",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"[0:4]",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},timeout:6e4,attributes:[{type:"raw",key:"rawData",value:"[:]"}],timeseries:[{type:"raw",key:"temp",value:"[4:]"}]}},{topicFilter:"custom/sensors/+",subscriptionQos:1,converter:{type:"custom",extension:"CustomMqttUplinkConverter",cached:!0,extensionConfig:{temperature:2,humidity:2,batteryLevel:1}}}],requestsMapping:{connectRequests:[{topicFilter:"sensor/connect",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"}},{topicFilter:"sensor/+/connect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"}}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device"}},{topicFilter:"sensor/+/disconnect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)"}}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device"},attributeNameExpressionSource:"message",attributeNameExpression:"${relay}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeValue}"}],attributeUpdates:[{deviceNameFilter:".*",attributeFilter:"relay",topicExpression:"sensor/request/setRelay",valueExpression:"${attributeValue}"}],serverSideRpc:[{type:"twoWay",deviceNameFilter:".*",methodFilter:"getRelay",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTopicQoS:1,responseTimeout:1e4,valueExpression:"${params}"},{type:"oneWay",deviceNameFilter:".*",methodFilter:"setRelay",requestTopicExpression:"sensor/request/${methodName}",valueExpression:"${params}"}]}},jt={master:{slaves:[{host:"127.0.0.1",port:5021,method:"socket",unitId:1,deviceName:"Demo Device",deviceType:"default",timeout:35,byteOrder:"BIG",wordOrder:"LITTLE",retries:3,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:1e3,connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,type:"tcp",attributes:[{tag:"power",type:"16int",functionCode:3,objectsCount:1,address:2,divider:10},{tag:"frequency",type:"16int",functionCode:3,objectsCount:1,address:3,divider:10}],timeseries:[{tag:"temperature",type:"16int",address:0,objectsCount:1,functionCode:3,divider:10},{tag:"humidity",type:"16int",address:1,objectsCount:1,functionCode:3,divider:10},{tag:"relay",type:"bits",address:1,objectsCount:1,functionCode:1,bitTargetType:"bool"}],attributeUpdates:[{tag:"relay",type:"bits",address:1,objectsCount:1,functionCode:5,bitTargetType:"bool"}],rpc:[{tag:"setRelay",type:"bits",address:1,objectsCount:1,functionCode:5,bitTargetType:"bool"},{tag:"getRelay",type:"bits",address:1,objectsCount:1,functionCode:1,bitTargetType:"bool"}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",unitId:0,deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",identity:{},values:{holding_registers:{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"16int",tag:"smm",objectsCount:1,value:12334}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",value:22,type:"16int",address:31,objectsCount:1,functionCode:6}]},coils_initializer:{attributes:[{address:5,type:"8int",tag:"coil",objectsCount:1,value:0}],timeseries:[],attributeUpdates:[],rpc:[]},input_registers:{attributes:[],timeseries:[],attributeUpdates:[],rpc:[]},discrete_inputs:{attributes:[],timeseries:[],attributeUpdates:[],rpc:[]}}}},Ht={server:{url:"opc.tcp://127.0.0.1:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:36e5,pollPeriodInMillis:5e3,enableSubscriptions:!1,subCheckPeriodInMillis:100,subDataMaxBatchSize:1e3,subDataMinBatchCreationTimeMs:200,subscriptionProcessBatchSize:2e3,sessionTimeoutInMillis:12e4,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"}},mapping:[{deviceNodeSource:"path",deviceNodePattern:"Root\\.Objects\\.MyObject",deviceInfo:{deviceNameExpression:"Demo Device",deviceNameExpressionSource:"constant",deviceProfileExpression:"default",deviceProfileExpressionSource:"constant"},attributes:[{key:"frequency",type:"path",value:"${Frequency}"},{key:"power",type:"path",value:"${Power}"}],timeseries:[{key:"temperature",type:"path",value:"${Temperature}"},{key:"humidity",type:"path",value:"${Humidity}"},{key:"relay",type:"path",value:"${Relay}"}],rpc_methods:[{method:"multiply",arguments:[{type:"integer",value:2},{type:"integer",value:4}]},{method:"get_relay",arguments:[]},{method:"set_relay",arguments:[]}],attributes_updates:[{key:"relay",type:"path",value:"Root\\.Objects\\.MyObject\\.Relay"}]}]},Wt={passiveScanMode:!0,showMap:!1,scanner:{timeout:1e4,deviceName:"Device name"},devices:[{name:"Temperature and humidity sensor",MACAddress:"4C:65:A8:DF:85:C0",pollPeriod:5e5,showMap:!1,timeout:1e4,connectRetry:5,connectRetryInSeconds:0,waitAfterConnectRetries:10,telemetry:[{key:"temperature",method:"notify",characteristicUUID:"226CAA55-6476-4566-7562-66734470666D",valueExpression:"[2]"},{key:"humidity",method:"notify",characteristicUUID:"226CAA55-6476-4566-7562-66734470666D",valueExpression:"[0]"}],attributes:[{key:"name",method:"read",characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",valueExpression:"[0:2]cm [2:]A"},{key:"values",method:"read",characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",valueExpression:"All values: [:]"}],attributeUpdates:[{attributeOnThingsBoard:"sharedName",characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB"}],serverSideRpc:[{methodRPC:"rpcMethod1",withResponse:!0,characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",methodProcessing:"read"},{methodRPC:"rpcMethod2",withResponse:!0,characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",methodProcessing:"write"},{methodRPC:"rpcMethod3",withResponse:!0,methodProcessing:"scan"}]}]},$t={host:"http://127.0.0.1:5000",SSLVerify:!0,security:{type:"basic",username:"user",password:"password"},mapping:[{url:"getdata",httpMethod:"GET",httpHeaders:{ACCEPT:"application/json"},content:{name:"morpheus",job:"leader"},allowRedirects:!0,timeout:.5,scanPeriod:5,dataUnpackExpression:"",converter:{type:"json",deviceNameJsonExpression:"SD8500",deviceTypeJsonExpression:"SD",attributes:[{key:"serialNumber",type:"string",value:"${serial}"}],telemetry:[{key:"Maintainer",type:"string",value:"${Developer}"},{key:"combine",type:"string",value:"${Developer}:${hum}"}]}},{url:"get_info",httpMethod:"GET",httpHeaders:{ACCEPT:"application/json"},allowRedirects:!0,timeout:.5,scanPeriod:100,dataUnpackExpression:"",converter:{type:"custom",deviceNameJsonExpression:"SD8500",deviceTypeJsonExpression:"SD",extension:"CustomRequestUplinkConverter","extension-config":[{key:"Totaliser",type:"float",fromByte:0,toByte:4,byteorder:"big",signed:!0,multiplier:1},{key:"Flow",type:"int",fromByte:4,toByte:6,byteorder:"big",signed:!0,multiplier:.01},{key:"Temperature",type:"int",fromByte:8,toByte:10,byteorder:"big",signed:!0,multiplier:.01},{key:"Pressure",type:"int",fromByte:12,toByte:14,byteorder:"big",signed:!0,multiplier:.01},{key:"deviceStatus",type:"int",byteAddress:15,fromBit:4,toBit:8,byteorder:"big",signed:!1},{key:"OUT2",type:"int",byteAddress:15,fromBit:1,toBit:2,byteorder:"big"},{key:"OUT1",type:"int",byteAddress:15,fromBit:0,toBit:1,byteorder:"big"}]}},{url:"/devices",httpMethod:"GET",httpHeaders:{ACCEPT:"application/json"},allowRedirects:!0,timeout:3,scanPeriod:1800,subRequests:{cumPwr:{url:"/${id}/hist/values/ActiveEnergy/SUM13/3600?start=RELATIVE_-1HOUR&end=RELATIVE_-1HOUR&online=false&aggregate=false",processingFunction:'def process_data(data, key): return {key: float(data["values"][0]["avg"])/1000.0}'}},converter:{type:"json",deviceNameJsonExpression:"${id}-${type}",deviceTypeJsonExpression:"GridVis",attributes:[{key:"id",type:"int",value:"${id}"},{key:"type",type:"string",value:"${type}"},{key:"serialNr",type:"string",value:"${serialNr}"},{key:"name",type:"string",value:"${name}"},{key:"description",type:"string",value:"${description}"}],telemetry:[{key:"cumPwr",type:"float",value:"${cumPwr}"}]}}],attributeUpdates:[{httpMethod:"POST",httpHeaders:{"Content-Type":"application/json"},timeout:.5,tries:3,allowRedirects:!0,deviceNameFilter:"SD.*",attributeFilter:"send_data",requestUrlExpression:"sensor/${deviceName}/${attributeKey}",requestValueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTimeout:1,httpMethod:"GET",responseValueExpression:"${temp}",timeout:.5,tries:3,httpHeaders:{"Content-Type":"application/json"}},{deviceNameFilter:".*",methodFilter:"no-reply",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",httpMethod:"POST",requestValueExpression:"${params}",httpHeaders:{"Content-Type":"application/json"}}]},Kt={interface:"socketcan",channel:"vcan0",backend:{fd:!0},reconnectPeriod:5,devices:[{name:"Car",sendDataOnlyOnChange:!1,enableUnknownRpc:!0,strictEval:!1,attributes:[{key:"isDriverDoorOpened",nodeId:41,command:"2:2:big:8717",value:"4:1:int",expression:"bool(value & 0b00000100)",polling:{type:"once",dataInHex:"AB CD AB CD"}}],timeseries:[{key:"rpm",nodeId:1918,isExtendedId:!0,command:"2:2:big:48059",value:"4:2:big:int",expression:"value / 4",polling:{type:"always",period:5,dataInHex:"aaaa bbbb aaaa bbbb"}},{key:"milliage",nodeId:1918,isExtendedId:!0,value:"4:2:little:int",expression:"value * 10",polling:{type:"always",period:30,dataInHex:"aa bb cc dd ee ff aa bb"}}],attributeUpdates:[{attributeOnThingsBoard:"softwareVersion",nodeId:64,isExtendedId:!0,dataLength:4,dataExpression:"value + 5",dataByteorder:"little"}],serverSideRpc:[{method:"sendSameData",nodeId:4,isExtendedId:!0,isFd:!0,bitrateSwitch:!0,dataInHex:"aa bb cc dd ee ff aa bb aa bb cc d ee ff"},{method:"setLightLevel",nodeId:5,dataLength:2,dataByteorder:"little",dataBefore:"00AA"},{method:"setSpeed",nodeId:16,dataAfter:"0102",dataExpression:"userSpeed if maxAllowedSpeed > userSpeed else maxAllowedSpeed"}]}]},Yt={"3.6.2":{application:{objectName:"TB_gateway",host:"0.0.0.0",port:47808,objectIdentifier:599,maxApduLengthAccepted:1476,segmentationSupported:"segmentedBoth",vendorIdentifier:15},devices:[{deviceInfo:{deviceNameExpression:"BACnet Device ${objectName}",deviceProfileExpression:"default",deviceNameExpressionSource:"expression",deviceProfileExpressionSource:"constant"},host:"192.168.2.110",port:"47808",pollPeriod:1e4,attributes:[{key:"temperature",objectType:"analogOutput",objectId:1,propertyId:"presentValue"}],timeseries:[{key:"state",objectType:"binaryValue",objectId:1,propertyId:"presentValue"}],attributeUpdates:[{key:"brightness",objectType:"analogOutput",objectId:1,propertyId:"presentValue"}],serverSideRpc:[{method:"set_state",requestType:"writeProperty",requestTimeout:1e4,objectType:"binaryOutput",objectId:1,propertyId:"presentValue"},{method:"get_state",requestType:"readProperty",requestTimeout:1e4,objectType:"binaryOutput",objectId:1,propertyId:"presentValue"}]}]},legacy:{general:{objectName:"TB_gateway",address:"0.0.0.0:47808",objectIdentifier:599,maxApduLengthAccepted:1476,segmentationSupported:"segmentedBoth",vendorIdentifier:15},devices:[{deviceName:"BACnet Device ${objectName}",deviceType:"default",address:"192.168.2.110:47808",pollPeriod:1e4,attributes:[{key:"temperature",type:"string",objectId:"analogOutput:1",propertyId:"presentValue"}],timeseries:[{key:"state",type:"bool",objectId:"binaryValue:1",propertyId:"presentValue"}],attributeUpdates:[{key:"brightness",requestType:"writeProperty",objectId:"analogOutput:1",propertyId:"presentValue"}],serverSideRpc:[{method:"set_state",requestType:"writeProperty",requestTimeout:1e4,objectId:"binaryOutput:1",propertyId:"presentValue"},{method:"get_state",requestType:"readProperty",requestTimeout:1e4,objectId:"binaryOutput:1",propertyId:"presentValue"}]}]}},Xt={connection:{str:"Driver={PostgreSQL};Server=localhost;Port=5432;Database=thingsboard;Uid=postgres;Pwd=postgres;",attributes:{autocommit:!0,timeout:0},encoding:"utf-8",decoding:{char:"utf-8",wchar:"utf-8",metadata:"utf-16le"},reconnect:!0,reconnectPeriod:60},pyodbc:{pooling:!1},polling:{query:"SELECT bool_v, str_v, dbl_v, long_v, entity_id, ts FROM ts_kv WHERE ts > ? ORDER BY ts ASC LIMIT 10",period:10,iterator:{column:"ts",query:"SELECT MIN(ts) - 1 FROM ts_kv",persistent:!1}},mapping:{device:{type:"postgres",name:"'ODBC ' + entity_id"},sendDataOnlyOnChange:!1,attributes:"*",timeseries:[{name:"value",value:"[i for i in [str_v, long_v, dbl_v,bool_v] if i is not None][0]"}]},serverSideRpc:{enableUnknownRpc:!1,overrideRpcConfig:!0,methods:["procedureOne",{name:"procedureTwo",args:["One",2,3]}]}},Zt={"3.7.2":{server:{host:"127.0.0.1",port:"5000",SSL:!1,security:{cert:"~/ssl/cert.pem",key:"~/ssl/key.pem"}},mapping:[{endpoint:"/my_devices",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"request",deviceNameExpression:"${sensorName}",deviceProfileExpressionSource:"request",deviceProfileExpression:"${sensorType}"},attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"certificateNumber",value:"${certificateNumber}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon1",HTTPMethods:["GET","POST"],security:{type:"anonymous"},converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Device 2",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},attributes:[{type:"string",key:"model",value:"Model2"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon2",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"custom",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"SuperAnonDevice",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},extension:"CustomRestUplinkConverter",extensionConfig:{key:"Totaliser",datatype:"float",fromByte:0,toByte:4,byteorder:"big",signed:!0,multiplier:1}}}],requestsMapping:{attributeRequests:[{endpoint:"/sharedAttributes",type:"shared",HTTPMethods:["POST"],security:{type:"anonymous"},timeout:10,deviceNameExpression:"${deviceName}",attributeNameExpression:"${attribute}${attribute1}"}],attributeUpdates:[{HTTPMethod:"POST",SSLVerify:!1,httpHeaders:{"CONTENT-TYPE":"application/json"},security:{type:"anonymous"},timeout:.5,tries:3,allowRedirects:!0,deviceNameFilter:"SN.*",attributeFilter:".*",requestUrlExpression:"http://127.0.0.1:5001/",valueExpression:'{"deviceName":"${deviceName}","${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestUrlExpression:"http://127.0.0.1:5001/${deviceName}",responseTimeout:1,HTTPMethod:"GET",valueExpression:"${params}",timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:"SN.*",methodFilter:"post_attributes",requestUrlExpression:"http://127.0.0.1:5000/my_devices",responseTimeout:1,HTTPMethod:"POST",valueExpression:'{"sensorName":"${deviceName}", "sensorModel":"${params.sensorModel}", "certificateNumber":"${params.certificateNumber}", "temp":"${params.temp}", "hum":"${params.hum}"}',timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:".*",methodFilter:"no-reply",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",HTTPMethod:"POST",valueExpression:"${params}",httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}}]}},legacy:{host:"127.0.0.1",port:"5000",SSL:!1,security:{cert:"~/ssl/cert.pem",key:"~/ssl/key.pem"},mapping:[{endpoint:"/my_devices",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"json",deviceNameExpression:"${sensorName}",deviceTypeExpression:"${sensorType}",attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"certificateNumber",value:"${certificateNumber}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon1",HTTPMethods:["GET","POST"],security:{type:"anonymous"},converter:{type:"json",deviceNameExpression:"Device 2",deviceTypeExpression:"default",attributes:[{type:"string",key:"model",value:"Model2"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon2",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"custom",deviceNameExpression:"SuperAnonDevice",deviceTypeExpression:"default",extension:"CustomRestUplinkConverter","extension-config":{key:"Totaliser",datatype:"float",fromByte:0,toByte:4,byteorder:"big",signed:!0,multiplier:1}}}],attributeRequests:[{endpoint:"/sharedAttributes",type:"shared",HTTPMethods:["POST"],security:{type:"anonymous"},timeout:10,deviceNameExpression:"${deviceName}",attributeNameExpression:"${attribute}${attribute1}"}],attributeUpdates:[{HTTPMethod:"POST",SSLVerify:!1,httpHeaders:{"CONTENT-TYPE":"application/json"},security:{type:"anonymous"},timeout:.5,tries:3,allowRedirects:!0,deviceNameFilter:"SN.*",attributeFilter:".*",requestUrlExpression:"http://127.0.0.1:5001/",valueExpression:'{"deviceName":"${deviceName}","${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestUrlExpression:"http://127.0.0.1:5001/${deviceName}",responseTimeout:1,HTTPMethod:"GET",valueExpression:"${params}",timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:"SN.*",methodFilter:"post_attributes",requestUrlExpression:"http://127.0.0.1:5000/my_devices",responseTimeout:1,HTTPMethod:"POST",valueExpression:'{"sensorName":"${deviceName}", "sensorModel":"${params.sensorModel}", "certificateNumber":"${params.certificateNumber}", "temp":"${params.temp}", "hum":"${params.hum}"}',timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:".*",methodFilter:"no-reply",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",HTTPMethod:"POST",valueExpression:"${params}",httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}}]}},Qt={devices:[{deviceName:"SNMP router",deviceType:"snmp",ip:"snmp.live.gambitcommunications.com",port:161,pollPeriod:5e3,community:"public",attributes:[{key:"ReceivedFromGet",method:"get",oid:"1.3.6.1.2.1.1.1.0",timeout:6},{key:"ReceivedFromMultiGet",method:"multiget",oid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],timeout:6},{key:"ReceivedFromGetNext",method:"getnext",oid:"1.3.6.1.2.1.1.1.0",timeout:6},{key:"ReceivedFromMultiWalk",method:"multiwalk",oid:["1.3.6.1.2.1.1.1.0","1.3.6.0.1.2.1"]},{key:"ReceivedFromBulkWalk",method:"bulkwalk",oid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"]},{key:"ReceivedFromBulkGet",method:"bulkget",scalarOid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],repeatingOid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],maxListSize:10}],telemetry:[{key:"ReceivedFromWalk",community:"private",method:"walk",oid:"1.3.6.1.2.1.1.1.0"},{key:"ReceivedFromTable",method:"table",oid:"1.3.6.1.2.1.1"}],attributeUpdateRequests:[{attributeFilter:"dataToSet",method:"set",oid:"1.3.6.1.2.1.1.1.0"},{attributeFilter:"dataToMultiSet",method:"multiset",mappings:{"1.2.3":"10","2.3.4":"${attribute}"}}],serverSideRpcRequests:[{requestFilter:"setData",method:"set",oid:"1.3.6.1.2.1.1.1.0"},{requestFilter:"multiSetData",method:"multiset"},{requestFilter:"getData",method:"get",oid:"1.3.6.1.2.1.1.1.0"},{requestFilter:"runBulkWalk",method:"bulkwalk",oid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"]}]},{deviceName:"SNMP router",deviceType:"snmp",ip:"127.0.0.1",pollPeriod:5e3,community:"public",converter:"CustomSNMPConverter",attributes:[{key:"ReceivedFromGetWithCustomConverter",method:"get",oid:"1.3.6.1.2.1.1.1.0"}],telemetry:[{key:"ReceivedFromTableWithCustomConverter",method:"table",oid:"1.3.6.1.2.1.1.1.0"}]}]},Jt={host:"0.0.0.0",port:21,TLSSupport:!1,security:{type:"basic",username:"admin",password:"admin"},paths:[{devicePatternName:"asd",devicePatternType:"Device",delimiter:",",path:"fol/*_hello*.txt",readMode:"FULL",maxFileSize:5,pollPeriod:500,txtFileDataView:"SLICED",withSortingFiles:!0,attributes:[{key:"temp",value:"[1:]"},{key:"tmp",value:"[0:1]"}],timeseries:[{type:"int",key:"[0:1]",value:"[0:1]"},{type:"int",key:"temp",value:"[1:]"}]}],attributeUpdates:[{path:"fol/hello.json",deviceNameFilter:".*",writingMode:"WRITE",valueExpression:"{'${attributeKey}':'${attributeValue}'}"}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"read",valueExpression:"${params}"},{deviceNameFilter:".*",methodFilter:"write",valueExpression:"${params}"}]},en={server:{jid:"gateway@localhost",password:"password",host:"localhost",port:5222,use_ssl:!1,disable_starttls:!1,force_starttls:!0,timeout:1e4,plugins:["xep_0030","xep_0323","xep_0325"]},devices:[{jid:"device@localhost/TMP_1101",deviceNameExpression:"${serialNumber}",deviceTypeExpression:"default",attributes:[{key:"temperature",value:"${temp}"}],timeseries:[{key:"humidity",value:"${hum}"},{key:"combination",value:"${temp}:${hum}"}],attributeUpdates:[{attributeOnThingsBoard:"shared",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{methodRPC:"rpc1",withResponse:!0,valueExpression:"${params}"}]}]},tn={centralSystem:{name:"Central System",host:"127.0.0.1",port:9e3,connection:{type:"insecure"},security:[{type:"token",tokens:["Bearer ACCESS_TOKEN"]},{type:"basic",credentials:[{username:"admin",password:"admin"}]}]},chargePoints:[{idRegexpPattern:"bidon/hello/CP_1",deviceNameExpression:"${Vendor} ${Model}",deviceTypeExpression:"default",attributes:[{messageTypeFilter:"MeterValues,",key:"temp1",value:"${meter_value[:].sampled_value[:].value}"},{messageTypeFilter:"MeterValues,",key:"vendorId",value:"${connector_id}"}],timeseries:[{messageTypeFilter:"DataTransfer,",key:"temp",value:"${data.temp}"}],attributeUpdates:[{attributeOnThingsBoard:"shared",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{methodRPC:"rpc1",withResponse:!0,valueExpression:"${params}"}]}]};const nn=e("connectorConfigs",{[yt.MQTT]:Ut,[yt.MODBUS]:jt,[yt.OPCUA]:Ht,[yt.BLE]:Wt,[yt.REQUEST]:$t,[yt.CAN]:Kt,[yt.BACNET]:Yt,[yt.ODBC]:Xt,[yt.REST]:Zt,[yt.SNMP]:Qt,[yt.FTP]:Jt,[yt.SOCKET]:zt,[yt.XMPP]:en,[yt.OCPP]:tn,[yt.KNX]:{3.7:{logLevel:"INFO",client:{type:"AUTOMATIC",addressFormat:"LONG",gatewayIP:"127.0.0.1",gatewayPort:3671,autoReconnect:!0,autoReconnectWait:3,gatewaysScanner:{enabled:!0,scanPeriod:3,stopOnFound:!1}},devices:[{deviceInfo:{deviceNameDataType:"string",deviceNameExpressionSource:"expression",deviceNameExpression:"Device ${1/0/5}",deviceProfileDataType:"none",deviceProfileExpressionSource:"constant",deviceProfileNameExpression:"default"},pollPeriod:5e3,attributes:[{type:"temperature",key:"temperature",groupAddress:"1/0/6"}],timeseries:[{type:"humidity",key:"humidity",groupAddress:"1/0/7"}]}],attributeUpdates:[{deviceNameFilter:".*",dataType:"precent_U8",groupAddress:"1/0/9",key:"brightness"}],serverSideRpc:[{requestType:"read",deviceNameFilter:".*",method:"get_name",dataType:"string",groupAddress:"1/0/5"},{requestType:"write",deviceNameFilter:".*",method:"set_name",dataType:"string",groupAddress:"1/0/5"}]}},[yt.S7]:{"3.8.5":{devices:[{type:"PLC",address:"127.0.0.1",port:1102,rack:0,slot:1,deviceName:"S7 PLC",deviceProfileName:"default",autoReconnect:!0,maxRetries:3,retryDelay:1,maxDelay:30,heartbeatInterval:5,pollPeriod:1e4,attributes:[{type:"tag",key:"power",tag:"DB1.DBD204:REAL"},{type:"tag",key:"frequency",tag:"DB1.DBD200:REAL"}],timeseries:[{type:"data",key:"temperature",dataType:"real",dbNumber:1,start:50,size:4},{type:"data",key:"humidity",dataType:"lreal",dbNumber:1,start:54,size:8},{type:"data",key:"relay",dataType:"bool",dbNumber:1,start:0,size:1,bit:0}],attributeUpdates:[{type:"tag",key:"relay",tag:"DB1.DBX0.0:BOOL"}],serverSideRpc:[{method:"getRelay",requestType:"read",type:"data",dataType:"bool",dbNumber:1,start:0,size:1,bit:0},{method:"setRelay",requestType:"write",type:"data",dataType:"bool",dbNumber:1,start:0,size:1,bit:0}]},{type:"LOGO",address:"127.0.0.1",port:102,tsapSnap7:20,tsapLogo:30,deviceName:"LOGO",deviceProfileName:"default",autoReconnect:!0,maxRetries:3,retryDelay:1,maxDelay:30,heartbeatInterval:5,pollPeriod:1e4,attributes:[],timeseries:[{type:"vm",key:"temperature",vmAddress:"VW30"},{type:"vm",key:"humidity",vmAddress:"VW0"}],attributeUpdates:[{type:"vm",key:"lightLevel",vmAddress:"VW30"}],serverSideRpc:[{method:"setLight",requestType:"write",type:"vm",vmAddress:"VW30"},{method:"getLight",requestType:"read",type:"vm",vmAddress:"VW30"}]}]}}});function an(e){const t=nn[e];if(!t)throw new Error("No default config found");return t}var rn;e("ModbusDataType",rn),function(e){e.STRING="string",e.BYTES="bytes",e.BITS="bits",e.INT8="8int",e.UINT8="8uint",e.INT16="16int",e.UINT16="16uint",e.FLOAT16="16float",e.INT32="32int",e.UINT32="32uint",e.FLOAT32="32float",e.INT64="64int",e.UINT64="64uint",e.FLOAT64="64float"}(rn||e("ModbusDataType",rn={}));const on=e("ModbusEditableDataTypes",[rn.BYTES,rn.BITS,rn.STRING]);var sn,ln;e("ModbusObjectCountByDataType",sn),function(e){e[e["8int"]=1]="8int",e[e["8uint"]=1]="8uint",e[e["16int"]=1]="16int",e[e["16uint"]=1]="16uint",e[e["16float"]=1]="16float",e[e["32int"]=2]="32int",e[e["32uint"]=2]="32uint",e[e["32float"]=2]="32float",e[e["64int"]=4]="64int",e[e["64uint"]=4]="64uint",e[e["64float"]=4]="64float"}(sn||e("ModbusObjectCountByDataType",sn={})),e("MappingValueType",ln),function(e){e.STRING="string",e.INTEGER="integer",e.DOUBLE="double",e.BOOLEAN="boolean"}(ln||e("MappingValueType",ln={}));const pn=e("mappingValueTypesMap",new Map([[ln.STRING,{name:"value.string",icon:"mdi:format-text"}],[ln.INTEGER,{name:"value.integer",icon:"mdi:numeric"}],[ln.DOUBLE,{name:"value.double",icon:"mdi:numeric"}],[ln.BOOLEAN,{name:"value.boolean",icon:"mdi:checkbox-marked-outline"}]])),cn=e("ModbusFunctionCodeTranslationsMap",new Map([[1,"gateway.function-codes.read-coils"],[2,"gateway.function-codes.read-discrete-inputs"],[3,"gateway.function-codes.read-multiple-holding-registers"],[4,"gateway.function-codes.read-input-registers"],[5,"gateway.function-codes.write-single-coil"],[6,"gateway.function-codes.write-single-holding-register"],[15,"gateway.function-codes.write-multiple-coils"],[16,"gateway.function-codes.write-multiple-holding-registers"]]));var dn,un,mn;e("ConfigurationModes",dn),function(e){e.BASIC="basic",e.ADVANCED="advanced"}(dn||e("ConfigurationModes",dn={})),e("ReportStrategyType",un),function(e){e.OnChange="ON_CHANGE",e.OnReportPeriod="ON_REPORT_PERIOD",e.OnChangeOrReportPeriod="ON_CHANGE_OR_REPORT_PERIOD",e.OnReceived="ON_RECEIVED"}(un||e("ReportStrategyType",un={})),e("ReportStrategyDefaultValue",mn),function(e){e[e.Gateway=6e4]="Gateway",e[e.Connector=6e4]="Connector",e[e.Device=3e4]="Device",e[e.Key=15e3]="Key"}(mn||e("ReportStrategyDefaultValue",mn={}));const hn=e("ReportStrategyTypeTranslationsMap",new Map([[un.OnChange,"gateway.report-strategy.on-change"],[un.OnReportPeriod,"gateway.report-strategy.on-report-period"],[un.OnChangeOrReportPeriod,"gateway.report-strategy.on-change-or-report-period"],[un.OnReceived,"gateway.report-strategy.on-received"]])),gn=e("numberInputPattern",new RegExp(/^\d{1,15}(\.\d{1,15})?$/)),fn=e("noLeadTrailSpacesRegex",/^\S+(?: \S+)*$/),yn=e("integerRegex",/^[-+]?\d+$/),vn=e("nonZeroFloat",/^-?(?!0(\.0+)?$)\d+(\.\d+)?$/),xn=e("directoryRegex",new RegExp(/^\.\/[^.\/ ]+(?: [^.\/ ]+)*(?:\/[^.\/ ]+(?: [^.\/ ]+)*)*\/$/));var bn;!function(e){e.EXCEPTION="EXCEPTION"}(bn||(bn={}));const wn={...gt,...bn},Sn=()=>[10,20,30];function Cn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"a",19),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$implicit,i=t.ɵɵnextContext();return t.ɵɵresetView(i.onTabChanged(n))})),t.ɵɵtext(1),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("active",i.activeLink.name===e.name),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.name," ")}}function _n(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",20),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.created-time")))}function Tn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtext(1),t.ɵɵpipe(2,"date"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind2(2,1,e.ts,"yyyy-MM-dd HH:mm:ss")," ")}}function En(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",21),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.level")))}function In(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell")(1,"span"),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(i.statusClass(e.status)),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.status)}}function Mn(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",22),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.message")))}function kn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵclassMap(i.statusClassMsg(e.status)),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.message," ")}}function Pn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",23)}function Dn(e,n){1&e&&t.ɵɵelement(0,"mat-row",23)}class An{constructor(e){this.translate=e,this.displayedColumns=["ts","status","message"],this.gatewayLogLinks=[{name:this.translate.instant("gateway.logs.columns.general"),key:"LOGS"},{name:this.translate.instant("gateway.logs.columns.service"),key:"SERVICE_LOGS"},{name:this.translate.instant("gateway.logs.columns.connection"),key:"CONNECTION_LOGS"},{name:this.translate.instant("gateway.logs.columns.storage"),key:"STORAGE_LOGS"},{key:"EXTENSIONS_LOGS",name:this.translate.instant("gateway.logs.columns.extension")}];const t={property:"ts",direction:S.DESC};this.pageLink=new C(10,0,null,t),this.dataSource=new x([])}ngOnInit(){this.updateWidgetTitle()}ngAfterViewInit(){if(this.dataSource.sort=this.sort,this.dataSource.paginator=this.paginator,this.ctx.defaultSubscription.onTimewindowChangeFunction=e=>(this.ctx.defaultSubscription.options.timeWindowConfig=e,this.ctx.defaultSubscription.updateDataSubscriptions(),e),this.ctx.settings.isConnectorLog&&this.ctx.settings.connectorLogState){const e=this.ctx.stateController.getStateParams()[this.ctx.settings.connectorLogState];this.logLinks=[{key:`${e.key}_LOGS`,name:this.translate.instant("gateway.connector"),filterFn:e=>!e.message.includes("_converter.py")},{key:`${e.key}_converter_LOGS`,name:this.translate.instant("gateway.converter"),filterFn:e=>e.message.includes("_converter.py")}]}else this.logLinks=this.gatewayLogLinks;this.activeLink=this.logLinks[0],this.changeSubscription()}updateWidgetTitle(){if(this.ctx.settings.isConnectorLog&&this.ctx.settings.connectorLogState){const e=this.ctx.widgetConfig.title,t="${connectorName}";if(e.includes(t)){const n=this.ctx.stateController.getStateParams()[this.ctx.settings.connectorLogState];this.ctx.widgetTitle=e.replace(t,n.key)}}}updateData(){if(this.ctx.defaultSubscription.data.length&&this.ctx.defaultSubscription.data[0]){let e=this.ctx.defaultSubscription.data[0].data.map((e=>{const t={ts:e[0],key:this.activeLink.key,message:e[1],status:"INVALID LOG FORMAT"};try{t.message=/\[(.*)/.exec(e[1])[0]}catch(n){t.message=e[1]}try{t.status=e[1].match(/\|(\w+)\|/)[1]}catch(e){t.status="INVALID LOG FORMAT"}return t}));this.activeLink.filterFn&&(e=e.filter((e=>this.activeLink.filterFn(e)))),this.dataSource.data=e}}onTabChanged(e){this.activeLink=e,this.changeSubscription()}statusClass(e){switch(e){case wn.DEBUG:return"status status-debug";case wn.WARNING:return"status status-warning";case wn.ERROR:case wn.EXCEPTION:return"status status-error";default:return"status status-info"}}statusClassMsg(e){if(e===wn.EXCEPTION)return"msg-status-exception"}trackByLogTs(e,t){return t.ts}changeSubscription(){this.ctx.datasources&&this.ctx.datasources[0].entity&&this.ctx.defaultSubscription.options.datasources&&(this.ctx.defaultSubscription.options.datasources[0].dataKeys=[{name:this.activeLink.key,type:_.timeseries,settings:{}}],this.ctx.defaultSubscription.unsubscribe(),this.ctx.defaultSubscription.updateDataSubscriptions(),this.ctx.defaultSubscription.callbacks.onDataUpdated=()=>{this.updateData()})}static{this.ɵfac=function(e){return new(e||An)(t.ɵɵdirectiveInject(he.TranslateService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:An,selectors:[["tb-gateway-logs"]],viewQuery:function(e,n){if(1&e&&(t.ɵɵviewQuery(v,5),t.ɵɵviewQuery(b,5)),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.sort=e.first),t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.paginator=e.first)}},inputs:{ctx:"ctx",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:24,vars:20,consts:[["tabPanel",""],[1,"flex","h-full","flex-col"],["mat-tab-nav-bar","",3,"tabPanel"],["mat-tab-link","",3,"active"],[1,"flex-1","overflow-auto"],["mat-table","","matSort","","matSortDisableClear","",3,"dataSource","trackBy","matSortActive","matSortDirection"],["matColumnDef","ts"],["mat-sort-header","","style","width: 20%",4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","status"],["mat-sort-header","","style","width: 10%",4,"matHeaderCellDef"],["matColumnDef","message"],["mat-sort-header","","style","width: 70%",4,"matHeaderCellDef"],[3,"class",4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","mat-row-select",4,"matRowDef","matRowDefColumns"],[1,"no-data-found","flex-1","items-center","justify-center"],[1,"flex-1"],["showFirstLastButtons","",3,"length","pageIndex","pageSize","pageSizeOptions"],["mat-tab-link","",3,"click","active"],["mat-sort-header","",2,"width","20%"],["mat-sort-header","",2,"width","10%"],["mat-sort-header","",2,"width","70%"],[1,"mat-row-select"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"nav",2),t.ɵɵrepeaterCreate(2,Cn,2,2,"a",3,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵelement(4,"mat-tab-nav-panel",null,0),t.ɵɵelementStart(6,"div",4)(7,"table",5),t.ɵɵelementContainerStart(8,6),t.ɵɵtemplate(9,_n,3,3,"mat-header-cell",7)(10,Tn,3,4,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(11,9),t.ɵɵtemplate(12,En,3,3,"mat-header-cell",10)(13,In,3,3,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(14,11),t.ɵɵtemplate(15,Mn,3,3,"mat-header-cell",12)(16,kn,2,3,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(17,Pn,1,0,"mat-header-row",14)(18,Dn,1,0,"mat-row",15),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"span",16),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"span",17),t.ɵɵelementEnd(),t.ɵɵelement(23,"mat-paginator",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵreference(5);t.ɵɵadvance(),t.ɵɵproperty("tabPanel",e),t.ɵɵadvance(),t.ɵɵrepeater(n.logLinks),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource)("trackBy",n.trackByLogTs)("matSortActive",n.pageLink.sortOrder.property)("matSortDirection",n.pageLink.sortDirection()),t.ɵɵadvance(10),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",0!==n.dataSource.data.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,17,"attribute.no-telemetry-text")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",0===n.dataSource.data.length),t.ɵɵadvance(),t.ɵɵproperty("length",n.dataSource.data.length)("pageIndex",n.pageLink.page)("pageSize",n.pageLink.pageSize)("pageSizeOptions",t.ɵɵpureFunction0(19,Sn))}},dependencies:t.ɵɵgetComponentDepsFactory(An,[me,T]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;overflow-x:auto;padding:0}[_nghost-%COMP%] .status[_ngcontent-%COMP%]{border-radius:20px;font-weight:500;padding:5px 15px}[_nghost-%COMP%] .status-debug[_ngcontent-%COMP%]{color:green;background:#0080001a}[_nghost-%COMP%] .status-warning[_ngcontent-%COMP%]{color:orange;background:#ffa5001a}[_nghost-%COMP%] .status-error[_ngcontent-%COMP%]{color:red;background:#ff00001a}[_nghost-%COMP%] .status-info[_ngcontent-%COMP%]{color:#00f;background:#0000801a}[_nghost-%COMP%] .msg-status-exception[_ngcontent-%COMP%]{color:red}']})}} -/** - * @license Angular v18.2.6 - * (c) 2010-2024 Google LLC. https://angular.io/ - * License: MIT - */ -function On(e){e||(n(On),e=i(a));const t=new Ce((t=>e.onDestroy(t.next.bind(t))));return e=>e.pipe(Re(t))}e("GatewayLogsComponent",An);function Rn(e,t){!t?.injector&&n(Rn);const l=t?.injector??i(r),p=new _e(1),c=o((()=>{let t;try{t=e()}catch(e){return void s((()=>p.error(e)))}s((()=>p.next(t)))}),{injector:l,manualCleanup:!0});return l.get(a).onDestroy((()=>{c.destroy(),p.complete()})),p.asObservable()}const Bn=["commandInput"],Fn=(e,t)=>t.attributeOnGateway,Nn=e=>({command:e});function Ln(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.clear())})),t.ɵɵelementStart(2,"mat-icon",11),t.ɵɵtext(3,"close"),t.ɵɵelementEnd()()}2&e&&t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,1,"action.clear"))}function Vn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onCreateNewClick(n))})),t.ɵɵelementStart(1,"span",13),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"notification.create-new")))}function qn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵelement(1,"span",14),t.ɵɵpipe(2,"async"),t.ɵɵpipe(3,"highlight"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(3,4,e.attributeOnGateway,t.ɵɵpipeBind1(2,2,i.searchText$)),t.ɵɵsanitizeHtml)}}function Gn(e,n){if(1&e&&(t.ɵɵtext(0),t.ɵɵpipe(1,"async"),t.ɵɵpipe(2,"translate")),2&e){const e=t.ɵɵnextContext(2);t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind2(2,3,"gateway.statistics.no-commands-matching",t.ɵɵpureFunction1(6,Nn,e.truncate.transform(t.ɵɵpipeBind1(1,1,e.searchText$),!0,6,"...")))," ")}}function zn(e,n){1&e&&(t.ɵɵtext(0),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(1,1,"gateway.statistics.no-command-found")," ")}function Un(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-option",9)(1,"div",15),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(2,"span"),t.ɵɵtemplate(3,Gn,3,8),t.ɵɵpipe(4,"async"),t.ɵɵtemplate(5,zn,2,3),t.ɵɵelementStart(6,"a",16),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onCreateNewClick(n))})),t.ɵɵtext(7,"gateway.create-new-one"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("value",null),t.ɵɵadvance(3),t.ɵɵconditional(t.ɵɵpipeBind1(4,2,e.searchText$)?3:5)}}class jn{constructor(e,t,n){this.truncate=e,this.fb=t,this.destroyRef=n,this.commands=l(),this.onCreateNewClicked=p(),this.selectStatisticsCommandControl=this.fb.control({}),this.searchText$=this.selectStatisticsCommandControl.valueChanges.pipe(Be((e=>e?"string"==typeof e?e:e?.attributeOnGateway:"")),Fe(),Te(1)),this.filteredCommands$=Ee([this.searchText$,Rn(this.commands)]).pipe(Ne(150),Be((([e,t])=>{const n=t.find((t=>t.attributeOnGateway===e))??null,i=this.selectStatisticsCommandControl.value;return"string"==typeof i&&n?.attributeOnGateway!==e||this.selectStatisticsCommandControl.patchValue(n,{emitEvent:!Q(n,i)}),t.filter((t=>t.attributeOnGateway.toLowerCase().includes(e?.toLowerCase()??"")))})),Te(1)),this.onChanges=e=>{},this.selectStatisticsCommandControl.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>this.onChanges(e)))}registerOnChange(e){this.onChanges=e}registerOnTouched(e){}writeValue(e){this.selectStatisticsCommandControl.patchValue(e)}displayCommandFn(e){return e?e.attributeOnGateway:null}clear(){this.selectStatisticsCommandControl.patchValue(null,{emitEvent:!0}),setTimeout((()=>{this.commandInput.nativeElement.blur(),this.commandInput.nativeElement.focus()}),0)}onCreateNewClick(e){e.stopPropagation(),this.onCreateNewClicked.emit()}static{this.ɵfac=function(e){return new(e||jn)(t.ɵɵdirectiveInject(E.TruncatePipe),t.ɵɵdirectiveInject(ye.UntypedFormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:jn,selectors:[["tb-statistics-commands-autocomplete"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Bn,7),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.commandInput=e.first)}},inputs:{commands:[1,"commands"]},outputs:{onCreateNewClicked:"onCreateNewClicked"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>jn)),multi:!0}]),t.ɵɵStandaloneFeature],decls:14,vars:10,consts:[["commandInput",""],["commandAutocomplete","matAutocomplete"],["appearance","outline",1,"mat-block"],["translate",""],["matInput","","type","text",3,"formControl","matAutocomplete"],["type","button","matTooltipPosition","above","matSuffix","","mat-icon-button","","aria-label","Clear",1,"action-button",3,"matTooltip"],["mat-button","","color","primary","matSuffix","",1,"mr-2"],[1,"tb-autocomplete",3,"displayWith"],[3,"value"],[1,"tb-not-found",3,"value"],["type","button","matTooltipPosition","above","matSuffix","","mat-icon-button","","aria-label","Clear",1,"action-button",3,"click","matTooltip"],[1,"material-icons"],["mat-button","","color","primary","matSuffix","",1,"mr-2",3,"click"],[1,"whitespace-nowrap"],[3,"innerHTML"],[1,"tb-not-found-content",3,"click"],["translate","",3,"click"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",2)(1,"mat-label",3),t.ɵɵtext(2,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",4,0),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,Ln,4,3,"button",5)(7,Vn,4,3,"button",6),t.ɵɵelementStart(8,"mat-autocomplete",7,1),t.ɵɵrepeaterCreate(10,qn,4,7,"mat-option",8,Fn,!1,Un,8,4,"mat-option",9),t.ɵɵpipe(13,"async"),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵreference(9);t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.selectStatisticsCommandControl)("matAutocomplete",e),t.ɵɵattribute("aria-label",t.ɵɵpipeBind1(5,6,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵconditional(n.selectStatisticsCommandControl.value?6:7),t.ɵɵadvance(2),t.ɵɵproperty("displayWith",n.displayCommandFn),t.ɵɵadvance(2),t.ɵɵrepeater(t.ɵɵpipeBind1(13,8,n.filteredCommands$))}},dependencies:t.ɵɵgetComponentDepsFactory(jn,[me,T]),styles:['@charset "UTF-8";[_nghost-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{border-bottom:none;color:inherit}[_nghost-%COMP%] .action-button[_ngcontent-%COMP%]{opacity:.7}']})}}const Hn=()=>["createdTime","message"];function Wn(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",12),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.created-time")))}function $n(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",13),t.ɵɵtext(1),t.ɵɵpipe(2,"date"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(2,1,e[0],"yyyy-MM-dd HH:mm:ss"))}}function Kn(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",14),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"widgets.gateway.message")," "))}function Yn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell")(1,"div",15),t.ɵɵtext(2),t.ɵɵelement(3,"tb-copy-button",16),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",e[1]," "),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tooltipText",t.ɵɵpipeBind1(4,3,"gateway.statistics.copy-message")),t.ɵɵproperty("copyText",e[1])}}function Xn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",17)}function Zn(e,n){1&e&&t.ɵɵelement(0,"mat-row",17)}class Qn{constructor(){this.data=l([]),this.defaultPageSizes=[10,20,30],this.defaultSortOrder={property:"0",direction:S.DESC},this.pageLink=new C(this.defaultPageSizes[0],0,null,this.defaultSortOrder),this.dataSource=new x([]),o((()=>{this.dataSource.data=this.data()}))}ngAfterViewInit(){this.dataSource.sort=this.sort,this.dataSource.paginator=this.paginator,this.dataSource.sortingDataAccessor=e=>e[Number(this.sort?.active)||0]}static{this.ɵfac=function(e){return new(e||Qn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Qn,selectors:[["tb-custom-statistics-table"]],viewQuery:function(e,n){if(1&e&&(t.ɵɵviewQuery(v,5),t.ɵɵviewQuery(b,5)),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.sort=e.first),t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.paginator=e.first)}},inputs:{data:[1,"data"]},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:12,vars:13,consts:[[1,"flex","h-full","flex-col"],[1,"flex-1","overflow-auto"],["mat-table","","matSort","","matSortDisableClear","",3,"dataSource","matSortActive","matSortDirection"],["matColumnDef","createdTime"],["mat-sort-header","","class","w-1/5",4,"matHeaderCellDef"],["class","!w-1/5",4,"matCellDef"],["matColumnDef","message"],["mat-sort-header","",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","mat-row-select",4,"matRowDef","matRowDefColumns"],["showFirstLastButtons","",3,"length","pageSize","pageSizeOptions"],["mat-sort-header","",1,"w-1/5"],[1,"!w-1/5"],["mat-sort-header",""],[1,"flex","items-center","justify-between"],["tooltipPosition","above","icon","content_copy",1,"copy-content",3,"copyText","tooltipText"],[1,"mat-row-select"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"table",2),t.ɵɵelementContainerStart(3,3),t.ɵɵtemplate(4,Wn,3,3,"mat-header-cell",4)(5,$n,3,4,"mat-cell",5),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(6,6),t.ɵɵtemplate(7,Kn,3,3,"mat-header-cell",7)(8,Yn,5,5,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(9,Xn,1,0,"mat-header-row",9)(10,Zn,1,0,"mat-row",10),t.ɵɵelementEnd()(),t.ɵɵelement(11,"mat-paginator",11),t.ɵɵelementEnd()),2&e){let e;t.ɵɵadvance(2),t.ɵɵproperty("dataSource",n.dataSource)("matSortActive",n.pageLink.sortOrder.property)("matSortDirection",n.pageLink.sortDirection()),t.ɵɵadvance(7),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(11,Hn))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(12,Hn)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",!n.dataSource.data.length),t.ɵɵproperty("length",null!==(e=null==n.dataSource||null==n.dataSource.data?null:n.dataSource.data.length)&&void 0!==e?e:0)("pageSize",n.defaultPageSizes[0])("pageSizeOptions",n.defaultPageSizes)}},dependencies:t.ɵɵgetComponentDepsFactory(Qn,[me,T]),styles:['@charset "UTF-8";[_nghost-%COMP%] .copy-content .mat-icon{padding:4px;font-size:18px}']})}}class Jn{constructor(e,t,n){this.elementRef=e,this.renderer=t,this.tooltip=n,this.tooltipEnabled=!0,this.position="above",this.destroy$=new Ie}ngOnInit(){this.observeMouseEvents(),this.applyTruncationStyles()}ngAfterViewInit(){this.tooltip.position=this.position}ngOnDestroy(){this.tooltip._isTooltipVisible()&&this.hideTooltip(),this.destroy$.next(),this.destroy$.complete()}observeMouseEvents(){Me(this.elementRef.nativeElement,"mouseenter").pipe(Le((()=>this.tooltipEnabled)),Le((()=>this.isOverflown(this.elementRef.nativeElement))),Ve((()=>this.showTooltip())),Re(this.destroy$)).subscribe(),Me(this.elementRef.nativeElement,"mouseleave").pipe(Le((()=>this.tooltipEnabled)),Le((()=>this.tooltip._isTooltipVisible())),Ve((()=>this.hideTooltip())),Re(this.destroy$)).subscribe()}applyTruncationStyles(){this.renderer.setStyle(this.elementRef.nativeElement,"white-space","nowrap"),this.renderer.setStyle(this.elementRef.nativeElement,"overflow","hidden"),this.renderer.setStyle(this.elementRef.nativeElement,"text-overflow","ellipsis")}isOverflown(e){return e.clientWidth{this.adjustChips()}),0))}constructor(e,t,n,i){this.el=e,this.renderer=t,this.translate=n,this.window=i,this.destroy$=new Ie,this.renderer.setStyle(this.el.nativeElement,"max-height","48px"),this.renderer.setStyle(this.el.nativeElement,"overflow","auto"),Me(i,"resize").pipe(Re(this.destroy$)).subscribe((()=>{this.adjustChips()})),this.observeIntersection()}observeIntersection(){this.intersectionObserver=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&this.adjustChips()}))})),this.intersectionObserver.observe(this.el.nativeElement)}adjustChips(){const e=this.el.nativeElement,t=this.el.nativeElement.querySelector(".ellipsis-chip"),n=parseFloat(this.window.getComputedStyle(t).marginLeft)||0,i=e.querySelectorAll("mat-chip:not(.ellipsis-chip)");if(this.chipsValue.length>1){const a=this.el.nativeElement.querySelector(".ellipsis-text");this.renderer.setStyle(t,"display","inline-flex"),a.innerHTML=this.translate.instant("gateway.ellipsis-chips-text",{count:this.chipsValue.length});const r=e.offsetWidth-(t.offsetWidth+n);let o=0,s=0;i.forEach((e=>{this.renderer.setStyle(e,"display","inline-flex");const t=e.querySelector(".mdc-evolution-chip__text-label");this.applyMaxChipTextWidth(t,r/3),o+(e.offsetWidth+n)<=r&&sPe(M())))).subscribe((e=>{this.attributesSubject.next(e.data),this.pageDataSubject.next(e),a.next(e)})),a}fetchAttributes(e,t,n){return this.getAllAttributes(e,t).pipe(Be((e=>{const t=e.filter((e=>0!==e.lastUpdateTs));return n.filterData(t)})))}getAllAttributes(e,t){if(!this.allAttributes){let n;k.get(t)?(this.telemetrySubscriber=P.createEntityAttributesSubscription(this.telemetryWsService,e,t,this.zone),this.telemetrySubscriber.subscribe(),n=this.telemetrySubscriber.attributeData$()):n=this.attributeService.getEntityAttributes(e,t),this.allAttributes=n.pipe(Ge(1),ze())}return this.allAttributes}isAllSelected(){const e=this.selection.selected.length;return this.attributesSubject.pipe(Be((t=>e===t.length)))}isEmpty(){return this.attributesSubject.pipe(Be((e=>!e.length)))}total(){return this.pageDataSubject.pipe(Be((e=>e.totalElements)))}masterToggle(){this.attributesSubject.pipe(Ve((e=>{this.selection.selected.length===e.length?this.selection.clear():e.forEach((e=>{this.selection.select(e)}))})),Ue(1)).subscribe()}}e("AttributeDatasource",ti);const ni=()=>({maxWidth:"970px"});function ii(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",2)(1,"mat-expansion-panel-header",3)(2,"mat-panel-title")(3,"mat-slide-toggle",4),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(4,"mat-label"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementContainer(7,5),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(4);t.ɵɵproperty("expanded",e.showStrategyControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showStrategyControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,4,"gateway.report-strategy.label")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n)}}function ai(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",6),t.ɵɵtext(1,"gateway.report-strategy.label"),t.ɵɵelementEnd(),t.ɵɵelementContainer(2,5)),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(4);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e)}}function ri(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.ReportTypeTranslateMap.get(e)))}}function oi(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.reportStrategyFormGroup.get("reportPeriod").hasError("min")?"gateway.hints.report-period-range":"gateway.hints.report-period-required"))}}function si(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",13),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",10),t.ɵɵelement(5,"input",14),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,oi,3,3,"mat-icon",15),t.ɵɵelementStart(8,"span",16),t.ɵɵtext(9,"gateway.suffix.ms"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,3,"gateway.report-strategy.report-period")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.reportStrategyFormGroup.get("reportPeriod").hasError("required")||e.reportStrategyFormGroup.get("reportPeriod").hasError("min")&&e.reportStrategyFormGroup.get("reportPeriod").touched?7:-1)}}function li(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",8),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"div",9),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-select",11),t.ɵɵrepeaterCreate(7,ri,3,4,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,si,10,7,"div",7)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,4,"gateway.type")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/report-strategy_fn")("tb-help-popup-style",t.ɵɵpureFunction0(6,ni)),t.ɵɵadvance(3),t.ɵɵrepeater(e.reportStrategyTypes),t.ɵɵadvance(2),t.ɵɵconditional(e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnChange&&e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnReceived?9:-1)}}class pi{constructor(e){this.fb=e,this.isExpansionMode=!1,this.defaultValue=mn.Key,this.isConfig=!1,this.reportStrategyTypes=Object.values(un),this.ReportTypeTranslateMap=hn,this.ReportStrategyType=un,this.destroy$=new Ie,this.showStrategyControl=this.fb.control(!1),this.reportStrategyFormGroup=this.fb.group({type:[{value:un.OnReportPeriod,disabled:!0},[]],reportPeriod:[{value:this.defaultValue,disabled:!0},[xe.required,xe.min(100)]]}),this.observeStrategyFormChange(),this.observeStrategyToggle()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){const t=this.isDisabledConfig(e);if(this.isExpansionMode&&this.showStrategyControl.setValue(!t&&!!e,{emitEvent:!1}),t||!e)return this.reportStrategyFormGroup.disable({emitEvent:!1}),void this.reportStrategyFormGroup.setValue(this.getDefaultConfig(),{emitEvent:!1});this.reportStrategyFormGroup.enable({emitEvent:!1});const n=this.getDefaultConfig(),{type:i=n.type,reportPeriod:a=n.reportPeriod}=e??{};this.reportStrategyFormGroup.setValue({type:i,reportPeriod:a},{emitEvent:!1}),this.onTypeChange(i)}validate(){return this.reportStrategyFormGroup.valid||this.reportStrategyFormGroup.disabled?null:{reportStrategyForm:{valid:!1}}}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}observeStrategyFormChange(){this.reportStrategyFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()})),this.reportStrategyFormGroup.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.onTypeChange(e)))}observeStrategyToggle(){this.showStrategyControl.valueChanges.pipe(Re(this.destroy$),Le((()=>this.isExpansionMode))).subscribe((e=>{if(e)this.reportStrategyFormGroup.enable({emitEvent:!1}),this.onTypeChange(this.reportStrategyFormGroup.get("type").value),this.reportStrategyFormGroup.updateValueAndValidity({emitEvent:!1}),this.onChange(this.reportStrategyFormGroup.value);else{this.reportStrategyFormGroup.disable({emitEvent:!1});const e=this.isConfig?{type:"DISABLED"}:null;this.onChange(e)}}))}onTypeChange(e){const t=this.reportStrategyFormGroup.get("reportPeriod");e===un.OnChange||e===un.OnReceived?t.disable({emitEvent:!1}):this.isExpansionMode&&!this.showStrategyControl.value||(t.enable({emitEvent:!1}),this.isConfig&&t.setValue(mn.Gateway,{emitEvent:!1}))}getDefaultConfig(){return{type:this.isConfig?un.OnReceived:un.OnReportPeriod,reportPeriod:this.isConfig?null:this.defaultValue}}isDisabledConfig(e){return this.isConfig&&("DISABLED"===e?.type||"DISABLED"===e?.type)}static{this.ɵfac=function(e){return new(e||pi)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:pi,selectors:[["tb-report-strategy"]],inputs:{isExpansionMode:"isExpansionMode",defaultValue:"defaultValue",isConfig:"isConfig"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>pi)),multi:!0},{provide:be,useExisting:c((()=>pi)),multi:!0}]),t.ɵɵStandaloneFeature],decls:5,vars:2,consts:[["strategyFields",""],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],[3,"ngTemplateOutlet"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","flex","items-center","gap-2"],["matSuffix","","tb-help-popup-placement","right",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","type"],[3,"value"],["tbTruncateWithTooltip","",1,"fixed-title-width","tb-required"],["matInput","","type","number","min","100","name","value","formControlName","reportPeriod",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","","matSuffix","",1,"block","pr-2"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,1),t.ɵɵtemplate(1,ii,8,6,"mat-expansion-panel",2)(2,ai,3,1)(3,li,10,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.reportStrategyFormGroup),t.ɵɵadvance(),t.ɵɵconditional(n.isExpansionMode?1:2))},dependencies:t.ɵɵgetComponentDepsFactory(pi,[me,T,Jn]),encapsulation:2,changeDetection:d.OnPush})}}e("ReportStrategyComponent",pi),Ze([I()],pi.prototype,"isExpansionMode",void 0),Ze([D()],pi.prototype,"defaultValue",void 0),Ze([I()],pi.prototype,"isConfig",void 0);class ci{constructor(e,t){this.attributeService=e,this.cd=t,this.isGatewayActive=!1}ngAfterViewInit(){this.ctx.$scope.gatewayStatus=this,this.loadGatewayState()}loadGatewayState(){this.attributeService.getEntityAttributes(this.deviceId,A.SERVER_SCOPE,["active","lastDisconnectTime","lastConnectTime"]).subscribe((e=>{const t=e.find((e=>"active"===e.key)).value,n=e.find((e=>"lastDisconnectTime"===e.key))?.value,i=e.find((e=>"lastConnectTime"===e.key))?.value;this.isGatewayActive=this.getGatewayStatus(t,i,n),this.cd.detectChanges()}))}getGatewayStatus(e,t,n){return!!e&&(!n||t>n)}onDataUpdated(){const e=this.ctx.defaultSubscription.data,t=e.find((e=>"active"===e.dataKey.name)).data[0][1],n=e.find((e=>"lastDisconnectTime"===e.dataKey.name)).data[0][1],i=e.find((e=>"lastConnectTime"===e.dataKey.name)).data[0][1];this.isGatewayActive=this.getGatewayStatus(t,i,n),this.cd.detectChanges()}static{this.ɵfac=function(e){return new(e||ci)(t.ɵɵdirectiveInject(ee.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ci,selectors:[["tb-gateway-status"]],inputs:{ctx:"ctx",deviceId:"deviceId"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:9,vars:10,consts:[[1,"flex","min-h-10","flex-1","justify-center"],[1,"divider"],[1,"whitespace-nowrap"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-card",0),t.ɵɵelement(1,"div",1),t.ɵɵelementStart(2,"mat-card-header")(3,"mat-card-subtitle",2),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"mat-card-content"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵclassProp("divider-red",!n.isGatewayActive)("divider-green",n.isGatewayActive),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,6,"gateway.gateway-status")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,8,n.isGatewayActive?"gateway.active":"gateway.inactive")))},dependencies:t.ɵɵgetComponentDepsFactory(ci,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex}[_nghost-%COMP%] .divider[_ngcontent-%COMP%]{position:absolute;width:3px;top:12px;border-radius:2px;bottom:4px;left:10px}[_nghost-%COMP%] .divider-green[_ngcontent-%COMP%] .divider[_ngcontent-%COMP%]{border:1px solid rgb(25,128,56);background-color:#198038}[_nghost-%COMP%] .divider-green[_ngcontent-%COMP%] .mat-mdc-card-content[_ngcontent-%COMP%]{color:#198038}[_nghost-%COMP%] .divider-red[_ngcontent-%COMP%] .divider[_ngcontent-%COMP%]{border:1px solid rgb(203,37,48);background-color:#cb2530}[_nghost-%COMP%] .divider-red[_ngcontent-%COMP%] .mat-mdc-card-content[_ngcontent-%COMP%]{color:#cb2530}.mdc-card[_ngcontent-%COMP%]{position:relative;padding-left:10px;box-shadow:none}.mat-mdc-card-subtitle[_ngcontent-%COMP%]{font-weight:400;font-size:12px}.mat-mdc-card-header[_ngcontent-%COMP%]{padding:8px 16px 0}.mat-mdc-card-content[_ngcontent-%COMP%]:last-child{padding-bottom:8px;font-size:16px}'],changeDetection:d.OnPush})}}e("GatewayStatusComponent",ci);class di{constructor(){this.tooltipText=""}static{this.ɵfac=function(e){return new(e||di)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:di,selectors:[["tb-error-icon"]],inputs:{tooltipText:"tooltipText"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:2,vars:1,consts:[["matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",0),t.ɵɵtext(1," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",n.tooltipText)},dependencies:t.ɵɵgetComponentDepsFactory(di,[T]),styles:["[_nghost-%COMP%]{display:flex;width:40px;height:40px;padding:10px}mat-icon[_ngcontent-%COMP%]{font-size:20px}"]})}}var ui,mi;e("ErrorTooltipIconComponent",di),e("MqttConverterType",ui),function(e){e.JSON="json",e.BYTES="bytes",e.CUSTOM="custom"}(ui||e("MqttConverterType",ui={})),e("MQTTSourceType",mi),function(e){e.MSG="message",e.TOPIC="topic",e.CONST="constant"}(mi||e("MQTTSourceType",mi={}));const hi=e("MqttVersions",[{name:3.1,value:3},{name:3.11,value:4},{name:5,value:5}]),gi=e("QualityTypeTranslationsMap",new Map([[0,"gateway.qos.at-most-once"],[1,"gateway.qos.at-least-once"],[2,"gateway.qos.exactly-once"]])),fi=e("ConvertorTypeTranslationsMap",new Map([[ui.JSON,"gateway.JSON"],[ui.BYTES,"gateway.bytes"],[ui.CUSTOM,"gateway.custom"]]));var yi;e("RequestType",yi),function(e){e.CONNECT_REQUEST="connectRequests",e.DISCONNECT_REQUEST="disconnectRequests",e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(yi||e("RequestType",yi={}));const vi=e("RequestTypesTranslationsMap",new Map([[yi.CONNECT_REQUEST,"gateway.request.connect-request"],[yi.DISCONNECT_REQUEST,"gateway.request.disconnect-request"],[yi.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[yi.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[yi.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]])),xi=e("DataConversionTranslationsMap",new Map([[ui.JSON,"gateway.JSON-hint"],[ui.BYTES,"gateway.bytes-hint"],[ui.CUSTOM,"gateway.custom-hint"]]));var bi,wi;e("SocketType",bi),function(e){e.TCP="TCP",e.UDP="UDP"}(bi||e("SocketType",bi={})),e("SocketValueKey",wi),function(e){e.TIMESERIES="telemetry",e.ATTRIBUTES="attributes",e.ATTRIBUTES_REQUESTS="attributeRequests",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_METHODS="serverSideRpc"}(wi||e("SocketValueKey",wi={}));const Si=e("SocketKeysPanelTitleTranslationsMap",new Map([[wi.ATTRIBUTES,"gateway.attributes"],[wi.TIMESERIES,"gateway.timeseries"],[wi.ATTRIBUTES_REQUESTS,"gateway.attribute-requests"],[wi.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[wi.RPC_METHODS,"gateway.rpc-methods"]]));var Ci,_i;e("RequestsType",Ci),function(e){e.Shared="shared",e.Client="client"}(Ci||e("RequestsType",Ci={})),e("ExpressionType",_i),function(e){e.Constant="constant",e.Expression="expression"}(_i||e("ExpressionType",_i={}));const Ti=e("SocketKeysAddKeyTranslationsMap",new Map([[wi.ATTRIBUTES,"gateway.add-attribute"],[wi.TIMESERIES,"gateway.add-timeseries"],[wi.ATTRIBUTES_REQUESTS,"gateway.add-attribute-request"],[wi.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[wi.RPC_METHODS,"gateway.add-rpc-method"]])),Ei=e("SocketKeysDeleteKeyTranslationsMap",new Map([[wi.ATTRIBUTES,"gateway.delete-attribute"],[wi.TIMESERIES,"gateway.delete-timeseries"],[wi.ATTRIBUTES_REQUESTS,"gateway.delete-attribute-request"],[wi.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[wi.RPC_METHODS,"gateway.delete-rpc-method"]])),Ii=e("SocketKeysNoKeysTextTranslationsMap",new Map([[wi.ATTRIBUTES,"gateway.no-attributes"],[wi.TIMESERIES,"gateway.no-timeseries"],[wi.ATTRIBUTES_REQUESTS,"gateway.no-attribute-requests"],[wi.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[wi.RPC_METHODS,"gateway.no-rpc-methods"]]));var Mi,ki,Pi,Di;e("RestConverterType",Mi),function(e){e.JSON="json",e.CUSTOM="custom"}(Mi||e("RestConverterType",Mi={})),e("RestSourceType",ki),function(e){e.REQUEST="request",e.CONST="constant"}(ki||e("RestSourceType",ki={})),e("ResponseType",Pi),function(e){e.DEFAULT="default",e.CONST="constant",e.ADVANCED="advanced"}(Pi||e("ResponseType",Pi={})),e("ResponseStatus",Di),function(e){e.OK="OK",e.ERROR="Error"}(Di||e("ResponseStatus",Di={}));const Ai=e("ResponseTypeTranslationsMap",new Map([[Pi.DEFAULT,"gateway.rest.response-type.default"],[Pi.CONST,"gateway.rest.response-type.const"],[Pi.ADVANCED,"gateway.rest.response-type.advanced"]]));var Oi;e("RestRequestType",Oi),function(e){e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(Oi||e("RestRequestType",Oi={}));const Ri=e("RestRequestTypesTranslationsMap",new Map([[Oi.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[Oi.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[Oi.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]]));var Bi;e("RestRequestsScopeType",Bi),function(e){e.Shared="shared",e.Client="client"}(Bi||e("RestRequestsScopeType",Bi={}));const Fi=e("RestRequestTypeFieldsMap",new Map([[Oi.ATTRIBUTE_REQUEST,["HTTPMethods","endpoint","type","deviceNameExpression","attributeNameExpression"]],[Oi.ATTRIBUTE_UPDATE,["HTTPMethod","SSLVerify","deviceNameFilter","attributeFilter","requestUrlExpression","valueExpression","httpHeaders","tries","allowRedirects"]],[Oi.SERVER_SIDE_RPC,["HTTPMethod","deviceNameFilter","methodFilter","requestUrlExpression","valueExpression","responseTimeout","httpHeaders","tries"]],["all",["requestType","timeout","security"]]])),Ni=e("RestConvertorTypeTranslationsMap",new Map([[Mi.JSON,"gateway.JSON"],[Mi.CUSTOM,"gateway.custom"]])),Li=e("RestDataConversionTranslationsMap",new Map([[Mi.JSON,"gateway.hints.rest.JSON"],[Mi.CUSTOM,"gateway.custom-hint"]]));var Vi;e("PortLimits",Vi),function(e){e[e.MIN=1]="MIN",e[e.MAX=65535]="MAX"}(Vi||e("PortLimits",Vi={}));const qi=e("GatewayConnectorConfigVersionMap",new Map([[yt.S7,ft.v3_8_5],[yt.REST,ft.v3_7_2],[yt.KNX,ft.v3_7_0],[yt.BACNET,ft.v3_6_2],[yt.SOCKET,ft.v3_6_0],[yt.MQTT,ft.v3_5_2],[yt.OPCUA,ft.v3_5_2],[yt.MODBUS,ft.v3_5_2]]));var Gi,zi,Ui,ji;e("OPCUaSourceType",Gi),function(e){e.PATH="path",e.IDENTIFIER="identifier",e.CONST="constant"}(Gi||e("OPCUaSourceType",Gi={})),e("SecurityType",zi),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic",e.CERTIFICATES="certificates"}(zi||e("SecurityType",zi={})),e("ModeType",Ui),function(e){e.NONE="None",e.SIGN="Sign",e.SIGNANDENCRYPT="SignAndEncrypt"}(Ui||e("ModeType",Ui={})),e("MappingType",ji),function(e){e.DATA="data",e.REQUESTS="requests",e.OPCUA="OPCua"}(ji||e("MappingType",ji={}));const Hi=e("MappingTypeTranslationsMap",new Map([[ji.DATA,"gateway.data-mapping"],[ji.REQUESTS,"gateway.requests-mapping"],[ji.OPCUA,"gateway.data-mapping"]]));var Wi;e("SecurityPolicy",Wi),function(e){e.BASIC128="Basic128Rsa15",e.BASIC256="Basic256",e.BASIC256SHA="Basic256Sha256"}(Wi||e("SecurityPolicy",Wi={}));const $i=e("SecurityPolicyTypes",[{value:Wi.BASIC128,name:"Basic128RSA15"},{value:Wi.BASIC256,name:"Basic256"},{value:Wi.BASIC256SHA,name:"Basic256SHA256"}]),Ki=e("SecurityTypeTranslationsMap",new Map([[zi.ANONYMOUS,"gateway.broker.security-types.anonymous"],[zi.BASIC,"gateway.broker.security-types.basic"],[zi.CERTIFICATES,"gateway.broker.security-types.certificates"]])),Yi=e("SourceTypeTranslationsMap",new Map([[mi.MSG,"gateway.source-type.msg"],[mi.TOPIC,"gateway.source-type.topic"],[mi.CONST,"gateway.source-type.const"],[Gi.PATH,"gateway.source-type.path"],[Gi.IDENTIFIER,"gateway.source-type.identifier"],[Gi.CONST,"gateway.source-type.const"],[_i.Expression,"gateway.source-type.expression"],[ki.REQUEST,"gateway.source-type.request"]]));var Xi;e("MappingKeysType",Xi),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.CUSTOM="extensionConfig",e.RPC_METHODS="rpc_methods",e.ATTRIBUTES_UPDATES="attributes_updates"}(Xi||e("MappingKeysType",Xi={}));const Zi=e("MappingKeysPanelTitleTranslationsMap",new Map([[Xi.ATTRIBUTES,"gateway.attributes"],[Xi.TIMESERIES,"gateway.timeseries"],[Xi.CUSTOM,"gateway.keys"],[Xi.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Xi.RPC_METHODS,"gateway.rpc-methods"]])),Qi=e("MappingKeysAddKeyTranslationsMap",new Map([[Xi.ATTRIBUTES,"gateway.add-attribute"],[Xi.TIMESERIES,"gateway.add-timeseries"],[Xi.CUSTOM,"gateway.add-key"],[Xi.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Xi.RPC_METHODS,"gateway.add-rpc-method"]])),Ji=e("MappingKeysDeleteKeyTranslationsMap",new Map([[Xi.ATTRIBUTES,"gateway.delete-attribute"],[Xi.TIMESERIES,"gateway.delete-timeseries"],[Xi.CUSTOM,"gateway.delete-key"],[Xi.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Xi.RPC_METHODS,"gateway.delete-rpc-method"]])),ea=e("MappingKeysNoKeysTextTranslationsMap",new Map([[Xi.ATTRIBUTES,"gateway.no-attributes"],[Xi.TIMESERIES,"gateway.no-timeseries"],[Xi.CUSTOM,"gateway.no-keys"],[Xi.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Xi.RPC_METHODS,"gateway.no-rpc-methods"]])),ta=e("QualityTypes",[0,1,2]);var na;e("ServerSideRpcType",na),function(e){e.WithResponse="twoWay",e.WithoutResponse="oneWay"}(na||e("ServerSideRpcType",na={}));const ia=e("HelpLinkByMappingTypeMap",new Map([[ji.DATA,w+"/docs/iot-gateway/config/mqtt/#section-mapping"],[ji.OPCUA,w+"/docs/iot-gateway/config/opc-ua/#section-mapping"],[ji.REQUESTS,w+"/docs/iot-gateway/config/mqtt/#requests-mapping"]])),aa=e("MappingHintTranslationsMap",new Map([[ji.DATA,"gateway.data-mapping-hint"],[ji.OPCUA,"gateway.opcua-data-mapping-hint"],[ji.REQUESTS,"gateway.requests-mapping-hint"]]));var ra,oa,sa,la,pa,ca,da,ua,ma;e("ServerSideRPCType",ra),function(e){e.ONE_WAY="oneWay",e.TWO_WAY="twoWay"}(ra||e("ServerSideRPCType",ra={})),e("SecurityMode",oa),function(e){e.basic="basic",e.certificates="certificates",e.extendedCertificates="extendedCertificates"}(oa||e("SecurityMode",oa={})),e("ModbusProtocolType",sa),function(e){e.TCP="tcp",e.UDP="udp",e.Serial="serial"}(sa||e("ModbusProtocolType",sa={})),e("ModbusMethodType",la),function(e){e.SOCKET="socket",e.RTU="rtu"}(la||e("ModbusMethodType",la={})),e("ModbusSerialMethodType",pa),function(e){e.RTU="rtu",e.ASCII="ascii"}(pa||e("ModbusSerialMethodType",pa={})),e("ModbusParity",ca),function(e){e.Even="E",e.Odd="O",e.None="N"}(ca||e("ModbusParity",ca={})),e("ModbusOrderType",da),function(e){e.BIG="BIG",e.LITTLE="LITTLE"}(da||e("ModbusOrderType",da={})),e("ModbusRegisterType",ua),function(e){e.HoldingRegisters="holding_registers",e.CoilsInitializer="coils_initializer",e.InputRegisters="input_registers",e.DiscreteInputs="discrete_inputs"}(ua||e("ModbusRegisterType",ua={})),e("ModbusValueKey",ma),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_REQUESTS="rpc"}(ma||e("ModbusValueKey",ma={}));const ha=e("ModbusBaudrates",[4800,9600,19200,38400,57600,115200,230400,460800,921600]),ga=e("ModbusByteSizes",[5,6,7,8]),fa=e("ModbusDefaultRetries",3),ya=e("ModbusRegisterTranslationsMap",new Map([[ua.HoldingRegisters,"gateway.holding_registers"],[ua.CoilsInitializer,"gateway.coils_initializer"],[ua.InputRegisters,"gateway.input_registers"],[ua.DiscreteInputs,"gateway.discrete_inputs"]]));var va;e("ModbusBitTargetType",va),function(e){e.BooleanType="bool",e.IntegerType="int"}(va||e("ModbusBitTargetType",va={}));const xa=e("ModbusBitTargetTypeTranslationMap",new Map([[va.BooleanType,"gateway.boolean"],[va.IntegerType,"gateway.integer"]])),ba=e("ModbusMethodLabelsMap",new Map([[la.SOCKET,"Socket"],[la.RTU,"RTU"],[pa.ASCII,"ASCII"]])),wa=e("ModbusProtocolLabelsMap",new Map([[sa.TCP,"TCP"],[sa.UDP,"UDP"],[sa.Serial,"Serial"]])),Sa=e("ModbusParityLabelsMap",new Map([[ca.Even,"Even"],[ca.Odd,"Odd"],[ca.None,"None"]])),Ca=e("ModbusKeysPanelTitleTranslationsMap",new Map([[ma.ATTRIBUTES,"gateway.attributes"],[ma.TIMESERIES,"gateway.timeseries"],[ma.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[ma.RPC_REQUESTS,"gateway.rpc-requests"]])),_a=e("ModbusKeysAddKeyTranslationsMap",new Map([[ma.ATTRIBUTES,"gateway.add-attribute"],[ma.TIMESERIES,"gateway.add-timeseries"],[ma.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[ma.RPC_REQUESTS,"gateway.add-rpc-request"]])),Ta=e("ModbusKeysDeleteKeyTranslationsMap",new Map([[ma.ATTRIBUTES,"gateway.delete-attribute"],[ma.TIMESERIES,"gateway.delete-timeseries"],[ma.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[ma.RPC_REQUESTS,"gateway.delete-rpc-request"]])),Ea=e("ModbusKeysNoKeysTextTranslationsMap",new Map([[ma.ATTRIBUTES,"gateway.no-attributes"],[ma.TIMESERIES,"gateway.no-timeseries"],[ma.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[ma.RPC_REQUESTS,"gateway.no-rpc-requests"]]));var Ia;e("ModifierType",Ia),function(e){e.DIVIDER="divider",e.MULTIPLIER="multiplier"}(Ia||e("ModifierType",Ia={}));const Ma=e("ModifierTypesMap",new Map([[Ia.DIVIDER,{name:"gateway.divider",icon:"mdi:division"}],[Ia.MULTIPLIER,{name:"gateway.multiplier",icon:"mdi:multiplication"}]]));var ka,Pa;e("DeviceInfoType",ka),function(e){e.FULL="full",e.PARTIAL="partial"}(ka||e("DeviceInfoType",ka={})),e("SegmentationType",Pa),function(e){e.BOTH="segmentedBoth",e.TRANSMIT="segmentedTransmit",e.RECEIVE="segmentedReceive",e.NO="noSegmentation"}(Pa||e("SegmentationType",Pa={}));const Da=e("SegmentationTypeTranslationsMap",new Map([[Pa.BOTH,"gateway.bacnet.segmentation.both"],[Pa.TRANSMIT,"gateway.bacnet.segmentation.transmit"],[Pa.RECEIVE,"gateway.bacnet.segmentation.receive"],[Pa.NO,"gateway.bacnet.segmentation.no"]]));var Aa;e("BacnetDeviceKeysType",Aa),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.RPC_METHODS="serverSideRpc",e.ATTRIBUTES_UPDATES="attributeUpdates"}(Aa||e("BacnetDeviceKeysType",Aa={}));const Oa=e("BacnetDeviceKeysPanelTitleTranslationsMap",new Map([[Aa.ATTRIBUTES,"gateway.attributes"],[Aa.TIMESERIES,"gateway.timeseries"],[Aa.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Aa.RPC_METHODS,"gateway.rpc-methods"]])),Ra=e("BacnetDeviceKeysAddKeyTranslationsMap",new Map([[Aa.ATTRIBUTES,"gateway.add-attribute"],[Aa.TIMESERIES,"gateway.add-timeseries"],[Aa.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Aa.RPC_METHODS,"gateway.add-rpc-method"]])),Ba=e("BacnetDeviceKeysDeleteKeyTranslationsMap",new Map([[Aa.ATTRIBUTES,"gateway.delete-attribute"],[Aa.TIMESERIES,"gateway.delete-timeseries"],[Aa.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Aa.RPC_METHODS,"gateway.delete-rpc-method"]])),Fa=e("BacnetDeviceKeysNoKeysTextTranslationsMap",new Map([[Aa.ATTRIBUTES,"gateway.no-attributes"],[Aa.TIMESERIES,"gateway.no-timeseries"],[Aa.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Aa.RPC_METHODS,"gateway.no-rpc-methods"]]));var Na;e("BacnetKeyObjectType",Na),function(e){e.analogInput="analogInput",e.analogOutput="analogOutput",e.analogValue="analogValue",e.binaryInput="binaryInput",e.binaryOutput="binaryOutput",e.binaryValue="binaryValue"}(Na||e("BacnetKeyObjectType",Na={}));const La=e("BacnetKeyObjectTypeTranslationsMap",new Map([[Na.analogInput,"gateway.bacnet.object-type.analog-input"],[Na.analogOutput,"gateway.bacnet.object-type.analog-output"],[Na.analogValue,"gateway.bacnet.object-type.analog-value"],[Na.binaryInput,"gateway.bacnet.object-type.binary-input"],[Na.binaryOutput,"gateway.bacnet.object-type.binary-output"],[Na.binaryValue,"gateway.bacnet.object-type.binary-value"]]));var Va;e("BacnetPropertyId",Va),function(e){e.presentValue="presentValue",e.statusFlags="statusFlags",e.covIncrement="covIncrement",e.eventState="eventState",e.outOfService="outOfService",e.polarity="polarity",e.priorityArray="priorityArray",e.relinquishDefault="relinquishDefault",e.currentCommandPriority="currentCommandPriority",e.eventMessageTexts="eventMessageTexts",e.eventMessageTextsConfig="eventMessageTextsConfig",e.eventAlgorithmInhibitReference="eventAlgorithmInhibitReference",e.timeDelayNormal="timeDelayNormal"}(Va||e("BacnetPropertyId",Va={}));const qa=e("BacnetPropertyIdByObjectType",new Map([[Na.analogInput,[Va.presentValue,Va.statusFlags,Va.covIncrement]],[Na.analogOutput,[Va.presentValue,Va.statusFlags,Va.covIncrement]],[Na.analogValue,[Va.presentValue,Va.statusFlags,Va.covIncrement]],[Na.binaryInput,[Va.presentValue,Va.statusFlags,Va.eventState,Va.outOfService,Va.polarity]],[Na.binaryOutput,[Va.presentValue,Va.statusFlags,Va.eventState,Va.outOfService,Va.polarity,Va.priorityArray,Va.relinquishDefault,Va.currentCommandPriority,Va.eventMessageTexts,Va.eventMessageTextsConfig,Va.eventAlgorithmInhibitReference,Va.timeDelayNormal]],[Na.binaryValue,[Va.presentValue,Va.statusFlags,Va.eventState,Va.outOfService]]])),Ga=e("BacnetPropertyIdTranslationsMap",new Map([[Va.presentValue,"gateway.bacnet.property-id.present-value"],[Va.statusFlags,"gateway.bacnet.property-id.status-flags"],[Va.covIncrement,"gateway.bacnet.property-id.cov-increment"],[Va.eventState,"gateway.bacnet.property-id.event-state"],[Va.outOfService,"gateway.bacnet.property-id.out-of-service"],[Va.polarity,"gateway.bacnet.property-id.polarity"],[Va.priorityArray,"gateway.bacnet.property-id.priority-array"],[Va.relinquishDefault,"gateway.bacnet.property-id.relinquish-default"],[Va.currentCommandPriority,"gateway.bacnet.property-id.current-command-priority"],[Va.eventMessageTexts,"gateway.bacnet.property-id.event-message-texts"],[Va.eventMessageTextsConfig,"gateway.bacnet.property-id.event-message-texts-config"],[Va.eventAlgorithmInhibitReference,"gateway.bacnet.property-id.event-algorithm-inhibit-reference"],[Va.timeDelayNormal,"gateway.bacnet.property-id.time-delay-normal"]]));var za;e("BacnetRequestType",za),function(e){e.Write="writeProperty",e.Read="readProperty"}(za||e("BacnetRequestType",za={}));const Ua=e("BacnetRequestTypeTranslationsMap",new Map([[za.Write,"gateway.bacnet.request-type.write"],[za.Read,"gateway.bacnet.request-type.read"]]));class ja{static{this.mqttRequestTypeKeys=Object.values(yi)}static{this.mqttRequestMappingOldFields=["attributeNameJsonExpression","deviceNameJsonExpression","deviceNameTopicExpression","extension-config"]}static{this.mqttRequestMappingNewFields=["attributeNameExpressionSource","responseTopicQoS","extensionConfig"]}static mapMappingToUpgradedVersion(e){return e?.map((({converter:e,topicFilter:t,subscriptionQos:n=1})=>{const i=e.deviceInfo??this.extractConverterDeviceInfo(e),a={...e,deviceInfo:i,extensionConfig:e.extensionConfig||e["extension-config"]||null};return this.cleanUpOldFields(a),{converter:a,topicFilter:t,subscriptionQos:n}}))}static mapRequestsToUpgradedVersion(e){return this.mqttRequestTypeKeys.reduce(((t,n)=>e[n]?(t[n]=e[n].map((e=>{const t=this.mapRequestToUpgradedVersion(e,n);return this.cleanUpOldFields(t),t})),t):t),{})}static mapRequestsToDowngradedVersion(e){return this.mqttRequestTypeKeys.reduce(((t,n)=>e[n]?(t[n]=e[n].map((e=>{n===yi.SERVER_SIDE_RPC&&delete e.type;const{attributeNameExpression:t,deviceInfo:i,...a}=e,r={...a,attributeNameJsonExpression:t||null,deviceNameJsonExpression:i?.deviceNameExpressionSource!==mi.TOPIC?i?.deviceNameExpression:null,deviceNameTopicExpression:i?.deviceNameExpressionSource===mi.TOPIC?i?.deviceNameExpression:null};return this.cleanUpNewFields(r),r})),t):t),{})}static mapMappingToDowngradedVersion(e){return e?.map((e=>{const t=this.mapConverterToDowngradedVersion(e.converter);return this.cleanUpNewFields(t),{converter:t,topicFilter:e.topicFilter}}))}static mapConverterToDowngradedVersion(e){const{deviceInfo:t,...n}=e;return e.type!==ui.BYTES?{...n,deviceNameJsonExpression:t?.deviceNameExpressionSource===mi.MSG?t.deviceNameExpression:null,deviceTypeJsonExpression:t?.deviceProfileExpressionSource===mi.MSG?t.deviceProfileExpression:null,deviceNameTopicExpression:t?.deviceNameExpressionSource!==mi.MSG?t?.deviceNameExpression:null,deviceTypeTopicExpression:t?.deviceProfileExpressionSource!==mi.MSG?t?.deviceProfileExpression:null}:{...n,deviceNameExpression:t.deviceNameExpression,deviceTypeExpression:t.deviceProfileExpression,"extension-config":e.extensionConfig}}static cleanUpOldFields(e){this.mqttRequestMappingOldFields.forEach((t=>delete e[t])),te(e)}static cleanUpNewFields(e){this.mqttRequestMappingNewFields.forEach((t=>delete e[t])),te(e)}static getTypeSourceByValue(e){return e.includes("${")?mi.MSG:e.includes("/")?mi.TOPIC:mi.CONST}static extractConverterDeviceInfo(e){const t=e.deviceNameExpression||e.deviceNameJsonExpression||e.deviceNameTopicExpression||null,n=e.deviceNameExpressionSource?e.deviceNameExpressionSource:t?this.getTypeSourceByValue(t):null,i=e.deviceProfileExpression||e.deviceTypeTopicExpression||e.deviceTypeJsonExpression||"default",a=e.deviceProfileExpressionSource?e.deviceProfileExpressionSource:i?this.getTypeSourceByValue(i):null;return t||i?{deviceNameExpression:t,deviceNameExpressionSource:n,deviceProfileExpression:i,deviceProfileExpressionSource:a}:null}static mapRequestToUpgradedVersion(e,t){const n=e.deviceNameJsonExpression||e.deviceNameTopicExpression||null,i=e.deviceTypeTopicExpression||e.deviceTypeJsonExpression||"default",a=i?this.getTypeSourceByValue(i):null,r=e.attributeNameExpressionSource||e.attributeNameJsonExpression||null,o=t===yi.SERVER_SIDE_RPC?1:null,s=t===yi.SERVER_SIDE_RPC?e.responseTopicExpression?na.WithResponse:na.WithoutResponse:null;return{...e,attributeNameExpression:r,attributeNameExpressionSource:r?this.getTypeSourceByValue(r):null,deviceInfo:e.deviceInfo?e.deviceInfo:n?{deviceNameExpression:n,deviceNameExpressionSource:this.getTypeSourceByValue(n),deviceProfileExpression:i,deviceProfileExpressionSource:a}:null,responseTopicQoS:o,type:s}}}e("MqttVersionMappingUtil",ja);class Ha{constructor(e,t){this.gatewayVersionIn=e,this.connector=t,this.gatewayVersion=nr.parseVersion(this.gatewayVersionIn),this.configVersion=nr.parseVersion(this.connector.configVersion??this.connector.configurationJson.configVersion)}getProcessedByVersion(){return this.isVersionUpdateNeeded()?this.processVersionUpdate():this.connector}processVersionUpdate(){return this.isVersionUpgradeNeeded()?this.getUpgradedVersion():this.isVersionDowngradeNeeded()?this.getDowngradedVersion():this.connector}isVersionUpdateNeeded(){return!!this.gatewayVersion&&this.configVersion!==this.gatewayVersion}isVersionUpgradeNeeded(){const e=nr.parseVersion(qi.get(this.connector.type)),t=this.gatewayVersion>=e,n=!this.configVersion||this.configVersion=e&&e>this.gatewayVersion}}e("GatewayConnectorVersionProcessor",Ha);class Wa extends Ha{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.mqttRequestTypeKeys=Object.values(yi)}getUpgradedVersion(){const{connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}=this.connector.configurationJson;let r={...this.connector.configurationJson,requestsMapping:ja.mapRequestsToUpgradedVersion({connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}),mapping:ja.mapMappingToUpgradedVersion(this.connector.configurationJson.mapping)};return this.mqttRequestTypeKeys.forEach((e=>{const{[e]:t,...n}=r;r={...n}})),this.cleanUpConfigJson(r),{...this.connector,configurationJson:r,configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const{requestsMapping:e,mapping:t,...n}=this.connector.configurationJson,i=e?ja.mapRequestsToDowngradedVersion(e):{},a=ja.mapMappingToDowngradedVersion(t);return{...this.connector,configurationJson:{...n,...i,mapping:a},configVersion:this.gatewayVersionIn}}cleanUpConfigJson(e){Q(e.requestsMapping,{})&&delete e.requestsMapping,Q(e.mapping,[])&&delete e.mapping}}e("MqttVersionProcessor",Wa);class $a extends Ha{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{master:e.master?.slaves?ir.mapMasterToUpgradedVersion(e.master):{slaves:[]},slave:e.slave?ir.mapSlaveToUpgradedVersion(e.slave):{}},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{...e,slave:e.slave?ir.mapSlaveToDowngradedVersion(e.slave):{},master:e.master?.slaves?ir.mapMasterToDowngradedVersion(e.master):{slaves:[]}},configVersion:this.gatewayVersionIn}}}e("ModbusVersionProcessor",$a);class Ka extends Ha{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson.server;let t;return t="mapping"in this.connector.configurationJson.server?ar.mapMappingToUpgradedVersion(this.connector.configurationJson.server.mapping):"mapping"in this.connector.configurationJson?ar.mapMappingToCurrentVersion(this.connector.configurationJson.mapping):[],{...this.connector,configurationJson:{server:e?ar.mapServerToUpgradedVersion(e):{},mapping:t},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:{server:ar.mapServerToDowngradedVersion(this.connector.configurationJson)},configVersion:this.gatewayVersionIn}}}e("OpcVersionProcessor",Ka);class Ya{constructor(){this.fb=i(we),this.destroyRef=i(a),this.formGroup=this.initFormGroup(),this.observeValueChanges()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.formGroup.valid?null:{formGroup:{valid:!1}}}writeValue(e){this.onWriteValue(e)}onWriteValue(e){this.formGroup.patchValue(e,{emitEvent:!1})}mapOnChangeValue(e){return e}observeValueChanges(){this.formGroup.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>this.onChange(this.mapOnChangeValue(e))))}toggleControl(e,t){t?e.enable({emitEvent:!1}):e.disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||Ya)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Ya})}}e("ControlValueAccessorBaseAbstract",Ya);class Xa extends Ya{constructor(){super(...arguments),this.withReportStrategy=!0,this.initialized=new u,this.isLegacy=!1,this.fb=i(we)}get basicFormGroup(){return this.formGroup}ngAfterViewInit(){this.initialized.emit()}onWriteValue(e){this.formGroup.setValue(this.mapConfigToFormValue(e),{emitEvent:!1})}mapOnChangeValue(e){return this.getMappedValue(e)}initFormGroup(){return this.initBasicFormGroup()}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(Xa)))(n||Xa)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:Xa,inputs:{generalTabContent:"generalTabContent",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},outputs:{initialized:"initialized"},features:[t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature]})}}e("GatewayConnectorBasicConfigDirective",Xa);class Za extends Ha{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{socket:e?rr.mapSocketToUpgradedVersion(e):{},devices:e?.devices?rr.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:rr.mapSocketToDowngradedVersion(this.connector.configurationJson),configVersion:this.gatewayVersionIn}}}e("SocketVersionProcessor",Za);class Qa extends Ha{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{application:e?.general?or.mapApplicationToUpgradedVersion(e.general):{},devices:e?.devices?or.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{general:e?.application?or.mapApplicationToDowngradedVersion(e.application):{},devices:e?.devices?or.mapDevicesToDowngradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}}e("BacnetVersionProcessor",Qa);const Ja=["searchInput"];class er{constructor(){this.withReportStrategy=!0,this.textSearchMode=!1,this.onChange=()=>{},this.translate=i(ge),this.dialog=i(Ke),this.dialogService=i(ne),this.fb=i(we),this.cd=i(h),this.destroyRef=i(a),this.textSearch=this.fb.control("",{nonNullable:!0}),this.entityFormArray=this.fb.array([]),this.entityFormArray.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.updateTableData(e,this.textSearch.value.trim()),this.onChange(e)})),this.dataSource=this.getDatasource()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Ne(150),Fe(((e,t)=>(e??"")===t.trim())),On(this.destroyRef)).subscribe((e=>this.updateTableData(this.entityFormArray.value,e.trim())))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.entityFormArray.clear(),this.pushDataAsFormArrays(e)}enterFilterMode(){this.textSearchMode=!0,this.cd.detectChanges();const e=this.searchInputField.nativeElement;e.focus(),e.setSelectionRange(0,0)}exitFilterMode(){this.updateTableData(this.entityFormArray.value),this.textSearchMode=!1,this.textSearch.reset()}validate(){return this.entityFormArray.controls.length?null:{devicesFormGroup:{valid:!1}}}updateTableData(e,t){t&&(e=e.filter((e=>Object.values(e).some((e=>e.toString().toLowerCase().includes(t.toLowerCase())))))),this.dataSource.loadData(e)}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.entityFormArray.push(this.fb.control(e))))}static{this.ɵfac=function(e){return new(e||er)}}static{this.ɵdir=t.ɵɵdefineDirective({type:er,viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Ja,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},features:[t.ɵɵInputTransformsFeature]})}}e("AbstractDevicesConfigTableComponent",er);class tr extends Ha{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.restRequestTypeKeys=Object.values(Oi)}getUpgradedVersion(){const{attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}=this.connector.configurationJson;let r={server:nr.cleanUpConfigBaseInfo(a),requestsMapping:{attributeRequests:e,attributeUpdates:t,serverSideRpc:n},mapping:sr.mapMappingToUpgradedVersion(i)};return this.restRequestTypeKeys.forEach((e=>{const{[e]:t,...n}=r;r={...n}})),{...this.connector,configurationJson:r,configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const{requestsMapping:e={},mapping:t,server:n,...i}=this.connector.configurationJson,{attributeRequests:a=[],attributeUpdates:r=[],serverSideRpc:o=[]}=e;return{...this.connector,configurationJson:{...i,...n,attributeRequests:a,attributeUpdates:r,serverSideRpc:o,mapping:sr.mapMappingToDowngradedVersion(t)},configVersion:this.gatewayVersionIn}}}e("RestVersionProcessor",tr);class nr{static getConfig(e,t){switch(e.type){case yt.MQTT:return new Wa(t,e).getProcessedByVersion();case yt.OPCUA:return new Ka(t,e).getProcessedByVersion();case yt.MODBUS:return new $a(t,e).getProcessedByVersion();case yt.SOCKET:return new Za(t,e).getProcessedByVersion();case yt.BACNET:return new Qa(t,e).getProcessedByVersion();case yt.REST:return new tr(t,e).getProcessedByVersion();default:return e}}static parseVersion(e){if(ie(e))return e;if(ae(e)){const[t,n="0",i="0"]=e.split(".");return parseFloat(`${t}.${n}${i.slice(0,1)}`)}return 0}static cleanUpConfigBaseInfo(e){const{name:t,id:n,enableRemoteLogging:i,logLevel:a,reportStrategy:r,configVersion:o,...s}=e;return s}}e("GatewayConnectorVersionMappingUtil",nr);class ir{static mapMasterToUpgradedVersion(e){return{slaves:e.slaves.map((e=>{const{sendDataOnlyOnChange:t,...n}=e;return{...n,deviceType:e.deviceType??"default",reportStrategy:t?{type:un.OnChange}:{type:un.OnReportPeriod,reportPeriod:e.pollPeriod}}}))}}static mapMasterToDowngradedVersion(e){return{slaves:e.slaves.map((e=>{const{reportStrategy:t,...n}=e;return{...n,sendDataOnlyOnChange:t?.type!==un.OnReportPeriod}}))}}static mapSlaveToDowngradedVersion(e){if(!e?.values)return e;const t=Object.keys(e.values).reduce(((t,n)=>t={...t,[n]:[e.values[n]]}),{});return{...e,values:t}}static mapSlaveToUpgradedVersion(e){if(!e?.values)return e;const t=Object.keys(e.values).reduce(((t,n)=>t={...t,[n]:this.mapValuesToUpgradedVersion(e.values[n][0]??{})}),{});return{...e,values:t}}static mapValuesToUpgradedVersion(e){return Object.keys(e).reduce(((t,n)=>t={...t,[n]:e[n].map((e=>({...e,type:"int"===e.type?rn.INT16:e.type})))}),{})}}e("ModbusVersionMappingUtil",ir);class ar{static mapServerToUpgradedVersion(e){const{mapping:t,disableSubscriptions:n,pollPeriodInMillis:i,...a}=e;return{...a,pollPeriodInMillis:i??5e3,enableSubscriptions:!n}}static mapServerToDowngradedVersion(e){const{mapping:t,server:n}=e,{enableSubscriptions:i,...a}=n??{};return{...a,mapping:t?this.mapMappingToDowngradedVersion(t):[],disableSubscriptions:!i}}static mapMappingToUpgradedVersion(e){return e.map((e=>({deviceNodePattern:e.deviceNodePattern,deviceNodeSource:this.getDeviceNodeSourceByValue(e.deviceNodePattern),deviceInfo:{deviceNameExpression:e.deviceNamePattern,deviceNameExpressionSource:this.getTypeSourceByValue(e.deviceNamePattern),deviceProfileExpression:e.deviceTypePattern??"default",deviceProfileExpressionSource:this.getTypeSourceByValue(e.deviceTypePattern??"default")},attributes:e.attributes?.map((e=>({key:e.key,type:this.getTypeSourceByValue(e.path),value:e.path})))??[],attributes_updates:e.attributes_updates?.map((e=>({key:e.attributeOnThingsBoard,type:this.getTypeSourceByValue(e.attributeOnDevice),value:e.attributeOnDevice})))??[],timeseries:e.timeseries?.map((e=>({key:e.key,type:this.getTypeSourceByValue(e.path),value:e.path})))??[],rpc_methods:e.rpc_methods?.map((e=>({method:e.method,arguments:e.arguments.map((e=>({value:e,type:this.getArgumentType(e)})))})))??[]})))}static mapMappingToCurrentVersion(e){return e.map((e=>({deviceNodePattern:e.deviceNodePattern,deviceNodeSource:this.getDeviceNodeSourceByValue(e.deviceNodePattern),deviceInfo:{deviceNameExpression:e.deviceInfo.deviceNameExpression,deviceNameExpressionSource:this.getTypeSourceByValue(e?.deviceInfo?.deviceNameExpressionSource),deviceProfileExpression:e?.deviceInfo?.deviceProfileExpression??"default",deviceProfileExpressionSource:this.getTypeSourceByValue(e?.deviceInfo?.deviceProfileExpressionSource??"default")},attributes:e.attributes?.map((e=>({key:e.key,type:e.type,value:e?.value})))??[],attributes_updates:e.attributes_updates?.map((e=>({key:e.key,type:e.type,value:e.value})))??[],timeseries:e.timeseries?.map((e=>({key:e.key,type:e.type,value:e.value})))??[],rpc_methods:e.rpc_methods?.map((e=>({method:e.method,arguments:e.arguments.map((e=>({value:e,type:this.getArgumentType(e)})))})))??[]})))}static mapMappingToDowngradedVersion(e){return e.map((e=>({deviceNodePattern:e.deviceNodePattern,deviceNamePattern:e.deviceInfo.deviceNameExpression,deviceTypePattern:e.deviceInfo.deviceProfileExpression,attributes:e.attributes.map((e=>({key:e.key,path:e.value}))),attributes_updates:e.attributes_updates.map((e=>({attributeOnThingsBoard:e.key,attributeOnDevice:e.value}))),timeseries:e.timeseries.map((e=>({key:e.key,path:e.value}))),rpc_methods:e.rpc_methods.map((e=>({method:e.method,arguments:e.arguments.map((e=>e.value))})))})))}static getTypeSourceByValue(e){return e.includes("${")?Gi.IDENTIFIER:e.includes("/")||e.includes("\\")?Gi.PATH:Gi.CONST}static getDeviceNodeSourceByValue(e){return e.includes("${")?Gi.IDENTIFIER:Gi.PATH}static getArgumentType(e){switch(typeof e){case"boolean":return"boolean";case"number":return Number.isInteger(e)?"integer":"float";default:return"string"}}}e("OpcVersionMappingUtil",ar);class rr{static mapSocketToUpgradedVersion(e){const{devices:t,...n}=e??{};return nr.cleanUpConfigBaseInfo(n)}static mapSocketToDowngradedVersion(e){const{devices:t,socket:n}=e??{};return{...n,devices:this.mapDevicesToDowngradedVersion(t??[])}}static mapDevicesToUpgradedVersion(e){return e?.map((e=>({...e,attributeRequests:e.attributeRequests?.map((e=>({...e,requestExpressionSource:this.getExpressionSource(e.requestExpression),attributeNameExpressionSource:this.getExpressionSource(e.attributeNameExpression)})))??[]})))??[]}static mapDevicesToDowngradedVersion(e){return e.map((e=>({...e,attributeRequests:e.attributeRequests?.map((({requestExpressionSource:e,attributeNameExpressionSource:t,...n})=>n))??[]})))}static getExpressionSource(e){return e.includes("${")||e.includes("[")?_i.Expression:_i.Constant}}e("SocketVersionMappingUtil",rr);class or{static mapApplicationToUpgradedVersion(e){const{address:t="",...n}=e,[i,a]=t.split(":"),[r,o]=i.split("/");return{host:r,port:a,mask:o,...n}}static mapApplicationToDowngradedVersion(e){const{host:t="",port:n="",mask:i="",...a}=e;return{address:i?`${t}/${i}:${n}`:`${t}:${n}`,...a}}static mapDevicesToUpgradedVersion(e){return e?.map((({address:e="",deviceName:t,deviceType:n,attributes:i,timeseries:a,attributeUpdates:r,serverSideRpc:o,...s})=>({...s,host:e.split(":")[0],port:e.split(":")[1],deviceInfo:{deviceNameExpression:t,deviceProfileExpression:n,deviceNameExpressionSource:this.getExpressionSource(t),deviceProfileExpressionSource:this.getExpressionSource(n)},attributes:this.getUpdateKeys(i),timeseries:this.getUpdateKeys(a),attributeUpdates:this.getUpdateKeys(r),serverSideRpc:this.getUpdateKeys(o)})))??[]}static mapDevicesToDowngradedVersion(e){return e?.map((({port:e,host:t,deviceInfo:n,attributes:i,timeseries:a,attributeUpdates:r,serverSideRpc:o,...s})=>({...s,address:`${t}:${e}`,deviceName:n?.deviceNameExpression,deviceType:n?.deviceProfileExpression,attributes:this.getDowngradedKeys(i),timeseries:this.getDowngradedKeys(a),attributeUpdates:this.getDowngradedKeys(r),serverSideRpc:this.getDowngradedKeys(o)})))??[]}static getExpressionSource(e){return e?.includes("${")||e?.includes("[")?_i.Expression:_i.Constant}static getUpdateKeys(e){return e?.map((({objectId:e="",...t})=>({objectType:e.split(":")[0],objectId:e.split(":")[1],...t})))??[]}static getDowngradedKeys(e){return e?.map((({objectId:e="",objectType:t="",...n})=>({objectId:`${t}:${e}`,...n})))??[]}}e("BacnetVersionMappingUtil",or);class sr{static mapMappingToUpgradedVersion(e){return e?.map((({converter:e,...t})=>{const{deviceNameExpression:n,deviceTypeExpression:i,...a}=e;return{converter:{deviceInfo:{deviceNameExpressionSource:this.getTypeSourceByValue(n),deviceNameExpression:n,deviceProfileExpressionSource:this.getTypeSourceByValue(i),deviceProfileExpression:i},...a},...t}}))}static mapMappingToDowngradedVersion(e){return e?.map((({converter:e,...t})=>{const{deviceInfo:n,...i}=e;return{converter:{deviceNameExpression:n?.deviceNameExpression,deviceTypeExpression:n?.deviceProfileExpression,...i},...t}}))}static getTypeSourceByValue(e=""){return e.includes("${")?ki.REQUEST:ki.CONST}}e("RestVersionMappingUtil",sr);class lr{transform(e,t){const n=nr.parseVersion(e);return t===yt.MODBUS?n>=nr.parseVersion(ft.v3_5_2):n>=nr.parseVersion(ft.v3_6_0)}static{this.ɵfac=function(e){return new(e||lr)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"withReportStrategy",type:lr,pure:!0,standalone:!0})}}function pr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-required")," "))}function cr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-pattern")," "))}function dr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.name-already-exists")," "))}function ur(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-required")," "))}function mr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-pattern")," "))}function hr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-min")," "))}function gr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.command-required")," "))}function fr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.command-pattern")," "))}e("ReportStrategyVersionPipe",lr);class yr extends O{constructor(e,t,n,i,a,r,o,s){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.dialogService=r,this.translate=o,this.destroyRef=s,this.commandHelpLink=w+"/docs/iot-gateway/configuration/#subsection-statistics",this.editCommandFormGroup=this.fb.group({attributeOnGateway:["",[xe.required,xe.pattern(fn),this.uniqNameRequired()]],command:["",[xe.required,xe.pattern(/^(?=\S).*\S$/)]],timeout:[10,[xe.required,xe.min(1),xe.pattern(gn),xe.pattern(/^[^.\s]+$/)]],installCmd:["",xe.pattern(fn)]}),this.editCommandFormGroup.patchValue(this.data.command,{emitEvent:!1})}cancel(){this.confirmConnectorChange().pipe(je(Boolean),On(this.destroyRef)).subscribe((()=>this.dialogRef.close(null)))}apply(){this.dialogRef.close({current:this.editCommandFormGroup.value,prev:this.data.command})}confirmConnectorChange(){return this.editCommandFormGroup.dirty?this.dialogService.confirm(this.translate.instant("gateway.statistics.change-command-title"),this.translate.instant("gateway.statistics.change-command-text"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0):Pe(!0)}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase();return t&&this.data.existingCommands.some((e=>e.toLowerCase()===t))&&t!==this.data.command.attributeOnGateway.toLowerCase()?{duplicateName:{valid:!1}}:null}}static{this.ɵfac=function(e){return new(e||yr)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(ee.DialogService),t.ɵɵdirectiveInject(he.TranslateService),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yr,selectors:[["tb-edit-custom-command-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:64,vars:27,consts:[[1,"edit-command-container",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel","stroked","no-padding-bottom","no-gap","command-container"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["translate",""],["matInput","","formControlName","attributeOnGateway"],["matIconSuffix","",1,"cursor-pointer",3,"matTooltip"],["matInput","","formControlName","timeout","type","number","min","1"],["appearance","outline",1,"mat-block"],["matInput","","formControlName","command"],[1,"tb-settings","pb-4"],["translate","",1,"tb-form-panel-title"],["matInput","","formControlName","installCmd"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"section",8)(13,"section",9)(14,"mat-form-field",10)(15,"mat-label",11),t.ɵɵtext(16,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(17,"input",12),t.ɵɵtemplate(18,pr,3,3,"mat-error")(19,cr,3,3,"mat-error")(20,dr,3,3,"mat-error"),t.ɵɵelementStart(21,"mat-icon",13),t.ɵɵpipe(22,"translate"),t.ɵɵtext(23,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"mat-form-field",10)(25,"mat-label",11),t.ɵɵtext(26,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",14),t.ɵɵtemplate(28,ur,3,3,"mat-error")(29,mr,3,3,"mat-error")(30,hr,3,3,"mat-error"),t.ɵɵelementStart(31,"mat-icon",13),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(34,"section")(35,"mat-form-field",15)(36,"mat-label",11),t.ɵɵtext(37,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(38,"input",16),t.ɵɵtemplate(39,gr,3,3,"mat-error")(40,fr,3,3,"mat-error"),t.ɵɵelementStart(41,"mat-icon",13),t.ɵɵpipe(42,"translate"),t.ɵɵtext(43,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(44,"section")(45,"mat-expansion-panel",17)(46,"mat-expansion-panel-header")(47,"mat-panel-title")(48,"div",18),t.ɵɵtext(49,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(50,"mat-form-field",10)(51,"mat-label",11),t.ɵɵtext(52,"gateway.statistics.install-cmd"),t.ɵɵelementEnd(),t.ɵɵelement(53,"input",19),t.ɵɵelementStart(54,"mat-icon",13),t.ɵɵpipe(55,"translate"),t.ɵɵtext(56,"info_outlined "),t.ɵɵelementEnd()()()()()()(),t.ɵɵelementStart(57,"div",20)(58,"button",21),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(59),t.ɵɵpipe(60,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(61,"button",22),t.ɵɵlistener("click",(function(){return n.apply()})),t.ɵɵtext(62),t.ɵɵpipe(63,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.editCommandFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,13,n.data.titleText)),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.commandHelpLink),t.ɵɵadvance(12),t.ɵɵconditional(n.editCommandFormGroup.get("attributeOnGateway").hasError("required")?18:n.editCommandFormGroup.get("attributeOnGateway").hasError("pattern")?19:n.editCommandFormGroup.get("attributeOnGateway").hasError("duplicateName")?20:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(22,15,"gateway.hints.attribute")),t.ɵɵadvance(7),t.ɵɵconditional(n.editCommandFormGroup.get("timeout").hasError("required")?28:n.editCommandFormGroup.get("timeout").hasError("pattern")?29:n.editCommandFormGroup.get("timeout").hasError("min")?30:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(32,17,"gateway.hints.timeout")),t.ɵɵadvance(8),t.ɵɵconditional(n.editCommandFormGroup.get("command").hasError("required")?39:n.editCommandFormGroup.get("command").hasError("pattern")?40:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(42,19,"gateway.hints.command")),t.ɵɵadvance(13),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(55,21,"gateway.hints.install-cmd")),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(60,23,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.editCommandFormGroup.invalid||!n.editCommandFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(63,25,n.data.buttonText)," "))},dependencies:t.ɵɵgetComponentDepsFactory(yr,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%] .edit-command-container[_ngcontent-%COMP%]{min-width:40vw;width:50vw}[_nghost-%COMP%] .pointer-event{pointer-events:all}[_nghost-%COMP%] .toggle-group span{padding:0 25px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{color:#e0e0e0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix:hover{color:#9e9e9e}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex;align-items:center}']})}}var vr=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},xr=new function(){this.browser=new vr,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(xr.wxa=!0,xr.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?xr.worker=!0:"undefined"==typeof navigator||0===navigator.userAgent.indexOf("Node.js")?(xr.node=!0,xr.svgSupported=!0):function(e,t){var n=t.browser,i=e.match(/Firefox\/([\d.]+)/),a=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),r=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);i&&(n.firefox=!0,n.version=i[1]);a&&(n.ie=!0,n.version=a[1]);r&&(n.edge=!0,n.version=r[1],n.newEdge=+r[1].split(".")[0]>18);o&&(n.weChat=!0);t.svgSupported="undefined"!=typeof SVGRect,t.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,t.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported="undefined"!=typeof document;var s=document.documentElement.style;t.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,xr);var br="sans-serif",wr="12px "+br;var Sr,Cr,_r=function(e){var t={};if("undefined"==typeof JSON)return t;for(var n=0;n=0)r=a*e.length;else for(var o=0;o>1)%2;o.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[s]+":0",a[l]+":0",i[1-s]+":auto",a[1-l]+":auto",""].join("!important;"),e.appendChild(o),n.push(o)}return n}(t,r),s=function(e,t,n){for(var i=n?"invTrans":"trans",a=t[i],r=t.srcCoords,o=[],s=[],l=!0,p=0;p<4;p++){var c=e[p].getBoundingClientRect(),d=2*p,u=c.left,m=c.top;o.push(u,m),l=l&&r&&u===r[d]&&m===r[d+1],s.push(e[p].offsetLeft,e[p].offsetTop)}return l&&a?a:(t.srcCoords=o,t[i]=n?os(s,o):os(o,s))}(o,r,a);if(s)return s(e,n,i),!0}return!1}function cs(e){return"CANVAS"===e.nodeName.toUpperCase()}var ds=/([&<>"'])/g,us={"&":"&","<":"<",">":">",'"':""","'":"'"};function ms(e){return null==e?"":(e+"").replace(ds,(function(e,t){return us[t]}))}var hs=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,gs=[],fs=xr.browser.firefox&&+xr.browser.version.split(".")[0]<39;function ys(e,t,n,i){return n=n||{},i?vs(e,t,n):fs&&null!=t.layerX&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):null!=t.offsetX?(n.zrX=t.offsetX,n.zrY=t.offsetY):vs(e,t,n),n}function vs(e,t,n){if(xr.domSupported&&e.getBoundingClientRect){var i=t.clientX,a=t.clientY;if(cs(e)){var r=e.getBoundingClientRect();return n.zrX=i-r.left,void(n.zrY=a-r.top)}if(ps(gs,e,i,a))return n.zrX=gs[0],void(n.zrY=gs[1])}n.zrX=n.zrY=0}function xs(e){return e||window.event}function bs(e,t,n){if(null!=(t=xs(t)).zrX)return t;var i=t.type;if(i&&i.indexOf("touch")>=0){var a="touchend"!==i?t.targetTouches[0]:t.changedTouches[0];a&&ys(e,a,t,n)}else{ys(e,t,t,n);var r=function(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,i=e.deltaY;if(null==n||null==i)return t;return 3*(0!==i?Math.abs(i):Math.abs(n))*(i>0?-1:i<0?1:n>0?-1:1)}(t);t.zrDelta=r?r/120:-(t.detail||0)/3}var o=t.button;return null==t.which&&void 0!==o&&hs.test(t.type)&&(t.which=1&o?1:2&o?3:4&o?2:0),t}function ws(e,t,n,i){e.addEventListener(t,n,i)}var Ss=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function Cs(e){return 2===e.which||3===e.which}var _s=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var i=e.touches;if(i){for(var a={points:[],touches:[],target:t,event:e},r=0,o=i.length;r1&&a&&a.length>1){var o=Ts(a)/Ts(r);!isFinite(o)&&(o=1),t.pinchScale=o;var s=[((i=a)[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];return t.pinchX=s[0],t.pinchY=s[1],{type:"pinch",target:e[0].target,event:t}}}}};function Is(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function Ms(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function ks(e,t,n){var i=t[0]*n[0]+t[2]*n[1],a=t[1]*n[0]+t[3]*n[1],r=t[0]*n[2]+t[2]*n[3],o=t[1]*n[2]+t[3]*n[3],s=t[0]*n[4]+t[2]*n[5]+t[4],l=t[1]*n[4]+t[3]*n[5]+t[5];return e[0]=i,e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=l,e}function Ps(e,t,n){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+n[0],e[5]=t[5]+n[1],e}function Ds(e,t,n,i){void 0===i&&(i=[0,0]);var a=t[0],r=t[2],o=t[4],s=t[1],l=t[3],p=t[5],c=Math.sin(n),d=Math.cos(n);return e[0]=a*d+s*c,e[1]=-a*c+s*d,e[2]=r*d+l*c,e[3]=-r*c+d*l,e[4]=d*(o-i[0])+c*(p-i[1])+i[0],e[5]=d*(p-i[1])-c*(o-i[0])+i[1],e}function As(e,t,n){var i=n[0],a=n[1];return e[0]=t[0]*i,e[1]=t[1]*a,e[2]=t[2]*i,e[3]=t[3]*a,e[4]=t[4]*i,e[5]=t[5]*a,e}function Os(e,t){var n=t[0],i=t[2],a=t[4],r=t[1],o=t[3],s=t[5],l=n*o-r*i;return l?(l=1/l,e[0]=o*l,e[1]=-r*l,e[2]=-i*l,e[3]=n*l,e[4]=(i*s-o*a)*l,e[5]=(r*a-n*s)*l,e):null}function Rs(e){var t=[1,0,0,1,0,0];return Ms(t,e),t}var Bs=function(){function e(e,t){this.x=e||0,this.y=t||0}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(e,t){return this.x=e,this.y=t,this},e.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.scale=function(e){this.x*=e,this.y*=e},e.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},e.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},e.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},e.prototype.distanceSquare=function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(e){if(e){var t=this.x,n=this.y;return this.x=e[0]*t+e[2]*n+e[4],this.y=e[1]*t+e[3]*n+e[5],this}},e.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},e.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},e.set=function(e,t,n){e.x=t,e.y=n},e.copy=function(e,t){e.x=t.x,e.y=t.y},e.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},e.lenSquare=function(e){return e.x*e.x+e.y*e.y},e.dot=function(e,t){return e.x*t.x+e.y*t.y},e.add=function(e,t,n){e.x=t.x+n.x,e.y=t.y+n.y},e.sub=function(e,t,n){e.x=t.x-n.x,e.y=t.y-n.y},e.scale=function(e,t,n){e.x=t.x*n,e.y=t.y*n},e.scaleAndAdd=function(e,t,n,i){e.x=t.x+n.x*i,e.y=t.y+n.y*i},e.lerp=function(e,t,n,i){var a=1-i;e.x=a*t.x+i*n.x,e.y=a*t.y+i*n.y},e}(),Fs=Math.min,Ns=Math.max,Ls=new Bs,Vs=new Bs,qs=new Bs,Gs=new Bs,zs=new Bs,Us=new Bs,js=function(){function e(e,t,n,i){n<0&&(e+=n,n=-n),i<0&&(t+=i,i=-i),this.x=e,this.y=t,this.width=n,this.height=i}return e.prototype.union=function(e){var t=Fs(e.x,this.x),n=Fs(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Ns(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Ns(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=t,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(e){var t=this,n=e.width/t.width,i=e.height/t.height,a=[1,0,0,1,0,0];return Ps(a,a,[-t.x,-t.y]),As(a,a,[n,i]),Ps(a,a,[e.x,e.y]),a},e.prototype.intersect=function(t,n){if(!t)return!1;t instanceof e||(t=e.create(t));var i=this,a=i.x,r=i.x+i.width,o=i.y,s=i.y+i.height,l=t.x,p=t.x+t.width,c=t.y,d=t.y+t.height,u=!(rh&&(h=x,gh&&(h=b,y=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){e.copy(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return 0===this.width||0===this.height},e.create=function(t){return new e(t.x,t.y,t.width,t.height)},e.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},e.applyTransform=function(t,n,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var a=i[0],r=i[3],o=i[4],s=i[5];return t.x=n.x*a+o,t.y=n.y*r+s,t.width=n.width*a,t.height=n.height*r,t.width<0&&(t.x+=t.width,t.width=-t.width),void(t.height<0&&(t.y+=t.height,t.height=-t.height))}Ls.x=qs.x=n.x,Ls.y=Gs.y=n.y,Vs.x=Gs.x=n.x+n.width,Vs.y=qs.y=n.y+n.height,Ls.transform(i),Gs.transform(i),Vs.transform(i),qs.transform(i),t.x=Fs(Ls.x,Vs.x,qs.x,Gs.x),t.y=Fs(Ls.y,Vs.y,qs.y,Gs.y);var l=Ns(Ls.x,Vs.x,qs.x,Gs.x),p=Ns(Ls.y,Vs.y,qs.y,Gs.y);t.width=l-t.x,t.height=p-t.y}else t!==n&&e.copy(t,n)},e}(),Hs="silent";function Ws(){Ss(this.event)}var $s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handler=null,t}return Qe(t,e),t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(is),Ks=function(e,t){this.x=e,this.y=t},Ys=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Xs=new js(0,0,0,0),Zs=function(e){function t(t,n,i,a,r){var o=e.call(this)||this;return o._hovered=new Ks(0,0),o.storage=t,o.painter=n,o.painterRoot=a,o._pointerSize=r,i=i||new $s,o.proxy=null,o.setHandlerProxy(i),o._draggingMgr=new ns(o),o}return Qe(t,e),t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(Yr(Ys,(function(t){e.on&&e.on(t,this[t],this)}),this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,i=el(this,t,n),a=this._hovered,r=a.target;r&&!r.__zr&&(r=(a=this.findHover(a.x,a.y)).target);var o=this._hovered=i?new Ks(t,n):this.findHover(t,n),s=o.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),r&&s!==r&&this.dispatchToElement(a,"mouseout",e),this.dispatchToElement(o,"mousemove",e),s&&s!==r&&this.dispatchToElement(o,"mouseover",e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;"only_globalout"!==t&&this.dispatchToElement(this._hovered,"mouseout",e),"no_globalout"!==t&&this.trigger("globalout",{type:"globalout",event:e})},t.prototype.resize=function(){this._hovered=new Ks(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){var i=(e=e||{}).target;if(!i||!i.silent){for(var a="on"+t,r=function(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:Ws}}(t,e,n);i&&(i[a]&&(r.cancelBubble=!!i[a].call(i,r)),i.trigger(t,r),i=i.__hostTarget?i.__hostTarget:i.parent,!r.cancelBubble););r.cancelBubble||(this.trigger(t,r),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer((function(e){"function"==typeof e[a]&&e[a].call(e,r),e.trigger&&e.trigger(t,r)})))}},t.prototype.findHover=function(e,t,n){var i=this.storage.getDisplayList(),a=new Ks(e,t);if(Js(i,a,e,t,n),this._pointerSize&&!a.target){for(var r=[],o=this._pointerSize,s=o/2,l=new js(e-s,t-s,o,o),p=i.length-1;p>=0;p--){var c=i[p];c===n||c.ignore||c.ignoreCoarsePointer||c.parent&&c.parent.ignoreCoarsePointer||(Xs.copy(c.getBoundingRect()),c.transform&&Xs.applyTransform(c.transform),Xs.intersect(l)&&r.push(c))}if(r.length)for(var d=Math.PI/12,u=2*Math.PI,m=0;m=0;r--){var o=e[r],s=void 0;if(o!==a&&!o.ignore&&(s=Qs(o,n,i))&&(!t.topTarget&&(t.topTarget=o),s!==Hs)){t.target=o;break}}}function el(e,t,n){var i=e.painter;return t<0||t>i.getWidth()||n<0||n>i.getHeight()}Yr(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(e){Zs.prototype[e]=function(t){var n,i,a=t.zrX,r=t.zrY,o=el(this,a,r);if("mouseup"===e&&o||(i=(n=this.findHover(a,r)).target),"mousedown"===e)this._downEl=i,this._downPoint=[t.zrX,t.zrY],this._upEl=i;else if("mouseup"===e)this._upEl=i;else if("click"===e){if(this._downEl!==this._upEl||!this._downPoint||Ko(this._downPoint,[t.zrX,t.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,e,t)}}));function tl(e,t,n,i){var a=t+1;if(a===n)return 1;if(i(e[a++],e[t])<0){for(;a=0;)a++;return a-t}function nl(e,t,n,i,a){for(i===t&&i++;i>>1])<0?l=r:s=r+1;var p=i-s;switch(p){case 3:e[s+3]=e[s+2];case 2:e[s+2]=e[s+1];case 1:e[s+1]=e[s];break;default:for(;p>0;)e[s+p]=e[s+p-1],p--}e[s]=o}}function il(e,t,n,i,a,r){var o=0,s=0,l=1;if(r(e,t[n+a])>0){for(s=i-a;l0;)o=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;ls&&(l=s);var p=o;o=a-l,l=a-p}for(o++;o>>1);r(e,t[n+c])>0?o=c+1:l=c}return l}function al(e,t,n,i,a,r){var o=0,s=0,l=1;if(r(e,t[n+a])<0){for(s=a+1;ls&&(l=s);var p=o;o=a-l,l=a-p}else{for(s=i-a;l=0;)o=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o>>1);r(e,t[n+c])<0?l=c:o=c+1}return l}function rl(e,t){var n,i,a=7,r=0,o=[];function s(s){var l=n[s],p=i[s],c=n[s+1],d=i[s+1];i[s]=p+d,s===r-3&&(n[s+1]=n[s+2],i[s+1]=i[s+2]),r--;var u=al(e[c],e,l,p,0,t);l+=u,0!==(p-=u)&&0!==(d=il(e[l+p-1],e,c,d,d-1,t))&&(p<=d?function(n,i,r,s){var l=0;for(l=0;l=7||m>=7);if(h)break;g<0&&(g=0),g+=2}if((a=g)<1&&(a=1),1===i){for(l=0;l=0;l--)e[m+l]=e[u+l];return void(e[d]=o[c])}var h=a;for(;;){var g=0,f=0,y=!1;do{if(t(o[c],e[p])<0){if(e[d--]=e[p--],g++,f=0,0==--i){y=!0;break}}else if(e[d--]=o[c--],f++,g=0,1==--s){y=!0;break}}while((g|f)=0;l--)e[m+l]=e[u+l];if(0===i){y=!0;break}}if(e[d--]=o[c--],1==--s){y=!0;break}if(0!==(f=s-il(e[p],o,0,s,s-1,t))){for(s-=f,m=(d-=f)+1,u=(c-=f)+1,l=0;l=7||f>=7);if(y)break;h<0&&(h=0),h+=2}(a=h)<1&&(a=1);if(1===s){for(m=(d-=i)+1,u=(p-=i)+1,l=i-1;l>=0;l--)e[m+l]=e[u+l];e[d]=o[c]}else{if(0===s)throw new Error;for(u=d-(s-1),l=0;l1;){var e=r-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;s(e)}},forceMergeRuns:function(){for(;r>1;){var e=r-2;e>0&&i[e-1]=32;)t|=1&e,e>>=1;return e+t}(a);do{if((r=tl(e,n,i,t))s&&(l=s),nl(e,n,n+l,n+r,t),r=l}o.pushRun(n,r),o.mergeRuns(),a-=r,n+=r}while(0!==a);o.forceMergeRuns()}}}var sl=!1;function ll(){sl||(sl=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function pl(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var cl=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=pl}return e.prototype.traverse=function(e,t){for(var n=0;n0&&(p.__clipPaths=[]),isNaN(p.z)&&(ll(),p.z=0),isNaN(p.z2)&&(ll(),p.z2=0),isNaN(p.zlevel)&&(ll(),p.zlevel=0),this._displayList[this._displayListLen++]=p}var c=e.getDecalElement&&e.getDecalElement();c&&this._updateAndAddDisplayable(c,t,n);var d=e.getTextGuideLine();d&&this._updateAndAddDisplayable(d,t,n);var u=e.getTextContent();u&&this._updateAndAddDisplayable(u,t,n)}},e.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},e.prototype.delRoot=function(e){if(e instanceof Array)for(var t=0,n=e.length;t=0&&this._roots.splice(i,1)}},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),dl=xr.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)},ul={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return.5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return 0===e?0:Math.pow(1024,e-1)},exponentialOut:function(e){return 1===e?1:1-Math.pow(2,-10*e)},exponentialInOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1;return 0===e?0:1===e?1:(!n||n<1?(n=1,t=.1):t=.4*Math.asin(1/n)/(2*Math.PI),-n*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/.4))},elasticOut:function(e){var t,n=.1;return 0===e?0:1===e?1:(!n||n<1?(n=1,t=.1):t=.4*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*e)*Math.sin((e-t)*(2*Math.PI)/.4)+1)},elasticInOut:function(e){var t,n=.1,i=.4;return 0===e?0:1===e?1:(!n||n<1?(n=1,t=.1):t=i*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?n*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/i)*-.5:n*Math.pow(2,-10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/i)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-ul.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?.5*ul.bounceIn(2*e):.5*ul.bounceOut(2*e-1)+.5}},ml=Math.pow,hl=Math.sqrt,gl=1e-8,fl=1e-4,yl=hl(3),vl=1/3,xl=No(),bl=No(),wl=No();function Sl(e){return e>-1e-8&&egl||e<-1e-8}function _l(e,t,n,i,a){var r=1-a;return r*r*(r*e+3*a*t)+a*a*(a*i+3*r*n)}function Tl(e,t,n,i,a){var r=1-a;return 3*(((t-e)*r+2*(n-t)*a)*r+(i-n)*a*a)}function El(e,t,n,i,a,r){var o=i+3*(t-n)-e,s=3*(n-2*t+e),l=3*(t-e),p=e-a,c=s*s-3*o*l,d=s*l-9*o*p,u=l*l-3*s*p,m=0;if(Sl(c)&&Sl(d)){if(Sl(s))r[0]=0;else(_=-l/s)>=0&&_<=1&&(r[m++]=_)}else{var h=d*d-4*c*u;if(Sl(h)){var g=d/c,f=-g/2;(_=-s/o+g)>=0&&_<=1&&(r[m++]=_),f>=0&&f<=1&&(r[m++]=f)}else if(h>0){var y=hl(h),v=c*s+1.5*o*(-d+y),x=c*s+1.5*o*(-d-y);(_=(-s-((v=v<0?-ml(-v,vl):ml(v,vl))+(x=x<0?-ml(-x,vl):ml(x,vl))))/(3*o))>=0&&_<=1&&(r[m++]=_)}else{var b=(2*c*s-3*o*d)/(2*hl(c*c*c)),w=Math.acos(b)/3,S=hl(c),C=Math.cos(w),_=(-s-2*S*C)/(3*o),T=(f=(-s+S*(C+yl*Math.sin(w)))/(3*o),(-s+S*(C-yl*Math.sin(w)))/(3*o));_>=0&&_<=1&&(r[m++]=_),f>=0&&f<=1&&(r[m++]=f),T>=0&&T<=1&&(r[m++]=T)}}return m}function Il(e,t,n,i,a){var r=6*n-12*t+6*e,o=9*t+3*i-3*e-9*n,s=3*t-3*e,l=0;if(Sl(o)){if(Cl(r))(c=-s/r)>=0&&c<=1&&(a[l++]=c)}else{var p=r*r-4*o*s;if(Sl(p))a[0]=-r/(2*o);else if(p>0){var c,d=hl(p),u=(-r-d)/(2*o);(c=(-r+d)/(2*o))>=0&&c<=1&&(a[l++]=c),u>=0&&u<=1&&(a[l++]=u)}}return l}function Ml(e,t,n,i,a,r){var o=(t-e)*a+e,s=(n-t)*a+t,l=(i-n)*a+n,p=(s-o)*a+o,c=(l-s)*a+s,d=(c-p)*a+p;r[0]=e,r[1]=o,r[2]=p,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=i}function kl(e,t,n,i,a,r,o,s,l,p,c){var d,u,m,h,g,f=.005,y=1/0;xl[0]=l,xl[1]=p;for(var v=0;v<1;v+=.05)bl[0]=_l(e,n,a,o,v),bl[1]=_l(t,i,r,s,v),(h=Xo(xl,bl))=0&&h=0&&f=1?1:El(0,i,r,1,e,s)&&_l(0,a,o,1,s[0])}}}var Vl=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Bo,this.ondestroy=e.ondestroy||Bo,this.onrestart=e.onrestart||Bo,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),!this._paused){var n=this._life,i=e-this._startTime-this._pausedTime,a=i/n;a<0&&(a=0),a=Math.min(a,1);var r=this.easingFunc,o=r?r(a):a;if(this.onframe(o),1===a){if(!this.loop)return!0;var s=i%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=t},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=ao(e)?e:ul[e]||Ll(e)},e}(),ql=function(e){this.value=e},Gl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new ql(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),zl=function(){function e(e){this._list=new Gl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,i=this._map,a=null;if(null==i[e]){var r=n.len(),o=this._lastRemovedEntry;if(r>=this._maxSize&&r>0){var s=n.head;n.remove(s),delete i[s.key],a=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new ql(t),o.key=e,n.insertEntry(o),i[e]=o}return a},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(null!=t)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),Ul={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function jl(e){return(e=Math.round(e))<0?0:e>255?255:e}function Hl(e){return e<0?0:e>1?1:e}function Wl(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?jl(parseFloat(t)/100*255):jl(parseInt(t,10))}function $l(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Hl(parseFloat(t)/100):Hl(parseFloat(t))}function Kl(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}function Yl(e,t,n){return e+(t-e)*n}function Xl(e,t,n,i,a){return e[0]=t,e[1]=n,e[2]=i,e[3]=a,e}function Zl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var Ql=new zl(20),Jl=null;function ep(e,t){Jl&&Zl(Jl,t),Jl=Ql.put(e,Jl||t.slice())}function tp(e,t){if(e){t=t||[];var n=Ql.get(e);if(n)return Zl(t,n);var i=(e+="").replace(/ /g,"").toLowerCase();if(i in Ul)return Zl(t,Ul[i]),ep(e,t),t;var a,r=i.length;if("#"===i.charAt(0))return 4===r||5===r?(a=parseInt(i.slice(1,4),16))>=0&&a<=4095?(Xl(t,(3840&a)>>4|(3840&a)>>8,240&a|(240&a)>>4,15&a|(15&a)<<4,5===r?parseInt(i.slice(4),16)/15:1),ep(e,t),t):void Xl(t,0,0,0,1):7===r||9===r?(a=parseInt(i.slice(1,7),16))>=0&&a<=16777215?(Xl(t,(16711680&a)>>16,(65280&a)>>8,255&a,9===r?parseInt(i.slice(7),16)/255:1),ep(e,t),t):void Xl(t,0,0,0,1):void 0;var o=i.indexOf("("),s=i.indexOf(")");if(-1!==o&&s+1===r){var l=i.substr(0,o),p=i.substr(o+1,s-(o+1)).split(","),c=1;switch(l){case"rgba":if(4!==p.length)return 3===p.length?Xl(t,+p[0],+p[1],+p[2],1):Xl(t,0,0,0,1);c=$l(p.pop());case"rgb":return p.length>=3?(Xl(t,Wl(p[0]),Wl(p[1]),Wl(p[2]),3===p.length?c:$l(p[3])),ep(e,t),t):void Xl(t,0,0,0,1);case"hsla":return 4!==p.length?void Xl(t,0,0,0,1):(p[3]=$l(p[3]),np(p,t),ep(e,t),t);case"hsl":return 3!==p.length?void Xl(t,0,0,0,1):(np(p,t),ep(e,t),t);default:return}}Xl(t,0,0,0,1)}}function np(e,t){var n=(parseFloat(e[0])%360+360)%360/360,i=$l(e[1]),a=$l(e[2]),r=a<=.5?a*(i+1):a+i-a*i,o=2*a-r;return Xl(t=t||[],jl(255*Kl(o,r,n+1/3)),jl(255*Kl(o,r,n)),jl(255*Kl(o,r,n-1/3)),1),4===e.length&&(t[3]=e[3]),t}function ip(e,t){var n=tp(e);if(n){for(var i=0;i<3;i++)n[i]=t<0?n[i]*(1-t)|0:(255-n[i])*t+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return lp(n,4===n.length?"rgba":"rgb")}}function ap(e,t,n){if(t&&t.length&&e>=0&&e<=1){n=n||[];var i=e*(t.length-1),a=Math.floor(i),r=Math.ceil(i),o=t[a],s=t[r],l=i-a;return n[0]=jl(Yl(o[0],s[0],l)),n[1]=jl(Yl(o[1],s[1],l)),n[2]=jl(Yl(o[2],s[2],l)),n[3]=Hl(Yl(o[3],s[3],l)),n}}function rp(e,t,n){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),a=Math.floor(i),r=Math.ceil(i),o=tp(t[a]),s=tp(t[r]),l=i-a,p=lp([jl(Yl(o[0],s[0],l)),jl(Yl(o[1],s[1],l)),jl(Yl(o[2],s[2],l)),Hl(Yl(o[3],s[3],l))],"rgba");return n?{color:p,leftIndex:a,rightIndex:r,value:i}:p}}function op(e,t,n,i){var a=tp(e);if(e)return a=function(e){if(e){var t,n,i=e[0]/255,a=e[1]/255,r=e[2]/255,o=Math.min(i,a,r),s=Math.max(i,a,r),l=s-o,p=(s+o)/2;if(0===l)t=0,n=0;else{n=p<.5?l/(s+o):l/(2-s-o);var c=((s-i)/6+l/2)/l,d=((s-a)/6+l/2)/l,u=((s-r)/6+l/2)/l;i===s?t=u-d:a===s?t=1/3+c-u:r===s&&(t=2/3+d-c),t<0&&(t+=1),t>1&&(t-=1)}var m=[360*t,n,p];return null!=e[3]&&m.push(e[3]),m}}(a),null!=t&&(a[0]=function(e){return(e=Math.round(e))<0?0:e>360?360:e}(t)),null!=n&&(a[1]=$l(n)),null!=i&&(a[2]=$l(i)),lp(np(a),"rgba")}function sp(e,t){var n=tp(e);if(n&&null!=t)return n[3]=Hl(t),lp(n,"rgba")}function lp(e,t){if(e&&e.length){var n=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(n+=","+e[3]),t+"("+n+")"}}function pp(e,t){var n=tp(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var cp=new zl(100);function dp(e){if(ro(e)){var t=cp.get(e);return t||(t=ip(e,-.1),cp.put(e,t)),t}if(mo(e)){var n=Ur({},e);return n.colorStops=Xr(e.colorStops,(function(e){return{offset:e.offset,color:ip(e.color,-.1)}})),n}return e}var up=Math.round;function mp(e){var t;if(e&&"transparent"!==e){if("string"==typeof e&&e.indexOf("rgba")>-1){var n=tp(e);n&&(e="rgb("+n[0]+","+n[1]+","+n[2]+")",t=n[3])}}else e="none";return{color:e,opacity:null==t?1:t}}var hp=1e-4;function gp(e){return e-1e-4}function fp(e){return up(1e3*e)/1e3}function yp(e){return up(1e4*e)/1e4}var vp={left:"start",right:"end",center:"middle",middle:"middle"};function xp(e){return e&&!!e.image}function bp(e){return xp(e)||function(e){return e&&!!e.svgElement}(e)}function wp(e){return"linear"===e.type}function Sp(e){return"radial"===e.type}function Cp(e){return e&&("linear"===e.type||"radial"===e.type)}function _p(e){return"url(#"+e+")"}function Tp(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function Ep(e){var t=e.x||0,n=e.y||0,i=(e.rotation||0)*Fo,a=vo(e.scaleX,1),r=vo(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,l=[];return(t||n)&&l.push("translate("+t+"px,"+n+"px)"),i&&l.push("rotate("+i+")"),1===a&&1===r||l.push("scale("+a+","+r+")"),(o||s)&&l.push("skew("+up(o*Fo)+"deg, "+up(s*Fo)+"deg)"),l.join(" ")}var Ip=xr.hasGlobalWindow&&ao(window.btoa)?function(e){return window.btoa(unescape(encodeURIComponent(e)))}:"undefined"!=typeof Buffer?function(e){return Buffer.from(e).toString("base64")}:function(e){return null},Mp=Array.prototype.slice;function kp(e,t,n){return(t-e)*n+e}function Pp(e,t,n,i){for(var a=t.length,r=0;ri?t:e,r=Math.min(n,i),o=a[r-1]||{color:[0,0,0,0],offset:0},s=r;so)i.length=o;else for(var s=r;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var i=this.keyframes,a=i.length,r=!1,o=6,s=t;if(Kr(t)){var l=function(e){return Kr(e&&e[0])?2:1}(t);o=l,(1===l&&!so(t[0])||2===l&&!so(t[0][0]))&&(r=!0)}else if(so(t)&&!fo(t))o=0;else if(ro(t))if(isNaN(+t)){var p=tp(t);p&&(s=p,o=3)}else o=0;else if(mo(t)){var c=Ur({},s);c.colorStops=Xr(t.colorStops,(function(e){return{offset:e.offset,color:tp(e.color)}})),wp(t)?o=4:Sp(t)&&(o=5),s=c}0===a?this.valType=o:o===this.valType&&6!==o||(r=!0),this.discrete=this.discrete||r;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=ao(n)?n:ul[n]||Ll(n)),i.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort((function(e,t){return e.time-t.time}));for(var i=this.valType,a=n.length,r=n[a-1],o=this.discrete,s=Lp(i),l=Np(i),p=0;p=0&&!(l[n].percent<=t);n--);n=m(n,p-2)}else{for(n=u;nt);n++);n=m(n-1,p-2)}a=l[n+1],i=l[n]}if(i&&a){this._lastFr=n,this._lastFrP=t;var h=a.percent-i.percent,g=0===h?1:m((t-i.percent)/h,1);a.easingFunc&&(g=a.easingFunc(g));var f=r?this._additiveValue:d?Vp:e[c];if(!Lp(s)&&!d||f||(f=this._additiveValue=[]),this.discrete)e[c]=g<1?i.rawValue:a.rawValue;else if(Lp(s))1===s?Pp(f,i[o],a[o],g):function(e,t,n,i){for(var a=t.length,r=a&&t[0].length,o=0;o0&&s.addKeyframe(0,Bp(l),i),this._trackKeys.push(o)}s.addKeyframe(e,Bp(t[o]),i)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],i=this._maxTime||0,a=0;a1){var o=r.pop();a.addKeyframe(o.time,e[i]),a.prepare(this._maxTime,a.getAdditiveTrack())}}}},e}();function zp(){return(new Date).getTime()}var Up,jp,Hp=function(e){function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t=t||{},n.stage=t.stage||{},n}return Qe(t,e),t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=zp()-this._pausedTime,n=t-this._time,i=this._head;i;){var a=i.next;i.step(t,n)?(i.ondestroy(),this.removeClip(i),i=a):i=a}this._time=t,e||(this.trigger("frame",n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0,dl((function t(){e._running&&(dl(t),!e._paused&&e.update())}))},t.prototype.start=function(){this._running||(this._time=zp(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=zp(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=zp()-this._pauseStart,this._paused=!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return null==this._head},t.prototype.animate=function(e,t){t=t||{},this.start();var n=new Gp(e,t.loop);return this.addAnimator(n),n},t}(is),Wp=xr.domSupported,$p=(jp={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:Up=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:Xr(Up,(function(e){var t=e.replace("mouse","pointer");return jp.hasOwnProperty(t)?t:e}))}),Kp=["mousemove","mouseup"],Yp=["pointermove","pointerup"],Xp=!1;function Zp(e){var t=e.pointerType;return"pen"===t||"touch"===t}function Qp(e){e&&(e.zrByTouch=!0)}function Jp(e,t){for(var n=t,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return i}var ec=function(e,t){this.stopPropagation=Bo,this.stopImmediatePropagation=Bo,this.preventDefault=Bo,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY},tc={mousedown:function(e){e=bs(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=bs(this.dom,e);var t=this.__mayPointerCapture;!t||e.zrX===t[0]&&e.zrY===t[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",e)},mouseup:function(e){e=bs(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){Jp(this,(e=bs(this.dom,e)).toElement||e.relatedTarget)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){Xp=!0,e=bs(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){Xp||(e=bs(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){Qp(e=bs(this.dom,e)),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),tc.mousemove.call(this,e),tc.mousedown.call(this,e)},touchmove:function(e){Qp(e=bs(this.dom,e)),this.handler.processGesture(e,"change"),tc.mousemove.call(this,e)},touchend:function(e){Qp(e=bs(this.dom,e)),this.handler.processGesture(e,"end"),tc.mouseup.call(this,e),+new Date-+this.__lastTouchMoment<300&&tc.click.call(this,e)},pointerdown:function(e){tc.mousedown.call(this,e)},pointermove:function(e){Zp(e)||tc.mousemove.call(this,e)},pointerup:function(e){tc.mouseup.call(this,e)},pointerout:function(e){Zp(e)||tc.mouseout.call(this,e)}};Yr(["click","dblclick","contextmenu"],(function(e){tc[e]=function(t){t=bs(this.dom,t),this.trigger(e,t)}}));var nc={pointermove:function(e){Zp(e)||nc.mousemove.call(this,e)},pointerup:function(e){nc.mouseup.call(this,e)},mousemove:function(e){this.trigger("mousemove",e)},mouseup:function(e){var t=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",e),t&&(e.zrEventControl="only_globalout",this.trigger("mouseout",e))}};function ic(e,t){var n=t.domHandlers;xr.pointerEventsSupported?Yr($p.pointer,(function(i){rc(t,i,(function(t){n[i].call(e,t)}))})):(xr.touchEventsSupported&&Yr($p.touch,(function(i){rc(t,i,(function(a){n[i].call(e,a),function(e){e.touching=!0,null!=e.touchTimer&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout((function(){e.touching=!1,e.touchTimer=null}),700)}(t)}))})),Yr($p.mouse,(function(i){rc(t,i,(function(a){a=xs(a),t.touching||n[i].call(e,a)}))})))}function ac(e,t){function n(n){rc(t,n,(function(i){i=xs(i),Jp(e,i.target)||(i=function(e,t){return bs(e.dom,new ec(e,t),!0)}(e,i),t.domHandlers[n].call(e,i))}),{capture:!0})}xr.pointerEventsSupported?Yr(Yp,n):xr.touchEventsSupported||Yr(Kp,n)}function rc(e,t,n,i){e.mounted[t]=n,e.listenerOpts[t]=i,ws(e.domTarget,t,n,i)}function oc(e){var t,n,i,a,r=e.mounted;for(var o in r)r.hasOwnProperty(o)&&(t=e.domTarget,n=o,i=r[o],a=e.listenerOpts[o],t.removeEventListener(n,i,a));e.mounted={}}var sc=function(e,t){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=t},lc=function(e){function t(t,n){var i=e.call(this)||this;return i.__pointerCapturing=!1,i.dom=t,i.painterRoot=n,i._localHandlerScope=new sc(t,tc),Wp&&(i._globalHandlerScope=new sc(document,nc)),ic(i,i._localHandlerScope),i}return Qe(t,e),t.prototype.dispose=function(){oc(this._localHandlerScope),Wp&&oc(this._globalHandlerScope)},t.prototype.setCursor=function(e){this.dom.style&&(this.dom.style.cursor=e||"default")},t.prototype.__togglePointerCapture=function(e){if(this.__mayPointerCapture=null,Wp&&+this.__pointerCapturing^+e){this.__pointerCapturing=e;var t=this._globalHandlerScope;e?ac(this,t):oc(t)}},t}(is),pc=1;xr.hasGlobalWindow&&(pc=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var cc=pc,dc="#333",uc="#ccc",mc=Is,hc=5e-5;function gc(e){return e>hc||e<-5e-5}var fc=[],yc=[],vc=[1,0,0,1,0,0],xc=Math.abs,bc=function(){function e(){}return e.prototype.getLocalTransform=function(t){return e.getLocalTransform(this,t)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return gc(this.rotation)||gc(this.x)||gc(this.y)||gc(this.scaleX-1)||gc(this.scaleY-1)||gc(this.skewX)||gc(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;t||e?(n=n||[1,0,0,1,0,0],t?this.getLocalTransform(n):mc(n),e&&(t?ks(n,e,n):Ms(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(mc(n),this.invTransform=null)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(null!=t&&1!==t){this.getGlobalScale(fc);var n=fc[0]<0?-1:1,i=fc[1]<0?-1:1,a=((fc[0]-n)*t+n)/fc[0]||0,r=((fc[1]-i)*t+i)/fc[1]||0;e[0]*=a,e[1]*=a,e[2]*=r,e[3]*=r}this.invTransform=this.invTransform||[1,0,0,1,0,0],Os(this.invTransform,e)},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],i=Math.atan2(e[1],e[0]),a=Math.PI/2+i-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(a),t=Math.sqrt(t),this.skewX=a,this.skewY=0,this.rotation=-i,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||[1,0,0,1,0,0],ks(yc,e.invTransform,t),t=yc);var n=this.originX,i=this.originY;(n||i)&&(vc[4]=n,vc[5]=i,ks(yc,t,vc),yc[4]-=n,yc[5]-=i,t=yc),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e=e||[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],i=this.invTransform;return i&&Qo(n,n,i),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],i=this.transform;return i&&Qo(n,n,i),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&xc(e[0]-1)>1e-10&&xc(e[3]-1)>1e-10?Math.sqrt(xc(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){Sc(this,e)},e.getLocalTransform=function(e,t){t=t||[];var n=e.originX||0,i=e.originY||0,a=e.scaleX,r=e.scaleY,o=e.anchorX,s=e.anchorY,l=e.rotation||0,p=e.x,c=e.y,d=e.skewX?Math.tan(e.skewX):0,u=e.skewY?Math.tan(-e.skewY):0;if(n||i||o||s){var m=n+o,h=i+s;t[4]=-m*a-d*h*r,t[5]=-h*r-u*m*a}else t[4]=t[5]=0;return t[0]=a,t[3]=r,t[1]=u*a,t[2]=d*r,l&&Ds(t,t,l),t[4]+=n+p,t[5]+=i+c,t},e.initDefaultProps=function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0}(),e}(),wc=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function Sc(e,t){for(var n=0;n=0?parseFloat(e)/100*t:parseFloat(e):e}function Dc(e,t,n){var i=t.position||"inside",a=null!=t.distance?t.distance:5,r=n.height,o=n.width,s=r/2,l=n.x,p=n.y,c="left",d="top";if(i instanceof Array)l+=Pc(i[0],n.width),p+=Pc(i[1],n.height),c=null,d=null;else switch(i){case"left":l-=a,p+=s,c="right",d="middle";break;case"right":l+=a+o,p+=s,d="middle";break;case"top":l+=o/2,p-=a,c="center",d="bottom";break;case"bottom":l+=o/2,p+=r+a,c="center";break;case"inside":l+=o/2,p+=s,c="center",d="middle";break;case"insideLeft":l+=a,p+=s,d="middle";break;case"insideRight":l+=o-a,p+=s,c="right",d="middle";break;case"insideTop":l+=o/2,p+=a,c="center";break;case"insideBottom":l+=o/2,p+=r-a,c="center",d="bottom";break;case"insideTopLeft":l+=a,p+=a;break;case"insideTopRight":l+=o-a,p+=a,c="right";break;case"insideBottomLeft":l+=a,p+=r-a,d="bottom";break;case"insideBottomRight":l+=o-a,p+=r-a,c="right",d="bottom"}return(e=e||{}).x=l,e.y=p,e.align=c,e.verticalAlign=d,e}var Ac="__zr_normal__",Oc=wc.concat(["ignore"]),Rc=Zr(wc,(function(e,t){return e[t]=!0,e}),{ignore:!1}),Bc={},Fc=new js(0,0,0,0),Nc=function(){function e(e){this.id=Lr(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return e.prototype._init=function(e){this.attr(e)},e.prototype.drift=function(e,t,n){switch(this.draggable){case"horizontal":t=0;break;case"vertical":e=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=e,i[5]+=t,this.decomposeTransform(),this.markRedraw()},e.prototype.beforeUpdate=function(){},e.prototype.afterUpdate=function(){},e.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},e.prototype.updateInnerText=function(e){var t=this._textContent;if(t&&(!t.ignore||e)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,a=t.innerTransformable,r=void 0,o=void 0,s=!1;a.parent=i?this:null;var l=!1;if(a.copyTransform(t),null!=n.position){var p=Fc;n.layoutRect?p.copy(n.layoutRect):p.copy(this.getBoundingRect()),i||p.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Bc,n,p):Dc(Bc,n,p),a.x=Bc.x,a.y=Bc.y,r=Bc.align,o=Bc.verticalAlign;var c=n.origin;if(c&&null!=n.rotation){var d=void 0,u=void 0;"center"===c?(d=.5*p.width,u=.5*p.height):(d=Pc(c[0],p.width),u=Pc(c[1],p.height)),l=!0,a.originX=-a.x+d+(i?0:p.x),a.originY=-a.y+u+(i?0:p.y)}}null!=n.rotation&&(a.rotation=n.rotation);var m=n.offset;m&&(a.x+=m[0],a.y+=m[1],l||(a.originX=-m[0],a.originY=-m[1]));var h=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),f=void 0,y=void 0,v=void 0;h&&this.canBeInsideText()?(f=n.insideFill,y=n.insideStroke,null!=f&&"auto"!==f||(f=this.getInsideTextFill()),null!=y&&"auto"!==y||(y=this.getInsideTextStroke(f),v=!0)):(f=n.outsideFill,y=n.outsideStroke,null!=f&&"auto"!==f||(f=this.getOutsideFill()),null!=y&&"auto"!==y||(y=this.getOutsideStroke(f),v=!0)),(f=f||"#000")===g.fill&&y===g.stroke&&v===g.autoStroke&&r===g.align&&o===g.verticalAlign||(s=!0,g.fill=f,g.stroke=y,g.autoStroke=v,g.align=r,g.verticalAlign=o,t.setDefaultTextStyle(g)),t.__dirty|=1,s&&t.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return"#fff"},e.prototype.getInsideTextStroke=function(e){return"#000"},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?uc:dc},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof t&&tp(t);n||(n=[255,255,255,1]);for(var i=n[3],a=this.__zr.isDarkMode(),r=0;r<3;r++)n[r]=n[r]*i+(a?0:255)*(1-i);return n[3]=1,lp(n,"rgba")},e.prototype.traverse=function(e,t){},e.prototype.attrKV=function(e,t){"textConfig"===e?this.setTextConfig(t):"textContent"===e?this.setTextContent(t):"clipPath"===e?this.setClipPath(t):"extra"===e?(this.extra=this.extra||{},Ur(this.extra,t)):this[e]=t},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(e,t){if("string"==typeof e)this.attrKV(e,t);else if(lo(e))for(var n=eo(e),i=0;i0},e.prototype.getState=function(e){return this.states[e]},e.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},e.prototype.clearStates=function(e){this.useState(Ac,!1,e)},e.prototype.useState=function(e,t,n,i){var a=e===Ac;if(this.hasState()||!a){var r=this.currentStates,o=this.stateTransition;if(!(Hr(r,e)>=0)||!t&&1!==r.length){var s;if(this.stateProxy&&!a&&(s=this.stateProxy(e)),s||(s=this.states&&this.states[e]),s||a){a||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||i);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,s,this._normalState,t,!n&&!this.__inHover&&o&&o.duration>0,o);var p=this._textContent,c=this._textGuide;return p&&p.useState(e,t,n,l),c&&c.useState(e,t,n,l),a?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2),s}Vr("State "+e+" not exists.")}}},e.prototype.useStates=function(e,t,n){if(e.length){var i=[],a=this.currentStates,r=e.length,o=r===a.length;if(o)for(var s=0;s0,m);var h=this._textContent,g=this._textGuide;h&&h.useStates(e,t,d),g&&g.useStates(e,t,d),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!d&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2)}else this.clearStates()},e.prototype.isSilent=function(){for(var e=this.silent,t=this.parent;!e&&t;){if(t.silent){e=!0;break}t=t.parent}return e},e.prototype._updateAnimationTargets=function(){for(var e=0;e=0){var n=this.currentStates.slice();n.splice(t,1),this.useStates(n)}},e.prototype.replaceState=function(e,t,n){var i=this.currentStates.slice(),a=Hr(i,e),r=Hr(i,t)>=0;a>=0?r?i.splice(a,1):i[a]=t:n&&!r&&i.push(t),this.useStates(i)},e.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},e.prototype._mergeStates=function(e){for(var t,n={},i=0;i=0&&t.splice(n,1)})),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(e){this.markRedraw()},e.prototype.stopAnimation=function(e,t){for(var n=this.animators,i=n.length,a=[],r=0;r0&&n.during&&r[0].during((function(e,t){n.during(t)}));for(var u=0;u0||a.force&&!o.length){var S,C=void 0,_=void 0,T=void 0;if(s){_={},u&&(C={});for(b=0;b=0&&(n.splice(i,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=Hr(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,i=n[t];if(e&&e!==this&&e.parent!==this&&e!==i){n[t]=e,i.parent=null;var a=this.__zr;a&&i.removeSelfFromZr(a),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,i=Hr(n,e);return i<0||(n.splice(i,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh()),this},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;ne.value?null:{required:!0});var mt,ht,gt;e("GatewayLogLevel",mt),function(e){e.NONE="NONE",e.CRITICAL="CRITICAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e.DEBUG="DEBUG",e.TRACE="TRACE"}(mt||e("GatewayLogLevel",mt={})),e("GatewayVersion",ht),function(e){e.v3_8_5="3.8.5",e.v3_7_3="3.7.3",e.v3_7_2="3.7.2",e.v3_7_0="3.7",e.v3_6_3="3.6.3",e.v3_6_2="3.6.2",e.v3_6_0="3.6",e.v3_5_2="3.5.2",e.Legacy="legacy"}(ht||e("GatewayVersion",ht={})),e("ConnectorType",gt),function(e){e.MQTT="mqtt",e.MODBUS="modbus",e.GRPC="grpc",e.OPCUA="opcua",e.BLE="ble",e.REQUEST="request",e.CAN="can",e.BACNET="bacnet",e.ODBC="odbc",e.REST="rest",e.SNMP="snmp",e.FTP="ftp",e.SOCKET="socket",e.XMPP="xmpp",e.OCPP="ocpp",e.CUSTOM="custom",e.KNX="knx",e.S7="s7"}(gt||e("ConnectorType",gt={}));const ft=e("GatewayConnectorDefaultTypesTranslatesMap",new Map([[gt.MQTT,"MQTT"],[gt.MODBUS,"MODBUS"],[gt.GRPC,"GRPC"],[gt.OPCUA,"OPCUA"],[gt.BLE,"BLE"],[gt.REQUEST,"REQUEST"],[gt.CAN,"CAN"],[gt.BACNET,"BACNET"],[gt.ODBC,"ODBC"],[gt.REST,"REST"],[gt.SNMP,"SNMP"],[gt.FTP,"FTP"],[gt.SOCKET,"SOCKET"],[gt.XMPP,"XMPP"],[gt.OCPP,"OCPP"],[gt.CUSTOM,"CUSTOM"],[gt.KNX,"KNX"],[gt.S7,"S7"]])),yt=e("GatewayConnectorHelpLinksMap",new Map([[gt.MQTT,`${v}/docs/iot-gateway/config/mqtt/`],[gt.MODBUS,`${v}/docs/iot-gateway/config/modbus/`],[gt.OPCUA,`${v}/docs/iot-gateway/config/opc-ua/`],[gt.BLE,`${v}/docs/iot-gateway/config/ble/`],[gt.REQUEST,`${v}/docs/iot-gateway/config/request/`],[gt.CAN,`${v}/docs/iot-gateway/config/can/`],[gt.BACNET,`${v}/docs/iot-gateway/config/bacnet/`],[gt.ODBC,`${v}/docs/iot-gateway/config/odbc/`],[gt.REST,`${v}/docs/iot-gateway/config/rest/`],[gt.SNMP,`${v}/docs/iot-gateway/config/snmp/`],[gt.FTP,`${v}/docs/iot-gateway/config/ftp/`],[gt.SOCKET,`${v}/docs/iot-gateway/config/socket/`],[gt.XMPP,`${v}/docs/iot-gateway/config/xmpp/`],[gt.OCPP,`${v}/docs/iot-gateway/config/ocpp/`],[gt.KNX,`${v}/docs/iot-gateway/config/knx/`],[gt.S7,`${v}/docs/iot-gateway/config/s7/`]])),vt=e("ConnectorsTypesByVersion",new Map([[ht.v3_8_5,Object.values(gt)],[ht.v3_7_0,Object.values(gt).filter(e=>e!==gt.S7)],[ht.Legacy,Object.values(gt).filter(e=>![gt.KNX,gt.S7].includes(e))]]));var xt,bt;e("SocketEncoding",xt),function(e){e.UTF8="utf-8",e.HEX="hex",e.UTF16="utf-16",e.UTF32="utf-32",e.UTF16BE="utf-16-be",e.UTF16LE="utf-16-le",e.UTF32BE="utf-32-be",e.UTF32LE="utf-32-le"}(xt||e("SocketEncoding",xt={})),e("HTTPMethods",bt),function(e){e.DELETE="DELETE",e.GET="GET",e.HEAD="HEAD",e.OPTIONS="OPTIONS",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT"}(bt||e("HTTPMethods",bt={}));var wt,St={gateway:{active:"Active",address:"Address","address-required":"Address required","add-entry":"Add configuration","add-attribute":"Add attribute","add-attribute-update":"Add attribute update","add-attribute-request":"Add attribute request","add-key":"Add key","add-timeseries":"Add time series","add-mapping":"Add mapping","add-slave":"Add Slave",arguments:"Arguments","add-rpc-method":"Add method","add-rpc-request":"Add request","add-value":"Add argument","advanced-settings":"Advanced settings",application:"Application",bacnet:{"device-timeout":"Discovery timeout","network-number":"Network number","alt-responses-address":"Alternative responses address","apdu-length":"APDU Length","object-name":"Object Name","object-type":{"analog-input":"Analog Input","analog-output":"Analog Output","analog-value":"Analog Value","binary-input":"Binary Input","binary-output":"Binary Output","binary-value":"Binary Value"},"request-type":{label:"Request Type",write:"Write Property",read:"Read Property"},"property-id":{"present-value":"Present Value","status-flags":"Status Flags","cov-increment":"COV Increment","event-state":"Event State","out-of-service":"Out of Service",polarity:"Polarity","priority-array":"Priority Array","relinquish-default":"Relinquish Default","current-command-priority":"Current Command Priority","event-message-texts":"Event Message Texts","event-message-texts-config":"Event Message Texts Config","event-algorithm-inhibit-reference":"Event Algorithm Inhibit Reference","time-delay-normal":"Time Delay Normal"},segmentation:{label:"Segmentation",no:"None",both:"Both",transmit:"Transmit",receive:"Receive"}},baudrate:"Baudrate","buffer-size":"Buffer size","buffer-size-required":"Buffer size is required","buffer-size-range":"Buffer size should be greater than 0",bytesize:"Bytesize",boolean:"Boolean",bit:"Bit","bit-target-type":"Bit target type","delete-value":"Delete value","delete-argument":"Delete argument","delete-rpc-method":"Delete method","delete-rpc-request":"Delete request","delete-attribute-update":"Delete attribute update","delete-attribute-request":"Delete attribute request",advanced:"Advanced","add-device":"Add device","address-filter":"Address filter","address-filter-required":"Address filter is required","advanced-connection-settings":"Advanced connection settings","advanced-configuration-settings":"Advanced configuration settings",attributes:"Attributes","attribute-updates":"Attribute updates","attribute-on-platform":"Attribute on platform","attribute-requests":"Attribute requests","attribute-filter":"Attribute filter","attribute-filter-hint":"Filter for incoming attribute name from platform, supports regular expression.","attribute-filter-required":"Attribute filter required.","attribute-name-expression":"Attribute name expression","attribute-name-expression-required":"Attribute name expression required.","attribute-name-expression-hint":"Hint for Attribute name expression",basic:"Basic","byte-order":"Byte order","word-order":"Word order",broker:{connection:"Connection to broker",name:"Broker name","name-required":"Broker name required.","security-types":{anonymous:"Anonymous",basic:"Basic",certificates:"Certificates"}},certificate:"Certificate","CA-certificate-path":"Path to CA certificate file","path-to-CA-cert-required":"Path to CA certificate file is required.","change-connector-title":"Confirm connector change","change-connector-text":"Switching connectors will discard any unsaved changes. Continue?","checking-device-activity":"Checking device activity",command:"Docker commands","command-copied-message":"Docker command has been copied to clipboard",configuration:"Configuration","add-connector":"Add connector","delete-connector":"Delete connector","connector-add":"Add new connector","connector-enabled":"Enable connector","connector-name":"Connector name",connector:"Connector",converter:"Converter","connector-name-required":"Connector name is required.","connector-type":"Connector type","connector-type-required":"Connector type is required.",connectors:"Connectors","connectors-config":"Connectors configuration","connectors-table-enabled":"Enabled","connectors-table-name":"Name","connectors-table-type":"Type","connectors-table-status":"Status","connectors-table-actions":"Actions","connectors-table-key":"Key","connectors-table-class":"Class","connection-timeout":"Connection timeout (s)","connect-attempt-time":"Connect attempt time (ms)","connect-attempt-count":"Connect attempt count","copy-username":"Copy username","copy-password":"Copy password","copy-client-id":"Copy client ID","connector-created":"Connector created","connector-updated":"Connector updated","create-new-one":"Create new one!","rpc-command-save-template":"Save Template","rpc-command-send":"Send","rpc-command-result":"Response","rpc-command-edit-params":"Edit parameters","gateway-configuration":"General Configuration","docker-label":"Use the following instruction to run IoT Gateway in Docker compose with credentials for selected device","install-docker-compose":"Use the instructions to download, install and setup docker compose",integer:"Integer",inactive:"Inactive",device:"Device",devices:"Devices","device-profile":"Device profile","device-info-settings":"Device info settings","device-info":{"entity-field":"Entity field",source:"Source",expression:"Value / Expression","expression-hint":"Show help",name:"Name","profile-name":"Profile name","device-name-expression":"Device name expression","device-name-expression-required":"Device name expression is required.","device-profile-expression-required":"Device profile expression is required."},"device-name-filter":"Device name filter","device-name-filter-hint":"This field supports regular expressions to filter incoming data by device name.","device-name-filter-required":"Device name filter is required.",details:"Details","delete-mapping-title":"Are you sure you want to delete the mapping related with '{{name}}'?","delete-mapping-description":"Be careful, after the confirmation mapping configuration and all related data will become unrecoverable.","delete-slave-title":"Are you sure you want to delete the server '{{name}}'?","delete-slave-description":"Be careful, after the confirmation server configuration and all related data will become unrecoverable.","delete-device-title":"Are you sure you want to delete the device '{{name}}'?","delete-device-description":"Be careful, after the confirmation the device configuration and all related data will become unrecoverable.",divider:"Divider","download-configuration-file":"Download configuration file","download-docker-compose":"Download docker-compose.yml for your gateway","enable-remote-logging":"Enable remote logging","ellipsis-chips-text":"+ {{count}} more","launch-gateway":"Launch gateway","launch-docker-compose":"Start the gateway using the following command in the terminal from folder with docker-compose.yml file","logs-configuration":"Logs configuration","create-new-gateway":"Create a new gateway","create-new-gateway-text":"Are you sure you want create a new gateway with name: '{{gatewayName}}'?","created-time":"Created time","configuration-delete-dialog-header":"Configurations will be deleted","configuration-delete-dialog-body":"Turning off Remote Configuration is possible only if there is physical access to the Gateway. All previous configurations will be deleted.

\nTo turn off configuration, enter gateway name below","configuration-delete-dialog-input":"Gateway name","configuration-delete-dialog-input-required":"Gateway name is mandatory","configuration-delete-dialog-confirm":"Turn Off","connector-duplicate-name":"Connector with such name already exists.","connection-type":"Connection type","connector-side":"Connector side","payload-type":"Payload type","platform-side":"Platform side",JSON:"JSON","JSON-hint":"Converter for this payload type processes MQTT messages in JSON format. It uses JSON Path expressions to extract vital details such as device names, device profile names, attributes, and time series from the message. And regular expressions to get device details from topics.",byte:"Byte",bytes:"Bytes","bytes-hint":"Converter for this payload type designed for binary MQTT payloads, this converter directly interprets binary data to retrieve device names and device profile names, along with attributes and time series, using specific byte positions for data extraction.",custom:"Custom","custom-hint":"This option allows you to use a custom converter for specific data tasks. You need to add your custom converter to the extension folder and enter its class name in the UI settings. Any keys you provide will be sent as configuration to your custom converter.","client-cert-path":"Path to client certificate file","path-to-client-cert-required":"Path to client certificate file is required.","client-id":"Client ID","data-conversion":"Data conversion","data-mapping":"Data mapping","data-mapping-hint":"Data mapping provides the capability to parse and convert the data received from a MQTT client in incoming messages into specific attributes and time series data keys.","opcua-data-mapping-hint":"Data mapping provides the capability to parse and convert the data received from a OPCUA server into specific data keys.",delete:"Delete configuration","delete-attribute":"Delete attribute","delete-key":"Delete key","delete-timeseries":"Delete time series",default:"Default","device-node":"Device node","device-node-required":"Device node required.","device-node-hint":"Path or identifier for device node on OPC UA server. Relative paths from it for attributes and time series can be used.","device-name":"Device name","device-profile-label":"Device profile","device-name-required":"Device name required","device-profile-required":"Device profile required","download-tip":"Download configuration file","drop-file":"Drop file here or",enable:"Enable",encoding:"Encoding","enable-subscription":"Enable subscription",extension:"Extension","extension-hint":"Put your converter classname in the field. Custom converter with such class should be in extension/mqtt folder.","extension-required":"Extension is required.","extension-configuration":"Extension configuration","extension-configuration-hint":"Configuration for converter. These arguments will be passed as a config to convert function.","fill-connector-defaults":"Fill configuration with default values","fill-connector-defaults-hint":"This property allows to fill connector configuration with default values on it's creation.","from-device-request-settings":"Input request parsing","from-device-request-settings-hint":"These fields support JSONPath expressions to extract a name from incoming message.","function-code":"Function code","function-codes":{"read-coils":"01 - Read Coils","read-discrete-inputs":"02 - Read Discrete Inputs","read-multiple-holding-registers":"03 - Read Multiple Holding Registers","read-input-registers":"04 - Read Input Registers","write-single-coil":"05 - Write Single Coil","write-single-holding-register":"06 - Write Single Holding Register","write-multiple-coils":"15 - Write Multiple Coils","write-multiple-holding-registers":"16 - Write Multiple Holding Registers"},"to-device-response-settings":"Output request processing","to-device-response-settings-hint":"For these fields you can use the following variables and they will be replaced with actual values: ${deviceName}, ${attributeKey}, ${attributeValue}",gateway:"Gateway","gateway-exists":"Device with same name is already exists.","gateway-status":"Gateway status","gateway-name":"Gateway name","gateway-name-required":"Gateway name is required.","gateway-saved":"Gateway configuration successfully saved.","generate-client-id":"Generate Client ID",grpc:"GRPC","grpc-keep-alive-timeout":"Keep alive timeout (in ms)","grpc-keep-alive-timeout-required":"Keep alive timeout is required","grpc-keep-alive-timeout-min":"Keep alive timeout can not be less then 1","grpc-keep-alive-timeout-pattern":"Keep alive timeout is not valid","grpc-keep-alive":"Keep alive (in ms)","grpc-keep-alive-required":"Keep alive is required","grpc-keep-alive-min":"Keep alive can not be less then 1","grpc-keep-alive-pattern":"Keep alive is not valid","grpc-min-time-between-pings":"Min time between pings (in ms)","grpc-min-time-between-pings-required":"Min time between pings is required","grpc-min-time-between-pings-min":"Min time between pings can not be less then 1","grpc-min-time-between-pings-pattern":"Min time between pings is not valid","grpc-min-ping-interval-without-data":"Min ping interval without data (in ms)","grpc-min-ping-interval-without-data-required":"Min ping interval without data is required","grpc-min-ping-interval-without-data-min":"Min ping interval without data can not be less then 1","grpc-min-ping-interval-without-data-pattern":"Min ping interval without data is not valid","grpc-max-pings-without-data":"Max pings without data","grpc-max-pings-without-data-required":"Max pings without data is required","grpc-max-pings-without-data-min":"Max pings without data can not be less then 1","grpc-max-pings-without-data-pattern":"Max pings without data is not valid",info:"Info",identity:"Identity","inactivity-check-period-seconds":"Inactivity check period (in sec)","inactivity-check-period-seconds-required":"Inactivity check period is required","inactivity-check-period-seconds-min":"Inactivity check period can not be less then 1","inactivity-check-period-seconds-pattern":"Inactivity check period is not valid","inactivity-timeout-seconds":"Inactivity timeout (in sec)","inactivity-timeout-seconds-required":"Inactivity timeout is required","inactivity-timeout-seconds-min":"Inactivity timeout can not be less then 1","inactivity-timeout-seconds-pattern":"Inactivity timeout is not valid","unit-id":"Unit ID",host:"Host","host-required":"Host is required.",holding_registers:"Holding registers",coils_initializer:"Coils initializer",input_registers:"Input registers",discrete_inputs:"Discrete inputs","json-parse":"Not valid JSON.","json-required":"Field cannot be empty.","JSONPath-hint":"Supports constants and JSONPath expressions to extract data.",logs:{logs:"Logs",days:"days",hours:"hours",minutes:"minutes",seconds:"seconds","date-format":"Date format","date-format-required":"Date format required","log-format":"Log format","log-type":"Log type","log-format-required":"Log format required",columns:{general:"General",service:"Service",connection:"Connection",storage:"Storage",extension:"Extension"},remote:"Remote logging","remote-logs":"Remote logs",local:"Local logging",level:"Log level","file-path":"File path","file-path-required":"File path required","saving-period":"Log saving period","saving-period-min":"Log saving period can not be less then 1","saving-period-required":"Log saving period required","backup-count":"Backup count","backup-count-min":"Backup count can not be less then 1","backup-count-required":"Backup count required"},"max-number-of-workers":"Max number of workers","max-number-of-workers-hint":"Maximal number of workers threads for converters \n(The amount of workers changes dynamically, depending on load) \nRecommended amount 50-150.","max-number-of-workers-required":"Max number of workers is required.","max-messages-queue-for-worker":"Max messages queue per worker","max-messages-queue-for-worker-hint":"Maximal messages count that will be in the queue \nfor each converter worker.","max-messages-queue-for-worker-required":"Max messages queue per worker is required.",method:"Method","method-name":"Method name","method-required":"Method name is required.","min-pack-send-delay":"Min pack send delay (in ms)","min-pack-send-delay-required":"Min pack send delay is required","min-pack-send-delay-min":"Min pack send delay can not be less then 10","min-pack-send-delay-pattern":"Min pack send delay is not valid",multiplier:"Multiplier",mode:"Mode","model-name":"Model name",modifier:"Modifier","modifier-invalid":"Modifier is not valid","mqtt-version":"MQTT version",name:"Name","name-required":"Name is required.","network-mask":"Network mask","no-attributes":"No attributes","no-attribute-updates":"No attribute updates","no-attribute-requests":"No attribute requests","no-connectors":"No connectors","no-data":"No configurations","no-gateway-found":"No gateway found.","no-gateway-matching":" '{{item}}' not found.","no-timeseries":"No time series","no-keys":"No keys","no-value":"No arguments","no-rpc-methods":"No RPC methods","no-rpc-requests":"No RPC requests","path-hint":"The path is local to the gateway file system","path-logs":"Path to log files","path-logs-required":"Path is required.",password:"Password","password-required":"Password is required.","permit-without-calls":"Keep alive permit without calls","property-id":"Property ID","poll-period":"Poll period (ms)","poll-period-error":"Poll period should be at least {{min}} (ms).",port:"Port","port-required":"Port is required.","port-limits-error":"Port should be number from {{min}} to {{max}}.","private-key-path":"Path to private key file","path-to-private-key-required":"Path to private key file is required.",parity:"Parity","product-code":"Product code","product-name":"Product name",raw:"Raw",retain:"Retain","retain-hint":"This flag tells the broker to store the message for a topic\nand ensures any new client subscribing to that topic\nwill receive the stored message.",remote:"Remote configuration","remote-logging-level":"Logging level","remove-entry":"Remove configuration","remote-shell":"Remote shell","remote-configuration":"Remote Configuration","request-expression":"Request expression","request-expression-required":"Request expression is required",retries:"Retries","retries-on-empty":"Retries on empty","retries-on-invalid":"Retries on invalid",response:"Response",rest:{"add-http-header":"Add HTTP header","no-http-headers":"No HTTP headers","delete-http-header":"Delete HTTP header","ssl-verify":"SSL verify",endpoint:"Endpoint","http-methods":"HTTP methods","http-method":"HTTP method","on-error":"On error","on-success":"On success",tries:"Tries","http-headers":"HTTP headers","allow-redirects":"Allow redirects","request-url-expression":"Request URL expression","response-attribute":"Response attribute","response-expected":"Expected","response-type":{default:"Default",const:"Constant",advanced:"Advanced"}},rpc:{rpc:"RPC",title:"{{type}} Connector RPC parameters","templates-title":"Connector RPC Templates",methodFilter:"Method filter","method-name":"Method name",requestTopicExpression:"Request topic expression",responseTopicExpression:"Response topic expression",responseTimeout:"Response timeout",valueExpression:"Value expression",tag:"Tag",type:"Type",functionCode:"Function Code",objectsCount:"Objects Count",address:"Address",method:"Method",requestType:"Request Type",requestTimeout:"Request Timeout",deviceName:"Device name","loading-devices":"Loading devices...","devices-load-error":"Failed to load devices","no-devices-found":"No devices found",deviceType:"Device type",addressType:"Address type",data:"Data",dataType:"Data type",dbNumber:"DB number","db-number-required":"DB number is required.","db-number-min":"DB number must be greater than or equal to 0.",start:"Start","start-required":"Start is required.","start-min":"Start must be greater than or equal to 0.",size:"Size","size-required":"Size is required.","size-min":"Size must be greater than or equal to 0.",bit:"Bit","bit-required":"Bit is required.","bit-range":"Bit must be between 1 and 7.","tag-required":"Tag is required.","tag-pattern":"Tag is not valid.",vmAddress:"VM address","vm-address-required":"VM address is required.","vm-address-pattern":"VM address is not valid.",objectType:"Object type",identifier:"Identifier",propertyId:"Property ID",methodRPC:"Method RPC name",withResponse:"With Response",characteristicUUID:"Characteristic UUID",methodProcessing:"Method Processing",nodeID:"Node ID",isExtendedID:"Is Extended ID",isFD:"Is FD",bitrateSwitch:"Bitrate Switch",dataInHEX:"Data In HEX",dataLength:"Data Length",dataByteorder:"Data Byte Order",dataBefore:"Data Before",dataAfter:"Data After",dataExpression:"Data Expression",oid:"OID","add-oid":"Add OID","add-header":"Add header","add-security":"Add security",remove:"Remove",requestFilter:"Request Filter",requestUrlExpression:"Request URL Expression",httpMethod:"HTTP Method",timeout:"Timeout",tries:"Tries",httpHeaders:"HTTP Headers","header-name":"Header name",hint:{"modbus-response-reading":"RPC response will return all subtracted values from all connected devices when the reading functions are selected.","modbus-writing-functions":"RPC will write a filled value to all connected devices when the writing functions are selected.","opc-method":"A filled method name is the OPC-UA method that will processed on the server side (make sure your node has the requested method)."},"security-name":"Security name",value:"Value",security:"Security",responseValueExpression:"Response Value Expression",requestValueExpression:"Request Value Expression",arguments:"Arguments","add-argument":"Add argument","write-property":"Write property","read-property":"Read property","analog-output":"Analog output","analog-input":"Analog input","binary-output":"Binary output","binary-input":"Binary input","binary-value":"Binary value","analog-value":"Analog value",write:"Write",read:"Read",scan:"Scan",oids:"OIDS",set:"Set",multiset:"Multiset",get:"Get","bulk-walk":"Bulk walk",table:"Table","multi-get":"Multiget","get-next":"Get next","bulk-get":"Bulk get",walk:"Walk","save-template":"Save template","template-name":"Template name","template-name-required":"Template name is required.","template-name-duplicate":"Template with such name already exists, it will be updated.",command:"Command",params:"Params","json-value-invalid":"JSON value has an invalid format"},"rpc-methods":"RPC methods","rpc-requests":"RPC requests",request:{"connect-request":"Connect request","disconnect-request":"Disconnect request","attribute-request":"Attribute request","attribute-update":"Attribute update","rpc-connection":"RPC command"},"request-type":"Request type","request-timeout":"Request timeout (ms)","requests-mapping":"Requests mapping","requests-mapping-hint":"MQTT Connector requests allows you to connect, disconnect, process attribute requests from the device, handle attribute updates on the server and RPC processing configuration.","request-topic-expression":"Request topic expression","request-client-certificate":"Request client certificate","request-topic-expression-required":"Request topic expression is required.","response-timeout":"Response timeout","response-timeout-required":"Response timeout is required.","response-timeout-limits-error":"Timeout must be more then {{min}} ms.","response-topic-Qos":"Response topic QoS","response-topic-Qos-hint":"MQTT Quality of Service (QoS) is an agreement between the message sender and receiver that defines the level of delivery guarantee for a specific message.","response-topic-expression":"Response topic expression","response-topic-expression-required":"Response topic expression is required.","response-value-expression":"Response value expression","response-value-expression-required":"Response value expression is required.","vendor-name":"Vendor name","vendor-url":"Vendor URL",value:"Value",values:"Values","value-required":"Value is required.","value-pattern":"Value is not valid.","value-expression":"Value expression","value-expression-required":"Value expression is required.","with-response":"With response","without-response":"Without response",other:"Other",socket:"Socket","save-tip":"Save configuration file","scan-period":"Scan period (ms)","scan-period-error":"Scan period should be at least {{min}} (ms).","sub-check-period":"Subscription check period (ms)","sub-check-period-error":"Subscription check period should be at least {{min}} (ms).",security:"Security","security-policy":"Security policy","security-type":"Security type","security-types":{"access-token":"Access Token","username-password":"Username and Password",tls:"TLS","tls-access-token":"TLS + Access Token","tls-private-key":"TLS + Private Key"},"select-connector":"Select connector to display config","send-change-data":"Send data only on change","send-data-to-platform":"Send data to platform","send-data-on-change":"Send data only on change","send-change-data-hint":"The values will be saved to the database only if they are different from the corresponding values in the previous converted message. This functionality applies to both attributes and time series in the converter output.",server:"Server","server-hostname":"Server hostname","server-slave":"Server (Slave)","servers-slaves":"Servers (Slaves)","server-port":"Server port","server-url":"Server endpoint url","server-connection":"Server Connection","server-config":"Server configuration","server-slave-config":"Server (Slave) configuration","server-url-required":"Server endpoint url is required.",stopbits:"Stopbits",strict:"Strict",set:"Set","show-map":"Show map",statistics:{entry:"Statistic entry","custom-send-period":"Custom send period (in sec)","custom-send-period-pattern":"Custom send period is not valid","custom-send-period-min":"Custom send period can not be less then 60","custom-send-period-required":"Custom send period is required","create-command":"Create command",attributes:"Attributes","name-already-exists":"Attribute name already exists.",telemetry:"Telemetry","storage-message-count":"Storage message count","messages-from-platform":"Messages from platform","pushed-datapoints":"Pushed datapoints","messages-pulled-from-storage":"Messages pulled from storage","messages-pushed-to-platform":"Messages pushed to platform","messages-sent-to-platform":"Messages sent to platform","process-cpu-usage":"Gateway process CPU usage",memory:"Gateway process memory usage","machine-resources":"Machine resources","free-disk":"Free disk",statistic:"Statistic",statistics:"Statistics","general-statistics":"General statistics","custom-statistics":"Custom statistics","copy-message":"Copy message","statistic-commands-empty":'No configured statistic keys found. You can configure them in "Statistics" tab in general configuration.',"statistics-button":"Go to configuration",commands:"Commands",name:"Time series name","time-series-name-already-exists":"Time series name already exists.","send-period":"Statistic send period (in sec)","send-period-required":"Statistic send period is required","send-period-min":"Statistic send period can not be less then 60","send-period-pattern":"Statistic send period is not valid","check-connectors-configuration":"Check connectors configuration (in sec)",messages:"Messages","max-payload-size-bytes":"Max payload size in bytes","max-payload-size-bytes-required":"Max payload size in bytes is required","max-payload-size-bytes-min":"Max payload size in bytes can not be less then 100","max-payload-size-bytes-pattern":"Max payload size in bytes is not valid","min-pack-size-to-send":"Min packet size to send","min-pack-size-to-send-required":"Min packet size to send is required","min-pack-size-to-send-min":"Min packet size to send can not be less then 100","min-pack-size-to-send-pattern":"Min packet size to send is not valid","no-config-commands-found":"No configuration commands found","delete-command":"Delete command '{{command}}'?","delete-command-data":"All command data will be deleted.","edit-command":"Edit command","change-command-title":"Discard command change","change-command-text":"Cancelling command edit will discard any unsaved changes. Continue?","no-command-found":"No command found","no-commands-matching":"No command matching '{{command}}' were found.","check-connectors-configuration-required":"Check connectors configuration is required","check-connectors-configuration-min":"Check connectors configuration can not be less then 1","check-connectors-configuration-pattern":"Check connectors configuration is not valid","install-cmd":"Install command",add:"Add command",timeout:"Timeout (in sec)","timeout-required":"Timeout is required","timeout-min":"Timeout can not be less then 1","timeout-pattern":"Timeout is not valid","time-series-name-required":"Time series name is required","time-series-name-pattern":"Time series name is not valid",command:"Command","command-required":"Command is required","command-pattern":"Command is not valid",remove:"Remove command"},storage:"Storage","storage-max-files":"Maximum number of files","storage-max-files-min":"Minimum number is 1.","storage-max-files-pattern":"Number is not valid.","storage-max-files-required":"Number is required.","storage-max-records":"Maximum records in storage","storage-max-records-min":"Minimum number of records is 1.","storage-max-records-pattern":"Number is not valid.","storage-max-records-required":"Maximum records is required.","storage-read-record-count":"Read record count in storage","storage-read-record-count-min":"Minimum number of records is 1.","storage-read-record-count-pattern":"Number is not valid.","storage-read-record-count-required":"Read record count is required.","storage-max-read-record-count-storage":"Max read record count in storage","storage-max-read-record-count":"Max read record count","storage-max-read-record-count-min":"Minimum number of records is 1.","storage-max-read-record-count-pattern":"Number is not valid.","storage-max-read-record-count-required":"Max read record count is required.","storage-data-folder-path":"Data folder path","storage-data-folder-path-required":"Data folder path is required.","storage-data-folder-path-pattern":"Data folder path path path must start with './' and end with '/', without dots in folder names.","storage-pack-size":"Maximum event pack size","storage-pack-size-min":"Minimum number is 1.","storage-pack-size-pattern":"Number is not valid.","storage-pack-size-required":"Maximum event pack size is required.","storage-path":"Storage path","storage-path-required":"Storage path is required.","storage-path-pattern":"Storage path path must start with './' and end with '/', without dots in folder names.","storage-type":"Storage type","storage-types":{"file-storage":"File storage","memory-storage":"Memory storage",sqlite:"SQLITE"},suffix:{s:"s",ms:"ms"},"report-strategy":{label:"Report strategy","on-change":"On value change","on-report-period":"On report period","on-change-or-report-period":"On value change or report period","report-period":"Report period","on-received":"On received"},"source-type":{msg:"Message",topic:"Topic",const:"Constant",identifier:"Identifier",path:"Path",expression:"Expression",request:"From request"},"workers-settings":"Workers settings",thingsboard:"ThingsBoard",general:"General",timeseries:"Time series",key:"Key",keys:"Keys","key-required":"Key is required.","thingsboard-host":"Platform host","thingsboard-host-required":"Host is required.","thingsboard-port":"Platform port","thingsboard-port-max":"Maximum port number is 65535.","thingsboard-port-min":"Minimum port number is 1.","thingsboard-port-pattern":"Port is not valid.","thingsboard-port-required":"Port is required.",tidy:"Tidy","tidy-tip":"Tidy config JSON",timeout:"Timeout","timeout-error":"Timeout should be at least {{min}} (ms).","title-connectors-json":"Connector {{typeName}} configuration",type:"Type","topic-filter":"Topic filter","topic-required":"Topic filter is required.","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","tls-connection":"TLS Connection","master-connections":"Master Connections","method-filter":"Method filter","method-filter-hint":"Regular expression to filter incoming RPC method from platform.","method-filter-required":"Method filter is required.","messages-ttl-check-in-hours":"Messages TTL check in hours","messages-ttl-check-in-hours-required":"Messages TTL check in hours is required.","messages-ttl-check-in-hours-min":"Min number is 1.","messages-ttl-check-in-hours-pattern":"Number is not valid.","messages-ttl-in-days":"Messages TTL in days","messages-ttl-in-days-required":"Messages TTL in days is required.","messages-ttl-in-days-min":"Min number is 1.","messages-ttl-in-days-pattern":"Number is not valid.","size-limit":"Size limit","size-limit-hint":"Maximum size of each SQLite file in megabytes. When exceeded, triggers rotation to a new DB file.","size-limit-required":"Size limit is required.","size-limit-min":"Min size limit is 1.","size-limit-pattern":"Number is not valid.","max-db-amount":"Maximum DB amount","max-db-amount-hint":"Maximum number of rotated DB files to keep on disk. When reached, further writes are dropped until cleanup.","max-db-amount-required":"Maximum DB amount is required.","max-db-amount-min":"Min number is 1.","max-db-amount-pattern":"Number is not valid.","oversize-check-period":"Oversize check period","oversize-check-period-hint":"How frequently (in minutes) to check the current DB’s file size against size_limit.","oversize-check-period-required":"Oversize check period is required.","oversize-check-period-min":"Min number is 1.","oversize-check-period-pattern":"Number is not valid.","writing-batch-size":"Writing batch size","writing-batch-size-hint":"Maximum number of messages collected before writing to the DB during single write request.","writing-batch-size-required":"Writing batch size is required.","writing-batch-size-min":"Min number is 1.","writing-batch-size-pattern":"Number is not valid.","mqtt-qos":"QoS","mqtt-qos-required":"QoS is required","mqtt-qos-range":"QoS values range is from 0 to 1",qos:{"at-most-once":"0 - At most once","at-least-once":"1 - At least once","exactly-once":"2 - Exactly once"},"objects-count":"Objects count","object-id":"Object ID","objects-count-required":"Objects count is required","wait-after-failed-attempts":"Wait after failed attempts (ms)","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON",username:"Username","username-required":"Username is required.","unit-id-required":"Unit ID is required.","vendor-id":"Vendor ID","write-coil":"Write Coil","write-coils":"Write Coils","write-register":"Write Register","write-registers":"Write Registers","general-configuration-widget":{"general-configuration":"General configuration","connectors-configuration":"Connectors configuration",logs:"Logs",statistics:"Statistics","remote-shell":"Remote Shell",rpc:"RPC"},"statistics-nav-widget":{"storage-statistics":"Storage","machine-statistics":"Machine","custom-statistics":"Custom"},"status-widget":{status:"Status","gateway-name":"Gateway name","gateway-version":"Gateway version","gateway-type":"Gateway type",devices:"Devices","active-inactive":"(Active | Inactive)",connectors:"Connectors","enabled-disabled":"(Enabled | Disabled)",errors:"Errors"},hints:{"enable-general-statistics":"Enables gateway statistics (machine, storage, connectors).","enable-custom-statistics":"Enables collecting statistics using custom commands.","buffer-size":"Buffer size for received data blocks.",encoding:"Encoding used for writing received string data to storage.",method:"Name for method on a platform.","modbus-master":"Configuration sections for connecting to Modbus servers and reading data from them.","modbus-server":"Configuration section for the Modbus server, storing data and sending updates to the platform when changes occur or at fixed intervals.","remote-configuration":"Enables remote configuration and management of the gateway","remote-shell":"Enables remote control of the operating system with the gateway from the Remote Shell widget",host:"Hostname or IP address of platform server",port:"Port of MQTT service on platform server",token:"Access token for the gateway from platform server","client-id":"MQTT client id for the gateway form platform server",username:"MQTT username for the gateway form platform server",password:"MQTT password for the gateway form platform server","ca-cert":"Path to CA certificate file","date-form":"Date format in log message","object-id-required":"Object ID is required","vendor-id-required":"Vendor ID is required","data-folder":"Path to the folder that will contain data (Relative or Absolute)","log-format":"Log message format","remote-log":"Enables remote logging and logs reading from the gateway","backup-count":"If backup count is > 0, when a rollover is done, no more than backup count files are kept - the oldest ones are deleted",storage:"Provides configuration for saving incoming data before it is sent to the platform","max-file-count":"Maximum number of files that will be created","max-read-count":"Number of messages to retrieve from the storage and send to platform","max-records":"Maximum count of records that will be stored in one file","read-record-count":"Number of messages to retrieve from the storage and send to platform","max-records-count":"Maximum number of data entries in storage before sending to platform","ttl-check-hour":"How often will the Gateway check data for obsolescence","ttl-messages-day":"Maximum number of days that the storage will retain data","username-required-with-password":"Username required if password is specified",commands:"Commands for collecting additional statistic",attribute:"Statistic telemetry key",timeout:"Timeout for command executing",command:"The result of the command execution, will be used as the value for telemetry","check-device-activity":"Enables monitor the activity of each connected device","inactivity-timeout":"Time after whose the gateway will disconnect device","inactivity-period":"Periodicity of device activity check","minimal-pack-delay":"Delay between sending packs of messages (Decreasing this setting results in increased CPU usage)",qos:"Quality of Service in MQTT messaging (0 - at most once, 1 - at least once)","server-port":"Network port on which GRPC server will listen for incoming connections.","grpc-keep-alive-timeout":"Maximum time the server should wait for a keepalive ping response before considering the connection dead.","grpc-keep-alive":"Duration between two successive keepalive ping messages when there is no active RPC call.","grpc-min-time-between-pings":"Minimum amount of time the server should wait between sending keepalive ping messages","grpc-max-pings-without-data":"Maximum number of keepalive ping messages that the server can send without receiving any data before it considers the connection dead.","grpc-min-ping-interval-without-data":"Minimum amount of time the server should wait between sending keepalive ping messages when there is no data being sent or received.","permit-without-calls":"Allow server to keep the GRPC connection alive even when there are no active RPC calls.","path-in-os":"Path in gateway os.",memory:"Your data will be stored in the in-memory queue, it is a fastest but no persistence guarantee.",file:"Your data will be stored in separated files and will be saved even after the gateway restart.",sqlite:"Your data will be stored in file based database. And will be saved even after the gateway restart.","opc-timeout":"Timeout in milliseconds for connecting to OPC-UA server.","security-policy":"Security Policy defines the security mechanisms to be applied.","install-cmd":"Packages that will be installed for command executing.","scan-period":"Period in milliseconds to rescan the server.","sub-check-period":"Period to check the subscriptions in the OPC-UA server.","enable-subscription":"If true - the gateway will subscribe to interesting nodes and wait for data update and if false - the gateway will rescan OPC-UA server every scanPeriodInMillis.","show-map":"Show nodes on scanning.","method-name":"Name of method on OPC-UA server.",arguments:"Arguments for the method (will be overwritten by arguments from the RPC request).","min-pack-size-to-send":"Minimum package size for sending.","max-payload-size-bytes":"Maximum package size in bytes","poll-period":"Period in milliseconds to read data from nodes.","poll-period-required":"Poll period is required.","report-period-required":"Report period is required.","report-period-range":"Report period must be greater than 100.","timeout-pattern":"Timeout is not valid",rest:{"endpoint-required":"Endpoint is required.","endpoint-pattern":"Endpoint is not valid.","device-name-filter-required":"Device name filter is required.","device-name-filter-pattern":"Device name filter is not valid.","request-url-expression-required":"Request URL expression is required.","request-url-expression-pattern":"Request URL expression is not valid.","value-expression-required":"Value expression is required.","value-expression-pattern":"Value expression is not valid.","method-filter-required":"Method filter is required.","method-filter-pattern":"Method filter is not valid.","scope-type":"Attribute scope on platform.","tries-min":"Request tries number should be greater than 0.","tries-pattern":"Request tries is invalid.","http-methods-required":"HTTP methods are required.",host:"Domain or IP address of the server.",port:"Port on the server for listening clients connection.","ssl-verify":"Enable SSL certificate verification.",cert:"Path to the certificate file.",key:"Path to the private key file",endpoint:"Endpoint path on the server.","http-methods":"HTTP methods allowed for endpoint.","http-method":"Request to external URL HTTP method.",JSON:"Converter for this payload type processes REST messages in JSON format. It uses JSON Path expressions to extract vital details such as device names, device profile names, attributes, and time series from the request body.",extension:"Custom converter classname. File with this class should be in extension/rest folder.","response-attribute-required":"Response attribute is required.","response-attribute-pattern":"Response attribute is not valid.","update-ssl":"Verify SSL certificate on the external server.","attribute-filter":"Filter for incoming attribute name from platform, support regular expression.","value-expression":"Used to create request body for request to external server. Supports ${deviceName}, ${deviceType}, ${attributeName}, ${attributeValue} variables.","attribute-url-expression":"Used to create request URL for request to external server. Supports ${deviceName}, ${deviceType}, ${attributeName}, ${attributeValue} variables.","method-filter":"Filter for RPC requests from the platform based on the method name. Supports regular expressions.","attribute-name-expression-required":"Attribute name expression is required.","attribute-name-expression-pattern":"Attribute name expression is not valid.","attribute-filter-required":"Attribute filter is required.","attribute-filter-pattern":"Attribute filter is not valid."},socket:{"attribute-on-platform-required":"Attribute on platform is required","attribute-requests-type":"The type of requested attribute can be “shared” or “client.“","with-response":"Boolean flag that specifies whether to send a response back to platform.","key-telemetry":"Name for telemetry on platform.","key-attribute":"Name for attribute on platform."},modbus:{"bit-target-type":"The response type can be either an integer (1/0) or a boolean (True/False).",bit:"Specify the index of the bit to read from the array, or leave it blank to read the entire array.","max-bit":"The bit value must not exceed the objects count.","framer-type":"Type of a framer (Socket, RTU, or ASCII), if needed.",host:"Hostname or IP address of Modbus server.",port:"Modbus server port for connection.","unit-id":"Modbus slave ID.","connection-timeout":"Connection timeout (in seconds) for the Modbus server.","byte-order":"Byte order for reading data.","word-order":"Word order when reading multiple registers.",retries:"Retrying sending data to the master.","retries-on-empty":"Retry sending data to the master if the data is empty.","retries-on-invalid":"Retry sending data to the master if it fails.","poll-period":"Period in milliseconds to check attributes and telemetry on the slave.","connect-attempt-time":"A waiting period in milliseconds before establishing a connection to the master.","connect-attempt-count":"The number of connection attempts made through the gateway.","wait-after-failed-attempts":"A waiting period in milliseconds before attempting to send data to the master.","serial-port":"Serial port for connection.",baudrate:"Baud rate for the serial device.",stopbits:"The number of stop bits sent after each character in a message to indicate the end of the byte.",bytesize:"The number of bits in a byte of serial data. This can be one of 5, 6, 7, or 8.",parity:"The type of checksum used to verify data integrity. Options: (E)ven, (O)dd, (N)one.",strict:"Use inter-character timeout for baudrates ≤ 19200.","objects-count":"Depends on the selected type.",address:"Register address to verify.",key:"Key to be used as the attribute key for the platform instance.",method:"Method name to be used for the platform instance.","data-keys":"For more information about function codes and data types click on help icon",modifier:"The retrieved value will be adjusted (by multiplying or dividing it) based on the specified modifier value."},bacnet:{"object-id":"The gateway object identifier in the BACnet network.","vendor-id":"The gateway vendor identifier in the BACnet network","apdu-length":"Maximal length of the APDU.",segmentation:"Segmentation type for transmitting large BACnet messages.","key-object-id":"Object id in the BACnet device.","property-id":"Property id in the BACnet device.","request-type":"“writeProperty” to write data and “readProperty” to read data.","request-timeout":"Timeout to wait the response from the BACnet device, milliseconds.","device-timeout":"Period of time when the connector will try to discover BACnet devices.","network-number":"Identifier of the network segment."}}}},Ct={gateway:{"add-entry":"إضافة تكوين",advanced:"متقدم","checking-device-activity":"فحص نشاط الجهاز",command:"أوامر Docker","command-copied-message":"تم نسخ أمر Docker إلى الحافظة",configuration:"التكوين","connector-add":"إضافة موصل جديد","connector-enabled":"تمكين الموصل","connector-name":"اسم الموصل","connector-name-required":"اسم الموصل مطلوب.","connector-type":"نوع الموصل","connector-type-required":"نوع الموصل مطلوب.",connectors:"الموصلات","connectors-config":"تكوينات الموصلات","connectors-table-enabled":"ممكّن","connectors-table-name":"الاسم","connectors-table-type":"النوع","connectors-table-status":"الحالة","connectors-table-actions":"الإجراءات","connectors-table-key":"المفتاح","connectors-table-class":"الفئة","rpc-command-send":"إرسال","rpc-command-result":"الاستجابة","rpc-command-edit-params":"تحرير المعلمات","gateway-configuration":"تكوين عام","docker-label":"استخدم التعليمات التالية لتشغيل IoT Gateway في Docker compose مع بيانات اعتماد للجهاز المحدد","install-docker-compose":"استخدم التعليمات لتنزيل وتثبيت وإعداد docker compose","download-configuration-file":"تنزيل ملف التكوين","download-docker-compose":"تنزيل docker-compose.yml لبوابتك","launch-gateway":"تشغيل البوابة","launch-docker-compose":"بدء تشغيل البوابة باستخدام الأمر التالي في الطرفية من المجلد الذي يحتوي على ملف docker-compose.yml","create-new-gateway":"إنشاء بوابة جديدة","create-new-gateway-text":"هل أنت متأكد أنك تريد إنشاء بوابة جديدة باسم: '{{gatewayName}}'؟","created-time":"وقت الإنشاء","configuration-delete-dialog-header":"سيتم حذف التكوينات","configuration-delete-dialog-body":"يمكن تعطيل التكوين عن بُعد فقط إذا كان هناك وصول جسدي إلى البوابة. ستتم حذف جميع التكوينات السابقة.

\n لتعطيل التكوين، أدخل اسم البوابة أدناه","configuration-delete-dialog-input":"اسم البوابة","configuration-delete-dialog-input-required":"اسم البوابة إلزامي","configuration-delete-dialog-confirm":"إيقاف التشغيل",delete:"حذف التكوين","download-tip":"تنزيل ملف التكوين","drop-file":"أفلق الملف هنا أو",gateway:"البوابة","gateway-exists":"الجهاز بنفس الاسم موجود بالفعل.","gateway-name":"اسم البوابة","gateway-name-required":"اسم البوابة مطلوب.","gateway-saved":"تم حفظ تكوين البوابة بنجاح.",grpc:"GRPC","grpc-keep-alive-timeout":"مهلة البقاء على قيد الحياة (بالمللي ثانية)","grpc-keep-alive-timeout-required":"مهلة البقاء على قيد الحياة مطلوبة","grpc-keep-alive-timeout-min":"مهلة البقاء على قيد الحياة لا يمكن أن تكون أقل من 1","grpc-keep-alive-timeout-pattern":"مهلة البقاء على قيد الحياة غير صالحة","grpc-keep-alive":"البقاء على قيد الحياة (بالمللي ثانية)","grpc-keep-alive-required":"البقاء على قيد الحياة مطلوب","grpc-keep-alive-min":"البقاء على قيد الحياة لا يمكن أن يكون أقل من 1","grpc-keep-alive-pattern":"البقاء على قيد الحياة غير صالح","grpc-min-time-between-pings":"الحد الأدنى للوقت بين البينغات (بالمللي ثانية)","grpc-min-time-between-pings-required":"الحد الأدنى للوقت بين البينغات مطلوب","grpc-min-time-between-pings-min":"الحد الأدنى للوقت بين البينغات لا يمكن أن يكون أقل من 1","grpc-min-time-between-pings-pattern":"الحد الأدنى للوقت بين البينغات غير صالح","grpc-min-ping-interval-without-data":"الحد الأدنى لفاصل البينغ بدون بيانات (بالمللي ثانية)","grpc-min-ping-interval-without-data-required":"الحد الأدنى لفاصل البينغ بدون بيانات مطلوب","grpc-min-ping-interval-without-data-min":"الحد الأدنى لفاصل البينغ بدون بيانات لا يمكن أن يكون أقل من 1","grpc-min-ping-interval-without-data-pattern":"الحد الأدنى لفاصل البينغ بدون بيانات غير صالح","grpc-max-pings-without-data":"الحد الأقصى لعدد البينغات بدون بيانات","grpc-max-pings-without-data-required":"الحد الأقصى لعدد البينغات بدون بيانات مطلوب","grpc-max-pings-without-data-min":"الحد الأقصى لعدد البينغات بدون بيانات لا يمكن أن يكون أقل من 1","grpc-max-pings-without-data-pattern":"الحد الأقصى لعدد البينغات بدون بيانات غير صالح","inactivity-check-period-seconds":"فترة فحص الخمول (بالثواني)","inactivity-check-period-seconds-required":"فترة فحص الخمول مطلوبة","inactivity-check-period-seconds-min":"فترة فحص الخمول لا يمكن أن تكون أقل من 1","inactivity-check-period-seconds-pattern":"فترة فحص الخمول غير صالحة","inactivity-timeout-seconds":"فترة الخمول (بالثواني)","inactivity-timeout-seconds-required":"فترة الخمول مطلوبة","inactivity-timeout-seconds-min":"فترة الخمول لا يمكن أن تكون أقل من 1","inactivity-timeout-seconds-pattern":"فترة الخمول غير صالحة","json-parse":"JSON غير صالح.","json-required":"الحقل لا يمكن أن يكون فارغًا.",logs:{logs:"السجلات",days:"أيام",hours:"ساعات",minutes:"دقائق",seconds:"ثواني","date-format":"تنسيق التاريخ","date-format-required":"تنسيق التاريخ مطلوب","log-format":"تنسيق السجل","log-type":"نوع السجل","log-format-required":"تنسيق السجل مطلوب",remote:"التسجيل عن بُعد","remote-logs":"السجلات عن بُعد",local:"التسجيل المحلي",level:"مستوى السجل","file-path":"مسار الملف","file-path-required":"مسار الملف مطلوب","saving-period":"فترة حفظ السجل","saving-period-min":"فترة حفظ السجل لا يمكن أن تكون أقل من 1","saving-period-required":"فترة حفظ السجل مطلوبة","backup-count":"عدد النسخ الاحتياطية","backup-count-min":"عدد النسخ الاحتياطية لا يمكن أن يكون أقل من 1","backup-count-required":"عدد النسخ الاحتياطية مطلوب"},"min-pack-send-delay":"الحد الأدنى لتأخير إرسال الحزمة (بالمللي ثانية)","min-pack-send-delay-required":"الحد الأدنى لتأخير إرسال الحزمة مطلوب","min-pack-send-delay-min":"لا يمكن أن يكون الحد الأدنى لتأخير إرسال الحزمة أقل من 0","no-connectors":"لا توجد موصلات","no-data":"لا توجد تكوينات","no-gateway-found":"لم يتم العثور على بوابة.","no-gateway-matching":"'{{item}}' غير موجود.","path-logs":"مسار إلى ملفات السجل","path-logs-required":"المسار مطلوب.","permit-without-calls":"البقاء على الحياة يسمح بدون مكالمات",remote:"التكوين عن بُعد","remote-logging-level":"مستوى التسجيل","remove-entry":"إزالة التكوين","remote-shell":"قشرة عن بُعد","remote-configuration":"التكوين عن بُعد",other:"آخر","save-tip":"حفظ ملف التكوين","security-type":"نوع الأمان","security-types":{"access-token":"رمز الوصول","username-password":"اسم المستخدم وكلمة المرور",tls:"TLS","tls-access-token":"TLS + رمز الوصول","tls-private-key":"TLS + المفتاح الخاص"},"server-port":"منفذ الخادم",statistics:{statistic:"إحصائية",statistics:"الإحصائيات","statistic-commands-empty":"لا تتوفر إحصائيات",commands:"الأوامر","send-period":"فترة إرسال الإحصائيات (بالثواني)","send-period-required":"فترة إرسال الإحصائيات مطلوبة","send-period-min":"لا يمكن أن تكون فترة إرسال الإحصائيات أقل من 60","send-period-pattern":"فترة إرسال الإحصائيات غير صالحة","check-connectors-configuration":"فترة فحص تكوين الموصلات (بالثواني)","check-connectors-configuration-required":"فترة فحص تكوين الموصلات مطلوبة","check-connectors-configuration-min":"لا يمكن أن تكون فترة فحص تكوين الموصلات أقل من 1","check-connectors-configuration-pattern":"فترة فحص تكوين الموصلات غير صالحة",add:"إضافة أمر",timeout:"المهلة","timeout-required":"المهلة مطلوبة","timeout-min":"لا يمكن أن تكون المهلة أقل من 1","timeout-pattern":"المهلة غير صالحة","attribute-name":"اسم السمة","attribute-name-required":"اسم السمة مطلوب",command:"الأمر","command-required":"الأمر مطلوب","command-pattern":"الأمر غير صالح",remove:"إزالة الأمر"},storage:"التخزين","storage-max-file-records":"السجلات القصوى في الملف","storage-max-files":"الحد الأقصى لعدد الملفات","storage-max-files-min":"الحد الأدنى هو 1.","storage-max-files-pattern":"العدد غير صالح.","storage-max-files-required":"العدد مطلوب.","storage-max-records":"السجلات القصوى في التخزين","storage-max-records-min":"الحد الأدنى لعدد السجلات هو 1.","storage-max-records-pattern":"العدد غير صالح.","storage-max-records-required":"السجلات القصوى مطلوبة.","storage-read-record-count":"عدد قراءة السجلات في التخزين","storage-read-record-count-min":"الحد الأدنى لعدد السجلات هو 1.","storage-read-record-count-pattern":"العدد غير صالح.","storage-read-record-count-required":"عدد قراءة السجلات مطلوب.","storage-max-read-record-count":"الحد الأقصى لعدد قراءة السجلات في التخزين","storage-max-read-record-count-min":"الحد الأدنى لعدد السجلات هو 1.","storage-max-read-record-count-pattern":"العدد غير صالح.","storage-max-read-record-count-required":"عدد القراءة القصوى مطلوب.","storage-data-folder-path":"مسار مجلد البيانات","storage-data-folder-path-required":"مسار مجلد البيانات مطلوب.","storage-pack-size":"الحد الأقصى لحجم حزمة الحدث","storage-pack-size-min":"الحد الأدنى هو 1.","storage-pack-size-pattern":"العدد غير صالح.","storage-pack-size-required":"الحجم الأقصى لحزمة الحدث مطلوب.","storage-path":"مسار التخزين","storage-path-required":"مسار التخزين مطلوب.","storage-type":"نوع التخزين","storage-types":{"file-storage":"تخزين الملفات","memory-storage":"تخزين الذاكرة",sqlite:"SQLITE"},thingsboard:"ثينغزبورد",general:"عام","thingsboard-host":"مضيف ثينغزبورد","thingsboard-host-required":"المضيف مطلوب.","thingsboard-port":"منفذ ثينغزبورد","thingsboard-port-max":"الحد الأقصى لرقم المنفذ هو 65535.","thingsboard-port-min":"الحد الأدنى لرقم المنفذ هو 1.","thingsboard-port-pattern":"المنفذ غير صالح.","thingsboard-port-required":"المنفذ مطلوب.",tidy:"ترتيب","tidy-tip":"ترتيب تكوين JSON","title-connectors-json":"تكوين موصل {{typeName}}","tls-path-ca-certificate":"المسار إلى شهادة CA على البوابة","tls-path-client-certificate":"المسار إلى شهادة العميل على البوابة","messages-ttl-check-in-hours":"فحص TTL الرسائل بالساعات","messages-ttl-check-in-hours-required":"يجب تحديد فحص TTL الرسائل بالساعات.","messages-ttl-check-in-hours-min":"الحد الأدنى هو 1.","messages-ttl-check-in-hours-pattern":"الرقم غير صالح.","messages-ttl-in-days":"TTL الرسائل بالأيام","messages-ttl-in-days-required":"يجب تحديد TTL الرسائل بالأيام.","messages-ttl-in-days-min":"الحد الأدنى هو 1.","messages-ttl-in-days-pattern":"الرقم غير صالح.","mqtt-qos":"جودة الخدمة (QoS)","mqtt-qos-required":"جودة الخدمة (QoS) مطلوبة","mqtt-qos-range":"تتراوح قيم جودة الخدمة (QoS) من 0 إلى 1","tls-path-private-key":"المسار إلى المفتاح الخاص على البوابة","toggle-fullscreen":"تبديل وضع ملء الشاشة","transformer-json-config":"تكوين JSON*","update-config":"إضافة/تحديث تكوين JSON",hints:{"remote-configuration":"يمكنك تمكين التكوين وإدارة البوابة عن بُعد","remote-shell":"يمكنك تمكين التحكم البعيد في نظام التشغيل مع البوابة من عنصر واجهة المستخدم قشرة عن بُعد",host:"اسم المضيف أو عنوان IP لخادم ثينغزبورد",port:"منفذ خدمة MQTT على خادم ثينغزبورد",token:"رمز الوصول للبوابة من خادم ثينغزبورد","client-id":"معرف عميل MQTT للبوابة من خادم ثينغزبورد",username:"اسم المستخدم MQTT للبوابة من خادم ثينغزبورد",password:"كلمة المرور MQTT للبوابة من خادم ثينغزبورد","ca-cert":"المسار إلى ملف شهادة CA","date-form":"تنسيق التاريخ في رسالة السجل","data-folder":"المسار إلى المجلد الذي سيحتوي على البيانات (نسبي أو مطلق)","log-format":"تنسيق رسالة السجل","remote-log":"يمكنك تمكين التسجيل البعيد وقراءة السجلات من البوابة","backup-count":"إذا كان عدد النسخ الاحتياطية > 0، عند عملية تدوير، لا يتم الاحتفاظ بأكثر من عدد النسخ الاحتياطية المحددة - يتم حذف الأقدم",storage:"يوفر تكوينًا لحفظ البيانات الواردة قبل إرسالها إلى المنصة","max-file-count":"العدد الأقصى لعدد الملفات التي سيتم إنشاؤها","max-read-count":"عدد الرسائل للحصول عليها من التخزين وإرسالها إلى ثينغزبورد","max-records":"العدد الأقصى للسجلات التي ستخزن في ملف واحد","read-record-count":"عدد الرسائل للحصول عليها من التخزين وإرسالها إلى ثينغزبورد","max-records-count":"العدد الأقصى للبيانات في التخزين قبل إرسالها إلى ثينغزبورد","ttl-check-hour":"كم مرة سيتحقق البوابة من البيانات القديمة","ttl-messages-day":"الحد الأقصى لعدد الأيام التي ستحتفظ فيها التخزين بالبيانات",commands:"الأوامر لجمع الإحصائيات الإضافية",attribute:"مفتاح تلقي الإحصائيات",timeout:"مهلة زمنية لتنفيذ الأمر",command:"سيتم استخدام نتيجة تنفيذ الأمر كقيمة لتلقي الإحصائيات","check-device-activity":"يمكنك تمكين مراقبة نشاط كل جهاز متصل","inactivity-timeout":"الوقت بعد الذي ستفصل البوابة الجهاز","inactivity-period":"تكرار فحص نشاط الجهاز","minimal-pack-delay":"التأخير بين إرسال حزم الرسائل (يؤدي تقليل هذا الإعداد إلى زيادة استخدام وحدة المعالجة المركزية)",qos:"جودة الخدمة في رسائل MQTT (0 - على الأكثر مرة واحدة، 1 - على الأقل مرة واحدة)","server-port":"منفذ الشبكة الذي سيستمع فيه خادم GRPC للاستفسارات الواردة.","grpc-keep-alive-timeout":"الحد الأقصى للوقت الذي يجب أن ينتظره الخادم لاستجابة رسالة الحفاظ على الاتصال قبل اعتبار الاتصال ميتًا.","grpc-keep-alive":"المدة بين رسائل حفظ الاتصال المتعاقبة عند عدم وجود استدعاء RPC نشط.","grpc-min-time-between-pings":"الحد الأدنى للوقت الذي يجب فيه أن ينتظر الخادم بين إرسال رسائل حفظ الاتصال","grpc-max-pings-without-data":"الحد الأقصى لعدد رسائل حفظ الاتصال التي يمكن للخادم إرسالها دون تلقي أي بيانات قبل اعتبار الاتصال ميتًا.","grpc-min-ping-interval-without-data":"الحد الأدنى للوقت الذي يجب فيه أن ينتظر الخادم بين إرسال رسائل حفظ الاتصال عند عدم إرسال أو استلام بيانات.","permit-without-calls":"السماح للخادم بإبقاء اتصال GRPC حيًا حتى عندما لا تكون هناك استدعاءات RPC نشطة."}}},_t={gateway:{"add-entry":"Afegir configuració","connector-add":"Afegir conector","connector-enabled":"Activar conector","connector-name":"Nom conector","connector-name-required":"Cal nom conector.","connector-type":"Tipus conector","connector-type-required":"Cal tipus conector.",connectors:"Configuració de conectors","create-new-gateway":"Crear un gateway nou","create-new-gateway-text":"Crear un nou gateway amb el nom: '{{gatewayName}}'?",delete:"Esborrar configuració","download-tip":"Descarregar fitxer de configuració",gateway:"Gateway","gateway-exists":"Ja existeix un dispositiu amb el mateix nom.","gateway-name":"Nom de Gateway","gateway-name-required":"Cal un nom de gateway.","gateway-saved":"Configuració de gateway gravada satisfactòriament.","json-parse":"JSON no vàlid.","json-required":"El camp no pot ser buit.","no-connectors":"No hi ha conectors","no-data":"No hi ha configuracions","no-gateway-found":"No s'ha trobat cap gateway.","no-gateway-matching":" '{{item}}' no trobat.","path-logs":"Ruta als fitxers de log","path-logs-required":"Cal ruta.",remote:"Configuració remota","remote-logging-level":"Nivel de logging","remove-entry":"Esborrar configuració","save-tip":"Gravar fitxer de configuració","security-type":"Tipus de seguretat","security-types":{"access-token":"Token d'accés",tls:"TLS"},storage:"Grabació","storage-max-file-records":"Número màxim de registres en fitxer","storage-max-files":"Número màxim de fitxers","storage-max-files-min":"El número mínim és 1.","storage-max-files-pattern":"Número no vàlid.","storage-max-files-required":"Cal número.","storage-max-records":"Màxim de registres en el magatzem","storage-max-records-min":"El número mínim és 1.","storage-max-records-pattern":"Número no vàlid.","storage-max-records-required":"Cal número.","storage-pack-size":"Mida màxim de esdeveniments","storage-pack-size-min":"El número mínim és 1.","storage-pack-size-pattern":"Número no vàlid.","storage-pack-size-required":"Cal número.","storage-path":"Ruta de magatzem","storage-path-required":"Cal ruta de magatzem.","storage-type":"Tipus de magatzem","storage-types":{"file-storage":"Magatzem fitxer","memory-storage":"Magatzem en memoria"},thingsboard:"ThingsBoard","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"Cal Host.","thingsboard-port":"Port ThingsBoard","thingsboard-port-max":"El port màxim és 65535.","thingsboard-port-min":"El port mínim és 1.","thingsboard-port-pattern":"Port no vàlid.","thingsboard-port-required":"Cal port.",tidy:"Endreçat","tidy-tip":"Endreçat JSON","title-connectors-json":"Configuració conector {{typeName}}","tls-path-ca-certificate":"Ruta al certificat CA al gateway","tls-path-client-certificate":"Ruta al certificat client al gateway","tls-path-private-key":"Ruta a la clau privada al gateway","toggle-fullscreen":"Pantalla completa fullscreen","transformer-json-config":"Configuració JSON*","update-config":"Afegir/actualizar configuració JSON"}},Tt={gateway:{"add-entry":"Přidat konfiguraci","connector-add":"Přidat nový konektor","connector-enabled":"Povolit konektor","connector-name":"Název konektoru","connector-name-required":"Název konektoru je povinný.","connector-type":"Typ konektoru","connector-type-required":"Typ konektoru je povinný.",connectors:"Konfigurace konektoru","create-new-gateway":"Vytvořit novou bránu","create-new-gateway-text":"Jste si jisti, že chcete vytvořit novou bránu s názvem: '{{gatewayName}}'?",delete:"Smazat konfiguraci","download-tip":"Stáhnout soubor konfigurace",gateway:"Brána","gateway-exists":"Zařízení se shodným názvem již existuje.","gateway-name":"Název brány","gateway-name-required":"Název brány je povinný.","gateway-saved":"Konfigurace brány byla úspěšně uložena.","json-parse":"Neplatný JSON.","json-required":"Pole nemůže být prázdné.","no-connectors":"Žádné konektory","no-data":"Žádné konfigurace","no-gateway-found":"Žádné brány nebyly nalezeny.","no-gateway-matching":" '{{item}}' nenalezena.","path-logs":"Cesta k souborům logu","path-logs-required":"Cesta je povinná.",remote:"Vzdálená konfigurace","remote-logging-level":"Úroveň logování","remove-entry":"Odstranit konfiguraci","save-tip":"Uložit soubor konfigurace","security-type":"Typ zabezpečení","security-types":{"access-token":"Přístupový token",tls:"TLS"},storage:"Úložiště","storage-max-file-records":"Maximální počet záznamů v souboru","storage-max-files":"Maximální počet souborů","storage-max-files-min":"Minimální počet je 1.","storage-max-files-pattern":"Počet není platný.","storage-max-files-required":"Počet je povinný.","storage-max-records":"Maximální počet záznamů v úložišti","storage-max-records-min":"Minimální počet záznamů je 1.","storage-max-records-pattern":"Počet není platný.","storage-max-records-required":"Maximální počet záznamů je povinný.","storage-pack-size":"Maximální velikost souboru událostí","storage-pack-size-min":"Minimální počet je 1.","storage-pack-size-pattern":"Počet není platný.","storage-pack-size-required":"Maximální velikost souboru událostí je povinná.","storage-path":"Cesta k úložišti","storage-path-required":"Cesta k úložišti je povinná.","storage-type":"Typ úložiště","storage-types":{"file-storage":"Soubor","memory-storage":"Paměť"},thingsboard:"ThingsBoard","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"Host je povinný.","thingsboard-port":"Port ThingsBoard","thingsboard-port-max":"Maximální číslo portu je 65535.","thingsboard-port-min":"Minimální číslo portu je 1.","thingsboard-port-pattern":"Port není platný.","thingsboard-port-required":"Port je povinný.",tidy:"Uspořádat","tidy-tip":"Uspořádat JSON konfiguraci","title-connectors-json":"Konfigurace {{typeName}} konektoru","tls-path-ca-certificate":"Cesta k certifikátu CA brány","tls-path-client-certificate":"Cesta k certifikátu klienta brány","tls-path-private-key":"Cesta k privátnímu klíči brány","toggle-fullscreen":"Přepnout do režimu celé obrazovky","transformer-json-config":"JSON* konfigurace","update-config":"Přidat/editovat JSON konfiguraci"}},Et={gateway:{"add-entry":"Tilføj konfiguration","connector-add":"Tilføj ny stikforbindelse","connector-enabled":"Aktivér stikforbindelse","connector-name":"Navn på stikforbindelse","connector-name-required":"Navn på stikforbindelse er påkrævet.","connector-type":"Stikforbindelsestype","connector-type-required":"Stikforbindelsestype er påkrævet.",connectors:"Konfiguration af stikforbindelser","create-new-gateway":"Opret en ny gateway","create-new-gateway-text":"",delete:"Slet konfiguration","download-tip":"Download konfigurationsfil",gateway:"Gateway","gateway-exists":"Enhed med samme navn findes allerede.","gateway-name":"Gateway-navn","gateway-name-required":"Gateway-navn er påkrævet.","gateway-saved":"Gateway-konfigurationen blev gemt.","json-parse":"Ikke gyldig JSON.","json-required":"Feltet må ikke være tomt.","no-connectors":"Ingen stikforbindelser","no-data":"Ingen konfigurationer","no-gateway-found":"Ingen gateway fundet.","no-gateway-matching":"","path-logs":"Sti til logfiler","path-logs-required":"Sti er påkrævet.",remote:"Fjernkonfiguration","remote-logging-level":"Logføringsniveau","remove-entry":"Fjern konfiguration","save-tip":"Gem konfigurationsfil","security-type":"Sikkerhedstype","security-types":{"access-token":"Adgangstoken",tls:"TLS"},storage:"Lagring","storage-max-file-records":"Maks. antal poster i fil","storage-max-files":"Maks. antal filer","storage-max-files-min":"Min. antal er 1.","storage-max-files-pattern":"Antal er ikke gyldigt.","storage-max-files-required":"Antal er påkrævet.","storage-max-records":"Maks. antal poster i lagring","storage-max-records-min":"Min. antal poster er 1.","storage-max-records-pattern":"Antal er ikke gyldigt.","storage-max-records-required":"Maks. antal poster er påkrævet.","storage-pack-size":"Maks. antal pakkestørrelse for begivenhed","storage-pack-size-min":"Min. antal er 1.","storage-pack-size-pattern":"Antal er ikke gyldigt.","storage-pack-size-required":"Maks. antal pakkestørrelse for begivenhed er påkrævet.","storage-path":"Lagringssti","storage-path-required":"Lagringssti er påkrævet.","storage-type":"Lagringstype","storage-types":{"file-storage":"Lagring af filter","memory-storage":"Lagring af hukommelse"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard-vært","thingsboard-host-required":"Vært er påkrævet.","thingsboard-port":"ThingsBoard-port","thingsboard-port-max":"Maks. portnummer er 65535.","thingsboard-port-min":"Min. portnummer er 1.","thingsboard-port-pattern":"Port er ikke gyldig.","thingsboard-port-required":"Port er påkrævet.",tidy:"Tidy","tidy-tip":"Tidy konfig. JSON","title-connectors-json":"","tls-path-ca-certificate":"Sti til CA-certifikat på gateway","tls-path-client-certificate":"Sti til klientcertifikat på gateway","tls-path-private-key":"Sti til privat nøgle på gateway","toggle-fullscreen":"Skift til fuld skærm","transformer-json-config":"Konfiguration JSON*","update-config":"Tilføj/opdater konfiguration JSON"}},Mt={gateway:{"add-entry":"Añadir configuración",advanced:"Avanzado","checking-device-activity":"Probando actividad de dispositivo",command:"Comandos Docker","command-copied-message":"Se han copiado los comandos al portapapeles",configuration:"Configuración","connector-add":"Añadir conector","connector-enabled":"Activar conector","connector-name":"Nombre conector","connector-name-required":"Se requiere nombre conector.","connector-type":"Tipo conector","connector-type-required":"Se requiere tipo conector.",connectors:"Conectores","connectors-config":"Configuración de conectores","connectors-table-enabled":"Enabled","connectors-table-name":"Nombre","connectors-table-type":"Tipo","connectors-table-status":"Estado","connectors-table-actions":"Acciones","connectors-table-key":"Clave","connectors-table-class":"Clase","rpc-command-send":"Enviar","rpc-command-result":"Resultado","rpc-command-edit-params":"Editar parametros","gateway-configuration":"Configuración General","create-new-gateway":"Crear un gateway nuevo","create-new-gateway-text":"Crear un nuevo gateway con el nombre: '{{gatewayName}}'?","created-time":"Hora de creación","configuration-delete-dialog-header":"Las configuraciones se borrarán","configuration-delete-dialog-body":"Sólo es posible desactivar la configuración remota, si hay acceso físico al gateway. Se borrarán todas las configuraciones previas.

\nPara desactivar la configuración, introduce el nombre del gateway aquí","configuration-delete-dialog-input":"Nombre Gateway","configuration-delete-dialog-input-required":"Se requiere nombre de gateway","configuration-delete-dialog-confirm":"Desactivar",delete:"Borrar configuración","download-tip":"Descargar fichero de configuración","drop-file":"Arrastra un fichero o",gateway:"Gateway","gateway-exists":"Ya existe un dispositivo con el mismo nombre.","gateway-name":"Nombre de Gateway","gateway-name-required":"Se requiere un nombre de gateway.","gateway-saved":"Configuración de gateway grabada satisfactoriamente.",grpc:"GRPC","grpc-keep-alive-timeout":"Timeout Keep alive (en ms)","grpc-keep-alive-timeout-required":"Se requiere Timeout Keep alive","grpc-keep-alive-timeout-min":"El valor no puede ser menor de 1","grpc-keep-alive-timeout-pattern":"El valor no es válido","grpc-keep-alive":"Keep alive (en ms)","grpc-keep-alive-required":"Se requiere keep alive","grpc-keep-alive-min":"El valor no puede ser menor de 1","grpc-keep-alive-pattern":"El valor keep alive no es válido","grpc-min-time-between-pings":"Tiempo mínimo entre pings (en ms)","grpc-min-time-between-pings-required":"Se requiere tiempo mínimo entre pings","grpc-min-time-between-pings-min":"El valor no puede ser menor de 1","grpc-min-time-between-pings-pattern":"El valor de tiempo mínimo entre pings no es válido","grpc-min-ping-interval-without-data":"Intervalo mínimo sin datos (en ms)","grpc-min-ping-interval-without-data-required":"Se requiere intervalo","grpc-min-ping-interval-without-data-min":"El valor no puede ser menor de 1","grpc-min-ping-interval-without-data-pattern":"El valor de intervalo no es válido","grpc-max-pings-without-data":"Intervalo máximo sin datos","grpc-max-pings-without-data-required":"Se requiere intervalo","grpc-max-pings-without-data-min":"El valor no puede ser menor de 1","grpc-max-pings-without-data-pattern":"El valor de intervalo no es válido","inactivity-check-period-seconds":"Periodo de control de inactividad (en segundos)","inactivity-check-period-seconds-required":"Se requiere periodo","inactivity-check-period-seconds-min":"El valor no puede ser menor de 1","inactivity-check-period-seconds-pattern":"El valor del periodo no es válido","inactivity-timeout-seconds":"Timeout de inactividad (en segundos)","inactivity-timeout-seconds-required":"Se requiere timeout de inactividad","inactivity-timeout-seconds-min":"El valor no puede ser menor de 1","inactivity-timeout-seconds-pattern":"El valor de inactividad no es válido","json-parse":"JSON no válido.","json-required":"El campo no puede estar vacío.",logs:{logs:"Registros",days:"días",hours:"horas",minutes:"minutos",seconds:"segundos","date-format":"Formato de fecha","date-format-required":"Se requiere formato de fecha","log-format":"Formato de registro","log-type":"Tipo de registro","log-format-required":"Se requiere tipo de registro",remote:"Registro remoto","remote-logs":"Registro remoto",local:"Registro local",level:"Nivel de registro","file-path":"Ruta de fichero","file-path-required":"Se requiere ruta de fichero","saving-period":"Periodo de guardado de registros","saving-period-min":"El periodo no puede ser menor que 1","saving-period-required":"Se requiere periodo de guardado","backup-count":"Número de backups","backup-count-min":"El número de backups no puede ser menor que 1","backup-count-required":"Se requiere número de backups"},"min-pack-send-delay":"Tiempo de espera, envío de paquetes (en ms)","min-pack-send-delay-required":"Se requiere tiempo de espera","min-pack-send-delay-min":"El tiempo de espera no puede ser menor que 0","no-connectors":"No hay conectores","no-data":"No hay configuraciones","no-gateway-found":"No se ha encontrado ningún gateway.","no-gateway-matching":" '{{item}}' no encontrado.","path-logs":"Ruta a los archivos de log","path-logs-required":"Ruta requerida.","permit-without-calls":"Permitir Keep alive si llamadas",remote:"Configuración remota","remote-logging-level":"Nivel de logging","remove-entry":"Borrar configuración","remote-shell":"Consola remota","remote-configuration":"Configuración remota",other:"otros","save-tip":"Grabar fichero de configuración","security-type":"Tipo de seguridad","security-types":{"access-token":"Tóken de acceso","username-password":"Usuario y contraseña",tls:"TLS","tls-access-token":"TLS + Tóken de acceso","tls-private-key":"TLS + Clave privada"},"server-port":"Puerto del servidor",statistics:{statistic:"Estadística",statistics:"Estadísticas","statistic-commands-empty":"No hay estadísticas",commands:"Comandos","send-period":"Periodo de envío de estadísticas (en segundos)","send-period-required":"Se requiere periodo de envío","send-period-min":"El periodo de envío no puede ser menor de 60","send-period-pattern":"El periodo de envío no es válido","check-connectors-configuration":"Revisar configuración de conectores (en segundos)","check-connectors-configuration-required":"Se requiere un valor","check-connectors-configuration-min":"El valor no puede ser menor de 1","check-connectors-configuration-pattern":"La configuración no es válida",add:"Añadir comando",timeout:"Timeout","timeout-required":"Se requiere timeout","timeout-min":"El timeout no puede ser menor de 1","timeout-pattern":"El timeout no es válido","attribute-name":"Nombre de atributo","attribute-name-required":"Se requiere nombre de atributo",command:"Comando","command-required":"Se requiere comando",remove:"Borrar comando"},storage:"Grabación","storage-max-file-records":"Número máximo de registros en fichero","storage-max-files":"Número máximo de ficheros","storage-max-files-min":"El número mínimo es 1.","storage-max-files-pattern":"Número no válido.","storage-max-files-required":"Se requiere número.","storage-max-records":"Máximo de registros en el almacén","storage-max-records-min":"El número mínimo es 1.","storage-max-records-pattern":"Número no válido.","storage-max-records-required":"Se requiere número.","storage-read-record-count":"Leer número de entradas en almacén","storage-read-record-count-min":"El número mínimo de entradas es 1.","storage-read-record-count-pattern":"El número no es válido.","storage-read-record-count-required":"Se requiere número de entradas.","storage-max-read-record-count":"Número máximo de entradas en el almacén","storage-max-read-record-count-min":"El número mínimo es 1.","storage-max-read-record-count-pattern":"El número no es válido","storage-max-read-record-count-required":"Se requiere número máximo de entradas.","storage-data-folder-path":"Ruta de carpeta de datos","storage-data-folder-path-required":"Se requiere ruta.","storage-pack-size":"Tamaño máximo de eventos","storage-pack-size-min":"El número mínimo es 1.","storage-pack-size-pattern":"Número no válido.","storage-pack-size-required":"Se requiere número.","storage-path":"Ruta de almacén","storage-path-required":"Se requiere ruta de almacén.","storage-type":"Tipo de almacén","storage-types":{"file-storage":"Almacén en fichero","memory-storage":"Almacén en memoria",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"General","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"Se requiere Host.","thingsboard-port":"Puerto ThingsBoard","thingsboard-port-max":"El puerto máximo es 65535.","thingsboard-port-min":"El puerto mínimo es 1.","thingsboard-port-pattern":"Puerto no válido.","thingsboard-port-required":"Se requiere puerto.",tidy:"Tidy","tidy-tip":"Tidy JSON","title-connectors-json":"Configuración conector {{typeName}}","tls-path-ca-certificate":"Ruta al certificado CA en el gateway","tls-path-client-certificate":"Ruta al certificado cliente en el gateway","messages-ttl-check-in-hours":"Comprobación de TTL de mensajes en horas","messages-ttl-check-in-hours-required":"Campo requerido.","messages-ttl-check-in-hours-min":"El mínimo es 1.","messages-ttl-check-in-hours-pattern":"El número no es válido.","messages-ttl-in-days":"TTL (Time to live) de mensages en días","messages-ttl-in-days-required":"Se requiere TTL de mensajes.","messages-ttl-in-days-min":"El número mínimo es 1.","messages-ttl-in-days-pattern":"El número no es válido.","mqtt-qos":"QoS","mqtt-qos-required":"Se requiere QoS","mqtt-qos-range":"El rango de valores es desde 0 a 1","tls-path-private-key":"Ruta a la clave privada en el gateway","toggle-fullscreen":"Pantalla completa fullscreen","transformer-json-config":"Configuración JSON*","update-config":"Añadir/actualizar configuración JSON",hints:{"remote-configuration":"Habilita la administración y configuración remota del gateway","remote-shell":"Habilita el control remoto del sistema operativo del gateway desde el widget terminal remoto",host:"Hostname o dirección IP del servidor Thingsboard",port:"Puerto del servicio MQTT en el servidor Thingsboard",token:"Access token para el gateway","client-id":"ID de cliente MQTT para el gateway",username:"Usuario MQTT para el gateway",password:"Contraseña MQTT para el gateway","ca-cert":"Ruta al fichero del certificado CA","date-form":"Formato de fecha en los mensajes de registro","data-folder":"Ruta a la carpeta que contendrá los datos (Relativa o absoluta)","log-format":"Formato de mensajes en registro","remote-log":"Habilita el registro remoto y la posterior lectura desde el gateway","backup-count":"Si el contaje de copias de seguridad es mayor que 0, cuando se realice una renovación, no se conservan más que los archivos de recuento de copias de seguridad, los más antíguos se eliminarán",storage:"Provee la configuración para el grabado de datos entrantes antes de que se envíen a la plataforma","max-file-count":"Número máximo de ficheros que se crearán","max-read-count":"Númeo máximo de mensajes a obtener desde el disco y enviados a la plataforma","max-records":"Número máximo de registros que se guardarán en un solo fichero","read-record-count":"Número de mensages a obtener desde el almacenamiento y enviados a la plataforma","max-records-count":"Número máximo de datos en almacenamiento antes de enviar a la plataforma","ttl-check-hour":"Con qué frecuencia el gateway comprobará si los datos están obsoletos","ttl-messages-day":"Número máximo de días para la retención de datos en el almacén",commands:"Comandos para recoger estadísticas adicionales",attribute:"Clave de telemetría para estadísticas",timeout:"Timeout para la ejecución de comandos",command:"El resultado de la ejecución del comando, se usará como valor para la telemetría","check-device-activity":"Habilita la monitorización de cada uno de los dispositivos conectados","inactivity-timeout":"Tiempo tras que el gateway desconectará el dispositivo","inactivity-period":"Periodo de monitorización de actividad en el dispositivo","minimal-pack-delay":"Tiempo de espera entre envío de paquetes de mensajes (Un valor muy bajo, resultará en un aumento de uso de la CPU en el gateway)",qos:"Quality of Service en los mensajes MQTT (0 - at most once, 1 - at least once)","server-port":"Puerto de red en el cual el servidor GRPC escuchará conexiones entrantes.","grpc-keep-alive-timeout":"Tiempo máximo, el cual el servidor esperara un ping keepalive antes de considerar la conexión terminada.","grpc-keep-alive":"Duración entre dos pings keepalive cuando no haya llamada RPC activa.","grpc-min-time-between-pings":"Mínimo tiempo que el servidor debe esperar entre envíos de mensajes de ping","grpc-max-pings-without-data":"Número máximo de pings keepalive que el servidor puede enviar sin recibir ningún dato antes de considerar la conexión terminada.","grpc-min-ping-interval-without-data":"Mínimo tiempo que el servidor debe esperar entre envíos de ping keepalive cuando no haya ningún dato en envío o recepción.","permit-without-calls":"Permitir al servidor mantener la conexión GRPC abierta, cuando no haya llamadas RPC activas."}}},It={gateway:{"add-entry":"설정 추가","connector-add":"새로운 연결자 추가","connector-enabled":"Enable connector","connector-name":"Connector name","connector-name-required":"Connector name is required.","connector-type":"Connector type","connector-type-required":"Connector type is required.",connectors:"Connectors configuration","create-new-gateway":"Create a new gateway","create-new-gateway-text":"Are you sure you want create a new gateway with name: '{{gatewayName}}'?",delete:"Delete configuration","download-tip":"Download configuration file",gateway:"Gateway","gateway-exists":"Device with same name is already exists.","gateway-name":"Gateway name","gateway-name-required":"Gateway name is required.","gateway-saved":"Gateway configuration successfully saved.","json-parse":"Not valid JSON.","json-required":"Field cannot be empty.","no-connectors":"No connectors","no-data":"No configurations","no-gateway-found":"No gateway found.","no-gateway-matching":" '{{item}}' not found.","path-logs":"Path to log files","path-logs-required":"Path is required.",remote:"Remote configuration","remote-logging-level":"Logging level","remove-entry":"Remove configuration","save-tip":"Save configuration file","security-type":"Security type","security-types":{"access-token":"Access Token",tls:"TLS"},storage:"Storage","storage-max-file-records":"Maximum records in file","storage-max-files":"Maximum number of files","storage-max-files-min":"Minimum number is 1.","storage-max-files-pattern":"Number is not valid.","storage-max-files-required":"Number is required.","storage-max-records":"Maximum records in storage","storage-max-records-min":"Minimum number of records is 1.","storage-max-records-pattern":"Number is not valid.","storage-max-records-required":"Maximum records is required.","storage-pack-size":"Maximum event pack size","storage-pack-size-min":"Minimum number is 1.","storage-pack-size-pattern":"Number is not valid.","storage-pack-size-required":"Maximum event pack size is required.","storage-path":"Storage path","storage-path-required":"Storage path is required.","storage-type":"Storage type","storage-types":{"file-storage":"File storage","memory-storage":"Memory storage"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard host","thingsboard-host-required":"Host is required.","thingsboard-port":"ThingsBoard port","thingsboard-port-max":"Maximum port number is 65535.","thingsboard-port-min":"Minimum port number is 1.","thingsboard-port-pattern":"Port is not valid.","thingsboard-port-required":"Port is required.",tidy:"Tidy","tidy-tip":"Tidy config JSON","title-connectors-json":"Connector {{typeName}} configuration","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON"}},kt={gateway:{"add-entry":"Add configuration",advanced:"Advanced","checking-device-activity":"Checking device activity",command:"Docker commands","command-copied-message":"Docker command has been copied to clipboard",configuration:"Configuration","connector-add":"Add new connector","connector-enabled":"Enable connector","connector-name":"Connector name","connector-name-required":"Connector name is required.","connector-type":"Connector type","connector-type-required":"Connector type is required.",connectors:"Connectors","connectors-config":"Connectors configuration","connectors-table-enabled":"Enabled","connectors-table-name":"Name","connectors-table-type":"Type","connectors-table-status":"Status","connectors-table-actions":"Actions","connectors-table-key":"Key","connectors-table-class":"Class","rpc-command-send":"Send","rpc-command-result":"Result","rpc-command-edit-params":"Edit parameters","gateway-configuration":"General Configuration","docker-label":"In order to run ThingsBoard IoT gateway in docker with credentials for this device you can use the following commands.","create-new-gateway":"Create a new gateway","create-new-gateway-text":"Are you sure you want create a new gateway with name: '{{gatewayName}}'?","created-time":"Created time","configuration-delete-dialog-header":"Configurations will be deleted","configuration-delete-dialog-body":"Turning off Remote Configuration is possible only if there is physical access to the Gateway. All previous configurations will be deleted.

\nTo turn off configuration, enter gateway name below","configuration-delete-dialog-input":"Gateway name","configuration-delete-dialog-input-required":"Gateway name is mandatory","configuration-delete-dialog-confirm":"Turn Off",delete:"Delete configuration","download-tip":"Download configuration file","drop-file":"Drop file here or",gateway:"Gateway","gateway-exists":"Device with same name is already exists.","gateway-name":"Gateway name","gateway-name-required":"Gateway name is required.","gateway-saved":"Gateway configuration successfully saved.",grpc:"GRPC","grpc-keep-alive-timeout":"Keep alive timeout (in ms)","grpc-keep-alive-timeout-required":"Keep alive timeout is required","grpc-keep-alive-timeout-min":"Keep alive timeout can not be less then 1","grpc-keep-alive-timeout-pattern":"Keep alive timeout is not valid","grpc-keep-alive":"Keep alive (in ms)","grpc-keep-alive-required":"Keep alive is required","grpc-keep-alive-min":"Keep alive can not be less then 1","grpc-keep-alive-pattern":"Keep alive is not valid","grpc-min-time-between-pings":"Min time between pings (in ms)","grpc-min-time-between-pings-required":"Min time between pings is required","grpc-min-time-between-pings-min":"Min time between pings can not be less then 1","grpc-min-time-between-pings-pattern":"Min time between pings is not valid","grpc-min-ping-interval-without-data":"Min ping interval without data (in ms)","grpc-min-ping-interval-without-data-required":"Min ping interval without data is required","grpc-min-ping-interval-without-data-min":"Min ping interval without data can not be less then 1","grpc-min-ping-interval-without-data-pattern":"Min ping interval without data is not valid","grpc-max-pings-without-data":"Max pings without data","grpc-max-pings-without-data-required":"Max pings without data is required","grpc-max-pings-without-data-min":"Max pings without data can not be less then 1","grpc-max-pings-without-data-pattern":"Max pings without data is not valid","inactivity-check-period-seconds":"Inactivity check period (in sec)","inactivity-check-period-seconds-required":"Inactivity check period is required","inactivity-check-period-seconds-min":"Inactivity check period can not be less then 1","inactivity-check-period-seconds-pattern":"Inactivity check period is not valid","inactivity-timeout-seconds":"Inactivity timeout (in sec)","inactivity-timeout-seconds-required":"Inactivity timeout is required","inactivity-timeout-seconds-min":"Inactivity timeout can not be less then 1","inactivity-timeout-seconds-pattern":"Inactivity timeout is not valid","json-parse":"Not valid JSON.","json-required":"Field cannot be empty.",logs:{logs:"Logs",days:"days",hours:"hours",minutes:"minutes",seconds:"seconds","date-format":"Date format","date-format-required":"Date format required","log-format":"Log format","log-type":"Log type","log-format-required":"Log format required",remote:"Remote logging","remote-logs":"Remote logs",local:"Local logging",level:"Log level","file-path":"File path","file-path-required":"File path required","saving-period":"Log saving period","saving-period-min":"Log saving period can not be less then 1","saving-period-required":"Log saving period required","backup-count":"Backup count","backup-count-min":"Backup count can not be less then 1","backup-count-required":"Backup count required"},"min-pack-send-delay":"Min pack send delay (in ms)","min-pack-send-delay-required":"Min pack send delay is required","min-pack-send-delay-min":"Min pack send delay can not be less then 0","no-connectors":"No connectors","no-data":"No configurations","no-gateway-found":"No gateway found.","no-gateway-matching":" '{{item}}' not found.","path-logs":"Path to log files","path-logs-required":"Path is required.","permit-without-calls":"Keep alive permit without calls",remote:"Remote configuration","remote-logging-level":"Logging level","remove-entry":"Remove configuration","remote-shell":"Remote shell","remote-configuration":"Remote Configuration",other:"Other","save-tip":"Save configuration file","security-type":"Security type","security-types":{"access-token":"Access Token","username-password":"Username and Password",tls:"TLS","tls-access-token":"TLS + Access Token","tls-private-key":"TLS + Private Key"},"server-port":"Server port",statistics:{statistic:"Statistic",statistics:"Statistics","statistic-commands-empty":"No statistics available",commands:"Commands","send-period":"Statistic send period (in sec)","send-period-required":"Statistic send period is required","send-period-min":"Statistic send period can not be less then 60","send-period-pattern":"Statistic send period is not valid","check-connectors-configuration":"Check connectors configuration (in sec)","check-connectors-configuration-required":"Check connectors configuration is required","check-connectors-configuration-min":"Check connectors configuration can not be less then 1","check-connectors-configuration-pattern":"Check connectors configuration is not valid",add:"Add command",timeout:"Timeout","timeout-required":"Timeout is required","timeout-min":"Timeout can not be less then 1","timeout-pattern":"Timeout is not valid","attribute-name":"Attribute name","attribute-name-required":"Attribute name is required",command:"Command","command-required":"Command is required",remove:"Remove command"},storage:"Storage","storage-max-file-records":"Maximum records in file","storage-max-files":"Maximum number of files","storage-max-files-min":"Minimum number is 1.","storage-max-files-pattern":"Number is not valid.","storage-max-files-required":"Number is required.","storage-max-records":"Maximum records in storage","storage-max-records-min":"Minimum number of records is 1.","storage-max-records-pattern":"Number is not valid.","storage-max-records-required":"Maximum records is required.","storage-read-record-count":"Read record count in storage","storage-read-record-count-min":"Minimum number of records is 1.","storage-read-record-count-pattern":"Number is not valid.","storage-read-record-count-required":"Read record count is required.","storage-max-read-record-count":"Max read record count in storage","storage-max-read-record-count-min":"Minimum number of records is 1.","storage-max-read-record-count-pattern":"Number is not valid.","storage-max-read-record-count-required":"Max Read record count is required.","storage-data-folder-path":"Data folder path","storage-data-folder-path-required":"Data folder path is required.","storage-pack-size":"Maximum event pack size","storage-pack-size-min":"Minimum number is 1.","storage-pack-size-pattern":"Number is not valid.","storage-pack-size-required":"Maximum event pack size is required.","storage-path":"Storage path","storage-path-required":"Storage path is required.","storage-type":"Storage type","storage-types":{"file-storage":"File storage","memory-storage":"Memory storage",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"General","thingsboard-host":"ThingsBoard host","thingsboard-host-required":"Host is required.","thingsboard-port":"ThingsBoard port","thingsboard-port-max":"Maximum port number is 65535.","thingsboard-port-min":"Minimum port number is 1.","thingsboard-port-pattern":"Port is not valid.","thingsboard-port-required":"Port is required.",tidy:"Tidy","tidy-tip":"Tidy config JSON","title-connectors-json":"Connector {{typeName}} configuration","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","messages-ttl-check-in-hours":"Messages TTL check in hours","messages-ttl-check-in-hours-required":"Messages TTL check in hours is required.","messages-ttl-check-in-hours-min":"Min number is 1.","messages-ttl-check-in-hours-pattern":"Number is not valid.","messages-ttl-in-days":"Messages TTL in days","messages-ttl-in-days-required":"Messages TTL in days is required.","messages-ttl-in-days-min":"Min number is 1.","messages-ttl-in-days-pattern":"Number is not valid.","mqtt-qos":"QoS","mqtt-qos-required":"QoS is required","mqtt-qos-range":"QoS values range is from 0 to 1","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON",hints:{"remote-configuration":"Enables remote configuration and management of the gateway","remote-shell":"Enables remote control of the operating system with the gateway from the Remote Shell widget",host:"Hostname or IP address of ThingsBoard server",port:"Port of MQTT service on ThingsBoard server",token:"Access token for the gateway from ThingsBoard server","client-id":"MQTT client id for the gateway form ThingsBoard server",username:"MQTT username for the gateway form ThingsBoard server",password:"MQTT password for the gateway form ThingsBoard server","ca-cert":"Path to CA certificate file","date-form":"Date format in log message","data-folder":"Path to folder, that will contains data (Relative or Absolute)","log-format":"Log message format","remote-log":"Enables remote logging and logs reading from the gateway","backup-count":"If backup count is > 0, when a rollover is done, no more than backup count files are kept - the oldest ones are deleted",storage:"Provides configuration for saving incoming data before it is sent to the platform","max-file-count":"Maximum count of file that will be created","max-read-count":"Count of messages to get from storage and send to ThingsBoard","max-records":"Maximum count of records that will be stored in one file","read-record-count":"Count of messages to get from storage and send to ThingsBoard","max-records-count":"Maximum count of data in storage before send to ThingsBoard","ttl-check-hour":"How often will Gateway check data for obsolescence","ttl-messages-day":"Maximum days that storage will save data",commands:"Commands for collecting additional statistic",attribute:"Statistic telemetry key",timeout:"Timeout for command executing",command:"The result of the command execution, will be used as the value for telemetry","check-device-activity":"Enables monitor the activity of each connected device","inactivity-timeout":"Time after whose the gateway will disconnect device","inactivity-period":"Periodicity of device activity check","minimal-pack-delay":"Delay between sending packs of messages (Decreasing this setting results in increased CPU usage)",qos:"Quality of Service in MQTT messaging (0 - at most once, 1 - at least once)","server-port":"Network port on which GRPC server will listen for incoming connections.","grpc-keep-alive-timeout":"Maximum time the server should wait for a keepalive ping response before considering the connection dead.","grpc-keep-alive":"Duration between two successive keepalive ping messages when there is no active RPC call.","grpc-min-time-between-pings":"Minimum amount of time the server should wait between sending keepalive ping messages","grpc-max-pings-without-data":"Maximum number of keepalive ping messages that the server can send without receiving any data before it considers the connection dead.","grpc-min-ping-interval-without-data":"Minimum amount of time the server should wait between sending keepalive ping messages when there is no data being sent or received.","permit-without-calls":"Allow server to keep the GRPC connection alive even when there are no active RPC calls."}}},Pt={gateway:{"add-entry":"Configuratie toevoegen","connector-add":"Nieuwe connector toevoegen","connector-enabled":"Connector inschakelen","connector-name":"Naam van de connector","connector-name-required":"De naam van de connector is vereist.","connector-type":"Type aansluiting","connector-type-required":"Het type connector is vereist.",connectors:"Configuratie van connectoren","create-new-gateway":"Een nieuwe gateway maken","create-new-gateway-text":"Weet u zeker dat u een nieuwe gateway wilt maken met de naam: '{{gatewayName}}'?",delete:"Configuratie verwijderen","download-tip":"Configuratiebestand downloaden",gateway:"Gateway","gateway-exists":"Device met dezelfde naam bestaat al.","gateway-name":"Naam van de gateway","gateway-name-required":"De naam van de gateway is vereist.","gateway-saved":"Gatewayconfiguratie succesvol opgeslagen.","json-parse":"Ongeldige JSON.","json-required":"Het veld mag niet leeg zijn.","no-connectors":"Geen connectoren","no-data":"Geen configuraties","no-gateway-found":"Geen gateway gevonden.","no-gateway-matching":"'{{item}}' niet gevonden.","path-logs":"Pad naar logbestanden","path-logs-required":"Pad is vereist.",remote:"Configuratie op afstand","remote-logging-level":"Registratie niveau","remove-entry":"Configuratie verwijderen","save-tip":"Configuratiebestand opslaan","security-type":"Soort beveiliging","security-types":{"access-token":"Toegang tot token",tls:"TLS (TLS)"},storage:"Opslag","storage-max-file-records":"Maximum aantal records in bestand","storage-max-files":"Maximaal aantal bestanden","storage-max-files-min":"Minimum aantal is 1.","storage-max-files-pattern":"Nummer is niet geldig.","storage-max-files-required":"Nummer is vereist.","storage-max-records":"Maximum aantal records in opslag","storage-max-records-min":"Minimum aantal records is 1.","storage-max-records-pattern":"Nummer is niet geldig.","storage-max-records-required":"Maximale records zijn vereist.","storage-pack-size":"Maximale pakketgrootte voor events","storage-pack-size-min":"Minimum aantal is 1.","storage-pack-size-pattern":"Nummer is niet geldig.","storage-pack-size-required":"De maximale pakketgrootte van het event is vereist.","storage-path":"Opslag pad","storage-path-required":"Opslagpad is vereist.","storage-type":"Type opslag","storage-types":{"file-storage":"Opslag van bestanden","memory-storage":"Geheugen opslag"},thingsboard:"Dingen Bord","thingsboard-host":"ThingsBoard-gastheer","thingsboard-host-required":"Server host is vereist.","thingsboard-port":"ThingsBoard-poort","thingsboard-port-max":"Het maximale poortnummer is 65535.","thingsboard-port-min":"Het minimale poortnummer is 1.","thingsboard-port-pattern":"Poort is niet geldig.","thingsboard-port-required":"Poort is vereist.",tidy:"Ordelijk","tidy-tip":"Opgeruimde configuratie JSON","title-connectors-json":"Configuratie van connector {{typeName}}","tls-path-ca-certificate":"Pad naar CA-certificaat op gateway","tls-path-client-certificate":"Pad naar clientcertificaat op gateway","tls-path-private-key":"Pad naar privésleutel op gateway","toggle-fullscreen":"Volledig scherm in- en uitschakelen","transformer-json-config":"Configuratie JSON*","update-config":"Configuratie JSON toevoegen/bijwerken"}},Dt={gateway:{"add-entry":"Dodaj konfigurację",advanced:"Advanced","checking-device-activity":"Checking device activity",command:"Docker commands","command-copied-message":"Docker command has been copied to clipboard",configuration:"Configuration","connector-add":"Dodaj nowe złącze","connector-enabled":"Włącz złącze","connector-name":"Nazwa złącza","connector-name-required":"Nazwa złącza jest wymagana.","connector-type":"Typ złącza","connector-type-required":"Typ złącza jest wymagany.",connectors:"Konfiguracja złączy","connectors-config":"Connectors configuration","connectors-table-enabled":"Enabled","connectors-table-name":"Name","connectors-table-type":"Type","connectors-table-status":"Status","connectors-table-actions":"Actions","connectors-table-key":"Key","connectors-table-class":"Class","rpc-command-send":"Send","rpc-command-result":"Result","rpc-command-edit-params":"Edit parameters","gateway-configuration":"General Configuration","docker-label":"In order to run ThingsBoard IoT gateway in docker with credentials for this device you can use the following commands.","create-new-gateway":"Utwórz nowy gateway","create-new-gateway-text":"Czy na pewno chcesz utworzyć nowy gateway o nazwie: '{{gatewayName}}'?","created-time":"Created time","configuration-delete-dialog-header":"Configurations will be deleted","configuration-delete-dialog-body":"Turning off Remote Configuration is possible only if there is physical access to the Gateway. All previous configurations will be deleted.

\nTo turn off configuration, enter gateway name below","configuration-delete-dialog-input":"Gateway name","configuration-delete-dialog-input-required":"Gateway name is mandatory","configuration-delete-dialog-confirm":"Turn Off",delete:"Usuń konfigurację","download-tip":"Pobierz plik konfiguracyjny","drop-file":"Drop file here or",gateway:"Wejście","gateway-exists":"Urządzenie o tej samej nazwie już istnieje.","gateway-name":"Nazwa Gateway","gateway-name-required":"Nazwa Gateway'a jest wymagana.","gateway-saved":"Konfiguracja Gatewey'a została pomyślnie zapisana.",grpc:"GRPC","grpc-keep-alive-timeout":"Keep alive timeout (in ms)","grpc-keep-alive-timeout-required":"Keep alive timeout is required","grpc-keep-alive-timeout-min":"Keep alive timeout can not be less then 1","grpc-keep-alive-timeout-pattern":"Keep alive timeout is not valid","grpc-keep-alive":"Keep alive (in ms)","grpc-keep-alive-required":"Keep alive is required","grpc-keep-alive-min":"Keep alive can not be less then 1","grpc-keep-alive-pattern":"Keep alive is not valid","grpc-min-time-between-pings":"Min time between pings (in ms)","grpc-min-time-between-pings-required":"Min time between pings is required","grpc-min-time-between-pings-min":"Min time between pings can not be less then 1","grpc-min-time-between-pings-pattern":"Min time between pings is not valid","grpc-min-ping-interval-without-data":"Min ping interval without data (in ms)","grpc-min-ping-interval-without-data-required":"Min ping interval without data is required","grpc-min-ping-interval-without-data-min":"Min ping interval without data can not be less then 1","grpc-min-ping-interval-without-data-pattern":"Min ping interval without data is not valid","grpc-max-pings-without-data":"Max pings without data","grpc-max-pings-without-data-required":"Max pings without data is required","grpc-max-pings-without-data-min":"Max pings without data can not be less then 1","grpc-max-pings-without-data-pattern":"Max pings without data is not valid","inactivity-check-period-seconds":"Inactivity check period (in sec)","inactivity-check-period-seconds-required":"Inactivity check period is required","inactivity-check-period-seconds-min":"Inactivity check period can not be less then 1","inactivity-check-period-seconds-pattern":"Inactivity check period is not valid","inactivity-timeout-seconds":"Inactivity timeout (in sec)","inactivity-timeout-seconds-required":"Inactivity timeout is required","inactivity-timeout-seconds-min":"Inactivity timeout can not be less then 1","inactivity-timeout-seconds-pattern":"Inactivity timeout is not valid","json-parse":"Nieprawidłowy JSON.","json-required":"Pole nie może być puste.",logs:{logs:"Logs",days:"days",hours:"hours",minutes:"minutes",seconds:"seconds","date-format":"Date format","date-format-required":"Date format required","log-format":"Log format","log-type":"Log type","log-format-required":"Log format required",remote:"Remote logging","remote-logs":"Remote logs",local:"Local logging",level:"Log level","file-path":"File path","file-path-required":"File path required","saving-period":"Log saving period","saving-period-min":"Log saving period can not be less then 1","saving-period-required":"Log saving period required","backup-count":"Backup count","backup-count-min":"Backup count can not be less then 1","backup-count-required":"Backup count required"},"min-pack-send-delay":"Min pack send delay (in ms)","min-pack-send-delay-required":"Min pack send delay is required","min-pack-send-delay-min":"Min pack send delay can not be less then 0","no-connectors":"Brak złączy","no-data":"Brak konfiguracji","no-gateway-found":"Nie znaleziono gateway'a.","no-gateway-matching":" '{{item}}' nie znaleziono.","path-logs":"Ścieżka do plików dziennika","path-logs-required":"Ścieżka jest wymagana.","permit-without-calls":"Keep alive permit without calls",remote:"Zdalna konfiguracja","remote-logging-level":"Poziom logowania","remove-entry":"Usuń konfigurację","remote-shell":"Remote shell","remote-configuration":"Remote Configuration",other:"Other","save-tip":"Zapisz plik konfiguracyjny","security-type":"Rodzaj zabezpieczenia","security-types":{"access-token":"Token dostępu","username-password":"Username and Password",tls:"TLS","tls-access-token":"TLS + Access Token","tls-private-key":"TLS + Private Key"},"server-port":"Server port",statistics:{statistic:"Statistic",statistics:"Statistics","statistic-commands-empty":"No statistics available",commands:"Commands","send-period":"Statistic send period (in sec)","send-period-required":"Statistic send period is required","send-period-min":"Statistic send period can not be less then 60","send-period-pattern":"Statistic send period is not valid","check-connectors-configuration":"Check connectors configuration (in sec)","check-connectors-configuration-required":"Check connectors configuration is required","check-connectors-configuration-min":"Check connectors configuration can not be less then 1","check-connectors-configuration-pattern":"Check connectors configuration is not valid",add:"Add command",timeout:"Timeout","timeout-required":"Timeout is required","timeout-min":"Timeout can not be less then 1","timeout-pattern":"Timeout is not valid","attribute-name":"Attribute name","attribute-name-required":"Attribute name is required",command:"Command","command-required":"Command is required",remove:"Remove command"},storage:"Składowanie","storage-max-file-records":"Maksymalna liczba rekordów w pliku","storage-max-files":"Maksymalna liczba plików","storage-max-files-min":"Minimalna liczba to 1.","storage-max-files-pattern":"Numer jest nieprawidłowy.","storage-max-files-required":"Numer jest wymagany.","storage-max-records":"Maksymalna liczba rekordów w pamięci","storage-max-records-min":"Minimalna liczba rekordów to 1.","storage-max-records-pattern":"Numer jest nieprawidłowy.","storage-max-records-required":"Maksymalna liczba rekordów jest wymagana.","storage-read-record-count":"Read record count in storage","storage-read-record-count-min":"Minimum number of records is 1.","storage-read-record-count-pattern":"Number is not valid.","storage-read-record-count-required":"Read record count is required.","storage-max-read-record-count":"Max read record count in storage","storage-max-read-record-count-min":"Minimum number of records is 1.","storage-max-read-record-count-pattern":"Number is not valid.","storage-max-read-record-count-required":"Max Read record count is required.","storage-data-folder-path":"Data folder path","storage-data-folder-path-required":"Data folder path is required.","storage-pack-size":"Maksymalny rozmiar pakietu wydarzeń","storage-pack-size-min":"Minimalna liczba to 1.","storage-pack-size-pattern":"Numer jest nieprawidłowy.","storage-pack-size-required":"Maksymalny rozmiar pakietu wydarzeń jest wymagany.","storage-path":"Ścieżka przechowywania","storage-path-required":"Ścieżka do przechowywania jest wymagana.","storage-type":"Typ składowania","storage-types":{"file-storage":"Nośnik danych","memory-storage":"Przechowywanie pamięci",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"General","thingsboard-host":"Gospodarz ThingsBoard","thingsboard-host-required":"Host jest wymagany.","thingsboard-port":"Port ThingsBoard","thingsboard-port-max":"Maksymalny numer portu to 65535.","thingsboard-port-min":"Minimalny numer portu to 1.","thingsboard-port-pattern":"Port jest nieprawidłowy.","thingsboard-port-required":"Port jest wymagany.",tidy:"Uporządkuj","tidy-tip":"Uporządkowana konfiguracja JSON","title-connectors-json":"Złącze {{typeName}} konfiguracja","tls-path-ca-certificate":"Ścieżka do certyfikatu CA na gateway","tls-path-client-certificate":"Ścieżka do certyfikatu klienta na gateway","messages-ttl-check-in-hours":"Messages TTL check in hours","messages-ttl-check-in-hours-required":"Messages TTL check in hours is required.","messages-ttl-check-in-hours-min":"Min number is 1.","messages-ttl-check-in-hours-pattern":"Number is not valid.","messages-ttl-in-days":"Messages TTL in days","messages-ttl-in-days-required":"Messages TTL in days is required.","messages-ttl-in-days-min":"Min number is 1.","messages-ttl-in-days-pattern":"Number is not valid.","mqtt-qos":"QoS","mqtt-qos-required":"QoS is required","mqtt-qos-range":"QoS values range is from 0 to 1","tls-path-private-key":"Ścieżka do klucza prywatnego na bramce","toggle-fullscreen":"Przełącz tryb pełnoekranowy","transformer-json-config":"Konfiguracja JSON*","update-config":"Dodaj/zaktualizuj konfigurację JSON",hints:{"remote-configuration":"Enables remote configuration and management of the gateway","remote-shell":"Enables remote control of the operating system with the gateway from the Remote Shell widget",host:"Hostname or IP address of ThingsBoard server",port:"Port of MQTT service on ThingsBoard server",token:"Access token for the gateway from ThingsBoard server","client-id":"MQTT client id for the gateway form ThingsBoard server",username:"MQTT username for the gateway form ThingsBoard server",password:"MQTT password for the gateway form ThingsBoard server","ca-cert":"Path to CA certificate file","date-form":"Date format in log message","data-folder":"Path to folder, that will contains data (Relative or Absolute)","log-format":"Log message format","remote-log":"Enables remote logging and logs reading from the gateway","backup-count":"If backup count is > 0, when a rollover is done, no more than backup count files are kept - the oldest ones are deleted",storage:"Provides configuration for saving incoming data before it is sent to the platform","max-file-count":"Maximum count of file that will be created","max-read-count":"Count of messages to get from storage and send to ThingsBoard","max-records":"Maximum count of records that will be stored in one file","read-record-count":"Count of messages to get from storage and send to ThingsBoard","max-records-count":"Maximum count of data in storage before send to ThingsBoard","ttl-check-hour":"How often will Gateway check data for obsolescence","ttl-messages-day":"Maximum days that storage will save data",commands:"Commands for collecting additional statistic",attribute:"Statistic telemetry key",timeout:"Timeout for command executing",command:"The result of the command execution, will be used as the value for telemetry","check-device-activity":"Enables monitor the activity of each connected device","inactivity-timeout":"Time after whose the gateway will disconnect device","inactivity-period":"Periodicity of device activity check","minimal-pack-delay":"Delay between sending packs of messages (Decreasing this setting results in increased CPU usage)",qos:"Quality of Service in MQTT messaging (0 - at most once, 1 - at least once)","server-port":"Network port on which GRPC server will listen for incoming connections.","grpc-keep-alive-timeout":"Maximum time the server should wait for a keepalive ping response before considering the connection dead.","grpc-keep-alive":"Duration between two successive keepalive ping messages when there is no active RPC call.","grpc-min-time-between-pings":"Minimum amount of time the server should wait between sending keepalive ping messages","grpc-max-pings-without-data":"Maximum number of keepalive ping messages that the server can send without receiving any data before it considers the connection dead.","grpc-min-ping-interval-without-data":"Minimum amount of time the server should wait between sending keepalive ping messages when there is no data being sent or received.","permit-without-calls":"Allow server to keep the GRPC connection alive even when there are no active RPC calls."}}},At={gateway:{"add-entry":"Adicionar configuração","connector-add":"Adicionar novo conector","connector-enabled":"Habilitar conector","connector-name":"Nome do conector","connector-name-required":"O nome do conector é obrigatório.","connector-type":"Tipo de conector","connector-type-required":"O tipo de conector é obrigatório.",connectors:"Configuração de conectores","create-new-gateway":"Criar um novo gateway","create-new-gateway-text":"Tem certeza de que deseja criar um novo gateway com o nome: '{{gatewayName}}'?",delete:"Excluir configuração","download-tip":"Download de arquivo de configuração",gateway:"Gateway","gateway-exists":"Já existe um dispositivo com o mesmo nome.","gateway-name":"Nome do gateway","gateway-name-required":"O nome do gateway é obrigatório.","gateway-saved":"A configuração do gateway foi salva corretamente.","json-parse":"JSON inválido.","json-required":"O campo não pode estar em branco.","no-connectors":"Sem conectores","no-data":"Sem configurações","no-gateway-found":"Nenhum gateway encontrado.","no-gateway-matching":" '{{item}}' não encontrado.","path-logs":"Caminho para arquivos de log","path-logs-required":"O caminho é obrigatório",remote:"Configuração remota","remote-logging-level":"Nível de registro em log","remove-entry":"Remover configuração","save-tip":"Salvar arquivo de configuração","security-type":"Tipo de segurança","security-types":{"access-token":"Token de Acesso",tls:"TLS"},storage:"Armazenamento","storage-max-file-records":"Número máximo de registros em arquivo","storage-max-files":"Número máximo de arquivos","storage-max-files-min":"O número mínimo é 1.","storage-max-files-pattern":"O número não é válido.","storage-max-files-required":"O número é obrigatório.","storage-max-records":"Número máximo de registros em armazenamento","storage-max-records-min":"O número mínimo de registros é 1.","storage-max-records-pattern":"O número não é válido.","storage-max-records-required":"O número máximo de registros é obrigatório.","storage-pack-size":"Tamanho máximo de pacote de eventos","storage-pack-size-min":"O número mínimo é 1.","storage-pack-size-pattern":"O número não é válido.","storage-pack-size-required":"O tamanho máximo de pacote de eventos é obrigatório.","storage-path":"Caminho de armazenamento","storage-path-required":"O caminho de armazenamento é obrigatório.","storage-type":"Tipo de armazenamento","storage-types":{"file-storage":"Armazenamento de arquivo","memory-storage":"Armazenamento de memória"},thingsboard:"ThingsBoard","thingsboard-host":"Host ThingsBoard","thingsboard-host-required":"O host é obrigatório.","thingsboard-port":"Porta ThingsBoard","thingsboard-port-max":"O número máximo de portas é 65535.","thingsboard-port-min":"O número mínimo de portas é 1.","thingsboard-port-pattern":"A porta não é válida.","thingsboard-port-required":"A porta é obrigatória.",tidy:"Tidy","tidy-tip":"Config Tidy JSON","title-connectors-json":"Configuração do conector {{typeName}}","tls-path-ca-certificate":"Caminho para certificado de Autoridade de Certificação no gateway","tls-path-client-certificate":"Caminho para certificado de cliente no gateway","tls-path-private-key":"Caminho para chave privada no gateway","toggle-fullscreen":"Alternar tela inteira","transformer-json-config":"Configuração JSON*","update-config":"Adicionar/atualizar configuração de JSON"}},Ot={gateway:{"add-entry":"Dodaj konfiguracijo","connector-add":"Dodaj nov priključek","connector-enabled":"Omogoči priključek","connector-name":"Ime priključka","connector-name-required":"Ime priključka je obvezno.","connector-type":"Vrsta priključka","connector-type-required":"Zahteva se vrsta priključka.",connectors:"Konfiguracija priključkov","create-new-gateway":"Ustvari nov prehod","create-new-gateway-text":"Ali ste prepričani, da želite ustvariti nov prehod z imenom: '{{gatewayName}}'?",delete:"Izbriši konfiguracijo","download-tip":"Prenos konfiguracijske datoteke",gateway:"Prehod","gateway-exists":"Naprava z istim imenom že obstaja.","gateway-name":"Ime prehoda","gateway-name-required":"Ime prehoda je obvezno.","gateway-saved":"Konfiguracija prehoda je uspešno shranjena.","json-parse":"Neveljaven JSON.","json-required":"Polje ne sme biti prazno.","no-connectors":"Ni priključkov","no-data":"Brez konfiguracij","no-gateway-found":"Prehod ni najden.","no-gateway-matching":" '{{item}}' ni mogoče najti.","path-logs":"Pot do dnevniških datotek","path-logs-required":"Pot je obvezna.",remote:"Oddaljena konfiguracija","remote-logging-level":"Raven beleženja","remove-entry":"Odstrani konfiguracijo","save-tip":"Shrani konfiguracijsko datoteko","security-type":"Vrsta zaščite","security-types":{"access-token":"Dostopni žeton",tls:"TLS"},storage:"Shramba","storage-max-file-records":"Največ zapisov v datoteki","storage-max-files":"Največje število datotek","storage-max-files-min":"Najmanjše število je 1.","storage-max-files-pattern":"Številka ni veljavna.","storage-max-files-required":"Številka je obvezna.","storage-max-records":"Največ zapisov v pomnilniku","storage-max-records-min":"Najmanjše število zapisov je 1.","storage-max-records-pattern":"Številka ni veljavna.","storage-max-records-required":"Zahtevan je največ zapisov.","storage-pack-size":"Največja velikost paketa dogodkov","storage-pack-size-min":"Najmanjše število je 1.","storage-pack-size-pattern":"Številka ni veljavna.","storage-pack-size-required":"Zahtevana je največja velikost paketa dogodkov.","storage-path":"Pot pomnilnika","storage-path-required":"Zahtevana je pot do pomnilnika.","storage-type":"Vrsta pomnilnika","storage-types":{"file-storage":"Shramba datotek","memory-storage":"Spomin pomnilnika"},thingsboard:"ThingsBoard","thingsboard-host":"Gostitelj ThingsBoard","thingsboard-host-required":"Potreben je gostitelj.","thingsboard-port":"Vrata ThingsBoard","thingsboard-port-max":"Največja številka vrat je 65535.","thingsboard-port-min":"Najmanjša številka vrat je 1.","thingsboard-port-pattern":"Vrata niso veljavna.","thingsboard-port-required":"Potrebna so vrata.",tidy:"Urejeno","tidy-tip":"Urejena konfiguracija JSON","title-connectors-json":"Konfiguracija konektorja {{typeName}}","tls-path-ca-certificate":"Pot do potrdila CA na prehodu","tls-path-client-certificate":"Pot do potrdila stranke na prehodu","tls-path-private-key":"Pot do zasebnega ključa na prehodu","toggle-fullscreen":"Preklop na celozaslonski način","transformer-json-config":"Konfiguracija JSON *","update-config":"Dodaj / posodobi konfiguracijo JSON"}},Rt={gateway:{"add-entry":"Yapılandırma ekle","connector-add":"Yeni bağlayıcı ekle","connector-enabled":"Bağlayıcıyı etkinleştir","connector-name":"Bağlayıcı adı","connector-name-required":"Bağlayıcı adı gerekli.","connector-type":"Bağlayıcı tipi","connector-type-required":"Bağlayıcı türü gerekli.",connectors:"Bağlayıcıların yapılandırması","create-new-gateway":"Yeni bir ağ geçidi oluştur","create-new-gateway-text":"'{{gatewayName}}' adında yeni bir ağ geçidi oluşturmak istediğinizden emin misiniz?",delete:"Yapılandırmayı sil","download-tip":"Yapılandırma dosyasını indirin",gateway:"Ağ geçidi","gateway-exists":"Aynı ada sahip cihaz zaten var.","gateway-name":"Ağ geçidi adı","gateway-name-required":"Ağ geçidi adı gerekli.","gateway-saved":"Ağ geçidi yapılandırması başarıyla kaydedildi.","json-parse":"Geçerli bir JSON değil.","json-required":"Alan boş olamaz.","no-connectors":"Bağlayıcı yok","no-data":"Yapılandırma yok","no-gateway-found":"Ağ geçidi bulunamadı.","no-gateway-matching":" '{{item}}' bulunamadı.","path-logs":"Log dosyaları yolu","path-logs-required":"Log dosyaları dizini gerekli.",remote:"Uzaktan yapılandırma","remote-logging-level":"Loglama seviyesi","remove-entry":"Yapılandırmayı kaldır","save-tip":"Yapılandırma dosyasını kaydet","security-type":"Güvenlik türü","security-types":{"access-token":"Access Token",tls:"TLS"},storage:"Depolama","storage-max-file-records":"Dosyadaki maksimum kayıt","storage-max-files":"Maksimum dosya sayısı","storage-max-files-min":"Minimum sayı 1'dir.","storage-max-files-pattern":"Sayı geçerli değil.","storage-max-files-required":"Sayı gerekli.","storage-max-records":"Depodaki maksimum kayıt","storage-max-records-min":"Minimum kayıt sayısı 1'dir.","storage-max-records-pattern":"Sayı geçerli değil.","storage-max-records-required":"Maksimum kayıt gerekli.","storage-pack-size":"Maksimum etkinlik paketi boyutu","storage-pack-size-min":"Minimum sayı 1'dir.","storage-pack-size-pattern":"Sayı geçerli değil.","storage-pack-size-required":"Maksimum etkinlik paketi boyutu gerekli.","storage-path":"Depolama yolu","storage-path-required":"Depolama yolu gerekli.","storage-type":"Depolama türü","storage-types":{"file-storage":"Dosya depolama","memory-storage":"Bellek depolama"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard host","thingsboard-host-required":"Host gerekli.","thingsboard-port":"ThingsBoard port","thingsboard-port-max":"Maksimum port numarası 65535.","thingsboard-port-min":"Minimum port numarası 1'dir.","thingsboard-port-pattern":"Port geçerli değil.","thingsboard-port-required":"Port gerekli.",tidy:"Tidy","tidy-tip":"Tidy config JSON","title-connectors-json":"Connector {{typeName}} configuration","tls-path-ca-certificate":"Path to CA certificate on gateway","tls-path-client-certificate":"Path to client certificate on gateway","tls-path-private-key":"Path to private key on gateway","toggle-fullscreen":"Toggle fullscreen","transformer-json-config":"Configuration JSON*","update-config":"Add/update configuration JSON"}},Bt={gateway:{"add-entry":"添加配置",advanced:"高级","checking-device-activity":"检查设备活动",command:"Docker命令","command-copied-message":"Docker命令已复制到剪贴板",configuration:"配置","connector-add":"添加连接器","connector-enabled":"启用连接器","connector-name":"连接器名称","connector-name-required":"连接器名称必填。","connector-type":"连接器类型","connector-type-required":"连接器类型必填。",connectors:"连接器配置","connectors-config":"连接器配置","connectors-table-enabled":"已启用","connectors-table-name":"名称","connectors-table-type":"类型","connectors-table-status":"状态","connectors-table-actions":"操作","connectors-table-key":"键","connectors-table-class":"类","rpc-command-send":"发送","rpc-command-result":"结果","rpc-command-edit-params":"编辑参数","gateway-configuration":"通用配置","create-new-gateway":"创建网关","create-new-gateway-text":"确定要创建名为 '{{gatewayName}}' 的新网关?","created-time":"创建时间","configuration-delete-dialog-header":"配置将被删除","configuration-delete-dialog-body":"只有对网关进行物理访问时,才有可能关闭远程配置。所有先前的配置都将被删除。

\n要关闭配置,请在下面输入网关名称","configuration-delete-dialog-input":"网关名称","configuration-delete-dialog-input-required":"网关名称是必需的","configuration-delete-dialog-confirm":"关闭",delete:"删除配置","download-tip":"下载配置","drop-file":"将文件拖放到此处或",gateway:"网关","gateway-exists":"同名设备已存在。","gateway-name":"网关名称","gateway-name-required":"网关名称必填。","gateway-saved":"已成功保存网关配置。",grpc:"GRPC","grpc-keep-alive-timeout":"保持连接超时(毫秒)","grpc-keep-alive-timeout-required":"需要保持连接超时","grpc-keep-alive-timeout-min":"保持连接超时不能小于1","grpc-keep-alive-timeout-pattern":"保持连接超时无效","grpc-keep-alive":"保持连接(毫秒)","grpc-keep-alive-required":"需要保持连接","grpc-keep-alive-min":"保持连接不能小于1","grpc-keep-alive-pattern":"保持连接无效","grpc-min-time-between-pings":"最小Ping间隔(毫秒)","grpc-min-time-between-pings-required":"需要最小Ping间隔","grpc-min-time-between-pings-min":"最小Ping间隔不能小于1","grpc-min-time-between-pings-pattern":"最小Ping间隔无效","grpc-min-ping-interval-without-data":"无数据时的最小Ping间隔(毫秒)","grpc-min-ping-interval-without-data-required":"需要无数据时的最小Ping间隔","grpc-min-ping-interval-without-data-min":"无数据时的最小Ping间隔不能小于1","grpc-min-ping-interval-without-data-pattern":"无数据时的最小Ping间隔无效","grpc-max-pings-without-data":"无数据时的最大Ping数","grpc-max-pings-without-data-required":"需要无数据时的最大Ping数","grpc-max-pings-without-data-min":"无数据时的最大Ping数不能小于1","grpc-max-pings-without-data-pattern":"无数据时的最大Ping数无效","inactivity-check-period-seconds":"不活跃检查期(秒)","inactivity-check-period-seconds-required":"需要不活跃检查期","inactivity-check-period-seconds-min":"不活跃检查期不能小于1","inactivity-check-period-seconds-pattern":"不活跃检查期无效","inactivity-timeout-seconds":"不活跃超时(秒)","inactivity-timeout-seconds-required":"需要不活跃超时","inactivity-timeout-seconds-min":"不活跃超时不能小于1","inactivity-timeout-seconds-pattern":"不活跃超时无效","json-parse":"无效的JSON。","json-required":"字段不能为空。",logs:{logs:"日志",days:"天",hours:"小时",minutes:"分钟",seconds:"秒","date-format":"日期格式","date-format-required":"需要日期格式","log-format":"日志格式","log-type":"日志类型","log-format-required":"需要日志格式",remote:"远程日志记录","remote-logs":"远程日志",local:"本地日志记录",level:"日志级别","file-path":"文件路径","file-path-required":"需要文件路径","saving-period":"日志保存期限","saving-period-min":"日志保存期限不能小于1","saving-period-required":"需要日志保存期限","backup-count":"备份数量","backup-count-min":"备份数量不能小于1","backup-count-required":"需要备份数量"},"min-pack-send-delay":"最小包发送延迟(毫秒)","min-pack-send-delay-required":"最小包发送延迟是必需的","min-pack-send-delay-min":"最小包发送延迟不能小于0","no-connectors":"无连接器","no-data":"没有配置","no-gateway-found":"未找到网关。","no-gateway-matching":"未找到 '{{item}}' 。","path-logs":"日志文件的路径","path-logs-required":"路径是必需的。","permit-without-calls":"保持连接许可,无需响应",remote:"远程配置","remote-logging-level":"日志记录级别","remove-entry":"删除配置","remote-shell":"远程Shell","remote-configuration":"远程配置",other:"其他","save-tip":"保存配置","security-type":"安全类型","security-types":{"access-token":"访问令牌","username-password":"用户名和密码",tls:"TLS","tls-access-token":"TLS + 访问令牌","tls-private-key":"TLS + 私钥"},"server-port":"服务器端口",statistics:{statistic:"统计信息",statistics:"统计信息","statistic-commands-empty":"无可用统计信息",commands:"命令","send-period":"统计信息发送周期(秒)","send-period-required":"统计信息发送周期是必需的","send-period-min":"统计信息发送周期不能小于60","send-period-pattern":"统计信息发送周期无效","check-connectors-configuration":"检查连接器配置(秒)","check-connectors-configuration-required":"检查连接器配置是必需的","check-connectors-configuration-min":"检查连接器配置不能小于1","check-connectors-configuration-pattern":"检查连接器配置无效",add:"添加命令",timeout:"超时时间","timeout-required":"超时时间是必需的","timeout-min":"超时时间不能小于1","timeout-pattern":"超时时间无效","attribute-name":"属性名称","attribute-name-required":"属性名称是必需的",command:"命令","command-required":"命令是必需的","command-pattern":"命令无效",remove:"删除命令"},storage:"存储","storage-max-file-records":"文件中的最大记录数","storage-max-files":"最大文件数","storage-max-files-min":"最小值为1。","storage-max-files-pattern":"数字无效。","storage-max-files-required":"数字是必需的。","storage-max-records":"存储中的最大记录数","storage-max-records-min":"最小记录数为1。","storage-max-records-pattern":"数字无效。","storage-max-records-required":"最大记录项必填。","storage-read-record-count":"存储中的读取记录数","storage-read-record-count-min":"最小记录数为1。","storage-read-record-count-pattern":"数字不合法。","storage-read-record-count-required":"需要读取记录数。","storage-max-read-record-count":"存储中的最大读取记录数","storage-max-read-record-count-min":"最小记录数为1。","storage-max-read-record-count-pattern":"数字不合法。","storage-max-read-record-count-required":"最大读取记录数必需。","storage-data-folder-path":"数据文件夹路径","storage-data-folder-path-required":"需要数据文件夹路径。","storage-pack-size":"最大事件包大小","storage-pack-size-min":"最小值为1。","storage-pack-size-pattern":"数字无效。","storage-pack-size-required":"最大事件包大小必填。","storage-path":"存储路径","storage-path-required":"存储路径必填。","storage-type":"存储类型","storage-types":{"file-storage":"文件存储","memory-storage":"内存存储",sqlite:"SQLITE"},thingsboard:"ThingsBoard",general:"常规","thingsboard-host":"ThingsBoard主机","thingsboard-host-required":"主机必填。","thingsboard-port":"ThingsBoard端口","thingsboard-port-max":"最大端口号为65535。","thingsboard-port-min":"最小端口号为1。","thingsboard-port-pattern":"端口无效。","thingsboard-port-required":"端口必填。",tidy:"整理","tidy-tip":"整理配置JSON","title-connectors-json":"连接器 {{typeName}} 配置","tls-path-ca-certificate":"网关上CA证书的路径","tls-path-client-certificate":"网关上客户端证书的路径","messages-ttl-check-in-hours":"消息TTL检查小时数","messages-ttl-check-in-hours-required":"需要提供消息TTL检查小时数。","messages-ttl-check-in-hours-min":"最小值为1。","messages-ttl-check-in-hours-pattern":"数字无效。","messages-ttl-in-days":"消息TTL天数","messages-ttl-in-days-required":"需要提供消息TTL天数。","messages-ttl-in-days-min":"最小值为1。","messages-ttl-in-days-pattern":"数字无效。","mqtt-qos":"QoS","mqtt-qos-required":"需要提供QoS","mqtt-qos-range":"QoS值的范围是从0到1","tls-path-private-key":"网关上私钥的路径","toggle-fullscreen":"切换全屏","transformer-json-config":"配置JSON*","update-config":"添加/更新配置JSON",hints:{"remote-configuration":"启用对网关的远程配置和管理","remote-shell":"通过远程Shell小部件启用对网关操作系统的远程控制",host:"ThingsBoard 主机名或IP地址",port:"ThingsBoard MQTT服务端口",token:"ThingsBoard 网关访问令牌","client-id":"ThingsBoard 网关MQTT客户端ID",username:"ThingsBoard 网关MQTT用户名",password:"ThingsBoard 网关MQTT密码","ca-cert":"CA证书文件的路径","date-form":"日志消息中的日期格式","data-folder":"包含数据的文件夹的路径(相对或绝对路径)","log-format":"日志消息格式","remote-log":"启用对网关的远程日志记录和日志读取","backup-count":"如果备份计数大于0,则在执行轮换时,最多保留备份计数个文件-最旧的文件将被删除",storage:"提供将数据发送到平台之前保存传入数据的配置","max-file-count":"将创建的文件的最大数量","max-read-count":"从存储中获取的消息计数并发送到ThingsBoard","max-records":"一个文件中存储的最大记录数","read-record-count":"从存储中获取的消息计数并发送到ThingsBoard","max-records-count":"在将数据发送到ThingsBoard之前,存储中的最大数据计数","ttl-check-hour":"网关多久检查一次数据是否过时","ttl-messages-day":"存储将保存数据的最大天数",commands:"用于收集附加统计信息的命令",attribute:"统计遥测键",timeout:"命令执行的超时时间",command:"命令执行的结果,将用作遥测的值","check-device-activity":"启用监视每个连接设备的活动","inactivity-timeout":"在此时间后,网关将断开设备的连接","inactivity-period":"设备活动检查的周期","minimal-pack-delay":"发送消息包之间的延迟(减小此设置会导致增加CPU使用率)",qos:"MQTT消息传递的服务质量(0-至多一次,1-至少一次)","server-port":"GRPC服务器侦听传入连接的网络端口","grpc-keep-alive-timeout":"在考虑连接死亡之前,服务器等待keepalive ping响应的最长时间","grpc-keep-alive":"没有活动RPC调用时两个连续keepalive ping消息之间的持续时间","grpc-min-time-between-pings":"服务器在发送keepalive ping消息之间应等待的最小时间量","grpc-max-pings-without-data":"在没有接收到任何数据之前,服务器可以发送的keepalive ping消息的最大数量,然后将连接视为死亡","grpc-min-ping-interval-without-data":"在没有发送或接收数据时,服务器在发送keepalive ping消息之间应等待的最小时间量","permit-without-calls":"允许服务器在没有活动RPC调用时保持GRPC连接活动"},"docker-label":"使用以下指令在 Docker compose 中运行 IoT 网关,并为选定的设备提供凭据","install-docker-compose":"使用以下说明下载、安装和设置 Docker Compose","download-configuration-file":"下载配置文件","download-docker-compose":"下载您的网关的 docker-compose.yml 文件","launch-gateway":"启动网关","launch-docker-compose":"在包含 docker-compose.yml 文件的文件夹中,使用以下命令在终端中启动网关"}},Ft={gateway:{"add-entry":"增加配置","connector-add":"增加新連接器","connector-enabled":"啟用連接器","connector-name":"連接器名稱","connector-name-required":"需要連接器名稱。","connector-type":"連接器類型","connector-type-required":"需要連接器類型。",connectors:"連接器配置","create-new-gateway":"建立新閘道","create-new-gateway-text":"您確定要建立一個名稱為:'{{gatewayName}}'的新閘道嗎?",delete:"刪除配置","download-tip":"下載配置文件",gateway:"閘道","gateway-exists":"同名設備已存在。","gateway-name":"閘道名稱","gateway-name-required":"需要閘道名稱。","gateway-saved":"閘道配置已成功保存。","json-parse":"無效的JSON","json-required":"欄位不能為空。","no-connectors":"無連接器","no-data":"無配置","no-gateway-found":"未找到閘道。","no-gateway-matching":" 未找到'{{item}}'。","path-logs":"日誌文件的路徑","path-logs-required":"需要路徑。",remote:"移除配置","remote-logging-level":"日誌記錄級別","remove-entry":"移除配置","save-tip":"保存配置文件","security-type":"安全類型","security-types":{"access-token":"訪問Token",tls:"TLS"},storage:"貯存","storage-max-file-records":"文件中的最大紀錄","storage-max-files":"最大文件數","storage-max-files-min":"最小數量為1。","storage-max-files-pattern":"號碼無效。","storage-max-files-required":"需要號碼。","storage-max-records":"存儲中的最大紀錄","storage-max-records-min":"最小紀錄數為1。","storage-max-records-pattern":"號碼無效。","storage-max-records-required":"需要最大紀錄數","storage-pack-size":"最大事件包大小","storage-pack-size-min":"最小數量為1。","storage-pack-size-pattern":"號碼無效.","storage-pack-size-required":"需要最大事件包大小","storage-path":"存儲路徑","storage-path-required":"需要存儲路徑。","storage-type":"存儲類型","storage-types":{"file-storage":"文件存儲","memory-storage":"記憶體存儲"},thingsboard:"ThingsBoard","thingsboard-host":"ThingsBoard主機","thingsboard-host-required":"需要主機。","thingsboard-port":"ThingsBoard連接埠","thingsboard-port-max":"最大埠號為 65535。","thingsboard-port-min":"最小埠號為1。","thingsboard-port-pattern":"連接埠無效。","thingsboard-port-required":"需要連接埠。",tidy:"整理","tidy-tip":"整理配置JSON","title-connectors-json":"連接器{{typeName}}配置","tls-path-ca-certificate":"閘道上CA證書的路徑","tls-path-client-certificate":"閘道上用戶端憑據的路徑","tls-path-private-key":"閘道上的私鑰路徑","toggle-fullscreen":"切換全螢幕","transformer-json-config":"配置JSON*","update-config":"增加/更新配置JSON"}};e("AvailableLanguages",wt),function(e){e.English="en_US",e.Arabic="ar_AE",e.Catalan="ca_ES",e.Czech="cs_CZ",e.Danish="da_DK",e.Spanish="es_ES",e.Korean="ko_KR",e.Lithuanian="lt_LT",e.Dutch="nl_BE",e.Polish="pl_PL",e.PortugueseBrazil="pt_BR",e.Slovenian="sl_SI",e.Turkish="tr_TR",e.ChineseSimplified="zh_CN",e.ChineseTraditional="zh_TW"}(wt||e("AvailableLanguages",wt={}));const Nt=new Map([[wt.English,St],[wt.Arabic,Ct],[wt.Catalan,_t],[wt.Czech,Tt],[wt.Danish,Et],[wt.Spanish,Mt],[wt.Korean,It],[wt.Lithuanian,kt],[wt.Dutch,Pt],[wt.Polish,Dt],[wt.PortugueseBrazil,At],[wt.Slovenian,Ot],[wt.Turkish,Rt],[wt.ChineseSimplified,Bt],[wt.ChineseTraditional,Ft]]),Lt=e("addGatewayLocale",(e,t)=>{const n=wt.English,i=e.getCurrentLang()??n,a=t.getTranslations(i)?.gateway?i:n,r=Nt.get(i)?.gateway?i:n,o=[r===n?void 0:Nt.get(n)?.gateway,Nt.get(r)?.gateway,t.getTranslations(a)?.gateway].filter(Vt);if(!o.length)return;const s=1===o.length?o[0]:$({},...o);e.setTranslation(a,{gateway:s},!0)}),Vt=e=>K(e)&&0!==Object.keys(e).length;var qt={3.6:{socket:{type:"TCP",address:"127.0.0.1",port:5e4,bufferSize:1024},devices:[{address:"*:*",deviceName:"Device Example",deviceType:"default",encoding:"utf-8",telemetry:[{key:"temp",byteFrom:0,byteTo:-1},{key:"hum",byteFrom:0,byteTo:2}],attributes:[{key:"name",byteFrom:0,byteTo:-1},{key:"num",byteFrom:2,byteTo:4}],attributeRequests:[{type:"shared",requestExpressionSource:"constant",attributeNameExpressionSource:"constant",requestExpression:"${[0:3]==atr}",attributeNameExpression:"[3:]"}],attributeUpdates:[{encoding:"utf-16",attributeOnThingsBoard:"sharedName"}],serverSideRpc:[{methodRPC:"rpcMethod1",withResponse:!0,encoding:"utf-8"}]}]},legacy:{type:"TCP",address:"127.0.0.1",port:5e4,bufferSize:1024,devices:[{address:"*:*",deviceName:"Device Example",deviceType:"default",encoding:"utf-8",telemetry:[{key:"temp",byteFrom:0,byteTo:-1},{key:"hum",byteFrom:0,byteTo:2}],attributes:[{key:"name",byteFrom:0,byteTo:-1},{key:"num",byteFrom:2,byteTo:4}],attributeRequests:[{type:"shared",requestExpression:"${[0:3]==atr}",attributeNameExpression:"[3:]"}],attributeUpdates:[{encoding:"utf-16",attributeOnThingsBoard:"sharedName"}],serverSideRpc:[{methodRPC:"rpcMethod1",withResponse:!0,methodProcessing:"write",encoding:"utf-8"}]}]}},Gt={broker:{host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,cleanSession:!0,cleanStart:!0,sessionExpiryInterval:0,security:{type:"anonymous"}},mapping:[{topicFilter:"data/",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"double",key:"power",value:"${power}"},{type:"integer",key:"frequency",value:"${frequency}"}],timeseries:[{type:"double",key:"temperature",value:"${temperature}"},{type:"double",key:"humidity",value:"${humidity}"},{type:"boolean",key:"relay",value:"${relay}"}]}},{topicFilter:"sensor/+/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/data)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"},timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"string",key:"humidity",value:"${hum}"}]}},{topicFilter:"sensor/raw_data",subscriptionQos:1,converter:{type:"bytes",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"[0:4]",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},timeout:6e4,attributes:[{type:"raw",key:"rawData",value:"[:]"}],timeseries:[{type:"raw",key:"temp",value:"[4:]"}]}},{topicFilter:"custom/sensors/+",subscriptionQos:1,converter:{type:"custom",extension:"CustomMqttUplinkConverter",cached:!0,extensionConfig:{temperature:2,humidity:2,batteryLevel:1}}}],requestsMapping:{connectRequests:[{topicFilter:"sensor/connect",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"}},{topicFilter:"sensor/+/connect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"}}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device"}},{topicFilter:"sensor/+/disconnect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)"}}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Demo Device"},attributeNameExpressionSource:"message",attributeNameExpression:"${relay}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeValue}"}],attributeUpdates:[{deviceNameFilter:".*",attributeFilter:"relay",topicExpression:"sensor/request/setRelay",valueExpression:"${attributeValue}"}],serverSideRpc:[{type:"twoWay",deviceNameFilter:".*",methodFilter:"getRelay",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTopicQoS:1,responseTimeout:1e4,valueExpression:"${params}"},{type:"oneWay",deviceNameFilter:".*",methodFilter:"setRelay",requestTopicExpression:"sensor/request/${methodName}",valueExpression:"${params}"}]}},zt={master:{slaves:[{host:"127.0.0.1",port:5021,method:"socket",unitId:1,deviceName:"Demo Device",deviceType:"default",timeout:35,byteOrder:"BIG",wordOrder:"LITTLE",retries:3,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:1e3,connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,type:"tcp",attributes:[{tag:"power",type:"16int",functionCode:3,objectsCount:1,address:2,divider:10},{tag:"frequency",type:"16int",functionCode:3,objectsCount:1,address:3,divider:10}],timeseries:[{tag:"temperature",type:"16int",address:0,objectsCount:1,functionCode:3,divider:10},{tag:"humidity",type:"16int",address:1,objectsCount:1,functionCode:3,divider:10},{tag:"relay",type:"bits",address:1,objectsCount:1,functionCode:1,bitTargetType:"bool"}],attributeUpdates:[{tag:"relay",type:"bits",address:1,objectsCount:1,functionCode:5,bitTargetType:"bool"}],rpc:[{tag:"setRelay",type:"bits",address:1,objectsCount:1,functionCode:5,bitTargetType:"bool"},{tag:"getRelay",type:"bits",address:1,objectsCount:1,functionCode:1,bitTargetType:"bool"}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",unitId:0,deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",identity:{},values:{holding_registers:{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"16int",tag:"smm",objectsCount:1,value:12334}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",value:22,type:"16int",address:31,objectsCount:1,functionCode:6}]},coils_initializer:{attributes:[{address:5,type:"8int",tag:"coil",objectsCount:1,value:0}],timeseries:[],attributeUpdates:[],rpc:[]},input_registers:{attributes:[],timeseries:[],attributeUpdates:[],rpc:[]},discrete_inputs:{attributes:[],timeseries:[],attributeUpdates:[],rpc:[]}}}},Ut={server:{url:"opc.tcp://127.0.0.1:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:36e5,pollPeriodInMillis:5e3,enableSubscriptions:!1,subCheckPeriodInMillis:100,subDataMaxBatchSize:1e3,subDataMinBatchCreationTimeMs:200,subscriptionProcessBatchSize:2e3,sessionTimeoutInMillis:12e4,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"}},mapping:[{deviceNodeSource:"path",deviceNodePattern:"Root\\.Objects\\.MyObject",deviceInfo:{deviceNameExpression:"Demo Device",deviceNameExpressionSource:"constant",deviceProfileExpression:"default",deviceProfileExpressionSource:"constant"},attributes:[{key:"frequency",type:"path",value:"${Frequency}"},{key:"power",type:"path",value:"${Power}"}],timeseries:[{key:"temperature",type:"path",value:"${Temperature}"},{key:"humidity",type:"path",value:"${Humidity}"},{key:"relay",type:"path",value:"${Relay}"}],rpc_methods:[{method:"multiply",arguments:[{type:"integer",value:2},{type:"integer",value:4}]},{method:"get_relay",arguments:[]},{method:"set_relay",arguments:[]}],attributes_updates:[{key:"relay",type:"path",value:"Root\\.Objects\\.MyObject\\.Relay"}]}]},jt={passiveScanMode:!0,showMap:!1,scanner:{timeout:1e4,deviceName:"Device name"},devices:[{name:"Temperature and humidity sensor",MACAddress:"4C:65:A8:DF:85:C0",pollPeriod:5e5,showMap:!1,timeout:1e4,connectRetry:5,connectRetryInSeconds:0,waitAfterConnectRetries:10,telemetry:[{key:"temperature",method:"notify",characteristicUUID:"226CAA55-6476-4566-7562-66734470666D",valueExpression:"[2]"},{key:"humidity",method:"notify",characteristicUUID:"226CAA55-6476-4566-7562-66734470666D",valueExpression:"[0]"}],attributes:[{key:"name",method:"read",characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",valueExpression:"[0:2]cm [2:]A"},{key:"values",method:"read",characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",valueExpression:"All values: [:]"}],attributeUpdates:[{attributeOnThingsBoard:"sharedName",characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB"}],serverSideRpc:[{methodRPC:"rpcMethod1",withResponse:!0,characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",methodProcessing:"read"},{methodRPC:"rpcMethod2",withResponse:!0,characteristicUUID:"00002A00-0000-1000-8000-00805F9B34FB",methodProcessing:"write"},{methodRPC:"rpcMethod3",withResponse:!0,methodProcessing:"scan"}]}]},Ht={host:"http://127.0.0.1:5000",SSLVerify:!0,security:{type:"basic",username:"user",password:"password"},mapping:[{url:"getdata",httpMethod:"GET",httpHeaders:{ACCEPT:"application/json"},content:{name:"morpheus",job:"leader"},allowRedirects:!0,timeout:.5,scanPeriod:5,dataUnpackExpression:"",converter:{type:"json",deviceNameJsonExpression:"SD8500",deviceTypeJsonExpression:"SD",attributes:[{key:"serialNumber",type:"string",value:"${serial}"}],telemetry:[{key:"Maintainer",type:"string",value:"${Developer}"},{key:"combine",type:"string",value:"${Developer}:${hum}"}]}},{url:"get_info",httpMethod:"GET",httpHeaders:{ACCEPT:"application/json"},allowRedirects:!0,timeout:.5,scanPeriod:100,dataUnpackExpression:"",converter:{type:"custom",deviceNameJsonExpression:"SD8500",deviceTypeJsonExpression:"SD",extension:"CustomRequestUplinkConverter","extension-config":[{key:"Totaliser",type:"float",fromByte:0,toByte:4,byteorder:"big",signed:!0,multiplier:1},{key:"Flow",type:"int",fromByte:4,toByte:6,byteorder:"big",signed:!0,multiplier:.01},{key:"Temperature",type:"int",fromByte:8,toByte:10,byteorder:"big",signed:!0,multiplier:.01},{key:"Pressure",type:"int",fromByte:12,toByte:14,byteorder:"big",signed:!0,multiplier:.01},{key:"deviceStatus",type:"int",byteAddress:15,fromBit:4,toBit:8,byteorder:"big",signed:!1},{key:"OUT2",type:"int",byteAddress:15,fromBit:1,toBit:2,byteorder:"big"},{key:"OUT1",type:"int",byteAddress:15,fromBit:0,toBit:1,byteorder:"big"}]}},{url:"/devices",httpMethod:"GET",httpHeaders:{ACCEPT:"application/json"},allowRedirects:!0,timeout:3,scanPeriod:1800,subRequests:{cumPwr:{url:"/${id}/hist/values/ActiveEnergy/SUM13/3600?start=RELATIVE_-1HOUR&end=RELATIVE_-1HOUR&online=false&aggregate=false",processingFunction:'def process_data(data, key): return {key: float(data["values"][0]["avg"])/1000.0}'}},converter:{type:"json",deviceNameJsonExpression:"${id}-${type}",deviceTypeJsonExpression:"GridVis",attributes:[{key:"id",type:"int",value:"${id}"},{key:"type",type:"string",value:"${type}"},{key:"serialNr",type:"string",value:"${serialNr}"},{key:"name",type:"string",value:"${name}"},{key:"description",type:"string",value:"${description}"}],telemetry:[{key:"cumPwr",type:"float",value:"${cumPwr}"}]}}],attributeUpdates:[{httpMethod:"POST",httpHeaders:{"Content-Type":"application/json"},timeout:.5,tries:3,allowRedirects:!0,deviceNameFilter:"SD.*",attributeFilter:"send_data",requestUrlExpression:"sensor/${deviceName}/${attributeKey}",requestValueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTimeout:1,httpMethod:"GET",responseValueExpression:"${temp}",timeout:.5,tries:3,httpHeaders:{"Content-Type":"application/json"}},{deviceNameFilter:".*",methodFilter:"no-reply",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",httpMethod:"POST",requestValueExpression:"${params}",httpHeaders:{"Content-Type":"application/json"}}]},Wt={interface:"socketcan",channel:"vcan0",backend:{fd:!0},reconnectPeriod:5,devices:[{name:"Car",sendDataOnlyOnChange:!1,enableUnknownRpc:!0,strictEval:!1,attributes:[{key:"isDriverDoorOpened",nodeId:41,command:"2:2:big:8717",value:"4:1:int",expression:"bool(value & 0b00000100)",polling:{type:"once",dataInHex:"AB CD AB CD"}}],timeseries:[{key:"rpm",nodeId:1918,isExtendedId:!0,command:"2:2:big:48059",value:"4:2:big:int",expression:"value / 4",polling:{type:"always",period:5,dataInHex:"aaaa bbbb aaaa bbbb"}},{key:"milliage",nodeId:1918,isExtendedId:!0,value:"4:2:little:int",expression:"value * 10",polling:{type:"always",period:30,dataInHex:"aa bb cc dd ee ff aa bb"}}],attributeUpdates:[{attributeOnThingsBoard:"softwareVersion",nodeId:64,isExtendedId:!0,dataLength:4,dataExpression:"value + 5",dataByteorder:"little"}],serverSideRpc:[{method:"sendSameData",nodeId:4,isExtendedId:!0,isFd:!0,bitrateSwitch:!0,dataInHex:"aa bb cc dd ee ff aa bb aa bb cc d ee ff"},{method:"setLightLevel",nodeId:5,dataLength:2,dataByteorder:"little",dataBefore:"00AA"},{method:"setSpeed",nodeId:16,dataAfter:"0102",dataExpression:"userSpeed if maxAllowedSpeed > userSpeed else maxAllowedSpeed"}]}]},$t={"3.6.2":{application:{objectName:"TB_gateway",host:"0.0.0.0",port:47808,objectIdentifier:599,maxApduLengthAccepted:1476,segmentationSupported:"segmentedBoth",vendorIdentifier:15},devices:[{deviceInfo:{deviceNameExpression:"BACnet Device ${objectName}",deviceProfileExpression:"default",deviceNameExpressionSource:"expression",deviceProfileExpressionSource:"constant"},host:"192.168.2.110",port:"47808",pollPeriod:1e4,attributes:[{key:"temperature",objectType:"analogOutput",objectId:1,propertyId:"presentValue"}],timeseries:[{key:"state",objectType:"binaryValue",objectId:1,propertyId:"presentValue"}],attributeUpdates:[{key:"brightness",objectType:"analogOutput",objectId:1,propertyId:"presentValue"}],serverSideRpc:[{method:"set_state",requestType:"writeProperty",requestTimeout:1e4,objectType:"binaryOutput",objectId:1,propertyId:"presentValue"},{method:"get_state",requestType:"readProperty",requestTimeout:1e4,objectType:"binaryOutput",objectId:1,propertyId:"presentValue"}]}]},legacy:{general:{objectName:"TB_gateway",address:"0.0.0.0:47808",objectIdentifier:599,maxApduLengthAccepted:1476,segmentationSupported:"segmentedBoth",vendorIdentifier:15},devices:[{deviceName:"BACnet Device ${objectName}",deviceType:"default",address:"192.168.2.110:47808",pollPeriod:1e4,attributes:[{key:"temperature",type:"string",objectId:"analogOutput:1",propertyId:"presentValue"}],timeseries:[{key:"state",type:"bool",objectId:"binaryValue:1",propertyId:"presentValue"}],attributeUpdates:[{key:"brightness",requestType:"writeProperty",objectId:"analogOutput:1",propertyId:"presentValue"}],serverSideRpc:[{method:"set_state",requestType:"writeProperty",requestTimeout:1e4,objectId:"binaryOutput:1",propertyId:"presentValue"},{method:"get_state",requestType:"readProperty",requestTimeout:1e4,objectId:"binaryOutput:1",propertyId:"presentValue"}]}]}},Kt={connection:{str:"Driver={PostgreSQL};Server=localhost;Port=5432;Database=thingsboard;Uid=postgres;Pwd=postgres;",attributes:{autocommit:!0,timeout:0},encoding:"utf-8",decoding:{char:"utf-8",wchar:"utf-8",metadata:"utf-16le"},reconnect:!0,reconnectPeriod:60},pyodbc:{pooling:!1},polling:{query:"SELECT bool_v, str_v, dbl_v, long_v, entity_id, ts FROM ts_kv WHERE ts > ? ORDER BY ts ASC LIMIT 10",period:10,iterator:{column:"ts",query:"SELECT MIN(ts) - 1 FROM ts_kv",persistent:!1}},mapping:{device:{type:"postgres",name:"'ODBC ' + entity_id"},sendDataOnlyOnChange:!1,attributes:"*",timeseries:[{name:"value",value:"[i for i in [str_v, long_v, dbl_v,bool_v] if i is not None][0]"}]},serverSideRpc:{enableUnknownRpc:!1,overrideRpcConfig:!0,methods:["procedureOne",{name:"procedureTwo",args:["One",2,3]}]}},Yt={"3.7.2":{server:{host:"127.0.0.1",port:"5000",SSL:!1,security:{cert:"~/ssl/cert.pem",key:"~/ssl/key.pem"}},mapping:[{endpoint:"/my_devices",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"request",deviceNameExpression:"${sensorName}",deviceProfileExpressionSource:"request",deviceProfileExpression:"${sensorType}"},attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"certificateNumber",value:"${certificateNumber}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon1",HTTPMethods:["GET","POST"],security:{type:"anonymous"},converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"Device 2",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},attributes:[{type:"string",key:"model",value:"Model2"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon2",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"custom",deviceInfo:{deviceNameExpressionSource:"constant",deviceNameExpression:"SuperAnonDevice",deviceProfileExpressionSource:"constant",deviceProfileExpression:"default"},extension:"CustomRestUplinkConverter",extensionConfig:{key:"Totaliser",datatype:"float",fromByte:0,toByte:4,byteorder:"big",signed:!0,multiplier:1}}}],requestsMapping:{attributeRequests:[{endpoint:"/sharedAttributes",type:"shared",HTTPMethods:["POST"],security:{type:"anonymous"},timeout:10,deviceNameExpression:"${deviceName}",attributeNameExpression:"${attribute}${attribute1}"}],attributeUpdates:[{HTTPMethod:"POST",SSLVerify:!1,httpHeaders:{"CONTENT-TYPE":"application/json"},security:{type:"anonymous"},timeout:.5,tries:3,allowRedirects:!0,deviceNameFilter:"SN.*",attributeFilter:".*",requestUrlExpression:"http://127.0.0.1:5001/",valueExpression:'{"deviceName":"${deviceName}","${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestUrlExpression:"http://127.0.0.1:5001/${deviceName}",responseTimeout:1,HTTPMethod:"GET",valueExpression:"${params}",timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:"SN.*",methodFilter:"post_attributes",requestUrlExpression:"http://127.0.0.1:5000/my_devices",responseTimeout:1,HTTPMethod:"POST",valueExpression:'{"sensorName":"${deviceName}", "sensorModel":"${params.sensorModel}", "certificateNumber":"${params.certificateNumber}", "temp":"${params.temp}", "hum":"${params.hum}"}',timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:".*",methodFilter:"no-reply",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",HTTPMethod:"POST",valueExpression:"${params}",httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}}]}},legacy:{host:"127.0.0.1",port:"5000",SSL:!1,security:{cert:"~/ssl/cert.pem",key:"~/ssl/key.pem"},mapping:[{endpoint:"/my_devices",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"json",deviceNameExpression:"${sensorName}",deviceTypeExpression:"${sensorType}",attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"certificateNumber",value:"${certificateNumber}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon1",HTTPMethods:["GET","POST"],security:{type:"anonymous"},converter:{type:"json",deviceNameExpression:"Device 2",deviceTypeExpression:"default",attributes:[{type:"string",key:"model",value:"Model2"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{endpoint:"/anon2",HTTPMethods:["POST"],security:{type:"anonymous"},converter:{type:"custom",deviceNameExpression:"SuperAnonDevice",deviceTypeExpression:"default",extension:"CustomRestUplinkConverter","extension-config":{key:"Totaliser",datatype:"float",fromByte:0,toByte:4,byteorder:"big",signed:!0,multiplier:1}}}],attributeRequests:[{endpoint:"/sharedAttributes",type:"shared",HTTPMethods:["POST"],security:{type:"anonymous"},timeout:10,deviceNameExpression:"${deviceName}",attributeNameExpression:"${attribute}${attribute1}"}],attributeUpdates:[{HTTPMethod:"POST",SSLVerify:!1,httpHeaders:{"CONTENT-TYPE":"application/json"},security:{type:"anonymous"},timeout:.5,tries:3,allowRedirects:!0,deviceNameFilter:"SN.*",attributeFilter:".*",requestUrlExpression:"http://127.0.0.1:5001/",valueExpression:'{"deviceName":"${deviceName}","${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestUrlExpression:"http://127.0.0.1:5001/${deviceName}",responseTimeout:1,HTTPMethod:"GET",valueExpression:"${params}",timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:"SN.*",methodFilter:"post_attributes",requestUrlExpression:"http://127.0.0.1:5000/my_devices",responseTimeout:1,HTTPMethod:"POST",valueExpression:'{"sensorName":"${deviceName}", "sensorModel":"${params.sensorModel}", "certificateNumber":"${params.certificateNumber}", "temp":"${params.temp}", "hum":"${params.hum}"}',timeout:10,tries:3,httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}},{deviceNameFilter:".*",methodFilter:"no-reply",requestUrlExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",HTTPMethod:"POST",valueExpression:"${params}",httpHeaders:{"Content-Type":"application/json"},security:{type:"anonymous"}}]}},Xt={devices:[{deviceName:"SNMP router",deviceType:"snmp",ip:"snmp.live.gambitcommunications.com",port:161,pollPeriod:5e3,community:"public",attributes:[{key:"ReceivedFromGet",method:"get",oid:"1.3.6.1.2.1.1.1.0",timeout:6},{key:"ReceivedFromMultiGet",method:"multiget",oid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],timeout:6},{key:"ReceivedFromGetNext",method:"getnext",oid:"1.3.6.1.2.1.1.1.0",timeout:6},{key:"ReceivedFromMultiWalk",method:"multiwalk",oid:["1.3.6.1.2.1.1.1.0","1.3.6.0.1.2.1"]},{key:"ReceivedFromBulkWalk",method:"bulkwalk",oid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"]},{key:"ReceivedFromBulkGet",method:"bulkget",scalarOid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],repeatingOid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"],maxListSize:10}],telemetry:[{key:"ReceivedFromWalk",community:"private",method:"walk",oid:"1.3.6.1.2.1.1.1.0"},{key:"ReceivedFromTable",method:"table",oid:"1.3.6.1.2.1.1"}],attributeUpdateRequests:[{attributeFilter:"dataToSet",method:"set",oid:"1.3.6.1.2.1.1.1.0"},{attributeFilter:"dataToMultiSet",method:"multiset",mappings:{"1.2.3":"10","2.3.4":"${attribute}"}}],serverSideRpcRequests:[{requestFilter:"setData",method:"set",oid:"1.3.6.1.2.1.1.1.0"},{requestFilter:"multiSetData",method:"multiset"},{requestFilter:"getData",method:"get",oid:"1.3.6.1.2.1.1.1.0"},{requestFilter:"runBulkWalk",method:"bulkwalk",oid:["1.3.6.1.2.1.1.1.0","1.3.6.1.2.1.1.2.0"]}]},{deviceName:"SNMP router",deviceType:"snmp",ip:"127.0.0.1",pollPeriod:5e3,community:"public",converter:"CustomSNMPConverter",attributes:[{key:"ReceivedFromGetWithCustomConverter",method:"get",oid:"1.3.6.1.2.1.1.1.0"}],telemetry:[{key:"ReceivedFromTableWithCustomConverter",method:"table",oid:"1.3.6.1.2.1.1.1.0"}]}]},Zt={host:"0.0.0.0",port:21,TLSSupport:!1,security:{type:"basic",username:"admin",password:"admin"},paths:[{devicePatternName:"asd",devicePatternType:"Device",delimiter:",",path:"fol/*_hello*.txt",readMode:"FULL",maxFileSize:5,pollPeriod:500,txtFileDataView:"SLICED",withSortingFiles:!0,attributes:[{key:"temp",value:"[1:]"},{key:"tmp",value:"[0:1]"}],timeseries:[{type:"int",key:"[0:1]",value:"[0:1]"},{type:"int",key:"temp",value:"[1:]"}]}],attributeUpdates:[{path:"fol/hello.json",deviceNameFilter:".*",writingMode:"WRITE",valueExpression:"{'${attributeKey}':'${attributeValue}'}"}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"read",valueExpression:"${params}"},{deviceNameFilter:".*",methodFilter:"write",valueExpression:"${params}"}]},Qt={server:{jid:"gateway@localhost",password:"password",host:"localhost",port:5222,use_ssl:!1,disable_starttls:!1,force_starttls:!0,timeout:1e4,plugins:["xep_0030","xep_0323","xep_0325"]},devices:[{jid:"device@localhost/TMP_1101",deviceNameExpression:"${serialNumber}",deviceTypeExpression:"default",attributes:[{key:"temperature",value:"${temp}"}],timeseries:[{key:"humidity",value:"${hum}"},{key:"combination",value:"${temp}:${hum}"}],attributeUpdates:[{attributeOnThingsBoard:"shared",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{methodRPC:"rpc1",withResponse:!0,valueExpression:"${params}"}]}]},Jt={centralSystem:{name:"Central System",host:"127.0.0.1",port:9e3,connection:{type:"insecure"},security:[{type:"token",tokens:["Bearer ACCESS_TOKEN"]},{type:"basic",credentials:[{username:"admin",password:"admin"}]}]},chargePoints:[{idRegexpPattern:"bidon/hello/CP_1",deviceNameExpression:"${Vendor} ${Model}",deviceTypeExpression:"default",attributes:[{messageTypeFilter:"MeterValues,",key:"temp1",value:"${meter_value[:].sampled_value[:].value}"},{messageTypeFilter:"MeterValues,",key:"vendorId",value:"${connector_id}"}],timeseries:[{messageTypeFilter:"DataTransfer,",key:"temp",value:"${data.temp}"}],attributeUpdates:[{attributeOnThingsBoard:"shared",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{methodRPC:"rpc1",withResponse:!0,valueExpression:"${params}"}]}]};const en=e("connectorConfigs",{[gt.MQTT]:Gt,[gt.MODBUS]:zt,[gt.OPCUA]:Ut,[gt.BLE]:jt,[gt.REQUEST]:Ht,[gt.CAN]:Wt,[gt.BACNET]:$t,[gt.ODBC]:Kt,[gt.REST]:Yt,[gt.SNMP]:Xt,[gt.FTP]:Zt,[gt.SOCKET]:qt,[gt.XMPP]:Qt,[gt.OCPP]:Jt,[gt.KNX]:{3.7:{logLevel:"INFO",client:{type:"AUTOMATIC",addressFormat:"LONG",gatewayIP:"127.0.0.1",gatewayPort:3671,autoReconnect:!0,autoReconnectWait:3,gatewaysScanner:{enabled:!0,scanPeriod:3,stopOnFound:!1}},devices:[{deviceInfo:{deviceNameDataType:"string",deviceNameExpressionSource:"expression",deviceNameExpression:"Device ${1/0/5}",deviceProfileDataType:"none",deviceProfileExpressionSource:"constant",deviceProfileNameExpression:"default"},pollPeriod:5e3,attributes:[{type:"temperature",key:"temperature",groupAddress:"1/0/6"}],timeseries:[{type:"humidity",key:"humidity",groupAddress:"1/0/7"}]}],attributeUpdates:[{deviceNameFilter:".*",dataType:"precent_U8",groupAddress:"1/0/9",key:"brightness"}],serverSideRpc:[{requestType:"read",deviceNameFilter:".*",method:"get_name",dataType:"string",groupAddress:"1/0/5"},{requestType:"write",deviceNameFilter:".*",method:"set_name",dataType:"string",groupAddress:"1/0/5"}]}},[gt.S7]:{"3.8.5":{devices:[{type:"PLC",address:"127.0.0.1",port:1102,rack:0,slot:1,deviceName:"S7 PLC",deviceProfileName:"default",autoReconnect:!0,maxRetries:3,retryDelay:1,maxDelay:30,heartbeatInterval:5,pollPeriod:1e4,attributes:[{type:"tag",key:"power",tag:"DB1.DBD204:REAL"},{type:"tag",key:"frequency",tag:"DB1.DBD200:REAL"}],timeseries:[{type:"data",key:"temperature",dataType:"real",dbNumber:1,start:50,size:4},{type:"data",key:"humidity",dataType:"lreal",dbNumber:1,start:54,size:8},{type:"data",key:"relay",dataType:"bool",dbNumber:1,start:0,size:1,bit:0}],attributeUpdates:[{type:"tag",key:"relay",tag:"DB1.DBX0.0:BOOL"}],serverSideRpc:[{method:"getRelay",requestType:"read",type:"data",dataType:"bool",dbNumber:1,start:0,size:1,bit:0},{method:"setRelay",requestType:"write",type:"data",dataType:"bool",dbNumber:1,start:0,size:1,bit:0}]},{type:"LOGO",address:"127.0.0.1",port:102,tsapSnap7:20,tsapLogo:30,deviceName:"LOGO",deviceProfileName:"default",autoReconnect:!0,maxRetries:3,retryDelay:1,maxDelay:30,heartbeatInterval:5,pollPeriod:1e4,attributes:[],timeseries:[{type:"vm",key:"temperature",vmAddress:"VW30"},{type:"vm",key:"humidity",vmAddress:"VW0"}],attributeUpdates:[{type:"vm",key:"lightLevel",vmAddress:"VW30"}],serverSideRpc:[{method:"setLight",requestType:"write",type:"vm",vmAddress:"VW30"},{method:"getLight",requestType:"read",type:"vm",vmAddress:"VW30"}]}]}}});function tn(e){const t=en[e];if(!t)throw new Error("No default config found");return t}var nn;e("ModbusDataType",nn),function(e){e.STRING="string",e.BYTES="bytes",e.BITS="bits",e.INT8="8int",e.UINT8="8uint",e.INT16="16int",e.UINT16="16uint",e.FLOAT16="16float",e.INT32="32int",e.UINT32="32uint",e.FLOAT32="32float",e.INT64="64int",e.UINT64="64uint",e.FLOAT64="64float"}(nn||e("ModbusDataType",nn={}));const an=e("ModbusEditableDataTypes",[nn.BYTES,nn.BITS,nn.STRING]);var rn,on;e("ModbusObjectCountByDataType",rn),function(e){e[e["8int"]=1]="8int",e[e["8uint"]=1]="8uint",e[e["16int"]=1]="16int",e[e["16uint"]=1]="16uint",e[e["16float"]=1]="16float",e[e["32int"]=2]="32int",e[e["32uint"]=2]="32uint",e[e["32float"]=2]="32float",e[e["64int"]=4]="64int",e[e["64uint"]=4]="64uint",e[e["64float"]=4]="64float"}(rn||e("ModbusObjectCountByDataType",rn={})),e("MappingValueType",on),function(e){e.STRING="string",e.INTEGER="integer",e.DOUBLE="double",e.BOOLEAN="boolean"}(on||e("MappingValueType",on={}));const sn=e("mappingValueTypesMap",new Map([[on.STRING,{name:"value.string",icon:"mdi:format-text"}],[on.INTEGER,{name:"value.integer",icon:"mdi:numeric"}],[on.DOUBLE,{name:"value.double",icon:"mdi:numeric"}],[on.BOOLEAN,{name:"value.boolean",icon:"mdi:checkbox-marked-outline"}]])),ln=e("ModbusFunctionCodeTranslationsMap",new Map([[1,"gateway.function-codes.read-coils"],[2,"gateway.function-codes.read-discrete-inputs"],[3,"gateway.function-codes.read-multiple-holding-registers"],[4,"gateway.function-codes.read-input-registers"],[5,"gateway.function-codes.write-single-coil"],[6,"gateway.function-codes.write-single-holding-register"],[15,"gateway.function-codes.write-multiple-coils"],[16,"gateway.function-codes.write-multiple-holding-registers"]]));var pn,cn,dn;e("ConfigurationModes",pn),function(e){e.BASIC="basic",e.ADVANCED="advanced"}(pn||e("ConfigurationModes",pn={})),e("ReportStrategyType",cn),function(e){e.OnChange="ON_CHANGE",e.OnReportPeriod="ON_REPORT_PERIOD",e.OnChangeOrReportPeriod="ON_CHANGE_OR_REPORT_PERIOD",e.OnReceived="ON_RECEIVED"}(cn||e("ReportStrategyType",cn={})),e("ReportStrategyDefaultValue",dn),function(e){e[e.Gateway=6e4]="Gateway",e[e.Connector=6e4]="Connector",e[e.Device=3e4]="Device",e[e.Key=15e3]="Key"}(dn||e("ReportStrategyDefaultValue",dn={}));const un=e("ReportStrategyTypeTranslationsMap",new Map([[cn.OnChange,"gateway.report-strategy.on-change"],[cn.OnReportPeriod,"gateway.report-strategy.on-report-period"],[cn.OnChangeOrReportPeriod,"gateway.report-strategy.on-change-or-report-period"],[cn.OnReceived,"gateway.report-strategy.on-received"]])),mn=e("numberInputPattern",new RegExp(/^\d{1,15}(\.\d{1,15})?$/)),hn=e("noLeadTrailSpacesRegex",/^\S+(?: \S+)*$/),gn=e("integerRegex",/^[-+]?\d+$/),fn=e("nonZeroFloat",/^-?(?!0(\.0+)?$)\d+(\.\d+)?$/),yn=e("directoryRegex",new RegExp(/^\.\/[^.\/ ]+(?: [^.\/ ]+)*(?:\/[^.\/ ]+(?: [^.\/ ]+)*)*\/$/));var vn;!function(e){e.EXCEPTION="EXCEPTION"}(vn||(vn={}));const xn={...mt,...vn},bn=()=>[10,20,30];function wn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"a",19),t.ɵɵlistener("click",function(){const n=t.ɵɵrestoreView(e).$implicit,i=t.ɵɵnextContext();return t.ɵɵresetView(i.onTabChanged(n))}),t.ɵɵtext(1),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("active",i.activeLink.name===e.name),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.name," ")}}function Sn(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",20),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.created-time")))}function Cn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtext(1),t.ɵɵpipe(2,"date"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind2(2,1,e.ts,"yyyy-MM-dd HH:mm:ss")," ")}}function _n(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",21),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.level")))}function Tn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell")(1,"span"),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(i.statusClass(e.status)),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.status)}}function En(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",22),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.message")))}function Mn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵclassMap(i.statusClassMsg(e.status)),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.message," ")}}function In(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",23)}function kn(e,n){1&e&&t.ɵɵelement(0,"mat-row",23)}class Pn{constructor(e,t){this.translate=e,this.destroyRef=t,this.displayedColumns=["ts","status","message"],this.gatewayLogLinks=[{name:this.translate.instant("gateway.logs.columns.general"),key:"LOGS"},{name:this.translate.instant("gateway.logs.columns.service"),key:"SERVICE_LOGS"},{name:this.translate.instant("gateway.logs.columns.connection"),key:"CONNECTION_LOGS"},{name:this.translate.instant("gateway.logs.columns.storage"),key:"STORAGE_LOGS"},{key:"EXTENSIONS_LOGS",name:this.translate.instant("gateway.logs.columns.extension")}];const n={property:"ts",direction:x.DESC};this.pageLink=new b(10,0,null,n),this.dataSource=new f([])}ngOnInit(){this.updateWidgetTitle()}ngAfterViewInit(){if(this.dataSource.sort=this.sort,this.dataSource.paginator=this.paginator,this.ctx.settings.isConnectorLog&&this.ctx.settings.connectorLogState){const e=this.ctx.stateController.getStateParams()[this.ctx.settings.connectorLogState],t=this.ctx.settings.isRpcLog||"connector_rpc"===this.ctx.settings.connectorLogState||"connector_rpc"===this.ctx.stateController.getStateId();this.logLinks=t?[{key:`${e.key}_LOGS`,name:this.translate.instant("gateway.connector"),filterFn:e=>/(?!e.message.includes("_converter.py")},{key:`${e.key}_converter_LOGS`,name:this.translate.instant("gateway.converter"),filterFn:e=>e.message.includes("_converter.py")}]}else this.logLinks=this.gatewayLogLinks;this.activeLink=this.logLinks[0],this.changeSubscription()}updateWidgetTitle(){if(this.ctx.settings.isConnectorLog&&this.ctx.settings.connectorLogState){const e=this.ctx.widgetConfig.title,t="${connectorName}";if(e.includes(t)){const n=this.ctx.stateController.getStateParams()[this.ctx.settings.connectorLogState];this.ctx.widgetTitle=e.replace(t,n.key)}}}updateData(e){if(e.data.length&&e.data[0]){let t=e.data[0].data.map(e=>{const t={ts:e[0],key:this.activeLink.key,message:e[1],status:"INVALID LOG FORMAT"};try{t.message=/\[(.*)/.exec(e[1])[0]}catch(n){t.message=e[1]}try{t.status=e[1].match(/\|(\w+)\|/)[1]}catch(e){t.status="INVALID LOG FORMAT"}return t});this.activeLink.filterFn&&(t=t.filter(e=>this.activeLink.filterFn(e))),this.dataSource.data=t}}onTabChanged(e){this.activeLink=e,this.changeSubscription()}statusClass(e){switch(e){case xn.DEBUG:return"status status-debug";case xn.WARNING:return"status status-warning";case xn.ERROR:case xn.EXCEPTION:return"status status-error";default:return"status status-info"}}statusClassMsg(e){if(e===xn.EXCEPTION)return"msg-status-exception"}trackByLogTs(e,t){return t.ts}changeSubscription(){if(!this.ctx.datasources?.[0]?.entity||!this.ctx.defaultSubscription.options.datasources)return;const e=(this.logsSubscription??this.ctx.defaultSubscription).timeWindowConfig;this.ctx.defaultSubscription.unsubscribe(),this.logsSubscription&&(this.ctx.subscriptionApi.removeSubscription(this.logsSubscription.id),this.logsSubscription=null),this.dataSource.data=[];const t=this.activeLink,n={...this.ctx.defaultSubscription.options.datasources[0],dataKeys:[{name:t.key,type:w.timeseries,settings:{}}]};this.ctx.subscriptionApi.createSubscription({type:S.timeseries,datasources:[n],useDashboardTimewindow:!1,timeWindowConfig:e,callbacks:{onDataUpdated:e=>this.ctx.ngZone.run(()=>this.updateData(e))}},!0).pipe(de(this.destroyRef)).subscribe(e=>{t===this.activeLink?this.logsSubscription=e:this.ctx.subscriptionApi.removeSubscription(e.id)})}static{this.ɵfac=function(e){return new(e||Pn)(t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Pn,selectors:[["tb-gateway-logs"]],viewQuery:function(e,n){if(1&e&&(t.ɵɵviewQuery(g,5),t.ɵɵviewQuery(y,5)),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.sort=e.first),t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.paginator=e.first)}},inputs:{ctx:"ctx",dialogRef:"dialogRef"},decls:24,vars:22,consts:[["tabPanel",""],[1,"flex","h-full","flex-col"],["mat-tab-nav-bar","",3,"tabPanel"],["mat-tab-link","",3,"active"],[1,"flex-1","overflow-auto"],["mat-table","","matSort","","matSortDisableClear","",3,"dataSource","trackBy","matSortActive","matSortDirection"],["matColumnDef","ts"],["mat-sort-header","","style","width: 20%",4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","status"],["mat-sort-header","","style","width: 10%",4,"matHeaderCellDef"],["matColumnDef","message"],["mat-sort-header","","style","width: 70%",4,"matHeaderCellDef"],[3,"class",4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","mat-row-select",4,"matRowDef","matRowDefColumns"],[1,"no-data-found","flex-1","items-center","justify-center"],[1,"flex-1"],["showFirstLastButtons","",3,"length","pageIndex","pageSize","pageSizeOptions"],["mat-tab-link","",3,"click","active"],["mat-sort-header","",2,"width","20%"],["mat-sort-header","",2,"width","10%"],["mat-sort-header","",2,"width","70%"],[1,"mat-row-select"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"nav",2),t.ɵɵrepeaterCreate(2,wn,2,2,"a",3,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵelement(4,"mat-tab-nav-panel",null,0),t.ɵɵelementStart(6,"div",4)(7,"table",5),t.ɵɵelementContainerStart(8,6),t.ɵɵtemplate(9,Sn,3,3,"mat-header-cell",7)(10,Cn,3,4,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(11,9),t.ɵɵtemplate(12,_n,3,3,"mat-header-cell",10)(13,Tn,3,3,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(14,11),t.ɵɵtemplate(15,En,3,3,"mat-header-cell",12)(16,Mn,2,3,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(17,In,1,0,"mat-header-row",14)(18,kn,1,0,"mat-row",15),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"span",16),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"span",17),t.ɵɵelementEnd(),t.ɵɵelement(23,"mat-paginator",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵreference(5);t.ɵɵadvance(),t.ɵɵclassProp("!hidden",(null==n.logLinks?null:n.logLinks.length)<2),t.ɵɵproperty("tabPanel",e),t.ɵɵadvance(),t.ɵɵrepeater(n.logLinks),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource)("trackBy",n.trackByLogTs)("matSortActive",n.pageLink.sortOrder.property)("matSortDirection",n.pageLink.sortDirection()),t.ɵɵadvance(10),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",0!==n.dataSource.data.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,19,"attribute.no-telemetry-text")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",0===n.dataSource.data.length),t.ɵɵadvance(),t.ɵɵproperty("length",n.dataSource.data.length)("pageIndex",n.pageLink.page)("pageSize",n.pageLink.pageSize)("pageSizeOptions",t.ɵɵpureFunction0(21,bn))}},dependencies:t.ɵɵgetComponentDepsFactory(Pn,[ce,C]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;overflow-x:auto;padding:0}[_nghost-%COMP%] .status[_ngcontent-%COMP%]{border-radius:20px;font-weight:500;padding:5px 15px}[_nghost-%COMP%] .status-debug[_ngcontent-%COMP%]{color:green;background:#0080001a}[_nghost-%COMP%] .status-warning[_ngcontent-%COMP%]{color:orange;background:#ffa5001a}[_nghost-%COMP%] .status-error[_ngcontent-%COMP%]{color:red;background:#ff00001a}[_nghost-%COMP%] .status-info[_ngcontent-%COMP%]{color:#00f;background:#0000801a}[_nghost-%COMP%] .msg-status-exception[_ngcontent-%COMP%]{color:red}']})}}e("GatewayLogsComponent",Pn);const Dn=["commandInput"],An=e=>({command:e}),On=(e,t)=>t.attributeOnGateway;function Rn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.clear())}),t.ɵɵelementStart(2,"mat-icon",11),t.ɵɵtext(3,"close"),t.ɵɵelementEnd()()}2&e&&t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"action.clear")))}function Bn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onCreateNewClick(n))}),t.ɵɵelementStart(1,"span",13),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"notification.create-new")))}function Fn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵelement(1,"span",14),t.ɵɵpipe(2,"async"),t.ɵɵpipe(3,"highlight"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(3,4,e.attributeOnGateway,t.ɵɵpipeBind1(2,2,i.searchText$)),t.ɵɵsanitizeHtml)}}function Nn(e,n){if(1&e&&(t.ɵɵtext(0),t.ɵɵpipe(1,"async"),t.ɵɵpipe(2,"translate")),2&e){const e=t.ɵɵnextContext(2);t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind2(2,3,"gateway.statistics.no-commands-matching",t.ɵɵpureFunction1(6,An,e.truncate.transform(t.ɵɵpipeBind1(1,1,e.searchText$),!0,6,"...")))," ")}}function Ln(e,n){1&e&&(t.ɵɵtext(0),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(1,1,"gateway.statistics.no-command-found")," ")}function Vn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-option",9)(1,"div",15),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(2,"span"),t.ɵɵconditionalCreate(3,Nn,3,8),t.ɵɵpipe(4,"async"),t.ɵɵconditionalBranchCreate(5,Ln,2,3),t.ɵɵelementStart(6,"a",16),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onCreateNewClick(n))}),t.ɵɵtext(7,"gateway.create-new-one"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("value",null),t.ɵɵadvance(3),t.ɵɵconditional(t.ɵɵpipeBind1(4,2,e.searchText$)?3:5)}}class qn{constructor(e,t,a){this.truncate=e,this.fb=t,this.destroyRef=a,this.commands=n(),this.onCreateNewClicked=i(),this.selectStatisticsCommandControl=this.fb.control({}),this.searchText$=this.selectStatisticsCommandControl.valueChanges.pipe(Ae(e=>e?"string"==typeof e?e:e?.attributeOnGateway:""),Oe(),Se(1)),this.filteredCommands$=Ce([this.searchText$,ue(this.commands)]).pipe(Re(150),Ae(([e,t])=>{const n=t.find(t=>t.attributeOnGateway===e)??null,i=this.selectStatisticsCommandControl.value;return"string"==typeof i&&n?.attributeOnGateway!==e||this.selectStatisticsCommandControl.patchValue(n,{emitEvent:!Y(n,i)}),t.filter(t=>t.attributeOnGateway.toLowerCase().includes(e?.toLowerCase()??""))}),Se(1)),this.onChanges=e=>{},this.selectStatisticsCommandControl.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>this.onChanges(e))}registerOnChange(e){this.onChanges=e}registerOnTouched(e){}writeValue(e){this.selectStatisticsCommandControl.patchValue(e)}displayCommandFn(e){return e?e.attributeOnGateway:null}clear(){this.selectStatisticsCommandControl.patchValue(null,{emitEvent:!0}),setTimeout(()=>{this.commandInput.nativeElement.blur(),this.commandInput.nativeElement.focus()},0)}onCreateNewClick(e){e.stopPropagation(),this.onCreateNewClicked.emit()}static{this.ɵfac=function(e){return new(e||qn)(t.ɵɵdirectiveInject(_.TruncatePipe),t.ɵɵdirectiveInject(fe.UntypedFormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:qn,selectors:[["tb-statistics-commands-autocomplete"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Dn,7),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.commandInput=e.first)}},inputs:{commands:[1,"commands"]},outputs:{onCreateNewClicked:"onCreateNewClicked"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>qn),multi:!0}])],decls:14,vars:10,consts:[["commandInput",""],["commandAutocomplete","matAutocomplete"],["appearance","outline",1,"mat-block"],["translate",""],["matInput","","type","text",3,"formControl","matAutocomplete"],["type","button","matTooltipPosition","above","matSuffix","","mat-icon-button","","aria-label","Clear",1,"action-button",3,"matTooltip"],["mat-button","","color","primary","matSuffix","",1,"mr-2"],[1,"tb-autocomplete",3,"displayWith"],[3,"value"],[1,"tb-not-found",3,"value"],["type","button","matTooltipPosition","above","matSuffix","","mat-icon-button","","aria-label","Clear",1,"action-button",3,"click","matTooltip"],[1,"material-icons"],["mat-button","","color","primary","matSuffix","",1,"mr-2",3,"click"],[1,"whitespace-nowrap"],[3,"innerHTML"],[1,"tb-not-found-content",3,"click"],["translate","",3,"click"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",2)(1,"mat-label",3),t.ɵɵtext(2,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",4,0),t.ɵɵpipe(5,"translate"),t.ɵɵconditionalCreate(6,Rn,4,4,"button",5)(7,Bn,4,3,"button",6),t.ɵɵelementStart(8,"mat-autocomplete",7,1),t.ɵɵrepeaterCreate(10,Fn,4,7,"mat-option",8,On,!1,Vn,8,4,"mat-option",9),t.ɵɵpipe(13,"async"),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵreference(9);t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.selectStatisticsCommandControl)("matAutocomplete",e),t.ɵɵattribute("aria-label",t.ɵɵpipeBind1(5,6,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵconditional(n.selectStatisticsCommandControl.value?6:7),t.ɵɵadvance(2),t.ɵɵproperty("displayWith",n.displayCommandFn),t.ɵɵadvance(2),t.ɵɵrepeater(t.ɵɵpipeBind1(13,8,n.filteredCommands$))}},dependencies:t.ɵɵgetComponentDepsFactory(qn,[ce,C]),styles:['@charset "UTF-8";[_nghost-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{border-bottom:none;color:inherit}[_nghost-%COMP%] .action-button[_ngcontent-%COMP%]{opacity:.7}']})}}const Gn=()=>["createdTime","message"];function zn(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",12),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.created-time")))}function Un(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",13),t.ɵɵtext(1),t.ɵɵpipe(2,"date"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(2,1,e[0],"yyyy-MM-dd HH:mm:ss"))}}function jn(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",14),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"widgets.gateway.message")," "))}function Hn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell")(1,"div",15),t.ɵɵtext(2),t.ɵɵelement(3,"tb-copy-button",16),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",e[1]," "),t.ɵɵadvance(),t.ɵɵproperty("tooltipText",t.ɵɵinterpolate(t.ɵɵpipeBind1(4,4,"gateway.statistics.copy-message")))("copyText",e[1])}}function Wn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",17)}function $n(e,n){1&e&&t.ɵɵelement(0,"mat-row",17)}class Kn{constructor(){this.data=n([]),this.defaultPageSizes=[10,20,30],this.defaultSortOrder={property:"0",direction:x.DESC},this.pageLink=new b(this.defaultPageSizes[0],0,null,this.defaultSortOrder),this.dataSource=new f([]),r(()=>{this.dataSource.data=this.data()})}ngAfterViewInit(){this.dataSource.sort=this.sort,this.dataSource.paginator=this.paginator,this.dataSource.sortingDataAccessor=e=>e[Number(this.sort?.active)||0]}static{this.ɵfac=function(e){return new(e||Kn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Kn,selectors:[["tb-custom-statistics-table"]],viewQuery:function(e,n){if(1&e&&(t.ɵɵviewQuery(g,5),t.ɵɵviewQuery(y,5)),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.sort=e.first),t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.paginator=e.first)}},inputs:{data:[1,"data"]},decls:12,vars:13,consts:[[1,"flex","h-full","flex-col"],[1,"flex-1","overflow-auto"],["mat-table","","matSort","","matSortDisableClear","",3,"dataSource","matSortActive","matSortDirection"],["matColumnDef","createdTime"],["mat-sort-header","","class","w-1/5",4,"matHeaderCellDef"],["class","!w-1/5",4,"matCellDef"],["matColumnDef","message"],["mat-sort-header","",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","mat-row-select",4,"matRowDef","matRowDefColumns"],["showFirstLastButtons","",3,"length","pageSize","pageSizeOptions"],["mat-sort-header","",1,"w-1/5"],[1,"!w-1/5"],["mat-sort-header",""],[1,"flex","items-center","justify-between"],["tooltipPosition","above","icon","content_copy",1,"copy-content",3,"copyText","tooltipText"],[1,"mat-row-select"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"table",2),t.ɵɵelementContainerStart(3,3),t.ɵɵtemplate(4,zn,3,3,"mat-header-cell",4)(5,Un,3,4,"mat-cell",5),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(6,6),t.ɵɵtemplate(7,jn,3,3,"mat-header-cell",7)(8,Hn,5,6,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(9,Wn,1,0,"mat-header-row",9)(10,$n,1,0,"mat-row",10),t.ɵɵelementEnd()(),t.ɵɵelement(11,"mat-paginator",11),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("dataSource",n.dataSource)("matSortActive",n.pageLink.sortOrder.property)("matSortDirection",n.pageLink.sortDirection()),t.ɵɵadvance(7),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(11,Gn))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(12,Gn)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",!n.dataSource.data.length),t.ɵɵproperty("length",(null==n.dataSource||null==n.dataSource.data?null:n.dataSource.data.length)??0)("pageSize",n.defaultPageSizes[0])("pageSizeOptions",n.defaultPageSizes))},dependencies:t.ɵɵgetComponentDepsFactory(Kn,[ce,C]),styles:['@charset "UTF-8";[_nghost-%COMP%] .copy-content .mat-icon{padding:4px;font-size:18px}']})}}class Yn{constructor(e,t,n){this.elementRef=e,this.renderer=t,this.tooltip=n,this.tooltipEnabled=!0,this.position="above",this.destroy$=new _e}ngOnInit(){this.observeMouseEvents(),this.applyTruncationStyles()}ngAfterViewInit(){this.tooltip.position=this.position}ngOnDestroy(){this.tooltip._isTooltipVisible()&&this.hideTooltip(),this.destroy$.next(),this.destroy$.complete()}observeMouseEvents(){Te(this.elementRef.nativeElement,"mouseenter").pipe(Be(()=>this.tooltipEnabled),Be(()=>this.isOverflown(this.elementRef.nativeElement)),Fe(()=>this.showTooltip()),Ne(this.destroy$)).subscribe(),Te(this.elementRef.nativeElement,"mouseleave").pipe(Be(()=>this.tooltipEnabled),Be(()=>this.tooltip._isTooltipVisible()),Fe(()=>this.hideTooltip()),Ne(this.destroy$)).subscribe()}applyTruncationStyles(){this.renderer.setStyle(this.elementRef.nativeElement,"white-space","nowrap"),this.renderer.setStyle(this.elementRef.nativeElement,"overflow","hidden"),this.renderer.setStyle(this.elementRef.nativeElement,"text-overflow","ellipsis")}isOverflown(e){return e.clientWidth{this.adjustChips()},0))}constructor(e,t,n,i){this.el=e,this.renderer=t,this.translate=n,this.window=i,this.destroy$=new _e,this.renderer.setStyle(this.el.nativeElement,"max-height","48px"),this.renderer.setStyle(this.el.nativeElement,"overflow","auto"),Te(i,"resize").pipe(Ne(this.destroy$)).subscribe(()=>{this.adjustChips()}),this.observeIntersection()}observeIntersection(){this.intersectionObserver=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&this.adjustChips()})}),this.intersectionObserver.observe(this.el.nativeElement)}adjustChips(){const e=this.el.nativeElement,t=this.el.nativeElement.querySelector(".ellipsis-chip"),n=parseFloat(this.window.getComputedStyle(t).marginLeft)||0,i=e.querySelectorAll("mat-chip:not(.ellipsis-chip)");if(this.chipsValue.length>1){const a=this.el.nativeElement.querySelector(".ellipsis-text");this.renderer.setStyle(t,"display","inline-flex"),a.innerHTML=this.translate.instant("gateway.ellipsis-chips-text",{count:this.chipsValue.length});const r=e.offsetWidth-(t.offsetWidth+n);let o=0,s=0;i.forEach(e=>{this.renderer.setStyle(e,"display","inline-flex");const t=e.querySelector(".mdc-evolution-chip__text-label");this.applyMaxChipTextWidth(t,r/3),o+(e.offsetWidth+n)<=r&&sIe(E()))).subscribe(e=>{this.attributesSubject.next(e.data),this.pageDataSubject.next(e),a.next(e)}),a}fetchAttributes(e,t,n){return this.getAllAttributes(e,t).pipe(Ae(e=>{const t=e.filter(e=>0!==e.lastUpdateTs);return n.filterData(t)}))}getAllAttributes(e,t){if(!this.allAttributes){let n;M.get(t)?(this.telemetrySubscriber=I.createEntityAttributesSubscription(this.telemetryWsService,e,t,this.zone),this.telemetrySubscriber.subscribe(),n=this.telemetrySubscriber.attributeData$()):n=this.attributeService.getEntityAttributes(e,t),this.allAttributes=n.pipe(Ve(1),qe())}return this.allAttributes}isAllSelected(){const e=this.selection.selected.length;return this.attributesSubject.pipe(Ae(t=>e===t.length))}isEmpty(){return this.attributesSubject.pipe(Ae(e=>!e.length))}total(){return this.pageDataSubject.pipe(Ae(e=>e.totalElements))}masterToggle(){this.attributesSubject.pipe(Fe(e=>{this.selection.selected.length===e.length?this.selection.clear():e.forEach(e=>{this.selection.select(e)})}),Ge(1)).subscribe()}}e("AttributeDatasource",Zn);const Qn=()=>({maxWidth:"970px"});function Jn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",2)(1,"mat-expansion-panel-header",3)(2,"mat-panel-title")(3,"mat-slide-toggle",4),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(4,"mat-label"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementContainer(7,5),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(4);t.ɵɵproperty("expanded",e.showStrategyControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showStrategyControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,4,"gateway.report-strategy.label")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n)}}function ei(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",6),t.ɵɵtext(1,"gateway.report-strategy.label"),t.ɵɵelementEnd(),t.ɵɵelementContainer(2,5)),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(4);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e)}}function ti(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.ReportTypeTranslateMap.get(e)))}}function ni(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.reportStrategyFormGroup.get("reportPeriod").hasError("min")?"gateway.hints.report-period-range":"gateway.hints.report-period-required"))}}function ii(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",13),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",10),t.ɵɵelement(5,"input",14),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,ni,3,3,"mat-icon",15),t.ɵɵelementStart(8,"span",16),t.ɵɵtext(9,"gateway.suffix.ms"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,4,"gateway.report-strategy.report-period")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,6,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.reportStrategyFormGroup.get("reportPeriod").hasError("required")||e.reportStrategyFormGroup.get("reportPeriod").hasError("min")&&e.reportStrategyFormGroup.get("reportPeriod").touched?7:-1)}}function ai(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",8),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"div",9),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-select",11),t.ɵɵrepeaterCreate(7,ti,3,4,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(9,ii,10,8,"div",7)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,4,"gateway.type")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/report-strategy_fn")("tb-help-popup-style",t.ɵɵpureFunction0(6,Qn)),t.ɵɵadvance(3),t.ɵɵrepeater(e.reportStrategyTypes),t.ɵɵadvance(2),t.ɵɵconditional(e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnChange&&e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnReceived?9:-1)}}class ri{constructor(e){this.fb=e,this.isExpansionMode=!1,this.defaultValue=dn.Key,this.isConfig=!1,this.reportStrategyTypes=Object.values(cn),this.ReportTypeTranslateMap=un,this.ReportStrategyType=cn,this.destroy$=new _e,this.showStrategyControl=this.fb.control(!1),this.reportStrategyFormGroup=this.fb.group({type:[{value:cn.OnReportPeriod,disabled:!0},[]],reportPeriod:[{value:this.defaultValue,disabled:!0},[ve.required,ve.min(100)]]}),this.observeStrategyFormChange(),this.observeStrategyToggle()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){const t=this.isDisabledConfig(e);if(this.isExpansionMode&&this.showStrategyControl.setValue(!t&&!!e,{emitEvent:!1}),t||!e)return this.reportStrategyFormGroup.disable({emitEvent:!1}),void this.reportStrategyFormGroup.setValue(this.getDefaultConfig(),{emitEvent:!1});this.reportStrategyFormGroup.enable({emitEvent:!1});const n=this.getDefaultConfig(),{type:i=n.type,reportPeriod:a=n.reportPeriod}=e??{};this.reportStrategyFormGroup.setValue({type:i,reportPeriod:a},{emitEvent:!1}),this.onTypeChange(i)}validate(){return this.reportStrategyFormGroup.valid||this.reportStrategyFormGroup.disabled?null:{reportStrategyForm:{valid:!1}}}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}observeStrategyFormChange(){this.reportStrategyFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e),this.onTouched()}),this.reportStrategyFormGroup.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.onTypeChange(e))}observeStrategyToggle(){this.showStrategyControl.valueChanges.pipe(Ne(this.destroy$),Be(()=>this.isExpansionMode)).subscribe(e=>{if(e)this.reportStrategyFormGroup.enable({emitEvent:!1}),this.onTypeChange(this.reportStrategyFormGroup.get("type").value),this.reportStrategyFormGroup.updateValueAndValidity({emitEvent:!1}),this.onChange(this.reportStrategyFormGroup.value);else{this.reportStrategyFormGroup.disable({emitEvent:!1});const e=this.isConfig?{type:"DISABLED"}:null;this.onChange(e)}})}onTypeChange(e){const t=this.reportStrategyFormGroup.get("reportPeriod");e===cn.OnChange||e===cn.OnReceived?t.disable({emitEvent:!1}):this.isExpansionMode&&!this.showStrategyControl.value||(t.enable({emitEvent:!1}),this.isConfig&&t.setValue(dn.Gateway,{emitEvent:!1}))}getDefaultConfig(){return{type:this.isConfig?cn.OnReceived:cn.OnReportPeriod,reportPeriod:this.isConfig?null:this.defaultValue}}isDisabledConfig(e){return this.isConfig&&("DISABLED"===e?.type||"DISABLED"===e?.type)}static{this.ɵfac=function(e){return new(e||ri)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ri,selectors:[["tb-report-strategy"]],inputs:{isExpansionMode:"isExpansionMode",defaultValue:"defaultValue",isConfig:"isConfig"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>ri),multi:!0},{provide:xe,useExisting:a(()=>ri),multi:!0}])],decls:5,vars:2,consts:[["strategyFields",""],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],[3,"ngTemplateOutlet"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","flex","items-center","gap-2"],["matSuffix","","tb-help-popup-placement","right",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","type"],[3,"value"],["tbTruncateWithTooltip","",1,"fixed-title-width","tb-required"],["matInput","","type","number","min","100","name","value","formControlName","reportPeriod",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","","matSuffix","",1,"block","pr-2"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,1),t.ɵɵconditionalCreate(1,Jn,8,6,"mat-expansion-panel",2)(2,ei,3,1),t.ɵɵtemplate(3,ai,10,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.reportStrategyFormGroup),t.ɵɵadvance(),t.ɵɵconditional(n.isExpansionMode?1:2))},dependencies:t.ɵɵgetComponentDepsFactory(ri,[ce,C,Yn]),encapsulation:2,changeDetection:o.OnPush})}}e("ReportStrategyComponent",ri),Ye([T()],ri.prototype,"isExpansionMode",void 0),Ye([k()],ri.prototype,"defaultValue",void 0),Ye([T()],ri.prototype,"isConfig",void 0);class oi{constructor(e,t){this.attributeService=e,this.cd=t,this.isGatewayActive=!1}ngAfterViewInit(){this.ctx.$scope.gatewayStatus=this,this.loadGatewayState()}loadGatewayState(){this.attributeService.getEntityAttributes(this.deviceId,P.SERVER_SCOPE,["active","lastDisconnectTime","lastConnectTime"]).subscribe(e=>{const t=e.find(e=>"active"===e.key).value,n=e.find(e=>"lastDisconnectTime"===e.key)?.value,i=e.find(e=>"lastConnectTime"===e.key)?.value;this.isGatewayActive=this.getGatewayStatus(t,i,n),this.cd.detectChanges()})}getGatewayStatus(e,t,n){return!!e&&(!n||t>n)}onDataUpdated(){const e=this.ctx.defaultSubscription.data,t=e.find(e=>"active"===e.dataKey.name).data[0][1],n=e.find(e=>"lastDisconnectTime"===e.dataKey.name).data[0][1],i=e.find(e=>"lastConnectTime"===e.dataKey.name).data[0][1];this.isGatewayActive=this.getGatewayStatus(t,i,n),this.cd.detectChanges()}static{this.ɵfac=function(e){return new(e||oi)(t.ɵɵdirectiveInject(Z.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:oi,selectors:[["tb-gateway-status"]],inputs:{ctx:"ctx",deviceId:"deviceId"},decls:9,vars:10,consts:[[1,"flex","min-h-10","flex-1","justify-center"],[1,"divider"],[1,"whitespace-nowrap"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-card",0),t.ɵɵelement(1,"div",1),t.ɵɵelementStart(2,"mat-card-header")(3,"mat-card-subtitle",2),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"mat-card-content"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵclassProp("divider-red",!n.isGatewayActive)("divider-green",n.isGatewayActive),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,6,"gateway.gateway-status")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,8,n.isGatewayActive?"gateway.active":"gateway.inactive")))},dependencies:t.ɵɵgetComponentDepsFactory(oi,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex}[_nghost-%COMP%] .divider[_ngcontent-%COMP%]{position:absolute;width:3px;top:12px;border-radius:2px;bottom:4px;left:10px}[_nghost-%COMP%] .divider-green[_ngcontent-%COMP%] .divider[_ngcontent-%COMP%]{border:1px solid rgb(25,128,56);background-color:#198038}[_nghost-%COMP%] .divider-green[_ngcontent-%COMP%] .mat-mdc-card-content[_ngcontent-%COMP%]{color:#198038}[_nghost-%COMP%] .divider-red[_ngcontent-%COMP%] .divider[_ngcontent-%COMP%]{border:1px solid rgb(203,37,48);background-color:#cb2530}[_nghost-%COMP%] .divider-red[_ngcontent-%COMP%] .mat-mdc-card-content[_ngcontent-%COMP%]{color:#cb2530}.mdc-card[_ngcontent-%COMP%]{position:relative;padding-left:10px;box-shadow:none}.mat-mdc-card-subtitle[_ngcontent-%COMP%]{font-weight:400;font-size:12px}.mat-mdc-card-header[_ngcontent-%COMP%]{padding:8px 16px 0}.mat-mdc-card-content[_ngcontent-%COMP%]:last-child{padding-bottom:8px;font-size:16px}'],changeDetection:o.OnPush})}}e("GatewayStatusComponent",oi);class si{constructor(){this.tooltipText=""}static{this.ɵfac=function(e){return new(e||si)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:si,selectors:[["tb-error-icon"]],inputs:{tooltipText:"tooltipText"},decls:2,vars:1,consts:[["matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",0),t.ɵɵtext(1," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",n.tooltipText)},dependencies:t.ɵɵgetComponentDepsFactory(si,[C]),styles:["[_nghost-%COMP%]{display:flex;width:40px;height:40px;padding:10px}mat-icon[_ngcontent-%COMP%]{font-size:20px}"]})}}var li,pi;e("ErrorTooltipIconComponent",si),e("MqttConverterType",li),function(e){e.JSON="json",e.BYTES="bytes",e.CUSTOM="custom"}(li||e("MqttConverterType",li={})),e("MQTTSourceType",pi),function(e){e.MSG="message",e.TOPIC="topic",e.CONST="constant"}(pi||e("MQTTSourceType",pi={}));const ci=e("MqttVersions",[{name:3.1,value:3},{name:3.11,value:4},{name:5,value:5}]),di=e("QualityTypeTranslationsMap",new Map([[0,"gateway.qos.at-most-once"],[1,"gateway.qos.at-least-once"],[2,"gateway.qos.exactly-once"]])),ui=e("ConvertorTypeTranslationsMap",new Map([[li.JSON,"gateway.JSON"],[li.BYTES,"gateway.bytes"],[li.CUSTOM,"gateway.custom"]]));var mi;e("RequestType",mi),function(e){e.CONNECT_REQUEST="connectRequests",e.DISCONNECT_REQUEST="disconnectRequests",e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(mi||e("RequestType",mi={}));const hi=e("RequestTypesTranslationsMap",new Map([[mi.CONNECT_REQUEST,"gateway.request.connect-request"],[mi.DISCONNECT_REQUEST,"gateway.request.disconnect-request"],[mi.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[mi.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[mi.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]])),gi=e("DataConversionTranslationsMap",new Map([[li.JSON,"gateway.JSON-hint"],[li.BYTES,"gateway.bytes-hint"],[li.CUSTOM,"gateway.custom-hint"]]));var fi,yi;e("SocketType",fi),function(e){e.TCP="TCP",e.UDP="UDP"}(fi||e("SocketType",fi={})),e("SocketValueKey",yi),function(e){e.TIMESERIES="telemetry",e.ATTRIBUTES="attributes",e.ATTRIBUTES_REQUESTS="attributeRequests",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_METHODS="serverSideRpc"}(yi||e("SocketValueKey",yi={}));const vi=e("SocketKeysPanelTitleTranslationsMap",new Map([[yi.ATTRIBUTES,"gateway.attributes"],[yi.TIMESERIES,"gateway.timeseries"],[yi.ATTRIBUTES_REQUESTS,"gateway.attribute-requests"],[yi.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[yi.RPC_METHODS,"gateway.rpc-methods"]]));var xi,bi;e("RequestsType",xi),function(e){e.Shared="shared",e.Client="client"}(xi||e("RequestsType",xi={})),e("ExpressionType",bi),function(e){e.Constant="constant",e.Expression="expression"}(bi||e("ExpressionType",bi={}));const wi=e("SocketKeysAddKeyTranslationsMap",new Map([[yi.ATTRIBUTES,"gateway.add-attribute"],[yi.TIMESERIES,"gateway.add-timeseries"],[yi.ATTRIBUTES_REQUESTS,"gateway.add-attribute-request"],[yi.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[yi.RPC_METHODS,"gateway.add-rpc-method"]])),Si=e("SocketKeysDeleteKeyTranslationsMap",new Map([[yi.ATTRIBUTES,"gateway.delete-attribute"],[yi.TIMESERIES,"gateway.delete-timeseries"],[yi.ATTRIBUTES_REQUESTS,"gateway.delete-attribute-request"],[yi.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[yi.RPC_METHODS,"gateway.delete-rpc-method"]])),Ci=e("SocketKeysNoKeysTextTranslationsMap",new Map([[yi.ATTRIBUTES,"gateway.no-attributes"],[yi.TIMESERIES,"gateway.no-timeseries"],[yi.ATTRIBUTES_REQUESTS,"gateway.no-attribute-requests"],[yi.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[yi.RPC_METHODS,"gateway.no-rpc-methods"]]));var _i,Ti,Ei,Mi;e("RestConverterType",_i),function(e){e.JSON="json",e.CUSTOM="custom"}(_i||e("RestConverterType",_i={})),e("RestSourceType",Ti),function(e){e.REQUEST="request",e.CONST="constant"}(Ti||e("RestSourceType",Ti={})),e("ResponseType",Ei),function(e){e.DEFAULT="default",e.CONST="constant",e.ADVANCED="advanced"}(Ei||e("ResponseType",Ei={})),e("ResponseStatus",Mi),function(e){e.OK="OK",e.ERROR="Error"}(Mi||e("ResponseStatus",Mi={}));const Ii=e("ResponseTypeTranslationsMap",new Map([[Ei.DEFAULT,"gateway.rest.response-type.default"],[Ei.CONST,"gateway.rest.response-type.const"],[Ei.ADVANCED,"gateway.rest.response-type.advanced"]]));var ki;e("RestRequestType",ki),function(e){e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(ki||e("RestRequestType",ki={}));const Pi=e("RestRequestTypesTranslationsMap",new Map([[ki.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[ki.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[ki.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]]));var Di;e("RestRequestsScopeType",Di),function(e){e.Shared="shared",e.Client="client"}(Di||e("RestRequestsScopeType",Di={}));const Ai=e("RestRequestTypeFieldsMap",new Map([[ki.ATTRIBUTE_REQUEST,["HTTPMethods","endpoint","type","deviceNameExpression","attributeNameExpression"]],[ki.ATTRIBUTE_UPDATE,["HTTPMethod","SSLVerify","deviceNameFilter","attributeFilter","requestUrlExpression","valueExpression","httpHeaders","tries","allowRedirects"]],[ki.SERVER_SIDE_RPC,["HTTPMethod","deviceNameFilter","methodFilter","requestUrlExpression","valueExpression","responseTimeout","httpHeaders","tries"]],["all",["requestType","timeout","security"]]])),Oi=e("RestConvertorTypeTranslationsMap",new Map([[_i.JSON,"gateway.JSON"],[_i.CUSTOM,"gateway.custom"]])),Ri=e("RestDataConversionTranslationsMap",new Map([[_i.JSON,"gateway.hints.rest.JSON"],[_i.CUSTOM,"gateway.custom-hint"]]));var Bi;e("PortLimits",Bi),function(e){e[e.MIN=1]="MIN",e[e.MAX=65535]="MAX"}(Bi||e("PortLimits",Bi={}));const Fi=e("GatewayConnectorConfigVersionMap",new Map([[gt.S7,ht.v3_8_5],[gt.REST,ht.v3_7_2],[gt.KNX,ht.v3_7_0],[gt.BACNET,ht.v3_6_2],[gt.SOCKET,ht.v3_6_0],[gt.MQTT,ht.v3_5_2],[gt.OPCUA,ht.v3_5_2],[gt.MODBUS,ht.v3_5_2]]));var Ni,Li,Vi,qi;e("OPCUaSourceType",Ni),function(e){e.PATH="path",e.IDENTIFIER="identifier",e.CONST="constant"}(Ni||e("OPCUaSourceType",Ni={})),e("SecurityType",Li),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic",e.CERTIFICATES="certificates"}(Li||e("SecurityType",Li={})),e("ModeType",Vi),function(e){e.NONE="None",e.SIGN="Sign",e.SIGNANDENCRYPT="SignAndEncrypt"}(Vi||e("ModeType",Vi={})),e("MappingType",qi),function(e){e.DATA="data",e.REQUESTS="requests",e.OPCUA="OPCua"}(qi||e("MappingType",qi={}));const Gi=e("MappingTypeTranslationsMap",new Map([[qi.DATA,"gateway.data-mapping"],[qi.REQUESTS,"gateway.requests-mapping"],[qi.OPCUA,"gateway.data-mapping"]]));var zi;e("SecurityPolicy",zi),function(e){e.BASIC128="Basic128Rsa15",e.BASIC256="Basic256",e.BASIC256SHA="Basic256Sha256"}(zi||e("SecurityPolicy",zi={}));const Ui=e("SecurityPolicyTypes",[{value:zi.BASIC128,name:"Basic128RSA15"},{value:zi.BASIC256,name:"Basic256"},{value:zi.BASIC256SHA,name:"Basic256SHA256"}]),ji=e("SecurityTypeTranslationsMap",new Map([[Li.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Li.BASIC,"gateway.broker.security-types.basic"],[Li.CERTIFICATES,"gateway.broker.security-types.certificates"]])),Hi=e("SourceTypeTranslationsMap",new Map([[pi.MSG,"gateway.source-type.msg"],[pi.TOPIC,"gateway.source-type.topic"],[pi.CONST,"gateway.source-type.const"],[Ni.PATH,"gateway.source-type.path"],[Ni.IDENTIFIER,"gateway.source-type.identifier"],[Ni.CONST,"gateway.source-type.const"],[bi.Expression,"gateway.source-type.expression"],[Ti.REQUEST,"gateway.source-type.request"]]));var Wi;e("MappingKeysType",Wi),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.CUSTOM="extensionConfig",e.RPC_METHODS="rpc_methods",e.ATTRIBUTES_UPDATES="attributes_updates"}(Wi||e("MappingKeysType",Wi={}));const $i=e("MappingKeysPanelTitleTranslationsMap",new Map([[Wi.ATTRIBUTES,"gateway.attributes"],[Wi.TIMESERIES,"gateway.timeseries"],[Wi.CUSTOM,"gateway.keys"],[Wi.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Wi.RPC_METHODS,"gateway.rpc-methods"]])),Ki=e("MappingKeysAddKeyTranslationsMap",new Map([[Wi.ATTRIBUTES,"gateway.add-attribute"],[Wi.TIMESERIES,"gateway.add-timeseries"],[Wi.CUSTOM,"gateway.add-key"],[Wi.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Wi.RPC_METHODS,"gateway.add-rpc-method"]])),Yi=e("MappingKeysDeleteKeyTranslationsMap",new Map([[Wi.ATTRIBUTES,"gateway.delete-attribute"],[Wi.TIMESERIES,"gateway.delete-timeseries"],[Wi.CUSTOM,"gateway.delete-key"],[Wi.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Wi.RPC_METHODS,"gateway.delete-rpc-method"]])),Xi=e("MappingKeysNoKeysTextTranslationsMap",new Map([[Wi.ATTRIBUTES,"gateway.no-attributes"],[Wi.TIMESERIES,"gateway.no-timeseries"],[Wi.CUSTOM,"gateway.no-keys"],[Wi.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Wi.RPC_METHODS,"gateway.no-rpc-methods"]])),Zi=e("QualityTypes",[0,1,2]);var Qi;e("ServerSideRpcType",Qi),function(e){e.WithResponse="twoWay",e.WithoutResponse="oneWay"}(Qi||e("ServerSideRpcType",Qi={}));const Ji=e("HelpLinkByMappingTypeMap",new Map([[qi.DATA,v+"/docs/iot-gateway/config/mqtt/#section-mapping"],[qi.OPCUA,v+"/docs/iot-gateway/config/opc-ua/#section-mapping"],[qi.REQUESTS,v+"/docs/iot-gateway/config/mqtt/#requests-mapping"]])),ea=e("MappingHintTranslationsMap",new Map([[qi.DATA,"gateway.data-mapping-hint"],[qi.OPCUA,"gateway.opcua-data-mapping-hint"],[qi.REQUESTS,"gateway.requests-mapping-hint"]]));var ta,na,ia,aa,ra,oa,sa,la,pa;e("ServerSideRPCType",ta),function(e){e.ONE_WAY="oneWay",e.TWO_WAY="twoWay"}(ta||e("ServerSideRPCType",ta={})),e("SecurityMode",na),function(e){e.basic="basic",e.certificates="certificates",e.extendedCertificates="extendedCertificates"}(na||e("SecurityMode",na={})),e("ModbusProtocolType",ia),function(e){e.TCP="tcp",e.UDP="udp",e.Serial="serial"}(ia||e("ModbusProtocolType",ia={})),e("ModbusMethodType",aa),function(e){e.SOCKET="socket",e.RTU="rtu"}(aa||e("ModbusMethodType",aa={})),e("ModbusSerialMethodType",ra),function(e){e.RTU="rtu",e.ASCII="ascii"}(ra||e("ModbusSerialMethodType",ra={})),e("ModbusParity",oa),function(e){e.Even="E",e.Odd="O",e.None="N"}(oa||e("ModbusParity",oa={})),e("ModbusOrderType",sa),function(e){e.BIG="BIG",e.LITTLE="LITTLE"}(sa||e("ModbusOrderType",sa={})),e("ModbusRegisterType",la),function(e){e.HoldingRegisters="holding_registers",e.CoilsInitializer="coils_initializer",e.InputRegisters="input_registers",e.DiscreteInputs="discrete_inputs"}(la||e("ModbusRegisterType",la={})),e("ModbusValueKey",pa),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_REQUESTS="rpc"}(pa||e("ModbusValueKey",pa={}));const ca=e("ModbusBaudrates",[4800,9600,19200,38400,57600,115200,230400,460800,921600]),da=e("ModbusByteSizes",[5,6,7,8]),ua=e("ModbusDefaultRetries",3),ma=e("ModbusRegisterTranslationsMap",new Map([[la.HoldingRegisters,"gateway.holding_registers"],[la.CoilsInitializer,"gateway.coils_initializer"],[la.InputRegisters,"gateway.input_registers"],[la.DiscreteInputs,"gateway.discrete_inputs"]]));var ha;e("ModbusBitTargetType",ha),function(e){e.BooleanType="bool",e.IntegerType="int"}(ha||e("ModbusBitTargetType",ha={}));const ga=e("ModbusBitTargetTypeTranslationMap",new Map([[ha.BooleanType,"gateway.boolean"],[ha.IntegerType,"gateway.integer"]])),fa=e("ModbusMethodLabelsMap",new Map([[aa.SOCKET,"Socket"],[aa.RTU,"RTU"],[ra.ASCII,"ASCII"]])),ya=e("ModbusProtocolLabelsMap",new Map([[ia.TCP,"TCP"],[ia.UDP,"UDP"],[ia.Serial,"Serial"]])),va=e("ModbusParityLabelsMap",new Map([[oa.Even,"Even"],[oa.Odd,"Odd"],[oa.None,"None"]])),xa=e("ModbusKeysPanelTitleTranslationsMap",new Map([[pa.ATTRIBUTES,"gateway.attributes"],[pa.TIMESERIES,"gateway.timeseries"],[pa.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[pa.RPC_REQUESTS,"gateway.rpc-requests"]])),ba=e("ModbusKeysAddKeyTranslationsMap",new Map([[pa.ATTRIBUTES,"gateway.add-attribute"],[pa.TIMESERIES,"gateway.add-timeseries"],[pa.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[pa.RPC_REQUESTS,"gateway.add-rpc-request"]])),wa=e("ModbusKeysDeleteKeyTranslationsMap",new Map([[pa.ATTRIBUTES,"gateway.delete-attribute"],[pa.TIMESERIES,"gateway.delete-timeseries"],[pa.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[pa.RPC_REQUESTS,"gateway.delete-rpc-request"]])),Sa=e("ModbusKeysNoKeysTextTranslationsMap",new Map([[pa.ATTRIBUTES,"gateway.no-attributes"],[pa.TIMESERIES,"gateway.no-timeseries"],[pa.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[pa.RPC_REQUESTS,"gateway.no-rpc-requests"]]));var Ca;e("ModifierType",Ca),function(e){e.DIVIDER="divider",e.MULTIPLIER="multiplier"}(Ca||e("ModifierType",Ca={}));const _a=e("ModifierTypesMap",new Map([[Ca.DIVIDER,{name:"gateway.divider",icon:"mdi:division"}],[Ca.MULTIPLIER,{name:"gateway.multiplier",icon:"mdi:multiplication"}]]));var Ta,Ea;e("DeviceInfoType",Ta),function(e){e.FULL="full",e.PARTIAL="partial"}(Ta||e("DeviceInfoType",Ta={})),e("SegmentationType",Ea),function(e){e.BOTH="segmentedBoth",e.TRANSMIT="segmentedTransmit",e.RECEIVE="segmentedReceive",e.NO="noSegmentation"}(Ea||e("SegmentationType",Ea={}));const Ma=e("SegmentationTypeTranslationsMap",new Map([[Ea.BOTH,"gateway.bacnet.segmentation.both"],[Ea.TRANSMIT,"gateway.bacnet.segmentation.transmit"],[Ea.RECEIVE,"gateway.bacnet.segmentation.receive"],[Ea.NO,"gateway.bacnet.segmentation.no"]]));var Ia;e("BacnetDeviceKeysType",Ia),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.RPC_METHODS="serverSideRpc",e.ATTRIBUTES_UPDATES="attributeUpdates"}(Ia||e("BacnetDeviceKeysType",Ia={}));const ka=e("BacnetDeviceKeysPanelTitleTranslationsMap",new Map([[Ia.ATTRIBUTES,"gateway.attributes"],[Ia.TIMESERIES,"gateway.timeseries"],[Ia.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Ia.RPC_METHODS,"gateway.rpc-methods"]])),Pa=e("BacnetDeviceKeysAddKeyTranslationsMap",new Map([[Ia.ATTRIBUTES,"gateway.add-attribute"],[Ia.TIMESERIES,"gateway.add-timeseries"],[Ia.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Ia.RPC_METHODS,"gateway.add-rpc-method"]])),Da=e("BacnetDeviceKeysDeleteKeyTranslationsMap",new Map([[Ia.ATTRIBUTES,"gateway.delete-attribute"],[Ia.TIMESERIES,"gateway.delete-timeseries"],[Ia.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Ia.RPC_METHODS,"gateway.delete-rpc-method"]])),Aa=e("BacnetDeviceKeysNoKeysTextTranslationsMap",new Map([[Ia.ATTRIBUTES,"gateway.no-attributes"],[Ia.TIMESERIES,"gateway.no-timeseries"],[Ia.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Ia.RPC_METHODS,"gateway.no-rpc-methods"]]));var Oa;e("BacnetKeyObjectType",Oa),function(e){e.analogInput="analogInput",e.analogOutput="analogOutput",e.analogValue="analogValue",e.binaryInput="binaryInput",e.binaryOutput="binaryOutput",e.binaryValue="binaryValue"}(Oa||e("BacnetKeyObjectType",Oa={}));const Ra=e("BacnetKeyObjectTypeTranslationsMap",new Map([[Oa.analogInput,"gateway.bacnet.object-type.analog-input"],[Oa.analogOutput,"gateway.bacnet.object-type.analog-output"],[Oa.analogValue,"gateway.bacnet.object-type.analog-value"],[Oa.binaryInput,"gateway.bacnet.object-type.binary-input"],[Oa.binaryOutput,"gateway.bacnet.object-type.binary-output"],[Oa.binaryValue,"gateway.bacnet.object-type.binary-value"]]));var Ba;e("BacnetPropertyId",Ba),function(e){e.presentValue="presentValue",e.statusFlags="statusFlags",e.covIncrement="covIncrement",e.eventState="eventState",e.outOfService="outOfService",e.polarity="polarity",e.priorityArray="priorityArray",e.relinquishDefault="relinquishDefault",e.currentCommandPriority="currentCommandPriority",e.eventMessageTexts="eventMessageTexts",e.eventMessageTextsConfig="eventMessageTextsConfig",e.eventAlgorithmInhibitReference="eventAlgorithmInhibitReference",e.timeDelayNormal="timeDelayNormal"}(Ba||e("BacnetPropertyId",Ba={}));const Fa=e("BacnetPropertyIdByObjectType",new Map([[Oa.analogInput,[Ba.presentValue,Ba.statusFlags,Ba.covIncrement]],[Oa.analogOutput,[Ba.presentValue,Ba.statusFlags,Ba.covIncrement]],[Oa.analogValue,[Ba.presentValue,Ba.statusFlags,Ba.covIncrement]],[Oa.binaryInput,[Ba.presentValue,Ba.statusFlags,Ba.eventState,Ba.outOfService,Ba.polarity]],[Oa.binaryOutput,[Ba.presentValue,Ba.statusFlags,Ba.eventState,Ba.outOfService,Ba.polarity,Ba.priorityArray,Ba.relinquishDefault,Ba.currentCommandPriority,Ba.eventMessageTexts,Ba.eventMessageTextsConfig,Ba.eventAlgorithmInhibitReference,Ba.timeDelayNormal]],[Oa.binaryValue,[Ba.presentValue,Ba.statusFlags,Ba.eventState,Ba.outOfService]]])),Na=e("BacnetPropertyIdTranslationsMap",new Map([[Ba.presentValue,"gateway.bacnet.property-id.present-value"],[Ba.statusFlags,"gateway.bacnet.property-id.status-flags"],[Ba.covIncrement,"gateway.bacnet.property-id.cov-increment"],[Ba.eventState,"gateway.bacnet.property-id.event-state"],[Ba.outOfService,"gateway.bacnet.property-id.out-of-service"],[Ba.polarity,"gateway.bacnet.property-id.polarity"],[Ba.priorityArray,"gateway.bacnet.property-id.priority-array"],[Ba.relinquishDefault,"gateway.bacnet.property-id.relinquish-default"],[Ba.currentCommandPriority,"gateway.bacnet.property-id.current-command-priority"],[Ba.eventMessageTexts,"gateway.bacnet.property-id.event-message-texts"],[Ba.eventMessageTextsConfig,"gateway.bacnet.property-id.event-message-texts-config"],[Ba.eventAlgorithmInhibitReference,"gateway.bacnet.property-id.event-algorithm-inhibit-reference"],[Ba.timeDelayNormal,"gateway.bacnet.property-id.time-delay-normal"]]));var La;e("BacnetRequestType",La),function(e){e.Write="writeProperty",e.Read="readProperty"}(La||e("BacnetRequestType",La={}));const Va=e("BacnetRequestTypeTranslationsMap",new Map([[La.Write,"gateway.bacnet.request-type.write"],[La.Read,"gateway.bacnet.request-type.read"]]));class qa{static{this.mqttRequestTypeKeys=Object.values(mi)}static{this.mqttRequestMappingOldFields=["attributeNameJsonExpression","deviceNameJsonExpression","deviceNameTopicExpression","extension-config"]}static{this.mqttRequestMappingNewFields=["attributeNameExpressionSource","responseTopicQoS","extensionConfig"]}static mapMappingToUpgradedVersion(e){return e?.map(({converter:e,topicFilter:t,subscriptionQos:n=1})=>{const i=e.deviceInfo??this.extractConverterDeviceInfo(e),a={...e,deviceInfo:i,extensionConfig:e.extensionConfig||e["extension-config"]||null};return this.cleanUpOldFields(a),{converter:a,topicFilter:t,subscriptionQos:n}})}static mapRequestsToUpgradedVersion(e){return this.mqttRequestTypeKeys.reduce((t,n)=>e[n]?(t[n]=e[n].map(e=>{const t=this.mapRequestToUpgradedVersion(e,n);return this.cleanUpOldFields(t),t}),t):t,{})}static mapRequestsToDowngradedVersion(e){return this.mqttRequestTypeKeys.reduce((t,n)=>e[n]?(t[n]=e[n].map(e=>{n===mi.SERVER_SIDE_RPC&&delete e.type;const{attributeNameExpression:t,deviceInfo:i,...a}=e,r={...a,attributeNameJsonExpression:t||null,deviceNameJsonExpression:i?.deviceNameExpressionSource!==pi.TOPIC?i?.deviceNameExpression:null,deviceNameTopicExpression:i?.deviceNameExpressionSource===pi.TOPIC?i?.deviceNameExpression:null};return this.cleanUpNewFields(r),r}),t):t,{})}static mapMappingToDowngradedVersion(e){return e?.map(e=>{const t=this.mapConverterToDowngradedVersion(e.converter);return this.cleanUpNewFields(t),{converter:t,topicFilter:e.topicFilter}})}static mapConverterToDowngradedVersion(e){const{deviceInfo:t,...n}=e;return e.type!==li.BYTES?{...n,deviceNameJsonExpression:t?.deviceNameExpressionSource===pi.MSG?t.deviceNameExpression:null,deviceTypeJsonExpression:t?.deviceProfileExpressionSource===pi.MSG?t.deviceProfileExpression:null,deviceNameTopicExpression:t?.deviceNameExpressionSource!==pi.MSG?t?.deviceNameExpression:null,deviceTypeTopicExpression:t?.deviceProfileExpressionSource!==pi.MSG?t?.deviceProfileExpression:null}:{...n,deviceNameExpression:t.deviceNameExpression,deviceTypeExpression:t.deviceProfileExpression,"extension-config":e.extensionConfig}}static cleanUpOldFields(e){this.mqttRequestMappingOldFields.forEach(t=>delete e[t]),Q(e)}static cleanUpNewFields(e){this.mqttRequestMappingNewFields.forEach(t=>delete e[t]),Q(e)}static getTypeSourceByValue(e){return e.includes("${")?pi.MSG:e.includes("/")?pi.TOPIC:pi.CONST}static extractConverterDeviceInfo(e){const t=e.deviceNameExpression||e.deviceNameJsonExpression||e.deviceNameTopicExpression||null,n=e.deviceNameExpressionSource?e.deviceNameExpressionSource:t?this.getTypeSourceByValue(t):null,i=e.deviceProfileExpression||e.deviceTypeTopicExpression||e.deviceTypeJsonExpression||"default",a=e.deviceProfileExpressionSource?e.deviceProfileExpressionSource:i?this.getTypeSourceByValue(i):null;return t||i?{deviceNameExpression:t,deviceNameExpressionSource:n,deviceProfileExpression:i,deviceProfileExpressionSource:a}:null}static mapRequestToUpgradedVersion(e,t){const n=e.deviceNameJsonExpression||e.deviceNameTopicExpression||null,i=e.deviceTypeTopicExpression||e.deviceTypeJsonExpression||"default",a=i?this.getTypeSourceByValue(i):null,r=e.attributeNameExpressionSource||e.attributeNameJsonExpression||null,o=t===mi.SERVER_SIDE_RPC?1:null,s=t===mi.SERVER_SIDE_RPC?e.responseTopicExpression?Qi.WithResponse:Qi.WithoutResponse:null;return{...e,attributeNameExpression:r,attributeNameExpressionSource:r?this.getTypeSourceByValue(r):null,deviceInfo:e.deviceInfo?e.deviceInfo:n?{deviceNameExpression:n,deviceNameExpressionSource:this.getTypeSourceByValue(n),deviceProfileExpression:i,deviceProfileExpressionSource:a}:null,responseTopicQoS:o,type:s}}}e("MqttVersionMappingUtil",qa);class Ga{constructor(e,t){this.gatewayVersionIn=e,this.connector=t,this.gatewayVersion=Qa.parseVersion(this.gatewayVersionIn),this.configVersion=Qa.parseVersion(this.connector.configVersion??this.connector.configurationJson.configVersion)}getProcessedByVersion(){return this.isVersionUpdateNeeded()?this.processVersionUpdate():this.connector}processVersionUpdate(){return this.isVersionUpgradeNeeded()?this.getUpgradedVersion():this.isVersionDowngradeNeeded()?this.getDowngradedVersion():this.connector}isVersionUpdateNeeded(){return!!this.gatewayVersion&&this.configVersion!==this.gatewayVersion}isVersionUpgradeNeeded(){const e=Qa.parseVersion(Fi.get(this.connector.type)),t=this.gatewayVersion>=e,n=!this.configVersion||this.configVersion=e&&e>this.gatewayVersion}}e("GatewayConnectorVersionProcessor",Ga);class za extends Ga{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.mqttRequestTypeKeys=Object.values(mi)}getUpgradedVersion(){const{connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}=this.connector.configurationJson;let r={...this.connector.configurationJson,requestsMapping:qa.mapRequestsToUpgradedVersion({connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}),mapping:qa.mapMappingToUpgradedVersion(this.connector.configurationJson.mapping)};return this.mqttRequestTypeKeys.forEach(e=>{const{[e]:t,...n}=r;r={...n}}),this.cleanUpConfigJson(r),{...this.connector,configurationJson:r,configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const{requestsMapping:e,mapping:t,...n}=this.connector.configurationJson,i=e?qa.mapRequestsToDowngradedVersion(e):{},a=qa.mapMappingToDowngradedVersion(t);return{...this.connector,configurationJson:{...n,...i,mapping:a},configVersion:this.gatewayVersionIn}}cleanUpConfigJson(e){Y(e.requestsMapping,{})&&delete e.requestsMapping,Y(e.mapping,[])&&delete e.mapping}}e("MqttVersionProcessor",za);class Ua extends Ga{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{master:e.master?.slaves?Ja.mapMasterToUpgradedVersion(e.master):{slaves:[]},slave:e.slave?Ja.mapSlaveToUpgradedVersion(e.slave):{}},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{...e,slave:e.slave?Ja.mapSlaveToDowngradedVersion(e.slave):{},master:e.master?.slaves?Ja.mapMasterToDowngradedVersion(e.master):{slaves:[]}},configVersion:this.gatewayVersionIn}}}e("ModbusVersionProcessor",Ua);class ja extends Ga{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson.server;let t;return t="mapping"in this.connector.configurationJson.server?er.mapMappingToUpgradedVersion(this.connector.configurationJson.server.mapping):"mapping"in this.connector.configurationJson?er.mapMappingToCurrentVersion(this.connector.configurationJson.mapping):[],{...this.connector,configurationJson:{server:e?er.mapServerToUpgradedVersion(e):{},mapping:t},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:{server:er.mapServerToDowngradedVersion(this.connector.configurationJson)},configVersion:this.gatewayVersionIn}}}e("OpcVersionProcessor",ja);class Ha{constructor(){this.fb=s(be),this.destroyRef=s(l),this.formGroup=this.initFormGroup(),this.observeValueChanges()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.formGroup.valid?null:{formGroup:{valid:!1}}}writeValue(e){this.onWriteValue(e)}onWriteValue(e){this.formGroup.patchValue(e,{emitEvent:!1})}mapOnChangeValue(e){return e}observeValueChanges(){this.formGroup.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>this.onChange(this.mapOnChangeValue(e)))}toggleControl(e,t){t?e.enable({emitEvent:!1}):e.disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||Ha)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Ha})}}e("ControlValueAccessorBaseAbstract",Ha);class Wa extends Ha{constructor(){super(...arguments),this.withReportStrategy=!0,this.initialized=new p,this.isLegacy=!1,this.fb=s(be)}get basicFormGroup(){return this.formGroup}ngAfterViewInit(){this.initialized.emit()}onWriteValue(e){this.formGroup.setValue(this.mapConfigToFormValue(e),{emitEvent:!1})}mapOnChangeValue(e){return this.getMappedValue(e)}initFormGroup(){return this.initBasicFormGroup()}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(Wa)))(n||Wa)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:Wa,inputs:{generalTabContent:"generalTabContent",withReportStrategy:[2,"withReportStrategy","withReportStrategy",c]},outputs:{initialized:"initialized"},features:[t.ɵɵInheritDefinitionFeature]})}}e("GatewayConnectorBasicConfigDirective",Wa);class $a extends Ga{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{socket:e?tr.mapSocketToUpgradedVersion(e):{},devices:e?.devices?tr.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:tr.mapSocketToDowngradedVersion(this.connector.configurationJson),configVersion:this.gatewayVersionIn}}}e("SocketVersionProcessor",$a);class Ka extends Ga{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{application:e?.general?nr.mapApplicationToUpgradedVersion(e.general):{},devices:e?.devices?nr.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{general:e?.application?nr.mapApplicationToDowngradedVersion(e.application):{},devices:e?.devices?nr.mapDevicesToDowngradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}}e("BacnetVersionProcessor",Ka);const Ya=["searchInput"];class Xa{constructor(){this.withReportStrategy=!0,this.textSearchMode=!1,this.onChange=()=>{},this.translate=s(he),this.dialog=s(We),this.dialogService=s(J),this.fb=s(be),this.cd=s(d),this.destroyRef=s(l),this.textSearch=this.fb.control("",{nonNullable:!0}),this.entityFormArray=this.fb.array([]),this.entityFormArray.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.updateTableData(e,this.textSearch.value.trim()),this.onChange(e)}),this.dataSource=this.getDatasource()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Re(150),Oe((e,t)=>(e??"")===t.trim()),de(this.destroyRef)).subscribe(e=>this.updateTableData(this.entityFormArray.value,e.trim()))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.entityFormArray.clear(),this.pushDataAsFormArrays(e)}enterFilterMode(){this.textSearchMode=!0,this.cd.detectChanges();const e=this.searchInputField.nativeElement;e.focus(),e.setSelectionRange(0,0)}exitFilterMode(){this.updateTableData(this.entityFormArray.value),this.textSearchMode=!1,this.textSearch.reset()}validate(){return this.entityFormArray.controls.length?null:{devicesFormGroup:{valid:!1}}}updateTableData(e,t){t&&(e=e.filter(e=>Object.values(e).some(e=>e.toString().toLowerCase().includes(t.toLowerCase())))),this.dataSource.loadData(e)}pushDataAsFormArrays(e){e?.length&&e.forEach(e=>this.entityFormArray.push(this.fb.control(e)))}static{this.ɵfac=function(e){return new(e||Xa)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Xa,viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Ya,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:[2,"withReportStrategy","withReportStrategy",c]}})}}e("AbstractDevicesConfigTableComponent",Xa);class Za extends Ga{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.restRequestTypeKeys=Object.values(ki)}getUpgradedVersion(){const{attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}=this.connector.configurationJson;let r={server:Qa.cleanUpConfigBaseInfo(a),requestsMapping:{attributeRequests:e,attributeUpdates:t,serverSideRpc:n},mapping:ir.mapMappingToUpgradedVersion(i)};return this.restRequestTypeKeys.forEach(e=>{const{[e]:t,...n}=r;r={...n}}),{...this.connector,configurationJson:r,configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const{requestsMapping:e={},mapping:t,server:n,...i}=this.connector.configurationJson,{attributeRequests:a=[],attributeUpdates:r=[],serverSideRpc:o=[]}=e;return{...this.connector,configurationJson:{...i,...n,attributeRequests:a,attributeUpdates:r,serverSideRpc:o,mapping:ir.mapMappingToDowngradedVersion(t)},configVersion:this.gatewayVersionIn}}}e("RestVersionProcessor",Za);class Qa{static getConfig(e,t){switch(e.type){case gt.MQTT:return new za(t,e).getProcessedByVersion();case gt.OPCUA:return new ja(t,e).getProcessedByVersion();case gt.MODBUS:return new Ua(t,e).getProcessedByVersion();case gt.SOCKET:return new $a(t,e).getProcessedByVersion();case gt.BACNET:return new Ka(t,e).getProcessedByVersion();case gt.REST:return new Za(t,e).getProcessedByVersion();default:return e}}static parseVersion(e){if(ee(e))return e;if(te(e)){const[t,n="0",i="0"]=e.split(".");return parseFloat(`${t}.${n}${i.slice(0,1)}`)}return 0}static cleanUpConfigBaseInfo(e){const{name:t,id:n,enableRemoteLogging:i,logLevel:a,reportStrategy:r,configVersion:o,...s}=e;return s}}e("GatewayConnectorVersionMappingUtil",Qa);class Ja{static mapMasterToUpgradedVersion(e){return{slaves:e.slaves.map(e=>{const{sendDataOnlyOnChange:t,...n}=e;return{...n,deviceType:e.deviceType??"default",reportStrategy:t?{type:cn.OnChange}:{type:cn.OnReportPeriod,reportPeriod:e.pollPeriod}}})}}static mapMasterToDowngradedVersion(e){return{slaves:e.slaves.map(e=>{const{reportStrategy:t,...n}=e;return{...n,sendDataOnlyOnChange:t?.type!==cn.OnReportPeriod}})}}static mapSlaveToDowngradedVersion(e){if(!e?.values)return e;const t=Object.keys(e.values).reduce((t,n)=>t={...t,[n]:[e.values[n]]},{});return{...e,values:t}}static mapSlaveToUpgradedVersion(e){if(!e?.values)return e;const t=Object.keys(e.values).reduce((t,n)=>t={...t,[n]:this.mapValuesToUpgradedVersion(e.values[n][0]??{})},{});return{...e,values:t}}static mapValuesToUpgradedVersion(e){return Object.keys(e).reduce((t,n)=>t={...t,[n]:e[n].map(e=>({...e,type:"int"===e.type?nn.INT16:e.type}))},{})}}e("ModbusVersionMappingUtil",Ja);class er{static mapServerToUpgradedVersion(e){const{mapping:t,disableSubscriptions:n,pollPeriodInMillis:i,...a}=e;return{...a,pollPeriodInMillis:i??5e3,enableSubscriptions:!n}}static mapServerToDowngradedVersion(e){const{mapping:t,server:n}=e,{enableSubscriptions:i,...a}=n??{};return{...a,mapping:t?this.mapMappingToDowngradedVersion(t):[],disableSubscriptions:!i}}static mapMappingToUpgradedVersion(e){return e.map(e=>({deviceNodePattern:e.deviceNodePattern,deviceNodeSource:this.getDeviceNodeSourceByValue(e.deviceNodePattern),deviceInfo:{deviceNameExpression:e.deviceNamePattern,deviceNameExpressionSource:this.getTypeSourceByValue(e.deviceNamePattern),deviceProfileExpression:e.deviceTypePattern??"default",deviceProfileExpressionSource:this.getTypeSourceByValue(e.deviceTypePattern??"default")},attributes:e.attributes?.map(e=>({key:e.key,type:this.getTypeSourceByValue(e.path),value:e.path}))??[],attributes_updates:e.attributes_updates?.map(e=>({key:e.attributeOnThingsBoard,type:this.getTypeSourceByValue(e.attributeOnDevice),value:e.attributeOnDevice}))??[],timeseries:e.timeseries?.map(e=>({key:e.key,type:this.getTypeSourceByValue(e.path),value:e.path}))??[],rpc_methods:e.rpc_methods?.map(e=>({method:e.method,arguments:e.arguments.map(e=>({value:e,type:this.getArgumentType(e)}))}))??[]}))}static mapMappingToCurrentVersion(e){return e.map(e=>({deviceNodePattern:e.deviceNodePattern,deviceNodeSource:this.getDeviceNodeSourceByValue(e.deviceNodePattern),deviceInfo:{deviceNameExpression:e.deviceInfo.deviceNameExpression,deviceNameExpressionSource:this.getTypeSourceByValue(e?.deviceInfo?.deviceNameExpressionSource),deviceProfileExpression:e?.deviceInfo?.deviceProfileExpression??"default",deviceProfileExpressionSource:this.getTypeSourceByValue(e?.deviceInfo?.deviceProfileExpressionSource??"default")},attributes:e.attributes?.map(e=>({key:e.key,type:e.type,value:e?.value}))??[],attributes_updates:e.attributes_updates?.map(e=>({key:e.key,type:e.type,value:e.value}))??[],timeseries:e.timeseries?.map(e=>({key:e.key,type:e.type,value:e.value}))??[],rpc_methods:e.rpc_methods?.map(e=>({method:e.method,arguments:e.arguments.map(e=>({value:e,type:this.getArgumentType(e)}))}))??[]}))}static mapMappingToDowngradedVersion(e){return e.map(e=>({deviceNodePattern:e.deviceNodePattern,deviceNamePattern:e.deviceInfo.deviceNameExpression,deviceTypePattern:e.deviceInfo.deviceProfileExpression,attributes:e.attributes.map(e=>({key:e.key,path:e.value})),attributes_updates:e.attributes_updates.map(e=>({attributeOnThingsBoard:e.key,attributeOnDevice:e.value})),timeseries:e.timeseries.map(e=>({key:e.key,path:e.value})),rpc_methods:e.rpc_methods.map(e=>({method:e.method,arguments:e.arguments.map(e=>e.value)}))}))}static getTypeSourceByValue(e){return e.includes("${")?Ni.IDENTIFIER:e.includes("/")||e.includes("\\")?Ni.PATH:Ni.CONST}static getDeviceNodeSourceByValue(e){return e.includes("${")?Ni.IDENTIFIER:Ni.PATH}static getArgumentType(e){switch(typeof e){case"boolean":return"boolean";case"number":return Number.isInteger(e)?"integer":"float";default:return"string"}}}e("OpcVersionMappingUtil",er);class tr{static mapSocketToUpgradedVersion(e){const{devices:t,...n}=e??{};return Qa.cleanUpConfigBaseInfo(n)}static mapSocketToDowngradedVersion(e){const{devices:t,socket:n}=e??{};return{...n,devices:this.mapDevicesToDowngradedVersion(t??[])}}static mapDevicesToUpgradedVersion(e){return e?.map(e=>({...e,attributeRequests:e.attributeRequests?.map(e=>({...e,requestExpressionSource:this.getExpressionSource(e.requestExpression),attributeNameExpressionSource:this.getExpressionSource(e.attributeNameExpression)}))??[]}))??[]}static mapDevicesToDowngradedVersion(e){return e.map(e=>({...e,attributeRequests:e.attributeRequests?.map(({requestExpressionSource:e,attributeNameExpressionSource:t,...n})=>n)??[]}))}static getExpressionSource(e){return e.includes("${")||e.includes("[")?bi.Expression:bi.Constant}}e("SocketVersionMappingUtil",tr);class nr{static mapApplicationToUpgradedVersion(e){const{address:t="",...n}=e,[i,a]=t.split(":"),[r,o]=i.split("/");return{host:r,port:a,mask:o,...n}}static mapApplicationToDowngradedVersion(e){const{host:t="",port:n="",mask:i="",...a}=e;return{address:i?`${t}/${i}:${n}`:`${t}:${n}`,...a}}static mapDevicesToUpgradedVersion(e){return e?.map(({address:e="",deviceName:t,deviceType:n,attributes:i,timeseries:a,attributeUpdates:r,serverSideRpc:o,...s})=>({...s,host:e.split(":")[0],port:e.split(":")[1],deviceInfo:{deviceNameExpression:t,deviceProfileExpression:n,deviceNameExpressionSource:this.getExpressionSource(t),deviceProfileExpressionSource:this.getExpressionSource(n)},attributes:this.getUpdateKeys(i),timeseries:this.getUpdateKeys(a),attributeUpdates:this.getUpdateKeys(r),serverSideRpc:this.getUpdateKeys(o)}))??[]}static mapDevicesToDowngradedVersion(e){return e?.map(({port:e,host:t,deviceInfo:n,attributes:i,timeseries:a,attributeUpdates:r,serverSideRpc:o,...s})=>({...s,address:`${t}:${e}`,deviceName:n?.deviceNameExpression,deviceType:n?.deviceProfileExpression,attributes:this.getDowngradedKeys(i),timeseries:this.getDowngradedKeys(a),attributeUpdates:this.getDowngradedKeys(r),serverSideRpc:this.getDowngradedKeys(o)}))??[]}static getExpressionSource(e){return e?.includes("${")||e?.includes("[")?bi.Expression:bi.Constant}static getUpdateKeys(e){return e?.map(({objectId:e="",...t})=>({objectType:e.split(":")[0],objectId:e.split(":")[1],...t}))??[]}static getDowngradedKeys(e){return e?.map(({objectId:e="",objectType:t="",...n})=>({objectId:`${t}:${e}`,...n}))??[]}}e("BacnetVersionMappingUtil",nr);class ir{static mapMappingToUpgradedVersion(e){return e?.map(({converter:e,...t})=>{const{deviceNameExpression:n,deviceTypeExpression:i,...a}=e;return{converter:{deviceInfo:{deviceNameExpressionSource:this.getTypeSourceByValue(n),deviceNameExpression:n,deviceProfileExpressionSource:this.getTypeSourceByValue(i),deviceProfileExpression:i},...a},...t}})}static mapMappingToDowngradedVersion(e){return e?.map(({converter:e,...t})=>{const{deviceInfo:n,...i}=e;return{converter:{deviceNameExpression:n?.deviceNameExpression,deviceTypeExpression:n?.deviceProfileExpression,...i},...t}})}static getTypeSourceByValue(e=""){return e.includes("${")?Ti.REQUEST:Ti.CONST}}e("RestVersionMappingUtil",ir);class ar{transform(e,t){const n=Qa.parseVersion(e);return t===gt.MODBUS?n>=Qa.parseVersion(ht.v3_5_2):n>=Qa.parseVersion(ht.v3_6_0)}static{this.ɵfac=function(e){return new(e||ar)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"withReportStrategy",type:ar,pure:!0})}}function rr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-required")," "))}function or(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-pattern")," "))}function sr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.name-already-exists")," "))}function lr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-required")," "))}function pr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-pattern")," "))}function cr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-min")," "))}function dr(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.command-required")," "))}function ur(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.command-pattern")," "))}e("ReportStrategyVersionPipe",ar);class mr extends D{constructor(e,t,n,i,a,r,o,s){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.dialogService=r,this.translate=o,this.destroyRef=s,this.commandHelpLink=v+"/docs/iot-gateway/configuration/#subsection-statistics",this.editCommandFormGroup=this.fb.group({attributeOnGateway:["",[ve.required,ve.pattern(hn),this.uniqNameRequired()]],command:["",[ve.required,ve.pattern(/^(?=\S).*\S$/)]],timeout:[10,[ve.required,ve.min(1),ve.pattern(mn),ve.pattern(/^[^.\s]+$/)]],installCmd:["",ve.pattern(hn)]}),this.editCommandFormGroup.patchValue(this.data.command,{emitEvent:!1})}cancel(){this.confirmConnectorChange().pipe(ze(Boolean),de(this.destroyRef)).subscribe(()=>this.dialogRef.close(null))}apply(){this.dialogRef.close({current:this.editCommandFormGroup.value,prev:this.data.command})}confirmConnectorChange(){return this.editCommandFormGroup.dirty?this.dialogService.confirm(this.translate.instant("gateway.statistics.change-command-title"),this.translate.instant("gateway.statistics.change-command-text"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0):Ie(!0)}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase();return t&&this.data.existingCommands.some(e=>e.toLowerCase()===t)&&t!==this.data.command.attributeOnGateway.toLowerCase()?{duplicateName:{valid:!1}}:null}}static{this.ɵfac=function(e){return new(e||mr)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(Z.DialogService),t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:mr,selectors:[["tb-edit-custom-command-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:64,vars:31,consts:[[1,"edit-command-container",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel","stroked","no-padding-bottom","no-gap","command-container"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["translate",""],["matInput","","formControlName","attributeOnGateway"],["matIconSuffix","",1,"cursor-pointer",3,"matTooltip"],["matInput","","formControlName","timeout","type","number","min","1"],["appearance","outline",1,"mat-block"],["matInput","","formControlName","command"],[1,"tb-settings","pb-4"],["translate","",1,"tb-form-panel-title"],["matInput","","formControlName","installCmd"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"section",8)(13,"section",9)(14,"mat-form-field",10)(15,"mat-label",11),t.ɵɵtext(16,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(17,"input",12),t.ɵɵconditionalCreate(18,rr,3,3,"mat-error")(19,or,3,3,"mat-error")(20,sr,3,3,"mat-error"),t.ɵɵelementStart(21,"mat-icon",13),t.ɵɵpipe(22,"translate"),t.ɵɵtext(23,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"mat-form-field",10)(25,"mat-label",11),t.ɵɵtext(26,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",14),t.ɵɵconditionalCreate(28,lr,3,3,"mat-error")(29,pr,3,3,"mat-error")(30,cr,3,3,"mat-error"),t.ɵɵelementStart(31,"mat-icon",13),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(34,"section")(35,"mat-form-field",15)(36,"mat-label",11),t.ɵɵtext(37,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(38,"input",16),t.ɵɵconditionalCreate(39,dr,3,3,"mat-error")(40,ur,3,3,"mat-error"),t.ɵɵelementStart(41,"mat-icon",13),t.ɵɵpipe(42,"translate"),t.ɵɵtext(43,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(44,"section")(45,"mat-expansion-panel",17)(46,"mat-expansion-panel-header")(47,"mat-panel-title")(48,"div",18),t.ɵɵtext(49,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(50,"mat-form-field",10)(51,"mat-label",11),t.ɵɵtext(52,"gateway.statistics.install-cmd"),t.ɵɵelementEnd(),t.ɵɵelement(53,"input",19),t.ɵɵelementStart(54,"mat-icon",13),t.ɵɵpipe(55,"translate"),t.ɵɵtext(56,"info_outlined "),t.ɵɵelementEnd()()()()()()(),t.ɵɵelementStart(57,"div",20)(58,"button",21),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(59),t.ɵɵpipe(60,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(61,"button",22),t.ɵɵlistener("click",function(){return n.apply()}),t.ɵɵtext(62),t.ɵɵpipe(63,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.editCommandFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,17,n.data.titleText)),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.commandHelpLink),t.ɵɵadvance(12),t.ɵɵconditional(n.editCommandFormGroup.get("attributeOnGateway").hasError("required")?18:n.editCommandFormGroup.get("attributeOnGateway").hasError("pattern")?19:n.editCommandFormGroup.get("attributeOnGateway").hasError("duplicateName")?20:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,19,"gateway.hints.attribute"))),t.ɵɵadvance(7),t.ɵɵconditional(n.editCommandFormGroup.get("timeout").hasError("required")?28:n.editCommandFormGroup.get("timeout").hasError("pattern")?29:n.editCommandFormGroup.get("timeout").hasError("min")?30:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(32,21,"gateway.hints.timeout"))),t.ɵɵadvance(8),t.ɵɵconditional(n.editCommandFormGroup.get("command").hasError("required")?39:n.editCommandFormGroup.get("command").hasError("pattern")?40:-1),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(42,23,"gateway.hints.command"))),t.ɵɵadvance(13),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(55,25,"gateway.hints.install-cmd"))),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(60,27,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.editCommandFormGroup.invalid||!n.editCommandFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(63,29,n.data.buttonText)," "))},dependencies:t.ɵɵgetComponentDepsFactory(mr,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%] .edit-command-container[_ngcontent-%COMP%]{min-width:40vw;width:50vw}[_nghost-%COMP%] .pointer-event{pointer-events:all}[_nghost-%COMP%] .toggle-group span{padding:0 25px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{color:#e0e0e0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix:hover{color:#9e9e9e}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex;align-items:center}']})}}var hr=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},gr=new function(){this.browser=new hr,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(gr.wxa=!0,gr.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?gr.worker=!0:"undefined"==typeof navigator||0===navigator.userAgent.indexOf("Node.js")?(gr.node=!0,gr.svgSupported=!0):function(e,t){var n=t.browser,i=e.match(/Firefox\/([\d.]+)/),a=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),r=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);i&&(n.firefox=!0,n.version=i[1]);a&&(n.ie=!0,n.version=a[1]);r&&(n.edge=!0,n.version=r[1],n.newEdge=+r[1].split(".")[0]>18);o&&(n.weChat=!0);t.svgSupported="undefined"!=typeof SVGRect,t.touchEventsSupported="ontouchstart"in window&&!n.ie&&!n.edge,t.pointerEventsSupported="onpointerdown"in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported="undefined"!=typeof document;var s=document.documentElement.style;t.transform3dSupported=(n.ie&&"transition"in s||n.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}(navigator.userAgent,gr);var fr="sans-serif",yr="12px "+fr;var vr,xr,br=function(e){var t={};if("undefined"==typeof JSON)return t;for(var n=0;n=0)r=a*e.length;else for(var o=0;o>1)%2;o.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[s]+":0",a[l]+":0",i[1-s]+":auto",a[1-l]+":auto",""].join("!important;"),e.appendChild(o),n.push(o)}return n}(t,r),s=function(e,t,n){for(var i=n?"invTrans":"trans",a=n?"invSrcCoords":"srcCoords",r=t[i],o=t[a],s=[],l=[],p=!0,c=0;c<4;c++){var d=e[c].getBoundingClientRect(),u=2*c,m=d.left,h=d.top;s.push(m,h),p=p&&o&&m===o[u]&&h===o[u+1],l.push(e[c].offsetLeft,e[c].offsetTop)}return p&&r?r:(t[a]=s,t[i]=n?ns(l,s):ns(s,l))}(o,r,a);if(s)return s(e,n,i),!0}return!1}function os(e){return"CANVAS"===e.nodeName.toUpperCase()}var ss=/([&<>"'])/g,ls={"&":"&","<":"<",">":">",'"':""","'":"'"};function ps(e){return null==e?"":(e+"").replace(ss,function(e,t){return ls[t]})}var cs=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ds=[],us=gr.browser.firefox&&+gr.browser.version.split(".")[0]<39;function ms(e,t,n,i){return n=n||{},i?hs(e,t,n):us&&null!=t.layerX&&t.layerX!==t.offsetX?(n.zrX=t.layerX,n.zrY=t.layerY):null!=t.offsetX?(n.zrX=t.offsetX,n.zrY=t.offsetY):hs(e,t,n),n}function hs(e,t,n){if(gr.domSupported&&e.getBoundingClientRect){var i=t.clientX,a=t.clientY;if(os(e)){var r=e.getBoundingClientRect();return n.zrX=i-r.left,void(n.zrY=a-r.top)}if(rs(ds,e,i,a))return n.zrX=ds[0],void(n.zrY=ds[1])}n.zrX=n.zrY=0}function gs(e){return e||window.event}function fs(e,t,n){if(null!=(t=gs(t)).zrX)return t;var i=t.type;if(i&&i.indexOf("touch")>=0){var a="touchend"!==i?t.targetTouches[0]:t.changedTouches[0];a&&ms(e,a,t,n)}else{ms(e,t,t,n);var r=function(e){var t=e.wheelDelta;if(t)return t;var n=e.deltaX,i=e.deltaY;if(null==n||null==i)return t;return 3*(0!==i?Math.abs(i):Math.abs(n))*(i>0?-1:i<0?1:n>0?-1:1)}(t);t.zrDelta=r?r/120:-(t.detail||0)/3}var o=t.button;return null==t.which&&void 0!==o&&cs.test(t.type)&&(t.which=1&o?1:2&o?3:4&o?2:0),t}function ys(e,t,n,i){e.addEventListener(t,n,i)}function vs(e,t,n,i){e.removeEventListener(t,n,i)}var xs=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function bs(e){return 2===e.which||3===e.which}var ws=function(){function e(){this._track=[]}return e.prototype.recognize=function(e,t,n){return this._doTrack(e,t,n),this._recognize(e)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(e,t,n){var i=e.touches;if(i){for(var a={points:[],touches:[],target:t,event:e},r=0,o=i.length;r1&&a&&a.length>1){var o=Ss(a)/Ss(r);!isFinite(o)&&(o=1),t.pinchScale=o;var s=[((i=a)[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2];return t.pinchX=s[0],t.pinchY=s[1],{type:"pinch",target:e[0].target,event:t}}}}};function _s(){return[1,0,0,1,0,0]}function Ts(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function Es(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Ms(e,t,n){var i=t[0]*n[0]+t[2]*n[1],a=t[1]*n[0]+t[3]*n[1],r=t[0]*n[2]+t[2]*n[3],o=t[1]*n[2]+t[3]*n[3],s=t[0]*n[4]+t[2]*n[5]+t[4],l=t[1]*n[4]+t[3]*n[5]+t[5];return e[0]=i,e[1]=a,e[2]=r,e[3]=o,e[4]=s,e[5]=l,e}function Is(e,t,n){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+n[0],e[5]=t[5]+n[1],e}function ks(e,t,n,i){void 0===i&&(i=[0,0]);var a=t[0],r=t[2],o=t[4],s=t[1],l=t[3],p=t[5],c=Math.sin(n),d=Math.cos(n);return e[0]=a*d+s*c,e[1]=-a*c+s*d,e[2]=r*d+l*c,e[3]=-r*c+d*l,e[4]=d*(o-i[0])+c*(p-i[1])+i[0],e[5]=d*(p-i[1])-c*(o-i[0])+i[1],e}function Ps(e,t,n){var i=n[0],a=n[1];return e[0]=t[0]*i,e[1]=t[1]*a,e[2]=t[2]*i,e[3]=t[3]*a,e[4]=t[4]*i,e[5]=t[5]*a,e}function Ds(e,t){var n=t[0],i=t[2],a=t[4],r=t[1],o=t[3],s=t[5],l=n*o-r*i;return l?(l=1/l,e[0]=o*l,e[1]=-r*l,e[2]=-i*l,e[3]=n*l,e[4]=(i*s-o*a)*l,e[5]=(r*a-n*s)*l,e):null}function As(e){var t=[1,0,0,1,0,0];return Es(t,e),t}var Os=function(){function e(e,t){this.x=e||0,this.y=t||0}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(e,t){return this.x=e,this.y=t,this},e.prototype.equal=function(e){return e.x===this.x&&e.y===this.y},e.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this},e.prototype.scale=function(e){this.x*=e,this.y*=e},e.prototype.scaleAndAdd=function(e,t){this.x+=e.x*t,this.y+=e.y*t},e.prototype.sub=function(e){return this.x-=e.x,this.y-=e.y,this},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var e=this.len();return this.x/=e,this.y/=e,this},e.prototype.distance=function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},e.prototype.distanceSquare=function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(e){if(e){var t=this.x,n=this.y;return this.x=e[0]*t+e[2]*n+e[4],this.y=e[1]*t+e[3]*n+e[5],this}},e.prototype.toArray=function(e){return e[0]=this.x,e[1]=this.y,e},e.prototype.fromArray=function(e){this.x=e[0],this.y=e[1]},e.set=function(e,t,n){e.x=t,e.y=n},e.copy=function(e,t){e.x=t.x,e.y=t.y},e.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y)},e.lenSquare=function(e){return e.x*e.x+e.y*e.y},e.dot=function(e,t){return e.x*t.x+e.y*t.y},e.add=function(e,t,n){e.x=t.x+n.x,e.y=t.y+n.y},e.sub=function(e,t,n){e.x=t.x-n.x,e.y=t.y-n.y},e.scale=function(e,t,n){e.x=t.x*n,e.y=t.y*n},e.scaleAndAdd=function(e,t,n,i){e.x=t.x+n.x*i,e.y=t.y+n.y*i},e.lerp=function(e,t,n,i){var a=1-i;e.x=a*t.x+i*n.x,e.y=a*t.y+i*n.y},e}(),Rs=Math.min,Bs=Math.max,Fs=new Os,Ns=new Os,Ls=new Os,Vs=new Os,qs=new Os,Gs=new Os,zs=function(){function e(e,t,n,i){n<0&&(e+=n,n=-n),i<0&&(t+=i,i=-i),this.x=e,this.y=t,this.width=n,this.height=i}return e.prototype.union=function(e){var t=Rs(e.x,this.x),n=Rs(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Bs(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Bs(e.y+e.height,this.y+this.height)-n:this.height=e.height,this.x=t,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(e){var t=this,n=e.width/t.width,i=e.height/t.height,a=[1,0,0,1,0,0];return Is(a,a,[-t.x,-t.y]),Ps(a,a,[n,i]),Is(a,a,[e.x,e.y]),a},e.prototype.intersect=function(t,n){if(!t)return!1;t instanceof e||(t=e.create(t));var i=this,a=i.x,r=i.x+i.width,o=i.y,s=i.y+i.height,l=t.x,p=t.x+t.width,c=t.y,d=t.y+t.height,u=!(rh&&(h=x,gh&&(h=b,y=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){e.copy(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return 0===this.width||0===this.height},e.create=function(t){return new e(t.x,t.y,t.width,t.height)},e.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},e.applyTransform=function(t,n,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var a=i[0],r=i[3],o=i[4],s=i[5];return t.x=n.x*a+o,t.y=n.y*r+s,t.width=n.width*a,t.height=n.height*r,t.width<0&&(t.x+=t.width,t.width=-t.width),void(t.height<0&&(t.y+=t.height,t.height=-t.height))}Fs.x=Ls.x=n.x,Fs.y=Vs.y=n.y,Ns.x=Vs.x=n.x+n.width,Ns.y=Ls.y=n.y+n.height,Fs.transform(i),Vs.transform(i),Ns.transform(i),Ls.transform(i),t.x=Rs(Fs.x,Ns.x,Ls.x,Vs.x),t.y=Rs(Fs.y,Ns.y,Ls.y,Vs.y);var l=Bs(Fs.x,Ns.x,Ls.x,Vs.x),p=Bs(Fs.y,Ns.y,Ls.y,Vs.y);t.width=l-t.x,t.height=p-t.y}else t!==n&&e.copy(t,n)},e}(),Us="silent";function js(){xs(this.event)}var Hs=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handler=null,t}return Xe(t,e),t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(Jo),Ws=function(e,t){this.x=e,this.y=t},$s=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Ks=new zs(0,0,0,0),Ys=function(e){function t(t,n,i,a,r){var o=e.call(this)||this;return o._hovered=new Ws(0,0),o.storage=t,o.painter=n,o.painterRoot=a,o._pointerSize=r,i=i||new Hs,o.proxy=null,o.setHandlerProxy(i),o._draggingMgr=new Qo(o),o}return Xe(t,e),t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(Hr($s,function(t){e.on&&e.on(t,this[t],this)},this),e.handler=this),this.proxy=e},t.prototype.mousemove=function(e){var t=e.zrX,n=e.zrY,i=Qs(this,t,n),a=this._hovered,r=a.target;r&&!r.__zr&&(r=(a=this.findHover(a.x,a.y)).target);var o=this._hovered=i?new Ws(t,n):this.findHover(t,n),s=o.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),r&&s!==r&&this.dispatchToElement(a,"mouseout",e),this.dispatchToElement(o,"mousemove",e),s&&s!==r&&this.dispatchToElement(o,"mouseover",e)},t.prototype.mouseout=function(e){var t=e.zrEventControl;"only_globalout"!==t&&this.dispatchToElement(this._hovered,"mouseout",e),"no_globalout"!==t&&this.trigger("globalout",{type:"globalout",event:e})},t.prototype.resize=function(){this._hovered=new Ws(0,0)},t.prototype.dispatch=function(e,t){var n=this[e];n&&n.call(this,t)},t.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},t.prototype.setCursorStyle=function(e){var t=this.proxy;t.setCursor&&t.setCursor(e)},t.prototype.dispatchToElement=function(e,t,n){var i=(e=e||{}).target;if(!i||!i.silent){for(var a="on"+t,r=function(e,t,n){return{type:e,event:n,target:t.target,topTarget:t.topTarget,cancelBubble:!1,offsetX:n.zrX,offsetY:n.zrY,gestureEvent:n.gestureEvent,pinchX:n.pinchX,pinchY:n.pinchY,pinchScale:n.pinchScale,wheelDelta:n.zrDelta,zrByTouch:n.zrByTouch,which:n.which,stop:js}}(t,e,n);i&&(i[a]&&(r.cancelBubble=!!i[a].call(i,r)),i.trigger(t,r),i=i.__hostTarget?i.__hostTarget:i.parent,!r.cancelBubble););r.cancelBubble||(this.trigger(t,r),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer(function(e){"function"==typeof e[a]&&e[a].call(e,r),e.trigger&&e.trigger(t,r)}))}},t.prototype.findHover=function(e,t,n){var i=this.storage.getDisplayList(),a=new Ws(e,t);if(Zs(i,a,e,t,n),this._pointerSize&&!a.target){for(var r=[],o=this._pointerSize,s=o/2,l=new zs(e-s,t-s,o,o),p=i.length-1;p>=0;p--){var c=i[p];c===n||c.ignore||c.ignoreCoarsePointer||c.parent&&c.parent.ignoreCoarsePointer||(Ks.copy(c.getBoundingRect()),c.transform&&Ks.applyTransform(c.transform),Ks.intersect(l)&&r.push(c))}if(r.length)for(var d=Math.PI/12,u=2*Math.PI,m=0;m=0;r--){var o=e[r],s=void 0;if(o!==a&&!o.ignore&&(s=Xs(o,n,i))&&(!t.topTarget&&(t.topTarget=o),s!==Us)){t.target=o;break}}}function Qs(e,t,n){var i=e.painter;return t<0||t>i.getWidth()||n<0||n>i.getHeight()}Hr(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(e){Ys.prototype[e]=function(t){var n,i,a=t.zrX,r=t.zrY,o=Qs(this,a,r);if("mouseup"===e&&o||(i=(n=this.findHover(a,r)).target),"mousedown"===e)this._downEl=i,this._downPoint=[t.zrX,t.zrY],this._upEl=i;else if("mouseup"===e)this._upEl=i;else if("click"===e){if(this._downEl!==this._upEl||!this._downPoint||jo(this._downPoint,[t.zrX,t.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,e,t)}});function Js(e,t,n,i){var a=t+1;if(a===n)return 1;if(i(e[a++],e[t])<0){for(;a=0;)a++;return a-t}function el(e,t,n,i,a){for(i===t&&i++;i>>1])<0?l=r:s=r+1;var p=i-s;switch(p){case 3:e[s+3]=e[s+2];case 2:e[s+2]=e[s+1];case 1:e[s+1]=e[s];break;default:for(;p>0;)e[s+p]=e[s+p-1],p--}e[s]=o}}function tl(e,t,n,i,a,r){var o=0,s=0,l=1;if(r(e,t[n+a])>0){for(s=i-a;l0;)o=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;ls&&(l=s);var p=o;o=a-l,l=a-p}for(o++;o>>1);r(e,t[n+c])>0?o=c+1:l=c}return l}function nl(e,t,n,i,a,r){var o=0,s=0,l=1;if(r(e,t[n+a])<0){for(s=a+1;ls&&(l=s);var p=o;o=a-l,l=a-p}else{for(s=i-a;l=0;)o=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o>>1);r(e,t[n+c])<0?l=c:o=c+1}return l}function il(e,t){var n,i,a=7,r=0,o=[];function s(s){var l=n[s],p=i[s],c=n[s+1],d=i[s+1];i[s]=p+d,s===r-3&&(n[s+1]=n[s+2],i[s+1]=i[s+2]),r--;var u=nl(e[c],e,l,p,0,t);l+=u,0!==(p-=u)&&0!==(d=tl(e[l+p-1],e,c,d,d-1,t))&&(p<=d?function(n,i,r,s){var l=0;for(l=0;l=7||m>=7);if(h)break;g<0&&(g=0),g+=2}if((a=g)<1&&(a=1),1===i){for(l=0;l=0;l--)e[m+l]=e[u+l];return void(e[d]=o[c])}var h=a;for(;;){var g=0,f=0,y=!1;do{if(t(o[c],e[p])<0){if(e[d--]=e[p--],g++,f=0,0===--i){y=!0;break}}else if(e[d--]=o[c--],f++,g=0,1===--s){y=!0;break}}while((g|f)=0;l--)e[m+l]=e[u+l];if(0===i){y=!0;break}}if(e[d--]=o[c--],1===--s){y=!0;break}if(0!==(f=s-tl(e[p],o,0,s,s-1,t))){for(s-=f,m=(d-=f)+1,u=(c-=f)+1,l=0;l=7||f>=7);if(y)break;h<0&&(h=0),h+=2}(a=h)<1&&(a=1);if(1===s){for(m=(d-=i)+1,u=(p-=i)+1,l=i-1;l>=0;l--)e[m+l]=e[u+l];e[d]=o[c]}else{if(0===s)throw new Error;for(u=d-(s-1),l=0;l1;){var e=r-2;if(e>=1&&i[e-1]<=i[e]+i[e+1]||e>=2&&i[e-2]<=i[e]+i[e-1])i[e-1]i[e+1])break;s(e)}},forceMergeRuns:function(){for(;r>1;){var e=r-2;e>0&&i[e-1]=32;)t|=1&e,e>>=1;return e+t}(a);do{if((r=Js(e,n,i,t))s&&(l=s),el(e,n,n+l,n+r,t),r=l}o.pushRun(n,r),o.mergeRuns(),a-=r,n+=r}while(0!==a);o.forceMergeRuns()}}}var rl=!1;function ol(){rl||(rl=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function sl(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var ll=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=sl}return e.prototype.traverse=function(e,t){for(var n=0;n0&&(p.__clipPaths=[]),isNaN(p.z)&&(ol(),p.z=0),isNaN(p.z2)&&(ol(),p.z2=0),isNaN(p.zlevel)&&(ol(),p.zlevel=0),this._displayList[this._displayListLen++]=p}var c=e.getDecalElement&&e.getDecalElement();c&&this._updateAndAddDisplayable(c,t,n);var d=e.getTextGuideLine();d&&this._updateAndAddDisplayable(d,t,n);var u=e.getTextContent();u&&this._updateAndAddDisplayable(u,t,n)}},e.prototype.addRoot=function(e){e.__zr&&e.__zr.storage===this||this._roots.push(e)},e.prototype.delRoot=function(e){if(e instanceof Array)for(var t=0,n=e.length;t=0&&this._roots.splice(i,1)}},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),pl=gr.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)},cl={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return.5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return 0===e?0:Math.pow(1024,e-1)},exponentialOut:function(e){return 1===e?1:1-Math.pow(2,-10*e)},exponentialInOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,n=.1;return 0===e?0:1===e?1:(!n||n<1?(n=1,t=.1):t=.4*Math.asin(1/n)/(2*Math.PI),-n*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/.4))},elasticOut:function(e){var t,n=.1;return 0===e?0:1===e?1:(!n||n<1?(n=1,t=.1):t=.4*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*e)*Math.sin((e-t)*(2*Math.PI)/.4)+1)},elasticInOut:function(e){var t,n=.1,i=.4;return 0===e?0:1===e?1:(!n||n<1?(n=1,t=.1):t=i*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?n*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/i)*-.5:n*Math.pow(2,-10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/i)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-cl.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?.5*cl.bounceIn(2*e):.5*cl.bounceOut(2*e-1)+.5}},dl=Math.pow,ul=Math.sqrt,ml=1e-8,hl=1e-4,gl=ul(3),fl=1/3,yl=Oo(),vl=Oo(),xl=Oo();function bl(e){return e>-1e-8&&eml||e<-1e-8}function Sl(e,t,n,i,a){var r=1-a;return r*r*(r*e+3*a*t)+a*a*(a*i+3*r*n)}function Cl(e,t,n,i,a){var r=1-a;return 3*(((t-e)*r+2*(n-t)*a)*r+(i-n)*a*a)}function _l(e,t,n,i,a,r){var o=i+3*(t-n)-e,s=3*(n-2*t+e),l=3*(t-e),p=e-a,c=s*s-3*o*l,d=s*l-9*o*p,u=l*l-3*s*p,m=0;if(bl(c)&&bl(d)){if(bl(s))r[0]=0;else(_=-l/s)>=0&&_<=1&&(r[m++]=_)}else{var h=d*d-4*c*u;if(bl(h)){var g=d/c,f=-g/2;(_=-s/o+g)>=0&&_<=1&&(r[m++]=_),f>=0&&f<=1&&(r[m++]=f)}else if(h>0){var y=ul(h),v=c*s+1.5*o*(-d+y),x=c*s+1.5*o*(-d-y);(_=(-s-((v=v<0?-dl(-v,fl):dl(v,fl))+(x=x<0?-dl(-x,fl):dl(x,fl))))/(3*o))>=0&&_<=1&&(r[m++]=_)}else{var b=(2*c*s-3*o*d)/(2*ul(c*c*c)),w=Math.acos(b)/3,S=ul(c),C=Math.cos(w),_=(-s-2*S*C)/(3*o),T=(f=(-s+S*(C+gl*Math.sin(w)))/(3*o),(-s+S*(C-gl*Math.sin(w)))/(3*o));_>=0&&_<=1&&(r[m++]=_),f>=0&&f<=1&&(r[m++]=f),T>=0&&T<=1&&(r[m++]=T)}}return m}function Tl(e,t,n,i,a){var r=6*n-12*t+6*e,o=9*t+3*i-3*e-9*n,s=3*t-3*e,l=0;if(bl(o)){if(wl(r))(c=-s/r)>=0&&c<=1&&(a[l++]=c)}else{var p=r*r-4*o*s;if(bl(p))a[0]=-r/(2*o);else if(p>0){var c,d=ul(p),u=(-r-d)/(2*o);(c=(-r+d)/(2*o))>=0&&c<=1&&(a[l++]=c),u>=0&&u<=1&&(a[l++]=u)}}return l}function El(e,t,n,i,a,r){var o=(t-e)*a+e,s=(n-t)*a+t,l=(i-n)*a+n,p=(s-o)*a+o,c=(l-s)*a+s,d=(c-p)*a+p;r[0]=e,r[1]=o,r[2]=p,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=i}function Ml(e,t,n,i,a,r,o,s,l,p,c){var d,u,m,h,g,f=.005,y=1/0;yl[0]=l,yl[1]=p;for(var v=0;v<1;v+=.05)vl[0]=Sl(e,n,a,o,v),vl[1]=Sl(t,i,r,s,v),(h=Wo(yl,vl))=0&&h=0&&f=1?1:_l(0,i,r,1,e,s)&&Sl(0,a,o,1,s[0])}}}var Nl=function(){function e(e){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=e.life||1e3,this._delay=e.delay||0,this.loop=e.loop||!1,this.onframe=e.onframe||Do,this.ondestroy=e.ondestroy||Do,this.onrestart=e.onrestart||Do,e.easing&&this.setEasing(e.easing)}return e.prototype.step=function(e,t){if(this._inited||(this._startTime=e+this._delay,this._inited=!0),!this._paused){var n=this._life,i=e-this._startTime-this._pausedTime,a=i/n;a<0&&(a=0),a=Math.min(a,1);var r=this.easingFunc,o=r?r(a):a;if(this.onframe(o),1===a){if(!this.loop)return!0;var s=i%n;this._startTime=e-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=t},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(e){this.easing=e,this.easingFunc=eo(e)?e:cl[e]||Fl(e)},e}(),Ll=function(e){this.value=e},Vl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Ll(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),ql=function(){function e(e){this._list=new Vl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,i=this._map,a=null;if(null==i[e]){var r=n.len(),o=this._lastRemovedEntry;if(r>=this._maxSize&&r>0){var s=n.head;n.remove(s),delete i[s.key],a=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Ll(t),o.key=e,n.insertEntry(o),i[e]=o}return a},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(null!=t)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),Gl={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function zl(e){return(e=Math.round(e))<0?0:e>255?255:e}function Ul(e){return e<0?0:e>1?1:e}function jl(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?zl(parseFloat(t)/100*255):zl(parseInt(t,10))}function Hl(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Ul(parseFloat(t)/100):Ul(parseFloat(t))}function Wl(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}function $l(e,t,n){return e+(t-e)*n}function Kl(e,t,n,i,a){return e[0]=t,e[1]=n,e[2]=i,e[3]=a,e}function Yl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var Xl=new ql(20),Zl=null;function Ql(e,t){Zl&&Yl(Zl,t),Zl=Xl.put(e,Zl||t.slice())}function Jl(e,t){if(e){t=t||[];var n=Xl.get(e);if(n)return Yl(t,n);var i=(e+="").replace(/ /g,"").toLowerCase();if(i in Gl)return Yl(t,Gl[i]),Ql(e,t),t;var a,r=i.length;if("#"===i.charAt(0))return 4===r||5===r?(a=parseInt(i.slice(1,4),16))>=0&&a<=4095?(Kl(t,(3840&a)>>4|(3840&a)>>8,240&a|(240&a)>>4,15&a|(15&a)<<4,5===r?parseInt(i.slice(4),16)/15:1),Ql(e,t),t):void Kl(t,0,0,0,1):7===r||9===r?(a=parseInt(i.slice(1,7),16))>=0&&a<=16777215?(Kl(t,(16711680&a)>>16,(65280&a)>>8,255&a,9===r?parseInt(i.slice(7),16)/255:1),Ql(e,t),t):void Kl(t,0,0,0,1):void 0;var o=i.indexOf("("),s=i.indexOf(")");if(-1!==o&&s+1===r){var l=i.substr(0,o),p=i.substr(o+1,s-(o+1)).split(","),c=1;switch(l){case"rgba":if(4!==p.length)return 3===p.length?Kl(t,+p[0],+p[1],+p[2],1):Kl(t,0,0,0,1);c=Hl(p.pop());case"rgb":return p.length>=3?(Kl(t,jl(p[0]),jl(p[1]),jl(p[2]),3===p.length?c:Hl(p[3])),Ql(e,t),t):void Kl(t,0,0,0,1);case"hsla":return 4!==p.length?void Kl(t,0,0,0,1):(p[3]=Hl(p[3]),ep(p,t),Ql(e,t),t);case"hsl":return 3!==p.length?void Kl(t,0,0,0,1):(ep(p,t),Ql(e,t),t);default:return}}Kl(t,0,0,0,1)}}function ep(e,t){var n=(parseFloat(e[0])%360+360)%360/360,i=Hl(e[1]),a=Hl(e[2]),r=a<=.5?a*(i+1):a+i-a*i,o=2*a-r;return Kl(t=t||[],zl(255*Wl(o,r,n+1/3)),zl(255*Wl(o,r,n)),zl(255*Wl(o,r,n-1/3)),1),4===e.length&&(t[3]=e[3]),t}function tp(e,t){var n=Jl(e);if(n){for(var i=0;i<3;i++)n[i]=t<0?n[i]*(1-t)|0:(255-n[i])*t+n[i]|0,n[i]>255?n[i]=255:n[i]<0&&(n[i]=0);return op(n,4===n.length?"rgba":"rgb")}}function np(e,t,n){if(t&&t.length&&e>=0&&e<=1){n=n||[];var i=e*(t.length-1),a=Math.floor(i),r=Math.ceil(i),o=t[a],s=t[r],l=i-a;return n[0]=zl($l(o[0],s[0],l)),n[1]=zl($l(o[1],s[1],l)),n[2]=zl($l(o[2],s[2],l)),n[3]=Ul($l(o[3],s[3],l)),n}}function ip(e,t,n){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),a=Math.floor(i),r=Math.ceil(i),o=Jl(t[a]),s=Jl(t[r]),l=i-a,p=op([zl($l(o[0],s[0],l)),zl($l(o[1],s[1],l)),zl($l(o[2],s[2],l)),Ul($l(o[3],s[3],l))],"rgba");return n?{color:p,leftIndex:a,rightIndex:r,value:i}:p}}function ap(e,t,n,i){var a=Jl(e);if(e)return a=function(e){if(e){var t,n,i=e[0]/255,a=e[1]/255,r=e[2]/255,o=Math.min(i,a,r),s=Math.max(i,a,r),l=s-o,p=(s+o)/2;if(0===l)t=0,n=0;else{n=p<.5?l/(s+o):l/(2-s-o);var c=((s-i)/6+l/2)/l,d=((s-a)/6+l/2)/l,u=((s-r)/6+l/2)/l;i===s?t=u-d:a===s?t=1/3+c-u:r===s&&(t=2/3+d-c),t<0&&(t+=1),t>1&&(t-=1)}var m=[360*t,n,p];return null!=e[3]&&m.push(e[3]),m}}(a),null!=t&&(a[0]=function(e){return(e=Math.round(e))<0?0:e>360?360:e}(t)),null!=n&&(a[1]=Hl(n)),null!=i&&(a[2]=Hl(i)),op(ep(a),"rgba")}function rp(e,t){var n=Jl(e);if(n&&null!=t)return n[3]=Ul(t),op(n,"rgba")}function op(e,t){if(e&&e.length){var n=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(n+=","+e[3]),t+"("+n+")"}}function sp(e,t){var n=Jl(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var lp=new ql(100);function pp(e){if(to(e)){var t=lp.get(e);return t||(t=tp(e,-.1),lp.put(e,t)),t}if(lo(e)){var n=Vr({},e);return n.colorStops=Wr(e.colorStops,function(e){return{offset:e.offset,color:tp(e.color,-.1)}}),n}return e}var cp=Math.round;function dp(e){var t;if(e&&"transparent"!==e){if("string"==typeof e&&e.indexOf("rgba")>-1){var n=Jl(e);n&&(e="rgb("+n[0]+","+n[1]+","+n[2]+")",t=n[3])}}else e="none";return{color:e,opacity:null==t?1:t}}var up=1e-4;function mp(e){return e-1e-4}function hp(e){return cp(1e3*e)/1e3}function gp(e){return cp(1e4*e)/1e4}var fp={left:"start",right:"end",center:"middle",middle:"middle"};function yp(e){return e&&!!e.image}function vp(e){return yp(e)||function(e){return e&&!!e.svgElement}(e)}function xp(e){return"linear"===e.type}function bp(e){return"radial"===e.type}function wp(e){return e&&("linear"===e.type||"radial"===e.type)}function Sp(e){return"url(#"+e+")"}function Cp(e){var t=e.getGlobalScale(),n=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(n)/Math.log(10)),1)}function _p(e){var t=e.x||0,n=e.y||0,i=(e.rotation||0)*Ao,a=ho(e.scaleX,1),r=ho(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,l=[];return(t||n)&&l.push("translate("+t+"px,"+n+"px)"),i&&l.push("rotate("+i+")"),1===a&&1===r||l.push("scale("+a+","+r+")"),(o||s)&&l.push("skew("+cp(o*Ao)+"deg, "+cp(s*Ao)+"deg)"),l.join(" ")}var Tp=gr.hasGlobalWindow&&eo(window.btoa)?function(e){return window.btoa(unescape(encodeURIComponent(e)))}:"undefined"!=typeof Buffer?function(e){return Buffer.from(e).toString("base64")}:function(e){return null},Ep=Array.prototype.slice;function Mp(e,t,n){return(t-e)*n+e}function Ip(e,t,n,i){for(var a=t.length,r=0;ri?t:e,r=Math.min(n,i),o=a[r-1]||{color:[0,0,0,0],offset:0},s=r;so)i.length=o;else for(var s=r;s=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t,n){this._needsSort=!0;var i=this.keyframes,a=i.length,r=!1,o=6,s=t;if(jr(t)){var l=function(e){return jr(e&&e[0])?2:1}(t);o=l,(1===l&&!io(t[0])||2===l&&!io(t[0][0]))&&(r=!0)}else if(io(t)&&!uo(t))o=0;else if(to(t))if(isNaN(+t)){var p=Jl(t);p&&(s=p,o=3)}else o=0;else if(lo(t)){var c=Vr({},s);c.colorStops=Wr(t.colorStops,function(e){return{offset:e.offset,color:Jl(e.color)}}),xp(t)?o=4:bp(t)&&(o=5),s=c}0===a?this.valType=o:o===this.valType&&6!==o||(r=!0),this.discrete=this.discrete||r;var d={time:e,value:s,rawValue:t,percent:0};return n&&(d.easing=n,d.easingFunc=eo(n)?n:cl[n]||Fl(n)),i.push(d),d},e.prototype.prepare=function(e,t){var n=this.keyframes;this._needsSort&&n.sort(function(e,t){return e.time-t.time});for(var i=this.valType,a=n.length,r=n[a-1],o=this.discrete,s=Fp(i),l=Bp(i),p=0;p=0&&!(l[n].percent<=t);n--);n=m(n,p-2)}else{for(n=u;nt);n++);n=m(n-1,p-2)}a=l[n+1],i=l[n]}if(i&&a){this._lastFr=n,this._lastFrP=t;var h=a.percent-i.percent,g=0===h?1:m((t-i.percent)/h,1);a.easingFunc&&(g=a.easingFunc(g));var f=r?this._additiveValue:d?Np:e[c];if(!Fp(s)&&!d||f||(f=this._additiveValue=[]),this.discrete)e[c]=g<1?i.rawValue:a.rawValue;else if(Fp(s))1===s?Ip(f,i[o],a[o],g):function(e,t,n,i){for(var a=t.length,r=a&&t[0].length,o=0;o0&&s.addKeyframe(0,Op(l),i),this._trackKeys.push(o)}s.addKeyframe(e,Op(t[o]),i)}return this._maxTime=Math.max(this._maxTime,e),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(e){return this._maxTime=e,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var e=this._doneCbs;if(e)for(var t=e.length,n=0;n0)){this._started=1;for(var t=this,n=[],i=this._maxTime||0,a=0;a1){var o=r.pop();a.addKeyframe(o.time,e[i]),a.prepare(this._maxTime,a.getAdditiveTrack())}}}},e}();function qp(){return(new Date).getTime()}var Gp,zp,Up=function(e){function t(t){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,t=t||{},n.stage=t.stage||{},n}return Xe(t,e),t.prototype.addClip=function(e){e.animation&&this.removeClip(e),this._head?(this._tail.next=e,e.prev=this._tail,e.next=null,this._tail=e):this._head=this._tail=e,e.animation=this},t.prototype.addAnimator=function(e){e.animation=this;var t=e.getClip();t&&this.addClip(t)},t.prototype.removeClip=function(e){if(e.animation){var t=e.prev,n=e.next;t?t.next=n:this._head=n,n?n.prev=t:this._tail=t,e.next=e.prev=e.animation=null}},t.prototype.removeAnimator=function(e){var t=e.getClip();t&&this.removeClip(t),e.animation=null},t.prototype.update=function(e){for(var t=qp()-this._pausedTime,n=t-this._time,i=this._head;i;){var a=i.next;i.step(t,n)?(i.ondestroy(),this.removeClip(i),i=a):i=a}this._time=t,e||(this.trigger("frame",n),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var e=this;this._running=!0,pl(function t(){e._running&&(pl(t),!e._paused&&e.update())})},t.prototype.start=function(){this._running||(this._time=qp(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=qp(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=qp()-this._pauseStart,this._paused=!1)},t.prototype.clear=function(){for(var e=this._head;e;){var t=e.next;e.prev=e.next=e.animation=null,e=t}this._head=this._tail=null},t.prototype.isFinished=function(){return null==this._head},t.prototype.animate=function(e,t){t=t||{},this.start();var n=new Vp(e,t.loop);return this.addAnimator(n),n},t}(Jo),jp=gr.domSupported,Hp=(zp={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:Gp=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:Wr(Gp,function(e){var t=e.replace("mouse","pointer");return zp.hasOwnProperty(t)?t:e})}),Wp=["mousemove","mouseup"],$p=["pointermove","pointerup"],Kp=!1;function Yp(e){var t=e.pointerType;return"pen"===t||"touch"===t}function Xp(e){e&&(e.zrByTouch=!0)}function Zp(e,t){for(var n=t,i=!1;n&&9!==n.nodeType&&!(i=n.domBelongToZr||n!==t&&n===e.painterRoot);)n=n.parentNode;return i}var Qp=function(e,t){this.stopPropagation=Do,this.stopImmediatePropagation=Do,this.preventDefault=Do,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY},Jp={mousedown:function(e){e=fs(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=fs(this.dom,e);var t=this.__mayPointerCapture;!t||e.zrX===t[0]&&e.zrY===t[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",e)},mouseup:function(e){e=fs(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){Zp(this,(e=fs(this.dom,e)).toElement||e.relatedTarget)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){Kp=!0,e=fs(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){Kp||(e=fs(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){Xp(e=fs(this.dom,e)),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),Jp.mousemove.call(this,e),Jp.mousedown.call(this,e)},touchmove:function(e){Xp(e=fs(this.dom,e)),this.handler.processGesture(e,"change"),Jp.mousemove.call(this,e)},touchend:function(e){Xp(e=fs(this.dom,e)),this.handler.processGesture(e,"end"),Jp.mouseup.call(this,e),+new Date-+this.__lastTouchMoment<300&&Jp.click.call(this,e)},pointerdown:function(e){Jp.mousedown.call(this,e)},pointermove:function(e){Yp(e)||Jp.mousemove.call(this,e)},pointerup:function(e){Jp.mouseup.call(this,e)},pointerout:function(e){Yp(e)||Jp.mouseout.call(this,e)}};Hr(["click","dblclick","contextmenu"],function(e){Jp[e]=function(t){t=fs(this.dom,t),this.trigger(e,t)}});var ec={pointermove:function(e){Yp(e)||ec.mousemove.call(this,e)},pointerup:function(e){ec.mouseup.call(this,e)},mousemove:function(e){this.trigger("mousemove",e)},mouseup:function(e){var t=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",e),t&&(e.zrEventControl="only_globalout",this.trigger("mouseout",e))}};function tc(e,t){var n=t.domHandlers;gr.pointerEventsSupported?Hr(Hp.pointer,function(i){ic(t,i,function(t){n[i].call(e,t)})}):(gr.touchEventsSupported&&Hr(Hp.touch,function(i){ic(t,i,function(a){n[i].call(e,a),function(e){e.touching=!0,null!=e.touchTimer&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}(t)})}),Hr(Hp.mouse,function(i){ic(t,i,function(a){a=gs(a),t.touching||n[i].call(e,a)})}))}function nc(e,t){function n(n){ic(t,n,function(i){i=gs(i),Zp(e,i.target)||(i=function(e,t){return fs(e.dom,new Qp(e,t),!0)}(e,i),t.domHandlers[n].call(e,i))},{capture:!0})}gr.pointerEventsSupported?Hr($p,n):gr.touchEventsSupported||Hr(Wp,n)}function ic(e,t,n,i){e.mounted[t]=n,e.listenerOpts[t]=i,ys(e.domTarget,t,n,i)}function ac(e){var t=e.mounted;for(var n in t)t.hasOwnProperty(n)&&vs(e.domTarget,n,t[n],e.listenerOpts[n]);e.mounted={}}var rc=function(e,t){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=t},oc=function(e){function t(t,n){var i=e.call(this)||this;return i.__pointerCapturing=!1,i.dom=t,i.painterRoot=n,i._localHandlerScope=new rc(t,Jp),jp&&(i._globalHandlerScope=new rc(document,ec)),tc(i,i._localHandlerScope),i}return Xe(t,e),t.prototype.dispose=function(){ac(this._localHandlerScope),jp&&ac(this._globalHandlerScope)},t.prototype.setCursor=function(e){this.dom.style&&(this.dom.style.cursor=e||"default")},t.prototype.__togglePointerCapture=function(e){if(this.__mayPointerCapture=null,jp&&+this.__pointerCapturing^+e){this.__pointerCapturing=e;var t=this._globalHandlerScope;e?nc(this,t):ac(t)}},t}(Jo),sc=1;gr.hasGlobalWindow&&(sc=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var lc=sc,pc="#333",cc="#ccc",dc=Ts,uc=5e-5;function mc(e){return e>uc||e<-5e-5}var hc=[],gc=[],fc=[1,0,0,1,0,0],yc=Math.abs,vc=function(){function e(){}return e.prototype.getLocalTransform=function(t){return e.getLocalTransform(this,t)},e.prototype.setPosition=function(e){this.x=e[0],this.y=e[1]},e.prototype.setScale=function(e){this.scaleX=e[0],this.scaleY=e[1]},e.prototype.setSkew=function(e){this.skewX=e[0],this.skewY=e[1]},e.prototype.setOrigin=function(e){this.originX=e[0],this.originY=e[1]},e.prototype.needLocalTransform=function(){return mc(this.rotation)||mc(this.x)||mc(this.y)||mc(this.scaleX-1)||mc(this.scaleY-1)||mc(this.skewX)||mc(this.skewY)},e.prototype.updateTransform=function(){var e=this.parent&&this.parent.transform,t=this.needLocalTransform(),n=this.transform;t||e?(n=n||[1,0,0,1,0,0],t?this.getLocalTransform(n):dc(n),e&&(t?Ms(n,e,n):Es(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(dc(n),this.invTransform=null)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(null!=t&&1!==t){this.getGlobalScale(hc);var n=hc[0]<0?-1:1,i=hc[1]<0?-1:1,a=((hc[0]-n)*t+n)/hc[0]||0,r=((hc[1]-i)*t+i)/hc[1]||0;e[0]*=a,e[1]*=a,e[2]*=r,e[3]*=r}this.invTransform=this.invTransform||[1,0,0,1,0,0],Ds(this.invTransform,e)},e.prototype.getComputedTransform=function(){for(var e=this,t=[];e;)t.push(e),e=e.parent;for(;e=t.pop();)e.updateTransform();return this.transform},e.prototype.setLocalTransform=function(e){if(e){var t=e[0]*e[0]+e[1]*e[1],n=e[2]*e[2]+e[3]*e[3],i=Math.atan2(e[1],e[0]),a=Math.PI/2+i-Math.atan2(e[3],e[2]);n=Math.sqrt(n)*Math.cos(a),t=Math.sqrt(t),this.skewX=a,this.skewY=0,this.rotation=-i,this.x=+e[4],this.y=+e[5],this.scaleX=t,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var e=this.parent,t=this.transform;e&&e.transform&&(e.invTransform=e.invTransform||[1,0,0,1,0,0],Ms(gc,e.invTransform,t),t=gc);var n=this.originX,i=this.originY;(n||i)&&(fc[4]=n,fc[5]=i,Ms(gc,t,fc),gc[4]-=n,gc[5]-=i,t=gc),this.setLocalTransform(t)}},e.prototype.getGlobalScale=function(e){var t=this.transform;return e=e||[],t?(e[0]=Math.sqrt(t[0]*t[0]+t[1]*t[1]),e[1]=Math.sqrt(t[2]*t[2]+t[3]*t[3]),t[0]<0&&(e[0]=-e[0]),t[3]<0&&(e[1]=-e[1]),e):(e[0]=1,e[1]=1,e)},e.prototype.transformCoordToLocal=function(e,t){var n=[e,t],i=this.invTransform;return i&&Ko(n,n,i),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],i=this.transform;return i&&Ko(n,n,i),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&yc(e[0]-1)>1e-10&&yc(e[3]-1)>1e-10?Math.sqrt(yc(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){bc(this,e)},e.getLocalTransform=function(e,t){t=t||[];var n=e.originX||0,i=e.originY||0,a=e.scaleX,r=e.scaleY,o=e.anchorX,s=e.anchorY,l=e.rotation||0,p=e.x,c=e.y,d=e.skewX?Math.tan(e.skewX):0,u=e.skewY?Math.tan(-e.skewY):0;if(n||i||o||s){var m=n+o,h=i+s;t[4]=-m*a-d*h*r,t[5]=-h*r-u*m*a}else t[4]=t[5]=0;return t[0]=a,t[3]=r,t[1]=u*a,t[2]=d*r,l&&ks(t,t,l),t[4]+=n+p,t[5]+=i+c,t},e.initDefaultProps=function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0}(),e}(),xc=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function bc(e,t){for(var n=0;n=0?parseFloat(e)/100*t:parseFloat(e):e}function kc(e,t,n){var i=t.position||"inside",a=null!=t.distance?t.distance:5,r=n.height,o=n.width,s=r/2,l=n.x,p=n.y,c="left",d="top";if(i instanceof Array)l+=Ic(i[0],n.width),p+=Ic(i[1],n.height),c=null,d=null;else switch(i){case"left":l-=a,p+=s,c="right",d="middle";break;case"right":l+=a+o,p+=s,d="middle";break;case"top":l+=o/2,p-=a,c="center",d="bottom";break;case"bottom":l+=o/2,p+=r+a,c="center";break;case"inside":l+=o/2,p+=s,c="center",d="middle";break;case"insideLeft":l+=a,p+=s,d="middle";break;case"insideRight":l+=o-a,p+=s,c="right",d="middle";break;case"insideTop":l+=o/2,p+=a,c="center";break;case"insideBottom":l+=o/2,p+=r-a,c="center",d="bottom";break;case"insideTopLeft":l+=a,p+=a;break;case"insideTopRight":l+=o-a,p+=a,c="right";break;case"insideBottomLeft":l+=a,p+=r-a,d="bottom";break;case"insideBottomRight":l+=o-a,p+=r-a,c="right",d="bottom"}return(e=e||{}).x=l,e.y=p,e.align=c,e.verticalAlign=d,e}var Pc="__zr_normal__",Dc=xc.concat(["ignore"]),Ac=$r(xc,function(e,t){return e[t]=!0,e},{ignore:!1}),Oc={},Rc=new zs(0,0,0,0),Bc=function(){function e(e){this.id=Rr(),this.animators=[],this.currentStates=[],this.states={},this._init(e)}return e.prototype._init=function(e){this.attr(e)},e.prototype.drift=function(e,t,n){switch(this.draggable){case"horizontal":t=0;break;case"vertical":e=0}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=e,i[5]+=t,this.decomposeTransform(),this.markRedraw()},e.prototype.beforeUpdate=function(){},e.prototype.afterUpdate=function(){},e.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},e.prototype.updateInnerText=function(e){var t=this._textContent;if(t&&(!t.ignore||e)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,a=t.innerTransformable,r=void 0,o=void 0,s=!1;a.parent=i?this:null;var l=!1;if(a.copyTransform(t),null!=n.position){var p=Rc;n.layoutRect?p.copy(n.layoutRect):p.copy(this.getBoundingRect()),i||p.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(Oc,n,p):kc(Oc,n,p),a.x=Oc.x,a.y=Oc.y,r=Oc.align,o=Oc.verticalAlign;var c=n.origin;if(c&&null!=n.rotation){var d=void 0,u=void 0;"center"===c?(d=.5*p.width,u=.5*p.height):(d=Ic(c[0],p.width),u=Ic(c[1],p.height)),l=!0,a.originX=-a.x+d+(i?0:p.x),a.originY=-a.y+u+(i?0:p.y)}}null!=n.rotation&&(a.rotation=n.rotation);var m=n.offset;m&&(a.x+=m[0],a.y+=m[1],l||(a.originX=-m[0],a.originY=-m[1]));var h=null==n.inside?"string"==typeof n.position&&n.position.indexOf("inside")>=0:n.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),f=void 0,y=void 0,v=void 0;h&&this.canBeInsideText()?(f=n.insideFill,y=n.insideStroke,null!=f&&"auto"!==f||(f=this.getInsideTextFill()),null!=y&&"auto"!==y||(y=this.getInsideTextStroke(f),v=!0)):(f=n.outsideFill,y=n.outsideStroke,null!=f&&"auto"!==f||(f=this.getOutsideFill()),null!=y&&"auto"!==y||(y=this.getOutsideStroke(f),v=!0)),(f=f||"#000")===g.fill&&y===g.stroke&&v===g.autoStroke&&r===g.align&&o===g.verticalAlign||(s=!0,g.fill=f,g.stroke=y,g.autoStroke=v,g.align=r,g.verticalAlign=o,t.setDefaultTextStyle(g)),t.__dirty|=1,s&&t.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return"#fff"},e.prototype.getInsideTextStroke=function(e){return"#000"},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?cc:pc},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof t&&Jl(t);n||(n=[255,255,255,1]);for(var i=n[3],a=this.__zr.isDarkMode(),r=0;r<3;r++)n[r]=n[r]*i+(a?0:255)*(1-i);return n[3]=1,op(n,"rgba")},e.prototype.traverse=function(e,t){},e.prototype.attrKV=function(e,t){"textConfig"===e?this.setTextConfig(t):"textContent"===e?this.setTextContent(t):"clipPath"===e?this.setClipPath(t):"extra"===e?(this.extra=this.extra||{},Vr(this.extra,t)):this[e]=t},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(e,t){if("string"==typeof e)this.attrKV(e,t);else if(ao(e))for(var n=Xr(e),i=0;i0},e.prototype.getState=function(e){return this.states[e]},e.prototype.ensureState=function(e){var t=this.states;return t[e]||(t[e]={}),t[e]},e.prototype.clearStates=function(e){this.useState(Pc,!1,e)},e.prototype.useState=function(e,t,n,i){var a=e===Pc;if(this.hasState()||!a){var r=this.currentStates,o=this.stateTransition;if(!(Gr(r,e)>=0)||!t&&1!==r.length){var s;if(this.stateProxy&&!a&&(s=this.stateProxy(e)),s||(s=this.states&&this.states[e]),s||a){a||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||i);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(e,s,this._normalState,t,!n&&!this.__inHover&&o&&o.duration>0,o);var p=this._textContent,c=this._textGuide;return p&&p.useState(e,t,n,l),c&&c.useState(e,t,n,l),a?(this.currentStates=[],this._normalState={}):t?this.currentStates.push(e):this.currentStates=[e],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2),s}Br("State "+e+" not exists.")}}},e.prototype.useStates=function(e,t,n){if(e.length){var i=[],a=this.currentStates,r=e.length,o=r===a.length;if(o)for(var s=0;s0,m);var h=this._textContent,g=this._textGuide;h&&h.useStates(e,t,d),g&&g.useStates(e,t,d),this._updateAnimationTargets(),this.currentStates=e.slice(),this.markRedraw(),!d&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2)}else this.clearStates()},e.prototype.isSilent=function(){for(var e=this.silent,t=this.parent;!e&&t;){if(t.silent){e=!0;break}t=t.parent}return e},e.prototype._updateAnimationTargets=function(){for(var e=0;e=0){var n=this.currentStates.slice();n.splice(t,1),this.useStates(n)}},e.prototype.replaceState=function(e,t,n){var i=this.currentStates.slice(),a=Gr(i,e),r=Gr(i,t)>=0;a>=0?r?i.splice(a,1):i[a]=t:n&&!r&&i.push(t),this.useStates(i)},e.prototype.toggleState=function(e,t){t?this.useState(e,!0):this.removeState(e)},e.prototype._mergeStates=function(e){for(var t,n={},i=0;i=0&&t.splice(n,1)}),this.animators.push(e),n&&n.animation.addAnimator(e),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(e){this.markRedraw()},e.prototype.stopAnimation=function(e,t){for(var n=this.animators,i=n.length,a=[],r=0;r0&&n.during&&r[0].during(function(e,t){n.during(t)});for(var u=0;u0||a.force&&!o.length){var S,C=void 0,_=void 0,T=void 0;if(s){_={},u&&(C={});for(b=0;b=0&&(n.splice(i,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=Gr(this._children,e);return n>=0&&this.replaceAt(t,n),this},t.prototype.replaceAt=function(e,t){var n=this._children,i=n[t];if(e&&e!==this&&e.parent!==this&&e!==i){n[t]=e,i.parent=null;var a=this.__zr;a&&i.removeSelfFromZr(a),this._doAdd(e)}return this},t.prototype._doAdd=function(e){e.parent&&e.parent.remove(e),e.parent=this;var t=this.__zr;t&&t!==e.__zr&&e.addSelfToZr(t),t&&t.refresh()},t.prototype.remove=function(e){var t=this.__zr,n=this._children,i=Gr(n,e);return i<0||(n.splice(i,1),e.parent=null,t&&e.removeSelfFromZr(t),t&&t.refresh()),this},t.prototype.removeAll=function(){for(var e=this._children,t=this.__zr,n=0;ne.onDestroy(t.next.bind(t))) * LICENSE * https://github.com/ecomfe/zrender/blob/master/LICENSE.txt */ -var Uc={},jc={};var Hc,Wc=function(){function e(e,t,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=t,this.id=e;var a=new cl,r=n.renderer||"canvas";Uc[r]||(r=eo(Uc)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var o=new Uc[r](t,a,n,e),s=n.ssr||o.ssrOnly;this.storage=a,this.painter=o;var l,p=xr.node||xr.worker||s?null:new lc(o.getViewportRoot(),o.root),c=n.useCoarsePointer;(null==c||"auto"===c?xr.touchEventsSupported:!!c)&&(l=vo(n.pointerSize,44)),this.handler=new Zs(a,o,p,o.root,l),this.animation=new Hp({stage:{update:s?null:function(){return i._flush(!0)}}}),s||this.animation.start()}return e.prototype.add=function(e){!this._disposed&&e&&(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},e.prototype.remove=function(e){!this._disposed&&e&&(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},e.prototype.configLayer=function(e,t){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,t),this.refresh())},e.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=function(e){if(!e)return!1;if("string"==typeof e)return pp(e,1)<.4;if(e.colorStops){for(var t=e.colorStops,n=0,i=t.length,a=0;a0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},e.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t0){if(e<=a)return o;if(e>=r)return s}else{if(e>=a)return o;if(e<=r)return s}else{if(e===a)return o;if(e===r)return s}return(e-a)/l*p+o}function Jc(e,t){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%"}return ro(e)?(n=e,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e;var n}function ed(e,t,n){return null==t&&(t=10),t=Math.min(Math.max(0,t),20),e=(+e).toFixed(t),n?e:+e}function td(e){return e.sort((function(e,t){return e-t})),e}function nd(e){if(e=+e,isNaN(e))return 0;if(e>1e-14)for(var t=1,n=0;n<15;n++,t*=10)if(Math.round(e*t)/t===e)return n;return id(e)}function id(e){var t=e.toString().toLowerCase(),n=t.indexOf("e"),i=n>0?+t.slice(n+1):0,a=n>0?n:t.length,r=t.indexOf("."),o=r<0?0:a-1-r;return Math.max(0,o-i)}function ad(e,t){var n=Math.log,i=Math.LN10,a=Math.floor(n(e[1]-e[0])/i),r=Math.round(n(Math.abs(t[1]-t[0]))/i),o=Math.min(Math.max(-a+r,0),20);return isFinite(o)?o:20}function rd(e,t){var n=Zr(e,(function(e,t){return e+(isNaN(t)?0:t)}),0);if(0===n)return[];for(var i=Math.pow(10,t),a=Xr(e,(function(e){return(isNaN(e)?0:e)/n*i*100})),r=100*i,o=Xr(a,(function(e){return Math.floor(e)})),s=Zr(o,(function(e,t){return e+t}),0),l=Xr(a,(function(e,t){return e-o[t]}));sp&&(p=l[d],c=d);++o[c],l[c]=0,++s}return Xr(o,(function(e){return e/i}))}function od(e,t){var n=Math.max(nd(e),nd(t)),i=e+t;return n>20?i:ed(i,n)}function sd(e){var t=2*Math.PI;return(e%t+t)%t}function ld(e){return e>-1e-4&&e=10&&t++,t}function md(e,t){var n=ud(e),i=Math.pow(10,n),a=e/i;return e=(t?a<1.5?1:a<2.5?2:a<4?3:a<7?5:10:a<1?1:a<2?2:a<3?3:a<5?5:10)*i,n>=-20?+e.toFixed(n<0?-n:0):e}function hd(e){e.sort((function(e,t){return s(e,t,0)?-1:1}));for(var t=-1/0,n=1,i=0;i=0||a&&Hr(a,s)<0)){var l=n.getShallow(s,t);null!=l&&(r[e[o][0]]=l)}}return r}}var iu=nu([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),au=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return iu(this,e,t)},e}(),ru=new zl(50);function ou(e){if("string"==typeof e){var t=ru.get(e);return t&&t.image}return e}function su(e,t,n,i,a){if(e){if("string"==typeof e){if(t&&t.__zrImageSrc===e||!n)return t;var r=ru.get(e),o={hostEl:n,cb:i,cbPayload:a};return r?!pu(t=r.image)&&r.pending.push(o):((t=Tr.loadImage(e,lu,lu)).__zrImageSrc=e,ru.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}return t}function lu(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=o;l++)s-=o;var p=_c(n,t);return p>s&&(n="",p=0),s=e-p,a.ellipsis=n,a.ellipsisWidth=p,a.contentWidth=s,a.containerWidth=e,a}function mu(e,t){var n=t.containerWidth,i=t.font,a=t.contentWidth;if(!n)return"";var r=_c(e,i);if(r<=n)return e;for(var o=0;;o++){if(r<=a||o>=t.maxIterations){e+=t.ellipsis;break}var s=0===o?hu(e,a,t.ascCharWidth,t.cnCharWidth):r>0?Math.floor(e.length*a/r):0;r=_c(e=e.substr(0,s),i)}return""===e&&(e=t.placeholder),e}function hu(e,t,n,i){for(var a=0,r=0,o=e.length;r0&&h+i.accumWidth>i.width&&(r=t.split("\n"),d=!0),i.accumWidth=h}else{var g=wu(t,c,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+m,o=g.linesWidths,r=g.lines}}else r=t.split("\n");for(var f=0;f=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}(e)||!!xu[e]}function wu(e,t,n,i,a){for(var r=[],o=[],s="",l="",p=0,c=0,d=0;dn:a+c+m>n)?c?(s||l)&&(h?(s||(s=l,l="",c=p=0),r.push(s),o.push(c-p),l+=u,s="",c=p+=m):(l&&(s+=l,l="",p=0),r.push(s),o.push(c),s=u,c=m)):h?(r.push(l),o.push(p),l=u,p=m):(r.push(u),o.push(m)):(c+=m,h?(l+=u,p+=m):(l&&(s+=l,l="",p=0),s+=u))}else l&&(s+=l,c+=p),r.push(s),o.push(c),s="",l="",p=0,c=0}return r.length||s||(s=e,l="",p=0),l&&(s+=l),s&&(r.push(s),o.push(c)),1===r.length&&(c+=a),{accumWidth:c,lines:r,linesWidths:o}}var Su="__zr_style_"+Math.round(10*Math.random()),Cu={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},_u={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Cu[Su]=!0;var Tu=["z","z2","invisible"],Eu=["invisible"],Iu=function(e){function t(t){return e.call(this,t)||this}var n;return Qe(t,e),t.prototype._init=function(t){for(var n=eo(t),i=0;i1e-4)return s[0]=e-n,s[1]=t-i,l[0]=e+n,void(l[1]=t+i);if(Bu[0]=Ou(a)*n+e,Bu[1]=Au(a)*i+t,Fu[0]=Ou(r)*n+e,Fu[1]=Au(r)*i+t,p(s,Bu,Fu),c(l,Bu,Fu),(a%=Ru)<0&&(a+=Ru),(r%=Ru)<0&&(r+=Ru),a>r&&!o?r+=Ru:aa&&(Nu[0]=Ou(m)*n+e,Nu[1]=Au(m)*i+t,p(s,Nu,s),c(l,Nu,l))}var Hu={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Wu=[],$u=[],Ku=[],Yu=[],Xu=[],Zu=[],Qu=Math.min,Ju=Math.max,em=Math.cos,tm=Math.sin,nm=Math.abs,im=Math.PI,am=2*im,rm="undefined"!=typeof Float32Array,om=[];function sm(e){return Math.round(e/im*1e8)/1e8%2*im}function lm(e,t){var n=sm(e[0]);n<0&&(n+=am);var i=n-e[0],a=e[1];a+=i,!t&&a-n>=am?a=n+am:t&&n-a>=am?a=n-am:!t&&n>a?a=n+(am-sm(n-a)):t&&n0&&(this._ux=nm(n/cc/e)||0,this._uy=nm(n/cc/t)||0)},e.prototype.setDPR=function(e){this.dpr=e},e.prototype.setContext=function(e){this._ctx=e},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(Hu.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},e.prototype.lineTo=function(e,t){var n=nm(e-this._xi),i=nm(t-this._yi),a=n>this._ux||i>this._uy;if(this.addData(Hu.L,e,t),this._ctx&&a&&this._ctx.lineTo(e,t),a)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var r=n*n+i*i;r>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=r)}return this},e.prototype.bezierCurveTo=function(e,t,n,i,a,r){return this._drawPendingPt(),this.addData(Hu.C,e,t,n,i,a,r),this._ctx&&this._ctx.bezierCurveTo(e,t,n,i,a,r),this._xi=a,this._yi=r,this},e.prototype.quadraticCurveTo=function(e,t,n,i){return this._drawPendingPt(),this.addData(Hu.Q,e,t,n,i),this._ctx&&this._ctx.quadraticCurveTo(e,t,n,i),this._xi=n,this._yi=i,this},e.prototype.arc=function(e,t,n,i,a,r){this._drawPendingPt(),om[0]=i,om[1]=a,lm(om,r),i=om[0];var o=(a=om[1])-i;return this.addData(Hu.A,e,t,n,n,i,o,0,r?0:1),this._ctx&&this._ctx.arc(e,t,n,i,a,r),this._xi=em(a)*n+e,this._yi=tm(a)*n+t,this},e.prototype.arcTo=function(e,t,n,i,a){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,n,i,a),this},e.prototype.rect=function(e,t,n,i){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,n,i),this.addData(Hu.R,e,t,n,i),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Hu.Z);var e=this._ctx,t=this._x0,n=this._y0;return e&&e.closePath(),this._xi=t,this._yi=n,this},e.prototype.fill=function(e){e&&e.fill(),this.toStatic()},e.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(e){var t=e.length;this.data&&this.data.length===t||!rm||(this.data=new Float32Array(t));for(var n=0;np.length&&(this._expandData(),p=this.data);for(var c=0;c0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t11&&(this.data=new Float32Array(e)))}},e.prototype.getBoundingRect=function(){Ku[0]=Ku[1]=Xu[0]=Xu[1]=Number.MAX_VALUE,Yu[0]=Yu[1]=Zu[0]=Zu[1]=-Number.MAX_VALUE;var e,t=this.data,n=0,i=0,a=0,r=0;for(e=0;en||nm(f)>i||d===t-1)&&(h=Math.sqrt(k*k+f*f),a=g,r=x);break;case Hu.C:var y=e[d++],v=e[d++],x=(g=e[d++],e[d++]),b=e[d++],w=e[d++];h=Pl(a,r,y,v,g,x,b,w,10),a=b,r=w;break;case Hu.Q:h=Fl(a,r,y=e[d++],v=e[d++],g=e[d++],x=e[d++],10),a=g,r=x;break;case Hu.A:var S=e[d++],C=e[d++],_=e[d++],T=e[d++],E=e[d++],I=e[d++],M=I+E;d+=1,m&&(o=em(E)*_+S,s=tm(E)*T+C),h=Ju(_,T)*Qu(am,Math.abs(I)),a=em(M)*_+S,r=tm(M)*T+C;break;case Hu.R:o=a=e[d++],s=r=e[d++],h=2*e[d++]+2*e[d++];break;case Hu.Z:var k=o-a;f=s-r;h=Math.sqrt(k*k+f*f),a=o,r=s}h>=0&&(l[c++]=h,p+=h)}return this._pathLen=p,p},e.prototype.rebuildPath=function(e,t){var n,i,a,r,o,s,l,p,c,d,u=this.data,m=this._ux,h=this._uy,g=this._len,f=t<1,y=0,v=0,x=0;if(!f||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,p=t*this._pathLen))e:for(var b=0;b0&&(e.lineTo(c,d),x=0),w){case Hu.M:n=a=u[b++],i=r=u[b++],e.moveTo(a,r);break;case Hu.L:o=u[b++],s=u[b++];var C=nm(o-a),_=nm(s-r);if(C>m||_>h){if(f){if(y+(K=l[v++])>p){var T=(p-y)/K;e.lineTo(a*(1-T)+o*T,r*(1-T)+s*T);break e}y+=K}e.lineTo(o,s),a=o,r=s,x=0}else{var E=C*C+_*_;E>x&&(c=o,d=s,x=E)}break;case Hu.C:var I=u[b++],M=u[b++],k=u[b++],P=u[b++],D=u[b++],A=u[b++];if(f){if(y+(K=l[v++])>p){Ml(a,I,k,D,T=(p-y)/K,Wu),Ml(r,M,P,A,T,$u),e.bezierCurveTo(Wu[1],$u[1],Wu[2],$u[2],Wu[3],$u[3]);break e}y+=K}e.bezierCurveTo(I,M,k,P,D,A),a=D,r=A;break;case Hu.Q:I=u[b++],M=u[b++],k=u[b++],P=u[b++];if(f){if(y+(K=l[v++])>p){Rl(a,I,k,T=(p-y)/K,Wu),Rl(r,M,P,T,$u),e.quadraticCurveTo(Wu[1],$u[1],Wu[2],$u[2]);break e}y+=K}e.quadraticCurveTo(I,M,k,P),a=k,r=P;break;case Hu.A:var O=u[b++],R=u[b++],B=u[b++],F=u[b++],N=u[b++],L=u[b++],V=u[b++],q=!u[b++],G=B>F?B:F,z=nm(B-F)>.001,U=N+L,j=!1;if(f)y+(K=l[v++])>p&&(U=N+L*(p-y)/K,j=!0),y+=K;if(z&&e.ellipse?e.ellipse(O,R,B,F,V,N,U,q):e.arc(O,R,G,N,U,q),j)break e;S&&(n=em(N)*B+O,i=tm(N)*F+R),a=em(U)*B+O,r=tm(U)*F+R;break;case Hu.R:n=a=u[b],i=r=u[b+1],o=u[b++],s=u[b++];var H=u[b++],W=u[b++];if(f){if(y+(K=l[v++])>p){var $=p-y;e.moveTo(o,s),e.lineTo(o+Qu($,H),s),($-=H)>0&&e.lineTo(o+H,s+Qu($,W)),($-=W)>0&&e.lineTo(o+Ju(H-$,0),s+W),($-=H)>0&&e.lineTo(o,s+Ju(W-$,0));break e}y+=K}e.rect(o,s,H,W);break;case Hu.Z:if(f){var K;if(y+(K=l[v++])>p){T=(p-y)/K;e.lineTo(a*(1-T)+n*T,r*(1-T)+i*T);break e}y+=K}e.closePath(),a=n,r=i}}},e.prototype.clone=function(){var t=new e,n=this.data;return t.data=n.slice?n.slice():Array.prototype.slice.call(n),t._len=this._len,t},e.CMD=Hu,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function cm(e,t,n,i,a,r,o){if(0===a)return!1;var s=a,l=0;if(o>t+s&&o>i+s||oe+s&&r>n+s||rt+d&&c>i+d&&c>r+d&&c>s+d||ce+d&&p>n+d&&p>a+d&&p>o+d||pt+p&&l>i+p&&l>r+p||le+p&&s>n+p&&s>a+p||sn||c+pa&&(a+=gm);var u=Math.atan2(l,s);return u<0&&(u+=gm),u>=i&&u<=a||u+gm>=i&&u+gm<=a}function ym(e,t,n,i,a,r){if(r>t&&r>i||ra?s:0}var vm=pm.CMD,xm=2*Math.PI;var bm=[-1,-1,-1],wm=[-1,-1];function Sm(e,t,n,i,a,r,o,s,l,p){if(p>t&&p>i&&p>r&&p>s||p1&&(c=void 0,c=wm[0],wm[0]=wm[1],wm[1]=c),h=_l(t,i,r,s,wm[0]),m>1&&(g=_l(t,i,r,s,wm[1]))),2===m?yt&&s>i&&s>r||s=0&&c<=1&&(a[l++]=c);else{var p=o*o-4*r*s;if(Sl(p))(c=-o/(2*r))>=0&&c<=1&&(a[l++]=c);else if(p>0){var c,d=hl(p),u=(-o-d)/(2*r);(c=(-o+d)/(2*r))>=0&&c<=1&&(a[l++]=c),u>=0&&u<=1&&(a[l++]=u)}}return l}(t,i,r,s,bm);if(0===l)return 0;var p=Ol(t,i,r);if(p>=0&&p<=1){for(var c=0,d=Dl(t,i,r,p),u=0;un||s<-n)return 0;var l=Math.sqrt(n*n-s*s);bm[0]=-l,bm[1]=l;var p=Math.abs(i-a);if(p<1e-4)return 0;if(p>=xm-1e-4){i=0,a=xm;var c=r?1:-1;return o>=bm[0]+e&&o<=bm[1]+e?c:0}if(i>a){var d=i;i=a,a=d}i<0&&(i+=xm,a+=xm);for(var u=0,m=0;m<2;m++){var h=bm[m];if(h+e>o){var g=Math.atan2(s,h);c=r?1:-1;g<0&&(g=xm+g),(g>=i&&g<=a||g+xm>=i&&g+xm<=a)&&(g>Math.PI/2&&g<1.5*Math.PI&&(c=-c),u+=c)}}return u}function Tm(e,t,n,i,a){for(var r,o,s,l,p=e.data,c=e.len(),d=0,u=0,m=0,h=0,g=0,f=0;f1&&(n||(d+=ym(u,m,h,g,i,a))),v&&(h=u=p[f],g=m=p[f+1]),y){case vm.M:u=h=p[f++],m=g=p[f++];break;case vm.L:if(n){if(cm(u,m,p[f],p[f+1],t,i,a))return!0}else d+=ym(u,m,p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case vm.C:if(n){if(dm(u,m,p[f++],p[f++],p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=Sm(u,m,p[f++],p[f++],p[f++],p[f++],p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case vm.Q:if(n){if(um(u,m,p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=Cm(u,m,p[f++],p[f++],p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case vm.A:var x=p[f++],b=p[f++],w=p[f++],S=p[f++],C=p[f++],_=p[f++];f+=1;var T=!!(1-p[f++]);r=Math.cos(C)*w+x,o=Math.sin(C)*S+b,v?(h=r,g=o):d+=ym(u,m,r,o,i,a);var E=(i-x)*S/w+x;if(n){if(fm(x,b,S,C,C+_,T,t,E,a))return!0}else d+=_m(x,b,S,C,C+_,T,E,a);u=Math.cos(C+_)*w+x,m=Math.sin(C+_)*S+b;break;case vm.R:if(h=u=p[f++],g=m=p[f++],r=h+p[f++],o=g+p[f++],n){if(cm(h,g,r,g,t,i,a)||cm(r,g,r,o,t,i,a)||cm(r,o,h,o,t,i,a)||cm(h,o,h,g,t,i,a))return!0}else d+=ym(r,g,r,o,i,a),d+=ym(h,o,h,g,i,a);break;case vm.Z:if(n){if(cm(u,m,h,g,t,i,a))return!0}else d+=ym(u,m,h,g,i,a);u=h,m=g}}return n||(s=m,l=g,Math.abs(s-l)<1e-4)||(d+=ym(u,m,h,g,i,a)||0),0!==d}var Em=jr({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Cu),Im={style:jr({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},_u.style)},Mm=wc.concat(["invisible","culling","z","z2","zlevel","parent"]),km=function(e){function t(t){return e.call(this,t)||this}var n;return Qe(t,e),t.prototype.update=function(){var n=this;e.prototype.update.call(this);var i=this.style;if(i.decal){var a=this._decalEl=this._decalEl||new t;a.buildPath===t.prototype.buildPath&&(a.buildPath=function(e){n.buildPath(e,n.shape)}),a.silent=!0;var r=a.style;for(var o in i)r[o]!==i[o]&&(r[o]=i[o]);r.fill=i.fill?i.decal:null,r.decal=null,r.shadowColor=null,i.strokeFirst&&(r.stroke=null);for(var s=0;s.5?dc:t>.2?"#eee":uc}if(e)return uc}return dc},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(ro(t)){var n=this.__zr;if(!(!n||!n.isDarkMode())===pp(e,0)<.4)return t}},t.prototype.buildPath=function(e,t,n){},t.prototype.pathUpdated=function(){this.__dirty&=-5},t.prototype.getUpdatedPathProxy=function(e){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,e),this.path},t.prototype.createPathProxy=function(){this.path=new pm(!1)},t.prototype.hasStroke=function(){var e=this.style,t=e.stroke;return!(null==t||"none"===t||!(e.lineWidth>0))},t.prototype.hasFill=function(){var e=this.style.fill;return null!=e&&"none"!==e},t.prototype.getBoundingRect=function(){var e=this._rect,t=this.style,n=!e;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var a=this.path;(i||4&this.__dirty)&&(a.beginPath(),this.buildPath(a,this.shape,!1),this.pathUpdated()),e=a.getBoundingRect()}if(this._rect=e,this.hasStroke()&&this.path&&this.path.len()>0){var r=this._rectStroke||(this._rectStroke=e.clone());if(this.__dirty||n){r.copy(e);var o=t.strokeNoScale?this.getLineScale():1,s=t.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}o>1e-10&&(r.width+=s/o,r.height+=s/o,r.x-=s/o/2,r.y-=s/o/2)}return r}return e},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),i=this.getBoundingRect(),a=this.style;if(e=n[0],t=n[1],i.contain(e,t)){var r=this.path;if(this.hasStroke()){var o=a.lineWidth,s=a.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),function(e,t,n,i){return Tm(e,t,!0,n,i)}(r,o/s,e,t)))return!0}if(this.hasFill())return function(e,t,n){return Tm(e,0,!1,t,n)}(r,e,t)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(e){return this.animate("shape",e)},t.prototype.updateDuringAnimation=function(e){"style"===e?this.dirtyStyle():"shape"===e?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(t,n){"shape"===t?this.setShape(n):e.prototype.attrKV.call(this,t,n)},t.prototype.setShape=function(e,t){var n=this.shape;return n||(n=this.shape={}),"string"==typeof e?n[e]=t:Ur(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(4&this.__dirty)},t.prototype.createStyle=function(e){return Ao(Em,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=Ur({},this.shape))},t.prototype._applyStateObj=function(t,n,i,a,r,o){e.prototype._applyStateObj.call(this,t,n,i,a,r,o);var s,l=!(n&&a);if(n&&n.shape?r?a?s=n.shape:(s=Ur({},i.shape),Ur(s,n.shape)):(s=Ur({},a?this.shape:i.shape),Ur(s,n.shape)):l&&(s=i.shape),s)if(r){this.shape=Ur({},this.shape);for(var p={},c=eo(s),d=0;d0},t.prototype.hasFill=function(){var e=this.style.fill;return null!=e&&"none"!==e},t.prototype.createStyle=function(e){return Ao(Pm,e)},t.prototype.setBoundingRect=function(e){this._rect=e},t.prototype.getBoundingRect=function(){var e=this.style;if(!this._rect){var t=e.text;null!=t?t+="":t="";var n=Ec(t,e.font,e.textAlign,e.textBaseline);if(n.x+=e.x||0,n.y+=e.y||0,this.hasStroke()){var i=e.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},t.initDefaultProps=void(t.prototype.dirtyRectTolerance=10),t}(Iu);Dm.prototype.type="tspan";var Am=jr({x:0,y:0},Cu),Om={style:jr({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},_u.style)};var Rm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.createStyle=function(e){return Ao(Am,e)},t.prototype._getSize=function(e){var t=this.style,n=t[e];if(null!=n)return n;var i,a=(i=t.image)&&"string"!=typeof i&&i.width&&i.height?t.image:this.__image;if(!a)return 0;var r="width"===e?"height":"width",o=t[r];return null==o?a[e]:a[e]/a[r]*o},t.prototype.getWidth=function(){return this._getSize("width")},t.prototype.getHeight=function(){return this._getSize("height")},t.prototype.getAnimationStyleProps=function(){return Om},t.prototype.getBoundingRect=function(){var e=this.style;return this._rect||(this._rect=new js(e.x||0,e.y||0,this.getWidth(),this.getHeight())),this._rect},t}(Iu);Rm.prototype.type="image";var Bm=Math.round;function Fm(e,t,n){if(t){var i=t.x1,a=t.x2,r=t.y1,o=t.y2;e.x1=i,e.x2=a,e.y1=r,e.y2=o;var s=n&&n.lineWidth;return s?(Bm(2*i)===Bm(2*a)&&(e.x1=e.x2=Lm(i,s,!0)),Bm(2*r)===Bm(2*o)&&(e.y1=e.y2=Lm(r,s,!0)),e):e}}function Nm(e,t,n){if(t){var i=t.x,a=t.y,r=t.width,o=t.height;e.x=i,e.y=a,e.width=r,e.height=o;var s=n&&n.lineWidth;return s?(e.x=Lm(i,s,!0),e.y=Lm(a,s,!0),e.width=Math.max(Lm(i+r,s,!1)-e.x,0===r?0:1),e.height=Math.max(Lm(a+o,s,!1)-e.y,0===o?0:1),e):e}}function Lm(e,t,n){if(!t)return e;var i=Bm(2*e);return(i+Bm(t))%2==0?i/2:(i+(n?1:-1))/2}var Vm=function(){this.x=0,this.y=0,this.width=0,this.height=0},qm={},Gm=function(e){function t(t){return e.call(this,t)||this}return Qe(t,e),t.prototype.getDefaultShape=function(){return new Vm},t.prototype.buildPath=function(e,t){var n,i,a,r;if(this.subPixelOptimize){var o=Nm(qm,t,this.style);n=o.x,i=o.y,a=o.width,r=o.height,o.r=t.r,t=o}else n=t.x,i=t.y,a=t.width,r=t.height;t.r?function(e,t){var n,i,a,r,o,s=t.x,l=t.y,p=t.width,c=t.height,d=t.r;p<0&&(s+=p,p=-p),c<0&&(l+=c,c=-c),"number"==typeof d?n=i=a=r=d:d instanceof Array?1===d.length?n=i=a=r=d[0]:2===d.length?(n=a=d[0],i=r=d[1]):3===d.length?(n=d[0],i=r=d[1],a=d[2]):(n=d[0],i=d[1],a=d[2],r=d[3]):n=i=a=r=0,n+i>p&&(n*=p/(o=n+i),i*=p/o),a+r>p&&(a*=p/(o=a+r),r*=p/o),i+a>c&&(i*=c/(o=i+a),a*=c/o),n+r>c&&(n*=c/(o=n+r),r*=c/o),e.moveTo(s+n,l),e.lineTo(s+p-i,l),0!==i&&e.arc(s+p-i,l+i,i,-Math.PI/2,0),e.lineTo(s+p,l+c-a),0!==a&&e.arc(s+p-a,l+c-a,a,0,Math.PI/2),e.lineTo(s+r,l+c),0!==r&&e.arc(s+r,l+c-r,r,Math.PI/2,Math.PI),e.lineTo(s,l+n),0!==n&&e.arc(s+n,l+n,n,Math.PI,1.5*Math.PI)}(e,t):e.rect(n,i,a,r)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(km);Gm.prototype.type="rect";var zm={fill:"#000"},Um={style:jr({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},_u.style)},jm=function(e){function t(t){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=zm,n.attr(t),n}return Qe(t,e),t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;tm&&c){var h=Math.floor(m/l);n=n.slice(0,h)}if(e&&o&&null!=d)for(var g=uu(d,r,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),f=0;f0,T=null!=e.width&&("truncate"===e.overflow||"break"===e.overflow||"breakAll"===e.overflow),E=i.calculatedLineHeight,I=0;Il&&vu(n,e.substring(l,p),t,s),vu(n,i[2],t,s,i[1]),l=cu.lastIndex}lr){w>0?(v.tokens=v.tokens.slice(0,w),f(v,b,x),n.lines=n.lines.slice(0,y+1)):n.lines=n.lines.slice(0,y);break e}var I=S.width,M=null==I||"auto"===I;if("string"==typeof I&&"%"===I.charAt(I.length-1))A.percentWidth=I,c.push(A),A.contentWidth=_c(A.text,T);else{if(M){var k=S.backgroundColor,P=k&&k.image;P&&pu(P=ou(P))&&(A.width=Math.max(A.width,P.width*E/P.height))}var D=h&&null!=a?a-b:null;null!=D&&D=0&&"right"===(I=x[E]).align;)this._placeToken(I,e,w,h,T,"right",f),S-=I.width,T-=I.width,E--;for(_+=(n-(_-m)-(g-T)-S)/2;C<=E;)I=x[C],this._placeToken(I,e,w,h,_+I.width/2,"center",f),_+=I.width,C++;h+=w}},t.prototype._placeToken=function(e,t,n,i,a,r,o){var s=t.rich[e.styleName]||{};s.text=e.text;var l=e.verticalAlign,p=i+n/2;"top"===l?p=i+e.height/2:"bottom"===l&&(p=i+n-e.height/2),!e.isLineHolder&&nh(s)&&this._renderBackground(s,t,"right"===r?a-e.width:"center"===r?a-e.width/2:a,p-e.height/2,e.width,e.height);var c=!!s.backgroundColor,d=e.textPadding;d&&(a=eh(a,r,d),p-=e.height/2-d[0]-e.innerHeight/2);var u=this._getOrCreateChild(Dm),m=u.createStyle();u.useStyle(m);var h=this._defaultStyle,g=!1,f=0,y=Jm("fill"in s?s.fill:"fill"in t?t.fill:(g=!0,h.fill)),v=Qm("stroke"in s?s.stroke:"stroke"in t?t.stroke:c||o||h.autoStroke&&!g?null:(f=2,h.stroke)),x=s.textShadowBlur>0||t.textShadowBlur>0;m.text=e.text,m.x=a,m.y=p,x&&(m.shadowBlur=s.textShadowBlur||t.textShadowBlur||0,m.shadowColor=s.textShadowColor||t.textShadowColor||"transparent",m.shadowOffsetX=s.textShadowOffsetX||t.textShadowOffsetX||0,m.shadowOffsetY=s.textShadowOffsetY||t.textShadowOffsetY||0),m.textAlign=r,m.textBaseline="middle",m.font=e.font||wr,m.opacity=xo(s.opacity,t.opacity,1),Ym(m,s),v&&(m.lineWidth=xo(s.lineWidth,t.lineWidth,f),m.lineDash=vo(s.lineDash,t.lineDash),m.lineDashOffset=t.lineDashOffset||0,m.stroke=v),y&&(m.fill=y);var b=e.contentWidth,w=e.contentHeight;u.setBoundingRect(new js(Ic(m.x,b,m.textAlign),Mc(m.y,w,m.textBaseline),b,w))},t.prototype._renderBackground=function(e,t,n,i,a,r){var o,s,l,p=e.backgroundColor,c=e.borderWidth,d=e.borderColor,u=p&&p.image,m=p&&!u,h=e.borderRadius,g=this;if(m||e.lineHeight||c&&d){(o=this._getOrCreateChild(Gm)).useStyle(o.createStyle()),o.style.fill=null;var f=o.shape;f.x=n,f.y=i,f.width=a,f.height=r,f.r=h,o.dirtyShape()}if(m)(l=o.style).fill=p||null,l.fillOpacity=vo(e.fillOpacity,1);else if(u){(s=this._getOrCreateChild(Rm)).onload=function(){g.dirtyStyle()};var y=s.style;y.image=p.image,y.x=n,y.y=i,y.width=a,y.height=r}c&&d&&((l=o.style).lineWidth=c,l.stroke=d,l.strokeOpacity=vo(e.strokeOpacity,1),l.lineDash=e.borderDash,l.lineDashOffset=e.borderDashOffset||0,o.strokeContainThreshold=0,o.hasFill()&&o.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var v=(o||s).style;v.shadowBlur=e.shadowBlur||0,v.shadowColor=e.shadowColor||"transparent",v.shadowOffsetX=e.shadowOffsetX||0,v.shadowOffsetY=e.shadowOffsetY||0,v.opacity=xo(e.opacity,t.opacity,1)},t.makeFont=function(e){var t="";return Xm(e)&&(t=[e.fontStyle,e.fontWeight,Km(e.fontSize),e.fontFamily||"sans-serif"].join(" ")),t&&Co(t)||e.textFont||e.font},t}(Iu),Hm={left:!0,right:1,center:1},Wm={top:1,bottom:1,middle:1},$m=["fontStyle","fontWeight","fontSize","fontFamily"];function Km(e){return"string"!=typeof e||-1===e.indexOf("px")&&-1===e.indexOf("rem")&&-1===e.indexOf("em")?isNaN(+e)?"12px":e+"px":e}function Ym(e,t){for(var n=0;n<$m.length;n++){var i=$m[n],a=t[i];null!=a&&(e[i]=a)}}function Xm(e){return null!=e.fontSize||e.fontFamily||e.fontWeight}function Zm(e){if(e){e.font=jm.makeFont(e);var t=e.align;"middle"===t&&(t="center"),e.align=null==t||Hm[t]?t:"left";var n=e.verticalAlign;"center"===n&&(n="middle"),e.verticalAlign=null==n||Wm[n]?n:"top",e.padding&&(e.padding=wo(e.padding))}}function Qm(e,t){return null==e||t<=0||"transparent"===e||"none"===e?null:e.image||e.colorStops?"#000":e}function Jm(e){return null==e||"none"===e?null:e.image||e.colorStops?"#000":e}function eh(e,t,n){return"right"===t?e-n[1]:"center"===t?e+n[3]/2-n[1]/2:e+n[3]}function th(e){var t=e.text;return null!=t&&(t+=""),t}function nh(e){return!!(e.backgroundColor||e.lineHeight||e.borderWidth&&e.borderColor)}var ih=Nd(),ah=function(e,t,n,i){if(i){var a=ih(i);a.dataIndex=n,a.dataType=t,a.seriesIndex=e,a.ssrType="chart","group"===i.type&&i.traverse((function(i){var a=ih(i);a.seriesIndex=e,a.dataIndex=n,a.dataType=t,a.ssrType="chart"}))}},rh=1,oh={},sh=Nd(),lh=Nd(),ph=["emphasis","blur","select"],ch=["normal","emphasis","blur","select"],dh=10,uh="highlight",mh="downplay",hh="select",gh="unselect",fh="toggleSelect";function yh(e){return null!=e&&"none"!==e}function vh(e,t,n){e.onHoverStateChange&&(e.hoverState||0)!==n&&e.onHoverStateChange(t),e.hoverState=n}function xh(e){vh(e,"emphasis",2)}function bh(e){2===e.hoverState&&vh(e,"normal",0)}function wh(e){vh(e,"blur",1)}function Sh(e){1===e.hoverState&&vh(e,"normal",0)}function Ch(e){e.selected=!0}function _h(e){e.selected=!1}function Th(e,t,n){t(e,n)}function Eh(e,t,n){Th(e,t,n),e.isGroup&&e.traverse((function(e){Th(e,t,n)}))}function Ih(e,t){switch(t){case"emphasis":e.hoverState=2;break;case"normal":e.hoverState=0;break;case"blur":e.hoverState=1;break;case"select":e.selected=!0}}function Mh(e,t){var n=this.states[e];if(this.style){if("emphasis"===e)return function(e,t,n,i){var a=n&&Hr(n,"select")>=0,r=!1;if(e instanceof km){var o=sh(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(yh(s)||yh(l)){var p=(i=i||{}).style||{};"inherit"===p.fill?(r=!0,i=Ur({},i),(p=Ur({},p)).fill=s):!yh(p.fill)&&yh(s)?(r=!0,i=Ur({},i),(p=Ur({},p)).fill=dp(s)):!yh(p.stroke)&&yh(l)&&(r||(i=Ur({},i),p=Ur({},p)),p.stroke=dp(l)),i.style=p}}if(i&&null==i.z2){r||(i=Ur({},i));var c=e.z2EmphasisLift;i.z2=e.z2+(null!=c?c:dh)}return i}(this,0,t,n);if("blur"===e)return function(e,t,n){var i=Hr(e.currentStates,t)>=0,a=e.style.opacity,r=i?null:function(e,t,n,i){for(var a=e.style,r={},o=0;o0){var r={dataIndex:a,seriesIndex:e.seriesIndex};null!=i&&(r.dataType=i),t.push(r)}}))})),t}function Hh(e,t,n){Zh(e,!0),Eh(e,kh),$h(e,t,n)}function Wh(e,t,n,i){i?function(e){Zh(e,!1)}(e):Hh(e,t,n)}function $h(e,t,n){var i=ih(e);null!=t?(i.focus=t,i.blurScope=n):i.focus&&(i.focus=null)}var Kh=["emphasis","blur","select"],Yh={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Xh(e,t,n,i){n=n||"itemStyle";for(var a=0;a1&&(o*=og(h),s*=og(h));var g=(a===r?-1:1)*og((o*o*(s*s)-o*o*(m*m)-s*s*(u*u))/(o*o*(m*m)+s*s*(u*u)))||0,f=g*o*m/s,y=g*-s*u/o,v=(e+n)/2+lg(d)*f-sg(d)*y,x=(t+i)/2+sg(d)*f+lg(d)*y,b=ug([1,0],[(u-f)/o,(m-y)/s]),w=[(u-f)/o,(m-y)/s],S=[(-1*u-f)/o,(-1*m-y)/s],C=ug(w,S);if(dg(w,S)<=-1&&(C=pg),dg(w,S)>=1&&(C=0),C<0){var _=Math.round(C/pg*1e6)/1e6;C=2*pg+_%2*pg}c.addData(p,v,x,o,s,b,C,d,r)}var hg=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,gg=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var fg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.applyTransform=function(e){},t}(km);function yg(e){return null!=e.setData}function vg(e,t){var n=function(e){var t=new pm;if(!e)return t;var n,i=0,a=0,r=i,o=a,s=pm.CMD,l=e.match(hg);if(!l)return t;for(var p=0;pP*P+D*D&&(_=E,T=I),{cx:_,cy:T,x0:-c,y0:-d,x1:_*(a/w-1),y1:T*(a/w-1)}}function Fg(e,t){var n,i=Ag(t.r,0),a=Ag(t.r0||0,0),r=i>0;if(r||a>0){if(r||(i=a,a=0),a>i){var o=i;i=a,a=o}var s=t.startAngle,l=t.endAngle;if(!isNaN(s)&&!isNaN(l)){var p=t.cx,c=t.cy,d=!!t.clockwise,u=Pg(l-s),m=u>Tg&&u%Tg;if(m>Rg&&(u=m),i>Rg)if(u>Tg-Rg)e.moveTo(p+i*Ig(s),c+i*Eg(s)),e.arc(p,c,i,s,l,!d),a>Rg&&(e.moveTo(p+a*Ig(l),c+a*Eg(l)),e.arc(p,c,a,l,s,d));else{var h=void 0,g=void 0,f=void 0,y=void 0,v=void 0,x=void 0,b=void 0,w=void 0,S=void 0,C=void 0,_=void 0,T=void 0,E=void 0,I=void 0,M=void 0,k=void 0,P=i*Ig(s),D=i*Eg(s),A=a*Ig(l),O=a*Eg(l),R=u>Rg;if(R){var B=t.cornerRadius;B&&(n=function(e){var t;if(io(e)){var n=e.length;if(!n)return e;t=1===n?[e[0],e[0],0,0]:2===n?[e[0],e[0],e[1],e[1]]:3===n?e.concat(e[2]):e}else t=[e,e,e,e];return t}(B),h=n[0],g=n[1],f=n[2],y=n[3]);var F=Pg(i-a)/2;if(v=Og(F,f),x=Og(F,y),b=Og(F,h),w=Og(F,g),_=S=Ag(v,x),T=C=Ag(b,w),(S>Rg||C>Rg)&&(E=i*Ig(l),I=i*Eg(l),M=a*Ig(s),k=a*Eg(s),u<_g)){var N=function(e,t,n,i,a,r,o,s){var l=n-e,p=i-t,c=o-a,d=s-r,u=d*l-c*p;if(!(u*uRg){var j=Og(f,_),H=Og(y,_),W=Bg(M,k,P,D,i,j,d),$=Bg(E,I,A,O,i,H,d);e.moveTo(p+W.cx+W.x0,c+W.cy+W.y0),_0&&e.arc(p+W.cx,c+W.cy,j,kg(W.y0,W.x0),kg(W.y1,W.x1),!d),e.arc(p,c,i,kg(W.cy+W.y1,W.cx+W.x1),kg($.cy+$.y1,$.cx+$.x1),!d),H>0&&e.arc(p+$.cx,c+$.cy,H,kg($.y1,$.x1),kg($.y0,$.x0),!d))}else e.moveTo(p+P,c+D),e.arc(p,c,i,s,l,!d);else e.moveTo(p+P,c+D);if(a>Rg&&R)if(T>Rg){j=Og(h,T),W=Bg(A,O,E,I,a,-(H=Og(g,T)),d),$=Bg(P,D,M,k,a,-j,d);e.lineTo(p+W.cx+W.x0,c+W.cy+W.y0),T0&&e.arc(p+W.cx,c+W.cy,H,kg(W.y0,W.x0),kg(W.y1,W.x1),!d),e.arc(p,c,a,kg(W.cy+W.y1,W.cx+W.x1),kg($.cy+$.y1,$.cx+$.x1),d),j>0&&e.arc(p+$.cx,c+$.cy,j,kg($.y1,$.x1),kg($.y0,$.x0),!d))}else e.lineTo(p+A,c+O),e.arc(p,c,a,l,s,d);else e.lineTo(p+A,c+O)}else e.moveTo(p,c);e.closePath()}}}var Ng=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},Lg=function(e){function t(t){return e.call(this,t)||this}return Qe(t,e),t.prototype.getDefaultShape=function(){return new Ng},t.prototype.buildPath=function(e,t){Fg(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(km);Lg.prototype.type="sector";var Vg=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},qg=function(e){function t(t){return e.call(this,t)||this}return Qe(t,e),t.prototype.getDefaultShape=function(){return new Vg},t.prototype.buildPath=function(e,t){var n=t.cx,i=t.cy,a=2*Math.PI;e.moveTo(n+t.r,i),e.arc(n,i,t.r,0,a,!1),e.moveTo(n+t.r0,i),e.arc(n,i,t.r0,0,a,!0)},t}(km);function Gg(e,t,n){var i=t.smooth,a=t.points;if(a&&a.length>=2){if(i){var r=function(e,t,n,i){var a,r,o,s,l=[],p=[],c=[],d=[];if(i){o=[1/0,1/0],s=[-1/0,-1/0];for(var u=0,m=e.length;usf[1]){if(o=!1,a)return o;var p=Math.abs(sf[0]-of[1]),c=Math.abs(of[0]-sf[1]);Math.min(p,c)>i.len()&&(p0){var d={duration:c.duration,delay:c.delay||0,easing:c.easing,done:r,force:!!r||!!o,setToFinal:!p,scope:e,during:o};l?t.animateFrom(n,d):t.animateTo(n,d)}else t.stopAnimation(),!l&&t.attr(n),o&&o(1),r&&r()}function ff(e,t,n,i,a,r){gf("update",e,t,n,i,a,r)}function yf(e,t,n,i,a,r){gf("enter",e,t,n,i,a,r)}function vf(e){if(!e.__zr)return!0;for(var t=0;tMath.abs(r[1])?r[0]>0?"right":"left":r[1]>0?"bottom":"top"}function Gf(e){return!e.isGroup}function zf(e,t,n){if(e&&t){var i,a=(i={},e.traverse((function(e){Gf(e)&&e.anid&&(i[e.anid]=e)})),i);t.traverse((function(e){if(Gf(e)&&e.anid){var t=a[e.anid];if(t){var i=r(e);e.attr(r(t)),ff(e,i,n,ih(e).dataIndex)}}}))}function r(e){var t={x:e.x,y:e.y,rotation:e.rotation};return function(e){return null!=e.shape}(e)&&(t.shape=Ur({},e.shape)),t}}function Uf(e,t){return Xr(e,(function(e){var n=e[0];n=Cf(n,t.x),n=_f(n,t.x+t.width);var i=e[1];return i=Cf(i,t.y),[n,i=_f(i,t.y+t.height)]}))}function jf(e,t){var n=Cf(e.x,t.x),i=_f(e.x+e.width,t.x+t.width),a=Cf(e.y,t.y),r=_f(e.y+e.height,t.y+t.height);if(i>=n&&r>=a)return{x:n,y:a,width:i-n,height:r-a}}function Hf(e,t,n){var i=Ur({rectHover:!0},t),a=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},e)return 0===e.indexOf("image://")?(a.image=e.slice(8),jr(a,n),new Rm(i)):Df(e.replace("path://",""),i,n,"center")}function Wf(e,t,n,i,a){for(var r=0,o=a[a.length-1];r=-1e-6)return!1;var h=e-a,g=t-r,f=Kf(h,g,p,c)/m;if(f<0||f>1)return!1;var y=Kf(h,g,d,u)/m;return!(y<0||y>1)}function Kf(e,t,n,i){return e*i-n*t}function Yf(e){var t=e.itemTooltipOption,n=e.componentModel,i=e.itemName,a=ro(t)?{formatter:t}:t,r=n.mainType,o=n.componentIndex,s={componentType:r,name:i,$vars:["name"]};s[r+"Index"]=o;var l=e.formatterParamsExtra;l&&Yr(eo(l),(function(e){Ro(s,e)||(s[e]=l[e],s.$vars.push(e))}));var p=ih(e.el);p.componentMainType=r,p.componentIndex=o,p.tooltipConfig={name:i,option:jr({content:i,formatterParams:s},a)}}function Xf(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function Zf(e,t){if(e)if(io(e))for(var n=0;n-1?Py:Ay;function Fy(e,t){e=e.toUpperCase(),Ry[e]=new Ey(t),Oy[e]=t}function Ny(e){return Ry[e]}Fy(Dy,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),Fy(Py,{time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}});var Ly=1e3,Vy=6e4,qy=36e5,Gy=864e5,zy=31536e6,Uy={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},jy="{yyyy}-{MM}-{dd}",Hy={year:"{yyyy}",month:"{yyyy}-{MM}",day:jy,hour:jy+" "+Uy.hour,minute:jy+" "+Uy.minute,second:jy+" "+Uy.second,millisecond:Uy.none},Wy=["year","month","day","hour","minute","second","millisecond"],$y=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Ky(e,t){return"0000".substr(0,t-(e+="").length)+e}function Yy(e){switch(e){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return e}}function Xy(e){return e===Yy(e)}function Zy(e,t,n,i){var a=cd(e),r=a[ev(n)](),o=a[tv(n)]()+1,s=Math.floor((o-1)/3)+1,l=a[nv(n)](),p=a["get"+(n?"UTC":"")+"Day"](),c=a[iv(n)](),d=(c-1)%12+1,u=a[av(n)](),m=a[rv(n)](),h=a[ov(n)](),g=(i instanceof Ey?i:Ny(i||By)||Ry[Ay]).getModel("time"),f=g.get("month"),y=g.get("monthAbbr"),v=g.get("dayOfWeek"),x=g.get("dayOfWeekAbbr");return(t||"").replace(/{yyyy}/g,r+"").replace(/{yy}/g,Ky(r%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,f[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,Ky(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Ky(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,v[p]).replace(/{ee}/g,x[p]).replace(/{e}/g,p+"").replace(/{HH}/g,Ky(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,Ky(d+"",2)).replace(/{h}/g,d+"").replace(/{mm}/g,Ky(u,2)).replace(/{m}/g,u+"").replace(/{ss}/g,Ky(m,2)).replace(/{s}/g,m+"").replace(/{SSS}/g,Ky(h,3)).replace(/{S}/g,h+"")}function Qy(e,t){var n=cd(e),i=n[tv(t)]()+1,a=n[nv(t)](),r=n[iv(t)](),o=n[av(t)](),s=n[rv(t)](),l=0===n[ov(t)](),p=l&&0===s,c=p&&0===o,d=c&&0===r,u=d&&1===a;return u&&1===i?"year":u?"month":d?"day":c?"hour":p?"minute":l?"second":"millisecond"}function Jy(e,t,n){var i=so(e)?cd(e):e;switch(t=t||Qy(e,n)){case"year":return i[ev(n)]();case"half-year":return i[tv(n)]()>=6?1:0;case"quarter":return Math.floor((i[tv(n)]()+1)/4);case"month":return i[tv(n)]();case"day":return i[nv(n)]();case"half-day":return i[iv(n)]()/24;case"hour":return i[iv(n)]();case"minute":return i[av(n)]();case"second":return i[rv(n)]();case"millisecond":return i[ov(n)]()}}function ev(e){return e?"getUTCFullYear":"getFullYear"}function tv(e){return e?"getUTCMonth":"getMonth"}function nv(e){return e?"getUTCDate":"getDate"}function iv(e){return e?"getUTCHours":"getHours"}function av(e){return e?"getUTCMinutes":"getMinutes"}function rv(e){return e?"getUTCSeconds":"getSeconds"}function ov(e){return e?"getUTCMilliseconds":"getMilliseconds"}function sv(e){return e?"setUTCFullYear":"setFullYear"}function lv(e){return e?"setUTCMonth":"setMonth"}function pv(e){return e?"setUTCDate":"setDate"}function cv(e){return e?"setUTCHours":"setHours"}function dv(e){return e?"setUTCMinutes":"setMinutes"}function uv(e){return e?"setUTCSeconds":"setSeconds"}function mv(e){return e?"setUTCMilliseconds":"setMilliseconds"}function hv(e){if(!fd(e))return ro(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function gv(e,t){return e=(e||"").toLowerCase().replace(/-(.)/g,(function(e,t){return t.toUpperCase()})),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var fv=wo;function yv(e,t,n){function i(e){return e&&Co(e)?e:"-"}function a(e){return!(null==e||isNaN(e)||!isFinite(e))}var r="time"===t,o=e instanceof Date;if(r||o){var s=r?cd(e):e;if(!isNaN(+s))return Zy(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(o)return"-"}if("ordinal"===t)return oo(e)?i(e):so(e)&&a(e)?e+"":"-";var l=gd(e);return a(l)?hv(l):oo(e)?i(e):"boolean"==typeof e?e+"":"-"}var vv=["a","b","c","d","e","f","g"],xv=function(e,t){return"{"+e+(null==t?"":t)+"}"};function bv(e,t,n){io(t)||(t=[t]);var i=t.length;if(!i)return"";for(var a=t[0].$vars||[],r=0;r':'':{renderMode:r,content:"{"+(n.markerId||"markerX")+"|} ",style:"subItem"===a?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}:""}function Sv(e,t){return t=t||"transparent",ro(e)?e:lo(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function Cv(e,t){if("_blank"===t||"blank"===t){var n=window.open();n.opener=null,n.location.href=e}else window.open(e,t)}var _v=Yr,Tv=["left","right","top","bottom","width","height"],Ev=[["width","left","right"],["height","top","bottom"]];function Iv(e,t,n,i,a){var r=0,o=0;null==i&&(i=1/0),null==a&&(a=1/0);var s=0;t.eachChild((function(l,p){var c,d,u=l.getBoundingRect(),m=t.childAt(p+1),h=m&&m.getBoundingRect();if("horizontal"===e){var g=u.width+(h?-h.x+u.x:0);(c=r+g)>i||l.newline?(r=0,c=g,o+=s+n,s=u.height):s=Math.max(s,u.height)}else{var f=u.height+(h?-h.y+u.y:0);(d=o+f)>a||l.newline?(r+=s+n,o=0,d=f,s=u.width):s=Math.max(s,u.width)}l.newline||(l.x=r,l.y=o,l.markRedraw(),"horizontal"===e?r=c+n:o=d+n)}))}var Mv=Iv;no(Iv,"vertical"),no(Iv,"horizontal");function kv(e,t,n){n=fv(n||0);var i=t.width,a=t.height,r=Jc(e.left,i),o=Jc(e.top,a),s=Jc(e.right,i),l=Jc(e.bottom,a),p=Jc(e.width,i),c=Jc(e.height,a),d=n[2]+n[0],u=n[1]+n[3],m=e.aspect;switch(isNaN(p)&&(p=i-s-u-r),isNaN(c)&&(c=a-l-d-o),null!=m&&(isNaN(p)&&isNaN(c)&&(m>i/a?p=.8*i:c=.8*a),isNaN(p)&&(p=m*c),isNaN(c)&&(c=p/m)),isNaN(r)&&(r=i-s-p-u),isNaN(o)&&(o=a-l-c-d),e.left||e.right){case"center":r=i/2-p/2-n[3];break;case"right":r=i-p-u}switch(e.top||e.bottom){case"middle":case"center":o=a/2-c/2-n[0];break;case"bottom":o=a-c-d}r=r||0,o=o||0,isNaN(p)&&(p=i-u-r-(s||0)),isNaN(c)&&(c=a-d-o-(l||0));var h=new js(r+n[3],o+n[0],p,c);return h.margin=n,h}function Pv(e,t,n,i,a,r){var o,s=!a||!a.hv||a.hv[0],l=!a||!a.hv||a.hv[1],p=a&&a.boundingMode||"all";if((r=r||e).x=e.x,r.y=e.y,!s&&!l)return!1;if("raw"===p)o="group"===e.type?new js(0,0,+t.width||0,+t.height||0):e.getBoundingRect();else if(o=e.getBoundingRect(),e.needLocalTransform()){var c=e.getLocalTransform();(o=o.clone()).applyTransform(c)}var d=kv(jr({width:o.width,height:o.height},t),n,i),u=s?d.x-o.x:0,m=l?d.y-o.y:0;return"raw"===p?(r.x=u,r.y=m):(r.x+=u,r.y+=m),r===e&&e.markRedraw(),!0}function Dv(e){var t=e.layoutMode||e.constructor.layoutMode;return lo(t)?t:t?{type:t}:null}function Av(e,t,n){var i=n&&n.ignoreSize;!io(i)&&(i=[i,i]);var a=o(Ev[0],0),r=o(Ev[1],1);function o(n,a){var r={},o=0,p={},c=0;if(_v(n,(function(t){p[t]=e[t]})),_v(n,(function(e){s(t,e)&&(r[e]=p[e]=t[e]),l(r,e)&&o++,l(p,e)&&c++})),i[a])return l(t,n[1])?p[n[2]]=null:l(t,n[2])&&(p[n[1]]=null),p;if(2!==c&&o){if(o>=2)return r;for(var d=0;d=0;o--)r=Gr(r,n[o],!0);t.defaultOption=r}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+"Index",i=e+"Id";return Ud(this.ecModel,e,{index:this.get(n,!0),id:this.get(i,!0)},t)},t.prototype.getBoxLayoutParams=function(){var e=this;return{left:e.get("left"),top:e.get("top"),right:e.get("right"),bottom:e.get("bottom"),width:e.get("width"),height:e.get("height")}},t.prototype.getZLevelKey=function(){return""},t.prototype.setZLevel=function(e){this.option.zlevel=e},t.protoInitialize=function(){var e=t.prototype;e.type="component",e.id="",e.name="",e.mainType="",e.subType="",e.componentIndex=0}(),t}(Ey);Zd(Fv,Ey),tu(Fv),function(e){var t={};e.registerSubTypeDefaulter=function(e,n){var i=Yd(e);t[i.main]=n},e.determineSubType=function(n,i){var a=i.type;if(!a){var r=Yd(n).main;e.hasSubTypes(n)&&t[r]&&(a=t[r](i))}return a}}(Fv),function(e,t){function n(e,t){return e[t]||(e[t]={predecessor:[],successor:[]}),e[t]}e.topologicalTravel=function(e,i,a,r){if(e.length){var o=function(e){var i={},a=[];return Yr(e,(function(r){var o=n(i,r),s=function(e,t){var n=[];return Yr(e,(function(e){Hr(t,e)>=0&&n.push(e)})),n}(o.originalDeps=t(r),e);o.entryCount=s.length,0===o.entryCount&&a.push(r),Yr(s,(function(e){Hr(o.predecessor,e)<0&&o.predecessor.push(e);var t=n(i,e);Hr(t.successor,e)<0&&t.successor.push(r)}))})),{graph:i,noEntryList:a}}(i),s=o.graph,l=o.noEntryList,p={};for(Yr(e,(function(e){p[e]=!0}));l.length;){var c=l.pop(),d=s[c],u=!!p[c];u&&(a.call(r,c,d.originalDeps.slice()),delete p[c]),Yr(d.successor,u?h:m)}Yr(p,(function(){var e="";throw new Error(e)}))}function m(e){s[e].entryCount--,0===s[e].entryCount&&l.push(e)}function h(e){p[e]=!0,m(e)}}}(Fv,(function(e){var t=[];Yr(Fv.getClassesByMainType(e),(function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])})),t=Xr(t,(function(e){return Yd(e).main})),"dataset"!==e&&Hr(t,"dataset")<=0&&t.unshift("dataset");return t}));var Nv="";"undefined"!=typeof navigator&&(Nv=navigator.platform||"");var Lv="rgba(0, 0, 0, 0.2)",Vv={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Lv,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Lv,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Lv,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Lv,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Lv,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Lv,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:Nv.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},qv=Po(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Gv="original",zv="arrayRows",Uv="objectRows",jv="keyedColumns",Hv="typedArray",Wv="unknown",$v="column",Kv="row",Yv=1,Xv=2,Zv=3,Qv=Nd();function Jv(e,t,n){var i={},a=tx(t);if(!a||!e)return i;var r,o,s=[],l=[],p=t.ecModel,c=Qv(p).datasetMap,d=a.uid+"_"+n.seriesLayoutBy;Yr(e=e.slice(),(function(t,n){var a=lo(t)?t:e[n]={name:t};"ordinal"===a.type&&null==r&&(r=n,o=h(a)),i[a.name]=[]}));var u=c.get(d)||c.set(d,{categoryWayDim:o,valueWayDim:0});function m(e,t,n){for(var i=0;it)return e[i];return e[n-1]}(i,o):n;if((c=c||n)&&c.length){var d=c[l];return a&&(p[a]=d),s.paletteIdx=(l+1)%c.length,d}}var mx="\0_ec_inner";var hx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.init=function(e,t,n,i,a,r){i=i||{},this.option=null,this._theme=new Ey(i),this._locale=new Ey(a),this._optionManager=r},t.prototype.setOption=function(e,t,n){var i=yx(t);this._optionManager.setOption(e,n,i),this._resetOption(null,i)},t.prototype.resetOption=function(e,t){return this._resetOption(e,yx(t))},t.prototype._resetOption=function(e,t){var n=!1,i=this._optionManager;if(!e||"recreate"===e){var a=i.mountOption("recreate"===e);0,this.option&&"recreate"!==e?(this.restoreData(),this._mergeOption(a,t)):sx(this,a),n=!0}if("timeline"!==e&&"media"!==e||this.restoreData(),!e||"recreate"===e||"timeline"===e){var r=i.getTimelineOption(this);r&&(n=!0,this._mergeOption(r,t))}if(!e||"recreate"===e||"media"===e){var o=i.getMediaOption(this);o.length&&Yr(o,(function(e){n=!0,this._mergeOption(e,t)}),this)}return n},t.prototype.mergeOption=function(e){this._mergeOption(e,null)},t.prototype._mergeOption=function(e,t){var n=this.option,i=this._componentsMap,a=this._componentsCount,r=[],o=Po(),s=t&&t.replaceMergeMainTypeMap;Qv(this).datasetMap=Po(),Yr(e,(function(e,t){null!=e&&(Fv.hasClass(t)?t&&(r.push(t),o.set(t,!0)):n[t]=null==n[t]?qr(e):Gr(n[t],e,!0))})),s&&s.each((function(e,t){Fv.hasClass(t)&&!o.get(t)&&(r.push(t),o.set(t,!0))})),Fv.topologicalTravel(r,Fv.getAllClassMainTypes(),(function(t){var r=function(e,t,n){var i=ax.get(t);if(!i)return n;var a=i(e);return a?n.concat(a):n}(this,t,Td(e[t])),o=i.get(t),l=o?s&&s.get(t)?"replaceMerge":"normalMerge":"replaceAll",p=Pd(o,r,l);(function(e,t,n){Yr(e,(function(e){var i=e.newOption;lo(i)&&(e.keyInfo.mainType=t,e.keyInfo.subType=function(e,t,n,i){return t.type?t.type:n?n.subType:i.determineSubType(e,t)}(t,i,e.existing,n))}))})(p,t,Fv),n[t]=null,i.set(t,null),a.set(t,0);var c,d=[],u=[],m=0;Yr(p,(function(e,n){var i=e.existing,a=e.newOption;if(a){var r="series"===t,o=Fv.getClass(t,e.keyInfo.subType,!r);if(!o)return;if("tooltip"===t){if(c)return void 0;c=!0}if(i&&i.constructor===o)i.name=e.keyInfo.name,i.mergeOption(a,this),i.optionUpdated(a,!1);else{var s=Ur({componentIndex:n},e.keyInfo);Ur(i=new o(a,this,this,s),s),e.brandNew&&(i.__requireNewView=!0),i.init(a,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(d.push(i.option),u.push(i),m++):(d.push(void 0),u.push(void 0))}),this),n[t]=d,i.set(t,u),a.set(t,m),"series"===t&&rx(this)}),this),this._seriesIndices||rx(this)},t.prototype.getOption=function(){var e=qr(this.option);return Yr(e,(function(t,n){if(Fv.hasClass(n)){for(var i=Td(t),a=i.length,r=!1,o=a-1;o>=0;o--)i[o]&&!Bd(i[o])?r=!0:(i[o]=null,!r&&a--);i.length=a,e[n]=i}})),delete e[mx],e},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var i=n[t||0];if(i)return i;if(null==t)for(var a=0;a=t:"max"===n?e<=t:e===t})(i[o],e,r)||(a=!1)}})),a}var Ex=Yr,Ix=lo,Mx=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function kx(e){var t=e&&e.itemStyle;if(t)for(var n=0,i=Mx.length;n=0;g--){var f=e[g];if(s||(u=f.data.rawIndexOf(f.stackedByDimension,d)),u>=0){var y=f.data.getByRawIndex(f.stackResultDimension,u);if("all"===l||"positive"===l&&y>0||"negative"===l&&y<0||"samesign"===l&&m>=0&&y>0||"samesign"===l&&m<=0&&y<0){m=od(m,y),h=y;break}}}return i[0]=m,i[1]=h,i}))}))}var $x,Kx,Yx,Xx,Zx,Qx=function(e){this.data=e.data||(e.sourceFormat===jv?{}:[]),this.sourceFormat=e.sourceFormat||Wv,this.seriesLayoutBy=e.seriesLayoutBy||$v,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var t=this.dimensionsDefine=e.dimensionsDefine;if(t)for(var n=0;np&&(p=m)}s[0]=l,s[1]=p}},i=function(){return this._data?this._data.length/this._dimSize:0};function a(e){for(var t=0;t=0&&(s=r.interpolatedValue[l])}return null!=s?s+"":""})):void 0},e.prototype.getRawValue=function(e,t){return yb(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function bb(e){var t,n;return lo(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function wb(e){return new Sb(e)}var Sb=function(){function e(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return e.prototype.perform=function(e){var t,n=this._upstream,i=e&&e.skip;if(this._dirty&&n){var a=this.context;a.data=a.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!i&&(t=this._plan(this.context));var r,o=c(this._modBy),s=this._modDataCount||0,l=c(e&&e.modBy),p=e&&e.modDataCount||0;function c(e){return!(e>=1)&&(e=1),e}o===l&&s===p||(t="reset"),(this._dirty||"reset"===t)&&(this._dirty=!1,r=this._doReset(i)),this._modBy=l,this._modDataCount=p;var d=e&&e.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var u=this._dueIndex,m=Math.min(null!=d?this._dueIndex+d:1/0,this._dueEnd);if(!i&&(r||u1&&i>0?s:o}};return r;function o(){return t=e?null:rt},gte:function(e,t){return e>=t}},Mb=function(){function e(e,t){if(!so(t)){var n="";0,wd(n)}this._opFn=Ib[e],this._rvalFloat=gd(t)}return e.prototype.evaluate=function(e){return so(e)?this._opFn(e,this._rvalFloat):this._opFn(gd(e),this._rvalFloat)},e}(),kb=function(){function e(e,t){var n="desc"===e;this._resultLT=n?1:-1,null==t&&(t=n?"min":"max"),this._incomparable="min"===t?-1/0:1/0}return e.prototype.evaluate=function(e,t){var n=so(e)?e:gd(e),i=so(t)?t:gd(t),a=isNaN(n),r=isNaN(i);if(a&&(n=this._incomparable),r&&(i=this._incomparable),a&&r){var o=ro(e),s=ro(t);o&&(n=s?e:0),s&&(i=o?t:0)}return ni?-this._resultLT:0},e}(),Pb=function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=gd(t)}return e.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var n=typeof e;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(t=gd(e)===this._rvalFloat)}return this._isEQ?t:!t},e}();function Db(e,t){return"eq"===e||"ne"===e?new Pb("eq"===e,t):Ro(Ib,e)?new Mb(e,t):null}var Ab=function(){function e(){}return e.prototype.getRawData=function(){throw new Error("not supported")},e.prototype.getRawDataItem=function(e){throw new Error("not supported")},e.prototype.cloneRawData=function(){},e.prototype.getDimensionInfo=function(e){},e.prototype.cloneAllDimensionInfo=function(){},e.prototype.count=function(){},e.prototype.retrieveValue=function(e,t){},e.prototype.retrieveValueFromItem=function(e,t){},e.prototype.convertValue=function(e,t){return _b(e,t)},e}();function Ob(e){var t=e.sourceFormat;if(!Vb(t)){var n="";0,wd(n)}return e.data}function Rb(e){var t=e.sourceFormat,n=e.data;if(!Vb(t)){var i="";0,wd(i)}if(t===zv){for(var a=[],r=0,o=n.length;r65535?zb:Ub}function Kb(e,t,n,i,a){var r=Wb[n||"float"];if(a){var o=e[t],s=o&&o.length;if(s!==i){for(var l=new r(i),p=0;pg[1]&&(g[1]=h)}return this._rawCount=this._count=s,{start:o,end:s}},e.prototype._initDataFromProvider=function(e,t,n){for(var i=this._provider,a=this._chunks,r=this._dimensions,o=r.length,s=this._rawExtent,l=Xr(r,(function(e){return e.property})),p=0;pf[1]&&(f[1]=g)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=t,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(e,t){if(!(t>=0&&t=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,n=t[e];if(null!=n&&ne))return r;a=r-1}}return-1},e.prototype.indicesOfNearest=function(e,t,n){var i=this._chunks[e],a=[];if(!i)return a;null==n&&(n=1/0);for(var r=1/0,o=-1,s=0,l=0,p=this.count();l=0&&o<0)&&(r=d,o=c,s=0),c===o&&(a[s++]=l))}return a.length=s,a},e.prototype.getIndices=function(){var e,t=this._indices;if(t){var n=t.constructor,i=this._count;if(n===Array){e=new n(i);for(var a=0;a=p&&x<=c||isNaN(x))&&(o[s++]=m),m++}u=!0}else if(2===a){h=d[i[0]];var f=d[i[1]],y=e[i[1]][0],v=e[i[1]][1];for(g=0;g=p&&x<=c||isNaN(x))&&(b>=y&&b<=v||isNaN(b))&&(o[s++]=m),m++}u=!0}}if(!u)if(1===a)for(g=0;g=p&&x<=c||isNaN(x))&&(o[s++]=w)}else for(g=0;ge[_][1])&&(S=!1)}S&&(o[s++]=t.getRawIndex(g))}return sf[1]&&(f[1]=g)}}}},e.prototype.lttbDownSample=function(e,t){var n,i,a,r=this.clone([e],!0),o=r._chunks[e],s=this.count(),l=0,p=Math.floor(1/t),c=this.getRawIndex(0),d=new($b(this._rawCount))(Math.min(2*(Math.ceil(s/p)+2),s));d[l++]=c;for(var u=1;un&&(n=i,a=T)}_>0&&_p-m&&(s=p-m,o.length=s);for(var h=0;hc[1]&&(c[1]=f),d[u++]=y}return a._count=u,a._indices=d,a._updateGetRawIdx(),a},e.prototype.each=function(e,t){if(this._count)for(var n=e.length,i=this._chunks,a=0,r=this.count();ao&&(o=l)}return i=[r,o],this._extent[e]=i,i},e.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var n=[],i=this._chunks,a=0;a=0?this._indices[e]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function e(e,t,n,i){return _b(e[i],this._dimensions[i])}qb={arrayRows:e,objectRows:function(e,t,n,i){return _b(e[t],this._dimensions[i])},keyedColumns:e,original:function(e,t,n,i){var a=e&&(null==e.value?e:e.value);return _b(a instanceof Array?a[i]:a,this._dimensions[i])},typedArray:function(e,t,n,i){return e[i]}}}(),e}(),Xb=function(){function e(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return e.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},e.prototype._setLocalSource=function(e,t){this._sourceList=e,this._upstreamSignList=t,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var e,t,n=this._sourceHost,i=this._getUpstreamSourceManagers(),a=!!i.length;if(Qb(n)){var r=n,o=void 0,s=void 0,l=void 0;if(a){var p=i[0];p.prepareSource(),o=(l=p.getSource()).data,s=l.sourceFormat,t=[p._getVersionSign()]}else s=co(o=r.get("data",!0))?Hv:Gv,t=[];var c=this._getSourceMetaRawOption()||{},d=l&&l.metaRawOption||{},u=vo(c.seriesLayoutBy,d.seriesLayoutBy)||null,m=vo(c.sourceHeader,d.sourceHeader),h=vo(c.dimensions,d.dimensions);e=u!==d.seriesLayoutBy||!!m!=!!d.sourceHeader||h?[eb(o,{seriesLayoutBy:u,sourceHeader:m,dimensions:h},s)]:[]}else{var g=n;if(a){var f=this._applyTransform(i);e=f.sourceList,t=f.upstreamSignList}else{e=[eb(g.get("source",!0),this._getSourceMetaRawOption(),null)],t=[]}}this._setLocalSource(e,t)},e.prototype._applyTransform=function(e){var t,n=this._sourceHost,i=n.get("transform",!0),a=n.get("fromTransformResult",!0);if(null!=a){var r="";1!==e.length&&Jb(r)}var o,s=[],l=[];return Yr(e,(function(e){e.prepareSource();var t=e.getSource(a||0),n="";null==a||t||Jb(n),s.push(t),l.push(e._getVersionSign())})),i?t=function(e,t){var n=Td(e),i=n.length,a="";i||wd(a);for(var r=0,o=i;r1||n>0&&!e.noHeader;return Yr(e.blocks,(function(e){var n=sw(e);n>=t&&(t=n+ +(i&&(!n||rw(e)&&!e.noHeader)))})),t}return 0}function lw(e,t,n,i){var a,r=t.noHeader,o=(a=sw(t),{html:nw[a],richText:iw[a]}),s=[],l=t.blocks||[];So(!l||io(l)),l=l||[];var p=e.orderMode;if(t.sortBlocks&&p){l=l.slice();var c={valueAsc:"asc",valueDesc:"desc"};if(Ro(c,p)){var d=new kb(c[p],null);l.sort((function(e,t){return d.evaluate(e.sortParam,t.sortParam)}))}else"seriesDesc"===p&&l.reverse()}Yr(l,(function(n,a){var r=t.valueFormatter,l=ow(n)(r?Ur(Ur({},e),{valueFormatter:r}):e,n,a>0?o.html:0,i);null!=l&&s.push(l)}));var u="richText"===e.renderMode?s.join(o.richText):dw(s.join(""),r?n:o.html);if(r)return u;var m=yv(t.header,"ordinal",e.useUTC),h=tw(i,e.renderMode).nameStyle;return"richText"===e.renderMode?uw(e,m,h)+o.richText+u:dw('
'+ms(m)+"
"+u,n)}function pw(e,t,n,i){var a=e.renderMode,r=t.noName,o=t.noValue,s=!t.markerType,l=t.name,p=e.useUTC,c=t.valueFormatter||e.valueFormatter||function(e){return Xr(e=io(e)?e:[e],(function(e,t){return yv(e,io(m)?m[t]:m,p)}))};if(!r||!o){var d=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||"#333",a),u=r?"":yv(l,"ordinal",p),m=t.valueType,h=o?[]:c(t.value,t.dataIndex),g=!s||!r,f=!s&&r,y=tw(i,a),v=y.nameStyle,x=y.valueStyle;return"richText"===a?(s?"":d)+(r?"":uw(e,u,v))+(o?"":function(e,t,n,i,a){var r=[a],o=i?10:20;return n&&r.push({padding:[0,0,0,o],align:"right"}),e.markupStyleCreator.wrapRichTextStyle(io(t)?t.join(" "):t,r)}(e,h,g,f,x)):dw((s?"":d)+(r?"":function(e,t,n){return''+ms(e)+""}(u,!s,v))+(o?"":function(e,t,n,i){var a=n?"10px":"20px",r=t?"float:right;margin-left:"+a:"";return e=io(e)?e:[e],''+Xr(e,(function(e){return ms(e)})).join("  ")+""}(h,g,f,x)),n)}}function cw(e,t,n,i,a,r){if(e)return ow(e)({useUTC:a,renderMode:n,orderMode:i,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,r)}function dw(e,t){return'
'+e+'
'}function uw(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function mw(e,t){return Sv(e.getData().getItemVisual(t,"style")[e.visualDrawType])}function hw(e,t){var n=e.get("padding");return null!=n?n:"richText"===t?[8,10]:10}var gw=function(){function e(){this.richTextStyles={},this._nextStyleNameId=yd()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var i="richText"===n?this._generateStyleName():null,a=wv({color:t,type:e,renderMode:n,markerId:i});return ro(a)?a:(this.richTextStyles[i]=a.style,a.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};io(t)?Yr(t,(function(e){return Ur(n,e)})):Ur(n,t);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+e+"}"},e}();function fw(e){var t,n,i,a,r=e.series,o=e.dataIndex,s=e.multipleSeries,l=r.getData(),p=l.mapDimensionsAll("defaultedTooltip"),c=p.length,d=r.getRawValue(o),u=io(d),m=mw(r,o);if(c>1||u&&!c){var h=function(e,t,n,i,a){var r=t.getData(),o=Zr(e,(function(e,t,n){var i=r.getDimensionInfo(n);return e||i&&!1!==i.tooltip&&null!=i.displayName}),!1),s=[],l=[],p=[];function c(e,t){var n=r.getDimensionInfo(t);n&&!1!==n.otherDims.tooltip&&(o?p.push(aw("nameValue",{markerType:"subItem",markerColor:a,name:n.displayName,value:e,valueType:n.type})):(s.push(e),l.push(n.type)))}return i.length?Yr(i,(function(e){c(yb(r,n,e),e)})):Yr(e,c),{inlineValues:s,inlineValueTypes:l,blocks:p}}(d,r,o,p,m);t=h.inlineValues,n=h.inlineValueTypes,i=h.blocks,a=h.inlineValues[0]}else if(c){var g=l.getDimensionInfo(p[0]);a=t=yb(l,o,p[0]),n=g.type}else a=t=u?d[0]:d;var f=Rd(r),y=f&&r.name||"",v=l.getName(o),x=s?y:v;return aw("section",{header:y,noHeader:s||!f,sortParam:a,blocks:[aw("nameValue",{markerType:"item",markerColor:m,name:x,noName:!Co(x),value:t,valueType:n,dataIndex:o})].concat(i||[])})}var yw=Nd();function vw(e,t){return e.getName(t)||e.getId(t)}var xw="__universalTransitionEnabled",bw=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return Qe(t,e),t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=wb({count:Sw,reset:Cw}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(yw(this).sourceManager=new Xb(this)).prepareSource();var i=this.getInitialData(e,n);Tw(i,this),this.dataTask.context.data=i,yw(this).dataBeforeProcessed=i,ww(this),this._initSelectedMapFromData(i)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=Dv(this),i=n?Ov(e):{},a=this.subType;Fv.hasClass(a)&&(a+="Series"),Gr(e,t.getTheme().get(this.subType)),Gr(e,this.getDefaultOption()),Ed(e,"label",["show"]),this.fillDataTextStyle(e.data),n&&Av(e,i,n)},t.prototype.mergeOption=function(e,t){e=Gr(this.option,e,!0),this.fillDataTextStyle(e.data);var n=Dv(this);n&&Av(this.option,e,n);var i=yw(this).sourceManager;i.dirty(),i.prepareSource();var a=this.getInitialData(e,t);Tw(a,this),this.dataTask.dirty(),this.dataTask.context.data=a,yw(this).dataBeforeProcessed=a,ww(this),this._initSelectedMapFromData(a)},t.prototype.fillDataTextStyle=function(e){if(e&&!co(e))for(var t=["show"],n=0;nthis.getShallow("animationThreshold")&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var i=this.ecModel,a=cx.prototype.getColorFromPalette.call(this,e,t,n);return a||(a=i.getColorFromPalette(e,t,n)),a},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get("progressive")},t.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,a=this.getData(t);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var r=0;r=0&&n.push(a)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(t);return("all"===n||n[vw(i,e)])&&!i.getItemModel(e).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[xw])return!0;var e=this.option.universalTransition;return!!e&&(!0===e||e&&e.enabled)},t.prototype._innerSelect=function(e,t){var n,i,a=this.option,r=a.selectedMode,o=t.length;if(r&&o)if("series"===r)a.selectedMap="all";else if("multiple"===r){lo(a.selectedMap)||(a.selectedMap={});for(var s=a.selectedMap,l=0;l0&&this._innerSelect(e,t)}},t.registerClass=function(e){return Fv.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type="series.__base__",e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol="circle",e.visualStyleAccessPath="itemStyle",e.visualDrawType="fill"}(),t}(Fv);function ww(e){var t=e.name;Rd(e)||(e.name=function(e){var t=e.getRawData(),n=t.mapDimensionsAll("seriesName"),i=[];return Yr(n,(function(e){var n=t.getDimensionInfo(e);n.displayName&&i.push(n.displayName)})),i.join(" ")}(e)||t)}function Sw(e){return e.model.getRawData().count()}function Cw(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),_w}function _w(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function Tw(e,t){Yr(Do(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),(function(n){e.wrapMethod(n,no(Ew,t))}))}function Ew(e,t){var n=Iw(e);return n&&n.setOutputEnd((t||this).count()),t}function Iw(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var i=n.currentTask;if(i){var a=i.agentStubMap;a&&(i=a.get(e.uid))}return i}}$r(bw,xb),$r(bw,cx),Zd(bw,Fv);var Mw=function(){function e(){this.group=new zc,this.uid=My("viewComponent")}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,i){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,i){},e.prototype.updateLayout=function(e,t,n,i){},e.prototype.updateVisual=function(e,t,n,i){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();function kw(){var e=Nd();return function(t){var n=e(t),i=t.pipelineContext,a=!!n.large,r=!!n.progressiveRender,o=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(a===o&&r===s)&&"reset"}}Xd(Mw),tu(Mw);var Pw=Nd(),Dw=kw(),Aw=function(){function e(){this.group=new zc,this.uid=My("viewChart"),this.renderTask=wb({plan:Bw,reset:Fw}),this.renderTask.context={view:this}}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,i){0},e.prototype.highlight=function(e,t,n,i){var a=e.getData(i&&i.dataType);a&&Rw(a,i,"emphasis")},e.prototype.downplay=function(e,t,n,i){var a=e.getData(i&&i.dataType);a&&Rw(a,i,"normal")},e.prototype.remove=function(e,t){this.group.removeAll()},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,i){this.render(e,t,n,i)},e.prototype.updateLayout=function(e,t,n,i){this.render(e,t,n,i)},e.prototype.updateVisual=function(e,t,n,i){this.render(e,t,n,i)},e.prototype.eachRendered=function(e){Zf(this.group,e)},e.markUpdateMethod=function(e,t){Pw(e).updateMethod=t},e.protoInitialize=void(e.prototype.type="chart"),e}();function Ow(e,t,n){e&&Qh(e)&&("emphasis"===t?Ah:Oh)(e,n)}function Rw(e,t,n){var i=Fd(e,t),a=t&&null!=t.highlightKey?function(e){var t=oh[e];return null==t&&rh<=32&&(t=oh[e]=rh++),t}(t.highlightKey):null;null!=i?Yr(Td(i),(function(t){Ow(e.getItemGraphicEl(t),n,a)})):e.eachItemGraphicEl((function(e){Ow(e,n,a)}))}function Bw(e){return Dw(e.model)}function Fw(e){var t=e.model,n=e.ecModel,i=e.api,a=e.payload,r=t.pipelineContext.progressiveRender,o=e.view,s=a&&Pw(a).updateMethod,l=r?"incrementalPrepareRender":s&&o[s]?s:"render";return"render"!==l&&o[l](t,n,i,a),Nw[l]}Xd(Aw),tu(Aw);var Nw={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},Lw="\0__throttleOriginMethod",Vw="\0__throttleRate",qw="\0__throttleType";function Gw(e,t,n){var i,a,r,o,s,l=0,p=0,c=null;function d(){p=(new Date).getTime(),c=null,e.apply(r,o||[])}t=t||0;var u=function(){for(var e=[],u=0;u=0?d():c=setTimeout(d,-a),l=i};return u.clear=function(){c&&(clearTimeout(c),c=null)},u.debounceNextCall=function(e){s=e},u}function zw(e,t,n,i){var a=e[t];if(a){var r=a[Lw]||a,o=a[qw];if(a[Vw]!==n||o!==i){if(null==n||!i)return e[t]=r;(a=e[t]=Gw(r,n,"debounce"===i))[Lw]=r,a[qw]=i,a[Vw]=n}return a}}function Uw(e,t){var n=e[t];n&&n[Lw]&&(n.clear&&n.clear(),e[t]=n[Lw])}var jw=Nd(),Hw={itemStyle:nu(Cy,!0),lineStyle:nu(by,!0)},Ww={lineStyle:"stroke",itemStyle:"fill"};function $w(e,t){var n=e.visualStyleMapper||Hw[t];return n||(console.warn("Unknown style type '"+t+"'."),Hw.itemStyle)}function Kw(e,t){var n=e.visualDrawType||Ww[t];return n||(console.warn("Unknown style type '"+t+"'."),"fill")}var Yw={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=e.getModel(i),r=$w(e,i)(a),o=a.getShallow("decal");o&&(n.setVisual("decal",o),o.dirty=!0);var s=Kw(e,i),l=r[s],p=ao(l)?l:null,c="auto"===r.fill||"auto"===r.stroke;if(!r[s]||p||c){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());r[s]||(r[s]=d,n.setVisual("colorFromPalette",!0)),r.fill="auto"===r.fill||ao(r.fill)?d:r.fill,r.stroke="auto"===r.stroke||ao(r.stroke)?d:r.stroke}if(n.setVisual("style",r),n.setVisual("drawType",s),!t.isSeriesFiltered(e)&&p)return n.setVisual("colorFromPalette",!1),{dataEach:function(t,n){var i=e.getDataParams(n),a=Ur({},r);a[s]=p(i),t.setItemVisual(n,"style",a)}}}},Xw=new Ey,Zw={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData&&!t.isSeriesFiltered(e)){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=$w(e,i),r=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[i]){Xw.option=n[i];var o=a(Xw);Ur(e.ensureUniqueItemVisual(t,"style"),o),Xw.option.decal&&(e.setItemVisual(t,"decal",Xw.option.decal),Xw.option.decal.dirty=!0),r in o&&e.setItemVisual(t,"colorFromPalette",!1)}}:null}}}},Qw={performRawSeries:!0,overallReset:function(e){var t=Po();e.eachSeries((function(e){var n=e.getColorBy();if(!e.isColorBySeries()){var i=e.type+"-"+n,a=t.get(i);a||(a={},t.set(i,a)),jw(e).scope=a}})),e.eachSeries((function(t){if(!t.isColorBySeries()&&!e.isSeriesFiltered(t)){var n=t.getRawData(),i={},a=t.getData(),r=jw(t).scope,o=t.visualStyleAccessPath||"itemStyle",s=Kw(t,o);a.each((function(e){var t=a.getRawIndex(e);i[t]=e})),n.each((function(e){var o=i[e];if(a.getItemVisual(o,"colorFromPalette")){var l=a.ensureUniqueItemVisual(o,"style"),p=n.getName(e)||e+"",c=n.count();l[s]=t.getColorFromPalette(p,r,c)}}))}}))}},Jw=Math.PI;var eS=function(){function e(e,t,n,i){this._stageTaskMap=Po(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each((function(e){var t=e.overallTask;t&&t.dirty()}))},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),i=n.context,a=!t&&n.progressiveEnabled&&(!i||i.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,r=i&&i.modDataCount;return{step:a,modBy:null!=r?Math.ceil(r/a):null,modDataCount:r}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid),i=e.getData().count(),a=n.progressiveEnabled&&t.incrementalPrepareRender&&i>=n.threshold,r=e.get("large")&&i>=e.get("largeThreshold"),o="mod"===e.get("progressiveChunkMode")?i:null;e.pipelineContext=n.context={progressiveRender:a,modDataCount:o,large:r}},e.prototype.restorePipelines=function(e){var t=this,n=t._pipelineMap=Po();e.eachSeries((function(e){var i=e.getProgressive(),a=e.uid;n.set(a,{id:a,head:null,tail:null,threshold:e.getProgressiveThreshold(),progressiveEnabled:i&&!(e.preventIncremental&&e.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),t._pipe(e,e.dataTask)}))},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;Yr(this._allHandlers,(function(i){var a=e.get(i.uid)||e.set(i.uid,{}),r="";So(!(i.reset&&i.overallReset),r),i.reset&&this._createSeriesStageTask(i,a,t,n),i.overallReset&&this._createOverallStageTask(i,a,t,n)}),this)},e.prototype.prepareView=function(e,t,n,i){var a=e.renderTask,r=a.context;r.model=t,r.ecModel=n,r.api=i,a.__block=!e.incrementalPrepareRender,this._pipe(t,a)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,i){i=i||{};var a=!1,r=this;function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}Yr(e,(function(e,s){if(!i.visualType||i.visualType===e.visualType){var l=r._stageTaskMap.get(e.uid),p=l.seriesTaskMap,c=l.overallTask;if(c){var d,u=c.agentStubMap;u.each((function(e){o(i,e)&&(e.dirty(),d=!0)})),d&&c.dirty(),r.updatePayload(c,n);var m=r.getPerformArgs(c,i.block);u.each((function(e){e.perform(m)})),c.perform(m)&&(a=!0)}else p&&p.each((function(s,l){o(i,s)&&s.dirty();var p=r.getPerformArgs(s,i.block);p.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),r.updatePayload(s,n),s.perform(p)&&(a=!0)}))}})),this.unfinished=a||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries((function(e){t=e.dataTask.perform()||t})),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each((function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)}))},e.prototype.updatePayload=function(e,t){"remain"!==t&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,i){var a=this,r=t.seriesTaskMap,o=t.seriesTaskMap=Po(),s=e.seriesType,l=e.getTargetSeries;function p(t){var s=t.uid,l=o.set(s,r&&r.get(s)||wb({plan:rS,reset:oS,count:pS}));l.context={model:t,ecModel:n,api:i,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:a},a._pipe(t,l)}e.createOnAllSeries?n.eachRawSeries(p):s?n.eachRawSeriesByType(s,p):l&&l(n,i).each(p)},e.prototype._createOverallStageTask=function(e,t,n,i){var a=this,r=t.overallTask=t.overallTask||wb({reset:tS});r.context={ecModel:n,api:i,overallReset:e.overallReset,scheduler:a};var o=r.agentStubMap,s=r.agentStubMap=Po(),l=e.seriesType,p=e.getTargetSeries,c=!0,d=!1,u="";function m(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,wb({reset:nS,onDirty:aS})));n.context={model:e,overallProgress:c},n.agent=r,n.__block=c,a._pipe(e,n)}So(!e.createOnAllSeries,u),l?n.eachRawSeriesByType(l,m):p?p(n,i).each(m):(c=!1,Yr(n.getSeries(),m)),d&&r.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=t),i.tail&&i.tail.pipe(t),i.tail=t,t.__idxInPipeline=i.count++,t.__pipeline=i},e.wrapStageHandler=function(e,t){return ao(e)&&(e={overallReset:e,seriesType:cS(e)}),e.uid=My("stageHandler"),t&&(e.visualType=t),e},e}();function tS(e){e.overallReset(e.ecModel,e.api,e.payload)}function nS(e){return e.overallProgress&&iS}function iS(){this.agent.dirty(),this.getDownstream().dirty()}function aS(){this.agent&&this.agent.dirty()}function rS(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function oS(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Td(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?Xr(t,(function(e,t){return lS(t)})):sS}var sS=lS(0);function lS(e){return function(t,n){var i=n.data,a=n.resetDefines[e];if(a&&a.dataEach)for(var r=t.start;r0&&c===a.length-p.length){var d=a.slice(0,c);"data"!==d&&(t.mainType=d,t[p.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(a)&&(n[a]=e,s=!0),s||(i[a]=e)}))}return{cptQuery:t,dataQuery:n,otherQuery:i}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,a=n.packedEvent,r=n.model,o=n.view;if(!r||!o)return!0;var s=t.cptQuery,l=t.dataQuery;return p(s,r,"mainType")&&p(s,r,"subType")&&p(s,r,"index","componentIndex")&&p(s,r,"name")&&p(s,r,"id")&&p(l,a,"name")&&p(l,a,"dataIndex")&&p(l,a,"dataType")&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,i,a));function p(e,t,n,i){return null==e[n]||t[i||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),CS=["symbol","symbolSize","symbolRotate","symbolOffset"],_S=CS.concat(["symbolKeepAspect"]),TS={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual("legendIcon",e.legendIcon),e.hasSymbolVisual){for(var i={},a={},r=!1,o=0;o=0&&$S(l)?l:.5,e.createRadialGradient(o,s,0,o,s,l)}(e,t,n):function(e,t,n){var i=null==t.x?0:t.x,a=null==t.x2?1:t.x2,r=null==t.y?0:t.y,o=null==t.y2?0:t.y2;return t.global||(i=i*n.width+n.x,a=a*n.width+n.x,r=r*n.height+n.y,o=o*n.height+n.y),i=$S(i)?i:0,a=$S(a)?a:1,r=$S(r)?r:0,o=$S(o)?o:0,e.createLinearGradient(i,r,a,o)}(e,t,n),a=t.colorStops,r=0;r0&&(t=i.lineDash,n=i.lineWidth,t&&"solid"!==t&&n>0?"dashed"===t?[4*n,2*n]:"dotted"===t?[n]:so(t)?[t]:io(t)?t:null:null),r=i.lineDashOffset;if(a){var o=i.strokeNoScale&&e.getLineScale?e.getLineScale():1;o&&1!==o&&(a=Xr(a,(function(e){return e/o})),r/=o)}return[a,r]}var QS=new pm(!0);function JS(e){var t=e.stroke;return!(null==t||"none"===t||!(e.lineWidth>0))}function eC(e){return"string"==typeof e&&"none"!==e}function tC(e){var t=e.fill;return null!=t&&"none"!==t}function nC(e,t){if(null!=t.fillOpacity&&1!==t.fillOpacity){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function iC(e,t){if(null!=t.strokeOpacity&&1!==t.strokeOpacity){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function aC(e,t,n){var i=su(t.image,t.__image,n);if(pu(i)){var a=e.createPattern(i,t.repeat||"repeat");if("function"==typeof DOMMatrix&&a&&a.setTransform){var r=new DOMMatrix;r.translateSelf(t.x||0,t.y||0),r.rotateSelf(0,0,(t.rotation||0)*Fo),r.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(r)}return a}}var rC=["shadowBlur","shadowOffsetX","shadowOffsetY"],oC=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function sC(e,t,n,i,a){var r=!1;if(!i&&t===(n=n||{}))return!1;if(i||t.opacity!==n.opacity){cC(e,a),r=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?Cu.opacity:o}(i||t.blend!==n.blend)&&(r||(cC(e,a),r=!0),e.globalCompositeOperation=t.blend||Cu.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[IC])if(this._disposed)a_(this.id);else{var i,a,r;if(lo(t)&&(n=t.lazyUpdate,i=t.silent,a=t.replaceMerge,r=t.transition,t=t.notMerge),this[IC]=!0,!this._model||t){var o=new _x(this._api),s=this._theme,l=this._model=new hx;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:a},l_);var p={seriesTransition:r,optionChanged:!0};if(n)this[MC]={silent:i,updateParams:p},this[IC]=!1,this.getZr().wakeUp();else{try{BC(this),LC.update.call(this,null,p)}catch(e){throw this[MC]=null,this[IC]=!1,e}this._ssr||this._zr.flush(),this[MC]=null,this[IC]=!1,zC.call(this,i),UC.call(this,i)}}},t.prototype.setTheme=function(){bd()},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||xr.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){e=e||{};var t=this._zr.painter;return t.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get("backgroundColor"),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){e=e||{};var t=this._zr.painter;return t.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){if(xr.svgSupported){var e=this._zr;return Yr(e.storage.getDisplayList(),(function(e){e.stopAnimation(null,!0)})),e.painter.toDataURL()}},t.prototype.getDataURL=function(e){if(!this._disposed){var t=(e=e||{}).excludeComponents,n=this._model,i=[],a=this;Yr(t,(function(e){n.eachComponent({mainType:e},(function(e){var t=a._componentsMap[e.__viewId];t.group.ignore||(i.push(t),t.group.ignore=!0)}))}));var r="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(e).toDataURL("image/"+(e&&e.type||"png"));return Yr(i,(function(e){e.group.ignore=!1})),r}a_(this.id)},t.prototype.getConnectedDataURL=function(e){if(!this._disposed){var t="svg"===e.type,n=this.group,i=Math.min,a=Math.max,r=1/0;if(m_[n]){var o=r,s=r,l=-1/0,p=-1/0,c=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();Yr(u_,(function(r,d){if(r.group===n){var u=t?r.getZr().painter.getSvgDom().innerHTML:r.renderToCanvas(qr(e)),m=r.getDom().getBoundingClientRect();o=i(m.left,o),s=i(m.top,s),l=a(m.right,l),p=a(m.bottom,p),c.push({dom:u,left:m.left,top:m.top})}}));var u=(l*=d)-(o*=d),m=(p*=d)-(s*=d),h=Tr.createCanvas(),g=$c(h,{renderer:t?"svg":"canvas"});if(g.resize({width:u,height:m}),t){var f="";return Yr(c,(function(e){var t=e.left-o,n=e.top-s;f+=''+e.dom+""})),g.painter.getSvgRoot().innerHTML=f,e.connectedBackgroundColor&&g.painter.setBackgroundColor(e.connectedBackgroundColor),g.refreshImmediately(),g.painter.toDataURL()}return e.connectedBackgroundColor&&g.add(new Gm({shape:{x:0,y:0,width:u,height:m},style:{fill:e.connectedBackgroundColor}})),Yr(c,(function(e){var t=new Rm({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});g.add(t)})),g.refreshImmediately(),h.toDataURL("image/"+(e&&e.type||"png"))}return this.getDataURL(e)}a_(this.id)},t.prototype.convertToPixel=function(e,t){return VC(this,"convertToPixel",e,t)},t.prototype.convertFromPixel=function(e,t){return VC(this,"convertFromPixel",e,t)},t.prototype.containPixel=function(e,t){var n;if(!this._disposed)return Yr(Vd(this._model,e),(function(e,i){i.indexOf("Models")>=0&&Yr(e,(function(e){var a=e.coordinateSystem;if(a&&a.containPoint)n=n||!!a.containPoint(t);else if("seriesModels"===i){var r=this._chartsMap[e.__viewId];r&&r.containPoint&&(n=n||r.containPoint(t,e))}else 0}),this)}),this),!!n;a_(this.id)},t.prototype.getVisual=function(e,t){var n=Vd(this._model,e,{defaultMainType:"series"}),i=n.seriesModel;var a=i.getData(),r=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?a.indexOfRawIndex(n.dataIndex):null;return null!=r?IS(a,r,t):MS(a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e,t,n,i=this;Yr(i_,(function(e){var t=function(t){var n,a=i.getModel(),r=t.target,o="globalout"===e;if(o?n={}:r&&AS(r,(function(e){var t=ih(e);if(t&&null!=t.dataIndex){var i=t.dataModel||a.getSeriesByIndex(t.seriesIndex);return n=i&&i.getDataParams(t.dataIndex,t.dataType,r)||{},!0}if(t.eventData)return n=Ur({},t.eventData),!0}),!0),n){var s=n.componentType,l=n.componentIndex;"markLine"!==s&&"markPoint"!==s&&"markArea"!==s||(s="series",l=n.seriesIndex);var p=s&&null!=l&&a.getComponent(s,l),c=p&&i["series"===p.mainType?"_chartsMap":"_componentsMap"][p.__viewId];0,n.event=t,n.type=e,i._$eventProcessor.eventInfo={targetEl:r,packedEvent:n,model:p,view:c},i.trigger(e,n)}};t.zrEventfulCallAtLast=!0,i._zr.on(e,t,i)})),Yr(o_,(function(e,t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),Yr(["selectchanged"],(function(e){i._messageCenter.on(e,(function(t){this.trigger(e,t)}),i)})),e=this._messageCenter,t=this,n=this._api,e.on("selectchanged",(function(e){var i=n.getModel();e.isFromClick?(DS("map","selectchanged",t,i,e),DS("pie","selectchanged",t,i,e)):"select"===e.fromAction?(DS("map","selected",t,i,e),DS("pie","selected",t,i,e)):"unselect"===e.fromAction&&(DS("map","unselected",t,i,e),DS("pie","unselected",t,i,e))}))},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?a_(this.id):this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)a_(this.id);else{this._disposed=!0,this.getDom()&&jd(this.getDom(),g_,"");var e=this,t=e._api,n=e._model;Yr(e._componentsViews,(function(e){e.dispose(n,t)})),Yr(e._chartsViews,(function(e){e.dispose(n,t)})),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete u_[e.id]}},t.prototype.resize=function(e){if(!this[IC])if(this._disposed)a_(this.id);else{this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption("media"),i=e&&e.silent;this[MC]&&(null==i&&(i=this[MC].silent),n=!0,this[MC]=null),this[IC]=!0;try{n&&BC(this),LC.update.call(this,{type:"resize",animation:Ur({duration:0},e&&e.animation)})}catch(e){throw this[IC]=!1,e}this[IC]=!1,zC.call(this,i),UC.call(this,i)}}},t.prototype.showLoading=function(e,t){if(this._disposed)a_(this.id);else if(lo(e)&&(t=e,e=""),e=e||"default",this.hideLoading(),d_[e]){var n=d_[e](this._api,t),i=this._zr;this._loadingFX=n,i.add(n)}},t.prototype.hideLoading=function(){this._disposed?a_(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=Ur({},e);return t.type=o_[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)a_(this.id);else if(lo(t)||(t={silent:!!t}),r_[e.type]&&this._model)if(this[IC])this._pendingActions.push(e);else{var n=t.silent;GC.call(this,e,n);var i=t.flush;i?this._zr.flush():!1!==i&&xr.browser.weChat&&this._throttledZrFlush(),zC.call(this,n),UC.call(this,n)}},t.prototype.updateLabelLayout=function(){wC.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)a_(this.id);else{var t=e.seriesIndex,n=this.getModel().getSeriesByIndex(t);0,n.appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},t.internalField=function(){function e(e){e.clearColorPalette(),e.eachSeries((function(e){e.clearColorPalette()}))}function t(e){for(var t=[],n=e.currentStates,i=0;i0?{duration:r,delay:i.get("delay"),easing:i.get("easing")}:null;n.eachRendered((function(e){if(e.states&&e.states.emphasis){if(vf(e))return;if(e instanceof km&&function(e){var t=sh(e);t.normalFill=e.style.fill,t.normalStroke=e.style.stroke;var n=e.states.select||{};t.selectFill=n.style&&n.style.fill||null,t.selectStroke=n.style&&n.style.stroke||null}(e),e.__dirty){var n=e.prevStates;n&&e.useStates(n)}if(a){e.stateTransition=o;var i=e.getTextContent(),r=e.getTextGuideLine();i&&(i.stateTransition=o),r&&(r.stateTransition=o)}e.__dirty&&t(e)}}))}BC=function(e){var t=e._scheduler;t.restorePipelines(e._model),t.prepareStageTasks(),FC(e,!0),FC(e,!1),t.plan()},FC=function(e,t){for(var n=e._model,i=e._scheduler,a=t?e._componentsViews:e._chartsViews,r=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,l=0;lt.get("hoverLayerThreshold")&&!xr.node&&!xr.worker&&t.eachSeries((function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered((function(e){e.states.emphasis&&(e.states.emphasis.hoverLayer=!0)}))}}))}(e,t),wC.trigger("series:afterupdate",t,i,s)},ZC=function(e){e[kC]=!0,e.getZr().wakeUp()},QC=function(e){e[kC]&&(e.getZr().storage.traverse((function(e){vf(e)||t(e)})),e[kC]=!1)},YC=function(e){return new(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return Qe(n,t),n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(null!=n)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){Ah(t,n),ZC(e)},n.prototype.leaveEmphasis=function(t,n){Oh(t,n),ZC(e)},n.prototype.enterBlur=function(t){Rh(t),ZC(e)},n.prototype.leaveBlur=function(t){Bh(t),ZC(e)},n.prototype.enterSelect=function(t){Fh(t),ZC(e)},n.prototype.leaveSelect=function(t){Nh(t),ZC(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n}(xx))(e)},XC=function(e){function t(e,t){for(var n=0;n=0)){C_.push(n);var r=eS.wrapStageHandler(n,a);r.__prio=t,r.__raw=n,e.push(r)}}function T_(e,t){d_[e]=t}var E_=function(e){var t=(e=qr(e)).type,n="";t||wd(n);var i=t.split(":");2!==i.length&&wd(n);var a=!1;"echarts"===i[0]&&(t=i[1],a=!0),e.__isBuiltIn=a,Nb.set(t,e)};function I_(e){return null==e?0:e.length||1}function M_(e){return e}S_(_C,Yw),S_(TC,Zw),S_(TC,Qw),S_(_C,TS),S_(TC,ES),S_(7e3,(function(e,t){e.eachRawSeries((function(n){if(!e.isSeriesFiltered(n)){var i=n.getData();i.hasItemVisual()&&i.each((function(e){var n=i.getItemVisual(e,"decal");n&&(i.ensureUniqueItemVisual(e,"style").decal=yC(n,t))}));var a=i.getVisual("decal");if(a)i.getVisual("style").decal=yC(a,t)}}))})),v_(Hx),x_(900,(function(e){var t=Po();e.eachSeries((function(e){var n=e.get("stack");if(n){var i=t.get(n)||t.set(n,[]),a=e.getData(),r={stackResultDimension:a.getCalculationInfo("stackResultDimension"),stackedOverDimension:a.getCalculationInfo("stackedOverDimension"),stackedDimension:a.getCalculationInfo("stackedDimension"),stackedByDimension:a.getCalculationInfo("stackedByDimension"),isStackedByIndex:a.getCalculationInfo("isStackedByIndex"),data:a,seriesModel:e};if(!r.stackedDimension||!r.isStackedByIndex&&!r.stackedByDimension)return;i.length&&a.setCalculationInfo("stackedOnSeries",i[i.length-1].seriesModel),i.push(r)}})),t.each(Wx)})),T_("default",(function(e,t){jr(t=t||{},{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new zc,i=new Gm({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(i);var a,r=new jm({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),o=new Gm({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});return n.add(o),t.showSpinner&&((a=new ef({shape:{startAngle:-Jw/2,endAngle:-Jw/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:"round",lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*Jw/2}).start("circularInOut"),a.animateShape(!0).when(1e3,{startAngle:3*Jw/2}).delay(300).start("circularInOut"),n.add(a)),n.resize=function(){var n=r.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,l=(e.getWidth()-2*s-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),p=e.getHeight()/2;t.showSpinner&&a.setShape({cx:l,cy:p}),o.setShape({x:l-s,y:p-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n})),w_({type:uh,event:uh,update:uh},Bo),w_({type:mh,event:mh,update:mh},Bo),w_({type:hh,event:hh,update:hh},Bo),w_({type:gh,event:gh,update:gh},Bo),w_({type:fh,event:fh,update:fh},Bo),y_("light",fS),y_("dark",wS);var k_=function(){function e(e,t,n,i,a,r){this._old=e,this._new=t,this._oldKeyGetter=n||M_,this._newKeyGetter=i||M_,this.context=a,this._diffModeMultiple="multiple"===r}return e.prototype.add=function(e){return this._add=e,this},e.prototype.update=function(e){return this._update=e,this},e.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},e.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},e.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},e.prototype.remove=function(e){return this._remove=e,this},e.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},e.prototype._executeOneToOne=function(){var e=this._old,t=this._new,n={},i=new Array(e.length),a=new Array(t.length);this._initIndexMap(e,null,i,"_oldKeyGetter"),this._initIndexMap(t,n,a,"_newKeyGetter");for(var r=0;r1){var p=s.shift();1===s.length&&(n[o]=s[0]),this._update&&this._update(p,r)}else 1===l?(n[o]=null,this._update&&this._update(s,r)):this._remove&&this._remove(r)}this._performRestAdd(a,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},i={},a=[],r=[];this._initIndexMap(e,n,a,"_oldKeyGetter"),this._initIndexMap(t,i,r,"_newKeyGetter");for(var o=0;o1&&1===d)this._updateManyToOne&&this._updateManyToOne(p,l),i[s]=null;else if(1===c&&d>1)this._updateOneToMany&&this._updateOneToMany(p,l),i[s]=null;else if(1===c&&1===d)this._update&&this._update(p,l),i[s]=null;else if(c>1&&d>1)this._updateManyToMany&&this._updateManyToMany(p,l),i[s]=null;else if(c>1)for(var u=0;u1)for(var o=0;o30}var G_,z_,U_,j_,H_,W_,$_,K_=lo,Y_=Xr,X_="undefined"==typeof Int32Array?Array:Int32Array,Z_=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Q_=["_approximateExtent"],J_=function(){function e(e,t){var n;this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","lttbDownSample"];var i=!1;N_(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(i=!0,n=e),n=n||["x","y"];for(var a={},r=[],o={},s=!1,l={},p=0;p=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,a=this._idList;if(n.getSource().sourceFormat===Gv&&!n.pure)for(var r=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,i=n[e];i||(i=n[e]={});var a=i[t];return null==a&&(io(a=this.getVisual(t))?a=a.slice():K_(a)&&(a=Ur({},a)),i[t]=a),a},e.prototype.setItemVisual=function(e,t,n){var i=this._itemVisuals[e]||{};this._itemVisuals[e]=i,K_(t)?Ur(i,t):i[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){K_(e)?Ur(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?Ur(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){var n=this.hostModel&&this.hostModel.seriesIndex;ah(n,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){Yr(this._graphicEls,(function(n,i){n&&e&&e.call(t,n,i)}))},e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:Y_(this.dimensions,this._getDimInfo,this),this.hostModel)),H_(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];ao(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(bo(arguments)))})},e.internalField=(G_=function(e){var t=e._invertedIndicesMap;Yr(t,(function(n,i){var a=e._dimInfos[i],r=a.ordinalMeta,o=a.stack,s=e._store;if(r||o){if(n=t[i]=o?new Array(s.count()):new X_(r.categories.length),r)for(var l=0;l1&&(s+="__ec__"+p),i[t]=s}})),e}();function eT(e,t){Jx(e)||(e=tb(e));var n=(t=t||{}).coordDimensions||[],i=t.dimensionsDefine||e.dimensionsDefine||[],a=Po(),r=[],o=function(e,t,n,i){var a=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,i||0);return Yr(t,(function(e){var t;lo(e)&&(t=e.dimsDef)&&(a=Math.max(a,t.length))})),a}(e,n,i,t.dimensionsCount),s=t.canOmitUnusedDimensions&&q_(o),l=i===e.dimensionsDefine,p=l?V_(e):L_(i),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var d=Po(c),u=new jb(o),m=0;m0&&(i.name=a+(r-1)),r++,t.set(a,r)}}(r),new F_({source:e,dimensions:r,fullDimensionCount:o,dimensionOmitted:s})}function tT(e,t,n){if(n||t.hasKey(e)){for(var i=0;t.hasKey(e+i);)i++;e+=i}return t.set(e,!0),e}var nT=function(e){this.coordSysDims=[],this.axisMap=Po(),this.categoryAxisMap=Po(),this.coordSysName=e};var iT={cartesian2d:function(e,t,n,i){var a=e.getReferringComponents("xAxis",Gd).models[0],r=e.getReferringComponents("yAxis",Gd).models[0];t.coordSysDims=["x","y"],n.set("x",a),n.set("y",r),aT(a)&&(i.set("x",a),t.firstCategoryDimIndex=0),aT(r)&&(i.set("y",r),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,n,i){var a=e.getReferringComponents("singleAxis",Gd).models[0];t.coordSysDims=["single"],n.set("single",a),aT(a)&&(i.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,n,i){var a=e.getReferringComponents("polar",Gd).models[0],r=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],n.set("radius",r),n.set("angle",o),aT(r)&&(i.set("radius",r),t.firstCategoryDimIndex=0),aT(o)&&(i.set("angle",o),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=1))},geo:function(e,t,n,i){t.coordSysDims=["lng","lat"]},parallel:function(e,t,n,i){var a=e.ecModel,r=a.getComponent("parallel",e.get("parallelIndex")),o=t.coordSysDims=r.dimensions.slice();Yr(r.parallelAxisIndex,(function(e,r){var s=a.getComponent("parallelAxis",e),l=o[r];n.set(l,s),aT(s)&&(i.set(l,s),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=r))}))}};function aT(e){return"category"===e.get("type")}function rT(e,t,n){var i,a,r,o=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(e){return!N_(e.schema)}(t)?(a=t.schema,i=a.dimensions,r=t.store):i=t;var l,p,c,d,u=!(!e||!e.get("stack"));if(Yr(i,(function(e,t){ro(e)&&(i[t]=e={name:e}),u&&!e.isExtraCoord&&(o||l||!e.ordinalMeta&&!e.stack||(l=e),p||"ordinal"===e.type||"time"===e.type||s&&s!==e.coordDim||(p=e))})),!p||o||l||(o=!0),p){c="__\0ecstackresult_"+e.id,d="__\0ecstackedover_"+e.id,l&&(l.createInvertedIndices=!0);var m=p.coordDim,h=p.type,g=0;Yr(i,(function(e){e.coordDim===m&&g++}));var f={name:c,coordDim:m,coordDimIndex:g,type:h,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},y={name:d,coordDim:d,coordDimIndex:g+1,type:h,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};a?(r&&(f.storeDimIndex=r.ensureCalculationDimension(d,h),y.storeDimIndex=r.ensureCalculationDimension(c,h)),a.appendCalculationDimension(f),a.appendCalculationDimension(y)):(i.push(f),i.push(y))}return{stackedDimension:p&&p.name,stackedByDimension:l&&l.name,isStackedByIndex:o,stackedOverDimension:d,stackResultDimension:c}}function oT(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function sT(e,t){return oT(e,t)?e.getCalculationInfo("stackResultDimension"):t}function lT(e,t,n){n=n||{};var i,a=t.getSourceManager(),r=!1;e?(r=!0,i=tb(e)):r=(i=a.getSource()).sourceFormat===Gv;var o=function(e){var t=e.get("coordinateSystem"),n=new nT(t),i=iT[t];if(i)return i(e,n,n.axisMap,n.categoryAxisMap),n}(t),s=function(e,t){var n,i=e.get("coordinateSystem"),a=Sx.get(i);return t&&t.coordSysDims&&(n=Xr(t.coordSysDims,(function(e){var n={name:e},i=t.axisMap.get(e);if(i){var a=i.get("type");n.type=A_(a)}return n}))),n||(n=a&&(a.getDimensionsInfo?a.getDimensionsInfo():a.dimensions.slice())||["x","y"]),n}(t,o),l=n.useEncodeDefaulter,p=ao(l)?l:l?no(Jv,s,t):null,c=eT(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:p,canOmitUnusedDimensions:!r}),d=function(e,t,n){var i,a;return n&&Yr(e,(function(e,r){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(null==i&&(i=r),e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),null!=e.otherDims.itemName&&(a=!0)})),a||null==i||(e[i].otherDims.itemName=0),i}(c.dimensions,n.createInvertedIndices,o),u=r?null:a.getSharedDataStore(c),m=rT(t,{schema:c,store:u}),h=new J_(c,t);h.setCalculationInfo(m);var g=null!=d&&function(e){if(e.sourceFormat===Gv){var t=function(e){var t=0;for(;tt[1]&&(t[1]=e[1])},e.prototype.unionExtentFromData=function(e,t){this.unionExtent(e.getApproximateExtent(t))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;isNaN(e)||(n[0]=e),isNaN(t)||(n[1]=t)},e.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}();tu(pT);var cT=0,dT=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++cT}return e.createByAxisModel=function(t){var n=t.option,i=n.data,a=i&&Xr(i,uT);return new e({categories:a,needCollect:!a,deduplication:!1!==n.dedplication})},e.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},e.prototype.parseAndCollect=function(e){var t,n=this._needCollect;if(!ro(e)&&!n)return e;if(n&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,t;var i=this._getOrCreateMap();return null==(t=i.get(e))&&(n?(t=this.categories.length,this.categories[t]=e,i.set(e,t)):t=NaN),t},e.prototype._getOrCreateMap=function(){return this._map||(this._map=Po(this.categories))},e}();function uT(e){return lo(e)&&null!=e.value?e.value:e+""}function mT(e){return"interval"===e.type||"log"===e.type}function hT(e,t,n,i){var a={},r=e[1]-e[0],o=a.interval=md(r/t,!0);null!=n&&oi&&(o=a.interval=i);var s=a.intervalPrecision=fT(o);return function(e,t){!isFinite(e[0])&&(e[0]=t[0]),!isFinite(e[1])&&(e[1]=t[1]),yT(e,0,t),yT(e,1,t),e[0]>e[1]&&(e[0]=e[1])}(a.niceTickExtent=[ed(Math.ceil(e[0]/o)*o,s),ed(Math.floor(e[1]/o)*o,s)],e),a}function gT(e){var t=Math.pow(10,ud(e)),n=e/t;return n?2===n?n=3:3===n?n=5:n*=2:n=1,ed(n*t)}function fT(e){return nd(e)+2}function yT(e,t,n){e[t]=Math.max(Math.min(e[t],n[1]),n[0])}function vT(e,t){return e>=t[0]&&e<=t[1]}function xT(e,t){return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])}function bT(e,t){return e*(t[1]-t[0])+t[0]}var wT=function(e){function t(t){var n=e.call(this,t)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new dT({})),io(i)&&(i=new dT({categories:Xr(i,(function(e){return lo(e)?e.value:e}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return Qe(t,e),t.prototype.parse=function(e){return null==e?NaN:ro(e)?this._ordinalMeta.getOrdinal(e):Math.round(e)},t.prototype.contain=function(e){return vT(e=this.parse(e),this._extent)&&null!=this._ordinalMeta.categories[e]},t.prototype.normalize=function(e){return xT(e=this._getTickNumber(this.parse(e)),this._extent)},t.prototype.scale=function(e){return e=Math.round(bT(e,this._extent)),this.getRawOrdinalNumber(e)},t.prototype.getTicks=function(){for(var e=[],t=this._extent,n=t[0];n<=t[1];)e.push({value:n}),n++;return e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(null!=e){for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],a=0,r=this._ordinalMeta.categories.length,o=Math.min(r,t.length);a=0&&e=0&&e=e},t.prototype.getOrdinalMeta=function(){return this._ordinalMeta},t.prototype.calcNiceTicks=function(){},t.prototype.calcNiceExtent=function(){},t.type="ordinal",t}(pT);pT.registerClass(wT);var ST=ed,CT=function(e){function t(t){var n=e.call(this,t)||this;n.type="interval",n._interval=0,n._intervalPrecision=2;var i=n.getSetting("ticksGenerator");return ao(i)&&(n._ticksGenerator=i),n}return Qe(t,e),t.prototype.parse=function(e){return e},t.prototype.contain=function(e){return vT(e,this._extent)},t.prototype.normalize=function(e){return xT(e,this._extent)},t.prototype.scale=function(e){return bT(e,this._extent)},t.prototype.setExtent=function(e,t){var n=this._extent;isNaN(e)||(n[0]=parseFloat(e)),isNaN(t)||(n[1]=parseFloat(t))},t.prototype.unionExtent=function(e){var t=this._extent;e[0]t[1]&&(t[1]=e[1]),this.setExtent(t[0],t[1])},t.prototype.getInterval=function(){return this._interval},t.prototype.setInterval=function(e){this._interval=e,this._niceExtent=this._extent.slice(),this._intervalPrecision=fT(e)},t.prototype.getTicks=function(e){var t,n=this._interval,i=this._extent,a=this._niceExtent,r=this._intervalPrecision,o=this._ticksGenerator;if(o)try{if(t=o(i,n,a,r))return t}catch(e){}if(t=[],!n)return t;i[0]1e4)return[];var l=t.length?t[t.length-1].value:a[1];return i[1]>l&&(e?t.push({value:ST(l+n,r)}):t.push({value:i[1]})),t},t.prototype.getMinorTicks=function(e){for(var t=this.getTicks(!0),n=[],i=this.getExtent(),a=1;ai[0]&&c0&&(r=null===r?s:Math.min(r,s))}n[i]=r}}return n}(e),n=[];return Yr(e,(function(e){var i,a=e.coordinateSystem.getBaseAxis(),r=a.getExtent();if("category"===a.type)i=a.getBandWidth();else if("value"===a.type||"time"===a.type){var o=a.dim+"_"+a.index,s=t[o],l=Math.abs(r[1]-r[0]),p=a.scale.getExtent(),c=Math.abs(p[1]-p[0]);i=s?l/c*s:l}else{var d=e.getData();i=Math.abs(r[1]-r[0])/d.count()}var u=Jc(e.get("barWidth"),i),m=Jc(e.get("barMaxWidth"),i),h=Jc(e.get("barMinWidth")||(FT(e)?.5:1),i),g=e.get("barGap"),f=e.get("barCategoryGap");n.push({bandWidth:i,barWidth:u,barMaxWidth:m,barMinWidth:h,barGap:g,barCategoryGap:f,axisKey:kT(a),stackId:MT(e)})})),AT(n)}function AT(e){var t={};Yr(e,(function(e,n){var i=e.axisKey,a=e.bandWidth,r=t[i]||{bandWidth:a,remainedWidth:a,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},o=r.stacks;t[i]=r;var s=e.stackId;o[s]||r.autoWidthCount++,o[s]=o[s]||{width:0,maxWidth:0};var l=e.barWidth;l&&!o[s].width&&(o[s].width=l,l=Math.min(r.remainedWidth,l),r.remainedWidth-=l);var p=e.barMaxWidth;p&&(o[s].maxWidth=p);var c=e.barMinWidth;c&&(o[s].minWidth=c);var d=e.barGap;null!=d&&(r.gap=d);var u=e.barCategoryGap;null!=u&&(r.categoryGap=u)}));var n={};return Yr(t,(function(e,t){n[t]={};var i=e.stacks,a=e.bandWidth,r=e.categoryGap;if(null==r){var o=eo(i).length;r=Math.max(35-4*o,15)+"%"}var s=Jc(r,a),l=Jc(e.gap,1),p=e.remainedWidth,c=e.autoWidthCount,d=(p-s)/(c+(c-1)*l);d=Math.max(d,0),Yr(i,(function(e){var t=e.maxWidth,n=e.minWidth;if(e.width){i=e.width;t&&(i=Math.min(i,t)),n&&(i=Math.max(i,n)),e.width=i,p-=i+l*i,c--}else{var i=d;t&&ti&&(i=n),i!==d&&(e.width=i,p-=i+l*i,c--)}})),d=(p-s)/(c+(c-1)*l),d=Math.max(d,0);var u,m=0;Yr(i,(function(e,t){e.width||(e.width=d),u=e,m+=e.width*(1+l)})),u&&(m-=u.width*l);var h=-m/2;Yr(i,(function(e,i){n[t][i]=n[t][i]||{bandWidth:a,offset:h,width:e.width},h+=e.width*(1+l)}))})),n}function OT(e,t){var n=PT(e,t),i=DT(n);Yr(n,(function(e){var t=e.getData(),n=e.coordinateSystem.getBaseAxis(),a=MT(e),r=i[kT(n)][a],o=r.offset,s=r.width;t.setLayout({bandWidth:r.bandWidth,offset:o,size:s})}))}function RT(e){return{seriesType:e,plan:kw(),reset:function(e){if(BT(e)){var t=e.getData(),n=e.coordinateSystem,i=n.getBaseAxis(),a=n.getOtherAxis(i),r=t.getDimensionIndex(t.mapDimension(a.dim)),o=t.getDimensionIndex(t.mapDimension(i.dim)),s=e.get("showBackground",!0),l=t.mapDimension(a.dim),p=t.getCalculationInfo("stackResultDimension"),c=oT(t,l)&&!!t.getCalculationInfo("stackedOnSeries"),d=a.isHorizontal(),u=function(e,t){return t.toGlobalCoord(t.dataToCoord("log"===t.type?1:0))}(0,a),m=FT(e),h=e.get("barMinHeight")||0,g=p&&t.getDimensionIndex(p),f=t.getLayout("size"),y=t.getLayout("offset");return{progress:function(e,t){for(var i,a=e.count,l=m&&ET(3*a),p=m&&s&&ET(3*a),v=m&&ET(a),x=n.master.getRect(),b=d?x.width:x.height,w=t.getStore(),S=0;null!=(i=e.next());){var C=w.get(c?g:r,i),_=w.get(o,i),T=u,E=void 0;c&&(E=+C-w.get(r,i));var I=void 0,M=void 0,k=void 0,P=void 0;if(d){var D=n.dataToPoint([C,_]);if(c)T=n.dataToPoint([E,_])[0];I=T,M=D[1]+y,k=D[0]-T,P=f,Math.abs(k)0)for(var s=0;s=0;--s)if(l[p]){r=l[p];break}r=r||o.none}if(io(r)){var c=null==e.level?0:e.level>=0?e.level:r.length+e.level;r=r[c=Math.min(c,r.length-1)]}}return Zy(new Date(e.value),r,a,i)}(e,t,n,this.getSetting("locale"),i)},t.prototype.getTicks=function(){var e=this._interval,t=this._extent,n=[];if(!e)return n;n.push({value:t[0],level:0});var i=this.getSetting("useUTC"),a=function(e,t,n,i){var a=1e4,r=$y,o=0;function s(e,t,n,a,r,o,s){for(var l=new Date(t),p=t,c=l[a]();p1&&0===p&&r.unshift({value:r[0].value-u})}}for(p=0;p=i[0]&&y<=i[1]&&d++)}var v=(i[1]-i[0])/t;if(d>1.5*v&&u>v/1.5)break;if(p.push(g),d>v||e===r[m])break}c=[]}}0;var x=Qr(Xr(p,(function(e){return Qr(e,(function(e){return e.value>=i[0]&&e.value<=i[1]&&!e.notAdd}))})),(function(e){return e.length>0})),b=[],w=x.length-1;for(m=0;mn&&(this._approxInterval=n);var r=LT.length,o=Math.min(function(e,t,n,i){for(;n>>1;e[a][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function qT(e){return(e/=2592e6)>6?6:e>3?3:e>2?2:1}function GT(e){return(e/=qy)>12?12:e>6?6:e>3.5?4:e>2?2:1}function zT(e,t){return(e/=t?Vy:Ly)>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function UT(e){return md(e,!0)}function jT(e,t,n){var i=new Date(e);switch(Yy(t)){case"year":case"month":i[lv(n)](0);case"day":i[pv(n)](1);case"hour":i[cv(n)](0);case"minute":i[dv(n)](0);case"second":i[uv(n)](0),i[mv(n)](0)}return i.getTime()}pT.registerClass(NT);var HT=pT.prototype,WT=CT.prototype,$T=ed,KT=Math.floor,YT=Math.ceil,XT=Math.pow,ZT=Math.log,QT=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="log",t.base=10,t._originalScale=new CT,t._interval=0,t}return Qe(t,e),t.prototype.getTicks=function(e){var t=this._originalScale,n=this._extent,i=t.getExtent();return Xr(WT.getTicks.call(this,e),(function(e){var t=e.value,a=ed(XT(this.base,t));return a=t===n[0]&&this._fixMin?eE(a,i[0]):a,{value:a=t===n[1]&&this._fixMax?eE(a,i[1]):a}}),this)},t.prototype.setExtent=function(e,t){var n=ZT(this.base);e=ZT(Math.max(0,e))/n,t=ZT(Math.max(0,t))/n,WT.setExtent.call(this,e,t)},t.prototype.getExtent=function(){var e=this.base,t=HT.getExtent.call(this);t[0]=XT(e,t[0]),t[1]=XT(e,t[1]);var n=this._originalScale.getExtent();return this._fixMin&&(t[0]=eE(t[0],n[0])),this._fixMax&&(t[1]=eE(t[1],n[1])),t},t.prototype.unionExtent=function(e){this._originalScale.unionExtent(e);var t=this.base;e[0]=ZT(e[0])/ZT(t),e[1]=ZT(e[1])/ZT(t),HT.unionExtent.call(this,e)},t.prototype.unionExtentFromData=function(e,t){this.unionExtent(e.getApproximateExtent(t))},t.prototype.calcNiceTicks=function(e){e=e||10;var t=this._extent,n=t[1]-t[0];if(!(n===1/0||n<=0)){var i=dd(n);for(e/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var a=[ed(YT(t[0]/i)*i),ed(KT(t[1]/i)*i)];this._interval=i,this._niceExtent=a}},t.prototype.calcNiceExtent=function(e){WT.calcNiceExtent.call(this,e),this._fixMin=e.fixMin,this._fixMax=e.fixMax},t.prototype.parse=function(e){return e},t.prototype.contain=function(e){return vT(e=ZT(e)/ZT(this.base),this._extent)},t.prototype.normalize=function(e){return xT(e=ZT(e)/ZT(this.base),this._extent)},t.prototype.scale=function(e){return e=bT(e,this._extent),XT(this.base,e)},t.type="log",t}(pT),JT=QT.prototype;function eE(e,t){return $T(e,nd(t))}JT.getMinorTicks=WT.getMinorTicks,JT.getLabel=WT.getLabel,pT.registerClass(QT);var tE=function(){function e(e,t,n){this._prepareParams(e,t,n)}return e.prototype._prepareParams=function(e,t,n){n[1]0&&s>0&&!l&&(o=0),o<0&&s<0&&!p&&(s=0));var d=this._determinedMin,u=this._determinedMax;return null!=d&&(o=d,l=!0),null!=u&&(s=u,p=!0),{min:o,max:s,minFixed:l,maxFixed:p,isBlank:c}},e.prototype.modifyDataMinMax=function(e,t){this[iE[e]]=t},e.prototype.setDeterminedMinMax=function(e,t){var n=nE[e];this[n]=t},e.prototype.freeze=function(){this.frozen=!0},e}(),nE={min:"_determinedMin",max:"_determinedMax"},iE={min:"_dataMin",max:"_dataMax"};function aE(e,t,n){var i=e.rawExtentInfo;return i||(i=new tE(e,t,n),e.rawExtentInfo=i,i)}function rE(e,t){return null==t?null:fo(t)?NaN:e.parse(t)}function oE(e,t){var n=e.type,i=aE(e,t,e.getExtent()).calculate();e.setBlank(i.isBlank);var a=i.min,r=i.max,o=t.ecModel;if(o&&"time"===n){var s=PT("bar",o),l=!1;if(Yr(s,(function(e){l=l||e.getBaseAxis()===t.axis})),l){var p=DT(s),c=function(e,t,n,i){var a=n.axis.getExtent(),r=a[1]-a[0],o=function(e,t,n){if(e&&t){var i=e[kT(t)];return null!=i&&null!=n?i[MT(n)]:i}}(i,n.axis);if(void 0===o)return{min:e,max:t};var s=1/0;Yr(o,(function(e){s=Math.min(e.offset,s)}));var l=-1/0;Yr(o,(function(e){l=Math.max(e.offset+e.width,l)})),s=Math.abs(s),l=Math.abs(l);var p=s+l,c=t-e,d=c/(1-(s+l)/r)-c;return t+=d*(l/p),e-=d*(s/p),{min:e,max:t}}(a,r,t,p);a=c.min,r=c.max}}return{extent:[a,r],fixMin:i.minFixed,fixMax:i.maxFixed}}function sE(e,t){var n=t,i=oE(e,n),a=i.extent,r=n.get("splitNumber");e instanceof QT&&(e.base=n.get("logBase"));var o=e.type,s=n.get("interval"),l="interval"===o||"time"===o;e.setExtent(a[0],a[1]),e.calcNiceExtent({splitNumber:r,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}),null!=s&&e.setInterval&&e.setInterval(s)}function lE(e,t){if(t=t||e.get("type"))switch(t){case"category":return new wT({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:[1/0,-1/0]});case"time":return new NT({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});case"value":return new CT({ticksGenerator:e.getTicksGenerator()});default:return new(pT.getClass(t)||CT)}}function pE(e){var t,n,i=e.getLabelModel().get("formatter"),a="category"===e.type?e.scale.getExtent()[0]:null;return"time"===e.scale.type?(n=i,function(t,i){return e.scale.getFormattedLabel(t,i,n)}):ro(i)?function(t){return function(n){var i=e.scale.getLabel(n);return t.replace("{value}",null!=i?i:"")}}(i):ao(i)?(t=i,function(n,i){return null!=a&&(i=n.value-a),t(cE(e,n),i,null!=n.level?{level:n.level}:null)}):function(t){return e.scale.getLabel(t)}}function cE(e,t){return"category"===e.type?e.scale.getLabel(t):t.value}function dE(e,t){var n=t*Math.PI/180,i=e.width,a=e.height,r=i*Math.abs(Math.cos(n))+Math.abs(a*Math.sin(n)),o=i*Math.abs(Math.sin(n))+Math.abs(a*Math.cos(n));return new js(e.x,e.y,r,o)}function uE(e){var t=e.get("interval");return null==t?"auto":t}function mE(e){return"category"===e.type&&0===uE(e.getLabelModel())}function hE(e,t){var n={};return Yr(e.mapDimensionsAll(t),(function(t){n[sT(e,t)]=!0})),eo(n)}var gE=function(){function e(){}return e.prototype.getNeedCrossZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}();var fE=[],yE={registerPreprocessor:v_,registerProcessor:x_,registerPostInit:function(e){b_("afterinit",e)},registerPostUpdate:function(e){b_("afterupdate",e)},registerUpdateLifecycle:b_,registerAction:w_,registerCoordinateSystem:function(e,t){Sx.register(e,t)},registerLayout:function(e,t){__(p_,e,t,1e3,"layout")},registerVisual:S_,registerTransform:E_,registerLoading:T_,registerMap:function(e,t,n){var i=CC("registerMap");i&&i(e,t,n)},registerImpl:function(e,t){SC[e]=t},PRIORITY:EC,ComponentModel:Fv,ComponentView:Mw,SeriesModel:bw,ChartView:Aw,registerComponentModel:function(e){Fv.registerClass(e)},registerComponentView:function(e){Mw.registerClass(e)},registerSeriesModel:function(e){bw.registerClass(e)},registerChartView:function(e){Aw.registerClass(e)},registerSubTypeDefaulter:function(e,t){Fv.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){Kc(e,t)}};function vE(e){io(e)?Yr(e,(function(e){vE(e)})):Hr(fE,e)>=0||(fE.push(e),ao(e)&&(e={install:e}),e.install(yE))}function xE(e,t){return Math.abs(e-t)<1e-8}function bE(e,t,n){var i=0,a=e[0];if(!a)return!1;for(var r=1;rn&&(e=a,n=o)}if(e)return function(e){for(var t=0,n=0,i=0,a=e.length,r=e[a-1][0],o=e[a-1][1],s=0;s>1^-(1&s),l=l>>1^-(1&l),a=s+=a,r=l+=r,i.push([s/n,l/n])}return i}function DE(e,t){return Xr(Qr((e=function(e){if(!e.UTF8Encoding)return e;var t=e,n=t.UTF8Scale;return null==n&&(n=1024),Yr(t.features,(function(e){var t=e.geometry,i=t.encodeOffsets,a=t.coordinates;if(i)switch(t.type){case"LineString":t.coordinates=PE(a,i,n);break;case"Polygon":case"MultiLineString":kE(a,i,n);break;case"MultiPolygon":Yr(a,(function(e,t){return kE(e,i[t],n)}))}})),t.UTF8Encoding=!1,t}(e)).features,(function(e){return e.geometry&&e.properties&&e.geometry.coordinates.length>0})),(function(e){var n=e.properties,i=e.geometry,a=[];switch(i.type){case"Polygon":var r=i.coordinates;a.push(new TE(r[0],r.slice(1)));break;case"MultiPolygon":Yr(i.coordinates,(function(e){e[0]&&a.push(new TE(e[0],e.slice(1)))}));break;case"LineString":a.push(new EE([i.coordinates]));break;case"MultiLineString":a.push(new EE(i.coordinates))}var o=new IE(n[t||"name"],a,n.cp);return o.properties=n,o}))}var AE=Nd();function OE(e){return"category"===e.type?function(e){var t=e.getLabelModel(),n=BE(e,t);return!t.get("show")||e.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(e):function(e){var t=e.scale.getTicks(),n=pE(e);return{labels:Xr(t,(function(t,i){return{level:t.level,formattedLabel:n(t,i),rawLabel:e.scale.getLabel(t),tickValue:t.value}}))}}(e)}function RE(e,t){return"category"===e.type?function(e,t){var n,i,a=FE(e,"ticks"),r=uE(t),o=NE(a,r);if(o)return o;t.get("show")&&!e.scale.isBlank()||(n=[]);if(ao(r))n=qE(e,r,!0);else if("auto"===r){var s=BE(e,e.getLabelModel());i=s.labelCategoryInterval,n=Xr(s.labels,(function(e){return e.tickValue}))}else n=VE(e,i=r,!0);return LE(a,r,{ticks:n,tickCategoryInterval:i})}(e,t):{ticks:Xr(e.scale.getTicks(),(function(e){return e.value}))}}function BE(e,t){var n,i,a=FE(e,"labels"),r=uE(t),o=NE(a,r);return o||(ao(r)?n=qE(e,r):(i="auto"===r?function(e){var t=AE(e).autoInterval;return null!=t?t:AE(e).autoInterval=e.calculateCategoryInterval()}(e):r,n=VE(e,i)),LE(a,r,{labels:n,labelCategoryInterval:i}))}function FE(e,t){return AE(e)[t]||(AE(e)[t]=[])}function NE(e,t){for(var n=0;n1&&c/l>2&&(p=Math.round(Math.ceil(p/l)*l));var d=mE(e),u=o.get("showMinLabel")||d,m=o.get("showMaxLabel")||d;u&&p!==r[0]&&g(r[0]);for(var h=p;h<=r[1];h+=l)g(h);function g(e){var t={value:e};s.push(n?e:{formattedLabel:i(t),rawLabel:a.getLabel(t),tickValue:e})}return m&&h-l!==r[1]&&g(r[1]),s}function qE(e,t,n){var i=e.scale,a=pE(e),r=[];return Yr(i.getTicks(),(function(e){var o=i.getLabel(e),s=e.value;t(e.value,o)&&r.push(n?s:{formattedLabel:a(e),rawLabel:o,tickValue:s})})),r}var GE=[0,1],zE=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),i=Math.max(t[0],t[1]);return e>=n&&e<=i},e.prototype.containData=function(e){return this.scale.contain(e)},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.getPixelPrecision=function(e){return ad(e||this.scale.getExtent(),this._extent)},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this._extent,i=this.scale;return e=i.normalize(e),this.onBand&&"ordinal"===i.type&&UE(n=n.slice(),i.count()),Qc(e,GE,n,t)},e.prototype.coordToData=function(e,t){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&UE(n=n.slice(),i.count());var a=Qc(e,n,GE,t);return this.scale.scale(a)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){var t=(e=e||{}).tickModel||this.getTickModel(),n=Xr(RE(this,t).ticks,(function(e){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(e):e),tickValue:e}}),this);return function(e,t,n,i){var a=t.length;if(!e.onBand||n||!a)return;var r,o,s=e.getExtent();if(1===a)t[0].coord=s[0],r=t[1]={coord:s[1]};else{var l=t[a-1].tickValue-t[0].tickValue,p=(t[a-1].coord-t[0].coord)/l;Yr(t,(function(e){e.coord-=p/2})),o=1+e.scale.getExtent()[1]-t[a-1].tickValue,r={coord:t[a-1].coord+p*o},t.push(r)}var c=s[0]>s[1];d(t[0].coord,s[0])&&(i?t[0].coord=s[0]:t.shift());i&&d(s[0],t[0].coord)&&t.unshift({coord:s[0]});d(s[1],r.coord)&&(i?r.coord=s[1]:t.pop());i&&d(r.coord,s[1])&&t.push({coord:s[1]});function d(e,t){return e=ed(e),t=ed(t),c?e>t:e0&&e<100||(e=5),Xr(this.scale.getMinorTicks(e),(function(e){return Xr(e,(function(e){return{coord:this.dataToCoord(e),tickValue:e}}),this)}),this)},e.prototype.getViewLabels=function(){return OE(this).labels},e.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},e.prototype.getTickModel=function(){return this.model.getModel("axisTick")},e.prototype.getBandWidth=function(){if("time"===this.type){var e=this.model,t=e.get("bandWidthCalculator"),n=void 0;if(ao(t))try{if(n=t(e))return n}catch(e){}}var i=this._extent,a=this.scale.getExtent(),r=a[1]-a[0]+(this.onBand?1:0);0===r&&(r=1);var o=Math.abs(i[1]-i[0]);return Math.abs(o)/r},e.prototype.calculateCategoryInterval=function(){return function(e){var t=function(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get("rotate")||0,font:t.getFont()}}(e),n=pE(e),i=(t.axisRotate-t.labelRotate)/180*Math.PI,a=e.scale,r=a.getExtent(),o=a.count();if(r[1]-r[0]<1)return 0;var s=1;o>40&&(s=Math.max(1,Math.floor(o/40)));for(var l=r[0],p=e.dataToCoord(l+1)-e.dataToCoord(l),c=Math.abs(p*Math.cos(i)),d=Math.abs(p*Math.sin(i)),u=0,m=0;l<=r[1];l+=s){var h,g,f=Ec(n({value:l}),t.font,"center","top");h=1.3*f.width,g=1.3*f.height,u=Math.max(u,h,7),m=Math.max(m,g,7)}var y=u/c,v=m/d;isNaN(y)&&(y=1/0),isNaN(v)&&(v=1/0);var x=Math.max(0,Math.floor(Math.min(y,v))),b=AE(e.model),w=e.getExtent(),S=b.lastAutoInterval,C=b.lastTickCount;return null!=S&&null!=C&&Math.abs(S-x)<=1&&Math.abs(C-o)<=1&&S>x&&b.axisExtent0===w[0]&&b.axisExtent1===w[1]?x=S:(b.lastTickCount=o,b.lastAutoInterval=x,b.axisExtent0=w[0],b.axisExtent1=w[1]),x}(this)},e}();function UE(e,t){var n=(e[1]-e[0])/t/2;e[0]+=n,e[1]-=n}var jE=2*Math.PI,HE=pm.CMD,WE=["top","right","bottom","left"];function $E(e,t,n,i,a){var r=n.width,o=n.height;switch(e){case"top":i.set(n.x+r/2,n.y-t),a.set(0,-1);break;case"bottom":i.set(n.x+r/2,n.y+o+t),a.set(0,1);break;case"left":i.set(n.x-t,n.y+o/2),a.set(-1,0);break;case"right":i.set(n.x+r+t,n.y+o/2),a.set(1,0)}}function KE(e,t,n,i,a,r,o,s,l){o-=e,s-=t;var p=Math.sqrt(o*o+s*s),c=(o/=p)*n+e,d=(s/=p)*n+t;if(Math.abs(i-a)%jE<1e-4)return l[0]=c,l[1]=d,p-n;if(r){var u=i;i=hm(a),a=hm(u)}else i=hm(i),a=hm(a);i>a&&(a+=jE);var m=Math.atan2(s,o);if(m<0&&(m+=jE),m>=i&&m<=a||m+jE>=i&&m+jE<=a)return l[0]=c,l[1]=d,p-n;var h=n*Math.cos(i)+e,g=n*Math.sin(i)+t,f=n*Math.cos(a)+e,y=n*Math.sin(a)+t,v=(h-o)*(h-o)+(g-s)*(g-s),x=(f-o)*(f-o)+(y-s)*(y-s);return v0){t=t/180*Math.PI,eI.fromArray(e[0]),tI.fromArray(e[1]),nI.fromArray(e[2]),Bs.sub(iI,eI,tI),Bs.sub(aI,nI,tI);var n=iI.len(),i=aI.len();if(!(n<.001||i<.001)){iI.scale(1/n),aI.scale(1/i);var a=iI.dot(aI);if(Math.cos(t)1&&Bs.copy(sI,nI),sI.toArray(e[1])}}}}function pI(e,t,n){if(n<=180&&n>0){n=n/180*Math.PI,eI.fromArray(e[0]),tI.fromArray(e[1]),nI.fromArray(e[2]),Bs.sub(iI,tI,eI),Bs.sub(aI,nI,tI);var i=iI.len(),a=aI.len();if(!(i<.001||a<.001))if(iI.scale(1/i),aI.scale(1/a),iI.dot(t)=o)Bs.copy(sI,nI);else{sI.scaleAndAdd(aI,r/Math.tan(Math.PI/2-s));var l=nI.x!==tI.x?(sI.x-tI.x)/(nI.x-tI.x):(sI.y-tI.y)/(nI.y-tI.y);if(isNaN(l))return;l<0?Bs.copy(sI,tI):l>1&&Bs.copy(sI,nI)}sI.toArray(e[1])}}}function cI(e,t,n,i){var a="normal"===n,r=a?e:e.ensureState(n);r.ignore=t;var o=i.get("smooth");o&&!0===o&&(o=.3),r.shape=r.shape||{},o>0&&(r.shape.smooth=o);var s=i.getModel("lineStyle").getLineStyle();a?e.useStyle(s):r.style=s}function dI(e,t){var n=t.smooth,i=t.points;if(i)if(e.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var a=Ko(i[0],i[1]),r=Ko(i[1],i[2]);if(!a||!r)return e.lineTo(i[1][0],i[1][1]),void e.lineTo(i[2][0],i[2][1]);var o=Math.min(a,r)*n,s=Zo([],i[1],i[0],o/a),l=Zo([],i[1],i[2],o/r),p=Zo([],s,l,.5);e.bezierCurveTo(s[0],s[1],s[0],s[1],p[0],p[1]),e.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var c=1;c0&&r&&S(-d/o,0,o);var f,y,v=e[0],x=e[o-1];return b(),f<0&&C(-f,.8),y<0&&C(y,.8),b(),w(f,y,1),w(y,f,-1),b(),f<0&&_(-f),y<0&&_(y),p}function b(){f=v.rect[t]-i,y=a-x.rect[t]-x.rect[n]}function w(e,t,n){if(e<0){var i=Math.min(t,-e);if(i>0){S(i*n,0,o);var a=i+e;a<0&&C(-a*n,1)}else C(-e*n,1)}}function S(n,i,a){0!==n&&(p=!0);for(var r=i;r0)for(l=0;l0;l--){S(-(r[l-1]*d),l,o)}}}function _(e){var t=e<0?-1:1;e=Math.abs(e);for(var n=Math.ceil(e/(o-1)),i=0;i0?S(n,0,i+1):S(-n,o-i-1,o),(e-=n)<=0)return}}function fI(e,t,n,i){return gI(e,"y","height",t,n,i)}function yI(e){var t=[];e.sort((function(e,t){return t.priority-e.priority}));var n=new js(0,0,0,0);function i(e){if(!e.ignore){var t=e.ensureState("emphasis");null==t.ignore&&(t.ignore=!1)}e.ignore=!0}for(var a=0;a=0&&n.attr(m.oldLayoutSelect),Hr(p,"emphasis")>=0&&n.attr(m.oldLayoutEmphasis)),ff(n,s,t,o)}else if(n.attr(s),!dy(n).valueAnimation){var c=vo(n.style.opacity,1);n.style.opacity=0,yf(n,{style:{opacity:c}},t,o)}if(m.oldLayout=s,n.states.select){var d=m.oldLayoutSelect={};_I(d,s,TI),_I(d,n.states.select,TI)}if(n.states.emphasis){var u=m.oldLayoutEmphasis={};_I(u,s,TI),_I(u,n.states.emphasis,TI)}my(n,o,l,t,t)}if(i&&!i.ignore&&!i.invisible){a=(m=CI(i)).oldLayout;var m,h={points:i.shape.points};a?(i.attr({shape:a}),ff(i,{shape:h},t)):(i.setShape(h),i.style.strokePercent=0,yf(i,{style:{strokePercent:1}},t)),m.oldLayout=h}},e}(),II=Nd();function MI(e){e.registerUpdateLifecycle("series:beforeupdate",(function(e,t,n){var i=II(t).labelManager;i||(i=II(t).labelManager=new EI),i.clearLabels()})),e.registerUpdateLifecycle("series:layoutlabels",(function(e,t,n){var i=II(t).labelManager;n.updatedSeries.forEach((function(e){i.addLabelsOfSeries(t.getViewOfSeriesModel(e))})),i.updateLayoutConfig(t),i.layout(t),i.processLabelsOverall()}))}vE(MI);var kI=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return Qe(t,e),t.prototype.getInitialData=function(e){return lT(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new zc,n=jS("line",0,e.itemHeight/2,e.itemWidth,0,e.lineStyle.stroke,!1);t.add(n),n.setStyle(e.lineStyle);var i=this.getData().getVisual("symbol"),a=this.getData().getVisual("symbolRotate"),r="none"===i?"circle":i,o=.8*e.itemHeight,s=jS(r,(e.itemWidth-o)/2,(e.itemHeight-o)/2,o,o,e.itemStyle.fill);t.add(s),s.setStyle(e.itemStyle);var l="inherit"===e.iconRotate?a:e.iconRotate||0;return s.rotation=l*Math.PI/180,s.setOrigin([e.itemWidth/2,e.itemHeight/2]),r.indexOf("empty")>-1&&(s.style.stroke=s.style.fill,s.style.fill="#fff",s.style.lineWidth=2),t},t.type="series.line",t.dependencies=["grid","polar"],t.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},t}(bw);function PI(e,t){var n=e.mapDimensionsAll("defaultedLabel"),i=n.length;if(1===i){var a=yb(e,t,n[0]);return null!=a?a+"":null}if(i){for(var r=[],o=0;o=0&&i.push(t[r])}return i.join(" ")}var AI=function(e){function t(t,n,i,a){var r=e.call(this)||this;return r.updateData(t,n,i,a),r}return Qe(t,e),t.prototype._createSymbol=function(e,t,n,i,a){this.removeAll();var r=jS(e,-1,-1,2,2,null,a);r.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),r.drift=OI,this._symbolType=e,this.add(r)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){Ah(this.childAt(0))},t.prototype.downplay=function(){Oh(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?"move":n.cursor},t.prototype.updateData=function(e,n,i,a){this.silent=!1;var r=e.getItemVisual(n,"symbol")||"circle",o=e.hostModel,s=t.getSymbolSize(e,n),l=r!==this._symbolType,p=a&&a.disableAnimation;if(l){var c=e.getItemVisual(n,"symbolKeepAspect");this._createSymbol(r,e,n,s,c)}else{(u=this.childAt(0)).silent=!1;var d={scaleX:s[0]/2,scaleY:s[1]/2};p?u.attr(d):ff(u,d,o,n),Sf(u)}if(this._updateCommon(e,n,s,i,a),l){var u=this.childAt(0);if(!p){d={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:u.style.opacity}};u.scaleX=u.scaleY=0,u.style.opacity=0,yf(u,d,o,n)}}p&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(e,t,n,i,a){var r,o,s,l,p,c,d,u,m,h=this.childAt(0),g=e.hostModel;if(i&&(r=i.emphasisItemStyle,o=i.blurItemStyle,s=i.selectItemStyle,l=i.focus,p=i.blurScope,d=i.labelStatesModels,u=i.hoverScale,m=i.cursorStyle,c=i.emphasisDisabled),!i||e.hasItemOption){var f=i&&i.itemModel?i.itemModel:e.getItemModel(t),y=f.getModel("emphasis");r=y.getModel("itemStyle").getItemStyle(),s=f.getModel(["select","itemStyle"]).getItemStyle(),o=f.getModel(["blur","itemStyle"]).getItemStyle(),l=y.get("focus"),p=y.get("blurScope"),c=y.get("disabled"),d=iy(f),u=y.getShallow("scale"),m=f.getShallow("cursor")}var v=e.getItemVisual(t,"symbolRotate");h.attr("rotation",(v||0)*Math.PI/180||0);var x=WS(e.getItemVisual(t,"symbolOffset"),n);x&&(h.x=x[0],h.y=x[1]),m&&h.attr("cursor",m);var b=e.getItemVisual(t,"style"),w=b.fill;if(h instanceof Rm){var S=h.style;h.useStyle(Ur({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else h.__isEmptyBrush?h.useStyle(Ur({},b)):h.useStyle(b),h.style.decal=null,h.setColor(w,a&&a.symbolInnerColor),h.style.strokeNoScale=!0;var C=e.getItemVisual(t,"liftZ"),_=this._z2;null!=C?null==_&&(this._z2=h.z2,h.z2+=C):null!=_&&(h.z2=_,this._z2=null);var T=a&&a.useNameLabel;ny(h,d,{labelFetcher:g,labelDataIndex:t,defaultText:function(t){return T?e.getName(t):PI(e,t)},inheritColor:w,defaultOpacity:b.opacity}),this._sizeX=n[0]/2,this._sizeY=n[1]/2;var E=h.ensureState("emphasis");E.style=r,h.ensureState("select").style=s,h.ensureState("blur").style=o;var I=null==u||!0===u?Math.max(1.1,3/this._sizeY):isFinite(u)&&u>0?+u:1;E.scaleX=this._sizeX*I,E.scaleY=this._sizeY*I,this.setSymbolScale(1),Wh(this,l,p,c)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var i=this.childAt(0),a=ih(this).dataIndex,r=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var o=i.getTextContent();o&&xf(o,{style:{opacity:0}},t,{dataIndex:a,removeOpt:r,cb:function(){i.removeTextContent()}})}else i.removeTextContent();xf(i,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:a,cb:e,removeOpt:r})},t.getSymbolSize=function(e,t){return HS(e.getItemVisual(t,"symbolSize"))},t}(zc);function OI(e,t){this.parent.drift(e,t)}function RI(e,t,n,i){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(i.isIgnore&&i.isIgnore(n))&&!(i.clipShape&&!i.clipShape.contain(t[0],t[1]))&&"none"!==e.getItemVisual(n,"symbol")}function BI(e){return null==e||lo(e)||(e={isIgnore:e}),e||{}}function FI(e){var t=e.hostModel,n=t.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:t.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:t.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),emphasisDisabled:n.get("disabled"),hoverScale:n.get("scale"),labelStatesModels:iy(t),cursorStyle:t.get("cursor")}}var NI=function(){function e(e){this.group=new zc,this._SymbolCtor=e||AI}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=BI(t);var n=this.group,i=e.hostModel,a=this._data,r=this._SymbolCtor,o=t.disableAnimation,s=FI(e),l={disableAnimation:o},p=t.getSymbolPoint||function(t){return e.getItemLayout(t)};a||n.removeAll(),e.diff(a).add((function(i){var a=p(i);if(RI(e,a,i,t)){var o=new r(e,i,s,l);o.setPosition(a),e.setItemGraphicEl(i,o),n.add(o)}})).update((function(c,d){var u=a.getItemGraphicEl(d),m=p(c);if(RI(e,m,c,t)){var h=e.getItemVisual(c,"symbol")||"circle",g=u&&u.getSymbolType&&u.getSymbolType();if(!u||g&&g!==h)n.remove(u),(u=new r(e,c,s,l)).setPosition(m);else{u.updateData(e,c,s,l);var f={x:m[0],y:m[1]};o?u.attr(f):ff(u,f,i)}n.add(u),e.setItemGraphicEl(c,u)}else n.remove(u)})).remove((function(e){var t=a.getItemGraphicEl(e);t&&t.fadeOut((function(){n.remove(t)}),i)})).execute(),this._getSymbolPoint=p,this._data=e},e.prototype.updateLayout=function(){var e=this,t=this._data;t&&t.eachItemGraphicEl((function(t,n){var i=e._getSymbolPoint(n);t.setPosition(i),t.markRedraw()}))},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=FI(e),this._data=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){function i(e){e.isGroup||(e.incremental=!0,e.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=BI(n);for(var a=e.start;a0?n=i[0]:i[1]<0&&(n=i[1]);return n}(a,n),o=i.dim,s=a.dim,l=t.mapDimension(s),p=t.mapDimension(o),c="x"===s||"radius"===s?1:0,d=Xr(e.dimensions,(function(e){return t.mapDimension(e)})),u=!1,m=t.getCalculationInfo("stackResultDimension");return oT(t,d[0])&&(u=!0,d[0]=m),oT(t,d[1])&&(u=!0,d[1]=m),{dataDimsForPoint:d,valueStart:r,valueAxisDim:s,baseAxisDim:o,stacked:!!u,valueDim:l,baseDim:p,baseDataOffset:c,stackedOverDimension:t.getCalculationInfo("stackedOverDimension")}}function VI(e,t,n,i){var a=NaN;e.stacked&&(a=n.get(n.getCalculationInfo("stackedOverDimension"),i)),isNaN(a)&&(a=e.valueStart);var r=e.baseDataOffset,o=[];return o[r]=n.get(e.baseDim,i),o[1-r]=a,t.dataToPoint(o)}var qI=Math.min,GI=Math.max;function zI(e,t){return isNaN(e)||isNaN(t)}function UI(e,t,n,i,a,r,o,s,l){for(var p,c,d,u,m,h,g=n,f=0;f=a||g<0)break;if(zI(y,v)){if(l){g+=r;continue}break}if(g===n)e[r>0?"moveTo":"lineTo"](y,v),d=y,u=v;else{var x=y-p,b=v-c;if(x*x+b*b<.5){g+=r;continue}if(o>0){for(var w=g+r,S=t[2*w],C=t[2*w+1];S===y&&C===v&&f=i||zI(S,C))m=y,h=v;else{E=S-p,I=C-c;var P=y-p,D=S-y,A=v-c,O=C-v,R=void 0,B=void 0;if("x"===s){var F=E>0?1:-1;m=y-F*(R=Math.abs(P))*o,h=v,M=y+F*(B=Math.abs(D))*o,k=v}else if("y"===s){var N=I>0?1:-1;m=y,h=v-N*(R=Math.abs(A))*o,M=y,k=v+N*(B=Math.abs(O))*o}else R=Math.sqrt(P*P+A*A),m=y-E*o*(1-(T=(B=Math.sqrt(D*D+O*O))/(B+R))),h=v-I*o*(1-T),k=v+I*o*T,M=qI(M=y+E*o*T,GI(S,y)),k=qI(k,GI(C,v)),M=GI(M,qI(S,y)),h=v-(I=(k=GI(k,qI(C,v)))-v)*R/B,m=qI(m=y-(E=M-y)*R/B,GI(p,y)),h=qI(h,GI(c,v)),M=y+(E=y-(m=GI(m,qI(p,y))))*B/R,k=v+(I=v-(h=GI(h,qI(c,v))))*B/R}e.bezierCurveTo(d,u,m,h,y,v),d=M,u=k}else e.lineTo(y,v)}p=y,c=v,g+=r}return f}var jI=function(){this.smooth=0,this.smoothConstraint=!0},HI=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polyline",n}return Qe(t,e),t.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},t.prototype.getDefaultShape=function(){return new jI},t.prototype.buildPath=function(e,t){var n=t.points,i=0,a=n.length/2;if(t.connectNulls){for(;a>0&&zI(n[2*a-2],n[2*a-1]);a--);for(;i=0){var f=o?(c-i)*g+i:(p-n)*g+n;return o?[e,f]:[f,e]}n=p,i=c;break;case r.C:p=a[l++],c=a[l++],d=a[l++],u=a[l++],m=a[l++],h=a[l++];var y=o?El(n,p,d,m,e,s):El(i,c,u,h,e,s);if(y>0)for(var v=0;v=0){f=o?_l(i,c,u,h,x):_l(n,p,d,m,x);return o?[e,f]:[f,e]}}n=m,i=h}}},t}(km),WI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t}(jI),$I=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polygon",n}return Qe(t,e),t.prototype.getDefaultShape=function(){return new WI},t.prototype.buildPath=function(e,t){var n=t.points,i=t.stackedOnPoints,a=0,r=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;r>0&&zI(n[2*r-2],n[2*r-1]);r--);for(;a=0;o--){var s=e.getDimensionInfo(i[o].dimension);if("x"===(a=s&&s.coordDim)||"y"===a){r=i[o];break}}if(r){var l=t.getAxis(a),p=Xr(r.stops,(function(e){return{coord:l.toGlobalCoord(l.dataToCoord(e.value)),color:e.color}})),c=p.length,d=r.outerColors.slice();c&&p[0].coord>p[c-1].coord&&(p.reverse(),d.reverse());var u=function(e,t){var n,i,a=[],r=e.length;function o(e,t,n){var i=e.coord;return{coord:n,color:rp((n-i)/(t.coord-i),[e.color,t.color])}}for(var s=0;st){i?a.push(o(i,l,t)):n&&a.push(o(n,l,0),o(n,l,t));break}n&&(a.push(o(n,l,0)),n=null),a.push(l),i=l}}return a}(p,"x"===a?n.getWidth():n.getHeight()),m=u.length;if(!m&&c)return p[0].coord<0?d[1]?d[1]:p[c-1].color:d[0]?d[0]:p[0].color;var h=u[0].coord-10,g=u[m-1].coord+10,f=g-h;if(f<.001)return"transparent";Yr(u,(function(e){e.offset=(e.coord-h)/f})),u.push({offset:m?u[m-1].offset:.5,color:d[1]||"transparent"}),u.unshift({offset:m?u[0].offset:.5,color:d[0]||"transparent"});var y=new af(0,0,0,0,u,!0);return y[a]=h,y[a+"2"]=g,y}}}function aM(e,t,n){var i=e.get("showAllSymbol"),a="auto"===i;if(!i||a){var r=n.getAxesByScale("ordinal")[0];if(r&&(!a||!function(e,t){var n=e.getExtent(),i=Math.abs(n[1]-n[0])/e.scale.count();isNaN(i)&&(i=0);for(var a=t.count(),r=Math.max(1,Math.round(a/5)),o=0;oi)return!1;return!0}(r,t))){var o=t.mapDimension(r.dim),s={};return Yr(r.getViewLabels(),(function(e){var t=r.scale.getRawOrdinalNumber(e.tickValue);s[t]=1})),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function rM(e,t){return[e[2*t],e[2*t+1]]}function oM(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&"bolder"===e.get(["emphasis","lineStyle","width"]))&&(m.getState("emphasis").style.lineWidth=+m.style.lineWidth+1);ih(m).seriesIndex=e.seriesIndex,Wh(m,P,D,A);var O=tM(e.get("smooth")),R=e.get("smoothMonotone");if(m.setShape({smooth:O,smoothMonotone:R,connectNulls:S}),h){var B=o.getCalculationInfo("stackedOnSeries"),F=0;h.useStyle(jr(l.getAreaStyle(),{fill:I,opacity:.7,lineJoin:"bevel",decal:o.getVisual("style").decal})),B&&(F=tM(B.get("smooth"))),h.setShape({smooth:O,stackedOnSmooth:F,smoothMonotone:R,connectNulls:S}),Xh(h,e,"areaStyle"),ih(h).seriesIndex=e.seriesIndex,Wh(h,P,D,A)}var N=function(e){i._changePolyState(e)};o.eachItemGraphicEl((function(e){e&&(e.onHoverStateChange=N)})),this._polyline.onHoverStateChange=N,this._data=o,this._coordSys=a,this._stackedOnPoints=b,this._points=p,this._step=E,this._valueOrigin=v,e.get("triggerLineEvent")&&(this.packEventData(e,m),h&&this.packEventData(e,h))},t.prototype.packEventData=function(e,t){ih(t).eventData={componentType:"series",componentSubType:"line",componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:"line"}},t.prototype.highlight=function(e,t,n,i){var a=e.getData(),r=Fd(a,i);if(this._changePolyState("emphasis"),!(r instanceof Array)&&null!=r&&r>=0){var o=a.getLayout("points"),s=a.getItemGraphicEl(r);if(!s){var l=o[2*r],p=o[2*r+1];if(isNaN(l)||isNaN(p))return;if(this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(l,p))return;var c=e.get("zlevel")||0,d=e.get("z")||0;(s=new AI(a,r)).x=l,s.y=p,s.setZ(c,d);var u=s.getSymbolPath().getTextContent();u&&(u.zlevel=c,u.z=d,u.z2=this._polyline.z2+1),s.__temp=!0,a.setItemGraphicEl(r,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else Aw.prototype.highlight.call(this,e,t,n,i)},t.prototype.downplay=function(e,t,n,i){var a=e.getData(),r=Fd(a,i);if(this._changePolyState("normal"),null!=r&&r>=0){var o=a.getItemGraphicEl(r);o&&(o.__temp?(a.setItemGraphicEl(r,null),this.group.remove(o)):o.downplay())}else Aw.prototype.downplay.call(this,e,t,n,i)},t.prototype._changePolyState=function(e){var t=this._polygon;Ih(this._polyline,e),t&&Ih(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new HI({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new $I({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var i,a,r=t.getBaseAxis(),o=r.inverse;"cartesian2d"===t.type?(i=r.isHorizontal(),a=!1):"polar"===t.type&&(i="angle"===r.dim,a=!0);var s=e.hostModel,l=s.get("animationDuration");ao(l)&&(l=l(null));var p=s.get("animationDelay")||0,c=ao(p)?p(null):p;e.eachItemGraphicEl((function(e,r){var s=e;if(s){var d=[e.x,e.y],u=void 0,m=void 0,h=void 0;if(n)if(a){var g=n,f=t.pointToCoord(d);i?(u=g.startAngle,m=g.endAngle,h=-f[1]/180*Math.PI):(u=g.r0,m=g.r,h=f[0])}else{var y=n;i?(u=y.x,m=y.x+y.width,h=e.x):(u=y.y+y.height,m=y.y,h=e.y)}var v=m===u?0:(h-u)/(m-u);o&&(v=1-v);var x=ao(p)?p(r):l*v+c,b=s.getSymbolPath(),w=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:x}),w&&w.animateFrom({style:{opacity:0}},{duration:300,delay:x}),b.disableLabelAnimation=!0}}))},t.prototype._initOrUpdateEndLabel=function(e,t,n){var i=e.getModel("endLabel");if(oM(e)){var a=e.getData(),r=this._polyline,o=a.getLayout("points");if(!o)return r.removeTextContent(),void(this._endLabel=null);var s=this._endLabel;s||((s=this._endLabel=new jm({z2:200})).ignoreClip=!0,r.setTextContent(this._endLabel),r.disableLabelAnimation=!0);var l=function(e){for(var t,n,i=e.length/2;i>0&&(t=e[2*i-2],n=e[2*i-1],isNaN(t)||isNaN(n));i--);return i-1}(o);l>=0&&(ny(r,iy(e,"endLabel"),{inheritColor:n,labelFetcher:e,labelDataIndex:l,defaultText:function(e,t,n){return null!=n?DI(a,n):PI(a,e)},enableTextSetter:!0},function(e,t){var n=t.getBaseAxis(),i=n.isHorizontal(),a=n.inverse,r=i?a?"right":"left":"center",o=i?"middle":a?"top":"bottom";return{normal:{align:e.get("align")||r,verticalAlign:e.get("verticalAlign")||o}}}(i,t)),r.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(e,t,n,i,a,r,o){var s=this._endLabel,l=this._polyline;if(s){e<1&&null==i.originalX&&(i.originalX=s.x,i.originalY=s.y);var p=n.getLayout("points"),c=n.hostModel,d=c.get("connectNulls"),u=r.get("precision"),m=r.get("distance")||0,h=o.getBaseAxis(),g=h.isHorizontal(),f=h.inverse,y=t.shape,v=f?g?y.x:y.y+y.height:g?y.x+y.width:y.y,x=(g?m:0)*(f?-1:1),b=(g?0:-m)*(f?-1:1),w=g?"x":"y",S=function(e,t,n){for(var i,a,r=e.length/2,o="x"===n?0:1,s=0,l=-1,p=0;p=t||i>=t&&a<=t){l=p;break}s=p,i=a}else i=a;return{range:[s,l],t:(t-i)/(a-i)}}(p,v,w),C=S.range,_=C[1]-C[0],T=void 0;if(_>=1){if(_>1&&!d){var E=rM(p,C[0]);s.attr({x:E[0]+x,y:E[1]+b}),a&&(T=c.getRawValue(C[0]))}else{(E=l.getPointOn(v,w))&&s.attr({x:E[0]+x,y:E[1]+b});var I=c.getRawValue(C[0]),M=c.getRawValue(C[1]);a&&(T=Wd(n,u,I,M,S.t))}i.lastFrameIndex=C[0]}else{var k=1===e||i.lastFrameIndex>0?C[0]:0;E=rM(p,k);a&&(T=c.getRawValue(k)),s.attr({x:E[0]+x,y:E[1]+b})}if(a){var P=dy(s);"function"==typeof P.setLabelText&&P.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,i,a,r,o){var s=this._polyline,l=this._polygon,p=e.hostModel,c=function(e,t,n,i,a,r,o){for(var s=function(e,t){var n=[];return t.diff(e).add((function(e){n.push({cmd:"+",idx:e})})).update((function(e,t){n.push({cmd:"=",idx:t,idx1:e})})).remove((function(e){n.push({cmd:"-",idx:e})})).execute(),n}(e,t),l=[],p=[],c=[],d=[],u=[],m=[],h=[],g=LI(a,t,o),f=e.getLayout("points")||[],y=t.getLayout("points")||[],v=0;v3e3||l&&eM(u,h)>3e3)return s.stopAnimation(),s.setShape({points:m}),void(l&&(l.stopAnimation(),l.setShape({points:m,stackedOnPoints:h})));s.shape.__points=c.current,s.shape.points=d;var g={shape:{points:m}};c.current!==d&&(g.shape.__points=c.next),s.stopAnimation(),ff(s,g,p),l&&(l.setShape({points:d,stackedOnPoints:u}),l.stopAnimation(),ff(l,{shape:{stackedOnPoints:h}},p),s.shape.points!==l.shape.points&&(l.shape.points=s.shape.points));for(var f=[],y=c.status,v=0;vt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;nt&&(t=r,n=a)}return isFinite(n)?n:NaN},nearest:function(e){return e[0]}},dM=function(e){return Math.round(e.length/2)};function uM(e){return{seriesType:e,reset:function(e,t,n){var i=e.getData(),a=e.get("sampling"),r=e.coordinateSystem,o=i.count();if(o>10&&"cartesian2d"===r.type&&a){var s=r.getBaseAxis(),l=r.getOtherAxis(s),p=s.getExtent(),c=n.getDevicePixelRatio(),d=Math.abs(p[1]-p[0])*(c||1),u=Math.round(o/d);if(isFinite(u)&&u>1){"lttb"===a&&e.setData(i.lttbDownSample(i.mapDimension(l.dim),1/u));var m=void 0;ro(a)?m=cM[a]:ao(a)&&(m=a),m&&e.setData(i.downSample(i.mapDimension(l.dim),1/u,m,dM))}}}}}function mM(e){e.registerChartView(lM),e.registerSeriesModel(kI),e.registerLayout(pM("line",!0)),e.registerVisual({seriesType:"line",reset:function(e){var t=e.getData(),n=e.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual("style").fill),t.setVisual("legendLineStyle",n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,uM("line"))}var hM=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.getInitialData=function(e,t){return lT(null,this,{useEncodeDefaulter:!0})},t.prototype.getMarkerPosition=function(e,t,n){var i=this.coordinateSystem;if(i&&i.clampData){var a=i.clampData(e),r=i.dataToPoint(a);if(n)Yr(i.getAxes(),(function(e,n){if("category"===e.type&&null!=t){var i=e.getTicksCoords(),o=e.getTickModel().get("alignWithLabel"),s=a[n],l="x1"===t[n]||"y1"===t[n];if(l&&!o&&(s+=1),i.length<2)return;if(2===i.length)return void(r[n]=e.toGlobalCoord(e.getExtent()[l?1:0]));for(var p=void 0,c=void 0,d=1,u=0;us){c=(m+p)/2;break}1===u&&(d=h-i[0].tickValue)}null==c&&(p?p&&(c=i[i.length-1].coord):c=i[0].coord),r[n]=e.toGlobalCoord(c)}}));else{var o=this.getData(),s=o.getLayout("offset"),l=o.getLayout("size"),p=i.getBaseAxis().isHorizontal()?0:1;r[p]+=s+l/2}return r}return[NaN,NaN]},t.type="series.__base_bar__",t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},t}(bw);bw.registerClass(hM);var gM=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.getInitialData=function(){return lT(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},t.prototype.getProgressive=function(){return!!this.get("large")&&this.get("progressive")},t.prototype.getProgressiveThreshold=function(){var e=this.get("progressiveThreshold"),t=this.get("largeThreshold");return t>e&&(e=t),e},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type="series.bar",t.dependencies=["grid","polar"],t.defaultOption=ky(hM.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),t}(hM),fM=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},yM=function(e){function t(t){var n=e.call(this,t)||this;return n.type="sausage",n}return Qe(t,e),t.prototype.getDefaultShape=function(){return new fM},t.prototype.buildPath=function(e,t){var n=t.cx,i=t.cy,a=Math.max(t.r0||0,0),r=Math.max(t.r,0),o=.5*(r-a),s=a+o,l=t.startAngle,p=t.endAngle,c=t.clockwise,d=2*Math.PI,u=c?p-lr)return!0;r=p}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,i=n.getExtent(),a=Math.max(0,i[0]),r=Math.min(i[1],n.getOrdinalMeta().categories.length-1);a<=r;++a)if(e.ordinalNumbers[a]!==n.getRawOrdinalNumber(a))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,i){if(this._isOrderChangedWithinSameData(e,t,n)){var a=this._dataSort(e,n,t);this._isOrderDifferentInView(a,n)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",axisId:n.index,sortInfo:a}))}},t.prototype._dispatchInitSort=function(e,t,n){var i=t.baseAxis,a=this._dataSort(e,i,(function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)}));n.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:a})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&(e.getZr().off("rendered",this._onRendered),this._onRendered=null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl((function(t){wf(t,e,ih(t).dataIndex)}))):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type="bar",t}(Aw),_M={cartesian2d:function(e,t){var n=t.width<0?-1:1,i=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),i<0&&(t.y+=t.height,t.height=-t.height);var a=e.x+e.width,r=e.y+e.height,o=wM(t.x,e.x),s=SM(t.x+t.width,a),l=wM(t.y,e.y),p=SM(t.y+t.height,r),c=sa?s:o,t.y=d&&l>r?p:l,t.width=c?0:s-o,t.height=d?0:p-l,n<0&&(t.x+=t.width,t.width=-t.width),i<0&&(t.y+=t.height,t.height=-t.height),c||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var i=t.r;t.r=t.r0,t.r0=i}var a=SM(t.r,e.r),r=wM(t.r0,e.r0);t.r=a,t.r0=r;var o=a-r<0;if(n<0){i=t.r;t.r=t.r0,t.r0=i}return o}},TM={cartesian2d:function(e,t,n,i,a,r,o,s,l){var p=new Gm({shape:Ur({},i),z2:1});(p.__dataIndex=n,p.name="item",r)&&(p.shape[a?"height":"width"]=0);return p},polar:function(e,t,n,i,a,r,o,s,l){var p=!a&&l?yM:Lg,c=new p({shape:i,z2:1});c.name="item";var d,u,m=AM(a);if(c.calculateTextPosition=(d=m,u=({isRoundCap:p===yM}||{}).isRoundCap,function(e,t,n){var i=t.position;if(!i||i instanceof Array)return Dc(e,t,n);var a=d(i),r=null!=t.distance?t.distance:5,o=this.shape,s=o.cx,l=o.cy,p=o.r,c=o.r0,m=(p+c)/2,h=o.startAngle,g=o.endAngle,f=(h+g)/2,y=u?Math.abs(p-c)/2:0,v=Math.cos,x=Math.sin,b=s+p*v(h),w=l+p*x(h),S="left",C="top";switch(a){case"startArc":b=s+(c-r)*v(f),w=l+(c-r)*x(f),S="center",C="top";break;case"insideStartArc":b=s+(c+r)*v(f),w=l+(c+r)*x(f),S="center",C="bottom";break;case"startAngle":b=s+m*v(h)+vM(h,r+y,!1),w=l+m*x(h)+xM(h,r+y,!1),S="right",C="middle";break;case"insideStartAngle":b=s+m*v(h)+vM(h,-r+y,!1),w=l+m*x(h)+xM(h,-r+y,!1),S="left",C="middle";break;case"middle":b=s+m*v(f),w=l+m*x(f),S="center",C="middle";break;case"endArc":b=s+(p+r)*v(f),w=l+(p+r)*x(f),S="center",C="bottom";break;case"insideEndArc":b=s+(p-r)*v(f),w=l+(p-r)*x(f),S="center",C="top";break;case"endAngle":b=s+m*v(g)+vM(g,r+y,!0),w=l+m*x(g)+xM(g,r+y,!0),S="left",C="middle";break;case"insideEndAngle":b=s+m*v(g)+vM(g,-r+y,!0),w=l+m*x(g)+xM(g,-r+y,!0),S="right",C="middle";break;default:return Dc(e,t,n)}return(e=e||{}).x=b,e.y=w,e.align=S,e.verticalAlign=C,e}),r){var h=a?"r":"endAngle",g={};c.shape[h]=a?i.r0:i.startAngle,g[h]=i[h],(s?ff:yf)(c,{shape:g},r)}return c}};function EM(e,t,n,i,a,r,o,s){var l,p;r?(p={x:i.x,width:i.width},l={y:i.y,height:i.height}):(p={y:i.y,height:i.height},l={x:i.x,width:i.width}),s||(o?ff:yf)(n,{shape:l},t,a,null),(o?ff:yf)(n,{shape:p},t?e.baseAxis.model:null,a)}function IM(e,t){for(var n=0;n0?1:-1,o=i.height>0?1:-1;return{x:i.x+r*a/2,y:i.y+o*a/2,width:i.width-r*a,height:i.height-o*a}},polar:function(e,t,n){var i=e.getItemLayout(t);return{cx:i.cx,cy:i.cy,r0:i.r0,r:i.r,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}}};function AM(e){return function(e){var t=e?"Arc":"Angle";return function(e){switch(e){case"start":case"insideStart":case"end":case"insideEnd":return e+t;default:return e}}}(e)}function OM(e,t,n,i,a,r,o,s){var l=t.getItemVisual(n,"style");if(s){if(!r.get("roundCap")){var p=e.shape;Ur(p,bM(i.getModel("itemStyle"),p,!0)),e.setShape(p)}}else{var c=i.get(["itemStyle","borderRadius"])||0;e.setShape("r",c)}e.useStyle(l);var d=i.getShallow("cursor");d&&e.attr("cursor",d);var u=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?a.height>=0?"bottom":"top":a.width>=0?"right":"left",m=iy(i);ny(e,m,{labelFetcher:r,labelDataIndex:n,defaultText:PI(r.getData(),n),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:u});var h=e.getTextContent();if(s&&h){var g=i.get(["label","position"]);e.textConfig.inside="middle"===g||null,function(e,t,n,i){if(so(i))e.setTextConfig({rotation:i});else if(io(t))e.setTextConfig({rotation:0});else{var a,r=e.shape,o=r.clockwise?r.startAngle:r.endAngle,s=r.clockwise?r.endAngle:r.startAngle,l=(o+s)/2,p=n(t);switch(p){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":a=l;break;case"startAngle":case"insideStartAngle":a=o;break;case"endAngle":case"insideEndAngle":a=s;break;default:return void e.setTextConfig({rotation:0})}var c=1.5*Math.PI-a;"middle"===p&&c>Math.PI/2&&c<1.5*Math.PI&&(c-=Math.PI),e.setTextConfig({rotation:c})}}(e,"outside"===g?u:g,AM(o),i.get(["label","rotate"]))}uy(h,m,r.getRawValue(n),(function(e){return DI(t,e)}));var f=i.getModel(["emphasis"]);Wh(e,f.get("focus"),f.get("blurScope"),f.get("disabled")),Xh(e,i),function(e){return null!=e.startAngle&&null!=e.endAngle&&e.startAngle===e.endAngle}(a)&&(e.style.fill="none",e.style.stroke="none",Yr(e.states,(function(e){e.style&&(e.style.fill=e.style.stroke="none")})))}var RM=function(){},BM=function(e){function t(t){var n=e.call(this,t)||this;return n.type="largeBar",n}return Qe(t,e),t.prototype.getDefaultShape=function(){return new RM},t.prototype.buildPath=function(e,t){for(var n=t.points,i=this.baseDimIdx,a=1-this.baseDimIdx,r=[],o=[],s=this.barWidth,l=0;l=s[0]&&t<=s[0]+l[0]&&n>=s[1]&&n<=s[1]+l[1])return o[c]}return-1}(this,e.offsetX,e.offsetY);ih(this).dataIndex=t>=0?t:null}),30,!1);function LM(e,t,n){if(ZI(n,"cartesian2d")){var i=t,a=n.getArea();return{x:e?i.x:a.x,y:e?a.y:i.y,width:e?i.width:a.width,height:e?a.height:i.height}}var r=t;return{cx:(a=n.getArea()).cx,cy:a.cy,r0:e?a.r0:r.r0,r:e?a.r:r.r,startAngle:e?r.startAngle:0,endAngle:e?r.endAngle:2*Math.PI}}function VM(e){e.registerChartView(CM),e.registerSeriesModel(gM),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,no(OT,"bar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,RT("bar")),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,uM("bar")),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},(function(e,t){var n=e.componentType||"series";t.eachComponent({mainType:n,query:e},(function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)}))}))}var qM=2*Math.PI,GM=Math.PI/180;function zM(e,t){return kv(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()})}function UM(e,t){var n=zM(e,t),i=e.get("center"),a=e.get("radius");io(a)||(a=[0,a]);var r,o,s=Jc(n.width,t.getWidth()),l=Jc(n.height,t.getHeight()),p=Math.min(s,l),c=Jc(a[0],p/2),d=Jc(a[1],p/2),u=e.coordinateSystem;if(u){var m=u.dataToPoint(i);r=m[0]||0,o=m[1]||0}else io(i)||(i=[i,i]),r=Jc(i[0],s)+n.x,o=Jc(i[1],l)+n.y;return{cx:r,cy:o,r0:c,r:d}}function jM(e,t,n){t.eachSeriesByType(e,(function(e){var t=e.getData(),i=t.mapDimension("value"),a=zM(e,n),r=UM(e,n),o=r.cx,s=r.cy,l=r.r,p=r.r0,c=-e.get("startAngle")*GM,d=e.get("endAngle"),u=e.get("padAngle")*GM;d="auto"===d?c-qM:-d*GM;var m=e.get("minAngle")*GM+u,h=0;t.each(i,(function(e){!isNaN(e)&&h++}));var g=t.getSum(i),f=Math.PI/(g||h)*2,y=e.get("clockwise"),v=e.get("roseType"),x=e.get("stillShowZeroSum"),b=t.getDataExtent(i);b[0]=0;var w=y?1:-1,S=[c,d],C=w*u/2;lm(S,!y),c=S[0],d=S[1];var _=Math.abs(d-c),T=_,E=0,I=c;if(t.setLayout({viewRect:a,r:l}),t.each(i,(function(e,n){var i;if(isNaN(e))t.setItemLayout(n,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:y,cx:o,cy:s,r0:p,r:v?NaN:l});else{(i="area"!==v?0===g&&x?f:e*f:_/h)i?c=r=I+w*i/2:(r=I+C,c=a-C),t.setItemLayout(n,{angle:i,startAngle:r,endAngle:c,clockwise:y,cx:o,cy:s,r0:p,r:v?Qc(e,b,[p,l]):l}),I=a}})),Tn?o:r,c=Math.abs(l.label.y-n);if(c>=p.maxY){var d=l.label.x-t-l.len2*a,u=i+l.len,h=Math.abs(d)e.unconstrainedWidth?null:m:null;i.setStyle("width",h)}var g=i.getBoundingRect();r.width=g.width;var f=(i.style.margin||0)+2.1;r.height=g.height+f,r.y-=(r.height-d)/2}}}function YM(e){return"center"===e.position}function XM(e){var t,n,i=e.getData(),a=[],r=!1,o=(e.get("minShowLabelAngle")||0)*WM,s=i.getLayout("viewRect"),l=i.getLayout("r"),p=s.width,c=s.x,d=s.y,u=s.height;function m(e){e.ignore=!0}i.each((function(e){var s=i.getItemGraphicEl(e),d=s.shape,u=s.getTextContent(),h=s.getTextGuideLine(),g=i.getItemModel(e),f=g.getModel("label"),y=f.get("position")||g.get(["emphasis","label","position"]),v=f.get("distanceToLabelLine"),x=f.get("alignTo"),b=Jc(f.get("edgeDistance"),p),w=f.get("bleedMargin"),S=g.getModel("labelLine"),C=S.get("length");C=Jc(C,p);var _=S.get("length2");if(_=Jc(_,p),Math.abs(d.endAngle-d.startAngle)0?"right":"left":P>0?"left":"right"}var L=Math.PI,V=0,q=f.get("rotate");if(so(q))V=q*(L/180);else if("center"===y)V=0;else if("radial"===q||!0===q){V=P<0?-k+L:-k}else if("tangential"===q&&"outside"!==y&&"outer"!==y){var G=Math.atan2(P,D);G<0&&(G=2*L+G),D>0&&(G=L+G),V=G-L}if(r=!!V,u.x=T,u.y=E,u.rotation=V,u.setStyle({verticalAlign:"middle"}),A){u.setStyle({align:M});var z=u.states.select;z&&(z.x+=u.x,z.y+=u.y)}else{var U=u.getBoundingRect().clone();U.applyTransform(u.getComputedTransform());var j=(u.style.margin||0)+2.1;U.y-=j/2,U.height+=j,a.push({label:u,labelLine:h,position:y,len:C,len2:_,minTurnAngle:S.get("minTurnAngle"),maxSurfaceAngle:S.get("maxSurfaceAngle"),surfaceNormal:new Bs(P,D),linePoints:I,textAlign:M,labelDistance:v,labelAlignTo:x,edgeDistance:b,bleedMargin:w,rect:U,unconstrainedWidth:U.width,labelStyleWidth:u.style.width})}s.setTextConfig({inside:A})}})),!r&&e.get("avoidLabelOverlap")&&function(e,t,n,i,a,r,o,s){for(var l=[],p=[],c=Number.MAX_VALUE,d=-Number.MAX_VALUE,u=0;u0){for(var l=r.getItemLayout(0),p=1;isNaN(l&&l.startAngle)&&p=n.r0}},t.type="pie",t}(Aw);function JM(e,t,n){t=io(t)&&{coordDimensions:t}||Ur({encodeDefine:e.getEncode()},t);var i=e.getSource(),a=eT(i,t).dimensions,r=new J_(a,e);return r.initData(i,n),r}var ek=function(){function e(e,t){this._getDataWithEncodedVisual=e,this._getRawData=t}return e.prototype.getAllNames=function(){var e=this._getRawData();return e.mapArray(e.getName)},e.prototype.containName=function(e){return this._getRawData().indexOfName(e)>=0},e.prototype.indexOfName=function(e){return this._getDataWithEncodedVisual().indexOfName(e)},e.prototype.getItemVisual=function(e,t){return this._getDataWithEncodedVisual().getItemVisual(e,t)},e}(),tk=Nd(),nk=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new ek(to(this.getData,this),to(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return JM(this,{coordDimensions:["value"],encodeDefaulter:no(ex,this)})},t.prototype.getDataParams=function(t){var n=this.getData(),i=tk(n),a=i.seats;if(!a){var r=[];n.each(n.mapDimension("value"),(function(e){r.push(e)})),a=i.seats=rd(r,n.hostModel.get("percentPrecision"))}var o=e.prototype.getDataParams.call(this,t);return o.percent=a[t]||0,o.$vars.push("percent"),o},t.prototype._defaultLabelLine=function(e){Ed(e,"labelLine",["show"]);var t=e.labelLine,n=e.emphasis.labelLine;t.show=t.show&&e.label.show,n.show=n.show&&e.emphasis.label.show},t.type="series.pie",t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",bleedMargin:10,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:15,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},t}(bw);function ik(e){e.registerChartView(QM),e.registerSeriesModel(nk),PS("pie",e.registerAction),e.registerLayout(no(jM,"pie")),e.registerProcessor(HM("pie")),e.registerProcessor(function(e){return{seriesType:e,reset:function(e,t){var n=e.getData();n.filterSelf((function(e){var t=n.mapDimension("value"),i=n.get(t,e);return!(so(i)&&!isNaN(i)&&i<0)}))}}}("pie"))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}Qe(t,e),t.prototype.getInitialData=function(e,t){return lT(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){var e=this.option.progressive;return null==e?this.option.large?5e3:this.get("progressive"):e},t.prototype.getProgressiveThreshold=function(){var e=this.option.progressiveThreshold;return null==e?this.option.large?1e4:this.get("progressiveThreshold"):e},t.prototype.brushSelector=function(e,t,n){return n.point(t.getItemLayout(e))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},t.type="series.scatter",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}}}(bw);var ak=function(){},rk=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return Qe(t,e),t.prototype.getDefaultShape=function(){return new ak},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.buildPath=function(e,t){var n,i=t.points,a=t.size,r=this.symbolProxy,o=r.shape,s=e.getContext?e.getContext():e,l=s&&a[0]<4,p=this.softClipShape;if(l)this._ctx=s;else{for(this._ctx=null,n=this._off;n=0;s--){var l=2*s,p=i[l]-r/2,c=i[l+1]-o/2;if(e>=p&&t>=c&&e<=p+r&&t<=c+o)return s}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),i=this.getBoundingRect();return e=n[0],t=n[1],i.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape,n=t.points,i=t.size,a=i[0],r=i[1],o=1/0,s=1/0,l=-1/0,p=-1/0,c=0;c=0&&(l.dataIndex=n+(e.startIndex||0))}))},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),sk=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.render=function(e,t,n){var i=e.getData();this._updateSymbolDraw(i,e).updateData(i,{clipShape:this._getClipShape(e)}),this._finished=!0},t.prototype.incrementalPrepareRender=function(e,t,n){var i=e.getData();this._updateSymbolDraw(i,e).incrementalPrepareUpdate(i),this._finished=!1},t.prototype.incrementalRender=function(e,t,n){this._symbolDraw.incrementalUpdate(e,t.getData(),{clipShape:this._getClipShape(t)}),this._finished=e.end===t.getData().count()},t.prototype.updateTransform=function(e,t,n){var i=e.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var a=pM("").reset(e,t,n);a.progress&&a.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},t.prototype.eachRendered=function(e){this._symbolDraw&&this._symbolDraw.eachRendered(e)},t.prototype._getClipShape=function(e){if(e.get("clip",!0)){var t=e.coordinateSystem;return t&&t.getArea&&t.getArea(.1)}},t.prototype._updateSymbolDraw=function(e,t){var n=this._symbolDraw,i=t.pipelineContext.large;return n&&i===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=i?new ok:new NI,this._isLargeDraw=i,this.group.removeAll()),this.group.add(n.group),n},t.prototype.remove=function(e,t){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter"}(Aw),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.type="grid",t.dependencies=["xAxis","yAxis"],t.layoutMode="box",t.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},t}(Fv)),lk=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Gd).models[0]},t.type="cartesian2dAxis",t}(Fv);$r(lk,gE);var pk={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},ck=Gr({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},pk),dk=Gr({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},pk),uk={category:ck,value:dk,time:Gr({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},dk),log:jr({logBase:10},dk)},mk={value:1,category:1,time:1,log:1};function hk(e,t,n,i){Yr(mk,(function(a,r){var o=Gr(Gr({},uk[r],!0),i,!0),s=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t+"Axis."+r,n}return Qe(n,e),n.prototype.mergeDefaultAndTheme=function(e,t){var n=Dv(this),i=n?Ov(e):{};Gr(e,t.getTheme().get(r+"Axis")),Gr(e,this.getDefaultOption()),e.type=gk(e),n&&Av(e,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=dT.createByAxisModel(this))},n.prototype.getCategories=function(e){var t=this.option;if("category"===t.type)return e?t.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.prototype.getTicksGenerator=function(){var e=this.option;if("value"===e.type)return e.ticksGenerator},n.type=t+"Axis."+r,n.defaultOption=o,n}(n);e.registerComponentModel(s)})),e.registerSubTypeDefaulter(t+"Axis",gk)}function gk(e){return e.type||(e.data?"category":"value")}var fk=function(){function e(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return Xr(this._dimList,(function(e){return this._axes[e]}),this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Qr(this.getAxes(),(function(t){return t.scale.type===e}))},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),yk=["x","y"];function vk(e){return"interval"===e.type||"time"===e.type}var xk=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=yk,t}return Qe(t,e),t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis("x").scale,t=this.getAxis("y").scale;if(vk(e)&&vk(t)){var n=e.getExtent(),i=t.getExtent(),a=this.dataToPoint([n[0],i[0]]),r=this.dataToPoint([n[1],i[1]]),o=n[1]-n[0],s=i[1]-i[0];if(o&&s){var l=(r[0]-a[0])/o,p=(r[1]-a[1])/s,c=a[0]-n[0]*l,d=a[1]-i[0]*p,u=this._transform=[l,0,0,p,c,d];this._invTransform=Os([],u)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},t.prototype.containPoint=function(e){var t=this.getAxis("x"),n=this.getAxis("y");return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis("x").containData(e[0])&&this.getAxis("y").containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),i=this.dataToPoint(t),a=this.getArea(),r=new js(n[0],n[1],i[0]-n[0],i[1]-n[1]);return a.intersect(r)},t.prototype.dataToPoint=function(e,t,n){n=n||[];var i=e[0],a=e[1];if(this._transform&&null!=i&&isFinite(i)&&null!=a&&isFinite(a))return Qo(n,e,this._transform);var r=this.getAxis("x"),o=this.getAxis("y");return n[0]=r.toGlobalCoord(r.dataToCoord(i,t)),n[1]=o.toGlobalCoord(o.dataToCoord(a,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,a=n.getExtent(),r=i.getExtent(),o=n.parse(e[0]),s=i.parse(e[1]);return(t=t||[])[0]=Math.min(Math.max(Math.min(a[0],a[1]),o),Math.max(a[0],a[1])),t[1]=Math.min(Math.max(Math.min(r[0],r[1]),s),Math.max(r[0],r[1])),t},t.prototype.pointToData=function(e,t){var n=[];if(this._invTransform)return Qo(n,e,this._invTransform);var i=this.getAxis("x"),a=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(e[0]),t),n[1]=a.coordToData(a.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis("x"===e.dim?"y":"x")},t.prototype.getArea=function(e){e=e||0;var t=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(t[0],t[1])-e,a=Math.min(n[0],n[1])-e,r=Math.max(t[0],t[1])-i+e,o=Math.max(n[0],n[1])-a+e;return new js(i,a,r,o)},t}(fk),bk=function(e){function t(t,n,i,a,r){var o=e.call(this,t,n,i)||this;return o.index=0,o.type=a||"value",o.position=r||"bottom",o}return Qe(t,e),t.prototype.isHorizontal=function(){var e=this.position;return"top"===e||"bottom"===e},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e["x"===this.dim?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if("category"!==this.type)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(zE);function wk(e,t,n){n=n||{};var i=e.coordinateSystem,a=t.axis,r={},o=a.getAxesOnZeroOf()[0],s=a.position,l=o?"onZero":s,p=a.dim,c=i.getRect(),d=[c.x,c.x+c.width,c.y,c.y+c.height],u={left:0,right:1,top:0,bottom:1,onZero:2},m=t.get("offset")||0,h="x"===p?[d[2]-m,d[3]+m]:[d[0]-m,d[1]+m];if(o){var g=o.toGlobalCoord(o.dataToCoord(0));h[u.onZero]=Math.max(Math.min(g,h[1]),h[0])}r.position=["y"===p?h[u[l]]:d[0],"x"===p?h[u[l]]:d[3]],r.rotation=Math.PI/2*("x"===p?0:1);r.labelDirection=r.tickDirection=r.nameDirection={top:-1,bottom:1,left:-1,right:1}[s],r.labelOffset=o?h[u[s]]-h[u.onZero]:0,t.get(["axisTick","inside"])&&(r.tickDirection=-r.tickDirection),yo(n.labelInside,t.get(["axisLabel","inside"]))&&(r.labelDirection=-r.labelDirection);var f=t.get(["axisLabel","rotate"]);return r.labelRotate="top"===l?-f:f,r.z2=1,r}function Sk(e){return"cartesian2d"===e.get("coordinateSystem")}function Ck(e){var t={xAxisModel:null,yAxisModel:null};return Yr(t,(function(n,i){var a=i.replace(/Model$/,""),r=e.getReferringComponents(a,Gd).models[0];t[i]=r})),t}var _k=Math.log;function Tk(e,t,n){var i=CT.prototype,a=i.getTicks.call(n),r=i.getTicks.call(n,!0),o=a.length-1,s=i.getInterval.call(n),l=oE(e,t),p=l.extent,c=l.fixMin,d=l.fixMax;if("log"===e.type){var u=_k(e.base);p=[_k(p[0])/u,_k(p[1])/u]}e.setExtent(p[0],p[1]),e.calcNiceExtent({splitNumber:o,fixMin:c,fixMax:d});var m=i.getExtent.call(e);c&&(p[0]=m[0]),d&&(p[1]=m[1]);var h=i.getInterval.call(e),g=p[0],f=p[1];if(c&&d)h=(f-g)/o;else if(c)for(f=p[0]+h*o;fp[0]&&isFinite(g)&&isFinite(p[0]);)h=gT(h),g=p[1]-h*o;else{e.getTicks().length-1>o&&(h=gT(h));var y=h*o;(g=ed((f=Math.ceil(p[1]/h)*h)-y))<0&&p[0]>=0?(g=0,f=ed(y)):f>0&&p[1]<=0&&(f=0,g=-ed(y))}var v=(a[0].value-r[0].value)/s,x=(a[o].value-r[o].value)/s;i.setExtent.call(e,g+h*v,f+h*x),i.setInterval.call(e,h),(v||x)&&i.setNiceExtent.call(e,g+h,f-h)}var Ek=function(){function e(e,t,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=yk,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;function i(e){var t,n=eo(e),i=n.length;if(i){for(var a=[],r=i-1;r>=0;r--){var o=(l=e[+n[r]]).model,s=l.scale;mT(s)&&o.get("alignTicks")&&null==o.get("interval")&&null==o.getTicksGenerator()?a.push(l):(sE(s,o),mT(s)&&!s.isBlank()&&(t=l))}if(a.length){for(;!t&&a.length;){var l;sE((l=a.pop()).scale,l.model),l.scale.isBlank()||(t=l)}a.length&&t&&Yr(a,(function(e){Tk(e.scale,e.model,t.scale)}))}}}this._updateScale(e,this.model),i(n.x),i(n.y);var a={};Yr(n.x,(function(e){Mk(n,"y",e,a)})),Yr(n.y,(function(e){Mk(n,"x",e,a)})),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var i=e.getBoxLayoutParams(),a=!n&&e.get("containLabel"),r=kv(i,{width:t.getWidth(),height:t.getHeight()});this._rect=r;var o=this._axesList;function s(){Yr(o,(function(e){var t=e.isHorizontal(),n=t?[0,r.width]:[0,r.height],i=e.inverse?1:0;e.setExtent(n[i],n[1-i]),function(e,t){var n=e.getExtent(),i=n[0]+n[1];e.toGlobalCoord="x"===e.dim?function(e){return e+t}:function(e){return i-e+t},e.toLocalCoord="x"===e.dim?function(e){return e-t}:function(e){return i-e+t}}(e,t?r.x:r.y)}))}s(),a&&(Yr(o,(function(e){if(!e.model.get(["axisLabel","inside"])){var t=function(e){var t=e.model,n=e.scale;if(t.get(["axisLabel","show"])&&!n.isBlank()){var i,a,r=n.getExtent();a=n instanceof wT?n.count():(i=n.getTicks()).length;var o,s=e.getLabelModel(),l=pE(e),p=1;a>40&&(p=Math.ceil(a/40));for(var c=0;c0&&i>0||n<0&&i<0)}(e)}var Pk=Math.PI,Dk=function(){function e(e,t){this.group=new zc,this.opt=t,this.axisModel=e,jr(t,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new zc({x:t.position[0],y:t.position[1],rotation:t.rotation});n.updateTransform(),this._transformGroup=n}return e.prototype.hasBuilder=function(e){return!!Ak[e]},e.prototype.add=function(e){Ak[e](this.opt,this.axisModel,this.group,this._transformGroup)},e.prototype.getGroup=function(){return this.group},e.innerTextLayout=function(e,t,n){var i,a,r=sd(t-e);return ld(r)?(a=n>0?"top":"bottom",i="center"):ld(r-Pk)?(a=n>0?"bottom":"top",i="center"):(a="middle",i=r>0&&r0?"right":"left":n>0?"left":"right"),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+"Index"]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||t&&t.show)},e}(),Ak={axisLine:function(e,t,n,i){var a=t.get(["axisLine","show"]);if("auto"===a&&e.handleAutoShown&&(a=e.handleAutoShown("axisLine")),a){var r=t.axis.getExtent(),o=i.transform,s=[r[0],0],l=[r[1],0],p=s[0]>l[0];o&&(Qo(s,s,o),Qo(l,l,o));var c=Ur({lineCap:"round"},t.getModel(["axisLine","lineStyle"]).getLineStyle()),d=new Kg({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:e.strokeContainThreshold||5,silent:!0,z2:1});Ff(d.shape,d.style.lineWidth),d.anid="line",n.add(d);var u=t.get(["axisLine","symbol"]);if(null!=u){var m=t.get(["axisLine","symbolSize"]);ro(u)&&(u=[u,u]),(ro(m)||so(m))&&(m=[m,m]);var h=WS(t.get(["axisLine","symbolOffset"])||0,m),g=m[0],f=m[1];Yr([{rotate:e.rotation+Math.PI/2,offset:h[0],r:0},{rotate:e.rotation-Math.PI/2,offset:h[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],(function(t,i){if("none"!==u[i]&&null!=u[i]){var a=jS(u[i],-g/2,-f/2,g,f,c.stroke,!0),r=t.r+t.offset,o=p?l:s;a.attr({rotation:t.rotate,x:o[0]+r*Math.cos(e.rotation),y:o[1]-r*Math.sin(e.rotation),silent:!0,z2:11}),n.add(a)}}))}}},axisTickLabel:function(e,t,n,i){var a=function(e,t,n,i){var a=n.axis,r=n.getModel("axisTick"),o=r.get("show");"auto"===o&&i.handleAutoShown&&(o=i.handleAutoShown("axisTick"));if(!o||a.scale.isBlank())return;for(var s=r.getModel("lineStyle"),l=i.tickDirection*r.get("length"),p=Fk(a.getTicksCoords(),t.transform,l,jr(s.getLineStyle(),{stroke:n.get(["axisLine","lineStyle","color"])}),"ticks"),c=0;cd[1]?-1:1,m=["start"===s?d[0]-u*c:"end"===s?d[1]+u*c:(d[0]+d[1])/2,Bk(s)?e.labelOffset+l*c:0],h=t.get("nameRotate");null!=h&&(h=h*Pk/180),Bk(s)?r=Dk.innerTextLayout(e.rotation,null!=h?h:e.rotation,l):(r=function(e,t,n,i){var a,r,o=sd(n-e),s=i[0]>i[1],l="start"===t&&!s||"start"!==t&&s;ld(o-Pk/2)?(r=l?"bottom":"top",a="center"):ld(o-1.5*Pk)?(r=l?"top":"bottom",a="center"):(r="middle",a=o<1.5*Pk&&o>Pk/2?l?"left":"right":l?"right":"left");return{rotation:o,textAlign:a,textVerticalAlign:r}}(e.rotation,s,h||0,d),null!=(o=e.axisNameAvailableWidth)&&(o=Math.abs(o/Math.sin(r.rotation)),!isFinite(o)&&(o=null)));var g=p.getFont(),f=t.get("nameTruncate",!0)||{},y=f.ellipsis,v=yo(e.nameTruncateMaxWidth,f.maxWidth,o),x=new jm({x:m[0],y:m[1],rotation:r.rotation,silent:Dk.isLabelSilent(t),style:ay(p,{text:a,font:g,overflow:"truncate",width:v,ellipsis:y,fill:p.getTextColor()||t.get(["axisLine","lineStyle","color"]),align:p.get("align")||r.textAlign,verticalAlign:p.get("verticalAlign")||r.textVerticalAlign}),z2:1});if(Yf({el:x,componentModel:t,itemName:a}),x.__fullText=a,x.anid="name",t.get("triggerEvent")){var b=Dk.makeAxisEventDataBase(t);b.targetType="axisName",b.name=a,ih(x).eventData=b}i.add(x),x.updateTransform(),n.add(x),x.decomposeTransform()}}};function Ok(e){e&&(e.ignore=!0)}function Rk(e,t){var n=e&&e.getBoundingRect().clone(),i=t&&t.getBoundingRect().clone();if(n&&i){var a=Is([]);return Ds(a,a,-e.rotation),n.applyTransform(ks([],a,e.getLocalTransform())),i.applyTransform(ks([],a,t.getLocalTransform())),n.intersect(i)}}function Bk(e){return"middle"===e||"center"===e}function Fk(e,t,n,i,a){for(var r=[],o=[],s=[],l=0;l=0||e===t}function Vk(e){var t=(e.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return t&&t.axesInfo[Gk(e)]}function qk(e){return!!e.get(["handle","show"])}function Gk(e){return e.type+"||"+e.id}var zk={},Uk=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.render=function(t,n,i,a){this.axisPointerClass&&function(e){var t=Vk(e);if(t){var n=t.axisPointerModel,i=t.axis.scale,a=n.option,r=n.get("status"),o=n.get("value");null!=o&&(o=i.parse(o));var s=qk(n);null==r&&(a.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==o||o>l[1])&&(o=l[1]),o0&&!d.min?d.min=0:null!=d.min&&d.min<0&&!d.max&&(d.max=0);var u=o;null!=d.color&&(u=jr({color:d.color},o));var m=Gr(qr(d),{boundaryGap:e,splitNumber:t,scale:n,axisLine:i,axisTick:a,axisLabel:r,name:d.text,showName:s,nameLocation:"end",nameGap:p,nameTextStyle:u,triggerEvent:c},!1);if(ro(l)){var h=m.name;m.name=l.replace("{value}",null!=h?h:"")}else ao(l)&&(m.name=l(m.name,m));var g=new Ey(m,null,this.ecModel);return $r(g,gE.prototype),g.mainType="radar",g.componentIndex=this.componentIndex,g}),this);this._indicatorModels=d},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type="radar",t.defaultOption={z:0,center:["50%","50%"],radius:"75%",startAngle:90,axisName:{show:!0},boundaryGap:[0,0],splitNumber:5,axisNameGap:15,scale:!1,shape:"polygon",axisLine:Gr({lineStyle:{color:"#bbb"}},lP.axisLine),axisLabel:pP(lP.axisLabel,!1),axisTick:pP(lP.axisTick,!1),splitLine:pP(lP.splitLine,!0),splitArea:pP(lP.splitArea,!0),indicator:[]},t}(Fv),dP=["axisLine","axisTickLabel","axisName"],uP=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.render=function(e,t,n){this.group.removeAll(),this._buildAxes(e),this._buildSplitLineAndArea(e)},t.prototype._buildAxes=function(e){var t=e.coordinateSystem;Yr(Xr(t.getIndicatorAxes(),(function(e){var n=e.model.get("showName")?e.name:"";return new Dk(e.model,{axisName:n,position:[t.cx,t.cy],rotation:e.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})})),(function(e){Yr(dP,e.add,e),this.group.add(e.getGroup())}),this)},t.prototype._buildSplitLineAndArea=function(e){var t=e.coordinateSystem,n=t.getIndicatorAxes();if(n.length){var i=e.get("shape"),a=e.getModel("splitLine"),r=e.getModel("splitArea"),o=a.getModel("lineStyle"),s=r.getModel("areaStyle"),l=a.get("show"),p=r.get("show"),c=o.get("color"),d=s.get("color"),u=io(c)?c:[c],m=io(d)?d:[d],h=[],g=[];if("circle"===i)for(var f=n[0].getTicksCoords(),y=t.cx,v=t.cy,x=0;x3?1.4:a>1?1.2:1.1;wP(this,"zoom","zoomOnMouseWheel",e,{scale:i>0?s:1/s,originX:r,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(i);wP(this,"scrollMove","moveOnMouseWheel",e,{scrollDelta:(i>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:r,originY:o,isAvailableBehavior:null})}}},t.prototype._pinchHandler=function(e){vP(this._zr,"globalPan")||wP(this,"zoom",null,e,{scale:e.pinchScale>1?1.1:1/1.1,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})},t}(is);function wP(e,t,n,i,a){e.pointerChecker&&e.pointerChecker(i,a.originX,a.originY)&&(Ss(i.event),SP(e,t,n,i,a))}function SP(e,t,n,i,a){a.isAvailableBehavior=to(CP,null,n,i),e.trigger(t,a)}function CP(e,t,n){var i=n[e];return!e||i&&(!ro(i)||t.event[i+"Key"])}function _P(e,t,n){var i=e.target;i.x+=t,i.y+=n,i.dirty()}function TP(e,t,n,i){var a=e.target,r=e.zoomLimit,o=e.zoom=e.zoom||1;if(o*=t,r){var s=r.min||0,l=r.max||1/0;o=Math.max(Math.min(l,o),s)}var p=o/e.zoom;e.zoom=o,a.x-=(n-a.x)*(p-1),a.y-=(i-a.y)*(p-1),a.scaleX*=p,a.scaleY*=p,a.dirty()}var EP,IP={axisPointer:1,tooltip:1,brush:1};function MP(e,t,n){var i=t.getComponentByElement(e.topTarget),a=i&&i.coordinateSystem;return i&&i!==n&&!IP.hasOwnProperty(i.mainType)&&a&&a.model!==n}function kP(e){ro(e)&&(e=(new DOMParser).parseFromString(e,"text/xml"));var t=e;for(9===t.nodeType&&(t=t.firstChild);"svg"!==t.nodeName.toLowerCase()||1!==t.nodeType;)t=t.nextSibling;return t}var PP={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-anchor":"textAlign",visibility:"visibility",display:"display"},DP=eo(PP),AP={"alignment-baseline":"textBaseline","stop-color":"stopColor"},OP=eo(AP),RP=function(){function e(){this._defs={},this._root=null}return e.prototype.parse=function(e,t){t=t||{};var n=kP(e);this._defsUsePending=[];var i=new zc;this._root=i;var a=[],r=n.getAttribute("viewBox")||"",o=parseFloat(n.getAttribute("width")||t.width),s=parseFloat(n.getAttribute("height")||t.height);isNaN(o)&&(o=null),isNaN(s)&&(s=null),qP(n,i,null,!0,!1);for(var l,p,c=n.firstChild;c;)this._parseNode(c,i,a,null,!1,!1),c=c.nextSibling;if(function(e,t){for(var n=0;n=4&&(l={x:parseFloat(d[0]||0),y:parseFloat(d[1]||0),width:parseFloat(d[2]),height:parseFloat(d[3])})}if(l&&null!=o&&null!=s&&(p=YP(l,{x:0,y:0,width:o,height:s}),!t.ignoreViewBox)){var u=i;(i=new zc).add(u),u.scaleX=u.scaleY=p.scale,u.x=p.x,u.y=p.y}return t.ignoreRootClip||null==o||null==s||i.setClipPath(new Gm({shape:{x:0,y:0,width:o,height:s}})),{root:i,width:o,height:s,viewBoxRect:l,viewBoxTransform:p,named:a}},e.prototype._parseNode=function(e,t,n,i,a,r){var o,s=e.nodeName.toLowerCase(),l=i;if("defs"===s&&(a=!0),"text"===s&&(r=!0),"defs"===s||"switch"===s)o=t;else{if(!a){var p=EP[s];if(p&&Ro(EP,s)){o=p.call(this,e,t);var c=e.getAttribute("name");if(c){var d={name:c,namedFrom:null,svgNodeTagLower:s,el:o};n.push(d),"g"===s&&(l=d)}else i&&n.push({name:i.name,namedFrom:i,svgNodeTagLower:s,el:o});t.add(o)}}var u=BP[s];if(u&&Ro(BP,s)){var m=u.call(this,e),h=e.getAttribute("id");h&&(this._defs[h]=m)}}if(o&&o.isGroup)for(var g=e.firstChild;g;)1===g.nodeType?this._parseNode(g,o,n,l,a,r):3===g.nodeType&&r&&this._parseText(g,o),g=g.nextSibling},e.prototype._parseText=function(e,t){var n=new Dm({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});LP(t,n),qP(e,n,this._defsUsePending,!1,!1),function(e,t){var n=t.__selfStyle;if(n){var i=n.textBaseline,a=i;i&&"auto"!==i?"baseline"===i?a="alphabetic":"before-edge"===i||"text-before-edge"===i?a="top":"after-edge"===i||"text-after-edge"===i?a="bottom":"central"!==i&&"mathematical"!==i||(a="middle"):a="alphabetic",e.style.textBaseline=a}var r=t.__inheritedStyle;if(r){var o=r.textAlign,s=o;o&&("middle"===o&&(s="center"),e.style.textAlign=s)}}(n,t);var i=n.style,a=i.fontSize;a&&a<9&&(i.fontSize=9,n.scaleX*=a/9,n.scaleY*=a/9);var r=(i.fontSize||i.fontFamily)&&[i.fontStyle,i.fontWeight,(i.fontSize||12)+"px",i.fontFamily||"sans-serif"].join(" ");i.font=r;var o=n.getBoundingRect();return this._textX+=o.width,t.add(n),n},e.internalField=void(EP={g:function(e,t){var n=new zc;return LP(t,n),qP(e,n,this._defsUsePending,!1,!1),n},rect:function(e,t){var n=new Gm;return LP(t,n),qP(e,n,this._defsUsePending,!1,!1),n.setShape({x:parseFloat(e.getAttribute("x")||"0"),y:parseFloat(e.getAttribute("y")||"0"),width:parseFloat(e.getAttribute("width")||"0"),height:parseFloat(e.getAttribute("height")||"0")}),n.silent=!0,n},circle:function(e,t){var n=new wg;return LP(t,n),qP(e,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),r:parseFloat(e.getAttribute("r")||"0")}),n.silent=!0,n},line:function(e,t){var n=new Kg;return LP(t,n),qP(e,n,this._defsUsePending,!1,!1),n.setShape({x1:parseFloat(e.getAttribute("x1")||"0"),y1:parseFloat(e.getAttribute("y1")||"0"),x2:parseFloat(e.getAttribute("x2")||"0"),y2:parseFloat(e.getAttribute("y2")||"0")}),n.silent=!0,n},ellipse:function(e,t){var n=new Cg;return LP(t,n),qP(e,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),rx:parseFloat(e.getAttribute("rx")||"0"),ry:parseFloat(e.getAttribute("ry")||"0")}),n.silent=!0,n},polygon:function(e,t){var n,i=e.getAttribute("points");i&&(n=VP(i));var a=new Ug({shape:{points:n||[]},silent:!0});return LP(t,a),qP(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var n,i=e.getAttribute("points");i&&(n=VP(i));var a=new Hg({shape:{points:n||[]},silent:!0});return LP(t,a),qP(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var n=new Rm;return LP(t,n),qP(e,n,this._defsUsePending,!1,!1),n.setStyle({image:e.getAttribute("xlink:href")||e.getAttribute("href"),x:+e.getAttribute("x"),y:+e.getAttribute("y"),width:+e.getAttribute("width"),height:+e.getAttribute("height")}),n.silent=!0,n},text:function(e,t){var n=e.getAttribute("x")||"0",i=e.getAttribute("y")||"0",a=e.getAttribute("dx")||"0",r=e.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(a),this._textY=parseFloat(i)+parseFloat(r);var o=new zc;return LP(t,o),qP(e,o,this._defsUsePending,!1,!0),o},tspan:function(e,t){var n=e.getAttribute("x"),i=e.getAttribute("y");null!=n&&(this._textX=parseFloat(n)),null!=i&&(this._textY=parseFloat(i));var a=e.getAttribute("dx")||"0",r=e.getAttribute("dy")||"0",o=new zc;return LP(t,o),qP(e,o,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(r),o},path:function(e,t){var n=xg(e.getAttribute("d")||"");return LP(t,n),qP(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}),e}(),BP={lineargradient:function(e){var t=parseInt(e.getAttribute("x1")||"0",10),n=parseInt(e.getAttribute("y1")||"0",10),i=parseInt(e.getAttribute("x2")||"10",10),a=parseInt(e.getAttribute("y2")||"0",10),r=new af(t,n,i,a);return FP(e,r),NP(e,r),r},radialgradient:function(e){var t=parseInt(e.getAttribute("cx")||"0",10),n=parseInt(e.getAttribute("cy")||"0",10),i=parseInt(e.getAttribute("r")||"0",10),a=new rf(t,n,i);return FP(e,a),NP(e,a),a}};function FP(e,t){"userSpaceOnUse"===e.getAttribute("gradientUnits")&&(t.global=!0)}function NP(e,t){for(var n=e.firstChild;n;){if(1===n.nodeType&&"stop"===n.nodeName.toLocaleLowerCase()){var i=n.getAttribute("offset"),a=void 0;a=i&&i.indexOf("%")>0?parseInt(i,10)/100:i?parseFloat(i):0;var r={};KP(n,r,r);var o=r.stopColor||n.getAttribute("stop-color")||"#000000";t.colorStops.push({offset:a,color:o})}n=n.nextSibling}}function LP(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),jr(t.__inheritedStyle,e.__inheritedStyle))}function VP(e){for(var t=jP(e),n=[],i=0;i0;r-=2){var o=i[r],s=i[r-1],l=jP(o);switch(a=a||[1,0,0,1,0,0],s){case"translate":Ps(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":As(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Ds(a,a,-parseFloat(l[0])*WP,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":ks(a,[1,0,Math.tan(parseFloat(l[0])*WP),1,0,0],a);break;case"skewY":ks(a,[1,Math.tan(parseFloat(l[0])*WP),0,1,0,0],a);break;case"matrix":a[0]=parseFloat(l[0]),a[1]=parseFloat(l[1]),a[2]=parseFloat(l[2]),a[3]=parseFloat(l[3]),a[4]=parseFloat(l[4]),a[5]=parseFloat(l[5])}}t.setLocalTransform(a)}}(e,t),KP(e,o,s),i||function(e,t,n){for(var i=0;i0,h={api:n,geo:s,mapOrGeoModel:e,data:o,isVisualEncodedByVisualMap:m,isGeo:r,transformInfoRaw:d};"geoJSON"===s.resourceType?this._buildGeoJSON(h):"geoSVG"===s.resourceType&&this._buildSVG(h),this._updateController(e,t,n),this._updateMapSelectHandler(e,l,n,i)},e.prototype._buildGeoJSON=function(e){var t=this._regionsGroupByName=Po(),n=Po(),i=this._regionsGroup,a=e.transformInfoRaw,r=e.mapOrGeoModel,o=e.data,s=e.geo.projection,l=s&&s.stream;function p(e,t){return t&&(e=t(e)),e&&[e[0]*a.scaleX+a.x,e[1]*a.scaleY+a.y]}function c(e){for(var t=[],n=!l&&s&&s.project,i=0;i=0)&&(u=a);var m=o?{normal:{align:"center",verticalAlign:"middle"}}:null;ny(t,iy(i),{labelFetcher:u,labelDataIndex:d,defaultText:n},m);var h=t.getTextContent();if(h&&(uD(h).ignore=h.ignore,t.textConfig&&o)){var g=t.getBoundingRect().clone();t.textConfig.layoutRect=g,t.textConfig.position=[(o[0]-g.x)/g.width*100+"%",(o[1]-g.y)/g.height*100+"%"]}t.disableLabelAnimation=!0}else t.removeTextContent(),t.removeTextConfig(),t.disableLabelAnimation=null}function vD(e,t,n,i,a,r){e.data?e.data.setItemGraphicEl(r,t):ih(t).eventData={componentType:"geo",componentIndex:a.componentIndex,geoIndex:a.componentIndex,name:n,region:i&&i.option||{}}}function xD(e,t,n,i,a){e.data||Yf({el:t,componentModel:a,itemName:n,itemTooltipOption:i.get("tooltip")})}function bD(e,t,n,i,a){t.highDownSilentOnTouch=!!a.get("selectedMode");var r=i.getModel("emphasis"),o=r.get("focus");return Wh(t,o,r.get("blurScope"),r.get("disabled")),e.isGeo&&function(e,t,n){var i=ih(e);i.componentMainType=t.mainType,i.componentIndex=t.componentIndex,i.componentHighDownName=n}(t,a,n),o}function wD(e,t,n){var i,a=[];function r(){i=[]}function o(){i.length&&(a.push(i),i=[])}var s=t({polygonStart:r,polygonEnd:o,lineStart:r,lineEnd:o,point:function(e,t){isFinite(e)&&isFinite(t)&&i.push([e,t])},sphere:function(){}});return!n&&s.polygonStart(),Yr(e,(function(e){s.lineStart();for(var t=0;t-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n},t.type="series.map",t.dependencies=["geo"],t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},nameProperty:"name"}}(bw);var SD=Qo,CD=function(e){function t(t){var n=e.call(this)||this;return n.type="view",n.dimensions=["x","y"],n._roamTransformable=new bc,n._rawTransformable=new bc,n.name=t,n}return Qe(t,e),t.prototype.setBoundingRect=function(e,t,n,i){return this._rect=new js(e,t,n,i),this._rect},t.prototype.getBoundingRect=function(){return this._rect},t.prototype.setViewRect=function(e,t,n,i){this._transformTo(e,t,n,i),this._viewRect=new js(e,t,n,i)},t.prototype._transformTo=function(e,t,n,i){var a=this.getBoundingRect(),r=this._rawTransformable;r.transform=a.calculateTransform(new js(e,t,n,i));var o=r.parent;r.parent=null,r.decomposeTransform(),r.parent=o,this._updateTransform()},t.prototype.setCenter=function(e,t){e&&(this._center=[Jc(e[0],t.getWidth()),Jc(e[1],t.getHeight())],this._updateCenterAndZoom())},t.prototype.setZoom=function(e){e=e||1;var t=this.zoomLimit;t&&(null!=t.max&&(e=Math.min(t.max,e)),null!=t.min&&(e=Math.max(t.min,e))),this._zoom=e,this._updateCenterAndZoom()},t.prototype.getDefaultCenter=function(){var e=this.getBoundingRect();return[e.x+e.width/2,e.y+e.height/2]},t.prototype.getCenter=function(){return this._center||this.getDefaultCenter()},t.prototype.getZoom=function(){return this._zoom||1},t.prototype.getRoamTransform=function(){return this._roamTransformable.getLocalTransform()},t.prototype._updateCenterAndZoom=function(){var e=this._rawTransformable.getLocalTransform(),t=this._roamTransformable,n=this.getDefaultCenter(),i=this.getCenter(),a=this.getZoom();i=Qo([],i,e),n=Qo([],n,e),t.originX=i[0],t.originY=i[1],t.x=n[0]-i[0],t.y=n[1]-i[1],t.scaleX=t.scaleY=a,this._updateTransform()},t.prototype._updateTransform=function(){var e=this._roamTransformable,t=this._rawTransformable;t.parent=e,e.updateTransform(),t.updateTransform(),Ms(this.transform||(this.transform=[]),t.transform||[1,0,0,1,0,0]),this._rawTransform=t.getLocalTransform(),this.invTransform=this.invTransform||[],Os(this.invTransform,this.transform),this.decomposeTransform()},t.prototype.getTransformInfo=function(){var e=this._rawTransformable,t=this._roamTransformable,n=new bc;return n.transform=t.transform,n.decomposeTransform(),{roam:{x:n.x,y:n.y,scaleX:n.scaleX,scaleY:n.scaleY},raw:{x:e.x,y:e.y,scaleX:e.scaleX,scaleY:e.scaleY}}},t.prototype.getViewRect=function(){return this._viewRect},t.prototype.getViewRectAfterRoam=function(){var e=this.getBoundingRect().clone();return e.applyTransform(this.transform),e},t.prototype.dataToPoint=function(e,t,n){var i=t?this._rawTransform:this.transform;return n=n||[],i?SD(n,e,i):Lo(n,e)},t.prototype.pointToData=function(e){var t=this.invTransform;return t?SD([],e,t):[e[0],e[1]]},t.prototype.convertToPixel=function(e,t,n){var i=_D(t);return i===this?i.dataToPoint(n):null},t.prototype.convertFromPixel=function(e,t,n){var i=_D(t);return i===this?i.pointToData(n):null},t.prototype.containPoint=function(e){return this.getViewRectAfterRoam().contain(e[0],e[1])},t.dimensions=["x","y"],t}(bc);function _D(e){var t=e.seriesModel;return t?t.coordinateSystem:null}var TD={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},ED=["lng","lat"],ID=function(e){function t(t,n,i){var a=e.call(this,t)||this;a.dimensions=ED,a.type="geo",a._nameCoordMap=Po(),a.map=n;var r,o=i.projection,s=sD(n,i.nameMap,i.nameProperty),l=oD(n),p=(a.resourceType=l?l.type:null,a.regions=s.regions),c=TD[l.type];if(a._regionsMap=s.regionsMap,a.regions=s.regions,a.projection=o,o)for(var d=0;d1?(m.width=u,m.height=u/x):(m.height=u,m.width=u*x),m.y=d[1]-m.height/2,m.x=d[0]-m.width/2;else{var w=e.getBoxLayoutParams();w.aspect=x,m=kv(w,{width:y,height:v})}this.setViewRect(m.x,m.y,m.width,m.height),this.setCenter(e.get("center"),t),this.setZoom(e.get("zoom"))}$r(ID,CD);var PD=function(){function e(){this.dimensions=ED}return e.prototype.create=function(e,t){var n=[];function i(e){return{nameProperty:e.get("nameProperty"),aspectScale:e.get("aspectScale"),projection:e.get("projection")}}e.eachComponent("geo",(function(e,a){var r=e.get("map"),o=new ID(r+a,r,Ur({nameMap:e.get("nameMap")},i(e)));o.zoomLimit=e.get("scaleLimit"),n.push(o),e.coordinateSystem=o,o.model=e,o.resize=kD,o.resize(e,t)})),e.eachSeries((function(e){if("geo"===e.get("coordinateSystem")){var t=e.get("geoIndex")||0;e.coordinateSystem=n[t]}}));var a={};return e.eachSeriesByType("map",(function(e){if(!e.getHostGeoModel()){var t=e.getMapType();a[t]=a[t]||[],a[t].push(e)}})),Yr(a,(function(e,a){var r=Xr(e,(function(e){return e.get("nameMap")})),o=new ID(a,a,Ur({nameMap:zr(r)},i(e[0])));o.zoomLimit=yo.apply(null,Xr(e,(function(e){return e.get("scaleLimit")}))),n.push(o),o.resize=kD,o.resize(e[0],t),Yr(e,(function(e){e.coordinateSystem=o,function(e,t){Yr(t.get("geoCoord"),(function(t,n){e.addGeoCoord(n,t)}))}(o,e)}))})),n},e.prototype.getFilledRegions=function(e,t,n,i){for(var a=(e||[]).slice(),r=Po(),o=0;ov.x)||(b-=Math.PI);var C=w?"left":"right",_=s.getModel("label"),T=_.get("rotate"),E=T*(Math.PI/180),I=f.getTextContent();I&&(f.setTextConfig({position:_.get("position")||C,rotation:null==T?-b:E,origin:"center"}),I.setStyle("verticalAlign","middle"))}var M=s.get(["emphasis","focus"]),k="relative"===M?Do(o.getAncestorsIndices(),o.getDescendantIndices()):"ancestor"===M?o.getAncestorsIndices():"descendant"===M?o.getDescendantIndices():null;k&&(ih(n).focus=k),function(e,t,n,i,a,r,o,s){var l=t.getModel(),p=e.get("edgeShape"),c=e.get("layout"),d=e.getOrient(),u=e.get(["lineStyle","curveness"]),m=e.get("edgeForkPosition"),h=l.getModel("lineStyle").getLineStyle(),g=i.__edge;if("curve"===p)t.parentNode&&t.parentNode!==n&&(g||(g=i.__edge=new Qg({shape:qD(c,d,u,a,a)})),ff(g,{shape:qD(c,d,u,r,o)},e));else if("polyline"===p)if("orthogonal"===c){if(t!==n&&t.children&&0!==t.children.length&&!0===t.isExpand){for(var f=t.children,y=[],v=0;vt&&(t=i.height)}this.height=t+1},e.prototype.getNodeById=function(e){if(this.getId()===e)return this;for(var t=0,n=this.children,i=n.length;t=0&&this.hostTree.data.setItemLayout(this.dataIndex,e,t)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostTree.data.getItemModel(this.dataIndex).getModel(e)},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,e,t)},e.prototype.getVisual=function(e){return this.hostTree.data.getItemVisual(this.dataIndex,e)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var e=this.parentNode.children,t=0;t=0){var i=n.getData().tree.root,a=e.targetNode;if(ro(a)&&(a=i.getNodeById(a)),a&&i.contains(a))return{node:a};var r=e.targetNodeId;if(null!=r&&(a=i.getNodeById(r)))return{node:a}}}function JD(e){for(var t=[];e;)(e=e.parentNode)&&t.push(e);return t.reverse()}function eA(e,t){return Hr(JD(e),t)>=0}function tA(e,t){for(var n=[];e;){var i=e.dataIndex;n.push({name:e.name,dataIndex:i,value:t.getRawValue(i)}),e=e.parentNode}return n.reverse(),n}!function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasSymbolVisual=!0,t.ignoreStyleOnData=!0,t}Qe(t,e),t.prototype.getInitialData=function(e){var t={name:e.name,children:e.data},n=e.leaves||{},i=new Ey(n,this,this.ecModel),a=ZD.createTree(t,this,(function(e){e.wrapMethod("getItemModel",(function(e,t){var n=a.getNodeByDataIndex(t);return n&&n.children.length&&n.isExpand||(e.parentModel=i),e}))}));var r=0;a.eachNode("preorder",(function(e){e.depth>r&&(r=e.depth)}));var o=e.expandAndCollapse&&e.initialTreeDepth>=0?e.initialTreeDepth:r;return a.root.eachNode("preorder",(function(e){var t=e.hostTree.data.getRawDataItem(e.dataIndex);e.isExpand=t&&null!=t.collapsed?!t.collapsed:e.depth<=o})),a.data},t.prototype.getOrient=function(){var e=this.get("orient");return"horizontal"===e?e="LR":"vertical"===e&&(e="TB"),e},t.prototype.setZoom=function(e){this.option.zoom=e},t.prototype.setCenter=function(e){this.option.center=e},t.prototype.formatTooltip=function(e,t,n){for(var i=this.getData().tree,a=i.root.children[0],r=i.getNodeByDataIndex(e),o=r.getValue(),s=r.name;r&&r!==a;)s=r.parentNode.name+"."+s,r=r.parentNode;return aw("nameValue",{name:s,value:o,noValue:isNaN(o)||null==o})},t.prototype.getDataParams=function(t){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return n.treeAncestors=tA(i,this),n.collapsed=!i.isExpand,n},t.type="series.tree",t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500}}(bw);function nA(e){var t=e.getData().tree,n={};t.eachNode((function(t){for(var i=t;i&&i.depth>1;)i=i.parentNode;var a=dx(e.ecModel,i.name||i.dataIndex+"",n);t.setVisual("decal",a)}))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.preventUsingHoverLayer=!0,n}Qe(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};iA(n);var i=e.levels||[],a=this.designatedVisualItemStyle={},r=new Ey({itemStyle:a},this,t);i=e.levels=function(e,t){var n,i,a=Td(t.get("color")),r=Td(t.get(["aria","decal","decals"]));if(!a)return;e=e||[],Yr(e,(function(e){var t=new Ey(e),a=t.get("color"),r=t.get("decal");(t.get(["itemStyle","color"])||a&&"none"!==a)&&(n=!0),(t.get(["itemStyle","decal"])||r&&"none"!==r)&&(i=!0)}));var o=e[0]||(e[0]={});n||(o.color=a.slice());!i&&r&&(o.decal=r.slice());return e}(i,t);var o=Xr(i||[],(function(e){return new Ey(e,r,t)}),this),s=ZD.createTree(n,this,(function(e){e.wrapMethod("getItemModel",(function(e,t){var n=s.getNodeByDataIndex(t),i=n?o[n.depth]:null;return e.parentModel=i||r,e}))}));return s.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(e,t,n){var i=this.getData(),a=this.getRawValue(e);return aw("nameValue",{name:i.getName(e),value:a})},t.prototype.getDataParams=function(t){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return n.treeAncestors=tA(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(e){this.layoutInfo=this.layoutInfo||{},Ur(this.layoutInfo,e)},t.prototype.mapIdToIndex=function(e){var t=this._idIndexMap;t||(t=this._idIndexMap=Po(),this._idIndexMapCount=0);var n=t.get(e);return null==n&&t.set(e,n=this._idIndexMapCount++),n},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(e){e?this._viewRoot=e:e=this._viewRoot;var t=this.getRawData().tree.root;e&&(e===t||t.contains(e))||(this._viewRoot=t)},t.prototype.enableAriaDecal=function(){nA(this)},t.type="series.treemap",t.layoutMode="box",t.defaultOption={progressive:0,left:"center",top:"middle",width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",textStyle:{color:"#fff"}},emphasis:{itemStyle:{color:"rgba(0,0,0,0.9)"}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]}}(bw);function iA(e){var t=0;Yr(e.children,(function(e){iA(e);var n=e.value;io(n)&&(n=n[0]),t+=n}));var n=e.value;io(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),io(e.value)?e.value[0]=n:e.value=n}var aA=function(){function e(e){this.group=new zc,e.add(this.group)}return e.prototype.render=function(e,t,n,i){var a=e.getModel("breadcrumb"),r=this.group;if(r.removeAll(),a.get("show")&&n){var o=a.getModel("itemStyle"),s=a.getModel("emphasis"),l=o.getModel("textStyle"),p=s.getModel(["itemStyle","textStyle"]),c={pos:{left:a.get("left"),right:a.get("right"),top:a.get("top"),bottom:a.get("bottom")},box:{width:t.getWidth(),height:t.getHeight()},emptyItemWidth:a.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(n,c,l),this._renderContent(e,c,o,s,l,p,i),Pv(r,c.pos,c.box)}},e.prototype._prepare=function(e,t,n){for(var i=e;i;i=i.parentNode){var a=Od(i.getModel().get("name"),""),r=n.getTextRect(a),o=Math.max(r.width+16,t.emptyItemWidth);t.totalWidth+=o+8,t.renderList.push({node:i,text:a,width:o})}},e.prototype._renderContent=function(e,t,n,i,a,r,o){for(var s,l,p,c,d,u,m,h,g,f=0,y=t.emptyItemWidth,v=e.get(["breadcrumb","height"]),x=(s=t.pos,l=t.box,c=l.width,d=l.height,u=Jc(s.left,c),m=Jc(s.top,d),h=Jc(s.right,c),g=Jc(s.bottom,d),(isNaN(u)||isNaN(parseFloat(s.left)))&&(u=0),(isNaN(h)||isNaN(parseFloat(s.right)))&&(h=c),(isNaN(m)||isNaN(parseFloat(s.top)))&&(m=0),(isNaN(g)||isNaN(parseFloat(s.bottom)))&&(g=d),p=fv(p||0),{width:Math.max(h-u-p[1]-p[3],0),height:Math.max(g-m-p[0]-p[2],0)}),b=t.totalWidth,w=t.renderList,S=i.getModel("itemStyle").getItemStyle(),C=w.length-1;C>=0;C--){var _=w[C],T=_.node,E=_.width,I=_.text;b>x.width&&(b-=E-y,E=y,I=null);var M=new Ug({shape:{points:rA(f,0,E,v,C===w.length-1,0===C)},style:jr(n.getItemStyle(),{lineJoin:"bevel"}),textContent:new jm({style:ay(a,{text:I})}),textConfig:{position:"inside"},z2:1e5,onclick:no(o,T)});M.disableLabelAnimation=!0,M.getTextContent().ensureState("emphasis").style=ay(r,{text:I}),M.ensureState("emphasis").style=S,Wh(M,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(M),oA(M,e,T),f+=E+8}},e.prototype.remove=function(){this.group.removeAll()},e}();function rA(e,t,n,i,a,r){var o=[[a?e:e-5,t],[e+n,t],[e+n,t+i],[a?e:e-5,t+i]];return!r&&o.splice(2,0,[e+n+5,t+i/2]),!a&&o.push([e,t+i/2]),o}function oA(e,t,n){ih(e).eventData={componentType:"series",componentSubType:"treemap",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:n&&n.dataIndex,name:n&&n.name},treePathInfo:n&&tA(n,t)}}var sA=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(e,t,n,i,a){return!this._elExistsMap[e.id]&&(this._elExistsMap[e.id]=!0,this._storage.push({el:e,target:t,duration:n,delay:i,easing:a}),!0)},e.prototype.finished=function(e){return this._finishedCallback=e,this},e.prototype.start=function(){for(var e=this,t=this._storage.length,n=function(){--t<=0&&(e._storage.length=0,e._elExistsMap={},e._finishedCallback&&e._finishedCallback())},i=0,a=this._storage.length;i3||Math.abs(e.dy)>3)){var t=this.seriesModel.getData().tree.root;if(!t)return;var n=t.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+e.dx,y:n.y+e.dy,width:n.width,height:n.height}})}},t.prototype._onZoom=function(e){var t=e.originX,n=e.originY;if("animating"!==this._state){var i=this.seriesModel.getData().tree.root;if(!i)return;var a=i.getLayout();if(!a)return;var r=new js(a.x,a.y,a.width,a.height),o=this.seriesModel.layoutInfo,s=[1,0,0,1,0,0];Ps(s,s,[-(t-=o.x),-(n-=o.y)]),As(s,s,[e.scale,e.scale]),Ps(s,s,[t,n]),r.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:r.x,y:r.y,width:r.width,height:r.height}})}},t.prototype._initEvents=function(e){var t=this;e.on("click",(function(e){if("ready"===t._state){var n=t.seriesModel.get("nodeClick",!0);if(n){var i=t.findTarget(e.offsetX,e.offsetY);if(i){var a=i.node;if(a.getLayout().isLeafRoot)t._rootToNode(i);else if("zoomToNode"===n)t._zoomToNode(i);else if("link"===n){var r=a.hostTree.data.getItemModel(a.dataIndex),o=r.get("link",!0),s=r.get("target",!0)||"blank";o&&Cv(o,s)}}}}}),this)},t.prototype._renderBreadcrumb=function(e,t,n){var i=this;n||(n=null!=e.get("leafDepth",!0)?{node:e.getViewRoot()}:this.findTarget(t.getWidth()/2,t.getHeight()/2))||(n={node:e.getData().tree.root}),(this._breadcrumb||(this._breadcrumb=new aA(this.group))).render(e,t,n.node,(function(t){"animating"!==i._state&&(eA(e.getViewRoot(),t)?i._rootToNode({node:t}):i._zoomToNode({node:t}))}))},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage={nodeGroup:[],background:[],content:[]},this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(e){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:e.node})},t.prototype._rootToNode=function(e){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:e.node})},t.prototype.findTarget=function(e,t){var n;return this.seriesModel.getViewRoot().eachNode({attr:"viewChildren",order:"preorder"},(function(i){var a=this._storage.background[i.getRawIndex()];if(a){var r=a.transformCoordToLocal(e,t),o=a.shape;if(!(o.x<=r[0]&&r[0]<=o.x+o.width&&o.y<=r[1]&&r[1]<=o.y+o.height))return!1;n={node:i,offsetX:r[0],offsetY:r[1]}}}),this),n},t.type="treemap"}(Aw);var gA=Yr,fA=lo,yA=-1,vA=function(){function e(t){var n=t.mappingMethod,i=t.type,a=this.option=qr(t);this.type=i,this.mappingMethod=n,this._normalizeData=MA[n];var r=e.visualHandlers[i];this.applyVisual=r.applyVisual,this.getColorMapper=r.getColorMapper,this._normalizedToVisual=r._normalizedToVisual[n],"piecewise"===n?(xA(a),function(e){var t=e.pieceList;e.hasSpecialVisual=!1,Yr(t,(function(t,n){t.originIndex=n,null!=t.visual&&(e.hasSpecialVisual=!0)}))}(a)):"category"===n?a.categories?function(e){var t=e.categories,n=e.categoryMap={},i=e.visual;if(gA(t,(function(e,t){n[e]=t})),!io(i)){var a=[];lo(i)?gA(i,(function(e,t){var i=n[t];a[null!=i?i:yA]=e})):a[-1]=i,i=IA(e,a)}for(var r=t.length-1;r>=0;r--)null==i[r]&&(delete n[t[r]],t.pop())}(a):xA(a,!0):(So("linear"!==n||a.dataExtent),xA(a))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return to(this._normalizeData,this)},e.listVisualTypes=function(){return eo(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){lo(e)?Yr(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,i){var a,r=io(t)?[]:lo(t)?{}:(a=!0,null);return e.eachVisual(t,(function(e,t){var o=n.call(i,e,t);a?r=o:r[t]=o})),r},e.retrieveVisuals=function(t){var n,i={};return t&&gA(e.visualHandlers,(function(e,a){t.hasOwnProperty(a)&&(i[a]=t[a],n=!0)})),n?i:null},e.prepareVisualTypes=function(e){if(io(e))e=e.slice();else{if(!fA(e))return[];var t=[];gA(e,(function(e,n){t.push(n)})),e=t}return e.sort((function(e,t){return"color"===t&&"color"!==e&&0===e.indexOf("color")?1:-1})),e},e.dependsOn=function(e,t){return"color"===t?!(!e||0!==e.indexOf(t)):e===t},e.findPieceIndex=function(e,t,n){for(var i,a=1/0,r=0,o=t.length;ri&&(i=t);var r=i%2?i+2:i+3;a=[];for(var o=0;o0&&(v[0]=-v[0],v[1]=-v[1]);var b=y[0]<0?-1:1;if("start"!==i.__position&&"end"!==i.__position){var w=-Math.atan2(y[1],y[0]);p[0].8?"left":c[0]<-.8?"right":"center",u=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";break;case"start":i.x=-c[0]*h+l[0],i.y=-c[1]*g+l[1],d=c[0]>.8?"right":c[0]<-.8?"left":"center",u=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=h*b+l[0],i.y=l[1]+S,d=y[0]<0?"right":"left",i.originX=-h*b,i.originY=-S;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=x[0],i.y=x[1]+S,d="center",i.originY=-S;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-h*b+p[0],i.y=p[1]+S,d=y[0]>=0?"right":"left",i.originX=h*b,i.originY=-S}i.scaleX=i.scaleY=a,i.setStyle({verticalAlign:i.__verticalAlign||u,align:i.__align||d})}}}function C(e,t){var n=e.__specifiedRotation;if(null==n){var i=o.tangentAt(t);e.attr("rotation",(1===t?-1:1)*Math.PI/2-Math.atan2(i[1],i[0]))}else e.attr("rotation",n)}},t}(zc),nO=function(){function e(e){this.group=new zc,this._LineCtor=e||tO}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,i=n.group,a=n._lineData;n._lineData=e,a||i.removeAll();var r=iO(e);e.diff(a).add((function(n){t._doAdd(e,n,r)})).update((function(n,i){t._doUpdate(a,e,i,n,r)})).remove((function(e){i.remove(a.getItemGraphicEl(e))})).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl((function(t,n){t.updateLayout(e,n)}),this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=iO(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t){function n(e){e.isGroup||function(e){return e.animators&&e.animators.length>0}(e)||(e.incremental=!0,e.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=e.start;i=0?i+=p:i-=p:h>=0?i-=p:i+=p}return i}function mO(e,t){var n=[],i=Rl,a=[[],[],[]],r=[[],[]],o=[];t/=2,e.eachEdge((function(e,s){var l=e.getLayout(),p=e.getVisual("fromSymbol"),c=e.getVisual("toSymbol");l.__original||(l.__original=[Vo(l[0]),Vo(l[1])],l[2]&&l.__original.push(Vo(l[2])));var d=l.__original;if(null!=l[2]){if(Lo(a[0],d[0]),Lo(a[1],d[2]),Lo(a[2],d[1]),p&&"none"!==p){var u=VA(e.node1),m=uO(a,d[0],u*t);i(a[0][0],a[1][0],a[2][0],m,n),a[0][0]=n[3],a[1][0]=n[4],i(a[0][1],a[1][1],a[2][1],m,n),a[0][1]=n[3],a[1][1]=n[4]}if(c&&"none"!==c){u=VA(e.node2),m=uO(a,d[1],u*t);i(a[0][0],a[1][0],a[2][0],m,n),a[1][0]=n[1],a[2][0]=n[2],i(a[0][1],a[1][1],a[2][1],m,n),a[1][1]=n[1],a[2][1]=n[2]}Lo(l[0],a[0]),Lo(l[1],a[2]),Lo(l[2],a[1])}else{if(Lo(r[0],d[0]),Lo(r[1],d[1]),zo(o,r[1],r[0]),Wo(o,o),p&&"none"!==p){u=VA(e.node1);Go(r[0],r[0],o,u*t)}if(c&&"none"!==c){u=VA(e.node2);Go(r[1],r[1],o,-u*t)}Lo(l[0],r[0]),Lo(l[1],r[1])}}))}function hO(e){return"view"===e.type}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.init=function(e,t){var n=new NI,i=new nO,a=this.group;this._controller=new bP(t.getZr()),this._controllerHost={target:a},a.add(n.group),a.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},t.prototype.render=function(e,t,n){var i=this,a=e.coordinateSystem;this._model=e;var r=this._symbolDraw,o=this._lineDraw,s=this.group;if(hO(a)){var l={x:a.x,y:a.y,scaleX:a.scaleX,scaleY:a.scaleY};this._firstRender?s.attr(l):ff(s,l,e)}mO(e.getGraph(),LA(e));var p=e.getData();r.updateData(p);var c=e.getEdgeData();o.updateData(c),this._updateNodeAndLinkScale(),this._updateController(e,t,n),clearTimeout(this._layoutTimeout);var d=e.forceLayout,u=e.get(["force","layoutAnimation"]);d&&this._startForceLayoutIteration(d,u);var m=e.get("layout");p.graph.eachNode((function(t){var n=t.dataIndex,a=t.getGraphicEl(),r=t.getModel();if(a){a.off("drag").off("dragend");var o=r.get("draggable");o&&a.on("drag",(function(r){switch(m){case"force":d.warmUp(),!i._layouting&&i._startForceLayoutIteration(d,u),d.setFixed(n),p.setItemLayout(n,[a.x,a.y]);break;case"circular":p.setItemLayout(n,[a.x,a.y]),t.setLayout({fixed:!0},!0),zA(e,"symbolSize",t,[r.offsetX,r.offsetY]),i.updateLayout(e);break;default:p.setItemLayout(n,[a.x,a.y]),NA(e.getGraph(),e),i.updateLayout(e)}})).on("dragend",(function(){d&&d.setUnfixed(n)})),a.setDraggable(o,!!r.get("cursor")),"adjacency"===r.get(["emphasis","focus"])&&(ih(a).focus=t.getAdjacentDataIndices())}})),p.graph.eachEdge((function(e){var t=e.getGraphicEl(),n=e.getModel().get(["emphasis","focus"]);t&&"adjacency"===n&&(ih(t).focus={edge:[e.dataIndex],node:[e.node1.dataIndex,e.node2.dataIndex]})}));var h="circular"===e.get("layout")&&e.get(["circular","rotateLabel"]),g=p.getLayout("cx"),f=p.getLayout("cy");p.graph.eachNode((function(e){jA(e,h,g,f)})),this._firstRender=!1},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},t.prototype._startForceLayoutIteration=function(e,t){var n=this;!function i(){e.step((function(e){n.updateLayout(n._model),(n._layouting=!e)&&(t?n._layoutTimeout=setTimeout(i,16):i())}))}()},t.prototype._updateController=function(e,t,n){var i=this,a=this._controller,r=this._controllerHost,o=this.group;a.setPointerChecker((function(t,i,a){var r=o.getBoundingRect();return r.applyTransform(o.transform),r.contain(i,a)&&!MP(t,n,e)})),hO(e.coordinateSystem)?(a.enable(e.get("roam")),r.zoomLimit=e.get("scaleLimit"),r.zoom=e.coordinateSystem.getZoom(),a.off("pan").off("zoom").on("pan",(function(t){_P(r,t.dx,t.dy),n.dispatchAction({seriesId:e.id,type:"graphRoam",dx:t.dx,dy:t.dy})})).on("zoom",(function(t){TP(r,t.scale,t.originX,t.originY),n.dispatchAction({seriesId:e.id,type:"graphRoam",zoom:t.scale,originX:t.originX,originY:t.originY}),i._updateNodeAndLinkScale(),mO(e.getGraph(),LA(e)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):a.disable()},t.prototype._updateNodeAndLinkScale=function(){var e=this._model,t=e.getData(),n=LA(e);t.eachItemGraphicEl((function(e,t){e&&e.setSymbolScale(n)}))},t.prototype.updateLayout=function(e){mO(e.getGraph(),LA(e)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},t.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},t.type="graph"}(Aw);function gO(e){return"_EC_"+e}var fO=function(){function e(e){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=e||!1}return e.prototype.isDirected=function(){return this._directed},e.prototype.addNode=function(e,t){e=null==e?""+t:""+e;var n=this._nodesMap;if(!n[gO(e)]){var i=new yO(e,t);return i.hostGraph=this,this.nodes.push(i),n[gO(e)]=i,i}},e.prototype.getNodeByIndex=function(e){var t=this.data.getRawIndex(e);return this.nodes[t]},e.prototype.getNodeById=function(e){return this._nodesMap[gO(e)]},e.prototype.addEdge=function(e,t,n){var i=this._nodesMap,a=this._edgesMap;if(so(e)&&(e=this.nodes[e]),so(t)&&(t=this.nodes[t]),e instanceof yO||(e=i[gO(e)]),t instanceof yO||(t=i[gO(t)]),e&&t){var r=e.id+"-"+t.id,o=new vO(e,t,n);return o.hostGraph=this,this._directed&&(e.outEdges.push(o),t.inEdges.push(o)),e.edges.push(o),e!==t&&t.edges.push(o),this.edges.push(o),a[r]=o,o}},e.prototype.getEdgeByIndex=function(e){var t=this.edgeData.getRawIndex(e);return this.edges[t]},e.prototype.getEdge=function(e,t){e instanceof yO&&(e=e.id),t instanceof yO&&(t=t.id);var n=this._edgesMap;return this._directed?n[e+"-"+t]:n[e+"-"+t]||n[t+"-"+e]},e.prototype.eachNode=function(e,t){for(var n=this.nodes,i=n.length,a=0;a=0&&e.call(t,n[a],a)},e.prototype.eachEdge=function(e,t){for(var n=this.edges,i=n.length,a=0;a=0&&n[a].node1.dataIndex>=0&&n[a].node2.dataIndex>=0&&e.call(t,n[a],a)},e.prototype.breadthFirstTraverse=function(e,t,n,i){if(t instanceof yO||(t=this._nodesMap[gO(t)]),t){for(var a="out"===n?"outEdges":"in"===n?"inEdges":"edges",r=0;r=0&&n.node2.dataIndex>=0}));for(a=0,r=i.length;a=0&&this[e][t].setItemVisual(this.dataIndex,n,i)},getVisual:function(n){return this[e][t].getItemVisual(this.dataIndex,n)},setLayout:function(n,i){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,n,i)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}function bO(e,t,n,i,a){for(var r=new fO(i),o=0;o "+u)),p++)}var m,h=n.get("coordinateSystem");if("cartesian2d"===h||"polar"===h)m=lT(e,n);else{var g=Sx.get(h),f=g&&g.dimensions||[];Hr(f,"value")<0&&f.concat(["value"]);var y=eT(e,{coordDimensions:f,encodeDefine:n.getEncode()}).dimensions;(m=new J_(y,n)).initData(e)}var v=new J_(["value"],n);return v.initData(l,s),a&&a(m,v),zD({mainData:m,struct:r,structAttr:"graph",datas:{node:m,edge:v},datasAttr:{node:"data",edge:"edgeData"}}),r.update(),r}$r(yO,xO("hostGraph","data")),$r(vO,xO("hostGraph","edgeData"));!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}Qe(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new ek(i,i),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},t.prototype.mergeDefaultAndTheme=function(t){e.prototype.mergeDefaultAndTheme.apply(this,arguments),Ed(t,"edgeLabel",["show"])},t.prototype.getInitialData=function(e,t){var n,i=e.edges||e.links||[],a=e.data||e.nodes||[],r=this;if(a&&i){DA(n=this)&&(n.__curvenessList=[],n.__edgeMap={},AA(n));var o=bO(a,i,this,!0,(function(e,t){e.wrapMethod("getItemModel",(function(e){var t=r._categoriesModels[e.getShallow("category")];return t&&(t.parentModel=e.parentModel,e.parentModel=t),e}));var n=Ey.prototype.getModel;function i(e,t){var i=n.call(this,e,t);return i.resolveParentPath=a,i}function a(e){if(e&&("label"===e[0]||"label"===e[1])){var t=e.slice();return"label"===e[0]?t[0]="edgeLabel":"label"===e[1]&&(t[1]="edgeLabel"),t}return e}t.wrapMethod("getItemModel",(function(e){return e.resolveParentPath=a,e.getModel=i,e}))}));return Yr(o.edges,(function(e){!function(e,t,n,i){if(DA(n)){var a=OA(e,t,n),r=n.__edgeMap,o=r[RA(a)];r[a]&&!o?r[a].isForward=!0:o&&r[a]&&(o.isForward=!0,r[a].isForward=!1),r[a]=r[a]||[],r[a].push(i)}}(e.node1,e.node2,this,e.dataIndex)}),this),o.data}},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.getCategoriesData=function(){return this._categoriesData},t.prototype.formatTooltip=function(e,t,n){if("edge"===n){var i=this.getData(),a=this.getDataParams(e,n),r=i.graph.getEdgeByIndex(e),o=i.getName(r.node1.dataIndex),s=i.getName(r.node2.dataIndex),l=[];return null!=o&&l.push(o),null!=s&&l.push(s),aw("nameValue",{name:l.join(" > "),value:a.value,noValue:null==a.value})}return fw({series:this,dataIndex:e,multipleSeries:t})},t.prototype._updateCategoriesData=function(){var e=Xr(this.option.categories||[],(function(e){return null!=e.value?e:Ur({value:0},e)})),t=new J_(["value"],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray((function(e){return t.getItemModel(e)}))},t.prototype.setZoom=function(e){this.option.zoom=e},t.prototype.setCenter=function(e){this.option.center=e},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},t.type="series.graph",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}}}(bw);var wO=function(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0},SO=function(e){function t(t){var n=e.call(this,t)||this;return n.type="pointer",n}return Qe(t,e),t.prototype.getDefaultShape=function(){return new wO},t.prototype.buildPath=function(e,t){var n=Math.cos,i=Math.sin,a=t.r,r=t.width,o=t.angle,s=t.x-n(o)*r*(r>=a/3?1:2),l=t.y-i(o)*r*(r>=a/3?1:2);o=t.angle-Math.PI/2,e.moveTo(s,l),e.lineTo(t.x+n(o)*r,t.y+i(o)*r),e.lineTo(t.x+n(t.angle)*a,t.y+i(t.angle)*a),e.lineTo(t.x-n(o)*r,t.y-i(o)*r),e.lineTo(s,l)},t}(km);function CO(e,t){var n=null==e?"":e+"";return t&&(ro(t)?n=t.replace("{value}",n):ao(t)&&(n=t(e))),n}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.render=function(e,t,n){this.group.removeAll();var i=e.get(["axisLine","lineStyle","color"]),a=function(e,t){var n=e.get("center"),i=t.getWidth(),a=t.getHeight(),r=Math.min(i,a);return{cx:Jc(n[0],t.getWidth()),cy:Jc(n[1],t.getHeight()),r:Jc(e.get("radius"),r/2)}}(e,n);this._renderMain(e,t,n,i,a),this._data=e.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(e,t,n,i,a){var r=this.group,o=e.get("clockwise"),s=-e.get("startAngle")/180*Math.PI,l=-e.get("endAngle")/180*Math.PI,p=e.getModel("axisLine"),c=p.get("roundCap")?yM:Lg,d=p.get("show"),u=p.getModel("lineStyle"),m=u.get("width"),h=[s,l];lm(h,!o);for(var g=(l=h[1])-(s=h[0]),f=s,y=[],v=0;d&&v=e&&(0===t?0:i[t-1][0])Math.PI/2&&(L+=Math.PI):"tangential"===N?L=-_-Math.PI/2:so(N)&&(L=N*Math.PI/180),0===L?d.add(new jm({style:ay(x,{text:O,x:B,y:F,verticalAlign:c<-.8?"top":c>.8?"bottom":"middle",align:p<-.4?"left":p>.4?"right":"center"},{inheritColor:R}),silent:!0})):d.add(new jm({style:ay(x,{text:O,x:B,y:F,verticalAlign:"middle",align:"center"},{inheritColor:R}),silent:!0,originX:B,originY:F,rotation:L}))}if(v.get("show")&&P!==b){A=(A=v.get("distance"))?A+l:l;for(var V=0;V<=w;V++){p=Math.cos(_),c=Math.sin(_);var q=new Kg({shape:{x1:p*(h-A)+u,y1:c*(h-A)+m,x2:p*(h-C-A)+u,y2:c*(h-C-A)+m},silent:!0,style:M});"auto"===M.stroke&&q.setStyle({stroke:i((P+V/w)/b)}),d.add(q),_+=E}_-=E}else _+=T}},t.prototype._renderPointer=function(e,t,n,i,a,r,o,s,l){var p=this.group,c=this._data,d=this._progressEls,u=[],m=e.get(["pointer","show"]),h=e.getModel("progress"),g=h.get("show"),f=e.getData(),y=f.mapDimension("value"),v=+e.get("min"),x=+e.get("max"),b=[v,x],w=[r,o];function S(t,n){var i,r=f.getItemModel(t).getModel("pointer"),o=Jc(r.get("width"),a.r),s=Jc(r.get("length"),a.r),l=e.get(["pointer","icon"]),p=r.get("offsetCenter"),c=Jc(p[0],a.r),d=Jc(p[1],a.r),u=r.get("keepAspect");return(i=l?jS(l,c-o/2,d-s,o,s,null,u):new SO({shape:{angle:-Math.PI/2,width:o,r:s,x:c,y:d}})).rotation=-(n+Math.PI/2),i.x=a.cx,i.y=a.cy,i}function C(e,t){var n=h.get("roundCap")?yM:Lg,i=h.get("overlap"),o=i?h.get("width"):l/f.count(),p=i?a.r-o:a.r-(e+1)*o,c=i?a.r:a.r-e*o,d=new n({shape:{startAngle:r,endAngle:t,cx:a.cx,cy:a.cy,clockwise:s,r0:p,r:c}});return i&&(d.z2=x-f.get(y,e)%x),d}(g||m)&&(f.diff(c).add((function(t){var n=f.get(y,t);if(m){var i=S(t,r);yf(i,{rotation:-((isNaN(+n)?w[0]:Qc(n,b,w,!0))+Math.PI/2)},e),p.add(i),f.setItemGraphicEl(t,i)}if(g){var a=C(t,r),o=h.get("clip");yf(a,{shape:{endAngle:Qc(n,b,w,o)}},e),p.add(a),ah(e.seriesIndex,f.dataType,t,a),u[t]=a}})).update((function(t,n){var i=f.get(y,t);if(m){var a=c.getItemGraphicEl(n),o=a?a.rotation:r,s=S(t,o);s.rotation=o,ff(s,{rotation:-((isNaN(+i)?w[0]:Qc(i,b,w,!0))+Math.PI/2)},e),p.add(s),f.setItemGraphicEl(t,s)}if(g){var l=d[n],v=C(t,l?l.shape.endAngle:r),x=h.get("clip");ff(v,{shape:{endAngle:Qc(i,b,w,x)}},e),p.add(v),ah(e.seriesIndex,f.dataType,t,v),u[t]=v}})).execute(),f.each((function(e){var t=f.getItemModel(e),n=t.getModel("emphasis"),a=n.get("focus"),r=n.get("blurScope"),o=n.get("disabled");if(m){var s=f.getItemGraphicEl(e),l=f.getItemVisual(e,"style"),p=l.fill;if(s instanceof Rm){var c=s.style;s.useStyle(Ur({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},l))}else s.useStyle(l),"pointer"!==s.type&&s.setColor(p);s.setStyle(t.getModel(["pointer","itemStyle"]).getItemStyle()),"auto"===s.style.fill&&s.setStyle("fill",i(Qc(f.get(y,e),b,[0,1],!0))),s.z2EmphasisLift=0,Xh(s,t),Wh(s,a,r,o)}if(g){var d=u[e];d.useStyle(f.getItemVisual(e,"style")),d.setStyle(t.getModel(["progress","itemStyle"]).getItemStyle()),d.z2EmphasisLift=0,Xh(d,t),Wh(d,a,r,o)}})),this._progressEls=u)},t.prototype._renderAnchor=function(e,t){var n=e.getModel("anchor");if(n.get("show")){var i=n.get("size"),a=n.get("icon"),r=n.get("offsetCenter"),o=n.get("keepAspect"),s=jS(a,t.cx-i/2+Jc(r[0],t.r),t.cy-i/2+Jc(r[1],t.r),i,i,null,o);s.z2=n.get("showAbove")?1:0,s.setStyle(n.getModel("itemStyle").getItemStyle()),this.group.add(s)}},t.prototype._renderTitleAndDetail=function(e,t,n,i,a){var r=this,o=e.getData(),s=o.mapDimension("value"),l=+e.get("min"),p=+e.get("max"),c=new zc,d=[],u=[],m=e.isAnimationEnabled(),h=e.get(["pointer","showAbove"]);o.diff(this._data).add((function(e){d[e]=new jm({silent:!0}),u[e]=new jm({silent:!0})})).update((function(e,t){d[e]=r._titleEls[t],u[e]=r._detailEls[t]})).execute(),o.each((function(t){var n=o.getItemModel(t),r=o.get(s,t),g=new zc,f=i(Qc(r,[l,p],[0,1],!0)),y=n.getModel("title");if(y.get("show")){var v=y.get("offsetCenter"),x=a.cx+Jc(v[0],a.r),b=a.cy+Jc(v[1],a.r);(M=d[t]).attr({z2:h?0:2,style:ay(y,{x:x,y:b,text:o.getName(t),align:"center",verticalAlign:"middle"},{inheritColor:f})}),g.add(M)}var w=n.getModel("detail");if(w.get("show")){var S=w.get("offsetCenter"),C=a.cx+Jc(S[0],a.r),_=a.cy+Jc(S[1],a.r),T=Jc(w.get("width"),a.r),E=Jc(w.get("height"),a.r),I=e.get(["progress","show"])?o.getItemVisual(t,"style").fill:f,M=u[t],k=w.get("formatter");M.attr({z2:h?0:2,style:ay(w,{x:C,y:_,text:CO(r,k),width:isNaN(T)?null:T,height:isNaN(E)?null:E,align:"center",verticalAlign:"middle"},{inheritColor:I})}),uy(M,{normal:w},r,(function(e){return CO(e,k)})),m&&my(M,t,o,e,{getFormattedLabel:function(e,t,n,i,a,o){return CO(o?o.interpolatedValue:r,k)}}),g.add(M)}c.add(g)})),this.group.add(c),this._titleEls=d,this._detailEls=u},t.type="gauge"})(Aw),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath="itemStyle",n}Qe(t,e),t.prototype.getInitialData=function(e,t){return JM(this,["value"])},t.type="series.gauge",t.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,"#E6EBF8"]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:"#63677A",width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:"#63677A",width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:"#464646",fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:"#fff",borderWidth:0,borderColor:"#5470c6"}},title:{show:!0,offsetCenter:[0,"20%"],color:"#464646",fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc",width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:"#464646",fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}}}(bw);var _O=["itemStyle","opacity"],TO=function(e){function t(t,n){var i=e.call(this)||this,a=i,r=new Hg,o=new jm;return a.setTextContent(o),i.setTextGuideLine(r),i.updateData(t,n,!0),i}return Qe(t,e),t.prototype.updateData=function(e,t,n){var i=this,a=e.hostModel,r=e.getItemModel(t),o=e.getItemLayout(t),s=r.getModel("emphasis"),l=r.get(_O);l=null==l?1:l,n||Sf(i),i.useStyle(e.getItemVisual(t,"style")),i.style.lineJoin="round",n?(i.setShape({points:o.points}),i.style.opacity=0,yf(i,{style:{opacity:l}},a,t)):ff(i,{style:{opacity:l},shape:{points:o.points}},a,t),Xh(i,r),this._updateLabel(e,t),Wh(this,s.get("focus"),s.get("blurScope"),s.get("disabled"))},t.prototype._updateLabel=function(e,t){var n=this,i=this.getTextGuideLine(),a=n.getTextContent(),r=e.hostModel,o=e.getItemModel(t),s=e.getItemLayout(t).label,l=e.getItemVisual(t,"style"),p=l.fill;ny(a,iy(o),{labelFetcher:e.hostModel,labelDataIndex:t,defaultOpacity:l.opacity,defaultText:e.getName(t)},{normal:{align:s.textAlign,verticalAlign:s.verticalAlign}}),n.setTextConfig({local:!0,inside:!!s.inside,insideStroke:p,outsideFill:p});var c=s.linePoints;i.setShape({points:c}),n.textGuideLineConfig={anchor:c?new Bs(c[0][0],c[0][1]):null},ff(a,{style:{x:s.x,y:s.y}},r,t),a.attr({rotation:s.rotation,originX:s.x,originY:s.y,z2:10}),uI(n,mI(o),{stroke:p})},t}(Ug);(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreLabelLineUpdate=!0,n}Qe(t,e),t.prototype.render=function(e,t,n){var i=e.getData(),a=this._data,r=this.group;i.diff(a).add((function(e){var t=new TO(i,e);i.setItemGraphicEl(e,t),r.add(t)})).update((function(e,t){var n=a.getItemGraphicEl(t);n.updateData(i,e),r.add(n),i.setItemGraphicEl(e,n)})).remove((function(t){wf(a.getItemGraphicEl(t),e,t)})).execute(),this._data=i},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type="funnel"})(Aw),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new ek(to(this.getData,this),to(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.getInitialData=function(e,t){return JM(this,{coordDimensions:["value"],encodeDefaulter:no(ex,this)})},t.prototype._defaultLabelLine=function(e){Ed(e,"labelLine",["show"]);var t=e.labelLine,n=e.emphasis.labelLine;t.show=t.show&&e.label.show,n.show=n.show&&e.emphasis.label.show},t.prototype.getDataParams=function(t){var n=this.getData(),i=e.prototype.getDataParams.call(this,t),a=n.mapDimension("value"),r=n.getSum(a);return i.percent=r?+(n.get(a,t)/r*100).toFixed(2):0,i.$vars.push("percent"),i},t.type="series.funnel",t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}}}(bw);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._dataGroup=new zc,n._initialized=!1,n}Qe(t,e),t.prototype.init=function(){this.group.add(this._dataGroup)},t.prototype.render=function(e,t,n,i){this._progressiveEls=null;var a=this._dataGroup,r=e.getData(),o=this._data,s=e.coordinateSystem,l=s.dimensions,p=MO(e);if(r.diff(o).add((function(e){kO(IO(r,a,e,l,s),r,e,p)})).update((function(t,n){var i=o.getItemGraphicEl(n),a=EO(r,t,l,s);r.setItemGraphicEl(t,i),ff(i,{shape:{points:a}},e,t),Sf(i),kO(i,r,t,p)})).remove((function(e){var t=o.getItemGraphicEl(e);a.remove(t)})).execute(),!this._initialized){this._initialized=!0;var c=function(e,t,n){var i=e.model,a=e.getRect(),r=new Gm({shape:{x:a.x,y:a.y,width:a.width,height:a.height}}),o="horizontal"===i.get("layout")?"width":"height";return r.setShape(o,0),yf(r,{shape:{width:a.width,height:a.height}},t,n),r}(s,e,(function(){setTimeout((function(){a.removeClipPath()}))}));a.setClipPath(c)}this._data=r},t.prototype.incrementalPrepareRender=function(e,t,n){this._initialized=!0,this._data=null,this._dataGroup.removeAll()},t.prototype.incrementalRender=function(e,t,n){for(var i=t.getData(),a=t.coordinateSystem,r=a.dimensions,o=MO(t),s=this._progressiveEls=[],l=e.start;l5)return;var i=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);"none"!==i.behavior&&this._dispatchExpand({axisExpandWindow:i.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!this._mouseDownPoint&&AO(this,"mousemove")){var t=this._model,n=t.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]),i=n.behavior;"jump"===i&&this._throttledDispatchExpand.debounceNextCall(t.get("axisExpandDebounce")),this._throttledDispatchExpand("none"===i?null:{axisExpandWindow:n.axisExpandWindow,animation:"jump"===i?null:{duration:0}})}}};function AO(e,t){var n=e._model;return n.get("axisExpandable")&&n.get("axisExpandTriggerOn")===t}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(e){var t=this.option;e&&Gr(t,e,!0),this._initDimensions()},t.prototype.contains=function(e,t){var n=e.get("parallelIndex");return null!=n&&t.getComponent("parallel",n)===this},t.prototype.setAxisExpand=function(e){Yr(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],(function(t){e.hasOwnProperty(t)&&(this.option[t]=e[t])}),this)},t.prototype._initDimensions=function(){var e=this.dimensions=[],t=this.parallelAxisIndex=[];Yr(Qr(this.ecModel.queryComponents({mainType:"parallelAxis"}),(function(e){return(e.get("parallelIndex")||0)===this.componentIndex}),this),(function(n){e.push("dim"+n.get("dim")),t.push(n.componentIndex)}))},t.type="parallel",t.dependencies=["parallelAxis"],t.layoutMode="box",t.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null}}(Fv);var OO=function(e){function t(t,n,i,a,r){var o=e.call(this,t,n,i)||this;return o.type=a||"value",o.axisIndex=r,o}return Qe(t,e),t.prototype.isHorizontal=function(){return"horizontal"!==this.coordinateSystem.getModel().get("layout")},t}(zE);function RO(e,t,n,i,a,r){e=e||0;var o=n[1]-n[0];if(null!=a&&(a=FO(a,[0,o])),null!=r&&(r=Math.max(r,null!=a?a:0)),"all"===i){var s=Math.abs(t[1]-t[0]);s=FO(s,[0,o]),a=r=FO(s,[a,r]),i=0}t[0]=FO(t[0],n),t[1]=FO(t[1],n);var l=BO(t,i);t[i]+=e;var p,c=a||0,d=n.slice();return l.sign<0?d[0]+=c:d[1]-=c,t[i]=FO(t[i],d),p=BO(t,i),null!=a&&(p.sign!==l.sign||p.spanr&&(t[1-i]=t[i]+p.sign*r),t}function BO(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function FO(e,t){return Math.min(null!=t[1]?t[1]:1/0,Math.max(null!=t[0]?t[0]:-1/0,e))}var NO=Yr,LO=Math.min,VO=Math.max,qO=Math.floor,GO=Math.ceil,zO=ed,UO=Math.PI;!function(){function e(e,t,n){this.type="parallel",this._axesMap=Po(),this._axesLayout={},this.dimensions=e.dimensions,this._model=e,this._init(e,t,n)}e.prototype._init=function(e,t,n){var i=e.dimensions,a=e.parallelAxisIndex;NO(i,(function(e,n){var i=a[n],r=t.getComponent("parallelAxis",i),o=this._axesMap.set(e,new OO(e,lE(r),[0,0],r.get("type"),i)),s="category"===o.type;o.onBand=s&&r.get("boundaryGap"),o.inverse=r.get("inverse"),r.axis=o,o.model=r,o.coordinateSystem=r.coordinateSystem=this}),this)},e.prototype.update=function(e,t){this._updateAxesFromSeries(this._model,e)},e.prototype.containPoint=function(e){var t=this._makeLayoutInfo(),n=t.axisBase,i=t.layoutBase,a=t.pixelDimIndex,r=e[1-a],o=e[a];return r>=n&&r<=n+t.axisLength&&o>=i&&o<=i+t.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype._updateAxesFromSeries=function(e,t){t.eachSeries((function(n){if(e.contains(n,t)){var i=n.getData();NO(this.dimensions,(function(e){var t=this._axesMap.get(e);t.scale.unionExtentFromData(i,i.mapDimension(e)),sE(t.scale,t.model)}),this)}}),this)},e.prototype.resize=function(e,t){this._rect=kv(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),this._layoutAxes()},e.prototype.getRect=function(){return this._rect},e.prototype._makeLayoutInfo=function(){var e,t=this._model,n=this._rect,i=["x","y"],a=["width","height"],r=t.get("layout"),o="horizontal"===r?0:1,s=n[a[o]],l=[0,s],p=this.dimensions.length,c=jO(t.get("axisExpandWidth"),l),d=jO(t.get("axisExpandCount")||0,[0,p]),u=t.get("axisExpandable")&&p>3&&p>d&&d>1&&c>0&&s>0,m=t.get("axisExpandWindow");m?(e=jO(m[1]-m[0],l),m[1]=m[0]+e):(e=jO(c*(d-1),l),(m=[c*(t.get("axisExpandCenter")||qO(p/2))-e/2])[1]=m[0]+e);var h=(s-e)/(p-d);h<3&&(h=0);var g=[qO(zO(m[0]/c,1))+1,GO(zO(m[1]/c,1))-1],f=h/c*m[0];return{layout:r,pixelDimIndex:o,layoutBase:n[i[o]],layoutLength:s,axisBase:n[i[1-o]],axisLength:n[a[1-o]],axisExpandable:u,axisExpandWidth:c,axisCollapseWidth:h,axisExpandWindow:m,axisCount:p,winInnerIndices:g,axisExpandWindow0Pos:f}},e.prototype._layoutAxes=function(){var e=this._rect,t=this._axesMap,n=this.dimensions,i=this._makeLayoutInfo(),a=i.layout;t.each((function(e){var t=[0,i.axisLength],n=e.inverse?1:0;e.setExtent(t[n],t[1-n])})),NO(n,(function(t,n){var r=(i.axisExpandable?WO:HO)(n,i),o={horizontal:{x:r.position,y:i.axisLength},vertical:{x:0,y:r.position}},s={horizontal:UO/2,vertical:0},l=[o[a].x+e.x,o[a].y+e.y],p=s[a],c=[1,0,0,1,0,0];Ds(c,c,p),Ps(c,c,l),this._axesLayout[t]={position:l,rotation:p,transform:c,axisNameAvailableWidth:r.axisNameAvailableWidth,axisLabelShow:r.axisLabelShow,nameTruncateMaxWidth:r.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}}),this)},e.prototype.getAxis=function(e){return this._axesMap.get(e)},e.prototype.dataToPoint=function(e,t){return this.axisCoordToPoint(this._axesMap.get(t).dataToCoord(e),t)},e.prototype.eachActiveState=function(e,t,n,i){null==n&&(n=0),null==i&&(i=e.count());var a=this._axesMap,r=this.dimensions,o=[],s=[];Yr(r,(function(t){o.push(e.mapDimension(t)),s.push(a.get(t).model)}));for(var l=this.hasAxisBrushed(),p=n;pa*(1-c[0])?(l="jump",o=s-a*(1-c[2])):(o=s-a*c[1])>=0&&(o=s-a*(1-c[1]))<=0&&(o=0),(o*=t.axisExpandWidth/p)?RO(o,i,r,"all"):l="none";else{var u=i[1]-i[0];(i=[VO(0,r[1]*s/u-u/2)])[1]=LO(r[1],i[0]+u),i[0]=i[1]-u}return{axisExpandWindow:i,behavior:l}}}();function jO(e,t){return LO(VO(e,t[0]),t[1])}function HO(e,t){var n=t.layoutLength/(t.axisCount-1);return{position:n*e,axisNameAvailableWidth:n,axisLabelShow:!0}}function WO(e,t){var n,i,a=t.layoutLength,r=t.axisExpandWidth,o=t.axisCount,s=t.axisCollapseWidth,l=t.winInnerIndices,p=s,c=!1;return e=0;n--)td(t[n])},t.prototype.getActiveState=function(e){var t=this.activeIntervals;if(!t.length)return"normal";if(null==e||isNaN(+e))return"inactive";if(1===t.length){var n=t[0];if(n[0]<=e&&e<=n[1])return"active"}else for(var i=0,a=t.length;i6}(e)||r){if(o&&!r){"single"===s.brushMode&&uR(e);var l=qr(s);l.brushType=kR(l.brushType,o),l.panelId=o===KO?null:o.panelId,r=e._creatingCover=aR(e,l),e._covers.push(r)}if(r){var p=AR[kR(e._brushType,o)];r.__brushOption.range=p.getCreatingRange(TR(e,r,e._track)),i&&(rR(e,r),p.updateCommon(e,r)),oR(e,r),a={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&cR(e,t,n)&&uR(e)&&(a={isEnd:i,removeOnClick:!0});return a}function kR(e,t){return"auto"===e?t.defaultBrushType:e}var PR={mousedown:function(e){if(this._dragging)DR(this,e);else if(!e.target||!e.target.draggable){ER(e);var t=this.group.transformCoordToLocal(e.offsetX,e.offsetY);this._creatingCover=null,(this._creatingPanel=cR(this,e,t))&&(this._dragging=!0,this._track=[t.slice()])}},mousemove:function(e){var t=e.offsetX,n=e.offsetY,i=this.group.transformCoordToLocal(t,n);if(function(e,t,n){if(e._brushType&&!function(e,t,n){var i=e._zr;return t<0||t>i.getWidth()||n<0||n>i.getHeight()}(e,t.offsetX,t.offsetY)){var i=e._zr,a=e._covers,r=cR(e,t,n);if(!e._dragging)for(var o=0;o=0&&(r[a[o].depth]=new Ey(a[o],this,t));if(i&&n){var s=bO(i,n,this,!0,(function(e,t){e.wrapMethod("getItemModel",(function(e,t){var n=e.parentModel,i=n.getData().getItemLayout(t);if(i){var a=i.depth,r=n.levelModels[a];r&&(e.parentModel=r)}return e})),t.wrapMethod("getItemModel",(function(e,t){var n=e.parentModel,i=n.getGraph().getEdgeByIndex(t).node1.getLayout();if(i){var a=i.depth,r=n.levelModels[a];r&&(e.parentModel=r)}return e}))}));return s.data}},t.prototype.setNodePosition=function(e,t){var n=(this.option.data||this.option.nodes)[e];n.localX=t[0],n.localY=t[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(e,t,n){function i(e){return isNaN(e)||null==e}if("edge"===n){var a=this.getDataParams(e,n),r=a.data,o=a.value;return aw("nameValue",{name:r.source+" -- "+r.target,value:o,noValue:i(o)})}var s=this.getGraph().getNodeByIndex(e).getLayout().value,l=this.getDataParams(e,n).data.name;return aw("nameValue",{name:null!=l?l+"":null,value:s,noValue:i(s)})},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(t,n){var i=e.prototype.getDataParams.call(this,t,n);if(null==i.value&&"node"===n){var a=this.getGraph().getNodeByIndex(t).getLayout().value;i.value=a}return i},t.type="series.sankey",t.defaultOption={z:2,coordinateSystem:"view",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:"#314656",opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:"#212121"}},animationEasing:"linear",animationDuration:1e3}}(bw);var zR=function(){function e(){}return e.prototype.getInitialData=function(e,t){var n,i,a=t.getComponent("xAxis",this.get("xAxisIndex")),r=t.getComponent("yAxis",this.get("yAxisIndex")),o=a.get("type"),s=r.get("type");"category"===o?(e.layout="horizontal",n=a.getOrdinalMeta(),i=!0):"category"===s?(e.layout="vertical",n=r.getOrdinalMeta(),i=!0):e.layout=e.layout||"horizontal";var l=["x","y"],p="horizontal"===e.layout?0:1,c=this._baseAxisDim=l[p],d=l[1-p],u=[a,r],m=u[p].get("type"),h=u[1-p].get("type"),g=e.data;if(g&&i){var f=[];Yr(g,(function(e,t){var n;io(e)?(n=e.slice(),e.unshift(t)):io(e.value)?((n=Ur({},e)).value=n.value.slice(),e.value.unshift(t)):n=e,f.push(n)})),e.data=f}var y=this.defaultValueDimensions,v=[{name:c,type:A_(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:d,type:A_(h),dimsDef:y.slice()}];return JM(this,{coordDimensions:v,dimensionsCount:y.length+1,encodeDefaulter:no(Jv,v,this)})},e.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},e}(),UR=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],n.visualDrawType="stroke",n}return Qe(t,e),t.type="series.boxplot",t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}},animationDuration:800},t}(bw);$r(UR,zR,!0);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.render=function(e,t,n){var i=e.getData(),a=this.group,r=this._data;this._data||a.removeAll();var o="horizontal"===e.get("layout")?1:0;i.diff(r).add((function(e){if(i.hasValue(e)){var t=WR(i.getItemLayout(e),i,e,o,!0);i.setItemGraphicEl(e,t),a.add(t)}})).update((function(e,t){var n=r.getItemGraphicEl(t);if(i.hasValue(e)){var s=i.getItemLayout(e);n?(Sf(n),$R(s,n,i,e)):n=WR(s,i,e,o),a.add(n),i.setItemGraphicEl(e,n)}else a.remove(n)})).remove((function(e){var t=r.getItemGraphicEl(e);t&&a.remove(t)})).execute(),this._data=i},t.prototype.remove=function(e){var t=this.group,n=this._data;this._data=null,n&&n.eachItemGraphicEl((function(e){e&&t.remove(e)}))},t.type="boxplot"}(Aw);var jR=function(){},HR=function(e){function t(t){var n=e.call(this,t)||this;return n.type="boxplotBoxPath",n}return Qe(t,e),t.prototype.getDefaultShape=function(){return new jR},t.prototype.buildPath=function(e,t){var n=t.points,i=0;for(e.moveTo(n[i][0],n[i][1]),i++;i<4;i++)e.lineTo(n[i][0],n[i][1]);for(e.closePath();i0?"borderColor":"borderColor0"])||n.get(["itemStyle",e>0?"color":"color0"]);0===e&&(a=n.get(["itemStyle","borderColorDoji"]));var r=n.getModel("itemStyle").getItemStyle(YR);t.useStyle(r),t.style.fill=null,t.style.stroke=a}var oB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],n}return Qe(t,e),t.prototype.getShadowDim=function(){return"open"},t.prototype.brushSelector=function(e,t,n){var i=t.getItemLayout(e);return i&&n.rect(i.brushRect)},t.type="series.candlestick",t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderColorDoji:null,borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},t}(bw);$r(oB,zR,!0);var sB=["itemStyle","borderColor"],lB=["itemStyle","borderColor0"],pB=["itemStyle","borderColorDoji"],cB=["itemStyle","color"],dB=["itemStyle","color0"];kw(),kw();function uB(e,t,n,i,a,r){return n>i?-1:n0?e.get(a,t-1)<=i?1:-1:1}function mB(e,t){var n=t.rippleEffectColor||t.color;e.eachChild((function(e){e.attr({z:t.z,zlevel:t.zlevel,style:{stroke:"stroke"===t.brushType?n:null,fill:"fill"===t.brushType?n:null}})}))}var hB=function(e){function t(t,n){var i=e.call(this)||this,a=new AI(t,n),r=new zc;return i.add(a),i.add(r),i.updateData(t,n),i}return Qe(t,e),t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(e){for(var t=e.symbolType,n=e.color,i=e.rippleNumber,a=this.childAt(1),r=0;r0&&(r=this._getLineLength(i)/l*1e3),r!==this._period||o!==this._loop||s!==this._roundTrip){i.stopAnimation();var c=void 0;c=ao(p)?p(n):p,i.__t>0&&(c=-r*i.__t),this._animateSymbol(i,r,c,o,s)}this._period=r,this._loop=o,this._roundTrip=s}},t.prototype._animateSymbol=function(e,t,n,i,a){if(t>0){e.__t=0;var r=this,o=e.animate("",i).when(a?2*t:t,{__t:a?2:1}).delay(n).during((function(){r._updateSymbolPosition(e)}));i||o.done((function(){r.remove(e)})),o.start()}},t.prototype._getLineLength=function(e){return Ko(e.__p1,e.__cp1)+Ko(e.__cp1,e.__p2)},t.prototype._updateAnimationPoints=function(e,t){e.__p1=t[0],e.__p2=t[1],e.__cp1=t[2]||[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]},t.prototype.updateData=function(e,t,n){this.childAt(0).updateData(e,t,n),this._updateEffectSymbol(e,t)},t.prototype._updateSymbolPosition=function(e){var t=e.__p1,n=e.__p2,i=e.__cp1,a=e.__t<1?e.__t:2-e.__t,r=[e.x,e.y],o=r.slice(),s=Dl,l=Al;r[0]=s(t[0],i[0],n[0],a),r[1]=s(t[1],i[1],n[1],a);var p=e.__t<1?l(t[0],i[0],n[0],a):l(n[0],i[0],t[0],1-a),c=e.__t<1?l(t[1],i[1],n[1],a):l(n[1],i[1],t[1],1-a);e.rotation=-Math.atan2(c,p)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==e.__lastT&&e.__lastT=0&&!(i[r]<=t);r--);r=Math.min(r,a-2)}else{for(r=o;rt);r++);r=Math.min(r-1,a-2)}var s=(t-i[r])/(i[r+1]-i[r]),l=n[r],p=n[r+1];e.x=l[0]*(1-s)+s*p[0],e.y=l[1]*(1-s)+s*p[1];var c=e.__t<1?p[0]-l[0]:l[0]-p[0],d=e.__t<1?p[1]-l[1]:l[1]-p[1];e.rotation=-Math.atan2(d,c)-Math.PI/2,this._lastFrame=r,this._lastFramePercent=t,e.ignore=!1}},t}(gB),vB=function(){this.polyline=!1,this.curveness=0,this.segs=[]},xB=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return Qe(t,e),t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},t.prototype.getDefaultShape=function(){return new vB},t.prototype.buildPath=function(e,t){var n,i=t.segs,a=t.curveness;if(t.polyline)for(n=this._off;n0){e.moveTo(i[n++],i[n++]);for(var o=1;o0){var d=(s+p)/2-(l-c)*a,u=(l+c)/2-(p-s)*a;e.quadraticCurveTo(d,u,p,c)}else e.lineTo(p,c)}this.incremental&&(this._off=n,this.notClear=!0)},t.prototype.findDataIndex=function(e,t){var n=this.shape,i=n.segs,a=n.curveness,r=this.style.lineWidth;if(n.polyline)for(var o=0,s=0;s0)for(var p=i[s++],c=i[s++],d=1;d0){if(um(p,c,(p+u)/2-(c-m)*a,(c+m)/2-(u-p)*a,u,m,r,e,t))return o}else if(cm(p,c,u,m,r,e,t))return o;o++}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),i=this.getBoundingRect();return e=n[0],t=n[1],i.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape.segs,n=1/0,i=1/0,a=-1/0,r=-1/0,o=0;o0&&(r.dataIndex=n+e.__startIndex)}))},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),wB={seriesType:"lines",plan:kw(),reset:function(e){var t=e.coordinateSystem;if(t){var n=e.get("polyline"),i=e.pipelineContext.large;return{progress:function(a,r){var o=[];if(i){var s=void 0,l=a.end-a.start;if(n){for(var p=0,c=a.start;c0&&(l||s.configLayer(r,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(o/10+.9,1),0)})),a.updateData(i);var p=e.get("clip",!0)&&XI(e.coordinateSystem,!1,e);p?this.group.setClipPath(p):this.group.removeClipPath(),this._lastZlevel=r,this._finished=!0},t.prototype.incrementalPrepareRender=function(e,t,n){var i=e.getData();this._updateLineDraw(i,e).incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},t.prototype.incrementalRender=function(e,t,n){this._lineDraw.incrementalUpdate(e,t.getData()),this._finished=e.end===t.getData().count()},t.prototype.eachRendered=function(e){this._lineDraw&&this._lineDraw.eachRendered(e)},t.prototype.updateTransform=function(e,t,n){var i=e.getData(),a=e.pipelineContext;if(!this._finished||a.large||a.progressiveRender)return{update:!0};var r=wB.reset(e,t,n);r.progress&&r.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},t.prototype._updateLineDraw=function(e,t){var n=this._lineDraw,i=this._showEffect(t),a=!!t.get("polyline"),r=t.pipelineContext.large;return n&&i===this._hasEffet&&a===this._isPolyline&&r===this._isLargeDraw||(n&&n.remove(),n=this._lineDraw=r?new bB:new nO(a?i?yB:fB:i?gB:tO),this._hasEffet=i,this._isPolyline=a,this._isLargeDraw=r),this.group.add(n.group),n},t.prototype._showEffect=function(e){return!!e.get(["effect","show"])},t.prototype._clearLayer=function(e){var t=e.getZr();"svg"===t.painter.getType()||null==this._lastZlevel||t.painter.getLayer(this._lastZlevel).clear(!0)},t.prototype.remove=function(e,t){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(t)},t.prototype.dispose=function(e,t){this.remove(e,t)},t.type="lines"}(Aw),"undefined"==typeof Uint32Array?Array:Uint32Array),CB="undefined"==typeof Float64Array?Array:Float64Array;function _B(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=Xr(t,(function(e){var t={coords:[e[0].coord,e[1].coord]};return e[0].name&&(t.fromName=e[0].name),e[1].name&&(t.toName=e[1].name),zr([t,e[0],e[1]])})))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath="lineStyle",n.visualDrawType="stroke",n}Qe(t,e),t.prototype.init=function(t){t.data=t.data||[],_B(t);var n=this._processFlatCoordsArray(t.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(t.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},t.prototype.mergeOption=function(t){if(_B(t),t.data){var n=this._processFlatCoordsArray(t.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(t.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},t.prototype.appendData=function(e){var t=this._processFlatCoordsArray(e.data);t.flatCoords&&(this._flatCoords?(this._flatCoords=Do(this._flatCoords,t.flatCoords),this._flatCoordsOffset=Do(this._flatCoordsOffset,t.flatCoordsOffset)):(this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset),e.data=new Float32Array(t.count)),this.getRawData().appendData(e.data)},t.prototype._getCoordsFromItemModel=function(e){var t=this.getData().getItemModel(e),n=t.option instanceof Array?t.option:t.getShallow("coords");return n},t.prototype.getLineCoordsCount=function(e){return this._flatCoordsOffset?this._flatCoordsOffset[2*e+1]:this._getCoordsFromItemModel(e).length},t.prototype.getLineCoords=function(e,t){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[2*e],i=this._flatCoordsOffset[2*e+1],a=0;a ")})},t.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},t.prototype.getProgressive=function(){var e=this.option.progressive;return null==e?this.option.large?1e4:this.get("progressive"):e},t.prototype.getProgressiveThreshold=function(){var e=this.option.progressiveThreshold;return null==e?this.option.large?2e4:this.get("progressiveThreshold"):e},t.prototype.getZLevelKey=function(){var e=this.getModel("effect"),t=e.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:e.get("show")&&t>0?t+"":""},t.type="series.lines",t.dependencies=["grid","polar","geo","calendar"],t.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}}}(bw);var TB=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=Tr.createCanvas();this.canvas=e}return e.prototype.update=function(e,t,n,i,a,r){var o=this._getBrush(),s=this._getGradient(a,"inRange"),l=this._getGradient(a,"outOfRange"),p=this.pointSize+this.blurSize,c=this.canvas,d=c.getContext("2d"),u=e.length;c.width=t,c.height=n;for(var m=0;m0){var T=r(y)?s:l;y>0&&(y=y*C+S),x[b++]=T[_],x[b++]=T[_+1],x[b++]=T[_+2],x[b++]=T[_+3]*y*256}else b+=4}return d.putImageData(v,0,0),c},e.prototype._getBrush=function(){var e=this._brushCanvas||(this._brushCanvas=Tr.createCanvas()),t=this.pointSize+this.blurSize,n=2*t;e.width=n,e.height=n;var i=e.getContext("2d");return i.clearRect(0,0,n,n),i.shadowOffsetX=n,i.shadowBlur=this.blurSize,i.shadowColor="#000",i.beginPath(),i.arc(-t,t,this.pointSize,0,2*Math.PI,!0),i.closePath(),i.fill(),e},e.prototype._getGradient=function(e,t){for(var n=this._gradientPixels,i=n[t]||(n[t]=new Uint8ClampedArray(1024)),a=[0,0,0,0],r=0,o=0;o<256;o++)e[t](o/255,!0,a),i[r++]=a[0],i[r++]=a[1],i[r++]=a[2],i[r++]=a[3];return i},e}();function EB(e){var t=e.dimensions;return"lng"===t[0]&&"lat"===t[1]}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.render=function(e,t,n){var i;t.eachComponent("visualMap",(function(t){t.eachTargetSeries((function(n){n===e&&(i=t)}))})),this._progressiveEls=null,this.group.removeAll();var a=e.coordinateSystem;"cartesian2d"===a.type||"calendar"===a.type?this._renderOnCartesianAndCalendar(e,n,0,e.getData().count()):EB(a)&&this._renderOnGeo(a,e,i,n)},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll()},t.prototype.incrementalRender=function(e,t,n,i){var a=t.coordinateSystem;a&&(EB(a)?this.render(t,n,i):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(t,i,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){Zf(this._progressiveEls||this.group,e)},t.prototype._renderOnCartesianAndCalendar=function(e,t,n,i,a){var r,o,s,l,p=e.coordinateSystem,c=ZI(p,"cartesian2d");if(c){var d=p.getAxis("x"),u=p.getAxis("y");0,r=d.getBandWidth()+.5,o=u.getBandWidth()+.5,s=d.scale.getExtent(),l=u.scale.getExtent()}for(var m=this.group,h=e.getData(),g=e.getModel(["emphasis","itemStyle"]).getItemStyle(),f=e.getModel(["blur","itemStyle"]).getItemStyle(),y=e.getModel(["select","itemStyle"]).getItemStyle(),v=e.get(["itemStyle","borderRadius"]),x=iy(e),b=e.getModel("emphasis"),w=b.get("focus"),S=b.get("blurScope"),C=b.get("disabled"),_=c?[h.mapDimension("x"),h.mapDimension("y"),h.mapDimension("value")]:[h.mapDimension("time"),h.mapDimension("value")],T=n;Ts[1]||kl[1])continue;var P=p.dataToPoint([M,k]);E=new Gm({shape:{x:P[0]-r/2,y:P[1]-o/2,width:r,height:o},style:I})}else{if(isNaN(h.get(_[1],T)))continue;E=new Gm({z2:1,shape:p.dataToRect([h.get(_[0],T)]).contentShape,style:I})}if(h.hasItemOption){var D=h.getItemModel(T),A=D.getModel("emphasis");g=A.getModel("itemStyle").getItemStyle(),f=D.getModel(["blur","itemStyle"]).getItemStyle(),y=D.getModel(["select","itemStyle"]).getItemStyle(),v=D.get(["itemStyle","borderRadius"]),w=A.get("focus"),S=A.get("blurScope"),C=A.get("disabled"),x=iy(D)}E.shape.r=v;var O=e.getRawValue(T),R="-";O&&null!=O[2]&&(R=O[2]+""),ny(E,x,{labelFetcher:e,labelDataIndex:T,defaultOpacity:I.opacity,defaultText:R}),E.ensureState("emphasis").style=g,E.ensureState("blur").style=f,E.ensureState("select").style=y,Wh(E,w,S,C),E.incremental=a,a&&(E.states.emphasis.hoverLayer=!0),m.add(E),h.setItemGraphicEl(T,E),this._progressiveEls&&this._progressiveEls.push(E)}},t.prototype._renderOnGeo=function(e,t,n,i){var a=n.targetVisuals.inRange,r=n.targetVisuals.outOfRange,o=t.getData(),s=this._hmLayer||this._hmLayer||new TB;s.blurSize=t.get("blurSize"),s.pointSize=t.get("pointSize"),s.minOpacity=t.get("minOpacity"),s.maxOpacity=t.get("maxOpacity");var l=e.getViewRect().clone(),p=e.getRoamTransform();l.applyTransform(p);var c=Math.max(l.x,0),d=Math.max(l.y,0),u=Math.min(l.width+l.x,i.getWidth()),m=Math.min(l.height+l.y,i.getHeight()),h=u-c,g=m-d,f=[o.mapDimension("lng"),o.mapDimension("lat"),o.mapDimension("value")],y=o.mapArray(f,(function(t,n,i){var a=e.dataToPoint([t,n]);return a[0]-=c,a[1]-=d,a.push(i),a})),v=n.getExtent(),x="visualMap.continuous"===n.type?function(e,t){var n=e[1]-e[0];return t=[(t[0]-e[0])/n,(t[1]-e[0])/n],function(e){return e>=t[0]&&e<=t[1]}}(v,n.option.range):function(e,t,n){var i=e[1]-e[0],a=(t=Xr(t,(function(t){return{interval:[(t.interval[0]-e[0])/i,(t.interval[1]-e[0])/i]}}))).length,r=0;return function(e){var i;for(i=r;i=0;i--){var o;if((o=t[i].interval)[0]<=e&&e<=o[1]){r=i;break}}return i>=0&&i0?1:-1}(n,r,a,i,d),function(e,t,n,i,a,r,o,s,l,p){var c,d=l.valueDim,u=l.categoryDim,m=Math.abs(n[u.wh]),h=e.getItemVisual(t,"symbolSize");c=io(h)?h.slice():null==h?["100%","100%"]:[h,h];c[u.index]=Jc(c[u.index],m),c[d.index]=Jc(c[d.index],i?m:Math.abs(r)),p.symbolSize=c;var g=p.symbolScale=[c[0]/s,c[1]/s];g[d.index]*=(l.isHorizontal?-1:1)*o}(e,t,a,r,0,d.boundingLength,d.pxSign,p,i,d),function(e,t,n,i,a){var r=e.get(IB)||0;r&&(kB.attr({scaleX:t[0],scaleY:t[1],rotation:n}),kB.updateTransform(),r/=kB.getLineScale(),r*=t[i.valueDim.index]);a.valueLineWidth=r||0}(n,d.symbolScale,l,i,d);var u=d.symbolSize,m=WS(n.get("symbolOffset"),u);return function(e,t,n,i,a,r,o,s,l,p,c,d){var u=c.categoryDim,m=c.valueDim,h=d.pxSign,g=Math.max(t[m.index]+s,0),f=g;if(i){var y=Math.abs(l),v=yo(e.get("symbolMargin"),"15%")+"",x=!1;v.lastIndexOf("!")===v.length-1&&(x=!0,v=v.slice(0,v.length-1));var b=Jc(v,t[m.index]),w=Math.max(g+2*b,0),S=x?0:2*b,C=fd(i),_=C?i:WB((y+S)/w);w=g+2*(b=(y-_*g)/2/(x?_:Math.max(_-1,1))),S=x?0:2*b,C||"fixed"===i||(_=p?WB((Math.abs(p)+S)/w):0),f=_*w-S,d.repeatTimes=_,d.symbolMargin=b}var T=h*(f/2),E=d.pathPosition=[];E[u.index]=n[u.wh]/2,E[m.index]="start"===o?T:"end"===o?l-T:l/2,r&&(E[0]+=r[0],E[1]+=r[1]);var I=d.bundlePosition=[];I[u.index]=n[u.xy],I[m.index]=n[m.xy];var M=d.barRectShape=Ur({},n);M[m.wh]=h*Math.max(Math.abs(n[m.wh]),Math.abs(E[m.index]+T)),M[u.wh]=n[u.wh];var k=d.clipShape={};k[u.xy]=-n[u.xy],k[u.wh]=c.ecSize[u.wh],k[m.xy]=0,k[m.wh]=n[m.wh]}(n,u,a,r,0,m,s,d.valueLineWidth,d.boundingLength,d.repeatCutLength,i,d),d}function DB(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function AB(e){var t=e.symbolPatternSize,n=jS(e.symbolType,-t/2,-t/2,t,t);return n.attr({culling:!0}),"image"!==n.type&&n.setStyle({strokeNoScale:!0}),n}function OB(e,t,n,i){var a=e.__pictorialBundle,r=n.symbolSize,o=n.valueLineWidth,s=n.pathPosition,l=t.valueDim,p=n.repeatTimes||0,c=0,d=r[t.valueDim.index]+o+2*n.symbolMargin;for(UB(e,(function(e){e.__pictorialAnimationIndex=c,e.__pictorialRepeatTimes=p,c0:i<0)&&(a=p-1-e),t[l.index]=d*(a-p/2+.5)+s[l.index],{x:t[0],y:t[1],scaleX:n.symbolScale[0],scaleY:n.symbolScale[1],rotation:n.rotation}}}function RB(e,t,n,i){var a=e.__pictorialBundle,r=e.__pictorialMainPath;r?jB(r,null,{x:n.pathPosition[0],y:n.pathPosition[1],scaleX:n.symbolScale[0],scaleY:n.symbolScale[1],rotation:n.rotation},n,i):(r=e.__pictorialMainPath=AB(n),a.add(r),jB(r,{x:n.pathPosition[0],y:n.pathPosition[1],scaleX:0,scaleY:0,rotation:n.rotation},{scaleX:n.symbolScale[0],scaleY:n.symbolScale[1]},n,i))}function BB(e,t,n){var i=Ur({},t.barRectShape),a=e.__pictorialBarRect;a?jB(a,null,{shape:i},t,n):((a=e.__pictorialBarRect=new Gm({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}})).disableMorphing=!0,e.add(a))}function FB(e,t,n,i){if(n.symbolClip){var a=e.__pictorialClipPath,r=Ur({},n.clipShape),o=t.valueDim,s=n.animationModel,l=n.dataIndex;if(a)ff(a,{shape:r},s,l);else{r[o.wh]=0,a=new Gm({shape:r}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var p={};p[o.wh]=n.clipShape[o.wh],Qf[i?"updateProps":"initProps"](a,{shape:p},s,l)}}}function NB(e,t){var n=e.getItemModel(t);return n.getAnimationDelayParams=LB,n.isAnimationEnabled=VB,n}function LB(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function VB(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function qB(e,t,n,i){var a=new zc,r=new zc;return a.add(r),a.__pictorialBundle=r,r.x=n.bundlePosition[0],r.y=n.bundlePosition[1],n.symbolRepeat?OB(a,t,n):RB(a,0,n),BB(a,n,i),FB(a,t,n,i),a.__pictorialShapeStr=zB(e,n),a.__pictorialSymbolMeta=n,a}function GB(e,t,n,i){var a=i.__pictorialBarRect;a&&a.removeTextContent();var r=[];UB(i,(function(e){r.push(e)})),i.__pictorialMainPath&&r.push(i.__pictorialMainPath),i.__pictorialClipPath&&(n=null),Yr(r,(function(e){xf(e,{scaleX:0,scaleY:0},n,t,(function(){i.parent&&i.parent.remove(i)}))})),e.setItemGraphicEl(t,null)}function zB(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function UB(e,t,n){Yr(e.__pictorialBundle.children(),(function(i){i!==e.__pictorialBarRect&&t.call(n,i)}))}function jB(e,t,n,i,a,r){t&&e.attr(t),i.symbolClip&&!a?n&&e.attr(n):n&&Qf[a?"updateProps":"initProps"](e,n,i.animationModel,i.dataIndex,r)}function HB(e,t,n){var i=n.dataIndex,a=n.itemModel,r=a.getModel("emphasis"),o=r.getModel("itemStyle").getItemStyle(),s=a.getModel(["blur","itemStyle"]).getItemStyle(),l=a.getModel(["select","itemStyle"]).getItemStyle(),p=a.getShallow("cursor"),c=r.get("focus"),d=r.get("blurScope"),u=r.get("scale");UB(e,(function(e){if(e instanceof Rm){var t=e.style;e.useStyle(Ur({image:t.image,x:t.x,y:t.y,width:t.width,height:t.height},n.style))}else e.useStyle(n.style);var i=e.ensureState("emphasis");i.style=o,u&&(i.scaleX=1.1*e.scaleX,i.scaleY=1.1*e.scaleY),e.ensureState("blur").style=s,e.ensureState("select").style=l,p&&(e.cursor=p),e.z2=n.z2}));var m=t.valueDim.posDesc[+(n.boundingLength>0)],h=e.__pictorialBarRect;h.ignoreClip=!0,ny(h,iy(a),{labelFetcher:t.seriesModel,labelDataIndex:i,defaultText:PI(t.seriesModel.getData(),i),inheritColor:n.style.fill,defaultOpacity:n.style.opacity,defaultOutsidePosition:m}),Wh(e,c,d,r.get("disabled"))}function WB(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n.defaultSymbol="roundRect",n}Qe(t,e),t.prototype.getInitialData=function(t){return t.stack=null,e.prototype.getInitialData.apply(this,arguments)},t.type="series.pictorialBar",t.dependencies=["grid"],t.defaultOption=ky(hM.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:"#212121"}}})}(hM);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._layers=[],n}Qe(t,e),t.prototype.render=function(e,t,n){var i=e.getData(),a=this,r=this.group,o=e.getLayerSeries(),s=i.getLayout("layoutInfo"),l=s.rect,p=s.boundaryGap;function c(e){return e.name}r.x=0,r.y=l.y+p[0];var d=new k_(this._layersSeries||[],o,c,c),u=[];function m(t,n,s){var l=a._layers;if("remove"!==t){for(var p,c,d=[],m=[],h=o[n].indices,g=0;gT&&!ld(I-T)&&I0?(a.virtualPiece?a.virtualPiece.updateData(!1,i,e,t,n):(a.virtualPiece=new $B(i,e,t,n),l.add(a.virtualPiece)),r.piece.off("click"),a.virtualPiece.on("click",(function(e){a._rootToNode(r.parentNode)}))):a.virtualPiece&&(l.remove(a.virtualPiece),a.virtualPiece=null)}(o,s),this._initEvents(),this._oldChildren=c},t.prototype._initEvents=function(){var e=this;this.group.off("click"),this.group.on("click",(function(t){var n=!1;e.seriesModel.getViewRoot().eachNode((function(i){if(!n&&i.piece&&i.piece===t.target){var a=i.getModel().get("nodeClick");if("rootToNode"===a)e._rootToNode(i);else if("link"===a){var r=i.getModel(),o=r.get("link");if(o)Cv(o,r.get("target",!0)||"_blank")}n=!0}}))}))},t.prototype._rootToNode=function(e){e!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:KB,from:this.uid,seriesId:this.seriesModel.id,targetNode:e})},t.prototype.containPoint=function(e,t){var n=t.getData().getItemLayout(0);if(n){var i=e[0]-n.cx,a=e[1]-n.cy,r=Math.sqrt(i*i+a*a);return r<=n.r&&r>=n.r0}},t.type="sunburst"})(Aw),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreStyleOnData=!0,n}Qe(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};YB(n);var i=this._levelModels=Xr(e.levels||[],(function(e){return new Ey(e,this,t)}),this),a=ZD.createTree(n,this,(function(e){e.wrapMethod("getItemModel",(function(e,t){var n=a.getNodeByDataIndex(t),r=i[n.depth];return r&&(e.parentModel=r),e}))}));return a.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.getDataParams=function(t){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return n.treePathInfo=tA(i,this),n},t.prototype.getLevelModel=function(e){return this._levelModels&&this._levelModels[e.depth]},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(e){e?this._viewRoot=e:e=this._viewRoot;var t=this.getRawData().tree.root;e&&(e===t||t.contains(e))||(this._viewRoot=t)},t.prototype.enableAriaDecal=function(){nA(this)},t.type="series.sunburst",t.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"}}(bw);function YB(e){var t=0;Yr(e.children,(function(e){YB(e);var n=e.value;io(n)&&(n=n[0]),t+=n}));var n=e.value;io(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),io(e.value)?e.value[0]=n:e.value=n}Math.PI;var XB={color:"fill",borderColor:"stroke"},ZB={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},QB=Nd(),JB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},t.prototype.getInitialData=function(e,t){return lT(null,this)},t.prototype.getDataParams=function(t,n,i){var a=e.prototype.getDataParams.call(this,t,n);return i&&(a.info=QB(i).info),a},t.type="series.custom",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},t}(bw);function eF(e,t){return t=t||[0,0],Xr(["x","y"],(function(n,i){var a=this.getAxis(n),r=t[i],o=e[i]/2;return"category"===a.type?a.getBandWidth():Math.abs(a.dataToCoord(r-o)-a.dataToCoord(r+o))}),this)}function tF(e,t){return t=t||[0,0],Xr([0,1],(function(n){var i=t[n],a=e[n]/2,r=[],o=[];return r[n]=i-a,o[n]=i+a,r[1-n]=o[1-n]=t[1-n],Math.abs(this.dataToPoint(r)[n]-this.dataToPoint(o)[n])}),this)}function nF(e,t){var n=this.getAxis(),i=t instanceof Array?t[0]:t,a=(e instanceof Array?e[0]:e)/2;return"category"===n.type?n.getBandWidth():Math.abs(n.dataToCoord(i-a)-n.dataToCoord(i+a))}function iF(e,t){return t=t||[0,0],Xr(["Radius","Angle"],(function(n,i){var a=this["get"+n+"Axis"](),r=t[i],o=e[i]/2,s="category"===a.type?a.getBandWidth():Math.abs(a.dataToCoord(r-o)-a.dataToCoord(r+o));return"Angle"===n&&(s=s*Math.PI/180),s}),this)}function aF(e,t,n,i){return e&&(e.legacy||!1!==e.legacy&&!n&&!i&&"tspan"!==t&&("text"===t||Ro(e,"text")))}function rF(e,t,n){var i,a,r,o=e;if("text"===t)r=o;else{r={},Ro(o,"text")&&(r.text=o.text),Ro(o,"rich")&&(r.rich=o.rich),Ro(o,"textFill")&&(r.fill=o.textFill),Ro(o,"textStroke")&&(r.stroke=o.textStroke),Ro(o,"fontFamily")&&(r.fontFamily=o.fontFamily),Ro(o,"fontSize")&&(r.fontSize=o.fontSize),Ro(o,"fontStyle")&&(r.fontStyle=o.fontStyle),Ro(o,"fontWeight")&&(r.fontWeight=o.fontWeight),a={type:"text",style:r,silent:!0},i={};var s=Ro(o,"textPosition");n?i.position=s?o.textPosition:"inside":s&&(i.position=o.textPosition),Ro(o,"textPosition")&&(i.position=o.textPosition),Ro(o,"textOffset")&&(i.offset=o.textOffset),Ro(o,"textRotation")&&(i.rotation=o.textRotation),Ro(o,"textDistance")&&(i.distance=o.textDistance)}return oF(r,e),Yr(r.rich,(function(e){oF(e,e)})),{textConfig:i,textContent:a}}function oF(e,t){t&&(t.font=t.textFont||t.font,Ro(t,"textStrokeWidth")&&(e.lineWidth=t.textStrokeWidth),Ro(t,"textAlign")&&(e.align=t.textAlign),Ro(t,"textVerticalAlign")&&(e.verticalAlign=t.textVerticalAlign),Ro(t,"textLineHeight")&&(e.lineHeight=t.textLineHeight),Ro(t,"textWidth")&&(e.width=t.textWidth),Ro(t,"textHeight")&&(e.height=t.textHeight),Ro(t,"textBackgroundColor")&&(e.backgroundColor=t.textBackgroundColor),Ro(t,"textPadding")&&(e.padding=t.textPadding),Ro(t,"textBorderColor")&&(e.borderColor=t.textBorderColor),Ro(t,"textBorderWidth")&&(e.borderWidth=t.textBorderWidth),Ro(t,"textBorderRadius")&&(e.borderRadius=t.textBorderRadius),Ro(t,"textBoxShadowColor")&&(e.shadowColor=t.textBoxShadowColor),Ro(t,"textBoxShadowBlur")&&(e.shadowBlur=t.textBoxShadowBlur),Ro(t,"textBoxShadowOffsetX")&&(e.shadowOffsetX=t.textBoxShadowOffsetX),Ro(t,"textBoxShadowOffsetY")&&(e.shadowOffsetY=t.textBoxShadowOffsetY))}function sF(e,t,n){var i=e;i.textPosition=i.textPosition||n.position||"inside",null!=n.offset&&(i.textOffset=n.offset),null!=n.rotation&&(i.textRotation=n.rotation),null!=n.distance&&(i.textDistance=n.distance);var a=i.textPosition.indexOf("inside")>=0,r=e.fill||"#000";lF(i,t);var o=null==i.textFill;return a?o&&(i.textFill=n.insideFill||"#fff",!i.textStroke&&n.insideStroke&&(i.textStroke=n.insideStroke),!i.textStroke&&(i.textStroke=r),null==i.textStrokeWidth&&(i.textStrokeWidth=2)):(o&&(i.textFill=e.fill||n.outsideFill||"#000"),!i.textStroke&&n.outsideStroke&&(i.textStroke=n.outsideStroke)),i.text=t.text,i.rich=t.rich,Yr(t.rich,(function(e){lF(e,e)})),i}function lF(e,t){t&&(Ro(t,"fill")&&(e.textFill=t.fill),Ro(t,"stroke")&&(e.textStroke=t.fill),Ro(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),Ro(t,"font")&&(e.font=t.font),Ro(t,"fontStyle")&&(e.fontStyle=t.fontStyle),Ro(t,"fontWeight")&&(e.fontWeight=t.fontWeight),Ro(t,"fontSize")&&(e.fontSize=t.fontSize),Ro(t,"fontFamily")&&(e.fontFamily=t.fontFamily),Ro(t,"align")&&(e.textAlign=t.align),Ro(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),Ro(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),Ro(t,"width")&&(e.textWidth=t.width),Ro(t,"height")&&(e.textHeight=t.height),Ro(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),Ro(t,"padding")&&(e.textPadding=t.padding),Ro(t,"borderColor")&&(e.textBorderColor=t.borderColor),Ro(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),Ro(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),Ro(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),Ro(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),Ro(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Ro(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Ro(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),Ro(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),Ro(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),Ro(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}var pF={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},cF=eo(pF),dF=(Zr(wc,(function(e,t){return e[t]=1,e}),{}),wc.join(", "),["","style","shape","extra"]),uF=Nd();function mF(e,t,n,i,a){var r=e+"Animation",o=hf(e,i,a)||{},s=uF(t).userDuring;return o.duration>0&&(o.during=s?to(bF,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),Ur(o,n[r]),o}function hF(e,t,n,i){var a=(i=i||{}).dataIndex,r=i.isInit,o=i.clearStyle,s=n.isAnimationEnabled(),l=uF(e),p=t.style;l.userDuring=t.during;var c={},d={};if(function(e,t,n){for(var i=0;i=0)){var d=e.getAnimationStyleProps(),u=d?d.style:null;if(u){!a&&(a=i.style={});var m=eo(n);for(p=0;p0&&e.animateFrom(u,m)}else!function(e,t,n,i,a){if(a){var r=mF("update",e,t,i,n);r.duration>0&&e.animateFrom(a,r)}}(e,t,a||0,n,c);gF(e,t),p?e.dirty():e.markRedraw()}function gF(e,t){for(var n=uF(e).leaveToProps,i=0;i=0){!r&&(r=i[e]={});var u=eo(o);for(c=0;ci[1]&&i.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:i[1],r0:i[0]},api:{coord:function(i){var a=t.dataToRadius(i[0]),r=n.dataToAngle(i[1]),o=e.coordToPoint([a,r]);return o.push(a,r*Math.PI/180),o},size:to(iF,e)}}},calendar:function(e){var t=e.getRect(),n=e.getRangeInfo();return{coordSys:{type:"calendar",x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:n.start,end:n.end,weeks:n.weeks,dayCount:n.allDay}},api:{coord:function(t,n){return e.dataToPoint(t,n)}}}}};function LF(e){return e instanceof km}function VF(e){return e instanceof Iu}var qF=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.render=function(e,t,n,i){this._progressiveEls=null;var a=this._data,r=e.getData(),o=this.group,s=HF(e,r,t,n);a||o.removeAll(),r.diff(a).add((function(t){$F(n,null,t,s(t,i),e,o,r)})).remove((function(t){var n=a.getItemGraphicEl(t);n&&fF(n,QB(n).option,e)})).update((function(t,l){var p=a.getItemGraphicEl(l);$F(n,p,t,s(t,i),e,o,r)})).execute();var l=e.get("clip",!0)?XI(e.coordinateSystem,!1,e):null;l?o.setClipPath(l):o.removeClipPath(),this._data=r},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll(),this._data=null},t.prototype.incrementalRender=function(e,t,n,i,a){var r=t.getData(),o=HF(t,r,n,i),s=this._progressiveEls=[];function l(e){e.isGroup||(e.incremental=!0,e.ensureState("emphasis").hoverLayer=!0)}for(var p=e.start;p=0?t.getStore().get(a,n):void 0}var r=t.get(i.name,n),o=i&&i.ordinalMeta;return o?o.categories[r]:r},styleEmphasis:function(n,i){0;null==i&&(i=s);var a=v(i,MF).getItemStyle(),r=x(i,MF),o=ay(r,null,null,!0,!0);o.text=r.getShallow("show")?xo(e.getFormattedLabel(i,MF),e.getFormattedLabel(i,kF),PI(t,i)):null;var l=ry(r,null,!0);return w(n,a),a=sF(a,o,l),n&&b(a,n),a.legacy=!0,a},visual:function(e,n){if(null==n&&(n=s),Ro(XB,e)){var i=t.getItemVisual(n,"style");return i?i[XB[e]]:null}if(Ro(ZB,e))return t.getItemVisual(n,e)},barLayout:function(e){if("cartesian2d"===r.type){return function(e){var t=[],n=e.axis,i="axis0";if("category"===n.type){for(var a=n.getBandWidth(),r=0;r=d;h--){var g=t.childAt(h);JF(t,g,a)}}(e,d,n,i,a),o>=0?r.replaceAt(d,o):r.add(d),d}function YF(e,t,n){var i,a=QB(e),r=t.type,o=t.shape,s=t.style;return n.isUniversalTransitionEnabled()||null!=r&&r!==a.customGraphicType||"path"===r&&((i=o)&&(Ro(i,"pathData")||Ro(i,"d")))&&iN(o)!==a.customPathData||"image"===r&&Ro(s,"image")&&s.image!==a.customImagePath}function XF(e,t,n){var i=t?ZF(e,t):e,a=t?QF(e,i,MF):e.style,r=e.type,o=i?i.textConfig:null,s=e.textContent,l=s?t?ZF(s,t):s:null;if(a&&(n.isLegacy||aF(a,r,!!o,!!l))){n.isLegacy=!0;var p=rF(a,r,!t);!o&&p.textConfig&&(o=p.textConfig),!l&&p.textContent&&(l=p.textContent)}if(!t&&l){var c=l;!c.type&&(c.type="text")}var d=t?n[t]:n.normal;d.cfg=o,d.conOpt=l}function ZF(e,t){return t?e?e[t]:null:e}function QF(e,t,n){var i=t&&t.style;return null==i&&n===MF&&e&&(i=e.styleEmphasis),i}function JF(e,t,n){t&&fF(t,QB(e).option,n)}function eN(e,t){var n=e&&e.name;return null!=n?n:"e\0\0"+t}function tN(e,t){var n=this.context,i=null!=e?n.newChildren[e]:null,a=null!=t?n.oldChildren[t]:null;KF(n.api,a,n.dataIndex,i,n.seriesModel,n.group)}function nN(e){var t=this.context,n=t.oldChildren[e];n&&fF(n,QB(n).option,t.seriesModel)}function iN(e){return e&&(e.pathData||e.d)}function aN(e){e.registerChartView(qF),e.registerSeriesModel(JB)}var rN=Nd(),oN=qr,sN=to,lN=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,i){var a=t.get("value"),r=t.get("status");if(this._axisModel=e,this._axisPointerModel=t,this._api=n,i||this._lastValue!==a||this._lastStatus!==r){this._lastValue=a,this._lastStatus=r;var o=this._group,s=this._handle;if(!r||"hide"===r)return o&&o.hide(),void(s&&s.hide());o&&o.show(),s&&s.show();var l={};this.makeElOption(l,a,e,t,n);var p=l.graphicKey;p!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=p;var c=this._moveAnimation=this.determineAnimation(e,t);if(o){var d=no(pN,t,c);this.updatePointerEl(o,l,d),this.updateLabelEl(o,l,d,t)}else o=this._group=new zc,this.createPointerEl(o,l,e,t),this.createLabelEl(o,l,e,t),n.getZr().add(o);mN(o,t,!0),this._renderHandle(a)}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get("animation"),i=e.axis,a="category"===i.type,r=t.get("snap");if(!r&&!a)return!1;if("auto"===n||null==n){var o=this.animationThreshold;if(a&&i.getBandWidth()>o)return!0;if(r){var s=Vk(e).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>o}return!1}return!0===n},e.prototype.makeElOption=function(e,t,n,i,a){},e.prototype.createPointerEl=function(e,t,n,i){var a=t.pointer;if(a){var r=rN(e).pointerEl=new Qf[a.type](oN(t.pointer));e.add(r)}},e.prototype.createLabelEl=function(e,t,n,i){if(t.label){var a=rN(e).labelEl=new jm(oN(t.label));e.add(a),dN(a,i)}},e.prototype.updatePointerEl=function(e,t,n){var i=rN(e).pointerEl;i&&t.pointer&&(i.setStyle(t.pointer.style),n(i,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,i){var a=rN(e).labelEl;a&&(a.setStyle(t.label.style),n(a,{x:t.label.x,y:t.label.y}),dN(a,i))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t,n=this._axisPointerModel,i=this._api.getZr(),a=this._handle,r=n.getModel("handle"),o=n.get("status");if(!r.get("show")||!o||"hide"===o)return a&&i.remove(a),void(this._handle=null);this._handle||(t=!0,a=this._handle=Hf(r.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(e){Ss(e.event)},onmousedown:sN(this._onHandleDragMove,this,0,0),drift:sN(this._onHandleDragMove,this),ondragend:sN(this._onHandleDragEnd,this)}),i.add(a)),mN(a,n,!1),a.setStyle(r.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=r.get("size");io(s)||(s=[s,s]),a.scaleX=s[0]/2,a.scaleY=s[1]/2,zw(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,t)}},e.prototype._moveHandleToValue=function(e,t){pN(this._axisPointerModel,!t&&this._moveAnimation,this._handle,uN(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(uN(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(uN(i)),rN(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get("value");this._moveHandleToValue(e),this._api.dispatchAction({type:"hideTip"})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,i=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),i&&t.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),Uw(this,"_doDispatchAxisPointer")},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return{x:e[n=n||0],y:e[1-n],width:t[n],height:t[1-n]}},e}();function pN(e,t,n,i){cN(rN(n).lastProp,i)||(rN(n).lastProp=i,t?ff(n,i,e):(n.stopAnimation(),n.attr(i)))}function cN(e,t){if(lo(e)&&lo(t)){var n=!0;return Yr(t,(function(t,i){n=n&&cN(e[i],t)})),!!n}return e===t}function dN(e,t){e[t.get(["label","show"])?"show":"hide"]()}function uN(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function mN(e,t,n){var i=t.get("z"),a=t.get("zlevel");e&&e.traverse((function(e){"group"!==e.type&&(null!=i&&(e.z=i),null!=a&&(e.zlevel=a),e.silent=n)}))}function hN(e){var t,n=e.get("type"),i=e.getModel(n+"Style");return"line"===n?(t=i.getLineStyle()).fill=null:"shadow"===n&&((t=i.getAreaStyle()).stroke=null),t}function gN(e,t,n,i,a){var r=fN(n.get("value"),t.axis,t.ecModel,n.get("seriesDataIndices"),{precision:n.get(["label","precision"]),formatter:n.get(["label","formatter"])}),o=n.getModel("label"),s=fv(o.get("padding")||0),l=o.getFont(),p=Ec(r,l),c=a.position,d=p.width+s[1]+s[3],u=p.height+s[0]+s[2],m=a.align;"right"===m&&(c[0]-=d),"center"===m&&(c[0]-=d/2);var h=a.verticalAlign;"bottom"===h&&(c[1]-=u),"middle"===h&&(c[1]-=u/2),function(e,t,n,i){var a=i.getWidth(),r=i.getHeight();e[0]=Math.min(e[0]+t,a)-t,e[1]=Math.min(e[1]+n,r)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}(c,d,u,i);var g=o.get("backgroundColor");g&&"auto"!==g||(g=t.get(["axisLine","lineStyle","color"])),e.label={x:c[0],y:c[1],style:ay(o,{text:r,font:l,fill:o.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function fN(e,t,n,i,a){e=t.scale.parse(e);var r=t.scale.getLabel({value:e},{precision:a.precision}),o=a.formatter;if(o){var s={value:cE(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};Yr(i,(function(e){var t=n.getSeriesByIndex(e.seriesIndex),i=e.dataIndexInside,a=t&&t.getDataParams(i);a&&s.seriesData.push(a)})),ro(o)?r=o.replace("{value}",r):ao(o)&&(r=o(s))}return r}function yN(e,t,n){var i=[1,0,0,1,0,0];return Ds(i,i,n.rotation),Ps(i,i,n.position),Vf([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}function vN(e,t,n,i,a,r){var o=Dk.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=a.get(["label","margin"]),gN(t,i,a,r,{position:yN(i.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function xN(e,t,n){return{x1:e[n=n||0],y1:e[1-n],x2:t[n],y2:t[1-n]}}function bN(e,t,n){return{x:e[n=n||0],y:e[1-n],width:t[n],height:t[1-n]}}function wN(e,t,n,i,a,r){return{cx:e,cy:t,r0:n,r:i,startAngle:a,endAngle:r,clockwise:!0}}var SN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.grid,s=i.get("type"),l=CN(o,r).getOtherAxis(r).getGlobalExtent(),p=r.toGlobalCoord(r.dataToCoord(t,!0));if(s&&"none"!==s){var c=hN(i),d=_N[s](r,p,l);d.style=c,e.graphicKey=d.type,e.pointer=d}vN(t,e,wk(o.model,n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=wk(t.axis.grid.model,t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=yN(t.axis,e,i);return{x:a[0],y:a[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,i){var a=n.axis,r=a.grid,o=a.getGlobalExtent(!0),s=CN(r,a).getOtherAxis(a).getGlobalExtent(),l="x"===a.dim?0:1,p=[e.x,e.y];p[l]+=t[l],p[l]=Math.min(o[1],p[l]),p[l]=Math.max(o[0],p[l]);var c=(s[1]+s[0])/2,d=[c,c];d[l]=p[l];return{x:p[0],y:p[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},t}(lN);function CN(e,t){var n={};return n[t.dim+"AxisIndex"]=t.index,e.getCartesian(n)}var _N={line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:xN([t,n[0]],[t,n[1]],TN(e))}},shadow:function(e,t,n){var i=Math.max(1,e.getBandWidth()),a=n[1]-n[0];return{type:"Rect",shape:bN([t-i/2,n[0]],[i,a],TN(e))}}};function TN(e){return"x"===e.dim?0:1}var EN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="axisPointer",t.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},t}(Fv),IN=Nd(),MN=Yr;function kN(e,t,n){if(!xr.node){var i=t.getZr();IN(i).records||(IN(i).records={}),function(e,t){if(IN(e).initialized)return;function n(n,i){e.on(n,(function(n){var a=function(e){var t={showTip:[],hideTip:[]},n=function(i){var a=t[i.type];a?a.push(i):(i.dispatchAction=n,e.dispatchAction(i))};return{dispatchAction:n,pendings:t}}(t);MN(IN(e).records,(function(e){e&&i(e,n,a.dispatchAction)})),function(e,t){var n,i=e.showTip.length,a=e.hideTip.length;i?n=e.showTip[i-1]:a&&(n=e.hideTip[a-1]);n&&(n.dispatchAction=null,t.dispatchAction(n))}(a.pendings,t)}))}IN(e).initialized=!0,n("click",no(DN,"click")),n("mousemove",no(DN,"mousemove")),n("globalout",PN)}(i,t),(IN(i).records[e]||(IN(i).records[e]={})).handler=n}}function PN(e,t,n){e.handler("leave",null,n)}function DN(e,t,n,i){t.handler(e,n,i)}function AN(e,t){if(!xr.node){var n=t.getZr();(IN(n).records||{})[e]&&(IN(n).records[e]=null)}}var ON=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.render=function(e,t,n){var i=t.getComponent("tooltip"),a=e.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";kN("axisPointer",n,(function(e,t,n){"none"!==a&&("leave"===e||a.indexOf(e)>=0)&&n({type:"updateAxisPointer",currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})}))},t.prototype.remove=function(e,t){AN("axisPointer",t)},t.prototype.dispose=function(e,t){AN("axisPointer",t)},t.type="axisPointer",t}(Mw);function RN(e,t){var n,i=[],a=e.seriesIndex;if(null==a||!(n=t.getSeriesByIndex(a)))return{point:[]};var r=n.getData(),o=Fd(r,e);if(null==o||o<0||io(o))return{point:[]};var s=r.getItemGraphicEl(o),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var p=l.getBaseAxis(),c=l.getOtherAxis(p).dim,d=p.dim,u="x"===c||"radius"===c?1:0,m=r.mapDimension(d),h=[];h[u]=r.get(m,o),h[1-u]=r.get(r.getCalculationInfo("stackResultDimension"),o),i=l.dataToPoint(h)||[]}else i=l.dataToPoint(r.getValues(Xr(l.dimensions,(function(e){return r.mapDimension(e)})),o))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),i=[g.x+g.width/2,g.y+g.height/2]}return{point:i,el:s}}var BN=Nd();function FN(e,t,n){var i=e.currTrigger,a=[e.x,e.y],r=e,o=e.dispatchAction||to(n.dispatchAction,n),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){GN(a)&&(a=RN({seriesIndex:r.seriesIndex,dataIndex:r.dataIndex},t).point);var l=GN(a),p=r.axesInfo,c=s.axesInfo,d="leave"===i||GN(a),u={},m={},h={list:[],map:{}},g={showPointer:no(LN,m),showTooltip:no(VN,h)};Yr(s.coordSysMap,(function(e,t){var n=l||e.containPoint(a);Yr(s.coordSysAxesInfo[t],(function(e,t){var i=e.axis,r=function(e,t){for(var n=0;n<(e||[]).length;n++){var i=e[n];if(t.axis.dim===i.axisDim&&t.axis.model.componentIndex===i.axisIndex)return i}}(p,e);if(!d&&n&&(!p||r)){var o=r&&r.value;null!=o||l||(o=i.pointToData(a)),null!=o&&NN(e,o,g,!1,u)}}))}));var f={};return Yr(c,(function(e,t){var n=e.linkGroup;n&&!m[t]&&Yr(n.axesInfo,(function(t,i){var a=m[i];if(t!==e&&a){var r=a.value;n.mapper&&(r=e.axis.scale.parse(n.mapper(r,qN(t),qN(e)))),f[e.key]=r}}))})),Yr(f,(function(e,t){NN(c[t],e,g,!0,u)})),function(e,t,n){var i=n.axesInfo=[];Yr(t,(function(t,n){var a=t.axisPointerModel.option,r=e[n];r?(!t.useHandle&&(a.status="show"),a.value=r.value,a.seriesDataIndices=(r.payloadBatch||[]).slice()):!t.useHandle&&(a.status="hide"),"show"===a.status&&i.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:a.value})}))}(m,c,u),function(e,t,n,i){if(GN(t)||!e.list.length)return void i({type:"hideTip"});var a=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:e.list})}(h,a,e,o),function(e,t,n){var i=n.getZr(),a="axisPointerLastHighlights",r=BN(i)[a]||{},o=BN(i)[a]={};Yr(e,(function(e,t){var n=e.axisPointerModel.option;"show"===n.status&&e.triggerEmphasis&&Yr(n.seriesDataIndices,(function(e){var t=e.seriesIndex+" | "+e.dataIndex;o[t]=e}))}));var s=[],l=[];Yr(r,(function(e,t){!o[t]&&l.push(e)})),Yr(o,(function(e,t){!r[t]&&s.push(e)})),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(c,0,n),u}}function NN(e,t,n,i,a){var r=e.axis;if(!r.scale.isBlank()&&r.containData(t))if(e.involveSeries){var o=function(e,t){var n=t.axis,i=n.dim,a=e,r=[],o=Number.MAX_VALUE,s=-1;return Yr(t.seriesModels,(function(t,l){var p,c,d=t.getData().mapDimensionsAll(i);if(t.getAxisTooltipData){var u=t.getAxisTooltipData(d,e,n);c=u.dataIndices,p=u.nestestValue}else{if(!(c=t.getData().indicesOfNearest(d[0],e,"category"===n.type?.5:null)).length)return;p=t.getData().get(d[0],c[0])}if(null!=p&&isFinite(p)){var m=e-p,h=Math.abs(m);h<=o&&((h=0&&s<0)&&(o=h,s=m,a=p,r.length=0),Yr(c,(function(e){r.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})})))}})),{payloadBatch:r,snapToValue:a}}(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&null==a.seriesIndex&&Ur(a,s[0]),!i&&e.snap&&r.containData(l)&&null!=l&&(t=l),n.showPointer(e,t,s),n.showTooltip(e,o,l)}else n.showPointer(e,t)}function LN(e,t,n,i){e[t.key]={value:n,payloadBatch:i}}function VN(e,t,n,i){var a=n.payloadBatch,r=t.axis,o=r.model,s=t.axisPointerModel;if(t.triggerTooltip&&a.length){var l=t.coordSys.model,p=Gk(l),c=e.map[p];c||(c=e.map[p]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},e.list.push(c)),c.dataByAxis.push({axisDim:r.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function qN(e){var t=e.axis.model,n={},i=n.axisDim=e.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=t.componentIndex,n.axisName=n[i+"AxisName"]=t.name,n.axisId=n[i+"AxisId"]=t.id,n}function GN(e){return!e||null==e[0]||isNaN(e[0])||null==e[1]||isNaN(e[1])}function zN(e){Uk.registerAxisPointerClass("CartesianAxisPointer",SN),e.registerComponentModel(EN),e.registerComponentView(ON),e.registerPreprocessor((function(e){if(e){(!e.axisPointer||0===e.axisPointer.length)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!io(t)&&(e.axisPointer.link=[t])}})),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,(function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=Nk(e,t)})),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},FN)}function UN(e){vE(tP),vE(zN)}var jN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis;"angle"===r.dim&&(this.animationThreshold=Math.PI/18);var o=r.polar,s=o.getOtherAxis(r).getExtent(),l=r.dataToCoord(t),p=i.get("type");if(p&&"none"!==p){var c=hN(i),d=HN[p](r,o,l,s);d.style=c,e.graphicKey=d.type,e.pointer=d}var u=function(e,t,n,i,a){var r=t.axis,o=r.dataToCoord(e),s=i.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l,p,c,d=i.getRadiusAxis().getExtent();if("radius"===r.dim){var u=[1,0,0,1,0,0];Ds(u,u,s),Ps(u,u,[i.cx,i.cy]),l=Vf([o,-a],u);var m=t.getModel("axisLabel").get("rotate")||0,h=Dk.innerTextLayout(s,m*Math.PI/180,-1);p=h.textAlign,c=h.textVerticalAlign}else{var g=d[1];l=i.coordToPoint([g+a,o]);var f=i.cx,y=i.cy;p=Math.abs(l[0]-f)/g<.3?"center":l[0]>f?"left":"right",c=Math.abs(l[1]-y)/g<.3?"middle":l[1]>y?"top":"bottom"}return{position:l,align:p,verticalAlign:c}}(t,n,0,o,i.get(["label","margin"]));gN(e,n,i,a,u)},t}(lN);var HN={line:function(e,t,n,i){return"angle"===e.dim?{type:"Line",shape:xN(t.coordToPoint([i[0],n]),t.coordToPoint([i[1],n]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r:n}}},shadow:function(e,t,n,i){var a=Math.max(1,e.getBandWidth()),r=Math.PI/180;return"angle"===e.dim?{type:"Sector",shape:wN(t.cx,t.cy,i[0],i[1],(-n-a/2)*r,(a/2-n)*r)}:{type:"Sector",shape:wN(t.cx,t.cy,n-a/2,n+a/2,0,2*Math.PI)}}},WN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.findAxisModel=function(e){var t;return this.ecModel.eachComponent(e,(function(e){e.getCoordSysModel()===this&&(t=e)}),this),t},t.type="polar",t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}(Fv),$N=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Qe(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Gd).models[0]},t.type="polarAxis",t}(Fv);$r($N,gE);var KN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="angleAxis",t}($N),YN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="radiusAxis",t}($N),XN=function(e){function t(t,n){return e.call(this,"radius",t,n)||this}return Qe(t,e),t.prototype.pointToData=function(e,t){return this.polar.pointToData(e,t)["radius"===this.dim?0:1]},t}(zE);XN.prototype.dataToRadius=zE.prototype.dataToCoord,XN.prototype.radiusToData=zE.prototype.coordToData;var ZN=Nd(),QN=function(e){function t(t,n){return e.call(this,"angle",t,n||[0,360])||this}return Qe(t,e),t.prototype.pointToData=function(e,t){return this.polar.pointToData(e,t)["radius"===this.dim?0:1]},t.prototype.calculateCategoryInterval=function(){var e=this,t=e.getLabelModel(),n=e.scale,i=n.getExtent(),a=n.count();if(i[1]-i[0]<1)return 0;var r=i[0],o=e.dataToCoord(r+1)-e.dataToCoord(r),s=Math.abs(o),l=Ec(null==r?"":r+"",t.getFont(),"center","top"),p=Math.max(l.height,7)/s;isNaN(p)&&(p=1/0);var c=Math.max(0,Math.floor(p)),d=ZN(e.model),u=d.lastAutoInterval,m=d.lastTickCount;return null!=u&&null!=m&&Math.abs(u-c)<=1&&Math.abs(m-a)<=1&&u>c?c=u:(d.lastTickCount=a,d.lastAutoInterval=c),c},t}(zE);QN.prototype.dataToAngle=zE.prototype.dataToCoord,QN.prototype.angleToData=zE.prototype.coordToData;var JN=["radius","angle"],eL=function(){function e(e){this.dimensions=JN,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new XN,this._angleAxis=new QN,this.axisPointerEnabled=!0,this.name=e||"",this._radiusAxis.polar=this._angleAxis.polar=this}return e.prototype.containPoint=function(e){var t=this.pointToCoord(e);return this._radiusAxis.contain(t[0])&&this._angleAxis.contain(t[1])},e.prototype.containData=function(e){return this._radiusAxis.containData(e[0])&&this._angleAxis.containData(e[1])},e.prototype.getAxis=function(e){return this["_"+e+"Axis"]},e.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},e.prototype.getAxesByScale=function(e){var t=[],n=this._angleAxis,i=this._radiusAxis;return n.scale.type===e&&t.push(n),i.scale.type===e&&t.push(i),t},e.prototype.getAngleAxis=function(){return this._angleAxis},e.prototype.getRadiusAxis=function(){return this._radiusAxis},e.prototype.getOtherAxis=function(e){var t=this._angleAxis;return e===t?this._radiusAxis:t},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},e.prototype.getTooltipAxes=function(e){var t=null!=e&&"auto"!==e?this.getAxis(e):this.getBaseAxis();return{baseAxes:[t],otherAxes:[this.getOtherAxis(t)]}},e.prototype.dataToPoint=function(e,t){return this.coordToPoint([this._radiusAxis.dataToRadius(e[0],t),this._angleAxis.dataToAngle(e[1],t)])},e.prototype.pointToData=function(e,t){var n=this.pointToCoord(e);return[this._radiusAxis.radiusToData(n[0],t),this._angleAxis.angleToData(n[1],t)]},e.prototype.pointToCoord=function(e){var t=e[0]-this.cx,n=e[1]-this.cy,i=this.getAngleAxis(),a=i.getExtent(),r=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]);i.inverse?r=o-360:o=r+360;var s=Math.sqrt(t*t+n*n);t/=s,n/=s;for(var l=Math.atan2(-n,t)/Math.PI*180,p=lo;)l+=360*p;return[s,l]},e.prototype.coordToPoint=function(e){var t=e[0],n=e[1]/180*Math.PI;return[Math.cos(n)*t+this.cx,-Math.sin(n)*t+this.cy]},e.prototype.getArea=function(){var e=this.getAngleAxis(),t=this.getRadiusAxis().getExtent().slice();t[0]>t[1]&&t.reverse();var n=e.getExtent(),i=Math.PI/180;return{cx:this.cx,cy:this.cy,r0:t[0],r:t[1],startAngle:-n[0]*i,endAngle:-n[1]*i,clockwise:e.inverse,contain:function(e,t){var n=e-this.cx,i=t-this.cy,a=n*n+i*i-1e-4,r=this.r,o=this.r0;return a<=r*r&&a>=o*o}}},e.prototype.convertToPixel=function(e,t,n){return tL(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return tL(t)===this?this.pointToData(n):null},e}();function tL(e){var t=e.seriesModel,n=e.polarModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}function nL(e,t){var n=this,i=n.getAngleAxis(),a=n.getRadiusAxis();if(i.scale.setExtent(1/0,-1/0),a.scale.setExtent(1/0,-1/0),e.eachSeries((function(e){if(e.coordinateSystem===n){var t=e.getData();Yr(hE(t,"radius"),(function(e){a.scale.unionExtentFromData(t,e)})),Yr(hE(t,"angle"),(function(e){i.scale.unionExtentFromData(t,e)}))}})),sE(i.scale,i.model),sE(a.scale,a.model),"category"===i.type&&!i.onBand){var r=i.getExtent(),o=360/i.scale.count();i.inverse?r[1]+=o:r[1]-=o,i.setExtent(r[0],r[1])}}function iL(e,t){var n;if(e.type=t.get("type"),e.scale=lE(t),e.onBand=t.get("boundaryGap")&&"category"===e.type,e.inverse=t.get("inverse"),function(e){return"angleAxis"===e.mainType}(t)){e.inverse=e.inverse!==t.get("clockwise");var i=t.get("startAngle"),a=null!==(n=t.get("endAngle"))&&void 0!==n?n:i+(e.inverse?-360:360);e.setExtent(i,a)}t.axis=e,e.model=t}var aL={dimensions:JN,create:function(e,t){var n=[];return e.eachComponent("polar",(function(e,i){var a=new eL(i+"");a.update=nL;var r=a.getRadiusAxis(),o=a.getAngleAxis(),s=e.findAxisModel("radiusAxis"),l=e.findAxisModel("angleAxis");iL(r,s),iL(o,l),function(e,t,n){var i=t.get("center"),a=n.getWidth(),r=n.getHeight();e.cx=Jc(i[0],a),e.cy=Jc(i[1],r);var o=e.getRadiusAxis(),s=Math.min(a,r)/2,l=t.get("radius");null==l?l=[0,"100%"]:io(l)||(l=[0,l]);var p=[Jc(l[0],s),Jc(l[1],s)];o.inverse?o.setExtent(p[1],p[0]):o.setExtent(p[0],p[1])}(a,e,t),n.push(a),e.coordinateSystem=a,a.model=e})),e.eachSeries((function(e){if("polar"===e.get("coordinateSystem")){var t=e.getReferringComponents("polar",Gd).models[0];0,e.coordinateSystem=t.coordinateSystem}})),n}},rL=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function oL(e,t,n){t[1]>t[0]&&(t=t.slice().reverse());var i=e.coordToPoint([t[0],n]),a=e.coordToPoint([t[1],n]);return{x1:i[0],y1:i[1],x2:a[0],y2:a[1]}}function sL(e){return e.getRadiusAxis().inverse?0:1}function lL(e){var t=e[0],n=e[e.length-1];t&&n&&Math.abs(Math.abs(t.coord-n.coord)-360)<1e-4&&e.pop()}var pL=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="PolarAxisPointer",n}return Qe(t,e),t.prototype.render=function(e,t){if(this.group.removeAll(),e.get("show")){var n=e.axis,i=n.polar,a=i.getRadiusAxis().getExtent(),r=n.getTicksCoords(),o=n.getMinorTicksCoords(),s=Xr(n.getViewLabels(),(function(e){e=qr(e);var t=n.scale,i="ordinal"===t.type?t.getRawOrdinalNumber(e.tickValue):e.tickValue;return e.coord=n.dataToCoord(i),e}));lL(s),lL(r),Yr(rL,(function(t){!e.get([t,"show"])||n.scale.isBlank()&&"axisLine"!==t||cL[t](this.group,e,i,r,o,a,s)}),this)}},t.type="angleAxis",t}(Uk),cL={axisLine:function(e,t,n,i,a,r){var o,s=t.getModel(["axisLine","lineStyle"]),l=n.getAngleAxis(),p=Math.PI/180,c=l.getExtent(),d=sL(n),u=d?0:1,m=360===Math.abs(c[1]-c[0])?"Circle":"Arc";(o=0===r[u]?new Qf[m]({shape:{cx:n.cx,cy:n.cy,r:r[d],startAngle:-c[0]*p,endAngle:-c[1]*p,clockwise:l.inverse},style:s.getLineStyle(),z2:1,silent:!0}):new qg({shape:{cx:n.cx,cy:n.cy,r:r[d],r0:r[u]},style:s.getLineStyle(),z2:1,silent:!0})).style.fill=null,e.add(o)},axisTick:function(e,t,n,i,a,r){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=r[sL(n)],p=Xr(i,(function(e){return new Kg({shape:oL(n,[l,l+s],e.coord)})}));e.add(Rf(p,{style:jr(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,n,i,a,r){if(a.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),p=r[sL(n)],c=[],d=0;dh?"left":"right",y=Math.abs(m[1]-g)/u<.3?"middle":m[1]>g?"top":"bottom";if(s&&s[d]){var v=s[d];lo(v)&&v.textStyle&&(o=new Ey(v.textStyle,l,l.ecModel))}var x=new jm({silent:Dk.isLabelSilent(t),style:ay(o,{x:m[0],y:m[1],fill:o.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:i.formattedLabel,align:f,verticalAlign:y})});if(e.add(x),c){var b=Dk.makeAxisEventDataBase(t);b.targetType="axisLabel",b.value=i.rawLabel,ih(x).eventData=b}}),this)},splitLine:function(e,t,n,i,a,r){var o=t.getModel("splitLine").getModel("lineStyle"),s=o.get("color"),l=0;s=s instanceof Array?s:[s];for(var p=[],c=0;c=0?"p":"n",E=b;v&&(i[s][_]||(i[s][_]={p:b,n:b}),E=i[s][_][T]);var I=void 0,M=void 0,k=void 0,P=void 0;if("radius"===d.dim){var D=d.dataToCoord(C)-b,A=r.dataToCoord(_);Math.abs(D)=P})}}}))}var vL={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},xL={splitNumber:5},bL=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="polar",t}(Mw);function wL(e){vE(zN),Uk.registerAxisPointerClass("PolarAxisPointer",jN),e.registerCoordinateSystem("polar",aL),e.registerComponentModel(WN),e.registerComponentView(bL),hk(e,"angle",KN,vL),hk(e,"radius",YN,xL),e.registerComponentView(pL),e.registerComponentView(mL),e.registerLayout(no(yL,"bar"))}function SL(e,t){t=t||{};var n=e.coordinateSystem,i=e.axis,a={},r=i.position,o=i.orient,s=n.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],p={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};a.position=["vertical"===o?p.vertical[r]:l[0],"horizontal"===o?p.horizontal[r]:l[3]];a.rotation=Math.PI/2*{horizontal:0,vertical:1}[o];a.labelDirection=a.tickDirection=a.nameDirection={top:-1,bottom:1,right:1,left:-1}[r],e.get(["axisTick","inside"])&&(a.tickDirection=-a.tickDirection),yo(t.labelInside,e.get(["axisLabel","inside"]))&&(a.labelDirection=-a.labelDirection);var c=t.rotate;return null==c&&(c=e.get(["axisLabel","rotate"])),a.labelRotation="top"===r?-c:c,a.z2=1,a}var CL=["axisLine","axisTickLabel","axisName"],_L=["splitArea","splitLine"],TL=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="SingleAxisPointer",n}Qe(t,e),t.prototype.render=function(t,n,i,a){var r=this.group;r.removeAll();var o=this._axisGroup;this._axisGroup=new zc;var s=SL(t),l=new Dk(t,s);Yr(CL,l.add,l),r.add(this._axisGroup),r.add(l.getGroup()),Yr(_L,(function(e){t.get([e,"show"])&&TL[e](this,this.group,this._axisGroup,t)}),this),zf(o,this._axisGroup,t),e.prototype.render.call(this,t,n,i,a)},t.prototype.remove=function(){Wk(this)},t.type="singleAxis"}(Uk),{splitLine:function(e,t,n,i){var a=i.axis;if(!a.scale.isBlank()){var r=i.getModel("splitLine"),o=r.getModel("lineStyle"),s=o.get("color");s=s instanceof Array?s:[s];for(var l=o.get("width"),p=i.coordinateSystem.getRect(),c=a.isHorizontal(),d=[],u=0,m=a.getTicksCoords({tickModel:r}),h=[],g=[],f=0;f=t.y&&e[1]<=t.y+t.height:n.contain(n.toLocalCoord(e[1]))&&e[0]>=t.y&&e[0]<=t.y+t.height},e.prototype.pointToData=function(e){var t=this.getAxis();return[t.coordToData(t.toLocalCoord(e["horizontal"===t.orient?0:1]))]},e.prototype.dataToPoint=function(e){var t=this.getAxis(),n=this.getRect(),i=[],a="horizontal"===t.orient?0:1;return e instanceof Array&&(e=e[0]),i[a]=t.toGlobalCoord(t.dataToCoord(+e)),i[1-a]=0===a?n.y+n.height/2:n.x+n.width/2,i},e.prototype.convertToPixel=function(e,t,n){return kL(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return kL(t)===this?this.pointToData(n):null}}();function kL(e){var t=e.seriesModel,n=e.singleAxisModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}var PL=["x","y"],DL=["width","height"],AL=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Qe(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.coordinateSystem,s=RL(o,1-OL(r)),l=o.dataToPoint(t)[0],p=i.get("type");if(p&&"none"!==p){var c=hN(i),d=AL[p](r,l,s);d.style=c,e.graphicKey=d.type,e.pointer=d}vN(t,e,SL(n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=SL(t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=yN(t.axis,e,i);return{x:a[0],y:a[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,i){var a=n.axis,r=a.coordinateSystem,o=OL(a),s=RL(r,o),l=[e.x,e.y];l[o]+=t[o],l[o]=Math.min(s[1],l[o]),l[o]=Math.max(s[0],l[o]);var p=RL(r,1-o),c=(p[1]+p[0])/2,d=[c,c];return d[o]=l[o],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:{verticalAlign:"middle"}}}}(lN),{line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:xN([t,n[0]],[t,n[1]],OL(e))}},shadow:function(e,t,n){var i=e.getBandWidth(),a=n[1]-n[0];return{type:"Rect",shape:bN([t-i/2,n[0]],[i,a],OL(e))}}});function OL(e){return e.isHorizontal()?0:1}function RL(e,t){var n=e.getRect();return[n[PL[t]],n[PL[t]]+n[DL[t]]]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.type="single"}(Mw);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.init=function(t,n,i){var a=Ov(t);e.prototype.init.apply(this,arguments),BL(t,a)},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),BL(this.option,t)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type="calendar",t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}}}(Fv);function BL(e,t){var n,i=e.cellSize;1===(n=io(i)?i:e.cellSize=[i,i]).length&&(n[1]=n[0]);var a=Xr([0,1],(function(e){return function(e,t){return null!=e[Ev[t][0]]||null!=e[Ev[t][1]]&&null!=e[Ev[t][2]]}(t,e)&&(n[e]="auto"),null!=n[e]&&"auto"!==n[e]}));Av(e,t,{type:"box",ignoreSize:a})}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.render=function(e,t,n){var i=this.group;i.removeAll();var a=e.coordinateSystem,r=a.getRangeInfo(),o=a.getOrient(),s=t.getLocaleModel();this._renderDayRect(e,r,i),this._renderLines(e,r,o,i),this._renderYearText(e,r,o,i),this._renderMonthText(e,s,o,i),this._renderWeekText(e,s,r,o,i)},t.prototype._renderDayRect=function(e,t,n){for(var i=e.coordinateSystem,a=e.getModel("itemStyle").getItemStyle(),r=i.getCellWidth(),o=i.getCellHeight(),s=t.start.time;s<=t.end.time;s=i.getNextNDay(s,1).time){var l=i.dataToRect([s],!1).tl,p=new Gm({shape:{x:l[0],y:l[1],width:r,height:o},cursor:"default",style:a});n.add(p)}},t.prototype._renderLines=function(e,t,n,i){var a=this,r=e.coordinateSystem,o=e.getModel(["splitLine","lineStyle"]).getLineStyle(),s=e.get(["splitLine","show"]),l=o.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var p=t.start,c=0;p.time<=t.end.time;c++){u(p.formatedDate),0===c&&(p=r.getDateInfo(t.start.y+"-"+t.start.m));var d=p.date;d.setMonth(d.getMonth()+1),p=r.getDateInfo(d)}function u(t){a._firstDayOfMonth.push(r.getDateInfo(t)),a._firstDayPoints.push(r.dataToRect([t],!1).tl);var l=a._getLinePointsOfOneWeek(e,t,n);a._tlpoints.push(l[0]),a._blpoints.push(l[l.length-1]),s&&a._drawSplitline(l,o,i)}u(r.getNextNDay(t.end.time,1).formatedDate),s&&this._drawSplitline(a._getEdgesPoints(a._tlpoints,l,n),o,i),s&&this._drawSplitline(a._getEdgesPoints(a._blpoints,l,n),o,i)},t.prototype._getEdgesPoints=function(e,t,n){var i=[e[0].slice(),e[e.length-1].slice()],a="horizontal"===n?0:1;return i[0][a]=i[0][a]-t/2,i[1][a]=i[1][a]+t/2,i},t.prototype._drawSplitline=function(e,t,n){var i=new Hg({z2:20,shape:{points:e},style:t});n.add(i)},t.prototype._getLinePointsOfOneWeek=function(e,t,n){for(var i=e.coordinateSystem,a=i.getDateInfo(t),r=[],o=0;o<7;o++){var s=i.getNextNDay(a.time,o),l=i.dataToRect([s.time],!1);r[2*s.day]=l.tl,r[2*s.day+1]=l["horizontal"===n?"bl":"tr"]}return r},t.prototype._formatterLabel=function(e,t){return ro(e)&&e?(n=e,Yr(t,(function(e,t){n=n.replace("{"+t+"}",i?ms(e):e)})),n):ao(e)?e(t):t.nameMap;var n,i},t.prototype._yearTextPositionControl=function(e,t,n,i,a){var r=t[0],o=t[1],s=["center","bottom"];"bottom"===i?(o+=a,s=["center","top"]):"left"===i?r-=a:"right"===i?(r+=a,s=["center","top"]):o-=a;var l=0;return"left"!==i&&"right"!==i||(l=Math.PI/2),{rotation:l,x:r,y:o,style:{align:s[0],verticalAlign:s[1]}}},t.prototype._renderYearText=function(e,t,n,i){var a=e.getModel("yearLabel");if(a.get("show")){var r=a.get("margin"),o=a.get("position");o||(o="horizontal"!==n?"top":"left");var s=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],l=(s[0][0]+s[1][0])/2,p=(s[0][1]+s[1][1])/2,c="horizontal"===n?0:1,d={top:[l,s[c][1]],bottom:[l,s[1-c][1]],left:[s[1-c][0],p],right:[s[c][0],p]},u=t.start.y;+t.end.y>+t.start.y&&(u=u+"-"+t.end.y);var m=a.get("formatter"),h={start:t.start.y,end:t.end.y,nameMap:u},g=this._formatterLabel(m,h),f=new jm({z2:30,style:ay(a,{text:g})});f.attr(this._yearTextPositionControl(f,d[o],n,o,r)),i.add(f)}},t.prototype._monthTextPositionControl=function(e,t,n,i,a){var r="left",o="top",s=e[0],l=e[1];return"horizontal"===n?(l+=a,t&&(r="center"),"start"===i&&(o="bottom")):(s+=a,t&&(o="middle"),"start"===i&&(r="right")),{x:s,y:l,align:r,verticalAlign:o}},t.prototype._renderMonthText=function(e,t,n,i){var a=e.getModel("monthLabel");if(a.get("show")){var r=a.get("nameMap"),o=a.get("margin"),s=a.get("position"),l=a.get("align"),p=[this._tlpoints,this._blpoints];r&&!ro(r)||(r&&(t=Ny(r)||t),r=t.get(["time","monthAbbr"])||[]);var c="start"===s?0:1,d="horizontal"===n?0:1;o="start"===s?-o:o;for(var u="center"===l,m=0;m=i.start.time&&n.timeo.end.time&&e.reverse(),e},e.prototype._getRangeInfo=function(e){var t,n=[this.getDateInfo(e[0]),this.getDateInfo(e[1])];n[0].time>n[1].time&&(t=!0,n.reverse());var i=Math.floor(n[1].time/FL)-Math.floor(n[0].time/FL)+1,a=new Date(n[0].time),r=a.getDate(),o=n[1].date.getDate();a.setDate(r+i-1);var s=a.getDate();if(s!==o)for(var l=a.getTime()-n[1].time>0?1:-1;(s=a.getDate())!==o&&(a.getTime()-n[1].time)*l>0;)i-=l,a.setDate(s-l);var p=Math.floor((i+n[0].day+6)/7),c=t?1-p:p-1;return t&&n.reverse(),{range:[n[0].formatedDate,n[1].formatedDate],start:n[0],end:n[1],allDay:i,weeks:p,nthWeek:c,fweek:n[0].day,lweek:n[1].day}},e.prototype._getDateByWeeksAndDay=function(e,t,n){var i=this._getRangeInfo(n);if(e>i.weeks||0===e&&ti.lweek)return null;var a=7*(e-1)-i.fweek+t,r=new Date(i.start.time);return r.setDate(+i.start.d+a),this.getDateInfo(r)},e.create=function(t,n){var i=[];return t.eachComponent("calendar",(function(a){var r=new e(a,t,n);i.push(r),a.coordinateSystem=r})),t.eachSeries((function(e){"calendar"===e.get("coordinateSystem")&&(e.coordinateSystem=i[e.get("calendarIndex")||0])})),i},e.dimensions=["time","value"]}();function NL(e){var t=e.calendarModel,n=e.seriesModel;return t?t.coordinateSystem:n?n.coordinateSystem:null}function LL(e,t){var n;return Yr(t,(function(t){null!=e[t]&&"auto"!==e[t]&&(n=!0)})),n}var VL=["transition","enterFrom","leaveTo"],qL=VL.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function GL(e,t,n){if(n&&(!e[n]&&t[n]&&(e[n]={}),e=e[n],t=t[n]),e&&t)for(var i=n?VL:qL,a=0;a=0;l--){var u,m,h;if(h=null!=(m=Od((u=n[l]).id,null))?a.get(m):null){var g=h.parent,f=(d=UL(g),{}),y=Pv(h,u,g===i?{width:r,height:o}:{width:d.width,height:d.height},null,{hv:u.hv,boundingMode:u.bounding},f);if(!UL(h).isNew&&y){for(var v=u.transition,x={},b=0;b=0)?x[w]=S:h[w]=S}ff(h,x,e,0)}else h.attr(f)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each((function(n){WL(n,UL(n).option,t,e._lastGraphicModel)})),this._elMap=Po()},t.prototype.dispose=function(){this._clear()},t.type="graphic"}(Mw);function jL(e){var t=Ro(zL,e)?zL[e]:Pf(e);var n=new t({});return UL(n).type=e,n}function HL(e,t,n,i){var a=jL(n);return t.add(a),i.set(e,a),UL(a).id=e,UL(a).isNew=!0,a}function WL(e,t,n,i){e&&e.parent&&("group"===e.type&&e.traverse((function(e){WL(e,t,n,i)})),fF(e,t,i),n.removeKey(UL(e).id))}function $L(e,t,n,i){e.isGroup||Yr([["cursor",Iu.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],(function(n){var i=n[0];Ro(t,i)?e[i]=vo(t[i],n[1]):null==e[i]&&(e[i]=n[1])})),Yr(eo(t),(function(n){if(0===n.indexOf("on")){var i=t[n];e[n]=ao(i)?i:null}})),Ro(t,"draggable")&&(e.draggable=t.draggable),null!=t.name&&(e.name=t.name),null!=t.id&&(e.id=t.id)}var KL=["x","y","radius","angle","single"],YL=["cartesian2d","polar","singleAxis"];function XL(e){return e+"Axis"}function ZL(e,t){var n,i=Po(),a=[],r=Po();e.eachComponent({mainType:"dataZoom",query:t},(function(e){r.get(e.uid)||s(e)}));do{n=!1,e.eachComponent("dataZoom",o)}while(n);function o(e){!r.get(e.uid)&&function(e){var t=!1;return e.eachTargetAxis((function(e,n){var a=i.get(e);a&&a[n]&&(t=!0)})),t}(e)&&(s(e),n=!0)}function s(e){r.set(e.uid,!0),a.push(e),e.eachTargetAxis((function(e,t){(i.get(e)||i.set(e,[]))[t]=!0}))}return a}function QL(e){var t=e.ecModel,n={infoList:[],infoMap:Po()};return e.eachTargetAxis((function(e,i){var a=t.getComponent(XL(e),i);if(a){var r=a.getCoordSysModel();if(r){var o=r.uid,s=n.infoMap.get(o);s||(s={model:r,axisModels:[]},n.infoList.push(s),n.infoMap.set(o,s)),s.axisModels.push(a)}}})),n}var JL=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),eV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=["percent","percent"],n}return Qe(t,e),t.prototype.init=function(e,t,n){var i=tV(e);this.settledOption=i,this.mergeDefaultAndTheme(e,n),this._doInit(i)},t.prototype.mergeOption=function(e){var t=tV(e);Gr(this.option,e,!0),Gr(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;Yr([["start","startValue"],["end","endValue"]],(function(e,i){"value"===this._rangePropMode[i]&&(t[e[0]]=n[e[0]]=null)}),this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get("orient",!0),t=this._targetAxisInfoMap=Po();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||"horizontal",this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each((function(e){e.indexList.length&&(this._noTarget=!1)}),this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return Yr(KL,(function(n){var i=this.getReferringComponents(XL(n),zd);if(i.specified){t=!0;var a=new JL;Yr(i.models,(function(e){a.add(e.componentIndex)})),e.set(n,a)}}),this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,i=!0;if(i){var a="vertical"===t?"y":"x";r(n.findComponents({mainType:a+"Axis"}),a)}i&&r(n.findComponents({mainType:"singleAxis",filter:function(e){return e.get("orient",!0)===t}}),"single");function r(t,n){var a=t[0];if(a){var r=new JL;if(r.add(a.componentIndex),e.set(n,r),i=!1,"x"===n||"y"===n){var o=a.getReferringComponents("grid",Gd).models[0];o&&Yr(t,(function(e){a.componentIndex!==e.componentIndex&&o===e.getReferringComponents("grid",Gd).models[0]&&r.add(e.componentIndex)}))}}}i&&Yr(KL,(function(t){if(i){var a=n.findComponents({mainType:XL(t),filter:function(e){return"category"===e.get("type",!0)}});if(a[0]){var r=new JL;r.add(a[0].componentIndex),e.set(t,r),i=!1}}}),this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis((function(t){!e&&(e=t)}),this),"y"===e?"vertical":"horizontal"},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get("rangeMode");Yr([["start","startValue"],["end","endValue"]],(function(i,a){var r=null!=e[i[0]],o=null!=e[i[1]];r&&!o?t[a]="percent":!r&&o?t[a]="value":n?t[a]=n[a]:r&&(t[a]="percent")}))},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis((function(t,n){null==e&&(e=this.ecModel.getComponent(XL(t),n))}),this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each((function(n,i){Yr(n.indexList,(function(n){e.call(t,i,n)}))}))},t.prototype.getAxisProxy=function(e,t){var n=this.getAxisModel(e,t);if(n)return n.__dzAxisProxy},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(XL(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;Yr([["start","startValue"],["end","endValue"]],(function(i){null==e[i[0]]&&null==e[i[1]]||(t[i[0]]=n[i[0]]=e[i[0]],t[i[1]]=n[i[1]]=e[i[1]])}),this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;Yr(["start","startValue","end","endValue"],(function(n){t[n]=e[n]}))},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getDataPercentWindow()},t.prototype.getValueRange=function(e,t){var n;if(null==e&&null==t){if(n=this.findRepresentativeAxisProxy())return n.getDataValueWindow()}else if(n=this.getAxisProxy(e,t))return n.getDataValueWindow()},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return e.__dzAxisProxy;for(var t,n=this._targetAxisInfoMap.keys(),i=0;i=0}(t)){var n=XL(this._dimName),i=t.getReferringComponents(n,Gd).models[0];i&&this._axisIndex===i.componentIndex&&e.push(t)}}),this),e},e.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},e.prototype.getMinMaxSpan=function(){return qr(this._minMaxSpan)},e.prototype.calculateDataWindow=function(e){var t,n=this._dataExtent,i=this.getAxisModel().axis.scale,a=this._dataZoomModel.getRangePropMode(),r=[0,100],o=[],s=[];iV(["start","end"],(function(l,p){var c=e[l],d=e[l+"Value"];"percent"===a[p]?(null==c&&(c=r[p]),d=i.parse(Qc(c,r,n))):(t=!0,c=Qc(d=null==d?n[p]:i.parse(d),n,r)),s[p]=null==d||isNaN(d)?n[p]:d,o[p]=null==c||isNaN(c)?r[p]:c})),aV(s),aV(o);var l=this._minMaxSpan;function p(e,t,n,a,r){var o=r?"Span":"ValueSpan";RO(0,e,n,"all",l["min"+o],l["max"+o]);for(var s=0;s<2;s++)t[s]=Qc(e[s],n,a,!0),r&&(t[s]=i.parse(t[s]))}return t?p(s,o,n,r,!1):p(o,s,r,n,!0),{valueWindow:s,percentWindow:o}},e.prototype.reset=function(e){if(e===this._dataZoomModel){var t=this.getTargetSeriesModels();this._dataExtent=function(e,t,n){var i=[1/0,-1/0];iV(n,(function(e){!function(e,t,n){t&&Yr(hE(t,n),(function(n){var i=t.getApproximateExtent(n);i[0]e[1]&&(e[1]=i[1])}))}(i,e.getData(),t)}));var a=e.getAxisModel(),r=aE(a.axis.scale,a,i).calculate();return[r.min,r.max]}(this,this._dimName,t),this._updateMinMaxSpan();var n=this.calculateDataWindow(e.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},e.prototype.filterData=function(e,t){if(e===this._dataZoomModel){var n=this._dimName,i=this.getTargetSeriesModels(),a=e.get("filterMode"),r=this._valueWindow;"none"!==a&&iV(i,(function(e){var t=e.getData(),i=t.mapDimensionsAll(n);if(i.length){if("weakFilter"===a){var o=t.getStore(),s=Xr(i,(function(e){return t.getDimensionIndex(e)}),t);t.filterSelf((function(e){for(var t,n,a,l=0;lr[1];if(c&&!d&&!u)return!0;c&&(a=!0),d&&(t=!0),u&&(n=!0)}return a&&t&&n}))}else iV(i,(function(n){if("empty"===a)e.setData(t=t.map(n,(function(e){return function(e){return e>=r[0]&&e<=r[1]}(e)?e:NaN})));else{var i={};i[n]=r,t.selectRange(i)}}));iV(i,(function(e){t.setApproximateExtent(r,e)}))}}))}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._dataExtent;iV(["min","max"],(function(i){var a=t.get(i+"Span"),r=t.get(i+"ValueSpan");null!=r&&(r=this.getAxisModel().axis.scale.parse(r)),null!=r?a=Qc(n[0]+r,n,[0,100],!0):null!=a&&(r=Qc(a,[0,100],n,!0)-n[0]),e[i+"Span"]=a,e[i+"ValueSpan"]=r}),this)},e.prototype._setAxisModel=function(){var e=this.getAxisModel(),t=this._percentWindow,n=this._valueWindow;if(t){var i=ad(n,[0,500]);i=Math.min(i,20);var a=e.axis.scale.rawExtentInfo;0!==t[0]&&a.setDeterminedMinMax("min",+n[0].toFixed(i)),100!==t[1]&&a.setDeterminedMinMax("max",+n[1].toFixed(i)),a.freeze()}},e}();var oV={getTargetSeries:function(e){function t(t){e.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,a){var r=e.getComponent(XL(i),a);t(i,a,r,n)}))}))}t((function(e,t,n,i){n.__dzAxisProxy=null}));var n=[];t((function(t,i,a,r){a.__dzAxisProxy||(a.__dzAxisProxy=new rV(t,i,r,e),n.push(a.__dzAxisProxy))}));var i=Po();return Yr(n,(function(e){Yr(e.getTargetSeriesModels(),(function(e){i.set(e.uid,e)}))})),i},overallReset:function(e,t){e.eachComponent("dataZoom",(function(e){e.eachTargetAxis((function(t,n){var i=e.getAxisProxy(t,n);i&&i.reset(e)})),e.eachTargetAxis((function(n,i){var a=e.getAxisProxy(n,i);a&&a.filterData(e,t)}))})),e.eachComponent("dataZoom",(function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getDataPercentWindow(),i=t.getDataValueWindow();e.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}}))}};var sV=!1;function lV(e){sV||(sV=!0,e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,oV),function(e){e.registerAction("dataZoom",(function(e,t){Yr(ZL(t,e),(function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})}))}))}(e),e.registerSubTypeDefaulter("dataZoom",(function(){return"slider"})))}var pV=function(){},cV={};function dV(e){return cV[e]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;Yr(this.option.feature,(function(e,n){var i=dV(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(t)),Gr(e,i.defaultOption))}))},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}}}(Fv);function uV(e,t){var n=fv(t.get("padding")),i=t.getItemStyle(["color","opacity"]);return i.fill=t.get("backgroundColor"),e=new Gm({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get("borderRadius")},style:i,silent:!0,z2:-1})}!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Qe(t,e),t.prototype.render=function(e,t,n,i){var a=this.group;if(a.removeAll(),e.get("show")){var r=+e.get("itemSize"),o="vertical"===e.get("orient"),s=e.get("feature")||{},l=this._features||(this._features={}),p=[];Yr(s,(function(e,t){p.push(t)})),new k_(this._featureNames||[],p).add(c).update(c).remove(no(c,null)).execute(),this._featureNames=p,function(e,t,n){var i=t.getBoxLayoutParams(),a=t.get("padding"),r={width:n.getWidth(),height:n.getHeight()},o=kv(i,r,a);Mv(t.get("orient"),e,t.get("itemGap"),o.width,o.height),Pv(e,i,r,a)}(a,e,n),a.add(uV(a.getBoundingRect(),e)),o||a.eachChild((function(e){var t=e.__title,i=e.ensureState("emphasis"),o=i.textConfig||(i.textConfig={}),s=e.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!ao(l)&&t){var p=l.style||(l.style={}),c=Ec(t,jm.makeFont(p)),d=e.x+a.x,u=!1;e.y+a.y+r+c.height>n.getHeight()&&(o.position="top",u=!0);var m=u?-5-c.height:r+10;d+c.width/2>n.getWidth()?(o.position=["100%",m],p.align="right"):d-c.width/2<0&&(o.position=[0,m],p.align="left")}}))}function c(c,d){var u,m=p[c],h=p[d],g=s[m],f=new Ey(g,e,e.ecModel);if(i&&null!=i.newTitle&&i.featureName===m&&(g.title=i.newTitle),m&&!h){if(function(e){return 0===e.indexOf("my")}(m))u={onclick:f.option.onclick,featureName:m};else{var y=dV(m);if(!y)return;u=new y}l[m]=u}else if(!(u=l[h]))return;u.uid=My("toolbox-feature"),u.model=f,u.ecModel=t,u.api=n;var v=u instanceof pV;m||!h?!f.get("show")||v&&u.unusable?v&&u.remove&&u.remove(t,n):(!function(i,s,l){var p,c,d=i.getModel("iconStyle"),u=i.getModel(["emphasis","iconStyle"]),m=s instanceof pV&&s.getIcons?s.getIcons():i.get("icon"),h=i.get("title")||{};ro(m)?(p={})[l]=m:p=m;ro(h)?(c={})[l]=h:c=h;var g=i.iconPaths={};Yr(p,(function(l,p){var m=Hf(l,{},{x:-r/2,y:-r/2,width:r,height:r});m.setStyle(d.getItemStyle()),m.ensureState("emphasis").style=u.getItemStyle();var h=new jm({style:{text:c[p],align:u.get("textAlign"),borderRadius:u.get("textBorderRadius"),padding:u.get("textPadding"),fill:null,font:cy({fontStyle:u.get("textFontStyle"),fontFamily:u.get("textFontFamily"),fontSize:u.get("textFontSize"),fontWeight:u.get("textFontWeight")},t)},ignore:!0});m.setTextContent(h),Yf({el:m,componentModel:e,itemName:p,formatterParamsExtra:{title:c[p]}}),m.__title=c[p],m.on("mouseover",(function(){var t=u.getItemStyle(),i=o?null==e.get("right")&&"right"!==e.get("left")?"right":"left":null==e.get("bottom")&&"bottom"!==e.get("top")?"bottom":"top";h.setStyle({fill:u.get("textFill")||t.fill||t.stroke||"#000",backgroundColor:u.get("textBackgroundColor")}),m.setTextConfig({position:u.get("textPosition")||i}),h.ignore=!e.get("showTitle"),n.enterEmphasis(this)})).on("mouseout",(function(){"emphasis"!==i.get(["iconStatus",p])&&n.leaveEmphasis(this),h.hide()})),("emphasis"===i.get(["iconStatus",p])?Ah:Oh)(m),a.add(m),m.on("click",to(s.onclick,s,t,n,p)),g[p]=m}))}(f,u,m),f.setIconStatus=function(e,t){var n=this.option,i=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[e]=t,i[e]&&("emphasis"===t?Ah:Oh)(i[e])},u instanceof pV&&u.render&&u.render(f,t,n,i)):v&&u.dispose&&u.dispose(t,n)}},t.prototype.updateView=function(e,t,n,i){Yr(this._features,(function(e){e instanceof pV&&e.updateView&&e.updateView(e.model,t,n,i)}))},t.prototype.remove=function(e,t){Yr(this._features,(function(n){n instanceof pV&&n.remove&&n.remove(e,t)})),this.group.removeAll()},t.prototype.dispose=function(e,t){Yr(this._features,(function(n){n instanceof pV&&n.dispose&&n.dispose(e,t)}))},t.type="toolbox"}(Mw);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Qe(t,e),t.prototype.onclick=function(e,t){var n=this.model,i=n.get("name")||e.get("title.0.text")||"echarts",a="svg"===t.getZr().painter.getType(),r=a?"svg":n.get("type",!0)||"png",o=t.getConnectedDataURL({type:r,backgroundColor:n.get("backgroundColor",!0)||e.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),s=xr.browser;if(ao(MouseEvent)&&(s.newEdge||!s.ie&&!s.edge)){var l=document.createElement("a");l.download=i+"."+r,l.target="_blank",l.href=o;var p=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});l.dispatchEvent(p)}else if(window.navigator.msSaveOrOpenBlob||a){var c=o.split(","),d=c[0].indexOf("base64")>-1,u=a?decodeURIComponent(c[1]):c[1];d&&(u=window.atob(u));var m=i+"."+r;if(window.navigator.msSaveOrOpenBlob){for(var h=u.length,g=new Uint8Array(h);h--;)g[h]=u.charCodeAt(h);var f=new Blob([g]);window.navigator.msSaveOrOpenBlob(f,m)}else{var y=document.createElement("iframe");document.body.appendChild(y);var v=y.contentWindow,x=v.document;x.open("image/svg+xml","replace"),x.write(u),x.close(),v.focus(),x.execCommand("SaveAs",!0,m),document.body.removeChild(y)}}else{var b=n.get("lang"),w='',S=window.open();S.document.write(w),S.document.title=i}},t.getDefaultOption=function(e){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:e.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:e.getLocaleModel().get(["toolbox","saveAsImage","lang"])}}}(pV);var mV="__ec_magicType_stack__",hV=[["line","bar"],["stack"]],gV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Qe(t,e),t.prototype.getIcons=function(){var e=this.model,t=e.get("icon"),n={};return Yr(e.get("type"),(function(e){t[e]&&(n[e]=t[e])})),n},t.getDefaultOption=function(e){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:e.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},t.prototype.onclick=function(e,t,n){var i=this.model,a=i.get(["seriesIndex",n]);if(gV[n]){var r,o={series:[]};Yr(hV,(function(e){Hr(e,n)>=0&&Yr(e,(function(e){i.setIconStatus(e,"normal")}))})),i.setIconStatus(n,"emphasis"),e.eachComponent({mainType:"series",query:null==a?null:{seriesIndex:a}},(function(e){var t=e.subType,a=e.id,r=gV[n](t,a,e,i);r&&(jr(r,e.option),o.series.push(r));var s=e.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===n||"bar"===n)){var l=s.getAxesByScale("ordinal")[0];if(l){var p=l.dim+"Axis",c=e.getReferringComponents(p,Gd).models[0].componentIndex;o[p]=o[p]||[];for(var d=0;d<=c;d++)o[p][c]=o[p][c]||{};o[p][c].boundaryGap="bar"===n}}}));var s=n;"stack"===n&&(r=Gr({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(s="tiled")),t.dispatchAction({type:"changeMagicType",currentType:s,newOption:o,newTitle:r,featureName:"magicType"})}}}(pV),{line:function(e,t,n,i){if("bar"===e)return Gr({id:t,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(e,t,n,i){if("line"===e)return Gr({id:t,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(e,t,n,i){var a=n.get("stack")===mV;if("line"===e||"bar"===e)return i.setIconStatus("stack",a?"normal":"emphasis"),Gr({id:t,stack:a?"":mV},i.get(["option","stack"])||{},!0)}});w_({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(e,t){t.mergeOption(e.newOption)}));var fV=new Array(60).join("-"),yV="\t";function vV(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var xV=new RegExp("[\t]+","g");function bV(e,t){var n=e.split(new RegExp("\n*"+fV+"\n*","g")),i={series:[]};return Yr(n,(function(e,n){if(function(e){if(e.slice(0,e.indexOf("\n")).indexOf(yV)>=0)return!0}(e)){var a=function(e){for(var t=e.split(/\n+/g),n=[],i=Xr(vV(t.shift()).split(xV),(function(e){return{name:e,data:[]}})),a=0;a=0)&&e(a,i._targetInfoList)}))}return e.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,(function(e,t,n){if((e.coordRanges||(e.coordRanges=[])).push(t),!e.coordRange){e.coordRange=t;var i=AV[e.brushType](0,n,t);e.__rangeOffset={offset:RV[e.brushType](i.values,e.range,[1,1]),xyMinMax:i.xyMinMax}}})),e},e.prototype.matchOutputRanges=function(e,t,n){Yr(e,(function(e){var i=this.findTargetInfo(e,t);i&&!0!==i&&Yr(i.coordSyses,(function(i){var a=AV[e.brushType](1,i,e.range,!0);n(e,a.values,i,t)}))}),this)},e.prototype.setInputRanges=function(e,t){Yr(e,(function(e){var n,i,a,r,o,s=this.findTargetInfo(e,t);if(e.range=e.range||[],s&&!0!==s){e.panelId=s.panelId;var l=AV[e.brushType](0,s.coordSys,e.coordRange),p=e.__rangeOffset;e.range=p?RV[e.brushType](l.values,p.offset,(n=l.xyMinMax,i=p.xyMinMax,a=FV(n),r=FV(i),o=[a[0]/r[0],a[1]/r[1]],isNaN(o[0])&&(o[0]=1),isNaN(o[1])&&(o[1]=1),o)):l.values}}),this)},e.prototype.makePanelOpts=function(e,t){return Xr(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:RR(i),isTargetByCursor:FR(i,e,n.coordSysModel),getLinearBrushOtherExtent:BR(i)}}))},e.prototype.controlSeries=function(e,t,n){var i=this.findTargetInfo(e,n);return!0===i||i&&Hr(i.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,i=MV(t,e),a=0;ae[1]&&e.reverse(),e}function MV(e,t){return Vd(e,t,{includeMainTypes:TV})}var kV={grid:function(e,t){var n=e.xAxisModels,i=e.yAxisModels,a=e.gridModels,r=Po(),o={},s={};(n||i||a)&&(Yr(n,(function(e){var t=e.axis.grid.model;r.set(t.id,t),o[t.id]=!0})),Yr(i,(function(e){var t=e.axis.grid.model;r.set(t.id,t),s[t.id]=!0})),Yr(a,(function(e){r.set(e.id,e),o[e.id]=!0,s[e.id]=!0})),r.each((function(e){var a=e.coordinateSystem,r=[];Yr(a.getCartesians(),(function(e,t){(Hr(n,e.getAxis("x").model)>=0||Hr(i,e.getAxis("y").model)>=0)&&r.push(e)})),t.push({panelId:"grid--"+e.id,gridModel:e,coordSysModel:e,coordSys:r[0],coordSyses:r,getPanelRect:DV.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})})))},geo:function(e,t){Yr(e.geoModels,(function(e){var n=e.coordinateSystem;t.push({panelId:"geo--"+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:DV.geo})}))}},PV=[function(e,t){var n=e.xAxisModel,i=e.yAxisModel,a=e.gridModel;return!a&&n&&(a=n.axis.grid.model),!a&&i&&(a=i.axis.grid.model),a&&a===t.gridModel},function(e,t){var n=e.geoModel;return n&&n===t.geoModel}],DV={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(Lf(e)),t}},AV={lineX:no(OV,0),lineY:no(OV,1),rect:function(e,t,n,i){var a=e?t.pointToData([n[0][0],n[1][0]],i):t.dataToPoint([n[0][0],n[1][0]],i),r=e?t.pointToData([n[0][1],n[1][1]],i):t.dataToPoint([n[0][1],n[1][1]],i),o=[IV([a[0],r[0]]),IV([a[1],r[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,n,i){var a=[[1/0,-1/0],[1/0,-1/0]];return{values:Xr(n,(function(n){var r=e?t.pointToData(n,i):t.dataToPoint(n,i);return a[0][0]=Math.min(a[0][0],r[0]),a[1][0]=Math.min(a[1][0],r[1]),a[0][1]=Math.max(a[0][1],r[0]),a[1][1]=Math.max(a[1][1],r[1]),r})),xyMinMax:a}}};function OV(e,t,n,i){var a=n.getAxis(["x","y"][e]),r=IV(Xr([0,1],(function(e){return t?a.coordToData(a.toLocalCoord(i[e]),!0):a.toGlobalCoord(a.dataToCoord(i[e]))}))),o=[];return o[e]=r,o[1-e]=[NaN,NaN],{values:r,xyMinMax:o}}var RV={lineX:no(BV,0),lineY:no(BV,1),rect:function(e,t,n){return[[e[0][0]-n[0]*t[0][0],e[0][1]-n[0]*t[0][1]],[e[1][0]-n[1]*t[1][0],e[1][1]-n[1]*t[1][1]]]},polygon:function(e,t,n){return Xr(e,(function(e,i){return[e[0]-n[0]*t[i][0],e[1]-n[1]*t[i][1]]}))}};function BV(e,t,n,i){return[t[0]-i[e]*n[0],t[1]-i[e]*n[1]]}function FV(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var NV,LV,VV=Yr,qV=_d+"toolbox-dataZoom_",GV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Qe(t,e),t.prototype.render=function(e,t,n,i){this._brushController||(this._brushController=new iR(n.getZr()),this._brushController.on("brush",to(this._onBrush,this)).mount()),function(e,t,n,i,a){var r=n._isZoomActive;i&&"takeGlobalCursor"===i.type&&(r="dataZoomSelect"===i.key&&i.dataZoomSelectActive);n._isZoomActive=r,e.setIconStatus("zoom",r?"emphasis":"normal");var o=new EV(zV(e),t,{include:["grid"]}),s=o.makePanelOpts(a,(function(e){return e.xAxisDeclared&&!e.yAxisDeclared?"lineX":!e.xAxisDeclared&&e.yAxisDeclared?"lineY":"rect"}));n._brushController.setPanels(s).enableBrush(!(!r||!s.length)&&{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()})}(e,t,this,i,n),function(e,t){e.setIconStatus("back",function(e){return _V(e).length}(t)>1?"emphasis":"normal")}(e,t)},t.prototype.onclick=function(e,t,n){GV[n].call(this)},t.prototype.remove=function(e,t){this._brushController&&this._brushController.unmount()},t.prototype.dispose=function(e,t){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(e){var t=e.areas;if(e.isEnd&&t.length){var n={},i=this.ecModel;this._brushController.updateCovers([]),new EV(zV(this.model),i,{include:["grid"]}).matchOutputRanges(t,i,(function(e,t,n){if("cartesian2d"===n.type){var i=e.brushType;"rect"===i?(a("x",n,t[0]),a("y",n,t[1])):a({lineX:"x",lineY:"y"}[i],n,t)}})),function(e,t){var n=_V(e);SV(t,(function(t,i){for(var a=n.length-1;a>=0&&!n[a][i];a--);if(a<0){var r=e.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(r){var o=r.getPercentRange();n[0][i]={dataZoomId:i,start:o[0],end:o[1]}}}})),n.push(t)}(i,n),this._dispatchZoomAction(n)}function a(e,t,a){var r=t.getAxis(e),o=r.model,s=function(e,t,n){var i;return n.eachComponent({mainType:"dataZoom",subType:"select"},(function(n){n.getAxisModel(e,t.componentIndex)&&(i=n)})),i}(e,o,i),l=s.findRepresentativeAxisProxy(o);if(l){var p=l.getMinMaxSpan();null==p.minValueSpan&&null==p.maxValueSpan||(a=RO(0,a.slice(),r.scale.getExtent(),0,p.minValueSpan,p.maxValueSpan))}s&&(n[s.id]={dataZoomId:s.id,startValue:a[0],endValue:a[1]})}},t.prototype._dispatchZoomAction=function(e){var t=[];VV(e,(function(e,n){t.push(qr(e))})),t.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:t})},t.getDefaultOption=function(e){return{show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:e.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}}}(pV),{zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(function(e){var t=_V(e),n=t[t.length-1];t.length>1&&t.pop();var i={};return SV(n,(function(e,n){for(var a=t.length-1;a>=0;a--)if(e=t[a][n]){i[n]=e;break}})),i}(this.ecModel))}});function zV(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return null==t.xAxisIndex&&null==t.xAxisId&&(t.xAxisIndex="all"),null==t.yAxisIndex&&null==t.yAxisId&&(t.yAxisIndex="all"),t}NV="dataZoom",LV=function(e){var t=e.getComponent("toolbox",0),n=["feature","dataZoom"];if(t&&null!=t.get(n)){var i=t.getModel(n),a=[],r=Vd(e,zV(i));return VV(r.xAxisModels,(function(e){return o(e,"xAxis","xAxisIndex")})),VV(r.yAxisModels,(function(e){return o(e,"yAxis","yAxisIndex")})),a}function o(e,t,n){var r=e.componentIndex,o={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:qV+t+r};o[n]=r,a.push(o)}},So(null==ax.get(NV)&&LV),ax.set(NV,LV);var UV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="tooltip",t.dependencies=["axisPointer"],t.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},t}(Fv);function jV(e){var t=e.get("confine");return null!=t?!!t:"richText"===e.get("renderMode")}function HV(e){if(xr.domSupported)for(var t=document.documentElement.style,n=0,i=e.length;n-1?(p+="top:50%",c+="translateY(-50%) rotate("+(o="left"===s?-225:-45)+"deg)"):(p+="left:50%",c+="translateX(-50%) rotate("+(o="top"===s?225:45)+"deg)");var d=o*Math.PI/180,u=l+a,m=u*Math.abs(Math.cos(d))+u*Math.abs(Math.sin(d)),h=t+" solid "+a+"px;";return'
'}(n,i,a)),ro(e))r.innerHTML=e+o;else if(e){r.innerHTML="",io(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,i):"leave"===t&&this._hide(i))}),this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,i=e.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var a=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout((function(){!n.isDisposed()&&a.manuallyShowTip(e,t,n,{x:a._lastX,y:a._lastY,dataByCoordSys:a._lastDataByCoordSys})}))}},t.prototype.manuallyShowTip=function(e,t,n,i){if(i.from!==this.uid&&!xr.node&&n.getDom()){var a=lq(i,n);this._ticket="";var r=i.dataByCoordSys,o=function(e,t,n){var i=qd(e).queryOptionMap,a=i.keys()[0];if(!a||"series"===a)return;var r=Ud(t,a,i.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=r.models[0];if(!o)return;var s,l=n.getViewOfComponentModel(o);if(l.group.traverse((function(t){var n=ih(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0})),s)return{componentMainType:a,componentIndex:o.componentIndex,el:s}}(i,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:i.position,positionDefault:"bottom"},a)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=rq;l.x=i.x,l.y=i.y,l.update(),ih(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},a)}else if(r)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:r,tooltipOption:i.tooltipOption},a);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(e,t,n,i))return;var p=RN(i,t),c=p.point[0],d=p.point[1];null!=c&&null!=d&&this._tryShow({offsetX:c,offsetY:d,target:p.el,position:i.position,positionDefault:"bottom"},a)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},a))}},t.prototype.manuallyHideTip=function(e,t,n,i){var a=this._tooltipContent;this._tooltipModel&&a.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(lq(i,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,i){var a=i.seriesIndex,r=i.dataIndex,o=t.getComponent("axisPointer").coordSysAxesInfo;if(null!=a&&null!=r&&null!=o){var s=t.getSeriesByIndex(a);if(s)if("axis"===sq([s.getData().getItemModel(r),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:a,dataIndex:r,position:i.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var i=e.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,e);else if(n){var a,r;if("legend"===ih(n).ssrType)return;this._lastDataByCoordSys=null,AS(n,(function(e){return null!=ih(e).dataIndex?(a=e,!0):null!=ih(e).tooltipConfig?(r=e,!0):void 0}),!0),a?this._showSeriesItemTooltip(e,a,t):r?this._showComponentItemTooltip(e,r,t):this._hide(t)}else this._lastDataByCoordSys=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get("showDelay");t=to(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,i=this._tooltipModel,a=[t.offsetX,t.offsetY],r=sq([t.tooltipOption],i),o=this._renderMode,s=[],l=aw("section",{blocks:[],noHeader:!0}),p=[],c=new gw;Yr(e,(function(e){Yr(e.dataByAxis,(function(e){var t=n.getComponent(e.axisDim+"Axis",e.axisIndex),a=e.value;if(t&&t.axis&&null!=a){var r=fN(a,t.axis,n,e.seriesDataIndices,e.valueLabelOpt),d=aw("section",{header:r,noHeader:!Co(r),sortBlocks:!0,blocks:[]});l.blocks.push(d),Yr(e.seriesDataIndices,(function(l){var u=n.getSeriesByIndex(l.seriesIndex),m=l.dataIndexInside,h=u.getDataParams(m);if(!(h.dataIndex<0)){h.axisDim=e.axisDim,h.axisIndex=e.axisIndex,h.axisType=e.axisType,h.axisId=e.axisId,h.axisValue=cE(t.axis,{value:a}),h.axisValueLabel=r,h.marker=c.makeTooltipMarker("item",Sv(h.color),o);var g=bb(u.formatTooltip(m,!0,null)),f=g.frag;if(f){var y=sq([u],i).get("valueFormatter");d.blocks.push(y?Ur({valueFormatter:y},f):f)}g.text&&p.push(g.text),s.push(h)}}))}}))})),l.blocks.reverse(),p.reverse();var d=t.position,u=r.get("order"),m=cw(l,c,o,u,n.get("useUTC"),r.get("textStyle"));m&&p.unshift(m);var h="richText"===o?"\n\n":"
",g=p.join(h);this._showOrMove(r,(function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(r,d,a[0],a[1],this._tooltipContent,s):this._showTooltipContent(r,g,s,Math.random()+"",a[0],a[1],d,null,c)}))},t.prototype._showSeriesItemTooltip=function(e,t,n){var i=this._ecModel,a=ih(t),r=a.seriesIndex,o=i.getSeriesByIndex(r),s=a.dataModel||o,l=a.dataIndex,p=a.dataType,c=s.getData(p),d=this._renderMode,u=e.positionDefault,m=sq([c.getItemModel(l),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,u?{position:u}:null),h=m.get("trigger");if(null==h||"item"===h){var g=s.getDataParams(l,p),f=new gw;g.marker=f.makeTooltipMarker("item",Sv(g.color),d);var y=bb(s.formatTooltip(l,!1,p)),v=m.get("order"),x=m.get("valueFormatter"),b=y.frag,w=b?cw(x?Ur({valueFormatter:x},b):b,f,d,v,i.get("useUTC"),m.get("textStyle")):y.text,S="item_"+s.name+"_"+l;this._showOrMove(m,(function(){this._showTooltipContent(m,w,g,S,e.offsetX,e.offsetY,e.position,e.target,f)})),n({type:"showTip",dataIndexInside:l,dataIndex:c.getRawIndex(l),seriesIndex:r,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var i=ih(t),a=i.tooltipConfig.option||{};if(ro(a)){a={content:a,formatter:a}}var r=[a],o=this._ecModel.getComponent(i.componentMainType,i.componentIndex);o&&r.push(o),r.push({formatter:a.content});var s=e.positionDefault,l=sq(r,this._tooltipModel,s?{position:s}:null),p=l.get("content"),c=Math.random()+"",d=new gw;this._showOrMove(l,(function(){var n=qr(l.get("formatterParams")||{});this._showTooltipContent(l,p,n,c,e.offsetX,e.offsetY,e.position,t,d)})),n({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,i,a,r,o,s,l){if(this._ticket="",e.get("showContent")&&e.get("show")){var p=this._tooltipContent;p.setEnterable(e.get("enterable"));var c=e.get("formatter");o=o||e.get("position");var d=t,u=this._getNearestPoint([a,r],n,e.get("trigger"),e.get("borderColor")).color;if(c)if(ro(c)){var m=e.ecModel.get("useUTC"),h=io(n)?n[0]:n;d=c,h&&h.axisType&&h.axisType.indexOf("time")>=0&&(d=Zy(h.axisValue,d,m)),d=bv(d,n,!0)}else if(ao(c)){var g=to((function(t,i){t===this._ticket&&(p.setContent(i,l,e,u,o),this._updatePosition(e,o,a,r,p,n,s))}),this);this._ticket=i,d=c(n,i,g)}else d=c;p.setContent(d,l,e,u,o),p.show(e,u),this._updatePosition(e,o,a,r,p,n,s)}},t.prototype._getNearestPoint=function(e,t,n,i){return"axis"===n||io(t)?{color:i||("html"===this._renderMode?"#fff":"none")}:io(t)?void 0:{color:i||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,i,a,r,o){var s=this._api.getWidth(),l=this._api.getHeight();t=t||e.get("position");var p=a.getSize(),c=e.get("align"),d=e.get("verticalAlign"),u=o&&o.getBoundingRect().clone();if(o&&u.applyTransform(o.transform),ao(t)&&(t=t([n,i],r,a.el,u,{viewSize:[s,l],contentSize:p.slice()})),io(t))n=Jc(t[0],s),i=Jc(t[1],l);else if(lo(t)){var m=t;m.width=p[0],m.height=p[1];var h=kv(m,{width:s,height:l});n=h.x,i=h.y,c=null,d=null}else if(ro(t)&&o){var g=function(e,t,n,i){var a=n[0],r=n[1],o=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,p=t.width,c=t.height;switch(e){case"inside":s=t.x+p/2-a/2,l=t.y+c/2-r/2;break;case"top":s=t.x+p/2-a/2,l=t.y-r-o;break;case"bottom":s=t.x+p/2-a/2,l=t.y+c+o;break;case"left":s=t.x-a-o,l=t.y+c/2-r/2;break;case"right":s=t.x+p+o,l=t.y+c/2-r/2}return[s,l]}(t,u,p,e.get("borderWidth"));n=g[0],i=g[1]}else{g=function(e,t,n,i,a,r,o){var s=n.getSize(),l=s[0],p=s[1];null!=r&&(e+l+r+2>i?e-=l+r:e+=r);null!=o&&(t+p+o>a?t-=p+o:t+=o);return[e,t]}(n,i,a,s,l,c?null:20,d?null:20);n=g[0],i=g[1]}if(c&&(n-=pq(c)?p[0]/2:"right"===c?p[0]:0),d&&(i-=pq(d)?p[1]/2:"bottom"===d?p[1]:0),jV(e)){g=function(e,t,n,i,a){var r=n.getSize(),o=r[0],s=r[1];return e=Math.min(e+o,i)-o,t=Math.min(t+s,a)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}(n,i,a,s,l);n=g[0],i=g[1]}a.moveTo(n,i)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,i=this._cbParamsList,a=!!n&&n.length===e.length;return a&&Yr(n,(function(n,r){var o=n.dataByAxis||[],s=(e[r]||{}).dataByAxis||[];(a=a&&o.length===s.length)&&Yr(o,(function(e,n){var r=s[n]||{},o=e.seriesDataIndices||[],l=r.seriesDataIndices||[];(a=a&&e.value===r.value&&e.axisType===r.axisType&&e.axisId===r.axisId&&o.length===l.length)&&Yr(o,(function(e,t){var n=l[t];a=a&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex})),i&&Yr(e.seriesDataIndices,(function(e){var n=e.seriesIndex,r=t[n],o=i[n];r&&o&&o.data!==r.data&&(a=!1)}))}))})),this._lastDataByCoordSys=e,this._cbParamsList=t,!!a},t.prototype._hide=function(e){this._lastDataByCoordSys=null,e({type:"hideTip",from:this.uid})},t.prototype.dispose=function(e,t){!xr.node&&t.getDom()&&(Uw(this,"_updatePosition"),this._tooltipContent.dispose(),AN("itemTooltip",t))},t.type="tooltip",t}(Mw);function sq(e,t,n){var i,a=t.ecModel;n?(i=new Ey(n,a,a),i=new Ey(t.option,i,a)):i=t;for(var r=e.length-1;r>=0;r--){var o=e[r];o&&(o instanceof Ey&&(o=o.get("tooltip",!0)),ro(o)&&(o={formatter:o}),o&&(i=new Ey(o,i,a)))}return i}function lq(e,t){return e.dispatchAction||to(t.dispatchAction,t)}function pq(e){return"center"===e||"middle"===e}function cq(e){vE(zN),e.registerComponentModel(UV),e.registerComponentView(oq),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Bo),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Bo)}var dq=Yr;function uq(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!0}function mq(e,t,n){var i={};return dq(t,(function(t){var a,r=i[t]=((a=function(){}).prototype.__hidden=a.prototype,new a);dq(e[t],(function(e,i){if(vA.isValidType(i)){var a={type:i,visual:e};n&&n(a,t),r[i]=new vA(a),"opacity"===i&&((a=qr(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new vA(a))}}))})),i}function hq(e,t,n){var i;Yr(n,(function(e){t.hasOwnProperty(e)&&uq(t[e])&&(i=!0)})),i&&Yr(n,(function(n){t.hasOwnProperty(n)&&uq(t[n])?e[n]=qr(t[n]):delete e[n]}))}gq(0),gq(1);function gq(e){var t=["x","y"],n=["width","height"];return{point:function(t,n,i){if(t){var a=i.range;return fq(t[e],a)}},rect:function(i,a,r){if(i){var o=r.range,s=[i[t[e]],i[t[e]]+i[n[e]]];return s[1]=t&&(e=t-1),e<0&&(e=0)),this.option.currentIndex=e},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(e){this.option.autoPlay=!!e},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var e,t=this.option,n=t.data||[],i=t.axisType,a=this._names=[];"category"===i?(e=[],Yr(n,(function(t,n){var i,r=Od(Md(t),"");lo(t)?(i=qr(t)).value=n:i=n,e.push(i),a.push(r)}))):e=n;var r={category:"ordinal",time:"time",value:"number"}[i]||"number";(this._data=new J_([{name:"value",type:r}],this)).initData(e,a)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if("category"===this.get("axisType"))return this._names.slice()},t.type="timeline",t.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},t}(Fv),wq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="timeline.slider",t.defaultOption=ky(bq.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),t}(bq);$r(wq,xb.prototype);var Sq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="timeline",t}(Mw),Cq=function(e){function t(t,n,i,a){var r=e.call(this,t,n,i)||this;return r.type=a||"value",r}return Qe(t,e),t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return"horizontal"===this.model.get("orient")},t}(zE),_q=Math.PI,Tq=Nd();!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.init=function(e,t){this.api=t},t.prototype.render=function(e,t,n){if(this.model=e,this.api=n,this.ecModel=t,this.group.removeAll(),e.get("show",!0)){var i=this._layout(e,n),a=this._createGroup("_mainGroup"),r=this._createGroup("_labelGroup"),o=this._axis=this._createAxis(i,e);e.formatTooltip=function(e){return aw("nameValue",{noName:!0,value:o.scale.getLabel({value:e})})},Yr(["AxisLine","AxisTick","Control","CurrentPointer"],(function(t){this["_render"+t](i,a,o,e)}),this),this._renderAxisLabel(i,r,o,e),this._position(i,e)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(e,t){var n,i,a,r,o=e.get(["label","position"]),s=e.get("orient"),l=function(e,t){return kv(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()},e.get("padding"))}(e,t),p={horizontal:"center",vertical:(n=null==o||"auto"===o?"horizontal"===s?l.y+l.height/2=0||"+"===n?"left":"right"},c={horizontal:n>=0||"+"===n?"top":"bottom",vertical:"middle"},d={horizontal:0,vertical:_q/2},u="vertical"===s?l.height:l.width,m=e.getModel("controlStyle"),h=m.get("show",!0),g=h?m.get("itemSize"):0,f=h?m.get("itemGap"):0,y=g+f,v=e.get(["label","rotate"])||0;v=v*_q/180;var x=m.get("position",!0),b=h&&m.get("showPlayBtn",!0),w=h&&m.get("showPrevBtn",!0),S=h&&m.get("showNextBtn",!0),C=0,_=u;"left"===x||"bottom"===x?(b&&(i=[0,0],C+=y),w&&(a=[C,0],C+=y),S&&(r=[_-g,0],_-=y)):(b&&(i=[_-g,0],_-=y),w&&(a=[0,0],C+=y),S&&(r=[_-g,0],_-=y));var T=[C,_];return e.get("inverse")&&T.reverse(),{viewRect:l,mainLength:u,orient:s,rotation:d[s],labelRotation:v,labelPosOpt:n,labelAlign:e.get(["label","align"])||p[s],labelBaseline:e.get(["label","verticalAlign"])||e.get(["label","baseline"])||c[s],playPosition:i,prevBtnPosition:a,nextBtnPosition:r,axisExtent:T,controlSize:g,controlGap:f}},t.prototype._position=function(e,t){var n=this._mainGroup,i=this._labelGroup,a=e.viewRect;if("vertical"===e.orient){var r=[1,0,0,1,0,0],o=a.x,s=a.y+a.height;Ps(r,r,[-o,-s]),Ds(r,r,-_q/2),Ps(r,r,[o,s]),(a=a.clone()).applyTransform(r)}var l=f(a),p=f(n.getBoundingRect()),c=f(i.getBoundingRect()),d=[n.x,n.y],u=[i.x,i.y];u[0]=d[0]=l[0][0];var m,h=e.labelPosOpt;null==h||ro(h)?(y(d,p,l,1,m="+"===h?0:1),y(u,c,l,1,1-m)):(y(d,p,l,1,m=h>=0?0:1),u[1]=d[1]+h);function g(e){e.originX=l[0][0]-e.x,e.originY=l[1][0]-e.y}function f(e){return[[e.x,e.x+e.width],[e.y,e.y+e.height]]}function y(e,t,n,i,a){e[i]+=n[i][a]-t[i][a]}n.setPosition(d),i.setPosition(u),n.rotation=i.rotation=e.rotation,g(n),g(i)},t.prototype._createAxis=function(e,t){var n=t.getData(),i=t.get("axisType"),a=function(e,t){if(t=t||e.get("type"),t)switch(t){case"category":return new wT({ordinalMeta:e.getCategories(),extent:[1/0,-1/0]});case"time":return new NT({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});default:return new CT}}(t,i);a.getTicks=function(){return n.mapArray(["value"],(function(e){return{value:e}}))};var r=n.getDataExtent("value");a.setExtent(r[0],r[1]),a.calcNiceTicks();var o=new Cq("value",a,e.axisExtent,i);return o.model=t,o},t.prototype._createGroup=function(e){var t=this[e]=new zc;return this.group.add(t),t},t.prototype._renderAxisLine=function(e,t,n,i){var a=n.getExtent();if(i.get(["lineStyle","show"])){var r=new Kg({shape:{x1:a[0],y1:0,x2:a[1],y2:0},style:Ur({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});t.add(r);var o=this._progressLine=new Kg({shape:{x1:a[0],x2:this._currentPointer?this._currentPointer.x:a[0],y1:0,y2:0},style:jr({lineCap:"round",lineWidth:r.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});t.add(o)}},t.prototype._renderAxisTick=function(e,t,n,i){var a=this,r=i.getData(),o=n.scale.getTicks();this._tickSymbols=[],Yr(o,(function(e){var o=n.dataToCoord(e.value),s=r.getItemModel(e.value),l=s.getModel("itemStyle"),p=s.getModel(["emphasis","itemStyle"]),c=s.getModel(["progress","itemStyle"]),d={x:o,y:0,onclick:to(a._changeTimeline,a,e.value)},u=Eq(s,l,t,d);u.ensureState("emphasis").style=p.getItemStyle(),u.ensureState("progress").style=c.getItemStyle(),Hh(u);var m=ih(u);s.get("tooltip")?(m.dataIndex=e.value,m.dataModel=i):m.dataIndex=m.dataModel=null,a._tickSymbols.push(u)}))},t.prototype._renderAxisLabel=function(e,t,n,i){var a=this;if(n.getLabelModel().get("show")){var r=i.getData(),o=n.getViewLabels();this._tickLabels=[],Yr(o,(function(i){var o=i.tickValue,s=r.getItemModel(o),l=s.getModel("label"),p=s.getModel(["emphasis","label"]),c=s.getModel(["progress","label"]),d=n.dataToCoord(i.tickValue),u=new jm({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:to(a._changeTimeline,a,o),silent:!1,style:ay(l,{text:i.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});u.ensureState("emphasis").style=ay(p),u.ensureState("progress").style=ay(c),t.add(u),Hh(u),Tq(u).dataIndex=o,a._tickLabels.push(u)}))}},t.prototype._renderControl=function(e,t,n,i){var a=e.controlSize,r=e.rotation,o=i.getModel("controlStyle").getItemStyle(),s=i.getModel(["emphasis","controlStyle"]).getItemStyle(),l=i.getPlayState(),p=i.get("inverse",!0);function c(e,n,l,p){if(e){var c=Pc(vo(i.get(["controlStyle",n+"BtnSize"]),a),a),d=function(e,t,n,i){var a=i.style,r=Hf(e.get(["controlStyle",t]),i||{},new js(n[0],n[1],n[2],n[3]));a&&r.setStyle(a);return r}(i,n+"Icon",[0,-c/2,c,c],{x:e[0],y:e[1],originX:a/2,originY:0,rotation:p?-r:0,rectHover:!0,style:o,onclick:l});d.ensureState("emphasis").style=s,t.add(d),Hh(d)}}c(e.nextBtnPosition,"next",to(this._changeTimeline,this,p?"-":"+")),c(e.prevBtnPosition,"prev",to(this._changeTimeline,this,p?"+":"-")),c(e.playPosition,l?"stop":"play",to(this._handlePlayClick,this,!l),!0)},t.prototype._renderCurrentPointer=function(e,t,n,i){var a=i.getData(),r=i.getCurrentIndex(),o=a.getItemModel(r).getModel("checkpointStyle"),s=this,l={onCreate:function(e){e.draggable=!0,e.drift=to(s._handlePointerDrag,s),e.ondragend=to(s._handlePointerDragend,s),Iq(e,s._progressLine,r,n,i,!0)},onUpdate:function(e){Iq(e,s._progressLine,r,n,i)}};this._currentPointer=Eq(o,o,this._mainGroup,{},this._currentPointer,l)},t.prototype._handlePlayClick=function(e){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:e,from:this.uid})},t.prototype._handlePointerDrag=function(e,t,n){this._clearTimer(),this._pointerChangeTimeline([n.offsetX,n.offsetY])},t.prototype._handlePointerDragend=function(e){this._pointerChangeTimeline([e.offsetX,e.offsetY],!0)},t.prototype._pointerChangeTimeline=function(e,t){var n=this._toAxisCoord(e)[0],i=td(this._axis.getExtent().slice());n>i[1]&&(n=i[1]),n=0&&(o[r]=+o[r].toFixed(d)),[o,c]}var Rq={min:no(Oq,"min"),max:no(Oq,"max"),average:no(Oq,"average"),median:no(Oq,"median")};function Bq(e,t){if(t){var n=e.getData(),i=e.coordinateSystem,a=i&&i.dimensions;if(!function(e){return!isNaN(parseFloat(e.x))&&!isNaN(parseFloat(e.y))}(t)&&!io(t.coord)&&io(a)){var r=Fq(t,n,i,e);if((t=qr(t)).type&&Rq[t.type]&&r.baseAxis&&r.valueAxis){var o=Hr(a,r.baseAxis.dim),s=Hr(a,r.valueAxis.dim),l=Rq[t.type](n,r.baseDataDim,r.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[null!=t.xAxis?t.xAxis:t.radiusAxis,null!=t.yAxis?t.yAxis:t.angleAxis]}if(null!=t.coord&&io(a))for(var p=t.coord,c=0;c<2;c++)Rq[p[c]]&&(p[c]=Vq(n,n.mapDimension(a[c]),p[c]));else t.coord=[];return t}}function Fq(e,t,n,i){var a={};return null!=e.valueIndex||null!=e.valueDim?(a.valueDataDim=null!=e.valueIndex?t.getDimension(e.valueIndex):e.valueDim,a.valueAxis=n.getAxis(function(e,t){var n=e.getData().getDimensionInfo(t);return n&&n.coordDim}(i,a.valueDataDim)),a.baseAxis=n.getOtherAxis(a.valueAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim)):(a.baseAxis=i.getBaseAxis(),a.valueAxis=n.getOtherAxis(a.baseAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim),a.valueDataDim=t.mapDimension(a.valueAxis.dim)),a}function Nq(e,t){return!(e&&e.containData&&t.coord&&!Aq(t))||e.containData(t.coord)}function Lq(e,t){return e?function(e,n,i,a){return _b(a<2?e.coord&&e.coord[a]:e.value,t[a])}:function(e,n,i,a){return _b(e.value,t[a])}}function Vq(e,t,n){if("average"===n){var i=0,a=0;return e.each(t,(function(e,t){isNaN(e)||(i+=e,a++)})),i/a}return"median"===n?e.getMedian(t):e.getDataExtent(t)["max"===n?1:0]}var qq=Nd(),Gq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.init=function(){this.markerGroupMap=Po()},t.prototype.render=function(e,t,n){var i=this,a=this.markerGroupMap;a.each((function(e){qq(e).keep=!1})),t.eachSeries((function(e){var a=Dq.getMarkerModelFromSeries(e,i.type);a&&i.renderSeries(e,a,t,n)})),a.each((function(e){!qq(e).keep&&i.group.remove(e.group)}))},t.prototype.markKeep=function(e){qq(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;Yr(e,(function(e){var i=Dq.getMarkerModelFromSeries(e,n.type);i&&i.getData().eachItemGraphicEl((function(e){e&&(t?Rh(e):Bh(e))}))}))},t.type="marker",t}(Mw);function zq(e,t,n){var i=t.coordinateSystem;e.each((function(a){var r,o=e.getItemModel(a),s=Jc(o.get("x"),n.getWidth()),l=Jc(o.get("y"),n.getHeight());if(isNaN(s)||isNaN(l)){if(t.getMarkerPosition)r=t.getMarkerPosition(e.getValues(e.dimensions,a));else if(i){var p=e.get(i.dimensions[0],a),c=e.get(i.dimensions[1],a);r=i.dataToPoint([p,c])}}else r=[s,l];isNaN(s)||(r[0]=s),isNaN(l)||(r[1]=l),e.setItemLayout(a,r)}))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=Dq.getMarkerModelFromSeries(e,"markPoint");t&&(zq(t.getData(),e,n),this.markerGroupMap.get(e.id).updateLayout())}),this)},t.prototype.renderSeries=function(e,t,n,i){var a=e.coordinateSystem,r=e.id,o=e.getData(),s=this.markerGroupMap,l=s.get(r)||s.set(r,new NI),p=function(e,t,n){var i;i=e?Xr(e&&e.dimensions,(function(e){return Ur(Ur({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new J_(i,n),r=Xr(n.get("data"),no(Bq,t));e&&(r=Qr(r,no(Nq,e)));var o=Lq(!!e,i);return a.initData(r,null,o),a}(a,e,t);t.setData(p),zq(t.getData(),e,i),p.each((function(e){var n=p.getItemModel(e),i=n.getShallow("symbol"),a=n.getShallow("symbolSize"),r=n.getShallow("symbolRotate"),s=n.getShallow("symbolOffset"),l=n.getShallow("symbolKeepAspect");if(ao(i)||ao(a)||ao(r)||ao(s)){var c=t.getRawValue(e),d=t.getDataParams(e);ao(i)&&(i=i(c,d)),ao(a)&&(a=a(c,d)),ao(r)&&(r=r(c,d)),ao(s)&&(s=s(c,d))}var u=n.getModel("itemStyle").getItemStyle(),m=MS(o,"color");u.fill||(u.fill=m),p.setItemVisual(e,{symbol:i,symbolSize:a,symbolRotate:r,symbolOffset:s,symbolKeepAspect:l,style:u})})),l.updateData(p),this.group.add(l.group),p.eachItemGraphicEl((function(e){e.traverse((function(e){ih(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markPoint"}(Gq);var Uq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.createMarkerModelFromSeries=function(e,n,i){return new t(e,n,i)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(Dq),jq=Nd(),Hq=function(e,t,n,i){var a,r=e.getData();if(io(i))a=i;else{var o=i.type;if("min"===o||"max"===o||"average"===o||"median"===o||null!=i.xAxis||null!=i.yAxis){var s=void 0,l=void 0;if(null!=i.yAxis||null!=i.xAxis)s=t.getAxis(null!=i.yAxis?"y":"x"),l=yo(i.yAxis,i.xAxis);else{var p=Fq(i,r,t,e);s=p.valueAxis,l=Vq(r,sT(r,p.valueDataDim),o)}var c="x"===s.dim?0:1,d=1-c,u=qr(i),m={coord:[]};u.type=null,u.coord=[],u.coord[d]=-1/0,m.coord[d]=1/0;var h=n.get("precision");h>=0&&so(l)&&(l=+l.toFixed(Math.min(h,20))),u.coord[c]=m.coord[c]=l,a=[u,m,{type:o,valueIndex:i.valueIndex,value:l}]}else a=[]}var g=[Bq(e,a[0]),Bq(e,a[1]),Ur({},a[2])];return g[2].type=g[2].type||null,Gr(g[2],g[0]),Gr(g[2],g[1]),g};function Wq(e){return!isNaN(e)&&!isFinite(e)}function $q(e,t,n,i){var a=1-e,r=i.dimensions[e];return Wq(t[a])&&Wq(n[a])&&t[e]===n[e]&&i.getAxis(r).containData(t[e])}function Kq(e,t){if("cartesian2d"===e.type){var n=t[0].coord,i=t[1].coord;if(n&&i&&($q(1,n,i,e)||$q(0,n,i,e)))return!0}return Nq(e,t[0])&&Nq(e,t[1])}function Yq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Jc(s.get("x"),a.getWidth()),p=Jc(s.get("y"),a.getHeight());if(isNaN(l)||isNaN(p)){if(i.getMarkerPosition)r=i.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=o.dimensions,d=e.get(c[0],t),u=e.get(c[1],t);r=o.dataToPoint([d,u])}if(ZI(o,"cartesian2d")){var m=o.getAxis("x"),h=o.getAxis("y");c=o.dimensions;Wq(e.get(c[0],t))?r[0]=m.toGlobalCoord(m.getExtent()[n?0:1]):Wq(e.get(c[1],t))&&(r[1]=h.toGlobalCoord(h.getExtent()[n?0:1]))}isNaN(l)||(r[0]=l),isNaN(p)||(r[1]=p)}else r=[l,p];e.setItemLayout(t,r)}var Xq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=Dq.getMarkerModelFromSeries(e,"markLine");if(t){var i=t.getData(),a=jq(t).from,r=jq(t).to;a.each((function(t){Yq(a,t,!0,e,n),Yq(r,t,!1,e,n)})),i.each((function(e){i.setItemLayout(e,[a.getItemLayout(e),r.getItemLayout(e)])})),this.markerGroupMap.get(e.id).updateLayout()}}),this)},t.prototype.renderSeries=function(e,t,n,i){var a=e.coordinateSystem,r=e.id,o=e.getData(),s=this.markerGroupMap,l=s.get(r)||s.set(r,new nO);this.group.add(l.group);var p=function(e,t,n){var i;i=e?Xr(e&&e.dimensions,(function(e){return Ur(Ur({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new J_(i,n),r=new J_(i,n),o=new J_([],n),s=Xr(n.get("data"),no(Hq,t,e,n));e&&(s=Qr(s,no(Kq,e)));var l=Lq(!!e,i);return a.initData(Xr(s,(function(e){return e[0]})),null,l),r.initData(Xr(s,(function(e){return e[1]})),null,l),o.initData(Xr(s,(function(e){return e[2]}))),o.hasItemOption=!0,{from:a,to:r,line:o}}(a,e,t),c=p.from,d=p.to,u=p.line;jq(t).from=c,jq(t).to=d,t.setData(u);var m=t.get("symbol"),h=t.get("symbolSize"),g=t.get("symbolRotate"),f=t.get("symbolOffset");function y(t,n,a){var r=t.getItemModel(n);Yq(t,n,a,e,i);var s=r.getModel("itemStyle").getItemStyle();null==s.fill&&(s.fill=MS(o,"color")),t.setItemVisual(n,{symbolKeepAspect:r.get("symbolKeepAspect"),symbolOffset:vo(r.get("symbolOffset",!0),f[a?0:1]),symbolRotate:vo(r.get("symbolRotate",!0),g[a?0:1]),symbolSize:vo(r.get("symbolSize"),h[a?0:1]),symbol:vo(r.get("symbol",!0),m[a?0:1]),style:s})}io(m)||(m=[m,m]),io(h)||(h=[h,h]),io(g)||(g=[g,g]),io(f)||(f=[f,f]),p.from.each((function(e){y(c,e,!0),y(d,e,!1)})),u.each((function(e){var t=u.getItemModel(e).getModel("lineStyle").getLineStyle();u.setItemLayout(e,[c.getItemLayout(e),d.getItemLayout(e)]),null==t.stroke&&(t.stroke=c.getItemVisual(e,"style").fill),u.setItemVisual(e,{fromSymbolKeepAspect:c.getItemVisual(e,"symbolKeepAspect"),fromSymbolOffset:c.getItemVisual(e,"symbolOffset"),fromSymbolRotate:c.getItemVisual(e,"symbolRotate"),fromSymbolSize:c.getItemVisual(e,"symbolSize"),fromSymbol:c.getItemVisual(e,"symbol"),toSymbolKeepAspect:d.getItemVisual(e,"symbolKeepAspect"),toSymbolOffset:d.getItemVisual(e,"symbolOffset"),toSymbolRotate:d.getItemVisual(e,"symbolRotate"),toSymbolSize:d.getItemVisual(e,"symbolSize"),toSymbol:d.getItemVisual(e,"symbol"),style:t})})),l.updateData(u),p.line.eachItemGraphicEl((function(e){ih(e).dataModel=t,e.traverse((function(e){ih(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markLine",t}(Gq);function Zq(e){e.registerComponentModel(Uq),e.registerComponentView(Xq),e.registerPreprocessor((function(e){Mq(e.series,"markLine")&&(e.markLine=e.markLine||{})}))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.createMarkerModelFromSeries=function(e,n,i){return new t(e,n,i)},t.type="markArea",t.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}}}(Dq);var Qq=Nd(),Jq=function(e,t,n,i){var a=i[0],r=i[1];if(a&&r){var o=Bq(e,a),s=Bq(e,r),l=o.coord,p=s.coord;l[0]=yo(l[0],-1/0),l[1]=yo(l[1],-1/0),p[0]=yo(p[0],1/0),p[1]=yo(p[1],1/0);var c=zr([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function eG(e){return!isNaN(e)&&!isFinite(e)}function tG(e,t,n,i){var a=1-e;return eG(t[a])&&eG(n[a])}function nG(e,t){var n=t.coord[0],i=t.coord[1],a={coord:n,x:t.x0,y:t.y0},r={coord:i,x:t.x1,y:t.y1};return ZI(e,"cartesian2d")?!(!n||!i||!tG(1,n,i)&&!tG(0,n,i))||function(e,t,n){return!(e&&e.containZone&&t.coord&&n.coord&&!Aq(t)&&!Aq(n))||e.containZone(t.coord,n.coord)}(e,a,r):Nq(e,a)||Nq(e,r)}function iG(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Jc(s.get(n[0]),a.getWidth()),p=Jc(s.get(n[1]),a.getHeight());if(isNaN(l)||isNaN(p)){if(i.getMarkerPosition){var c=e.getValues(["x0","y0"],t),d=e.getValues(["x1","y1"],t),u=o.clampData(c),m=o.clampData(d),h=[];"x0"===n[0]?h[0]=u[0]>m[0]?d[0]:c[0]:h[0]=u[0]>m[0]?c[0]:d[0],"y0"===n[1]?h[1]=u[1]>m[1]?d[1]:c[1]:h[1]=u[1]>m[1]?c[1]:d[1],r=i.getMarkerPosition(h,n,!0)}else{var g=[v=e.get(n[0],t),x=e.get(n[1],t)];o.clampData&&o.clampData(g,g),r=o.dataToPoint(g,!0)}if(ZI(o,"cartesian2d")){var f=o.getAxis("x"),y=o.getAxis("y"),v=e.get(n[0],t),x=e.get(n[1],t);eG(v)?r[0]=f.toGlobalCoord(f.getExtent()["x0"===n[0]?0:1]):eG(x)&&(r[1]=y.toGlobalCoord(y.getExtent()["y0"===n[1]?0:1]))}isNaN(l)||(r[0]=l),isNaN(p)||(r[1]=p)}else r=[l,p];return r}var aG=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]];!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Qe(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=Dq.getMarkerModelFromSeries(e,"markArea");if(t){var i=t.getData();i.each((function(t){var a=Xr(aG,(function(a){return iG(i,t,a,e,n)}));i.setItemLayout(t,a),i.getItemGraphicEl(t).setShape("points",a)}))}}),this)},t.prototype.renderSeries=function(e,t,n,i){var a=e.coordinateSystem,r=e.id,o=e.getData(),s=this.markerGroupMap,l=s.get(r)||s.set(r,{group:new zc});this.group.add(l.group),this.markKeep(l);var p=function(e,t,n){var i,a,r=["x0","y0","x1","y1"];if(e){var o=Xr(e&&e.dimensions,(function(e){var n=t.getData();return Ur(Ur({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}));a=Xr(r,(function(e,t){return{name:e,type:o[t%2].type}})),i=new J_(a,n)}else i=new J_(a=[{name:"value",type:"float"}],n);var s=Xr(n.get("data"),no(Jq,t,e,n));e&&(s=Qr(s,no(nG,e)));var l=e?function(e,t,n,i){return _b(e.coord[Math.floor(i/2)][i%2],a[i])}:function(e,t,n,i){return _b(e.value,a[i])};return i.initData(s,null,l),i.hasItemOption=!0,i}(a,e,t);t.setData(p),p.each((function(t){var n=Xr(aG,(function(n){return iG(p,t,n,e,i)})),r=a.getAxis("x").scale,s=a.getAxis("y").scale,l=r.getExtent(),c=s.getExtent(),d=[r.parse(p.get("x0",t)),r.parse(p.get("x1",t))],u=[s.parse(p.get("y0",t)),s.parse(p.get("y1",t))];td(d),td(u);var m=!!(l[0]>d[1]||l[1]u[1]||c[1]=0},t.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},t}(Fv),oG=no,sG=Yr,lG=zc,pG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return Qe(t,e),t.prototype.init=function(){this.group.add(this._contentGroup=new lG),this.group.add(this._selectorGroup=new lG),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get("show",!0)){var a=e.get("align"),r=e.get("orient");a&&"auto"!==a||(a="right"===e.get("left")&&"vertical"===r?"right":"left");var o=e.get("selector",!0),s=e.get("selectorPosition",!0);!o||s&&"auto"!==s||(s="horizontal"===r?"end":"start"),this.renderInner(a,e,t,n,o,r,s);var l=e.getBoxLayoutParams(),p={width:n.getWidth(),height:n.getHeight()},c=e.get("padding"),d=kv(l,p,c),u=this.layoutInner(e,a,d,i,o,s),m=kv(jr({width:u.width,height:u.height},l),p,c);this.group.x=m.x-u.x,this.group.y=m.y-u.y,this.group.markRedraw(),this.group.add(this._backgroundEl=uV(u,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,i,a,r,o){var s=this.getContentGroup(),l=Po(),p=t.get("selectedMode"),c=[];n.eachRawSeries((function(e){!e.get("legendHoverLink")&&c.push(e.id)})),sG(t.getData(),(function(a,r){var o=a.get("name");if(!this.newlineDisabled&&(""===o||"\n"===o)){var d=new lG;return d.newline=!0,void s.add(d)}var u=n.getSeriesByName(o)[0];if(!l.get(o)){if(u){var m=u.getData(),h=m.getVisual("legendLineStyle")||{},g=m.getVisual("legendIcon"),f=m.getVisual("style"),y=this._createItem(u,o,r,a,t,e,h,f,g,p,i);y.on("click",oG(cG,o,null,i,c)).on("mouseover",oG(uG,u.name,null,i,c)).on("mouseout",oG(mG,u.name,null,i,c)),n.ssr&&y.eachChild((function(e){var t=ih(e);t.seriesIndex=u.seriesIndex,t.dataIndex=r,t.ssrType="legend"})),l.set(o,!0)}else n.eachRawSeries((function(s){if(!l.get(o)&&s.legendVisualProvider){var d=s.legendVisualProvider;if(!d.containName(o))return;var u=d.indexOfName(o),m=d.getItemVisual(u,"style"),h=d.getItemVisual(u,"legendIcon"),g=tp(m.fill);g&&0===g[3]&&(g[3]=.2,m=Ur(Ur({},m),{fill:lp(g,"rgba")}));var f=this._createItem(s,o,r,a,t,e,{},m,h,p,i);f.on("click",oG(cG,null,o,i,c)).on("mouseover",oG(uG,null,o,i,c)).on("mouseout",oG(mG,null,o,i,c)),n.ssr&&f.eachChild((function(e){var t=ih(e);t.seriesIndex=s.seriesIndex,t.dataIndex=r,t.ssrType="legend"})),l.set(o,!0)}}),this);0}}),this),a&&this._createSelector(a,t,i,r,o)},t.prototype._createSelector=function(e,t,n,i,a){var r=this.getSelectorGroup();sG(e,(function(e){var i=e.type,a=new jm({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect"})}});r.add(a),ny(a,{normal:t.getModel("selectorLabel"),emphasis:t.getModel(["emphasis","selectorLabel"])},{defaultText:e.title}),Hh(a)}))},t.prototype._createItem=function(e,t,n,i,a,r,o,s,l,p,c){var d=e.visualDrawType,u=a.get("itemWidth"),m=a.get("itemHeight"),h=a.isSelected(t),g=i.get("symbolRotate"),f=i.get("symbolKeepAspect"),y=i.get("icon"),v=function(e,t,n,i,a,r,o){function s(e,t){"auto"===e.lineWidth&&(e.lineWidth=t.lineWidth>0?2:0),sG(e,(function(n,i){"inherit"===e[i]&&(e[i]=t[i])}))}var l=t.getModel("itemStyle"),p=l.getItemStyle(),c=0===e.lastIndexOf("empty",0)?"fill":"stroke",d=l.getShallow("decal");p.decal=d&&"inherit"!==d?yC(d,o):i.decal,"inherit"===p.fill&&(p.fill=i[a]);"inherit"===p.stroke&&(p.stroke=i[c]);"inherit"===p.opacity&&(p.opacity=("fill"===a?i:n).opacity);s(p,i);var u=t.getModel("lineStyle"),m=u.getLineStyle();if(s(m,n),"auto"===p.fill&&(p.fill=i.fill),"auto"===p.stroke&&(p.stroke=i.fill),"auto"===m.stroke&&(m.stroke=i.fill),!r){var h=t.get("inactiveBorderWidth"),g=p[c];p.lineWidth="auto"===h?i.lineWidth>0&&g?2:0:p.lineWidth,p.fill=t.get("inactiveColor"),p.stroke=t.get("inactiveBorderColor"),m.stroke=u.get("inactiveColor"),m.lineWidth=u.get("inactiveWidth")}return{itemStyle:p,lineStyle:m}}(l=y||l||"roundRect",i,o,s,d,h,c),x=new lG,b=i.getModel("textStyle");if(!ao(e.getLegendIcon)||y&&"inherit"!==y){var w="inherit"===y&&e.getData().getVisual("symbol")?"inherit"===g?e.getData().getVisual("symbolRotate"):g:0;x.add(function(e){var t=e.icon||"roundRect",n=jS(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2);return n}({itemWidth:u,itemHeight:m,icon:l,iconRotate:w,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:f}))}else x.add(e.getLegendIcon({itemWidth:u,itemHeight:m,icon:l,iconRotate:g,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:f}));var S="left"===r?u+5:-5,C=r,_=a.get("formatter"),T=t;ro(_)&&_?T=_.replace("{name}",null!=t?t:""):ao(_)&&(T=_(t));var E=h?b.getTextColor():i.get("inactiveColor");x.add(new jm({style:ay(b,{text:T,x:S,y:m/2,fill:E,align:C,verticalAlign:"middle"},{inheritColor:E})}));var I=new Gm({shape:x.getBoundingRect(),style:{fill:"transparent"}}),M=i.getModel("tooltip");return M.get("show")&&Yf({el:I,componentModel:a,itemName:t,itemTooltipOption:M.option}),x.add(I),x.eachChild((function(e){e.silent=!0})),I.silent=!p,this.getContentGroup().add(x),Hh(x),x.__legendDataIndex=n,x},t.prototype.layoutInner=function(e,t,n,i,a,r){var o=this.getContentGroup(),s=this.getSelectorGroup();Mv(e.get("orient"),o,e.get("itemGap"),n.width,n.height);var l=o.getBoundingRect(),p=[-l.x,-l.y];if(s.markRedraw(),o.markRedraw(),a){Mv("horizontal",s,e.get("selectorItemGap",!0));var c=s.getBoundingRect(),d=[-c.x,-c.y],u=e.get("selectorButtonGap",!0),m=e.getOrient().index,h=0===m?"width":"height",g=0===m?"height":"width",f=0===m?"y":"x";"end"===r?d[m]+=l[h]+u:p[m]+=c[h]+u,d[1-m]+=l[g]/2-c[g]/2,s.x=d[0],s.y=d[1],o.x=p[0],o.y=p[1];var y={x:0,y:0};return y[h]=l[h]+u+c[h],y[g]=Math.max(l[g],c[g]),y[f]=Math.min(0,c[f]+d[1-m]),y}return o.x=p[0],o.y=p[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(Mw);function cG(e,t,n,i){mG(e,t,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=e?e:t}),uG(e,t,n,i)}function dG(e){for(var t,n=e.getZr().storage.getDisplayList(),i=0,a=n.length;in[a],h=[-d.x,-d.y];t||(h[i]=l[s]);var g=[0,0],f=[-u.x,-u.y],y=vo(e.get("pageButtonGap",!0),e.get("itemGap",!0));m&&("end"===e.get("pageButtonPosition",!0)?f[i]+=n[a]-u[a]:g[i]+=u[a]+y);f[1-i]+=d[r]/2-u[r]/2,l.setPosition(h),p.setPosition(g),c.setPosition(f);var v={x:0,y:0};if(v[a]=m?n[a]:d[a],v[r]=Math.max(d[r],u[r]),v[o]=Math.min(0,u[o]+f[1-i]),p.__rectSize=n[a],m){var x={x:0,y:0};x[a]=Math.max(n[a]-u[a]-y,0),x[r]=v[r],p.setClipPath(new Gm({shape:x})),p.__rectSize=x[a]}else c.eachChild((function(e){e.attr({invisible:!0,silent:!0})}));var b=this._getPageInfo(e);return null!=b.pageIndex&&ff(l,{x:b.contentPosition[0],y:b.contentPosition[1]},m?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var i=this._getPageInfo(t)[e];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;Yr(["pagePrev","pageNext"],(function(i){var a=null!=t[i+"DataIndex"],r=n.childOfName(i);r&&(r.setStyle("fill",a?e.get("pageIconColor",!0):e.get("pageIconInactiveColor",!0)),r.cursor=a?"pointer":"default")}));var i=n.childOfName("pageText"),a=e.get("pageFormatter"),r=t.pageIndex,o=null!=r?r+1:0,s=t.pageCount;i&&a&&i.setStyle("text",ro(a)?a.replace("{current}",null==o?"":o+"").replace("{total}",null==s?"":s+""):a({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get("scrollDataIndex",!0),n=this.getContentGroup(),i=this._containerGroup.__rectSize,a=e.getOrient().index,r=fG[a],o=yG[a],s=this._findTargetItemIndex(t),l=n.children(),p=l[s],c=l.length,d=c?1:0,u={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!p)return u;var m=v(p);u.contentPosition[a]=-m.s;for(var h=s+1,g=m,f=m,y=null;h<=c;++h)(!(y=v(l[h]))&&f.e>g.s+i||y&&!x(y,g.s))&&(g=f.i>g.i?f:y)&&(null==u.pageNextDataIndex&&(u.pageNextDataIndex=g.i),++u.pageCount),f=y;for(h=s-1,g=m,f=m,y=null;h>=-1;--h)(y=v(l[h]))&&x(f,y.s)||!(g.i=t&&e.s<=t+i}},t.prototype._findTargetItemIndex=function(e){return this._showController?(this.getContentGroup().eachChild((function(i,a){var r=i.__legendDataIndex;null==n&&null!=r&&(n=a),r===e&&(t=a)})),null!=t?t:n):0;var t,n},t.type="legend.scroll"}(pG);var vG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="dataZoom.inside",t.defaultOption=ky(eV.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(eV),xG=Nd();function bG(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function wG(e,t){e.isDisposed()||e.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:t})}function SG(e,t,n,i){return e.coordinateSystem.containPoint([n,i])}function CG(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,(function(e,t){var n=xG(t),i=n.coordSysRecordMap||(n.coordSysRecordMap=Po());i.each((function(e){e.dataZoomInfoMap=null})),e.eachComponent({mainType:"dataZoom",subType:"inside"},(function(e){Yr(QL(e).infoList,(function(n){var a=n.model.uid,r=i.get(a)||i.set(a,function(e,t){var n={model:t,containsPoint:no(SG,t),dispatchAction:no(wG,e),dataZoomInfoMap:null,controller:null},i=n.controller=new bP(e.getZr());return Yr(["pan","zoom","scrollMove"],(function(e){i.on(e,(function(t){var i=[];n.dataZoomInfoMap.each((function(a){if(t.isAvailableBehavior(a.model.option)){var r=(a.getRange||{})[e],o=r&&r(a.dzReferCoordSysInfo,n.model.mainType,n.controller,t);!a.model.get("disabled",!0)&&o&&i.push({dataZoomId:a.model.id,start:o[0],end:o[1]})}})),i.length&&n.dispatchAction(i)}))})),n}(t,n.model));(r.dataZoomInfoMap||(r.dataZoomInfoMap=Po())).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})}))})),i.each((function(e){var t,n=e.controller,a=e.dataZoomInfoMap;if(a){var r=a.keys()[0];null!=r&&(t=a.get(r))}if(t){var o=function(e){var t,n="type_",i={type_true:2,type_move:1,type_false:0,type_undefined:-1},a=!0;return e.each((function(e){var r=e.model,o=!r.get("disabled",!0)&&(!r.get("zoomLock",!0)||"move");i[n+o]>i[n+t]&&(t=o),a=a&&r.get("preventDefaultMouseMove",!0)})),{controlType:t,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!a}}}(a);n.enable(o.controlType,o.opt),n.setPointerChecker(e.containsPoint),zw(e,"dispatchAction",t.model.get("throttle",!0),"fixRate")}else bG(i,e)}))}))}var _G=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return Qe(t,e),t.prototype.render=function(t,n,i){e.prototype.render.apply(this,arguments),t.noTarget()?this._clear():(this.range=t.getPercentRange(),function(e,t,n){xG(e).coordSysRecordMap.each((function(e){var i=e.dataZoomInfoMap.get(t.uid);i&&(i.getRange=n)}))}(i,t,{pan:to(TG.pan,this),zoom:to(TG.zoom,this),scrollMove:to(TG.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){!function(e,t){for(var n=xG(e).coordSysRecordMap,i=n.keys(),a=0;a0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(r[1]-r[0])+r[0],p=Math.max(1/i.scale,0);r[0]=(r[0]-l)*p+l,r[1]=(r[1]-l)*p+l;var c=this.dataZoomModel.findRepresentativeAxisProxy();if(c){var d=c.getMinMaxSpan();if(RO(0,r,[0,100],0,d.minSpan,d.maxSpan),this.range=r,a[0]!==r[0]||a[1]!==r[1])return r}}},pan:EG((function(e,t,n,i,a,r){var o=IG[i]([r.oldX,r.oldY],[r.newX,r.newY],t,a,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength})),scrollMove:EG((function(e,t,n,i,a,r){return IG[i]([0,0],[r.scrollDelta,r.scrollDelta],t,a,n).signal*(e[1]-e[0])*r.scrollDelta}))};function EG(e){return function(t,n,i,a){var r=this.range,o=r.slice(),s=t.axisModels[0];if(s)return RO(e(o,s,t,n,i,a),o,[0,100],"all"),this.range=o,r[0]!==o[0]||r[1]!==o[1]?o:void 0}}var IG={grid:function(e,t,n,i,a){var r=n.axis,o={},s=a.model.coordinateSystem.getRect();return e=e||[0,0],"x"===r.dim?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=r.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=r.inverse?-1:1),o},polar:function(e,t,n,i,a){var r=n.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),p=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),"radiusAxis"===n.mainType?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=r.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=p[1]-p[0],o.pixelStart=p[0],o.signal=r.inverse?-1:1),o},singleAxis:function(e,t,n,i,a){var r=n.axis,o=a.model.coordinateSystem.getRect(),s={};return e=e||[0,0],"horizontal"===r.orient?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=r.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=r.inverse?-1:1),s}};function MG(e){lV(e),e.registerComponentModel(vG),e.registerComponentView(_G),CG(e)}var kG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=ky(eV.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),t}(eV),PG=Gm,DG="horizontal",AG="vertical",OG=["line","bar","candlestick","scatter","custom"],RG={easing:"cubicOut",duration:100,delay:0},BG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return Qe(t,e),t.prototype.init=function(e,t){this.api=t,this._onBrush=to(this._onBrush,this),this._onBrushEnd=to(this._onBrushEnd,this)},t.prototype.render=function(t,n,i,a){if(e.prototype.render.apply(this,arguments),zw(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),!1!==t.get("show")){if(t.noTarget())return this._clear(),void this.group.removeAll();a&&"dataZoom"===a.type&&a.from===this.uid||this._buildView(),this._updateView()}else this.group.removeAll()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Uw(this,"_dispatchZoomAction");var e=this.api.getZr();e.off("mousemove",this._onBrush),e.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new zc;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get("brushSelect")?7:0,i=this._findCoordRect(),a={width:t.getWidth(),height:t.getHeight()},r=this._orient===DG?{right:a.width-i.x-i.width,top:a.height-30-7-n,width:i.width,height:30}:{right:7,top:i.y,width:30,height:i.height},o=Ov(e.option);Yr(["right","top","width","height"],(function(e){"ph"===o[e]&&(o[e]=r[e])}));var s=kv(o,a);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===AG&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),a=i&&i.get("inverse"),r=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;r.attr(n!==DG||a?n===DG&&a?{scaleY:o?1:-1,scaleX:-1}:n!==AG||a?{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?1:-1,scaleX:1});var s=e.getBoundingRect([r]);e.x=t.x-s.x,e.y=t.y-s.y,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,i=e.get("brushSelect");n.add(new PG({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get("backgroundColor")},z2:-40}));var a=new PG({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:"transparent"},z2:0,onclick:to(this._onClickPanel,this)}),r=this.api.getZr();i?(a.on("mousedown",this._onBrushStart,this),a.cursor="crosshair",r.on("mousemove",this._onBrush),r.on("mouseup",this._onBrushEnd)):(r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)),n.add(a)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],e){var t=this._size,n=this._shadowSize||[],i=e.series,a=i.getRawData(),r=i.getShadowDim&&i.getShadowDim(),o=r&&a.getDimensionInfo(r)?i.getShadowDim():e.otherDim;if(null!=o){var s=this._shadowPolygonPts,l=this._shadowPolylinePts;if(a!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var p=a.getDataExtent(o),c=.3*(p[1]-p[0]);p=[p[0]-c,p[1]+c];var d,u=[0,t[1]],m=[0,t[0]],h=[[t[0],0],[0,0]],g=[],f=m[1]/(a.count()-1),y=0,v=Math.round(a.count()/t[0]);a.each([o],(function(e,t){if(v>0&&t%v)y+=f;else{var n=null==e||isNaN(e)||""===e,i=n?0:Qc(e,p,u,!0);n&&!d&&t?(h.push([h[h.length-1][0],0]),g.push([g[g.length-1][0],0])):!n&&d&&(h.push([y,0]),g.push([y,0])),h.push([y,i]),g.push([y,i]),y+=f,d=n}})),s=this._shadowPolygonPts=h,l=this._shadowPolylinePts=g}this._shadowData=a,this._shadowDim=o,this._shadowSize=[t[0],t[1]];for(var x=this.dataZoomModel,b=0;b<3;b++){var w=S(1===b);this._displayables.sliderGroup.add(w),this._displayables.dataShadowSegs.push(w)}}}function S(e){var t=x.getModel(e?"selectedDataBackground":"dataBackground"),n=new zc,i=new Ug({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),a=new Hg({shape:{points:l},segmentIgnoreThreshold:1,style:t.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return n.add(i),n.add(a),n}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get("showDataShadow");if(!1!==t){var n,i=this.ecModel;return e.eachTargetAxis((function(a,r){var o=e.getAxisProxy(a,r);o&&Yr(o.getTargetSeriesModels(),(function(e){if(!(n||!0!==t&&Hr(OG,e.get("type"))<0)){var o,s=i.getComponent(XL(a),r).axis,l=function(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}(a),p=e.coordinateSystem;null!=l&&p.getOtherAxis&&(o=p.getOtherAxis(s).inverse),l=e.getData().mapDimension(l),n={thisAxis:s,series:e,thisDim:a,otherDim:l,otherAxisInverse:o}}}),this)}),this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],i=t.handleLabels=[null,null],a=this._displayables.sliderGroup,r=this._size,o=this.dataZoomModel,s=this.api,l=o.get("borderRadius")||0,p=o.get("brushSelect"),c=t.filler=new PG({silent:p,style:{fill:o.get("fillerColor")},textConfig:{position:"inside"}});a.add(c),a.add(new PG({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:r[0],height:r[1],r:l},style:{stroke:o.get("dataBackgroundColor")||o.get("borderColor"),lineWidth:1,fill:"rgba(0,0,0,0)"}})),Yr([0,1],(function(t){var r=o.get("handleIcon");!GS[r]&&r.indexOf("path://")<0&&r.indexOf("image://")<0&&(r="path://"+r);var s=jS(r,-1,0,2,2,null,!0);s.attr({cursor:FG(this._orient),draggable:!0,drift:to(this._onDragMove,this,t),ondragend:to(this._onDragEnd,this),onmouseover:to(this._showDataInfo,this,!0),onmouseout:to(this._showDataInfo,this,!1),z2:5});var l=s.getBoundingRect(),p=o.get("handleSize");this._handleHeight=Jc(p,this._size[1]),this._handleWidth=l.width/l.height*this._handleHeight,s.setStyle(o.getModel("handleStyle").getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState("emphasis").style=o.getModel(["emphasis","handleStyle"]).getItemStyle(),Hh(s);var c=o.get("handleColor");null!=c&&(s.style.fill=c),a.add(n[t]=s);var d=o.getModel("textStyle");e.add(i[t]=new jm({silent:!0,invisible:!0,style:ay(d,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:d.getTextColor(),font:d.getFont()}),z2:10}))}),this);var d=c;if(p){var u=Jc(o.get("moveHandleSize"),r[1]),m=t.moveHandle=new Gm({style:o.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:r[1]-.5,height:u}}),h=.8*u,g=t.moveHandleIcon=jS(o.get("moveHandleIcon"),-h/2,-h/2,h,h,"#fff",!0);g.silent=!0,g.y=r[1]+u/2-.5,m.ensureState("emphasis").style=o.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var f=Math.min(r[1]/2,Math.max(u,10));(d=t.moveZone=new Gm({invisible:!0,shape:{y:r[1]-f,height:u+f}})).on("mouseover",(function(){s.enterEmphasis(m)})).on("mouseout",(function(){s.leaveEmphasis(m)})),a.add(m),a.add(g),a.add(d)}d.attr({draggable:!0,cursor:FG(this._orient),drift:to(this._onDragMove,this,"all"),ondragstart:to(this._showDataInfo,this,!0),ondragend:to(this._onDragEnd,this),onmouseover:to(this._showDataInfo,this,!0),onmouseout:to(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[Qc(e[0],[0,100],t,!0),Qc(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,i=this._handleEnds,a=this._getViewExtent(),r=n.findRepresentativeAxisProxy();if(r){var o=r.getMinMaxSpan(),s=[0,100];RO(t,i,a,n.get("zoomLock")?"all":e,null!=o.minSpan?Qc(o.minSpan,s,a,!0):null,null!=o.maxSpan?Qc(o.maxSpan,s,a,!0):null);var l=this._range,p=this._range=td([Qc(i[0],a,s,!0),Qc(i[1],a,s,!0)]);return!l||l[0]!==p[0]||l[1]!==p[1]}return!1},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,i=td(n.slice()),a=this._size;Yr([0,1],(function(e){var i=t.handles[e],r=this._handleHeight;i.attr({scaleX:r/2,scaleY:r/2,x:n[e]+(e?-1:1),y:a[1]/2-r/2})}),this),t.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:a[1]});var r={x:i[0],width:i[1]-i[0]};t.moveHandle&&(t.moveHandle.setShape(r),t.moveZone.setShape(r),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr("x",r.x+r.width/2));for(var o=t.dataShadowSegs,s=[0,i[0],i[1],a[0]],l=0;lt[0]||n[1]<0||n[1]>t[1])){var i=this._handleEnds,a=(i[0]+i[1])/2,r=this._updateInterval("all",n[0]-a);this._updateView(),r&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new Bs(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr("ignore",!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var i=this._getViewExtent(),a=[0,100];this._range=td([Qc(n.x,i,a,!0),Qc(n.x+n.width,i,a,!0)]),this._handleEnds=[n.x,n.x+n.width],this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(Ss(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,i=this.dataZoomModel,a=n.brushRect;a||(a=n.brushRect=new PG({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(a)),a.attr("ignore",!1);var r=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),l=o.transformCoordToLocal(r.x,r.y),p=this._size;s[0]=Math.max(Math.min(p[0],s[0]),0),a.setShape({x:l[0],y:0,width:s[0]-l[0],height:p[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?RG:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=QL(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var i=this.api.getWidth(),a=this.api.getHeight();e={x:.2*i,y:.2*a,width:.6*i,height:.6*a}}return e},t.type="dataZoom.slider",t}(nV);function FG(e){return"vertical"===e?"ns-resize":"ew-resize"}function NG(e){e.registerComponentModel(kG),e.registerComponentView(BG),lV(e)}function LG(e){vE(MG),vE(NG)}var VG=function(e,t,n){var i=qr((qG[e]||{})[t]);return n&&io(i)?i[i.length-1]:i},qG={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},GG=vA.mapVisual,zG=vA.eachVisual,UG=io,jG=Yr,HG=td,WG=Qc,$G=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=["inRange","outOfRange"],n.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],n.layoutMode={type:"box",ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return Qe(t,e),t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&hq(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=to(e,this),this.controllerVisuals=mq(this.option.controller,t,e),this.targetVisuals=mq(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this.option.seriesIndex,t=[];return null==e||"all"===e?this.ecModel.eachSeries((function(e,n){t.push(n)})):t=Td(e),t},t.prototype.eachTargetSeries=function(e,t){Yr(this.getTargetSeriesIndices(),(function(n){var i=this.ecModel.getSeriesByIndex(n);i&&e.call(t,i)}),this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries((function(n){n===e&&(t=!0)})),t},t.prototype.formatValueText=function(e,t,n){var i,a=this.option,r=a.precision,o=this.dataBound,s=a.formatter;n=n||["<",">"],io(e)&&(e=e.slice(),i=!0);var l=t?e:i?[p(e[0]),p(e[1])]:p(e);return ro(s)?s.replace("{value}",i?l[0]:l).replace("{value2}",i?l[1]:l):ao(s)?i?s(e[0],e[1]):s(e):i?e[0]===o[0]?n[0]+" "+l[1]:e[1]===o[1]?n[1]+" "+l[0]:l[0]+" - "+l[1]:l;function p(e){return e===o[0]?"min":e===o[1]?"max":(+e).toFixed(Math.min(r,20))}},t.prototype.resetExtent=function(){var e=this.option,t=HG([e.min,e.max]);this._dataExtent=t},t.prototype.getDataDimensionIndex=function(e){var t=this.option.dimension;if(null!=t)return e.getDimensionIndex(t);for(var n=e.dimensions,i=n.length-1;i>=0;i--){var a=n[i],r=e.getDimensionInfo(a);if(!r.isCalculationCoord)return r.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},i=t.target||(t.target={}),a=t.controller||(t.controller={});Gr(i,n),Gr(a,n);var r=this.isCategory();function o(n){UG(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get("gradientColor")}}o.call(this,i),o.call(this,a),function(e,t,n){var i=e[t],a=e[n];i&&!a&&(a=e[n]={},jG(i,(function(e,t){if(vA.isValidType(t)){var n=VG(t,"inactive",r);null!=n&&(a[t]=n,"color"!==t||a.hasOwnProperty("opacity")||a.hasOwnProperty("colorAlpha")||(a.opacity=[0,0]))}})))}.call(this,i,"inRange","outOfRange"),function(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,i=this.get("inactiveColor"),a=this.getItemSymbol()||"roundRect";jG(this.stateList,(function(o){var s=this.itemSize,l=e[o];l||(l=e[o]={color:r?i:[i]}),null==l.symbol&&(l.symbol=t&&qr(t)||(r?a:[a])),null==l.symbolSize&&(l.symbolSize=n&&qr(n)||(r?s[0]:[s[0],s[0]])),l.symbol=GG(l.symbol,(function(e){return"none"===e?a:e}));var p=l.symbolSize;if(null!=p){var c=-1/0;zG(p,(function(e){e>c&&(c=e)})),l.symbolSize=GG(p,(function(e){return WG(e,[0,c],[0,s[0]],!0)}))}}),this)}.call(this,a)},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},t}(Fv),KG=[20,140],YG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual((function(e){e.mappingMethod="linear",e.dataExtent=this.getExtent()})),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(null==t[0]||isNaN(t[0]))&&(t[0]=KG[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=KG[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):io(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),Yr(this.stateList,(function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)}),this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=td((this.get("range")||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries((function(n){var i=[],a=n.getData();a.each(this.getDataDimensionIndex(a),(function(t,n){e[0]<=t&&t<=e[1]&&i.push(n)}),this),t.push({seriesId:n.id,dataIndex:i})}),this),t},t.prototype.getVisualMeta=function(e){var t=XG(this,"outOfRange",this.getExtent()),n=XG(this,"inRange",this.option.range.slice()),i=[];function a(t,n){i.push({value:t,color:e(t,n)})}for(var r=0,o=0,s=n.length,l=t.length;oe[1])break;n.push({color:this.getControllerVisual(r,"color",t),offset:a/100})}return n.push({color:this.getControllerVisual(e[1],"color",t),offset:1}),n},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get("inverse");return new zc("horizontal"!==t||n?"horizontal"===t&&n?{scaleX:"bottom"===e?-1:1,rotation:-Math.PI/2}:"vertical"!==t||n?{scaleX:"left"===e?1:-1}:{scaleX:"left"===e?1:-1,scaleY:-1}:{scaleX:"bottom"===e?1:-1,rotation:Math.PI/2})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,i=this.visualMapModel,a=n.handleThumbs,r=n.handleLabels,o=i.itemSize,s=i.getExtent();nz([0,1],(function(l){var p=a[l];p.setStyle("fill",t.handlesColor[l]),p.y=e[l];var c=tz(e[l],[0,o[1]],s,!0),d=this.getControllerVisual(c,"symbolSize");p.scaleX=p.scaleY=d/o[0],p.x=o[0]-d/2;var u=Vf(n.handleLabelPoints[l],Lf(p,this.group));r[l].setStyle({x:u[0],y:u[1],text:i.formatValueText(this._dataInterval[l]),verticalAlign:"middle",align:"vertical"===this._orient?this._applyTransform("left",n.mainGroup):"center"})}),this)}},t.prototype._showIndicator=function(e,t,n,i){var a=this.visualMapModel,r=a.getExtent(),o=a.itemSize,s=[0,o[1]],l=this._shapes,p=l.indicator;if(p){p.attr("invisible",!1);var c=this.getControllerVisual(e,"color",{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,"symbolSize"),u=tz(e,r,s,!0),m=o[0]-d/2,h={x:p.x,y:p.y};p.y=u,p.x=m;var g=Vf(l.indicatorLabelPoint,Lf(p,this.group)),f=l.indicatorLabel;f.attr("invisible",!1);var y=this._applyTransform("left",l.mainGroup),v="horizontal"===this._orient;f.setStyle({text:(n||"")+a.formatValueText(t),verticalAlign:v?y:"middle",align:v?"center":y});var x={x:m,y:u,style:{fill:c}},b={style:{x:g[0],y:g[1]}};if(a.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var w={duration:100,easing:"cubicInOut",additive:!0};p.x=h.x,p.y=h.y,p.animateTo(x,w),f.animateTo(b,w)}else p.attr(x),f.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ca[1]&&(p[1]=1/0),t&&(p[0]===-1/0?this._showIndicator(l,p[1],"< ",o):p[1]===1/0?this._showIndicator(l,p[0],"> ",o):this._showIndicator(l,l,"≈ ",o));var c=this._hoverLinkDataIndices,d=[];(t||sz(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(p));var u=function(e,t){var n={},i={};return a(e||[],n),a(t||[],i,n),[r(n),r(i)];function a(e,t,n){for(var i=0,a=e.length;i=0&&(a.dimension=r,i.push(a))}})),e.getData().setVisual("visualMeta",i)}}];function uz(e,t,n,i){for(var a=t.targetVisuals[i],r=vA.prepareVisualTypes(a),o={color:MS(e.getData(),"color")},s=0,l=r.length;s0:e.splitNumber>0)&&!e.calculable?"piecewise":"continuous"})),e.registerAction(pz,cz),Yr(dz,(function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)})),e.registerPreprocessor(hz))}function vz(e){e.registerComponentModel(YG),e.registerComponentView(rz),yz(e)}var xz=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return Qe(t,e),t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],bz[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var a=this.option.categories;this.resetVisual((function(e,t){"categories"===i?(e.mappingMethod="category",e.categories=qr(a)):(e.dataExtent=this.getExtent(),e.mappingMethod="piecewise",e.pieceList=Xr(this._pieceList,(function(e){return e=qr(e),"inRange"!==t&&(e.visual=null),e})))}))},t.prototype.completeVisualOption=function(){var t=this.option,n={},i=vA.listVisualTypes(),a=this.isCategory();function r(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}Yr(t.pieces,(function(e){Yr(i,(function(t){e.hasOwnProperty(t)&&(n[t]=1)}))})),Yr(n,(function(e,n){var i=!1;Yr(this.stateList,(function(e){i=i||r(t,e,n)||r(t.target,e,n)}),this),!i&&Yr(this.stateList,(function(e){(t[e]||(t[e]={}))[n]=VG(n,"inRange"===e?"active":"inactive",a)}))}),this),e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,i=this._pieceList,a=(t?n:e).selected||{};if(n.selected=a,Yr(i,(function(e,t){var n=this.getSelectedMapKey(e);a.hasOwnProperty(n)||(a[n]=!0)}),this),"single"===n.selectedMode){var r=!1;Yr(i,(function(e,t){var n=this.getSelectedMapKey(e);a[n]&&(r?a[n]=!1:r=!0)}),this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(e){return"categories"===this._mode?e.value+"":e.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(e){this.option.selected=qr(e)},t.prototype.getValueState=function(e){var t=vA.findPieceIndex(e,this._pieceList);return null!=t&&this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries((function(i){var a=[],r=i.getData();r.each(this.getDataDimensionIndex(r),(function(t,i){vA.findPieceIndex(t,n)===e&&a.push(i)}),this),t.push({seriesId:i.id,dataIndex:a})}),this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(null!=e.value)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(!this.isCategory()){var t=[],n=["",""],i=this,a=this._pieceList.slice();if(a.length){var r=a[0].interval[0];r!==-1/0&&a.unshift({interval:[-1/0,r]}),(r=a[a.length-1].interval[1])!==1/0&&a.push({interval:[r,1/0]})}else a.push({interval:[-1/0,1/0]});var o=-1/0;return Yr(a,(function(e){var t=e.interval;t&&(t[0]>o&&s([o,t[0]],"outOfRange"),s(t.slice()),o=t[1])}),this),{stops:t,outerColors:n}}function s(a,r){var o=i.getRepresentValue({interval:a});r||(r=i.getValueState(o));var s=e(o,r);a[0]===-1/0?n[0]=s:a[1]===1/0?n[1]=s:t.push({value:a[0],color:s},{value:a[1],color:s})}},t.type="visualMap.piecewise",t.defaultOption=ky($G.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}($G),bz={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),i=this.getExtent(),a=t.splitNumber;a=Math.max(parseInt(a,10),1),t.splitNumber=a;for(var r=(i[1]-i[0])/a;+r.toFixed(n)!==r&&n<5;)n++;t.precision=n,r=+r.toFixed(n),t.minOpen&&e.push({interval:[-1/0,i[0]],close:[0,0]});for(var o=0,s=i[0];o","≥"][t[0]]];e.text=e.text||this.formatValueText(null!=e.value?e.value:e.interval,!1,n)}),this)}};function wz(e,t){var n=e.inverse;("vertical"===e.orient?!n:n)&&t.reverse()}var Sz=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Qe(t,e),t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get("textGap"),i=t.textStyleModel,a=i.getFont(),r=i.getTextColor(),o=this._getItemAlign(),s=t.itemSize,l=this._getViewData(),p=l.endsText,c=yo(t.get("showLabel",!0),!p);p&&this._renderEndsText(e,p[0],s,c,o),Yr(l.viewPieceList,(function(i){var l=i.piece,p=new zc;p.onclick=to(this._onItemClick,this,l),this._enableHoverLink(p,i.indexInModelPieceList);var d=t.getRepresentValue(l);if(this._createItemSymbol(p,d,[0,0,s[0],s[1]]),c){var u=this.visualMapModel.getValueState(d);p.add(new jm({style:{x:"right"===o?-n:s[0]+n,y:s[1]/2,text:l.text,verticalAlign:"middle",align:o,font:a,fill:r,opacity:"outOfRange"===u?.5:1}}))}e.add(p)}),this),p&&this._renderEndsText(e,p[1],s,c,o),Mv(t.get("orient"),e,t.get("itemGap")),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on("mouseover",(function(){return i("highlight")})).on("mouseout",(function(){return i("downplay")}));var i=function(e){var i=n.visualMapModel;i.option.hoverLink&&n.api.dispatchAction({type:e,batch:ez(i.findTargetDataIndices(t),i)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if("vertical"===t.orient)return JG(e,this.api,e.itemSize);var n=t.align;return n&&"auto"!==n||(n="left"),n},t.prototype._renderEndsText=function(e,t,n,i,a){if(t){var r=new zc,o=this.visualMapModel.textStyleModel;r.add(new jm({style:ay(o,{x:i?"right"===a?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:"middle",align:i?a:"center",text:t})})),e.add(r)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=Xr(e.getPieceList(),(function(e,t){return{piece:e,indexInModelPieceList:t}})),n=e.get("text"),i=e.get("orient"),a=e.get("inverse");return("horizontal"===i?a:!a)?t.reverse():n&&(n=n.slice().reverse()),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n){e.add(jS(this.getControllerVisual(t,"symbol"),n[0],n[1],n[2],n[3],this.getControllerVisual(t,"color")))},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,i=n.selectedMode;if(i){var a=qr(n.selected),r=t.getSelectedMapKey(e);"single"===i||!0===i?(a[r]=!0,Yr(a,(function(e,t){a[t]=t===r}))):a[r]=!a[r],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:a})}},t.type="visualMap.piecewise",t}(ZG);function Cz(e){e.registerComponentModel(xz),e.registerComponentView(Sz),yz(e)}function _z(e){vE(vz),vE(Cz)}Nd();var Tz={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},Ez=function(){function e(e){if(null==(this._condVal=ro(e)?new RegExp(e):go(e)?e:null)){var t="";0,wd(t)}}return e.prototype.evaluate=function(e){var t=typeof e;return ro(t)?this._condVal.test(e):!!so(t)&&this._condVal.test(e+"")},e}(),Iz=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),Mz=function(){function e(){}return e.prototype.evaluate=function(){for(var e=this.children,t=0;t=Lz:-l>=Lz),u=l>0?l%Lz:l%Lz+Lz,m=!1;m=!!d||!gp(c)&&u>=Nz==!!p;var h=e+n*Fz(r),g=t+i*Bz(r);this._start&&this._add("M",h,g);var f=Math.round(a*Vz);if(d){var y=1/this._p,v=(p?1:-1)*(Lz-y);this._add("A",n,i,f,1,+p,e+n*Fz(r+v),t+i*Bz(r+v)),y>.01&&this._add("A",n,i,f,0,+p,h,g)}else{var x=e+n*Fz(o),b=t+i*Bz(o);this._add("A",n,i,f,+m,+p,x,b)}},e.prototype.rect=function(e,t,n,i){this._add("M",e,t),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},e.prototype.closePath=function(){this._d.length>0&&this._add("Z")},e.prototype._add=function(e,t,n,i,a,r,o,s,l){for(var p=[],c=this._p,d=1;d"}(a,r)+("style"!==a?ms(o):o||"")+(i?""+n+Xr(i,(function(t){return e(t)})).join(n)+n:"")+("")}(e)}function Qz(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function Jz(e,t,n,i){return Xz("svg","root",{width:e,height:t,xmlns:Wz,"xmlns:xlink":$z,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+e+" "+t},n)}var eU=0;function tU(){return eU++}var nU={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},iU="transform-origin";function aU(e,t,n){var i=Ur({},e.shape);Ur(i,t),e.buildPath(n,i);var a=new qz;return a.reset(Tp(e)),n.rebuildPath(a,1),a.generateStr(),a.getStr()}function rU(e,t){var n=t.originX,i=t.originY;(n||i)&&(e[iU]=n+"px "+i+"px")}var oU={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function sU(e,t){var n=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function lU(e){return ro(e)?nU[e]?"cubic-bezier("+nU[e]+")":Ll(e)?e:"":""}function pU(e,t,n,i){var a=e.animators,r=a.length,o=[];if(e instanceof tf){var s=function(e,t,n){var i,a,r=e.shape.paths,o={};if(Yr(r,(function(e){var t=Qz(n.zrId);t.animation=!0,pU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,l=eo(r),p=l.length;if(p){var c=r[a=l[p-1]];for(var d in c){var u=c[d];o[d]=o[d]||{d:""},o[d].d+=u.d||""}for(var m in s){var h=s[m].animation;h.indexOf(a)>=0&&(i=h)}}})),i){t.d=!1;var s=sU(o,n);return i.replace(a,s)}}(e,t,n);if(s)o.push(s);else if(!r)return}else if(!r)return;for(var l={},p=0;p0})).length)return sU(c,n)+" "+a[0]+" both"}for(var f in l){(s=g(l[f]))&&o.push(s)}if(o.length){var y=n.zrId+"-cls-"+tU();n.cssNodes["."+y]={animation:o.join(",")},t.class=y}}function cU(e,t,n,i){var a=JSON.stringify(e),r=n.cssStyleCache[a];r||(r=n.zrId+"-cls-"+tU(),n.cssStyleCache[a]=r,n.cssNodes["."+r+(i?":hover":"")]=e),t.class=t.class?t.class+" "+r:r}var dU=Math.round;function uU(e){return e&&ro(e.src)}function mU(e){return e&&ao(e.toDataURL)}function hU(e,t,n,i){Hz((function(a,r){var o="fill"===a||"stroke"===a;o&&Cp(r)?TU(t,e,a,i):o&&bp(r)?EU(n,e,a,i):e[a]=o&&"none"===r?"transparent":r}),t,n,!1),function(e,t,n){var i=e.style;if(function(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}(i)){var a=function(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}(e),r=n.shadowCache,o=r[a];if(!o){var s=e.getGlobalScale(),l=s[0],p=s[1];if(!l||!p)return;var c=i.shadowOffsetX||0,d=i.shadowOffsetY||0,u=i.shadowBlur,m=mp(i.shadowColor),h=m.opacity,g=m.color,f=u/2/l+" "+u/2/p;o=n.zrId+"-s"+n.shadowIdx++,n.defs[o]=Xz("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[Xz("feDropShadow","",{dx:c/l,dy:d/p,stdDeviation:f,"flood-color":g,"flood-opacity":h})]),r[a]=o}t.filter=_p(o)}}(n,e,i)}function gU(e,t){var n=Yc(t);n&&(n.each((function(t,n){null!=t&&(e[(Kz+n).toLowerCase()]=t+"")})),t.isSilent()&&(e[Kz+"silent"]="true"))}function fU(e){return gp(e[0]-1)&&gp(e[1])&&gp(e[2])&&gp(e[3]-1)}function yU(e,t,n){if(t&&(!function(e){return gp(e[4])&&gp(e[5])}(t)||!fU(t))){var i=n?10:1e4;e.transform=fU(t)?"translate("+dU(t[4]*i)/i+" "+dU(t[5]*i)/i+")":function(e){return"matrix("+fp(e[0])+","+fp(e[1])+","+fp(e[2])+","+fp(e[3])+","+yp(e[4])+","+yp(e[5])+")"}(t)}}function vU(e,t,n){for(var i=e.points,a=[],r=0;r=0&&o||r;s&&(a=dp(s))}var l=i.lineWidth;l&&(l/=!i.strokeNoScale&&e.transform?e.transform[0]:1);var p={cursor:"pointer"};a&&(p.fill=a),i.stroke&&(p.stroke=i.stroke),l&&(p["stroke-width"]=l),cU(p,t,n,!0)}}(e,r,t),Xz(s,e.id+"",r)}function _U(e,t){return e instanceof km?CU(e,t):e instanceof Rm?function(e,t){var n=e.style,i=n.image;if(i&&!ro(i)&&(uU(i)?i=i.src:mU(i)&&(i=i.toDataURL())),i){var a=n.x||0,r=n.y||0,o={href:i,width:n.width,height:n.height};return a&&(o.x=a),r&&(o.y=r),yU(o,e.transform),hU(o,n,e,t),gU(o,e),t.animation&&pU(e,o,t),Xz("image",e.id+"",o)}}(e,t):e instanceof Dm?function(e,t){var n=e.style,i=n.text;if(null!=i&&(i+=""),i&&!isNaN(n.x)&&!isNaN(n.y)){var a=n.font||wr,r=n.x||0,o=function(e,t,n){return"top"===n?e+=t/2:"bottom"===n&&(e-=t/2),e}(n.y||0,kc(a),n.textBaseline),s={"dominant-baseline":"central","text-anchor":vp[n.textAlign]||n.textAlign};if(Xm(n)){var l="",p=n.fontStyle,c=Km(n.fontSize);if(!parseFloat(c))return;var d=n.fontFamily||br,u=n.fontWeight;l+="font-size:"+c+";font-family:"+d+";",p&&"normal"!==p&&(l+="font-style:"+p+";"),u&&"normal"!==u&&(l+="font-weight:"+u+";"),s.style=l}else s.style="font: "+a;return i.match(/\s/)&&(s["xml:space"]="preserve"),r&&(s.x=r),o&&(s.y=o),yU(s,e.transform),hU(s,n,e,t),gU(s,e),t.animation&&pU(e,s,t),Xz("text",e.id+"",s,void 0,i)}}(e,t):void 0}function TU(e,t,n,i){var a,r=e[n],o={gradientUnits:r.global?"userSpaceOnUse":"objectBoundingBox"};if(wp(r))a="linearGradient",o.x1=r.x,o.y1=r.y,o.x2=r.x2,o.y2=r.y2;else{if(!Sp(r))return void 0;a="radialGradient",o.cx=vo(r.x,.5),o.cy=vo(r.y,.5),o.r=vo(r.r,.5)}for(var s=r.colorStops,l=[],p=0,c=s.length;pl?GU(e,null==n[d+1]?null:n[d+1].elm,n,s,d):zU(e,t,o,l))}(n,i,a):NU(a)?(NU(e.text)&&RU(n,""),GU(n,null,a,0,a.length-1)):NU(i)?zU(n,i,0,i.length-1):NU(e.text)&&RU(n,""):e.text!==t.text&&(NU(i)&&zU(n,i,0,i.length-1),RU(n,t.text)))}var HU=0,WU=function(){function e(e,t,n){if(this.type="svg",this.refreshHover=$U("refreshHover"),this.configLayer=$U("configLayer"),this.storage=t,this._opts=n=Ur({},n),this.root=e,this._id="zr"+HU++,this._oldVNode=Jz(n.width,n.height),e&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var a=this._svgDom=this._oldVNode.elm=Yz("svg");UU(null,this._oldVNode),i.appendChild(a),e.appendChild(i)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style="position:absolute;left:0;top:0;user-select:none",function(e,t){if(VU(e,t))jU(e,t);else{var n=e.elm,i=AU(n);qU(t),null!==i&&(kU(i,t.elm,OU(n)),zU(i,[e],0,0))}}(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return _U(e,Qz(this._id))},e.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),n=this._width,i=this._height,a=Qz(this._id);a.animation=e.animation,a.willUpdate=e.willUpdate,a.compress=e.compress,a.emphasis=e.emphasis;var r=[],o=this._bgVNode=function(e,t,n,i){var a;if(n&&"none"!==n)if(a=Xz("rect","bg",{width:e,height:t,x:"0",y:"0"}),Cp(n))TU({fill:n},a.attrs,"fill",i);else if(bp(n))EU({style:{fill:n},dirty:Bo,getBoundingRect:function(){return{width:e,height:t}}},a.attrs,"fill",i);else{var r=mp(n),o=r.color,s=r.opacity;a.attrs.fill=o,s<1&&(a.attrs["fill-opacity"]=s)}return a}(n,i,this._backgroundColor,a);o&&r.push(o);var s=e.compress?null:this._mainVNode=Xz("g","main",{},[]);this._paintList(t,a,s?s.children:r),s&&r.push(s);var l=Xr(eo(a.defs),(function(e){return a.defs[e]}));if(l.length&&r.push(Xz("defs","defs",{},l)),e.animation){var p=function(e,t,n){var i=(n=n||{}).newline?"\n":"",a=" {"+i,r=i+"}",o=Xr(eo(e),(function(t){return t+a+Xr(eo(e[t]),(function(n){return n+":"+e[t][n]+";"})).join(i)+r})).join(i),s=Xr(eo(t),(function(e){return"@keyframes "+e+a+Xr(eo(t[e]),(function(n){return n+a+Xr(eo(t[e][n]),(function(i){var a=t[e][n][i];return"d"===i&&(a='path("'+a+'")'),i+":"+a+";"})).join(i)+r})).join(i)+r})).join(i);return o||s?[""].join(i):""}(a.cssNodes,a.cssAnims,{newline:!0});if(p){var c=Xz("style","stl",{},[],p);r.push(c)}}return Jz(n,i,r,e.useViewBox)},e.prototype.renderToString=function(e){return e=e||{},Zz(this.renderToVNode({animation:vo(e.cssAnimation,!0),emphasis:vo(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:vo(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var i,a,r=e.length,o=[],s=0,l=0,p=0;p=0&&(!d||!a||d[h]!==a[h]);h--);for(var g=m-1;g>h;g--)i=o[--s-1];for(var f=h+1;f=o)}}for(var c=this.__startIndex;c15)break}n.prevElClipPaths&&d.restore()};if(m)if(0===m.length)s=l.__endIndex;else for(var b=u.dpr,w=0;w0&&e>i[0]){for(s=0;se);s++);o=n[i[s]]}if(i.splice(s+1,0,e),n[e]=t,!t.virtual)if(o){var l=o.dom;l.nextSibling?r.insertBefore(t.dom,l.nextSibling):r.appendChild(t.dom)}else r.firstChild?r.insertBefore(t.dom,r.firstChild):r.appendChild(t.dom);t.painter||(t.painter=this)}},e.prototype.eachLayer=function(e,t){for(var n=this._zlevelList,i=0;i0?JU:0),this._needsManuallyCompositing),p.__builtin__||Vr("ZLevel "+l+" has been used by unkown layer "+p.id),p!==r&&(p.__used=!0,p.__startIndex!==a&&(p.__dirty=!0),p.__startIndex=a,p.incremental?p.__drawIndex=-1:p.__drawIndex=a,t(a),r=p),1&s.__dirty&&!s.__inHover&&(p.__dirty=!0,p.incremental&&p.__drawIndex<0&&(p.__drawIndex=a))}t(a),this.eachBuiltinLayer((function(e,t){!e.__used&&e.getElementCount()>0&&(e.__dirty=!0,e.__startIndex=e.__endIndex=e.__drawIndex=0),e.__dirty&&e.__drawIndex<0&&(e.__drawIndex=e.__startIndex)}))},e.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},e.prototype._clearLayer=function(e){e.clear()},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,Yr(this._layers,(function(e){e.setUnpainted()}))},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?Gr(n[e],t,!0):n[e]=t;for(var i=0;i({legendKey:e,left:!0}),aj=e=>({background:e});function rj(e,n){1&e&&t.ɵɵelementContainer(0)}function oj(e,n){if(1&e&&t.ɵɵtemplate(0,rj,1,0,"ng-container",7),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("ngTemplateOutlet",e.widgetTitlePanel)}}function sj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Min")))}function lj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Max")))}function pj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Avg")))}function cj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Total")))}function dj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Latest")))}function uj(e,n){1&e&&t.ɵɵelementContainer(0)}function mj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].min,"html"),t.ɵɵsanitizeHtml)}}function hj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].max,"html"),t.ɵɵsanitizeHtml)}}function gj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].avg,"html"),t.ɵɵsanitizeHtml)}}function fj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].total,"html"),t.ɵɵsanitizeHtml)}}function yj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].latest,"html"),t.ɵɵsanitizeHtml)}}function vj(e,n){if(1&e&&(t.ɵɵelementStart(0,"tr")(1,"th"),t.ɵɵtemplate(2,uj,1,0,"ng-container",10),t.ɵɵelementEnd(),t.ɵɵtemplate(3,mj,2,4,"td",11)(4,hj,2,4,"td",11)(5,gj,2,4,"td",11)(6,fj,2,4,"td",11)(7,yj,2,4,"td",11),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2),a=t.ɵɵreference(8);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",a)("ngTemplateOutletContext",t.ɵɵpureFunction1(7,ij,e)),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showMin?3:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showMax?4:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showAvg?5:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showTotal?6:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showLatest?7:-1)}}function xj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",6)(1,"table",8)(2,"thead")(3,"tr"),t.ɵɵelement(4,"th"),t.ɵɵtemplate(5,sj,3,3,"th",9)(6,lj,3,3,"th",9)(7,pj,3,3,"th",9)(8,cj,3,3,"th",9)(9,dj,3,3,"th",9),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"tbody"),t.ɵɵrepeaterCreate(11,vj,8,9,"tr",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵconditional(!0===e.legendConfig.showMin?5:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showMax?6:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showAvg?7:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showTotal?8:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showLatest?9:-1),t.ɵɵadvance(2),t.ɵɵrepeater(e.legendKeys)}}function bj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelement(2,"div",14)(3,"div",15),t.ɵɵpipe(4,"safe"),t.ɵɵelementEnd()()),2&e){const e=n.legendKey,i=n.left;t.ɵɵclassProp("left",i),t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction1(8,aj,e.dataKey.color)),t.ɵɵadvance(),t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(4,5,e.dataKey.label,"html"),t.ɵɵsanitizeHtml)}}class wj{constructor(e,t,n){this.renderer=e,this.sanitizer=t,this.widgetComponent=n,this.updateXAxisTimeWindow=(e,t)=>{e.min=t.minTime,e.max=t.maxTime}}ngOnInit(){this.initEchart(),this.initLegend()}ngAfterViewInit(){this.myChart=function(e,t,n){var i=!(n&&n.ssr);if(i){var a=f_(e);if(a)return a}var r=new t_(e,t,n);return r.id="ec_"+h_++,u_[r.id]=r,i&&jd(e,g_,r.id),XC(r),wC.trigger("afterinit",r),r}(this.echartContainer.nativeElement,null,{renderer:"svg"}),this.initResize(),this.xAxis=this.setupXAxis(),this.yAxis=this.setupYAxis(),this.option={...this.setupAnimationSettings(),formatter:e=>this.setupTooltipElement(e),backgroundColor:"transparent",darkMode:!1,tooltip:{show:!0,trigger:"axis",confine:!0,padding:[8,12],appendTo:"body",textStyle:{fontFamily:"Roboto",fontSize:12,fontWeight:"normal",lineHeight:16}},grid:[{backgroundColor:null,borderColor:"#ccc",borderWidth:1,bottom:45,left:5,right:5,show:!1,top:10}],xAxis:[this.xAxis],yAxis:[this.yAxis],series:this.setupChartLines(),dataZoom:[{type:"inside",disabled:!1,realtime:!0,filterMode:"none"},{type:"slider",show:!0,showDetail:!1,realtime:!0,filterMode:"none",bottom:5}]},this.myChart.setOption(this.option),this.updateAxisOffset(!1)}onDataUpdated(){const e=[];this.onResize(),this.updateXAxisTimeWindow(this.xAxis,this.ctx.defaultSubscription.timeWindow);for(const t in this.ctx.data){e[t]=[];for(const[n,i]of this.ctx.data[t].data)e[t].push({name:n,value:[n,i]})}const t=[];for(const n of e)t.push({data:n});this.option.series=t,this.myChart.setOption(this.option),this.updateAxisOffset()}updateAxisOffset(e=!0){const t=at(this.myChart,this.yAxis.mainType,this.yAxis.id),n=rt(this.myChart,this.yAxis.mainType,this.yAxis.id,this.yAxis.name),i=at(this.myChart,this.xAxis.mainType,this.xAxis.id),a=t+n,r=i+rt(this.myChart,this.yAxis.mainType,this.yAxis.id,this.yAxis.name)+35;this.option.grid[0].left===a&&this.option.grid[0].bottom===r||(this.option.grid[0].left=a,this.yAxis.nameGap=t,this.option.grid[0].bottom=r,this.xAxis.nameGap=i,this.myChart.setOption(this.option,{replaceMerge:["yAxis","xAxis","grid"],lazyUpdate:e}))}initEchart(){vE([cq,UN,_z,LG,Zq,wL,gP,mM,VM,ik,fP,aN,MI,tj,KU])}initLegend(){this.showLegend=this.ctx.settings.showLegend,this.showLegend&&(this.legendConfig=this.ctx.settings.legendConfig,this.legendData=this.ctx.defaultSubscription.legendData,this.legendKeys=this.legendData.keys,this.legendClass=`legend-${this.legendConfig.position}`,this.legendConfig.sortDataKeys?this.legendKeys=this.legendData.keys.sort(((e,t)=>e.dataKey.label.localeCompare(t.dataKey.label))):this.legendKeys=this.legendData.keys)}initResize(){this.shapeResize$=new ResizeObserver((()=>{this.onResize()})),this.shapeResize$.observe(this.echartContainer.nativeElement)}onResize(){this.myChart.resize()}setupTooltipElement(e){const t=this.renderer.createElement("div");if(this.renderer.setStyle(t,"display","flex"),this.renderer.setStyle(t,"flex-direction","column"),this.renderer.setStyle(t,"align-items","flex-start"),this.renderer.setStyle(t,"gap","16px"),e.length){const n=this.renderer.createElement("div");this.renderer.setStyle(n,"display","flex"),this.renderer.setStyle(n,"flex-direction","column"),this.renderer.setStyle(n,"align-items","flex-start"),this.renderer.setStyle(n,"gap","4px"),this.renderer.appendChild(n,this.setTooltipDate(e));for(const[t,i]of e.entries())this.renderer.appendChild(n,this.constructTooltipSeriesElement(i,t));this.renderer.appendChild(t,n)}return t}constructTooltipSeriesElement(e,t){const n=this.renderer.createElement("div");this.renderer.setStyle(n,"display","flex"),this.renderer.setStyle(n,"flex-direction","row"),this.renderer.setStyle(n,"align-items","center"),this.renderer.setStyle(n,"align-self","stretch"),this.renderer.setStyle(n,"gap","12px");const i=this.renderer.createElement("div");this.renderer.setStyle(i,"display","flex"),this.renderer.setStyle(i,"align-items","center"),this.renderer.setStyle(i,"gap","8px"),this.renderer.appendChild(n,i);const a=this.renderer.createElement("div");this.renderer.setStyle(a,"width","8px"),this.renderer.setStyle(a,"height","8px"),this.renderer.setStyle(a,"border-radius","50%"),this.renderer.setStyle(a,"background",e.color),this.renderer.appendChild(i,a);const r=this.renderer.createElement("div");this.renderer.setProperty(r,"innerHTML",this.sanitizer.sanitize(g.HTML,e.seriesName)),this.renderer.setStyle(r,"font-family","Roboto"),this.renderer.setStyle(r,"font-size","12px"),this.renderer.setStyle(r,"font-style","normal"),this.renderer.setStyle(r,"font-weight",400),this.renderer.setStyle(r,"line-height","16px"),this.renderer.setStyle(r,"color","rgba(0, 0, 0, 0.76)"),this.renderer.appendChild(i,r);const o=re(this.ctx.data[t].dataKey.decimals)?this.ctx.data[t].dataKey.decimals:this.ctx.decimals,s=re(this.ctx.data[t].dataKey.units)?this.ctx.data[t].dataKey.units:this.ctx.units,l=oe(e.value[1],o,s,!1),p=this.renderer.createElement("div");return this.renderer.setProperty(p,"innerHTML",this.sanitizer.sanitize(g.HTML,l)),this.renderer.setStyle(p,"flex","1"),this.renderer.setStyle(p,"text-align","end"),this.renderer.setStyle(p,"font-family","Roboto"),this.renderer.setStyle(p,"font-size","12px"),this.renderer.setStyle(p,"font-style","normal"),this.renderer.setStyle(p,"font-weight",500),this.renderer.setStyle(p,"line-height","16px"),this.renderer.setStyle(p,"color","rgba(0, 0, 0, 0.76)"),this.renderer.appendChild(n,p),n}setTooltipDate(e){const t=this.renderer.createElement("div");return this.renderer.appendChild(t,this.renderer.createText(new Date(e[0].value[0]).toLocaleString("en-GB"))),this.renderer.setStyle(t,"font-family","Roboto"),this.renderer.setStyle(t,"font-size","11px"),this.renderer.setStyle(t,"font-style","normal"),this.renderer.setStyle(t,"font-weight","400"),this.renderer.setStyle(t,"line-height","16px"),this.renderer.setStyle(t,"color","rgba(0, 0, 0, 0.76)"),t}setupAnimationSettings(){return{animation:!0,animationDelay:0,animationDelayUpdate:0,animationDuration:500,animationDurationUpdate:300,animationEasing:"cubicOut",animationEasingUpdate:"cubicOut",animationThreshold:2e3}}setupChartLines(){const e=[];for(const[t,n]of this.ctx.datasources[0].dataKeys.entries())e.push({id:t,name:n.label,type:"line",showSymbol:!1,smooth:!1,step:!1,stackStrategy:"all",data:[],lineStyle:{color:n.color},itemStyle:{color:n.color}});return e}setupYAxis(){return{type:"value",position:"left",mainType:"yAxis",id:"yAxis",offset:0,nameLocation:"middle",nameRotate:90,alignTicks:!0,scale:!0,show:!0,axisLabel:{color:"rgba(0, 0, 0, 0.54)",fontFamily:"Roboto",fontSize:12,fontStyle:"normal",fontWeight:400,show:!0,formatter:e=>oe(e,this.ctx.decimals,this.ctx.units,!1)},splitLine:{show:!0},axisLine:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.54)"}},axisTick:{lineStyle:{color:"rgba(0, 0, 0, 0.54)"},show:!0},nameTextStyle:{color:"rgba(0, 0, 0, 0.54)",fontFamily:"Roboto",fontSize:12,fontStyle:"normal",fontWeight:600}}}setupXAxis(){return{id:"xAxis",mainType:"xAxis",show:!0,type:"time",position:"bottom",offset:0,nameLocation:"middle",max:this.ctx.defaultSubscription.timeWindow.maxTime,min:this.ctx.defaultSubscription.timeWindow.minTime,nameTextStyle:{color:"rgba(0, 0, 0, 0.54)",fontStyle:"normal",fontWeight:600,fontFamily:"Roboto",fontSize:12},axisPointer:{shadowStyle:{color:"rgba(210,219,238,0.2)"}},splitLine:{show:!0},axisTick:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.54)"}},axisLine:{onZero:!1,show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.54)"}},axisLabel:{color:"rgba(0, 0, 0, 0.54)",fontFamily:"Roboto",fontSize:10,fontStyle:"normal",fontWeight:400,show:!0,hideOverlap:!0}}}static{this.ɵfac=function(e){return new(e||wj)(t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(ot.DomSanitizer),t.ɵɵdirectiveInject(st.WidgetComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:wj,selectors:[["tb-gateway-statistics-chart"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(nj,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.echartContainer=e.first)}},inputs:{ctx:"ctx",widgetTitlePanel:"widgetTitlePanel"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:9,vars:4,consts:[["echartContainer",""],["legendItem",""],[1,"tb-time-series-chart-panel"],[1,"tb-time-series-chart-overlay"],[1,"tb-time-series-chart-content"],[1,"tb-time-series-chart-shape"],[1,"tb-time-series-chart-legend"],[4,"ngTemplateOutlet"],[1,"tb-time-series-chart-legend-table","vertical"],[1,"tb-time-series-chart-legend-type-label","right","legend","legend-row-color"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"tb-time-series-chart-legend-value","legend",3,"innerHTML"],[1,"tb-time-series-chart-legend-item"],[1,"tb-time-series-chart-legend-item-label"],[1,"tb-time-series-chart-legend-item-label-circle"],[1,"legend","legend-label-color",3,"innerHTML"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",2),t.ɵɵelement(1,"div",3),t.ɵɵtemplate(2,oj,1,1,"ng-container"),t.ɵɵelementStart(3,"div",4),t.ɵɵelement(4,"div",5,0),t.ɵɵtemplate(6,xj,13,5,"div",6)(7,bj,5,10,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵconditional(n.widgetComponent.dashboardWidget.showWidgetTitlePanel?2:-1),t.ɵɵadvance(),t.ɵɵclassMap(n.legendClass),t.ɵɵadvance(3),t.ɵɵconditional(n.showLegend?6:-1))},dependencies:t.ɵɵgetComponentDepsFactory(wj,[me,T]),styles:['@charset "UTF-8";.tb-time-series-chart-panel[_ngcontent-%COMP%]{width:100%;height:100%;position:relative;display:flex;flex-direction:column;gap:8px;padding:12px}.tb-time-series-chart-panel[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:not(.tb-time-series-chart-overlay){z-index:1}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-overlay[_ngcontent-%COMP%]{position:absolute;inset:12px}.tb-time-series-chart-panel[_ngcontent-%COMP%] div.tb-widget-title[_ngcontent-%COMP%]{padding:0}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%]{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;gap:8px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%]{flex-direction:column-reverse}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-right[_ngcontent-%COMP%]{flex-direction:row}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-left[_ngcontent-%COMP%]{flex-direction:row-reverse}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-shape[_ngcontent-%COMP%]{flex:1;min-width:0;min-height:0;display:flex;align-items:center;justify-content:center}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-right[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-left[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]{display:inline-grid;grid-auto-flow:column;grid-template-rows:repeat(auto-fit,minmax(16px,min-content));max-width:calc(25% - 8px);height:fit-content;max-height:100%}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-bottom[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]{align-self:center}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%] .tb-time-series-chart-legend.tb-simple-legend[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-bottom[_ngcontent-%COMP%] .tb-time-series-chart-legend.tb-simple-legend[_ngcontent-%COMP%]{justify-content:center}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]:not(.tb-simple-legend), .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-bottom[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]:not(.tb-simple-legend){width:100%}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]{display:flex;align-items:flex-start;align-self:stretch;column-gap:16px;row-gap:8px;flex-wrap:wrap;overflow:auto;width:fit-content;max-width:100%;max-height:calc(35% - 8px)}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%]{border-spacing:0;table-layout:fixed}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table.vertical[_ngcontent-%COMP%]{width:100%;table-layout:auto}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table.vertical[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{width:95%}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:not(:last-child), .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:not(:last-child){padding-right:16px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:not(:last-child) th[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:not(:last-child) td[_ngcontent-%COMP%]{padding-bottom:8px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%]{align-items:flex-end}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] .tb-time-series-chart-legend-item.left[_ngcontent-%COMP%]{align-items:flex-start}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;-webkit-user-select:none;user-select:none}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%] .tb-time-series-chart-legend-item-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;color:#ccc;white-space:nowrap;cursor:pointer}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%] .tb-time-series-chart-legend-item-label[_ngcontent-%COMP%] .tb-time-series-chart-legend-item-label-circle[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;background-color:#ccc}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-type-label[_ngcontent-%COMP%]{white-space:nowrap;text-align:left}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-type-label.right[_ngcontent-%COMP%]{text-align:right}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-value[_ngcontent-%COMP%]{white-space:nowrap;text-align:right}.tb-time-series-chart-panel[_ngcontent-%COMP%] .legend[_ngcontent-%COMP%]{font-size:12px;font-style:normal;font-weight:500;letter-spacing:normal;line-height:16px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .legend.legend-row-color[_ngcontent-%COMP%]{color:#00000061}.tb-time-series-chart-panel[_ngcontent-%COMP%] .legend.legend-label-color[_ngcontent-%COMP%]{color:#000}']})}}const Sj=["statisticChart"];function Cj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.openEditCommandDialog())})),t.ɵɵelementStart(2,"mat-icon",13),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",12),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onDeleteClick())})),t.ɵɵelementStart(6,"mat-icon",13),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.edit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(5,4,"action.delete")))}function _j(e,n){if(1&e&&t.ɵɵelement(0,"tb-gateway-statistics-chart",14,0),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("ctx",e.ctx)}}function Tj(e,n){if(1&e&&t.ɵɵelement(0,"tb-custom-statistics-table",15),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("data",e.subscriptionData)}}function Ej(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,_j,2,1,"tb-gateway-statistics-chart",14)(2,Tj,1,1,"tb-custom-statistics-table",15),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵconditional(e.isNumericData?1:2)}}function Ij(e,n){1&e&&(t.ɵɵelementStart(0,"div",11),t.ɵɵelement(1,"div",16),t.ɵɵelementStart(2,"div",17),t.ɵɵtext(3,"attribute.no-telemetry-text"),t.ɵɵelementEnd()())}class Mj{constructor(e,t,n,i,a,r){this.fb=e,this.attributeService=t,this.destroyRef=n,this.dialog=i,this.dialogService=a,this.utils=r,this.subscriptionData=[],this.statisticForm=this.fb.group({command:[]}),this.isNumericData=!1,this.commands=[],this.subscribed=!1,this.dataTypeDefined=!1,this.subscriptionOptions={callbacks:{onDataUpdated:()=>this.ctx.ngZone.run((()=>{this.isDataOnlyNumbers(),this.isNumericData&&this.statisticChart?.onDataUpdated()})),onDataUpdateError:(e,t)=>this.ctx.ngZone.run((()=>{this.onDataUpdateError(t)}))},useDashboardTimewindow:!1,legendConfig:R(B.timeseries)},this.statisticForm.get("command").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.subscribed=!1,this.subscriptionInfo&&e?.attributeOnGateway&&this.createSubscription(this.ctx.defaultSubscription.datasources[0].entity,e.attributeOnGateway)}))}ngAfterViewInit(){if(this.ctx.defaultSubscription.datasources.length){const e=this.ctx.defaultSubscription.datasources[0].entity;if(e.id.id===F)return;this.getGatewayGeneralConfig().pipe(On(this.destroyRef)).subscribe((t=>{this.commands=t?.statistics.commands.reverse()??[],this.commands.length&&(this.statisticForm.get("command").setValue(this.commands[0]),this.createSubscription(e,this.commands[0].attributeOnGateway))}))}}openEditCommandDialog(){const e=this.statisticForm.get("command").value,t="string"==typeof e||!e,n="string"==typeof e?{attributeOnGateway:e}:e;let i;this.dialog.open(yr,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{titleText:t?"gateway.statistics.create-command":"gateway.statistics.edit-command",buttonText:t?"action.add":"action.apply",command:n,existingCommands:this.commands.map((e=>e.attributeOnGateway))}}).afterClosed().pipe(He((e=>De(this.getGatewayGeneralConfig(),Pe(e)))),He((([e,t])=>(this.commands=[...e?.statistics.commands.filter((e=>e.attributeOnGateway!==t?.prev?.attributeOnGateway))??[],...t?.current?[{...t.current}]:[]],i=t?.current,this.updateStatisticsCommands(e,this.commands)))),On(this.destroyRef)).subscribe((()=>{i&&this.statisticForm.get("command").patchValue(i)}))}onDeleteClick(){const e=this.statisticForm.get("command").value.attributeOnGateway;this.dialogService.confirm(this.ctx.translate.instant("gateway.statistics.delete-command",{command:e}),this.ctx.translate.instant("gateway.statistics.delete-command-data"),this.ctx.translate.instant("action.cancel"),this.ctx.translate.instant("action.confirm")).pipe(je(Boolean),He((()=>this.getGatewayGeneralConfig())),He((t=>(this.commands=[...t.statistics.commands.filter((t=>t.attributeOnGateway!==e))],this.updateStatisticsCommands(t,this.commands)))),On(this.destroyRef)).subscribe()}getGatewayGeneralConfig(){const e=this.ctx.defaultSubscription.datasources[0].entity;return e.id.id===F?Pe(null):this.attributeService.getEntityAttributes(e.id,A.SHARED_SCOPE,["general_configuration"]).pipe(Be((e=>e[0]?.value)))}updateStatisticsCommands(e,t){const n=this.ctx.defaultSubscription.datasources[0].entity;return n.id.id!==F&&e?this.attributeService.saveEntityAttributes(n.id,A.SHARED_SCOPE,[{key:"general_configuration",value:{...e,statistics:{...e.statistics,commands:t}}}]):Pe(null)}createSubscription(e,t){const n=[{type:N.entity,entityType:L.DEVICE,entityId:e.id.id,entityName:e.name,timeseries:[]}];n[0].timeseries=[{name:t,label:t,settings:{}}],this.subscriptionInfo=n,this.changeSubscription(n)}onDataUpdateError(e){const t=this.utils.parseException(e);let n=t.name;t.message&&(n+=": "+t.message),console.error(n)}isDataOnlyNumbers(){this.subscriptionData=this.ctx.defaultSubscription.data[0]?.data??[],this.subscriptionData.length&&!this.dataTypeDefined&&(this.isNumericData=this.subscriptionData.every((e=>!isNaN(+e[1]))),this.dataTypeDefined=!0),this.ctx.detectChanges()}changeSubscription(e){this.ctx.defaultSubscription?.unsubscribe(),this.ctx.datasources[0].entity&&this.ctx.subscriptionApi.createSubscriptionFromInfo(B.timeseries,e,this.subscriptionOptions,!1,!0).pipe(On(this.destroyRef)).subscribe((e=>{this.dataTypeDefined=!1,this.ctx.defaultSubscription=e,this.ctx.settings.showLegend=!1,this.ctx.data=e.data,this.ctx.datasources=e.datasources,this.isDataOnlyNumbers(),this.subscribed=!0}))}static{this.ɵfac=function(e){return new(e||Mj)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(ee.AttributeService),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(ee.DialogService),t.ɵɵdirectiveInject(ee.UtilsService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Mj,selectors:[["tb-gateway-statistics"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Sj,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.statisticChart=e.first)}},inputs:{ctx:"ctx"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:18,vars:13,consts:[["statisticChart",""],[1,"flex","flex-1","flex-col","max-h-full"],[1,"entry-container","flex","items-center"],[1,"tb-form-panel","stroked","w-full","flex-1",3,"formGroup"],["translate","",1,"tb-form-panel-title"],[1,"entry-container","flex","w-full","gap-2"],["formControlName","command",1,"flex-1",3,"onCreateNewClicked","commands"],["appearance","outline",1,"flex-1"],["matInput","","disabled","",3,"tbTruncateWithTooltip","value"],[1,"actions-container","flex","flex-col","p-2","min-w-16"],[1,"chart-box","flex","flex-1","flex-col","overflow-auto"],[1,"tb-no-data-available","h-full"],["type","button","matSuffix","","mat-icon-button","","aria-label","Edit","matTooltipPosition","above",1,"action-button",3,"click","matTooltip"],[1,"material-icons"],[1,"flex-1",3,"ctx"],[1,"h-full","flex-1",3,"data"],[1,"tb-no-data-bg"],["translate","",1,"tb-no-data-text"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4),t.ɵɵtext(4,"gateway.statistics.entry"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",5)(6,"tb-statistics-commands-autocomplete",6),t.ɵɵlistener("onCreateNewClicked",(function(){return n.openEditCommandDialog()})),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-form-field",7)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",8),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"div",9),t.ɵɵtemplate(15,Cj,8,6),t.ɵɵelementEnd()(),t.ɵɵtemplate(16,Ej,3,1,"div",10)(17,Ij,4,0,"div",11),t.ɵɵelementEnd()),2&e){let e,i,a,r;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.statisticForm),t.ɵɵadvance(4),t.ɵɵproperty("commands",n.commands),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.statistics.command")),t.ɵɵadvance(2),t.ɵɵproperty("tbTruncateWithTooltip",null!==(e=null==(e=n.statisticForm.get("command").value)?null:e.command)&&void 0!==e?e:t.ɵɵpipeBind1(12,9,"gateway.statistics.no-config-commands-found"))("value",null!==(i=null==(i=n.statisticForm.get("command").value)?null:i.command)&&void 0!==i?i:t.ɵɵpipeBind1(13,11,"gateway.statistics.no-config-commands-found")),t.ɵɵadvance(4),t.ɵɵconditional(null!=(a=n.statisticForm.get("command").value)&&a.attributeOnGateway?15:-1),t.ɵɵadvance(),t.ɵɵconditional(null!=(r=n.statisticForm.get("command").value)&&r.attributeOnGateway&&n.subscriptionData.length&&n.subscribed?16:17)}},dependencies:t.ɵɵgetComponentDepsFactory(Mj,[T,jn,Qn,wj]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;padding:4px;display:flex;flex-direction:column}[_nghost-%COMP%] .action-button[_ngcontent-%COMP%]{opacity:.7}@media screen and (max-width: 599px){[_nghost-%COMP%] .entry-container[_ngcontent-%COMP%]{flex-direction:column}[_nghost-%COMP%] .actions-container[_ngcontent-%COMP%]{flex-direction:row}}']})}}var kj;e("GatewayStatisticsComponent",Mj),e("BACnetRequestTypes",kj),function(e){e.WriteProperty="writeProperty",e.ReadProperty="readProperty"}(kj||e("BACnetRequestTypes",kj={}));const Pj=e("BACnetRequestTypesTranslates",new Map([[kj.WriteProperty,"gateway.rpc.write-property"],[kj.ReadProperty,"gateway.rpc.read-property"]]));var Dj;e("BACnetObjectTypes",Dj),function(e){e.BinaryInput="binaryInput",e.BinaryOutput="binaryOutput",e.AnalogInput="analogInput",e.AnalogOutput="analogOutput",e.BinaryValue="binaryValue",e.AnalogValue="analogValue"}(Dj||e("BACnetObjectTypes",Dj={}));const Aj=e("BACnetObjectTypesTranslates",new Map([[Dj.AnalogOutput,"gateway.rpc.analog-output"],[Dj.AnalogInput,"gateway.rpc.analog-input"],[Dj.BinaryOutput,"gateway.rpc.binary-output"],[Dj.BinaryInput,"gateway.rpc.binary-input"],[Dj.BinaryValue,"gateway.rpc.binary-value"],[Dj.AnalogValue,"gateway.rpc.analog-value"]]));var Oj;e("BLEMethods",Oj),function(e){e.WRITE="write",e.READ="read",e.SCAN="scan"}(Oj||e("BLEMethods",Oj={}));const Rj=e("BLEMethodsTranslates",new Map([[Oj.WRITE,"gateway.rpc.write"],[Oj.READ,"gateway.rpc.read"],[Oj.SCAN,"gateway.rpc.scan"]]));var Bj,Fj;e("CANByteOrders",Bj),function(e){e.LITTLE="LITTLE",e.BIG="BIG"}(Bj||e("CANByteOrders",Bj={})),e("SocketMethodProcessings",Fj),function(e){e.WRITE="write",e.READ="read"}(Fj||e("SocketMethodProcessings",Fj={}));const Nj=e("SocketMethodProcessingsTranslates",new Map([[Fj.WRITE,"gateway.rpc.write"],[Fj.READ,"gateway.rpc.read"]]));var Lj;e("SNMPMethods",Lj),function(e){e.SET="set",e.MULTISET="multiset",e.GET="get",e.BULKWALK="bulkwalk",e.TABLE="table",e.MULTIGET="multiget",e.GETNEXT="getnext",e.BULKGET="bulkget",e.WALKS="walk"}(Lj||e("SNMPMethods",Lj={}));const Vj=e("SNMPMethodsTranslations",new Map([[Lj.SET,"gateway.rpc.set"],[Lj.MULTISET,"gateway.rpc.multiset"],[Lj.GET,"gateway.rpc.get"],[Lj.BULKWALK,"gateway.rpc.bulk-walk"],[Lj.TABLE,"gateway.rpc.table"],[Lj.MULTIGET,"gateway.rpc.multi-get"],[Lj.GETNEXT,"gateway.rpc.get-next"],[Lj.BULKGET,"gateway.rpc.bulk-get"],[Lj.WALKS,"gateway.rpc.walk"]]));var qj,Gj,zj;e("SocketEncodings",qj),function(e){e.UTF_8="utf-8"}(qj||e("SocketEncodings",qj={})),e("S7DeviceType",Gj),function(e){e.PLC="PLC",e.LOGO="LOGO"}(Gj||e("S7DeviceType",Gj={})),e("S7RequestType",zj),function(e){e.READ="read",e.WRITE="write"}(zj||e("S7RequestType",zj={}));const Uj=e("S7RequestTypeTranslates",new Map([[zj.READ,"gateway.rpc.read"],[zj.WRITE,"gateway.rpc.write"]]));var jj;e("S7AddressType",jj),function(e){e.DATA="data",e.TAG="tag",e.VM="vm"}(jj||e("S7AddressType",jj={}));const Hj=e("S7AddressTypeTranslates",new Map([[jj.DATA,"gateway.rpc.data"],[jj.TAG,"gateway.rpc.tag"]])),Wj=e("S7SelectableAddressTypes",[jj.DATA,jj.TAG]);var $j;e("S7DataType",$j),function(e){e.BOOLEAN="boolean",e.STRING="string",e.RAW="raw",e.BYTES="bytes",e.BIT="bit",e.BYTE="byte",e.USINT="usint",e.UINT8="uint8",e.SINT="sint",e.INT8="int8",e.INT="int",e.INT16="int16",e.SHORT="short",e.UINT="uint",e.UINT16="uint16",e.WORD="word",e.DINT="dint",e.INT32="int32",e.UDINT="udint",e.UINT32="uint32",e.DWORD="dword",e.REAL="real",e.FLOAT="float",e.FLOAT32="float32",e.LREAL="lreal",e.DOUBLE="double",e.FLOAT64="float64"}($j||e("S7DataType",$j={}));const Kj=e("S7BooleanDataTypes",[$j.BOOLEAN]);var Yj;e("RestSecurityType",Yj),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic"}(Yj||e("RestSecurityType",Yj={}));const Xj=e("RestSecurityTypeTranslationsMap",new Map([[Yj.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Yj.BASIC,"gateway.broker.security-types.basic"]]));class Zj{transform(e){return e.map((e=>(e?.value??e).toString())).join(", ")}static{this.ɵfac=function(e){return new(e||Zj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getRpcTemplateArrayView",type:Zj,pure:!0,standalone:!0})}}e("RpcTemplateArrayViewPipe",Zj);class Qj{constructor(){this.differs=i(f),this.keyValues=[]}transform(e){if(!e||!(e instanceof Map)&&"object"!=typeof e)return null;this.differ??=this.differs.find(e).create();const t=this.differ.diff(e);return t&&(this.keyValues=[],t.forEachItem((e=>{re(e.currentValue)&&this.keyValues.push(this.makeKeyValuePair(e.key,e.currentValue))}))),this.keyValues}makeKeyValuePair(e,t){return{key:e,value:t}}static{this.ɵfac=function(e){return new(e||Qj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"keyValueIsNotEmpty",type:Qj,pure:!1,standalone:!0})}}e("KeyValueIsNotEmptyPipe",Qj);const Jj=e=>({$implicit:e,innerValue:!1}),eH=e=>({"padding-left":e}),tH=(e,t)=>({"boolean-true":e,"boolean-false":t}),nH=e=>({$implicit:e,innerValue:!0});function iH(e,n){if(1&e&&t.ɵɵelementContainer(0,10),2&e){const e=n.$implicit;t.ɵɵnextContext();const i=t.ɵɵreference(16);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,Jj,e))}}function aH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13),t.ɵɵtext(1),t.ɵɵpipe(2,"getRpcTemplateArrayView"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,e.value)," ")}}function rH(e,n){if(1&e&&t.ɵɵelementContainer(0,14),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(10);t.ɵɵproperty("ngTemplateOutlet",e)}}function oH(e,n){if(1&e&&t.ɵɵelementContainer(0,14),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(8);t.ɵɵproperty("ngTemplateOutlet",e)}}function sH(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate1(" ",e.value," ")}}function lH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div"),t.ɵɵtemplate(1,oH,1,1,"ng-container",14)(2,sH,1,1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext().$implicit,i=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction2(3,tH,!0===e.value,!1===e.value)),t.ɵɵadvance(),t.ɵɵconditional(n.type===i.ConnectorType.SNMP&&"method"===e.key?1:2)}}function pH(e,n){if(1&e&&(t.ɵɵtext(0),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵtextInterpolate(t.ɵɵpipeBind1(1,1,n.SNMPMethodsTranslations.get(e.value)))}}function cH(e,n){if(1&e&&t.ɵɵelementContainer(0,10),2&e){const e=n.$implicit;t.ɵɵnextContext(3);const i=t.ɵɵreference(16);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,nH,e))}}function dH(e,n){if(1&e&&(t.ɵɵrepeaterCreate(0,cH,1,4,"ng-container",10,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(2,"keyvalue")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵrepeater(t.ɵɵpipeBind2(2,0,e.value,n.originalOrder))}}function uH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",11)(1,"div",12),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,aH,3,3,"div",13)(5,rH,1,1,"ng-container",14)(6,lH,3,6,"div",15)(7,pH,2,3,"ng-template",null,1,t.ɵɵtemplateRefExtractor)(9,dH,3,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=n.innerValue,a=t.ɵɵnextContext(2);t.ɵɵstyleMap(t.ɵɵpureFunction1(10,eH,i?"16px":"0")),t.ɵɵclassMap(a.getRpcParamsRowClasses(e.value)),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",i?e.key:t.ɵɵpipeBind1(3,8,"gateway.rpc."+e.key)," "),t.ɵɵadvance(2),t.ɵɵconditional(a.isArray(e.value)?4:-1),t.ɵɵadvance(),t.ɵɵconditional(a.isObject(e.value)?5:-1),t.ɵɵadvance(),t.ɵɵconditional(a.isObject(e.value)||a.isArray(e.value)?-1:6)}}function mH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",4)(1,"mat-expansion-panel-header")(2,"mat-panel-title",5)(3,"span",6),t.ɵɵtext(4),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-panel-description")(6,"button",7),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteTemplate(n,i))})),t.ɵɵelementStart(7,"mat-icon",8),t.ɵɵtext(8,"delete"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",9),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.applyTemplate(n,i))})),t.ɵɵelementStart(10,"mat-icon",8),t.ɵɵtext(11,"play_arrow"),t.ɵɵelementEnd()()()(),t.ɵɵrepeaterCreate(12,iH,1,4,"ng-container",10,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(14,"keyValueIsNotEmpty"),t.ɵɵtemplate(15,uH,11,12,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit;t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",e.name),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name),t.ɵɵadvance(8),t.ɵɵrepeater(t.ɵɵpipeBind1(14,2,e.config))}}class hH{constructor(e){this.attributeService=e,this.saveTemplate=new u,this.useTemplate=new u,this.ConnectorType=yt,this.originalOrder=()=>0,this.isObject=e=>Z(e),this.isArray=e=>Array.isArray(e),this.SNMPMethodsTranslations=Vj}applyTemplate(e,t){e.stopPropagation(),this.useTemplate.emit(t)}deleteTemplate(e,t){e.stopPropagation();const n=this.rpcTemplates.findIndex((e=>e.name==t.name));this.rpcTemplates.splice(n,1);const i=`${this.connectorType}_template`;this.attributeService.saveEntityAttributes({id:this.ctx.defaultSubscription.targetDeviceId,entityType:L.DEVICE},A.SERVER_SCOPE,[{key:i,value:this.rpcTemplates}]).subscribe((()=>{}))}getRpcParamsRowClasses(e){return this.isObject(e)?"flex-col":"flex-row justify-between items-center"}static{this.ɵfac=function(e){return new(e||hH)(t.ɵɵdirectiveInject(ee.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:hH,selectors:[["tb-gateway-service-rpc-connector-templates"]],inputs:{connectorType:"connectorType",ctx:"ctx",rpcTemplates:"rpcTemplates"},outputs:{saveTemplate:"saveTemplate",useTemplate:"useTemplate"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:5,vars:3,consts:[["RPCTemplateRef",""],["SNMPMethod",""],["RPCObjectRow",""],[1,"mat-subtitle-1","title"],["hideToggle",""],[1,"template-name"],["matTooltipPosition","above",3,"matTooltip"],["mat-icon-button","","matTooltip","Delete",3,"click"],[1,"material-icons"],["mat-icon-button","","matTooltip","Use",3,"click"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"rpc-params-row","flex"],[1,"template-key"],["tbTruncateWithTooltip","",1,"array-value"],[3,"ngTemplateOutlet"],[3,"class"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵrepeaterCreate(3,mH,17,4,"mat-expansion-panel",4,t.ɵɵrepeaterTrackByIdentity)),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.templates-title")),t.ɵɵadvance(2),t.ɵɵrepeater(n.rpcTemplates))},dependencies:t.ɵɵgetComponentDepsFactory(hH,[me,T,Zj,Qj]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;padding:0}[_nghost-%COMP%] .title[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .template-key[_ngcontent-%COMP%]{color:#00000061;height:32px;line-height:32px}[_nghost-%COMP%] .boolean-true[_ngcontent-%COMP%], [_nghost-%COMP%] .boolean-false[_ngcontent-%COMP%]{border-radius:3px;height:32px;line-height:32px;padding:0 12px;width:fit-content;font-size:14px;text-transform:capitalize}[_nghost-%COMP%] .boolean-false[_ngcontent-%COMP%]{color:#d12730;background-color:#d1273014}[_nghost-%COMP%] .boolean-true[_ngcontent-%COMP%]{color:#198038;background-color:#19803814}[_nghost-%COMP%] mat-expansion-panel[_ngcontent-%COMP%]{margin-top:10px;overflow:visible}[_nghost-%COMP%] .mat-expansion-panel-header-description[_ngcontent-%COMP%]{flex-direction:row-reverse;align-items:center;margin-right:0;flex:0}[_nghost-%COMP%] .mat-expansion-panel-header-description[_ngcontent-%COMP%] > mat-icon[_ngcontent-%COMP%]{margin-left:15px;color:#00000061}[_nghost-%COMP%] .mat-expansion-panel-header[_ngcontent-%COMP%]{padding:0 0 0 12px}[_nghost-%COMP%] .mat-expansion-panel-header.mat-expansion-panel-header.mat-expanded[_ngcontent-%COMP%]{height:48px}[_nghost-%COMP%] .mat-expansion-panel-header[_ngcontent-%COMP%] .mat-content.mat-content-hide-toggle[_ngcontent-%COMP%]{margin-right:0}[_nghost-%COMP%] .rpc-params-row[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap}[_nghost-%COMP%] .rpc-params-row[_ngcontent-%COMP%] [_ngcontent-%COMP%]:not(:first-child){white-space:pre;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .template-name[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;display:block}[_nghost-%COMP%] .mat-content{align-items:center}[_nghost-%COMP%] .mat-expansion-panel-header-title[_ngcontent-%COMP%]{flex:1;margin:0}[_nghost-%COMP%] .array-value[_ngcontent-%COMP%]{margin-left:10px}']})}}function gH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rpc.template-name-required")," "))}function fH(e,n){1&e&&(t.ɵɵelementStart(0,"div",7),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rpc.template-name-duplicate")," "))}e("GatewayServiceRPCConnectorTemplatesComponent",hH);class yH extends O{constructor(e,t,n,i,a){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.config=this.data.config,this.templates=this.data.templates,this.templateNameCtrl=this.fb.control("",[xe.required])}validateDuplicateName(e){const t=e.value.trim();return!!this.templates.find((e=>e.name===t))}close(){this.dialogRef.close()}save(){this.templateNameCtrl.setValue(this.templateNameCtrl.value.trim()),this.templateNameCtrl.valid&&this.dialogRef.close(this.templateNameCtrl.value)}static{this.ɵfac=function(e){return new(e||yH)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yH,selectors:[["tb-gateway-service-rpc-connector-template-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:20,vars:10,consts:[["color","primary",1,"justify-between"],["translate",""],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"mat-content","flex","flex-col",2,"width","600px"],["appearance","outline",1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[1,"mat-mdc-form-field-error",2,"margin-top","-15px","padding-left","10px","font-size","14px"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-toolbar",0)(1,"h2",1),t.ɵɵtext(2,"gateway.rpc.save-template"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"button",2),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵelementStart(4,"mat-icon",3),t.ɵɵtext(5,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(6,"div",4)(7,"mat-form-field",5)(8,"mat-label",1),t.ɵɵtext(9,"gateway.rpc.template-name"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",6),t.ɵɵtemplate(11,gH,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵtemplate(12,fH,3,3,"div",7),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",8)(14,"button",9),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵlistener("click",(function(){return n.save()})),t.ɵɵtext(18),t.ɵɵpipe(19,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(10),t.ɵɵproperty("formControl",n.templateNameCtrl),t.ɵɵadvance(),t.ɵɵconditional(n.templateNameCtrl.hasError("required")?11:-1),t.ɵɵadvance(),t.ɵɵconditional(n.validateDuplicateName(n.templateNameCtrl)?12:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(16,6,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",!n.templateNameCtrl.valid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(19,8,"action.save")," "))},dependencies:t.ɵɵgetComponentDepsFactory(yH,[T]),encapsulation:2})}}function vH(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SecurityTypeTranslationsMap.get(e))," ")}}function xH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function bH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.password-required"))}function wH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"div",6),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",7)(4,"mat-form-field",8),t.ɵɵelement(5,"input",9),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,xH,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",5)(9,"div",6),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",11),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,bH,3,3,"mat-icon",10),t.ɵɵelementStart(16,"div",12),t.ɵɵelement(17,"tb-toggle-password",13),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched?7:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("password").hasError("required")&&e.securityFormGroup.get("password").touched?15:-1),t.ɵɵadvance(),t.ɵɵclassProp("hide-toggle",e.securityFormGroup.get("password").hasError("required"))}}e("GatewayServiceRPCConnectorTemplateDialogComponent",yH);class SH{constructor(e){this.fb=e,this.BrokerSecurityType=Yj,this.securityTypes=Object.values(Yj),this.SecurityTypeTranslationsMap=Xj,this.destroy$=new Ie,this.propagateChange=e=>{},this.securityFormGroup=this.fb.group({type:[Yj.ANONYMOUS,[]],username:["",[xe.required,xe.pattern(fn)]],password:["",[xe.required,xe.pattern(fn)]]}),this.observeSecurityForm()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){e.type||(e.type=Yj.ANONYMOUS),this.securityFormGroup.reset(e),this.updateView(e)}validate(){return this.securityFormGroup.valid?null:{securityForm:{valid:!1}}}updateView(e){this.propagateChange(e)}updateValidators(e){e===Yj.BASIC?(this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1})):(this.securityFormGroup.get("username").disable({emitEvent:!1}),this.securityFormGroup.get("password").disable({emitEvent:!1}))}observeSecurityForm(){this.securityFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.updateView(e))),this.securityFormGroup.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.updateValidators(e)))}static{this.ɵfac=function(e){return new(e||SH)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:SH,selectors:[["tb-rest-connector-security"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>SH)),multi:!0},{provide:be,useExisting:c((()=>SH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:8,vars:2,consts:[[1,"tb-form-row","space-between","same-padding","tb-flex","column",3,"formGroup"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fields-label"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["translate","",1,"fixed-title-width"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","username",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","password","name","value","formControlName","password",3,"placeholder"],["matSuffix","",1,"tb-flex","no-gap","align-center","fill-height"],[1,"tb-flex","align-center","fill-height"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.security"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-select",3),t.ɵɵrepeaterCreate(5,vH,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵtemplate(7,wH,18,10),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(5),t.ɵɵrepeater(n.securityTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.securityFormGroup.get("type").value===n.BrokerSecurityType.BASIC?7:-1))},dependencies:t.ɵɵgetComponentDepsFactory(SH,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block;margin-bottom:10px}[_nghost-%COMP%] .fields-label[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .hide-toggle[_ngcontent-%COMP%]{display:none}'],changeDetection:d.OnPush})}}e("RestConnectorSecurityComponent",SH);const CH=e=>({type:e});function _H(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.bACnetRequestTypesTranslates.get(e))," ")}}function TH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.bACnetObjectTypesTranslates.get(e))," ")}}function EH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",6),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",7)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",8),t.ɵɵrepeaterCreate(10,_H,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",5)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",10),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",11)(18,"mat-form-field",12)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-select",13),t.ɵɵrepeaterCreate(23,TH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"mat-form-field",12)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(29,"input",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"mat-form-field",7)(31,"mat-label"),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",15),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,6,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,8,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.bACnetRequestTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,10,"gateway.rpc.requestTimeout")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,12,"gateway.rpc.objectType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.bACnetObjectTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,14,"gateway.rpc.identifier")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,16,"gateway.rpc.propertyId"))}}function IH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.bLEMethodsTranslates.get(e))," ")}}function MH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",16),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",17),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",7)(11,"mat-label"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-select",18),t.ɵɵrepeaterCreate(15,IH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-slide-toggle",19),t.ɵɵtext(18),t.ɵɵpipe(19,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,4,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,6,"gateway.rpc.characteristicUUID")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,8,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵrepeater(e.bLEMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(19,10,"gateway.rpc.withResponse")," ")}}function kH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e)," ")}}function PH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",20),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",21),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",22),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-slide-toggle",23),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-slide-toggle",24),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",11)(20,"mat-form-field",12)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",25),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",12)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-select",26),t.ɵɵrepeaterCreate(30,kH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(32,"div",11)(33,"mat-form-field",12)(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",27),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field",12)(39,"mat-label"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(43,"mat-form-field",5)(44,"mat-label"),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(48,"mat-form-field",5)(49,"mat-label"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(52,"input",30),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,11,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,13,"gateway.rpc.nodeID")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,15,"gateway.rpc.isExtendedID")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,17,"gateway.rpc.isFD")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,19,"gateway.rpc.bitrateSwitch")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,21,"gateway.rpc.dataLength")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,23,"gateway.rpc.dataByteorder")),t.ɵɵadvance(3),t.ɵɵrepeater(e.cANByteOrders),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,25,"gateway.rpc.dataBefore")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,27,"gateway.rpc.dataAfter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(46,29,"gateway.rpc.dataInHEX")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(51,31,"gateway.rpc.dataExpression"))}}function DH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",32),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.methodFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,4,"gateway.rpc.valueExpression")))}function AH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",32),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",34),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,3,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,5,"gateway.rpc.valueExpression")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.rpc.withResponse")," "))}function OH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",32),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",34),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,3,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,5,"gateway.rpc.valueExpression")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.rpc.withResponse")," "))}function RH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SNMPMethodsTranslations.get(e))," ")}}function BH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",39)(1,"mat-form-field",41),t.ɵɵelement(2,"input",42),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-icon",43),t.ɵɵpipe(4,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext(3);return t.ɵɵresetView(i.removeSNMPoid(n))})),t.ɵɵtext(5,"delete "),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵproperty("formControl",e),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(4,2,"gateway.rpc.remove"))}}function FH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",35),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",7)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",36),t.ɵɵrepeaterCreate(10,RH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-slide-toggle",34),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"fieldset",37)(16,"span",38),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵrepeaterCreate(19,BH,6,4,"div",39,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(21,"button",40),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addSNMPoid())})),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.rpc.requestFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,7,"gateway.rpc.method")),t.ɵɵadvance(3),t.ɵɵrepeater(e.sNMPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,9,"gateway.rpc.withResponse")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(18,11,"gateway.rpc.oids"),"*"),t.ɵɵadvance(2),t.ɵɵrepeater(e.getFormArrayControls("oid")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,13,"gateway.rpc.add-oid")," ")}}function NH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function LH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",53),t.ɵɵelementContainerStart(1,56),t.ɵɵelementStart(2,"mat-form-field",12),t.ɵɵelement(3,"input",57),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",58),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-icon",59),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext(4);return t.ɵɵresetView(i.removeHTTPHeader(n))})),t.ɵɵtext(8,"delete "),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()}if(2&e){const e=n.$index;t.ɵɵadvance(),t.ɵɵproperty("formGroupName",e),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(7,2,"gateway.rpc.remove"))}}function VH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",52)(1,"div",53)(2,"span",54),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",54),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",55),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵrepeaterCreate(10,LH,9,4,"div",53,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,2,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,4,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵrepeater(e.getFormArrayControls("httpHeaders"))}}function qH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",44),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",11)(6,"mat-form-field",45)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",46),t.ɵɵrepeaterCreate(11,NH,2,2,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"mat-form-field",12)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(17,"input",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",11)(19,"mat-form-field",12)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",48),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",12)(25,"mat-label"),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(28,"input",49),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",12)(30,"mat-label"),t.ɵɵtext(31),t.ɵɵpipe(32,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(33,"input",50),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"mat-form-field",5)(35,"mat-label"),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(38,"input",32),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"fieldset",51)(40,"span",38),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(43,VH,12,6,"div",52),t.ɵɵelementStart(44,"button",40),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,10,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,12,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵrepeater(e.hTTPMethods),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,14,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,16,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(27,18,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(32,20,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,22,"gateway.rpc.valueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(42,24,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵconditional(e.getFormArrayControls("httpHeaders").length?43:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(46,26,"gateway.rpc.add-header")," ")}}function GH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function zH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",63),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.requestValueExpression")))}function UH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",53),t.ɵɵelementContainerStart(1,56),t.ɵɵelementStart(2,"mat-form-field",12),t.ɵɵelement(3,"input",64),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",12),t.ɵɵelement(6,"input",65),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-icon",59),t.ɵɵpipe(8,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext(4);return t.ɵɵresetView(i.removeHTTPHeader(n))})),t.ɵɵtext(9,"delete "),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()}if(2&e){const e=n.$index;t.ɵɵadvance(),t.ɵɵproperty("formGroupName",e),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(4,3,"gateway.rpc.set")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,5,"gateway.rpc.remove"))}}function jH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",52)(1,"div",53)(2,"span",54),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",54),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",55),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵrepeaterCreate(10,UH,10,7,"div",53,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,2,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,4,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵrepeater(e.getFormArrayControls("httpHeaders"))}}function HH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",53)(1,"mat-form-field",45)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",46),t.ɵɵrepeaterCreate(6,GH,2,2,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"mat-form-field",12)(9,"mat-label"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(12,"input",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"div",53)(14,"mat-form-field",12)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",48),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",12)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",60),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",12)(25,"mat-label"),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(28,"input",61),t.ɵɵelementEnd()(),t.ɵɵtemplate(29,zH,5,3,"mat-form-field",5),t.ɵɵelementStart(30,"mat-form-field",5)(31,"mat-label"),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",62),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"fieldset",51)(36,"span",38),t.ɵɵtext(37),t.ɵɵpipe(38,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(39,jH,12,6,"div",52),t.ɵɵelementStart(40,"button",40),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,10,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵrepeater(e.hTTPMethods),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,12,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(17,14,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,16,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(27,18,"gateway.rpc.tries")),t.ɵɵadvance(3),t.ɵɵconditional(e.commandForm.get("httpMethod").value!==e.HTTPMethods.GET&&e.commandForm.get("httpMethod").value!==e.HTTPMethods.HEAD?29:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,20,"gateway.rpc.responseValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(38,22,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵconditional(e.getFormArrayControls("httpHeaders").length?39:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(42,24,"gateway.rpc.add-header")," ")}}function WH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rpc.json-value-invalid")," "))}function $H(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",66),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",67),t.ɵɵelementStart(10,"mat-icon",68),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext(2);return t.ɵɵresetView(i.openEditJSONDialog(n))})),t.ɵɵtext(12,"edit "),t.ɵɵelementEnd(),t.ɵɵtemplate(13,WH,3,3,"mat-error"),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,4,"gateway.statistics.command")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,6,"widget-config.datasource-parameters")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,8,"gateway.rpc-command-edit-params")),t.ɵɵadvance(3),t.ɵɵconditional(e.commandForm.get("params").hasError("invalidJSON")?13:-1)}}function KH(e,n){if(1&e&&t.ɵɵtemplate(0,EH,35,18)(1,MH,20,12)(2,PH,53,33)(3,DH,10,6)(4,AH,13,9)(5,OH,13,9)(6,FH,24,15)(7,qH,47,28)(8,HH,43,26)(9,$H,14,10),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵconditional((e=n.connectorType)===n.ConnectorType.BACNET?0:e===n.ConnectorType.BLE?1:e===n.ConnectorType.CAN?2:e===n.ConnectorType.FTP?3:e===n.ConnectorType.OCPP?4:e===n.ConnectorType.XMPP?5:e===n.ConnectorType.SNMP?6:e===n.ConnectorType.REST?7:e===n.ConnectorType.REQUEST?8:9)}}class YH{constructor(e,t){this.fb=e,this.dialog=t,this.sendCommand=new u,this.saveTemplate=new u,this.ConnectorType=yt,this.bACnetRequestTypes=Object.values(kj),this.bACnetObjectTypes=Object.values(Dj),this.bLEMethods=Object.values(Oj),this.cANByteOrders=Object.values(Bj),this.sNMPMethods=Object.values(Lj),this.hTTPMethods=Object.values(St),this.HTTPMethods=St,this.bACnetRequestTypesTranslates=Pj,this.bACnetObjectTypesTranslates=Aj,this.bLEMethodsTranslates=Rj,this.SNMPMethodsTranslations=Vj,this.gatewayConnectorDefaultTypesTranslates=vt,this.urlPattern=/^[-a-zA-Zd_$:{}?~+=\/.0-9-]*$/,this.numbersOnlyPattern=/^[0-9]*$/,this.hexOnlyPattern=/^[0-9A-Fa-f ]+$/,this.propagateChange=e=>{},this.destroy$=new Ie}ngOnInit(){this.commandForm=this.connectorParamsFormGroupByType(this.connectorType),this.observeFormChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}connectorParamsFormGroupByType(e){let t;switch(e){case yt.BACNET:t=this.fb.group({method:[null,[xe.required,xe.pattern(fn)]],requestType:[null,[xe.required,xe.pattern(fn)]],requestTimeout:[null,[xe.required,xe.min(10),xe.pattern(this.numbersOnlyPattern)]],objectType:[null,[]],identifier:[null,[xe.required,xe.min(1),xe.pattern(this.numbersOnlyPattern)]],propertyId:[null,[xe.required,xe.pattern(fn)]]});break;case yt.BLE:t=this.fb.group({methodRPC:[null,[xe.required,xe.pattern(fn)]],characteristicUUID:["00002A00-0000-1000-8000-00805F9B34FB",[xe.required,xe.pattern(fn)]],methodProcessing:[null,[xe.required]],withResponse:[!1,[]]});break;case yt.CAN:t=this.fb.group({method:[null,[xe.required,xe.pattern(fn)]],nodeID:[null,[xe.required,xe.min(0),xe.pattern(this.numbersOnlyPattern)]],isExtendedID:[!1,[]],isFD:[!1,[]],bitrateSwitch:[!1,[]],dataLength:[null,[xe.min(1),xe.pattern(this.numbersOnlyPattern)]],dataByteorder:[null,[]],dataBefore:[null,[xe.pattern(fn),xe.pattern(this.hexOnlyPattern)]],dataAfter:[null,[xe.pattern(fn),xe.pattern(this.hexOnlyPattern)]],dataInHEX:[null,[xe.pattern(fn),xe.pattern(this.hexOnlyPattern)]],dataExpression:[null,[xe.pattern(fn)]]});break;case yt.FTP:t=this.fb.group({methodFilter:[null,[xe.required,xe.pattern(fn)]],valueExpression:[null,[xe.required,xe.pattern(fn)]]});break;case yt.OCPP:case yt.XMPP:t=this.fb.group({methodRPC:[null,[xe.required,xe.pattern(fn)]],valueExpression:[null,[xe.required,xe.pattern(fn)]],withResponse:[!1,[]]});break;case yt.SNMP:t=this.fb.group({requestFilter:[null,[xe.required,xe.pattern(fn)]],method:[null,[xe.required]],withResponse:[!1,[]],oid:this.fb.array([],[xe.required])});break;case yt.REST:t=this.fb.group({methodFilter:[null,[xe.required,xe.pattern(fn)]],httpMethod:[null,[xe.required]],requestUrlExpression:[null,[xe.required,xe.pattern(this.urlPattern)]],responseTimeout:[null,[xe.required,xe.min(10),xe.pattern(this.numbersOnlyPattern)]],timeout:[null,[xe.required,xe.min(10),xe.pattern(this.numbersOnlyPattern)]],tries:[null,[xe.required,xe.min(1),xe.pattern(this.numbersOnlyPattern)]],valueExpression:[null,[xe.required,xe.pattern(fn)]],httpHeaders:this.fb.array([]),security:[{},[xe.required]]});break;case yt.REQUEST:t=this.fb.group({methodFilter:[null,[xe.required,xe.pattern(fn)]],httpMethod:[null,[xe.required]],requestUrlExpression:[null,[xe.required,xe.pattern(this.urlPattern)]],responseTimeout:[null,[xe.required,xe.min(10),xe.pattern(this.numbersOnlyPattern)]],timeout:[null,[xe.required,xe.min(10),xe.pattern(this.numbersOnlyPattern)]],tries:[null,[xe.required,xe.min(1),xe.pattern(this.numbersOnlyPattern)]],requestValueExpression:[null,[xe.required,xe.pattern(fn)]],responseValueExpression:[null,[xe.pattern(fn)]],httpHeaders:this.fb.array([])});break;default:t=this.fb.group({command:[null,[xe.required,xe.pattern(fn)]],params:[{},[ht]]})}return t}addSNMPoid(e=null){const t=this.commandForm.get("oid");t&&t.push(this.fb.control(e,[xe.required,xe.pattern(fn)]),{emitEvent:!1})}removeSNMPoid(e){this.commandForm.get("oid").removeAt(e)}addHTTPHeader(e={headerName:null,value:null}){const t=this.commandForm.get("httpHeaders"),n=this.fb.group({headerName:[e.headerName,[xe.required,xe.pattern(fn)]],value:[e.value,[xe.required,xe.pattern(fn)]]});t&&t.push(n,{emitEvent:!1})}removeHTTPHeader(e){this.commandForm.get("httpHeaders").removeAt(e)}getFormArrayControls(e){return this.commandForm.get(e).controls}openEditJSONDialog(e){e&&e.stopPropagation(),this.dialog.open(lt,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{jsonValue:this.commandForm.get("params").value,required:!0}}).afterClosed().subscribe((e=>{e&&this.commandForm.get("params").setValue(e)}))}save(){this.saveTemplate.emit()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}clearFromArrayByName(e){const t=this.commandForm.get(e);for(;0!==t.length;)t.removeAt(0)}writeValue(e){if("object"==typeof e){switch(e=se(e),this.connectorType){case yt.SNMP:this.clearFromArrayByName("oid"),e.oid.forEach((e=>{this.addSNMPoid(e)})),delete e.oid;break;case yt.REQUEST:case yt.REST:this.clearFromArrayByName("httpHeaders"),e.httpHeaders&&Object.entries(e.httpHeaders).forEach((e=>{this.addHTTPHeader({headerName:e[0],value:e[1]})})),delete e.httpHeaders}this.commandForm.patchValue(e,{onlySelf:!1})}}observeFormChanges(){this.commandForm.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.connectorType!==yt.REST&&this.connectorType!==yt.REQUEST||(e.httpHeaders=e.httpHeaders.reduce(((e,t)=>(e[t.headerName]=t.value,e)),{})),this.commandForm.valid&&this.propagateChange({...this.commandForm.value,...e})}))}static{this.ɵfac=function(e){return new(e||YH)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(Xe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:YH,selectors:[["tb-gateway-service-rpc-connector"]],inputs:{connectorType:"connectorType"},outputs:{sendCommand:"sendCommand",saveTemplate:"saveTemplate"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>YH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:12,vars:16,consts:[[1,"command-form","flex","flex-col",3,"formGroup"],[1,"mat-subtitle-1","title"],[1,"template-actions","flex","flex-row","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline"],["matInput","","formControlName","method","placeholder","set_state"],["appearance","outline",1,"mat-block"],["formControlName","requestType"],[3,"value"],["matInput","","formControlName","requestTimeout","type","number","min","10","step","1","placeholder","1000"],[1,"flex","flex-1","flex-row","gap-2.5"],["appearance","outline",1,"flex-1"],["formControlName","objectType"],["matInput","","formControlName","identifier","type","number","min","1","step","1","placeholder","1"],["matInput","","formControlName","propertyId","placeholder","presentValue"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],["matInput","","formControlName","characteristicUUID","placeholder","00002A00-0000-1000-8000-00805F9B34FB"],["formControlName","methodProcessing"],["formControlName","withResponse",1,"mat-slide"],["matInput","","formControlName","method","placeholder","sendSameData"],["matInput","","formControlName","nodeID","type","number","placeholder","4","min","0","step","1"],["formControlName","isExtendedID",1,"mat-slide","margin"],["formControlName","isFD",1,"mat-slide","margin"],["formControlName","bitrateSwitch",1,"mat-slide","margin"],["matInput","","formControlName","dataLength","type","number","placeholder","2","min","1","step","1"],["formControlName","dataByteorder"],["matInput","","formControlName","dataBefore","placeholder","00AA"],["matInput","","formControlName","dataAfter","placeholder","0102"],["matInput","","formControlName","dataInHEX","placeholder","aa bb cc dd ee ff aa bb aa bb cc d ee ff"],["matInput","","formControlName","dataExpression","placeholder","userSpeed if maxAllowedSpeed > userSpeed else maxAllowedSpeed"],["matInput","","formControlName","methodFilter","placeholder","read"],["matInput","","formControlName","valueExpression","placeholder","${params}"],["matInput","","formControlName","methodRPC","placeholder","rpc1"],["formControlName","withResponse",1,"mat-slide","margin"],["matInput","","formControlName","requestFilter","placeholder","setData"],["formControlName","method"],["formArrayName","oid",1,"fields","flex","flex-col","gap-2.5","border"],[1,"fields-label"],[1,"flex","flex-1","flex-row","items-center","justify-center","gap-2.5"],["mat-raised-button","",1,"self-start",3,"click"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex-1"],["matInput","","required","",3,"formControl"],[1,"flex-[1_1_30px]",2,"cursor","pointer","max-width","30px","min-width","30px",3,"click","matTooltip"],["matInput","","formControlName","methodFilter","placeholder","post_attributes"],["appearance","outline",1,"max-w-4/12","flex-[1_1_33%]"],["formControlName","httpMethod"],["matInput","","formControlName","requestUrlExpression","placeholder","http://127.0.0.1:5000/my_devices"],["matInput","","formControlName","responseTimeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","1000"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","3"],["formArrayName","httpHeaders",1,"fields","flex","flex-col","gap-2.5","border"],[1,"flex","flex-col","gap-2.5","border"],[1,"flex","flex-row","items-center","justify-center","gap-2.5"],[1,"title","flex-1"],[2,"width","30px"],[3,"formGroupName"],["matInput","","formControlName","headerName"],["matInput","","formControlName","value","placeholder","application/json"],[2,"cursor","pointer","width","30px",3,"click","matTooltip"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","1"],["matInput","","formControlName","responseValueExpression","placeholder","${temp}"],["matInput","","formControlName","requestValueExpression","placeholder","${params}"],["matInput","","formControlName","headerName",3,"placeholder"],["matInput","","formControlName","value"],["matInput","","formControlName","command"],["matInput","","formControlName","params","type","JSON","tb-json-to-string",""],["aria-hidden","false","aria-label","help-icon","matIconSuffix","",1,"material-icons-outlined",2,"cursor","pointer",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,KH,10,1),t.ɵɵelementStart(5,"div",2)(6,"button",3),t.ɵɵlistener("click",(function(){return n.save()})),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",4),t.ɵɵlistener("click",(function(){return n.sendCommand.emit()})),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,7,"gateway.rpc.title",t.ɵɵpureFunction1(14,CH,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorType?4:-1),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,10,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,12,"gateway.rpc-command-send")," "))},dependencies:t.ɵɵgetComponentDepsFactory(YH,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;padding:0}[_nghost-%COMP%] .title[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%]{flex-wrap:nowrap}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%] > button[_ngcontent-%COMP%]{margin-top:10px}[_nghost-%COMP%] .mat-mdc-slide-toggle.margin[_ngcontent-%COMP%]{margin-bottom:10px;margin-left:10px}[_nghost-%COMP%] .fields[_ngcontent-%COMP%] .fields-label[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .border[_ngcontent-%COMP%]{padding:16px;margin-bottom:10px;box-shadow:0 0 #0003,0 0 #00000024,0 0 #0000001f;border:solid 1px #e0e0e0;border-radius:4px}[_nghost-%COMP%] .border[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{color:#0000008a}[_nghost-%COMP%] .border[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{color:#00000061}[_nghost-%COMP%] .border[_ngcontent-%COMP%] .mat-divider[_ngcontent-%COMP%]{margin-left:-16px;margin-right:-16px;margin-bottom:16px}']})}}function XH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function ZH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.ModbusFunctionCodeTranslationsMap.get(e)))}}function QH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",8),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function JH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",8),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function eW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"mat-form-field",3)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",11),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,JH,3,3,"mat-icon",8),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.value")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.rpcParametersFormGroup.get("value").hasError("required")&&e.rpcParametersFormGroup.get("value").touched?7:-1)}}class tW{constructor(e){this.fb=e,this.ModbusEditableDataTypes=on,this.ModbusFunctionCodeTranslationsMap=cn,this.modbusDataTypes=Object.values(rn),this.writeFunctionCodes=[5,6,15,16],this.defaultFunctionCodes=[3,4,6,16],this.readFunctionCodes=[1,2,3,4],this.bitsFunctionCodes=[...this.readFunctionCodes,...this.writeFunctionCodes],this.destroy$=new Ie,this.rpcParametersFormGroup=this.fb.group({type:[rn.BYTES,[xe.required]],functionCode:[this.defaultFunctionCodes[0],[xe.required]],value:[{value:"",disabled:!0},[xe.required,xe.pattern(fn)]],address:[null,[xe.required]],objectsCount:[1,[xe.required]]}),this.updateFunctionCodes(this.rpcParametersFormGroup.get("type").value),this.observeValueChanges(),this.observeKeyDataType(),this.observeFunctionCode()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.rpcParametersFormGroup.valid?null:{rpcParametersFormGroup:{valid:!1}}}writeValue(e){this.rpcParametersFormGroup.patchValue(e,{emitEvent:!1})}observeValueChanges(){this.rpcParametersFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeKeyDataType(){this.rpcParametersFormGroup.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.ModbusEditableDataTypes.includes(e)||this.rpcParametersFormGroup.get("objectsCount").patchValue(sn[e],{emitEvent:!1}),this.updateFunctionCodes(e)}))}observeFunctionCode(){this.rpcParametersFormGroup.get("functionCode").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.updateValueEnabling(e)))}updateValueEnabling(e){this.writeFunctionCodes.includes(e)?this.rpcParametersFormGroup.get("value").enable({emitEvent:!1}):(this.rpcParametersFormGroup.get("value").setValue(null),this.rpcParametersFormGroup.get("value").disable({emitEvent:!1}))}updateFunctionCodes(e){this.functionCodes=e===rn.BITS?this.bitsFunctionCodes:this.defaultFunctionCodes,this.functionCodes.includes(this.rpcParametersFormGroup.get("functionCode").value)||this.rpcParametersFormGroup.get("functionCode").patchValue(this.functionCodes[0],{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||tW)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:tW,selectors:[["tb-gateway-modbus-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>tW)),multi:!0},{provide:be,useExisting:c((()=>tW)),multi:!0}]),t.ɵɵStandaloneFeature],decls:37,vars:28,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","no-padding-top","hint-container"],[1,"flex","flex-1","flex-row","gap-2.5"],["appearance","outline",1,"flex-1"],["formControlName","type"],[3,"value"],["formControlName","functionCode"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],[1,"flex"],["matInput","","name","value","formControlName","value",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"br"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",2)(8,"mat-form-field",3)(9,"mat-label"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-select",4),t.ɵɵrepeaterCreate(13,XH,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",3)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-select",6),t.ɵɵrepeaterCreate(20,ZH,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",2)(23,"mat-form-field",3)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",7),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,QH,3,3,"mat-icon",8),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",3)(31,"mat-label"),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",9),t.ɵɵpipe(35,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(36,eW,8,7,"div",10),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,12,"gateway.rpc.hint.modbus-response-reading"),""),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,14,"gateway.rpc.hint.modbus-writing-functions")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,16,"gateway.rpc.type")),t.ɵɵadvance(3),t.ɵɵrepeater(n.modbusDataTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(18,18,"gateway.rpc.functionCode")),t.ɵɵadvance(3),t.ɵɵrepeater(n.functionCodes),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,20,"gateway.rpc.address")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.rpcParametersFormGroup.get("address").hasError("required")&&n.rpcParametersFormGroup.get("address").touched?29:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,24,"gateway.rpc.objectsCount")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,26,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(n.rpcParametersFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵconditional(n.writeFunctionCodes.includes(n.rpcParametersFormGroup.get("functionCode").value)?36:-1))},dependencies:t.ɵɵgetComponentDepsFactory(tW,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:d.OnPush})}}function nW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",1)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",6),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.responseTopicExpression")))}function iW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",1)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",7),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.responseTimeout")))}class aW{constructor(e){this.fb=e,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new Ie,this.rpcParametersFormGroup=this.fb.group({methodFilter:[null,[xe.required,xe.pattern(fn)]],requestTopicExpression:[null,[xe.required,xe.pattern(fn)]],responseTopicExpression:[{value:null,disabled:!0},[xe.required,xe.pattern(fn)]],responseTimeout:[{value:null,disabled:!0},[xe.min(10),xe.pattern(yn)]],valueExpression:[null,[xe.required,xe.pattern(fn)]],withResponse:[!1,[]]}),this.observeValueChanges(),this.observeWithResponse()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.rpcParametersFormGroup.valid?null:{rpcParametersFormGroup:{valid:!1}}}writeValue(e){this.rpcParametersFormGroup.patchValue(e,{emitEvent:!1}),this.toggleResponseFields(e.withResponse)}observeValueChanges(){this.rpcParametersFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeWithResponse(){this.rpcParametersFormGroup.get("withResponse").valueChanges.pipe(Ve((e=>this.toggleResponseFields(e))),Re(this.destroy$)).subscribe()}toggleResponseFields(e){const t=this.rpcParametersFormGroup.get("responseTopicExpression"),n=this.rpcParametersFormGroup.get("responseTimeout");e?(t.enable(),n.enable()):(t.disable(),n.disable())}static{this.ɵfac=function(e){return new(e||aW)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:aW,selectors:[["tb-gateway-mqtt-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>aW)),multi:!0},{provide:be,useExisting:c((()=>aW)),multi:!0}]),t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],["appearance","outline"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","requestTopicExpression","placeholder","sensor/${deviceName}/request/${methodName}/${requestId}"],["formControlName","withResponse",1,"margin",3,"click"],["matInput","","formControlName","valueExpression","placeholder","${params}"],["matInput","","formControlName","responseTopicExpression","placeholder","sensor/${deviceName}/response/${methodName}/${requestId}"],["matInput","","formControlName","responseTimeout","type","number","placeholder","10000","min","10","step","1"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"mat-form-field",1)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",1)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",3),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-slide-toggle",4),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,nW,5,3,"mat-form-field",1)(15,iW,5,3,"mat-form-field",1),t.ɵɵelementStart(16,"mat-form-field",1)(17,"mat-label"),t.ɵɵtext(18),t.ɵɵpipe(19,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(20,"input",5),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){let e,i;t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.rpc.method-name")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,9,"gateway.rpc.requestTopicExpression")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,11,"gateway.rpc.withResponse")," "),t.ɵɵadvance(2),t.ɵɵconditional(null!=(e=n.rpcParametersFormGroup.get("withResponse"))&&e.value?14:-1),t.ɵɵadvance(),t.ɵɵconditional(null!=(i=n.rpcParametersFormGroup.get("withResponse"))&&i.value?15:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(19,13,"gateway.rpc.valueExpression"))}},dependencies:t.ɵɵgetComponentDepsFactory(aW,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:flex;flex-direction:column}[_nghost-%COMP%] .mat-mdc-slide-toggle.margin[_ngcontent-%COMP%]{margin-bottom:10px;margin-left:10px}'],changeDetection:d.OnPush})}}function rW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",15),t.ɵɵelement(1,"mat-icon",24),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("svgIcon",i.valueTypes.get(e).icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,i.valueTypes.get(e).name))}}function oW(e,n){1&e&&(t.ɵɵelement(0,"input",18),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function sW(e,n){1&e&&(t.ɵɵelement(0,"input",19),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function lW(e,n){1&e&&(t.ɵɵelement(0,"input",20),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function pW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",21)(1,"mat-option",15),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",15),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function cW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",22),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function dW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",8)(2,"div",9),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11)(6,"mat-select",12)(7,"mat-select-trigger")(8,"div",13),t.ɵɵelement(9,"mat-icon",14),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵrepeaterCreate(13,rW,5,5,"mat-option",15,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",16)(16,"div",9),t.ɵɵtext(17,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-form-field",17),t.ɵɵtemplate(19,oW,2,3,"input",18)(20,sW,2,3,"input",19)(21,lW,2,3,"input",20)(22,pW,5,2,"mat-select",21)(23,cW,3,3,"mat-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",23),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.removeArgument(n))})),t.ɵɵelementStart(26,"mat-icon"),t.ɵɵtext(27,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e,i,a;const r=n.$implicit,o=t.ɵɵnextContext();t.ɵɵproperty("formGroup",r),t.ɵɵadvance(9),t.ɵɵproperty("svgIcon",null==(e=o.valueTypes.get(r.get("type").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,6,null==(i=o.valueTypes.get(r.get("type").value))?null:i.name)),t.ɵɵadvance(2),t.ɵɵrepeater(o.valueTypeKeys),t.ɵɵadvance(6),t.ɵɵconditional((a=r.get("type").value)===o.MappingValueType.STRING?19:a===o.MappingValueType.INTEGER?20:a===o.MappingValueType.DOUBLE?21:a===o.MappingValueType.BOOLEAN?22:-1),t.ɵɵadvance(4),t.ɵɵconditional(r.get(r.get("type").value+"Value").hasError("required")&&r.get(r.get("type").value+"Value").touched?23:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(25,8,"gateway.rpc.remove"))}}class uW{constructor(e,t){this.fb=e,this.cdr=t,this.valueTypeKeys=Object.values(ln),this.MappingValueType=ln,this.valueTypes=pn,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new Ie,this.rpcParametersFormGroup=this.fb.group({method:[null,[xe.required,xe.pattern(fn)]],arguments:this.fb.array([])}),this.observeValueChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.rpcParametersFormGroup.valid?null:{rpcParametersFormGroup:{valid:!1}}}writeValue(e){this.clearArguments(),e.arguments?.map((({type:e,value:t})=>({type:e,[e+"Value"]:t}))).forEach((e=>this.addArgument(e))),this.cdr.markForCheck(),this.rpcParametersFormGroup.get("method").patchValue(e.method)}observeValueChanges(){this.rpcParametersFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{const t=e.arguments.map((({type:e,...t})=>({type:e,value:t[e+"Value"]})));this.onChange({method:e.method,arguments:t}),this.onTouched()}))}removeArgument(e){this.rpcParametersFormGroup.get("arguments").removeAt(e)}addArgument(e={}){const t=this.fb.group({type:[e.type??ln.STRING],stringValue:[e.stringValue??{value:"",disabled:!(Q(e,{})||e.stringValue)},[xe.required,xe.pattern(fn)]],integerValue:[{value:e.integerValue??0,disabled:!re(e.integerValue)},[xe.required,xe.pattern(yn)]],doubleValue:[{value:e.doubleValue??0,disabled:!re(e.doubleValue)},[xe.required]],booleanValue:[{value:e.booleanValue??!1,disabled:!re(e.booleanValue)},[xe.required]]});this.observeTypeChange(t),this.rpcParametersFormGroup.get("arguments").push(t,{emitEvent:!1})}clearArguments(){const e=this.rpcParametersFormGroup.get("arguments");for(;0!==e.length;)e.removeAt(0)}observeTypeChange(e){e.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((t=>{e.disable({emitEvent:!1}),e.get("type").enable({emitEvent:!1}),e.get(t+"Value").enable({emitEvent:!1})}))}static{this.ɵfac=function(e){return new(e||uW)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:uW,selectors:[["tb-gateway-opc-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>uW)),multi:!0},{provide:be,useExisting:c((()=>uW)),multi:!0}]),t.ɵɵStandaloneFeature],decls:19,vars:13,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","tb-flex","no-padding-top","hint-container"],["appearance","outline",1,"tb-flex"],["matInput","","formControlName","method","placeholder","multiply"],["formArrayName","arguments",1,"tb-form-panel","stroked","arguments-container"],[1,"fields-label"],[1,"flex","flex-1","items-center","justify-center","gap-2.5",3,"formGroup"],["mat-raised-button","",1,"self-start",3,"click"],[1,"tb-form-row","column-xs","type-container","items-center","justify-between"],["translate","",1,"tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],[3,"value"],[1,"tb-form-row","column-xs","value-container","item-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],["matInput","","required","","formControlName","stringValue",3,"placeholder"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder"],["formControlName","booleanValue"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","matTooltip"],[1,"tb-mat-20",3,"svgIcon"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",2)(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"input",3),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"fieldset",4)(10,"strong")(11,"span",5),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()(),t.ɵɵrepeaterCreate(14,dW,28,10,"div",6,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(16,"button",7),t.ɵɵlistener("click",(function(){return n.addArgument()})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.rpc.hint.opc-method")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,7,"gateway.rpc.method")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,9,"gateway.rpc.arguments")),t.ɵɵadvance(2),t.ɵɵrepeater(n.rpcParametersFormGroup.get("arguments").controls),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.rpc.add-argument")," "))},dependencies:t.ɵɵgetComponentDepsFactory(uW,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%] .arguments-container[_ngcontent-%COMP%]{margin-bottom:10px}[_nghost-%COMP%] .type-container[_ngcontent-%COMP%]{width:40%}[_nghost-%COMP%] .value-container[_ngcontent-%COMP%]{width:50%}[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:d.OnPush})}}function mW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SocketMethodProcessingsTranslates.get(e))," ")}}function hW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}class gW extends Ya{constructor(){super(...arguments),this.SocketMethodProcessingsTranslates=Nj,this.socketMethodProcessings=Object.values(Fj),this.socketEncoding=Object.values(wt)}initFormGroup(){return this.fb.group({methodRPC:[null,[xe.required,xe.pattern(fn)]],methodProcessing:[Fj.WRITE,[xe.required]],encoding:[qj.UTF_8,[xe.required,xe.pattern(fn)]],withResponse:[!1,[]]})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(gW)))(n||gW)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:gW,selectors:[["tb-gateway-socket-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>gW)),multi:!0},{provide:be,useExisting:c((()=>gW)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:23,vars:13,consts:[[3,"formGroup"],["appearance","outline",1,"w-full"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],["appearance","outline",1,"mat-block"],["formControlName","methodProcessing"],[3,"value"],["formControlName","encoding"],["formControlName","withResponse",1,"mat-slide","margin"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"mat-form-field",1)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",3)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",4),t.ɵɵrepeaterCreate(11,mW,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"mat-form-field",3)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-select",6),t.ɵɵrepeaterCreate(18,hW,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(20,"mat-slide-toggle",7),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,7,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵrepeater(n.socketMethodProcessings),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,9,"gateway.encoding")),t.ɵɵadvance(3),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(22,11,"gateway.rpc.withResponse")," "))},dependencies:t.ɵɵgetComponentDepsFactory(gW,[T]),encapsulation:2,changeDetection:d.OnPush})}}function fW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.loading-devices")))}function yW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.devices-load-error")))}function vW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.no-devices-found")))}function xW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function bW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function wW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function SW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.S7RequestTypeTranslates.get(e)))}}function CW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.S7AddressTypeTranslates.get(e)))}}function _W(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",2)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-select",10),t.ɵɵrepeaterCreate(5,CW,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.addressType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.s7AddressTypes)}}function TW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function EW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.db-number-required"))}function IW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.db-number-min"))}function MW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.start-required"))}function kW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.start-min"))}function PW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.size-required"))}function DW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.size-min"))}function AW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.bit-required"))}function OW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.bit-range"))}function RW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",2)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",15),t.ɵɵdeclareLet(5),t.ɵɵtemplate(6,AW,2,3,"tb-error-icon",6)(7,OW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.bit"));const n=e.formGroup.get("bit").touched;t.ɵɵadvance(4),t.ɵɵconditional(e.formGroup.get("bit").hasError("required")&&n?6:(e.formGroup.get("bit").hasError("min")||e.formGroup.get("bit").hasError("max"))&&n?7:-1)}}function BW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"mat-form-field",2)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",11),t.ɵɵrepeaterCreate(6,TW,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"mat-form-field",2)(9,"mat-label"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(12,"input",12),t.ɵɵdeclareLet(13),t.ɵɵtemplate(14,EW,2,3,"tb-error-icon",6)(15,IW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"div",1)(17,"mat-form-field",2)(18,"mat-label"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(21,"input",13),t.ɵɵdeclareLet(22),t.ɵɵtemplate(23,MW,2,3,"tb-error-icon",6)(24,kW,2,3,"tb-error-icon",6),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",2)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(29,"input",14),t.ɵɵdeclareLet(30),t.ɵɵtemplate(31,PW,2,3,"tb-error-icon",6)(32,DW,2,3,"tb-error-icon",6),t.ɵɵelementEnd(),t.ɵɵtemplate(33,RW,8,4,"mat-form-field",2),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.rpc.dataType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.s7DataTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,10,"gateway.rpc.dbNumber"));const n=e.formGroup.get("dbNumber").touched;t.ɵɵadvance(4),t.ɵɵconditional(e.formGroup.get("dbNumber").hasError("required")&&n?14:e.formGroup.get("dbNumber").hasError("min")&&n?15:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,12,"gateway.rpc.start"));const i=e.formGroup.get("start").touched;t.ɵɵadvance(4),t.ɵɵconditional(e.formGroup.get("start").hasError("required")&&i?23:e.formGroup.get("start").hasError("min")&&i?24:-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,14,"gateway.rpc.size"));const a=e.formGroup.get("size").touched;t.ɵɵadvance(4),t.ɵɵconditional(e.formGroup.get("size").hasError("required")&&a?31:e.formGroup.get("size").hasError("min")&&a?32:-1),t.ɵɵadvance(2),t.ɵɵconditional(e.isBooleanDataType?33:-1)}}function FW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.tag-required"))}function NW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.tag-pattern"))}function LW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",16),t.ɵɵdeclareLet(5),t.ɵɵtemplate(6,FW,2,3,"tb-error-icon",6)(7,NW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.tag"));const n=e.formGroup.get("tag").touched;t.ɵɵadvance(4),t.ɵɵconditional(e.formGroup.get("tag").hasError("required")&&n?6:e.formGroup.get("tag").hasError("pattern")&&n?7:-1)}}function VW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.vm-address-required"))}function qW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.vm-address-pattern"))}function GW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",17),t.ɵɵdeclareLet(5),t.ɵɵtemplate(6,VW,2,3,"tb-error-icon",6)(7,qW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.vmAddress"));const n=e.formGroup.get("vmAddress").touched;t.ɵɵadvance(4),t.ɵɵconditional(e.formGroup.get("vmAddress").hasError("required")&&n?6:e.formGroup.get("vmAddress").hasError("pattern")&&n?7:-1)}}function zW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function UW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.value-pattern"))}function jW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",18),t.ɵɵdeclareLet(5),t.ɵɵtemplate(6,zW,2,3,"tb-error-icon",6)(7,UW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.value"));const n=e.formGroup.get("value").touched;t.ɵɵadvance(4),t.ɵɵconditional(e.formGroup.get("value").hasError("required")&&n?6:e.formGroup.get("value").hasError("pattern")&&n?7:-1)}}class HW extends Ya{constructor(){super(...arguments),this.S7RequestType=zj,this.S7AddressType=jj,this.S7DeviceType=Gj,this.S7RequestTypeTranslates=Uj,this.S7AddressTypeTranslates=Hj,this.s7DataTypes=Object.values($j),this.s7DeviceTypes=Object.values(Gj),this.s7RequestTypes=Array.from(Uj.keys()),this.s7AddressTypes=Wj,this.devices=[],this.devicesLoaded=!1,this.devicesLoadError=!1,this.cdr=i(h)}get isBooleanDataType(){return Kj.includes(this.formGroup.get("dataType").value)}ngOnInit(){this.loadDevices()}initFormGroup(){const e=this.fb.group({deviceName:[null,[xe.required]],deviceType:[Gj.PLC,[xe.required]],requestType:[zj.READ,[xe.required]],type:[jj.DATA,[xe.required]],dataType:[$j.BOOLEAN,[xe.required]],dbNumber:[0,[xe.required,xe.min(0)]],start:[0,[xe.required,xe.min(0)]],size:[1,[xe.required,xe.min(0)]],bit:[0,[xe.required,xe.min(0),xe.max(7)]],tag:[{value:null,disabled:!0},[xe.required,xe.pattern(fn)]],vmAddress:[{value:null,disabled:!0},[xe.required,xe.pattern(fn)]],value:[{value:null,disabled:!0},[xe.required,xe.pattern(fn)]]});return e.get("deviceType").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>this.onDeviceTypeChange(e))),e.get("requestType").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>this.updateValueEnabling(e))),e.get("type").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>this.updateAddressTypeEnabling(e))),e.get("dataType").valueChanges.pipe(On(this.destroyRef)).subscribe((()=>this.updateBitEnabling())),e}onWriteValue(e){if(super.onWriteValue(e),e&&"object"==typeof e){const t=e.type===jj.VM?Gj.LOGO:Gj.PLC;this.formGroup.get("deviceType").setValue(t,{emitEvent:!1}),this.onDeviceTypeChange(t),this.updateValueEnabling(this.formGroup.get("requestType").value),this.cdr.markForCheck()}}mapOnChangeValue(e){const{deviceType:t,...n}=e;return n}onDeviceTypeChange(e){const t=this.formGroup.get("type");e===Gj.LOGO?t.setValue(jj.VM,{emitEvent:!1}):t.value===jj.VM&&t.setValue(jj.DATA,{emitEvent:!1}),this.updateAddressTypeEnabling(t.value)}updateAddressTypeEnabling(e){const t=this.formGroup.get("dataType"),n=this.formGroup.get("dbNumber"),i=this.formGroup.get("start"),a=this.formGroup.get("size"),r=this.formGroup.get("tag"),o=this.formGroup.get("vmAddress");this.toggleControl(t,e===jj.DATA),this.toggleControl(n,e===jj.DATA),this.toggleControl(i,e===jj.DATA),this.toggleControl(a,e===jj.DATA),this.toggleControl(r,e===jj.TAG),this.toggleControl(o,e===jj.VM),this.updateBitEnabling()}updateBitEnabling(){const e=this.formGroup.get("bit"),t=this.formGroup.get("type").value===jj.DATA,n=this.isBooleanDataType;this.toggleControl(e,t&&n)}updateValueEnabling(e){this.toggleControl(this.formGroup.get("value"),e===zj.WRITE)}loadDevices(){const e=this.ctx.stateController.getStateParams().connector_rpc.value,t={entityFilter:{type:V.entityType,entityType:L.DEVICE},pageLink:q(100),entityFields:[{type:G.ENTITY_FIELD,key:"name"}],keyFilters:[this.buildAttributeEqualsFilter("connectorType",e.type),this.buildAttributeEqualsFilter("connectorName",e.name)]};this.ctx.entityService.findEntityDataByQuery(t).pipe(On(this.destroyRef)).subscribe({next:e=>{this.devices=e.data.map((e=>e.latest[G.ENTITY_FIELD]?.name?.value)).filter((e=>!!e)),this.devicesLoaded=!0,this.cdr.markForCheck()},error:()=>{this.devicesLoadError=!0,this.devicesLoaded=!0,this.cdr.markForCheck()}})}buildAttributeEqualsFilter(e,t){return{key:{type:G.CLIENT_ATTRIBUTE,key:e},valueType:z.STRING,predicate:{type:U.STRING,operation:j.EQUAL,value:{defaultValue:t},ignoreCase:!0}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(HW)))(n||HW)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:HW,selectors:[["tb-gateway-s7-rpc-parameters"]],inputs:{ctx:"ctx"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>HW)),multi:!0},{provide:be,useExisting:c((()=>HW)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:33,vars:17,consts:[[3,"formGroup"],[1,"flex","flex-1","flex-row","gap-2.5"],["appearance","outline",1,"flex-1"],["formControlName","deviceName"],["disabled",""],[3,"value"],["matSuffix","",3,"tooltipText"],["formControlName","deviceType"],["formControlName","requestType"],["appearance","outline",1,"w-full"],["formControlName","type"],["formControlName","dataType"],["matInput","","type","number","min","0","formControlName","dbNumber"],["matInput","","type","number","min","0","formControlName","start"],["matInput","","type","number","min","0","formControlName","size"],["matInput","","type","number","min","0","max","7","formControlName","bit"],["matInput","","formControlName","tag","placeholder","DB0.DBX0.0"],["matInput","","formControlName","vmAddress","placeholder","VW30"],["matInput","","formControlName","value"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1)(2,"mat-form-field",2)(3,"mat-label"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-select",3),t.ɵɵtemplate(7,fW,3,3,"mat-option",4)(8,yW,3,3,"mat-option",4)(9,vW,3,3,"mat-option",4),t.ɵɵrepeaterCreate(10,xW,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(12,bW,2,3,"tb-error-icon",6),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",2)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-select",7),t.ɵɵrepeaterCreate(18,wW,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",1)(21,"mat-form-field",2)(22,"mat-label"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",8),t.ɵɵrepeaterCreate(26,SW,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵtemplate(28,_W,7,3,"mat-form-field",2),t.ɵɵelementEnd(),t.ɵɵtemplate(29,BW,34,16)(30,LW,8,4,"mat-form-field",9)(31,GW,8,4,"mat-form-field",9)(32,jW,8,4,"mat-form-field",9),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,11,"gateway.rpc.deviceName")),t.ɵɵadvance(3),t.ɵɵconditional(n.devicesLoaded?n.devicesLoadError?8:n.devices.length?-1:9:7),t.ɵɵadvance(3),t.ɵɵrepeater(n.devices),t.ɵɵadvance(2),t.ɵɵconditional(n.formGroup.get("deviceName").hasError("required")&&n.formGroup.get("deviceName").touched?12:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,13,"gateway.rpc.deviceType")),t.ɵɵadvance(3),t.ɵɵrepeater(n.s7DeviceTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,15,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵrepeater(n.s7RequestTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.formGroup.get("deviceType").value!==n.S7DeviceType.LOGO?28:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("type").value===n.S7AddressType.DATA?29:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("type").value===n.S7AddressType.TAG?30:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("type").value===n.S7AddressType.VM?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("requestType").value===n.S7RequestType.WRITE?32:-1))},dependencies:t.ɵɵgetComponentDepsFactory(HW,[T,di]),encapsulation:2,changeDetection:d.OnPush})}}const WW=e=>({border:e}),$W=e=>({"py-1":e}),KW=e=>({type:e});function YW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function XW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-min")," "))}function ZW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",6)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-select",7),t.ɵɵrepeaterCreate(5,YW,2,2,"mat-option",8,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",9)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",10),t.ɵɵtemplate(12,XW,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",11),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.sendCommand())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵrepeater(e.RPCCommands),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.statistics.timeout")),t.ɵɵadvance(3),t.ɵɵconditional(e.commandForm.get("time").hasError("min")?12:-1),t.ɵɵadvance(),t.ɵɵproperty("disabled",e.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,9,"gateway.rpc-command-send")," ")}}function QW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector",14),t.ɵɵlistener("sendCommand",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.sendCommand())}))("saveTemplate",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.saveTemplate())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("connectorType",e.connectorType)}}function JW(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-modbus-rpc-parameters",16)}function e$(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-mqtt-rpc-parameters",16)}function t$(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-opc-rpc-parameters",16)}function n$(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-socket-rpc-parameters",16)}function i$(e,n){if(1&e&&t.ɵɵelement(0,"tb-gateway-s7-rpc-parameters",17),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ctx",e.ctx)}}function a$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",13)(1,"div",15),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,JW,1,0,"tb-gateway-modbus-rpc-parameters",16)(5,e$,1,0,"tb-gateway-mqtt-rpc-parameters",16)(6,t$,1,0,"tb-gateway-opc-rpc-parameters",16)(7,n$,1,0,"tb-gateway-socket-rpc-parameters",16)(8,i$,1,1,"tb-gateway-s7-rpc-parameters",17),t.ɵɵelementStart(9,"div",18)(10,"button",19),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.saveTemplate())})),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",11),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.sendCommand())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,6,"gateway.rpc.title",t.ɵɵpureFunction1(13,KW,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵconditional((e=n.connectorType)===n.ConnectorType.MODBUS?4:e===n.ConnectorType.MQTT?5:e===n.ConnectorType.OPCUA?6:e===n.ConnectorType.SOCKET?7:e===n.ConnectorType.S7?8:-1),t.ɵɵadvance(6),t.ɵɵproperty("disabled",n.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,9,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,11,"gateway.rpc-command-send")," ")}}function r$(e,n){if(1&e&&t.ɵɵtemplate(0,QW,1,1,"tb-gateway-service-rpc-connector",12)(1,a$,16,15,"div",13),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.typesWithUpdatedParams.has(e.connectorType)?1:0)}}function o$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"mat-icon",20),t.ɵɵtext(2,"schedule"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"span"),t.ɵɵtext(4),t.ɵɵpipe(5,"date"),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(5,1,e.resultTime,"yyyy/MM/dd HH:mm:ss"))}}function s$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector-templates",21),t.ɵɵlistener("useTemplate",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.useTemplate(n))})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("rpcTemplates",e.templates)("ctx",e.ctx)("connectorType",e.connectorType)}}class l${constructor(e,t,n,i,a){this.fb=e,this.dialog=t,this.utils=n,this.cd=i,this.attributeService=a,this.contentTypes=H,this.RPCCommands=["Ping","Stats","Devices","Update","Version","Restart","Reboot"],this.templates=[],this.ConnectorType=yt,this.gatewayConnectorDefaultTypesTranslates=vt,this.typesWithUpdatedParams=new Set([yt.MQTT,yt.OPCUA,yt.MODBUS,yt.SOCKET,yt.S7]),this.modbusReadFunctionCodes=[1,2,3,4],this.subscriptionOptions={callbacks:{onDataUpdated:()=>this.ctx.ngZone.run((()=>{this.updateTemplates()})),onDataUpdateError:(e,t)=>this.ctx.ngZone.run((()=>{this.onDataUpdateError(t)})),dataLoading:()=>{}}},this.commandForm=this.fb.group({command:[null,[xe.required]],time:[60,[xe.required,xe.min(1)]],params:["{}",[ht]],result:[null]})}ngOnInit(){if(this.isConnector=this.ctx.settings.isConnector,this.isConnector){this.connectorType=this.ctx.stateController.getStateParams().connector_rpc.value.type;const e=[{type:N.entity,entityType:L.DEVICE,entityId:this.ctx.defaultSubscription.targetDeviceId,entityName:"Connector",attributes:[{name:`${this.connectorType}_template`}]}];this.ctx.subscriptionApi.createSubscriptionFromInfo(B.latest,e,this.subscriptionOptions,!1,!0).subscribe((e=>{this.subscription=e}))}else this.commandForm.get("command").setValue(this.RPCCommands[0])}sendCommand(e){this.resultTime=null;const t=e||this.commandForm.value,n=this.isConnector?`${this.connectorType}_`:"gateway_",i=this.isConnector?this.getCommandFromParamsByType(t.params):t.command.toLowerCase(),a=this.ctx.stateController.getStateParams().connector_rpc?.value.configurationJson.id,r=a?{...t.params,connectorId:a}:t.params;this.ctx.controlApi.sendTwoWayCommand(n+i,r,t.time).subscribe({next:e=>{this.resultTime=(new Date).getTime(),this.commandForm.get("result").setValue(JSON.stringify(e))},error:e=>{this.resultTime=(new Date).getTime(),console.error(e),this.commandForm.get("result").setValue(JSON.stringify(e.error))}})}getCommandFromParamsByType(e){switch(this.connectorType){case yt.MQTT:case yt.FTP:case yt.SNMP:case yt.REST:case yt.REQUEST:return e.methodFilter;case yt.MODBUS:return this.modbusReadFunctionCodes.includes(e.functionCode)?"get":"set";case yt.BACNET:case yt.CAN:case yt.OPCUA:return e.method;case yt.BLE:case yt.OCPP:case yt.SOCKET:case yt.XMPP:return e.methodRPC;case yt.S7:return e.requestType;default:return e.command}}saveTemplate(){this.dialog.open(yH,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{config:this.commandForm.value.params,templates:this.templates}}).afterClosed().subscribe((e=>{if(e){const t={name:e,config:this.commandForm.value.params,type:this.connectorType},n=this.templates,i=n.findIndex((e=>e.name==t.name));i>-1&&n.splice(i,1),n.push(t);const a=`${this.connectorType}_template`;this.attributeService.saveEntityAttributes({id:this.ctx.defaultSubscription.targetDeviceId,entityType:L.DEVICE},A.SERVER_SCOPE,[{key:a,value:n}]).subscribe((()=>{this.cd.detectChanges()}))}}))}useTemplate(e){this.commandForm.get("params").patchValue(e.config)}updateTemplates(){this.templates=this.subscription.data[0].data[0][1].length?JSON.parse(this.subscription.data[0].data[0][1]):[],this.cd.detectChanges()}onDataUpdateError(e){const t=this.utils.parseException(e);let n=t.name;t.message&&(n+=": "+t.message),console.error(n)}static{this.ɵfac=function(e){return new(e||l$)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(ee.UtilsService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(ee.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:l$,selectors:[["tb-gateway-service-rpc"]],inputs:{ctx:"ctx",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:11,vars:17,consts:[[1,"flex","flex-1","flex-col"],[1,"command-form","lt-sm:flex-col","flex","flex-row","gap-2.5",3,"formGroup"],[1,"result-block",3,"formGroup"],[1,"result-time","flex","flex-1","flex-row","items-center","justify-center"],["readonly","true","formControlName","result",3,"contentType"],[1,"border",3,"rpcTemplates","ctx","connectorType"],["appearance","outline"],["formControlName","command"],[3,"value"],["appearance","outline",1,"flex-1"],["matInput","","formControlName","time","type","number","min","1"],["mat-raised-button","","color","primary",3,"click","disabled"],["formControlName","params",3,"connectorType"],[1,"rpc-parameters","flex","flex-col"],["formControlName","params",3,"sendCommand","saveTemplate","connectorType"],[1,"mat-subtitle-1","tb-form-panel-title"],["formControlName","params"],["formControlName","params",3,"ctx"],[1,"fex-row","template-actions","flex","flex-1","items-center","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],[1,"material-icons"],[1,"border",3,"useTemplate","rpcTemplates","ctx","connectorType"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtemplate(2,ZW,16,11)(3,r$,2,1),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"section",2)(5,"span"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,o$,6,4,"div",3),t.ɵɵelementEnd(),t.ɵɵelement(9,"tb-json-content",4),t.ɵɵelementEnd()(),t.ɵɵtemplate(10,s$,1,3,"tb-gateway-service-rpc-connector-templates",5)),2&e&&(t.ɵɵclassMap(t.ɵɵpureFunction1(13,WW,n.isConnector)),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction1(15,$W,!n.isConnector)),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(),t.ɵɵconditional(n.isConnector?3:2),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(7,11,"gateway.rpc-command-result")," "),t.ɵɵadvance(2),t.ɵɵconditional(n.resultTime?8:-1),t.ɵɵadvance(),t.ɵɵproperty("contentType",n.contentTypes.JSON),t.ɵɵadvance(),t.ɵɵconditional(n.isConnector?10:-1))},dependencies:t.ɵɵgetComponentDepsFactory(l$,[me,T,YH,tW,aW,uW,hH,gW,HW]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;overflow:auto;display:flex;flex-direction:row;padding:0 5px}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{height:100%;overflow:auto}[_nghost-%COMP%] > tb-gateway-service-rpc-connector-templates[_ngcontent-%COMP%]:last-child{margin-left:10px}[_nghost-%COMP%] tb-gateway-service-rpc-connector-templates[_ngcontent-%COMP%]{flex:1 1 30%;max-width:30%}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%]{flex-wrap:nowrap;padding:0 5px 5px}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%] > button[_ngcontent-%COMP%]{margin-top:10px}[_nghost-%COMP%] .rpc-parameters[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%]{padding:0 5px;display:flex;flex-direction:column;flex:1}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-weight:600;position:relative;font-size:14px;margin-bottom:10px}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] .result-time[_ngcontent-%COMP%]{font-weight:400;font-size:14px;line-height:32px;position:absolute;left:0;top:25px;z-index:5;color:#0000008a}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] .result-time[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{padding-left:10px}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] tb-json-content[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] .border[_ngcontent-%COMP%]{padding:16px;box-shadow:0 0 #0003,0 0 #00000024,0 0 #0000001f;border:solid 1px #e0e0e0;border-radius:4px}']})}}function p$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration-delete-dialog-input-required")," "))}e("GatewayServiceRPCComponent",l$);class c$ extends O{constructor(e,t,n,i,a){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.gatewayName=this.data.gatewayName,this.gatewayControl=this.fb.control("")}close(){this.dialogRef.close()}turnOff(){this.dialogRef.close(!0)}static{this.ɵfac=function(e){return new(e||c$)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:c$,selectors:[["tb-gateway-remote-configuration-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:24,vars:14,consts:[["color","warn"],["translate",""],[1,"flex-1"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"mat-content","flex-col",2,"max-width","600px"],[3,"innerHTML"],["appearance","outline",1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","warn","type","button","cdkFocusInitial","",3,"click"],["mat-button","","color","warn","type","button",3,"click","disabled"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-toolbar",0)(1,"mat-icon"),t.ɵɵtext(2,"warning"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"h2",1),t.ɵɵtext(4,"gateway.configuration-delete-dialog-header"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2),t.ɵɵelementStart(6,"button",3),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵelementStart(7,"mat-icon",4),t.ɵɵtext(8,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",5),t.ɵɵelement(10,"span",6),t.ɵɵpipe(11,"translate"),t.ɵɵelementStart(12,"mat-form-field",7)(13,"mat-label",1),t.ɵɵtext(14,"gateway.configuration-delete-dialog-input"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",8),t.ɵɵtemplate(16,p$,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",9)(18,"button",10),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",11),t.ɵɵlistener("click",(function(){return n.turnOff()})),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(10),t.ɵɵpropertyInterpolate2("innerHTML","",t.ɵɵpipeBind1(11,8,"gateway.configuration-delete-dialog-body")," ",n.gatewayName,"",t.ɵɵsanitizeHtml),t.ɵɵadvance(5),t.ɵɵproperty("formControl",n.gatewayControl),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayControl.hasError("required")?16:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(20,10,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.gatewayControl.value!==n.gatewayName),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,12,"gateway.configuration-delete-dialog-confirm")," "))},dependencies:t.ɵɵgetComponentDepsFactory(c$,[T]),encapsulation:2})}}var d$;e("GatewayRemoteConfigurationDialogComponent",c$),function(e){e.tls="tls",e.accessToken="accessToken"}(d$||(d$={}));const u$="configuration_drafts",m$="RemoteLoggingLevel",h$=new Map([[d$.tls,"gateway.security-types.tls"],[d$.accessToken,"gateway.security-types.access-token"]]);var g$,f$;!function(e){e.none="NONE",e.critical="CRITICAL",e.error="ERROR",e.warning="WARNING",e.info="INFO",e.debug="DEBUG"}(g$||(g$={})),function(e){e.memory="memory",e.file="file"}(f$||(f$={}));const y$=new Map([[f$.memory,"gateway.storage-types.memory-storage"],[f$.file,"gateway.storage-types.file-storage"]]);var v$;!function(e){e.mqtt="MQTT",e.modbus="Modbus",e.opcua="OPC-UA",e.ble="BLE",e.request="Request",e.can="CAN",e.bacnet="BACnet",e.custom="Custom"}(v$||(v$={}));const x$={config:{},name:"",configType:null,enabled:!1};function b$(e){return JSON.stringify(e.value)===JSON.stringify({})?{validJSON:!0}:null}function w$(e){return e.replace("_","").replace("-","").replace(/^\s+|\s+/g,"").toLowerCase()+".json"}function S$(e,t){return'[loggers]}}keys=root, service, connector, converter, tb_connection, storage, extension}}[handlers]}}keys=consoleHandler, serviceHandler, connectorHandler, converterHandler, tb_connectionHandler, storageHandler, extensionHandler}}[formatters]}}keys=LogFormatter}}[logger_root]}}level=ERROR}}handlers=consoleHandler}}[logger_connector]}}level={ERROR}}}handlers=connectorHandler}}formatter=LogFormatter}}qualname=connector}}[logger_storage]}}level={ERROR}}}handlers=storageHandler}}formatter=LogFormatter}}qualname=storage}}[logger_tb_connection]}}level={ERROR}}}handlers=tb_connectionHandler}}formatter=LogFormatter}}qualname=tb_connection}}[logger_service]}}level={ERROR}}}handlers=serviceHandler}}formatter=LogFormatter}}qualname=service}}[logger_converter]}}level={ERROR}}}handlers=converterHandler}}formatter=LogFormatter}}qualname=converter}}[logger_extension]}}level={ERROR}}}handlers=connectorHandler}}formatter=LogFormatter}}qualname=extension}}[handler_consoleHandler]}}class=StreamHandler}}level={ERROR}}}formatter=LogFormatter}}args=(sys.stdout,)}}[handler_connectorHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}connector.log", "d", 1, 7,)}}[handler_storageHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}storage.log", "d", 1, 7,)}}[handler_serviceHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}service.log", "d", 1, 7,)}}[handler_converterHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}converter.log", "d", 1, 3,)}}[handler_extensionHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}extension.log", "d", 1, 3,)}}[handler_tb_connectionHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}tb_connection.log", "d", 1, 3,)}}[formatter_LogFormatter]}}format="%(asctime)s - %(levelname)s - [%(filename)s] - %(module)s - %(lineno)d - %(message)s" }}datefmt="%Y-%m-%d %H:%M:%S"'.replace(/{ERROR}/g,e).replace(/{.\/logs\/}/g,t)}function C$(e){return{id:e,entityType:L.DEVICE}}function _$(e){const t={};return Object.prototype.hasOwnProperty.call(e,"thingsboard")&&(t.host=e.thingsboard.host,t.port=e.thingsboard.port,t.remoteConfiguration=e.thingsboard.remoteConfiguration,Object.prototype.hasOwnProperty.call(e.thingsboard.security,d$.accessToken)?(t.securityType=d$.accessToken,t.accessToken=e.thingsboard.security.accessToken):(t.securityType=d$.tls,t.caCertPath=e.thingsboard.security.caCert,t.privateKeyPath=e.thingsboard.security.privateKey,t.certPath=e.thingsboard.security.cert)),Object.prototype.hasOwnProperty.call(e,"storage")&&Object.prototype.hasOwnProperty.call(e.storage,"type")&&(e.storage.type===f$.memory?(t.storageType=f$.memory,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count):e.storage.type===f$.file&&(t.storageType=f$.file,t.dataFolderPath=e.storage.data_folder_path,t.maxFilesCount=e.storage.max_file_count,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count)),t}function T$(e){const t={};for(const n of e)n.enabled||(t[n.name]={connector:n.configType,config:n.config});return t}function E$(e){const t={thingsboard:I$(e)};return function(e,t){for(const n of t)if(n.enabled){const t=n.configType;Array.isArray(e[t])||(e[t]=[]);const i={name:n.name,config:n.config};e[t].push(i)}}(t,e.connectors),t}function I$(e){let t;t=e.securityType===d$.accessToken?{accessToken:e.accessToken}:{caCert:e.caCertPath,privateKey:e.privateKeyPath,cert:e.certPath};const n={host:e.host,remoteConfiguration:e.remoteConfiguration,port:e.port,security:t};let i;i=e.storageType===f$.memory?{type:f$.memory,read_records_count:e.readRecordsCount,max_records_count:e.maxRecordsCount}:{type:f$.file,data_folder_path:e.dataFolderPath,max_file_count:e.maxFilesCount,max_read_records_count:e.readRecordsCount,max_records_per_file:e.maxRecordsCount};const a=[];for(const t of e.connectors)if(t.enabled){const e={configuration:w$(t.name),name:t.name,type:t.configType};a.push(e)}return{thingsboard:n,connectors:a,storage:i,logs:window.btoa(S$(e.remoteLoggingLevel,e.remoteLoggingPathToLogs))}}const M$=["formContainer"],k$=(e,t,n)=>({"gap-1.25":e,"flex-row":t,"flex-col":n}),P$=(e,t,n)=>({"gap-1.25":e,"flex-row justify-end item-center":t,"flex-col justify-evenly item-center":n});function D$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e.value.toString())," ")}}function A$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-host-required "),t.ɵɵelementEnd())}function O$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-required "),t.ɵɵelementEnd())}function R$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-min "),t.ɵɵelementEnd())}function B$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-max "),t.ɵɵelementEnd())}function F$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-pattern "),t.ɵɵelementEnd())}function N$(e,n){1&e&&(t.ɵɵelementStart(0,"div",13)(1,"mat-form-field",17)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",17)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",30),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",17)(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",31),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.tls-path-ca-certificate")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,5,"gateway.tls-path-private-key")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,7,"gateway.tls-path-client-certificate")))}function L$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function V$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.path-logs-required "),t.ɵɵelementEnd())}function q$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e.value.toString())," ")}}function G$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-pack-size-required "),t.ɵɵelementEnd())}function z$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-pack-size-min "),t.ɵɵelementEnd())}function U$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-pack-size-pattern "),t.ɵɵelementEnd())}function j$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-records-required "),t.ɵɵelementEnd())}function H$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-records-min "),t.ɵɵelementEnd())}function W$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-records-pattern "),t.ɵɵelementEnd())}function $$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-files-required "),t.ɵɵelementEnd())}function K$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-files-min "),t.ɵɵelementEnd())}function Y$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-files-pattern "),t.ɵɵelementEnd())}function X$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-path-required "),t.ɵɵelementEnd())}function Z$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-form-field",9)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",32),t.ɵɵtemplate(6,$$,2,0,"mat-error",11)(7,K$,2,0,"mat-error",11)(8,Y$,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",9)(10,"mat-label"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",33),t.ɵɵtemplate(14,X$,2,0,"mat-error",11),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction3(12,k$,e.layoutGap,e.alignment,!e.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.storage-max-files")),t.ɵɵadvance(3),t.ɵɵconditional(e.gatewayConfigurationGroup.get("maxFilesCount").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.gatewayConfigurationGroup.get("maxFilesCount").hasError("min")?7:-1),t.ɵɵadvance(),t.ɵɵconditional(e.gatewayConfigurationGroup.get("maxFilesCount").hasError("pattern")?8:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,10,"gateway.storage-path")),t.ɵɵadvance(3),t.ɵɵconditional(e.gatewayConfigurationGroup.get("dataFolderPath").hasError("required")?14:-1)}}function Q$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function J$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.connector-type-required "),t.ɵɵelementEnd())}function eK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.connector-name-required "),t.ɵɵelementEnd())}function tK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",23)(1,"div",34)(2,"div",35),t.ɵɵelement(3,"mat-slide-toggle",36),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",37)(5,"mat-form-field",9)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",38),t.ɵɵlistener("selectionChange",(function(){const n=t.ɵɵrestoreView(e).$implicit,i=t.ɵɵnextContext();return t.ɵɵresetView(i.changeConnectorType(n))})),t.ɵɵrepeaterCreate(10,Q$,2,2,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(12,J$,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",9)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"input",39),t.ɵɵlistener("blur",(function(){const n=t.ɵɵrestoreView(e),i=n.$implicit,a=n.$index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.changeConnectorName(i,a))})),t.ɵɵelementEnd(),t.ɵɵtemplate(18,eK,2,0,"mat-error",11),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",40)(20,"button",41),t.ɵɵpipe(21,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e),a=i.$implicit,r=i.$index,o=t.ɵɵnextContext();return t.ɵɵresetView(o.openConfigDialog(n,r,a.get("config").value,a.get("name").value))})),t.ɵɵelementStart(22,"mat-icon"),t.ɵɵtext(23,"more_horiz"),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",41),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.removeConnector(n))})),t.ɵɵelementStart(26,"mat-icon"),t.ɵɵtext(27,"close"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,i=n.$index,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("formGroupName",i),t.ɵɵadvance(3),t.ɵɵclassMap(t.ɵɵpureFunction3(23,k$,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,15,"gateway.connector-type")),t.ɵɵadvance(3),t.ɵɵrepeater(a.connectorTypes),t.ɵɵadvance(2),t.ɵɵconditional(e.get("configType").hasError("required")?12:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,17,"gateway.connector-name")),t.ɵɵadvance(3),t.ɵɵconditional(e.get("name").hasError("required")?18:-1),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction3(27,P$,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(),t.ɵɵclassProp("mat-warn",e.get("config").invalid),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(21,19,"gateway.update-config")),t.ɵɵproperty("disabled",a.isReadOnlyForm),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(25,21,"gateway.delete")),t.ɵɵproperty("disabled",a.isReadOnlyForm)}}function nK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",42),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.exportConfig())})),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,3,"gateway.download-tip")),t.ɵɵproperty("disabled",!e.gatewayConfigurationGroup.dirty||e.gatewayConfigurationGroup.invalid),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"action.download")," ")}}function iK(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",28),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,3,"gateway.save-tip")),t.ɵɵproperty("disabled",!e.gatewayConfigurationGroup.dirty||e.gatewayConfigurationGroup.invalid),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"action.save")," ")}}class aK extends W{constructor(e,t,n,i,a,r,o,s,l,p,c){super(e),this.store=e,this.elementRef=t,this.utils=n,this.ngZone=i,this.fb=a,this.window=r,this.dialog=o,this.translate=s,this.deviceService=l,this.attributeService=p,this.importExport=c,this.alignment=!0,this.layoutGap=!0,this.securityTypes=h$,this.gatewayLogLevels=Object.keys(g$).map((e=>g$[e])),this.connectorTypes=Object.keys(v$),this.storageTypes=y$,this.toastTargetId="gateway-configuration-widget"+this.utils.guid(),this.isReadOnlyForm=!1}get connectors(){return this.gatewayConfigurationGroup.get("connectors")}ngOnInit(){this.initWidgetSettings(this.ctx.settings),this.ctx.datasources&&this.ctx.datasources.length&&(this.deviceNameForm=this.ctx.datasources[0].name),this.buildForm(),this.ctx.updateWidgetParams(),this.formResize$=new ResizeObserver((()=>{this.resize()})),this.formResize$.observe(this.formContainerRef.nativeElement)}ngOnDestroy(){this.formResize$&&this.formResize$.disconnect(),this.subscribeGateway$.unsubscribe(),this.subscribeStorageType$.unsubscribe()}initWidgetSettings(e){let t;t=e.gatewayTitle&&e.gatewayTitle.length?this.utils.customTranslation(e.gatewayTitle,e.gatewayTitle):this.translate.instant("gateway.gateway"),this.ctx.widgetTitle=t,this.isReadOnlyForm=!!e.readOnly&&e.readOnly,this.archiveFileName=e.archiveFileName?.length?e.archiveFileName:"gatewayConfiguration",this.gatewayType=e.gatewayType?.length?e.gatewayType:"Gateway",this.gatewayNameExists=this.utils.customTranslation(e.gatewayNameExists,e.gatewayNameExists)||this.translate.instant("gateway.gateway-exists"),this.successfulSaved=this.utils.customTranslation(e.successfulSave,e.successfulSave)||this.translate.instant("gateway.gateway-saved"),this.updateWidgetDisplaying()}resize(){this.ngZone.run((()=>{this.updateWidgetDisplaying(),this.ctx.detectChanges()}))}updateWidgetDisplaying(){this.ctx.$container&&this.ctx.$container[0].offsetWidth<=425?(this.layoutGap=!1,this.alignment=!1):(this.layoutGap=!0,this.alignment=!0)}saveAttribute(e,t,n){const i=this.gatewayConfigurationGroup.get("gateway").value,a={key:e,value:t};return this.attributeService.saveEntityAttributes(C$(i),n,[a])}createConnector(e=x$){this.connectors.push(this.fb.group({enabled:[e.enabled],configType:[e.configType,[xe.required]],name:[e.name,[xe.required]],config:[e.config,[xe.nullValidator,b$]]}))}getFormField(e){return this.gatewayConfigurationGroup.get(e)}buildForm(){this.gatewayConfigurationGroup=this.fb.group({gateway:[null,[]],accessToken:[null,[xe.required]],securityType:[d$.accessToken],host:[this.window.location.hostname,[xe.required]],port:[1883,[xe.required,xe.min(1),xe.max(65535),xe.pattern(/^-?[0-9]+$/)]],remoteConfiguration:[!0],caCertPath:["/etc/thingsboard-gateway/ca.pem"],privateKeyPath:["/etc/thingsboard-gateway/privateKey.pem"],certPath:["/etc/thingsboard-gateway/certificate.pem"],remoteLoggingLevel:[g$.debug],remoteLoggingPathToLogs:["./logs/",[xe.required]],storageType:[f$.memory],readRecordsCount:[100,[xe.required,xe.min(1),xe.pattern(/^-?[0-9]+$/)]],maxRecordsCount:[1e4,[xe.required,xe.min(1),xe.pattern(/^-?[0-9]+$/)]],maxFilesCount:[5,[xe.required,xe.min(1),xe.pattern(/^-?[0-9]+$/)]],dataFolderPath:["./data/",[xe.required]],connectors:this.fb.array([])}),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1}),this.subscribeStorageType$=this.getFormField("storageType").valueChanges.subscribe((e=>{e===f$.memory?(this.getFormField("maxFilesCount").disable(),this.getFormField("dataFolderPath").disable()):(this.getFormField("maxFilesCount").enable(),this.getFormField("dataFolderPath").enable())})),this.subscribeGateway$=this.getFormField("gateway").valueChanges.subscribe((e=>{null!==e?Ae([this.deviceService.getDeviceCredentials(e).pipe(Ve((e=>{this.getFormField("accessToken").patchValue(e.credentialsId)}))),...this.getAttributes(e)]).subscribe((()=>{this.gatewayConfigurationGroup.markAsPristine(),this.ctx.detectChanges()})):this.getFormField("accessToken").patchValue("")}))}gatewayExist(){this.ctx.showErrorToast(this.gatewayNameExists,"top","left",this.toastTargetId)}exportConfig(){const e=this.gatewayConfigurationGroup.value,t={};var n,i,a;t["tb_gateway.yaml"]=function(e){let t;t="thingsboard:\n",t+=" host: "+e.host+"\n",t+=" remoteConfiguration: "+e.remoteConfiguration+"\n",t+=" port: "+e.port+"\n",t+=" security:\n",e.securityType===d$.accessToken?t+=" access-token: "+e.accessToken+"\n":(t+=" ca_cert: "+e.caCertPath+"\n",t+=" privateKey: "+e.privateKeyPath+"\n",t+=" cert: "+e.certPath+"\n"),t+="storage:\n",e.storageType===f$.memory?(t+=" type: memory\n",t+=" read_records_count: "+e.readRecordsCount+"\n",t+=" max_records_count: "+e.maxRecordsCount+"\n"):(t+=" type: file\n",t+=" data_folder_path: "+e.dataFolderPath+"\n",t+=" max_file_count: "+e.maxFilesCount+"\n",t+=" max_read_records_count: "+e.readRecordsCount+"\n",t+=" max_records_per_file: "+e.maxRecordsCount+"\n"),t+="connectors:\n";for(const n of e.connectors)n.enabled&&(t+=" -\n",t+=" name: "+n.name+"\n",t+=" type: "+n.configType+"\n",t+=" configuration: "+w$(n.name)+"\n");return t}(e),function(e,t){for(const n of t)n.enabled&&(e[w$(n.name)]=JSON.stringify(n.config))}(t,e.connectors),n=t,i=e.remoteLoggingLevel,a=e.remoteLoggingPathToLogs,n["logs.conf"]=S$(i,a),this.importExport.exportJSZip(t,this.archiveFileName),this.saveAttribute(m$,this.gatewayConfigurationGroup.value.remoteLoggingLevel.toUpperCase(),A.SHARED_SCOPE)}addNewConnector(){this.createConnector()}removeConnector(e){e>-1&&(this.connectors.removeAt(e),this.connectors.markAsDirty())}openConfigDialog(e,t,n,i){e&&(e.stopPropagation(),e.preventDefault()),this.dialog.open(lt,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{jsonValue:n,required:!0,title:this.translate.instant("gateway.title-connectors-json",{typeName:i})}}).afterClosed().subscribe((e=>{e&&(this.connectors.at(t).get("config").patchValue(e),this.ctx.detectChanges())}))}createConnectorName(e,t,n=0){const i=n?t+n:t;return-1===e.findIndex((e=>e.name===i))?i:this.createConnectorName(e,t,++n)}validateConnectorName(e,t,n,i=0){for(let a=0;a{this.ctx.showSuccessToast(this.successfulSaved,2e3,"top","left",this.toastTargetId),this.gatewayConfigurationGroup.markAsPristine()}))}getAttributes(e){const t=[];return t.push(Ae([this.getAttribute("current_configuration",A.CLIENT_SCOPE,e),this.getAttribute(u$,A.SERVER_SCOPE,e)]).pipe(Ve((([e,t])=>{this.setFormGatewaySettings(e),this.setFormConnectorsDraft(t),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1})})))),t.push(this.getAttribute(m$,A.SHARED_SCOPE,e).pipe(Ve((e=>this.processLoggingLevel(e))))),t}getAttribute(e,t,n){return this.attributeService.getEntityAttributes(C$(n),t,[e])}setFormGatewaySettings(e){if(this.connectors.clear(),e.length>0){const t=JSON.parse(window.atob(e[0].value));for(const e of Object.keys(t)){const n=t[e];if("thingsboard"===e)null!==n&&Object.keys(n).length>0&&this.gatewayConfigurationGroup.patchValue(_$(n));else for(const t of Object.keys(n)){let i="No name";Object.prototype.hasOwnProperty.call(n[t],"name")&&(i=n[t].name);const a={enabled:!0,configType:e,config:n[t].config,name:i};this.createConnector(a)}}}}setFormConnectorsDraft(e){if(e.length>0){const t=JSON.parse(window.atob(e[0].value));for(const e of Object.keys(t)){const n={enabled:!1,configType:t[e].connector,config:t[e].config,name:e};this.createConnector(n)}}}processLoggingLevel(e){let t=g$.debug;e.length>0&&g$[e[0].value.toLowerCase()]&&(t=g$[e[0].value.toLowerCase()]),this.getFormField("remoteLoggingLevel").patchValue(t)}static{this.ɵfac=function(e){return new(e||aK)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(t.ElementRef),t.ɵɵdirectiveInject(ee.UtilsService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(ye.UntypedFormBuilder),t.ɵɵdirectiveInject(J),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(he.TranslateService),t.ɵɵdirectiveInject(ee.DeviceService),t.ɵɵdirectiveInject(ee.AttributeService),t.ɵɵdirectiveInject(pt.ImportExportService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:aK,selectors:[["tb-gateway-form"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(M$,7),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.formContainerRef=e.first)}},inputs:{ctx:"ctx",isStateForm:"isStateForm"},standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:108,vars:100,consts:[["formContainer",""],["tb-toast","",1,"gateway-form",3,"ngSubmit","formGroup","toastTarget"],["multi","true",1,"mat-body-2"],[1,"tb-panel-title"],["formControlName","gateway","required","",3,"gatewayNameExist","deviceName","isStateForm","newGatewayType"],["appearance","outline",1,"flex"],["formControlName","securityType"],[3,"value"],[1,"flex"],["appearance","outline",1,"flex-1"],["matInput","","type","text","formControlName","host"],["translate",""],["matInput","","type","number","formControlName","port"],[1,"flex","flex-col"],["formControlName","remoteConfiguration"],["formControlName","remoteLoggingLevel"],["matInput","","type","text","formControlName","remoteLoggingPathToLogs"],["appearance","outline"],["formControlName","storageType"],["matInput","","type","number","formControlName","readRecordsCount"],["matInput","","type","number","formControlName","maxRecordsCount"],[1,"flex",3,"class"],[1,"gateway-config","flex","flex-col"],["formArrayName","connectors"],[1,"no-data-found","items-center","justify-center"],["mat-raised-button","","type","button","matTooltipPosition","above",3,"click","matTooltip"],[1,"form-action-buttons","flex","flex-row","items-center","justify-end"],["mat-raised-button","","color","primary","type","button",3,"disabled","matTooltip"],["mat-raised-button","","color","primary","type","submit",3,"disabled","matTooltip"],["matInput","","type","text","formControlName","caCertPath"],["matInput","","type","text","formControlName","privateKeyPath"],["matInput","","type","text","formControlName","certPath"],["matInput","","type","number","formControlName","maxFilesCount"],["matInput","","type","text","formControlName","dataFolderPath"],[1,"flex","flex-row","items-stretch","justify-between","gap-2",3,"formGroupName"],[1,"flex","flex-col","justify-center"],["formControlName","enabled"],[1,"flex-full","flex"],["formControlName","configType",3,"selectionChange"],["matInput","","type","text","formControlName","name",3,"blur"],[1,"action-buttons","flex"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],["mat-raised-button","","color","primary","type","button",3,"click","disabled","matTooltip"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"form",1,0),t.ɵɵlistener("ngSubmit",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.save())})),t.ɵɵelementStart(2,"mat-accordion",2)(3,"mat-expansion-panel")(4,"mat-expansion-panel-header")(5,"mat-panel-title")(6,"div",3),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵpipe(9,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"tb-entity-gateway-select",4),t.ɵɵlistener("gatewayNameExist",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.gatewayExist())})),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",5)(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-select",6),t.ɵɵrepeaterCreate(16,D$,3,4,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(18,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",8)(20,"mat-form-field",9)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",10),t.ɵɵtemplate(25,A$,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",9)(27,"mat-label"),t.ɵɵtext(28),t.ɵɵpipe(29,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(30,"input",12),t.ɵɵtemplate(31,O$,2,0,"mat-error",11)(32,R$,2,0,"mat-error",11)(33,B$,2,0,"mat-error",11)(34,F$,2,0,"mat-error",11),t.ɵɵelementEnd()(),t.ɵɵtemplate(35,N$,16,9,"div",13),t.ɵɵelementStart(36,"mat-checkbox",14),t.ɵɵtext(37),t.ɵɵpipe(38,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"div",8)(40,"mat-form-field",9)(41,"mat-label"),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-select",15),t.ɵɵrepeaterCreate(45,L$,2,2,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"mat-form-field",9)(48,"mat-label"),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(51,"input",16),t.ɵɵtemplate(52,V$,2,0,"mat-error",11),t.ɵɵelementEnd()()(),t.ɵɵelementStart(53,"mat-expansion-panel")(54,"mat-expansion-panel-header")(55,"mat-panel-title")(56,"div",3),t.ɵɵtext(57),t.ɵɵpipe(58,"translate"),t.ɵɵpipe(59,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(60,"div",13)(61,"mat-form-field",17)(62,"mat-label"),t.ɵɵtext(63),t.ɵɵpipe(64,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(65,"mat-select",18),t.ɵɵrepeaterCreate(66,q$,3,4,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(68,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(69,"div",8)(70,"mat-form-field",9)(71,"mat-label"),t.ɵɵtext(72),t.ɵɵpipe(73,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(74,"input",19),t.ɵɵtemplate(75,G$,2,0,"mat-error",11)(76,z$,2,0,"mat-error",11)(77,U$,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(78,"mat-form-field",9)(79,"mat-label"),t.ɵɵtext(80),t.ɵɵpipe(81,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(82,"input",20),t.ɵɵtemplate(83,j$,2,0,"mat-error",11)(84,H$,2,0,"mat-error",11)(85,W$,2,0,"mat-error",11),t.ɵɵelementEnd()(),t.ɵɵtemplate(86,Z$,15,16,"div",21),t.ɵɵelementEnd()(),t.ɵɵelementStart(87,"mat-expansion-panel")(88,"mat-expansion-panel-header")(89,"mat-panel-title")(90,"div",3),t.ɵɵtext(91),t.ɵɵpipe(92,"translate"),t.ɵɵpipe(93,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(94,"div",22),t.ɵɵrepeaterCreate(95,tK,28,31,"section",23,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(97,"span",24),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(100,"div")(101,"button",25),t.ɵɵpipe(102,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addNewConnector())})),t.ɵɵtext(103),t.ɵɵpipe(104,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(105,"section",26),t.ɵɵtemplate(106,nK,4,7,"button",27)(107,iK,4,7,"button",28),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("toastTarget",n.toastTargetId),t.ɵɵproperty("formGroup",n.gatewayConfigurationGroup),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,50,t.ɵɵpipeBind1(8,48,"gateway.thingsboard"))),t.ɵɵadvance(3),t.ɵɵproperty("deviceName",n.deviceNameForm)("isStateForm",n.isStateForm)("newGatewayType",n.gatewayType),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,52,"gateway.security-type")),t.ɵɵadvance(3),t.ɵɵrepeater(t.ɵɵpipeBind1(18,54,n.securityTypes)),t.ɵɵadvance(3),t.ɵɵclassMap(t.ɵɵpureFunction3(88,k$,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,56,"gateway.thingsboard-host")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("host").hasError("required")?25:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(29,58,"gateway.thingsboard-port")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("required")?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("min")?32:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("max")?33:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("pattern")?34:-1),t.ɵɵadvance(),t.ɵɵconditional("tls"===n.gatewayConfigurationGroup.get("securityType").value?35:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(38,60,"gateway.remote")),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(92,k$,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(43,62,"gateway.remote-logging-level")),t.ɵɵadvance(3),t.ɵɵrepeater(n.gatewayLogLevels),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(50,64,"gateway.path-logs")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("remoteLoggingPathToLogs").hasError("required")?52:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(59,68,t.ɵɵpipeBind1(58,66,"gateway.storage"))),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(64,70,"gateway.storage-type")),t.ɵɵadvance(3),t.ɵɵrepeater(t.ɵɵpipeBind1(68,72,n.storageTypes)),t.ɵɵadvance(3),t.ɵɵclassMap(t.ɵɵpureFunction3(96,k$,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(73,74,"gateway.storage-pack-size")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("readRecordsCount").hasError("required")?75:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("readRecordsCount").hasError("min")?76:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("readRecordsCount").hasError("pattern")?77:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(81,76,"file"!==n.gatewayConfigurationGroup.get("storageType").value?"gateway.storage-max-records":"gateway.storage-max-file-records")," "),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("required")?83:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("min")?84:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("pattern")?85:-1),t.ɵɵadvance(),t.ɵɵconditional("file"===n.gatewayConfigurationGroup.get("storageType").value?86:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(93,80,t.ɵɵpipeBind1(92,78,"gateway.connectors-config"))),t.ɵɵadvance(4),t.ɵɵrepeater(n.connectors.controls),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.connectors.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(99,82,"gateway.no-connectors")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(102,84,"gateway.connector-add")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(104,86,"action.add")," "),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("remoteConfiguration").value?-1:106),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("remoteConfiguration").value?107:-1))},dependencies:t.ɵɵgetComponentDepsFactory(aK,[me,T]),styles:['@charset "UTF-8";[_nghost-%COMP%] .gateway-form[_ngcontent-%COMP%]{height:100%;padding:5px;background-color:transparent;overflow-y:auto;overflow-x:hidden}[_nghost-%COMP%] .gateway-form[_ngcontent-%COMP%] .form-action-buttons[_ngcontent-%COMP%]{padding-top:8px}[_nghost-%COMP%] .gateway-form[_ngcontent-%COMP%] .gateway-config[_ngcontent-%COMP%] .no-data-found[_ngcontent-%COMP%]{position:relative;display:flex;height:40px}']})}}e("GatewayFormComponent",aK);class rK{transform(e,t){return nr.parseVersion(e)>=nr.parseVersion(qi.get(t))}static{this.ɵfac=function(e){return new(e||rK)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"isLatestVersionConfig",type:rK,pure:!0,standalone:!0})}}class oK{constructor(e){this.translate=e}transform(e){return e.hasError("required")?this.translate.instant("gateway.port-required"):e.hasError("min")||e.hasError("max")?this.translate.instant("gateway.port-limits-error",{min:Vi.MIN,max:Vi.MAX}):""}static{this.ɵfac=function(e){return new(e||oK)(t.ɵɵdirectiveInject(he.TranslateService,16))}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getGatewayPortTooltip",type:oK,pure:!0,standalone:!0})}}class sK{transform(e,t,n,i){switch(e){case yt.OPCUA:return this.getOpcConnectorHelpLink(t,n);case yt.MQTT:return this.getMqttConnectorHelpLink(t,n,i);case yt.BACNET:return this.getBacnetConnectorHelpLink(t,n);case yt.REST:return this.getRestConnectorHelpLink(n)}}getOpcConnectorHelpLink(e,t){if(t!==Gi.CONST)return`widget/lib/gateway/${e}-${t}_fn`}getMqttConnectorHelpLink(e,t,n){if(t!==mi.CONST)return n?e!==Xi.ATTRIBUTES&&e!==Xi.TIMESERIES||n!==ui.JSON?`widget/lib/gateway/mqtt-${n}-expression_fn`:"widget/lib/gateway/mqtt-json-key-expression_fn":"widget/lib/gateway/mqtt-expression_fn"}getBacnetConnectorHelpLink(e,t){if(t!==Gi.CONST)return`widget/lib/gateway/bacnet-device-${e}-${t}_fn`}getRestConnectorHelpLink(e){if(e!==ki.CONST)return"widget/lib/gateway/rest-json_fn"}static{this.ɵfac=function(e){return new(e||sK)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getConnectorMappingHelpLink",type:sK,pure:!0,standalone:!0})}}function lK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.gatewayConnectorDefaultTypesTranslatesMap.get(e)," ")}}function pK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.connectorForm.get("name").hasError("duplicateName")?"gateway.connector-duplicate-name":"gateway.name-required"))}}function cK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",10),t.ɵɵelement(4,"input",20),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function dK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",10),t.ɵɵelement(4,"input",21),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function uK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function mK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",22)(2,"mat-label",23),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,2,"gateway.fill-connector-defaults-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,4,"gateway.fill-connector-defaults")," "))}function hK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",24)(2,"mat-label",23),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,2,"gateway.send-change-data-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,4,"gateway.send-change-data")," "))}class gK extends O{constructor(e,t,n,i,a,r){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.isLatestVersionConfig=r,this.connectorType=yt,this.gatewayConnectorDefaultTypesTranslatesMap=vt,this.gatewayLogLevel=Object.values(gt),this.submitted=!1,this.destroy$=new Ie,this.updateConnectorTypesByVersion(),this.connectorForm=this.fb.group({type:[yt.MQTT,[]],name:["",[xe.required,this.uniqNameRequired(),xe.pattern(fn)]],logLevel:[gt.INFO,[]],useDefaults:[!0,[]],sendDataOnlyOnChange:[!1,[]],class:["",[]],key:["auto",[]]})}ngOnInit(){this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}helpLinkId(){return w+"/docs/iot-gateway/configuration/"}cancel(){this.dialogRef.close(null)}add(){this.submitted=!0;const e=this.connectorForm.getRawValue();if(e.useDefaults){const t=an(e.type),n=this.data.gatewayVersion;n&&(e.configVersion=n),e.configurationJson=(this.isLatestVersionConfig.transform(n,e.type)?t[qi.get(e.type)]:t[ft.Legacy])??t,this.connectorForm.valid&&this.dialogRef.close(e)}else this.connectorForm.valid&&this.dialogRef.close(e)}uniqNameRequired(){return e=>{const t=e.value.trim().toLowerCase();return this.data.dataSourceData.some((({value:{name:e}})=>e.toLowerCase()===t))?{duplicateName:{valid:!1}}:null}}updateConnectorTypesByVersion(){const e=bt.keys();for(let t of e)if(t===ft.Legacy||nr.parseVersion(this.data.gatewayVersion)>=nr.parseVersion(t)){this.connectorTypes=bt.get(t);break}}observeTypeChange(){this.connectorForm.get("type").valueChanges.pipe(Ve((e=>{const t=this.connectorForm.get("useDefaults");e===yt.GRPC||e===yt.CUSTOM?t.setValue(!1):t.value||t.setValue(!0)})),Re(this.destroy$)).subscribe()}static{this.ɵfac=function(e){return new(e||gK)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(rK))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gK,selectors:[["tb-add-connector-dialog"]],standalone:!0,features:[t.ɵɵProvidersFeature([rK]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:45,vars:23,consts:[[1,"add-connector",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","type"],[3,"value"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["formControlName","logLevel"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","useDefaults",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8)(13,"div",9),t.ɵɵtext(14,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-form-field",10)(16,"mat-select",11),t.ɵɵrepeaterCreate(17,lK,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",8)(20,"div",13),t.ɵɵtext(21,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",10),t.ɵɵelement(23,"input",14),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,pK,3,3,"mat-icon",15),t.ɵɵelementEnd()(),t.ɵɵtemplate(26,cK,6,3,"div",8)(27,dK,6,3,"div",8),t.ɵɵelementStart(28,"div",8)(29,"div",9),t.ɵɵtext(30,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",10)(32,"mat-select",16),t.ɵɵrepeaterCreate(33,uK,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(35,mK,6,6,"div",8)(36,hK,6,6,"div",8),t.ɵɵpipe(37,"withReportStrategy"),t.ɵɵelementEnd()(),t.ɵɵelementStart(38,"div",17)(39,"button",18),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"button",19),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,12,"gateway.add-connector")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLinkId()),t.ɵɵadvance(11),t.ɵɵrepeater(n.connectorTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorForm.get("name").hasError("required")&&n.connectorForm.get("name").touched||n.connectorForm.get("name").hasError("duplicateName")?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.connectorForm.get("type").value===n.connectorType.CUSTOM?26:-1),t.ɵɵadvance(),t.ɵɵconditional(n.connectorForm.get("type").value===n.connectorType.GRPC?27:-1),t.ɵɵadvance(6),t.ɵɵrepeater(n.gatewayLogLevel),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorForm.get("type").value!==n.connectorType.GRPC&&n.connectorForm.get("type").value!==n.connectorType.CUSTOM?35:-1),t.ɵɵadvance(),t.ɵɵconditional(n.connectorForm.get("type").value!==n.connectorType.MQTT||t.ɵɵpipeBind2(37,16,n.data.gatewayVersion,n.connectorType.MQTT)?-1:36),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(41,19,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.connectorForm.invalid||!n.connectorForm.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(44,21,"action.add")," "))},dependencies:t.ɵɵgetComponentDepsFactory(gK,[T,lr]),styles:['@charset "UTF-8";[_nghost-%COMP%] .add-connector[_ngcontent-%COMP%]{min-width:400px;width:500px}']})}}e("AddConnectorDialogComponent",gK);const fK=()=>({maxWidth:"970px"});function yK(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1,"gateway.device-info.source"),t.ɵɵelementEnd())}function vK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",18),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function xK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"mat-form-field",16)(2,"mat-select",17),t.ɵɵrepeaterCreate(3,vK,3,4,"mat-option",18,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵrepeater(e.sourceTypes)}}function bK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",13),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-info.device-name-expression-required"))}function wK(e,n){if(1&e&&(t.ɵɵelement(0,"div",14),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,e.connectorType,"name-field",e.mappingFormGroup.get("deviceNameExpressionSource").value,e.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,fK))}}function SK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",18),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function CK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"mat-form-field",16)(2,"mat-select",20),t.ɵɵrepeaterCreate(3,SK,3,4,"mat-option",18,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵrepeater(e.sourceTypes)}}function _K(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",13),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-info.device-profile-expression-required"))}function TK(e,n){if(1&e&&(t.ɵɵelement(0,"div",14),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,fK))}}function EK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",15)(1,"div",8),t.ɵɵtext(2,"gateway.device-info.profile-name"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,CK,5,0,"div",9),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11),t.ɵɵelement(6,"input",19),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,_K,3,3,"mat-icon",13)(9,TK,2,8,"div",14),t.ɵɵpipe(10,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵconditional(e.useSource?3:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("deviceProfileExpression").hasError("required")&&e.mappingFormGroup.get("deviceProfileExpression").touched?8:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(10,6,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType)?9:-1)}}class IK extends W{get deviceInfoType(){return this.deviceInfoTypeValue}set deviceInfoType(e){this.deviceInfoTypeValue!==e&&(this.deviceInfoTypeValue=e)}constructor(e,t,n,i){super(e),this.store=e,this.translate=t,this.dialog=n,this.fb=i,this.SourceTypeTranslationsMap=Yi,this.DeviceInfoType=ka,this.useSource=!0,this.required=!1,this.connectorType=yt.MQTT,this.sourceTypes=Object.values(mi),this.destroy$=new Ie,this.propagateChange=e=>{}}ngOnInit(){this.mappingFormGroup=this.fb.group({deviceNameExpression:["",this.required?[xe.required,xe.pattern(fn)]:[xe.pattern(fn)]]}),this.useSource&&this.mappingFormGroup.addControl("deviceNameExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.deviceInfoType===ka.FULL&&(this.useSource&&this.mappingFormGroup.addControl("deviceProfileExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.mappingFormGroup.addControl("deviceProfileExpression",this.fb.control("",this.required?[xe.required,xe.pattern(fn)]:[xe.pattern(fn)]))),this.mappingFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.updateView(e)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){this.mappingFormGroup.patchValue(e,{emitEvent:!1})}validate(){return this.mappingFormGroup.valid?null:{mappingForm:{valid:!1}}}updateView(e){this.propagateChange(e)}static{this.ɵfac=function(e){return new(e||IK)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(he.TranslateService),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:IK,selectors:[["tb-device-info-table"]],inputs:{useSource:"useSource",required:"required",connectorType:"connectorType",convertorType:"convertorType",sourceTypes:"sourceTypes",deviceInfoType:"deviceInfoType"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>IK)),multi:!0},{provide:be,useExisting:c((()=>IK)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:23,vars:18,consts:[[1,"tb-form-panel","stroked",3,"formGroup"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-table","no-padding","no-gap"],[1,"tb-form-table-header"],["translate","",1,"tb-form-table-header-cell","w-1/5"],["translate","",1,"tb-form-table-header-cell","w-1/2"],[1,"tb-form-table-body","no-gap"],[1,"tb-form-table-row","tb-form-row","no-border","same-padding","pt-4"],["translate","",1,"tb-required","w-1/5"],[1,"no-gap","w-1/5"],[1,"tb-form-table-row-cell","tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","deviceNameExpression",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-form-table-row","tb-form-row","no-border","same-padding","pb-4"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","!w-full"],["formControlName","deviceNameExpressionSource"],[3,"value"],["matInput","","name","value","formControlName","deviceProfileExpression",3,"placeholder"],["formControlName","deviceProfileExpressionSource"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2,"device.device"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",2)(4,"div",3)(5,"div",4),t.ɵɵtext(6,"gateway.device-info.entity-field"),t.ɵɵelementEnd(),t.ɵɵtemplate(7,yK,2,0,"div",4),t.ɵɵelementStart(8,"div",5),t.ɵɵtext(9," gateway.device-info.expression "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8),t.ɵɵtext(13,"gateway.device-info.name"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,xK,5,0,"div",9),t.ɵɵelementStart(15,"div",10)(16,"mat-form-field",11),t.ɵɵelement(17,"input",12),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,bK,3,3,"mat-icon",13)(20,wK,2,8,"div",14),t.ɵɵpipe(21,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(22,EK,11,11,"div",15),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(),t.ɵɵclassProp("tb-required",n.required),t.ɵɵadvance(6),t.ɵɵconditional(n.useSource?7:-1),t.ɵɵadvance(4),t.ɵɵclassProp("pb-4",n.deviceInfoType!==n.DeviceInfoType.FULL),t.ɵɵadvance(3),t.ɵɵconditional(n.useSource?14:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(18,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.mappingFormGroup.get("deviceNameExpression").hasError("required")&&n.mappingFormGroup.get("deviceNameExpression").touched?19:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(21,13,n.connectorType,"name-field",n.mappingFormGroup.get("deviceNameExpressionSource").value,n.convertorType)?20:-1),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceInfoType===n.DeviceInfoType.FULL?22:-1))},dependencies:t.ɵɵgetComponentDepsFactory(IK,[T,sK]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:d.OnPush})}}Ze([I()],IK.prototype,"useSource",void 0),Ze([I()],IK.prototype,"required",void 0);const MK=()=>({maxWidth:"970px"});function kK(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",7),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵproperty("svgIcon",null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.icon)}}function PK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",17),t.ɵɵelement(1,"mat-icon",18),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){let e,i;const a=n.$implicit,r=t.ɵɵnextContext(2);t.ɵɵproperty("value",a),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("svgIcon",null==(e=r.valueTypes.get(a))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,null==(i=r.valueTypes.get(a))?null:i.name))}}function DK(e,n){if(1&e&&t.ɵɵrepeaterCreate(0,PK,5,5,"mat-option",17,t.ɵɵrepeaterTrackByIdentity),2&e){const e=t.ɵɵnextContext();t.ɵɵrepeater(e.valueTypeKeys)}}function AK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",8)(1,"span"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.raw")))}function OK(e,n){1&e&&(t.ɵɵelement(0,"input",10),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function RK(e,n){1&e&&(t.ɵɵelement(0,"input",11),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function BK(e,n){1&e&&(t.ɵɵelement(0,"input",12),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function FK(e,n){1&e&&(t.ɵɵelement(0,"input",13),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function NK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",14)(1,"mat-option",17),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",17),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function LK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",15),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function VK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",19),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tb-help-popup",e.helpLink)("tb-help-popup-style",t.ɵɵpureFunction0(2,MK))}}class qK{constructor(e){this.fb=e,this.valueTypeKeys=Object.values(ln),this.valueTypes=pn,this.MappingValueType=ln,this.destroy$=new Ie,this.onChange=e=>{},this.valueTypeFormGroup=this.fb.group({type:[ln.STRING],stringValue:[{value:"",disabled:this.rawData},[xe.required,xe.pattern(fn)]],integerValue:[{value:0,disabled:!0},[xe.required,xe.pattern(yn)]],doubleValue:[{value:0,disabled:!0},[xe.required]],booleanValue:[{value:!1,disabled:!0},[xe.required]],rawValue:[{value:"",disabled:!this.rawData},[xe.required,xe.pattern(fn)]]}),this.valueTypeFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((({type:e,...t})=>{this.onChange({type:e,value:t[e+"Value"]})})),this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}observeTypeChange(){this.valueTypeFormGroup.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.toggleTypeInputs(e)))}toggleTypeInputs(e){this.valueTypeFormGroup.disable({emitEvent:!1}),this.valueTypeFormGroup.get("type").enable({emitEvent:!1}),this.valueTypeFormGroup.get(e+"Value").enable({emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){const t=this.getValueType(e?.value),n={stringValue:"",rawValue:"",integerValue:0,doubleValue:0,booleanValue:!1,type:t};n[t+"Value"]=e?.value,this.toggleTypeInputs(t),this.valueTypeFormGroup.patchValue(n,{emitEvent:!1})}validate(){return this.valueTypeFormGroup.valid?null:{valueTypeFormGroup:{valid:!1}}}getValueType(e){if(this.rawData)return"raw";switch(typeof e){case"boolean":return ln.BOOLEAN;case"number":return Number.isInteger(e)?ln.INTEGER:ln.DOUBLE;default:return ln.STRING}}static{this.ɵfac=function(e){return new(e||qK)(t.ɵɵdirectiveInject(ye.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:qK,selectors:[["tb-type-value-field"]],inputs:{rawData:"rawData",helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>qK)),multi:!0},{provide:be,useExisting:c((()=>qK)),multi:!0}]),t.ɵɵStandaloneFeature],decls:27,vars:11,consts:[[3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],["value","raw"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex","tb-suffix-absolute"],["matInput","","required","","formControlName","stringValue",3,"placeholder"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder"],["matInput","","required","","formControlName","rawValue",3,"placeholder"],["formControlName","booleanValue"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"click","tb-help-popup","tb-help-popup-style"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3)(5,"mat-form-field",4)(6,"mat-select",5)(7,"mat-select-trigger")(8,"div",6),t.ɵɵtemplate(9,kK,1,1,"mat-icon",7),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(14,DK,2,0)(15,AK,4,3,"mat-option",8),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(16,"div",1)(17,"div",2),t.ɵɵtext(18,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",9),t.ɵɵtemplate(20,OK,2,3,"input",10)(21,RK,2,3,"input",11)(22,BK,2,3,"input",12)(23,FK,2,3,"input",13)(24,NK,5,2,"mat-select",14)(25,LK,3,3,"mat-icon",15)(26,VK,1,3,"div",16),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){let e,i,a;t.ɵɵproperty("formGroup",n.valueTypeFormGroup),t.ɵɵadvance(9),t.ɵɵconditional(n.rawData?-1:9),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,7,null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.name)||t.ɵɵpipeBind1(13,9,"gateway.raw")),t.ɵɵadvance(3),t.ɵɵconditional(n.rawData?15:14),t.ɵɵadvance(6),t.ɵɵconditional((i=n.valueTypeFormGroup.get("type").value)===n.MappingValueType.STRING?20:i===n.MappingValueType.INTEGER?21:i===n.MappingValueType.DOUBLE?22:"raw"===i?23:i===n.MappingValueType.BOOLEAN?24:-1),t.ɵɵadvance(5),t.ɵɵconditional(null!=(a=n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value))&&a.hasError("required")&&n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value).touched?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.helpLink?26:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(qK,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%]{gap:16px;display:grid;width:100%}']})}}function GK(e,n){if(1&e&&t.ɵɵelement(0,"tb-type-value-field",12),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("helpLink",e.helpLink)}}function zK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",4)(1,"div",5),t.ɵɵelementContainerStart(2,6),t.ɵɵelementStart(3,"mat-expansion-panel",7)(4,"mat-expansion-panel-header",8)(5,"mat-panel-title")(6,"div",9),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,GK,1,1,"ng-template",10),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",11),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e;const i=n.$implicit,a=n.$index,r=n.$count;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i),t.ɵɵadvance(),t.ɵɵproperty("expanded",a===r-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate(null!==(e=null==(e=i.get("typeValue").value)?null:e.value)&&void 0!==e?e:""),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,"gateway.delete-argument"))}}function UK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1),t.ɵɵrepeaterCreate(1,zK,13,6,"div",4,t.ɵɵcomponentInstance().trackByKey,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.valueListFormArray.controls)}}function jK(e,n){1&e&&(t.ɵɵelementStart(0,"div",2)(1,"span",13),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate("gateway.no-value"))}Ze([I()],qK.prototype,"rawData",void 0);class HK{constructor(e){this.fb=e,this.destroy$=new Ie,this.onChange=e=>{}}ngOnInit(){this.valueListFormArray=this.fb.array([]),this.valueListFormArray.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e.map((({typeValue:e})=>({...e}))))}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}trackByKey(e,t){return t}addKey(){const e=this.fb.group({typeValue:[]});this.valueListFormArray.push(e)}deleteKey(e,t){e&&e.stopPropagation(),this.valueListFormArray.removeAt(t),this.valueListFormArray.markAsDirty()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){for(const t of e){const e={typeValue:[t]},n=this.fb.group(e);this.valueListFormArray.push(n)}}validate(){return this.valueListFormArray.valid?null:{valueListForm:{valid:!1}}}static{this.ɵfac=function(e){return new(e||HK)(t.ɵɵdirectiveInject(ye.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:HK,selectors:[["tb-type-value-panel"]],inputs:{helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>HK)),multi:!0},{provide:be,useExisting:c((()=>HK)),multi:!0}]),t.ɵɵStandaloneFeature],decls:7,vars:4,consts:[[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["formControlName","typeValue",3,"helpLink"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0),t.ɵɵtemplate(1,UK,3,0,"div",1)(2,jK,3,1,"div",2),t.ɵɵelementStart(3,"div")(4,"button",3),t.ɵɵlistener("click",(function(){return n.addKey()})),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(),t.ɵɵconditional(n.valueListFormArray.controls.length?1:2),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,2,"gateway.add-value")," "))},dependencies:t.ɵɵgetComponentDepsFactory(HK,[T,qK]),styles:['@charset "UTF-8";[_nghost-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw}[_nghost-%COMP%] .key-panel[_ngcontent-%COMP%]{height:250px;overflow:auto}[_nghost-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}const WK=()=>({maxWidth:"970px"});function $K(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵtext(1),t.ɵɵelementEnd(),t.ɵɵtext(2)),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," "),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",":","  ")}}function KK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function YK(e,n){if(1&e&&(t.ɵɵelement(0,"div",25),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext(3).$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,n.connectorType,n.keysType,e.get("type").value,n.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,WK))}}function XK(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",35),2&e){let e;const n=t.ɵɵnextContext(4).$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("svgIcon",null==(e=i.valueTypes.get(n.get("type").value))?null:e.icon)}}function ZK(e,n){if(1&e&&(t.ɵɵelementStart(0,"span"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){let e;const n=t.ɵɵnextContext(4).$implicit,i=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,null!==(e=null==(e=i.valueTypes.get(n.get("type").value))?null:e.name)&&void 0!==e?e:i.valueTypes.get(n.get("type").value))," ")}}function QK(e,n){1&e&&(t.ɵɵelementStart(0,"span"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.raw")))}function JK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-select-trigger")(1,"div",34),t.ɵɵtemplate(2,XK,1,1,"mat-icon",35)(3,ZK,3,3,"span")(4,QK,3,3,"span"),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵnextContext(3).$implicit,i=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵconditional(null!=(e=i.valueTypes.get(n.get("type").value))&&e.icon?2:-1),t.ɵɵadvance(),t.ɵɵconditional(i.rawData?4:3)}}function eY(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",36),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(6);t.ɵɵpropertyInterpolate("svgIcon",n.valueTypes.get(e).icon)}}function tY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",30),t.ɵɵtemplate(1,eY,1,1,"mat-icon",36),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){let e,i;const a=n.$implicit,r=t.ɵɵnextContext(6);t.ɵɵproperty("value",a),t.ɵɵadvance(),t.ɵɵconditional(null!=(e=r.valueTypes.get(a))&&e.icon?1:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,3,null!==(i=null==(i=r.valueTypes.get(a))?null:i.name)&&void 0!==i?i:r.valueTypes.get(a))," ")}}function nY(e,n){if(1&e&&t.ɵɵrepeaterCreate(0,tY,5,5,"mat-option",30,t.ɵɵrepeaterTrackByIdentity),2&e){const e=t.ɵɵnextContext(5);t.ɵɵrepeater(e.valueTypeKeys)}}function iY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",30)(1,"span"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("value","raw"),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.raw")))}function aY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function rY(e,n){if(1&e&&(t.ɵɵelement(0,"div",25),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext(3).$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,n.connectorType,n.keysType,e.get("type").value,n.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,WK))}}function oY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",18)(2,"div",19),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",20)(5,"div",21),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",22),t.ɵɵelement(10,"input",23),t.ɵɵpipe(11,"translate"),t.ɵɵtemplate(12,KK,3,3,"mat-icon",24)(13,YK,2,8,"div",25),t.ɵɵpipe(14,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",18)(16,"div",19),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",26)(19,"div",27),t.ɵɵtext(20,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",28)(22,"mat-select",29),t.ɵɵtemplate(23,JK,5,2,"mat-select-trigger")(24,nY,2,0)(25,iY,4,4,"mat-option",30),t.ɵɵelementEnd()()(),t.ɵɵelementStart(26,"div",31)(27,"div",21),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29),t.ɵɵpipe(30,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",32),t.ɵɵelement(32,"input",33),t.ɵɵpipe(33,"translate"),t.ɵɵtemplate(34,aY,3,3,"mat-icon",24)(35,rY,2,8,"div",25),t.ɵɵpipe(36,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,12,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,14,"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(11,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?12:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(14,18,n.connectorType,n.keysType,e.get("type").value,n.convertorType)?13:-1),t.ɵɵadvance(10),t.ɵɵconditional(n.rawData?-1:23),t.ɵɵadvance(),t.ɵɵconditional(n.rawData?25:24),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(28,23,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(30,25,"gateway.value")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,27,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?34:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(36,29,n.connectorType,n.keysType,e.get("type").value,n.convertorType)?35:-1)}}function sY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function lY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function pY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",20)(2,"div",27),t.ɵɵtext(3,"gateway.key"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",22),t.ɵɵelement(5,"input",23),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,sY,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",20)(9,"div",27),t.ɵɵtext(10,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",37),t.ɵɵelement(12,"input",33),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,lY,3,3,"mat-icon",24),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?7:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?14:-1)}}function cY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function dY(e,n){1&e&&t.ɵɵelement(0,"tb-type-value-panel",42)}function uY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",20)(2,"div",21),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",22),t.ɵɵelement(7,"input",38),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,cY,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",10)(11,"mat-expansion-panel",39)(12,"mat-expansion-panel-header",40)(13,"mat-panel-title")(14,"div",41),t.ɵɵpipe(15,"translate"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(18,dY,1,0,"ng-template",15),t.ɵɵelementEnd()()()),2&e){let e;const n=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,7,"gateway.hints.method-name")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,9,"gateway.method-name")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.get("method").hasError("required")&&n.get("method").touched?9:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(15,13,"gateway.hints.arguments")),t.ɵɵadvance(2),t.ɵɵtextInterpolate2(" ",t.ɵɵpipeBind1(17,15,"gateway.arguments"),""," ("+(null==(e=n.get("arguments").value)?null:e.length)+")"," ")}}function mY(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",17),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function hY(e,n){if(1&e&&t.ɵɵtemplate(0,oY,37,34,"div",1)(1,pY,15,8,"div",1)(2,uY,19,17,"div",1)(3,mY,1,2,"tb-report-strategy",17),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(e.keysType!==e.MappingKeysType.CUSTOM&&e.keysType!==e.MappingKeysType.RPC_METHODS?0:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.MappingKeysType.CUSTOM?1:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.MappingKeysType.RPC_METHODS?2:-1),t.ɵɵadvance(),t.ɵɵconditional(!e.withReportStrategy||e.keysType!==e.MappingKeysType.ATTRIBUTES&&e.keysType!==e.MappingKeysType.TIMESERIES?-1:3)}}function gY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header",13)(5,"mat-panel-title"),t.ɵɵtemplate(6,$K,3,2),t.ɵɵelementStart(7,"div",14),t.ɵɵtext(8),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,hY,4,4,"ng-template",15),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",16),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(3),t.ɵɵconditional(r.keysType!==r.MappingKeysType.RPC_METHODS?6:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate(r.valueTitle(e)),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function fY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,gY,14,7,"div",9,t.ɵɵcomponentInstance().trackByKey,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function yY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",43),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class vY extends W{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.valueTypeEnum=ln,this.valueTypes=pn,this.valueTypeKeys=Object.values(ln),this.rawData=!1,this.withReportStrategy=!0,this.keysDataApplied=new u,this.MappingKeysType=Xi,this.ReportStrategyDefaultValue=mn,this.ConnectorType=yt,this.errorText=""}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===Xi.RPC_METHODS?this.fb.group({method:["",[xe.required]],arguments:[[],[]]}):this.keysType===Xi.CUSTOM?this.fb.group({key:["",[xe.required,xe.pattern(fn)]],value:["",[xe.required,xe.pattern(fn)]]}):this.fb.group({key:["",[xe.required,xe.pattern(fn)]],type:[this.rawData?"raw":this.valueTypeKeys[0]],value:["",[xe.required,xe.pattern(fn)]],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]}),this.keysListFormArray.push(e)}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){let e=this.keysListFormArray.value.map((({reportStrategy:e,...t})=>({...t,...e&&{reportStrategy:e}})));if(this.keysType===Xi.CUSTOM){e={};for(let t of this.keysListFormArray.value)e[t.key]=t.value}this.keysDataApplied.emit(e)}prepareKeysFormArray(e){const t=[];return e&&(this.keysType===Xi.CUSTOM&&(e=Object.keys(e).map((t=>({key:t,value:e[t],type:""})))),e.forEach((e=>{let n;if(this.keysType===Xi.RPC_METHODS)n=this.fb.group({method:[e.method,[xe.required]],arguments:[[...e.arguments],[]]});else if(this.keysType===Xi.CUSTOM){const{key:t,value:i}=e;n=this.fb.group({key:[t,[xe.required,xe.pattern(fn)]],value:[i,[xe.required,xe.pattern(fn)]]})}else{const{key:t,value:i,type:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[xe.required,xe.pattern(fn)]],type:[a],value:[i,[xe.required,xe.pattern(fn)]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)}))),this.fb.array(t)}valueTitle(e){const t=this.keysType===Xi.RPC_METHODS?e.get("method").value:e.get("value").value;return re(t)?"object"==typeof t?JSON.stringify(t):t:""}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===Xi.ATTRIBUTES||this.keysType===Xi.TIMESERIES))}static{this.ɵfac=function(e){return new(e||vY)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(ct.TbPopoverComponent),t.ɵɵdirectiveInject(nt.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:vY,selectors:[["tb-mapping-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",connectorType:"connectorType",convertorType:"convertorType",sourceType:"sourceType",valueTypeEnum:"valueTypeEnum",valueTypes:"valueTypes",valueTypeKeys:"valueTypeKeys",rawData:"rawData",withReportStrategy:"withReportStrategy"},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:18,vars:15,consts:[[1,"tb-mapping-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex","flex-row","flex-wrap"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[3,"value"],[1,"tb-form-row","column-xs","flex","items-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"no-gap","flex","flex-1"],["matInput","","required","","formControlName","value",3,"placeholder"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],[1,"tb-mat-20",3,"svgIcon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],["matInput","","name","value","formControlName","method",3,"placeholder"],[1,"tb-settings"],[1,"flex","flex-wrap"],[1,"title-container",3,"tb-hint-tooltip-icon"],["formControlName","arguments"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,fY,3,0,"div",3)(6,yY,3,1,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",(function(){return n.addKey()})),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",(function(){return n.applyKeysData()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(vY,[T,pi,HK,sK]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:500px;overflow:auto}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] tb-value-input[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}Ze([I()],vY.prototype,"rawData",void 0),Ze([I()],vY.prototype,"withReportStrategy",void 0);const xY=()=>({maxWidth:"970px"}),bY=(e,t)=>[e,t];function wY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function SY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.QualityTranslationsMap.get(e))," ")}}function CY(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.ConvertorTypeTranslationsMap.get(e))," ")}}function _Y(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("convertorType",e.ConvertorTypeEnum.JSON)("deviceInfoType",e.DeviceInfoType.FULL)}}function TY(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",38),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)("convertorType",e.ConvertorTypeEnum.BYTES)("sourceTypes",t.ɵɵpureFunction2(3,bY,e.sourceTypesEnum.MSG,e.sourceTypesEnum.CONST))}}function EY(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",39),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function IY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function MY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function kY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",31)(2,"div",32),t.ɵɵtext(3,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",42)(5,"mat-chip-listbox",43),t.ɵɵrepeaterCreate(6,IY,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(8,"mat-chip",44),t.ɵɵelement(9,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",46,0),t.ɵɵpipe(12,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(11),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(13,"tb-icon",47),t.ɵɵtext(14,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",31)(16,"div",32),t.ɵɵtext(17,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",42)(19,"mat-chip-listbox",43),t.ɵɵrepeaterCreate(20,MY,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(22,"mat-chip",44),t.ɵɵelement(23,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",46,1),t.ɵɵpipe(26,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(25),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(27,"tb-icon",47),t.ɵɵtext(28,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵrepeater(e.converterAttributes),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(12,4,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵrepeater(e.converterTelemetry),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(26,6,"action.edit"))}}function PY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function DY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function AY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",21)(2,"div",48),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",23),t.ɵɵelement(7,"input",49),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,PY,3,3,"mat-icon",40),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",50)(11,"div",35),t.ɵɵtext(12,"gateway.extension-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",15),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",31)(17,"div",32),t.ɵɵtext(18,"gateway.keys"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",42)(20,"mat-chip-listbox",43),t.ɵɵrepeaterCreate(21,DY,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(23,"mat-chip",44),t.ɵɵelement(24,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"button",46,2),t.ɵɵpipe(27,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(26),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.CUSTOM))})),t.ɵɵelementStart(28,"tb-icon",47),t.ɵɵtext(29,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,7,"gateway.extension-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,9,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingForm.get("converter.custom.extension").hasError("required")&&e.mappingForm.get("converter.custom.extension").touched?9:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,13,"gateway.extension-configuration-hint")),t.ɵɵadvance(6),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵrepeater(e.customKeys),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(27,15,"action.edit"))}}function OY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2,"gateway.topic-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",23),t.ɵɵelement(4,"input",24),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,wY,3,3,"mat-icon",25),t.ɵɵelement(7,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",21)(9,"div",27),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23)(14,"mat-select",28),t.ɵɵtemplate(15,SY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(16,30),t.ɵɵelementStart(17,"div",31)(18,"div",32),t.ɵɵtext(19,"gateway.payload-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"tb-toggle-select",33),t.ɵɵtemplate(21,CY,3,4,"tb-toggle-option",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",34)(23,"div",35),t.ɵɵtext(24,"gateway.data-conversion"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"div",15),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(28,36),t.ɵɵtemplate(29,_Y,1,2,"tb-device-info-table",37)(30,TY,1,6,"tb-device-info-table",38)(31,EY,1,2,"tb-report-strategy",39)(32,kY,29,8,"div",14)(33,AY,30,17,"div",14),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.mappingForm.get("topicFilter").hasError("required")&&n.mappingForm.get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(22,xY)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,16,"gateway.response-topic-Qos-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,18,"gateway.mqtt-qos")," "),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.qualityTypes),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.convertorTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,20,n.DataConversionTranslationsMap.get(n.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroupName",n.converterType),t.ɵɵadvance(),t.ɵɵconditional((e=n.converterType)===n.ConvertorTypeEnum.JSON?29:e===n.ConvertorTypeEnum.BYTES?30:-1),t.ɵɵadvance(2),t.ɵɵconditional(n.data.withReportStrategy?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.converterType===n.ConvertorTypeEnum.BYTES||n.converterType===n.ConvertorTypeEnum.JSON?32:-1),t.ɵɵadvance(),t.ɵɵconditional(n.converterType===n.ConvertorTypeEnum.CUSTOM?33:-1)}}function RY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.RequestTypesTranslationsMap.get(e))," ")}}function BY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function FY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2,"gateway.topic-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",23),t.ɵɵelement(4,"input",55),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,BY,3,3,"mat-icon",25),t.ɵɵelement(7,"div",26),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,5,"gateway.set")),t.ɵɵproperty("formControl",e.mappingForm.get("requestValue").get(e.requestMappingType).get("topicFilter")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue").get(e.requestMappingType).get("topicFilter").hasError("required")&&e.mappingForm.get("requestValue").get(e.requestMappingType).get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(7,xY))}}function NY(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",54),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)}}function LY(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",54),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.PARTIAL)}}function VY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function qY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-info.device-name-expression-required"))}function GY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function zY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-name-expression-required"))}function UY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-value-expression-required"))}function jY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-topic-expression-required"))}function HY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",34)(1,"div",56),t.ɵɵtext(2,"gateway.from-device-request-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",57),t.ɵɵtext(4," gateway.from-device-request-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",58)(6,"div",59)(7,"div",60),t.ɵɵtext(8,"gateway.device-info.device-name-expression"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",61)(10,"div",62)(11,"mat-form-field",23)(12,"mat-select",63),t.ɵɵtemplate(13,VY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",64),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,qY,3,3,"mat-icon",25),t.ɵɵelement(18,"div",26),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",21)(20,"div",22),t.ɵɵtext(21,"gateway.attribute-name-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",61)(23,"div",62)(24,"mat-form-field",23)(25,"mat-select",65),t.ɵɵtemplate(26,GY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"mat-form-field",23),t.ɵɵelement(28,"input",66),t.ɵɵpipe(29,"translate"),t.ɵɵtemplate(30,zY,3,3,"mat-icon",25),t.ɵɵelement(31,"div",26),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(32,"div",34)(33,"div",56),t.ɵɵtext(34,"gateway.to-device-response-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"div",57),t.ɵɵtext(36," gateway.to-device-response-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"div",21)(38,"div",22),t.ɵɵtext(39,"gateway.response-value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"mat-form-field",23),t.ɵɵelement(41,"input",67),t.ɵɵpipe(42,"translate"),t.ɵɵtemplate(43,UY,3,3,"mat-icon",25),t.ɵɵelement(44,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"div",21)(46,"div",22),t.ɵɵtext(47,"gateway.response-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(48,"mat-form-field",23),t.ɵɵelement(49,"input",68),t.ɵɵpipe(50,"translate"),t.ɵɵtemplate(51,jY,3,3,"mat-icon",25),t.ɵɵelement(52,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(53,"div",69)(54,"mat-slide-toggle",70)(55,"mat-label",71),t.ɵɵpipe(56,"translate"),t.ɵɵtext(57),t.ɵɵpipe(58,"translate"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(13),t.ɵɵproperty("ngForOf",e.sourceTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,20,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.deviceInfo.deviceNameExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.deviceInfo.deviceNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(32,xY)),t.ɵɵadvance(8),t.ɵɵproperty("ngForOf",e.sourceTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(29,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.attributeNameExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.attributeNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(33,xY)),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(42,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.valueExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.valueExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(34,xY)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(50,26,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.topicExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.topicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(35,xY)),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(56,28,"gateway.retain-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(58,30,"gateway.retain")," ")}}function WY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-filter-required"))}function $Y(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-filter-required"))}function KY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-value-expression-required"))}function YY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-topic-expression-required"))}function XY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",23),t.ɵɵelement(6,"input",72),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,WY,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",48),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",73),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,$Y,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",21)(19,"div",22),t.ɵɵtext(20,"gateway.response-value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",23),t.ɵɵelement(22,"input",67),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,KY,3,3,"mat-icon",25),t.ɵɵelement(25,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"div",21)(27,"div",22),t.ɵɵtext(28,"gateway.response-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",23),t.ɵɵelement(30,"input",68),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,YY,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",69)(35,"mat-slide-toggle",70)(36,"mat-label",71),t.ɵɵpipe(37,"translate"),t.ɵɵtext(38),t.ɵɵpipe(39,"translate"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,18,"gateway.device-name-filter-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,20,"gateway.device-name-filter")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.deviceNameFilter").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.deviceNameFilter").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(11,24,"gateway.attribute-filter-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,26,"gateway.attribute-filter")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.attributeFilter").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.attributeFilter").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(23,30,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.valueExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.valueExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(38,xY)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(31,32,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.topicExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.topicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(39,xY)),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(37,34,"gateway.retain-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(39,36,"gateway.retain")," ")}}function ZY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-filter-required"))}function QY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-filter-required"))}function JY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-topic-expression-required"))}function eX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-expression-required"))}function tX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-topic-expression-required"))}function nX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(4);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.QualityTranslationsMap.get(e))," ")}}function iX(e,n){if(1&e&&t.ɵɵelement(0,"tb-error-icon",81),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("tooltipText",e.responseTimeoutErrorTooltip)}}function aX(e,n){1&e&&(t.ɵɵelementStart(0,"span",82),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function rX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",21)(2,"div",22),t.ɵɵtext(3,"gateway.response-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",23),t.ɵɵelement(5,"input",78),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,tX,3,3,"mat-icon",25),t.ɵɵelement(8,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",27),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23)(15,"mat-select",79),t.ɵɵtemplate(16,nX,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(17,"div",21)(18,"div",22),t.ɵɵtext(19,"gateway.response-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",23),t.ɵɵelement(21,"input",80),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,iX,1,1,"tb-error-icon",81)(24,aX,2,0,"span",82),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.responseTopicExpression").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.responseTopicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(17,xY)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(11,11,"gateway.response-topic-Qos-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,13,"gateway.response-topic-Qos")," "),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.qualityTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").hasError("required")||e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").hasError("min"))&&e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").touched?23:24)}}function oX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",74)(1,"tb-toggle-select",33)(2,"tb-toggle-option",41),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-option",41),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",21)(9,"div",48),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23),t.ɵɵelement(14,"input",72),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,ZY,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",21)(18,"div",48),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",23),t.ɵɵelement(23,"input",75),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,QY,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"div",21)(27,"div",22),t.ɵɵtext(28,"gateway.request-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",23),t.ɵɵelement(30,"input",76),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,JY,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",21)(35,"div",22),t.ɵɵtext(36,"gateway.value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",23),t.ɵɵelement(38,"input",67),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,eX,3,3,"mat-icon",25),t.ɵɵelement(41,"div",26),t.ɵɵelementEnd()(),t.ɵɵtemplate(42,rX,25,18,"ng-container",77)),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("value",e.ServerSideRPCType.TWO_WAY),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,21,"gateway.with-response")," "),t.ɵɵadvance(2),t.ɵɵproperty("value",e.ServerSideRPCType.ONE_WAY),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,23,"gateway.without-response")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,25,"gateway.device-name-filter-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,27,"gateway.device-name-filter")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,29,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.deviceNameFilter").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.deviceNameFilter").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(19,31,"gateway.method-filter-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,33,"gateway.method-filter")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,35,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.methodFilter").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.methodFilter").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(31,37,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.requestTopicExpression").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.requestTopicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(41,xY)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(39,39,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.valueExpression").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.valueExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(42,xY)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.type").value===e.ServerSideRPCType.TWO_WAY)}}function sX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",32),t.ɵɵtext(2,"gateway.request-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",23)(4,"mat-select",51),t.ɵɵtemplate(5,RY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(6,52)(7,53),t.ɵɵtemplate(8,FY,8,8,"div",21)(9,NY,1,1,"tb-device-info-table",54)(10,LY,1,1,"tb-device-info-table",54)(11,HY,59,36)(12,XY,40,40)(13,oX,43,43),t.ɵɵelementContainerEnd()()),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.requestTypes),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.mappingForm.get("requestValue").get(n.requestMappingType)),t.ɵɵadvance(),t.ɵɵconditional(n.requestMappingType===n.RequestTypeEnum.ATTRIBUTE_REQUEST||n.requestMappingType===n.RequestTypeEnum.CONNECT_REQUEST||n.requestMappingType===n.RequestTypeEnum.DISCONNECT_REQUEST?8:-1),t.ɵɵadvance(),t.ɵɵconditional((e=n.requestMappingType)===n.RequestTypeEnum.CONNECT_REQUEST?9:e===n.RequestTypeEnum.DISCONNECT_REQUEST?10:e===n.RequestTypeEnum.ATTRIBUTE_REQUEST?11:e===n.RequestTypeEnum.ATTRIBUTE_UPDATE?12:e===n.RequestTypeEnum.SERVER_SIDE_RPC?13:-1)}}function lX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function pX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-node-required"))}function cX(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",39),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function dX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function uX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function mX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function hX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function gX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",83)(1,"div",84)(2,"div",85),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",86)(7,"mat-form-field",87)(8,"mat-select",88),t.ɵɵtemplate(9,lX,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"mat-form-field",87),t.ɵɵelement(11,"input",89),t.ɵɵpipe(12,"translate"),t.ɵɵtemplate(13,pX,3,3,"mat-icon",25),t.ɵɵelement(14,"div",26),t.ɵɵpipe(15,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()(),t.ɵɵelement(16,"tb-device-info-table",90),t.ɵɵtemplate(17,cX,1,2,"tb-report-strategy",39),t.ɵɵelementStart(18,"div",31)(19,"div",32),t.ɵɵtext(20,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",42)(22,"mat-chip-listbox",43),t.ɵɵtemplate(23,dX,2,1,"mat-chip",91),t.ɵɵelementStart(24,"mat-chip",44),t.ɵɵelement(25,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",46,3),t.ɵɵpipe(28,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(27),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(29,"tb-icon",47),t.ɵɵtext(30,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(31,"div",31)(32,"div",32),t.ɵɵtext(33,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"div",42)(35,"mat-chip-listbox",43),t.ɵɵtemplate(36,uX,2,1,"mat-chip",91),t.ɵɵelementStart(37,"mat-chip",44),t.ɵɵelement(38,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"button",46,4),t.ɵɵpipe(41,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(40),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(42,"tb-icon",47),t.ɵɵtext(43,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(44,"div",31)(45,"div",32),t.ɵɵtext(46,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(47,"div",42)(48,"mat-chip-listbox",43),t.ɵɵtemplate(49,mX,2,1,"mat-chip",91),t.ɵɵelementStart(50,"mat-chip",44),t.ɵɵelement(51,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"button",46,5),t.ɵɵpipe(54,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(53),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(55,"tb-icon",47),t.ɵɵtext(56,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(57,"div",31)(58,"div",32),t.ɵɵtext(59,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(60,"div",42)(61,"mat-chip-listbox",43),t.ɵɵtemplate(62,hX,2,1,"mat-chip",91),t.ɵɵelementStart(63,"mat-chip",44),t.ɵɵelement(64,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(65,"button",46,6),t.ɵɵpipe(67,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(66),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.RPC_METHODS))})),t.ɵɵelementStart(68,"tb-icon",47),t.ɵɵtext(69,"edit"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,23,"gateway.device-node-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,25,"gateway.device-node")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",t.ɵɵpureFunction2(41,bY,e.OPCUaSourceTypesEnum.PATH,e.OPCUaSourceTypesEnum.IDENTIFIER)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(12,27,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("deviceNodePattern").hasError("required")&&e.mappingForm.get("deviceNodePattern").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind3(15,29,e.ConnectorType.OPCUA,"device-node",e.mappingForm.get("deviceNodeSource").value))("tb-help-popup-style",t.ɵɵpureFunction0(44,xY)),t.ɵɵadvance(2),t.ɵɵproperty("connectorType",e.ConnectorType.OPCUA)("sourceTypes",e.OPCUaSourceTypes)("deviceInfoType",e.DeviceInfoType.FULL),t.ɵɵadvance(),t.ɵɵconditional(e.data.withReportStrategy?17:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.opcAttributes),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcAttributes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,33,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.opcTelemetry),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcTelemetry),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(41,35,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.opcAttributesUpdates),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcAttributesUpdates),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(54,37,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.opcRpcMethods),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcRpcMethods),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(67,39,"action.edit"))}}class fX extends O{constructor(e,t,n,i,a,r,o,s,l){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.translate=l,this.MappingType=ji,this.qualityTypes=ta,this.QualityTranslationsMap=gi,this.convertorTypes=Object.values(ui),this.ConvertorTypeEnum=ui,this.ConvertorTypeTranslationsMap=fi,this.sourceTypes=Object.values(mi),this.OPCUaSourceTypes=Object.values(Gi),this.OPCUaSourceTypesEnum=Gi,this.sourceTypesEnum=mi,this.SourceTypeTranslationsMap=Yi,this.requestTypes=Object.values(yi),this.RequestTypeEnum=yi,this.RequestTypesTranslationsMap=vi,this.DeviceInfoType=ka,this.ServerSideRPCType=ra,this.MappingKeysType=Xi,this.MappingHintTranslationsMap=aa,this.MappingTypeTranslationsMap=Hi,this.DataConversionTranslationsMap=xi,this.HelpLinkByMappingTypeMap=ia,this.ConnectorType=yt,this.ReportStrategyDefaultValue=mn,this.keysPopupClosed=!0,this.destroy$=new Ie,this.createMappingForm()}get converterAttributes(){if(this.converterType)return this.mappingForm.get("converter").get(this.converterType).value.attributes.map((e=>e.key))}get converterTelemetry(){if(this.converterType)return this.mappingForm.get("converter").get(this.converterType).value.timeseries.map((e=>e.key))}get opcAttributes(){return this.mappingForm.get("attributes").value?.map((e=>e.key))||[]}get opcTelemetry(){return this.mappingForm.get("timeseries").value?.map((e=>e.key))||[]}get opcRpcMethods(){return this.mappingForm.get("rpc_methods").value?.map((e=>e.method))||[]}get opcAttributesUpdates(){return this.mappingForm.get("attributes_updates")?.value?.map((e=>e.key))||[]}get converterType(){return this.mappingForm.get("converter")?.get("type").value}get customKeys(){return Object.keys(this.mappingForm.get("converter").get("custom").value.extensionConfig)}get requestMappingType(){return this.mappingForm.get("requestType").value}get responseTimeoutErrorTooltip(){const e=this.mappingForm.get("requestValue.serverSideRpc.responseTimeout");return e.hasError("required")?this.translate.instant("gateway.response-timeout-required"):e.hasError("min")?this.translate.instant("gateway.response-timeout-limits-error",{min:1}):""}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}createMappingForm(){switch(this.data.mappingType){case ji.DATA:this.mappingForm=this.fb.group({}),this.createDataMappingForm();break;case ji.REQUESTS:this.mappingForm=this.fb.group({}),this.createRequestMappingForm();break;case ji.OPCUA:this.createOPCUAMappingForm()}}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){this.mappingForm.valid&&this.dialogRef.close(this.prepareMappingData())}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))this.popoverService.hidePopover(i);else{const e=(this.data.mappingType!==ji.OPCUA?this.mappingForm.get("converter").get(this.converterType):this.mappingForm).get(n),t={keys:e.value,keysType:n,rawData:this.mappingForm.get("converter.type")?.value===ui.BYTES,panelTitle:Zi.get(n),addKeyTitle:Qi.get(n),deleteKeyTitle:Ji.get(n),noKeysText:ea.get(n),withReportStrategy:this.data.withReportStrategy,connectorType:this.data.mappingType===ji.OPCUA?yt.OPCUA:yt.MQTT,convertorType:this.converterType};this.data.mappingType===ji.OPCUA&&(t.valueTypeKeys=Object.values(Gi),t.valueTypeEnum=Gi,t.valueTypes=Yi,t.sourceType=this.mappingForm.get("deviceNodeSource").value),this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,vY,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(Re(this.destroy$)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty()})),this.popoverComponent.tbHideStart.pipe(Re(this.destroy$)).subscribe((()=>{this.keysPopupClosed=!0}))}}prepareMappingData(){const e=this.mappingForm.value;switch(te(e),this.data.mappingType){case ji.DATA:const{converter:t,topicFilter:n,subscriptionQos:i}=e,{reportStrategy:a,...r}=t[t.type];return{topicFilter:n,subscriptionQos:i,...a?{reportStrategy:a}:{},converter:{type:t.type,...r}};case ji.REQUESTS:return{requestType:e.requestType,requestValue:e.requestValue[e.requestType]};default:return e}}getFormValueData(){if(this.data.value&&Object.keys(this.data.value).length)switch(this.data.mappingType){case ji.DATA:const{converter:e,topicFilter:t,subscriptionQos:n,reportStrategy:i}=this.data.value;return{topicFilter:t,subscriptionQos:n,converter:{type:e.type,[e.type]:{...e,...i?{reportStrategy:i}:{}}}};case ji.REQUESTS:return{requestType:this.data.value.requestType,requestValue:{[this.data.value.requestType]:this.data.value.requestValue}};default:return this.data.value}}createDataMappingForm(){this.mappingForm.addControl("topicFilter",this.fb.control("",[xe.required,xe.pattern(fn)])),this.mappingForm.addControl("subscriptionQos",this.fb.control(0)),this.mappingForm.addControl("converter",this.fb.group({type:[ui.JSON,[]],json:this.fb.group({deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),bytes:this.fb.group({deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),custom:this.fb.group({extension:["",[xe.required,xe.pattern(fn)]],extensionConfig:[{},[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})})),this.mappingForm.patchValue(this.getFormValueData()),this.mappingForm.get("converter.type").valueChanges.pipe(We(this.mappingForm.get("converter.type").value),Re(this.destroy$)).subscribe((e=>{const t=this.mappingForm.get("converter");t.get("json").disable({emitEvent:!1}),t.get("bytes").disable({emitEvent:!1}),t.get("custom").disable({emitEvent:!1}),t.get(e).enable({emitEvent:!1})}))}createRequestMappingForm(){this.mappingForm.addControl("requestType",this.fb.control(yi.CONNECT_REQUEST,[])),this.mappingForm.addControl("requestValue",this.fb.group({connectRequests:this.fb.group({topicFilter:["",[xe.required,xe.pattern(fn)]],deviceInfo:[{},[]]}),disconnectRequests:this.fb.group({topicFilter:["",[xe.required,xe.pattern(fn)]],deviceInfo:[{},[]]}),attributeRequests:this.fb.group({topicFilter:["",[xe.required,xe.pattern(fn)]],deviceInfo:this.fb.group({deviceNameExpressionSource:[mi.MSG,[]],deviceNameExpression:["",[xe.required]]}),attributeNameExpressionSource:[mi.MSG,[]],attributeNameExpression:["",[xe.required,xe.pattern(fn)]],topicExpression:["",[xe.required,xe.pattern(fn)]],valueExpression:["",[xe.required,xe.pattern(fn)]],retain:[!1,[]]}),attributeUpdates:this.fb.group({deviceNameFilter:["",[xe.required,xe.pattern(fn)]],attributeFilter:["",[xe.required,xe.pattern(fn)]],topicExpression:["",[xe.required,xe.pattern(fn)]],valueExpression:["",[xe.required,xe.pattern(fn)]],retain:[!0,[]]}),serverSideRpc:this.fb.group({type:[ra.TWO_WAY,[]],deviceNameFilter:["",[xe.required,xe.pattern(fn)]],methodFilter:["",[xe.required,xe.pattern(fn)]],requestTopicExpression:["",[xe.required,xe.pattern(fn)]],responseTopicExpression:["",[xe.required,xe.pattern(fn)]],valueExpression:["",[xe.required,xe.pattern(fn)]],responseTopicQoS:[0,[]],responseTimeout:[1e4,[xe.required,xe.min(1)]]}),reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})),this.mappingForm.get("requestType").valueChanges.pipe(We(this.mappingForm.get("requestType").value),Re(this.destroy$)).subscribe((e=>{const t=this.mappingForm.get("requestValue");t.get("connectRequests").disable({emitEvent:!1}),t.get("disconnectRequests").disable({emitEvent:!1}),t.get("attributeRequests").disable({emitEvent:!1}),t.get("attributeUpdates").disable({emitEvent:!1}),t.get("serverSideRpc").disable({emitEvent:!1}),t.get(e).enable()})),this.mappingForm.get("requestValue.serverSideRpc.type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{const t=this.mappingForm.get("requestValue.serverSideRpc");e===ra.ONE_WAY?(t.get("responseTopicExpression").disable({emitEvent:!1}),t.get("responseTopicQoS").disable({emitEvent:!1}),t.get("responseTimeout").disable({emitEvent:!1})):(t.get("responseTopicExpression").enable({emitEvent:!1}),t.get("responseTopicQoS").enable({emitEvent:!1}),t.get("responseTimeout").enable({emitEvent:!1}))})),this.mappingForm.patchValue(this.getFormValueData())}createOPCUAMappingForm(){this.mappingForm=this.fb.group({deviceNodeSource:[Gi.PATH,[]],deviceNodePattern:["",[xe.required]],deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]],rpc_methods:[[],[]],attributes_updates:[[],[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.mappingForm.patchValue(this.getFormValueData())}static{this.ɵfac=function(e){return new(e||fX)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(dt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(he.TranslateService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:fX,selectors:[["tb-mapping-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:26,vars:19,consts:[["attributesButton",""],["telemetryButton",""],["keysButton",""],["opcAttributesButton",""],["opcTelemetryButton",""],["attributesUpdatesButton",""],["rpcMethodsButton",""],[1,"key-mapping",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-hint","tb-primary-fill"],[3,"ngSwitch"],[3,"ngSwitchCase"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex"],["matInput","","name","value","formControlName","topicFilter",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","subscriptionQos"],[3,"value",4,"ngFor","ngForOf"],["formGroupName","converter"],[1,"tb-form-row","space-between","tb-flex"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[3,"formGroupName"],["formControlName","deviceInfo","required","true",3,"convertorType","deviceInfoType"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","convertorType","sourceTypes"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","extension",3,"placeholder"],[1,"tb-form-row","space-between","same-padding","tb-flex","column"],["formControlName","requestType"],["formGroupName","requestValue"],[3,"formGroup"],["formControlName","deviceInfo","required","true",3,"deviceInfoType"],["matInput","","name","value",3,"formControl","placeholder"],["translate","",1,"tb-form-panel-title","tb-required"],["translate","",1,"tb-form-hint","tb-primary-fill"],["formGroupName","deviceInfo",1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-flex","no-flex","align-center"],["translate","",1,"tb-required"],[1,"flex","flex-1","gap-2"],[1,"flex","w-1/4"],["formControlName","deviceNameExpressionSource"],["matInput","","name","value","formControlName","deviceNameExpression",3,"placeholder"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","valueExpression",3,"placeholder"],["matInput","","name","value","formControlName","topicExpression",3,"placeholder"],[1,"tb-form-row"],["formControlName","retain",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","deviceNameFilter",3,"placeholder"],["matInput","","name","value","formControlName","attributeFilter",3,"placeholder"],[1,"tb-flex","row","center","align-center","no-gap","fill-width"],["matInput","","name","value","formControlName","methodFilter",3,"placeholder"],["matInput","","name","value","formControlName","requestTopicExpression",3,"placeholder"],[4,"ngIf"],["matInput","","name","value","formControlName","responseTopicExpression",3,"placeholder"],["formControlName","responseTopicQoS"],["matInput","","name","value","type","number","min","1","formControlName","responseTimeout",3,"placeholder"],["matSuffix","",3,"tooltipText"],["translate","","matSuffix","",1,"block","pr-2"],[1,"device-node-row","tb-form-row","column-xs","pr-4"],["translate","",1,"tb-flex","no-flex","align-center","w-1/5"],[1,"tb-required",3,"tb-hint-tooltip-icon"],[1,"flex","w-1/5"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","deviceNodeSource"],["matInput","","name","value","formControlName","deviceNodePattern",3,"placeholder"],["formControlName","deviceInfo","required","true",3,"connectorType","sourceTypes","deviceInfoType"],[4,"ngFor","ngForOf"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",7)(1,"mat-toolbar",8)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",9)(6,"div",10),t.ɵɵelementStart(7,"button",11),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵelementStart(8,"mat-icon",12),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",13)(11,"div",14)(12,"div",15),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(15,16),t.ɵɵtemplate(16,OY,34,23,"ng-template",17)(17,sX,14,4,"ng-template",17)(18,gX,70,45,"ng-template",17),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",18)(20,"button",19),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"button",20),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,11,n.MappingTypeTranslationsMap.get(null==n.data?null:n.data.mappingType))),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.HelpLinkByMappingTypeMap.get(n.data.mappingType)),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,13,n.MappingHintTranslationsMap.get(null==n.data?null:n.data.mappingType))," "),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.data.mappingType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingType.DATA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingType.REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingType.OPCUA),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(22,15,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.mappingForm.invalid||!n.mappingForm.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,17,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(fX,[me,T,sK,ei,IK,di,pi]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:grid;height:100%}[_nghost-%COMP%] .key-mapping[_ngcontent-%COMP%]{max-width:900px;display:flex;flex-direction:column}[_nghost-%COMP%] .key-mapping[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{min-height:64px}[_nghost-%COMP%] .key-mapping[_ngcontent-%COMP%] tb-toggle-select[_ngcontent-%COMP%]{padding:4px 0}[_nghost-%COMP%] .mat-mdc-dialog-content[_ngcontent-%COMP%]{height:670px}[_nghost-%COMP%] .ellipsis-chips-container[_ngcontent-%COMP%]{max-width:70%}[_nghost-%COMP%] .key-mapping .mat-mdc-chip-listbox .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center;flex-wrap:nowrap}[_nghost-%COMP%] .tb-form-row .fixed-title-width{min-width:40px;width:35%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-form-row .mat-mdc-form-field{width:0}[_nghost-%COMP%] .device-node-row.tb-form-row{gap:12px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}e("MappingDialogComponent",fX);const yX=["searchInput"],vX=()=>({minWidth:"96px",textAlign:"center"});function xX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",23)(2,"span",24),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",25),t.ɵɵelementStart(6,"button",10),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageMapping(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",10),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,e.mappingTypeTranslationsMap.get(e.mappingType))),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(7,5,"action.add")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,7,"action.search"))}}function bX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext();t.ɵɵclassProp("request-column",n.mappingType===n.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,3,e.title)," ")}}function wX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();t.ɵɵclassProp("request-column",a.mappingType===a.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e[i.def]," ")}}function SX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,13),t.ɵɵtemplate(1,bX,3,5,"mat-header-cell",26)(2,wX,2,3,"mat-cell",27),t.ɵɵelementContainerEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("matColumnDef",e.def)}}function CX(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function _X(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageMapping(n,i))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteMapping(n,i))})),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.edit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(5,4,"action.delete")))}function TX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,_X,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",31),t.ɵɵelementContainer(4,32),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"button",34),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",35),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",36,2),t.ɵɵelementContainer(11,32),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,vX)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function EX(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function IX(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class MX{set mappingType(e){this.mappingTypeValue!==e&&(this.mappingTypeValue=e)}get mappingType(){return this.mappingTypeValue}constructor(e,t,n,i){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=i,this.required=!1,this.withReportStrategy=!0,this.mappingTypeTranslationsMap=Hi,this.mappingTypeEnum=ji,this.displayedColumns=[],this.mappingColumns=[],this.textSearchMode=!1,this.hidePageSize=!1,this.activeValue=!1,this.dirtyValue=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new Ie,this.mappingFormGroup=this.fb.array([]),this.dirtyValue=!this.activeValue,this.dataSource=new kX}ngOnInit(){this.setMappingColumns(),this.displayedColumns.push(...this.mappingColumns.map((e=>e.def)),"actions"),this.mappingFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.updateTableData(e,this.textSearch.value.trim()),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Ne(150),Fe(((e,t)=>(e??"")===t.trim())),Re(this.destroy$)).subscribe((e=>{const t=e.trim();this.updateTableData(this.mappingFormGroup.value,t.trim())}))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){this.mappingFormGroup.clear(),this.pushDataAsFormArrays(e)}validate(){return!this.required||this.mappingFormGroup.controls.length?null:{mappingFormGroup:{valid:!1}}}enterFilterMode(){this.textSearchMode=!0,setTimeout((()=>{this.searchInputField.nativeElement.focus(),this.searchInputField.nativeElement.setSelectionRange(0,0)}),10)}exitFilterMode(){this.updateTableData(this.mappingFormGroup.value),this.textSearchMode=!1,this.textSearch.reset()}manageMapping(e,t){e&&e.stopPropagation();const n=re(t),i=n?this.getMappingIndex(t):-1,a=n?this.mappingFormGroup.at(i).value:{};this.dialog.open(fX,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{mappingType:this.mappingType,value:a,buttonTitle:n?"action.apply":"action.add",withReportStrategy:this.withReportStrategy}}).afterClosed().pipe(Ue(1),Re(this.destroy$)).subscribe((e=>{e&&(n?this.mappingFormGroup.at(i).patchValue(e):this.pushDataAsFormArrays([e]),this.mappingFormGroup.markAsDirty())}))}updateTableData(e,t){let n=e.map((e=>this.getMappingValue(e)));t&&(n=n.filter((e=>Object.values(e).some((e=>e.toString().toLowerCase().includes(t.toLowerCase())))))),this.dataSource.loadData(n)}deleteMapping(e,t){e&&e.stopPropagation();const n=this.getMappingIndex(t),i=this.mappingFormGroup.controls[n].value,a=i.deviceInfo?.deviceNameExpression??i.topicFilter??this.getRequestDetails(i);this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:a}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).subscribe((e=>{e&&(this.mappingFormGroup.removeAt(n),this.mappingFormGroup.markAsDirty())}))}getMappingIndex(e){const t=e.__raw;return this.mappingFormGroup.controls.findIndex((e=>e.value===t))}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.mappingFormGroup.push(this.fb.control(e))))}getMappingValue(e){let t;switch(this.mappingType){case ji.DATA:const n=fi.get(e.converter?.type);t={topicFilter:e.topicFilter,QoS:e.subscriptionQos,converter:n?this.translate.instant(n):""};break;case ji.REQUESTS:t={requestType:e.requestType,type:this.translate.instant(vi.get(e.requestType)),details:this.getRequestDetails(e)};break;case ji.OPCUA:const i=e.deviceInfo?.deviceNameExpression,a=e.deviceInfo?.deviceProfileExpression,{deviceNodePattern:r}=e;t={deviceNodePattern:r,deviceNamePattern:i,deviceProfileExpression:a};break;default:t={}}return Object.defineProperty(t,"__raw",{value:e,enumerable:!1}),t}getRequestDetails(e){let t;return t=e.requestType===yi.ATTRIBUTE_UPDATE?e.requestValue.attributeFilter:e.requestType===yi.SERVER_SIDE_RPC?e.requestValue.methodFilter:e.requestValue.topicFilter,t}setMappingColumns(){switch(this.mappingType){case ji.DATA:this.mappingColumns.push({def:"topicFilter",title:"gateway.topic-filter"},{def:"QoS",title:"gateway.mqtt-qos"},{def:"converter",title:"gateway.payload-type"});break;case ji.REQUESTS:this.mappingColumns.push({def:"type",title:"gateway.type"},{def:"details",title:"gateway.details"});break;case ji.OPCUA:this.mappingColumns.push({def:"deviceNodePattern",title:"gateway.device-node"},{def:"deviceNamePattern",title:"gateway.device-name"},{def:"deviceProfileExpression",title:"gateway.device-profile"})}}static{this.ɵfac=function(e){return new(e||MX)(t.ɵɵdirectiveInject(he.TranslateService),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(ee.DialogService),t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:MX,selectors:[["tb-mapping-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(yX,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{required:"required",withReportStrategy:"withReportStrategy",mappingType:"mappingType"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>MX)),multi:!0},{provide:be,useExisting:c((()=>MX)),multi:!0}]),t.ɵɵStandaloneFeature],decls:41,vars:32,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-mapping-table","tb-absolute-fill"],[1,"tb-mapping-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-mapping-table-title"],[1,"flex-1"],["class","table-value-column",3,"request-column",4,"matHeaderCellDef"],["tbTruncateWithTooltip","","class","table-value-column",3,"request-column",4,"matCellDef"],[1,"table-value-column"],["tbTruncateWithTooltip","",1,"table-value-column"],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵtemplate(3,xX,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",6)(7,"button",7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",9,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵpipe(18,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())})),t.ɵɵelementStart(19,"mat-icon"),t.ɵɵtext(20,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(21,"div",11)(22,"table",12),t.ɵɵrepeaterCreate(23,SX,3,1,"ng-container",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementContainerStart(25,14),t.ɵɵtemplate(26,CX,1,0,"mat-header-cell",15)(27,TX,12,6,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,EX,1,0,"mat-header-row",17)(29,IX,1,0,"mat-row",18),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"section",19),t.ɵɵpipe(31,"async"),t.ɵɵelementStart(32,"button",20),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))})),t.ɵɵelementStart(33,"mat-icon",21),t.ɵɵtext(34,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"span"),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(38,"span",22),t.ɵɵpipe(39,"async"),t.ɵɵtext(40," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,18,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,20,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,22,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,24,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵrepeater(n.mappingColumns),t.ɵɵadvance(5),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(31,26,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,28,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(39,30,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(MX,[me,T,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%]{width:100%;height:100%;background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content.tb-outlined-border[_ngcontent-%COMP%]{box-shadow:0 0 #0003,0 0 #00000024,0 0 #0000001f;border:solid 1px #e0e0e0;border-radius:4px}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .tb-mapping-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:21%}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column.request-column[_ngcontent-%COMP%]{width:35%}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .ellipsis[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width: 599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-mapping-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:d.OnPush})}}e("MappingTableComponent",MX),Ze([I()],MX.prototype,"required",void 0),Ze([I()],MX.prototype,"withReportStrategy",void 0);let kX=class extends ${constructor(){super()}};function PX(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SecurityTypeTranslationsMap.get(e))," ")}}function DX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function AX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"div",6),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",7)(4,"mat-form-field",8),t.ɵɵelement(5,"input",9),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,DX,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",5)(9,"div",11),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",12),t.ɵɵpipe(14,"translate"),t.ɵɵelementStart(15,"div",13),t.ɵɵelement(16,"tb-toggle-password",14),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,3,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched?7:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,5,"gateway.set"))}}function OX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function RX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function BX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"div",11),t.ɵɵtext(2,"gateway.mode"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",7)(4,"mat-form-field",8)(5,"mat-select",20),t.ɵɵrepeaterCreate(6,OX,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(8,"div",5)(9,"div",11),t.ɵɵtext(10,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",9),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,RX,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",5)(17,"div",11),t.ɵɵtext(18,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",7)(20,"mat-form-field",8),t.ɵɵelement(21,"input",12),t.ɵɵpipe(22,"translate"),t.ɵɵelementStart(23,"div",13),t.ɵɵelement(24,"tb-toggle-password",14),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(6),t.ɵɵrepeater(e.modeTypes),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,3,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched?15:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,5,"gateway.set"))}}function FX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",15),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",5)(4,"div",16),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",7)(8,"mat-form-field",8),t.ɵɵelement(9,"input",17),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",5)(12,"div",16),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"div",7)(16,"mat-form-field",8),t.ɵɵelement(17,"input",18),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",5)(20,"div",16),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"div",7)(24,"mat-form-field",8),t.ɵɵelement(25,"input",19),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(27,BX,25,7)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,8,"gateway.path-hint")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,10,"gateway.CA-certificate-path")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(10,12,"gateway.set")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,14,"gateway.private-key-path")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(18,16,"gateway.set")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,18,"gateway.client-cert-path")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,20,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mode()===e.SecurityMode.extendedCertificates?27:-1)}}e("MappingDatasource",kX);class NX{constructor(e,t){this.fb=e,this.cdr=t,this.title="gateway.security",this.mode=l(oa.certificates),this.BrokerSecurityType=zi,this.SecurityMode=oa,this.securityTypes=Object.values(zi),this.modeTypes=Object.values(Ui),this.SecurityTypeTranslationsMap=Ki,this.destroy$=new Ie,o((()=>{this.mode()===oa.basic&&(this.securityTypes=this.securityTypes.filter((e=>e!==zi.CERTIFICATES)))}))}ngOnInit(){this.securityFormGroup=this.fb.group({type:[zi.ANONYMOUS,[]],username:["",[xe.required,xe.pattern(fn)]],password:["",[xe.pattern(fn)]],pathToCACert:["",[xe.pattern(fn)]],pathToPrivateKey:["",[xe.pattern(fn)]],pathToClientCert:["",[xe.pattern(fn)]]}),this.mode()===oa.extendedCertificates&&this.securityFormGroup.addControl("mode",this.fb.control(Ui.NONE,[])),this.securityFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{te(e),this.onChange(e),this.onTouched()})),this.securityFormGroup.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.updateValidators(e)))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){if(e)e.type||(e.type=zi.ANONYMOUS),this.updateValidators(e.type),this.securityFormGroup.reset(e,{emitEvent:!1});else{const e={type:zi.ANONYMOUS};this.securityFormGroup.reset(e,{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.securityFormGroup.get("type").value!==zi.BASIC||this.securityFormGroup.valid?null:{securityForm:{valid:!1}}}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}updateValidators(e){if(e)if(this.securityFormGroup.get("username").disable({emitEvent:!1}),this.securityFormGroup.get("password").disable({emitEvent:!1}),this.securityFormGroup.get("pathToCACert").disable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").disable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").disable({emitEvent:!1}),this.securityFormGroup.get("mode")?.disable({emitEvent:!1}),e===zi.BASIC)this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1});else if(e===zi.CERTIFICATES&&(this.securityFormGroup.get("pathToCACert").enable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").enable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").enable({emitEvent:!1}),this.mode()===oa.extendedCertificates)){const e=this.securityFormGroup.get("mode");e&&!e.value&&e.setValue(Ui.NONE,{emitEvent:!1}),e?.enable({emitEvent:!1}),this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1})}}static{this.ɵfac=function(e){return new(e||NX)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:NX,selectors:[["tb-security-config"]],inputs:{title:"title",mode:[1,"mode"]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>NX)),multi:!0},{provide:be,useExisting:c((()=>NX)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:5,consts:[[1,"tb-form-row","space-between","same-padding","tb-flex","column",3,"formGroup"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],[1,"fixed-title-width","tb-required"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","username",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width"],["matInput","","type","password","name","value","formControlName","password",3,"placeholder"],["matSuffix","",1,"tb-flex","no-gap","align-center","fill-height"],[1,"tb-flex","align-center","fill-height"],[1,"tb-form-hint","tb-primary-fill"],["tbTruncateWithTooltip","",1,"fixed-title-width"],["matInput","","name","value","formControlName","pathToCACert",3,"placeholder"],["matInput","","name","value","formControlName","pathToPrivateKey",3,"placeholder"],["matInput","","name","value","formControlName","pathToClientCert",3,"placeholder"],["formControlName","mode"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵrepeaterCreate(6,PX,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵtemplate(8,AX,17,7)(9,FX,28,22),t.ɵɵelementEnd()),2&e){let e;t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,n.title)),t.ɵɵadvance(3),t.ɵɵrepeater(n.securityTypes),t.ɵɵadvance(2),t.ɵɵconditional((e=n.securityFormGroup.get("type").value)===n.BrokerSecurityType.BASIC?8:e===n.BrokerSecurityType.CERTIFICATES?9:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(NX,[T,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("SecurityConfigComponent",NX);const LX=()=>({min:1e3}),VX=()=>({min:50}),qX=()=>({min:100});function GX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.server-url-required"))}function zX(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",9),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.timeout-error",t.ɵɵpureFunction0(4,LX)))}function UX(e,n){1&e&&(t.ɵɵelementStart(0,"span",10),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function jX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function HX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind2(1,1,"gateway.scan-period-error",t.ɵɵpureFunction0(4,LX)))}function WX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind2(1,1,"gateway.poll-period-error",t.ɵɵpureFunction0(4,VX)))}function $X(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",6),t.ɵɵpipe(2,"translate"),t.ɵɵelementStart(3,"div",7),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"mat-form-field",3),t.ɵɵelement(7,"input",20),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,WX,3,5,"mat-icon",5),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,4,"gateway.hints.poll-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,6,"gateway.poll-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("required")||e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("min"))&&e.serverConfigFormGroup.get("pollPeriodInMillis").touched?9:-1)}}function KX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind2(1,1,"gateway.sub-check-period-error",t.ɵɵpureFunction0(4,qX)))}class YX{constructor(e){this.fb=e,this.hideNewFields=!1,this.securityPolicyTypes=$i,this.SecurityMode=oa,this.destroy$=new Ie,this.serverConfigFormGroup=this.fb.group({url:["",[xe.required,xe.pattern(fn)]],timeoutInMillis:[1e3,[xe.required,xe.min(1e3)]],scanPeriodInMillis:[K,[xe.required,xe.min(1e3)]],pollPeriodInMillis:[5e3,[xe.required,xe.min(50)]],enableSubscriptions:[!0,[]],subCheckPeriodInMillis:[100,[xe.required,xe.min(100)]],showMap:[!1,[]],security:[Wi.BASIC128,[]],identity:[]}),this.serverConfigFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}ngAfterViewInit(){this.hideNewFields&&this.serverConfigFormGroup.get("pollPeriodInMillis").disable({emitEvent:!1})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.serverConfigFormGroup.valid?null:{serverConfigFormGroup:{valid:!1}}}writeValue(e){const{timeoutInMillis:t=1e3,scanPeriodInMillis:n=K,pollPeriodInMillis:i=5e3,enableSubscriptions:a=!0,subCheckPeriodInMillis:r=100,showMap:o=!1,security:s=Wi.BASIC128,identity:l={}}=e;this.serverConfigFormGroup.reset({...e,timeoutInMillis:t,scanPeriodInMillis:n,pollPeriodInMillis:i,enableSubscriptions:a,subCheckPeriodInMillis:r,showMap:o,security:s,identity:l},{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||YX)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:YX,selectors:[["tb-opc-server-config"]],inputs:{hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>YX)),multi:!0},{provide:be,useExisting:c((()=>YX)),multi:!0}]),t.ɵɵStandaloneFeature],decls:64,vars:55,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],["tbTruncateWithTooltip","","translate","",1,"fixed-title-width"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","url",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip",""],["matInput","","type","number","min","1000","name","value","formControlName","timeoutInMillis",3,"placeholder"],["matSuffix","",3,"tooltipText"],["translate","","matSuffix","",1,"block","pr-2"],["formControlName","security"],[3,"value"],["matInput","","type","number","min","1000","name","value","formControlName","scanPeriodInMillis",3,"placeholder"],["matInput","","type","number","min","100","name","value","formControlName","subCheckPeriodInMillis",3,"placeholder"],[1,"tb-form-row"],["formControlName","enableSubscriptions",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","showMap",1,"mat-slide"],["formControlName","identity",3,"mode"],["matInput","","type","number","min","50","name","value","formControlName","pollPeriodInMillis",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.server-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",3),t.ɵɵelement(5,"input",4),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,GX,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",6),t.ɵɵpipe(10,"translate"),t.ɵɵelementStart(11,"div",7),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-form-field",3),t.ɵɵelement(15,"input",8),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,zX,2,5,"tb-error-icon",9)(18,UX,2,0,"span",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",1)(20,"div",6),t.ɵɵpipe(21,"translate"),t.ɵɵelementStart(22,"div",7),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"mat-form-field",3)(26,"mat-select",11),t.ɵɵrepeaterCreate(27,jX,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",1)(30,"div",6),t.ɵɵpipe(31,"translate"),t.ɵɵelementStart(32,"div",7),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(35,"mat-form-field",3),t.ɵɵelement(36,"input",13),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,HX,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵtemplate(39,$X,10,10,"div",1),t.ɵɵelementStart(40,"div",1)(41,"div",6),t.ɵɵpipe(42,"translate"),t.ɵɵelementStart(43,"div",7),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",3),t.ɵɵelement(47,"input",14),t.ɵɵpipe(48,"translate"),t.ɵɵtemplate(49,KX,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(50,"div",15)(51,"mat-slide-toggle",16)(52,"mat-label",17),t.ɵɵpipe(53,"translate"),t.ɵɵelementStart(54,"div",7),t.ɵɵtext(55),t.ɵɵpipe(56,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(57,"div",15)(58,"mat-slide-toggle",18)(59,"mat-label",17),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61),t.ɵɵpipe(62,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelement(63,"tb-security-config",19),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,23,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.serverConfigFormGroup.get("url").hasError("required")&&n.serverConfigFormGroup.get("url").touched?7:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,25,"gateway.hints.opc-timeout")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,27,"gateway.timeout")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,29,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.serverConfigFormGroup.get("timeoutInMillis").hasError("required")||n.serverConfigFormGroup.get("timeoutInMillis").hasError("min"))&&n.serverConfigFormGroup.get("timeoutInMillis").touched?17:18),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,31,"gateway.hints.security-policy")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,33,"gateway.security-policy")),t.ɵɵadvance(4),t.ɵɵrepeater(n.securityPolicyTypes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(31,35,"gateway.hints.scan-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(34,37,"gateway.scan-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,39,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("scanPeriodInMillis").touched?38:-1),t.ɵɵadvance(),t.ɵɵconditional(n.hideNewFields?-1:39),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(42,41,"gateway.hints.sub-check-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(45,43,"gateway.sub-check-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(48,45,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("subCheckPeriodInMillis").touched?49:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(53,47,"gateway.hints.enable-subscription")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(56,49,"gateway.enable-subscription")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(60,51,"gateway.hints.show-map")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(62,53,"gateway.show-map")," "),t.ɵɵadvance(2),t.ɵɵproperty("mode",n.SecurityMode.extendedCertificates))},dependencies:t.ɵɵgetComponentDepsFactory(YX,[T,NX,Jn,di]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("OpcServerConfigComponent",YX),Ze([I()],YX.prototype,"hideNewFields",void 0);class XX extends Xa{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=ji,this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){let t;return t=e?.server&&"mapping"in e?.server?ar.mapMappingToUpgradedVersion(e.server.mapping):e&&"mapping"in e?ar.mapMappingToCurrentVersion(e.mapping):[],{server:e.server?ar.mapServerToUpgradedVersion(e.server):{},mapping:t}}getMappedValue(e){return{server:ar.mapServerToDowngradedVersion(e)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(XX)))(n||XX)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:XX,selectors:[["tb-opc-ua-legacy-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>XX)),multi:!0},{provide:be,useExisting:c((()=>XX)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:17,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server",3,"hideNewFields"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"required","withReportStrategy","mappingType"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-opc-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,11,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,13,"gateway.server"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("hideNewFields",n.isLegacy),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,15,"gateway.data-mapping"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("required",!0)("withReportStrategy",n.withReportStrategy)("mappingType",n.mappingTypes.OPCUA))},dependencies:t.ɵɵgetComponentDepsFactory(XX,[me,T,MX,YX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}e("OpcUaLegacyBasicConfigComponent",XX),Ze([I()],XX.prototype,"withReportStrategy",void 0);class ZX extends Xa{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=ji,this.isLegacy=!1}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){return{server:e.server??{},mapping:e.mapping??[]}}getMappedValue(e){return{server:e.server,mapping:e.mapping}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(ZX)))(n||ZX)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:ZX,selectors:[["tb-opc-ua-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>ZX)),multi:!0},{provide:be,useExisting:c((()=>ZX)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:17,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server",3,"hideNewFields"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"required","withReportStrategy","mappingType"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-opc-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,11,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,13,"gateway.server"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("hideNewFields",n.isLegacy),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,15,"gateway.data-mapping"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("required",!0)("withReportStrategy",n.withReportStrategy)("mappingType",n.mappingTypes.OPCUA))},dependencies:t.ɵɵgetComponentDepsFactory(ZX,[me,T,NX,MX,YX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}e("OpcUaBasicConfigComponent",ZX),Ze([I()],ZX.prototype,"withReportStrategy",void 0);class QX extends Xa{constructor(){super(...arguments),this.withReportStrategy=!0,this.MappingType=ji}initBasicFormGroup(){return this.fb.group({mapping:[],requestsMapping:[],broker:[],workers:[]})}getRequestDataArray(e){const t=[];return le(e)&&Object.keys(e).forEach((n=>{for(const i of e[n])t.push({requestType:n,requestValue:i})})),t}getRequestDataObject(e){return e.reduce(((e,{requestType:t,requestValue:n})=>(e[t].push(n),e)),{connectRequests:[],disconnectRequests:[],attributeRequests:[],attributeUpdates:[],serverSideRpc:[]})}getBrokerMappedValue(e,t){return{...e,maxNumberOfWorkers:t.maxNumberOfWorkers??100,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker??10}}writeValue(e){this.basicFormGroup.setValue(this.mapConfigToFormValue(e),{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(QX)))(n||QX)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:QX,inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵInheritDefinitionFeature]})}}function JX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.max-number-of-workers-required"))}function eZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.max-messages-queue-for-worker-required"))}e("MqttBasicConfigDirective",QX),Ze([I()],QX.prototype,"withReportStrategy",void 0);class tZ{constructor(e){this.fb=e,this.destroy$=new Ie,this.workersConfigFormGroup=this.fb.group({maxNumberOfWorkers:[100,[xe.required,xe.min(1)]],maxMessageNumberPerWorker:[10,[xe.required,xe.min(1)]]}),this.workersConfigFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{maxNumberOfWorkers:t,maxMessageNumberPerWorker:n}=e;this.workersConfigFormGroup.reset({maxNumberOfWorkers:t||100,maxMessageNumberPerWorker:n||10},{emitEvent:!1})}validate(){return this.workersConfigFormGroup.valid?null:{workersConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||tZ)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:tZ,selectors:[["tb-workers-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>tZ)),multi:!0},{provide:be,useExisting:c((()=>tZ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:21,vars:21,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",2,"width","50%",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip",""],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","type","number","min","1","formControlName","maxNumberOfWorkers",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","type","number","min","1","formControlName","maxMessageNumberPerWorker",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"div",3),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",4),t.ɵɵelement(8,"input",5),t.ɵɵpipe(9,"translate"),t.ɵɵtemplate(10,JX,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",1)(12,"div",2),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"div",3),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-form-field",4),t.ɵɵelement(18,"input",7),t.ɵɵpipe(19,"translate"),t.ɵɵtemplate(20,eZ,3,3,"mat-icon",6),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.workersConfigFormGroup),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,9,"gateway.max-number-of-workers-hint")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,11,"gateway.max-number-of-workers")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(9,13,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("min")||n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("required")&&n.workersConfigFormGroup.get("maxNumberOfWorkers").touched?10:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(13,15,"gateway.max-messages-queue-for-worker-hint")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,17,"gateway.max-messages-queue-for-worker")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,19,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("min")||n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("required")&&n.workersConfigFormGroup.get("maxMessageNumberPerWorker").touched?20:-1))},dependencies:t.ɵɵgetComponentDepsFactory(tZ,[T,Jn]),encapsulation:2,changeDetection:d.OnPush})}}function nZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function iZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.brokerConfigFormGroup.get("port")))}}function aZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function rZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("clientId"))})),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.generate-client-id"))}e("WorkersConfigControlComponent",tZ);class oZ{constructor(e,t){this.fb=e,this.cdr=t,this.mqttVersions=hi,this.portLimits=Vi,this.destroy$=new Ie,this.brokerConfigFormGroup=this.fb.group({host:["",[xe.required,xe.pattern(fn)]],port:[null,[xe.required,xe.min(Vi.MIN),xe.max(Vi.MAX)]],version:[5,[]],clientId:["tb_gw_"+pe(5),[xe.pattern(fn)]],security:[]}),this.brokerConfigFormGroup.valueChanges.subscribe((e=>{this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}generate(e){this.brokerConfigFormGroup.get(e)?.patchValue("tb_gw_"+pe(5))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{version:t=5,clientId:n=`tb_gw_${pe(5)}`,security:i={}}=e;this.brokerConfigFormGroup.reset({...e,version:t,clientId:n,security:i},{emitEvent:!1}),this.cdr.markForCheck()}validate(){return this.brokerConfigFormGroup.valid?null:{brokerConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||oZ)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:oZ,selectors:[["tb-broker-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>oZ)),multi:!0},{provide:be,useExisting:c((()=>oZ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:30,vars:15,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["formControlName","version"],[3,"value"],["matInput","","name","value","formControlName","clientId",3,"placeholder"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip"],["formControlName","security"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",3),t.ɵɵelement(5,"input",4),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,nZ,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",2),t.ɵɵtext(10,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",3),t.ɵɵelement(12,"input",6),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,iZ,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"div",1)(16,"div",7),t.ɵɵtext(17,"gateway.mqtt-version"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-form-field",3)(19,"mat-select",8),t.ɵɵrepeaterCreate(20,aZ,2,2,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",1)(23,"div",7),t.ɵɵtext(24,"gateway.client-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",3),t.ɵɵelement(26,"input",10),t.ɵɵpipe(27,"translate"),t.ɵɵtemplate(28,rZ,4,3,"button",11),t.ɵɵelementEnd()(),t.ɵɵelement(29,"tb-security-config",12),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.brokerConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.brokerConfigFormGroup.get("host").hasError("required")&&n.brokerConfigFormGroup.get("host").touched?7:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.brokerConfigFormGroup.get("port").hasError("required")||n.brokerConfigFormGroup.get("port").hasError("min")||n.brokerConfigFormGroup.get("port").hasError("max"))&&n.brokerConfigFormGroup.get("port").touched?14:-1),t.ɵɵadvance(6),t.ɵɵrepeater(n.mqttVersions),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(27,13,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.brokerConfigFormGroup.get("clientId").value?-1:28))},dependencies:t.ɵɵgetComponentDepsFactory(oZ,[T,NX,oK]),encapsulation:2,changeDetection:d.OnPush})}}e("BrokerConfigControlComponent",oZ);class sZ extends QX{mapConfigToFormValue(e){const{broker:t,mapping:n=[],requestsMapping:i}=e;return{workers:t&&(t.maxNumberOfWorkers||t.maxMessageNumberPerWorker)?{maxNumberOfWorkers:t.maxNumberOfWorkers,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker}:{},mapping:n??[],broker:t??{},requestsMapping:this.getRequestDataArray(i)}}getMappedValue(e){const{broker:t,workers:n,mapping:i,requestsMapping:a}=e||{};return{broker:this.getBrokerMappedValue(t,n),mapping:i,requestsMapping:a?.length?this.getRequestDataObject(a):{}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(sZ)))(n||sZ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:sZ,selectors:[["tb-mqtt-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>sZ)),multi:!0},{provide:be,useExisting:c((()=>sZ)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:19,vars:24,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","broker"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"withReportStrategy","required","mappingType"],["formControlName","requestsMapping",3,"withReportStrategy","mappingType"],[1,"tb-form-panel","no-border","no-padding"],["formControlName","workers"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-broker-config-control",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-tab",1),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"div",4),t.ɵɵelement(14,"tb-mapping-table",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-tab",1),t.ɵɵpipe(16,"translate"),t.ɵɵelementStart(17,"div",7),t.ɵɵelement(18,"tb-workers-config-control",8),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,14,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,16,"gateway.broker.connection"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,18,"gateway.data-mapping"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("required",!0)("mappingType",n.MappingType.DATA),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(12,20,"gateway.requests-mapping")),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("mappingType",n.MappingType.REQUESTS),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(16,22,"gateway.workers-settings")))},dependencies:t.ɵɵgetComponentDepsFactory(sZ,[me,T,tZ,oZ,MX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}e("MqttBasicConfigComponent",sZ);class lZ extends QX{mapConfigToFormValue(e){const{broker:t,mapping:n=[],connectRequests:i=[],disconnectRequests:a=[],attributeRequests:r=[],attributeUpdates:o=[],serverSideRpc:s=[]}=e,l=ja.mapRequestsToUpgradedVersion({connectRequests:i,disconnectRequests:a,attributeRequests:r,attributeUpdates:o,serverSideRpc:s});return{workers:t&&(t.maxNumberOfWorkers||t.maxMessageNumberPerWorker)?{maxNumberOfWorkers:t.maxNumberOfWorkers,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker}:{},mapping:ja.mapMappingToUpgradedVersion(n)||[],broker:t||{},requestsMapping:this.getRequestDataArray(l)}}getMappedValue(e){const{broker:t,workers:n,mapping:i,requestsMapping:a}=e||{},r=a?.length?this.getRequestDataObject(a):{};return{broker:this.getBrokerMappedValue(t,n),mapping:ja.mapMappingToDowngradedVersion(i),...ja.mapRequestsToDowngradedVersion(r)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(lZ)))(n||lZ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:lZ,selectors:[["tb-mqtt-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>lZ)),multi:!0},{provide:be,useExisting:c((()=>lZ)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:19,vars:24,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","broker"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"withReportStrategy","required","mappingType"],["formControlName","requestsMapping",3,"withReportStrategy","mappingType"],[1,"tb-form-panel","no-border","no-padding"],["formControlName","workers"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-broker-config-control",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-tab",1),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"div",4),t.ɵɵelement(14,"tb-mapping-table",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-tab",1),t.ɵɵpipe(16,"translate"),t.ɵɵelementStart(17,"div",7),t.ɵɵelement(18,"tb-workers-config-control",8),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,14,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,16,"gateway.broker.connection"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,18,"gateway.data-mapping"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("required",!0)("mappingType",n.MappingType.DATA),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(12,20,"gateway.requests-mapping")),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("mappingType",n.MappingType.REQUESTS),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(16,22,"gateway.workers-settings")))},dependencies:t.ɵɵgetComponentDepsFactory(lZ,[me,T,tZ,oZ,MX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}e("MqttLegacyBasicConfigComponent",lZ);class pZ extends O{constructor(e,t,n,i,a){super(t,n,a),this.fb=e,this.store=t,this.router=n,this.data=i,this.dialogRef=a,this.portLimits=Vi,this.modbusProtocolTypes=Object.values(sa),this.modbusMethodTypes=Object.values(la),this.modbusSerialMethodTypes=Object.values(pa),this.modbusParities=Object.values(ca),this.modbusByteSizes=ga,this.modbusBaudrates=ha,this.modbusOrderType=Object.values(da),this.ModbusProtocolType=sa,this.ModbusParityLabelsMap=Sa,this.ModbusProtocolLabelsMap=wa,this.ModbusMethodLabelsMap=ba,this.ReportStrategyDefaultValue=mn,this.modbusHelpLink=w+"/docs/iot-gateway/config/modbus/#section-master-description-and-configuration-parameters",this.serialSpecificControlKeys=["serialPort","baudrate","stopbits","bytesize","parity","strict"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new Ie,this.showSecurityControl=this.fb.control(!1),this.initializeSlaveFormGroup(),this.updateSlaveFormGroup(),this.updateControlsEnabling(this.data.value.type),this.observeTypeChange(),this.observeShowSecurity(),this.showSecurityControl.patchValue(!!this.data.value.security&&!Q(this.data.value.security,{}))}get protocolType(){return this.slaveConfigFormGroup.get("type").value}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}cancel(){this.dialogRef.close(null)}add(){this.slaveConfigFormGroup.valid&&this.dialogRef.close(this.getSlaveResultData())}initializeSlaveFormGroup(){this.slaveConfigFormGroup=this.fb.group({type:[sa.TCP],host:["",[xe.required,xe.pattern(fn)]],port:[null,[xe.required,xe.min(Vi.MIN),xe.max(Vi.MAX)]],serialPort:["",[xe.required,xe.pattern(fn)]],method:[la.SOCKET,[xe.required]],baudrate:[this.modbusBaudrates[0]],stopbits:[1],bytesize:[ga[0]],parity:[ca.None],strict:[!0],unitId:[null,[xe.required]],deviceName:["",[xe.required,xe.pattern(fn)]],deviceType:["",[xe.required,xe.pattern(fn)]],timeout:[35],byteOrder:[da.BIG],wordOrder:[da.BIG],retries:[fa],retryOnEmpty:[!0],retryOnInvalid:[!0],pollPeriod:[1e3,[xe.required]],connectAttemptTimeMs:[500,[xe.required]],connectAttemptCount:[5,[xe.required]],waitAfterFailedAttemptsMs:[3e4,[xe.required]],values:[{}],security:[{}]}),this.addFieldsToFormGroup()}updateSlaveFormGroup(){this.slaveConfigFormGroup.patchValue({...this.data.value,port:this.data.value.type===sa.Serial?null:this.data.value.port,serialPort:this.data.value.type===sa.Serial?this.data.value.port:"",retries:!1===this.data.value.retries?0:ie(this.data.value.retries)?this.data.value.retries:fa,values:{attributes:this.data.value.attributes??[],timeseries:this.data.value.timeseries??[],attributeUpdates:this.data.value.attributeUpdates??[],rpc:this.data.value.rpc??[]}})}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.updateControlsEnabling(e),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==la.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===sa.Serial?pa.ASCII:la.SOCKET,{emitEvent:!1})}updateControlsEnabling(e){const[t,n]=e===sa.Serial?[this.serialSpecificControlKeys,this.tcpUdpSpecificControlKeys]:[this.tcpUdpSpecificControlKeys,this.serialSpecificControlKeys];t.forEach((e=>this.slaveConfigFormGroup.get(e)?.enable({emitEvent:!1}))),n.forEach((e=>this.slaveConfigFormGroup.get(e)?.disable({emitEvent:!1}))),this.updateSecurityEnabling(this.showSecurityControl.value)}observeShowSecurity(){this.showSecurityControl.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.updateSecurityEnabling(e)))}updateSecurityEnabling(e){e&&this.protocolType!==sa.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||pZ)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef))}}static{this.ɵdir=t.ɵɵdefineDirective({type:pZ,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusSlaveDialogAbstract",pZ);const cZ=()=>({maxWidth:"970px"});function dZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",15),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate3(" ",e.get("tag").value,"",": ","",e.get("value").value," ")}}function uZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",16)(1,"div",19),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"span",20),t.ɵɵtext(5),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",21),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"span",22),t.ɵɵtext(10),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",21),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"span",22),t.ɵɵtext(15),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(3,6,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.method":"gateway.key"),": "),t.ɵɵadvance(3),t.ɵɵtextInterpolate(e.get("tag").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(8,8,"gateway.address"),": "),t.ɵɵadvance(3),t.ɵɵtextInterpolate(e.get("address").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(13,10,"gateway.type"),": "),t.ɵɵadvance(3),t.ɵɵtextInterpolate(e.get("type").value)}}function mZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.keysType===e.ModbusValueKey.RPC_REQUESTS?"gateway.method-required":"gateway.key-required"))}}function hZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function gZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(5);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.ModbusFunctionCodeTranslationsMap.get(e))," ")}}function fZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",32),t.ɵɵtext(2,"gateway.function-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",29)(4,"mat-select",40),t.ɵɵrepeaterCreate(5,gZ,3,4,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵrepeater(n.functionCodesMap.get(e.get("id").value)||n.defaultFunctionCodes)}}function yZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.objects-count-required"))}function vZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.modbus.max-bit"))}function xZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",41),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",42),t.ɵɵelement(5,"input",43),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,vZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(3).$implicit;t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.modbus.bit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("bit").hasError("max")&&e.get("bit").touched?7:-1)}}function bZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(6);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.BitTargetTypeTranslationMap.get(e)))}}function wZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",41),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit-target-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",44)(5,"mat-form-field",45)(6,"mat-select",46),t.ɵɵrepeaterCreate(7,bZ,3,4,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,1,"gateway.hints.modbus.bit-target-type")),t.ɵɵadvance(6),t.ɵɵrepeater(e.bitTargetTypes)}}function SZ(e,n){if(1&e&&t.ɵɵtemplate(0,xZ,8,7,"div",27)(1,wZ,9,3,"div",27),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵconditional(e.get("objectsCount").value>1?0:-1),t.ɵɵadvance(),t.ɵɵconditional(n.hideNewFields?-1:1)}}function CZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function _Z(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵelement(1,"mat-icon",54),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(5);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("svgIcon",i.ModifierTypesMap.get(e).icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,i.ModifierTypesMap.get(e).name))}}function TZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.modifier-invalid"))}function EZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",38)(1,"mat-expansion-panel",13)(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-slide-toggle",47),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label",48),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",44)(10,"div",49)(11,"div",32),t.ɵɵtext(12,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",45)(14,"mat-select",50)(15,"mat-select-trigger")(16,"div",51),t.ɵɵelement(17,"mat-icon",52),t.ɵɵelementStart(18,"span"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd()()(),t.ɵɵrepeaterCreate(21,_Z,5,5,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(23,"div",27)(24,"div",32),t.ɵɵtext(25,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",42),t.ɵɵelement(27,"input",53),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,TZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()()()}if(2&e){let e,n;const i=t.ɵɵnextContext(2).$implicit,a=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("expanded",a.enableModifiersControlMap.get(i.get("id").value).value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",a.enableModifiersControlMap.get(i.get("id").value)),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,8,"gateway.hints.modbus.modifier")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,10,"gateway.modifier")," "),t.ɵɵadvance(10),t.ɵɵproperty("svgIcon",null==(e=a.ModifierTypesMap.get(i.get("modifierType").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,12,null==(n=a.ModifierTypesMap.get(i.get("modifierType").value))?null:n.name)),t.ɵɵadvance(2),t.ɵɵrepeater(a.modifierTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(i.get("modifierValue").hasError("pattern")&&i.get("modifierValue").touched?29:-1)}}function IZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function MZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",55),t.ɵɵtext(2,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",29),t.ɵɵelement(4,"input",56),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,IZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,2,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?6:-1)}}function kZ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",39),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Key)("isExpansionMode",!0)}}function PZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",23),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelement(3,"div",24),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",25)(5,"div",26),t.ɵɵtext(6,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",27)(8,"div",28),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",29),t.ɵɵelement(13,"input",30),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,mZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",25)(17,"div",26),t.ɵɵtext(18,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",27)(20,"div",32),t.ɵɵtext(21," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",29)(23,"mat-select",33),t.ɵɵrepeaterCreate(24,hZ,2,2,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(26,fZ,7,0,"div",27),t.ɵɵelementStart(27,"div",27)(28,"div",35),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"gateway.objects-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",29),t.ɵɵelement(32,"input",36),t.ɵɵpipe(33,"translate"),t.ɵɵtemplate(34,yZ,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(35,SZ,2,2),t.ɵɵelementStart(36,"div",27)(37,"div",35),t.ɵɵpipe(38,"translate"),t.ɵɵtext(39,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"mat-form-field",29),t.ɵɵelement(41,"input",37),t.ɵɵpipe(42,"translate"),t.ɵɵtemplate(43,CZ,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(44,EZ,30,16,"div",38)(45,MZ,7,4,"div",27)(46,kZ,1,2,"tb-report-strategy",39),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,19,"gateway.hints.modbus.data-keys")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/modbus-functions-data-types_fn")("tb-help-popup-style",t.ɵɵpureFunction0(35,cZ)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(9,21,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.hints.modbus.method":"gateway.hints.modbus.key")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,23,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.method-name":"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,25,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("tag").hasError("required")&&e.get("tag").touched?15:-1),t.ɵɵadvance(9),t.ɵɵrepeater(n.modbusDataTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.withFunctionCode?26:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(29,27,"gateway.hints.modbus.objects-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,29,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(e.get("type").value)),t.ɵɵadvance(2),t.ɵɵconditional(e.get("objectsCount").hasError("required")&&e.get("objectsCount").touched?34:-1),t.ɵɵadvance(),t.ɵɵconditional(e.get("type").value===n.ModbusDataType.BITS?35:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(38,31,"gateway.hints.modbus.address")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(42,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("address").hasError("required")&&e.get("address").touched?43:-1),t.ɵɵadvance(),t.ɵɵconditional(n.showModifiersMap.get(e.get("id").value)?44:-1),t.ɵɵadvance(),t.ɵɵconditional(n.isMaster?45:-1),t.ɵɵadvance(),t.ɵɵconditional(n.withReportStrategy?46:-1)}}function DZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",10)(1,"div",11),t.ɵɵelementContainerStart(2,12),t.ɵɵelementStart(3,"mat-expansion-panel",13)(4,"mat-expansion-panel-header",14)(5,"mat-panel-title"),t.ɵɵtemplate(6,dZ,2,3,"div",15)(7,uZ,16,12,"div",16),t.ɵɵelementEnd()(),t.ɵɵtemplate(8,PZ,47,36,"ng-template",17),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",18),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(3),t.ɵɵconditional(r.isMaster?6:7),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,r.deleteKeyTitle))}}function AZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,DZ,13,6,"div",10,t.ɵɵcomponentInstance().trackByControlId,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function OZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",57),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class RZ{constructor(e,t){this.fb=e,this.popover=t,this.isMaster=!1,this.hideNewFields=!1,this.keysDataApplied=new u,this.withFunctionCode=!0,this.withReportStrategy=!0,this.enableModifiersControlMap=new Map,this.showModifiersMap=new Map,this.functionCodesMap=new Map,this.defaultFunctionCodes=[],this.modbusDataTypes=Object.values(rn),this.modifierTypes=Object.values(Ia),this.bitTargetTypes=Object.values(va),this.BitTargetTypeTranslationMap=xa,this.ModbusEditableDataTypes=on,this.ModbusFunctionCodeTranslationsMap=cn,this.ModifierTypesMap=Ma,this.ReportStrategyDefaultValue=mn,this.ModbusDataType=rn,this.ModbusValueKey=ma,this.destroy$=new Ie,this.defaultReadFunctionCodes=[3,4],this.bitsReadFunctionCodes=[1,2],this.defaultWriteFunctionCodes=[6,16],this.bitsWriteFunctionCodes=[5,15]}ngOnInit(){this.withFunctionCode=!this.isMaster||this.keysType!==ma.ATTRIBUTES&&this.keysType!==ma.TIMESERIES,this.withReportStrategy=!(this.isMaster||this.keysType!==ma.ATTRIBUTES&&this.keysType!==ma.TIMESERIES||this.hideNewFields),this.keysListFormArray=this.prepareKeysFormArray(this.values),this.defaultFunctionCodes=this.getDefaultFunctionCodes()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}trackByControlId(e,t){return t.value.id}addKey(){const e=pe(5),t=this.fb.group({tag:["",[xe.required,xe.pattern(fn)]],value:[{value:"",disabled:!this.isMaster},[xe.required,xe.pattern(fn)]],type:[rn.BYTES,[xe.required]],address:[null,[xe.required]],objectsCount:[1,[xe.required]],functionCode:[{value:this.getDefaultFunctionCodes()[0],disabled:!this.withFunctionCode},[xe.required]],reportStrategy:[{value:null,disabled:!this.withReportStrategy}],modifierType:[{value:Ia.MULTIPLIER,disabled:!0}],modifierValue:[{value:1,disabled:!0},[xe.pattern(vn)]],bit:[{value:null,disabled:!0}],bitTargetType:[{value:va.IntegerType,disabled:!0}],id:[{value:e,disabled:!0}]});this.showModifiersMap.set(e,!1),this.enableModifiersControlMap.set(e,this.fb.control(!1)),this.observeKeyDataType(t),this.observeObjectsCount(t),this.observeEnableModifier(t),this.keysListFormArray.push(t)}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover.hide()}applyKeysData(){this.keysDataApplied.emit(this.getFormValue())}getFormValue(){return this.mapKeysWithModifier(this.withReportStrategy?this.cleanUpEmptyStrategies(this.keysListFormArray.value):this.keysListFormArray.value)}cleanUpEmptyStrategies(e){return e.map((e=>{const{reportStrategy:t,...n}=e;return t?e:n}))}mapKeysWithModifier(e){return e.map(((e,t)=>{if(this.showModifiersMap.get(this.keysListFormArray.controls[t].get("id").value)){const{modifierType:t,modifierValue:n,...i}=e;return t?{...i,[t]:n}:i}return e}))}prepareKeysFormArray(e){const t=[];return e&&e.forEach((e=>{const n=this.createDataKeyFormGroup(e);this.observeKeyDataType(n),this.observeObjectsCount(n),this.observeEnableModifier(n),this.functionCodesMap.set(n.get("id").value,this.getFunctionCodes(e.type)),t.push(n)})),this.fb.array(t)}createDataKeyFormGroup(e){const{tag:t,value:n,type:i,address:a,objectsCount:r,functionCode:o,multiplier:s,divider:l,reportStrategy:p,bit:c,bitTargetType:d}=e,u=pe(5),m=this.shouldShowModifier(i);return this.showModifiersMap.set(u,m),this.enableModifiersControlMap.set(u,this.fb.control((s||l)&&m)),this.fb.group({tag:[t,[xe.required,xe.pattern(fn)]],value:[{value:n,disabled:!this.isMaster},[xe.required,xe.pattern(fn)]],type:[i,[xe.required]],address:[a,[xe.required]],objectsCount:[r,[xe.required]],functionCode:[{value:o,disabled:!this.withFunctionCode},[xe.required]],modifierType:[{value:l?Ia.DIVIDER:Ia.MULTIPLIER,disabled:!this.enableModifiersControlMap.get(u).value}],bit:[{value:c,disabled:i!==rn.BITS||r<2},[xe.max(r-1)]],bitTargetType:[{value:d??va.IntegerType,disabled:i!==rn.BITS||this.hideNewFields}],modifierValue:[{value:s??l??1,disabled:!this.enableModifiersControlMap.get(u).value},[xe.pattern(vn)]],id:[{value:u,disabled:!0}],reportStrategy:[{value:p,disabled:!this.withReportStrategy}]})}shouldShowModifier(e){return!(this.isMaster||this.keysType!==ma.ATTRIBUTES&&this.keysType!==ma.TIMESERIES||this.ModbusEditableDataTypes.includes(e))}observeKeyDataType(e){e.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((t=>{this.ModbusEditableDataTypes.includes(t)||e.get("objectsCount").patchValue(sn[t],{emitEvent:!1}),this.toggleBitsFields(e);const n=this.shouldShowModifier(t);this.showModifiersMap.set(e.get("id").value,n),this.updateFunctionCodes(e,t)}))}observeObjectsCount(e){e.get("objectsCount").valueChanges.pipe(Le((()=>e.get("type").value===rn.BITS)),Re(this.destroy$)).subscribe((()=>this.toggleBitsFields(e)))}toggleBitsFields(e){const{objectsCount:t,type:n,bit:i,bitTargetType:a}=e.controls,r=n.value===rn.BITS,o=t.value>1;r&&o?(i.enable({emitEvent:!1}),i.setValidators(xe.max(t.value-1))):i.disable({emitEvent:!1}),i.updateValueAndValidity({emitEvent:!1}),a[r?"enable":"disable"]({emitEvent:!1})}observeEnableModifier(e){this.enableModifiersControlMap.get(e.get("id").value).valueChanges.pipe(Re(this.destroy$)).subscribe((t=>this.toggleModifierControls(e,t)))}toggleModifierControls(e,t){const n=e.get("modifierType"),i=e.get("modifierValue");n[t?"enable":"disable"]({emitEvent:!1}),i[t?"enable":"disable"]({emitEvent:!1}),n.markAsDirty(),i.markAsDirty()}updateFunctionCodes(e,t){const n=this.getFunctionCodes(t);this.functionCodesMap.set(e.get("id").value,n),n.includes(e.get("functionCode").value)||e.get("functionCode").patchValue(n[0],{emitEvent:!1})}getFunctionCodes(e){const t=[...e===rn.BITS?this.bitsWriteFunctionCodes:[],...this.defaultWriteFunctionCodes];if(this.keysType===ma.ATTRIBUTES_UPDATES)return t.sort(((e,t)=>e-t));const n=[...this.defaultReadFunctionCodes];return e===rn.BITS&&n.push(...this.bitsReadFunctionCodes),this.keysType===ma.RPC_REQUESTS&&n.push(...t),n.sort(((e,t)=>e-t))}getDefaultFunctionCodes(){return this.keysType===ma.ATTRIBUTES_UPDATES?this.defaultWriteFunctionCodes:this.keysType===ma.RPC_REQUESTS?[...this.defaultReadFunctionCodes,...this.defaultWriteFunctionCodes]:this.defaultReadFunctionCodes}static{this.ɵfac=function(e){return new(e||RZ)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(ct.TbPopoverComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:RZ,selectors:[["tb-modbus-data-keys-panel"]],inputs:{isMaster:"isMaster",hideNewFields:"hideNewFields",panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keysType:"keysType",values:"values"},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:18,vars:15,consts:[[1,"tb-modbus-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],[1,"flex","justify-between","pt-4"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],["tbTruncateWithTooltip","",1,"title-container"],[1,"tb-flex"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"title-container","tb-flex"],["tbTruncateWithTooltip","",1,"key-label"],[1,"title-container"],[1,"key-label"],[1,"tb-form-hint","tb-primary-fill","tb-flex","align-center"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","tag",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width"],["formControlName","type"],[3,"value"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],["matInput","","type","number","min","0","max","65535","name","value","formControlName","address",3,"placeholder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],["formControlName","functionCode"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],["matInput","","formControlName","bit","step","1","type","number","min","0",3,"placeholder"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","bitTargetType"],[1,"mat-slide",3,"click","formControl"],[3,"tb-hint-tooltip-icon"],[1,"tb-form-row","column-xs","w-full"],["formControlName","modifierType"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],["matInput","","required","","formControlName","modifierValue","step","0.1","type","number",3,"placeholder"],[1,"tb-mat-20",3,"svgIcon"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","value",3,"placeholder"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,AZ,3,0,"div",3)(6,OZ,3,1,"div",4),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",5)(8,"button",6),t.ɵɵlistener("click",(function(){return n.addKey()})),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"button",8),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",9),t.ɵɵlistener("click",(function(){return n.applyKeysData()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(RZ,[T,pi,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{width:180px}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .key-label[_ngcontent-%COMP%]{font-weight:400}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:calc(100vh - 112px);max-height:500px;overflow:auto}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}']})}}e("ModbusDataKeysPanelComponent",RZ),Ze([I()],RZ.prototype,"isMaster",void 0),Ze([I()],RZ.prototype,"hideNewFields",void 0);const BZ=()=>({$implicit:null}),FZ=e=>({$implicit:e});function NZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5),t.ɵɵelementContainer(1,7),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(3);t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",n)("ngTemplateOutletContext",t.ɵɵpureFunction0(3,BZ))}}function LZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab",8),t.ɵɵpipe(1,"translate"),t.ɵɵelementStart(2,"div",5),t.ɵɵelementContainer(3,7),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2),a=t.ɵɵreference(3);t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(1,4,i.ModbusValuesTranslationsMap.get(e))),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i.valuesFormGroup.get(e)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",a)("ngTemplateOutletContext",t.ɵɵpureFunction1(6,FZ,e))}}function VZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group",6),t.ɵɵrepeaterCreate(1,LZ,4,8,"mat-tab",8,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵrepeater(e.modbusRegisterTypes)}}function qZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function GZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function zZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function UZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function jZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",11)(4,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(5,qZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(7,"mat-chip",13),t.ɵɵelement(8,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",15,1),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(10),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES,i))})),t.ɵɵelementStart(12,"tb-icon",16),t.ɵɵtext(13,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",9)(15,"div",10),t.ɵɵtext(16,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",11)(18,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(19,GZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(21,"mat-chip",13),t.ɵɵelement(22,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",15,2),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(24),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.TIMESERIES,i))})),t.ɵɵelementStart(26,"tb-icon",16),t.ɵɵtext(27,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(28,"div",9)(29,"div",10),t.ɵɵtext(30,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"div",11)(32,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(33,zZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(35,"mat-chip",13),t.ɵɵelement(36,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"button",15,3),t.ɵɵpipe(39,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(38),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES_UPDATES,i))})),t.ɵɵelementStart(40,"tb-icon",16),t.ɵɵtext(41,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"div",9)(43,"div",10),t.ɵɵtext(44,"gateway.rpc-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(45,"div",11)(46,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(47,UZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(49,"mat-chip",13),t.ɵɵelement(50,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"button",15,4),t.ɵɵpipe(53,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(52),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.RPC_REQUESTS,i))})),t.ɵɵelementStart(54,"tb-icon",16),t.ɵɵtext(55,"edit"),t.ɵɵelementEnd()()()()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,12,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(25,14,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,16,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(53,18,"action.edit")),t.ɵɵproperty("disabled",i.disabled)}}class HZ{constructor(e,t,n,i,a,r){this.fb=e,this.popoverService=t,this.renderer=n,this.viewContainerRef=i,this.cdr=a,this.destroyRef=r,this.singleMode=!1,this.hideNewFields=!1,this.disabled=!1,this.modbusRegisterTypes=Object.values(ua),this.modbusValueKeys=Object.values(ma),this.ModbusValuesTranslationsMap=ya,this.ModbusValueKey=ma}ngOnInit(){this.initializeValuesFormGroup(),this.observeValuesChanges()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){if(this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide(),this.singleMode)this.valuesFormGroup.setValue(this.getSingleRegisterState(e),{emitEvent:!1});else{const{holding_registers:t,coils_initializer:n,input_registers:i,discrete_inputs:a}=e;this.valuesFormGroup.setValue({holding_registers:this.getSingleRegisterState(t),coils_initializer:this.getSingleRegisterState(n),input_registers:this.getSingleRegisterState(i),discrete_inputs:this.getSingleRegisterState(a)},{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.valuesFormGroup.valid?null:{valuesFormGroup:{valid:!1}}}setDisabledState(e){this.disabled=e,this.cdr.markForCheck()}getValueGroup(e,t){return t?this.valuesFormGroup.get(t).get(e):this.valuesFormGroup.get(e)}manageKeys(e,t,n,i){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const a=t._elementRef.nativeElement;if(this.popoverService.hasPopover(a))return void this.popoverService.hidePopover(a);const r=this.getValueGroup(n,i),o={values:r.value,isMaster:!this.singleMode,keysType:n,panelTitle:Ca.get(n),addKeyTitle:_a.get(n),deleteKeyTitle:Ta.get(n),noKeysText:Ea.get(n),hideNewFields:this.hideNewFields};this.popoverComponent=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,RZ,"leftTop",!1,null,o,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(On(this.destroyRef)).subscribe((e=>{this.popoverComponent.hide(),r.patchValue(e),r.markAsDirty(),this.cdr.markForCheck()}))}initializeValuesFormGroup(){const e=()=>this.fb.group(this.modbusValueKeys.reduce(((e,t)=>(e[t]=this.fb.control([[],[]]),e)),{}));this.singleMode?this.valuesFormGroup=e():this.valuesFormGroup=this.fb.group(this.modbusRegisterTypes.reduce(((t,n)=>(t[n]=e(),t)),{}))}observeValuesChanges(){this.valuesFormGroup.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.onChange(e),this.onTouched()}))}getSingleRegisterState(e){return{attributes:e?.attributes??[],timeseries:e?.timeseries??[],attributeUpdates:e?.attributeUpdates??[],rpc:e?.rpc??[]}}static{this.ɵfac=function(e){return new(e||HZ)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(dt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:HZ,selectors:[["tb-modbus-values"]],inputs:{singleMode:"singleMode",hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>HZ)),multi:!0},{provide:be,useExisting:c((()=>HZ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:4,vars:1,consts:[["singleView",""],["attributesButton",""],["telemetryButton",""],["attributesUpdatesButton",""],["rpcRequestsButton",""],[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[3,"formGroup"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"label"],[1,"tb-form-row","space-between","tb-flex"],["translate","",1,"fixed-title-width"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","disabled","matTooltip"],["matButtonIcon",""]],template:function(e,n){1&e&&t.ɵɵtemplate(0,NZ,2,4,"div",5)(1,VZ,3,1,"mat-tab-group",6)(2,jZ,56,20,"ng-template",null,0,t.ɵɵtemplateRefExtractor),2&e&&t.ɵɵconditional(n.singleMode?0:1)},dependencies:t.ɵɵgetComponentDepsFactory(HZ,[me,T,ei]),styles:['@charset "UTF-8";[_nghost-%COMP%] .ellipsis-chips-container{max-width:70%}[_nghost-%COMP%] .mat-mdc-tab-body-wrapper{min-height:320px} .mdc-evolution-chip-set__chips{align-items:center}'],changeDetection:d.OnPush})}}function WZ(e,n){1&e&&(t.ɵɵelementStart(0,"div",2)(1,"div",10),t.ɵɵtext(2,"gateway.server-hostname"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",5)(4,"mat-form-field",6),t.ɵɵelement(5,"input",15),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function $Z(e,n){1&e&&(t.ɵɵelementStart(0,"div",14)(1,"mat-slide-toggle",16)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.request-client-certificate")," "))}e("ModbusValuesComponent",HZ),Ze([I()],HZ.prototype,"singleMode",void 0),Ze([I()],HZ.prototype,"hideNewFields",void 0);class KZ{constructor(e,t){this.fb=e,this.cdr=t,this.isMaster=!1,this.disabled=!1,this.destroy$=new Ie,this.securityConfigFormGroup=this.fb.group({certfile:["",[xe.required,xe.pattern(fn)]],keyfile:["",[xe.required,xe.pattern(fn)]],password:["",[xe.required,xe.pattern(fn)]],server_hostname:["",[xe.pattern(fn)]],reqclicert:[{value:!1,disabled:!0}]}),this.observeValueChanges()}ngOnChanges(){this.updateMasterEnabling()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.disabled=e,this.disabled?this.securityConfigFormGroup.disable({emitEvent:!1}):this.securityConfigFormGroup.enable({emitEvent:!1}),this.updateMasterEnabling(),this.cdr.markForCheck()}validate(){return this.securityConfigFormGroup.valid?null:{securityConfigFormGroup:{valid:!1}}}writeValue(e){const{certfile:t,password:n,keyfile:i,server_hostname:a}=e,r={certfile:t??"",password:n??"",keyfile:i??"",server_hostname:a??"",reqclicert:!!e.reqclicert};this.securityConfigFormGroup.reset(r,{emitEvent:!1})}updateMasterEnabling(){this.isMaster?(this.disabled||this.securityConfigFormGroup.get("reqclicert").enable({emitEvent:!1}),this.securityConfigFormGroup.get("server_hostname").disable({emitEvent:!1})):(this.disabled||this.securityConfigFormGroup.get("server_hostname").enable({emitEvent:!1}),this.securityConfigFormGroup.get("reqclicert").disable({emitEvent:!1}))}observeValueChanges(){this.securityConfigFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}static{this.ɵfac=function(e){return new(e||KZ)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:KZ,selectors:[["tb-modbus-security-config"]],inputs:{isMaster:"isMaster"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>KZ)),multi:!0},{provide:be,useExisting:c((()=>KZ)),multi:!0}]),t.ɵɵNgOnChangesFeature,t.ɵɵStandaloneFeature],decls:33,vars:21,consts:[[1,"tb-form-panel","no-border","no-padding",3,"formGroup"],[1,"tb-form-hint","tb-primary-fill"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["tbTruncateWithTooltip","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","required","","formControlName","certfile",3,"placeholder"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["matInput","","name","value","required","","formControlName","keyfile",3,"placeholder"],["translate","",1,"fixed-title-width"],["matInput","","type","password","required","","name","value","formControlName","password",3,"placeholder"],["matSuffix","",1,"tb-flex","no-gap","align-center","fill-height"],[1,"tb-flex","align-center","fill-height"],[1,"tb-form-row"],["matInput","","name","value","formControlName","server_hostname",3,"placeholder"],["formControlName","reqclicert",1,"mat-slide"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",2)(5,"div",3),t.ɵɵpipe(6,"translate"),t.ɵɵelementStart(7,"span",4),t.ɵɵtext(8,"gateway.client-cert-path"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",5)(10,"mat-form-field",6),t.ɵɵelement(11,"input",7),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(13,"div",2)(14,"div",8),t.ɵɵpipe(15,"translate"),t.ɵɵelementStart(16,"span",4),t.ɵɵtext(17,"gateway.private-key-path"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",5)(19,"mat-form-field",6),t.ɵɵelement(20,"input",9),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",2)(23,"div",10),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"div",5)(26,"mat-form-field",6),t.ɵɵelement(27,"input",11),t.ɵɵpipe(28,"translate"),t.ɵɵelementStart(29,"div",12),t.ɵɵelement(30,"tb-toggle-password",13),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(31,WZ,7,3,"div",2)(32,$Z,5,3,"div",14),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityConfigFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,9,"gateway.hints.path-in-os")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,11,"gateway.hints.ca-cert")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(12,13,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(15,15,"gateway.private-key-path")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,17,"gateway.set")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,19,"gateway.set")),t.ɵɵadvance(4),t.ɵɵconditional(n.isMaster?-1:31),t.ɵɵadvance(),t.ɵɵconditional(n.isMaster?32:-1))},dependencies:t.ɵɵgetComponentDepsFactory(KZ,[T,Jn]),encapsulation:2,changeDetection:d.OnPush})}}function YZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusProtocolLabelsMap.get(e))}}function XZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function ZZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",47),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,XZ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.modbus.host")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched?7:-1)}}function QZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.slaveConfigFormGroup.get("port")))}}function JZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",48),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,QZ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.port")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("min",e.portLimits.MIN),t.ɵɵpropertyInterpolate("max",e.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,7,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function eQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function tQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",49),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,eQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.modbus.serial-port")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched?7:-1)}}function nQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusMethodLabelsMap.get(e))}}function iQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function aQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function rQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusParityLabelsMap.get(e))}}function oQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15)(5,"mat-select",50),t.ɵɵrepeaterCreate(6,iQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",13)(9,"div",14),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-select",51),t.ɵɵrepeaterCreate(14,aQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",13)(17,"div",14),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",15),t.ɵɵelement(21,"input",52),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",53),t.ɵɵrepeaterCreate(29,rQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",23)(32,"mat-slide-toggle",54)(33,"mat-label",34),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,7,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusBaudrates),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,9,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusByteSizes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(18,11,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,13,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,15,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusParities),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(34,17,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(36,19,"gateway.strict")," ")}}function sQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function lQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function pQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function cQ(e,n){1&e&&(t.ɵɵelementStart(0,"div",23)(1,"mat-slide-toggle",55)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.send-data-on-change")," "))}function dQ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",24),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function uQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function mQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function hQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",31)(1,"mat-expansion-panel",56)(2,"mat-expansion-panel-header",57)(3,"mat-panel-title")(4,"mat-slide-toggle",58),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",59),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("expanded",e.showSecurityControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showSecurityControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,3,"gateway.tls-connection")," ")}}e("ModbusSecurityConfigComponent",KZ),Ze([I()],KZ.prototype,"isMaster",void 0);class gQ extends pZ{constructor(e,t,n,i,a){super(e,t,n,i,a),this.fb=e,this.store=t,this.router=n,this.data=i,this.dialogRef=a}getSlaveResultData(){const{values:e,type:t,serialPort:n,...i}=this.slaveConfigFormGroup.value,a={...i,type:t,...e};return t===sa.Serial&&(a.port=n),a.reportStrategy||delete a.reportStrategy,te(a),a}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("reportStrategy",this.fb.control(null))}static{this.ɵfac=function(e){return new(e||gQ)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gQ,selectors:[["tb-modbus-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:144,vars:91,consts:[[1,"slaves-config-container"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"tb-form-panel",3,"formGroup"],[1,"stroked","tb-form-panel"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","method"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","unitId",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],[1,"tb-form-row"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["formControlName","byteOrder"],["formControlName","wordOrder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],["matInput","","type","number","min","0","name","retries","formControlName","retries",3,"placeholder"],["formControlName","retryOnEmpty",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnInvalid",1,"mat-slide"],[1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","100","name","value","formControlName","pollPeriod",3,"placeholder"],["translate","",1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","500","name","value","formControlName","connectAttemptTimeMs",3,"placeholder"],["matInput","","type","number","min","1","name","value","formControlName","connectAttemptCount",3,"placeholder"],["matInput","","type","number","min","30000","name","value","formControlName","waitAfterFailedAttemptsMs",3,"placeholder"],["formControlName","values",3,"singleMode","hideNewFields"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matInput","","name","value","formControlName","serialPort",3,"placeholder"],["formControlName","baudrate"],["formControlName","bytesize"],["matInput","","type","number","min","0","name","value","formControlName","stopbits",3,"placeholder"],["formControlName","parity"],["formControlName","strict",1,"mat-slide"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide","justify-start",3,"click","formControl"],["formControlName","security",1,"security-config"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8)(13,"div",9)(14,"div",10),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",11),t.ɵɵrepeaterCreate(17,YZ,2,2,"tb-toggle-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",8),t.ɵɵtemplate(20,ZZ,8,7,"div",13)(21,JZ,8,9,"div",13)(22,tQ,8,7,"div",13),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",16),t.ɵɵrepeaterCreate(29,nQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(31,oQ,37,21),t.ɵɵelementStart(32,"div",13)(33,"div",17),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(36,"mat-form-field",15),t.ɵɵelement(37,"input",18),t.ɵɵpipe(38,"translate"),t.ɵɵtemplate(39,sQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(40,"div",13)(41,"div",20),t.ɵɵtext(42,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-form-field",15),t.ɵɵelement(44,"input",21),t.ɵɵpipe(45,"translate"),t.ɵɵtemplate(46,lQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"div",13)(48,"div",20),t.ɵɵtext(49,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(50,"mat-form-field",15),t.ɵɵelement(51,"input",22),t.ɵɵpipe(52,"translate"),t.ɵɵtemplate(53,pQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵtemplate(54,cQ,5,3,"div",23)(55,dQ,1,2,"tb-report-strategy",24),t.ɵɵelementStart(56,"div",25)(57,"mat-expansion-panel",26)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",27),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",8)(63,"div",13)(64,"div",14),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",15),t.ɵɵelement(68,"input",28),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",13)(71,"div",14),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",15)(75,"mat-select",29),t.ɵɵrepeaterCreate(76,uQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(78,"div",13)(79,"div",14),t.ɵɵpipe(80,"translate"),t.ɵɵtext(81,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(82,"mat-form-field",15)(83,"mat-select",30),t.ɵɵrepeaterCreate(84,mQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(86,hQ,9,5,"div",31),t.ɵɵelementStart(87,"div",23)(88,"div",14),t.ɵɵpipe(89,"translate"),t.ɵɵtext(90,"gateway.retries"),t.ɵɵelementEnd(),t.ɵɵelementStart(91,"mat-form-field",15),t.ɵɵelement(92,"input",32),t.ɵɵpipe(93,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"div",23)(95,"mat-slide-toggle",33)(96,"mat-label",34),t.ɵɵpipe(97,"translate"),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(100,"div",23)(101,"mat-slide-toggle",35)(102,"mat-label",34),t.ɵɵpipe(103,"translate"),t.ɵɵtext(104),t.ɵɵpipe(105,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(106,"div",13)(107,"div",36),t.ɵɵpipe(108,"translate"),t.ɵɵelementStart(109,"span",37),t.ɵɵtext(110," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"mat-form-field",15),t.ɵɵelement(112,"input",38),t.ɵɵpipe(113,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(114,"div",13)(115,"div",39),t.ɵɵpipe(116,"translate"),t.ɵɵtext(117,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(118,"mat-form-field",15),t.ɵɵelement(119,"input",40),t.ɵɵpipe(120,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(121,"div",13)(122,"div",39),t.ɵɵpipe(123,"translate"),t.ɵɵtext(124,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(125,"mat-form-field",15),t.ɵɵelement(126,"input",41),t.ɵɵpipe(127,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(128,"div",13)(129,"div",39),t.ɵɵpipe(130,"translate"),t.ɵɵtext(131,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(132,"mat-form-field",15),t.ɵɵelement(133,"input",42),t.ɵɵpipe(134,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(135,"div",25),t.ɵɵelement(136,"tb-modbus-values",43),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(137,"div",44)(138,"button",45),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(141,"button",46),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(142),t.ɵɵpipe(143,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,39,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵrepeater(n.modbusProtocolTypes),t.ɵɵadvance(3),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?21:22),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,41,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵrepeater(n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType===n.ModbusProtocolType.Serial?31:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(34,43,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(38,45,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched?39:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(45,47,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched?46:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(52,49,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched?53:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?54:55),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,51,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,53,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,55,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(80,57,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?86:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(89,59,"gateway.hints.modbus.retries")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(93,61,"gateway.set")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(97,63,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(99,65,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(103,67,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(105,69,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(108,71,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(113,73,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(116,75,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(120,77,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(123,79,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(127,81,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(130,83,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(134,85,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,87,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(143,89,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(gQ,[T,HZ,KZ,oK,pi,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .slaves-config-container[_ngcontent-%COMP%]{width:80vw;max-width:900px}[_nghost-%COMP%] .slave-name-label[_ngcontent-%COMP%]{margin-right:16px;color:#000000de}[_nghost-%COMP%] .fixed-title-width-260[_ngcontent-%COMP%]{min-width:260px}[_nghost-%COMP%] .security-config .fixed-title-width{min-width:230px}'],changeDetection:d.OnPush})}}function fQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusProtocolLabelsMap.get(e))}}function yQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function vQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",47),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,yQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.modbus.host")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched?7:-1)}}function xQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.slaveConfigFormGroup.get("port")))}}function bQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",48),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,xQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.port")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("min",e.portLimits.MIN),t.ɵɵpropertyInterpolate("max",e.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,7,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function wQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function SQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",49),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,wQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.modbus.serial-port")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched?7:-1)}}function CQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusMethodLabelsMap.get(e))}}function _Q(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function TQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function EQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusParityLabelsMap.get(e))}}function IQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15)(5,"mat-select",50),t.ɵɵrepeaterCreate(6,_Q,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",13)(9,"div",14),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-select",51),t.ɵɵrepeaterCreate(14,TQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",13)(17,"div",14),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",15),t.ɵɵelement(21,"input",52),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",53),t.ɵɵrepeaterCreate(29,EQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",23)(32,"mat-slide-toggle",54)(33,"mat-label",34),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,7,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusBaudrates),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,9,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusByteSizes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(18,11,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,13,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,15,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusParities),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(34,17,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(36,19,"gateway.strict")," ")}}function MQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function kQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function PQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function DQ(e,n){1&e&&(t.ɵɵelementStart(0,"div",23)(1,"mat-slide-toggle",55)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.send-data-on-change")," "))}function AQ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",24),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function OQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function RQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function BQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",31)(1,"mat-expansion-panel",56)(2,"mat-expansion-panel-header",57)(3,"mat-panel-title")(4,"mat-slide-toggle",58),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",59),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("expanded",e.showSecurityControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showSecurityControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,3,"gateway.tls-connection")," ")}}e("ModbusSlaveDialogComponent",gQ);class FQ extends pZ{constructor(e,t,n,i,a){super(e,t,n,i,a),this.fb=e,this.store=t,this.router=n,this.data=i,this.dialogRef=a}getSlaveResultData(){const{values:e,type:t,serialPort:n,...i}=this.slaveConfigFormGroup.value,a={...i,type:t,...e};return t===sa.Serial&&(a.port=n),te(a),a}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("sendDataOnlyOnChange",this.fb.control(!1))}static{this.ɵfac=function(e){return new(e||FQ)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:FQ,selectors:[["tb-modbus-legacy-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:144,vars:91,consts:[[1,"slaves-config-container"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"tb-form-panel",3,"formGroup"],[1,"stroked","tb-form-panel"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","method"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","unitId",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],[1,"tb-form-row"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["formControlName","byteOrder"],["formControlName","wordOrder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],["matInput","","type","number","min","0","name","retries","formControlName","retries",3,"placeholder"],["formControlName","retryOnEmpty",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnInvalid",1,"mat-slide"],[1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","100","name","value","formControlName","pollPeriod",3,"placeholder"],["translate","",1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","500","name","value","formControlName","connectAttemptTimeMs",3,"placeholder"],["matInput","","type","number","min","1","name","value","formControlName","connectAttemptCount",3,"placeholder"],["matInput","","type","number","min","30000","name","value","formControlName","waitAfterFailedAttemptsMs",3,"placeholder"],["formControlName","values",3,"singleMode","hideNewFields"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matInput","","name","value","formControlName","serialPort",3,"placeholder"],["formControlName","baudrate"],["formControlName","bytesize"],["matInput","","type","number","min","0","name","value","formControlName","stopbits",3,"placeholder"],["formControlName","parity"],["formControlName","strict",1,"mat-slide"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide","justify-start",3,"click","formControl"],["formControlName","security",1,"security-config"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8)(13,"div",9)(14,"div",10),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",11),t.ɵɵrepeaterCreate(17,fQ,2,2,"tb-toggle-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",8),t.ɵɵtemplate(20,vQ,8,7,"div",13)(21,bQ,8,9,"div",13)(22,SQ,8,7,"div",13),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",16),t.ɵɵrepeaterCreate(29,CQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(31,IQ,37,21),t.ɵɵelementStart(32,"div",13)(33,"div",17),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(36,"mat-form-field",15),t.ɵɵelement(37,"input",18),t.ɵɵpipe(38,"translate"),t.ɵɵtemplate(39,MQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(40,"div",13)(41,"div",20),t.ɵɵtext(42,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-form-field",15),t.ɵɵelement(44,"input",21),t.ɵɵpipe(45,"translate"),t.ɵɵtemplate(46,kQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"div",13)(48,"div",20),t.ɵɵtext(49,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(50,"mat-form-field",15),t.ɵɵelement(51,"input",22),t.ɵɵpipe(52,"translate"),t.ɵɵtemplate(53,PQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵtemplate(54,DQ,5,3,"div",23)(55,AQ,1,2,"tb-report-strategy",24),t.ɵɵelementStart(56,"div",25)(57,"mat-expansion-panel",26)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",27),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",8)(63,"div",13)(64,"div",14),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",15),t.ɵɵelement(68,"input",28),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",13)(71,"div",14),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",15)(75,"mat-select",29),t.ɵɵrepeaterCreate(76,OQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(78,"div",13)(79,"div",14),t.ɵɵpipe(80,"translate"),t.ɵɵtext(81,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(82,"mat-form-field",15)(83,"mat-select",30),t.ɵɵrepeaterCreate(84,RQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(86,BQ,9,5,"div",31),t.ɵɵelementStart(87,"div",23)(88,"div",14),t.ɵɵpipe(89,"translate"),t.ɵɵtext(90,"gateway.retries"),t.ɵɵelementEnd(),t.ɵɵelementStart(91,"mat-form-field",15),t.ɵɵelement(92,"input",32),t.ɵɵpipe(93,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"div",23)(95,"mat-slide-toggle",33)(96,"mat-label",34),t.ɵɵpipe(97,"translate"),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(100,"div",23)(101,"mat-slide-toggle",35)(102,"mat-label",34),t.ɵɵpipe(103,"translate"),t.ɵɵtext(104),t.ɵɵpipe(105,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(106,"div",13)(107,"div",36),t.ɵɵpipe(108,"translate"),t.ɵɵelementStart(109,"span",37),t.ɵɵtext(110," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"mat-form-field",15),t.ɵɵelement(112,"input",38),t.ɵɵpipe(113,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(114,"div",13)(115,"div",39),t.ɵɵpipe(116,"translate"),t.ɵɵtext(117,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(118,"mat-form-field",15),t.ɵɵelement(119,"input",40),t.ɵɵpipe(120,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(121,"div",13)(122,"div",39),t.ɵɵpipe(123,"translate"),t.ɵɵtext(124,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(125,"mat-form-field",15),t.ɵɵelement(126,"input",41),t.ɵɵpipe(127,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(128,"div",13)(129,"div",39),t.ɵɵpipe(130,"translate"),t.ɵɵtext(131,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(132,"mat-form-field",15),t.ɵɵelement(133,"input",42),t.ɵɵpipe(134,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(135,"div",25),t.ɵɵelement(136,"tb-modbus-values",43),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(137,"div",44)(138,"button",45),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(141,"button",46),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(142),t.ɵɵpipe(143,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,39,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵrepeater(n.modbusProtocolTypes),t.ɵɵadvance(3),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?21:22),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,41,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵrepeater(n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType===n.ModbusProtocolType.Serial?31:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(34,43,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(38,45,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched?39:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(45,47,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched?46:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(52,49,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched?53:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?54:55),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,51,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,53,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,55,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(80,57,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?86:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(89,59,"gateway.hints.modbus.retries")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(93,61,"gateway.set")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(97,63,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(99,65,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(103,67,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(105,69,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(108,71,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(113,73,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(116,75,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(120,77,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(123,79,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(127,81,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(130,83,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(134,85,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,87,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(143,89,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(FQ,[me,T,HZ,KZ,oK,pi]),styles:['@charset "UTF-8";[_nghost-%COMP%] .slaves-config-container[_ngcontent-%COMP%]{width:80vw;max-width:900px}[_nghost-%COMP%] .slave-name-label[_ngcontent-%COMP%]{margin-right:16px;color:#000000de}[_nghost-%COMP%] .fixed-title-width-260[_ngcontent-%COMP%]{min-width:260px}[_nghost-%COMP%] .security-config .fixed-title-width{min-width:230px}'],changeDetection:d.OnPush})}}function NQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusProtocolLabelsMap.get(e))}}function LQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function VQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9),t.ɵɵelement(5,"input",34),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,LQ,3,3,"mat-icon",35),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.modbus.host")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched?7:-1)}}function qQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.slaveConfigFormGroup.get("port")))}}function GQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9),t.ɵɵelement(5,"input",36),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,qQ,3,3,"mat-icon",35),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.port")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("min",e.portLimits.MIN),t.ɵɵpropertyInterpolate("max",e.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,7,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function zQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function UQ(e,n){if(1&e&&t.ɵɵtemplate(0,zQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext(2);t.ɵɵconditional(e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched?0:-1)}}function jQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9),t.ɵɵelement(5,"input",37),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,UQ,1,1),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.modbus.serial-port")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function HQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusMethodLabelsMap.get(e))}}function WQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function $Q(e,n){if(1&e&&t.ɵɵtemplate(0,WQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.slaveConfigFormGroup.get("unitId").hasError("required")&&e.slaveConfigFormGroup.get("unitId").touched?0:-1)}}function KQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function YQ(e,n){if(1&e&&t.ɵɵtemplate(0,KQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.slaveConfigFormGroup.get("deviceName").hasError("required")&&e.slaveConfigFormGroup.get("deviceName").touched?0:-1)}}function XQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function ZQ(e,n){if(1&e&&t.ɵɵtemplate(0,XQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.slaveConfigFormGroup.get("deviceType").hasError("required")&&e.slaveConfigFormGroup.get("deviceType").touched?0:-1)}}function QQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function JQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",8),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9)(5,"mat-select",38),t.ɵɵrepeaterCreate(6,QQ,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,1,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusBaudrates)}}function eJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function tJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function nJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",26)(1,"mat-expansion-panel",39)(2,"mat-expansion-panel-header",40)(3,"mat-panel-title")(4,"mat-slide-toggle",41),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",42),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("expanded",e.showSecurityControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showSecurityControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,3,"gateway.tls-connection")," ")}}e("ModbusLegacySlaveDialogComponent",FQ);class iJ{constructor(e){this.fb=e,this.ModbusProtocolLabelsMap=wa,this.ModbusMethodLabelsMap=ba,this.portLimits=Vi,this.modbusProtocolTypes=Object.values(sa),this.modbusMethodTypes=Object.values(la),this.modbusSerialMethodTypes=Object.values(pa),this.modbusOrderType=Object.values(da),this.ModbusProtocolType=sa,this.modbusBaudrates=ha,this.isSlaveEnabled=!1,this.serialSpecificControlKeys=["serialPort","baudrate"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new Ie,this.showSecurityControl=this.fb.control(!1),this.slaveConfigFormGroup=this.fb.group({type:[sa.TCP],host:["",[xe.required,xe.pattern(fn)]],port:[null,[xe.required,xe.min(Vi.MIN),xe.max(Vi.MAX)]],serialPort:["",[xe.required,xe.pattern(fn)]],method:[la.SOCKET],unitId:[null,[xe.required]],baudrate:[this.modbusBaudrates[0]],deviceName:["",[xe.required,xe.pattern(fn)]],deviceType:["",[xe.required,xe.pattern(fn)]],pollPeriod:[1e3,[xe.required]],sendDataToThingsBoard:[!1],byteOrder:[da.BIG],wordOrder:[da.BIG],security:[],identity:this.fb.group({vendorName:["",[xe.pattern(fn)]],productCode:["",[xe.pattern(fn)]],vendorUrl:["",[xe.pattern(fn)]],productName:["",[xe.pattern(fn)]],modelName:["",[xe.pattern(fn)]]}),values:[]}),this.observeValueChanges(),this.observeTypeChange(),this.observeShowSecurity()}get protocolType(){return this.slaveConfigFormGroup.get("type").value}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.slaveConfigFormGroup.valid?null:{slaveConfigFormGroup:{valid:!1}}}writeValue(e){this.showSecurityControl.patchValue(!!e.security&&!Q(e.security,{})),this.updateSlaveConfig(e)}setDisabledState(e){this.isSlaveEnabled=!e,this.updateFormEnableState()}observeValueChanges(){this.slaveConfigFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{e.type===sa.Serial&&(e.port=e.serialPort,delete e.serialPort),this.onChange(e),this.onTouched()}))}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.updateFormEnableState(),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==la.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===sa.Serial?pa.ASCII:la.SOCKET,{emitEvent:!1})}updateFormEnableState(){this.isSlaveEnabled?(this.slaveConfigFormGroup.enable({emitEvent:!1}),this.showSecurityControl.enable({emitEvent:!1})):(this.slaveConfigFormGroup.disable({emitEvent:!1}),this.showSecurityControl.disable({emitEvent:!1})),this.updateEnablingByProtocol(),this.updateSecurityEnable(this.showSecurityControl.value)}observeShowSecurity(){this.showSecurityControl.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>this.updateSecurityEnable(e)))}updateSecurityEnable(e){e&&this.isSlaveEnabled&&this.protocolType!==sa.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}updateEnablingByProtocol(){const e=this.protocolType===sa.Serial,t=e?this.serialSpecificControlKeys:this.tcpUdpSpecificControlKeys,n=e?this.tcpUdpSpecificControlKeys:this.serialSpecificControlKeys;this.isSlaveEnabled&&t.forEach((e=>this.slaveConfigFormGroup.get(e)?.enable({emitEvent:!1}))),n.forEach((e=>this.slaveConfigFormGroup.get(e)?.disable({emitEvent:!1})))}updateSlaveConfig(e){const{vendorName:t="",productCode:n="",vendorUrl:i="",productName:a="",modelName:r=""}=e.identity??{},o={vendorName:t,productCode:n,vendorUrl:i,productName:a,modelName:r},{type:s=sa.TCP,method:l=la.RTU,unitId:p=0,deviceName:c="",deviceType:d="",pollPeriod:u=1e3,sendDataToThingsBoard:m=!1,byteOrder:h=da.BIG,wordOrder:g=da.BIG,security:f={},values:y={},baudrate:v=this.modbusBaudrates[0],host:x="",port:b=null}=e,w={type:s,method:l,unitId:p,deviceName:c,deviceType:d,pollPeriod:u,sendDataToThingsBoard:!!m,byteOrder:h,wordOrder:g,security:f,identity:o,values:y,baudrate:v,host:s===sa.Serial?"":x,port:s===sa.Serial?null:b,serialPort:s===sa.Serial?b:""};this.slaveConfigFormGroup.setValue(w,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||iJ)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:iJ,selectors:[["tb-modbus-slave-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>iJ)),multi:!0},{provide:be,useExisting:c((()=>iJ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:115,vars:54,consts:[[1,"slave-container",3,"formGroup"],[1,"slave-content","tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","method"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","unitId",3,"placeholder"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","100","name","value","formControlName","pollPeriod",3,"placeholder"],[1,"tb-form-row"],["formControlName","sendDataToThingsBoard",1,"mat-slide"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],["formControlName","byteOrder"],["formControlName","wordOrder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[3,"formGroup"],["matInput","","name","value","formControlName","vendorName",3,"placeholder"],["matInput","","name","value","formControlName","productCode",3,"placeholder"],["matInput","","name","value","formControlName","vendorUrl",3,"placeholder"],["matInput","","name","value","formControlName","productName",3,"placeholder"],["matInput","","name","value","formControlName","modelName",3,"placeholder"],["formControlName","values"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matInput","","name","value","formControlName","serialPort",3,"placeholder"],["formControlName","baudrate"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],["formControlName","security"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),t.ɵɵtext(4,"gateway.server-slave-config"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",4),t.ɵɵrepeaterCreate(6,NQ,2,2,"tb-toggle-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",6),t.ɵɵtemplate(9,VQ,8,7,"div",7)(10,GQ,8,9,"div",7)(11,jQ,8,7,"div",7),t.ɵɵelementStart(12,"div",7)(13,"div",8),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-form-field",9)(17,"mat-select",10),t.ɵɵrepeaterCreate(18,HQ,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(20,"div",7)(21,"div",11),t.ɵɵpipe(22,"translate"),t.ɵɵtext(23,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",9),t.ɵɵelement(25,"input",12),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,$Q,1,1),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"div",7)(29,"div",13),t.ɵɵtext(30,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",9),t.ɵɵelement(32,"input",14),t.ɵɵpipe(33,"translate"),t.ɵɵtemplate(34,YQ,1,1),t.ɵɵelementEnd()(),t.ɵɵelementStart(35,"div",7)(36,"div",13),t.ɵɵtext(37,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field",9),t.ɵɵelement(39,"input",15),t.ɵɵpipe(40,"translate"),t.ɵɵtemplate(41,ZQ,1,1),t.ɵɵelementEnd()(),t.ɵɵelementStart(42,"div",7)(43,"div",16),t.ɵɵpipe(44,"translate"),t.ɵɵelementStart(45,"span",17),t.ɵɵtext(46," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"mat-form-field",9),t.ɵɵelement(48,"input",18),t.ɵɵpipe(49,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(50,JQ,8,3,"div",7),t.ɵɵelementStart(51,"div",19)(52,"mat-slide-toggle",20)(53,"mat-label"),t.ɵɵtext(54),t.ɵɵpipe(55,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(56,"div",21)(57,"mat-expansion-panel",22)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",23),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",6)(63,"div",7)(64,"div",8),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",9)(68,"mat-select",24),t.ɵɵrepeaterCreate(69,eJ,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(71,"div",7)(72,"div",8),t.ɵɵpipe(73,"translate"),t.ɵɵtext(74,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(75,"mat-form-field",9)(76,"mat-select",25),t.ɵɵrepeaterCreate(77,tJ,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(79,nJ,9,5,"div",26),t.ɵɵelementContainerStart(80,27),t.ɵɵelementStart(81,"div",7)(82,"div",3),t.ɵɵtext(83,"gateway.vendor-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(84,"mat-form-field",9),t.ɵɵelement(85,"input",28),t.ɵɵpipe(86,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(87,"div",7)(88,"div",3),t.ɵɵtext(89,"gateway.product-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(90,"mat-form-field",9),t.ɵɵelement(91,"input",29),t.ɵɵpipe(92,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(93,"div",7)(94,"div",3),t.ɵɵtext(95,"gateway.vendor-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(96,"mat-form-field",9),t.ɵɵelement(97,"input",30),t.ɵɵpipe(98,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(99,"div",7)(100,"div",3),t.ɵɵtext(101,"gateway.product-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(102,"mat-form-field",9),t.ɵɵelement(103,"input",31),t.ɵɵpipe(104,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(105,"div",7)(106,"div",3),t.ɵɵtext(107,"gateway.model-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(108,"mat-form-field",9),t.ɵɵelement(109,"input",32),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()(),t.ɵɵelementStart(111,"div",21)(112,"div",23),t.ɵɵtext(113,"gateway.values"),t.ɵɵelementEnd(),t.ɵɵelement(114,"tb-modbus-values",33),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(6),t.ɵɵrepeater(n.modbusProtocolTypes),t.ɵɵadvance(3),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?9:-1),t.ɵɵadvance(),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?10:11),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(14,24,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵrepeater(n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(22,26,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched?27:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,30,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched?34:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(40,32,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched?41:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(44,34,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(49,36,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType===n.ModbusProtocolType.Serial?50:-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(55,38,"gateway.send-data-to-platform")," "),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,40,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(73,42,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?79:-1),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup.get("identity")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(86,44,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(92,46,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(98,48,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(104,50,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,52,"gateway.set")))},dependencies:t.ɵɵgetComponentDepsFactory(iJ,[T,HZ,KZ,oK,Jn]),encapsulation:2,changeDetection:d.OnPush})}}e("ModbusSlaveConfigComponent",iJ);const aJ=["searchInput"],rJ=()=>["deviceName","info","unitId","type","actions"],oJ=()=>({minWidth:"96px",textAlign:"center"});function sJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"div",27)(2,"span",28),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",29),t.ɵɵelementStart(6,"button",12),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageSlave(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",12),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.servers-slaves")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(7,5,"action.add")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,7,"action.search")))}function lJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.device-name")))}function pJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.deviceName)}}function cJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.info")," "))}function dJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){let e;const i=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(null!==(e=i.host)&&void 0!==e?e:i.port)}}function uJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.unit-id")," "))}function mJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.unitId)}}function hJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30)(1,"div"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.type")))}function gJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.ModbusProtocolLabelsMap.get(e.type)," ")}}function fJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function yJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageSlave(n,i))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",12),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteSlave(n,i))})),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.edit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(5,4,"action.delete")))}function vJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,yJ,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",33),t.ɵɵelementContainer(4,34),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",35)(6,"button",36),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",37),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",38,2),t.ɵɵelementContainer(11,34),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,oJ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function xJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function bJ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class wJ{constructor(e,t,n,i,a){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=i,this.cdr=a,this.isLegacy=!1,this.textSearchMode=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.ModbusProtocolLabelsMap=wa,this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new Ie,this.masterFormGroup=this.fb.group({slaves:this.fb.array([])}),this.dataSource=new SJ}get slaves(){return this.masterFormGroup.get("slaves")}ngOnInit(){this.masterFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.updateTableData(e.slaves,this.textSearch.value.trim()),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Ne(150),Fe(((e,t)=>(e??"")===t.trim())),Re(this.destroy$)).subscribe((e=>this.updateTableData(this.slaves.value,e.trim())))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){this.slaves.clear(),this.pushDataAsFormArrays(e.slaves)}enterFilterMode(){this.textSearchMode=!0,this.cdr.detectChanges();const e=this.searchInputField.nativeElement;e.focus(),e.setSelectionRange(0,0)}exitFilterMode(){this.updateTableData(this.slaves.value),this.textSearchMode=!1,this.textSearch.reset()}manageSlave(e,t){e&&e.stopPropagation();const n=re(t),i=n?this.getSlaveIndex(t):-1,a=n?this.slaves.at(i).value:{};this.getSlaveDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ue(1),Re(this.destroy$)).subscribe((e=>{e&&(n?this.slaves.at(i).patchValue(e):this.slaves.push(this.fb.control(e)),this.masterFormGroup.markAsDirty())}))}getSlaveIndex(e){return this.slaves.controls.findIndex((t=>t.value===e))}getSlaveDialog(e,t){return this.isLegacy?this.dialog.open(FQ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,hideNewFields:!0,buttonTitle:t}}):this.dialog.open(gQ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,hideNewFields:!1}})}deleteSlave(e,t){e&&e.stopPropagation();const n=this.getSlaveIndex(t);this.dialogService.confirm(this.translate.instant("gateway.delete-slave-title",{name:t.deviceName}),this.translate.instant("gateway.delete-slave-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ue(1),Re(this.destroy$)).subscribe((e=>{e&&(this.slaves.removeAt(n),this.masterFormGroup.markAsDirty())}))}updateTableData(e,t){t&&(e=e.filter((e=>Object.values(e).some((e=>e.toString().toLowerCase().includes(t.toLowerCase())))))),this.dataSource.loadData(e)}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.slaves.push(this.fb.control(e))))}static{this.ɵfac=function(e){return new(e||wJ)(t.ɵɵdirectiveInject(he.TranslateService),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(ee.DialogService),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:wJ,selectors:[["tb-modbus-master-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(aJ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{isLegacy:"isLegacy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>wJ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:55,vars:41,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-master-table","tb-absolute-fill"],[1,"tb-form-panel","no-border","no-padding","padding-top","hint-container"],["tbTruncateWithTooltip","",1,"tb-form-hint","tb-primary-fill","tb-flex"],[1,"tb-master-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","table-value-column",4,"matHeaderCellDef"],["class","table-value-column",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-master-table-title"],[1,"flex-1"],[1,"table-value-column"],["tbTruncateWithTooltip",""],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"div",5),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"div",6)(6,"mat-toolbar",7),t.ɵɵtemplate(7,sJ,14,9,"div",8),t.ɵɵpipe(8,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-toolbar",7)(10,"div",8)(11,"button",9),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"mat-icon"),t.ɵɵtext(14,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",10)(16,"mat-label"),t.ɵɵtext(17," "),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",11,0),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",12),t.ɵɵpipe(22,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())})),t.ɵɵelementStart(23,"mat-icon"),t.ɵɵtext(24,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(25,"div",13)(26,"table",14),t.ɵɵelementContainerStart(27,15),t.ɵɵtemplate(28,lJ,4,3,"mat-header-cell",16)(29,pJ,3,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(30,15),t.ɵɵtemplate(31,cJ,3,3,"mat-header-cell",16)(32,dJ,3,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(33,15),t.ɵɵtemplate(34,uJ,3,3,"mat-header-cell",16)(35,mJ,3,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(36,15),t.ɵɵtemplate(37,hJ,4,3,"mat-header-cell",16)(38,gJ,2,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(39,18),t.ɵɵtemplate(40,fJ,1,0,"mat-header-cell",19)(41,vJ,12,6,"mat-cell",20),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(42,xJ,1,0,"mat-header-row",21)(43,bJ,1,0,"mat-row",22),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"section",23),t.ɵɵpipe(45,"async"),t.ɵɵelementStart(46,"button",24),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageSlave(i))})),t.ɵɵelementStart(47,"mat-icon",25),t.ɵɵtext(48,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"span"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(52,"span",26),t.ɵɵpipe(53,"async"),t.ɵɵtext(54," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,23,"gateway.hints.modbus-master")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(8,25,n.dataSource.isEmpty())?7:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(12,27,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(20,29,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(22,31,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","deviceName"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","info"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","unitId"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","type"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(39,rJ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(40,rJ)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(45,33,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(51,35,"gateway.add-slave")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(53,37,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(wJ,[me,T,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%]{width:100%;height:calc(100% - 60px);background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .tb-master-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:15%}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width: 599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-master-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{z-index:1000}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:d.OnPush})}}e("ModbusMasterTableComponent",wJ),Ze([ut()],wJ.prototype,"isLegacy",void 0);class SJ extends ${constructor(){super()}}e("SlavesDatasource",SJ);class CJ extends Xa{constructor(){super(),this.enableSlaveControl=new Se(!1),this.enableSlaveControl.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.updateSlaveEnabling(e),this.basicFormGroup.get("slave").updateValueAndValidity({emitEvent:!!this.onChange})}))}writeValue(e){super.writeValue(e),this.onEnableSlaveControl(e)}validate(){const{master:e,slave:t}=this.basicFormGroup.value,n=!e?.slaves?.length&&(Q(t,{})||!t);return!this.basicFormGroup.valid||n?{basicFormGroup:{valid:!1}}:null}initBasicFormGroup(){return this.fb.group({master:[],slave:[]})}updateSlaveEnabling(e){e?this.basicFormGroup.get("slave").enable({emitEvent:!1}):this.basicFormGroup.get("slave").disable({emitEvent:!1})}onEnableSlaveControl(e){this.enableSlaveControl.setValue(!!e.slave&&!Q(e.slave,{}))}static{this.ɵfac=function(e){return new(e||CJ)}}static{this.ɵdir=t.ɵɵdefineDirective({type:CJ,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusBasicConfigDirective",CJ);class _J extends CJ{constructor(){super(...arguments),this.isLegacy=!1}mapConfigToFormValue({master:e,slave:t}){return{master:e?.slaves?e:{slaves:[]},slave:t??{}}}getMappedValue(e){return{master:e.master,slave:e.slave}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(_J)))(n||_J)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:_J,selectors:[["tb-modbus-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>_J)),multi:!0},{provide:be,useExisting:c((()=>_J)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:19,vars:19,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","master",3,"isLegacy"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-form-hint","tb-primary-fill","tb-flex","center"],[1,"tb-form-row"],[1,"mat-slide",3,"formControl"],["formControlName","slave"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-modbus-master-table",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4)(10,"div",5),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",6)(14,"mat-slide-toggle",7)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(18,"tb-modbus-slave-config",8),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,9,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(5,11,"gateway.master-connections")),t.ɵɵadvance(2),t.ɵɵproperty("isLegacy",n.isLegacy),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(8,13,"gateway.server-config")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,15,"gateway.hints.modbus-server")),t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.enableSlaveControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,17,"gateway.enable")," "))},dependencies:t.ɵɵgetComponentDepsFactory(_J,[me,T,iJ,wJ,ei]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusBasicConfigComponent",_J);class TJ extends CJ{constructor(){super(...arguments),this.isLegacy=!0}mapConfigToFormValue(e){return{master:e.master?.slaves?e.master:{slaves:[]},slave:e.slave?ir.mapSlaveToUpgradedVersion(e.slave):{}}}getMappedValue(e){return{master:e.master,slave:e.slave?ir.mapSlaveToDowngradedVersion(e.slave):{}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(TJ)))(n||TJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:TJ,selectors:[["tb-modbus-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>TJ)),multi:!0},{provide:be,useExisting:c((()=>TJ)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:19,vars:19,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","master",3,"isLegacy"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-form-hint","tb-primary-fill","tb-flex","center"],[1,"tb-form-row"],[1,"mat-slide",3,"formControl"],["formControlName","slave"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-modbus-master-table",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4)(10,"div",5),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",6)(14,"mat-slide-toggle",7)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(18,"tb-modbus-slave-config",8),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,9,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(5,11,"gateway.master-connections")),t.ɵɵadvance(2),t.ɵɵproperty("isLegacy",n.isLegacy),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(8,13,"gateway.server-config")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,15,"gateway.hints.modbus-server")),t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.enableSlaveControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,17,"gateway.enable")," "))},dependencies:t.ɵɵgetComponentDepsFactory(TJ,[me,T,iJ,wJ,ei]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusLegacyBasicConfigComponent",TJ);const EJ=()=>({maxWidth:"970px"});function IJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," ")}}function MJ(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate1(" ",e.get("methodRPC").value," ")}}function kJ(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate1(" ",e.get("attributeOnThingsBoard").value," ")}}function PJ(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate2(" ",e.get("requestExpression").value+" - ","",e.get("attributeNameExpression").value," ")}}function DJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵtemplate(1,MJ,1,1)(2,kJ,1,1)(3,PJ,1,2),t.ɵɵelementEnd()),2&e){let e;const n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵconditional((e=n.keysType)===n.SocketValueKey.RPC_METHODS?1:e===n.SocketValueKey.ATTRIBUTES_UPDATES?2:e===n.SocketValueKey.ATTRIBUTES_REQUESTS?3:-1)}}function AJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function OJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function RJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function BJ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",33),2&e){const e=t.ɵɵnextContext(5);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function FJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",17)(2,"div",18),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",19)(5,"div",20),t.ɵɵpipe(6,"translate"),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"div",21)(11,"mat-form-field",22),t.ɵɵelement(12,"input",23),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,AJ,3,3,"mat-icon",24),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",19)(19,"div",25)(20,"span",26),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"div",27),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"label",28),t.ɵɵtext(25,"from"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",29),t.ɵɵelement(27,"input",30),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,OJ,3,3,"mat-icon",24),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"label",31),t.ɵɵtext(31,"to"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",29),t.ɵɵelement(33,"input",32),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,RJ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(36,BJ,1,2,"tb-report-strategy",33),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",n.keysType===n.SocketValueKey.ATTRIBUTES?t.ɵɵpipeBind1(6,12,"gateway.hints.socket.key-attribute"):t.ɵɵpipeBind1(7,14,"gateway.hints.socket.key-telemetry")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,16,"gateway.key")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,18,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?14:-1),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,20,"gateway.byte")),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/byte_fn")("tb-help-popup-style",t.ɵɵpureFunction0(26,EJ)),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("byteFrom").hasError("required")&&e.get("byteFrom").touched?29:-1),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("byteTo").hasError("required")&&e.get("byteTo").touched?35:-1),t.ɵɵadvance(),t.ɵɵconditional(!n.withReportStrategy||n.keysType!==n.SocketValueKey.ATTRIBUTES&&n.keysType!==n.SocketValueKey.TIMESERIES?-1:36)}}function NJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function LJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function VJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",1)(1,"div",19)(2,"div",34),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",21)(6,"mat-form-field",22),t.ɵɵelement(7,"input",35),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,NJ,3,3,"mat-icon",24),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",19)(11,"div",36),t.ɵɵpipe(12,"translate"),t.ɵɵtext(13," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",21)(15,"mat-form-field",22)(16,"mat-select",37),t.ɵɵrepeaterCreate(17,LJ,2,2,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",39)(20,"mat-slide-toggle",40),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(21,"mat-label",41),t.ɵɵpipe(22,"translate"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,6,"gateway.method-name")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("methodRPC").hasError("required")&&e.get("methodRPC").touched?9:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(12,10,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(22,12,"gateway.hints.socket.with-response")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(24,14,"gateway.rpc.withResponse")," ")}}function qJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e)," ")}}function GJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e)," ")}}function zJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-expression-required"))}function UJ(e,n){1&e&&t.ɵɵelement(0,"div",27),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/request-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,EJ))}function jJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e)," ")}}function HJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-name-expression-required"))}function WJ(e,n){1&e&&t.ɵɵelement(0,"div",27),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/attribute-name-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,EJ))}function $J(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",19)(2,"div",36),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",21)(6,"mat-form-field",22)(7,"mat-select",42),t.ɵɵrepeaterCreate(8,qJ,3,4,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",19)(11,"div",34),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",43)(15,"mat-form-field",22)(16,"mat-select",44),t.ɵɵrepeaterCreate(17,GJ,3,4,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"mat-form-field",22),t.ɵɵelement(20,"input",45),t.ɵɵpipe(21,"translate"),t.ɵɵtemplate(22,zJ,3,3,"mat-icon",24)(23,UJ,1,3,"div",27),t.ɵɵelementEnd()()(),t.ɵɵelementStart(24,"div",19)(25,"div",34),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"div",43)(29,"mat-form-field",22)(30,"mat-select",46),t.ɵɵrepeaterCreate(31,jJ,3,4,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",22),t.ɵɵelement(34,"input",47),t.ɵɵpipe(35,"translate"),t.ɵɵtemplate(36,HJ,3,3,"mat-icon",24)(37,WJ,1,3,"div",27),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,9,"gateway.hints.socket.attribute-requests-type")),t.ɵɵadvance(6),t.ɵɵrepeater(n.requestsType),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,11,"gateway.request-expression")," "),t.ɵɵadvance(5),t.ɵɵrepeater(n.expressionType),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,13,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("requestExpression").hasError("required")&&e.get("requestExpression").touched?22:-1),t.ɵɵadvance(),t.ɵɵconditional(e.get("requestExpressionSource").value===n.ExpressionType.Expression?23:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,15,"gateway.attribute-name-expression")," "),t.ɵɵadvance(5),t.ɵɵrepeater(n.expressionType),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("attributeNameExpression").hasError("required")&&e.get("attributeNameExpression").touched?36:-1),t.ɵɵadvance(),t.ɵɵconditional(e.get("attributeNameExpressionSource").value===n.ExpressionType.Expression?37:-1)}}function KJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function YJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.socket.attribute-on-platform-required"))}function XJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",19)(2,"div",36),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",21)(6,"mat-form-field",22)(7,"mat-select",37),t.ɵɵrepeaterCreate(8,KJ,2,2,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",19)(11,"div",34),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",21)(15,"mat-form-field",22),t.ɵɵelement(16,"input",48),t.ɵɵpipe(17,"translate"),t.ɵɵtemplate(18,YJ,3,3,"mat-icon",24),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,4,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,6,"gateway.attribute-on-platform")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(17,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("attributeOnThingsBoard").hasError("required")&&e.get("attributeOnThingsBoard").touched?18:-1)}}function ZJ(e,n){if(1&e&&t.ɵɵtemplate(0,FJ,37,27,"div",1)(1,VJ,25,16,"div",1)(2,$J,38,19,"div",1)(3,XJ,19,10,"div",1),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(e.keysType===e.SocketValueKey.TIMESERIES||e.keysType===e.SocketValueKey.ATTRIBUTES?0:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.SocketValueKey.RPC_METHODS?1:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.SocketValueKey.ATTRIBUTES_REQUESTS?2:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.SocketValueKey.ATTRIBUTES_UPDATES?3:-1)}}function QJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header",13)(5,"mat-panel-title"),t.ɵɵtemplate(6,IJ,2,1,"div",14)(7,DJ,4,1,"div",14),t.ɵɵelementEnd()(),t.ɵɵtemplate(8,ZJ,4,4,"ng-template",15),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",16),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(3),t.ɵɵconditional(r.keysType===r.SocketValueKey.TIMESERIES||r.keysType===r.SocketValueKey.ATTRIBUTES?6:7),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,r.deleteKeyTitle))}}function JJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,QJ,13,6,"div",9,t.ɵɵcomponentInstance().trackByKey,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function e1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",49),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class t1 extends W{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=new u,this.SocketValueKey=wi,this.socketEncoding=Object.values(wt),this.requestsType=Object.values(Ci),this.expressionType=Object.values(_i),this.ExpressionType=_i,this.ReportStrategyDefaultValue=mn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===wi.RPC_METHODS?this.fb.group({methodRPC:["",[xe.required]],encoding:[wt.UTF16,[xe.required]],withResponse:[!0]}):this.keysType===wi.ATTRIBUTES_UPDATES?this.fb.group({encoding:[wt.UTF16,[xe.required]],attributeOnThingsBoard:["",[xe.required]]}):this.keysType===wi.ATTRIBUTES_REQUESTS?this.fb.group({type:[Ci.Shared],requestExpressionSource:[_i.Constant],attributeNameExpressionSource:[_i.Constant],requestExpression:["",[xe.required]],attributeNameExpression:["",[xe.required]]}):this.fb.group({key:["",[xe.required,xe.pattern(fn)]],byteFrom:[0,[xe.required]],byteTo:[0,[xe.required]],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]}),this.keysListFormArray.push(e)}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){let e=this.keysListFormArray.value.map((({reportStrategy:e,...t})=>({...t,...e&&{reportStrategy:e}})));this.keysDataApplied.emit(e)}prepareKeysFormArray(e){const t=[];return e?.forEach((e=>{let n;if(this.keysType===wi.RPC_METHODS){const t=e;n=this.fb.group({methodRPC:[t.methodRPC,[xe.required]],encoding:[t.encoding,[xe.required]],withResponse:[t.withResponse]})}else if(this.keysType===wi.ATTRIBUTES_REQUESTS){const t=e;n=this.fb.group({type:[t.type??Ci.Shared],requestExpressionSource:[t.requestExpressionSource??_i.Constant],attributeNameExpressionSource:[t.attributeNameExpressionSource??_i.Constant],requestExpression:[t.requestExpression,[xe.required]],attributeNameExpression:[t.attributeNameExpression,[xe.required]]})}else if(this.keysType===wi.ATTRIBUTES_UPDATES)n=this.fb.group({encoding:[e.encoding??wt.UTF16],attributeOnThingsBoard:[e.attributeOnThingsBoard,[xe.required]]});else{const{key:t,byteFrom:i,byteTo:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[xe.required,xe.pattern(fn)]],byteFrom:[i??0,[xe.required]],byteTo:[a??0,[xe.required]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)})),this.fb.array(t)}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===wi.ATTRIBUTES||this.keysType===wi.TIMESERIES))}static{this.ɵfac=function(e){return new(e||t1)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(ct.TbPopoverComponent),t.ɵɵdirectiveInject(nt.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:t1,selectors:[["tb-device-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",withReportStrategy:"withReportStrategy"},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:18,vars:15,consts:[[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"fixed-title-width","tb-flex","align-center"],[1,"tb-required"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["for","byteFrom",1,"tb-small-label"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","flex-1"],["matInput","","required","","formControlName","byteFrom","type","number","id","byteFrom",3,"placeholder"],["for","byteTo",1,"tb-small-label"],["matInput","","required","","formControlName","byteTo","type","number","id","byteTo",3,"placeholder"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","methodRPC",3,"placeholder"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","encoding"],[3,"value"],[1,"tb-form-row"],["formControlName","withResponse",1,"mat-slide",3,"click"],[3,"tb-hint-tooltip-icon"],["formControlName","type"],[1,"tb-flex"],["formControlName","requestExpressionSource"],["matInput","","name","value","formControlName","requestExpression",3,"placeholder"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","attributeOnThingsBoard",3,"placeholder"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,JJ,3,0,"div",3)(6,e1,3,1,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",(function(){return n.addKey()})),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",(function(){return n.applyKeysData()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(t1,[me,T,pi]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:500px;overflow:auto}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-small-label[_ngcontent-%COMP%]{font-size:16px;padding-right:0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:d.OnPush})}}e("DeviceDataKeysPanelComponent",t1),Ze([I()],t1.prototype,"withReportStrategy",void 0);const n1=()=>({maxWidth:"970px"});function i1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-filter-required"))}function a1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function r1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function o1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",26),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function s1(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",27),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function l1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function p1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function c1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.type," ")}}function d1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.encoding," ")}}function u1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.methodRPC," ")}}class m1 extends O{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.destroyRef=l,this.cdr=p,this.deviceFormGroup=this.fb.group({address:["",[xe.required,xe.pattern(fn)]],deviceName:["",[xe.required,xe.pattern(fn)]],deviceType:["",[xe.required,xe.pattern(fn)]],encoding:[wt.UTF8],telemetry:[[]],attributes:[[]],attributeRequests:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.SocketValueKey=wi,this.socketDeviceHelpLink=w+"/docs/iot-gateway/config/socket/#device-subsection",this.socketEncoding=Object.values(wt),this.ReportStrategyDefaultValue=mn,this.deviceFormGroup.patchValue(this.data.value,{emitEvent:!1})}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.deviceFormGroup.valid){const e=this.deviceFormGroup.value;te(e),this.dialogRef.close(e)}}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))return void this.popoverService.hidePopover(i);const a=this.deviceFormGroup.get(n),r={keys:a.value,keysType:n,panelTitle:Si.get(n),addKeyTitle:Ti.get(n),deleteKeyTitle:Ei.get(n),noKeysText:Ii.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,t1,"leftBottom",!1,null,r,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(On(this.destroyRef)).subscribe((e=>{this.popoverComponent.hide(),a.patchValue(e),a.markAsDirty(),this.cdr.markForCheck()})),this.popoverComponent.tbHideStart.pipe(On(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||m1)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(dt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:m1,selectors:[["tb-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:125,vars:51,consts:[["socketTelemetryButton",""],["attributesButton",""],["attributeRequestsButton",""],["attributesUpdatesButton",""],["rpcMethodsButton",""],[1,"dialog-mapping",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width"],["translate","",1,"tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","encoding"],[3,"value"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],[1,"tb-form-row","space-between","tb-flex"],["translate","",1,"fixed-title-width"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",5)(1,"mat-toolbar",6)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",7)(6,"div",8),t.ɵɵelementStart(7,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",10),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",11)(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",15),t.ɵɵtext(15," gateway.address-filter "),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"div",16)(17,"mat-form-field",17),t.ɵɵelement(18,"input",18),t.ɵɵpipe(19,"translate"),t.ɵɵtemplate(20,i1,3,3,"mat-icon",19),t.ɵɵelement(21,"div",20),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",13)(23,"div",21),t.ɵɵtext(24,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"div",16)(26,"mat-form-field",17),t.ɵɵelement(27,"input",22),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,a1,3,3,"mat-icon",19),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"div",13)(31,"div",21),t.ɵɵtext(32,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"div",16)(34,"mat-form-field",17),t.ɵɵelement(35,"input",23),t.ɵɵpipe(36,"translate"),t.ɵɵtemplate(37,r1,3,3,"mat-icon",19),t.ɵɵelementEnd()()(),t.ɵɵelementStart(38,"div",13)(39,"div",24),t.ɵɵpipe(40,"translate"),t.ɵɵtext(41," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",16)(43,"mat-form-field",17)(44,"mat-select",25),t.ɵɵrepeaterCreate(45,o1,2,2,"mat-option",26,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(47,s1,1,2,"tb-report-strategy",27),t.ɵɵelementStart(48,"div",28)(49,"div",29),t.ɵɵtext(50,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(51,"div",30)(52,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(53,l1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(55,"mat-chip",32),t.ɵɵelement(56,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(57,"button",34,0),t.ɵɵpipe(59,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(58);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.TIMESERIES))})),t.ɵɵelementStart(60,"tb-icon",35),t.ɵɵtext(61,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(62,"div",28)(63,"div",29),t.ɵɵtext(64,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(65,"div",30)(66,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(67,p1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(69,"mat-chip",32),t.ɵɵelement(70,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(71,"button",34,1),t.ɵɵpipe(73,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(72);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES))})),t.ɵɵelementStart(74,"tb-icon",35),t.ɵɵtext(75,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(76,"div",28)(77,"div",29),t.ɵɵtext(78,"gateway.attribute-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(79,"div",30)(80,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(81,c1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(83,"mat-chip",32),t.ɵɵelement(84,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(85,"button",34,2),t.ɵɵpipe(87,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(86);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES_REQUESTS))})),t.ɵɵelementStart(88,"tb-icon",35),t.ɵɵtext(89,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(90,"div",28)(91,"div",29),t.ɵɵtext(92,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(93,"div",30)(94,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(95,d1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(97,"mat-chip",32),t.ɵɵelement(98,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(99,"button",34,3),t.ɵɵpipe(101,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(100);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(102,"tb-icon",35),t.ɵɵtext(103,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(104,"div",28)(105,"div",29),t.ɵɵtext(106,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(107,"div",30)(108,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(109,u1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(111,"mat-chip",32),t.ɵɵelement(112,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(113,"button",34,4),t.ɵɵpipe(115,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(114);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.RPC_METHODS))})),t.ɵɵelementStart(116,"tb-icon",35),t.ɵɵtext(117,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(118,"div",36)(119,"button",37),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(120),t.ɵɵpipe(121,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"button",38),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(123),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,26,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.socketDeviceHelpLink),t.ɵɵadvance(12),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("address").hasError("required")&&n.deviceFormGroup.get("address").touched?20:-1),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/address-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(50,n1)),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,30,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("deviceName").hasError("required")&&n.deviceFormGroup.get("deviceName").touched?29:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,32,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("deviceType").hasError("required")&&n.deviceFormGroup.get("deviceType").touched?37:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(40,34,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(2),t.ɵɵconditional(n.data.withReportStrategy?47:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(59,36,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(73,38,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(87,40,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(101,42,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(115,44,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(121,46,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(124,48,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(m1,[T,ei,pi]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:grid;height:100%}[_nghost-%COMP%] .tb-form-panel[_ngcontent-%COMP%]{width:77vw;max-width:800px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%]{max-width:900px;display:flex;flex-direction:column}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{min-height:64px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] tb-toggle-select[_ngcontent-%COMP%]{padding:4px 0}[_nghost-%COMP%] .mat-mdc-dialog-content[_ngcontent-%COMP%]{height:670px}[_nghost-%COMP%] .ellipsis-chips-container[_ngcontent-%COMP%]{max-width:70%}[_nghost-%COMP%] .dialog-mapping .mat-mdc-chip-listbox .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center}[_nghost-%COMP%] .tb-form-row .fixed-title-width{min-width:40px;width:35%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center}[_nghost-%COMP%] .tb-form-row .mat-mdc-form-field{width:0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}[_nghost-%COMP%] .device-config{gap:12px;padding-left:10px;padding-right:10px}[_nghost-%COMP%] .device-node-pattern-field{flex-basis:3%}'],changeDetection:d.OnPush})}}e("DeviceDialogComponent",m1);const h1=["searchInput"],g1=()=>["address","deviceName","actions"],f1=()=>({minWidth:"96px",textAlign:"center"});function y1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",25)(2,"span",26),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",27),t.ɵɵelementStart(6,"button",10),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageDevices(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",10),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.devices")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(7,5,"action.add")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,7,"action.search")))}function v1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.address-filter")," "))}function x1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.address)}}function b1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.device-name")))}function w1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.deviceName)}}function S1(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function C1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageDevices(n,i))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteDevice(n,i))})),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.edit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(5,4,"action.delete")))}function _1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,C1,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",31),t.ɵɵelementContainer(4,32),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"button",34),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",35),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",36,2),t.ɵɵelementContainer(11,32),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,f1)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function T1(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function E1(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class I1{constructor(e,t,n,i,a){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=i,this.cdr=a,this.withReportStrategy=!0,this.textSearchMode=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.onChange=()=>{},this.destroy$=new Ie,this.devicesFormGroup=this.fb.array([]),this.dataSource=new M1}ngOnInit(){this.devicesFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.updateTableData(e,this.textSearch.value.trim()),this.onChange(e)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Ne(150),Fe(((e,t)=>(e??"")===t.trim())),Re(this.destroy$)).subscribe((e=>this.updateTableData(this.devicesFormGroup.value,e.trim())))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.devicesFormGroup.clear(),this.pushDataAsFormArrays(e)}enterFilterMode(){this.textSearchMode=!0,this.cdr.detectChanges();const e=this.searchInputField.nativeElement;e.focus(),e.setSelectionRange(0,0)}exitFilterMode(){this.updateTableData(this.devicesFormGroup.value),this.textSearchMode=!1,this.textSearch.reset()}manageDevices(e,t){e&&e.stopPropagation();const n=re(t),i=n?this.getDeviceIndex(t):-1,a=n?this.devicesFormGroup.at(i).value:{};this.getDeviceDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ue(1),Re(this.destroy$)).subscribe((e=>{e&&(n?this.devicesFormGroup.at(i).patchValue(e):this.devicesFormGroup.push(this.fb.control(e)),this.devicesFormGroup.markAsDirty())}))}getDeviceIndex(e){return this.devicesFormGroup.controls.findIndex((t=>t.value===e))}validate(){return this.devicesFormGroup.controls.length?null:{devicesFormGroup:{valid:!1}}}getDeviceDialog(e,t){return this.dialog.open(m1,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}deleteDevice(e,t){e&&e.stopPropagation();const n=this.getDeviceIndex(t);this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:t.deviceName}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ue(1),Re(this.destroy$)).subscribe((e=>{e&&(this.devicesFormGroup.removeAt(n),this.devicesFormGroup.markAsDirty())}))}updateTableData(e,t){t&&(e=e.filter((e=>Object.values(e).some((e=>e.toString().toLowerCase().includes(t.toLowerCase())))))),this.dataSource.loadData(e)}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.devicesFormGroup.push(this.fb.control(e))))}static{this.ɵfac=function(e){return new(e||I1)(t.ɵɵdirectiveInject(he.TranslateService),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(ee.DialogService),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:I1,selectors:[["tb-devices-config-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(h1,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>I1)),multi:!0},{provide:be,useExisting:c((()=>I1)),multi:!0}]),t.ɵɵStandaloneFeature],decls:45,vars:36,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-device-table","tb-absolute-fill"],[1,"tb-device-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","table-value-column",4,"matHeaderCellDef"],["class","table-value-column",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-device-table-title"],[1,"flex-1"],[1,"table-value-column"],["tbTruncateWithTooltip",""],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵtemplate(3,y1,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",6)(7,"button",7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",9,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵpipe(18,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())})),t.ɵɵelementStart(19,"mat-icon"),t.ɵɵtext(20,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(21,"div",11)(22,"table",12),t.ɵɵelementContainerStart(23,13),t.ɵɵtemplate(24,v1,3,3,"mat-header-cell",14)(25,x1,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,13),t.ɵɵtemplate(27,b1,4,3,"mat-header-cell",14)(28,w1,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,16),t.ɵɵtemplate(30,S1,1,0,"mat-header-cell",17)(31,_1,12,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(32,T1,1,0,"mat-header-row",19)(33,E1,1,0,"mat-row",20),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"section",21),t.ɵɵpipe(35,"async"),t.ɵɵelementStart(36,"button",22),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(37,"mat-icon",23),t.ɵɵtext(38,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"span"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"span",24),t.ɵɵpipe(43,"async"),t.ɵɵtext(44," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,20,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,22,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,24,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,26,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","address"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","deviceName"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(34,g1))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,g1)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(35,28,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,30,"gateway.add-device")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(43,32,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(I1,[me,T,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%]{width:100%;height:100%;background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:35%}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width: 599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:d.OnPush})}}e("DevicesConfigTableComponent",I1),Ze([I()],I1.prototype,"withReportStrategy",void 0);let M1=class extends ${constructor(){super()}};function k1(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function P1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function D1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.socketConfigFormGroup.get("port")))}}function A1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.socketConfigFormGroup.get("bufferSize").hasError("min")?"gateway.buffer-size-range":"gateway.buffer-size-required"))}}e("DevicesDatasource",M1);class O1{constructor(e){this.fb=e,this.portLimits=Vi,this.socketTypes=Object.values(bi),this.onChange=e=>{},this.destroy$=new Ie,this.socketConfigFormGroup=this.fb.group({address:["",[xe.required,xe.pattern(fn)]],type:[bi.TCP],port:[5e4,[xe.required,xe.min(Vi.MIN),xe.max(Vi.MAX)]],bufferSize:[1024,[xe.required,xe.min(1),xe.pattern(fn)]]}),this.socketConfigFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){const{address:t="",type:n=bi.TCP,port:i=5e4,bufferSize:a=1024}=e??{};this.socketConfigFormGroup.reset({address:t,type:n,port:i,bufferSize:a})}validate(){return this.socketConfigFormGroup.valid?null:{socketConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||O1)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:O1,selectors:[["tb-socket-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>O1)),multi:!0},{provide:be,useExisting:c((()=>O1)),multi:!0}]),t.ɵɵStandaloneFeature],decls:35,vars:24,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width"],["tbTruncateWithTooltip",""],["formControlName","type","appearance","fill"],[3,"value"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","name","value","min","1","formControlName","bufferSize",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"tb-toggle-select",4),t.ɵɵrepeaterCreate(7,k1,2,2,"tb-toggle-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",1)(10,"div",6),t.ɵɵtext(11,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"div",7)(13,"mat-form-field",8),t.ɵɵelement(14,"input",9),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,P1,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(17,"div",1)(18,"div",6),t.ɵɵtext(19,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"div",7)(21,"mat-form-field",8),t.ɵɵelement(22,"input",11),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,D1,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(25,"div",1)(26,"div",12),t.ɵɵpipe(27,"translate"),t.ɵɵtext(28),t.ɵɵpipe(29,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"div",7)(31,"mat-form-field",8),t.ɵɵelement(32,"input",13),t.ɵɵpipe(33,"translate"),t.ɵɵtemplate(34,A1,3,3,"mat-icon",10),t.ɵɵelementEnd()()()()),2&e&&(t.ɵɵproperty("formGroup",n.socketConfigFormGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,12,"gateway.connection-type")),t.ɵɵadvance(3),t.ɵɵrepeater(n.socketTypes),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.socketConfigFormGroup.get("address").hasError("required")&&n.socketConfigFormGroup.get("address").touched?16:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(23,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.socketConfigFormGroup.get("port").hasError("required")||n.socketConfigFormGroup.get("port").hasError("min")||n.socketConfigFormGroup.get("port").hasError("max"))&&n.socketConfigFormGroup.get("port").touched?24:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(27,18,"gateway.hints.buffer-size")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(29,20,"gateway.buffer-size")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.socketConfigFormGroup.get("bufferSize").hasError("required")||n.socketConfigFormGroup.get("bufferSize").hasError("min")&&n.socketConfigFormGroup.get("bufferSize").touched?34:-1))},dependencies:t.ɵɵgetComponentDepsFactory(O1,[T,oK,Jn]),encapsulation:2,changeDetection:d.OnPush})}}e("SocketConfigComponent",O1);class R1 extends Xa{constructor(){super(...arguments),this.isLegacy=!1}getMappedValue(e){return e}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:e.socket??{},devices:e.devices??[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(R1)))(n||R1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:R1,selectors:[["tb-socket-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>R1)),multi:!0},{provide:be,useExisting:c((()=>R1)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:10,vars:14,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","socket"],["formControlName","devices",3,"withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-socket-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-devices-config-table",4),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,8,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,10,"gateway.socket"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,12,"gateway.devices"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("withReportStrategy",!n.isLegacy))},dependencies:t.ɵɵgetComponentDepsFactory(R1,[me,T,O1,I1]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}e("SocketBasicConfigComponent",R1);class B1 extends Xa{constructor(){super(...arguments),this.isLegacy=!0}getMappedValue(e){return rr.mapSocketToDowngradedVersion(e)}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:rr.mapSocketToUpgradedVersion(e),devices:e?.devices?rr.mapDevicesToUpgradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(B1)))(n||B1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:B1,selectors:[["tb-socket-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>B1)),multi:!0},{provide:be,useExisting:c((()=>B1)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:10,vars:14,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","socket"],["formControlName","devices",3,"withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-socket-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-devices-config-table",4),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,8,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,10,"gateway.socket"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,12,"gateway.devices"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("withReportStrategy",!n.isLegacy))},dependencies:t.ɵɵgetComponentDepsFactory(B1,[me,T,O1,I1]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}function F1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.name-required"))}function N1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function L1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.applicationConfigFormGroup.get("port")))}}function V1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.object-id-required"))}function q1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.vendor-id-required"))}function G1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SegmentationTypeTranslationsMap.get(e))," ")}}e("SocketLegacyBasicConfigComponent",B1);class z1 extends Ya{constructor(){super(...arguments),this.segmentationTypes=Object.values(Pa),this.SegmentationTypeTranslationsMap=Da,this.portLimits=Vi}get applicationConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({objectName:["",[xe.required,xe.pattern(fn)]],host:["",[xe.required,xe.pattern(fn)]],port:[null,[xe.required,xe.min(Vi.MIN),xe.max(Vi.MAX)]],mask:[""],objectIdentifier:[null,[xe.required]],vendorIdentifier:[null,[xe.required]],maxApduLengthAccepted:[],segmentationSupported:[Pa.BOTH],networkNumber:[],deviceDiscoveryTimeoutInSec:[]})}mapOnChangeValue(e){return te(e),e}onWriteValue(e){const{maxApduLengthAccepted:t=1476,segmentationSupported:n=Pa.BOTH,networkNumber:i=3,deviceDiscoveryTimeoutInSec:a=5,...r}=e;this.formGroup.reset({...r,maxApduLengthAccepted:t,segmentationSupported:n,networkNumber:i,deviceDiscoveryTimeoutInSec:a},{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(z1)))(n||z1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:z1,selectors:[["tb-bacnet-application-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>z1)),multi:!0},{provide:be,useExisting:c((()=>z1)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:83,vars:53,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","autocomplete","off","name","value","formControlName","objectName",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["matInput","","name","value","formControlName","mask",3,"placeholder"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","objectIdentifier",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","vendorIdentifier",3,"placeholder"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","padding-top"],["matInput","","type","number","min","0","name","value","formControlName","maxApduLengthAccepted",3,"placeholder"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","segmentationSupported"],[3,"value"],["matInput","","type","number","min","0","name","value","formControlName","networkNumber",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","deviceDiscoveryTimeoutInSec",3,"placeholder"],["translate","","matSuffix","",1,"block","pr-2"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.bacnet.object-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3)(5,"mat-form-field",4),t.ɵɵelement(6,"input",5),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,F1,3,3,"mat-icon",6),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",1)(10,"div",2),t.ɵɵtext(11,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",4),t.ɵɵelement(13,"input",7),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,N1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"div",1)(17,"div",2),t.ɵɵtext(18,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",4),t.ɵɵelement(20,"input",8),t.ɵɵpipe(21,"translate"),t.ɵɵtemplate(22,L1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"div",1)(24,"div",9),t.ɵɵtext(25,"gateway.network-mask"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",4),t.ɵɵelement(27,"input",10),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(29,"div",1)(30,"div",11),t.ɵɵpipe(31,"translate"),t.ɵɵtext(32,"gateway.object-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"mat-form-field",4),t.ɵɵelement(34,"input",12),t.ɵɵpipe(35,"translate"),t.ɵɵtemplate(36,V1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"div",1)(38,"div",11),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"gateway.vendor-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(41,"mat-form-field",4),t.ɵɵelement(42,"input",13),t.ɵɵpipe(43,"translate"),t.ɵɵtemplate(44,q1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"div",14)(46,"mat-expansion-panel",15)(47,"mat-expansion-panel-header")(48,"mat-panel-title")(49,"div",16),t.ɵɵtext(50,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(51,"div",17)(52,"div",1)(53,"div",11),t.ɵɵpipe(54,"translate"),t.ɵɵtext(55,"gateway.bacnet.apdu-length"),t.ɵɵelementEnd(),t.ɵɵelementStart(56,"mat-form-field",4),t.ɵɵelement(57,"input",18),t.ɵɵpipe(58,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(59,"div",1)(60,"div",19),t.ɵɵpipe(61,"translate"),t.ɵɵtext(62,"gateway.bacnet.segmentation.label"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"mat-form-field",4)(64,"mat-select",20),t.ɵɵrepeaterCreate(65,G1,3,4,"mat-option",21,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(67,"div",1)(68,"div",19),t.ɵɵpipe(69,"translate"),t.ɵɵtext(70,"gateway.bacnet.network-number"),t.ɵɵelementEnd(),t.ɵɵelementStart(71,"mat-form-field",4),t.ɵɵelement(72,"input",22),t.ɵɵpipe(73,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(74,"div",1)(75,"div",19),t.ɵɵpipe(76,"translate"),t.ɵɵtext(77,"gateway.bacnet.device-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(78,"mat-form-field",4),t.ɵɵelement(79,"input",23),t.ɵɵpipe(80,"translate"),t.ɵɵelementStart(81,"span",24),t.ɵɵtext(82,"gateway.suffix.s"),t.ɵɵelementEnd()()()()()()()),2&e&&(t.ɵɵproperty("formGroup",n.applicationConfigFormGroup),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,23,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("objectName").hasError("required")&&n.applicationConfigFormGroup.get("objectName").touched?8:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,25,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("host").hasError("required")&&n.applicationConfigFormGroup.get("host").touched?15:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,27,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.applicationConfigFormGroup.get("port").hasError("required")||n.applicationConfigFormGroup.get("port").hasError("min")||n.applicationConfigFormGroup.get("port").hasError("max"))&&n.applicationConfigFormGroup.get("port").touched?22:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,29,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(31,31,"gateway.hints.bacnet.object-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("objectIdentifier").hasError("required")&&n.applicationConfigFormGroup.get("objectIdentifier").touched?36:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(39,35,"gateway.hints.bacnet.vendor-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(43,37,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("vendorIdentifier").hasError("required")&&n.applicationConfigFormGroup.get("vendorIdentifier").touched?44:-1),t.ɵɵadvance(9),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(54,39,"gateway.hints.bacnet.apdu-length")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(58,41,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(61,43,"gateway.hints.bacnet.segmentation")),t.ɵɵadvance(5),t.ɵɵrepeater(n.segmentationTypes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(69,45,"gateway.hints.bacnet.network-number")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(73,47,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(76,49,"gateway.hints.bacnet.device-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(80,51,"gateway.set")))},dependencies:t.ɵɵgetComponentDepsFactory(z1,[T,oK]),encapsulation:2,changeDetection:d.OnPush})}}function U1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",11),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function j1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",15)(6,"mat-form-field",6),t.ɵɵelement(7,"input",16),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,U1,3,3,"mat-icon",11),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",e.keyType===e.BacnetDeviceKeysType.TIMESERIES?t.ɵɵpipeBind1(1,4,"gateway.hints.socket.key-telemetry"):t.ɵɵpipeBind1(2,6,"gateway.hints.socket.key-attribute")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,8,"gateway.key")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,10,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.formGroup.get("key").hasError("required")&&e.formGroup.get("key").touched?9:-1)}}function H1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",11),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function W1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",15)(5,"mat-form-field",6),t.ɵɵelement(6,"input",17),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,H1,3,3,"mat-icon",11),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(1,4,"gateway.hints.method")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,6,"gateway.method")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.formGroup.get("method").hasError("required")&&e.formGroup.get("method").touched?8:-1)}}function $1(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",8),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.BacnetRequestTypeTranslationsMap.get(e))," ")}}function K1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",18)(2,"div",14),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"tb-toggle-select",19),t.ɵɵrepeaterCreate(7,$1,3,4,"tb-toggle-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,2,"gateway.hints.bacnet.request-type")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,4,"gateway.bacnet.request-type.label")),t.ɵɵadvance(3),t.ɵɵrepeater(e.requestTypes)}}function Y1(e,n){1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",4),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.request-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",6),t.ɵɵelement(5,"input",20),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.bacnet.request-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,4,"gateway.set")))}function X1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.BacnetKeyObjectTypeTranslationsMap.get(e))," ")}}function Z1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",11),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.object-id-required"))}function Q1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.BacnetPropertyIdTranslationsMap.get(e))," ")}}function J1(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",13),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}class e0 extends Ya{constructor(){super(...arguments),this.withReportStrategy=!0,this.propertyIds=qa.get(Na.analogOutput),this.objectTypes=Object.values(Na),this.requestTypes=Object.values(za),this.ReportStrategyDefaultValue=mn,this.BacnetDeviceKeysType=Aa,this.BacnetKeyObjectTypeTranslationsMap=La,this.BacnetPropertyIdTranslationsMap=Ga,this.BacnetRequestTypeTranslationsMap=Ua}ngOnInit(){this.formGroup=this.initKeyFormGroup(),this.observeValueChanges(),this.observeObjectType()}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keyType===Aa.ATTRIBUTES||this.keyType===Aa.TIMESERIES))}initKeyFormGroup(){return this.fb.group({key:[{value:"",disabled:this.keyType===Aa.RPC_METHODS},[xe.required,xe.pattern(fn)]],method:[{value:"",disabled:this.keyType!==Aa.RPC_METHODS},[xe.required,xe.pattern(fn)]],objectType:[Na.analogOutput],objectId:[0,[xe.required]],propertyId:[Va.presentValue],requestTimeout:[{value:0,disabled:this.keyType!==Aa.RPC_METHODS}],requestType:[{value:za.Write,disabled:this.keyType!==Aa.RPC_METHODS}],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]})}observeObjectType(){this.formGroup.get("objectType").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.propertyIds=qa.get(e),this.propertyIds.includes(this.formGroup.get("propertyId").value)||this.formGroup.get("propertyId").patchValue(this.propertyIds[0],{emitEvent:!1})}))}initFormGroup(){return this.fb.group({})}mapOnChangeValue({reportStrategy:e,...t}){return e?{...t,reportStrategy:e}:t}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(e0)))(n||e0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:e0,selectors:[["tb-bacnet-device-data-key"]],inputs:{keyType:"keyType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>e0)),multi:!0},{provide:be,useExisting:c((()=>e0)),multi:!0}]),t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:35,vars:15,consts:[[1,"tb-form-panel","no-border","no-padding",3,"formGroup"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap","raw-value-option"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","objectType"],[3,"value"],[1,"tb-form-table-row-cell","tb-flex","no-gap"],["matInput","","type","number","min","0","name","value","formControlName","objectId",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["formControlName","propertyId"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matInput","","name","value","formControlName","method",3,"placeholder"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["formControlName","requestType","appearance","fill"],["matInput","","type","number","min","0","name","value","formControlName","requestTimeout",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3),t.ɵɵtemplate(5,j1,10,12)(6,W1,9,10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",1)(8,"div",2),t.ɵɵtext(9,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵtemplate(10,K1,9,6,"div",3)(11,Y1,7,6,"div",3),t.ɵɵelementStart(12,"div",3)(13,"div",4),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15,"gateway.object-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",5)(17,"mat-form-field",6)(18,"mat-select",7),t.ɵɵrepeaterCreate(19,X1,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",9)(22,"mat-form-field",6),t.ɵɵelement(23,"input",10),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,Z1,3,3,"mat-icon",11),t.ɵɵelementEnd()()(),t.ɵɵelementStart(26,"div",3)(27,"div",4),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"gateway.property-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",6)(31,"mat-select",12),t.ɵɵrepeaterCreate(32,Q1,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵtemplate(34,J1,1,2,"tb-report-strategy",13),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(5),t.ɵɵconditional(n.keyType!==n.BacnetDeviceKeysType.RPC_METHODS?5:6),t.ɵɵadvance(5),t.ɵɵconditional(n.keyType===n.BacnetDeviceKeysType.RPC_METHODS?10:-1),t.ɵɵadvance(),t.ɵɵconditional(n.keyType===n.BacnetDeviceKeysType.RPC_METHODS?11:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(14,9,"gateway.hints.bacnet.key-object-id")),t.ɵɵadvance(6),t.ɵɵrepeater(n.objectTypes),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.formGroup.get("objectId").hasError("required")&&n.formGroup.get("objectId").touched?25:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(28,13,"gateway.hints.bacnet.property-id")),t.ɵɵadvance(5),t.ɵɵrepeater(n.propertyIds),t.ɵɵadvance(2),t.ɵɵconditional(n.isReportStrategyDisabled()?-1:34))},dependencies:t.ɵɵgetComponentDepsFactory(e0,[T,pi]),encapsulation:2,changeDetection:d.OnPush})}}function t0(e,n){if(1&e&&t.ɵɵelement(0,"tb-bacnet-device-data-key",17),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("formControl",e)("keyType",n.keysType)("withReportStrategy",n.withReportStrategy)}}function n0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header",13)(5,"mat-panel-title")(6,"div",14),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,t0,1,3,"ng-template",15),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",16),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e;const i=n.$implicit,a=n.$index,r=n.$count,o=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i),t.ɵɵadvance(),t.ɵɵproperty("expanded",a===r-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",null!==(e=null==i.value?null:i.value.key)&&void 0!==e?e:null==i.value?null:i.value.method," "),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,o.deleteKeyTitle))}}function i0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,n0,13,6,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function a0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",18),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class r0 extends W{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=mn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}addKey(){this.keysListFormArray.push(this.fb.control({}))}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){this.keysDataApplied.emit(this.keysListFormArray.value)}prepareKeysFormArray(e){const t=[];return e?.forEach((e=>{t.push(this.fb.control(e))})),this.fb.array(t)}static{this.ɵfac=function(e){return new(e||r0)(t.ɵɵdirectiveInject(ye.UntypedFormBuilder),t.ɵɵdirectiveInject(ct.TbPopoverComponent),t.ɵɵdirectiveInject(nt.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:r0,selectors:[["tb-bacnet-device-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:18,vars:15,consts:[[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[3,"formControl","keyType","withReportStrategy"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,i0,3,0,"div",3)(6,a0,3,1,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",(function(){return n.addKey()})),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",(function(){return n.applyKeysData()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(r0,[T,e0]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:500px;overflow:auto}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-small-label[_ngcontent-%COMP%]{font-size:16px;padding-right:0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:d.OnPush})}}function o0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function s0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function l0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"mat-expansion-panel",35)(2,"mat-expansion-panel-header")(3,"mat-panel-title")(4,"div",36),t.ɵɵtext(5,"gateway.advanced-configuration-settings"),t.ɵɵelementEnd()()(),t.ɵɵelement(6,"tb-string-items-list",37),t.ɵɵpipe(7,"translate"),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(7,2,"gateway.bacnet.alt-responses-address")),t.ɵɵpropertyInterpolate("placeholder",null!=(e=n.deviceFormGroup.get("altResponsesAddresses").value)&&e.length?"":t.ɵɵpipeBind1(8,4,"gateway.address"))}}function p0(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",21),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function c0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.poll-period-required"))}function d0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function u0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function m0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function h0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.method," ")}}class g0 extends O{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.cdr=l,this.destroyRef=p,this.deviceFormGroup=this.fb.group({host:["",[xe.required,xe.pattern(fn)]],port:["",[xe.required]],networkMask:[""],deviceInfo:[],altResponsesAddresses:[{value:[],disabled:this.data.hideNewFields}],pollPeriod:[1e4,[xe.required,xe.min(0)]],timeseries:[[]],attributes:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.BacnetDeviceKeysType=Aa,this.DeviceInfoType=ka,this.deviceHelpLink=w+"/docs/iot-gateway/config/bacnet/#device-object-settings",this.sourceTypes=Object.values(_i),this.ConnectorType=yt,this.ReportStrategyDefaultValue=mn,this.deviceFormGroup.patchValue(this.data.value,{emitEvent:!1})}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.deviceFormGroup.valid){const{altResponsesAddresses:e,reportStrategy:t,...n}=this.deviceFormGroup.value;this.dialogRef.close({altResponsesAddresses:e??[],...t?{reportStrategy:t}:{},...n})}}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))return void this.popoverService.hidePopover(i);const a=this.deviceFormGroup.get(n),r={keys:a.value,keysType:n,panelTitle:Oa.get(n),addKeyTitle:Ra.get(n),deleteKeyTitle:Ba.get(n),noKeysText:Fa.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,r0,"leftBottom",!1,null,r,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.subscribe((e=>{this.popoverComponent.hide(),a.patchValue(e),a.markAsDirty(),this.cdr.markForCheck()})),this.popoverComponent.tbHideStart.pipe(On(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||g0)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(dt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:g0,selectors:[["tb-bacnet-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:106,vars:48,consts:[["attributesButton",""],["socketTelemetryButton",""],["attributesUpdatesButton",""],["rpcMethodsButton",""],[1,"dialog-mapping",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","port",3,"placeholder"],["translate","",1,"fixed-title-width"],["matInput","","name","value","formControlName","networkMask",3,"placeholder"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","sourceTypes","connectorType"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],[1,"fixed-title-width","tb-required"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","0","name","value","formControlName","pollPeriod",3,"placeholder"],[1,"tb-form-row","space-between","tb-flex"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],[1,"tb-settings","chips-panel","w-full"],["translate","",1,"tb-form-panel-title"],["editable","","appearance","outline","floatLabel","always","formControlName","altResponsesAddresses",1,"chips-list",3,"label","placeholder"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",4)(1,"mat-toolbar",5)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",6)(6,"div",7),t.ɵɵelementStart(7,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",9),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",10)(11,"div",11)(12,"div",12)(13,"div",13),t.ɵɵtext(14,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-form-field",14),t.ɵɵelement(16,"input",15),t.ɵɵpipe(17,"translate"),t.ɵɵtemplate(18,o0,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",12)(20,"div",13),t.ɵɵtext(21,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",14),t.ɵɵelement(23,"input",17),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,s0,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"div",12)(27,"div",18),t.ɵɵtext(28,"gateway.network-mask"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",14),t.ɵɵelement(30,"input",19),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(32,l0,9,6,"div",12),t.ɵɵelement(33,"tb-device-info-table",20),t.ɵɵtemplate(34,p0,1,2,"tb-report-strategy",21),t.ɵɵelementStart(35,"div",12)(36,"div",22)(37,"span",23),t.ɵɵtext(38,"gateway.poll-period"),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"mat-form-field",14),t.ɵɵelement(40,"input",24),t.ɵɵpipe(41,"translate"),t.ɵɵtemplate(42,c0,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(43,"div",25)(44,"div",18),t.ɵɵtext(45,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(46,"div",26)(47,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(48,d0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(50,"mat-chip",28),t.ɵɵelement(51,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"button",30,0),t.ɵɵpipe(54,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(53);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES))})),t.ɵɵelementStart(55,"tb-icon",31),t.ɵɵtext(56,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(57,"div",25)(58,"div",18),t.ɵɵtext(59,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(60,"div",26)(61,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(62,u0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(64,"mat-chip",28),t.ɵɵelement(65,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(66,"button",30,1),t.ɵɵpipe(68,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(67);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.TIMESERIES))})),t.ɵɵelementStart(69,"tb-icon",31),t.ɵɵtext(70,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(71,"div",25)(72,"div",18),t.ɵɵtext(73,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"div",26)(75,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(76,m0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(78,"mat-chip",28),t.ɵɵelement(79,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(80,"button",30,2),t.ɵɵpipe(82,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(81);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(83,"tb-icon",31),t.ɵɵtext(84,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(85,"div",25)(86,"div",18),t.ɵɵtext(87,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(88,"div",26)(89,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(90,h0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(92,"mat-chip",28),t.ɵɵelement(93,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"button",30,3),t.ɵɵpipe(96,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(95);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.RPC_METHODS))})),t.ɵɵelementStart(97,"tb-icon",31),t.ɵɵtext(98,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(99,"div",32)(100,"button",33),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(103,"button",34),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(104),t.ɵɵpipe(105,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,26,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.deviceHelpLink),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(17,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("host").hasError("required")&&n.deviceFormGroup.get("host").touched?18:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,30,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("port").hasError("required")&&n.deviceFormGroup.get("port").touched?25:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(31,32,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.data.hideNewFields?-1:32),t.ɵɵadvance(),t.ɵɵproperty("deviceInfoType",n.DeviceInfoType.FULL)("sourceTypes",n.sourceTypes)("connectorType",n.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?34:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(41,34,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("pollPeriod").hasError("required")&&n.deviceFormGroup.get("pollPeriod").touched?42:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(54,36,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("timeseries").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("timeseries").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(68,38,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(82,40,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(96,42,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,44,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(105,46,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(g0,[T,ei,Jn,IK,pi]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:grid;height:100%}[_nghost-%COMP%] .tb-form-panel[_ngcontent-%COMP%]{width:77vw;max-width:800px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%]{max-width:900px;display:flex;flex-direction:column}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{min-height:64px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] tb-toggle-select[_ngcontent-%COMP%]{padding:4px 0}[_nghost-%COMP%] .mat-mdc-dialog-content[_ngcontent-%COMP%]{height:670px}[_nghost-%COMP%] .ellipsis-chips-container[_ngcontent-%COMP%]{max-width:70%}[_nghost-%COMP%] .chips-panel[_ngcontent-%COMP%]{padding:6px 6px 6px 0}[_nghost-%COMP%] .dialog-mapping .mat-mdc-chip-listbox .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center}[_nghost-%COMP%] .tb-form-row .fixed-title-width{min-width:40px;width:35%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center}[_nghost-%COMP%] .tb-form-row .mat-mdc-form-field{width:0}[_nghost-%COMP%] .tb-form-row .chips-list .mat-mdc-form-field{width:100%}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}[_nghost-%COMP%] .device-config{gap:12px;padding-left:10px;padding-right:10px}[_nghost-%COMP%] .device-node-pattern-field{flex-basis:3%}'],changeDetection:d.OnPush})}}const f0=()=>["deviceName","host","port","actions"],y0=()=>({minWidth:"96px",textAlign:"center"});function v0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",25)(2,"span",26),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",27),t.ɵɵelementStart(6,"button",10),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageDevices(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",10),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.devices")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(7,5,"action.add")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,7,"action.search")))}function x0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.device-name")))}function b0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(null==e.deviceInfo?null:e.deviceInfo.deviceNameExpression)}}function w0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.host")," "))}function S0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.host)}}function C0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.port")," "))}function _0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.port)}}function T0(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function E0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageDevices(n,i))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteDevice(n,i))})),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.edit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(5,4,"action.delete")))}function I0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,E0,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",31),t.ɵɵelementContainer(4,32),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"button",34),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",35),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",36,2),t.ɵɵelementContainer(11,32),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,y0)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function M0(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function k0(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class P0 extends er{constructor(){super(...arguments),this.hideNewFields=!1}getDatasource(){return new D0}manageDevices(e,t){e&&e.stopPropagation();const n=re(t),i=n?this.getEntityIndex(t):-1,a=n?this.entityFormArray.at(i).value:{};this.getDeviceDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ue(1),On(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(i).patchValue(e):this.entityFormArray.push(this.fb.control(e)),this.entityFormArray.markAsDirty())}))}deleteDevice(e,t){e&&e.stopPropagation();this.getEntityIndex(t);this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:t.deviceInfo?.deviceNameExpression}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ue(1),On(this.destroyRef)).subscribe((e=>{if(e){const e=this.entityFormArray.value.findIndex((e=>JSON.stringify(e)===JSON.stringify(t)));this.entityFormArray.removeAt(e),this.entityFormArray.markAsDirty()}}))}getEntityIndex(e){return this.entityFormArray.controls.findIndex((t=>t.value===e))}getDeviceDialog(e,t){return this.dialog.open(g0,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy,hideNewFields:this.hideNewFields}})}updateTableData(e,t){t&&(e=e.filter((e=>Object.values(e).some((e=>e.toString().toLowerCase().includes(t.toLowerCase())||e.deviceNameExpression?.toString().toLowerCase().includes(t.toLowerCase())))))),this.dataSource.loadData(e)}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(P0)))(n||P0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:P0,selectors:[["tb-bacnet-devices-config-table"]],inputs:{hideNewFields:[2,"hideNewFields","hideNewFields",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>P0)),multi:!0},{provide:be,useExisting:c((()=>P0)),multi:!0}]),t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:48,vars:37,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-device-table","tb-absolute-fill"],[1,"tb-device-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","table-value-column",4,"matHeaderCellDef"],["class","table-value-column",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-device-table-title"],[1,"flex-1"],[1,"table-value-column"],["tbTruncateWithTooltip",""],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵtemplate(3,v0,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",6)(7,"button",7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",9,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵpipe(18,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())})),t.ɵɵelementStart(19,"mat-icon"),t.ɵɵtext(20,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(21,"div",11)(22,"table",12),t.ɵɵelementContainerStart(23,13),t.ɵɵtemplate(24,x0,4,3,"mat-header-cell",14)(25,b0,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,13),t.ɵɵtemplate(27,w0,3,3,"mat-header-cell",14)(28,S0,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,13),t.ɵɵtemplate(30,C0,3,3,"mat-header-cell",14)(31,_0,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(32,16),t.ɵɵtemplate(33,T0,1,0,"mat-header-cell",17)(34,I0,12,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(35,M0,1,0,"mat-header-row",19)(36,k0,1,0,"mat-row",20),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"section",21),t.ɵɵpipe(38,"async"),t.ɵɵelementStart(39,"button",22),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(40,"mat-icon",23),t.ɵɵtext(41,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"span"),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(45,"span",24),t.ɵɵpipe(46,"async"),t.ɵɵtext(47," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,21,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,23,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,25,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,27,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","deviceName"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","host"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","port"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(35,f0))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,f0)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(38,29,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(44,31,"gateway.add-device")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(46,33,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(P0,[me,T,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%]{width:100%;height:100%;background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:21%}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width: 599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:d.OnPush})}}class D0 extends ${constructor(){super()}}class A0 extends Xa{initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.application??{},devices:e.devices??[]}}getMappedValue(e){return{application:e.application,devices:e.devices??[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(A0)))(n||A0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:A0,selectors:[["tb-bacnet-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>A0)),multi:!0},{provide:be,useExisting:c((()=>A0)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:15,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","application"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","devices",3,"hideNewFields","withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-bacnet-application-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-bacnet-devices-config-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,9,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,11,"gateway.application"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,13,"gateway.devices"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("hideNewFields",n.isLegacy)("withReportStrategy",n.withReportStrategy))},dependencies:t.ɵɵgetComponentDepsFactory(A0,[me,T,z1,P0]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}class O0 extends Xa{constructor(){super(...arguments),this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.general?or.mapApplicationToUpgradedVersion(e.general):{},devices:e.devices?.length?or.mapDevicesToUpgradedVersion(e.devices):[]}}getMappedValue(e){return{general:e.application?or.mapApplicationToDowngradedVersion(e.application):{},devices:e.devices?.length?or.mapDevicesToDowngradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(O0)))(n||O0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:O0,selectors:[["tb-bacnet-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>O0)),multi:!0},{provide:be,useExisting:c((()=>O0)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:15,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","application"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","devices",3,"hideNewFields","withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-bacnet-application-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-bacnet-devices-config-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,9,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,11,"gateway.application"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,13,"gateway.devices"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("hideNewFields",n.isLegacy)("withReportStrategy",n.withReportStrategy))},dependencies:t.ɵɵgetComponentDepsFactory(O0,[me,T,z1,P0]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:d.OnPush})}}function R0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function B0(e,n){if(1&e&&(t.ɵɵelement(0,"tb-error-icon",8),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵpipe(2,"translate")),2&e){t.ɵɵnextContext();const e=t.ɵɵreadContextLet(16);t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(2,3,t.ɵɵpipeBind1(1,1,e)))}}class F0 extends Ya{constructor(){super(...arguments),this.portLimits=Vi}get serverConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({host:["",[xe.required,xe.pattern(fn)]],port:[null,[xe.required,xe.min(Vi.MIN),xe.max(Vi.MAX)]],SSL:[!1],security:this.fb.group({cert:[""],key:[""]})})}mapOnChangeValue(e){return te(e),e}onWriteValue(e){this.formGroup.reset(e,{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(F0)))(n||F0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:F0,selectors:[["tb-rest-server-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>F0)),multi:!0},{provide:be,useExisting:c((()=>F0)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:46,vars:43,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"tb-form-row","column-xs"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matSuffix","",3,"tooltipText"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["formControlName","SSL",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],[3,"formGroup"],["tbTruncateWithTooltip","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","cert",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",3),t.ɵɵelement(6,"input",4),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,R0,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",6)(10,"div",2),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",3),t.ɵɵelement(14,"input",7),t.ɵɵpipe(15,"translate"),t.ɵɵdeclareLet(16),t.ɵɵtemplate(17,B0,3,5,"tb-error-icon",8),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",9)(19,"div",10),t.ɵɵtext(20,"gateway.security"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",11)(22,"mat-slide-toggle",12)(23,"mat-label",13),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(27,14),t.ɵɵelementStart(28,"div",11)(29,"div",15),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31),t.ɵɵpipe(32,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"div",16)(34,"mat-form-field",3),t.ɵɵelement(35,"input",17),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(37,"div",11)(38,"div",15),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",16)(43,"mat-form-field",3),t.ɵɵelement(44,"input",18),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e){t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,18,"gateway.hints.rest.host")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,20,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.serverConfigFormGroup.get("host").hasError("required")&&n.serverConfigFormGroup.get("host").touched?8:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(11,22,"gateway.hints.rest.port")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,24,"gateway.set")),t.ɵɵadvance(2);const e=t.ɵɵstoreLet(n.serverConfigFormGroup.get("port"));t.ɵɵadvance(),t.ɵɵconditional((e.hasError("required")||e.hasError("min")||e.hasError("max"))&&e.touched?17:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,27,"gateway.hints.rest.ssl-verify")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(26,29,"gateway.rest.ssl-verify")," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.serverConfigFormGroup.get("security")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(30,31,"gateway.hints.rest.cert")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(32,33,"gateway.certificate")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,35,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(39,37,"gateway.hints.rest.key")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,39,"gateway.key")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(45,41,"gateway.set"))}},dependencies:t.ɵɵgetComponentDepsFactory(F0,[T,oK,Jn,di]),encapsulation:2,changeDetection:d.OnPush})}}const N0=()=>({min:1});function L0(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.ResponseTypeTranslationsMap.get(e)))}}function V0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function q0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function G0(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,5),t.ɵɵelementStart(1,"div",6)(2,"div",7),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",8)(6,"mat-form-field",9)(7,"mat-select",10),t.ɵɵrepeaterCreate(8,V0,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",8)(15,"mat-form-field",9)(16,"mat-select",11),t.ɵɵrepeaterCreate(17,q0,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.responseConfigFormGroup.get(e.ResponseType.CONST)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rest.on-success")),t.ɵɵadvance(5),t.ɵɵrepeater(e.responseStatuses),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,5,"gateway.rest.on-error")),t.ɵɵadvance(5),t.ɵɵrepeater(e.responseStatuses)}}function z0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.response-timeout-required"))}function U0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,N0)))}function j0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function H0(e,n){1&e&&(t.ɵɵelementStart(0,"span",16),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function W0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-required"))}function $0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-pattern"))}function K0(e,n){if(1&e&&(t.ɵɵdeclareLet(0),t.ɵɵelementContainerStart(1,5),t.ɵɵelementStart(2,"div",6)(3,"mat-slide-toggle",12)(4,"mat-label"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(7,"div",6)(8,"div",13),t.ɵɵtext(9,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",9),t.ɵɵelement(11,"input",14),t.ɵɵpipe(12,"translate"),t.ɵɵdeclareLet(13),t.ɵɵtemplate(14,z0,2,3,"tb-error-icon",15)(15,U0,2,5,"tb-error-icon",15)(16,j0,2,3,"tb-error-icon",15)(17,H0,2,0,"span",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",6)(19,"div",13),t.ɵɵtext(20,"gateway.rest.response-attribute"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",9),t.ɵɵelement(22,"input",17),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,W0,2,3,"tb-error-icon",15)(25,$0,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(),n=e.responseConfigFormGroup.get(e.ResponseType.ADVANCED);t.ɵɵadvance(),t.ɵɵproperty("formGroup",n),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,6,"gateway.rest.response-expected")," "),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(12,8,"gateway.set"));const i=n.get("timeout").touched;t.ɵɵadvance(3),t.ɵɵconditional(n.get("timeout").hasError("required")&&i?14:n.get("timeout").hasError("min")&&i?15:n.get("timeout").hasError("pattern")&&i?16:17),t.ɵɵadvance(8),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(23,10,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.get("responseAttribute").hasError("required")&&n.get("responseAttribute").touched?24:n.get("responseAttribute").hasError("pattern")&&n.get("responseAttribute").touched?25:-1)}}class Y0 extends Ya{get responseConfigFormGroup(){return this.formGroup}constructor(){super(),this.ResponseTypeTranslationsMap=Ai,this.ResponseType=Pi,this.responseTypes=Object.values(Pi),this.responseStatuses=Object.values(Di),this.observeIsExpected()}initFormGroup(){return this.fb.group({type:[Pi.DEFAULT],[Pi.CONST]:this.fb.group({successResponse:[Di.OK],unsuccessfulResponse:[Di.ERROR]}),[Pi.ADVANCED]:this.fb.group({responseExpected:[!0],timeout:[null,[xe.required,xe.min(.001),xe.pattern(gn)]],responseAttribute:["",[xe.required,xe.pattern(fn)]]})})}mapOnChangeValue({type:e,...t}){return{type:e,...t[e]??{}}}onWriteValue(e){const{type:t=Pi.DEFAULT,...n}=e??{};this.toggleIsExpected(n.responseExpected,t),this.responseConfigFormGroup.patchValue({type:t,[t]:n},{emitEvent:!1})}toggleIsExpected(e,t){const n=e&&t===Pi.ADVANCED;this.toggleControl(this.responseConfigFormGroup.get(Pi.ADVANCED).get("timeout"),n),this.toggleControl(this.responseConfigFormGroup.get(Pi.ADVANCED).get("responseAttribute"),n)}observeIsExpected(){Oe(this.responseConfigFormGroup.get("type").valueChanges,this.responseConfigFormGroup.get(Pi.ADVANCED).get("responseExpected").valueChanges).pipe(On(this.destroyRef)).subscribe((()=>this.toggleIsExpected(this.responseConfigFormGroup.get(Pi.ADVANCED).get("responseExpected").value,this.responseConfigFormGroup.get("type").value)))}static{this.ɵfac=function(e){return new(e||Y0)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Y0,selectors:[["tb-rest-response-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>Y0)),multi:!0},{provide:be,useExisting:c((()=>Y0)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:10,vars:5,consts:[[1,"tb-form-row","space-between","same-padding","tb-flex","column","size-full",3,"formGroup"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],[1,"fixed-title-width","tb-required"],["formControlName","type","appearance","fill"],[3,"value"],[3,"formGroup"],[1,"tb-form-row"],[1,"fixed-title-width"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","successResponse"],["formControlName","unsuccessfulResponse"],["formControlName","responseExpected",1,"mat-slide"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["matSuffix","",3,"tooltipText"],["translate","","matSuffix","",1,"block","pr-2"],["matInput","","type","text","name","value","formControlName","responseAttribute",3,"placeholder"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵrepeaterCreate(6,L0,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵtemplate(8,G0,19,7,"ng-container",5)(9,K0,26,12,"ng-container",5),t.ɵɵelementEnd()),2&e){let e;t.ɵɵproperty("formGroup",n.responseConfigFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.response")),t.ɵɵadvance(3),t.ɵɵrepeater(n.responseTypes),t.ɵɵadvance(2),t.ɵɵconditional((e=n.responseConfigFormGroup.get("type").value)===n.ResponseType.CONST?8:e===n.ResponseType.ADVANCED?9:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(Y0,[T,di]),encapsulation:2,changeDetection:d.OnPush})}}function X0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.endpoint-required"))}function Z0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",17),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function Q0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.http-methods-required"))}function J0(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",17),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.RestConvertorTypeTranslationsMap.get(e)))}}function e2(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",27),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function t2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",40),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function n2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",40),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function i2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",28)(1,"div",20)(2,"div",21),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"mat-chip-listbox",34),t.ɵɵrepeaterCreate(7,t2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(9,"mat-chip",35),t.ɵɵelement(10,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"button",37,0),t.ɵɵpipe(13,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(12),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(14,"tb-icon",38),t.ɵɵtext(15,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(16,"div",20)(17,"div",39),t.ɵɵtext(18,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",33)(20,"mat-chip-listbox",34),t.ɵɵrepeaterCreate(21,n2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(23,"mat-chip",35),t.ɵɵelement(24,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"button",37,1),t.ɵɵpipe(27,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(26),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(28,"tb-icon",38),t.ɵɵtext(29,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.attributes")),t.ɵɵadvance(3),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵrepeater(e.converterAttributes),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(13,7,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵrepeater(e.converterTelemetry),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(27,9,"action.edit"))}}function a2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function r2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",40),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function o2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",28)(1,"div",11)(2,"div",12),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",41),t.ɵɵelement(7,"input",42),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,a2,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",43)(11,"div",24),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",25),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",20)(18,"div",21),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",44)(22,"mat-chip-listbox",34),t.ɵɵrepeaterCreate(23,r2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(25,"mat-chip",35),t.ɵɵelement(26,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(27,"button",37,2),t.ɵɵpipe(29,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(28),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.CUSTOM))})),t.ɵɵelementStart(30,"tb-icon",38),t.ɵɵtext(31,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,9,"gateway.hints.rest.extension")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,11,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,13,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("converter.extension").hasError("required")&&e.mappingFormGroup.get("converter.extension").touched?9:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,15,"gateway.extension-configuration")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,17,"gateway.extension-configuration-hint")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,19,"gateway.keys")),t.ɵɵadvance(3),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵrepeater(e.customKeys),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,21,"action.edit"))}}class s2 extends O{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.destroyRef=l,this.cd=p,this.mappingFormGroup=this.fb.group({endpoint:["",[xe.required,xe.pattern(fn)]],HTTPMethods:[[St.POST],[xe.required]],security:[{type:zi.ANONYMOUS}],converter:this.fb.group({type:[Mi.JSON,[]],deviceInfo:[],reportStrategy:[],attributes:[[]],timeseries:[[]],extension:["",[xe.required,xe.pattern(fn)]],extensionConfig:[]}),response:[]}),this.keysPopupClosed=!0,this.helpLink=`${w}/docs/iot-gateway/config/rest/#mapping-section`,this.httpMethods=Object.values(St),this.converterTypes=Object.values(Mi),this.restSourceTypes=Object.values(ki),this.SecurityMode=oa,this.MappingKeysType=Xi,this.DeviceInfoType=ka,this.RestConvertorTypeTranslationsMap=Ni,this.RestDataConversionTranslationsMap=Li,this.RestConverterType=Mi,this.ConnectorType=yt,this.ReportStrategyDefaultValue=mn,this.setInitialFormValue(),this.observeConverterTypeChange(),this.toggleConverterFieldsByType(this.converterType)}get converterType(){return this.mappingFormGroup.get("converter")?.get("type").value}get converterAttributes(){if(this.converterType)return this.mappingFormGroup.get("converter").value.attributes.map((e=>e.key))}get converterTelemetry(){if(this.converterType)return this.mappingFormGroup.get("converter").value.timeseries.map((e=>e.key))}get customKeys(){return Object.keys(this.mappingFormGroup.get("converter").value.extensionConfig??{})}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.mappingFormGroup.valid){const{converter:e,...t}=this.mappingFormGroup.value,{reportStrategy:n,...i}=e,a={...t,reportStrategy:n,converter:i};te(a),this.dialogRef.close(a)}}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))this.popoverService.hidePopover(i);else{const e=this.mappingFormGroup.get("converter").get(n),t={keys:e.value,keysType:n,panelTitle:Zi.get(n),addKeyTitle:Qi.get(n),deleteKeyTitle:Ji.get(n),noKeysText:ea.get(n),withReportStrategy:this.data.withReportStrategy,convertorType:this.converterType,connectorType:yt.REST};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,vY,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(On(this.destroyRef)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty(),this.cd.markForCheck()})),this.popoverComponent.tbHideStart.pipe(On(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}}setInitialFormValue(){const{converter:e,reportStrategy:t,...n}=this.data.value;this.mappingFormGroup.patchValue({...n,converter:{...e,...t?{reportStrategy:t}:{}}},{emitEvent:!1})}observeConverterTypeChange(){this.mappingFormGroup.get("converter").get("type").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>this.toggleConverterFieldsByType(e)))}toggleConverterFieldsByType(e){const t=e===Mi.JSON;this.mappingFormGroup.get("converter").get("attributes")[t?"enable":"disable"]({emitEvent:!1}),this.mappingFormGroup.get("converter").get("timeseries")[t?"enable":"disable"]({emitEvent:!1}),this.mappingFormGroup.get("converter").get("extension")[t?"disable":"enable"]({emitEvent:!1}),this.mappingFormGroup.get("converter").get("extensionConfig")[t?"disable":"enable"]({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||s2)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(dt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:s2,selectors:[["tb-rest-mapping-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:59,vars:45,consts:[["attributesButton",""],["telemetryButton",""],["keysButton",""],[1,"h-full","w-[77vw]","max-w-3xl",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","endpoint",3,"placeholder"],["matSuffix","",3,"tooltipText"],["formControlName","HTTPMethods","multiple",""],[3,"value"],["formControlName","security",3,"mode"],["formGroupName","converter"],[1,"tb-form-row","space-between","tb-flex"],[1,"fixed-title-width"],["formControlName","type","appearance","fill"],[1,"tb-form-panel","stroked"],[1,"tb-form-panel-title"],[1,"tb-form-hint","tb-primary-fill"],["formControlName","deviceInfo","required","true",1,"device-info",3,"sourceTypes","convertorType","deviceInfoType","connectorType"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],[1,"tb-form-panel","no-border","no-padding","w-full"],["formControlName","response"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],[1,"tb-flex","max-w-70%"],[1,"tb-flex","gw-chip-list",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["translate","",1,"fixed-title-width"],["tbTruncateWithTooltip",""],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex"],["matInput","","name","value","formControlName","extension",3,"placeholder"],[1,"tb-form-row","space-between","same-padding","tb-flex","column"],[1,"tb-flex","ellipsis-chips-container"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",3)(1,"mat-toolbar",4)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",5)(6,"div",6),t.ɵɵelementStart(7,"button",7),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵelementStart(8,"mat-icon",8),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",9)(11,"div",10)(12,"div",11)(13,"div",12),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-form-field",13),t.ɵɵelement(18,"input",14),t.ɵɵpipe(19,"translate"),t.ɵɵtemplate(20,X0,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(21,"div",11)(22,"div",12),t.ɵɵpipe(23,"translate"),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",13)(27,"mat-select",16),t.ɵɵrepeaterCreate(28,Z0,2,2,"mat-option",17,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(30,Q0,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelement(31,"tb-security-config",18),t.ɵɵelementContainerStart(32,19),t.ɵɵelementStart(33,"div",20)(34,"div",21),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"tb-toggle-select",22),t.ɵɵrepeaterCreate(38,J0,3,4,"tb-toggle-option",17,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(40,"div",23)(41,"div",24),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"div",25),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(47,"tb-device-info-table",26),t.ɵɵtemplate(48,e2,1,2,"tb-report-strategy",27)(49,i2,30,11,"div",28)(50,o2,32,23,"div",28),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelement(51,"tb-rest-response-config",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"div",30)(53,"button",31),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(54),t.ɵɵpipe(55,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(56,"button",32),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(57),t.ɵɵpipe(58,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,23,"gateway.data-mapping")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLink),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(14,25,"gateway.hints.rest.endpoint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,27,"gateway.rest.endpoint")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,29,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.mappingFormGroup.get("endpoint").hasError("required")&&n.mappingFormGroup.get("endpoint").touched?20:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(23,31,"gateway.hints.rest.http-methods")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(25,33,"gateway.rest.http-methods")),t.ɵɵadvance(4),t.ɵɵrepeater(n.httpMethods),t.ɵɵadvance(2),t.ɵɵconditional(n.mappingFormGroup.get("HTTPMethods").hasError("required")&&n.mappingFormGroup.get("HTTPMethods").touched?30:-1),t.ɵɵadvance(),t.ɵɵproperty("mode",n.SecurityMode.basic),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,35,"gateway.payload-type")),t.ɵɵadvance(3),t.ɵɵrepeater(n.converterTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(43,37,"gateway.data-conversion")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(46,39,n.RestDataConversionTranslationsMap.get(n.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("sourceTypes",n.restSourceTypes)("convertorType",n.RestConverterType.JSON)("deviceInfoType",n.DeviceInfoType.FULL)("connectorType",n.ConnectorType.REST),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?48:-1),t.ɵɵadvance(),t.ɵɵconditional(n.converterType===n.RestConverterType.JSON?49:50),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(55,41,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.mappingFormGroup.invalid||!n.mappingFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(58,43,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(s2,[T,ei,IK,NX,Y0,di,pi]),styles:['@charset "UTF-8";[_nghost-%COMP%] .device-info .fixed-title-width{min-width:0}'],changeDetection:d.OnPush})}}const l2=()=>["endpoint","httpMethods","securityType","actions"];function p2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"span",30),t.ɵɵelementStart(5,"button",10),t.ɵɵpipe(6,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageMapping(n))})),t.ɵɵelementStart(7,"mat-icon"),t.ɵɵtext(8,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",10),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,3,"gateway.data-mapping")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(6,5,"action.add")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,7,"action.search")))}function c2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",31)(1,"div",32),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rest.endpoint")))}function d2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",33)(1,"div",32),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.endpoint)}}function u2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rest.http-methods")," "))}function m2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",39),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function h2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",35)(1,"mat-chip-listbox",36),t.ɵɵrepeaterCreate(2,m2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(4,"mat-chip",37),t.ɵɵelement(5,"label",38),t.ɵɵelementEnd()()()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵproperty("tbEllipsisChipList",e.HTTPMethods),t.ɵɵadvance(),t.ɵɵrepeater(e.HTTPMethods)}}function g2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",40),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.security-type")," "))}function f2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40)(1,"div",32),t.ɵɵtext(2),t.ɵɵpipe(3,"titlecase"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,null==e.security?null:e.security.type))}}function y2(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",41)}function v2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageMapping(n,i))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteMapping(n,i))})),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.edit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(5,4,"action.delete")))}function x2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,v2,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",42),t.ɵɵelementContainer(4,43),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",44)(6,"button",45),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",46),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",47,2),t.ɵɵelementContainer(11,43),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(4),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function b2(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",48)}function w2(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class S2 extends er{getDatasource(){return new C2}manageMapping(e,t){e&&e.stopPropagation();const n=re(t);this.getMappingDialog(t??{},n?"action.apply":"action.add").afterClosed().pipe(On(this.destroyRef)).subscribe((e=>{if(e){if(n){const n=this.entityFormArray.value.findIndex((e=>JSON.stringify(e)===JSON.stringify(t)));this.entityFormArray.at(n).patchValue(e)}else this.entityFormArray.push(this.fb.control(e));this.entityFormArray.markAsDirty()}}))}deleteMapping(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:t.endpoint}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(On(this.destroyRef)).subscribe((e=>{if(e){const e=this.entityFormArray.value.findIndex((e=>JSON.stringify(e)===JSON.stringify(t)));this.entityFormArray.removeAt(e),this.entityFormArray.markAsDirty()}}))}updateTableData(e,t){t&&(e=e.filter((e=>Object.values(e).some((e=>e.toString().toLowerCase().includes(t.toLowerCase())||e.type?.toLowerCase().includes(t.toLowerCase())))))),this.dataSource.loadData(e)}getMappingDialog(e,t){return this.dialog.open(s2,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(S2)))(n||S2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:S2,selectors:[["tb-rest-mapping-table"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>S2)),multi:!0},{provide:be,useExisting:c((()=>S2)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:47,vars:37,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-absolute-fill","size-full"],[1,"flex","size-full","flex-col"],[1,"gw-table-toolbar","mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"gw-connector-table"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","!w-1/5",4,"matHeaderCellDef"],["class","w-1/5",4,"matCellDef"],["class","w-1/3 !pl-0",4,"matHeaderCellDef"],["class","w-1/3",4,"matCellDef"],["class","w-1/6",4,"matHeaderCellDef"],["class","w-1/6",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"flex-1"],[1,"!w-1/5"],["tbTruncateWithTooltip",""],[1,"w-1/5"],[1,"w-1/3","!pl-0"],[1,"w-1/3"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text","http-method-label","font-medium"],["tbTruncateWithTooltip","",1,"http-method-label","font-medium"],[1,"w-1/6"],[1,"w-12"],[1,"lt-lg:!hidden","flex","min-w-24","flex-1","flex-row","items-stretch","justify-end","text-center"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵtemplate(3,p2,13,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"button",7),t.ɵɵpipe(7,"translate"),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",8)(11,"mat-label"),t.ɵɵtext(12," "),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",9,0),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵpipe(17,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())})),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"table",12),t.ɵɵelementContainerStart(22,13),t.ɵɵtemplate(23,c2,4,3,"mat-header-cell",14)(24,d2,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,u2,3,3,"mat-header-cell",16)(27,h2,6,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,13),t.ɵɵtemplate(29,g2,3,3,"mat-header-cell",18)(30,f2,4,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(31,20),t.ɵɵtemplate(32,y2,1,0,"mat-header-cell",21)(33,x2,12,3,"mat-cell",22),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(34,b2,1,0,"mat-header-row",23)(35,w2,1,0,"mat-row",24),t.ɵɵelementEnd(),t.ɵɵelementStart(36,"section",25),t.ɵɵpipe(37,"async"),t.ɵɵelementStart(38,"button",26),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))})),t.ɵɵelementStart(39,"mat-icon",27),t.ɵɵtext(40,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(41,"span"),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(44,"span",28),t.ɵɵpipe(45,"async"),t.ɵɵtext(46," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,21,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(7,23,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,25,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(17,27,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","endpoint"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","httpMethods"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","securityType"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(35,l2))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,l2)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(37,29,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(43,31,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(45,33,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(S2,[me,T,Jn,ei]),styles:[".http-method-label[_ngcontent-%COMP%]{font-size:12px}"],changeDetection:d.OnPush})}}let C2=class extends ${constructor(){super()}};function _2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" : ",e.value.value," ")}}function T2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",21),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function E2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",21),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function I2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",16)(1,"div",17),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",18)(5,"mat-form-field",19),t.ɵɵelement(6,"input",20),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,T2,3,3,"mat-icon",21),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",16)(10,"div",22),t.ɵɵtext(11,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19),t.ɵɵelement(13,"input",23),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,E2,3,3,"mat-icon",21),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.key")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,7,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?8:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?15:-1)}}function M2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header")(5,"mat-panel-title")(6,"div",13),t.ɵɵtext(7),t.ɵɵelementEnd(),t.ɵɵtemplate(8,_2,2,1,"div",13),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,I2,16,11,"ng-template",14),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",15),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",null==e.value?null:e.value.key," "),t.ɵɵadvance(),t.ɵɵconditional(null!=e.value&&e.value.value?8:-1),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,"gateway.rest.delete-http-header"))}}function k2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,M2,14,7,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function P2(e,n){1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",24),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rest.no-http-headers")))}class D2 extends W{constructor(e,t){super(t),this.fb=e,this.store=t,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=mn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}addKey(){this.keysListFormArray.push(this.fb.group({key:["",[xe.required,xe.pattern(fn)]],value:["",[xe.required,xe.pattern(fn)]]}))}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){this.keysDataApplied.emit(this.keysListFormArray.value.reduce(((e,{key:t,value:n})=>({...e,[t]:n})),{}))}prepareKeysFormArray(e){const t=[];return Object.keys(e)?.forEach((n=>{t.push(this.fb.group({key:[n,[xe.required,xe.pattern(fn)]],value:[e[n],[xe.required,xe.pattern(fn)]]}))})),this.fb.array(t)}static{this.ɵfac=function(e){return new(e||D2)(t.ɵɵdirectiveInject(ye.UntypedFormBuilder),t.ɵɵdirectiveInject(nt.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:D2,selectors:[["tb-rest-http-headers-panel"]],inputs:{keys:"keys",popover:"popover",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:18,vars:15,consts:[[1,"w-[77vw]","max-w-2xl"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","h-[500px]"],[1,"tb-flex","no-flex","center","align-center","h-[500px]"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],["tbTruncateWithTooltip","",1,"max-w-[11vw]"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",1,"gw-delete-icon-button",3,"click","matTooltip"],[1,"tb-form-row"],[1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","type","text","name","value","formControlName","value",3,"placeholder"],[1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,k2,3,0,"div",3)(6,P2,4,3,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",(function(){return n.addKey()})),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",(function(){return n.applyKeysData()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,"gateway.rest.http-headers"),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,"gateway.rest.add-http-header")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(D2,[T]),encapsulation:2,changeDetection:d.OnPush})}}const A2=()=>({min:1}),O2=()=>({maxWidth:"970px"});function R2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.RestRequestTypesTranslationsMap.get(e)))}}function B2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.endpoint-required"))}function F2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.endpoint-pattern"))}function N2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function L2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.http-methods-required"))}function V2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,e))}}function q2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.rest.endpoint"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",21),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,B2,2,3,"tb-error-icon",22)(8,F2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",9)(10,"div",19),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"gateway.rest.http-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",20)(14,"mat-select",23),t.ɵɵrepeaterCreate(15,N2,2,2,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(17,L2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",9)(19,"div",24),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",20)(23,"mat-select",25),t.ɵɵrepeaterCreate(24,V2,3,4,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,6,"gateway.hints.rest.endpoint")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("endpoint").hasError("required")&&e.mappingFormGroup.get("endpoint").touched?7:e.mappingFormGroup.get("endpoint").hasError("pattern")&&e.mappingFormGroup.get("endpoint").touched?8:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(11,10,"gateway.hints.rest.http-methods")),t.ɵɵadvance(5),t.ɵɵrepeater(e.httpMethods),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("HTTPMethods").hasError("required")&&e.mappingFormGroup.get("HTTPMethods").touched?17:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(20,12,"gateway.hints.rest.scope-type")),t.ɵɵadvance(5),t.ɵɵrepeater(e.requestsScopeType)}}function G2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-required"))}function z2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-pattern"))}function U2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.device-name-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",26),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,G2,2,3,"tb-error-icon",22)(8,z2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.device-name-filter-hint")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("deviceNameFilter").hasError("required")&&e.mappingFormGroup.get("deviceNameFilter").touched?7:e.mappingFormGroup.get("deviceNameFilter").hasError("pattern")&&e.mappingFormGroup.get("deviceNameFilter").touched?8:-1)}}function j2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.method-filter-required"))}function H2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.method-filter-pattern"))}function W2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.method-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",27),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,j2,2,3,"tb-error-icon",22)(8,H2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.rest.method-filter")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("methodFilter").hasError("required")&&e.mappingFormGroup.get("methodFilter").touched?7:e.mappingFormGroup.get("methodFilter").hasError("pattern")&&e.mappingFormGroup.get("methodFilter").touched?8:-1)}}function $2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-filter-required"))}function K2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-filter-pattern"))}function Y2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.attribute-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",28),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,$2,2,3,"tb-error-icon",22)(8,K2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,3,"gateway.hints.rest.attribute-filter")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,5,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("attributeFilter").hasError("required")&&e.mappingFormGroup.get("attributeFilter").touched?7:e.mappingFormGroup.get("attributeFilter").hasError("pattern")&&e.mappingFormGroup.get("attributeFilter").touched?8:-1)}}function X2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.request-url-expression-required"))}function Z2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.request-url-expression-pattern"))}function Q2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function J2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.value-expression-required"))}function e3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.value-expression-pattern"))}function t3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",29)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.rest.request-url-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",30),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,X2,2,3,"tb-error-icon",22)(8,Z2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",9)(10,"div",19),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"gateway.rest.http-method"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",20)(14,"mat-select",31),t.ɵɵrepeaterCreate(15,Q2,2,2,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(17,"div",9)(18,"div",19),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"gateway.value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",20),t.ɵɵelement(22,"input",32),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,J2,2,3,"tb-error-icon",22)(25,e3,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,7,"gateway.hints.rest.attribute-url-expression")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("requestUrlExpression").hasError("required")&&e.mappingFormGroup.get("requestUrlExpression").touched?7:e.mappingFormGroup.get("requestUrlExpression").hasError("pattern")&&e.mappingFormGroup.get("requestUrlExpression").touched?8:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(11,11,"gateway.hints.rest.http-method")),t.ɵɵadvance(5),t.ɵɵrepeater(e.httpMethods),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(19,13,"gateway.hints.rest.value-expression")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(23,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("valueExpression").hasError("required")&&e.mappingFormGroup.get("valueExpression").touched?24:e.mappingFormGroup.get("valueExpression").hasError("pattern")&&e.mappingFormGroup.get("valueExpression").touched?25:-1)}}function n3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,A2)))}function i3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function a3(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function r3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2,"gateway.response-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",20),t.ɵɵelement(4,"input",33),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,n3,2,5,"tb-error-icon",22)(7,i3,2,3,"tb-error-icon",22)(8,a3,2,0,"span",34),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,2,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("responseTimeout").hasError("min")&&e.mappingFormGroup.get("responseTimeout").touched?6:e.mappingFormGroup.get("responseTimeout").hasError("pattern")&&e.mappingFormGroup.get("responseTimeout").touched?7:8)}}function o3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-required"))}function s3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-pattern"))}function l3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-name-expression-required"))}function p3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-name-expression-pattern"))}function c3(e,n){1&e&&t.ɵɵelement(0,"div",38),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/rest-json_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,O2))}function d3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.device-name-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",35),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,o3,2,3,"tb-error-icon",22)(8,s3,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",9)(10,"div",36),t.ɵɵtext(11,"gateway.attribute-name-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",20),t.ɵɵelement(13,"input",37),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,l3,2,3,"tb-error-icon",22)(16,p3,2,3,"tb-error-icon",22)(17,c3,1,3,"div",38),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,5,"gateway.device-name-filter-hint")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,7,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("deviceNameExpression").hasError("required")&&e.mappingFormGroup.get("deviceNameExpression").touched?7:e.mappingFormGroup.get("deviceNameExpression").hasError("pattern")&&e.mappingFormGroup.get("deviceNameExpression").touched?8:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("attributeNameExpression").hasError("required")&&e.mappingFormGroup.get("attributeNameExpression").touched?15:e.mappingFormGroup.get("attributeNameExpression").hasError("pattern")&&e.mappingFormGroup.get("attributeNameExpression").touched?16:17)}}function u3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,A2)))}function m3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function h3(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function g3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",20),t.ɵɵelement(4,"input",39),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,u3,2,5,"tb-error-icon",22)(7,m3,2,3,"tb-error-icon",22)(8,h3,2,0,"span",34),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,2,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("timeout").hasError("min")&&e.mappingFormGroup.get("timeout").touched?6:e.mappingFormGroup.get("timeout").hasError("pattern")&&e.mappingFormGroup.get("timeout").touched?7:8)}}function f3(e,n){1&e&&(t.ɵɵelementStart(0,"div",14)(1,"mat-slide-toggle",40)(2,"mat-label",41),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,2,"gateway.hints.rest.update-ssl")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,4,"gateway.rest.ssl-verify")," "))}function y3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",53),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.value)}}function v3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,A2)))}function x3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function b3(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function w3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.tries-min"))}function S3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.tries-pattern"))}function C3(e,n){1&e&&(t.ɵɵelementStart(0,"div",14)(1,"mat-slide-toggle",54)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.rest.allow-redirects")," "))}function _3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"mat-expansion-panel",42)(2,"mat-expansion-panel-header")(3,"mat-panel-title",43)(4,"div",44),t.ɵɵtext(5,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(6,"div",45)(7,"div",10),t.ɵɵtext(8,"gateway.rest.http-headers"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"div",46)(10,"mat-chip-listbox",47),t.ɵɵpipe(11,"keyvalue"),t.ɵɵrepeaterCreate(12,y3,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(14,"keyvalue"),t.ɵɵelementStart(15,"mat-chip",48),t.ɵɵelement(16,"label",49),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"button",50,0),t.ɵɵpipe(19,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(18),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i))})),t.ɵɵelementStart(20,"tb-icon",51),t.ɵɵtext(21,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(22,"div",9)(23,"div",10),t.ɵɵtext(24,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",20),t.ɵɵelement(26,"input",39),t.ɵɵpipe(27,"translate"),t.ɵɵtemplate(28,v3,2,5,"tb-error-icon",22)(29,x3,2,3,"tb-error-icon",22)(30,b3,2,0,"span",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"div",9)(32,"div",10),t.ɵɵtext(33,"gateway.rest.tries"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"mat-form-field",20),t.ɵɵelement(35,"input",52),t.ɵɵpipe(36,"translate"),t.ɵɵtemplate(37,w3,2,3,"tb-error-icon",22)(38,S3,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵtemplate(39,C3,5,3,"div",14),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(10),t.ɵɵproperty("tbEllipsisChipList",t.ɵɵpipeBind1(11,7,e.mappingFormGroup.get("httpHeaders").value)),t.ɵɵadvance(2),t.ɵɵrepeater(t.ɵɵpipeBind1(14,9,e.mappingFormGroup.get("httpHeaders").value)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,11,"action.edit")),t.ɵɵadvance(9),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(27,13,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("timeout").hasError("min")&&e.mappingFormGroup.get("timeout").touched?28:e.mappingFormGroup.get("timeout").hasError("pattern")&&e.mappingFormGroup.get("timeout").touched?29:30),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("tries").hasError("min")&&e.mappingFormGroup.get("tries").touched?37:e.mappingFormGroup.get("tries").hasError("pattern")&&e.mappingFormGroup.get("tries").touched?38:-1),t.ɵɵadvance(2),t.ɵɵconditional(e.requestType===e.RestRequestType.ATTRIBUTE_UPDATE?39:-1)}}class T3 extends O{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.cdr=l,this.destroyRef=p,this.requestTypes=Object.values(Oi),this.requestsScopeType=Object.values(Bi),this.httpMethods=Object.values(St),this.helpLink=`${w}/docs/iot-gateway/config/rest/#attribute-request-section`,this.RestRequestTypesTranslationsMap=Ri,this.SecurityMode=oa,this.RestRequestType=Oi,this.mappingFormGroup=this.fb.group({requestType:[Oi.ATTRIBUTE_REQUEST],endpoint:["",[xe.required,xe.pattern(fn)]],HTTPMethods:[[St.POST],[xe.required]],HTTPMethod:[St.POST,[xe.required]],type:[Bi.Shared],security:[{type:zi.ANONYMOUS}],timeout:[null,[xe.min(.001),xe.pattern(gn)]],deviceNameExpression:["",[xe.required,xe.pattern(fn)]],attributeNameExpression:["",[xe.required,xe.pattern(fn)]],SSLVerify:[!1],deviceNameFilter:["",[xe.required,xe.pattern(fn)]],methodFilter:["",[xe.required,xe.pattern(fn)]],attributeFilter:["",[xe.required,xe.pattern(fn)]],requestUrlExpression:[this.data.defaultRequestUrl,[xe.required,xe.pattern(fn)]],valueExpression:["",[xe.required,xe.pattern(fn)]],responseTimeout:[null,[xe.min(.001),xe.pattern(gn)]],tries:[null,[xe.min(1),xe.pattern(gn)]],allowRedirects:[!1],httpHeaders:[{}]}),this.keysPopupClosed=!0,this.mappingFormGroup.patchValue(this.data.value,{emitEvent:!1}),this.observeRequestTypeChange(),this.toggleFieldsByRequestType(this.mappingFormGroup.get("requestType").value)}get requestType(){return this.mappingFormGroup.get("requestType").value}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.mappingFormGroup.valid){const{requestType:e,...t}=this.mappingFormGroup.value;te(t),this.dialogRef.close({requestType:e,requestValue:t})}}manageKeys(e,t){e.stopPropagation();const n=t._elementRef.nativeElement;if(this.popoverService.hasPopover(n))return void this.popoverService.hidePopover(n);this.popoverService.hasPopover(n)&&this.popoverService.hidePopover(n),this.keysPopupClosed=!1;const i=this.popoverService.displayPopover(n,this.renderer,this.viewContainerRef,D2,"leftBottom",!1,null,{keys:this.mappingFormGroup.get("httpHeaders").value,withReportStrategy:this.data.withReportStrategy},{},{},{},!0);i.tbComponentRef.instance.popover=i,i.tbComponentRef.instance.keysDataApplied.subscribe((e=>{i.hide(),this.mappingFormGroup.get("httpHeaders").patchValue(e),this.mappingFormGroup.get("httpHeaders").markAsDirty(),this.cdr.markForCheck()})),i.tbHideStart.pipe(On(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}observeRequestTypeChange(){this.mappingFormGroup.get("requestType").valueChanges.pipe(Fe(),On(this.destroyRef)).subscribe((e=>this.toggleFieldsByRequestType(e)))}toggleFieldsByRequestType(e){this.mappingFormGroup.disable({emitEvent:!1}),Fi.get("all").forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1}))),Fi.get(e).forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1})))}static{this.ɵfac=function(e){return new(e||T3)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(it.Router),t.ɵɵdirectiveInject(Ye),t.ɵɵdirectiveInject(Xe.MatDialogRef),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(dt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:T3,selectors:[["tb-rest-requests-mapping-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:37,vars:23,consts:[["button",""],[1,"h-full","w-[77vw]","max-w-3xl",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row"],["translate","",1,"fixed-title-width"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex"],["formControlName","requestType"],[3,"value"],[1,"tb-form-row","tb-flex","fill-width"],["formControlName","security",3,"mode"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","type","text","name","value","formControlName","endpoint",3,"placeholder"],["matSuffix","",3,"tooltipText"],["formControlName","HTTPMethods","multiple",""],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","type"],["matInput","","type","text","name","value","formControlName","deviceNameFilter",3,"placeholder"],["matInput","","type","text","name","value","formControlName","methodFilter",3,"placeholder"],["matInput","","type","text","name","value","formControlName","attributeFilter",3,"placeholder"],[1,"tb-form-row","request-url-row"],["matInput","","type","text","name","value","formControlName","requestUrlExpression",3,"placeholder"],["formControlName","HTTPMethod"],["matInput","","type","text","name","value","formControlName","valueExpression",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","responseTimeout",3,"placeholder"],["translate","","matSuffix","",1,"block","pr-2"],["matInput","","type","text","name","value","formControlName","deviceNameExpression",3,"placeholder"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","type","text","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["formControlName","SSLVerify",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],[1,"tb-settings"],[1,"justify-end"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","space-between","tb-flex"],[1,"tb-flex","gw-chip-list"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["matInput","","type","number","min","0","name","value","formControlName","tries",3,"placeholder"],["tbTruncateWithTooltip",""],["formControlName","allowRedirects",1,"mat-slide"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",1)(1,"mat-toolbar",2)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",3)(6,"div",4),t.ɵɵelementStart(7,"button",5),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵelementStart(8,"mat-icon",6),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",7)(11,"div",8)(12,"div",9)(13,"div",10),t.ɵɵtext(14,"gateway.request-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-form-field",11)(16,"mat-select",12),t.ɵɵrepeaterCreate(17,R2,3,4,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(19,q2,26,14)(20,U2,9,7,"div",9)(21,W2,9,7,"div",9)(22,Y2,9,7,"div",9)(23,t3,26,17)(24,r3,9,4,"div",9)(25,d3,18,11)(26,g3,9,4,"div",9)(27,f3,6,6,"div",14),t.ɵɵelement(28,"tb-security-config",15),t.ɵɵtemplate(29,_3,40,17,"div",8),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"div",16)(31,"button",17),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"button",18),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,17,"gateway.requests-mapping")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLink),t.ɵɵadvance(11),t.ɵɵrepeater(n.requestTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_REQUEST?19:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType!==n.RestRequestType.ATTRIBUTE_REQUEST?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.SERVER_SIDE_RPC?21:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_UPDATE?22:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType!==n.RestRequestType.ATTRIBUTE_REQUEST?23:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.SERVER_SIDE_RPC?24:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_REQUEST?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_REQUEST?26:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_UPDATE?27:-1),t.ɵɵadvance(),t.ɵɵproperty("mode",n.SecurityMode.basic),t.ɵɵadvance(),t.ɵɵconditional(n.requestType!==n.RestRequestType.ATTRIBUTE_REQUEST?29:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(33,19,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.mappingFormGroup.invalid||!n.mappingFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(36,21,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(T3,[me,T,ei,NX,di]),styles:["[_nghost-%COMP%] .tb-form-row.request-url-row[_ngcontent-%COMP%]{gap:6px}"],changeDetection:d.OnPush})}}const E3=()=>["type","details","actions"],I3=()=>({});function M3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",26),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"span",27),t.ɵɵelementStart(5,"button",10),t.ɵɵpipe(6,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageMapping(n))})),t.ɵɵelementStart(7,"mat-icon"),t.ɵɵtext(8,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",10),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,3,"gateway.requests-mapping")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(6,5,"action.add")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,7,"action.search")))}function k3(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.type")))}function P3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,i.RestRequestTypesTranslationsMap.get(e.requestType)))}}function D3(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",31),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.details")," "))}function A3(e,n){if(1&e&&t.ɵɵtext(0),2&e){let e;const n=t.ɵɵnextContext().$implicit,i=t.ɵɵnextContext();t.ɵɵtextInterpolate1(" ",i.Object.values(null!==(e=n.requestValue.httpHeaders)&&void 0!==e?e:t.ɵɵpureFunction0(1,I3)).join(", ")," ")}}function O3(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.methodFilter," ")}}function R3(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.endpoint," ")}}function B3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",29),t.ɵɵtemplate(2,A3,1,2)(3,O3,1,1)(4,R3,1,1),t.ɵɵelementEnd()()),2&e){let e;const i=n.$implicit;t.ɵɵadvance(2),t.ɵɵconditional("attributeUpdates"===(e=i.requestType)?2:"serverSideRpc"===e?3:4)}}function F3(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function N3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageMapping(n,i))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteMapping(n,i))})),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.edit")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(5,4,"action.delete")))}function L3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,N3,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",33),t.ɵɵelementContainer(4,34),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",35)(6,"button",36),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",37),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",38,2),t.ɵɵelementContainer(11,34),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(4),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function V3(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function q3(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class G3 extends er{constructor(){super(...arguments),this.Object=Object,this.RestRequestTypesTranslationsMap=Ri}getDatasource(){return new z3}manageMapping(e,t){e&&e.stopPropagation();const n=re(t);this.getMappingDialog(t,n?"action.apply":"action.add").afterClosed().pipe(On(this.destroyRef)).subscribe((e=>{if(e){if(n){const n=this.entityFormArray.value.findIndex((e=>JSON.stringify(e)===JSON.stringify(t)));this.entityFormArray.at(n).patchValue(e)}else this.entityFormArray.push(this.fb.control(e));this.entityFormArray.markAsDirty()}}))}deleteMapping(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:this.getRequestDetails(t)}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(On(this.destroyRef)).subscribe((e=>{if(e){const e=this.entityFormArray.value.findIndex((e=>JSON.stringify(e)===JSON.stringify(t)));this.entityFormArray.removeAt(e),this.entityFormArray.markAsDirty()}}))}updateTableData(e,t){t&&(e=e.filter((e=>{const n=this.getRequestDetails(e);return Object.values(e).some((e=>ae(e)&&this.translate.instant(Ri.get(e)).toLowerCase().includes(t.toLowerCase())||n?.toLowerCase().includes(t.toLowerCase())))}))),this.dataSource.loadData(e)}getRequestDetails(e){let t;switch(e.requestType){case"attributeUpdates":t=Object.values(e.requestValue.httpHeaders).join(", ");break;case"serverSideRpc":t=e.requestValue.methodFilter;break;default:t=e.requestValue.endpoint}return t}validate(){return null}getMappingDialog(e,t){return this.dialog.open(T3,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,defaultRequestUrl:this.defaultRequestUrl,withReportStrategy:this.withReportStrategy}})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(G3)))(n||G3)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:G3,selectors:[["tb-rest-request-mapping-table"]],inputs:{defaultRequestUrl:"defaultRequestUrl"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>G3)),multi:!0},{provide:be,useExisting:c((()=>G3)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:44,vars:36,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-absolute-fill","size-full"],[1,"flex","size-full","flex-col"],[1,"gw-table-toolbar","mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"gw-connector-table"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","!w-1/3",4,"matHeaderCellDef"],["class","w-1/3",4,"matCellDef"],["class","w-1/3 !pl-0",4,"matHeaderCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"flex-1"],[1,"!w-1/3"],["tbTruncateWithTooltip",""],[1,"w-1/3"],[1,"w-1/3","!pl-0"],[1,"w-12"],[1,"lt-lg:!hidden","flex","min-w-24","flex-1","flex-row","items-stretch","justify-end","text-center"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵtemplate(3,M3,13,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"button",7),t.ɵɵpipe(7,"translate"),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",8)(11,"mat-label"),t.ɵɵtext(12," "),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",9,0),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵpipe(17,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())})),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"table",12),t.ɵɵelementContainerStart(22,13),t.ɵɵtemplate(23,k3,4,3,"mat-header-cell",14)(24,P3,4,3,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,D3,3,3,"mat-header-cell",16)(27,B3,5,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,17),t.ɵɵtemplate(29,F3,1,0,"mat-header-cell",18)(30,L3,12,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(31,V3,1,0,"mat-header-row",20)(32,q3,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"section",22),t.ɵɵpipe(34,"async"),t.ɵɵelementStart(35,"button",23),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))})),t.ɵɵelementStart(36,"mat-icon",24),t.ɵɵtext(37,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"span"),t.ɵɵtext(39),t.ɵɵpipe(40,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(41,"span",25),t.ɵɵpipe(42,"async"),t.ɵɵtext(43," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,20,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(7,22,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,24,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(17,26,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","type"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","details"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(34,E3))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,E3)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(34,28,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(40,30,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(42,32,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(G3,[me,T,Jn]),encapsulation:2,changeDetection:d.OnPush})}}class z3 extends ${constructor(){super()}}class U3 extends Xa{initBasicFormGroup(){return this.fb.group({server:[],mapping:[],requestsMapping:[]})}getRequestDataArray(e){const t=[];return le(e)&&Object.keys(e).forEach((n=>{for(const i of e[n])t.push({requestType:n,requestValue:i})})),t}getRequestDataObject(e){return e.reduce(((e,{requestType:t,requestValue:n})=>(e[t]?.push(n),e)),{attributeRequests:[],attributeUpdates:[],serverSideRpc:[]})}updateDefaultUrl({host:e,port:t,SSL:n}){this.defaultRequestUrl=e&&t?`${n?"https":"http"}//${e}:${t}/`:document.location.origin}writeValue(e){this.basicFormGroup.setValue(this.mapConfigToFormValue(e),{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(U3)))(n||U3)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:U3,features:[t.ɵɵInheritDefinitionFeature]})}}class j3 extends U3{mapConfigToFormValue(e){return{server:e.server??{},mapping:e.mapping??[],requestsMapping:this.getRequestDataArray(e.requestsMapping)}}getMappedValue(e){return this.updateDefaultUrl(e?.server??{}),{server:e.server??{},mapping:e.mapping??[],requestsMapping:this.getRequestDataObject(e.requestsMapping??[])}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(j3)))(n||j3)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:j3,selectors:[["tb-rest-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>j3)),multi:!0},{provide:be,useExisting:c((()=>j3)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:13,vars:17,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server"],["formControlName","mapping"],["formControlName","requestsMapping",3,"defaultRequestUrl"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-rest-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-rest-mapping-table",4),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-tab",1),t.ɵɵpipe(11,"translate"),t.ɵɵelement(12,"tb-rest-request-mapping-table",5),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,9,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,11,"gateway.server"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,13,"gateway.data-mapping"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(11,15,"gateway.requests-mapping")),t.ɵɵadvance(2),t.ɵɵproperty("defaultRequestUrl",n.defaultRequestUrl))},dependencies:t.ɵɵgetComponentDepsFactory(j3,[me,T,F0,S2,G3]),encapsulation:2,changeDetection:d.OnPush})}}class H3 extends U3{mapConfigToFormValue({attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}){return{server:{...a??{}},mapping:sr.mapMappingToUpgradedVersion(i),requestsMapping:this.getRequestDataArray({attributeRequests:e,attributeUpdates:t,serverSideRpc:n})}}getMappedValue({requestsMapping:e,mapping:t=[],server:n={}}){this.updateDefaultUrl(n);const{attributeRequests:i=[],attributeUpdates:a=[],serverSideRpc:r=[]}=this.getRequestDataObject(e);return{...n,mapping:sr.mapMappingToDowngradedVersion(t),attributeRequests:i,attributeUpdates:a,serverSideRpc:r}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(H3)))(n||H3)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:H3,selectors:[["tb-rest-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>H3)),multi:!0},{provide:be,useExisting:c((()=>H3)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:13,vars:17,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server"],["formControlName","mapping"],["formControlName","requestsMapping",3,"defaultRequestUrl"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-rest-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-rest-mapping-table",4),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-tab",1),t.ɵɵpipe(11,"translate"),t.ɵɵelement(12,"tb-rest-request-mapping-table",5),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,9,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,11,"gateway.server"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,13,"gateway.data-mapping"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(11,15,"gateway.requests-mapping")),t.ɵɵadvance(2),t.ɵɵproperty("defaultRequestUrl",n.defaultRequestUrl))},dependencies:t.ɵɵgetComponentDepsFactory(H3,[me,T,F0,S2,G3]),encapsulation:2,changeDetection:d.OnPush})}}const W3=(e,t)=>({hasErrors:e,noErrors:t}),$3=()=>({minWidth:"144px",maxWidth:"144px",textAlign:"center"}),K3=()=>({minWidth:"144px",maxWidth:"144px",width:"144px",textAlign:"center"}),Y3=e=>({"tb-current-entity":e});function X3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",31),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"async"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onAddConnector(n))})),t.ɵɵelementStart(3,"mat-icon"),t.ɵɵtext(4,"add"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,2,"action.add")),t.ɵɵproperty("disabled",t.ɵɵpipeBind1(2,4,e.isLoading$))}}function Z3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",7)(1,"button",32),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onAddConnector(n))})),t.ɵɵelementStart(2,"mat-icon",33),t.ɵɵtext(3,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"span"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,1,"gateway.add-connector")))}function Q3(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-enabled")," "))}function J3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"mat-slide-toggle",35),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return n.stopPropagation(),t.ɵɵresetView(a.onEnableConnector(i))})),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("checked",i.activeConnectors.includes(e.key))}}function e5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",36),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-name"),""))}function t5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function n5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",37),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-type")," "))}function i5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.returnType(e)," ")}}function a5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",37),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration")," "))}function r5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",38)(1,"div",39),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(i.isConnectorSynced(e)?"status-sync":"status-unsync"),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.isConnectorSynced(e)?"sync":"out of sync"," ")}}function o5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",37),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-status")," "))}function s5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell",38)(1,"span",40),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction2(3,W3,+i.getErrorsCount(e)>0,0==+i.getErrorsCount(e)||""===i.getErrorsCount(e))),t.ɵɵpropertyInterpolate("matTooltip","Errors: "+i.getErrorsCount(e))}}function l5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell"),t.ɵɵelement(1,"div",41),t.ɵɵelementStart(2,"div",42),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,$3)),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.connectors-table-actions")))}function p5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"div",43)(2,"button",44),t.ɵɵpipe(3,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(4,"mat-icon"),t.ɵɵtext(5,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"button",45),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",45),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"div",46)(15,"button",47),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(16,"mat-icon",48),t.ɵɵtext(17,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"mat-menu",49,1)(20,"button",44),t.ɵɵpipe(21,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(22,"mat-icon"),t.ɵɵtext(23,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",45),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(26,"mat-icon"),t.ɵɵtext(27,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"button",45),t.ɵɵpipe(29,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(30,"mat-icon"),t.ɵɵtext(31,"delete"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,i=t.ɵɵreference(19);t.ɵɵadvance(),t.ɵɵstyleMap(t.ɵɵpureFunction0(23,K3)),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(3,11,"gateway.rpc.rpc"))("disabled",!e.value.configurationJson.id),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(7,13,"gateway.logs.logs")),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,15,"gateway.delete-connector")),t.ɵɵadvance(5),t.ɵɵproperty("matMenuTriggerFor",i),t.ɵɵadvance(5),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(21,17,"gateway.rpc.rpc"))("disabled",!e.value.configurationJson.id),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(25,19,"gateway.logs.logs")),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(29,21,"gateway.delete-connector"))}}function c5(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",50)}function d5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-row",51),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.selectConnector(n,i))})),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction1(2,Y3,i.isSameConnector(e)))}}function u5(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",26),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1("v",e.connectorForm.get("configVersion").value,"")}}function m5(e,n){1&e&&t.ɵɵelement(0,"div",27),2&e&&t.ɵɵproperty("tb-help",n)}function h5(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-select",28)(1,"tb-toggle-option",52),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-option",52),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("value",e.ConnectorConfigurationModes.BASIC),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,4,"gateway.basic")," "),t.ɵɵadvance(2),t.ɵɵproperty("value",e.ConnectorConfigurationModes.ADVANCED),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,6,"gateway.advanced")," ")}}function g5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function f5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-legacy-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function y5(e,n){if(1&e&&(t.ɵɵtemplate(0,g5,2,4,"tb-mqtt-basic-config",55),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵtemplate(2,f5,2,4,"tb-mqtt-legacy-basic-config",55)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)?0:2)}}function v5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function x5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-legacy-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function b5(e,n){if(1&e&&(t.ɵɵtemplate(0,v5,2,4,"tb-opc-ua-basic-config",55),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵtemplate(2,x5,2,4,"tb-opc-ua-legacy-basic-config",55)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.OPCUA)?0:2)}}function w5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-basic-config",58),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function S5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-legacy-basic-config",58),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function C5(e,n){if(1&e&&(t.ɵɵtemplate(0,w5,1,1,"tb-modbus-basic-config",57),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵtemplate(2,S5,1,1,"tb-modbus-legacy-basic-config",57)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.MODBUS)?0:2)}}function _5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-basic-config",58),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function T5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-legacy-basic-config",58),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function E5(e,n){if(1&e&&(t.ɵɵtemplate(0,_5,1,1,"tb-socket-basic-config",57),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵtemplate(2,T5,1,1,"tb-socket-legacy-basic-config",57)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.SOCKET)?0:2)}}function I5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function M5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-legacy-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function k5(e,n){if(1&e&&(t.ɵɵtemplate(0,I5,2,4,"tb-bacnet-basic-config",55),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵtemplate(2,M5,2,4,"tb-bacnet-legacy-basic-config",55)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.BACNET)?0:2)}}function P5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-basic-config",60),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function D5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-legacy-basic-config",60),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function A5(e,n){if(1&e&&(t.ɵɵtemplate(0,P5,2,4,"tb-rest-basic-config",59),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵtemplate(2,D5,2,4,"tb-rest-legacy-basic-config",59)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.REST)?0:2)}}function O5(e,n){if(1&e&&t.ɵɵtemplate(0,y5,3,4)(1,b5,3,4)(2,C5,3,4)(3,E5,3,4)(4,k5,3,4)(5,A5,3,4),2&e){let e;const n=t.ɵɵnextContext(2);t.ɵɵconditional((e=n.initialConnector.type)===n.ConnectorType.MQTT?0:e===n.ConnectorType.OPCUA?1:e===n.ConnectorType.MODBUS?2:e===n.ConnectorType.SOCKET?3:e===n.ConnectorType.BACNET?4:e===n.ConnectorType.REST?5:-1)}}function R5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group")(1,"mat-tab",61),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,62),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",61),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-json-object-edit",63),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(42);t.ɵɵadvance(),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,6,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,8,"gateway.configuration"),"*"),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(7,10,"gateway.configuration")),t.ɵɵproperty("fillHeight",!0)}}function B5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",30),t.ɵɵtemplate(1,O5,6,1)(2,R5,8,12,"mat-tab-group"),t.ɵɵelementStart(3,"div",53)(4,"button",54),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onSaveConnector())})),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵconditional((null==(e=n.connectorForm.get("mode"))?null:e.value)===n.ConnectorConfigurationModes.BASIC?1:2),t.ɵɵadvance(3),t.ɵɵproperty("disabled",!n.connectorForm.dirty||n.connectorForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,3,"action.save")," ")}}function F5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",70),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.connectorForm.get("name").hasError("duplicateName")?"gateway.connector-duplicate-name":"gateway.name-required"))}}function N5(e,n){1&e&&(t.ɵɵelementStart(0,"div",65)(1,"div",75),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",67)(4,"mat-form-field",68),t.ɵɵelement(5,"input",78),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function L5(e,n){1&e&&(t.ɵɵelementStart(0,"div",65)(1,"div",75),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",67)(4,"mat-form-field",68),t.ɵɵelement(5,"input",79),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function V5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function q5(e,n){1&e&&(t.ɵɵelementStart(0,"div",65)(1,"mat-slide-toggle",80)(2,"mat-label",81),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,2,"gateway.send-change-data-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,4,"gateway.send-change-data")," "))}function G5(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",77),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Connector)}}function z5(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",64)(1,"div",65)(2,"div",66),t.ɵɵtext(3,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",67)(5,"mat-form-field",68),t.ɵɵelement(6,"input",69),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,F5,3,3,"mat-icon",70),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,N5,7,3,"div",65)(10,L5,7,3,"div",65),t.ɵɵelementStart(11,"div",71)(12,"div",72),t.ɵɵtext(13,"gateway.logs-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",73)(15,"mat-slide-toggle",74)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",65)(20,"div",75),t.ɵɵtext(21,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",67)(23,"mat-form-field",68)(24,"mat-select",76),t.ɵɵrepeaterCreate(25,V5,2,2,"mat-option",52,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()()(),t.ɵɵtemplate(27,q5,6,6,"div",65),t.ɵɵpipe(28,"withReportStrategy"),t.ɵɵtemplate(29,G5,1,2,"tb-report-strategy",77),t.ɵɵpipe(30,"withReportStrategy"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.connectorForm),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(e.connectorForm.get("name").hasError("required")&&e.connectorForm.get("name").touched||e.connectorForm.get("name").hasError("duplicateName")?8:-1),t.ɵɵadvance(),t.ɵɵconditional(e.connectorForm.get("type").value===e.ConnectorType.CUSTOM?9:-1),t.ɵɵadvance(),t.ɵɵconditional(e.connectorForm.get("type").value===e.ConnectorType.GRPC?10:-1),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,10,"gateway.enable-remote-logging")," "),t.ɵɵadvance(8),t.ɵɵrepeater(e.gatewayLogLevel),t.ɵɵadvance(2),t.ɵɵconditional(e.connectorForm.get("type").value!==e.ConnectorType.MQTT||t.ɵɵpipeBind2(28,12,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)?-1:27),t.ɵɵadvance(2),t.ɵɵconditional(t.ɵɵpipeBind2(30,15,e.connectorForm.get("configVersion").value,e.connectorForm.get("type").value)?29:-1)}}class U5{isErrorState(e){return e&&e.invalid}}e("ForceErrorStateMatcher",U5);class j5 extends W{constructor(e,t,n,i,a,r,o,s,l,p,c){super(e),this.store=e,this.fb=t,this.translate=n,this.attributeService=i,this.dialogService=a,this.dialog=r,this.telemetryWsService=o,this.zone=s,this.utils=l,this.withReportStrategy=p,this.cd=c,this.ConnectorType=yt,this.allowBasicConfig=new Set([yt.MQTT,yt.OPCUA,yt.MODBUS,yt.SOCKET,yt.BACNET,yt.REST]),this.gatewayLogLevel=Object.values(gt),this.displayedColumns=["enabled","key","type","syncStatus","errors","actions"],this.GatewayConnectorTypesTranslatesMap=vt,this.ConnectorConfigurationModes=dn,this.ReportStrategyDefaultValue=mn,this.connectorHelpLinksMap=xt,this.basicConfigInitSubject=new Ie,this.activeData=[],this.inactiveData=[],this.sharedAttributeData=[],this.subscriptionOptions={callbacks:{onDataUpdated:()=>this.ctx.ngZone.run((()=>{this.onErrorsUpdated()})),onDataUpdateError:(e,t)=>this.ctx.ngZone.run((()=>{this.onDataUpdateError(t)}))}},this.destroy$=new Ie,this.attributeUpdateSubject=new Ie,this.initDataSources(),this.initConnectorForm(),this.observeAttributeChange()}ngAfterViewInit(){this.dataSource.sort=this.sort,this.dataSource.sortingDataAccessor=this.getSortingDataAccessor(),this.ctx.$scope.gatewayConnectors=this,this.loadConnectors(),this.loadGatewayState(),this.observeModeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}onSaveConnector(){this.saveConnector(this.getUpdatedConnectorData(this.connectorForm.value),!1)}saveConnector(e,t=!0){const n=t||this.activeConnectors.includes(this.initialConnector.name)?A.SHARED_SCOPE:A.SERVER_SCOPE;Ae(this.getEntityAttributeTasks(e,n)).pipe(Ue(1)).subscribe((n=>{this.showToast(t?this.translate.instant("gateway.connector-created"):this.translate.instant("gateway.connector-updated")),this.initialConnector=e,this.updateData(!0),this.connectorForm.markAsPristine()}))}getEntityAttributeTasks(e,t){const n=[],i=[{key:e.name,value:e}],a=[],r=!this.activeConnectors.includes(e.name)&&t===A.SHARED_SCOPE||!this.inactiveConnectors.includes(e.name)&&t===A.SERVER_SCOPE,o=this.initialConnector&&this.initialConnector.name!==e.name;return o&&(a.push({key:this.initialConnector.name}),this.removeConnectorFromList(this.initialConnector.name,!0),this.removeConnectorFromList(this.initialConnector.name,!1)),r&&(t===A.SHARED_SCOPE?this.activeConnectors.push(e.name):this.inactiveConnectors.push(e.name)),(o||r)&&n.push(this.getSaveEntityAttributesTask(t)),n.push(this.attributeService.saveEntityAttributes(this.device,t,i)),a.length&&n.push(this.attributeService.deleteEntityAttributes(this.device,t,a)),n}getSaveEntityAttributesTask(e){const t=e===A.SHARED_SCOPE?"active_connectors":"inactive_connectors",n=e===A.SHARED_SCOPE?this.activeConnectors:this.inactiveConnectors;return this.attributeService.saveEntityAttributes(this.device,e,[{key:t,value:n}])}removeConnectorFromList(e,t){const n=t?this.activeConnectors:this.inactiveConnectors,i=n.indexOf(e);-1!==i&&n.splice(i,1)}getUpdatedConnectorData(e){const t={...e};return t.configuration=`${ce(t.name)}.json`,delete t.basicConfig,t.type!==yt.GRPC&&delete t.key,t.type!==yt.CUSTOM&&delete t.class,this.allowBasicConfig.has(t.type)||delete t.mode,this.withReportStrategy.transform(t.configVersion,t.type)&&(t.configurationJson.reportStrategy=t.reportStrategy,de(t.reportStrategy)&&delete t.reportStrategy,de(t.configurationJson.reportStrategy)&&delete t.configurationJson.reportStrategy),this.gatewayVersion&&!t.configVersion&&(t.configVersion=this.gatewayVersion),t.ts=Date.now(),t}updateData(e=!1){this.pageLink.sortOrder.property=this.sort.active,this.pageLink.sortOrder.direction=S[this.sort.direction.toUpperCase()],this.attributeDataSource.loadAttributes(this.device,A.CLIENT_SCOPE,this.pageLink,e).subscribe((e=>{this.activeData=e.data.filter((e=>this.activeConnectors.includes(e.key))),this.combineData(),this.generateSubscription(),this.setClientData(e)})),this.inactiveConnectorsDataSource.loadAttributes(this.device,A.SHARED_SCOPE,this.pageLink,e).subscribe((e=>{this.sharedAttributeData=e.data.filter((e=>this.activeConnectors.includes(e.key))),this.combineData()})),this.serverDataSource.loadAttributes(this.device,A.SERVER_SCOPE,this.pageLink,e).subscribe((e=>{this.inactiveData=e.data.filter((e=>this.inactiveConnectors.includes(e.key))),this.combineData()}))}isConnectorSynced(e){const t=e.value;if(!t.ts||e.skipSync||!this.isGatewayActive)return!1;if(-1===this.activeData.findIndex((e=>("string"==typeof e.value?JSON.parse(e.value):e.value).name===t.name)))return!1;return-1!==this.sharedAttributeData.findIndex((e=>{const n=e.value,i=n.name===t.name,a=Q(n.configurationJson,{})&&i,r=this.hasSameConfig(n.configurationJson,t.configurationJson),o=n.ts&&n.ts<=t.ts;return i&&o&&(r||a)}))}hasSameConfig(e,t){const{name:n,id:i,enableRemoteLogging:a,logLevel:r,reportStrategy:o,configVersion:s,...l}=e,{name:p,id:c,enableRemoteLogging:d,logLevel:u,reportStrategy:m,configVersion:h,...g}=t;return Q(l,g)}combineData(){const e=[...this.activeData,...this.inactiveData,...this.sharedAttributeData].reduce(((e,t)=>{const n=e.findIndex((e=>e.key===t.key));return-1===n?e.push(t):t.lastUpdateTs>e[n].lastUpdateTs&&!this.isConnectorSynced(e[n])&&(e[n]={...t,skipSync:!0}),e}),[]);this.dataSource.data=e.map((e=>({...e,value:"string"==typeof e.value?JSON.parse(e.value):e.value})))}clearOutConnectorForm(){this.initialConnector=null,this.connectorForm.setValue({mode:dn.BASIC,name:"",type:yt.MQTT,sendDataOnlyOnChange:!1,enableRemoteLogging:!1,logLevel:gt.INFO,key:"auto",class:"",configuration:"",configurationJson:{},basicConfig:{},configVersion:"",reportStrategy:[{value:{},disabled:!0}]},{emitEvent:!1}),this.connectorForm.markAsPristine()}selectConnector(e,t){e&&e.stopPropagation();const n=t.value;n?.name!==this.initialConnector?.name&&this.confirmConnectorChange().subscribe((e=>{e&&this.setFormValue(n)}))}isSameConnector(e){if(!this.initialConnector)return!1;const t=e.value;return this.initialConnector.name===t.name}showToast(e){this.store.dispatch({type:"[Notification] Show",notification:{message:e,type:"success",duration:1e3,verticalPosition:"top",horizontalPosition:"left",target:"dashboardRoot",forceDismiss:!0}})}returnType(e){const t=e.value;return this.GatewayConnectorTypesTranslatesMap.get(t.type)}deleteConnector(e,t){t?.stopPropagation();const n=`Delete connector "${e.key}"?`;this.dialogService.confirm(n,"All connector data will be deleted.","Cancel","Delete").pipe(Ue(1),He((t=>{if(!t)return;const n=[],i=this.activeConnectors.includes(e.value?.name)?A.SHARED_SCOPE:A.SERVER_SCOPE;return n.push(this.attributeService.deleteEntityAttributes(this.device,i,[e])),this.removeConnectorFromList(e.key,!0),this.removeConnectorFromList(e.key,!1),n.push(this.getSaveEntityAttributesTask(i)),Ae(n)}))).subscribe((()=>{this.initialConnector&&this.initialConnector.name!==e.key||(this.clearOutConnectorForm(),this.cd.detectChanges()),this.updateData(!0)}))}connectorLogs(e,t){t&&t.stopPropagation();const n=se(this.ctx.stateController.getStateParams());n.connector_logs=e,n.targetEntityParamName="connector_logs",this.ctx.stateController.openState("connector_logs",n)}connectorRpc(e,t){t&&t.stopPropagation();const n=se(this.ctx.stateController.getStateParams());n.connector_rpc=e,n.targetEntityParamName="connector_rpc",this.ctx.stateController.openState("connector_rpc",n)}onEnableConnector(e){e.value.ts=(new Date).getTime(),this.updateActiveConnectorKeys(e.key),this.attributeUpdateSubject.next(e)}getErrorsCount(e){const t=e.key,n=this.subscription&&this.subscription.data.find((e=>e&&e.dataKey.name===`${t}_ERRORS_COUNT`));return n&&this.activeConnectors.includes(t)?n.data[0][1]||0:"Inactive"}onAddConnector(e){e?.stopPropagation(),this.confirmConnectorChange().pipe(Ue(1),Le(Boolean),He((()=>this.openAddConnectorDialog())),Le(Boolean)).subscribe((e=>this.addConnector(e)))}addConnector(e){e.configurationJson||(e.configurationJson={}),this.gatewayVersion&&!e.configVersion&&(e.configVersion=this.gatewayVersion),e.basicConfig=e.configurationJson,this.initialConnector=e;const t=this.connectorForm.get("type").value;this.setInitialConnectorValues(e),this.saveConnector(this.getUpdatedConnectorData(e)),t!==e.type&&this.allowBasicConfig.has(e.type)?this.basicConfigInitSubject.pipe(Ue(1)).subscribe((()=>{this.patchConnectorBasicConfig(e.basicConfig)})):this.patchConnectorBasicConfig(e.basicConfig)}setInitialConnectorValues(e){const{basicConfig:t,mode:n,enableRemoteLogging:i,...a}=e;this.toggleReportStrategy(e),this.connectorForm.get("mode").setValue(this.allowBasicConfig.has(e.type)?e.mode??dn.BASIC:null,{emitEvent:!1}),this.connectorForm.get("enableRemoteLogging").setValue(i,{emitEvent:!1}),this.connectorForm.patchValue(a,{emitEvent:!1})}openAddConnectorDialog(){return this.ctx.ngZone.run((()=>this.dialog.open(gK,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{dataSourceData:this.dataSource.data,gatewayVersion:this.gatewayVersion}}).afterClosed()))}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=this.dataSource.data.some((e=>e.value.name.toLowerCase()===t)),i=this.initialConnector?.name.toLowerCase()===t;return n&&!i?{duplicateName:{valid:!1}}:null}}initDataSources(){const e={property:"key",direction:S.ASC};this.pageLink=new C(1e3,0,null,e),this.attributeDataSource=new ti(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.inactiveConnectorsDataSource=new ti(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.serverDataSource=new ti(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.dataSource=new x([])}initConnectorForm(){this.connectorForm=this.fb.group({mode:[dn.BASIC],name:["",[xe.required,this.uniqNameRequired(),xe.pattern(fn)]],type:["",[xe.required]],enableRemoteLogging:[!1],logLevel:["",[xe.required]],sendDataOnlyOnChange:[!1],key:["auto"],class:[""],configuration:[""],configurationJson:[{},[xe.required]],basicConfig:[{}],configVersion:[""],reportStrategy:[{value:{},disabled:!0}]})}getSortingDataAccessor(){return(e,t)=>{switch(t){case"syncStatus":return this.isConnectorSynced(e)?1:0;case"enabled":return this.activeConnectors.includes(e.key)?1:0;case"errors":const n=this.getErrorsCount(e);return"string"==typeof n?this.sort.direction.toUpperCase()===S.DESC?-1:1/0:n;default:return e[t]||e.value[t]}}}loadConnectors(){this.device&&this.device.id!==F&&Ae([this.attributeService.getEntityAttributes(this.device,A.SHARED_SCOPE,["active_connectors"]),this.attributeService.getEntityAttributes(this.device,A.SERVER_SCOPE,["inactive_connectors"]),this.attributeService.getEntityAttributes(this.device,A.CLIENT_SCOPE,["Version"])]).pipe(Re(this.destroy$)).subscribe((e=>{this.activeConnectors=this.parseConnectors(e[0]),this.inactiveConnectors=this.parseConnectors(e[1]),this.gatewayVersion=e[2][0]?.value,this.updateData(!0)}))}loadGatewayState(){this.attributeService.getEntityAttributes(this.device,A.SERVER_SCOPE).pipe(Re(this.destroy$)).subscribe((e=>{const t=e.find((e=>"active"===e.key)).value,n=e.find((e=>"lastDisconnectTime"===e.key))?.value,i=e.find((e=>"lastConnectTime"===e.key))?.value;this.isGatewayActive=this.getGatewayStatus(t,i,n)}))}parseConnectors(e){const t=e?.[0]?.value||[];return ae(t)?JSON.parse(t):t}observeModeChange(){this.connectorForm.get("mode").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{e===dn.BASIC&&this.patchConnectorBasicConfig(this.connectorForm.get("configurationJson").value)}))}observeAttributeChange(){this.attributeUpdateSubject.pipe(Ne(300),Ve((e=>this.executeAttributeUpdates(e))),Re(this.destroy$)).subscribe()}updateActiveConnectorKeys(e){if(this.activeConnectors.includes(e)){const t=this.activeConnectors.indexOf(e);-1!==t&&this.activeConnectors.splice(t,1),this.inactiveConnectors.push(e)}else{const t=this.inactiveConnectors.indexOf(e);-1!==t&&this.inactiveConnectors.splice(t,1),this.activeConnectors.push(e)}}executeAttributeUpdates(e){Ae(this.getAttributeExecutionTasks(e)).pipe(Ue(1),Ve((()=>this.updateData(!0))),Re(this.destroy$)).subscribe()}getAttributeExecutionTasks(e){const t=this.activeConnectors.includes(e.key),n=t?A.SERVER_SCOPE:A.SHARED_SCOPE,i=t?A.SHARED_SCOPE:A.SERVER_SCOPE;return[this.attributeService.saveEntityAttributes(this.device,A.SHARED_SCOPE,[{key:"active_connectors",value:this.activeConnectors}]),this.attributeService.saveEntityAttributes(this.device,A.SERVER_SCOPE,[{key:"inactive_connectors",value:this.inactiveConnectors}]),this.attributeService.deleteEntityAttributes(this.device,n,[e]),this.attributeService.saveEntityAttributes(this.device,i,[e])]}onDataUpdateError(e){const t=this.utils.parseException(e);let n=t.name;t.message&&(n+=": "+t.message),console.error(n)}onErrorsUpdated(){this.cd.detectChanges()}onDataUpdated(){const e=this.ctx.defaultSubscription.data,t=e.find((e=>"active"===e.dataKey.name)).data[0][1],n=e.find((e=>"lastDisconnectTime"===e.dataKey.name)).data[0][1],i=e.find((e=>"lastConnectTime"===e.dataKey.name)).data[0][1];this.isGatewayActive=this.getGatewayStatus(t,i,n),this.cd.detectChanges()}getGatewayStatus(e,t,n){return!!e&&(!n||t>n)}generateSubscription(){if(this.subscription&&this.subscription.unsubscribe(),this.device){const e=[{type:N.entity,entityType:L.DEVICE,entityId:this.device.id,entityName:"Gateway",timeseries:[]}];this.dataSource.data.forEach((t=>{e[0].timeseries.push({name:`${t.key}_ERRORS_COUNT`,label:`${t.key}_ERRORS_COUNT`})})),this.ctx.subscriptionApi.createSubscriptionFromInfo(B.latest,e,this.subscriptionOptions,!1,!0).subscribe((e=>{this.subscription=e}))}}createBasicConfigWatcher(){this.basicConfigSub&&this.basicConfigSub.unsubscribe(),this.basicConfigSub=this.connectorForm.get("basicConfig").valueChanges.pipe(Le((()=>!!this.initialConnector)),Re(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("configurationJson"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;if(!Q(e,t?.value)&&this.allowBasicConfig.has(n)&&i===dn.BASIC){const n={...t.value,...e};this.connectorForm.get("configurationJson").patchValue(n,{emitEvent:!1})}}))}createJsonConfigWatcher(){this.jsonConfigSub&&this.jsonConfigSub.unsubscribe(),this.jsonConfigSub=this.connectorForm.get("configurationJson").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("basicConfig"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;!Q(e,t?.value)&&this.allowBasicConfig.has(n)&&i===dn.ADVANCED&&this.connectorForm.get("basicConfig").patchValue(e,{emitEvent:!1})}))}confirmConnectorChange(){return this.initialConnector&&this.connectorForm.dirty?this.dialogService.confirm(this.translate.instant("gateway.change-connector-title"),this.translate.instant("gateway.change-connector-text"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0):Pe(!0)}setFormValue(e){this.connectorForm.disabled&&this.connectorForm.enable();const t=nr.getConfig({configuration:"",key:"auto",configurationJson:{},...e},this.gatewayVersion);this.gatewayVersion&&!t.configVersion&&(t.configVersion=this.gatewayVersion),t.basicConfig=t.configurationJson,this.initialConnector=t,this.updateConnector(t)}updateConnector(e){this.jsonConfigSub?.unsubscribe(),this.allowBasicConfig.has(e.type)?this.updateBasicConfigConnector(e):(this.setInitialConnectorValues(e),this.connectorForm.markAsPristine(),this.createJsonConfigWatcher())}updateBasicConfigConnector(e){this.basicConfigSub?.unsubscribe();const t=this.connectorForm.get("type").value;this.setInitialConnectorValues(e),t!==e.type&&this.allowBasicConfig.has(e.type)&&e.mode!==dn.ADVANCED?this.basicConfigInitSubject.asObservable().pipe(Ue(1)).subscribe((()=>{this.patchConnectorBasicConfig(e.basicConfig)})):this.patchConnectorBasicConfig(e.basicConfig)}patchConnectorBasicConfig(e){this.connectorForm.get("basicConfig").patchValue(e,{emitEvent:!1}),this.connectorForm.markAsPristine(),this.createBasicConfigWatcher(),this.createJsonConfigWatcher()}toggleReportStrategy(e){const t=this.connectorForm.get("reportStrategy"),n=this.connectorForm.get("sendDataOnlyOnChange");this.connectorForm.get("reportStrategy").reset(e.reportStrategy,{emitEvent:!1}),this.withReportStrategy.transform(e.configVersion,e.type)?(t.enable({emitEvent:!1}),n.disable({emitEvent:!1})):(t.disable({emitEvent:!1}),e.type===yt.MQTT&&n.enable({emitEvent:!1}))}setClientData(e){if(this.initialConnector){const t=e.data.find((e=>e.key===this.initialConnector.name));t&&(t.value="string"==typeof t.value?JSON.parse(t.value):t.value,this.isConnectorSynced(t)&&t.value.configurationJson&&this.setFormValue({...t.value,mode:this.connectorForm.get("mode").value??t.value.mode}))}}static{this.ɵfac=function(e){return new(e||j5)(t.ɵɵdirectiveInject(nt.Store),t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(he.TranslateService),t.ɵɵdirectiveInject(ee.AttributeService),t.ɵɵdirectiveInject(ee.DialogService),t.ɵɵdirectiveInject(Xe.MatDialog),t.ɵɵdirectiveInject(ee.TelemetryWebsocketService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(ee.UtilsService),t.ɵɵdirectiveInject(lr),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:j5,selectors:[["tb-gateway-connector"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(v,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.sort=e.first)}},inputs:{ctx:"ctx",device:"device"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:mt,useClass:U5},lr]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:43,vars:22,consts:[["generalTabContent",""],["cellActionsMenu","matMenu"],[1,"connector-container","tb-form-panel","no-border"],[1,"table-section","tb-form-panel","no-padding","section-container","flex"],[1,"mat-mdc-table-toolbar","justify-between"],["mat-icon-button","","matTooltipPosition","above",3,"disabled","matTooltip"],[1,"table-container"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-table","","matSort","","matSortDisableClear","",3,"dataSource","matSortActive","matSortDirection"],["matColumnDef","enabled","sticky",""],["style","width: 60px;min-width: 60px;",4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","key"],["mat-sort-header","","style","width: 40%",4,"matHeaderCellDef"],["matColumnDef","type"],["mat-sort-header","","style","width: 30%",4,"matHeaderCellDef"],["style","text-transform: uppercase",4,"matCellDef"],["matColumnDef","syncStatus"],["matColumnDef","errors"],["matColumnDef","actions","stickyEnd",""],[4,"matHeaderCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","mat-row-select",3,"class","click",4,"matRowDef","matRowDefColumns"],[1,"tb-form-panel","section-container","flex",3,"formGroup"],[1,"tb-form-panel-title","tb-flex","no-flex","space-between","align-center"],[1,"tb-form-panel-title","tb-flex","no-flex","align-center"],[1,"version-placeholder"],[3,"tb-help"],["formControlName","mode","appearance","fill"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"tb-form-panel","section-container","no-border","no-padding","tb-flex","space-between"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],[2,"width","60px","min-width","60px"],[3,"click","checked"],["mat-sort-header","",2,"width","40%"],["mat-sort-header","",2,"width","30%"],[2,"text-transform","uppercase"],[1,"status"],["matTooltipPosition","above",1,"dot",3,"click","matTooltip"],[1,"gt-md:!hidden",2,"width","48px","min-width","48px","max-width","48px"],[1,"lt-lg:!hidden"],[1,"lt-md:!hidden","flex-row","justify-end"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip","disabled"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"gt-sm:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"],[1,"mat-row-select",3,"click"],[3,"value"],[1,"flex","justify-end"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],["formControlName","basicConfig",3,"generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"initialized","generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"generalTabContent"],["formControlName","basicConfig",3,"initialized","generalTabContent"],["formControlName","basicConfig",1,"h-full",3,"generalTabContent","withReportStrategy"],["formControlName","basicConfig",1,"h-full",3,"initialized","generalTabContent","withReportStrategy"],[3,"label"],[3,"ngTemplateOutlet"],["jsonRequired","","formControlName","configurationJson",1,"configuration-json",3,"fillHeight","label"],[1,"tb-form-panel","no-border","no-padding","padding-top","section-container","flex",3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row"],["formControlName","enableRemoteLogging",1,"mat-slide"],["translate","",1,"fixed-title-width"],["formControlName","logLevel"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[3,"tb-hint-tooltip-icon"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",2)(1,"section",3)(2,"mat-toolbar",4)(3,"h2"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(6,X3,5,6,"button",5),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",6),t.ɵɵtemplate(8,Z3,7,3,"section",7),t.ɵɵelementStart(9,"table",8),t.ɵɵelementContainerStart(10,9),t.ɵɵtemplate(11,Q3,3,3,"mat-header-cell",10)(12,J3,2,1,"mat-cell",11),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,12),t.ɵɵtemplate(14,e5,3,3,"mat-header-cell",13)(15,t5,2,1,"mat-cell",11),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(16,14),t.ɵɵtemplate(17,n5,3,3,"mat-header-cell",15)(18,i5,2,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(19,17),t.ɵɵtemplate(20,a5,3,3,"mat-header-cell",15)(21,r5,3,3,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(22,18),t.ɵɵtemplate(23,o5,3,3,"mat-header-cell",15)(24,s5,2,6,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,19),t.ɵɵtemplate(26,l5,5,6,"mat-header-cell",20)(27,p5,32,24,"mat-cell",11),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,c5,1,0,"mat-header-row",21)(29,d5,1,4,"mat-row",22),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"section",23)(31,"div",24)(32,"div",25),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,u5,2,1,"span",26)(36,m5,1,1,"div",27),t.ɵɵelementEnd(),t.ɵɵtemplate(37,h5,7,8,"tb-toggle-select",28),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"span",29),t.ɵɵtext(39," gateway.select-connector "),t.ɵɵelementEnd(),t.ɵɵtemplate(40,B5,7,5,"section",30),t.ɵɵelementEnd()(),t.ɵɵtemplate(41,z5,31,18,"ng-template",null,0,t.ɵɵtemplateRefExtractor)),2&e){let e;t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,18,"gateway.connectors")),t.ɵɵadvance(2),t.ɵɵconditional(null!=n.dataSource&&(null!=n.dataSource.data&&n.dataSource.data.length)?6:-1),t.ɵɵadvance(2),t.ɵɵconditional(null!=n.dataSource&&null!=n.dataSource.data&&n.dataSource.data.length?-1:8),t.ɵɵadvance(),t.ɵɵproperty("dataSource",n.dataSource)("matSortActive",n.pageLink.sortOrder.property)("matSortDirection",n.pageLink.sortDirection()),t.ɵɵadvance(19),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate2(" ",null!=n.initialConnector&&n.initialConnector.type?n.GatewayConnectorTypesTranslatesMap.get(n.initialConnector.type):""," ",t.ɵɵpipeBind1(34,20,"gateway.configuration")," "),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorForm.get("configVersion").value?35:-1),t.ɵɵadvance(),t.ɵɵconditional((e=n.connectorHelpLinksMap.get(null==n.initialConnector?null:n.initialConnector.type))?36:-1,e),t.ɵɵadvance(),t.ɵɵconditional(n.initialConnector&&n.allowBasicConfig.has(n.initialConnector.type)?37:-1),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.initialConnector),t.ɵɵadvance(2),t.ɵɵconditional(n.initialConnector?40:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(j5,[me,T,lr,rK,sZ,lZ,ZX,XX,_J,TJ,R1,B1,pi,A0,O0,H3,j3]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block;overflow-x:auto;padding:0}[_nghost-%COMP%] .version-placeholder[_ngcontent-%COMP%]{color:gray;font-size:12px}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%]{height:100%;width:100%;flex-direction:row}@media screen and (max-width: 1279px){[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%]{flex-direction:column}}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] > section[_ngcontent-%COMP%]:not(.table-section){max-width:unset}@media screen and (min-width: 1280px){[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] > section[_ngcontent-%COMP%]:not(.table-section){max-width:50%}}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .table-section[_ngcontent-%COMP%]{min-height:35vh;overflow:hidden}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .table-section[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .flex[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .input-container[_ngcontent-%COMP%]{height:auto}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .section-container[_ngcontent-%COMP%]{background-color:#fff}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{background:transparent;color:#000000de!important}[_nghost-%COMP%] .mat-mdc-slide-toggle[_ngcontent-%COMP%]{margin:0 8px}[_nghost-%COMP%] .status[_ngcontent-%COMP%]{text-align:center;border-radius:16px;font-weight:500;width:fit-content;padding:5px 15px}[_nghost-%COMP%] .status-sync[_ngcontent-%COMP%]{background:#1980380f;color:#198038}[_nghost-%COMP%] .status-unsync[_ngcontent-%COMP%]{background:#cb25300f;color:#cb2530}[_nghost-%COMP%] mat-row[_ngcontent-%COMP%]{cursor:pointer}[_nghost-%COMP%] .dot[_ngcontent-%COMP%]{height:12px;width:12px;background-color:#bbb;border-radius:50%;display:inline-block}[_nghost-%COMP%] .hasErrors[_ngcontent-%COMP%]{background-color:#cb2530}[_nghost-%COMP%] .noErrors[_ngcontent-%COMP%]{background-color:#198038}[_nghost-%COMP%] .connector-container .mat-mdc-tab-group, [_nghost-%COMP%] .connector-container .mat-mdc-tab-body-wrapper{height:100%}[_nghost-%COMP%] .connector-container .mat-mdc-tab-body.mat-mdc-tab-body-active{position:absolute}[_nghost-%COMP%] .connector-container .tb-form-row .fixed-title-width{min-width:120px;width:30%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .connector-container .tb-add-new{display:flex;z-index:999;pointer-events:none;background-color:#fff}[_nghost-%COMP%] .connector-container .tb-add-new button.connector{height:auto;padding-right:12px;font-size:20px;border-style:dashed;border-width:2px;border-radius:8px;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;color:#00000061}@media screen and (min-width: 960px){[_nghost-%COMP%] .configuration-json .ace_tooltip{transform:translate(-250px,-120px)}}']})}}e("GatewayConnectorComponent",j5);class H5{constructor(e){this.deviceService=e}download(e){e&&e.stopPropagation(),this.deviceId&&this.deviceService.downloadGatewayDockerComposeFile(this.deviceId).subscribe((()=>{}))}static{this.ɵfac=function(e){return new(e||H5)(t.ɵɵdirectiveInject(ee.DeviceService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:H5,selectors:[["tb-gateway-command"]],inputs:{deviceId:"deviceId"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:32,vars:9,consts:[["mat-dialog-content","",1,"tb-form-panel","no-border",2,"padding","16px 16px 8px"],[1,"tb-no-data-text"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","no-border","no-padding","space-between"],["translate","",1,"tb-no-data-text","tb-commands-hint"],["mat-stroked-button","","color","primary","href","https://docs.docker.com/compose/install/","target","_blank"],["mat-stroked-button","","color","primary",3,"click"],["usePlainMarkdown","","containerClass","start-code","data","\n ```bash\n docker compose up\n {:copy-code}\n ```\n "]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",2)(5,"div",3),t.ɵɵtext(6,"device.connectivity.install-necessary-client-tools"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",4)(8,"div",5),t.ɵɵtext(9,"gateway.install-docker-compose"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"a",6)(11,"mat-icon"),t.ɵɵtext(12,"description"),t.ɵɵelementEnd(),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",2)(16,"div",3),t.ɵɵtext(17,"gateway.download-configuration-file"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",4)(19,"div",5),t.ɵɵtext(20,"gateway.download-docker-compose"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",7),t.ɵɵlistener("click",(function(e){return n.download(e)})),t.ɵɵelementStart(22,"mat-icon"),t.ɵɵtext(23,"download"),t.ɵɵelementEnd(),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(26,"div",2)(27,"div",3),t.ɵɵtext(28,"gateway.launch-gateway"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",5),t.ɵɵtext(30,"gateway.launch-docker-compose"),t.ɵɵelementEnd(),t.ɵɵelement(31,"tb-markdown",8),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,3,"gateway.docker-label")),t.ɵɵadvance(11),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,5,"common.documentation")," "),t.ɵɵadvance(11),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,7,"action.download")," "))},dependencies:t.ɵɵgetComponentDepsFactory(H5,[T]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-commands-hint[_ngcontent-%COMP%]{color:inherit;font-weight:400;flex:1}[_nghost-%COMP%] .tb-markdown-view .start-code .code-wrapper{padding:0}[_nghost-%COMP%] .tb-markdown-view .start-code .code-wrapper pre[class*=language-]{margin:0;background:#f3f6fa;border-color:#305680;padding-right:38px;overflow:scroll;padding-bottom:4px;min-height:42px;scrollbar-width:thin}[_nghost-%COMP%] .tb-markdown-view .start-code .code-wrapper pre[class*=language-]::-webkit-scrollbar{width:4px;height:4px}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn{right:-2px}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn p{color:#305680}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn p, [_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn div{background-color:#f3f6fa}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn div img{display:none}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn div:after{content:"";position:initial;display:block;width:18px;height:18px;background:#305680;mask-image:url(/assets/copy-code-icon.svg);-webkit-mask-image:url(/assets/copy-code-icon.svg);mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat}']})}}var W5,$5,K5;e("DeviceGatewayCommandComponent",H5),e("GatewayBasicConfigTab",W5),function(e){e[e.general=0]="general",e[e.logs=1]="logs",e[e.storage=2]="storage",e[e.grpc=3]="grpc",e[e.statistics=4]="statistics",e[e.other=5]="other"}(W5||e("GatewayBasicConfigTab",W5={})),e("StorageTypes",$5),function(e){e.MEMORY="memory",e.FILE="file",e.SQLITE="sqlite"}($5||e("StorageTypes",$5={})),e("LocalLogsConfigs",K5),function(e){e.service="service",e.connector="connector",e.converter="converter",e.tb_connection="tb_connection",e.storage="storage",e.extension="extension"}(K5||e("LocalLogsConfigs",K5={}));const Y5=e("LocalLogsConfigTranslateMap",new Map([[K5.service,"Service"],[K5.connector,"Connector"],[K5.converter,"Converter"],[K5.tb_connection,"TB Connection"],[K5.storage,"Storage"],[K5.extension,"Extension"]])),X5=e("StorageTypesTranslationMap",new Map([[$5.MEMORY,"gateway.storage-types.memory-storage"],[$5.FILE,"gateway.storage-types.file-storage"],[$5.SQLITE,"gateway.storage-types.sqlite"]]));var Z5;e("LogSavingPeriod",Z5),function(e){e.days="D",e.hours="H",e.minutes="M",e.seconds="S"}(Z5||e("LogSavingPeriod",Z5={}));const Q5=e("LogSavingPeriodTranslations",new Map([[Z5.days,"gateway.logs.days"],[Z5.hours,"gateway.logs.hours"],[Z5.minutes,"gateway.logs.minutes"],[Z5.seconds,"gateway.logs.seconds"]]));var J5;e("SecurityTypes",J5),function(e){e.ACCESS_TOKEN="accessToken",e.USERNAME_PASSWORD="usernamePassword",e.TLS_ACCESS_TOKEN="tlsAccessToken",e.TLS_PRIVATE_KEY="tlsPrivateKey"}(J5||e("SecurityTypes",J5={}));const e4=e("SecurityTypesTranslationsMap",new Map([[J5.ACCESS_TOKEN,"gateway.security-types.access-token"],[J5.USERNAME_PASSWORD,"gateway.security-types.username-password"],[J5.TLS_ACCESS_TOKEN,"gateway.security-types.tls-access-token"]])),t4=e("logsHandlerClass","thingsboard_gateway.tb_utility.tb_rotating_file_handler.TimedRotatingFileHandler"),n4=e("logsLegacyHandlerClass","thingsboard_gateway.tb_utility.tb_handler.TimedRotatingFileHandler");function i4(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.storageTypesTranslationMap.get(e))," ")}}function a4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-read-record-count-required")," "))}function r4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-read-record-count-min")," "))}function o4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-read-record-count-pattern")," "))}function s4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-required")," "))}function l4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-min")," "))}function p4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-pattern")," "))}function c4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",7)(1,"mat-form-field",8)(2,"mat-label",9),t.ɵɵtext(3,"gateway.storage-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",10),t.ɵɵtemplate(5,a4,3,3,"mat-error")(6,r4,3,3,"mat-error")(7,o4,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",11),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label",9),t.ɵɵtext(13,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",12),t.ɵɵtemplate(15,s4,3,3,"mat-error")(16,l4,3,3,"mat-error")(17,p4,3,3,"mat-error"),t.ɵɵelementStart(18,"mat-icon",11),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵconditional(e.storageFormGroup.get("read_records_count").hasError("required")?5:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("read_records_count").hasError("min")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("read_records_count").hasError("pattern")?7:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,8,"gateway.hints.read-record-count")),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_records_count").hasError("required")?15:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_count").hasError("min")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_count").hasError("pattern")?17:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,10,"gateway.hints.max-records-count"))}}function d4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-data-folder-path-required")," "))}function u4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-data-folder-path-pattern")," "))}function m4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-files-required")," "))}function h4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-files-min")," "))}function g4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-files-pattern")," "))}function f4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-required")," "))}function y4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-min")," "))}function v4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-pattern")," "))}function x4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-required")," "))}function b4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-min")," "))}function w4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-pattern")," "))}function S4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",13)(2,"mat-form-field",14)(3,"mat-label",9),t.ɵɵtext(4,"gateway.storage-data-folder-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",15),t.ɵɵtemplate(6,d4,3,3,"mat-error")(7,u4,3,3,"mat-error"),t.ɵɵelement(8,"mat-hint"),t.ɵɵelementStart(9,"mat-icon",16),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",8)(13,"mat-label",9),t.ɵɵtext(14,"gateway.storage-max-files"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",17),t.ɵɵtemplate(16,m4,3,3,"mat-error")(17,h4,3,3,"mat-error")(18,g4,3,3,"mat-error"),t.ɵɵelementStart(19,"mat-icon",11),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",7)(23,"mat-form-field",8)(24,"mat-label",9),t.ɵɵtext(25,"gateway.storage-max-read-record-count-storage"),t.ɵɵelementEnd(),t.ɵɵelement(26,"input",18),t.ɵɵtemplate(27,f4,3,3,"mat-error")(28,y4,3,3,"mat-error")(29,v4,3,3,"mat-error"),t.ɵɵelementStart(30,"mat-icon",11),t.ɵɵpipe(31,"translate"),t.ɵɵtext(32,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",8)(34,"mat-label",9),t.ɵɵtext(35,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(36,"input",19),t.ɵɵtemplate(37,x4,3,3,"mat-error")(38,b4,3,3,"mat-error")(39,w4,3,3,"mat-error"),t.ɵɵelementStart(40,"mat-icon",11),t.ɵɵpipe(41,"translate"),t.ɵɵtext(42,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵconditional(e.storageFormGroup.get("data_folder_path").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("data_folder_path").hasError("pattern")?7:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,15,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_file_count").hasError("required")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_file_count").hasError("min")?17:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_file_count").hasError("pattern")?18:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,17,"gateway.hints.max-file-count")),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("required")?27:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("min")?28:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("pattern")?29:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(31,19,"gateway.hints.max-read-count")),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_records_per_file").hasError("required")?37:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_per_file").hasError("min")?38:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_per_file").hasError("pattern")?39:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(41,21,"gateway.hints.max-records"))}}function C4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-path-required")," "))}function _4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-path-pattern")," "))}function T4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-check-in-hours-required")," "))}function E4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-check-in-hours-min")," "))}function I4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-check-in-hours-pattern")," "))}function M4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-in-days-required")," "))}function k4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-in-days-min")," "))}function P4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-in-days-pattern")," "))}function D4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-required")," "))}function A4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-min")," "))}function O4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-pattern")," "))}function R4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.size-limit-required")," "))}function B4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.size-limit-min")," "))}function F4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.size-limit-pattern")," "))}function N4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.max-db-amount-required")," "))}function L4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.max-db-amount-min")," "))}function V4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.max-db-amount-pattern")," "))}function q4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.oversize-check-period-required")," "))}function G4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.oversize-check-period-min")," "))}function z4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.oversize-check-period-pattern")," "))}function U4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.writing-batch-size-required")," "))}function j4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.writing-batch-size-min")," "))}function H4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.writing-batch-size-pattern")," "))}function W4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",13)(2,"mat-form-field",14)(3,"mat-label",9),t.ɵɵtext(4,"gateway.storage-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",20),t.ɵɵtemplate(6,C4,3,3,"mat-error")(7,_4,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",11),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label",9),t.ɵɵtext(13,"gateway.messages-ttl-check-in-hours"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",21),t.ɵɵtemplate(15,T4,3,3,"mat-error")(16,E4,3,3,"mat-error")(17,I4,3,3,"mat-error"),t.ɵɵelementStart(18,"mat-icon",11),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",7)(22,"mat-form-field",8)(23,"mat-label",9),t.ɵɵtext(24,"gateway.messages-ttl-in-days"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",22),t.ɵɵtemplate(26,M4,3,3,"mat-error")(27,k4,3,3,"mat-error")(28,P4,3,3,"mat-error"),t.ɵɵelementStart(29,"mat-icon",23),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(32,"mat-form-field",8)(33,"mat-label",9),t.ɵɵtext(34,"gateway.storage-max-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(35,"input",18),t.ɵɵtemplate(36,D4,3,3,"mat-error")(37,A4,3,3,"mat-error")(38,O4,3,3,"mat-error"),t.ɵɵelementStart(39,"mat-icon",23),t.ɵɵpipe(40,"translate"),t.ɵɵtext(41,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(42,"div",7)(43,"mat-form-field",8)(44,"mat-label",9),t.ɵɵtext(45,"gateway.size-limit"),t.ɵɵelementEnd(),t.ɵɵelement(46,"input",24),t.ɵɵtemplate(47,R4,3,3,"mat-error")(48,B4,3,3,"mat-error")(49,F4,3,3,"mat-error"),t.ɵɵelementStart(50,"mat-icon",23),t.ɵɵpipe(51,"translate"),t.ɵɵtext(52,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(53,"mat-form-field",8)(54,"mat-label",9),t.ɵɵtext(55,"gateway.max-db-amount"),t.ɵɵelementEnd(),t.ɵɵelement(56,"input",25),t.ɵɵtemplate(57,N4,3,3,"mat-error")(58,L4,3,3,"mat-error")(59,V4,3,3,"mat-error"),t.ɵɵelementStart(60,"mat-icon",23),t.ɵɵpipe(61,"translate"),t.ɵɵtext(62,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(63,"div",7)(64,"mat-form-field",8)(65,"mat-label",9),t.ɵɵtext(66,"gateway.oversize-check-period"),t.ɵɵelementEnd(),t.ɵɵelement(67,"input",26),t.ɵɵtemplate(68,q4,3,3,"mat-error")(69,G4,3,3,"mat-error")(70,z4,3,3,"mat-error"),t.ɵɵelementStart(71,"mat-icon",23),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(74,"mat-form-field",8)(75,"mat-label",9),t.ɵɵtext(76,"gateway.writing-batch-size"),t.ɵɵelementEnd(),t.ɵɵelement(77,"input",27),t.ɵɵtemplate(78,U4,3,3,"mat-error")(79,j4,3,3,"mat-error")(80,H4,3,3,"mat-error"),t.ɵɵelementStart(81,"mat-icon",23),t.ɵɵpipe(82,"translate"),t.ɵɵtext(83,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵconditional(e.storageFormGroup.get("data_file_path").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("data_file_path").hasError("pattern")?7:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,31,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("required")?15:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("min")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("pattern")?17:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,33,"gateway.hints.ttl-check-hour")),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_in_days").hasError("required")?26:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_in_days").hasError("min")?27:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_in_days").hasError("pattern")?28:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(30,35,"gateway.hints.ttl-messages-day")),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("required")?36:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("min")?37:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("pattern")?38:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(40,37,"gateway.hints.max-read-count")),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("size_limit").hasError("required")?47:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("size_limit").hasError("min")?48:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("size_limit").hasError("pattern")?49:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(51,39,"gateway.size-limit-hint")),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_db_amount").hasError("required")?57:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_db_amount").hasError("min")?58:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_db_amount").hasError("pattern")?59:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(61,41,"gateway.max-db-amount-hint")),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("oversize_check_period").hasError("required")?68:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("oversize_check_period").hasError("min")?69:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("oversize_check_period").hasError("pattern")?70:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(72,43,"gateway.oversize-check-period-hint")),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("writing_batch_size").hasError("required")?78:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("writing_batch_size").hasError("min")?79:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("writing_batch_size").hasError("pattern")?80:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(82,45,"gateway.writing-batch-size-hint"))}}class $4{constructor(e,t){this.fb=e,this.destroyRef=t,this.initialized=new u,this.StorageTypes=$5,this.storageTypes=Object.values($5),this.storageTypesTranslationMap=X5,this.onChange=()=>{},this.numberValidators=[xe.min(1),xe.pattern(gn)],this.requiredNumberValidators=[xe.required,...this.numberValidators],this.requiredDirValidators=[xe.required,xe.pattern(xn)],this.storageConfig={[$5.MEMORY]:{read_records_count:this.requiredNumberValidators,max_records_count:this.requiredNumberValidators},[$5.FILE]:{data_folder_path:this.requiredDirValidators,max_file_count:this.requiredNumberValidators,max_read_records_count:this.requiredNumberValidators,max_records_per_file:this.requiredNumberValidators},[$5.SQLITE]:{data_file_path:this.requiredDirValidators,messages_ttl_check_in_hours:this.requiredNumberValidators,messages_ttl_in_days:this.requiredNumberValidators,max_read_records_count:this.requiredNumberValidators,size_limit:this.numberValidators,max_db_amount:this.numberValidators,oversize_check_period:this.numberValidators,writing_batch_size:this.numberValidators}},this.storageFormGroup=this.initStorageFormGroup(),this.observeStorageTypeChanges(),this.storageFormGroup.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.onChange(e)}))}ngAfterViewInit(){this.updateValidators(this.storageFormGroup.get("type").value),this.initialized.emit({storage:this.storageFormGroup.value})}writeValue(e){re(e)&&(this.storageFormGroup.patchValue(e,{emitEvent:!1}),this.updateValidators(e.type))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.storageFormGroup.valid?null:{storageFormGroup:{valid:!1}}}initStorageFormGroup(){return this.fb.group({type:[$5.MEMORY,[xe.required]],read_records_count:[100],max_records_count:[1e5],data_folder_path:["./data/"],max_file_count:[10],max_read_records_count:[10],max_records_per_file:[1e4],data_file_path:["./data/"],messages_ttl_check_in_hours:[1],messages_ttl_in_days:[7],size_limit:[1024],max_db_amount:[10],oversize_check_period:[1],writing_batch_size:[1e3]})}observeStorageTypeChanges(){this.storageFormGroup.get("type").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.updateValidators(e)}))}updateValidators(e){const t=this.storageConfig[e];Object.keys(this.storageFormGroup.controls).forEach((e=>{if("type"===e)return;const n=this.storageFormGroup.get(e),i=t[e];i?(n.enable({emitEvent:!1}),n.setValidators(i),n.updateValueAndValidity({emitEvent:!1}),n.markAsTouched({emitEvent:!1})):(n.disable({emitEvent:!1}),n.clearValidators(),n.updateValueAndValidity({emitEvent:!1}),n.markAsUntouched({emitEvent:!1}))}))}static{this.ɵfac=function(e){return new(e||$4)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$4,selectors:[["tb-gateway-storage-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>$4)),multi:!0},{provide:be,useExisting:c((()=>$4)),multi:!0}]),t.ɵɵStandaloneFeature],decls:15,vars:5,consts:[[1,"mat-content","mat-padding","flex","w-full","flex-col","gap-2",3,"formGroup"],[1,"tb-form-panel","no-padding-bottom","w-full"],["translate","",1,"tb-form-panel-title"],["translate","",1,"tb-form-panel-hint"],["formControlName","type",1,"flex"],[3,"value"],[1,"tb-form-panel-hint"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["translate",""],["type","number","matInput","","formControlName","read_records_count"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","number","matInput","","formControlName","max_records_count"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs","align-start","mb-2"],["appearance","outline","subscriptSizing","dynamic",1,"flex"],["matInput","","formControlName","data_folder_path"],["aria-hidden","false","aria-label","help-icon","matSuffix","",1,"mat-form-field-infix","pointer-event","suffix-icon",2,"cursor","pointer",3,"matTooltip"],["matInput","","type","number","formControlName","max_file_count"],["matInput","","type","number","formControlName","max_read_records_count"],["matInput","","type","number","formControlName","max_records_per_file"],["matInput","","formControlName","data_file_path"],["matInput","","type","number","formControlName","messages_ttl_check_in_hours"],["matInput","","type","number","formControlName","messages_ttl_in_days"],["matIconSuffix","",1,"cursor-pointer",3,"matTooltip"],["matInput","","type","number","formControlName","size_limit"],["matInput","","type","number","formControlName","max_db_amount"],["matInput","","type","number","formControlName","oversize_check_period"],["matInput","","type","number","formControlName","writing_batch_size"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.storage"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3),t.ɵɵtext(5,"gateway.hints.storage"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"tb-toggle-select",4),t.ɵɵrepeaterCreate(7,i4,3,4,"tb-toggle-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"div",6),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(12,c4,21,12,"section",7)(13,S4,43,23,"section")(14,W4,84,47,"section"),t.ɵɵelementEnd()()),2&e){let e;t.ɵɵproperty("formGroup",n.storageFormGroup),t.ɵɵadvance(7),t.ɵɵrepeater(n.storageTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,3,"gateway.hints."+n.storageFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵconditional((e=n.storageFormGroup.get("type").value)===n.StorageTypes.MEMORY?12:e===n.StorageTypes.FILE?13:e===n.StorageTypes.SQLITE?14:-1)}},dependencies:t.ɵɵgetComponentDepsFactory($4,[T]),encapsulation:2})}}function K4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-required")," "))}function Y4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-min")," "))}function X4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-max")," "))}function Z4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-pattern")," "))}function Q4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-timeout-required")," "))}function J4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-timeout-min")," "))}function e6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-timeout-pattern")," "))}function t6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-required")," "))}function n6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-min")," "))}function i6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-pattern")," "))}function a6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-time-between-pings-required")," "))}function r6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-time-between-pings-min")," "))}function o6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-time-between-pings-pattern")," "))}function s6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-max-pings-without-data-required")," "))}function l6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-max-pings-without-data-min")," "))}function p6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-max-pings-without-data-pattern")," "))}function c6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-ping-interval-without-data-required")," "))}function d6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-ping-interval-without-data-min")," "))}function u6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-ping-interval-without-data-pattern")," "))}class m6{constructor(e,t){this.fb=e,this.destroyRef=t,this.initialized=new u,this.onChange=()=>{},this.grpcFormGroup=this.initGrpcFormGroup(),this.grpcFormGroup.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.onChange(e)})),this.grpcFormGroup.get("enabled").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.toggleRpcFields(e)}))}ngAfterViewInit(){this.initialized.emit({grpc:this.grpcFormGroup.value})}writeValue(e){e&&this.toggleRpcFields(e.enabled),this.grpcFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.grpcFormGroup.valid?null:{grpcFormGroup:{valid:!1}}}toggleRpcFields(e){const t=this.grpcFormGroup;e?(t.get("serverPort").enable({emitEvent:!1}),t.get("keepAliveTimeMs").enable({emitEvent:!1}),t.get("keepAliveTimeoutMs").enable({emitEvent:!1}),t.get("keepalivePermitWithoutCalls").enable({emitEvent:!1}),t.get("maxPingsWithoutData").enable({emitEvent:!1}),t.get("minTimeBetweenPingsMs").enable({emitEvent:!1}),t.get("minPingIntervalWithoutDataMs").enable({emitEvent:!1})):(t.get("serverPort").disable({emitEvent:!1}),t.get("keepAliveTimeMs").disable({emitEvent:!1}),t.get("keepAliveTimeoutMs").disable({emitEvent:!1}),t.get("keepalivePermitWithoutCalls").disable({emitEvent:!1}),t.get("maxPingsWithoutData").disable({emitEvent:!1}),t.get("minTimeBetweenPingsMs").disable({emitEvent:!1}),t.get("minPingIntervalWithoutDataMs").disable({emitEvent:!1}))}initGrpcFormGroup(){return this.fb.group({enabled:[!1],serverPort:[9595,[xe.required,xe.min(1),xe.max(65535),xe.pattern(gn)]],keepAliveTimeMs:[1e4,[xe.required,xe.min(1),xe.pattern(gn)]],keepAliveTimeoutMs:[5e3,[xe.required,xe.min(1),xe.pattern(gn)]],keepalivePermitWithoutCalls:[!0],maxPingsWithoutData:[0,[xe.required,xe.min(0),xe.pattern(gn)]],minTimeBetweenPingsMs:[1e4,[xe.required,xe.min(1),xe.pattern(gn)]],minPingIntervalWithoutDataMs:[5e3,[xe.required,xe.min(1),xe.pattern(gn)]]})}static{this.ɵfac=function(e){return new(e||m6)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:m6,selectors:[["tb-gateway-grpc-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>m6)),multi:!0},{provide:be,useExisting:c((()=>m6)),multi:!0}]),t.ɵɵStandaloneFeature],decls:75,vars:47,consts:[[1,"mat-content","mat-padding","flex","flex-col","gap-2",3,"formGroup"],[1,"tb-form-panel","no-padding-bottom","w-full"],["color","primary","formControlName","enabled",1,"mat-slide"],[1,"tb-form-row","no-border","no-padding",3,"tb-hint-tooltip-icon"],["color","primary","formControlName","keepalivePermitWithoutCalls",1,"mat-slide"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["translate",""],["matInput","","formControlName","serverPort","type","number","min","0"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","keepAliveTimeoutMs","type","number","min","0"],["matInput","","formControlName","keepAliveTimeMs","type","number","min","0"],["matInput","","formControlName","minTimeBetweenPingsMs","type","number","min","0"],["matInput","","formControlName","maxPingsWithoutData","type","number","min","0"],["matInput","","formControlName","minPingIntervalWithoutDataMs","type","number","min","0"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"mat-slide-toggle",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",3),t.ɵɵpipe(6,"translate"),t.ɵɵelementStart(7,"mat-slide-toggle",4),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"section")(11,"section",5)(12,"mat-form-field",6)(13,"mat-label",7),t.ɵɵtext(14,"gateway.server-port"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",8),t.ɵɵelementStart(16,"mat-icon",9),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(19,K4,3,3,"mat-error")(20,Y4,3,3,"mat-error")(21,X4,3,3,"mat-error")(22,Z4,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",6)(24,"mat-label",7),t.ɵɵtext(25,"gateway.grpc-keep-alive-timeout"),t.ɵɵelementEnd(),t.ɵɵelement(26,"input",10),t.ɵɵelementStart(27,"mat-icon",9),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(30,Q4,3,3,"mat-error")(31,J4,3,3,"mat-error")(32,e6,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"section",5)(34,"mat-form-field",6)(35,"mat-label",7),t.ɵɵtext(36,"gateway.grpc-keep-alive"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",11),t.ɵɵelementStart(38,"mat-icon",9),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(41,t6,3,3,"mat-error")(42,n6,3,3,"mat-error")(43,i6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",6)(45,"mat-label",7),t.ɵɵtext(46,"gateway.grpc-min-time-between-pings"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",12),t.ɵɵelementStart(48,"mat-icon",9),t.ɵɵpipe(49,"translate"),t.ɵɵtext(50,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(51,a6,3,3,"mat-error")(52,r6,3,3,"mat-error")(53,o6,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(54,"section",5)(55,"mat-form-field",6)(56,"mat-label",7),t.ɵɵtext(57,"gateway.grpc-max-pings-without-data"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",13),t.ɵɵelementStart(59,"mat-icon",9),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(62,s6,3,3,"mat-error")(63,l6,3,3,"mat-error")(64,p6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(65,"mat-form-field",6)(66,"mat-label",7),t.ɵɵtext(67,"gateway.grpc-min-ping-interval-without-data"),t.ɵɵelementEnd(),t.ɵɵelement(68,"input",14),t.ɵɵelementStart(69,"mat-icon",9),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(72,c6,3,3,"mat-error")(73,d6,3,3,"mat-error")(74,u6,3,3,"mat-error"),t.ɵɵelementEnd()()()()()),2&e&&(t.ɵɵproperty("formGroup",n.grpcFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,29,"gateway.grpc")," "),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,31,"gateway.hints.permit-without-calls")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,33,"gateway.permit-without-calls")," "),t.ɵɵadvance(8),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(17,35,"gateway.hints.server-port")),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("required")?19:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("min")?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("max")?21:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("pattern")?22:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,37,"gateway.hints.grpc-keep-alive-timeout")),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("required")?30:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("min")?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("pattern")?32:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,39,"gateway.hints.grpc-keep-alive")),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeMs").hasError("required")?41:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeMs").hasError("min")?42:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeMs").hasError("pattern")?43:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,41,"gateway.hints.grpc-min-time-between-pings")),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("required")?51:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("min")?52:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("pattern")?53:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(60,43,"gateway.hints.grpc-max-pings-without-data")),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("maxPingsWithoutData").hasError("required")?62:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("maxPingsWithoutData").hasError("min")?63:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("maxPingsWithoutData").hasError("pattern")?64:-1),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,45,"gateway.hints.grpc-min-ping-interval-without-data")),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("required")?72:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("min")?73:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("pattern")?74:-1))},dependencies:t.ɵɵgetComponentDepsFactory(m6,[T]),encapsulation:2})}}function h6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.date-format-required")," "))}function g6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.log-format-required")," "))}function f6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function y6(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",18),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.localLogsConfigTranslateMap.get(e))}}function v6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function x6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.file-path-required")," "))}function b6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.saving-period-required")," "))}function w6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.saving-period-min")," "))}function S6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",14),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e.value)," ")}}function C6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.backup-count-required")," "))}function _6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.backup-count-min")," "))}class T6{constructor(e,t){this.fb=e,this.destroyRef=t,this.initialized=new u,this.logSavingPeriods=Q5,this.localLogsConfigs=Object.keys(K5),this.localLogsConfigTranslateMap=Y5,this.gatewayLogLevel=Object.values(gt),this.remoteLogLevel=Object.values(gt).filter((e=>e!==gt.NONE)),this.onChange=()=>{},this.logsFormGroup=this.initLogsFormGroup(),this.showRemoteLogsControl=this.fb.control(!1),this.logsFormGroup.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{this.onChange(e)})),this.logSelector=this.fb.control(K5.service);for(const e of Object.keys(K5))this.addLocalLogConfig(e,{});this.showRemoteLogsControl.valueChanges.pipe(On(this.destroyRef)).subscribe((e=>this.logsFormGroup.get("logLevel")[e?"enable":"disable"]()))}ngAfterViewInit(){this.initialized.emit({logs:this.logsFormGroup.value})}writeValue(e){this.logsFormGroup.patchValue(e,{emitEvent:!1}),this.updateRemoteLogs(e?.logLevel??gt.NONE)}registerOnChange(e){this.onChange=e}registerOnTouched(e){}getLogFormGroup(e){return this.logsFormGroup.get(`local.${e}`)}validate(){return this.logsFormGroup.valid?null:{logsFormGroup:{valid:!1}}}initLogsFormGroup(){return this.fb.group({dateFormat:["%Y-%m-%d %H:%M:%S",[xe.required,xe.pattern(/^[^\s].*[^\s]$/)]],logFormat:["%(asctime)s.%(msecs)03d - |%(levelname)s| - [%(filename)s] - %(module)s - %(funcName)s - %(lineno)d - %(message)s",[xe.required,xe.pattern(/^[^\s].*[^\s]$/)]],type:["remote",[xe.required]],logLevel:[{value:gt.INFO,disabled:!0}],local:this.fb.group({})})}addLocalLogConfig(e,t){const n=this.logsFormGroup.get("local"),i=this.fb.group({logLevel:[t.logLevel||gt.INFO,[xe.required]],filePath:[t.filePath||"./logs",[xe.required]],backupCount:[t.backupCount||7,[xe.required,xe.min(0)]],savingTime:[t.savingTime||3,[xe.required,xe.min(0)]],savingPeriod:[t.savingPeriod||Z5.days,[xe.required]]});n.addControl(e,i,{emitEvent:!1})}updateRemoteLogs(e){const t=e&&e!==gt.NONE;this.showRemoteLogsControl.patchValue(t,{emitEvent:!1}),this.logsFormGroup.get("logLevel")[t?"enable":"disable"]({emitEvent:!1}),this.logsFormGroup.get("logLevel").patchValue(e===gt.NONE?gt.INFO:e,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||T6)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:T6,selectors:[["tb-gateway-logs-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>T6)),multi:!0},{provide:be,useExisting:c((()=>T6)),multi:!0}]),t.ɵɵStandaloneFeature],decls:76,vars:29,consts:[[1,"mat-content","mat-padding","flex","flex-col","gap-2",3,"formGroup"],[1,"tb-form-panel","no-padding-bottom"],[1,"flex","flex-col"],["appearance","outline"],["translate",""],["matInput","","formControlName","dateFormat"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","logFormat","rows","2"],[1,"tb-form-panel"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],[3,"tb-hint-tooltip-icon"],["formControlName","logLevel"],[3,"value"],["formGroupName","local",1,"tb-form-panel","no-padding-bottom"],["translate","",1,"tb-form-panel-title"],[1,"toggle-group",3,"formControl"],[1,"first-capital",3,"value"],[3,"formGroup"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["matInput","","formControlName","filePath"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","saving-period"],["matInput","","formControlName","savingTime","type","number","min","0"],["appearance","outline","hideRequiredMarker","",2,"min-width","110px","width","30%"],["formControlName","savingPeriod"],["matInput","","formControlName","backupCount","type","number","min","0"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-form-field",3)(4,"mat-label",4),t.ɵɵtext(5,"gateway.logs.date-format"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",5),t.ɵɵtemplate(7,h6,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",6),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",3)(12,"mat-label",4),t.ɵɵtext(13,"gateway.logs.log-format"),t.ɵɵelementEnd(),t.ɵɵelement(14,"textarea",7),t.ɵɵtemplate(15,g6,3,3,"mat-error"),t.ɵɵelementStart(16,"mat-icon",6),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",8)(20,"mat-expansion-panel",9)(21,"mat-expansion-panel-header",10)(22,"mat-panel-title")(23,"mat-slide-toggle",11),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵelementStart(24,"mat-label")(25,"div",12),t.ɵɵpipe(26,"translate"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(29,"mat-form-field",3)(30,"mat-label",4),t.ɵɵtext(31,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-select",13),t.ɵɵrepeaterCreate(33,f6,2,2,"mat-option",14,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(35,"div",15)(36,"div",16),t.ɵɵtext(37,"gateway.logs.local"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"tb-toggle-select",17),t.ɵɵrepeaterCreate(39,y6,2,2,"tb-toggle-option",18,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(41,19),t.ɵɵelementStart(42,"div",20)(43,"mat-form-field",21)(44,"mat-label",4),t.ɵɵtext(45,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(46,"mat-select",13),t.ɵɵrepeaterCreate(47,v6,2,2,"mat-option",14,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(49,"mat-form-field",21)(50,"mat-label",4),t.ɵɵtext(51,"gateway.logs.file-path"),t.ɵɵelementEnd(),t.ɵɵelement(52,"input",22),t.ɵɵtemplate(53,x6,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(54,"div",20)(55,"div",23)(56,"mat-form-field",21)(57,"mat-label",4),t.ɵɵtext(58,"gateway.logs.saving-period"),t.ɵɵelementEnd(),t.ɵɵelement(59,"input",24),t.ɵɵtemplate(60,b6,3,3,"mat-error")(61,w6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(62,"mat-form-field",25)(63,"mat-select",26),t.ɵɵrepeaterCreate(64,S6,3,4,"mat-option",14,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(66,"keyvalue"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(67,"mat-form-field",21)(68,"mat-label",4),t.ɵɵtext(69,"gateway.logs.backup-count"),t.ɵɵelementEnd(),t.ɵɵelement(70,"input",27),t.ɵɵtemplate(71,C6,3,3,"mat-error")(72,_6,3,3,"mat-error"),t.ɵɵelementStart(73,"mat-icon",6),t.ɵɵpipe(74,"translate"),t.ɵɵtext(75,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.logsFormGroup),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("dateFormat").hasError("required")?7:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,17,"gateway.hints.date-form")),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("logFormat").hasError("required")?15:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(17,19,"gateway.hints.log-format")),t.ɵɵadvance(4),t.ɵɵproperty("expanded",n.showRemoteLogsControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.showRemoteLogsControl),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,21,"gateway.hints.remote-log")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,23,"gateway.logs.remote")),t.ɵɵadvance(6),t.ɵɵrepeater(n.remoteLogLevel),t.ɵɵadvance(5),t.ɵɵproperty("formControl",n.logSelector),t.ɵɵadvance(),t.ɵɵrepeater(n.localLogsConfigs),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.getLogFormGroup(n.logSelector.value)),t.ɵɵadvance(6),t.ɵɵrepeater(n.gatewayLogLevel),t.ɵɵadvance(6),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".filePath").hasError("required")?53:-1),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("required")?60:-1),t.ɵɵadvance(),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("min")?61:-1),t.ɵɵadvance(3),t.ɵɵrepeater(t.ɵɵpipeBind1(66,25,n.logSavingPeriods)),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("required")?71:-1),t.ɵɵadvance(),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("min")?72:-1),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(74,27,"gateway.hints.backup-count")))},dependencies:t.ɵɵgetComponentDepsFactory(T6,[me,T]),encapsulation:2})}}function E6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"security.clientId-required")," "))}function I6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",5),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("tooltipText",t.ɵɵpipeBind1(1,2,"gateway.copy-client-id")),t.ɵɵproperty("copyText",e.usernameFormGroup.get("clientId").value)}}function M6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("clientId"))})),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,1,"device.generate-client-id"))}function k6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"security.username-required")," "))}function P6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",5),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("tooltipText",t.ɵɵpipeBind1(1,2,"gateway.copy-username")),t.ɵɵproperty("copyText",e.usernameFormGroup.get("username").value)}}function D6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("username"))})),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,1,"device.generate-user-name"))}function A6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",5),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext();t.ɵɵpropertyInterpolate("tooltipText",t.ɵɵpipeBind1(1,2,"gateway.copy-password")),t.ɵɵproperty("copyText",e.usernameFormGroup.get("password").value)}}function O6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("password"))})),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,1,"device.generate-password"))}function R6(e,n){1&e&&(t.ɵɵelement(0,"tb-error",11),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"device.client-id-or-user-name-necessary"))}function B6(e,n){1&e&&(t.ɵɵelement(0,"tb-error",11),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"gateway.hints.username-required-with-password"))}class F6{constructor(e,t){this.fb=e,this.destroyRef=t,this.onChange=()=>{},this.initForm(),this.usernameFormGroup.valueChanges.pipe(On(this.destroyRef),Fe(((e,t)=>Q(e,t)))).subscribe((e=>this.onChange(e)))}writeValue(e){Q(e,this.usernameFormGroup.value)||this.usernameFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){e?this.usernameFormGroup.disable({emitEvent:!1}):(this.usernameFormGroup.enable(),this.usernameFormGroup.updateValueAndValidity({emitEvent:!1}))}validate(){return this.usernameFormGroup.disabled||this.usernameFormGroup.valid?null:{usernameFormGroup:{valid:!1}}}initForm(){this.usernameFormGroup=this.createSecurityFormGroup()}createSecurityFormGroup(){return this.fb.group({clientId:[null,[xe.pattern(/^[^.\s]+$/)]],username:[null,[xe.pattern(/^[^.\s]+$/)]],password:[null,[xe.pattern(/^[^.\s]+$/)]]},{validators:[this.atLeastOneRequired,this.usernameRequired]})}atLeastOneRequired(e){const t=e.get("clientId").value,n=e.get("username").value;return t||n?null:{atLeastOneRequired:!0}}usernameRequired(e){const t=e.get("username").value,n=e.get("password").value;return!t&&n?{usernameRequired:!0}:null}generate(e){this.usernameFormGroup.get(e).patchValue(pe(20))}static{this.ɵfac=function(e){return new(e||F6)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:F6,selectors:[["tb-gateway-username-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>F6)),multi:!0},{provide:be,useExisting:c((()=>F6)),multi:!0}]),t.ɵɵStandaloneFeature],decls:33,vars:17,consts:[[3,"formGroup"],[1,"xs:flex-col","no-border","no-padding","tb-standard-fields","flex","gap-2"],["appearance","outline",1,"flex","flex-1"],["translate",""],["matInput","","formControlName","clientId"],["matSuffix","","miniButton","false","tooltipPosition","above","icon","content_copy",3,"copyText","tooltipText"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","username"],["appearance","outline","subscriptSizing","dynamic",2,"width","100%"],["matInput","","formControlName","password"],[1,"block",3,"error"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"section",0)(1,"div",1)(2,"mat-form-field",2)(3,"mat-label",3),t.ɵɵtext(4,"security.clientId"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",4),t.ɵɵtemplate(6,E6,3,3,"mat-error")(7,I6,2,4,"tb-copy-button",5)(8,M6,4,3,"button",6),t.ɵɵelementStart(9,"mat-icon",7),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",2)(13,"mat-label",3),t.ɵɵtext(14,"security.username"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",8),t.ɵɵtemplate(16,k6,3,3,"mat-error")(17,P6,2,4,"tb-copy-button",5)(18,D6,4,3,"button",6),t.ɵɵelementStart(19,"mat-icon",7),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"mat-form-field",9)(23,"mat-label",3),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",10),t.ɵɵtemplate(26,A6,2,4,"tb-copy-button",5)(27,O6,4,3,"button",6),t.ɵɵelementStart(28,"mat-icon",7),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵtemplate(31,R6,2,3,"tb-error",11)(32,B6,2,3,"tb-error",11)),2&e&&(t.ɵɵproperty("formGroup",n.usernameFormGroup),t.ɵɵadvance(6),t.ɵɵconditional(n.usernameFormGroup.get("clientId").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(n.usernameFormGroup.get("clientId").value?7:8),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,11,"gateway.hints.client-id")),t.ɵɵadvance(7),t.ɵɵconditional(n.usernameFormGroup.get("username").hasError("required")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(n.usernameFormGroup.get("username").value?17:18),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,13,"gateway.hints.username")),t.ɵɵadvance(7),t.ɵɵconditional(n.usernameFormGroup.get("password").value?26:27),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,15,"gateway.hints.password")),t.ɵɵadvance(3),t.ɵɵconditional(n.usernameFormGroup.hasError("atLeastOneRequired")&&n.usernameFormGroup.touched?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.usernameFormGroup.hasError("usernameRequired")&&n.usernameFormGroup.touched?32:-1))},dependencies:t.ɵɵgetComponentDepsFactory(F6,[T]),encapsulation:2})}}class N6{constructor(e,t){this.deviceService=e,this.destroyRef=t,this.initialCredentialsSubject=new ke(null)}get initialCredentials(){return this.initialCredentialsSubject.value}get initialCredentials$(){return this.initialCredentialsSubject.asObservable()}updateCredentials(e){let t={};switch(e.type){case J5.USERNAME_PASSWORD:this.shouldUpdateCredentials(e)&&(t=this.generateMqttCredentials(e));break;case J5.ACCESS_TOKEN:case J5.TLS_ACCESS_TOKEN:this.shouldUpdateAccessToken(e)&&(t={credentialsType:Y.ACCESS_TOKEN,credentialsId:e.accessToken,credentialsValue:null})}return this.initialCredentialsSubject.next({...this.initialCredentials,...t}),Object.keys(t).length?this.deviceService.saveDeviceCredentials(this.initialCredentials):Pe(null)}setInitialCredentials(e){this.deviceService.getDeviceCredentials(e.id).pipe(On(this.destroyRef)).subscribe((e=>{this.initialCredentialsSubject.next({...e,version:null})}))}shouldUpdateSecurityConfig(e){switch(e.type){case J5.USERNAME_PASSWORD:return this.shouldUpdateCredentials(e);case J5.ACCESS_TOKEN:case J5.TLS_ACCESS_TOKEN:return this.shouldUpdateAccessToken(e)}}credentialsToSecurityConfig(e){const t=e.credentialsType===Y.MQTT_BASIC?J5.USERNAME_PASSWORD:J5.ACCESS_TOKEN;if(e.credentialsType!==Y.MQTT_BASIC)return{type:t,accessToken:e.credentialsId};if(e.credentialsValue){const{clientId:n,userName:i,password:a}=JSON.parse(e.credentialsValue);return{type:t,clientId:n,username:i,password:a}}}shouldUpdateCredentials(e){if(this.initialCredentials.credentialsType!==Y.MQTT_BASIC)return!0;const t=JSON.parse(this.initialCredentials.credentialsValue);return!(t.clientId===e.clientId&&t.userName===e.username&&t.password===e.password)}shouldUpdateAccessToken(e){return this.initialCredentials.credentialsType!==Y.ACCESS_TOKEN||this.initialCredentials.credentialsId!==e.accessToken}generateMqttCredentials(e){const{clientId:t,username:n,password:i}=e,a={...t&&{clientId:t},...n&&{userName:n},...i&&{password:i}};return{credentialsType:Y.MQTT_BASIC,credentialsValue:JSON.stringify(a)}}static{this.ɵfac=function(e){return new(e||N6)(t.ɵɵinject(ee.DeviceService),t.ɵɵinject(t.DestroyRef))}}static{this.ɵprov=t.ɵɵdefineInjectable({token:N6,factory:N6.ɵfac})}}function L6(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e.value)," ")}}function V6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"security.access-token-required")," "))}function q6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",10),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext(2);t.ɵɵpropertyInterpolate("tooltipText",t.ɵɵpipeBind1(1,2,"device.copy-access-token")),t.ɵɵproperty("copyText",e.securityFormGroup.get("accessToken").value)}}function G6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.generateAccessToken())})),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(1,1,"device.generate-access-token"))}function z6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label",8),t.ɵɵtext(2,"security.access-token"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",9),t.ɵɵtemplate(4,V6,3,3,"mat-error")(5,q6,2,4,"tb-copy-button",10)(6,G6,4,3,"button",11),t.ɵɵelementStart(7,"mat-icon",12),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵconditional(e.securityFormGroup.get("accessToken").hasError("required")?4:-1),t.ɵɵadvance(),t.ɵɵconditional(e.securityFormGroup.get("accessToken").value?5:6),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,3,"gateway.hints.token"))}}function U6(e,n){1&e&&(t.ɵɵelement(0,"tb-file-input",7),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"translate"),t.ɵɵpipe(3,"translate")),2&e&&(t.ɵɵpropertyInterpolate("hint",t.ɵɵpipeBind1(1,5,"gateway.hints.ca-cert")),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(2,7,"security.ca-cert")),t.ɵɵpropertyInterpolate("dropLabel",t.ɵɵpipeBind1(3,9,"gateway.drop-file")),t.ɵɵproperty("allowedExtensions","pem,cert,key")("accept",".pem, application/pem,.cert, application/cert, .key,application/key"))}class j6{constructor(e,t,n,i){this.fb=e,this.cd=t,this.gatewayCredentialsService=n,this.destroyRef=i,this.initialized=new u,this.securityTypes=e4,this.onChange=()=>{},this.securityFormGroup=this.createSecurityFormGroup(),this.setupFormListeners()}ngAfterViewInit(){const{usernamePassword:e,...t}=this.securityFormGroup.value;this.initialized.emit({thingsboard:{security:e?{...t,...e}:t}})}writeValue(e){const t=e??this.gatewayCredentialsService.credentialsToSecurityConfig(this.gatewayCredentialsService.initialCredentials),n=this.securityFormGroup.getRawValue(),{usernamePassword:i,...a}=n,r=i?{...a,...i}:a;Q(t,r)||this.updateFormBySecurityConfig(t)}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.securityFormGroup.valid?null:{securityFormGroup:{valid:!1}}}updateFormBySecurityConfig(e){const{clientId:t,username:n,password:i,...a}=e??{};a?.type===J5.USERNAME_PASSWORD?this.securityFormGroup.patchValue({...a,usernamePassword:{clientId:t,username:n,password:i}},{emitEvent:!1}):this.securityFormGroup.patchValue(a,{emitEvent:!1}),this.toggleBySecurityType(this.securityFormGroup.get("type").value)}createSecurityFormGroup(){return this.fb.group({type:[J5.ACCESS_TOKEN,[xe.required]],accessToken:[null,[xe.required,xe.pattern(/^[^.\s]+$/)]],caCert:[null,[xe.required]],usernamePassword:[]})}setupFormListeners(){this.securityFormGroup.valueChanges.pipe(On(this.destroyRef)).subscribe((({usernamePassword:e,...t})=>{this.onChange(e?{...t,...e}:t)})),this.securityFormGroup.get("type").valueChanges.pipe(On(this.destroyRef),Fe()).subscribe((e=>{this.toggleBySecurityType(e)})),this.securityFormGroup.get("caCert").valueChanges.pipe(On(this.destroyRef)).subscribe((()=>this.cd.detectChanges()))}toggleBySecurityType(e){switch(e){case J5.ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").disable({emitEvent:!1}),this.securityFormGroup.get("usernamePassword").disable({emitEvent:!1});break;case J5.TLS_PRIVATE_KEY:this.securityFormGroup.get("caCert").enable({emitEvent:!1}),this.securityFormGroup.get("accessToken").disable({emitEvent:!1}),this.securityFormGroup.get("usernamePassword").disable({emitEvent:!1});break;case J5.TLS_ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").enable({emitEvent:!1}),this.securityFormGroup.get("usernamePassword").disable({emitEvent:!1});break;case J5.USERNAME_PASSWORD:this.securityFormGroup.get("usernamePassword").enable({emitEvent:!1}),this.securityFormGroup.get("accessToken").disable({emitEvent:!1}),this.securityFormGroup.get("caCert").disable({emitEvent:!1}),this.cd.detectChanges()}}generateAccessToken(){this.securityFormGroup.get("accessToken").patchValue(pe(20))}static{this.ɵfac=function(e){return new(e||j6)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(N6),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:j6,selectors:[["tb-gateway-security-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>j6)),multi:!0},{provide:be,useExisting:c((()=>j6)),multi:!0}]),t.ɵɵStandaloneFeature],decls:11,vars:7,consts:[[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],[3,"formGroup"],["formControlName","type",1,"toggle-group","flex"],[3,"value"],["appearance","outline"],["formControlName","usernamePassword"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel"],["translate",""],["matInput","","formControlName","accessToken"],["matSuffix","","miniButton","false","tooltipPosition","above","icon","content_copy",3,"copyText","tooltipText"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2,"security.security"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(3,2),t.ɵɵelementStart(4,"tb-toggle-select",3),t.ɵɵrepeaterCreate(5,L6,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(7,"keyvalue"),t.ɵɵelementEnd(),t.ɵɵtemplate(8,z6,10,5,"mat-form-field",5),t.ɵɵelement(9,"tb-gateway-username-configuration",6),t.ɵɵtemplate(10,U6,4,11,"tb-file-input",7),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(2),t.ɵɵrepeater(t.ɵɵpipeBind1(7,5,n.securityTypes)),t.ɵɵadvance(3),t.ɵɵconditional(n.securityFormGroup.get("type").value.toLowerCase().includes("accesstoken")?8:-1),t.ɵɵadvance(),t.ɵɵclassProp("hidden","usernamePassword"!==n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵconditional(n.securityFormGroup.get("type").value.toLowerCase().includes("tls")?10:-1))},dependencies:t.ɵɵgetComponentDepsFactory(j6,[me,T,F6]),encapsulation:2})}}const H6=["configGroup"];function W6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-host-required")))}function $6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-required")))}function K6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-min")))}function Y6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-max")))}function X6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-pattern")))}function Z6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-security-configuration",20),t.ɵɵlistener("initialized",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext(2);return t.ɵɵresetView(i.onInitialized(n))})),t.ɵɵelementEnd()}}function Q6(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",19),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("isConfig",!0)("defaultValue",e.ReportStrategyDefaultValue.Gateway)}}function J6(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",8)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",10),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",9),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-slide-toggle",11),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"div",12)(13,"mat-form-field",13)(14,"mat-label",14),t.ɵɵtext(15,"gateway.thingsboard-host"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(20,W6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",13)(22,"mat-label",14),t.ɵɵtext(23,"gateway.thingsboard-port"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",17),t.ɵɵtemplate(25,$6,3,3,"mat-error")(26,K6,3,3,"mat-error")(27,Y6,3,3,"mat-error")(28,X6,3,3,"mat-error"),t.ɵɵelementStart(29,"mat-icon",16),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(32,Z6,1,0,"tb-gateway-security-configuration",18),t.ɵɵpipe(33,"async"),t.ɵɵtemplate(34,Q6,1,3,"tb-report-strategy",19),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.remote-configuration")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,12,"gateway.remote-configuration")," "),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(8,14,"gateway.hints.remote-shell")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,16,"gateway.remote-shell")," "),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,18,"gateway.hints.host")),t.ɵɵadvance(3),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.host").hasError("required")?20:-1),t.ɵɵadvance(5),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.port").hasError("required")?25:e.basicFormGroup.get("thingsboard.port").hasError("min")?26:e.basicFormGroup.get("thingsboard.port").hasError("max")?27:e.basicFormGroup.get("thingsboard.port").hasError("pattern")?28:-1),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(30,20,"gateway.hints.port")),t.ɵɵadvance(3),t.ɵɵconditional(t.ɵɵpipeBind1(33,22,e.initialCredentials$)?32:-1),t.ɵɵadvance(2),t.ɵɵconditional(e.withReportStrategy?34:-1)}}function e7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",22)(1,"mat-label",32),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-slide-toggle",33)(6,"mat-label",32),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,4,"gateway.hints.enable-general-statistics")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,6,"gateway.statistics.general-statistics")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(7,8,"gateway.hints.enable-custom-statistics")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,"gateway.statistics.custom-statistics")," "))}function t7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",22),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.statistics")," "))}function n7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.send-period-required")))}function i7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.send-period-min")))}function a7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.send-period-pattern")))}function r7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.custom-send-period-required")))}function o7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.custom-send-period-min")))}function s7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.custom-send-period-pattern")))}function l7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-required")))}function p7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-pattern")," "))}function c7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-already-exists")))}function d7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-required")))}function u7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-min")))}function m7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-pattern")))}function h7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.command-required")))}function g7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.command-pattern")))}function f7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",30)(1,"section",34)(2,"section",35)(3,"mat-form-field",36)(4,"mat-label",14),t.ɵɵtext(5,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",37),t.ɵɵtemplate(7,l7,3,3,"mat-error")(8,p7,3,3,"mat-error")(9,c7,3,3,"mat-error"),t.ɵɵelementStart(10,"mat-icon",16),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"mat-form-field",36)(14,"mat-label",14),t.ɵɵtext(15,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",38),t.ɵɵtemplate(17,d7,3,3,"mat-error")(18,u7,3,3,"mat-error")(19,m7,3,3,"mat-error"),t.ɵɵelementStart(20,"mat-icon",16),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(23,"section")(24,"mat-form-field",39)(25,"mat-label",14),t.ɵɵtext(26,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",40),t.ɵɵtemplate(28,h7,3,3,"mat-error")(29,g7,3,3,"mat-error"),t.ɵɵelementStart(30,"mat-icon",16),t.ɵɵpipe(31,"translate"),t.ɵɵtext(32,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(33,"section")(34,"mat-expansion-panel",41)(35,"mat-expansion-panel-header")(36,"mat-panel-title")(37,"div",27),t.ɵɵtext(38,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(39,"mat-form-field",36)(40,"mat-label",14),t.ɵɵtext(41,"gateway.statistics.install-cmd"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",42),t.ɵɵelementStart(43,"mat-icon",43),t.ɵɵpipe(44,"translate"),t.ɵɵtext(45,"info_outlined "),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(46,"button",44),t.ɵɵpipe(47,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.removeCommandControl(i,n))})),t.ɵɵelementStart(48,"mat-icon"),t.ɵɵtext(49,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("formGroupName",i),t.ɵɵadvance(6),t.ɵɵconditional(e.get("attributeOnGateway").hasError("required")?7:e.get("attributeOnGateway").hasError("pattern")?8:e.get("attributeOnGateway").hasError("duplicateName")?9:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,10,"gateway.hints.attribute")),t.ɵɵadvance(7),t.ɵɵconditional(e.get("timeout").hasError("required")?17:e.get("timeout").hasError("min")?18:e.get("timeout").hasError("pattern")?19:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(21,12,"gateway.hints.timeout")),t.ɵɵadvance(8),t.ɵɵconditional(e.get("command").hasError("required")?28:e.get("command").hasError("pattern")?29:-1),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(31,14,"gateway.hints.command")),t.ɵɵadvance(13),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(44,16,"gateway.hints.install-cmd")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(47,18,"gateway.statistics.remove")),t.ɵɵproperty("disabled",!a.basicFormGroup.get("thingsboard.remoteConfiguration").value)}}function y7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",21),t.ɵɵtemplate(2,e7,10,12)(3,t7,3,3,"mat-slide-toggle",22),t.ɵɵelementStart(4,"mat-form-field",23)(5,"mat-label",14),t.ɵɵtext(6,"gateway.statistics.send-period"),t.ɵɵelementEnd(),t.ɵɵelement(7,"input",24),t.ɵɵtemplate(8,n7,3,3,"mat-error")(9,i7,3,3,"mat-error")(10,a7,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",23)(12,"mat-label",14),t.ɵɵtext(13,"gateway.statistics.custom-send-period"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",25),t.ɵɵtemplate(15,r7,3,3,"mat-error")(16,o7,3,3,"mat-error")(17,s7,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",26)(19,"div",27),t.ɵɵtext(20,"gateway.statistics.commands"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",28),t.ɵɵtext(22,"gateway.hints.commands"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(23,29),t.ɵɵrepeaterCreate(24,f7,50,20,"div",30,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(26,"button",31),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.addCommand())})),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵconditional(e.hasUpdatedStatistics?2:3),t.ɵɵadvance(6),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("required")?8:e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("min")?9:e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("pattern")?10:-1),t.ɵɵadvance(7),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.statistics.customStatsSendPeriodInSeconds").hasError("required")?15:e.basicFormGroup.get("thingsboard.statistics.customStatsSendPeriodInSeconds").hasError("min")?16:e.basicFormGroup.get("thingsboard.statistics.customStatsSendPeriodInSeconds").hasError("pattern")?17:-1),t.ɵɵadvance(9),t.ɵɵrepeater(e.commandFormArray().controls),t.ɵɵadvance(2),t.ɵɵproperty("disabled",!e.basicFormGroup.get("thingsboard.remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(28,5,"gateway.statistics.add")," ")}}function v7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-timeout-seconds-required")))}function x7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-timeout-seconds-min")))}function b7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-timeout-seconds-pattern")))}function w7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-check-period-seconds-required")))}function S7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-check-period-seconds-min")))}function C7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-check-period-seconds-pattern")))}function _7(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",35)(1,"mat-form-field",36)(2,"mat-label",14),t.ɵɵtext(3,"gateway.inactivity-timeout-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",53),t.ɵɵtemplate(5,v7,3,3,"mat-error")(6,x7,3,3,"mat-error")(7,b7,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",36)(12,"mat-label",14),t.ɵɵtext(13,"gateway.inactivity-check-period-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",54),t.ɵɵtemplate(15,w7,3,3,"mat-error")(16,S7,3,3,"mat-error")(17,C7,3,3,"mat-error"),t.ɵɵelementStart(18,"mat-icon",16),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("required")?5:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("min")?6:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("pattern")?7:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,4,"gateway.hints.inactivity-timeout")),t.ɵɵadvance(7),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("required")?15:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("min")?16:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("pattern")?17:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,6,"gateway.hints.inactivity-period"))}}function T7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.min-pack-send-delay-required")))}function E7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.min-pack-send-delay-min")))}function I7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.min-pack-send-delay-pattern")))}function M7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.mqtt-qos-required")))}function k7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.mqtt-qos-range")))}function P7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.mqtt-qos-range")))}function D7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.check-connectors-configuration-required")))}function A7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.check-connectors-configuration-min")))}function O7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.check-connectors-configuration-pattern")))}function R7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.max-payload-size-bytes-required")))}function B7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.max-payload-size-bytes-min")))}function F7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.max-payload-size-bytes-pattern")))}function N7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.min-pack-size-to-send-required")))}function L7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.min-pack-size-to-send-min")))}function V7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.min-pack-size-to-send-pattern")))}function q7(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",45)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",46),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(7,_7,21,8,"section",35),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",8)(9,"div",27),t.ɵɵtext(10,"gateway.advanced"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"section",35)(12,"mat-form-field",36)(13,"mat-label",14),t.ɵɵtext(14,"gateway.min-pack-send-delay"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",47),t.ɵɵtemplate(16,T7,3,3,"mat-error")(17,E7,3,3,"mat-error")(18,I7,3,3,"mat-error"),t.ɵɵelementStart(19,"mat-icon",16),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"mat-form-field",36)(23,"mat-label",14),t.ɵɵtext(24,"gateway.mqtt-qos"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",48)(26,"mat-option",49),t.ɵɵtext(27,"0"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-option",49),t.ɵɵtext(29,"1"),t.ɵɵelementEnd()(),t.ɵɵtemplate(30,M7,3,3,"mat-error")(31,k7,3,3,"mat-error")(32,P7,3,3,"mat-error"),t.ɵɵelementStart(33,"mat-icon",16),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(36,"section",35)(37,"mat-form-field",36)(38,"mat-label",14),t.ɵɵtext(39,"gateway.statistics.check-connectors-configuration"),t.ɵɵelementEnd(),t.ɵɵelement(40,"input",50),t.ɵɵtemplate(41,D7,3,3,"mat-error")(42,A7,3,3,"mat-error")(43,O7,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",36)(45,"mat-label",14),t.ɵɵtext(46,"gateway.statistics.max-payload-size-bytes"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",51),t.ɵɵtemplate(48,R7,3,3,"mat-error")(49,B7,3,3,"mat-error")(50,F7,3,3,"mat-error"),t.ɵɵelementStart(51,"mat-icon",16),t.ɵɵpipe(52,"translate"),t.ɵɵtext(53,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(54,"section",35)(55,"mat-form-field",36)(56,"mat-label",14),t.ɵɵtext(57,"gateway.statistics.min-pack-size-to-send"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",52),t.ɵɵtemplate(59,N7,3,3,"mat-error")(60,L7,3,3,"mat-error")(61,V7,3,3,"mat-error"),t.ɵɵelementStart(62,"mat-icon",16),t.ɵɵpipe(63,"translate"),t.ɵɵtext(64,"info_outlined "),t.ɵɵelementEnd()()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassProp("no-padding-bottom",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,16,"gateway.hints.check-device-activity")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,18,"gateway.checking-device-activity")," "),t.ɵɵadvance(2),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value?7:-1),t.ɵɵadvance(9),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("required")?16:e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("min")?17:e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("pattern")?18:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,20,"gateway.hints.minimal-pack-delay")),t.ɵɵadvance(7),t.ɵɵproperty("value",0),t.ɵɵadvance(2),t.ɵɵproperty("value",1),t.ɵɵadvance(2),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.qos").hasError("required")?30:e.basicFormGroup.get("thingsboard.qos").hasError("min")?31:e.basicFormGroup.get("thingsboard.qos").hasError("max")?32:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(34,22,"gateway.hints.qos")),t.ɵɵadvance(8),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("required")?41:e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("min")?42:e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("pattern")?43:-1),t.ɵɵadvance(7),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("required")?48:e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("min")?49:e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("pattern")?50:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(52,24,"gateway.hints.max-payload-size-bytes")),t.ɵɵadvance(8),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("required")?59:e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("min")?60:e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("pattern")?61:-1),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(63,26,"gateway.hints.min-pack-size-to-send"))}}class G7{constructor(e,t,n,i,a){this.fb=e,this.deviceService=t,this.gatewayCredentialsService=n,this.destroyRef=i,this.dialog=a,this.gatewayVersion=ft.Legacy,this.dialogMode=!1,this.withReportStrategy=!1,this.initialized=new u,this.ReportStrategyDefaultValue=mn,this.initialCredentials$=this.gatewayCredentialsService.initialCredentials$,this.onChange=()=>{},this.destroy$=new Ie,this.initBasicFormGroup(),this.observeFormChanges(),this.basicFormGroup.valueChanges.pipe(Re(this.destroy$)).subscribe((()=>{this.onChange(this.basicFormGroup.getRawValue())}))}ngOnChanges(e){e.withReportStrategy&&!e.withReportStrategy.firstChange&&this.withReportStrategy&&this.basicFormGroup.get("thingsboard.reportStrategy").enable({emitEvent:!1}),e.gatewayVersion?.previousValue!==e.gatewayVersion.currentValue&&this.onVersionChange()}ngAfterViewInit(){this.defaultTab&&(this.configGroup.selectedIndex=W5[this.defaultTab])}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){if(!e||Q(e,this.basicFormGroup.value))return;this.basicFormGroup.patchValue(e,{emitEvent:!1});const t=this.basicFormGroup.get("thingsboard.reportStrategy"),n=e?.thingsboard?.reportStrategy;"DISABLED"===n?.type?t.disable({emitEvent:!1}):this.withReportStrategy&&t.enable({emitEvent:!1});const i=e?.thingsboard?.statistics?.commands??[],a=this.commandFormArray().getRawValue();Q(i,a)||(this.commandFormArray().clear({emitEvent:!1}),i.forEach((e=>this.addCommand(e,!1))))}validate(){return this.basicFormGroup.valid?null:{basicFormGroup:{valid:!1}}}commandFormArray(){return this.basicFormGroup.get("thingsboard.statistics.commands")}removeCommandControl(e,t){""!==t.pointerType&&(this.commandFormArray().removeAt(e),this.basicFormGroup.markAsDirty())}openConfigurationConfirmDialog(){this.deviceService.getDevice(this.device.id).pipe(Re(this.destroy$)).subscribe((e=>{this.dialog.open(c$,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{gatewayName:e.name}}).afterClosed().pipe(Ue(1)).subscribe((e=>{e||this.basicFormGroup.get("thingsboard.remoteConfiguration").setValue(!0,{emitEvent:!1})}))}))}addCommand(e,t=!0){const{attributeOnGateway:n=null,command:i=null,timeout:a=10,installCmd:r=""}=e||{},o=this.fb.group({attributeOnGateway:[n,[xe.required,xe.pattern(fn),this.uniqNameRequired()]],command:[i,[xe.required,xe.pattern(/^(?=\S).*\S$/)]],timeout:[a,[xe.required,xe.min(1),xe.pattern(gn),xe.pattern(/^[^.\s]+$/)]],installCmd:[r,xe.pattern(fn)]});this.commandFormArray().push(o,{emitEvent:t})}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase();return e.dirty&&t&&this.commandFormArray().value.some((e=>e.attributeOnGateway?.toLowerCase()===t))?{duplicateName:{valid:!1}}:null}}onInitialized(e){this.basicFormGroup.patchValue(e,{emitEvent:!1}),this.initialized.emit(this.basicFormGroup.value)}initBasicFormGroup(){this.basicFormGroup=this.fb.group({thingsboard:this.initThingsboardFormGroup(),storage:[],grpc:[],connectors:this.fb.array([]),logs:[]})}initThingsboardFormGroup(){return this.fb.group({host:[window.location.hostname,[xe.required,xe.pattern(/^[^\s]+$/)]],port:[1883,[xe.required,xe.min(1),xe.max(65535),xe.pattern(gn)]],remoteShell:[!1],remoteConfiguration:[!0],checkConnectorsConfigurationInSeconds:[60,[xe.required,xe.min(1),xe.pattern(gn)]],statistics:this.fb.group({enable:[!0],enableCustom:[{value:!1,disabled:!0}],statsSendPeriodInSeconds:[3600,[xe.required,xe.min(60),xe.pattern(gn)]],customStatsSendPeriodInSeconds:[3600,[xe.required,xe.min(60),xe.pattern(gn)]],commands:this.fb.array([])}),maxPayloadSizeBytes:[8196,[xe.required,xe.min(100),xe.pattern(gn)]],minPackSendDelayMS:[50,[xe.required,xe.min(10),xe.pattern(gn)]],minPackSizeToSend:[500,[xe.required,xe.min(100),xe.pattern(gn)]],handleDeviceRenaming:[!0],checkingDeviceActivity:this.initCheckingDeviceActivityFormGroup(),security:[],qos:[1],reportStrategy:[null]})}initCheckingDeviceActivityFormGroup(){return this.fb.group({checkDeviceInactivity:[!1],inactivityTimeoutSeconds:[300,[xe.min(1),xe.pattern(gn)]],inactivityCheckPeriodSeconds:[10,[xe.min(1),xe.pattern(gn)]]})}onVersionChange(){if(this.hasUpdatedStatistics=nr.parseVersion(this.gatewayVersion)>=nr.parseVersion(ft.v3_7_3),this.hasUpdatedStatistics){const e=this.basicFormGroup.get("thingsboard.statistics.enableCustom");e.enable({emitEvent:!1}),this.basicFormGroup.get("thingsboard.statistics.enable").valueChanges.pipe(On(this.destroyRef)).subscribe((t=>{t||e.patchValue(!1,{emitEvent:!1}),e[t?"enable":"disable"]({emitEvent:!1})}))}}observeFormChanges(){this.observeRemoteConfigurationChanges(),this.observeDeviceActivityChanges()}observeRemoteConfigurationChanges(){this.basicFormGroup.get("thingsboard.remoteConfiguration").valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{e||this.openConfigurationConfirmDialog()}))}observeDeviceActivityChanges(){const e=this.basicFormGroup.get("thingsboard.checkingDeviceActivity");e.get("checkDeviceInactivity").valueChanges.pipe(Re(this.destroy$)).subscribe((t=>{e.updateValueAndValidity();const n=[xe.min(1),xe.required,xe.pattern(gn)];t?(e.get("inactivityTimeoutSeconds").setValidators(n),e.get("inactivityCheckPeriodSeconds").setValidators(n)):(e.get("inactivityTimeoutSeconds").clearValidators(),e.get("inactivityCheckPeriodSeconds").clearValidators()),e.get("inactivityTimeoutSeconds").updateValueAndValidity({emitEvent:!1}),e.get("inactivityCheckPeriodSeconds").updateValueAndValidity({emitEvent:!1})}))}static{this.ɵfac=function(e){return new(e||G7)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(ee.DeviceService),t.ɵɵdirectiveInject(N6),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(Xe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:G7,selectors:[["tb-gateway-basic-configuration"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(H6,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.configGroup=e.first)}},inputs:{device:"device",defaultTab:"defaultTab",gatewayVersion:"gatewayVersion",dialogMode:"dialogMode",withReportStrategy:"withReportStrategy"},outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>G7)),multi:!0},{provide:be,useExisting:c((()=>G7)),multi:!0}]),t.ɵɵNgOnChangesFeature,t.ɵɵStandaloneFeature],decls:20,vars:21,consts:[["configGroup",""],[1,"tab-group-block",3,"formGroup"],[3,"label"],["matTabContent",""],["formControlName","logs",1,"configuration-block",3,"initialized"],["formControlName","storage",3,"initialized"],["formControlName","grpc",3,"initialized"],["formGroupName","thingsboard",1,"mat-content","mat-padding","configuration-block"],[1,"tb-form-panel","no-padding-bottom"],[1,"tb-form-row","no-border","no-padding",3,"tb-hint-tooltip-icon"],["color","primary","formControlName","remoteConfiguration",1,"mat-slide"],["color","primary","formControlName","remoteShell",1,"mat-slide"],[1,"no-border","no-padding","tb-standard-fields","xs:flex-col","flex","gap-2"],["appearance","outline",1,"flex","flex-1"],["translate",""],["matInput","","formControlName","host"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","port","type","number","min","0"],["formControlName","security"],["formControlName","reportStrategy",1,"tb-form-panel",3,"isExpansionMode","isConfig","defaultValue"],["formControlName","security",3,"initialized"],["formGroupName","statistics",1,"tb-form-panel","no-padding-bottom"],["color","primary","formControlName","enable",1,"mat-slide"],["appearance","outline"],["matInput","","formControlName","statsSendPeriodInSeconds","type","number","min","60"],["matInput","","formControlName","customStatsSendPeriodInSeconds","type","number","min","60"],[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],["translate","",1,"tb-form-panel-hint"],["formGroupName","statistics"],["formArrayName","commands",1,"statistics-container","flex","flex-row"],["mat-stroked-button","","color","primary","type","button",2,"width","fit-content",3,"click","disabled"],[3,"tb-hint-tooltip-icon"],["color","primary","formControlName","enableCustom",1,"mat-slide"],[1,"tb-form-panel","stroked","no-padding-bottom","no-gap","command-container",3,"formGroupName"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["matInput","","formControlName","attributeOnGateway"],["matInput","","formControlName","timeout","type","number","min","0"],["appearance","outline",1,"mat-block"],["matInput","","formControlName","command"],[1,"tb-settings","pb-4"],["matInput","","formControlName","installCmd"],["matIconSuffix","",1,"cursor-pointer",3,"matTooltip"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","disabled","matTooltip"],["formGroupName","checkingDeviceActivity",1,"tb-form-panel"],["color","primary","formControlName","checkDeviceInactivity",1,"mat-slide"],["matInput","","formControlName","minPackSendDelayMS","type","number","min","0"],["formControlName","qos"],[3,"value"],["matInput","","formControlName","checkConnectorsConfigurationInSeconds","type","number","min","0"],["matInput","","formControlName","maxPayloadSizeBytes","type","number","min","0"],["matInput","","formControlName","minPackSizeToSend","type","number","min","0"],["matInput","","formControlName","inactivityTimeoutSeconds","type","number","min","0"],["matInput","","type","number","min","0","formControlName","inactivityCheckPeriodSeconds"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-tab-group",1,0)(2,"mat-tab",2),t.ɵɵpipe(3,"translate"),t.ɵɵtemplate(4,J6,35,24,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-tab",2),t.ɵɵpipe(6,"translate"),t.ɵɵelementStart(7,"tb-gateway-logs-configuration",4),t.ɵɵlistener("initialized",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(i))})),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"mat-tab",2),t.ɵɵpipe(9,"translate"),t.ɵɵelementStart(10,"tb-gateway-storage-configuration",5),t.ɵɵlistener("initialized",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(i))})),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-tab",2),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"tb-gateway-grpc-configuration",6),t.ɵɵlistener("initialized",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(i))})),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-tab",2),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,y7,29,7,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-tab",2),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,q7,65,28,"ng-template",3),t.ɵɵelementEnd()()}2&e&&(t.ɵɵclassProp("dialog-mode",n.dialogMode),t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(3,9,"gateway.general")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(6,11,"gateway.logs.logs")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(9,13,"gateway.storage")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(12,15,"gateway.grpc")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(15,17,"gateway.statistics.statistics")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(18,19,"gateway.other")))},dependencies:t.ɵɵgetComponentDepsFactory(G7,[me,T,pi,$4,m6,T6,j6]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:grid;grid-template-rows:min-content minmax(auto,1fr) min-content}[_nghost-%COMP%] .configuration-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{grid-row:1;background:transparent;color:#000000de!important}[_nghost-%COMP%] .tab-group-block[_ngcontent-%COMP%]{min-width:0;height:100%;min-height:0;grid-row:2}[_nghost-%COMP%] .toggle-group[_ngcontent-%COMP%]{margin-right:auto}[_nghost-%COMP%] .first-capital[_ngcontent-%COMP%]{text-transform:capitalize}[_nghost-%COMP%] textarea[_ngcontent-%COMP%]{resize:none}[_nghost-%COMP%] .saving-period[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] .command-container[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] mat-form-field[_ngcontent-%COMP%] mat-error[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%] mat-form-field[_ngcontent-%COMP%] mat-error[_ngcontent-%COMP%]:first-child{display:block!important}[_nghost-%COMP%] .pointer-event{pointer-events:all}[_nghost-%COMP%] .toggle-group span{padding:0 25px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{color:#e0e0e0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix:hover{color:#9e9e9e}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex;align-items:center}']})}}e("GatewayBasicConfigurationComponent",G7),Ze([I()],G7.prototype,"dialogMode",void 0),Ze([I()],G7.prototype,"withReportStrategy",void 0);class z7{constructor(e){this.fb=e,this.destroy$=new Ie,this.advancedFormControl=this.fb.control(""),this.advancedFormControl.valueChanges.pipe(Re(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){this.advancedFormControl.reset(e,{emitEvent:!1})}validate(){return this.advancedFormControl.valid?null:{advancedFormControl:{valid:!1}}}static{this.ɵfac=function(e){return new(e||z7)(t.ɵɵdirectiveInject(ye.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:z7,selectors:[["tb-gateway-advanced-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ve,useExisting:c((()=>z7)),multi:!0},{provide:be,useExisting:c((()=>z7)),multi:!0}]),t.ɵɵStandaloneFeature],decls:2,vars:4,consts:[["fillHeight","true","jsonRequired","",1,"flex","h-full","flex-col","p-2",3,"label","formControl"]],template:function(e,n){1&e&&(t.ɵɵelement(0,"tb-json-object-edit",0),t.ɵɵpipe(1,"translate")),2&e&&(t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(1,2,"gateway.configuration")),t.ɵɵproperty("formControl",n.advancedFormControl))},dependencies:t.ɵɵgetComponentDepsFactory(z7,[T]),encapsulation:2})}}function U7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",14),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(1,"mat-icon",15),t.ɵɵtext(2,"close"),t.ɵɵelementEnd()()}}function j7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-basic-configuration",16),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onInitialized(n))})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("device",e.device)("defaultTab",e.defaultTab)("gatewayVersion",e.gatewayVersion)("dialogMode",!!e.dialogRef)("withReportStrategy",t.ɵɵpipeBind1(1,5,e.gatewayVersion))}}function H7(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-advanced-configuration",10)}function W7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",17),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.cancel())})),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()}2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"action.cancel")," "))}e("GatewayAdvancedConfigurationComponent",z7);class $7{constructor(e,t,n,i,a){this.fb=e,this.attributeService=t,this.cd=n,this.gatewayCredentialsService=i,this.destroyRef=a,this.ConfigurationModes=dn,this.gatewayConfigAttributeKeys=["general_configuration","grpc_configuration","logs_configuration","storage_configuration","RemoteLoggingLevel","mode"],this.useUpdatedLogs=!1,this.gatewayConfigGroup=this.fb.group({basicConfig:[],advancedConfig:[],mode:[dn.BASIC]}),this.observeAlignConfigs()}ngAfterViewInit(){this.fetchConfigAttribute(this.device)}saveConfig(){const{mode:e,advancedConfig:t}=ue(this.removeEmpty(this.gatewayConfigGroup.value)),n={mode:e,...t};n.thingsboard.statistics.commands=Object.values(n.thingsboard.statistics.commands??[]),n.thingsboard.reportStrategy||(n.thingsboard.reportStrategy={type:"DISABLED"});const i=this.generateAttributes(n);this.attributeService.saveEntityAttributes(this.device,A.SHARED_SCOPE,i).pipe(He((e=>this.gatewayCredentialsService.updateCredentials(n.thingsboard.security))),On(this.destroyRef)).subscribe((()=>{this.dialogRef?this.dialogRef.close():(this.gatewayConfigGroup.markAsPristine(),this.cd.detectChanges())}))}onInitialized(e){this.gatewayConfigGroup.get("basicConfig").patchValue(e,{emitEvent:!1}),this.gatewayConfigGroup.get("advancedConfig").patchValue(e,{emitEvent:!1})}observeAlignConfigs(){this.gatewayConfigGroup.get("basicConfig").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("advancedConfig");Q(t.value,e)||this.gatewayConfigGroup.get("mode").value!==dn.BASIC||t.patchValue(e,{emitEvent:!1})})),this.gatewayConfigGroup.get("advancedConfig").valueChanges.pipe(On(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("basicConfig");Q(t.value,e)||this.gatewayConfigGroup.get("mode").value!==dn.ADVANCED||t.patchValue(e,{emitEvent:!1})}))}generateAttributes(e){const t=[],n=(e,n)=>{t.push({key:e,value:n})},i=(e,t)=>{t={...t,ts:(new Date).getTime()},n(e,t)};return n("RemoteLoggingLevel",e.logs?.logLevel??gt.NONE),delete e.connectors,n("logs_configuration",this.generateLogsFile(e.logs)),i("grpc_configuration",e.grpc),i("storage_configuration",e.storage),i("general_configuration",e.thingsboard),n("mode",e.mode),t}cancel(){this.dialogRef&&this.dialogRef.close()}removeEmpty(e){return Object.fromEntries(Object.entries(e).filter((([e,t])=>null!=t)).map((([e,t])=>[e,t===Object(t)?this.removeEmpty(t):t])))}generateLogsFile(e){const t={version:1,disable_existing_loggers:!1,formatters:{LogFormatter:{class:"logging.Formatter",format:e.logFormat,datefmt:e.dateFormat}},handlers:{consoleHandler:{class:"logging.StreamHandler",formatter:"LogFormatter",level:0,stream:"ext://sys.stdout"}},loggers:{...this.useUpdatedLogs?{}:{database:{handlers:["consoleHandler"],level:"DEBUG",propagate:!1}}},root:{level:"ERROR",handlers:["consoleHandler"]},ts:(new Date).getTime()};return this.addLocalLoggers(t,e?.local),t}addLocalLoggers(e,t){if(t)for(const n of Object.keys(t))e.handlers[n+"Handler"]=this.createHandlerObj(t[n],n),e.loggers[n]=this.createLoggerObj(t[n],n)}createHandlerObj(e,t){return{class:this.useUpdatedLogs?t4:n4,formatter:"LogFormatter",filename:`${e.filePath}/${t}.log`,backupCount:e.backupCount,interval:e.savingTime,when:e.savingPeriod,encoding:"utf-8"}}createLoggerObj(e,t){return{handlers:[`${t}Handler`,"consoleHandler"],level:e.logLevel,propagate:!1}}fetchConfigAttribute(e){e.id!==F&&this.attributeService.getEntityAttributes(e,A.CLIENT_SCOPE).pipe($e((t=>t.length?Pe(t):this.attributeService.getEntityAttributes(e,A.SHARED_SCOPE,this.gatewayConfigAttributeKeys))),On(this.destroyRef)).subscribe((e=>{this.gatewayVersion=e.find((e=>"Version"===e.key))?.value,this.useUpdatedLogs=nr.parseVersion(this.gatewayVersion??ft.Legacy)>=nr.parseVersion(ft.v3_6_3),this.updateConfigs(e),this.cd.detectChanges()}))}updateConfigs(e){let t={},n=gt.NONE;this.gatewayCredentialsService.setInitialCredentials(this.device),e.forEach((e=>{switch(e.key){case"general_configuration":e.value&&(t={...t,thingsboard:e.value});break;case"grpc_configuration":e.value&&(t={...t,grpc:e.value});break;case"logs_configuration":e.value&&(t={...t,logs:this.logsToObj(e.value)});break;case"storage_configuration":e.value&&(t={...t,storage:e.value});break;case"mode":t={...t,mode:e.value??dn.BASIC};break;case"RemoteLoggingLevel":e.value&&(n=e.value)}})),t.logs&&(t={...t,logs:{...t.logs,logLevel:n}}),t.thingsboard?.security?this.gatewayCredentialsService.initialCredentials$.pipe(Le(Boolean),Ue(1),On(this.destroyRef)).subscribe((e=>{this.gatewayCredentialsService.shouldUpdateSecurityConfig(t.thingsboard.security)&&(t.thingsboard.security=this.gatewayCredentialsService.credentialsToSecurityConfig(e)),this.gatewayConfigGroup.get("basicConfig").patchValue(t,{emitEvent:!1}),this.gatewayConfigGroup.get("advancedConfig").patchValue(t,{emitEvent:!1})})):(this.gatewayConfigGroup.get("basicConfig").patchValue(t,{emitEvent:!1}),this.gatewayConfigGroup.get("advancedConfig").patchValue(t,{emitEvent:!1}))}logsToObj(e){const{format:t,datefmt:n}=e.formatters.LogFormatter;return{local:Object.keys(K5).reduce(((t,n)=>{const i=e.handlers[`${n}Handler`]||{},a=e.loggers[n]||{};return t[n]={logLevel:a.level||gt.INFO,filePath:i.filename?.split(`/${n}`)[0]||"./logs",backupCount:i.backupCount||7,savingTime:i.interval||3,savingPeriod:i.when||Z5.days},t}),{}),logFormat:t,dateFormat:n}}static{this.ɵfac=function(e){return new(e||$7)(t.ɵɵdirectiveInject(ye.FormBuilder),t.ɵɵdirectiveInject(ee.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(N6),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$7,selectors:[["tb-gateway-configuration"]],inputs:{device:"device",defaultTab:"defaultTab",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵProvidersFeature([N6]),t.ɵɵStandaloneFeature],decls:24,vars:24,consts:[[1,"flex","size-full","max-w-full","flex-col",3,"formGroup"],["color","primary"],[1,"tb-flex","space-between","align-center","h-16"],["tbTruncateWithTooltip",""],[1,"flex","items-center"],["formControlName","mode",3,"appearance"],[3,"value"],["mat-icon-button","","type","button"],[1,"content-wrapper","flex-1"],["formControlName","basicConfig",3,"device","defaultTab","gatewayVersion","dialogMode","withReportStrategy"],["formControlName","advancedConfig"],[1,"flex","h-full","items-center","justify-end","gap-2","pr-4"],["mat-button","","color","primary","type","button"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["formControlName","basicConfig",3,"initialized","device","defaultTab","gatewayVersion","dialogMode","withReportStrategy"],["mat-button","","color","primary","type","button",3,"click"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"div",2)(3,"h2")(4,"div",3),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",4)(8,"tb-toggle-select",5)(9,"tb-toggle-option",6),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"tb-toggle-option",6),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(15,U7,3,0,"button",7),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8),t.ɵɵtemplate(17,j7,2,7,"tb-gateway-basic-configuration",9)(18,H7,1,0,"tb-gateway-advanced-configuration",10),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",11),t.ɵɵtemplate(20,W7,3,3,"button",12),t.ɵɵelementStart(21,"button",13),t.ɵɵlistener("click",(function(){return n.saveConfig()})),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.gatewayConfigGroup),t.ɵɵadvance(),t.ɵɵclassProp("page-header",!n.dialogRef),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,16,"gateway.gateway-configuration")),t.ɵɵadvance(3),t.ɵɵclassProp("dialog-toggle",!!n.dialogRef),t.ɵɵpropertyInterpolate("appearance",n.dialogRef?"stroked":"fill"),t.ɵɵadvance(),t.ɵɵproperty("value",n.ConfigurationModes.BASIC),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,18,"gateway.basic")," "),t.ɵɵadvance(2),t.ɵɵproperty("value",n.ConfigurationModes.ADVANCED),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,20,"gateway.advanced")," "),t.ɵɵadvance(2),t.ɵɵconditional(n.dialogRef?15:-1),t.ɵɵadvance(2),t.ɵɵconditional(n.gatewayConfigGroup.get("mode").value===n.ConfigurationModes.BASIC?17:18),t.ɵɵadvance(3),t.ɵɵconditional(n.dialogRef?20:-1),t.ɵɵadvance(),t.ɵɵproperty("disabled",n.gatewayConfigGroup.invalid||!n.gatewayConfigGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,22,"action.save")," "))},dependencies:t.ɵɵgetComponentDepsFactory($7,[T,lr,G7,z7]),styles:['@charset "UTF-8";[_nghost-%COMP%]{overflow:hidden;padding:0!important;max-height:75vh;height:75vh;width:800px;max-width:80vw}@media screen and (max-width: 599px){[_nghost-%COMP%]{max-height:100%;height:100%;width:100%;max-width:100%}}[_nghost-%COMP%] .page-header.mat-toolbar[_ngcontent-%COMP%]{background:transparent;color:#000000de!important}[_nghost-%COMP%] .content-wrapper[_ngcontent-%COMP%]{min-height:calc(100% - 116px)}.dialog-toggle[_ngcontent-%COMP%] .mat-button-toggle-button{color:#ffffffbf}']})}}e("GatewayConfigurationComponent",$7);class K7{constructor(){}static{this.ɵfac=function(e){return new(e||K7)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:K7,selectors:[["tb-lib-styles-entry"]],standalone:!0,features:[t.ɵɵStandaloneFeature],decls:0,vars:0,template:function(e,t){},styles:['@charset "UTF-8";.gw-delete-icon-button{color:#0000008a}.gw-connector-table .mat-mdc-table{table-layout:fixed}.gw-chip-list .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center}.gw-table-toolbar.mat-mdc-table-toolbar.mat-mdc-table-toolbar{padding:0 8px}.see-example{display:flex}.tb-default .size-min{width:-moz-min-content;width:min-content;height:-moz-min-content;height:min-content}.tb-default .h-16{height:4rem}.tb-default .h-\\[500px\\]{height:500px}.tb-default .max-h-full{max-height:100%}.tb-default .min-h-10{min-height:2.5rem}.tb-default .\\!w-1\\/5{width:20%!important}.tb-default .w-1\\/2{width:50%}.tb-default .w-12{width:3rem}.tb-default .w-\\[77vw\\]{width:77vw}.tb-default .min-w-16{min-width:4rem}.tb-default .min-w-24{min-width:6rem}.tb-default .max-w-2xl{max-width:42rem}.tb-default .max-w-3xl{max-width:48rem}.tb-default .max-w-4\\/12{max-width:33.333333%}.tb-default .max-w-\\[11vw\\]{max-width:11vw}.tb-default .max-w-full{max-width:100%}.tb-default .flex-\\[1_1_30px\\]{flex:1 1 30px}.tb-default .flex-\\[1_1_33\\%\\]{flex:1 1 33%}.tb-default .flex-grow{flex-grow:1}.tb-default .gap-1\\.25{gap:.3125rem}.tb-default .p-1{padding:.25rem}.tb-default .py-1{padding-top:.25rem;padding-bottom:.25rem}.tb-default .\\!pl-0{padding-left:0!important}.tb-default .pr-4{padding-right:1rem}.tb-default .pt-4{padding-top:1rem}.tb-default .text-center{text-align:center}@media (max-width: 599px){.tb-default .lt-sm\\:flex-col{flex-direction:column}}\n'],encapsulation:2})}}const Y7=(e,t)=>{const n=e[y];if(n.styles?.length){const e=n.styles[0];let i=document.getElementById(t);if(!i){i=document.createElement("style"),i.id=t;(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}i.innerHTML=e}};class X7{constructor(e){this.translate=e,qt(e),this.translate.onLangChange.pipe(On(),Le((e=>e.lang!==Ct.English))).subscribe((()=>{qt(e)})),(e=>{Y7(K7,e)})("tb-gateway-css")}static{this.ɵfac=function(e){return new(e||X7)(t.ɵɵinject(he.TranslateService))}}static{this.ɵmod=t.ɵɵdefineNgModule({type:X7})}static{this.ɵinj=t.ɵɵdefineInjector({imports:[me,T,fe,Mj,l$,aK,$7,An,H5,j5]})}}e("GatewayExtensionModule",X7),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(X7,{imports:[me,T,fe,Mj,l$,aK,$7,An,H5,j5]})}}}));//# sourceMappingURL=gateway-management-extension.js.map +var Gc={},zc={};var Uc,jc=function(){function e(e,t,n){var i=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,n=n||{},this.dom=t,this.id=e;var a=new ll,r=n.renderer||"canvas";Gc[r]||(r=Xr(Gc)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var o=new Gc[r](t,a,n,e),s=n.ssr||o.ssrOnly;this.storage=a,this.painter=o;var l,p=gr.node||gr.worker||s?null:new oc(o.getViewportRoot(),o.root),c=n.useCoarsePointer;(null==c||"auto"===c?gr.touchEventsSupported:!!c)&&(l=ho(n.pointerSize,44)),this.handler=new Ys(a,o,p,o.root,l),this.animation=new Up({stage:{update:s?null:function(){return i._flush(!0)}}}),s||this.animation.start()}return e.prototype.add=function(e){!this._disposed&&e&&(this.storage.addRoot(e),e.addSelfToZr(this),this.refresh())},e.prototype.remove=function(e){!this._disposed&&e&&(this.storage.delRoot(e),e.removeSelfFromZr(this),this.refresh())},e.prototype.configLayer=function(e,t){this._disposed||(this.painter.configLayer&&this.painter.configLayer(e,t),this.refresh())},e.prototype.setBackgroundColor=function(e){this._disposed||(this.painter.setBackgroundColor&&this.painter.setBackgroundColor(e),this.refresh(),this._backgroundColor=e,this._darkMode=function(e){if(!e)return!1;if("string"==typeof e)return sp(e,1)<.4;if(e.colorStops){for(var t=e.colorStops,n=0,i=t.length,a=0;a0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(e){this._sleepAfterStill=e},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},e.prototype.resize=function(e){this._disposed||(e=e||{},this.painter.resize(e.width,e.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(e){this._disposed||this.handler.setCursorStyle(e)},e.prototype.findHover=function(e,t){if(!this._disposed)return this.handler.findHover(e,t)},e.prototype.on=function(e,t,n){return this._disposed||this.handler.on(e,t,n),this},e.prototype.off=function(e,t){this._disposed||this.handler.off(e,t)},e.prototype.trigger=function(e,t){this._disposed||this.handler.trigger(e,t)},e.prototype.clear=function(){if(!this._disposed){for(var e=this.storage.getRoots(),t=0;t0){if(e<=a)return o;if(e>=r)return s}else{if(e>=a)return o;if(e<=r)return s}else{if(e===a)return o;if(e===r)return s}return(e-a)/l*p+o}function Zc(e,t){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%"}return to(e)?(n=e,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e;var n}function Qc(e,t,n){return null==t&&(t=10),t=Math.min(Math.max(0,t),20),e=(+e).toFixed(t),n?e:+e}function Jc(e){return e.sort(function(e,t){return e-t}),e}function ed(e){if(e=+e,isNaN(e))return 0;if(e>1e-14)for(var t=1,n=0;n<15;n++,t*=10)if(Math.round(e*t)/t===e)return n;return td(e)}function td(e){var t=e.toString().toLowerCase(),n=t.indexOf("e"),i=n>0?+t.slice(n+1):0,a=n>0?n:t.length,r=t.indexOf("."),o=r<0?0:a-1-r;return Math.max(0,o-i)}function nd(e,t){var n=Math.log,i=Math.LN10,a=Math.floor(n(e[1]-e[0])/i),r=Math.round(n(Math.abs(t[1]-t[0]))/i),o=Math.min(Math.max(-a+r,0),20);return isFinite(o)?o:20}function id(e,t){var n=$r(e,function(e,t){return e+(isNaN(t)?0:t)},0);if(0===n)return[];for(var i=Math.pow(10,t),a=Wr(e,function(e){return(isNaN(e)?0:e)/n*i*100}),r=100*i,o=Wr(a,function(e){return Math.floor(e)}),s=$r(o,function(e,t){return e+t},0),l=Wr(a,function(e,t){return e-o[t]});sp&&(p=l[d],c=d);++o[c],l[c]=0,++s}return Wr(o,function(e){return e/i})}function ad(e,t){var n=Math.max(ed(e),ed(t)),i=e+t;return n>20?i:Qc(i,n)}function rd(e){var t=2*Math.PI;return(e%t+t)%t}function od(e){return e>-1e-4&&e=10&&t++,t}function dd(e,t){var n=cd(e),i=Math.pow(10,n),a=e/i;return e=(t?a<1.5?1:a<2.5?2:a<4?3:a<7?5:10:a<1?1:a<2?2:a<3?3:a<5?5:10)*i,n>=-20?+e.toFixed(n<0?-n:0):e}function ud(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,i=0;i=0||a&&Gr(a,s)<0)){var l=n.getShallow(s,t);null!=l&&(r[e[o][0]]=l)}}return r}}var tu=eu([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),nu=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return tu(this,e,t)},e}(),iu=new ql(50);function au(e){if("string"==typeof e){var t=iu.get(e);return t&&t.image}return e}function ru(e,t,n,i,a){if(e){if("string"==typeof e){if(t&&t.__zrImageSrc===e||!n)return t;var r=iu.get(e),o={hostEl:n,cb:i,cbPayload:a};return r?!su(t=r.image)&&r.pending.push(o):((t=wr.loadImage(e,ou,ou)).__zrImageSrc=e,iu.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}return t}function ou(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=o;l++)s-=o;var p=Sc(n,t);return p>s&&(n="",p=0),s=e-p,a.ellipsis=n,a.ellipsisWidth=p,a.contentWidth=s,a.containerWidth=e,a}function du(e,t){var n=t.containerWidth,i=t.font,a=t.contentWidth;if(!n)return"";var r=Sc(e,i);if(r<=n)return e;for(var o=0;;o++){if(r<=a||o>=t.maxIterations){e+=t.ellipsis;break}var s=0===o?uu(e,a,t.ascCharWidth,t.cnCharWidth):r>0?Math.floor(e.length*a/r):0;r=Sc(e=e.substr(0,s),i)}return""===e&&(e=t.placeholder),e}function uu(e,t,n,i){for(var a=0,r=0,o=e.length;r0&&h+i.accumWidth>i.width&&(r=t.split("\n"),d=!0),i.accumWidth=h}else{var g=xu(t,c,i.width,i.breakAll,i.accumWidth);i.accumWidth=g.accumWidth+m,o=g.linesWidths,r=g.lines}}else r=t.split("\n");for(var f=0;f=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}(e)||!!yu[e]}function xu(e,t,n,i,a){for(var r=[],o=[],s="",l="",p=0,c=0,d=0;dn:a+c+m>n)?c?(s||l)&&(h?(s||(s=l,l="",c=p=0),r.push(s),o.push(c-p),l+=u,s="",c=p+=m):(l&&(s+=l,l="",p=0),r.push(s),o.push(c),s=u,c=m)):h?(r.push(l),o.push(p),l=u,p=m):(r.push(u),o.push(m)):(c+=m,h?(l+=u,p+=m):(l&&(s+=l,l="",p=0),s+=u))}else l&&(s+=l,c+=p),r.push(s),o.push(c),s="",l="",p=0,c=0}return r.length||s||(s=e,l="",p=0),l&&(s+=l),s&&(r.push(s),o.push(c)),1===r.length&&(c+=a),{accumWidth:c,lines:r,linesWidths:o}}var bu="__zr_style_"+Math.round(10*Math.random()),wu={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},Su={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};wu[bu]=!0;var Cu=["z","z2","invisible"],_u=["invisible"],Tu=function(e){function t(t){return e.call(this,t)||this}var n;return Xe(t,e),t.prototype._init=function(t){for(var n=Xr(t),i=0;i1e-4)return s[0]=e-n,s[1]=t-i,l[0]=e+n,void(l[1]=t+i);if(Ou[0]=Du(a)*n+e,Ou[1]=Pu(a)*i+t,Ru[0]=Du(r)*n+e,Ru[1]=Pu(r)*i+t,p(s,Ou,Ru),c(l,Ou,Ru),(a%=Au)<0&&(a+=Au),(r%=Au)<0&&(r+=Au),a>r&&!o?r+=Au:aa&&(Bu[0]=Du(m)*n+e,Bu[1]=Pu(m)*i+t,p(s,Bu,s),c(l,Bu,l))}var Uu={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},ju=[],Hu=[],Wu=[],$u=[],Ku=[],Yu=[],Xu=Math.min,Zu=Math.max,Qu=Math.cos,Ju=Math.sin,em=Math.abs,tm=Math.PI,nm=2*tm,im="undefined"!=typeof Float32Array,am=[];function rm(e){return Math.round(e/tm*1e8)/1e8%2*tm}function om(e,t){var n=rm(e[0]);n<0&&(n+=nm);var i=n-e[0],a=e[1];a+=i,!t&&a-n>=nm?a=n+nm:t&&n-a>=nm?a=n-nm:!t&&n>a?a=n+(nm-rm(n-a)):t&&n0&&(this._ux=em(n/lc/e)||0,this._uy=em(n/lc/t)||0)},e.prototype.setDPR=function(e){this.dpr=e},e.prototype.setContext=function(e){this._ctx=e},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(e,t){return this._drawPendingPt(),this.addData(Uu.M,e,t),this._ctx&&this._ctx.moveTo(e,t),this._x0=e,this._y0=t,this._xi=e,this._yi=t,this},e.prototype.lineTo=function(e,t){var n=em(e-this._xi),i=em(t-this._yi),a=n>this._ux||i>this._uy;if(this.addData(Uu.L,e,t),this._ctx&&a&&this._ctx.lineTo(e,t),a)this._xi=e,this._yi=t,this._pendingPtDist=0;else{var r=n*n+i*i;r>this._pendingPtDist&&(this._pendingPtX=e,this._pendingPtY=t,this._pendingPtDist=r)}return this},e.prototype.bezierCurveTo=function(e,t,n,i,a,r){return this._drawPendingPt(),this.addData(Uu.C,e,t,n,i,a,r),this._ctx&&this._ctx.bezierCurveTo(e,t,n,i,a,r),this._xi=a,this._yi=r,this},e.prototype.quadraticCurveTo=function(e,t,n,i){return this._drawPendingPt(),this.addData(Uu.Q,e,t,n,i),this._ctx&&this._ctx.quadraticCurveTo(e,t,n,i),this._xi=n,this._yi=i,this},e.prototype.arc=function(e,t,n,i,a,r){this._drawPendingPt(),am[0]=i,am[1]=a,om(am,r),i=am[0];var o=(a=am[1])-i;return this.addData(Uu.A,e,t,n,n,i,o,0,r?0:1),this._ctx&&this._ctx.arc(e,t,n,i,a,r),this._xi=Qu(a)*n+e,this._yi=Ju(a)*n+t,this},e.prototype.arcTo=function(e,t,n,i,a){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(e,t,n,i,a),this},e.prototype.rect=function(e,t,n,i){return this._drawPendingPt(),this._ctx&&this._ctx.rect(e,t,n,i),this.addData(Uu.R,e,t,n,i),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Uu.Z);var e=this._ctx,t=this._x0,n=this._y0;return e&&e.closePath(),this._xi=t,this._yi=n,this},e.prototype.fill=function(e){e&&e.fill(),this.toStatic()},e.prototype.stroke=function(e){e&&e.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(e){var t=e.length;this.data&&this.data.length===t||!im||(this.data=new Float32Array(t));for(var n=0;np.length&&(this._expandData(),p=this.data);for(var c=0;c0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var e=[],t=0;t11&&(this.data=new Float32Array(e)))}},e.prototype.getBoundingRect=function(){Wu[0]=Wu[1]=Ku[0]=Ku[1]=Number.MAX_VALUE,$u[0]=$u[1]=Yu[0]=Yu[1]=-Number.MAX_VALUE;var e,t=this.data,n=0,i=0,a=0,r=0;for(e=0;en||em(f)>i||d===t-1)&&(h=Math.sqrt(k*k+f*f),a=g,r=x);break;case Uu.C:var y=e[d++],v=e[d++],x=(g=e[d++],e[d++]),b=e[d++],w=e[d++];h=Il(a,r,y,v,g,x,b,w,10),a=b,r=w;break;case Uu.Q:h=Rl(a,r,y=e[d++],v=e[d++],g=e[d++],x=e[d++],10),a=g,r=x;break;case Uu.A:var S=e[d++],C=e[d++],_=e[d++],T=e[d++],E=e[d++],M=e[d++],I=M+E;d+=1,m&&(o=Qu(E)*_+S,s=Ju(E)*T+C),h=Zu(_,T)*Xu(nm,Math.abs(M)),a=Qu(I)*_+S,r=Ju(I)*T+C;break;case Uu.R:o=a=e[d++],s=r=e[d++],h=2*e[d++]+2*e[d++];break;case Uu.Z:var k=o-a;f=s-r;h=Math.sqrt(k*k+f*f),a=o,r=s}h>=0&&(l[c++]=h,p+=h)}return this._pathLen=p,p},e.prototype.rebuildPath=function(e,t){var n,i,a,r,o,s,l,p,c,d,u=this.data,m=this._ux,h=this._uy,g=this._len,f=t<1,y=0,v=0,x=0;if(!f||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,p=t*this._pathLen))e:for(var b=0;b0&&(e.lineTo(c,d),x=0),w){case Uu.M:n=a=u[b++],i=r=u[b++],e.moveTo(a,r);break;case Uu.L:o=u[b++],s=u[b++];var C=em(o-a),_=em(s-r);if(C>m||_>h){if(f){if(y+(K=l[v++])>p){var T=(p-y)/K;e.lineTo(a*(1-T)+o*T,r*(1-T)+s*T);break e}y+=K}e.lineTo(o,s),a=o,r=s,x=0}else{var E=C*C+_*_;E>x&&(c=o,d=s,x=E)}break;case Uu.C:var M=u[b++],I=u[b++],k=u[b++],P=u[b++],D=u[b++],A=u[b++];if(f){if(y+(K=l[v++])>p){El(a,M,k,D,T=(p-y)/K,ju),El(r,I,P,A,T,Hu),e.bezierCurveTo(ju[1],Hu[1],ju[2],Hu[2],ju[3],Hu[3]);break e}y+=K}e.bezierCurveTo(M,I,k,P,D,A),a=D,r=A;break;case Uu.Q:M=u[b++],I=u[b++],k=u[b++],P=u[b++];if(f){if(y+(K=l[v++])>p){Al(a,M,k,T=(p-y)/K,ju),Al(r,I,P,T,Hu),e.quadraticCurveTo(ju[1],Hu[1],ju[2],Hu[2]);break e}y+=K}e.quadraticCurveTo(M,I,k,P),a=k,r=P;break;case Uu.A:var O=u[b++],R=u[b++],B=u[b++],F=u[b++],N=u[b++],L=u[b++],V=u[b++],q=!u[b++],G=B>F?B:F,z=em(B-F)>.001,U=N+L,j=!1;if(f)y+(K=l[v++])>p&&(U=N+L*(p-y)/K,j=!0),y+=K;if(z&&e.ellipse?e.ellipse(O,R,B,F,V,N,U,q):e.arc(O,R,G,N,U,q),j)break e;S&&(n=Qu(N)*B+O,i=Ju(N)*F+R),a=Qu(U)*B+O,r=Ju(U)*F+R;break;case Uu.R:n=a=u[b],i=r=u[b+1],o=u[b++],s=u[b++];var H=u[b++],W=u[b++];if(f){if(y+(K=l[v++])>p){var $=p-y;e.moveTo(o,s),e.lineTo(o+Xu($,H),s),($-=H)>0&&e.lineTo(o+H,s+Xu($,W)),($-=W)>0&&e.lineTo(o+Zu(H-$,0),s+W),($-=H)>0&&e.lineTo(o,s+Zu(W-$,0));break e}y+=K}e.rect(o,s,H,W);break;case Uu.Z:if(f){var K;if(y+(K=l[v++])>p){T=(p-y)/K;e.lineTo(a*(1-T)+n*T,r*(1-T)+i*T);break e}y+=K}e.closePath(),a=n,r=i}}},e.prototype.clone=function(){var t=new e,n=this.data;return t.data=n.slice?n.slice():Array.prototype.slice.call(n),t._len=this._len,t},e.CMD=Uu,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function lm(e,t,n,i,a,r,o){if(0===a)return!1;var s=a,l=0;if(o>t+s&&o>i+s||oe+s&&r>n+s||rt+d&&c>i+d&&c>r+d&&c>s+d||ce+d&&p>n+d&&p>a+d&&p>o+d||pt+p&&l>i+p&&l>r+p||le+p&&s>n+p&&s>a+p||sn||c+pa&&(a+=mm);var u=Math.atan2(l,s);return u<0&&(u+=mm),u>=i&&u<=a||u+mm>=i&&u+mm<=a}function gm(e,t,n,i,a,r){if(r>t&&r>i||ra?s:0}var fm=sm.CMD,ym=2*Math.PI;var vm=[-1,-1,-1],xm=[-1,-1];function bm(){var e=xm[0];xm[0]=xm[1],xm[1]=e}function wm(e,t,n,i,a,r,o,s,l,p){if(p>t&&p>i&&p>r&&p>s||p1&&bm(),m=Sl(t,i,r,s,xm[0]),u>1&&(h=Sl(t,i,r,s,xm[1]))),2===u?ft&&s>i&&s>r||s=0&&c<=1&&(a[l++]=c);else{var p=o*o-4*r*s;if(bl(p))(c=-o/(2*r))>=0&&c<=1&&(a[l++]=c);else if(p>0){var c,d=ul(p),u=(-o-d)/(2*r);(c=(-o+d)/(2*r))>=0&&c<=1&&(a[l++]=c),u>=0&&u<=1&&(a[l++]=u)}}return l}(t,i,r,s,vm);if(0===l)return 0;var p=Dl(t,i,r);if(p>=0&&p<=1){for(var c=0,d=kl(t,i,r,p),u=0;un||s<-n)return 0;var l=Math.sqrt(n*n-s*s);vm[0]=-l,vm[1]=l;var p=Math.abs(i-a);if(p<1e-4)return 0;if(p>=ym-1e-4){i=0,a=ym;var c=r?1:-1;return o>=vm[0]+e&&o<=vm[1]+e?c:0}if(i>a){var d=i;i=a,a=d}i<0&&(i+=ym,a+=ym);for(var u=0,m=0;m<2;m++){var h=vm[m];if(h+e>o){var g=Math.atan2(s,h);c=r?1:-1;g<0&&(g=ym+g),(g>=i&&g<=a||g+ym>=i&&g+ym<=a)&&(g>Math.PI/2&&g<1.5*Math.PI&&(c=-c),u+=c)}}return u}function _m(e,t,n,i,a){for(var r,o,s,l,p=e.data,c=e.len(),d=0,u=0,m=0,h=0,g=0,f=0;f1&&(n||(d+=gm(u,m,h,g,i,a))),v&&(h=u=p[f],g=m=p[f+1]),y){case fm.M:u=h=p[f++],m=g=p[f++];break;case fm.L:if(n){if(lm(u,m,p[f],p[f+1],t,i,a))return!0}else d+=gm(u,m,p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case fm.C:if(n){if(pm(u,m,p[f++],p[f++],p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=wm(u,m,p[f++],p[f++],p[f++],p[f++],p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case fm.Q:if(n){if(cm(u,m,p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=Sm(u,m,p[f++],p[f++],p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case fm.A:var x=p[f++],b=p[f++],w=p[f++],S=p[f++],C=p[f++],_=p[f++];f+=1;var T=!!(1-p[f++]);r=Math.cos(C)*w+x,o=Math.sin(C)*S+b,v?(h=r,g=o):d+=gm(u,m,r,o,i,a);var E=(i-x)*S/w+x;if(n){if(hm(x,b,S,C,C+_,T,t,E,a))return!0}else d+=Cm(x,b,S,C,C+_,T,E,a);u=Math.cos(C+_)*w+x,m=Math.sin(C+_)*S+b;break;case fm.R:if(h=u=p[f++],g=m=p[f++],r=h+p[f++],o=g+p[f++],n){if(lm(h,g,r,g,t,i,a)||lm(r,g,r,o,t,i,a)||lm(r,o,h,o,t,i,a)||lm(h,o,h,g,t,i,a))return!0}else d+=gm(r,g,r,o,i,a),d+=gm(h,o,h,g,i,a);break;case fm.Z:if(n){if(lm(u,m,h,g,t,i,a))return!0}else d+=gm(u,m,h,g,i,a);u=h,m=g}}return n||(s=m,l=g,Math.abs(s-l)<1e-4)||(d+=gm(u,m,h,g,i,a)||0),0!==d}var Tm=qr({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},wu),Em={style:qr({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},Su.style)},Mm=xc.concat(["invisible","culling","z","z2","zlevel","parent"]),Im=function(e){function t(t){return e.call(this,t)||this}var n;return Xe(t,e),t.prototype.update=function(){var n=this;e.prototype.update.call(this);var i=this.style;if(i.decal){var a=this._decalEl=this._decalEl||new t;a.buildPath===t.prototype.buildPath&&(a.buildPath=function(e){n.buildPath(e,n.shape)}),a.silent=!0;var r=a.style;for(var o in i)r[o]!==i[o]&&(r[o]=i[o]);r.fill=i.fill?i.decal:null,r.decal=null,r.shadowColor=null,i.strokeFirst&&(r.stroke=null);for(var s=0;s.5?pc:t>.2?"#eee":cc}if(e)return cc}return pc},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(to(t)){var n=this.__zr;if(!(!n||!n.isDarkMode())===sp(e,0)<.4)return t}},t.prototype.buildPath=function(e,t,n){},t.prototype.pathUpdated=function(){this.__dirty&=-5},t.prototype.getUpdatedPathProxy=function(e){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,e),this.path},t.prototype.createPathProxy=function(){this.path=new sm(!1)},t.prototype.hasStroke=function(){var e=this.style,t=e.stroke;return!(null==t||"none"===t||!(e.lineWidth>0))},t.prototype.hasFill=function(){var e=this.style.fill;return null!=e&&"none"!==e},t.prototype.getBoundingRect=function(){var e=this._rect,t=this.style,n=!e;if(n){var i=!1;this.path||(i=!0,this.createPathProxy());var a=this.path;(i||4&this.__dirty)&&(a.beginPath(),this.buildPath(a,this.shape,!1),this.pathUpdated()),e=a.getBoundingRect()}if(this._rect=e,this.hasStroke()&&this.path&&this.path.len()>0){var r=this._rectStroke||(this._rectStroke=e.clone());if(this.__dirty||n){r.copy(e);var o=t.strokeNoScale?this.getLineScale():1,s=t.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}o>1e-10&&(r.width+=s/o,r.height+=s/o,r.x-=s/o/2,r.y-=s/o/2)}return r}return e},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),i=this.getBoundingRect(),a=this.style;if(e=n[0],t=n[1],i.contain(e,t)){var r=this.path;if(this.hasStroke()){var o=a.lineWidth,s=a.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(o=Math.max(o,this.strokeContainThreshold)),function(e,t,n,i){return _m(e,t,!0,n,i)}(r,o/s,e,t)))return!0}if(this.hasFill())return function(e,t,n){return _m(e,0,!1,t,n)}(r,e,t)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(e){return this.animate("shape",e)},t.prototype.updateDuringAnimation=function(e){"style"===e?this.dirtyStyle():"shape"===e?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(t,n){"shape"===t?this.setShape(n):e.prototype.attrKV.call(this,t,n)},t.prototype.setShape=function(e,t){var n=this.shape;return n||(n=this.shape={}),"string"==typeof e?n[e]=t:Vr(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(4&this.__dirty)},t.prototype.createStyle=function(e){return Io(Tm,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=Vr({},this.shape))},t.prototype._applyStateObj=function(t,n,i,a,r,o){e.prototype._applyStateObj.call(this,t,n,i,a,r,o);var s,l=!(n&&a);if(n&&n.shape?r?a?s=n.shape:(s=Vr({},i.shape),Vr(s,n.shape)):(s=Vr({},a?this.shape:i.shape),Vr(s,n.shape)):l&&(s=i.shape),s)if(r){this.shape=Vr({},this.shape);for(var p={},c=Xr(s),d=0;d0},t.prototype.hasFill=function(){var e=this.style.fill;return null!=e&&"none"!==e},t.prototype.createStyle=function(e){return Io(km,e)},t.prototype.setBoundingRect=function(e){this._rect=e},t.prototype.getBoundingRect=function(){var e=this.style;if(!this._rect){var t=e.text;null!=t?t+="":t="";var n=_c(t,e.font,e.textAlign,e.textBaseline);if(n.x+=e.x||0,n.y+=e.y||0,this.hasStroke()){var i=e.lineWidth;n.x-=i/2,n.y-=i/2,n.width+=i,n.height+=i}this._rect=n}return this._rect},t.initDefaultProps=void(t.prototype.dirtyRectTolerance=10),t}(Tu);Pm.prototype.type="tspan";var Dm=qr({x:0,y:0},wu),Am={style:qr({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},Su.style)};var Om=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.createStyle=function(e){return Io(Dm,e)},t.prototype._getSize=function(e){var t=this.style,n=t[e];if(null!=n)return n;var i,a=(i=t.image)&&"string"!=typeof i&&i.width&&i.height?t.image:this.__image;if(!a)return 0;var r="width"===e?"height":"width",o=t[r];return null==o?a[e]:a[e]/a[r]*o},t.prototype.getWidth=function(){return this._getSize("width")},t.prototype.getHeight=function(){return this._getSize("height")},t.prototype.getAnimationStyleProps=function(){return Am},t.prototype.getBoundingRect=function(){var e=this.style;return this._rect||(this._rect=new zs(e.x||0,e.y||0,this.getWidth(),this.getHeight())),this._rect},t}(Tu);Om.prototype.type="image";var Rm=Math.round;function Bm(e,t,n){if(t){var i=t.x1,a=t.x2,r=t.y1,o=t.y2;e.x1=i,e.x2=a,e.y1=r,e.y2=o;var s=n&&n.lineWidth;return s?(Rm(2*i)===Rm(2*a)&&(e.x1=e.x2=Nm(i,s,!0)),Rm(2*r)===Rm(2*o)&&(e.y1=e.y2=Nm(r,s,!0)),e):e}}function Fm(e,t,n){if(t){var i=t.x,a=t.y,r=t.width,o=t.height;e.x=i,e.y=a,e.width=r,e.height=o;var s=n&&n.lineWidth;return s?(e.x=Nm(i,s,!0),e.y=Nm(a,s,!0),e.width=Math.max(Nm(i+r,s,!1)-e.x,0===r?0:1),e.height=Math.max(Nm(a+o,s,!1)-e.y,0===o?0:1),e):e}}function Nm(e,t,n){if(!t)return e;var i=Rm(2*e);return(i+Rm(t))%2==0?i/2:(i+(n?1:-1))/2}var Lm=function(){this.x=0,this.y=0,this.width=0,this.height=0},Vm={},qm=function(e){function t(t){return e.call(this,t)||this}return Xe(t,e),t.prototype.getDefaultShape=function(){return new Lm},t.prototype.buildPath=function(e,t){var n,i,a,r;if(this.subPixelOptimize){var o=Fm(Vm,t,this.style);n=o.x,i=o.y,a=o.width,r=o.height,o.r=t.r,t=o}else n=t.x,i=t.y,a=t.width,r=t.height;t.r?function(e,t){var n,i,a,r,o,s=t.x,l=t.y,p=t.width,c=t.height,d=t.r;p<0&&(s+=p,p=-p),c<0&&(l+=c,c=-c),"number"==typeof d?n=i=a=r=d:d instanceof Array?1===d.length?n=i=a=r=d[0]:2===d.length?(n=a=d[0],i=r=d[1]):3===d.length?(n=d[0],i=r=d[1],a=d[2]):(n=d[0],i=d[1],a=d[2],r=d[3]):n=i=a=r=0,n+i>p&&(n*=p/(o=n+i),i*=p/o),a+r>p&&(a*=p/(o=a+r),r*=p/o),i+a>c&&(i*=c/(o=i+a),a*=c/o),n+r>c&&(n*=c/(o=n+r),r*=c/o),e.moveTo(s+n,l),e.lineTo(s+p-i,l),0!==i&&e.arc(s+p-i,l+i,i,-Math.PI/2,0),e.lineTo(s+p,l+c-a),0!==a&&e.arc(s+p-a,l+c-a,a,0,Math.PI/2),e.lineTo(s+r,l+c),0!==r&&e.arc(s+r,l+c-r,r,Math.PI/2,Math.PI),e.lineTo(s,l+n),0!==n&&e.arc(s+n,l+n,n,Math.PI,1.5*Math.PI)}(e,t):e.rect(n,i,a,r)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(Im);qm.prototype.type="rect";var Gm={fill:"#000"},zm={style:qr({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},Su.style)},Um=function(e){function t(t){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=Gm,n.attr(t),n}return Xe(t,e),t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var t=0;tm&&c){var h=Math.floor(m/l);n=n.slice(0,h)}if(e&&o&&null!=d)for(var g=cu(d,r,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),f=0;f0,T=null!=e.width&&("truncate"===e.overflow||"break"===e.overflow||"breakAll"===e.overflow),E=i.calculatedLineHeight,M=0;Ml&&fu(n,e.substring(l,p),t,s),fu(n,i[2],t,s,i[1]),l=lu.lastIndex}lr){w>0?(v.tokens=v.tokens.slice(0,w),f(v,b,x),n.lines=n.lines.slice(0,y+1)):n.lines=n.lines.slice(0,y);break e}var M=S.width,I=null==M||"auto"===M;if("string"==typeof M&&"%"===M.charAt(M.length-1))A.percentWidth=M,c.push(A),A.contentWidth=Sc(A.text,T);else{if(I){var k=S.backgroundColor,P=k&&k.image;P&&su(P=au(P))&&(A.width=Math.max(A.width,P.width*E/P.height))}var D=h&&null!=a?a-b:null;null!=D&&D=0&&"right"===(M=x[E]).align;)this._placeToken(M,e,w,h,T,"right",f),S-=M.width,T-=M.width,E--;for(_+=(n-(_-m)-(g-T)-S)/2;C<=E;)M=x[C],this._placeToken(M,e,w,h,_+M.width/2,"center",f),_+=M.width,C++;h+=w}},t.prototype._placeToken=function(e,t,n,i,a,r,o){var s=t.rich[e.styleName]||{};s.text=e.text;var l=e.verticalAlign,p=i+n/2;"top"===l?p=i+e.height/2:"bottom"===l&&(p=i+n-e.height/2),!e.isLineHolder&&th(s)&&this._renderBackground(s,t,"right"===r?a-e.width:"center"===r?a-e.width/2:a,p-e.height/2,e.width,e.height);var c=!!s.backgroundColor,d=e.textPadding;d&&(a=Jm(a,r,d),p-=e.height/2-d[0]-e.innerHeight/2);var u=this._getOrCreateChild(Pm),m=u.createStyle();u.useStyle(m);var h=this._defaultStyle,g=!1,f=0,y=Qm("fill"in s?s.fill:"fill"in t?t.fill:(g=!0,h.fill)),v=Zm("stroke"in s?s.stroke:"stroke"in t?t.stroke:c||o||h.autoStroke&&!g?null:(f=2,h.stroke)),x=s.textShadowBlur>0||t.textShadowBlur>0;m.text=e.text,m.x=a,m.y=p,x&&(m.shadowBlur=s.textShadowBlur||t.textShadowBlur||0,m.shadowColor=s.textShadowColor||t.textShadowColor||"transparent",m.shadowOffsetX=s.textShadowOffsetX||t.textShadowOffsetX||0,m.shadowOffsetY=s.textShadowOffsetY||t.textShadowOffsetY||0),m.textAlign=r,m.textBaseline="middle",m.font=e.font||yr,m.opacity=go(s.opacity,t.opacity,1),Km(m,s),v&&(m.lineWidth=go(s.lineWidth,t.lineWidth,f),m.lineDash=ho(s.lineDash,t.lineDash),m.lineDashOffset=t.lineDashOffset||0,m.stroke=v),y&&(m.fill=y);var b=e.contentWidth,w=e.contentHeight;u.setBoundingRect(new zs(Tc(m.x,b,m.textAlign),Ec(m.y,w,m.textBaseline),b,w))},t.prototype._renderBackground=function(e,t,n,i,a,r){var o,s,l,p=e.backgroundColor,c=e.borderWidth,d=e.borderColor,u=p&&p.image,m=p&&!u,h=e.borderRadius,g=this;if(m||e.lineHeight||c&&d){(o=this._getOrCreateChild(qm)).useStyle(o.createStyle()),o.style.fill=null;var f=o.shape;f.x=n,f.y=i,f.width=a,f.height=r,f.r=h,o.dirtyShape()}if(m)(l=o.style).fill=p||null,l.fillOpacity=ho(e.fillOpacity,1);else if(u){(s=this._getOrCreateChild(Om)).onload=function(){g.dirtyStyle()};var y=s.style;y.image=p.image,y.x=n,y.y=i,y.width=a,y.height=r}c&&d&&((l=o.style).lineWidth=c,l.stroke=d,l.strokeOpacity=ho(e.strokeOpacity,1),l.lineDash=e.borderDash,l.lineDashOffset=e.borderDashOffset||0,o.strokeContainThreshold=0,o.hasFill()&&o.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var v=(o||s).style;v.shadowBlur=e.shadowBlur||0,v.shadowColor=e.shadowColor||"transparent",v.shadowOffsetX=e.shadowOffsetX||0,v.shadowOffsetY=e.shadowOffsetY||0,v.opacity=go(e.opacity,t.opacity,1)},t.makeFont=function(e){var t="";return Ym(e)&&(t=[e.fontStyle,e.fontWeight,$m(e.fontSize),e.fontFamily||"sans-serif"].join(" ")),t&&xo(t)||e.textFont||e.font},t}(Tu),jm={left:!0,right:1,center:1},Hm={top:1,bottom:1,middle:1},Wm=["fontStyle","fontWeight","fontSize","fontFamily"];function $m(e){return"string"!=typeof e||-1===e.indexOf("px")&&-1===e.indexOf("rem")&&-1===e.indexOf("em")?isNaN(+e)?"12px":e+"px":e}function Km(e,t){for(var n=0;n=0,r=!1;if(e instanceof Im){var o=oh(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(fh(s)||fh(l)){var p=(i=i||{}).style||{};"inherit"===p.fill?(r=!0,i=Vr({},i),(p=Vr({},p)).fill=s):!fh(p.fill)&&fh(s)?(r=!0,i=Vr({},i),(p=Vr({},p)).fill=pp(s)):!fh(p.stroke)&&fh(l)&&(r||(i=Vr({},i),p=Vr({},p)),p.stroke=pp(l)),i.style=p}}if(i&&null==i.z2){r||(i=Vr({},i));var c=e.z2EmphasisLift;i.z2=e.z2+(null!=c?c:ch)}return i}(this,0,t,n);if("blur"===e)return function(e,t,n){var i=Gr(e.currentStates,t)>=0,a=e.style.opacity,r=i?null:function(e,t,n,i){for(var a=e.style,r={},o=0;o0){var r={dataIndex:a,seriesIndex:e.seriesIndex};null!=i&&(r.dataType=i),t.push(r)}})}),t}function jh(e,t,n){Xh(e,!0),Th(e,Ih),Wh(e,t,n)}function Hh(e,t,n,i){i?function(e){Xh(e,!1)}(e):jh(e,t,n)}function Wh(e,t,n){var i=nh(e);null!=t?(i.focus=t,i.blurScope=n):i.focus&&(i.focus=null)}var $h=["emphasis","blur","select"],Kh={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Yh(e,t,n,i){n=n||"itemStyle";for(var a=0;a<$h.length;a++){var r=$h[a],o=t.getModel([r,n]);e.ensureState(r).style=i?i(o):o[Kh[n]]()}}function Xh(e,t){var n=!1===t,i=e;e.highDownSilentOnTouch&&(i.__highDownSilentOnTouch=e.highDownSilentOnTouch),n&&!i.__highDownDispatcher||(i.__highByOuter=i.__highByOuter||0,i.__highDownDispatcher=!n)}function Zh(e){return!(!e||!e.__highDownDispatcher)}function Qh(e){var t=e.type;return t===mh||t===hh||t===gh}function Jh(e){var t=e.type;return t===dh||t===uh}var eg=sm.CMD,tg=[[],[],[]],ng=Math.sqrt,ig=Math.atan2;function ag(e,t){if(t){var n,i,a,r,o,s,l=e.data,p=e.len(),c=eg.M,d=eg.C,u=eg.L,m=eg.R,h=eg.A,g=eg.Q;for(a=0,r=0;a1&&(o*=rg(h),s*=rg(h));var g=(a===r?-1:1)*rg((o*o*(s*s)-o*o*(m*m)-s*s*(u*u))/(o*o*(m*m)+s*s*(u*u)))||0,f=g*o*m/s,y=g*-s*u/o,v=(e+n)/2+sg(d)*f-og(d)*y,x=(t+i)/2+og(d)*f+sg(d)*y,b=dg([1,0],[(u-f)/o,(m-y)/s]),w=[(u-f)/o,(m-y)/s],S=[(-1*u-f)/o,(-1*m-y)/s],C=dg(w,S);if(cg(w,S)<=-1&&(C=lg),cg(w,S)>=1&&(C=0),C<0){var _=Math.round(C/lg*1e6)/1e6;C=2*lg+_%2*lg}c.addData(p,v,x,o,s,b,C,d,r)}var mg=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,hg=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var gg=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.applyTransform=function(e){},t}(Im);function fg(e){return null!=e.setData}function yg(e,t){var n=function(e){var t=new sm;if(!e)return t;var n,i=0,a=0,r=i,o=a,s=sm.CMD,l=e.match(mg);if(!l)return t;for(var p=0;pP*P+D*D&&(_=E,T=M),{cx:_,cy:T,x0:-c,y0:-d,x1:_*(a/w-1),y1:T*(a/w-1)}}function Bg(e,t){var n,i=Dg(t.r,0),a=Dg(t.r0||0,0),r=i>0;if(r||a>0){if(r||(i=a,a=0),a>i){var o=i;i=a,a=o}var s=t.startAngle,l=t.endAngle;if(!isNaN(s)&&!isNaN(l)){var p=t.cx,c=t.cy,d=!!t.clockwise,u=kg(l-s),m=u>_g&&u%_g;if(m>Og&&(u=m),i>Og)if(u>_g-Og)e.moveTo(p+i*Eg(s),c+i*Tg(s)),e.arc(p,c,i,s,l,!d),a>Og&&(e.moveTo(p+a*Eg(l),c+a*Tg(l)),e.arc(p,c,a,l,s,d));else{var h=void 0,g=void 0,f=void 0,y=void 0,v=void 0,x=void 0,b=void 0,w=void 0,S=void 0,C=void 0,_=void 0,T=void 0,E=void 0,M=void 0,I=void 0,k=void 0,P=i*Eg(s),D=i*Tg(s),A=a*Eg(l),O=a*Tg(l),R=u>Og;if(R){var B=t.cornerRadius;B&&(n=function(e){var t;if(Jr(e)){var n=e.length;if(!n)return e;t=1===n?[e[0],e[0],0,0]:2===n?[e[0],e[0],e[1],e[1]]:3===n?e.concat(e[2]):e}else t=[e,e,e,e];return t}(B),h=n[0],g=n[1],f=n[2],y=n[3]);var F=kg(i-a)/2;if(v=Ag(F,f),x=Ag(F,y),b=Ag(F,h),w=Ag(F,g),_=S=Dg(v,x),T=C=Dg(b,w),(S>Og||C>Og)&&(E=i*Eg(l),M=i*Tg(l),I=a*Eg(s),k=a*Tg(s),uOg){var j=Ag(f,_),H=Ag(y,_),W=Rg(I,k,P,D,i,j,d),$=Rg(E,M,A,O,i,H,d);e.moveTo(p+W.cx+W.x0,c+W.cy+W.y0),_0&&e.arc(p+W.cx,c+W.cy,j,Ig(W.y0,W.x0),Ig(W.y1,W.x1),!d),e.arc(p,c,i,Ig(W.cy+W.y1,W.cx+W.x1),Ig($.cy+$.y1,$.cx+$.x1),!d),H>0&&e.arc(p+$.cx,c+$.cy,H,Ig($.y1,$.x1),Ig($.y0,$.x0),!d))}else e.moveTo(p+P,c+D),e.arc(p,c,i,s,l,!d);else e.moveTo(p+P,c+D);if(a>Og&&R)if(T>Og){j=Ag(h,T),W=Rg(A,O,E,M,a,-(H=Ag(g,T)),d),$=Rg(P,D,I,k,a,-j,d);e.lineTo(p+W.cx+W.x0,c+W.cy+W.y0),T0&&e.arc(p+W.cx,c+W.cy,H,Ig(W.y0,W.x0),Ig(W.y1,W.x1),!d),e.arc(p,c,a,Ig(W.cy+W.y1,W.cx+W.x1),Ig($.cy+$.y1,$.cx+$.x1),d),j>0&&e.arc(p+$.cx,c+$.cy,j,Ig($.y1,$.x1),Ig($.y0,$.x0),!d))}else e.lineTo(p+A,c+O),e.arc(p,c,a,l,s,d);else e.lineTo(p+A,c+O)}else e.moveTo(p,c);e.closePath()}}}var Fg=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},Ng=function(e){function t(t){return e.call(this,t)||this}return Xe(t,e),t.prototype.getDefaultShape=function(){return new Fg},t.prototype.buildPath=function(e,t){Bg(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(Im);Ng.prototype.type="sector";var Lg=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},Vg=function(e){function t(t){return e.call(this,t)||this}return Xe(t,e),t.prototype.getDefaultShape=function(){return new Lg},t.prototype.buildPath=function(e,t){var n=t.cx,i=t.cy,a=2*Math.PI;e.moveTo(n+t.r,i),e.arc(n,i,t.r,0,a,!1),e.moveTo(n+t.r0,i),e.arc(n,i,t.r0,0,a,!0)},t}(Im);function qg(e,t,n){var i=t.smooth,a=t.points;if(a&&a.length>=2){if(i){var r=function(e,t,n,i){var a,r,o,s,l=[],p=[],c=[],d=[];if(i){o=[1/0,1/0],s=[-1/0,-1/0];for(var u=0,m=e.length;uof[1]){if(o=!1,a)return o;var p=Math.abs(of[0]-rf[1]),c=Math.abs(rf[0]-of[1]);Math.min(p,c)>i.len()&&(p0){var d={duration:c.duration,delay:c.delay||0,easing:c.easing,done:r,force:!!r||!!o,setToFinal:!p,scope:e,during:o};l?t.animateFrom(n,d):t.animateTo(n,d)}else t.stopAnimation(),!l&&t.attr(n),o&&o(1),r&&r()}function gf(e,t,n,i,a,r){hf("update",e,t,n,i,a,r)}function ff(e,t,n,i,a,r){hf("enter",e,t,n,i,a,r)}function yf(e){if(!e.__zr)return!0;for(var t=0;tMath.abs(r[1])?r[0]>0?"right":"left":r[1]>0?"bottom":"top"}function qf(e){return!e.isGroup}function Gf(e,t,n){if(e&&t){var i,a=(i={},e.traverse(function(e){qf(e)&&e.anid&&(i[e.anid]=e)}),i);t.traverse(function(e){if(qf(e)&&e.anid){var t=a[e.anid];if(t){var i=r(e);e.attr(r(t)),gf(e,i,n,nh(e).dataIndex)}}})}function r(e){var t={x:e.x,y:e.y,rotation:e.rotation};return function(e){return null!=e.shape}(e)&&(t.shape=Vr({},e.shape)),t}}function zf(e,t){return Wr(e,function(e){var n=e[0];n=Sf(n,t.x),n=Cf(n,t.x+t.width);var i=e[1];return i=Sf(i,t.y),[n,i=Cf(i,t.y+t.height)]})}function Uf(e,t){var n=Sf(e.x,t.x),i=Cf(e.x+e.width,t.x+t.width),a=Sf(e.y,t.y),r=Cf(e.y+e.height,t.y+t.height);if(i>=n&&r>=a)return{x:n,y:a,width:i-n,height:r-a}}function jf(e,t,n){var i=Vr({rectHover:!0},t),a=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},e)return 0===e.indexOf("image://")?(a.image=e.slice(8),qr(a,n),new Om(i)):Pf(e.replace("path://",""),i,n,"center")}function Hf(e,t,n,i,a){for(var r=0,o=a[a.length-1];r=-1e-6)return!1;var h=e-a,g=t-r,f=$f(h,g,p,c)/m;if(f<0||f>1)return!1;var y=$f(h,g,d,u)/m;return!(y<0||y>1)}function $f(e,t,n,i){return e*i-n*t}function Kf(e){var t=e.itemTooltipOption,n=e.componentModel,i=e.itemName,a=to(t)?{formatter:t}:t,r=n.mainType,o=n.componentIndex,s={componentType:r,name:i,$vars:["name"]};s[r+"Index"]=o;var l=e.formatterParamsExtra;l&&Hr(Xr(l),function(e){Po(s,e)||(s[e]=l[e],s.$vars.push(e))});var p=nh(e.el);p.componentMainType=r,p.componentIndex=o,p.tooltipConfig={name:i,option:qr({content:i,formatterParams:s},a)}}function Yf(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function Xf(e,t){if(e)if(Jr(e))for(var n=0;n-1?ky:Dy;function By(e,t){e=e.toUpperCase(),Oy[e]=new Ty(t),Ay[e]=t}function Fy(e){return Oy[e]}By(Py,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),By(ky,{time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}});var Ny=1e3,Ly=6e4,Vy=36e5,qy=864e5,Gy=31536e6,zy={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Uy="{yyyy}-{MM}-{dd}",jy={year:"{yyyy}",month:"{yyyy}-{MM}",day:Uy,hour:Uy+" "+zy.hour,minute:Uy+" "+zy.minute,second:Uy+" "+zy.second,millisecond:zy.none},Hy=["year","month","day","hour","minute","second","millisecond"],Wy=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function $y(e,t){return"0000".substr(0,t-(e+="").length)+e}function Ky(e){switch(e){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return e}}function Yy(e){return e===Ky(e)}function Xy(e,t,n,i){var a=ld(e),r=a[Jy(n)](),o=a[ev(n)]()+1,s=Math.floor((o-1)/3)+1,l=a[tv(n)](),p=a["get"+(n?"UTC":"")+"Day"](),c=a[nv(n)](),d=(c-1)%12+1,u=a[iv(n)](),m=a[av(n)](),h=a[rv(n)](),g=(i instanceof Ty?i:Fy(i||Ry)||Oy[Dy]).getModel("time"),f=g.get("month"),y=g.get("monthAbbr"),v=g.get("dayOfWeek"),x=g.get("dayOfWeekAbbr");return(t||"").replace(/{yyyy}/g,r+"").replace(/{yy}/g,$y(r%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,f[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,$y(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,$y(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,v[p]).replace(/{ee}/g,x[p]).replace(/{e}/g,p+"").replace(/{HH}/g,$y(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,$y(d+"",2)).replace(/{h}/g,d+"").replace(/{mm}/g,$y(u,2)).replace(/{m}/g,u+"").replace(/{ss}/g,$y(m,2)).replace(/{s}/g,m+"").replace(/{SSS}/g,$y(h,3)).replace(/{S}/g,h+"")}function Zy(e,t){var n=ld(e),i=n[ev(t)]()+1,a=n[tv(t)](),r=n[nv(t)](),o=n[iv(t)](),s=n[av(t)](),l=0===n[rv(t)](),p=l&&0===s,c=p&&0===o,d=c&&0===r,u=d&&1===a;return u&&1===i?"year":u?"month":d?"day":c?"hour":p?"minute":l?"second":"millisecond"}function Qy(e,t,n){var i=io(e)?ld(e):e;switch(t=t||Zy(e,n)){case"year":return i[Jy(n)]();case"half-year":return i[ev(n)]()>=6?1:0;case"quarter":return Math.floor((i[ev(n)]()+1)/4);case"month":return i[ev(n)]();case"day":return i[tv(n)]();case"half-day":return i[nv(n)]()/24;case"hour":return i[nv(n)]();case"minute":return i[iv(n)]();case"second":return i[av(n)]();case"millisecond":return i[rv(n)]()}}function Jy(e){return e?"getUTCFullYear":"getFullYear"}function ev(e){return e?"getUTCMonth":"getMonth"}function tv(e){return e?"getUTCDate":"getDate"}function nv(e){return e?"getUTCHours":"getHours"}function iv(e){return e?"getUTCMinutes":"getMinutes"}function av(e){return e?"getUTCSeconds":"getSeconds"}function rv(e){return e?"getUTCMilliseconds":"getMilliseconds"}function ov(e){return e?"setUTCFullYear":"setFullYear"}function sv(e){return e?"setUTCMonth":"setMonth"}function lv(e){return e?"setUTCDate":"setDate"}function pv(e){return e?"setUTCHours":"setHours"}function cv(e){return e?"setUTCMinutes":"setMinutes"}function dv(e){return e?"setUTCSeconds":"setSeconds"}function uv(e){return e?"setUTCMilliseconds":"setMilliseconds"}function mv(e){if(!hd(e))return to(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function hv(e,t){return e=(e||"").toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var gv=yo;function fv(e,t,n){function i(e){return e&&xo(e)?e:"-"}function a(e){return!(null==e||isNaN(e)||!isFinite(e))}var r="time"===t,o=e instanceof Date;if(r||o){var s=r?ld(e):e;if(!isNaN(+s))return Xy(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(o)return"-"}if("ordinal"===t)return no(e)?i(e):io(e)&&a(e)?e+"":"-";var l=md(e);return a(l)?mv(l):no(e)?i(e):"boolean"==typeof e?e+"":"-"}var yv=["a","b","c","d","e","f","g"],vv=function(e,t){return"{"+e+(null==t?"":t)+"}"};function xv(e,t,n){Jr(t)||(t=[t]);var i=t.length;if(!i)return"";for(var a=t[0].$vars||[],r=0;r':'':{renderMode:r,content:"{"+(n.markerId||"markerX")+"|} ",style:"subItem"===a?{width:4,height:4,borderRadius:2,backgroundColor:i}:{width:10,height:10,borderRadius:5,backgroundColor:i}}:""}function wv(e,t){return t=t||"transparent",to(e)?e:ao(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function Sv(e,t){if("_blank"===t||"blank"===t){var n=window.open();n.opener=null,n.location.href=e}else window.open(e,t)}var Cv=Hr,_v=["left","right","top","bottom","width","height"],Tv=[["width","left","right"],["height","top","bottom"]];function Ev(e,t,n,i,a){var r=0,o=0;null==i&&(i=1/0),null==a&&(a=1/0);var s=0;t.eachChild(function(l,p){var c,d,u=l.getBoundingRect(),m=t.childAt(p+1),h=m&&m.getBoundingRect();if("horizontal"===e){var g=u.width+(h?-h.x+u.x:0);(c=r+g)>i||l.newline?(r=0,c=g,o+=s+n,s=u.height):s=Math.max(s,u.height)}else{var f=u.height+(h?-h.y+u.y:0);(d=o+f)>a||l.newline?(r+=s+n,o=0,d=f,s=u.width):s=Math.max(s,u.width)}l.newline||(l.x=r,l.y=o,l.markRedraw(),"horizontal"===e?r=c+n:o=d+n)})}var Mv=Ev;Qr(Ev,"vertical"),Qr(Ev,"horizontal");function Iv(e,t,n){n=gv(n||0);var i=t.width,a=t.height,r=Zc(e.left,i),o=Zc(e.top,a),s=Zc(e.right,i),l=Zc(e.bottom,a),p=Zc(e.width,i),c=Zc(e.height,a),d=n[2]+n[0],u=n[1]+n[3],m=e.aspect;switch(isNaN(p)&&(p=i-s-u-r),isNaN(c)&&(c=a-l-d-o),null!=m&&(isNaN(p)&&isNaN(c)&&(m>i/a?p=.8*i:c=.8*a),isNaN(p)&&(p=m*c),isNaN(c)&&(c=p/m)),isNaN(r)&&(r=i-s-p-u),isNaN(o)&&(o=a-l-c-d),e.left||e.right){case"center":r=i/2-p/2-n[3];break;case"right":r=i-p-u}switch(e.top||e.bottom){case"middle":case"center":o=a/2-c/2-n[0];break;case"bottom":o=a-c-d}r=r||0,o=o||0,isNaN(p)&&(p=i-u-r-(s||0)),isNaN(c)&&(c=a-d-o-(l||0));var h=new zs(r+n[3],o+n[0],p,c);return h.margin=n,h}function kv(e,t,n,i,a,r){var o,s=!a||!a.hv||a.hv[0],l=!a||!a.hv||a.hv[1],p=a&&a.boundingMode||"all";if((r=r||e).x=e.x,r.y=e.y,!s&&!l)return!1;if("raw"===p)o="group"===e.type?new zs(0,0,+t.width||0,+t.height||0):e.getBoundingRect();else if(o=e.getBoundingRect(),e.needLocalTransform()){var c=e.getLocalTransform();(o=o.clone()).applyTransform(c)}var d=Iv(qr({width:o.width,height:o.height},t),n,i),u=s?d.x-o.x:0,m=l?d.y-o.y:0;return"raw"===p?(r.x=u,r.y=m):(r.x+=u,r.y+=m),r===e&&e.markRedraw(),!0}function Pv(e){var t=e.layoutMode||e.constructor.layoutMode;return ao(t)?t:t?{type:t}:null}function Dv(e,t,n){var i=n&&n.ignoreSize;!Jr(i)&&(i=[i,i]);var a=o(Tv[0],0),r=o(Tv[1],1);function o(n,a){var r={},o=0,p={},c=0;if(Cv(n,function(t){p[t]=e[t]}),Cv(n,function(e){s(t,e)&&(r[e]=p[e]=t[e]),l(r,e)&&o++,l(p,e)&&c++}),i[a])return l(t,n[1])?p[n[2]]=null:l(t,n[2])&&(p[n[1]]=null),p;if(2!==c&&o){if(o>=2)return r;for(var d=0;d=0;o--)r=Nr(r,n[o],!0);t.defaultOption=r}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+"Index",i=e+"Id";return Gd(this.ecModel,e,{index:this.get(n,!0),id:this.get(i,!0)},t)},t.prototype.getBoxLayoutParams=function(){var e=this;return{left:e.get("left"),top:e.get("top"),right:e.get("right"),bottom:e.get("bottom"),width:e.get("width"),height:e.get("height")}},t.prototype.getZLevelKey=function(){return""},t.prototype.setZLevel=function(e){this.option.zlevel=e},t.protoInitialize=function(){var e=t.prototype;e.type="component",e.id="",e.name="",e.mainType="",e.subType="",e.componentIndex=0}(),t}(Ty);Yd(Bv,Ty),Jd(Bv),function(e){var t={};e.registerSubTypeDefaulter=function(e,n){var i=$d(e);t[i.main]=n},e.determineSubType=function(n,i){var a=i.type;if(!a){var r=$d(n).main;e.hasSubTypes(n)&&t[r]&&(a=t[r](i))}return a}}(Bv),function(e,t){function n(e,t){return e[t]||(e[t]={predecessor:[],successor:[]}),e[t]}e.topologicalTravel=function(e,i,a,r){if(e.length){var o=function(e){var i={},a=[];return Hr(e,function(r){var o=n(i,r),s=function(e,t){var n=[];return Hr(e,function(e){Gr(t,e)>=0&&n.push(e)}),n}(o.originalDeps=t(r),e);o.entryCount=s.length,0===o.entryCount&&a.push(r),Hr(s,function(e){Gr(o.predecessor,e)<0&&o.predecessor.push(e);var t=n(i,e);Gr(t.successor,e)<0&&t.successor.push(r)})}),{graph:i,noEntryList:a}}(i),s=o.graph,l=o.noEntryList,p={};for(Hr(e,function(e){p[e]=!0});l.length;){var c=l.pop(),d=s[c],u=!!p[c];u&&(a.call(r,c,d.originalDeps.slice()),delete p[c]),Hr(d.successor,u?h:m)}Hr(p,function(){var e="";throw new Error(e)})}function m(e){s[e].entryCount--,0===s[e].entryCount&&l.push(e)}function h(e){p[e]=!0,m(e)}}}(Bv,function(e){var t=[];Hr(Bv.getClassesByMainType(e),function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])}),t=Wr(t,function(e){return $d(e).main}),"dataset"!==e&&Gr(t,"dataset")<=0&&t.unshift("dataset");return t});var Fv="";"undefined"!=typeof navigator&&(Fv=navigator.platform||"");var Nv="rgba(0, 0, 0, 0.2)",Lv={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Nv,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Nv,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Nv,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Nv,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Nv,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Nv,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:Fv.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},Vv=Eo(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),qv="original",Gv="arrayRows",zv="objectRows",Uv="keyedColumns",jv="typedArray",Hv="unknown",Wv="column",$v="row",Kv=1,Yv=2,Xv=3,Zv=Bd();function Qv(e,t,n){var i={},a=ex(t);if(!a||!e)return i;var r,o,s=[],l=[],p=t.ecModel,c=Zv(p).datasetMap,d=a.uid+"_"+n.seriesLayoutBy;Hr(e=e.slice(),function(t,n){var a=ao(t)?t:e[n]={name:t};"ordinal"===a.type&&null==r&&(r=n,o=h(a)),i[a.name]=[]});var u=c.get(d)||c.set(d,{categoryWayDim:o,valueWayDim:0});function m(e,t,n){for(var i=0;it)return e[i];return e[n-1]}(i,o):n;if((c=c||n)&&c.length){var d=c[l];return a&&(p[a]=d),s.paletteIdx=(l+1)%c.length,d}}var ux="\0_ec_inner";var mx=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.init=function(e,t,n,i,a,r){i=i||{},this.option=null,this._theme=new Ty(i),this._locale=new Ty(a),this._optionManager=r},t.prototype.setOption=function(e,t,n){var i=fx(t);this._optionManager.setOption(e,n,i),this._resetOption(null,i)},t.prototype.resetOption=function(e,t){return this._resetOption(e,fx(t))},t.prototype._resetOption=function(e,t){var n=!1,i=this._optionManager;if(!e||"recreate"===e){var a=i.mountOption("recreate"===e);0,this.option&&"recreate"!==e?(this.restoreData(),this._mergeOption(a,t)):ox(this,a),n=!0}if("timeline"!==e&&"media"!==e||this.restoreData(),!e||"recreate"===e||"timeline"===e){var r=i.getTimelineOption(this);r&&(n=!0,this._mergeOption(r,t))}if(!e||"recreate"===e||"media"===e){var o=i.getMediaOption(this);o.length&&Hr(o,function(e){n=!0,this._mergeOption(e,t)},this)}return n},t.prototype.mergeOption=function(e){this._mergeOption(e,null)},t.prototype._mergeOption=function(e,t){var n=this.option,i=this._componentsMap,a=this._componentsCount,r=[],o=Eo(),s=t&&t.replaceMergeMainTypeMap;Zv(this).datasetMap=Eo(),Hr(e,function(e,t){null!=e&&(Bv.hasClass(t)?t&&(r.push(t),o.set(t,!0)):n[t]=null==n[t]?Fr(e):Nr(n[t],e,!0))}),s&&s.each(function(e,t){Bv.hasClass(t)&&!o.get(t)&&(r.push(t),o.set(t,!0))}),Bv.topologicalTravel(r,Bv.getAllClassMainTypes(),function(t){var r=function(e,t,n){var i=ix.get(t);if(!i)return n;var a=i(e);return a?n.concat(a):n}(this,t,Cd(e[t])),o=i.get(t),l=o?s&&s.get(t)?"replaceMerge":"normalMerge":"replaceAll",p=Id(o,r,l);(function(e,t,n){Hr(e,function(e){var i=e.newOption;ao(i)&&(e.keyInfo.mainType=t,e.keyInfo.subType=function(e,t,n,i){return t.type?t.type:n?n.subType:i.determineSubType(e,t)}(t,i,e.existing,n))})})(p,t,Bv),n[t]=null,i.set(t,null),a.set(t,0);var c,d=[],u=[],m=0;Hr(p,function(e,n){var i=e.existing,a=e.newOption;if(a){var r="series"===t,o=Bv.getClass(t,e.keyInfo.subType,!r);if(!o)return;if("tooltip"===t){if(c)return void 0;c=!0}if(i&&i.constructor===o)i.name=e.keyInfo.name,i.mergeOption(a,this),i.optionUpdated(a,!1);else{var s=Vr({componentIndex:n},e.keyInfo);Vr(i=new o(a,this,this,s),s),e.brandNew&&(i.__requireNewView=!0),i.init(a,this,this),i.optionUpdated(null,!0)}}else i&&(i.mergeOption({},this),i.optionUpdated({},!1));i?(d.push(i.option),u.push(i),m++):(d.push(void 0),u.push(void 0))},this),n[t]=d,i.set(t,u),a.set(t,m),"series"===t&&ax(this)},this),this._seriesIndices||ax(this)},t.prototype.getOption=function(){var e=Fr(this.option);return Hr(e,function(t,n){if(Bv.hasClass(n)){for(var i=Cd(t),a=i.length,r=!1,o=a-1;o>=0;o--)i[o]&&!Od(i[o])?r=!0:(i[o]=null,!r&&a--);i.length=a,e[n]=i}}),delete e[ux],e},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(e){this._payload=e},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(e,t){var n=this._componentsMap.get(e);if(n){var i=n[t||0];if(i)return i;if(null==t)for(var a=0;a=t:"max"===n?e<=t:e===t})(i[o],e,r)||(a=!1)}}),a}var Tx=Hr,Ex=ao,Mx=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function Ix(e){var t=e&&e.itemStyle;if(t)for(var n=0,i=Mx.length;n=0;g--){var f=e[g];if(s||(u=f.data.rawIndexOf(f.stackedByDimension,d)),u>=0){var y=f.data.getByRawIndex(f.stackResultDimension,u);if("all"===l||"positive"===l&&y>0||"negative"===l&&y<0||"samesign"===l&&m>=0&&y>0||"samesign"===l&&m<=0&&y<0){m=ad(m,y),h=y;break}}}return i[0]=m,i[1]=h,i})})}var Wx,$x,Kx,Yx,Xx,Zx=function(e){this.data=e.data||(e.sourceFormat===Uv?{}:[]),this.sourceFormat=e.sourceFormat||Hv,this.seriesLayoutBy=e.seriesLayoutBy||Wv,this.startIndex=e.startIndex||0,this.dimensionsDetectedCount=e.dimensionsDetectedCount,this.metaRawOption=e.metaRawOption;var t=this.dimensionsDefine=e.dimensionsDefine;if(t)for(var n=0;np&&(p=m)}s[0]=l,s[1]=p}},i=function(){return this._data?this._data.length/this._dimSize:0};function a(e){for(var t=0;t=0&&(s=r.interpolatedValue[l])}return null!=s?s+"":""}):void 0},e.prototype.getRawValue=function(e,t){return fb(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function xb(e){var t,n;return ao(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function bb(e){return new wb(e)}var wb=function(){function e(e){e=e||{},this._reset=e.reset,this._plan=e.plan,this._count=e.count,this._onDirty=e.onDirty,this._dirty=!0}return e.prototype.perform=function(e){var t,n=this._upstream,i=e&&e.skip;if(this._dirty&&n){var a=this.context;a.data=a.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!i&&(t=this._plan(this.context));var r,o=c(this._modBy),s=this._modDataCount||0,l=c(e&&e.modBy),p=e&&e.modDataCount||0;function c(e){return!(e>=1)&&(e=1),e}o===l&&s===p||(t="reset"),(this._dirty||"reset"===t)&&(this._dirty=!1,r=this._doReset(i)),this._modBy=l,this._modDataCount=p;var d=e&&e.step;if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var u=this._dueIndex,m=Math.min(null!=d?this._dueIndex+d:1/0,this._dueEnd);if(!i&&(r||u1&&i>0?s:o}};return r;function o(){return t=e?null:rt},gte:function(e,t){return e>=t}},Mb=function(){function e(e,t){if(!io(t)){var n="";0,xd(n)}this._opFn=Eb[e],this._rvalFloat=md(t)}return e.prototype.evaluate=function(e){return io(e)?this._opFn(e,this._rvalFloat):this._opFn(md(e),this._rvalFloat)},e}(),Ib=function(){function e(e,t){var n="desc"===e;this._resultLT=n?1:-1,null==t&&(t=n?"min":"max"),this._incomparable="min"===t?-1/0:1/0}return e.prototype.evaluate=function(e,t){var n=io(e)?e:md(e),i=io(t)?t:md(t),a=isNaN(n),r=isNaN(i);if(a&&(n=this._incomparable),r&&(i=this._incomparable),a&&r){var o=to(e),s=to(t);o&&(n=s?e:0),s&&(i=o?t:0)}return ni?-this._resultLT:0},e}(),kb=function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=md(t)}return e.prototype.evaluate=function(e){var t=e===this._rval;if(!t){var n=typeof e;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(t=md(e)===this._rvalFloat)}return this._isEQ?t:!t},e}();function Pb(e,t){return"eq"===e||"ne"===e?new kb("eq"===e,t):Po(Eb,e)?new Mb(e,t):null}var Db=function(){function e(){}return e.prototype.getRawData=function(){throw new Error("not supported")},e.prototype.getRawDataItem=function(e){throw new Error("not supported")},e.prototype.cloneRawData=function(){},e.prototype.getDimensionInfo=function(e){},e.prototype.cloneAllDimensionInfo=function(){},e.prototype.count=function(){},e.prototype.retrieveValue=function(e,t){},e.prototype.retrieveValueFromItem=function(e,t){},e.prototype.convertValue=function(e,t){return Cb(e,t)},e}();function Ab(e){var t=e.sourceFormat;if(!Lb(t)){var n="";0,xd(n)}return e.data}function Ob(e){var t=e.sourceFormat,n=e.data;if(!Lb(t)){var i="";0,xd(i)}if(t===Gv){for(var a=[],r=0,o=n.length;r65535?Gb:zb}function $b(){return[1/0,-1/0]}function Kb(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function Yb(e,t,n,i,a){var r=Hb[n||"float"];if(a){var o=e[t],s=o&&o.length;if(s!==i){for(var l=new r(i),p=0;pg[1]&&(g[1]=h)}return this._rawCount=this._count=s,{start:o,end:s}},e.prototype._initDataFromProvider=function(e,t,n){for(var i=this._provider,a=this._chunks,r=this._dimensions,o=r.length,s=this._rawExtent,l=Wr(r,function(e){return e.property}),p=0;pf[1]&&(f[1]=g)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=t,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(e,t){if(!(t>=0&&t=0&&t=this._rawCount||e<0)return-1;if(!this._indices)return e;var t=this._indices,n=t[e];if(null!=n&&ne))return r;a=r-1}}return-1},e.prototype.indicesOfNearest=function(e,t,n){var i=this._chunks[e],a=[];if(!i)return a;null==n&&(n=1/0);for(var r=1/0,o=-1,s=0,l=0,p=this.count();l=0&&o<0)&&(r=d,o=c,s=0),c===o&&(a[s++]=l))}return a.length=s,a},e.prototype.getIndices=function(){var e,t=this._indices;if(t){var n=t.constructor,i=this._count;if(n===Array){e=new n(i);for(var a=0;a=p&&x<=c||isNaN(x))&&(o[s++]=m),m++}u=!0}else if(2===a){h=d[i[0]];var f=d[i[1]],y=e[i[1]][0],v=e[i[1]][1];for(g=0;g=p&&x<=c||isNaN(x))&&(b>=y&&b<=v||isNaN(b))&&(o[s++]=m),m++}u=!0}}if(!u)if(1===a)for(g=0;g=p&&x<=c||isNaN(x))&&(o[s++]=w)}else for(g=0;ge[_][1])&&(S=!1)}S&&(o[s++]=t.getRawIndex(g))}return sf[1]&&(f[1]=g)}}}},e.prototype.lttbDownSample=function(e,t){var n,i,a,r=this.clone([e],!0),o=r._chunks[e],s=this.count(),l=0,p=Math.floor(1/t),c=this.getRawIndex(0),d=new(Wb(this._rawCount))(Math.min(2*(Math.ceil(s/p)+2),s));d[l++]=c;for(var u=1;un&&(n=i,a=T)}_>0&&_p-m&&(s=p-m,o.length=s);for(var h=0;hc[1]&&(c[1]=f),d[u++]=y}return a._count=u,a._indices=d,a._updateGetRawIdx(),a},e.prototype.each=function(e,t){if(this._count)for(var n=e.length,i=this._chunks,a=0,r=this.count();ao&&(o=l)}return i=[r,o],this._extent[e]=i,i},e.prototype.getRawDataItem=function(e){var t=this.getRawIndex(e);if(this._provider.persistent)return this._provider.getItem(t);for(var n=[],i=this._chunks,a=0;a=0?this._indices[e]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function e(e,t,n,i){return Cb(e[i],this._dimensions[i])}Vb={arrayRows:e,objectRows:function(e,t,n,i){return Cb(e[t],this._dimensions[i])},keyedColumns:e,original:function(e,t,n,i){var a=e&&(null==e.value?e:e.value);return Cb(a instanceof Array?a[i]:a,this._dimensions[i])},typedArray:function(e,t,n,i){return e[i]}}}(),e}(),Zb=function(){function e(e){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=e}return e.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},e.prototype._setLocalSource=function(e,t){this._sourceList=e,this._upstreamSignList=t,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var e,t,n=this._sourceHost,i=this._getUpstreamSourceManagers(),a=!!i.length;if(Jb(n)){var r=n,o=void 0,s=void 0,l=void 0;if(a){var p=i[0];p.prepareSource(),o=(l=p.getSource()).data,s=l.sourceFormat,t=[p._getVersionSign()]}else s=oo(o=r.get("data",!0))?jv:qv,t=[];var c=this._getSourceMetaRawOption()||{},d=l&&l.metaRawOption||{},u=ho(c.seriesLayoutBy,d.seriesLayoutBy)||null,m=ho(c.sourceHeader,d.sourceHeader),h=ho(c.dimensions,d.dimensions);e=u!==d.seriesLayoutBy||!!m!=!!d.sourceHeader||h?[Jx(o,{seriesLayoutBy:u,sourceHeader:m,dimensions:h},s)]:[]}else{var g=n;if(a){var f=this._applyTransform(i);e=f.sourceList,t=f.upstreamSignList}else{e=[Jx(g.get("source",!0),this._getSourceMetaRawOption(),null)],t=[]}}this._setLocalSource(e,t)},e.prototype._applyTransform=function(e){var t,n=this._sourceHost,i=n.get("transform",!0),a=n.get("fromTransformResult",!0);if(null!=a){var r="";1!==e.length&&ew(r)}var o,s=[],l=[];return Hr(e,function(e){e.prepareSource();var t=e.getSource(a||0),n="";null==a||t||ew(n),s.push(t),l.push(e._getVersionSign())}),i?t=function(e,t){var n=Cd(e),i=n.length,a="";i||xd(a);for(var r=0,o=i;r1||n>0&&!e.noHeader;return Hr(e.blocks,function(e){var n=lw(e);n>=t&&(t=n+ +(i&&(!n||ow(e)&&!e.noHeader)))}),t}return 0}function pw(e,t,n,i){var a,r=t.noHeader,o=(a=lw(t),{html:iw[a],richText:aw[a]}),s=[],l=t.blocks||[];vo(!l||Jr(l)),l=l||[];var p=e.orderMode;if(t.sortBlocks&&p){l=l.slice();var c={valueAsc:"asc",valueDesc:"desc"};if(Po(c,p)){var d=new Ib(c[p],null);l.sort(function(e,t){return d.evaluate(e.sortParam,t.sortParam)})}else"seriesDesc"===p&&l.reverse()}Hr(l,function(n,a){var r=t.valueFormatter,l=sw(n)(r?Vr(Vr({},e),{valueFormatter:r}):e,n,a>0?o.html:0,i);null!=l&&s.push(l)});var u="richText"===e.renderMode?s.join(o.richText):uw(s.join(""),r?n:o.html);if(r)return u;var m=fv(t.header,"ordinal",e.useUTC),h=nw(i,e.renderMode).nameStyle;return"richText"===e.renderMode?mw(e,m,h)+o.richText+u:uw('
'+ps(m)+"
"+u,n)}function cw(e,t,n,i){var a=e.renderMode,r=t.noName,o=t.noValue,s=!t.markerType,l=t.name,p=e.useUTC,c=t.valueFormatter||e.valueFormatter||function(e){return Wr(e=Jr(e)?e:[e],function(e,t){return fv(e,Jr(m)?m[t]:m,p)})};if(!r||!o){var d=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||"#333",a),u=r?"":fv(l,"ordinal",p),m=t.valueType,h=o?[]:c(t.value,t.dataIndex),g=!s||!r,f=!s&&r,y=nw(i,a),v=y.nameStyle,x=y.valueStyle;return"richText"===a?(s?"":d)+(r?"":mw(e,u,v))+(o?"":function(e,t,n,i,a){var r=[a],o=i?10:20;return n&&r.push({padding:[0,0,0,o],align:"right"}),e.markupStyleCreator.wrapRichTextStyle(Jr(t)?t.join(" "):t,r)}(e,h,g,f,x)):uw((s?"":d)+(r?"":function(e,t,n){return''+ps(e)+""}(u,!s,v))+(o?"":function(e,t,n,i){var a=n?"10px":"20px",r=t?"float:right;margin-left:"+a:"";return e=Jr(e)?e:[e],''+Wr(e,function(e){return ps(e)}).join("  ")+""}(h,g,f,x)),n)}}function dw(e,t,n,i,a,r){if(e)return sw(e)({useUTC:a,renderMode:n,orderMode:i,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,r)}function uw(e,t){return'
'+e+'
'}function mw(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function hw(e,t){return wv(e.getData().getItemVisual(t,"style")[e.visualDrawType])}function gw(e,t){var n=e.get("padding");return null!=n?n:"richText"===t?[8,10]:10}var fw=function(){function e(){this.richTextStyles={},this._nextStyleNameId=gd()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,t,n){var i="richText"===n?this._generateStyleName():null,a=bv({color:t,type:e,renderMode:n,markerId:i});return to(a)?a:(this.richTextStyles[i]=a.style,a.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};Jr(t)?Hr(t,function(e){return Vr(n,e)}):Vr(n,t);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+e+"}"},e}();function yw(e){var t,n,i,a,r=e.series,o=e.dataIndex,s=e.multipleSeries,l=r.getData(),p=l.mapDimensionsAll("defaultedTooltip"),c=p.length,d=r.getRawValue(o),u=Jr(d),m=hw(r,o);if(c>1||u&&!c){var h=function(e,t,n,i,a){var r=t.getData(),o=$r(e,function(e,t,n){var i=r.getDimensionInfo(n);return e||i&&!1!==i.tooltip&&null!=i.displayName},!1),s=[],l=[],p=[];function c(e,t){var n=r.getDimensionInfo(t);n&&!1!==n.otherDims.tooltip&&(o?p.push(rw("nameValue",{markerType:"subItem",markerColor:a,name:n.displayName,value:e,valueType:n.type})):(s.push(e),l.push(n.type)))}return i.length?Hr(i,function(e){c(fb(r,n,e),e)}):Hr(e,c),{inlineValues:s,inlineValueTypes:l,blocks:p}}(d,r,o,p,m);t=h.inlineValues,n=h.inlineValueTypes,i=h.blocks,a=h.inlineValues[0]}else if(c){var g=l.getDimensionInfo(p[0]);a=t=fb(l,o,p[0]),n=g.type}else a=t=u?d[0]:d;var f=Ad(r),y=f&&r.name||"",v=l.getName(o),x=s?y:v;return rw("section",{header:y,noHeader:s||!f,sortParam:a,blocks:[rw("nameValue",{markerType:"item",markerColor:m,name:x,noName:!xo(x),value:t,valueType:n,dataIndex:o})].concat(i||[])})}var vw=Bd();function xw(e,t){return e.getName(t)||e.getId(t)}var bw="__universalTransitionEnabled",ww=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return Xe(t,e),t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=bb({count:Cw,reset:_w}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(vw(this).sourceManager=new Zb(this)).prepareSource();var i=this.getInitialData(e,n);Ew(i,this),this.dataTask.context.data=i,vw(this).dataBeforeProcessed=i,Sw(this),this._initSelectedMapFromData(i)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=Pv(this),i=n?Av(e):{},a=this.subType;Bv.hasClass(a)&&(a+="Series"),Nr(e,t.getTheme().get(this.subType)),Nr(e,this.getDefaultOption()),_d(e,"label",["show"]),this.fillDataTextStyle(e.data),n&&Dv(e,i,n)},t.prototype.mergeOption=function(e,t){e=Nr(this.option,e,!0),this.fillDataTextStyle(e.data);var n=Pv(this);n&&Dv(this.option,e,n);var i=vw(this).sourceManager;i.dirty(),i.prepareSource();var a=this.getInitialData(e,t);Ew(a,this),this.dataTask.dirty(),this.dataTask.context.data=a,vw(this).dataBeforeProcessed=a,Sw(this),this._initSelectedMapFromData(a)},t.prototype.fillDataTextStyle=function(e){if(e&&!oo(e))for(var t=["show"],n=0;nthis.getShallow("animationThreshold")&&(t=!1),!!t},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(e,t,n){var i=this.ecModel,a=px.prototype.getColorFromPalette.call(this,e,t,n);return a||(a=i.getColorFromPalette(e,t,n)),a},t.prototype.coordDimToDataDim=function(e){return this.getRawData().mapDimensionsAll(e)},t.prototype.getProgressive=function(){return this.get("progressive")},t.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},t.prototype.select=function(e,t){this._innerSelect(this.getData(t),e)},t.prototype.unselect=function(e,t){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,a=this.getData(t);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var r=0;r=0&&n.push(a)}return n},t.prototype.isSelected=function(e,t){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(t);return("all"===n||n[xw(i,e)])&&!i.getItemModel(e).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[bw])return!0;var e=this.option.universalTransition;return!!e&&(!0===e||e&&e.enabled)},t.prototype._innerSelect=function(e,t){var n,i,a=this.option,r=a.selectedMode,o=t.length;if(r&&o)if("series"===r)a.selectedMap="all";else if("multiple"===r){ao(a.selectedMap)||(a.selectedMap={});for(var s=a.selectedMap,l=0;l0&&this._innerSelect(e,t)}},t.registerClass=function(e){return Bv.registerClass(e)},t.protoInitialize=function(){var e=t.prototype;e.type="series.__base__",e.seriesIndex=0,e.ignoreStyleOnData=!1,e.hasSymbolVisual=!1,e.defaultSymbol="circle",e.visualStyleAccessPath="itemStyle",e.visualDrawType="fill"}(),t}(Bv);function Sw(e){var t=e.name;Ad(e)||(e.name=function(e){var t=e.getRawData(),n=t.mapDimensionsAll("seriesName"),i=[];return Hr(n,function(e){var n=t.getDimensionInfo(e);n.displayName&&i.push(n.displayName)}),i.join(" ")}(e)||t)}function Cw(e){return e.model.getRawData().count()}function _w(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),Tw}function Tw(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function Ew(e,t){Hr(Mo(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(n){e.wrapMethod(n,Qr(Mw,t))})}function Mw(e,t){var n=Iw(e);return n&&n.setOutputEnd((t||this).count()),t}function Iw(e){var t=(e.ecModel||{}).scheduler,n=t&&t.getPipeline(e.uid);if(n){var i=n.currentTask;if(i){var a=i.agentStubMap;a&&(i=a.get(e.uid))}return i}}Ur(ww,vb),Ur(ww,px),Yd(ww,Bv);var kw=function(){function e(){this.group=new qc,this.uid=My("viewComponent")}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,i){},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,i){},e.prototype.updateLayout=function(e,t,n,i){},e.prototype.updateVisual=function(e,t,n,i){},e.prototype.toggleBlurSeries=function(e,t,n){},e.prototype.eachRendered=function(e){var t=this.group;t&&t.traverse(e)},e}();function Pw(){var e=Bd();return function(t){var n=e(t),i=t.pipelineContext,a=!!n.large,r=!!n.progressiveRender,o=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(a===o&&r===s)&&"reset"}}Kd(kw),Jd(kw);var Dw=Bd(),Aw=Pw(),Ow=function(){function e(){this.group=new qc,this.uid=My("viewChart"),this.renderTask=bb({plan:Fw,reset:Nw}),this.renderTask.context={view:this}}return e.prototype.init=function(e,t){},e.prototype.render=function(e,t,n,i){0},e.prototype.highlight=function(e,t,n,i){var a=e.getData(i&&i.dataType);a&&Bw(a,i,"emphasis")},e.prototype.downplay=function(e,t,n,i){var a=e.getData(i&&i.dataType);a&&Bw(a,i,"normal")},e.prototype.remove=function(e,t){this.group.removeAll()},e.prototype.dispose=function(e,t){},e.prototype.updateView=function(e,t,n,i){this.render(e,t,n,i)},e.prototype.updateLayout=function(e,t,n,i){this.render(e,t,n,i)},e.prototype.updateVisual=function(e,t,n,i){this.render(e,t,n,i)},e.prototype.eachRendered=function(e){Xf(this.group,e)},e.markUpdateMethod=function(e,t){Dw(e).updateMethod=t},e.protoInitialize=void(e.prototype.type="chart"),e}();function Rw(e,t,n){e&&Zh(e)&&("emphasis"===t?Dh:Ah)(e,n)}function Bw(e,t,n){var i=Rd(e,t),a=t&&null!=t.highlightKey?function(e){var t=rh[e];return null==t&&ah<=32&&(t=rh[e]=ah++),t}(t.highlightKey):null;null!=i?Hr(Cd(i),function(t){Rw(e.getItemGraphicEl(t),n,a)}):e.eachItemGraphicEl(function(e){Rw(e,n,a)})}function Fw(e){return Aw(e.model)}function Nw(e){var t=e.model,n=e.ecModel,i=e.api,a=e.payload,r=t.pipelineContext.progressiveRender,o=e.view,s=a&&Dw(a).updateMethod,l=r?"incrementalPrepareRender":s&&o[s]?s:"render";return"render"!==l&&o[l](t,n,i,a),Lw[l]}Kd(Ow),Jd(Ow);var Lw={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},Vw="\0__throttleOriginMethod",qw="\0__throttleRate",Gw="\0__throttleType";function zw(e,t,n){var i,a,r,o,s,l=0,p=0,c=null;function d(){p=(new Date).getTime(),c=null,e.apply(r,o||[])}t=t||0;var u=function(){for(var e=[],u=0;u=0?d():c=setTimeout(d,-a),l=i};return u.clear=function(){c&&(clearTimeout(c),c=null)},u.debounceNextCall=function(e){s=e},u}function Uw(e,t,n,i){var a=e[t];if(a){var r=a[Vw]||a,o=a[Gw];if(a[qw]!==n||o!==i){if(null==n||!i)return e[t]=r;(a=e[t]=zw(r,n,"debounce"===i))[Vw]=r,a[Gw]=i,a[qw]=n}return a}}function jw(e,t){var n=e[t];n&&n[Vw]&&(n.clear&&n.clear(),e[t]=n[Vw])}var Hw=Bd(),Ww={itemStyle:eu(Sy,!0),lineStyle:eu(xy,!0)},$w={lineStyle:"stroke",itemStyle:"fill"};function Kw(e,t){var n=e.visualStyleMapper||Ww[t];return n||(console.warn("Unknown style type '"+t+"'."),Ww.itemStyle)}function Yw(e,t){var n=e.visualDrawType||$w[t];return n||(console.warn("Unknown style type '"+t+"'."),"fill")}var Xw={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=e.getModel(i),r=Kw(e,i)(a),o=a.getShallow("decal");o&&(n.setVisual("decal",o),o.dirty=!0);var s=Yw(e,i),l=r[s],p=eo(l)?l:null,c="auto"===r.fill||"auto"===r.stroke;if(!r[s]||p||c){var d=e.getColorFromPalette(e.name,null,t.getSeriesCount());r[s]||(r[s]=d,n.setVisual("colorFromPalette",!0)),r.fill="auto"===r.fill||eo(r.fill)?d:r.fill,r.stroke="auto"===r.stroke||eo(r.stroke)?d:r.stroke}if(n.setVisual("style",r),n.setVisual("drawType",s),!t.isSeriesFiltered(e)&&p)return n.setVisual("colorFromPalette",!1),{dataEach:function(t,n){var i=e.getDataParams(n),a=Vr({},r);a[s]=p(i),t.setItemVisual(n,"style",a)}}}},Zw=new Ty,Qw={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData&&!t.isSeriesFiltered(e)){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=Kw(e,i),r=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[i]){Zw.option=n[i];var o=a(Zw);Vr(e.ensureUniqueItemVisual(t,"style"),o),Zw.option.decal&&(e.setItemVisual(t,"decal",Zw.option.decal),Zw.option.decal.dirty=!0),r in o&&e.setItemVisual(t,"colorFromPalette",!1)}}:null}}}},Jw={performRawSeries:!0,overallReset:function(e){var t=Eo();e.eachSeries(function(e){var n=e.getColorBy();if(!e.isColorBySeries()){var i=e.type+"-"+n,a=t.get(i);a||(a={},t.set(i,a)),Hw(e).scope=a}}),e.eachSeries(function(t){if(!t.isColorBySeries()&&!e.isSeriesFiltered(t)){var n=t.getRawData(),i={},a=t.getData(),r=Hw(t).scope,o=t.visualStyleAccessPath||"itemStyle",s=Yw(t,o);a.each(function(e){var t=a.getRawIndex(e);i[t]=e}),n.each(function(e){var o=i[e];if(a.getItemVisual(o,"colorFromPalette")){var l=a.ensureUniqueItemVisual(o,"style"),p=n.getName(e)||e+"",c=n.count();l[s]=t.getColorFromPalette(p,r,c)}})}})}},eS=Math.PI;var tS=function(){function e(e,t,n,i){this._stageTaskMap=Eo(),this.ecInstance=e,this.api=t,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return e.prototype.restoreData=function(e,t){e.restoreData(t),this._stageTaskMap.each(function(e){var t=e.overallTask;t&&t.dirty()})},e.prototype.getPerformArgs=function(e,t){if(e.__pipeline){var n=this._pipelineMap.get(e.__pipeline.id),i=n.context,a=!t&&n.progressiveEnabled&&(!i||i.progressiveRender)&&e.__idxInPipeline>n.blockIndex?n.step:null,r=i&&i.modDataCount;return{step:a,modBy:null!=r?Math.ceil(r/a):null,modDataCount:r}}},e.prototype.getPipeline=function(e){return this._pipelineMap.get(e)},e.prototype.updateStreamModes=function(e,t){var n=this._pipelineMap.get(e.uid),i=e.getData().count(),a=n.progressiveEnabled&&t.incrementalPrepareRender&&i>=n.threshold,r=e.get("large")&&i>=e.get("largeThreshold"),o="mod"===e.get("progressiveChunkMode")?i:null;e.pipelineContext=n.context={progressiveRender:a,modDataCount:o,large:r}},e.prototype.restorePipelines=function(e){var t=this,n=t._pipelineMap=Eo();e.eachSeries(function(e){var i=e.getProgressive(),a=e.uid;n.set(a,{id:a,head:null,tail:null,threshold:e.getProgressiveThreshold(),progressiveEnabled:i&&!(e.preventIncremental&&e.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),t._pipe(e,e.dataTask)})},e.prototype.prepareStageTasks=function(){var e=this._stageTaskMap,t=this.api.getModel(),n=this.api;Hr(this._allHandlers,function(i){var a=e.get(i.uid)||e.set(i.uid,{}),r="";vo(!(i.reset&&i.overallReset),r),i.reset&&this._createSeriesStageTask(i,a,t,n),i.overallReset&&this._createOverallStageTask(i,a,t,n)},this)},e.prototype.prepareView=function(e,t,n,i){var a=e.renderTask,r=a.context;r.model=t,r.ecModel=n,r.api=i,a.__block=!e.incrementalPrepareRender,this._pipe(t,a)},e.prototype.performDataProcessorTasks=function(e,t){this._performStageTasks(this._dataProcessorHandlers,e,t,{block:!0})},e.prototype.performVisualTasks=function(e,t,n){this._performStageTasks(this._visualHandlers,e,t,n)},e.prototype._performStageTasks=function(e,t,n,i){i=i||{};var a=!1,r=this;function o(e,t){return e.setDirty&&(!e.dirtyMap||e.dirtyMap.get(t.__pipeline.id))}Hr(e,function(e,s){if(!i.visualType||i.visualType===e.visualType){var l=r._stageTaskMap.get(e.uid),p=l.seriesTaskMap,c=l.overallTask;if(c){var d,u=c.agentStubMap;u.each(function(e){o(i,e)&&(e.dirty(),d=!0)}),d&&c.dirty(),r.updatePayload(c,n);var m=r.getPerformArgs(c,i.block);u.each(function(e){e.perform(m)}),c.perform(m)&&(a=!0)}else p&&p.each(function(s,l){o(i,s)&&s.dirty();var p=r.getPerformArgs(s,i.block);p.skip=!e.performRawSeries&&t.isSeriesFiltered(s.context.model),r.updatePayload(s,n),s.perform(p)&&(a=!0)})}}),this.unfinished=a||this.unfinished},e.prototype.performSeriesTasks=function(e){var t;e.eachSeries(function(e){t=e.dataTask.perform()||t}),this.unfinished=t||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(e){var t=e.tail;do{if(t.__block){e.blockIndex=t.__idxInPipeline;break}t=t.getUpstream()}while(t)})},e.prototype.updatePayload=function(e,t){"remain"!==t&&(e.context.payload=t)},e.prototype._createSeriesStageTask=function(e,t,n,i){var a=this,r=t.seriesTaskMap,o=t.seriesTaskMap=Eo(),s=e.seriesType,l=e.getTargetSeries;function p(t){var s=t.uid,l=o.set(s,r&&r.get(s)||bb({plan:oS,reset:sS,count:cS}));l.context={model:t,ecModel:n,api:i,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:a},a._pipe(t,l)}e.createOnAllSeries?n.eachRawSeries(p):s?n.eachRawSeriesByType(s,p):l&&l(n,i).each(p)},e.prototype._createOverallStageTask=function(e,t,n,i){var a=this,r=t.overallTask=t.overallTask||bb({reset:nS});r.context={ecModel:n,api:i,overallReset:e.overallReset,scheduler:a};var o=r.agentStubMap,s=r.agentStubMap=Eo(),l=e.seriesType,p=e.getTargetSeries,c=!0,d=!1,u="";function m(e){var t=e.uid,n=s.set(t,o&&o.get(t)||(d=!0,bb({reset:iS,onDirty:rS})));n.context={model:e,overallProgress:c},n.agent=r,n.__block=c,a._pipe(e,n)}vo(!e.createOnAllSeries,u),l?n.eachRawSeriesByType(l,m):p?p(n,i).each(m):(c=!1,Hr(n.getSeries(),m)),d&&r.dirty()},e.prototype._pipe=function(e,t){var n=e.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=t),i.tail&&i.tail.pipe(t),i.tail=t,t.__idxInPipeline=i.count++,t.__pipeline=i},e.wrapStageHandler=function(e,t){return eo(e)&&(e={overallReset:e,seriesType:dS(e)}),e.uid=My("stageHandler"),t&&(e.visualType=t),e},e}();function nS(e){e.overallReset(e.ecModel,e.api,e.payload)}function iS(e){return e.overallProgress&&aS}function aS(){this.agent.dirty(),this.getDownstream().dirty()}function rS(){this.agent&&this.agent.dirty()}function oS(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function sS(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Cd(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?Wr(t,function(e,t){return pS(t)}):lS}var lS=pS(0);function pS(e){return function(t,n){var i=n.data,a=n.resetDefines[e];if(a&&a.dataEach)for(var r=t.start;r0&&c===a.length-p.length){var d=a.slice(0,c);"data"!==d&&(t.mainType=d,t[p.toLowerCase()]=e,s=!0)}}o.hasOwnProperty(a)&&(n[a]=e,s=!0),s||(i[a]=e)})}return{cptQuery:t,dataQuery:n,otherQuery:i}},e.prototype.filter=function(e,t){var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,a=n.packedEvent,r=n.model,o=n.view;if(!r||!o)return!0;var s=t.cptQuery,l=t.dataQuery;return p(s,r,"mainType")&&p(s,r,"subType")&&p(s,r,"index","componentIndex")&&p(s,r,"name")&&p(s,r,"id")&&p(l,a,"name")&&p(l,a,"dataIndex")&&p(l,a,"dataType")&&(!o.filterForExposedEvent||o.filterForExposedEvent(e,t.otherQuery,i,a));function p(e,t,n,i){return null==e[n]||t[i||n]===e[n]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),_S=["symbol","symbolSize","symbolRotate","symbolOffset"],TS=_S.concat(["symbolKeepAspect"]),ES={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData();if(e.legendIcon&&n.setVisual("legendIcon",e.legendIcon),e.hasSymbolVisual){for(var i={},a={},r=!1,o=0;o<_S.length;o++){var s=_S[o],l=e.get(s);eo(l)?(r=!0,a[s]=l):i[s]=l}if(i.symbol=i.symbol||e.defaultSymbol,n.setVisual(Vr({legendIcon:e.legendIcon||i.symbol,symbolKeepAspect:e.get("symbolKeepAspect")},i)),!t.isSeriesFiltered(e)){var p=Xr(a);return{dataEach:r?function(t,n){for(var i=e.getRawValue(n),r=e.getDataParams(n),o=0;o=0&&KS(l)?l:.5,e.createRadialGradient(o,s,0,o,s,l)}(e,t,n):function(e,t,n){var i=null==t.x?0:t.x,a=null==t.x2?1:t.x2,r=null==t.y?0:t.y,o=null==t.y2?0:t.y2;return t.global||(i=i*n.width+n.x,a=a*n.width+n.x,r=r*n.height+n.y,o=o*n.height+n.y),i=KS(i)?i:0,a=KS(a)?a:1,r=KS(r)?r:0,o=KS(o)?o:0,e.createLinearGradient(i,r,a,o)}(e,t,n),a=t.colorStops,r=0;r0&&(t=i.lineDash,n=i.lineWidth,t&&"solid"!==t&&n>0?"dashed"===t?[4*n,2*n]:"dotted"===t?[n]:io(t)?[t]:Jr(t)?t:null:null),r=i.lineDashOffset;if(a){var o=i.strokeNoScale&&e.getLineScale?e.getLineScale():1;o&&1!==o&&(a=Wr(a,function(e){return e/o}),r/=o)}return[a,r]}var JS=new sm(!0);function eC(e){var t=e.stroke;return!(null==t||"none"===t||!(e.lineWidth>0))}function tC(e){return"string"==typeof e&&"none"!==e}function nC(e){var t=e.fill;return null!=t&&"none"!==t}function iC(e,t){if(null!=t.fillOpacity&&1!==t.fillOpacity){var n=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=n}else e.fill()}function aC(e,t){if(null!=t.strokeOpacity&&1!==t.strokeOpacity){var n=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=n}else e.stroke()}function rC(e,t,n){var i=ru(t.image,t.__image,n);if(su(i)){var a=e.createPattern(i,t.repeat||"repeat");if("function"==typeof DOMMatrix&&a&&a.setTransform){var r=new DOMMatrix;r.translateSelf(t.x||0,t.y||0),r.rotateSelf(0,0,(t.rotation||0)*Ao),r.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(r)}return a}}var oC=["shadowBlur","shadowOffsetX","shadowOffsetY"],sC=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function lC(e,t,n,i,a){var r=!1;if(!i&&t===(n=n||{}))return!1;if(i||t.opacity!==n.opacity){dC(e,a),r=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?wu.opacity:o}(i||t.blend!==n.blend)&&(r||(dC(e,a),r=!0),e.globalCompositeOperation=t.blend||wu.blend);for(var s=0;s0&&e.unfinished);e.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(e,t,n){if(!this[IC])if(this._disposed)r_(this.id);else{var i,a,r;if(ao(t)&&(n=t.lazyUpdate,i=t.silent,a=t.replaceMerge,r=t.transition,t=t.notMerge),this[IC]=!0,!this._model||t){var o=new Cx(this._api),s=this._theme,l=this._model=new mx;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:a},p_);var p={seriesTransition:r,optionChanged:!0};if(n)this[kC]={silent:i,updateParams:p},this[IC]=!1,this.getZr().wakeUp();else{try{FC(this),VC.update.call(this,null,p)}catch(e){throw this[kC]=null,this[IC]=!1,e}this._ssr||this._zr.flush(),this[kC]=null,this[IC]=!1,UC.call(this,i),jC.call(this,i)}}},t.prototype.setTheme=function(){vd()},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||gr.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(e){return this.renderToCanvas(e)},t.prototype.renderToCanvas=function(e){e=e||{};var t=this._zr.painter;return t.getRenderedCanvas({backgroundColor:e.backgroundColor||this._model.get("backgroundColor"),pixelRatio:e.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(e){e=e||{};var t=this._zr.painter;return t.renderToString({useViewBox:e.useViewBox})},t.prototype.getSvgDataURL=function(){if(gr.svgSupported){var e=this._zr;return Hr(e.storage.getDisplayList(),function(e){e.stopAnimation(null,!0)}),e.painter.toDataURL()}},t.prototype.getDataURL=function(e){if(!this._disposed){var t=(e=e||{}).excludeComponents,n=this._model,i=[],a=this;Hr(t,function(e){n.eachComponent({mainType:e},function(e){var t=a._componentsMap[e.__viewId];t.group.ignore||(i.push(t),t.group.ignore=!0)})});var r="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(e).toDataURL("image/"+(e&&e.type||"png"));return Hr(i,function(e){e.group.ignore=!1}),r}r_(this.id)},t.prototype.getConnectedDataURL=function(e){if(!this._disposed){var t="svg"===e.type,n=this.group,i=Math.min,a=Math.max,r=1/0;if(h_[n]){var o=r,s=r,l=-1/0,p=-1/0,c=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();Hr(m_,function(r,d){if(r.group===n){var u=t?r.getZr().painter.getSvgDom().innerHTML:r.renderToCanvas(Fr(e)),m=r.getDom().getBoundingClientRect();o=i(m.left,o),s=i(m.top,s),l=a(m.right,l),p=a(m.bottom,p),c.push({dom:u,left:m.left,top:m.top})}});var u=(l*=d)-(o*=d),m=(p*=d)-(s*=d),h=wr.createCanvas(),g=Hc(h,{renderer:t?"svg":"canvas"});if(g.resize({width:u,height:m}),t){var f="";return Hr(c,function(e){var t=e.left-o,n=e.top-s;f+=''+e.dom+""}),g.painter.getSvgRoot().innerHTML=f,e.connectedBackgroundColor&&g.painter.setBackgroundColor(e.connectedBackgroundColor),g.refreshImmediately(),g.painter.toDataURL()}return e.connectedBackgroundColor&&g.add(new qm({shape:{x:0,y:0,width:u,height:m},style:{fill:e.connectedBackgroundColor}})),Hr(c,function(e){var t=new Om({style:{x:e.left*d-o,y:e.top*d-s,image:e.dom}});g.add(t)}),g.refreshImmediately(),h.toDataURL("image/"+(e&&e.type||"png"))}return this.getDataURL(e)}r_(this.id)},t.prototype.convertToPixel=function(e,t){return qC(this,"convertToPixel",e,t)},t.prototype.convertFromPixel=function(e,t){return qC(this,"convertFromPixel",e,t)},t.prototype.containPixel=function(e,t){var n;if(!this._disposed)return Hr(Nd(this._model,e),function(e,i){i.indexOf("Models")>=0&&Hr(e,function(e){var a=e.coordinateSystem;if(a&&a.containPoint)n=n||!!a.containPoint(t);else if("seriesModels"===i){var r=this._chartsMap[e.__viewId];r&&r.containPoint&&(n=n||r.containPoint(t,e))}else 0},this)},this),!!n;r_(this.id)},t.prototype.getVisual=function(e,t){var n=Nd(this._model,e,{defaultMainType:"series"}),i=n.seriesModel;var a=i.getData(),r=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?a.indexOfRawIndex(n.dataIndex):null;return null!=r?IS(a,r,t):kS(a,t)},t.prototype.getViewOfComponentModel=function(e){return this._componentsMap[e.__viewId]},t.prototype.getViewOfSeriesModel=function(e){return this._chartsMap[e.__viewId]},t.prototype._initEvents=function(){var e,t,n,i=this;Hr(a_,function(e){var t=function(t){var n,a=i.getModel(),r=t.target,o="globalout"===e;if(o?n={}:r&&OS(r,function(e){var t=nh(e);if(t&&null!=t.dataIndex){var i=t.dataModel||a.getSeriesByIndex(t.seriesIndex);return n=i&&i.getDataParams(t.dataIndex,t.dataType,r)||{},!0}if(t.eventData)return n=Vr({},t.eventData),!0},!0),n){var s=n.componentType,l=n.componentIndex;"markLine"!==s&&"markPoint"!==s&&"markArea"!==s||(s="series",l=n.seriesIndex);var p=s&&null!=l&&a.getComponent(s,l),c=p&&i["series"===p.mainType?"_chartsMap":"_componentsMap"][p.__viewId];0,n.event=t,n.type=e,i._$eventProcessor.eventInfo={targetEl:r,packedEvent:n,model:p,view:c},i.trigger(e,n)}};t.zrEventfulCallAtLast=!0,i._zr.on(e,t,i)}),Hr(s_,function(e,t){i._messageCenter.on(t,function(e){this.trigger(t,e)},i)}),Hr(["selectchanged"],function(e){i._messageCenter.on(e,function(t){this.trigger(e,t)},i)}),e=this._messageCenter,t=this,n=this._api,e.on("selectchanged",function(e){var i=n.getModel();e.isFromClick?(AS("map","selectchanged",t,i,e),AS("pie","selectchanged",t,i,e)):"select"===e.fromAction?(AS("map","selected",t,i,e),AS("pie","selected",t,i,e)):"unselect"===e.fromAction&&(AS("map","unselected",t,i,e),AS("pie","unselected",t,i,e))})},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?r_(this.id):this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)r_(this.id);else{this._disposed=!0,this.getDom()&&zd(this.getDom(),f_,"");var e=this,t=e._api,n=e._model;Hr(e._componentsViews,function(e){e.dispose(n,t)}),Hr(e._chartsViews,function(e){e.dispose(n,t)}),e._zr.dispose(),e._dom=e._model=e._chartsMap=e._componentsMap=e._chartsViews=e._componentsViews=e._scheduler=e._api=e._zr=e._throttledZrFlush=e._theme=e._coordSysMgr=e._messageCenter=null,delete m_[e.id]}},t.prototype.resize=function(e){if(!this[IC])if(this._disposed)r_(this.id);else{this._zr.resize(e);var t=this._model;if(this._loadingFX&&this._loadingFX.resize(),t){var n=t.resetOption("media"),i=e&&e.silent;this[kC]&&(null==i&&(i=this[kC].silent),n=!0,this[kC]=null),this[IC]=!0;try{n&&FC(this),VC.update.call(this,{type:"resize",animation:Vr({duration:0},e&&e.animation)})}catch(e){throw this[IC]=!1,e}this[IC]=!1,UC.call(this,i),jC.call(this,i)}}},t.prototype.showLoading=function(e,t){if(this._disposed)r_(this.id);else if(ao(e)&&(t=e,e=""),e=e||"default",this.hideLoading(),u_[e]){var n=u_[e](this._api,t),i=this._zr;this._loadingFX=n,i.add(n)}},t.prototype.hideLoading=function(){this._disposed?r_(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=Vr({},e);return t.type=s_[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)r_(this.id);else if(ao(t)||(t={silent:!!t}),o_[e.type]&&this._model)if(this[IC])this._pendingActions.push(e);else{var n=t.silent;zC.call(this,e,n);var i=t.flush;i?this._zr.flush():!1!==i&&gr.browser.weChat&&this._throttledZrFlush(),UC.call(this,n),jC.call(this,n)}},t.prototype.updateLabelLayout=function(){SC.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)r_(this.id);else{var t=e.seriesIndex,n=this.getModel().getSeriesByIndex(t);0,n.appendData(e),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},t.internalField=function(){function e(e){e.clearColorPalette(),e.eachSeries(function(e){e.clearColorPalette()})}function t(e){for(var t=[],n=e.currentStates,i=0;i0?{duration:r,delay:i.get("delay"),easing:i.get("easing")}:null;n.eachRendered(function(e){if(e.states&&e.states.emphasis){if(yf(e))return;if(e instanceof Im&&function(e){var t=oh(e);t.normalFill=e.style.fill,t.normalStroke=e.style.stroke;var n=e.states.select||{};t.selectFill=n.style&&n.style.fill||null,t.selectStroke=n.style&&n.style.stroke||null}(e),e.__dirty){var n=e.prevStates;n&&e.useStates(n)}if(a){e.stateTransition=o;var i=e.getTextContent(),r=e.getTextGuideLine();i&&(i.stateTransition=o),r&&(r.stateTransition=o)}e.__dirty&&t(e)}})}FC=function(e){var t=e._scheduler;t.restorePipelines(e._model),t.prepareStageTasks(),NC(e,!0),NC(e,!1),t.plan()},NC=function(e,t){for(var n=e._model,i=e._scheduler,a=t?e._componentsViews:e._chartsViews,r=t?e._componentsMap:e._chartsMap,o=e._zr,s=e._api,l=0;lt.get("hoverLayerThreshold")&&!gr.node&&!gr.worker&&t.eachSeries(function(t){if(!t.preventUsingHoverLayer){var n=e._chartsMap[t.__viewId];n.__alive&&n.eachRendered(function(e){e.states.emphasis&&(e.states.emphasis.hoverLayer=!0)})}})}(e,t),SC.trigger("series:afterupdate",t,i,s)},QC=function(e){e[PC]=!0,e.getZr().wakeUp()},JC=function(e){e[PC]&&(e.getZr().storage.traverse(function(e){yf(e)||t(e)}),e[PC]=!1)},XC=function(e){return new(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return Xe(n,t),n.prototype.getCoordinateSystems=function(){return e._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(t){for(;t;){var n=t.__ecComponentInfo;if(null!=n)return e._model.getComponent(n.mainType,n.index);t=t.parent}},n.prototype.enterEmphasis=function(t,n){Dh(t,n),QC(e)},n.prototype.leaveEmphasis=function(t,n){Ah(t,n),QC(e)},n.prototype.enterBlur=function(t){Oh(t),QC(e)},n.prototype.leaveBlur=function(t){Rh(t),QC(e)},n.prototype.enterSelect=function(t){Bh(t),QC(e)},n.prototype.leaveSelect=function(t){Fh(t),QC(e)},n.prototype.getModel=function(){return e.getModel()},n.prototype.getViewOfComponentModel=function(t){return e.getViewOfComponentModel(t)},n.prototype.getViewOfSeriesModel=function(t){return e.getViewOfSeriesModel(t)},n}(vx))(e)},ZC=function(e){function t(e,t){for(var n=0;n=0)){__.push(n);var r=tS.wrapStageHandler(n,a);r.__prio=t,r.__raw=n,e.push(r)}}function E_(e,t){u_[e]=t}var M_=function(e){var t=(e=Fr(e)).type,n="";t||xd(n);var i=t.split(":");2!==i.length&&xd(n);var a=!1;"echarts"===i[0]&&(t=i[1],a=!0),e.__isBuiltIn=a,Fb.set(t,e)};function I_(e){return null==e?0:e.length||1}function k_(e){return e}C_(TC,Xw),C_(EC,Qw),C_(EC,Jw),C_(TC,ES),C_(EC,MS),C_(7e3,function(e,t){e.eachRawSeries(function(n){if(!e.isSeriesFiltered(n)){var i=n.getData();i.hasItemVisual()&&i.each(function(e){var n=i.getItemVisual(e,"decal");n&&(i.ensureUniqueItemVisual(e,"style").decal=vC(n,t))});var a=i.getVisual("decal");if(a)i.getVisual("style").decal=vC(a,t)}})}),x_(jx),b_(900,function(e){var t=Eo();e.eachSeries(function(e){var n=e.get("stack");if(n){var i=t.get(n)||t.set(n,[]),a=e.getData(),r={stackResultDimension:a.getCalculationInfo("stackResultDimension"),stackedOverDimension:a.getCalculationInfo("stackedOverDimension"),stackedDimension:a.getCalculationInfo("stackedDimension"),stackedByDimension:a.getCalculationInfo("stackedByDimension"),isStackedByIndex:a.getCalculationInfo("isStackedByIndex"),data:a,seriesModel:e};if(!r.stackedDimension||!r.isStackedByIndex&&!r.stackedByDimension)return;i.length&&a.setCalculationInfo("stackedOnSeries",i[i.length-1].seriesModel),i.push(r)}}),t.each(Hx)}),E_("default",function(e,t){qr(t=t||{},{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new qc,i=new qm({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(i);var a,r=new Um({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),o=new qm({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});return n.add(o),t.showSpinner&&((a=new Jg({shape:{startAngle:-eS/2,endAngle:-eS/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:"round",lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*eS/2}).start("circularInOut"),a.animateShape(!0).when(1e3,{startAngle:3*eS/2}).delay(300).start("circularInOut"),n.add(a)),n.resize=function(){var n=r.getBoundingRect().width,s=t.showSpinner?t.spinnerRadius:0,l=(e.getWidth()-2*s-(t.showSpinner&&n?10:0)-n)/2-(t.showSpinner&&n?0:5+n/2)+(t.showSpinner?0:n/2)+(n?0:s),p=e.getHeight()/2;t.showSpinner&&a.setShape({cx:l,cy:p}),o.setShape({x:l-s,y:p-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},n.resize(),n}),S_({type:dh,event:dh,update:dh},Do),S_({type:uh,event:uh,update:uh},Do),S_({type:mh,event:mh,update:mh},Do),S_({type:hh,event:hh,update:hh},Do),S_({type:gh,event:gh,update:gh},Do),v_("light",yS),v_("dark",SS);var P_=function(){function e(e,t,n,i,a,r){this._old=e,this._new=t,this._oldKeyGetter=n||k_,this._newKeyGetter=i||k_,this.context=a,this._diffModeMultiple="multiple"===r}return e.prototype.add=function(e){return this._add=e,this},e.prototype.update=function(e){return this._update=e,this},e.prototype.updateManyToOne=function(e){return this._updateManyToOne=e,this},e.prototype.updateOneToMany=function(e){return this._updateOneToMany=e,this},e.prototype.updateManyToMany=function(e){return this._updateManyToMany=e,this},e.prototype.remove=function(e){return this._remove=e,this},e.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},e.prototype._executeOneToOne=function(){var e=this._old,t=this._new,n={},i=new Array(e.length),a=new Array(t.length);this._initIndexMap(e,null,i,"_oldKeyGetter"),this._initIndexMap(t,n,a,"_newKeyGetter");for(var r=0;r1){var p=s.shift();1===s.length&&(n[o]=s[0]),this._update&&this._update(p,r)}else 1===l?(n[o]=null,this._update&&this._update(s,r)):this._remove&&this._remove(r)}this._performRestAdd(a,n)},e.prototype._executeMultiple=function(){var e=this._old,t=this._new,n={},i={},a=[],r=[];this._initIndexMap(e,n,a,"_oldKeyGetter"),this._initIndexMap(t,i,r,"_newKeyGetter");for(var o=0;o1&&1===d)this._updateManyToOne&&this._updateManyToOne(p,l),i[s]=null;else if(1===c&&d>1)this._updateOneToMany&&this._updateOneToMany(p,l),i[s]=null;else if(1===c&&1===d)this._update&&this._update(p,l),i[s]=null;else if(c>1&&d>1)this._updateManyToMany&&this._updateManyToMany(p,l),i[s]=null;else if(c>1)for(var u=0;u1)for(var o=0;o30}var z_,U_,j_,H_,W_,$_,K_,Y_=ao,X_=Wr,Z_="undefined"==typeof Int32Array?Array:Int32Array,Q_=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],J_=["_approximateExtent"],eT=function(){function e(e,t){var n;this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","lttbDownSample"];var i=!1;L_(e)?(n=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(i=!0,n=e),n=n||["x","y"];for(var a={},r=[],o={},s=!1,l={},p=0;p=t)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,a=this._idList;if(n.getSource().sourceFormat===qv&&!n.pure)for(var r=[],o=e;o0},e.prototype.ensureUniqueItemVisual=function(e,t){var n=this._itemVisuals,i=n[e];i||(i=n[e]={});var a=i[t];return null==a&&(Jr(a=this.getVisual(t))?a=a.slice():Y_(a)&&(a=Vr({},a)),i[t]=a),a},e.prototype.setItemVisual=function(e,t,n){var i=this._itemVisuals[e]||{};this._itemVisuals[e]=i,Y_(t)?Vr(i,t):i[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){Y_(e)?Vr(this._layout,e):this._layout[e]=t},e.prototype.getLayout=function(e){return this._layout[e]},e.prototype.getItemLayout=function(e){return this._itemLayouts[e]},e.prototype.setItemLayout=function(e,t,n){this._itemLayouts[e]=n?Vr(this._itemLayouts[e]||{},t):t},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(e,t){var n=this.hostModel&&this.hostModel.seriesIndex;ih(n,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){Hr(this._graphicEls,function(n,i){n&&e&&e.call(t,n,i)})},e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:X_(this.dimensions,this._getDimInfo,this),this.hostModel)),W_(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];eo(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(fo(arguments)))})},e.internalField=(z_=function(e){var t=e._invertedIndicesMap;Hr(t,function(n,i){var a=e._dimInfos[i],r=a.ordinalMeta,o=a.stack,s=e._store;if(r||o){if(n=t[i]=o?new Array(s.count()):new Z_(r.categories.length),r)for(var l=0;l1&&(s+="__ec__"+p),i[t]=s}})),e}();function tT(e,t){Qx(e)||(e=eb(e));var n=(t=t||{}).coordDimensions||[],i=t.dimensionsDefine||e.dimensionsDefine||[],a=Eo(),r=[],o=function(e,t,n,i){var a=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,i||0);return Hr(t,function(e){var t;ao(e)&&(t=e.dimsDef)&&(a=Math.max(a,t.length))}),a}(e,n,i,t.dimensionsCount),s=t.canOmitUnusedDimensions&&G_(o),l=i===e.dimensionsDefine,p=l?q_(e):V_(i),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var d=Eo(c),u=new Ub(o),m=0;m0&&(i.name=a+(r-1)),r++,t.set(a,r)}}(r),new N_({source:e,dimensions:r,fullDimensionCount:o,dimensionOmitted:s})}function nT(e,t,n){if(n||t.hasKey(e)){for(var i=0;t.hasKey(e+i);)i++;e+=i}return t.set(e,!0),e}var iT=function(e){this.coordSysDims=[],this.axisMap=Eo(),this.categoryAxisMap=Eo(),this.coordSysName=e};var aT={cartesian2d:function(e,t,n,i){var a=e.getReferringComponents("xAxis",Vd).models[0],r=e.getReferringComponents("yAxis",Vd).models[0];t.coordSysDims=["x","y"],n.set("x",a),n.set("y",r),rT(a)&&(i.set("x",a),t.firstCategoryDimIndex=0),rT(r)&&(i.set("y",r),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,n,i){var a=e.getReferringComponents("singleAxis",Vd).models[0];t.coordSysDims=["single"],n.set("single",a),rT(a)&&(i.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,n,i){var a=e.getReferringComponents("polar",Vd).models[0],r=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],n.set("radius",r),n.set("angle",o),rT(r)&&(i.set("radius",r),t.firstCategoryDimIndex=0),rT(o)&&(i.set("angle",o),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=1))},geo:function(e,t,n,i){t.coordSysDims=["lng","lat"]},parallel:function(e,t,n,i){var a=e.ecModel,r=a.getComponent("parallel",e.get("parallelIndex")),o=t.coordSysDims=r.dimensions.slice();Hr(r.parallelAxisIndex,function(e,r){var s=a.getComponent("parallelAxis",e),l=o[r];n.set(l,s),rT(s)&&(i.set(l,s),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=r))})}};function rT(e){return"category"===e.get("type")}function oT(e,t,n){var i,a,r,o=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(e){return!L_(e.schema)}(t)?(a=t.schema,i=a.dimensions,r=t.store):i=t;var l,p,c,d,u=!(!e||!e.get("stack"));if(Hr(i,function(e,t){to(e)&&(i[t]=e={name:e}),u&&!e.isExtraCoord&&(o||l||!e.ordinalMeta&&!e.stack||(l=e),p||"ordinal"===e.type||"time"===e.type||s&&s!==e.coordDim||(p=e))}),!p||o||l||(o=!0),p){c="__\0ecstackresult_"+e.id,d="__\0ecstackedover_"+e.id,l&&(l.createInvertedIndices=!0);var m=p.coordDim,h=p.type,g=0;Hr(i,function(e){e.coordDim===m&&g++});var f={name:c,coordDim:m,coordDimIndex:g,type:h,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},y={name:d,coordDim:d,coordDimIndex:g+1,type:h,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};a?(r&&(f.storeDimIndex=r.ensureCalculationDimension(d,h),y.storeDimIndex=r.ensureCalculationDimension(c,h)),a.appendCalculationDimension(f),a.appendCalculationDimension(y)):(i.push(f),i.push(y))}return{stackedDimension:p&&p.name,stackedByDimension:l&&l.name,isStackedByIndex:o,stackedOverDimension:d,stackResultDimension:c}}function sT(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function lT(e,t){return sT(e,t)?e.getCalculationInfo("stackResultDimension"):t}function pT(e,t,n){n=n||{};var i,a=t.getSourceManager(),r=!1;e?(r=!0,i=eb(e)):r=(i=a.getSource()).sourceFormat===qv;var o=function(e){var t=e.get("coordinateSystem"),n=new iT(t),i=aT[t];if(i)return i(e,n,n.axisMap,n.categoryAxisMap),n}(t),s=function(e,t){var n,i=e.get("coordinateSystem"),a=bx.get(i);return t&&t.coordSysDims&&(n=Wr(t.coordSysDims,function(e){var n={name:e},i=t.axisMap.get(e);if(i){var a=i.get("type");n.type=O_(a)}return n})),n||(n=a&&(a.getDimensionsInfo?a.getDimensionsInfo():a.dimensions.slice())||["x","y"]),n}(t,o),l=n.useEncodeDefaulter,p=eo(l)?l:l?Qr(Qv,s,t):null,c=tT(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:p,canOmitUnusedDimensions:!r}),d=function(e,t,n){var i,a;return n&&Hr(e,function(e,r){var o=e.coordDim,s=n.categoryAxisMap.get(o);s&&(null==i&&(i=r),e.ordinalMeta=s.getOrdinalMeta(),t&&(e.createInvertedIndices=!0)),null!=e.otherDims.itemName&&(a=!0)}),a||null==i||(e[i].otherDims.itemName=0),i}(c.dimensions,n.createInvertedIndices,o),u=r?null:a.getSharedDataStore(c),m=oT(t,{schema:c,store:u}),h=new eT(c,t);h.setCalculationInfo(m);var g=null!=d&&function(e){if(e.sourceFormat===qv){var t=function(e){var t=0;for(;tt[1]&&(t[1]=e[1])},e.prototype.unionExtentFromData=function(e,t){this.unionExtent(e.getApproximateExtent(t))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(e,t){var n=this._extent;isNaN(e)||(n[0]=e),isNaN(t)||(n[1]=t)},e.prototype.isInExtentRange=function(e){return this._extent[0]<=e&&this._extent[1]>=e},e.prototype.isBlank=function(){return this._isBlank},e.prototype.setBlank=function(e){this._isBlank=e},e}();Jd(cT);var dT=0,uT=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++dT}return e.createByAxisModel=function(t){var n=t.option,i=n.data,a=i&&Wr(i,mT);return new e({categories:a,needCollect:!a,deduplication:!1!==n.dedplication})},e.prototype.getOrdinal=function(e){return this._getOrCreateMap().get(e)},e.prototype.parseAndCollect=function(e){var t,n=this._needCollect;if(!to(e)&&!n)return e;if(n&&!this._deduplication)return t=this.categories.length,this.categories[t]=e,t;var i=this._getOrCreateMap();return null==(t=i.get(e))&&(n?(t=this.categories.length,this.categories[t]=e,i.set(e,t)):t=NaN),t},e.prototype._getOrCreateMap=function(){return this._map||(this._map=Eo(this.categories))},e}();function mT(e){return ao(e)&&null!=e.value?e.value:e+""}function hT(e){return"interval"===e.type||"log"===e.type}function gT(e,t,n,i){var a={},r=e[1]-e[0],o=a.interval=dd(r/t,!0);null!=n&&oi&&(o=a.interval=i);var s=a.intervalPrecision=yT(o);return function(e,t){!isFinite(e[0])&&(e[0]=t[0]),!isFinite(e[1])&&(e[1]=t[1]),vT(e,0,t),vT(e,1,t),e[0]>e[1]&&(e[0]=e[1])}(a.niceTickExtent=[Qc(Math.ceil(e[0]/o)*o,s),Qc(Math.floor(e[1]/o)*o,s)],e),a}function fT(e){var t=Math.pow(10,cd(e)),n=e/t;return n?2===n?n=3:3===n?n=5:n*=2:n=1,Qc(n*t)}function yT(e){return ed(e)+2}function vT(e,t,n){e[t]=Math.max(Math.min(e[t],n[1]),n[0])}function xT(e,t){return e>=t[0]&&e<=t[1]}function bT(e,t){return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])}function wT(e,t){return e*(t[1]-t[0])+t[0]}var ST=function(e){function t(t){var n=e.call(this,t)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new uT({})),Jr(i)&&(i=new uT({categories:Wr(i,function(e){return ao(e)?e.value:e})})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return Xe(t,e),t.prototype.parse=function(e){return null==e?NaN:to(e)?this._ordinalMeta.getOrdinal(e):Math.round(e)},t.prototype.contain=function(e){return xT(e=this.parse(e),this._extent)&&null!=this._ordinalMeta.categories[e]},t.prototype.normalize=function(e){return bT(e=this._getTickNumber(this.parse(e)),this._extent)},t.prototype.scale=function(e){return e=Math.round(wT(e,this._extent)),this.getRawOrdinalNumber(e)},t.prototype.getTicks=function(){for(var e=[],t=this._extent,n=t[0];n<=t[1];)e.push({value:n}),n++;return e},t.prototype.getMinorTicks=function(e){},t.prototype.setSortInfo=function(e){if(null!=e){for(var t=e.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],a=0,r=this._ordinalMeta.categories.length,o=Math.min(r,t.length);a=0&&e=0&&e=e},t.prototype.getOrdinalMeta=function(){return this._ordinalMeta},t.prototype.calcNiceTicks=function(){},t.prototype.calcNiceExtent=function(){},t.type="ordinal",t}(cT);cT.registerClass(ST);var CT=Qc,_T=function(e){function t(t){var n=e.call(this,t)||this;n.type="interval",n._interval=0,n._intervalPrecision=2;var i=n.getSetting("ticksGenerator");return eo(i)&&(n._ticksGenerator=i),n}return Xe(t,e),t.prototype.parse=function(e){return e},t.prototype.contain=function(e){return xT(e,this._extent)},t.prototype.normalize=function(e){return bT(e,this._extent)},t.prototype.scale=function(e){return wT(e,this._extent)},t.prototype.setExtent=function(e,t){var n=this._extent;isNaN(e)||(n[0]=parseFloat(e)),isNaN(t)||(n[1]=parseFloat(t))},t.prototype.unionExtent=function(e){var t=this._extent;e[0]t[1]&&(t[1]=e[1]),this.setExtent(t[0],t[1])},t.prototype.getInterval=function(){return this._interval},t.prototype.setInterval=function(e){this._interval=e,this._niceExtent=this._extent.slice(),this._intervalPrecision=yT(e)},t.prototype.getTicks=function(e){var t,n=this._interval,i=this._extent,a=this._niceExtent,r=this._intervalPrecision,o=this._ticksGenerator;if(o)try{if(t=o(i,n,a,r))return t}catch(e){}if(t=[],!n)return t;i[0]1e4)return[];var l=t.length?t[t.length-1].value:a[1];return i[1]>l&&(e?t.push({value:CT(l+n,r)}):t.push({value:i[1]})),t},t.prototype.getMinorTicks=function(e){for(var t=this.getTicks(!0),n=[],i=this.getExtent(),a=1;ai[0]&&c0&&(r=null===r?s:Math.min(r,s))}n[i]=r}}return n}(e),n=[];return Hr(e,function(e){var i,a=e.coordinateSystem.getBaseAxis(),r=a.getExtent();if("category"===a.type)i=a.getBandWidth();else if("value"===a.type||"time"===a.type){var o=a.dim+"_"+a.index,s=t[o],l=Math.abs(r[1]-r[0]),p=a.scale.getExtent(),c=Math.abs(p[1]-p[0]);i=s?l/c*s:l}else{var d=e.getData();i=Math.abs(r[1]-r[0])/d.count()}var u=Zc(e.get("barWidth"),i),m=Zc(e.get("barMaxWidth"),i),h=Zc(e.get("barMinWidth")||(NT(e)?.5:1),i),g=e.get("barGap"),f=e.get("barCategoryGap");n.push({bandWidth:i,barWidth:u,barMaxWidth:m,barMinWidth:h,barGap:g,barCategoryGap:f,axisKey:PT(a),stackId:kT(e)})}),OT(n)}function OT(e){var t={};Hr(e,function(e,n){var i=e.axisKey,a=e.bandWidth,r=t[i]||{bandWidth:a,remainedWidth:a,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},o=r.stacks;t[i]=r;var s=e.stackId;o[s]||r.autoWidthCount++,o[s]=o[s]||{width:0,maxWidth:0};var l=e.barWidth;l&&!o[s].width&&(o[s].width=l,l=Math.min(r.remainedWidth,l),r.remainedWidth-=l);var p=e.barMaxWidth;p&&(o[s].maxWidth=p);var c=e.barMinWidth;c&&(o[s].minWidth=c);var d=e.barGap;null!=d&&(r.gap=d);var u=e.barCategoryGap;null!=u&&(r.categoryGap=u)});var n={};return Hr(t,function(e,t){n[t]={};var i=e.stacks,a=e.bandWidth,r=e.categoryGap;if(null==r){var o=Xr(i).length;r=Math.max(35-4*o,15)+"%"}var s=Zc(r,a),l=Zc(e.gap,1),p=e.remainedWidth,c=e.autoWidthCount,d=(p-s)/(c+(c-1)*l);d=Math.max(d,0),Hr(i,function(e){var t=e.maxWidth,n=e.minWidth;if(e.width){i=e.width;t&&(i=Math.min(i,t)),n&&(i=Math.max(i,n)),e.width=i,p-=i+l*i,c--}else{var i=d;t&&ti&&(i=n),i!==d&&(e.width=i,p-=i+l*i,c--)}}),d=(p-s)/(c+(c-1)*l),d=Math.max(d,0);var u,m=0;Hr(i,function(e,t){e.width||(e.width=d),u=e,m+=e.width*(1+l)}),u&&(m-=u.width*l);var h=-m/2;Hr(i,function(e,i){n[t][i]=n[t][i]||{bandWidth:a,offset:h,width:e.width},h+=e.width*(1+l)})}),n}function RT(e,t){var n=DT(e,t),i=AT(n);Hr(n,function(e){var t=e.getData(),n=e.coordinateSystem.getBaseAxis(),a=kT(e),r=i[PT(n)][a],o=r.offset,s=r.width;t.setLayout({bandWidth:r.bandWidth,offset:o,size:s})})}function BT(e){return{seriesType:e,plan:Pw(),reset:function(e){if(FT(e)){var t=e.getData(),n=e.coordinateSystem,i=n.getBaseAxis(),a=n.getOtherAxis(i),r=t.getDimensionIndex(t.mapDimension(a.dim)),o=t.getDimensionIndex(t.mapDimension(i.dim)),s=e.get("showBackground",!0),l=t.mapDimension(a.dim),p=t.getCalculationInfo("stackResultDimension"),c=sT(t,l)&&!!t.getCalculationInfo("stackedOnSeries"),d=a.isHorizontal(),u=function(e,t){return t.toGlobalCoord(t.dataToCoord("log"===t.type?1:0))}(0,a),m=NT(e),h=e.get("barMinHeight")||0,g=p&&t.getDimensionIndex(p),f=t.getLayout("size"),y=t.getLayout("offset");return{progress:function(e,t){for(var i,a=e.count,l=m&&MT(3*a),p=m&&s&&MT(3*a),v=m&&MT(a),x=n.master.getRect(),b=d?x.width:x.height,w=t.getStore(),S=0;null!=(i=e.next());){var C=w.get(c?g:r,i),_=w.get(o,i),T=u,E=void 0;c&&(E=+C-w.get(r,i));var M=void 0,I=void 0,k=void 0,P=void 0;if(d){var D=n.dataToPoint([C,_]);if(c)T=n.dataToPoint([E,_])[0];M=T,I=D[1]+y,k=D[0]-T,P=f,Math.abs(k)0)for(var s=0;s=0;--s)if(l[p]){r=l[p];break}r=r||o.none}if(Jr(r)){var c=null==e.level?0:e.level>=0?e.level:r.length+e.level;r=r[c=Math.min(c,r.length-1)]}}return Xy(new Date(e.value),r,a,i)}(e,t,n,this.getSetting("locale"),i)},t.prototype.getTicks=function(){var e=this._interval,t=this._extent,n=[];if(!e)return n;n.push({value:t[0],level:0});var i=this.getSetting("useUTC"),a=function(e,t,n,i){var a=1e4,r=Wy,o=0;function s(e,t,n,a,r,o,s){for(var l=new Date(t),p=t,c=l[a]();p1&&0===p&&r.unshift({value:r[0].value-u})}}for(p=0;p=i[0]&&y<=i[1]&&d++)}var v=(i[1]-i[0])/t;if(d>1.5*v&&u>v/1.5)break;if(p.push(g),d>v||e===r[m])break}c=[]}}0;var x=Kr(Wr(p,function(e){return Kr(e,function(e){return e.value>=i[0]&&e.value<=i[1]&&!e.notAdd})}),function(e){return e.length>0}),b=[],w=x.length-1;for(m=0;mn&&(this._approxInterval=n);var r=VT.length,o=Math.min(function(e,t,n,i){for(;n>>1;e[a][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function GT(e){return(e/=2592e6)>6?6:e>3?3:e>2?2:1}function zT(e){return(e/=Vy)>12?12:e>6?6:e>3.5?4:e>2?2:1}function UT(e,t){return(e/=t?Ly:Ny)>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function jT(e){return dd(e,!0)}function HT(e,t,n){var i=new Date(e);switch(Ky(t)){case"year":case"month":i[sv(n)](0);case"day":i[lv(n)](1);case"hour":i[pv(n)](0);case"minute":i[cv(n)](0);case"second":i[dv(n)](0),i[uv(n)](0)}return i.getTime()}cT.registerClass(LT);var WT=cT.prototype,$T=_T.prototype,KT=Qc,YT=Math.floor,XT=Math.ceil,ZT=Math.pow,QT=Math.log,JT=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="log",t.base=10,t._originalScale=new _T,t._interval=0,t}return Xe(t,e),t.prototype.getTicks=function(e){var t=this._originalScale,n=this._extent,i=t.getExtent();return Wr($T.getTicks.call(this,e),function(e){var t=e.value,a=Qc(ZT(this.base,t));return a=t===n[0]&&this._fixMin?tE(a,i[0]):a,{value:a=t===n[1]&&this._fixMax?tE(a,i[1]):a}},this)},t.prototype.setExtent=function(e,t){var n=QT(this.base);e=QT(Math.max(0,e))/n,t=QT(Math.max(0,t))/n,$T.setExtent.call(this,e,t)},t.prototype.getExtent=function(){var e=this.base,t=WT.getExtent.call(this);t[0]=ZT(e,t[0]),t[1]=ZT(e,t[1]);var n=this._originalScale.getExtent();return this._fixMin&&(t[0]=tE(t[0],n[0])),this._fixMax&&(t[1]=tE(t[1],n[1])),t},t.prototype.unionExtent=function(e){this._originalScale.unionExtent(e);var t=this.base;e[0]=QT(e[0])/QT(t),e[1]=QT(e[1])/QT(t),WT.unionExtent.call(this,e)},t.prototype.unionExtentFromData=function(e,t){this.unionExtent(e.getApproximateExtent(t))},t.prototype.calcNiceTicks=function(e){e=e||10;var t=this._extent,n=t[1]-t[0];if(!(n===1/0||n<=0)){var i=pd(n);for(e/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var a=[Qc(XT(t[0]/i)*i),Qc(YT(t[1]/i)*i)];this._interval=i,this._niceExtent=a}},t.prototype.calcNiceExtent=function(e){$T.calcNiceExtent.call(this,e),this._fixMin=e.fixMin,this._fixMax=e.fixMax},t.prototype.parse=function(e){return e},t.prototype.contain=function(e){return xT(e=QT(e)/QT(this.base),this._extent)},t.prototype.normalize=function(e){return bT(e=QT(e)/QT(this.base),this._extent)},t.prototype.scale=function(e){return e=wT(e,this._extent),ZT(this.base,e)},t.type="log",t}(cT),eE=JT.prototype;function tE(e,t){return KT(e,ed(t))}eE.getMinorTicks=$T.getMinorTicks,eE.getLabel=$T.getLabel,cT.registerClass(JT);var nE=function(){function e(e,t,n){this._prepareParams(e,t,n)}return e.prototype._prepareParams=function(e,t,n){n[1]0&&s>0&&!l&&(o=0),o<0&&s<0&&!p&&(s=0));var d=this._determinedMin,u=this._determinedMax;return null!=d&&(o=d,l=!0),null!=u&&(s=u,p=!0),{min:o,max:s,minFixed:l,maxFixed:p,isBlank:c}},e.prototype.modifyDataMinMax=function(e,t){this[aE[e]]=t},e.prototype.setDeterminedMinMax=function(e,t){var n=iE[e];this[n]=t},e.prototype.freeze=function(){this.frozen=!0},e}(),iE={min:"_determinedMin",max:"_determinedMax"},aE={min:"_dataMin",max:"_dataMax"};function rE(e,t,n){var i=e.rawExtentInfo;return i||(i=new nE(e,t,n),e.rawExtentInfo=i,i)}function oE(e,t){return null==t?null:uo(t)?NaN:e.parse(t)}function sE(e,t){var n=e.type,i=rE(e,t,e.getExtent()).calculate();e.setBlank(i.isBlank);var a=i.min,r=i.max,o=t.ecModel;if(o&&"time"===n){var s=DT("bar",o),l=!1;if(Hr(s,function(e){l=l||e.getBaseAxis()===t.axis}),l){var p=AT(s),c=function(e,t,n,i){var a=n.axis.getExtent(),r=a[1]-a[0],o=function(e,t,n){if(e&&t){var i=e[PT(t)];return null!=i&&null!=n?i[kT(n)]:i}}(i,n.axis);if(void 0===o)return{min:e,max:t};var s=1/0;Hr(o,function(e){s=Math.min(e.offset,s)});var l=-1/0;Hr(o,function(e){l=Math.max(e.offset+e.width,l)}),s=Math.abs(s),l=Math.abs(l);var p=s+l,c=t-e,d=c/(1-(s+l)/r)-c;return t+=d*(l/p),e-=d*(s/p),{min:e,max:t}}(a,r,t,p);a=c.min,r=c.max}}return{extent:[a,r],fixMin:i.minFixed,fixMax:i.maxFixed}}function lE(e,t){var n=t,i=sE(e,n),a=i.extent,r=n.get("splitNumber");e instanceof JT&&(e.base=n.get("logBase"));var o=e.type,s=n.get("interval"),l="interval"===o||"time"===o;e.setExtent(a[0],a[1]),e.calcNiceExtent({splitNumber:r,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}),null!=s&&e.setInterval&&e.setInterval(s)}function pE(e,t){if(t=t||e.get("type"))switch(t){case"category":return new ST({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:[1/0,-1/0]});case"time":return new LT({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});case"value":return new _T({ticksGenerator:e.getTicksGenerator()});default:return new(cT.getClass(t)||_T)}}function cE(e){var t,n,i=e.getLabelModel().get("formatter"),a="category"===e.type?e.scale.getExtent()[0]:null;return"time"===e.scale.type?(n=i,function(t,i){return e.scale.getFormattedLabel(t,i,n)}):to(i)?function(t){return function(n){var i=e.scale.getLabel(n);return t.replace("{value}",null!=i?i:"")}}(i):eo(i)?(t=i,function(n,i){return null!=a&&(i=n.value-a),t(dE(e,n),i,null!=n.level?{level:n.level}:null)}):function(t){return e.scale.getLabel(t)}}function dE(e,t){return"category"===e.type?e.scale.getLabel(t):t.value}function uE(e,t){var n=t*Math.PI/180,i=e.width,a=e.height,r=i*Math.abs(Math.cos(n))+Math.abs(a*Math.sin(n)),o=i*Math.abs(Math.sin(n))+Math.abs(a*Math.cos(n));return new zs(e.x,e.y,r,o)}function mE(e){var t=e.get("interval");return null==t?"auto":t}function hE(e){return"category"===e.type&&0===mE(e.getLabelModel())}function gE(e,t){var n={};return Hr(e.mapDimensionsAll(t),function(t){n[lT(e,t)]=!0}),Xr(n)}var fE=function(){function e(){}return e.prototype.getNeedCrossZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}();var yE=[],vE={registerPreprocessor:x_,registerProcessor:b_,registerPostInit:function(e){w_("afterinit",e)},registerPostUpdate:function(e){w_("afterupdate",e)},registerUpdateLifecycle:w_,registerAction:S_,registerCoordinateSystem:function(e,t){bx.register(e,t)},registerLayout:function(e,t){T_(c_,e,t,1e3,"layout")},registerVisual:C_,registerTransform:M_,registerLoading:E_,registerMap:function(e,t,n){var i=_C("registerMap");i&&i(e,t,n)},registerImpl:function(e,t){CC[e]=t},PRIORITY:MC,ComponentModel:Bv,ComponentView:kw,SeriesModel:ww,ChartView:Ow,registerComponentModel:function(e){Bv.registerClass(e)},registerComponentView:function(e){kw.registerClass(e)},registerSeriesModel:function(e){ww.registerClass(e)},registerChartView:function(e){Ow.registerClass(e)},registerSubTypeDefaulter:function(e,t){Bv.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){Wc(e,t)}};function xE(e){Jr(e)?Hr(e,function(e){xE(e)}):Gr(yE,e)>=0||(yE.push(e),eo(e)&&(e={install:e}),e.install(vE))}function bE(e,t){return Math.abs(e-t)<1e-8}function wE(e,t,n){var i=0,a=e[0];if(!a)return!1;for(var r=1;rn&&(e=a,n=o)}if(e)return function(e){for(var t=0,n=0,i=0,a=e.length,r=e[a-1][0],o=e[a-1][1],s=0;s>1^-(1&s),l=l>>1^-(1&l),a=s+=a,r=l+=r,i.push([s/n,l/n])}return i}function AE(e,t){return Wr(Kr((e=function(e){if(!e.UTF8Encoding)return e;var t=e,n=t.UTF8Scale;return null==n&&(n=1024),Hr(t.features,function(e){var t=e.geometry,i=t.encodeOffsets,a=t.coordinates;if(i)switch(t.type){case"LineString":t.coordinates=DE(a,i,n);break;case"Polygon":case"MultiLineString":PE(a,i,n);break;case"MultiPolygon":Hr(a,function(e,t){return PE(e,i[t],n)})}}),t.UTF8Encoding=!1,t}(e)).features,function(e){return e.geometry&&e.properties&&e.geometry.coordinates.length>0}),function(e){var n=e.properties,i=e.geometry,a=[];switch(i.type){case"Polygon":var r=i.coordinates;a.push(new EE(r[0],r.slice(1)));break;case"MultiPolygon":Hr(i.coordinates,function(e){e[0]&&a.push(new EE(e[0],e.slice(1)))});break;case"LineString":a.push(new ME([i.coordinates]));break;case"MultiLineString":a.push(new ME(i.coordinates))}var o=new IE(n[t||"name"],a,n.cp);return o.properties=n,o})}var OE=Bd();function RE(e){return"category"===e.type?function(e){var t=e.getLabelModel(),n=FE(e,t);return!t.get("show")||e.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(e):function(e){var t=e.scale.getTicks(),n=cE(e);return{labels:Wr(t,function(t,i){return{level:t.level,formattedLabel:n(t,i),rawLabel:e.scale.getLabel(t),tickValue:t.value}})}}(e)}function BE(e,t){return"category"===e.type?function(e,t){var n,i,a=NE(e,"ticks"),r=mE(t),o=LE(a,r);if(o)return o;t.get("show")&&!e.scale.isBlank()||(n=[]);if(eo(r))n=GE(e,r,!0);else if("auto"===r){var s=FE(e,e.getLabelModel());i=s.labelCategoryInterval,n=Wr(s.labels,function(e){return e.tickValue})}else n=qE(e,i=r,!0);return VE(a,r,{ticks:n,tickCategoryInterval:i})}(e,t):{ticks:Wr(e.scale.getTicks(),function(e){return e.value})}}function FE(e,t){var n,i,a=NE(e,"labels"),r=mE(t),o=LE(a,r);return o||(eo(r)?n=GE(e,r):(i="auto"===r?function(e){var t=OE(e).autoInterval;return null!=t?t:OE(e).autoInterval=e.calculateCategoryInterval()}(e):r,n=qE(e,i)),VE(a,r,{labels:n,labelCategoryInterval:i}))}function NE(e,t){return OE(e)[t]||(OE(e)[t]=[])}function LE(e,t){for(var n=0;n1&&c/l>2&&(p=Math.round(Math.ceil(p/l)*l));var d=hE(e),u=o.get("showMinLabel")||d,m=o.get("showMaxLabel")||d;u&&p!==r[0]&&g(r[0]);for(var h=p;h<=r[1];h+=l)g(h);function g(e){var t={value:e};s.push(n?e:{formattedLabel:i(t),rawLabel:a.getLabel(t),tickValue:e})}return m&&h-l!==r[1]&&g(r[1]),s}function GE(e,t,n){var i=e.scale,a=cE(e),r=[];return Hr(i.getTicks(),function(e){var o=i.getLabel(e),s=e.value;t(e.value,o)&&r.push(n?s:{formattedLabel:a(e),rawLabel:o,tickValue:s})}),r}var zE=[0,1],UE=function(){function e(e,t,n){this.onBand=!1,this.inverse=!1,this.dim=e,this.scale=t,this._extent=n||[0,0]}return e.prototype.contain=function(e){var t=this._extent,n=Math.min(t[0],t[1]),i=Math.max(t[0],t[1]);return e>=n&&e<=i},e.prototype.containData=function(e){return this.scale.contain(e)},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.getPixelPrecision=function(e){return nd(e||this.scale.getExtent(),this._extent)},e.prototype.setExtent=function(e,t){var n=this._extent;n[0]=e,n[1]=t},e.prototype.dataToCoord=function(e,t){var n=this._extent,i=this.scale;return e=i.normalize(e),this.onBand&&"ordinal"===i.type&&jE(n=n.slice(),i.count()),Xc(e,zE,n,t)},e.prototype.coordToData=function(e,t){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&jE(n=n.slice(),i.count());var a=Xc(e,n,zE,t);return this.scale.scale(a)},e.prototype.pointToData=function(e,t){},e.prototype.getTicksCoords=function(e){var t=(e=e||{}).tickModel||this.getTickModel(),n=Wr(BE(this,t).ticks,function(e){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(e):e),tickValue:e}},this);return function(e,t,n,i){var a=t.length;if(!e.onBand||n||!a)return;var r,o,s=e.getExtent();if(1===a)t[0].coord=s[0],r=t[1]={coord:s[1]};else{var l=t[a-1].tickValue-t[0].tickValue,p=(t[a-1].coord-t[0].coord)/l;Hr(t,function(e){e.coord-=p/2}),o=1+e.scale.getExtent()[1]-t[a-1].tickValue,r={coord:t[a-1].coord+p*o},t.push(r)}var c=s[0]>s[1];d(t[0].coord,s[0])&&(i?t[0].coord=s[0]:t.shift());i&&d(s[0],t[0].coord)&&t.unshift({coord:s[0]});d(s[1],r.coord)&&(i?r.coord=s[1]:t.pop());i&&d(r.coord,s[1])&&t.push({coord:s[1]});function d(e,t){return e=Qc(e),t=Qc(t),c?e>t:e0&&e<100||(e=5),Wr(this.scale.getMinorTicks(e),function(e){return Wr(e,function(e){return{coord:this.dataToCoord(e),tickValue:e}},this)},this)},e.prototype.getViewLabels=function(){return RE(this).labels},e.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},e.prototype.getTickModel=function(){return this.model.getModel("axisTick")},e.prototype.getBandWidth=function(){if("time"===this.type){var e=this.model,t=e.get("bandWidthCalculator"),n=void 0;if(eo(t))try{if(n=t(e))return n}catch(e){}}var i=this._extent,a=this.scale.getExtent(),r=a[1]-a[0]+(this.onBand?1:0);0===r&&(r=1);var o=Math.abs(i[1]-i[0]);return Math.abs(o)/r},e.prototype.calculateCategoryInterval=function(){return function(e){var t=function(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get("rotate")||0,font:t.getFont()}}(e),n=cE(e),i=(t.axisRotate-t.labelRotate)/180*Math.PI,a=e.scale,r=a.getExtent(),o=a.count();if(r[1]-r[0]<1)return 0;var s=1;o>40&&(s=Math.max(1,Math.floor(o/40)));for(var l=r[0],p=e.dataToCoord(l+1)-e.dataToCoord(l),c=Math.abs(p*Math.cos(i)),d=Math.abs(p*Math.sin(i)),u=0,m=0;l<=r[1];l+=s){var h,g,f=_c(n({value:l}),t.font,"center","top");h=1.3*f.width,g=1.3*f.height,u=Math.max(u,h,7),m=Math.max(m,g,7)}var y=u/c,v=m/d;isNaN(y)&&(y=1/0),isNaN(v)&&(v=1/0);var x=Math.max(0,Math.floor(Math.min(y,v))),b=OE(e.model),w=e.getExtent(),S=b.lastAutoInterval,C=b.lastTickCount;return null!=S&&null!=C&&Math.abs(S-x)<=1&&Math.abs(C-o)<=1&&S>x&&b.axisExtent0===w[0]&&b.axisExtent1===w[1]?x=S:(b.lastTickCount=o,b.lastAutoInterval=x,b.axisExtent0=w[0],b.axisExtent1=w[1]),x}(this)},e}();function jE(e,t){var n=(e[1]-e[0])/t/2;e[0]+=n,e[1]-=n}var HE=2*Math.PI,WE=sm.CMD,$E=["top","right","bottom","left"];function KE(e,t,n,i,a){var r=n.width,o=n.height;switch(e){case"top":i.set(n.x+r/2,n.y-t),a.set(0,-1);break;case"bottom":i.set(n.x+r/2,n.y+o+t),a.set(0,1);break;case"left":i.set(n.x-t,n.y+o/2),a.set(-1,0);break;case"right":i.set(n.x+r+t,n.y+o/2),a.set(1,0)}}function YE(e,t,n,i,a,r,o,s,l){o-=e,s-=t;var p=Math.sqrt(o*o+s*s),c=(o/=p)*n+e,d=(s/=p)*n+t;if(Math.abs(i-a)%HE<1e-4)return l[0]=c,l[1]=d,p-n;if(r){var u=i;i=um(a),a=um(u)}else i=um(i),a=um(a);i>a&&(a+=HE);var m=Math.atan2(s,o);if(m<0&&(m+=HE),m>=i&&m<=a||m+HE>=i&&m+HE<=a)return l[0]=c,l[1]=d,p-n;var h=n*Math.cos(i)+e,g=n*Math.sin(i)+t,f=n*Math.cos(a)+e,y=n*Math.sin(a)+t,v=(h-o)*(h-o)+(g-s)*(g-s),x=(f-o)*(f-o)+(y-s)*(y-s);return v0){t=t/180*Math.PI,tM.fromArray(e[0]),nM.fromArray(e[1]),iM.fromArray(e[2]),Os.sub(aM,tM,nM),Os.sub(rM,iM,nM);var n=aM.len(),i=rM.len();if(!(n<.001||i<.001)){aM.scale(1/n),rM.scale(1/i);var a=aM.dot(rM);if(Math.cos(t)1&&Os.copy(lM,iM),lM.toArray(e[1])}}}}function cM(e,t,n){if(n<=180&&n>0){n=n/180*Math.PI,tM.fromArray(e[0]),nM.fromArray(e[1]),iM.fromArray(e[2]),Os.sub(aM,nM,tM),Os.sub(rM,iM,nM);var i=aM.len(),a=rM.len();if(!(i<.001||a<.001))if(aM.scale(1/i),rM.scale(1/a),aM.dot(t)=o)Os.copy(lM,iM);else{lM.scaleAndAdd(rM,r/Math.tan(Math.PI/2-s));var l=iM.x!==nM.x?(lM.x-nM.x)/(iM.x-nM.x):(lM.y-nM.y)/(iM.y-nM.y);if(isNaN(l))return;l<0?Os.copy(lM,nM):l>1&&Os.copy(lM,iM)}lM.toArray(e[1])}}}function dM(e,t,n,i){var a="normal"===n,r=a?e:e.ensureState(n);r.ignore=t;var o=i.get("smooth");o&&!0===o&&(o=.3),r.shape=r.shape||{},o>0&&(r.shape.smooth=o);var s=i.getModel("lineStyle").getLineStyle();a?e.useStyle(s):r.style=s}function uM(e,t){var n=t.smooth,i=t.points;if(i)if(e.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var a=jo(i[0],i[1]),r=jo(i[1],i[2]);if(!a||!r)return e.lineTo(i[1][0],i[1][1]),void e.lineTo(i[2][0],i[2][1]);var o=Math.min(a,r)*n,s=$o([],i[1],i[0],o/a),l=$o([],i[1],i[2],o/r),p=$o([],s,l,.5);e.bezierCurveTo(s[0],s[1],s[0],s[1],p[0],p[1]),e.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var c=1;c0&&r&&S(-d/o,0,o);var f,y,v=e[0],x=e[o-1];return b(),f<0&&C(-f,.8),y<0&&C(y,.8),b(),w(f,y,1),w(y,f,-1),b(),f<0&&_(-f),y<0&&_(y),p}function b(){f=v.rect[t]-i,y=a-x.rect[t]-x.rect[n]}function w(e,t,n){if(e<0){var i=Math.min(t,-e);if(i>0){S(i*n,0,o);var a=i+e;a<0&&C(-a*n,1)}else C(-e*n,1)}}function S(n,i,a){0!==n&&(p=!0);for(var r=i;r0)for(l=0;l0;l--){S(-(r[l-1]*d),l,o)}}}function _(e){var t=e<0?-1:1;e=Math.abs(e);for(var n=Math.ceil(e/(o-1)),i=0;i0?S(n,0,i+1):S(-n,o-i-1,o),(e-=n)<=0)return}}function yM(e,t,n,i){return fM(e,"y","height",t,n,i)}function vM(e){var t=[];e.sort(function(e,t){return t.priority-e.priority});var n=new zs(0,0,0,0);function i(e){if(!e.ignore){var t=e.ensureState("emphasis");null==t.ignore&&(t.ignore=!1)}e.ignore=!0}for(var a=0;a=0&&n.attr(m.oldLayoutSelect),Gr(p,"emphasis")>=0&&n.attr(m.oldLayoutEmphasis)),gf(n,s,t,o)}else if(n.attr(s),!cy(n).valueAnimation){var c=ho(n.style.opacity,1);n.style.opacity=0,ff(n,{style:{opacity:c}},t,o)}if(m.oldLayout=s,n.states.select){var d=m.oldLayoutSelect={};TM(d,s,EM),TM(d,n.states.select,EM)}if(n.states.emphasis){var u=m.oldLayoutEmphasis={};TM(u,s,EM),TM(u,n.states.emphasis,EM)}uy(n,o,l,t,t)}if(i&&!i.ignore&&!i.invisible){a=(m=_M(i)).oldLayout;var m,h={points:i.shape.points};a?(i.attr({shape:a}),gf(i,{shape:h},t)):(i.setShape(h),i.style.strokePercent=0,ff(i,{style:{strokePercent:1}},t)),m.oldLayout=h}},e}(),IM=Bd();function kM(e){e.registerUpdateLifecycle("series:beforeupdate",function(e,t,n){var i=IM(t).labelManager;i||(i=IM(t).labelManager=new MM),i.clearLabels()}),e.registerUpdateLifecycle("series:layoutlabels",function(e,t,n){var i=IM(t).labelManager;n.updatedSeries.forEach(function(e){i.addLabelsOfSeries(t.getViewOfSeriesModel(e))}),i.updateLayoutConfig(t),i.layout(t),i.processLabelsOverall()})}xE(kM);var PM=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return Xe(t,e),t.prototype.getInitialData=function(e){return pT(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new qc,n=HS("line",0,e.itemHeight/2,e.itemWidth,0,e.lineStyle.stroke,!1);t.add(n),n.setStyle(e.lineStyle);var i=this.getData().getVisual("symbol"),a=this.getData().getVisual("symbolRotate"),r="none"===i?"circle":i,o=.8*e.itemHeight,s=HS(r,(e.itemWidth-o)/2,(e.itemHeight-o)/2,o,o,e.itemStyle.fill);t.add(s),s.setStyle(e.itemStyle);var l="inherit"===e.iconRotate?a:e.iconRotate||0;return s.rotation=l*Math.PI/180,s.setOrigin([e.itemWidth/2,e.itemHeight/2]),r.indexOf("empty")>-1&&(s.style.stroke=s.style.fill,s.style.fill="#fff",s.style.lineWidth=2),t},t.type="series.line",t.dependencies=["grid","polar"],t.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},t}(ww);function DM(e,t){var n=e.mapDimensionsAll("defaultedLabel"),i=n.length;if(1===i){var a=fb(e,t,n[0]);return null!=a?a+"":null}if(i){for(var r=[],o=0;o=0&&i.push(t[r])}return i.join(" ")}var OM=function(e){function t(t,n,i,a){var r=e.call(this)||this;return r.updateData(t,n,i,a),r}return Xe(t,e),t.prototype._createSymbol=function(e,t,n,i,a){this.removeAll();var r=HS(e,-1,-1,2,2,null,a);r.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),r.drift=RM,this._symbolType=e,this.add(r)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){Dh(this.childAt(0))},t.prototype.downplay=function(){Ah(this.childAt(0))},t.prototype.setZ=function(e,t){var n=this.childAt(0);n.zlevel=e,n.z=t},t.prototype.setDraggable=function(e,t){var n=this.childAt(0);n.draggable=e,n.cursor=!t&&e?"move":n.cursor},t.prototype.updateData=function(e,n,i,a){this.silent=!1;var r=e.getItemVisual(n,"symbol")||"circle",o=e.hostModel,s=t.getSymbolSize(e,n),l=r!==this._symbolType,p=a&&a.disableAnimation;if(l){var c=e.getItemVisual(n,"symbolKeepAspect");this._createSymbol(r,e,n,s,c)}else{(u=this.childAt(0)).silent=!1;var d={scaleX:s[0]/2,scaleY:s[1]/2};p?u.attr(d):gf(u,d,o,n),wf(u)}if(this._updateCommon(e,n,s,i,a),l){var u=this.childAt(0);if(!p){d={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:u.style.opacity}};u.scaleX=u.scaleY=0,u.style.opacity=0,ff(u,d,o,n)}}p&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(e,t,n,i,a){var r,o,s,l,p,c,d,u,m,h=this.childAt(0),g=e.hostModel;if(i&&(r=i.emphasisItemStyle,o=i.blurItemStyle,s=i.selectItemStyle,l=i.focus,p=i.blurScope,d=i.labelStatesModels,u=i.hoverScale,m=i.cursorStyle,c=i.emphasisDisabled),!i||e.hasItemOption){var f=i&&i.itemModel?i.itemModel:e.getItemModel(t),y=f.getModel("emphasis");r=y.getModel("itemStyle").getItemStyle(),s=f.getModel(["select","itemStyle"]).getItemStyle(),o=f.getModel(["blur","itemStyle"]).getItemStyle(),l=y.get("focus"),p=y.get("blurScope"),c=y.get("disabled"),d=ny(f),u=y.getShallow("scale"),m=f.getShallow("cursor")}var v=e.getItemVisual(t,"symbolRotate");h.attr("rotation",(v||0)*Math.PI/180||0);var x=$S(e.getItemVisual(t,"symbolOffset"),n);x&&(h.x=x[0],h.y=x[1]),m&&h.attr("cursor",m);var b=e.getItemVisual(t,"style"),w=b.fill;if(h instanceof Om){var S=h.style;h.useStyle(Vr({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else h.__isEmptyBrush?h.useStyle(Vr({},b)):h.useStyle(b),h.style.decal=null,h.setColor(w,a&&a.symbolInnerColor),h.style.strokeNoScale=!0;var C=e.getItemVisual(t,"liftZ"),_=this._z2;null!=C?null==_&&(this._z2=h.z2,h.z2+=C):null!=_&&(h.z2=_,this._z2=null);var T=a&&a.useNameLabel;ty(h,d,{labelFetcher:g,labelDataIndex:t,defaultText:function(t){return T?e.getName(t):DM(e,t)},inheritColor:w,defaultOpacity:b.opacity}),this._sizeX=n[0]/2,this._sizeY=n[1]/2;var E=h.ensureState("emphasis");E.style=r,h.ensureState("select").style=s,h.ensureState("blur").style=o;var M=null==u||!0===u?Math.max(1.1,3/this._sizeY):isFinite(u)&&u>0?+u:1;E.scaleX=this._sizeX*M,E.scaleY=this._sizeY*M,this.setSymbolScale(1),Hh(this,l,p,c)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,t,n){var i=this.childAt(0),a=nh(this).dataIndex,r=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var o=i.getTextContent();o&&vf(o,{style:{opacity:0}},t,{dataIndex:a,removeOpt:r,cb:function(){i.removeTextContent()}})}else i.removeTextContent();vf(i,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:a,cb:e,removeOpt:r})},t.getSymbolSize=function(e,t){return WS(e.getItemVisual(t,"symbolSize"))},t}(qc);function RM(e,t){this.parent.drift(e,t)}function BM(e,t,n,i){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(i.isIgnore&&i.isIgnore(n))&&!(i.clipShape&&!i.clipShape.contain(t[0],t[1]))&&"none"!==e.getItemVisual(n,"symbol")}function FM(e){return null==e||ao(e)||(e={isIgnore:e}),e||{}}function NM(e){var t=e.hostModel,n=t.getModel("emphasis");return{emphasisItemStyle:n.getModel("itemStyle").getItemStyle(),blurItemStyle:t.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:t.getModel(["select","itemStyle"]).getItemStyle(),focus:n.get("focus"),blurScope:n.get("blurScope"),emphasisDisabled:n.get("disabled"),hoverScale:n.get("scale"),labelStatesModels:ny(t),cursorStyle:t.get("cursor")}}var LM=function(){function e(e){this.group=new qc,this._SymbolCtor=e||OM}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=FM(t);var n=this.group,i=e.hostModel,a=this._data,r=this._SymbolCtor,o=t.disableAnimation,s=NM(e),l={disableAnimation:o},p=t.getSymbolPoint||function(t){return e.getItemLayout(t)};a||n.removeAll(),e.diff(a).add(function(i){var a=p(i);if(BM(e,a,i,t)){var o=new r(e,i,s,l);o.setPosition(a),e.setItemGraphicEl(i,o),n.add(o)}}).update(function(c,d){var u=a.getItemGraphicEl(d),m=p(c);if(BM(e,m,c,t)){var h=e.getItemVisual(c,"symbol")||"circle",g=u&&u.getSymbolType&&u.getSymbolType();if(!u||g&&g!==h)n.remove(u),(u=new r(e,c,s,l)).setPosition(m);else{u.updateData(e,c,s,l);var f={x:m[0],y:m[1]};o?u.attr(f):gf(u,f,i)}n.add(u),e.setItemGraphicEl(c,u)}else n.remove(u)}).remove(function(e){var t=a.getItemGraphicEl(e);t&&t.fadeOut(function(){n.remove(t)},i)}).execute(),this._getSymbolPoint=p,this._data=e},e.prototype.updateLayout=function(){var e=this,t=this._data;t&&t.eachItemGraphicEl(function(t,n){var i=e._getSymbolPoint(n);t.setPosition(i),t.markRedraw()})},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=NM(e),this._data=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t,n){function i(e){e.isGroup||(e.incremental=!0,e.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],n=FM(n);for(var a=e.start;a0?n=i[0]:i[1]<0&&(n=i[1]);return n}(a,n),o=i.dim,s=a.dim,l=t.mapDimension(s),p=t.mapDimension(o),c="x"===s||"radius"===s?1:0,d=Wr(e.dimensions,function(e){return t.mapDimension(e)}),u=!1,m=t.getCalculationInfo("stackResultDimension");return sT(t,d[0])&&(u=!0,d[0]=m),sT(t,d[1])&&(u=!0,d[1]=m),{dataDimsForPoint:d,valueStart:r,valueAxisDim:s,baseAxisDim:o,stacked:!!u,valueDim:l,baseDim:p,baseDataOffset:c,stackedOverDimension:t.getCalculationInfo("stackedOverDimension")}}function qM(e,t,n,i){var a=NaN;e.stacked&&(a=n.get(n.getCalculationInfo("stackedOverDimension"),i)),isNaN(a)&&(a=e.valueStart);var r=e.baseDataOffset,o=[];return o[r]=n.get(e.baseDim,i),o[1-r]=a,t.dataToPoint(o)}var GM=Math.min,zM=Math.max;function UM(e,t){return isNaN(e)||isNaN(t)}function jM(e,t,n,i,a,r,o,s,l){for(var p,c,d,u,m,h,g=n,f=0;f=a||g<0)break;if(UM(y,v)){if(l){g+=r;continue}break}if(g===n)e[r>0?"moveTo":"lineTo"](y,v),d=y,u=v;else{var x=y-p,b=v-c;if(x*x+b*b<.5){g+=r;continue}if(o>0){for(var w=g+r,S=t[2*w],C=t[2*w+1];S===y&&C===v&&f=i||UM(S,C))m=y,h=v;else{E=S-p,M=C-c;var P=y-p,D=S-y,A=v-c,O=C-v,R=void 0,B=void 0;if("x"===s){var F=E>0?1:-1;m=y-F*(R=Math.abs(P))*o,h=v,I=y+F*(B=Math.abs(D))*o,k=v}else if("y"===s){var N=M>0?1:-1;m=y,h=v-N*(R=Math.abs(A))*o,I=y,k=v+N*(B=Math.abs(O))*o}else R=Math.sqrt(P*P+A*A),m=y-E*o*(1-(T=(B=Math.sqrt(D*D+O*O))/(B+R))),h=v-M*o*(1-T),k=v+M*o*T,I=GM(I=y+E*o*T,zM(S,y)),k=GM(k,zM(C,v)),I=zM(I,GM(S,y)),h=v-(M=(k=zM(k,GM(C,v)))-v)*R/B,m=GM(m=y-(E=I-y)*R/B,zM(p,y)),h=GM(h,zM(c,v)),I=y+(E=y-(m=zM(m,GM(p,y))))*B/R,k=v+(M=v-(h=zM(h,GM(c,v))))*B/R}e.bezierCurveTo(d,u,m,h,y,v),d=I,u=k}else e.lineTo(y,v)}p=y,c=v,g+=r}return f}var HM=function(){this.smooth=0,this.smoothConstraint=!0},WM=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polyline",n}return Xe(t,e),t.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},t.prototype.getDefaultShape=function(){return new HM},t.prototype.buildPath=function(e,t){var n=t.points,i=0,a=n.length/2;if(t.connectNulls){for(;a>0&&UM(n[2*a-2],n[2*a-1]);a--);for(;i=0){var f=o?(c-i)*g+i:(p-n)*g+n;return o?[e,f]:[f,e]}n=p,i=c;break;case r.C:p=a[l++],c=a[l++],d=a[l++],u=a[l++],m=a[l++],h=a[l++];var y=o?_l(n,p,d,m,e,s):_l(i,c,u,h,e,s);if(y>0)for(var v=0;v=0){f=o?Sl(i,c,u,h,x):Sl(n,p,d,m,x);return o?[e,f]:[f,e]}}n=m,i=h}}},t}(Im),$M=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t}(HM),KM=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polygon",n}return Xe(t,e),t.prototype.getDefaultShape=function(){return new $M},t.prototype.buildPath=function(e,t){var n=t.points,i=t.stackedOnPoints,a=0,r=n.length/2,o=t.smoothMonotone;if(t.connectNulls){for(;r>0&&UM(n[2*r-2],n[2*r-1]);r--);for(;a=0;o--){var s=e.getDimensionInfo(i[o].dimension);if("x"===(a=s&&s.coordDim)||"y"===a){r=i[o];break}}if(r){var l=t.getAxis(a),p=Wr(r.stops,function(e){return{coord:l.toGlobalCoord(l.dataToCoord(e.value)),color:e.color}}),c=p.length,d=r.outerColors.slice();c&&p[0].coord>p[c-1].coord&&(p.reverse(),d.reverse());var u=function(e,t){var n,i,a=[],r=e.length;function o(e,t,n){var i=e.coord;return{coord:n,color:ip((n-i)/(t.coord-i),[e.color,t.color])}}for(var s=0;st){i?a.push(o(i,l,t)):n&&a.push(o(n,l,0),o(n,l,t));break}n&&(a.push(o(n,l,0)),n=null),a.push(l),i=l}}return a}(p,"x"===a?n.getWidth():n.getHeight()),m=u.length;if(!m&&c)return p[0].coord<0?d[1]?d[1]:p[c-1].color:d[0]?d[0]:p[0].color;var h=u[0].coord-10,g=u[m-1].coord+10,f=g-h;if(f<.001)return"transparent";Hr(u,function(e){e.offset=(e.coord-h)/f}),u.push({offset:m?u[m-1].offset:.5,color:d[1]||"transparent"}),u.unshift({offset:m?u[0].offset:.5,color:d[0]||"transparent"});var y=new nf(0,0,0,0,u,!0);return y[a]=h,y[a+"2"]=g,y}}}function rI(e,t,n){var i=e.get("showAllSymbol"),a="auto"===i;if(!i||a){var r=n.getAxesByScale("ordinal")[0];if(r&&(!a||!function(e,t){var n=e.getExtent(),i=Math.abs(n[1]-n[0])/e.scale.count();isNaN(i)&&(i=0);for(var a=t.count(),r=Math.max(1,Math.round(a/5)),o=0;oi)return!1;return!0}(r,t))){var o=t.mapDimension(r.dim),s={};return Hr(r.getViewLabels(),function(e){var t=r.scale.getRawOrdinalNumber(e.tickValue);s[t]=1}),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function oI(e,t){return isNaN(e)||isNaN(t)}function sI(e,t){return[e[2*t],e[2*t+1]]}function lI(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&"bolder"===e.get(["emphasis","lineStyle","width"]))&&(m.getState("emphasis").style.lineWidth=+m.style.lineWidth+1);nh(m).seriesIndex=e.seriesIndex,Hh(m,P,D,A);var O=nI(e.get("smooth")),R=e.get("smoothMonotone");if(m.setShape({smooth:O,smoothMonotone:R,connectNulls:S}),h){var B=o.getCalculationInfo("stackedOnSeries"),F=0;h.useStyle(qr(l.getAreaStyle(),{fill:M,opacity:.7,lineJoin:"bevel",decal:o.getVisual("style").decal})),B&&(F=nI(B.get("smooth"))),h.setShape({smooth:O,stackedOnSmooth:F,smoothMonotone:R,connectNulls:S}),Yh(h,e,"areaStyle"),nh(h).seriesIndex=e.seriesIndex,Hh(h,P,D,A)}var N=function(e){i._changePolyState(e)};o.eachItemGraphicEl(function(e){e&&(e.onHoverStateChange=N)}),this._polyline.onHoverStateChange=N,this._data=o,this._coordSys=a,this._stackedOnPoints=b,this._points=p,this._step=E,this._valueOrigin=v,e.get("triggerLineEvent")&&(this.packEventData(e,m),h&&this.packEventData(e,h))},t.prototype.packEventData=function(e,t){nh(t).eventData={componentType:"series",componentSubType:"line",componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:"line"}},t.prototype.highlight=function(e,t,n,i){var a=e.getData(),r=Rd(a,i);if(this._changePolyState("emphasis"),!(r instanceof Array)&&null!=r&&r>=0){var o=a.getLayout("points"),s=a.getItemGraphicEl(r);if(!s){var l=o[2*r],p=o[2*r+1];if(isNaN(l)||isNaN(p))return;if(this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(l,p))return;var c=e.get("zlevel")||0,d=e.get("z")||0;(s=new OM(a,r)).x=l,s.y=p,s.setZ(c,d);var u=s.getSymbolPath().getTextContent();u&&(u.zlevel=c,u.z=d,u.z2=this._polyline.z2+1),s.__temp=!0,a.setItemGraphicEl(r,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else Ow.prototype.highlight.call(this,e,t,n,i)},t.prototype.downplay=function(e,t,n,i){var a=e.getData(),r=Rd(a,i);if(this._changePolyState("normal"),null!=r&&r>=0){var o=a.getItemGraphicEl(r);o&&(o.__temp?(a.setItemGraphicEl(r,null),this.group.remove(o)):o.downplay())}else Ow.prototype.downplay.call(this,e,t,n,i)},t.prototype._changePolyState=function(e){var t=this._polygon;Eh(this._polyline,e),t&&Eh(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new WM({shape:{points:e},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(t),this._polyline=t,t},t.prototype._newPolygon=function(e,t){var n=this._polygon;return n&&this._lineGroup.remove(n),n=new KM({shape:{points:e,stackedOnPoints:t},segmentIgnoreThreshold:2}),this._lineGroup.add(n),this._polygon=n,n},t.prototype._initSymbolLabelAnimation=function(e,t,n){var i,a,r=t.getBaseAxis(),o=r.inverse;"cartesian2d"===t.type?(i=r.isHorizontal(),a=!1):"polar"===t.type&&(i="angle"===r.dim,a=!0);var s=e.hostModel,l=s.get("animationDuration");eo(l)&&(l=l(null));var p=s.get("animationDelay")||0,c=eo(p)?p(null):p;e.eachItemGraphicEl(function(e,r){var s=e;if(s){var d=[e.x,e.y],u=void 0,m=void 0,h=void 0;if(n)if(a){var g=n,f=t.pointToCoord(d);i?(u=g.startAngle,m=g.endAngle,h=-f[1]/180*Math.PI):(u=g.r0,m=g.r,h=f[0])}else{var y=n;i?(u=y.x,m=y.x+y.width,h=e.x):(u=y.y+y.height,m=y.y,h=e.y)}var v=m===u?0:(h-u)/(m-u);o&&(v=1-v);var x=eo(p)?p(r):l*v+c,b=s.getSymbolPath(),w=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:x}),w&&w.animateFrom({style:{opacity:0}},{duration:300,delay:x}),b.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(e,t,n){var i=e.getModel("endLabel");if(lI(e)){var a=e.getData(),r=this._polyline,o=a.getLayout("points");if(!o)return r.removeTextContent(),void(this._endLabel=null);var s=this._endLabel;s||((s=this._endLabel=new Um({z2:200})).ignoreClip=!0,r.setTextContent(this._endLabel),r.disableLabelAnimation=!0);var l=function(e){for(var t=e.length/2;t>0&&oI(e[2*t-2],e[2*t-1]);t--);return t-1}(o);l>=0&&(ty(r,ny(e,"endLabel"),{inheritColor:n,labelFetcher:e,labelDataIndex:l,defaultText:function(e,t,n){return null!=n?AM(a,n):DM(a,e)},enableTextSetter:!0},function(e,t){var n=t.getBaseAxis(),i=n.isHorizontal(),a=n.inverse,r=i?a?"right":"left":"center",o=i?"middle":a?"top":"bottom";return{normal:{align:e.get("align")||r,verticalAlign:e.get("verticalAlign")||o}}}(i,t)),r.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(e,t,n,i,a,r,o){var s=this._endLabel,l=this._polyline;if(s){e<1&&null==i.originalX&&(i.originalX=s.x,i.originalY=s.y);var p=n.getLayout("points"),c=n.hostModel,d=c.get("connectNulls"),u=r.get("precision"),m=r.get("distance")||0,h=o.getBaseAxis(),g=h.isHorizontal(),f=h.inverse,y=t.shape,v=f?g?y.x:y.y+y.height:g?y.x+y.width:y.y,x=(g?m:0)*(f?-1:1),b=(g?0:-m)*(f?-1:1),w=g?"x":"y",S=function(e,t,n){for(var i,a,r=e.length/2,o="x"===n?0:1,s=0,l=-1,p=0;p=t||i>=t&&a<=t){l=p;break}s=p,i=a}else i=a;return{range:[s,l],t:(t-i)/(a-i)}}(p,v,w),C=S.range,_=C[1]-C[0],T=void 0;if(_>=1){if(_>1&&!d){var E=sI(p,C[0]);s.attr({x:E[0]+x,y:E[1]+b}),a&&(T=c.getRawValue(C[0]))}else{(E=l.getPointOn(v,w))&&s.attr({x:E[0]+x,y:E[1]+b});var M=c.getRawValue(C[0]),I=c.getRawValue(C[1]);a&&(T=jd(n,u,M,I,S.t))}i.lastFrameIndex=C[0]}else{var k=1===e||i.lastFrameIndex>0?C[0]:0;E=sI(p,k);a&&(T=c.getRawValue(k)),s.attr({x:E[0]+x,y:E[1]+b})}if(a){var P=cy(s);"function"==typeof P.setLabelText&&P.setLabelText(T)}}},t.prototype._doUpdateAnimation=function(e,t,n,i,a,r,o){var s=this._polyline,l=this._polygon,p=e.hostModel,c=function(e,t,n,i,a,r,o){for(var s=function(e,t){var n=[];return t.diff(e).add(function(e){n.push({cmd:"+",idx:e})}).update(function(e,t){n.push({cmd:"=",idx:t,idx1:e})}).remove(function(e){n.push({cmd:"-",idx:e})}).execute(),n}(e,t),l=[],p=[],c=[],d=[],u=[],m=[],h=[],g=VM(a,t,o),f=e.getLayout("points")||[],y=t.getLayout("points")||[],v=0;v3e3||l&&tI(u,h)>3e3)return s.stopAnimation(),s.setShape({points:m}),void(l&&(l.stopAnimation(),l.setShape({points:m,stackedOnPoints:h})));s.shape.__points=c.current,s.shape.points=d;var g={shape:{points:m}};c.current!==d&&(g.shape.__points=c.next),s.stopAnimation(),gf(s,g,p),l&&(l.setShape({points:d,stackedOnPoints:u}),l.stopAnimation(),gf(l,{shape:{stackedOnPoints:h}},p),s.shape.points!==l.shape.points&&(l.shape.points=s.shape.points));for(var f=[],y=c.status,v=0;vt&&(t=e[n]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,n=0;nt&&(t=r,n=a)}return isFinite(n)?n:NaN},nearest:function(e){return e[0]}},mI=function(e){return Math.round(e.length/2)};function hI(e){return{seriesType:e,reset:function(e,t,n){var i=e.getData(),a=e.get("sampling"),r=e.coordinateSystem,o=i.count();if(o>10&&"cartesian2d"===r.type&&a){var s=r.getBaseAxis(),l=r.getOtherAxis(s),p=s.getExtent(),c=n.getDevicePixelRatio(),d=Math.abs(p[1]-p[0])*(c||1),u=Math.round(o/d);if(isFinite(u)&&u>1){"lttb"===a&&e.setData(i.lttbDownSample(i.mapDimension(l.dim),1/u));var m=void 0;to(a)?m=uI[a]:eo(a)&&(m=a),m&&e.setData(i.downSample(i.mapDimension(l.dim),1/u,m,mI))}}}}}function gI(e){e.registerChartView(cI),e.registerSeriesModel(PM),e.registerLayout(dI("line",!0)),e.registerVisual({seriesType:"line",reset:function(e){var t=e.getData(),n=e.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=t.getVisual("style").fill),t.setVisual("legendLineStyle",n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,hI("line"))}var fI=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.getInitialData=function(e,t){return pT(null,this,{useEncodeDefaulter:!0})},t.prototype.getMarkerPosition=function(e,t,n){var i=this.coordinateSystem;if(i&&i.clampData){var a=i.clampData(e),r=i.dataToPoint(a);if(n)Hr(i.getAxes(),function(e,n){if("category"===e.type&&null!=t){var i=e.getTicksCoords(),o=e.getTickModel().get("alignWithLabel"),s=a[n],l="x1"===t[n]||"y1"===t[n];if(l&&!o&&(s+=1),i.length<2)return;if(2===i.length)return void(r[n]=e.toGlobalCoord(e.getExtent()[l?1:0]));for(var p=void 0,c=void 0,d=1,u=0;us){c=(m+p)/2;break}1===u&&(d=h-i[0].tickValue)}null==c&&(p?p&&(c=i[i.length-1].coord):c=i[0].coord),r[n]=e.toGlobalCoord(c)}});else{var o=this.getData(),s=o.getLayout("offset"),l=o.getLayout("size"),p=i.getBaseAxis().isHorizontal()?0:1;r[p]+=s+l/2}return r}return[NaN,NaN]},t.type="series.__base_bar__",t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},t}(ww);ww.registerClass(fI);var yI=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.getInitialData=function(){return pT(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},t.prototype.getProgressive=function(){return!!this.get("large")&&this.get("progressive")},t.prototype.getProgressiveThreshold=function(){var e=this.get("progressiveThreshold"),t=this.get("largeThreshold");return t>e&&(e=t),e},t.prototype.brushSelector=function(e,t,n){return n.rect(t.getItemLayout(e))},t.type="series.bar",t.dependencies=["grid","polar"],t.defaultOption=Iy(fI.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:"#212121"}},realtimeSort:!1}),t}(fI),vI=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},xI=function(e){function t(t){var n=e.call(this,t)||this;return n.type="sausage",n}return Xe(t,e),t.prototype.getDefaultShape=function(){return new vI},t.prototype.buildPath=function(e,t){var n=t.cx,i=t.cy,a=Math.max(t.r0||0,0),r=Math.max(t.r,0),o=.5*(r-a),s=a+o,l=t.startAngle,p=t.endAngle,c=t.clockwise,d=2*Math.PI,u=c?p-lr)return!0;r=p}return!1},t.prototype._isOrderDifferentInView=function(e,t){for(var n=t.scale,i=n.getExtent(),a=Math.max(0,i[0]),r=Math.min(i[1],n.getOrdinalMeta().categories.length-1);a<=r;++a)if(e.ordinalNumbers[a]!==n.getRawOrdinalNumber(a))return!0},t.prototype._updateSortWithinSameData=function(e,t,n,i){if(this._isOrderChangedWithinSameData(e,t,n)){var a=this._dataSort(e,n,t);this._isOrderDifferentInView(a,n)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",axisId:n.index,sortInfo:a}))}},t.prototype._dispatchInitSort=function(e,t,n){var i=t.baseAxis,a=this._dataSort(e,i,function(n){return e.get(e.mapDimension(t.otherAxis.dim),n)});n.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.index,sortInfo:a})},t.prototype.remove=function(e,t){this._clear(this._model),this._removeOnRenderedListener(t)},t.prototype.dispose=function(e,t){this._removeOnRenderedListener(t)},t.prototype._removeOnRenderedListener=function(e){this._onRendered&&(e.getZr().off("rendered",this._onRendered),this._onRendered=null)},t.prototype._clear=function(e){var t=this.group,n=this._data;e&&e.isAnimationEnabled()&&n&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],n.eachItemGraphicEl(function(t){bf(t,e,nh(t).dataIndex)})):t.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type="bar",t}(Ow),EI={cartesian2d:function(e,t){var n=t.width<0?-1:1,i=t.height<0?-1:1;n<0&&(t.x+=t.width,t.width=-t.width),i<0&&(t.y+=t.height,t.height=-t.height);var a=e.x+e.width,r=e.y+e.height,o=CI(t.x,e.x),s=_I(t.x+t.width,a),l=CI(t.y,e.y),p=_I(t.y+t.height,r),c=sa?s:o,t.y=d&&l>r?p:l,t.width=c?0:s-o,t.height=d?0:p-l,n<0&&(t.x+=t.width,t.width=-t.width),i<0&&(t.y+=t.height,t.height=-t.height),c||d},polar:function(e,t){var n=t.r0<=t.r?1:-1;if(n<0){var i=t.r;t.r=t.r0,t.r0=i}var a=_I(t.r,e.r),r=CI(t.r0,e.r0);t.r=a,t.r0=r;var o=a-r<0;if(n<0){i=t.r;t.r=t.r0,t.r0=i}return o}},MI={cartesian2d:function(e,t,n,i,a,r,o,s,l){var p=new qm({shape:Vr({},i),z2:1});(p.__dataIndex=n,p.name="item",r)&&(p.shape[a?"height":"width"]=0);return p},polar:function(e,t,n,i,a,r,o,s,l){var p=!a&&l?xI:Ng,c=new p({shape:i,z2:1});c.name="item";var d,u,m=RI(a);if(c.calculateTextPosition=(d=m,u=({isRoundCap:p===xI}||{}).isRoundCap,function(e,t,n){var i=t.position;if(!i||i instanceof Array)return kc(e,t,n);var a=d(i),r=null!=t.distance?t.distance:5,o=this.shape,s=o.cx,l=o.cy,p=o.r,c=o.r0,m=(p+c)/2,h=o.startAngle,g=o.endAngle,f=(h+g)/2,y=u?Math.abs(p-c)/2:0,v=Math.cos,x=Math.sin,b=s+p*v(h),w=l+p*x(h),S="left",C="top";switch(a){case"startArc":b=s+(c-r)*v(f),w=l+(c-r)*x(f),S="center",C="top";break;case"insideStartArc":b=s+(c+r)*v(f),w=l+(c+r)*x(f),S="center",C="bottom";break;case"startAngle":b=s+m*v(h)+bI(h,r+y,!1),w=l+m*x(h)+wI(h,r+y,!1),S="right",C="middle";break;case"insideStartAngle":b=s+m*v(h)+bI(h,-r+y,!1),w=l+m*x(h)+wI(h,-r+y,!1),S="left",C="middle";break;case"middle":b=s+m*v(f),w=l+m*x(f),S="center",C="middle";break;case"endArc":b=s+(p+r)*v(f),w=l+(p+r)*x(f),S="center",C="bottom";break;case"insideEndArc":b=s+(p-r)*v(f),w=l+(p-r)*x(f),S="center",C="top";break;case"endAngle":b=s+m*v(g)+bI(g,r+y,!0),w=l+m*x(g)+wI(g,r+y,!0),S="left",C="middle";break;case"insideEndAngle":b=s+m*v(g)+bI(g,-r+y,!0),w=l+m*x(g)+wI(g,-r+y,!0),S="right",C="middle";break;default:return kc(e,t,n)}return(e=e||{}).x=b,e.y=w,e.align=S,e.verticalAlign=C,e}),r){var h=a?"r":"endAngle",g={};c.shape[h]=a?i.r0:i.startAngle,g[h]=i[h],(s?gf:ff)(c,{shape:g},r)}return c}};function II(e,t,n,i,a,r,o,s){var l,p;r?(p={x:i.x,width:i.width},l={y:i.y,height:i.height}):(p={y:i.y,height:i.height},l={x:i.x,width:i.width}),s||(o?gf:ff)(n,{shape:l},t,a,null),(o?gf:ff)(n,{shape:p},t?e.baseAxis.model:null,a)}function kI(e,t){for(var n=0;n0?1:-1,o=i.height>0?1:-1;return{x:i.x+r*a/2,y:i.y+o*a/2,width:i.width-r*a,height:i.height-o*a}},polar:function(e,t,n){var i=e.getItemLayout(t);return{cx:i.cx,cy:i.cy,r0:i.r0,r:i.r,startAngle:i.startAngle,endAngle:i.endAngle,clockwise:i.clockwise}}};function RI(e){return function(e){var t=e?"Arc":"Angle";return function(e){switch(e){case"start":case"insideStart":case"end":case"insideEnd":return e+t;default:return e}}}(e)}function BI(e,t,n,i,a,r,o,s){var l=t.getItemVisual(n,"style");if(s){if(!r.get("roundCap")){var p=e.shape;Vr(p,SI(i.getModel("itemStyle"),p,!0)),e.setShape(p)}}else{var c=i.get(["itemStyle","borderRadius"])||0;e.setShape("r",c)}e.useStyle(l);var d=i.getShallow("cursor");d&&e.attr("cursor",d);var u=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?a.height>=0?"bottom":"top":a.width>=0?"right":"left",m=ny(i);ty(e,m,{labelFetcher:r,labelDataIndex:n,defaultText:DM(r.getData(),n),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:u});var h=e.getTextContent();if(s&&h){var g=i.get(["label","position"]);e.textConfig.inside="middle"===g||null,function(e,t,n,i){if(io(i))e.setTextConfig({rotation:i});else if(Jr(t))e.setTextConfig({rotation:0});else{var a,r=e.shape,o=r.clockwise?r.startAngle:r.endAngle,s=r.clockwise?r.endAngle:r.startAngle,l=(o+s)/2,p=n(t);switch(p){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":a=l;break;case"startAngle":case"insideStartAngle":a=o;break;case"endAngle":case"insideEndAngle":a=s;break;default:return void e.setTextConfig({rotation:0})}var c=1.5*Math.PI-a;"middle"===p&&c>Math.PI/2&&c<1.5*Math.PI&&(c-=Math.PI),e.setTextConfig({rotation:c})}}(e,"outside"===g?u:g,RI(o),i.get(["label","rotate"]))}dy(h,m,r.getRawValue(n),function(e){return AM(t,e)});var f=i.getModel(["emphasis"]);Hh(e,f.get("focus"),f.get("blurScope"),f.get("disabled")),Yh(e,i),function(e){return null!=e.startAngle&&null!=e.endAngle&&e.startAngle===e.endAngle}(a)&&(e.style.fill="none",e.style.stroke="none",Hr(e.states,function(e){e.style&&(e.style.fill=e.style.stroke="none")}))}var FI=function(){},NI=function(e){function t(t){var n=e.call(this,t)||this;return n.type="largeBar",n}return Xe(t,e),t.prototype.getDefaultShape=function(){return new FI},t.prototype.buildPath=function(e,t){for(var n=t.points,i=this.baseDimIdx,a=1-this.baseDimIdx,r=[],o=[],s=this.barWidth,l=0;l=s[0]&&t<=s[0]+l[0]&&n>=s[1]&&n<=s[1]+l[1])return o[c]}return-1}(this,e.offsetX,e.offsetY);nh(this).dataIndex=t>=0?t:null},30,!1);function qI(e,t,n){if(QM(n,"cartesian2d")){var i=t,a=n.getArea();return{x:e?i.x:a.x,y:e?a.y:i.y,width:e?i.width:a.width,height:e?a.height:i.height}}var r=t;return{cx:(a=n.getArea()).cx,cy:a.cy,r0:e?a.r0:r.r0,r:e?a.r:r.r,startAngle:e?r.startAngle:0,endAngle:e?r.endAngle:2*Math.PI}}function GI(e){e.registerChartView(TI),e.registerSeriesModel(yI),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Qr(RT,"bar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,BT("bar")),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,hI("bar")),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(e,t){var n=e.componentType||"series";t.eachComponent({mainType:n,query:e},function(t){e.sortInfo&&t.axis.setCategorySortInfo(e.sortInfo)})})}var zI=2*Math.PI,UI=Math.PI/180;function jI(e,t){return Iv(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()})}function HI(e,t){var n=jI(e,t),i=e.get("center"),a=e.get("radius");Jr(a)||(a=[0,a]);var r,o,s=Zc(n.width,t.getWidth()),l=Zc(n.height,t.getHeight()),p=Math.min(s,l),c=Zc(a[0],p/2),d=Zc(a[1],p/2),u=e.coordinateSystem;if(u){var m=u.dataToPoint(i);r=m[0]||0,o=m[1]||0}else Jr(i)||(i=[i,i]),r=Zc(i[0],s)+n.x,o=Zc(i[1],l)+n.y;return{cx:r,cy:o,r0:c,r:d}}function WI(e,t,n){t.eachSeriesByType(e,function(e){var t=e.getData(),i=t.mapDimension("value"),a=jI(e,n),r=HI(e,n),o=r.cx,s=r.cy,l=r.r,p=r.r0,c=-e.get("startAngle")*UI,d=e.get("endAngle"),u=e.get("padAngle")*UI;d="auto"===d?c-zI:-d*UI;var m=e.get("minAngle")*UI+u,h=0;t.each(i,function(e){!isNaN(e)&&h++});var g=t.getSum(i),f=Math.PI/(g||h)*2,y=e.get("clockwise"),v=e.get("roseType"),x=e.get("stillShowZeroSum"),b=t.getDataExtent(i);b[0]=0;var w=y?1:-1,S=[c,d],C=w*u/2;om(S,!y),c=S[0],d=S[1];var _=Math.abs(d-c),T=_,E=0,M=c;if(t.setLayout({viewRect:a,r:l}),t.each(i,function(e,n){var i;if(isNaN(e))t.setItemLayout(n,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:y,cx:o,cy:s,r0:p,r:v?NaN:l});else{(i="area"!==v?0===g&&x?f:e*f:_/h)i?c=r=M+w*i/2:(r=M+C,c=a-C),t.setItemLayout(n,{angle:i,startAngle:r,endAngle:c,clockwise:y,cx:o,cy:s,r0:p,r:v?Xc(e,b,[p,l]):l}),M=a}}),Tn?o:r,c=Math.abs(l.label.y-n);if(c>=p.maxY){var d=l.label.x-t-l.len2*a,u=i+l.len,h=Math.abs(d)e.unconstrainedWidth?null:m:null;i.setStyle("width",h)}var g=i.getBoundingRect();r.width=g.width;var f=(i.style.margin||0)+2.1;r.height=g.height+f,r.y-=(r.height-d)/2}}}function ZI(e){return"center"===e.position}function QI(e){var t,n,i=e.getData(),a=[],r=!1,o=(e.get("minShowLabelAngle")||0)*KI,s=i.getLayout("viewRect"),l=i.getLayout("r"),p=s.width,c=s.x,d=s.y,u=s.height;function m(e){e.ignore=!0}i.each(function(e){var s=i.getItemGraphicEl(e),d=s.shape,u=s.getTextContent(),h=s.getTextGuideLine(),g=i.getItemModel(e),f=g.getModel("label"),y=f.get("position")||g.get(["emphasis","label","position"]),v=f.get("distanceToLabelLine"),x=f.get("alignTo"),b=Zc(f.get("edgeDistance"),p),w=f.get("bleedMargin"),S=g.getModel("labelLine"),C=S.get("length");C=Zc(C,p);var _=S.get("length2");if(_=Zc(_,p),Math.abs(d.endAngle-d.startAngle)0?"right":"left":P>0?"left":"right"}var L=Math.PI,V=0,q=f.get("rotate");if(io(q))V=q*(L/180);else if("center"===y)V=0;else if("radial"===q||!0===q){V=P<0?-k+L:-k}else if("tangential"===q&&"outside"!==y&&"outer"!==y){var G=Math.atan2(P,D);G<0&&(G=2*L+G),D>0&&(G=L+G),V=G-L}if(r=!!V,u.x=T,u.y=E,u.rotation=V,u.setStyle({verticalAlign:"middle"}),A){u.setStyle({align:I});var z=u.states.select;z&&(z.x+=u.x,z.y+=u.y)}else{var U=u.getBoundingRect().clone();U.applyTransform(u.getComputedTransform());var j=(u.style.margin||0)+2.1;U.y-=j/2,U.height+=j,a.push({label:u,labelLine:h,position:y,len:C,len2:_,minTurnAngle:S.get("minTurnAngle"),maxSurfaceAngle:S.get("maxSurfaceAngle"),surfaceNormal:new Os(P,D),linePoints:M,textAlign:I,labelDistance:v,labelAlignTo:x,edgeDistance:b,bleedMargin:w,rect:U,unconstrainedWidth:U.width,labelStyleWidth:u.style.width})}s.setTextConfig({inside:A})}}),!r&&e.get("avoidLabelOverlap")&&function(e,t,n,i,a,r,o,s){for(var l=[],p=[],c=Number.MAX_VALUE,d=-Number.MAX_VALUE,u=0;u0){for(var l=r.getItemLayout(0),p=1;isNaN(l&&l.startAngle)&&p=n.r0}},t.type="pie",t}(Ow);function tk(e,t,n){t=Jr(t)&&{coordDimensions:t}||Vr({encodeDefine:e.getEncode()},t);var i=e.getSource(),a=tT(i,t).dimensions,r=new eT(a,e);return r.initData(i,n),r}var nk=function(){function e(e,t){this._getDataWithEncodedVisual=e,this._getRawData=t}return e.prototype.getAllNames=function(){var e=this._getRawData();return e.mapArray(e.getName)},e.prototype.containName=function(e){return this._getRawData().indexOfName(e)>=0},e.prototype.indexOfName=function(e){return this._getDataWithEncodedVisual().indexOfName(e)},e.prototype.getItemVisual=function(e,t){return this._getDataWithEncodedVisual().getItemVisual(e,t)},e}(),ik=Bd(),ak=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new nk(Zr(this.getData,this),Zr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return tk(this,{coordDimensions:["value"],encodeDefaulter:Qr(Jv,this)})},t.prototype.getDataParams=function(t){var n=this.getData(),i=ik(n),a=i.seats;if(!a){var r=[];n.each(n.mapDimension("value"),function(e){r.push(e)}),a=i.seats=id(r,n.hostModel.get("percentPrecision"))}var o=e.prototype.getDataParams.call(this,t);return o.percent=a[t]||0,o.$vars.push("percent"),o},t.prototype._defaultLabelLine=function(e){_d(e,"labelLine",["show"]);var t=e.labelLine,n=e.emphasis.labelLine;t.show=t.show&&e.label.show,n.show=n.show&&e.emphasis.label.show},t.type="series.pie",t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",bleedMargin:10,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:15,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},t}(ww);function rk(e){e.registerChartView(ek),e.registerSeriesModel(ak),DS("pie",e.registerAction),e.registerLayout(Qr(WI,"pie")),e.registerProcessor($I("pie")),e.registerProcessor(function(e){return{seriesType:e,reset:function(e,t){var n=e.getData();n.filterSelf(function(e){var t=n.mapDimension("value"),i=n.get(t,e);return!(io(i)&&!isNaN(i)&&i<0)})}}}("pie"))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}Xe(t,e),t.prototype.getInitialData=function(e,t){return pT(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){var e=this.option.progressive;return null==e?this.option.large?5e3:this.get("progressive"):e},t.prototype.getProgressiveThreshold=function(){var e=this.option.progressiveThreshold;return null==e?this.option.large?1e4:this.get("progressiveThreshold"):e},t.prototype.brushSelector=function(e,t,n){return n.point(t.getItemLayout(e))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},t.type="series.scatter",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}}}(ww);var ok=function(){},sk=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return Xe(t,e),t.prototype.getDefaultShape=function(){return new ok},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.buildPath=function(e,t){var n,i=t.points,a=t.size,r=this.symbolProxy,o=r.shape,s=e.getContext?e.getContext():e,l=s&&a[0]<4,p=this.softClipShape;if(l)this._ctx=s;else{for(this._ctx=null,n=this._off;n=0;s--){var l=2*s,p=i[l]-r/2,c=i[l+1]-o/2;if(e>=p&&t>=c&&e<=p+r&&t<=c+o)return s}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),i=this.getBoundingRect();return e=n[0],t=n[1],i.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape,n=t.points,i=t.size,a=i[0],r=i[1],o=1/0,s=1/0,l=-1/0,p=-1/0,c=0;c=0&&(l.dataIndex=n+(e.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),pk=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.render=function(e,t,n){var i=e.getData();this._updateSymbolDraw(i,e).updateData(i,{clipShape:this._getClipShape(e)}),this._finished=!0},t.prototype.incrementalPrepareRender=function(e,t,n){var i=e.getData();this._updateSymbolDraw(i,e).incrementalPrepareUpdate(i),this._finished=!1},t.prototype.incrementalRender=function(e,t,n){this._symbolDraw.incrementalUpdate(e,t.getData(),{clipShape:this._getClipShape(t)}),this._finished=e.end===t.getData().count()},t.prototype.updateTransform=function(e,t,n){var i=e.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var a=dI("").reset(e,t,n);a.progress&&a.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},t.prototype.eachRendered=function(e){this._symbolDraw&&this._symbolDraw.eachRendered(e)},t.prototype._getClipShape=function(e){if(e.get("clip",!0)){var t=e.coordinateSystem;return t&&t.getArea&&t.getArea(.1)}},t.prototype._updateSymbolDraw=function(e,t){var n=this._symbolDraw,i=t.pipelineContext.large;return n&&i===this._isLargeDraw||(n&&n.remove(),n=this._symbolDraw=i?new lk:new LM,this._isLargeDraw=i,this.group.removeAll()),this.group.add(n.group),n},t.prototype.remove=function(e,t){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter"}(Ow),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.type="grid",t.dependencies=["xAxis","yAxis"],t.layoutMode="box",t.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},t}(Bv)),ck=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Vd).models[0]},t.type="cartesian2dAxis",t}(Bv);Ur(ck,fE);var dk={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},uk=Nr({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},dk),mk=Nr({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},dk),hk={category:uk,value:mk,time:Nr({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},mk),log:qr({logBase:10},mk)},gk={value:1,category:1,time:1,log:1};function fk(e,t,n,i){Hr(gk,function(a,r){var o=Nr(Nr({},hk[r],!0),i,!0),s=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t+"Axis."+r,n}return Xe(n,e),n.prototype.mergeDefaultAndTheme=function(e,t){var n=Pv(this),i=n?Av(e):{};Nr(e,t.getTheme().get(r+"Axis")),Nr(e,this.getDefaultOption()),e.type=yk(e),n&&Dv(e,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=uT.createByAxisModel(this))},n.prototype.getCategories=function(e){var t=this.option;if("category"===t.type)return e?t.data:this.__ordinalMeta.categories},n.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},n.prototype.getTicksGenerator=function(){var e=this.option;if("value"===e.type)return e.ticksGenerator},n.type=t+"Axis."+r,n.defaultOption=o,n}(n);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+"Axis",yk)}function yk(e){return e.type||(e.data?"category":"value")}var vk=function(){function e(e){this.type="cartesian",this._dimList=[],this._axes={},this.name=e||""}return e.prototype.getAxis=function(e){return this._axes[e]},e.prototype.getAxes=function(){return Wr(this._dimList,function(e){return this._axes[e]},this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Kr(this.getAxes(),function(t){return t.scale.type===e})},e.prototype.addAxis=function(e){var t=e.dim;this._axes[t]=e,this._dimList.push(t)},e}(),xk=["x","y"];function bk(e){return"interval"===e.type||"time"===e.type}var wk=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=xk,t}return Xe(t,e),t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis("x").scale,t=this.getAxis("y").scale;if(bk(e)&&bk(t)){var n=e.getExtent(),i=t.getExtent(),a=this.dataToPoint([n[0],i[0]]),r=this.dataToPoint([n[1],i[1]]),o=n[1]-n[0],s=i[1]-i[0];if(o&&s){var l=(r[0]-a[0])/o,p=(r[1]-a[1])/s,c=a[0]-n[0]*l,d=a[1]-i[0]*p,u=this._transform=[l,0,0,p,c,d];this._invTransform=Ds([],u)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},t.prototype.containPoint=function(e){var t=this.getAxis("x"),n=this.getAxis("y");return t.contain(t.toLocalCoord(e[0]))&&n.contain(n.toLocalCoord(e[1]))},t.prototype.containData=function(e){return this.getAxis("x").containData(e[0])&&this.getAxis("y").containData(e[1])},t.prototype.containZone=function(e,t){var n=this.dataToPoint(e),i=this.dataToPoint(t),a=this.getArea(),r=new zs(n[0],n[1],i[0]-n[0],i[1]-n[1]);return a.intersect(r)},t.prototype.dataToPoint=function(e,t,n){n=n||[];var i=e[0],a=e[1];if(this._transform&&null!=i&&isFinite(i)&&null!=a&&isFinite(a))return Ko(n,e,this._transform);var r=this.getAxis("x"),o=this.getAxis("y");return n[0]=r.toGlobalCoord(r.dataToCoord(i,t)),n[1]=o.toGlobalCoord(o.dataToCoord(a,t)),n},t.prototype.clampData=function(e,t){var n=this.getAxis("x").scale,i=this.getAxis("y").scale,a=n.getExtent(),r=i.getExtent(),o=n.parse(e[0]),s=i.parse(e[1]);return(t=t||[])[0]=Math.min(Math.max(Math.min(a[0],a[1]),o),Math.max(a[0],a[1])),t[1]=Math.min(Math.max(Math.min(r[0],r[1]),s),Math.max(r[0],r[1])),t},t.prototype.pointToData=function(e,t){var n=[];if(this._invTransform)return Ko(n,e,this._invTransform);var i=this.getAxis("x"),a=this.getAxis("y");return n[0]=i.coordToData(i.toLocalCoord(e[0]),t),n[1]=a.coordToData(a.toLocalCoord(e[1]),t),n},t.prototype.getOtherAxis=function(e){return this.getAxis("x"===e.dim?"y":"x")},t.prototype.getArea=function(e){e=e||0;var t=this.getAxis("x").getGlobalExtent(),n=this.getAxis("y").getGlobalExtent(),i=Math.min(t[0],t[1])-e,a=Math.min(n[0],n[1])-e,r=Math.max(t[0],t[1])-i+e,o=Math.max(n[0],n[1])-a+e;return new zs(i,a,r,o)},t}(vk),Sk=function(e){function t(t,n,i,a,r){var o=e.call(this,t,n,i)||this;return o.index=0,o.type=a||"value",o.position=r||"bottom",o}return Xe(t,e),t.prototype.isHorizontal=function(){var e=this.position;return"top"===e||"bottom"===e},t.prototype.getGlobalExtent=function(e){var t=this.getExtent();return t[0]=this.toGlobalCoord(t[0]),t[1]=this.toGlobalCoord(t[1]),e&&t[0]>t[1]&&t.reverse(),t},t.prototype.pointToData=function(e,t){return this.coordToData(this.toLocalCoord(e["x"===this.dim?0:1]),t)},t.prototype.setCategorySortInfo=function(e){if("category"!==this.type)return!1;this.model.option.categorySortInfo=e,this.scale.setSortInfo(e)},t}(UE);function Ck(e,t,n){n=n||{};var i=e.coordinateSystem,a=t.axis,r={},o=a.getAxesOnZeroOf()[0],s=a.position,l=o?"onZero":s,p=a.dim,c=i.getRect(),d=[c.x,c.x+c.width,c.y,c.y+c.height],u={left:0,right:1,top:0,bottom:1,onZero:2},m=t.get("offset")||0,h="x"===p?[d[2]-m,d[3]+m]:[d[0]-m,d[1]+m];if(o){var g=o.toGlobalCoord(o.dataToCoord(0));h[u.onZero]=Math.max(Math.min(g,h[1]),h[0])}r.position=["y"===p?h[u[l]]:d[0],"x"===p?h[u[l]]:d[3]],r.rotation=Math.PI/2*("x"===p?0:1);r.labelDirection=r.tickDirection=r.nameDirection={top:-1,bottom:1,left:-1,right:1}[s],r.labelOffset=o?h[u[s]]-h[u.onZero]:0,t.get(["axisTick","inside"])&&(r.tickDirection=-r.tickDirection),mo(n.labelInside,t.get(["axisLabel","inside"]))&&(r.labelDirection=-r.labelDirection);var f=t.get(["axisLabel","rotate"]);return r.labelRotate="top"===l?-f:f,r.z2=1,r}function _k(e){return"cartesian2d"===e.get("coordinateSystem")}function Tk(e){var t={xAxisModel:null,yAxisModel:null};return Hr(t,function(n,i){var a=i.replace(/Model$/,""),r=e.getReferringComponents(a,Vd).models[0];t[i]=r}),t}var Ek=Math.log;function Mk(e,t,n){var i=_T.prototype,a=i.getTicks.call(n),r=i.getTicks.call(n,!0),o=a.length-1,s=i.getInterval.call(n),l=sE(e,t),p=l.extent,c=l.fixMin,d=l.fixMax;if("log"===e.type){var u=Ek(e.base);p=[Ek(p[0])/u,Ek(p[1])/u]}e.setExtent(p[0],p[1]),e.calcNiceExtent({splitNumber:o,fixMin:c,fixMax:d});var m=i.getExtent.call(e);c&&(p[0]=m[0]),d&&(p[1]=m[1]);var h=i.getInterval.call(e),g=p[0],f=p[1];if(c&&d)h=(f-g)/o;else if(c)for(f=p[0]+h*o;fp[0]&&isFinite(g)&&isFinite(p[0]);)h=fT(h),g=p[1]-h*o;else{e.getTicks().length-1>o&&(h=fT(h));var y=h*o;(g=Qc((f=Math.ceil(p[1]/h)*h)-y))<0&&p[0]>=0?(g=0,f=Qc(y)):f>0&&p[1]<=0&&(f=0,g=-Qc(y))}var v=(a[0].value-r[0].value)/s,x=(a[o].value-r[o].value)/s;i.setExtent.call(e,g+h*v,f+h*x),i.setInterval.call(e,h),(v||x)&&i.setNiceExtent.call(e,g+h,f-h)}var Ik=function(){function e(e,t,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=xk,this._initCartesian(e,t,n),this.model=e}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(e,t){var n=this._axesMap;function i(e){var t,n=Xr(e),i=n.length;if(i){for(var a=[],r=i-1;r>=0;r--){var o=(l=e[+n[r]]).model,s=l.scale;hT(s)&&o.get("alignTicks")&&null==o.get("interval")&&null==o.getTicksGenerator()?a.push(l):(lE(s,o),hT(s)&&!s.isBlank()&&(t=l))}if(a.length){for(;!t&&a.length;){var l;lE((l=a.pop()).scale,l.model),l.scale.isBlank()||(t=l)}a.length&&t&&Hr(a,function(e){Mk(e.scale,e.model,t.scale)})}}}this._updateScale(e,this.model),i(n.x),i(n.y);var a={};Hr(n.x,function(e){Pk(n,"y",e,a)}),Hr(n.y,function(e){Pk(n,"x",e,a)}),this.resize(this.model,t)},e.prototype.resize=function(e,t,n){var i=e.getBoxLayoutParams(),a=!n&&e.get("containLabel"),r=Iv(i,{width:t.getWidth(),height:t.getHeight()});this._rect=r;var o=this._axesList;function s(){Hr(o,function(e){var t=e.isHorizontal(),n=t?[0,r.width]:[0,r.height],i=e.inverse?1:0;e.setExtent(n[i],n[1-i]),function(e,t){var n=e.getExtent(),i=n[0]+n[1];e.toGlobalCoord="x"===e.dim?function(e){return e+t}:function(e){return i-e+t},e.toLocalCoord="x"===e.dim?function(e){return e-t}:function(e){return i-e+t}}(e,t?r.x:r.y)})}s(),a&&(Hr(o,function(e){if(!e.model.get(["axisLabel","inside"])){var t=function(e){var t=e.model,n=e.scale;if(t.get(["axisLabel","show"])&&!n.isBlank()){var i,a,r=n.getExtent();a=n instanceof ST?n.count():(i=n.getTicks()).length;var o,s=e.getLabelModel(),l=cE(e),p=1;a>40&&(p=Math.ceil(a/40));for(var c=0;c0&&i>0||n<0&&i<0)}(e)}var Ak=Math.PI,Ok=function(){function e(e,t){this.group=new qc,this.opt=t,this.axisModel=e,qr(t,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new qc({x:t.position[0],y:t.position[1],rotation:t.rotation});n.updateTransform(),this._transformGroup=n}return e.prototype.hasBuilder=function(e){return!!Rk[e]},e.prototype.add=function(e){Rk[e](this.opt,this.axisModel,this.group,this._transformGroup)},e.prototype.getGroup=function(){return this.group},e.innerTextLayout=function(e,t,n){var i,a,r=rd(t-e);return od(r)?(a=n>0?"top":"bottom",i="center"):od(r-Ak)?(a=n>0?"bottom":"top",i="center"):(a="middle",i=r>0&&r0?"right":"left":n>0?"left":"right"),{rotation:r,textAlign:i,textVerticalAlign:a}},e.makeAxisEventDataBase=function(e){var t={componentType:e.mainType,componentIndex:e.componentIndex};return t[e.mainType+"Index"]=e.componentIndex,t},e.isLabelSilent=function(e){var t=e.get("tooltip");return e.get("silent")||!(e.get("triggerEvent")||t&&t.show)},e}(),Rk={axisLine:function(e,t,n,i){var a=t.get(["axisLine","show"]);if("auto"===a&&e.handleAutoShown&&(a=e.handleAutoShown("axisLine")),a){var r=t.axis.getExtent(),o=i.transform,s=[r[0],0],l=[r[1],0],p=s[0]>l[0];o&&(Ko(s,s,o),Ko(l,l,o));var c=Vr({lineCap:"round"},t.getModel(["axisLine","lineStyle"]).getLineStyle()),d=new $g({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:e.strokeContainThreshold||5,silent:!0,z2:1});Bf(d.shape,d.style.lineWidth),d.anid="line",n.add(d);var u=t.get(["axisLine","symbol"]);if(null!=u){var m=t.get(["axisLine","symbolSize"]);to(u)&&(u=[u,u]),(to(m)||io(m))&&(m=[m,m]);var h=$S(t.get(["axisLine","symbolOffset"])||0,m),g=m[0],f=m[1];Hr([{rotate:e.rotation+Math.PI/2,offset:h[0],r:0},{rotate:e.rotation-Math.PI/2,offset:h[1],r:Math.sqrt((s[0]-l[0])*(s[0]-l[0])+(s[1]-l[1])*(s[1]-l[1]))}],function(t,i){if("none"!==u[i]&&null!=u[i]){var a=HS(u[i],-g/2,-f/2,g,f,c.stroke,!0),r=t.r+t.offset,o=p?l:s;a.attr({rotation:t.rotate,x:o[0]+r*Math.cos(e.rotation),y:o[1]-r*Math.sin(e.rotation),silent:!0,z2:11}),n.add(a)}})}}},axisTickLabel:function(e,t,n,i){var a=function(e,t,n,i){var a=n.axis,r=n.getModel("axisTick"),o=r.get("show");"auto"===o&&i.handleAutoShown&&(o=i.handleAutoShown("axisTick"));if(!o||a.scale.isBlank())return;for(var s=r.getModel("lineStyle"),l=i.tickDirection*r.get("length"),p=Lk(a.getTicksCoords(),t.transform,l,qr(s.getLineStyle(),{stroke:n.get(["axisLine","lineStyle","color"])}),"ticks"),c=0;cd[1]?-1:1,m=["start"===s?d[0]-u*c:"end"===s?d[1]+u*c:(d[0]+d[1])/2,Nk(s)?e.labelOffset+l*c:0],h=t.get("nameRotate");null!=h&&(h=h*Ak/180),Nk(s)?r=Ok.innerTextLayout(e.rotation,null!=h?h:e.rotation,l):(r=function(e,t,n,i){var a,r,o=rd(n-e),s=i[0]>i[1],l="start"===t&&!s||"start"!==t&&s;od(o-Ak/2)?(r=l?"bottom":"top",a="center"):od(o-1.5*Ak)?(r=l?"top":"bottom",a="center"):(r="middle",a=o<1.5*Ak&&o>Ak/2?l?"left":"right":l?"right":"left");return{rotation:o,textAlign:a,textVerticalAlign:r}}(e.rotation,s,h||0,d),null!=(o=e.axisNameAvailableWidth)&&(o=Math.abs(o/Math.sin(r.rotation)),!isFinite(o)&&(o=null)));var g=p.getFont(),f=t.get("nameTruncate",!0)||{},y=f.ellipsis,v=mo(e.nameTruncateMaxWidth,f.maxWidth,o),x=new Um({x:m[0],y:m[1],rotation:r.rotation,silent:Ok.isLabelSilent(t),style:iy(p,{text:a,font:g,overflow:"truncate",width:v,ellipsis:y,fill:p.getTextColor()||t.get(["axisLine","lineStyle","color"]),align:p.get("align")||r.textAlign,verticalAlign:p.get("verticalAlign")||r.textVerticalAlign}),z2:1});if(Kf({el:x,componentModel:t,itemName:a}),x.__fullText=a,x.anid="name",t.get("triggerEvent")){var b=Ok.makeAxisEventDataBase(t);b.targetType="axisName",b.name=a,nh(x).eventData=b}i.add(x),x.updateTransform(),n.add(x),x.decomposeTransform()}}};function Bk(e){e&&(e.ignore=!0)}function Fk(e,t){var n=e&&e.getBoundingRect().clone(),i=t&&t.getBoundingRect().clone();if(n&&i){var a=Ts([]);return ks(a,a,-e.rotation),n.applyTransform(Ms([],a,e.getLocalTransform())),i.applyTransform(Ms([],a,t.getLocalTransform())),n.intersect(i)}}function Nk(e){return"middle"===e||"center"===e}function Lk(e,t,n,i,a){for(var r=[],o=[],s=[],l=0;l=0||e===t}function Gk(e){var t=(e.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return t&&t.axesInfo[Uk(e)]}function zk(e){return!!e.get(["handle","show"])}function Uk(e){return e.type+"||"+e.id}var jk={},Hk=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.render=function(t,n,i,a){this.axisPointerClass&&function(e){var t=Gk(e);if(t){var n=t.axisPointerModel,i=t.axis.scale,a=n.option,r=n.get("status"),o=n.get("value");null!=o&&(o=i.parse(o));var s=zk(n);null==r&&(a.status=s?"show":"hide");var l=i.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==o||o>l[1])&&(o=l[1]),o0&&!d.min?d.min=0:null!=d.min&&d.min<0&&!d.max&&(d.max=0);var u=o;null!=d.color&&(u=qr({color:d.color},o));var m=Nr(Fr(d),{boundaryGap:e,splitNumber:t,scale:n,axisLine:i,axisTick:a,axisLabel:r,name:d.text,showName:s,nameLocation:"end",nameGap:p,nameTextStyle:u,triggerEvent:c},!1);if(to(l)){var h=m.name;m.name=l.replace("{value}",null!=h?h:"")}else eo(l)&&(m.name=l(m.name,m));var g=new Ty(m,null,this.ecModel);return Ur(g,fE.prototype),g.mainType="radar",g.componentIndex=this.componentIndex,g},this);this._indicatorModels=d},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type="radar",t.defaultOption={z:0,center:["50%","50%"],radius:"75%",startAngle:90,axisName:{show:!0},boundaryGap:[0,0],splitNumber:5,axisNameGap:15,scale:!1,shape:"polygon",axisLine:Nr({lineStyle:{color:"#bbb"}},cP.axisLine),axisLabel:dP(cP.axisLabel,!1),axisTick:dP(cP.axisTick,!1),splitLine:dP(cP.splitLine,!0),splitArea:dP(cP.splitArea,!0),indicator:[]},t}(Bv),mP=["axisLine","axisTickLabel","axisName"],hP=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.render=function(e,t,n){this.group.removeAll(),this._buildAxes(e),this._buildSplitLineAndArea(e)},t.prototype._buildAxes=function(e){var t=e.coordinateSystem;Hr(Wr(t.getIndicatorAxes(),function(e){var n=e.model.get("showName")?e.name:"";return new Ok(e.model,{axisName:n,position:[t.cx,t.cy],rotation:e.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})}),function(e){Hr(mP,e.add,e),this.group.add(e.getGroup())},this)},t.prototype._buildSplitLineAndArea=function(e){var t=e.coordinateSystem,n=t.getIndicatorAxes();if(n.length){var i=e.get("shape"),a=e.getModel("splitLine"),r=e.getModel("splitArea"),o=a.getModel("lineStyle"),s=r.getModel("areaStyle"),l=a.get("show"),p=r.get("show"),c=o.get("color"),d=s.get("color"),u=Jr(c)?c:[c],m=Jr(d)?d:[d],h=[],g=[];if("circle"===i)for(var f=n[0].getTicksCoords(),y=t.cx,v=t.cy,x=0;x3?1.4:a>1?1.2:1.1;CP(this,"zoom","zoomOnMouseWheel",e,{scale:i>0?s:1/s,originX:r,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(i);CP(this,"scrollMove","moveOnMouseWheel",e,{scrollDelta:(i>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:r,originY:o,isAvailableBehavior:null})}}},t.prototype._pinchHandler=function(e){bP(this._zr,"globalPan")||CP(this,"zoom",null,e,{scale:e.pinchScale>1?1.1:1/1.1,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})},t}(Jo);function CP(e,t,n,i,a){e.pointerChecker&&e.pointerChecker(i,a.originX,a.originY)&&(xs(i.event),_P(e,t,n,i,a))}function _P(e,t,n,i,a){a.isAvailableBehavior=Zr(TP,null,n,i),e.trigger(t,a)}function TP(e,t,n){var i=n[e];return!e||i&&(!to(i)||t.event[i+"Key"])}function EP(e,t,n){var i=e.target;i.x+=t,i.y+=n,i.dirty()}function MP(e,t,n,i){var a=e.target,r=e.zoomLimit,o=e.zoom=e.zoom||1;if(o*=t,r){var s=r.min||0,l=r.max||1/0;o=Math.max(Math.min(l,o),s)}var p=o/e.zoom;e.zoom=o,a.x-=(n-a.x)*(p-1),a.y-=(i-a.y)*(p-1),a.scaleX*=p,a.scaleY*=p,a.dirty()}var IP,kP={axisPointer:1,tooltip:1,brush:1};function PP(e,t,n){var i=t.getComponentByElement(e.topTarget),a=i&&i.coordinateSystem;return i&&i!==n&&!kP.hasOwnProperty(i.mainType)&&a&&a.model!==n}function DP(e){to(e)&&(e=(new DOMParser).parseFromString(e,"text/xml"));var t=e;for(9===t.nodeType&&(t=t.firstChild);"svg"!==t.nodeName.toLowerCase()||1!==t.nodeType;)t=t.nextSibling;return t}var AP={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-anchor":"textAlign",visibility:"visibility",display:"display"},OP=Xr(AP),RP={"alignment-baseline":"textBaseline","stop-color":"stopColor"},BP=Xr(RP),FP=function(){function e(){this._defs={},this._root=null}return e.prototype.parse=function(e,t){t=t||{};var n=DP(e);this._defsUsePending=[];var i=new qc;this._root=i;var a=[],r=n.getAttribute("viewBox")||"",o=parseFloat(n.getAttribute("width")||t.width),s=parseFloat(n.getAttribute("height")||t.height);isNaN(o)&&(o=null),isNaN(s)&&(s=null),zP(n,i,null,!0,!1);for(var l,p,c=n.firstChild;c;)this._parseNode(c,i,a,null,!1,!1),c=c.nextSibling;if(function(e,t){for(var n=0;n=4&&(l={x:parseFloat(d[0]||0),y:parseFloat(d[1]||0),width:parseFloat(d[2]),height:parseFloat(d[3])})}if(l&&null!=o&&null!=s&&(p=ZP(l,{x:0,y:0,width:o,height:s}),!t.ignoreViewBox)){var u=i;(i=new qc).add(u),u.scaleX=u.scaleY=p.scale,u.x=p.x,u.y=p.y}return t.ignoreRootClip||null==o||null==s||i.setClipPath(new qm({shape:{x:0,y:0,width:o,height:s}})),{root:i,width:o,height:s,viewBoxRect:l,viewBoxTransform:p,named:a}},e.prototype._parseNode=function(e,t,n,i,a,r){var o,s=e.nodeName.toLowerCase(),l=i;if("defs"===s&&(a=!0),"text"===s&&(r=!0),"defs"===s||"switch"===s)o=t;else{if(!a){var p=IP[s];if(p&&Po(IP,s)){o=p.call(this,e,t);var c=e.getAttribute("name");if(c){var d={name:c,namedFrom:null,svgNodeTagLower:s,el:o};n.push(d),"g"===s&&(l=d)}else i&&n.push({name:i.name,namedFrom:i,svgNodeTagLower:s,el:o});t.add(o)}}var u=NP[s];if(u&&Po(NP,s)){var m=u.call(this,e),h=e.getAttribute("id");h&&(this._defs[h]=m)}}if(o&&o.isGroup)for(var g=e.firstChild;g;)1===g.nodeType?this._parseNode(g,o,n,l,a,r):3===g.nodeType&&r&&this._parseText(g,o),g=g.nextSibling},e.prototype._parseText=function(e,t){var n=new Pm({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});qP(t,n),zP(e,n,this._defsUsePending,!1,!1),function(e,t){var n=t.__selfStyle;if(n){var i=n.textBaseline,a=i;i&&"auto"!==i?"baseline"===i?a="alphabetic":"before-edge"===i||"text-before-edge"===i?a="top":"after-edge"===i||"text-after-edge"===i?a="bottom":"central"!==i&&"mathematical"!==i||(a="middle"):a="alphabetic",e.style.textBaseline=a}var r=t.__inheritedStyle;if(r){var o=r.textAlign,s=o;o&&("middle"===o&&(s="center"),e.style.textAlign=s)}}(n,t);var i=n.style,a=i.fontSize;a&&a<9&&(i.fontSize=9,n.scaleX*=a/9,n.scaleY*=a/9);var r=(i.fontSize||i.fontFamily)&&[i.fontStyle,i.fontWeight,(i.fontSize||12)+"px",i.fontFamily||"sans-serif"].join(" ");i.font=r;var o=n.getBoundingRect();return this._textX+=o.width,t.add(n),n},e.internalField=void(IP={g:function(e,t){var n=new qc;return qP(t,n),zP(e,n,this._defsUsePending,!1,!1),n},rect:function(e,t){var n=new qm;return qP(t,n),zP(e,n,this._defsUsePending,!1,!1),n.setShape({x:parseFloat(e.getAttribute("x")||"0"),y:parseFloat(e.getAttribute("y")||"0"),width:parseFloat(e.getAttribute("width")||"0"),height:parseFloat(e.getAttribute("height")||"0")}),n.silent=!0,n},circle:function(e,t){var n=new bg;return qP(t,n),zP(e,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),r:parseFloat(e.getAttribute("r")||"0")}),n.silent=!0,n},line:function(e,t){var n=new $g;return qP(t,n),zP(e,n,this._defsUsePending,!1,!1),n.setShape({x1:parseFloat(e.getAttribute("x1")||"0"),y1:parseFloat(e.getAttribute("y1")||"0"),x2:parseFloat(e.getAttribute("x2")||"0"),y2:parseFloat(e.getAttribute("y2")||"0")}),n.silent=!0,n},ellipse:function(e,t){var n=new Sg;return qP(t,n),zP(e,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(e.getAttribute("cx")||"0"),cy:parseFloat(e.getAttribute("cy")||"0"),rx:parseFloat(e.getAttribute("rx")||"0"),ry:parseFloat(e.getAttribute("ry")||"0")}),n.silent=!0,n},polygon:function(e,t){var n,i=e.getAttribute("points");i&&(n=GP(i));var a=new zg({shape:{points:n||[]},silent:!0});return qP(t,a),zP(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var n,i=e.getAttribute("points");i&&(n=GP(i));var a=new jg({shape:{points:n||[]},silent:!0});return qP(t,a),zP(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var n=new Om;return qP(t,n),zP(e,n,this._defsUsePending,!1,!1),n.setStyle({image:e.getAttribute("xlink:href")||e.getAttribute("href"),x:+e.getAttribute("x"),y:+e.getAttribute("y"),width:+e.getAttribute("width"),height:+e.getAttribute("height")}),n.silent=!0,n},text:function(e,t){var n=e.getAttribute("x")||"0",i=e.getAttribute("y")||"0",a=e.getAttribute("dx")||"0",r=e.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(a),this._textY=parseFloat(i)+parseFloat(r);var o=new qc;return qP(t,o),zP(e,o,this._defsUsePending,!1,!0),o},tspan:function(e,t){var n=e.getAttribute("x"),i=e.getAttribute("y");null!=n&&(this._textX=parseFloat(n)),null!=i&&(this._textY=parseFloat(i));var a=e.getAttribute("dx")||"0",r=e.getAttribute("dy")||"0",o=new qc;return qP(t,o),zP(e,o,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(r),o},path:function(e,t){var n=vg(e.getAttribute("d")||"");return qP(t,n),zP(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}),e}(),NP={lineargradient:function(e){var t=parseInt(e.getAttribute("x1")||"0",10),n=parseInt(e.getAttribute("y1")||"0",10),i=parseInt(e.getAttribute("x2")||"10",10),a=parseInt(e.getAttribute("y2")||"0",10),r=new nf(t,n,i,a);return LP(e,r),VP(e,r),r},radialgradient:function(e){var t=parseInt(e.getAttribute("cx")||"0",10),n=parseInt(e.getAttribute("cy")||"0",10),i=parseInt(e.getAttribute("r")||"0",10),a=new af(t,n,i);return LP(e,a),VP(e,a),a}};function LP(e,t){"userSpaceOnUse"===e.getAttribute("gradientUnits")&&(t.global=!0)}function VP(e,t){for(var n=e.firstChild;n;){if(1===n.nodeType&&"stop"===n.nodeName.toLocaleLowerCase()){var i=n.getAttribute("offset"),a=void 0;a=i&&i.indexOf("%")>0?parseInt(i,10)/100:i?parseFloat(i):0;var r={};XP(n,r,r);var o=r.stopColor||n.getAttribute("stop-color")||"#000000";t.colorStops.push({offset:a,color:o})}n=n.nextSibling}}function qP(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),qr(t.__inheritedStyle,e.__inheritedStyle))}function GP(e){for(var t=WP(e),n=[],i=0;i0;r-=2){var o=i[r],s=i[r-1],l=WP(o);switch(a=a||_s(),s){case"translate":Is(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Ps(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":ks(a,a,-parseFloat(l[0])*KP,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":Ms(a,[1,0,Math.tan(parseFloat(l[0])*KP),1,0,0],a);break;case"skewY":Ms(a,[1,Math.tan(parseFloat(l[0])*KP),0,1,0,0],a);break;case"matrix":a[0]=parseFloat(l[0]),a[1]=parseFloat(l[1]),a[2]=parseFloat(l[2]),a[3]=parseFloat(l[3]),a[4]=parseFloat(l[4]),a[5]=parseFloat(l[5])}}t.setLocalTransform(a)}}(e,t),XP(e,o,s),i||function(e,t,n){for(var i=0;i0,h={api:n,geo:s,mapOrGeoModel:e,data:o,isVisualEncodedByVisualMap:m,isGeo:r,transformInfoRaw:d};"geoJSON"===s.resourceType?this._buildGeoJSON(h):"geoSVG"===s.resourceType&&this._buildSVG(h),this._updateController(e,t,n),this._updateMapSelectHandler(e,l,n,i)},e.prototype._buildGeoJSON=function(e){var t=this._regionsGroupByName=Eo(),n=Eo(),i=this._regionsGroup,a=e.transformInfoRaw,r=e.mapOrGeoModel,o=e.data,s=e.geo.projection,l=s&&s.stream;function p(e,t){return t&&(e=t(e)),e&&[e[0]*a.scaleX+a.x,e[1]*a.scaleY+a.y]}function c(e){for(var t=[],n=!l&&s&&s.project,i=0;i=0)&&(u=a);var m=o?{normal:{align:"center",verticalAlign:"middle"}}:null;ty(t,ny(i),{labelFetcher:u,labelDataIndex:d,defaultText:n},m);var h=t.getTextContent();if(h&&(hD(h).ignore=h.ignore,t.textConfig&&o)){var g=t.getBoundingRect().clone();t.textConfig.layoutRect=g,t.textConfig.position=[(o[0]-g.x)/g.width*100+"%",(o[1]-g.y)/g.height*100+"%"]}t.disableLabelAnimation=!0}else t.removeTextContent(),t.removeTextConfig(),t.disableLabelAnimation=null}function bD(e,t,n,i,a,r){e.data?e.data.setItemGraphicEl(r,t):nh(t).eventData={componentType:"geo",componentIndex:a.componentIndex,geoIndex:a.componentIndex,name:n,region:i&&i.option||{}}}function wD(e,t,n,i,a){e.data||Kf({el:t,componentModel:a,itemName:n,itemTooltipOption:i.get("tooltip")})}function SD(e,t,n,i,a){t.highDownSilentOnTouch=!!a.get("selectedMode");var r=i.getModel("emphasis"),o=r.get("focus");return Hh(t,o,r.get("blurScope"),r.get("disabled")),e.isGeo&&function(e,t,n){var i=nh(e);i.componentMainType=t.mainType,i.componentIndex=t.componentIndex,i.componentHighDownName=n}(t,a,n),o}function CD(e,t,n){var i,a=[];function r(){i=[]}function o(){i.length&&(a.push(i),i=[])}var s=t({polygonStart:r,polygonEnd:o,lineStart:r,lineEnd:o,point:function(e,t){isFinite(e)&&isFinite(t)&&i.push([e,t])},sphere:function(){}});return!n&&s.polygonStart(),Hr(e,function(e){s.lineStart();for(var t=0;t-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n},t.type="series.map",t.dependencies=["geo"],t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},nameProperty:"name"}}(ww);var _D=Ko,TD=function(e){function t(t){var n=e.call(this)||this;return n.type="view",n.dimensions=["x","y"],n._roamTransformable=new vc,n._rawTransformable=new vc,n.name=t,n}return Xe(t,e),t.prototype.setBoundingRect=function(e,t,n,i){return this._rect=new zs(e,t,n,i),this._rect},t.prototype.getBoundingRect=function(){return this._rect},t.prototype.setViewRect=function(e,t,n,i){this._transformTo(e,t,n,i),this._viewRect=new zs(e,t,n,i)},t.prototype._transformTo=function(e,t,n,i){var a=this.getBoundingRect(),r=this._rawTransformable;r.transform=a.calculateTransform(new zs(e,t,n,i));var o=r.parent;r.parent=null,r.decomposeTransform(),r.parent=o,this._updateTransform()},t.prototype.setCenter=function(e,t){e&&(this._center=[Zc(e[0],t.getWidth()),Zc(e[1],t.getHeight())],this._updateCenterAndZoom())},t.prototype.setZoom=function(e){e=e||1;var t=this.zoomLimit;t&&(null!=t.max&&(e=Math.min(t.max,e)),null!=t.min&&(e=Math.max(t.min,e))),this._zoom=e,this._updateCenterAndZoom()},t.prototype.getDefaultCenter=function(){var e=this.getBoundingRect();return[e.x+e.width/2,e.y+e.height/2]},t.prototype.getCenter=function(){return this._center||this.getDefaultCenter()},t.prototype.getZoom=function(){return this._zoom||1},t.prototype.getRoamTransform=function(){return this._roamTransformable.getLocalTransform()},t.prototype._updateCenterAndZoom=function(){var e=this._rawTransformable.getLocalTransform(),t=this._roamTransformable,n=this.getDefaultCenter(),i=this.getCenter(),a=this.getZoom();i=Ko([],i,e),n=Ko([],n,e),t.originX=i[0],t.originY=i[1],t.x=n[0]-i[0],t.y=n[1]-i[1],t.scaleX=t.scaleY=a,this._updateTransform()},t.prototype._updateTransform=function(){var e=this._roamTransformable,t=this._rawTransformable;t.parent=e,e.updateTransform(),t.updateTransform(),Es(this.transform||(this.transform=[]),t.transform||[1,0,0,1,0,0]),this._rawTransform=t.getLocalTransform(),this.invTransform=this.invTransform||[],Ds(this.invTransform,this.transform),this.decomposeTransform()},t.prototype.getTransformInfo=function(){var e=this._rawTransformable,t=this._roamTransformable,n=new vc;return n.transform=t.transform,n.decomposeTransform(),{roam:{x:n.x,y:n.y,scaleX:n.scaleX,scaleY:n.scaleY},raw:{x:e.x,y:e.y,scaleX:e.scaleX,scaleY:e.scaleY}}},t.prototype.getViewRect=function(){return this._viewRect},t.prototype.getViewRectAfterRoam=function(){var e=this.getBoundingRect().clone();return e.applyTransform(this.transform),e},t.prototype.dataToPoint=function(e,t,n){var i=t?this._rawTransform:this.transform;return n=n||[],i?_D(n,e,i):Ro(n,e)},t.prototype.pointToData=function(e){var t=this.invTransform;return t?_D([],e,t):[e[0],e[1]]},t.prototype.convertToPixel=function(e,t,n){var i=ED(t);return i===this?i.dataToPoint(n):null},t.prototype.convertFromPixel=function(e,t,n){var i=ED(t);return i===this?i.pointToData(n):null},t.prototype.containPoint=function(e){return this.getViewRectAfterRoam().contain(e[0],e[1])},t.dimensions=["x","y"],t}(vc);function ED(e){var t=e.seriesModel;return t?t.coordinateSystem:null}var MD={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},ID=["lng","lat"],kD=function(e){function t(t,n,i){var a=e.call(this,t)||this;a.dimensions=ID,a.type="geo",a._nameCoordMap=Eo(),a.map=n;var r,o=i.projection,s=pD(n,i.nameMap,i.nameProperty),l=lD(n),p=(a.resourceType=l?l.type:null,a.regions=s.regions),c=MD[l.type];if(a._regionsMap=s.regionsMap,a.regions=s.regions,a.projection=o,o)for(var d=0;d1?(m.width=u,m.height=u/x):(m.height=u,m.width=u*x),m.y=d[1]-m.height/2,m.x=d[0]-m.width/2;else{var w=e.getBoxLayoutParams();w.aspect=x,m=Iv(w,{width:y,height:v})}this.setViewRect(m.x,m.y,m.width,m.height),this.setCenter(e.get("center"),t),this.setZoom(e.get("zoom"))}Ur(kD,TD);var AD=function(){function e(){this.dimensions=ID}return e.prototype.create=function(e,t){var n=[];function i(e){return{nameProperty:e.get("nameProperty"),aspectScale:e.get("aspectScale"),projection:e.get("projection")}}e.eachComponent("geo",function(e,a){var r=e.get("map"),o=new kD(r+a,r,Vr({nameMap:e.get("nameMap")},i(e)));o.zoomLimit=e.get("scaleLimit"),n.push(o),e.coordinateSystem=o,o.model=e,o.resize=DD,o.resize(e,t)}),e.eachSeries(function(e){if("geo"===e.get("coordinateSystem")){var t=e.get("geoIndex")||0;e.coordinateSystem=n[t]}});var a={};return e.eachSeriesByType("map",function(e){if(!e.getHostGeoModel()){var t=e.getMapType();a[t]=a[t]||[],a[t].push(e)}}),Hr(a,function(e,a){var r=Wr(e,function(e){return e.get("nameMap")}),o=new kD(a,a,Vr({nameMap:Lr(r)},i(e[0])));o.zoomLimit=mo.apply(null,Wr(e,function(e){return e.get("scaleLimit")})),n.push(o),o.resize=DD,o.resize(e[0],t),Hr(e,function(e){e.coordinateSystem=o,function(e,t){Hr(t.get("geoCoord"),function(t,n){e.addGeoCoord(n,t)})}(o,e)})}),n},e.prototype.getFilledRegions=function(e,t,n,i){for(var a=(e||[]).slice(),r=Eo(),o=0;ov.x)||(b-=Math.PI);var C=w?"left":"right",_=s.getModel("label"),T=_.get("rotate"),E=T*(Math.PI/180),M=f.getTextContent();M&&(f.setTextConfig({position:_.get("position")||C,rotation:null==T?-b:E,origin:"center"}),M.setStyle("verticalAlign","middle"))}var I=s.get(["emphasis","focus"]),k="relative"===I?Mo(o.getAncestorsIndices(),o.getDescendantIndices()):"ancestor"===I?o.getAncestorsIndices():"descendant"===I?o.getDescendantIndices():null;k&&(nh(n).focus=k),function(e,t,n,i,a,r,o,s){var l=t.getModel(),p=e.get("edgeShape"),c=e.get("layout"),d=e.getOrient(),u=e.get(["lineStyle","curveness"]),m=e.get("edgeForkPosition"),h=l.getModel("lineStyle").getLineStyle(),g=i.__edge;if("curve"===p)t.parentNode&&t.parentNode!==n&&(g||(g=i.__edge=new Zg({shape:zD(c,d,u,a,a)})),gf(g,{shape:zD(c,d,u,r,o)},e));else if("polyline"===p)if("orthogonal"===c){if(t!==n&&t.children&&0!==t.children.length&&!0===t.isExpand){for(var f=t.children,y=[],v=0;vt&&(t=i.height)}this.height=t+1},e.prototype.getNodeById=function(e){if(this.getId()===e)return this;for(var t=0,n=this.children,i=n.length;t=0&&this.hostTree.data.setItemLayout(this.dataIndex,e,t)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(e){if(!(this.dataIndex<0))return this.hostTree.data.getItemModel(this.dataIndex).getModel(e)},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(e,t){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,e,t)},e.prototype.getVisual=function(e){return this.hostTree.data.getItemVisual(this.dataIndex,e)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var e=this.parentNode.children,t=0;t=0){var i=n.getData().tree.root,a=e.targetNode;if(to(a)&&(a=i.getNodeById(a)),a&&i.contains(a))return{node:a};var r=e.targetNodeId;if(null!=r&&(a=i.getNodeById(r)))return{node:a}}}function tA(e){for(var t=[];e;)(e=e.parentNode)&&t.push(e);return t.reverse()}function nA(e,t){return Gr(tA(e),t)>=0}function iA(e,t){for(var n=[];e;){var i=e.dataIndex;n.push({name:e.name,dataIndex:i,value:t.getRawValue(i)}),e=e.parentNode}return n.reverse(),n}!function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasSymbolVisual=!0,t.ignoreStyleOnData=!0,t}Xe(t,e),t.prototype.getInitialData=function(e){var t={name:e.name,children:e.data},n=e.leaves||{},i=new Ty(n,this,this.ecModel),a=JD.createTree(t,this,function(e){e.wrapMethod("getItemModel",function(e,t){var n=a.getNodeByDataIndex(t);return n&&n.children.length&&n.isExpand||(e.parentModel=i),e})});var r=0;a.eachNode("preorder",function(e){e.depth>r&&(r=e.depth)});var o=e.expandAndCollapse&&e.initialTreeDepth>=0?e.initialTreeDepth:r;return a.root.eachNode("preorder",function(e){var t=e.hostTree.data.getRawDataItem(e.dataIndex);e.isExpand=t&&null!=t.collapsed?!t.collapsed:e.depth<=o}),a.data},t.prototype.getOrient=function(){var e=this.get("orient");return"horizontal"===e?e="LR":"vertical"===e&&(e="TB"),e},t.prototype.setZoom=function(e){this.option.zoom=e},t.prototype.setCenter=function(e){this.option.center=e},t.prototype.formatTooltip=function(e,t,n){for(var i=this.getData().tree,a=i.root.children[0],r=i.getNodeByDataIndex(e),o=r.getValue(),s=r.name;r&&r!==a;)s=r.parentNode.name+"."+s,r=r.parentNode;return rw("nameValue",{name:s,value:o,noValue:isNaN(o)||null==o})},t.prototype.getDataParams=function(t){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return n.treeAncestors=iA(i,this),n.collapsed=!i.isExpand,n},t.type="series.tree",t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500}}(ww);function aA(e){var t=e.getData().tree,n={};t.eachNode(function(t){for(var i=t;i&&i.depth>1;)i=i.parentNode;var a=cx(e.ecModel,i.name||i.dataIndex+"",n);t.setVisual("decal",a)})}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.preventUsingHoverLayer=!0,n}Xe(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};rA(n);var i=e.levels||[],a=this.designatedVisualItemStyle={},r=new Ty({itemStyle:a},this,t);i=e.levels=function(e,t){var n,i,a=Cd(t.get("color")),r=Cd(t.get(["aria","decal","decals"]));if(!a)return;e=e||[],Hr(e,function(e){var t=new Ty(e),a=t.get("color"),r=t.get("decal");(t.get(["itemStyle","color"])||a&&"none"!==a)&&(n=!0),(t.get(["itemStyle","decal"])||r&&"none"!==r)&&(i=!0)});var o=e[0]||(e[0]={});n||(o.color=a.slice());!i&&r&&(o.decal=r.slice());return e}(i,t);var o=Wr(i||[],function(e){return new Ty(e,r,t)},this),s=JD.createTree(n,this,function(e){e.wrapMethod("getItemModel",function(e,t){var n=s.getNodeByDataIndex(t),i=n?o[n.depth]:null;return e.parentModel=i||r,e})});return s.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(e,t,n){var i=this.getData(),a=this.getRawValue(e);return rw("nameValue",{name:i.getName(e),value:a})},t.prototype.getDataParams=function(t){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return n.treeAncestors=iA(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(e){this.layoutInfo=this.layoutInfo||{},Vr(this.layoutInfo,e)},t.prototype.mapIdToIndex=function(e){var t=this._idIndexMap;t||(t=this._idIndexMap=Eo(),this._idIndexMapCount=0);var n=t.get(e);return null==n&&t.set(e,n=this._idIndexMapCount++),n},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(e){e?this._viewRoot=e:e=this._viewRoot;var t=this.getRawData().tree.root;e&&(e===t||t.contains(e))||(this._viewRoot=t)},t.prototype.enableAriaDecal=function(){aA(this)},t.type="series.treemap",t.layoutMode="box",t.defaultOption={progressive:0,left:"center",top:"middle",width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",textStyle:{color:"#fff"}},emphasis:{itemStyle:{color:"rgba(0,0,0,0.9)"}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]}}(ww);function rA(e){var t=0;Hr(e.children,function(e){rA(e);var n=e.value;Jr(n)&&(n=n[0]),t+=n});var n=e.value;Jr(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),Jr(e.value)?e.value[0]=n:e.value=n}var oA=function(){function e(e){this.group=new qc,e.add(this.group)}return e.prototype.render=function(e,t,n,i){var a=e.getModel("breadcrumb"),r=this.group;if(r.removeAll(),a.get("show")&&n){var o=a.getModel("itemStyle"),s=a.getModel("emphasis"),l=o.getModel("textStyle"),p=s.getModel(["itemStyle","textStyle"]),c={pos:{left:a.get("left"),right:a.get("right"),top:a.get("top"),bottom:a.get("bottom")},box:{width:t.getWidth(),height:t.getHeight()},emptyItemWidth:a.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(n,c,l),this._renderContent(e,c,o,s,l,p,i),kv(r,c.pos,c.box)}},e.prototype._prepare=function(e,t,n){for(var i=e;i;i=i.parentNode){var a=Dd(i.getModel().get("name"),""),r=n.getTextRect(a),o=Math.max(r.width+16,t.emptyItemWidth);t.totalWidth+=o+8,t.renderList.push({node:i,text:a,width:o})}},e.prototype._renderContent=function(e,t,n,i,a,r,o){for(var s,l,p,c,d,u,m,h,g,f=0,y=t.emptyItemWidth,v=e.get(["breadcrumb","height"]),x=(s=t.pos,l=t.box,c=l.width,d=l.height,u=Zc(s.left,c),m=Zc(s.top,d),h=Zc(s.right,c),g=Zc(s.bottom,d),(isNaN(u)||isNaN(parseFloat(s.left)))&&(u=0),(isNaN(h)||isNaN(parseFloat(s.right)))&&(h=c),(isNaN(m)||isNaN(parseFloat(s.top)))&&(m=0),(isNaN(g)||isNaN(parseFloat(s.bottom)))&&(g=d),p=gv(p||0),{width:Math.max(h-u-p[1]-p[3],0),height:Math.max(g-m-p[0]-p[2],0)}),b=t.totalWidth,w=t.renderList,S=i.getModel("itemStyle").getItemStyle(),C=w.length-1;C>=0;C--){var _=w[C],T=_.node,E=_.width,M=_.text;b>x.width&&(b-=E-y,E=y,M=null);var I=new zg({shape:{points:sA(f,0,E,v,C===w.length-1,0===C)},style:qr(n.getItemStyle(),{lineJoin:"bevel"}),textContent:new Um({style:iy(a,{text:M})}),textConfig:{position:"inside"},z2:1e5,onclick:Qr(o,T)});I.disableLabelAnimation=!0,I.getTextContent().ensureState("emphasis").style=iy(r,{text:M}),I.ensureState("emphasis").style=S,Hh(I,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(I),lA(I,e,T),f+=E+8}},e.prototype.remove=function(){this.group.removeAll()},e}();function sA(e,t,n,i,a,r){var o=[[a?e:e-5,t],[e+n,t],[e+n,t+i],[a?e:e-5,t+i]];return!r&&o.splice(2,0,[e+n+5,t+i/2]),!a&&o.push([e,t+i/2]),o}function lA(e,t,n){nh(e).eventData={componentType:"series",componentSubType:"treemap",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:n&&n.dataIndex,name:n&&n.name},treePathInfo:n&&iA(n,t)}}var pA=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(e,t,n,i,a){return!this._elExistsMap[e.id]&&(this._elExistsMap[e.id]=!0,this._storage.push({el:e,target:t,duration:n,delay:i,easing:a}),!0)},e.prototype.finished=function(e){return this._finishedCallback=e,this},e.prototype.start=function(){for(var e=this,t=this._storage.length,n=function(){--t<=0&&(e._storage.length=0,e._elExistsMap={},e._finishedCallback&&e._finishedCallback())},i=0,a=this._storage.length;i3||Math.abs(e.dy)>3)){var t=this.seriesModel.getData().tree.root;if(!t)return;var n=t.getLayout();if(!n)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:n.x+e.dx,y:n.y+e.dy,width:n.width,height:n.height}})}},t.prototype._onZoom=function(e){var t=e.originX,n=e.originY;if("animating"!==this._state){var i=this.seriesModel.getData().tree.root;if(!i)return;var a=i.getLayout();if(!a)return;var r=new zs(a.x,a.y,a.width,a.height),o=this.seriesModel.layoutInfo,s=[1,0,0,1,0,0];Is(s,s,[-(t-=o.x),-(n-=o.y)]),Ps(s,s,[e.scale,e.scale]),Is(s,s,[t,n]),r.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:r.x,y:r.y,width:r.width,height:r.height}})}},t.prototype._initEvents=function(e){var t=this;e.on("click",function(e){if("ready"===t._state){var n=t.seriesModel.get("nodeClick",!0);if(n){var i=t.findTarget(e.offsetX,e.offsetY);if(i){var a=i.node;if(a.getLayout().isLeafRoot)t._rootToNode(i);else if("zoomToNode"===n)t._zoomToNode(i);else if("link"===n){var r=a.hostTree.data.getItemModel(a.dataIndex),o=r.get("link",!0),s=r.get("target",!0)||"blank";o&&Sv(o,s)}}}}},this)},t.prototype._renderBreadcrumb=function(e,t,n){var i=this;n||(n=null!=e.get("leafDepth",!0)?{node:e.getViewRoot()}:this.findTarget(t.getWidth()/2,t.getHeight()/2))||(n={node:e.getData().tree.root}),(this._breadcrumb||(this._breadcrumb=new oA(this.group))).render(e,t,n.node,function(t){"animating"!==i._state&&(nA(e.getViewRoot(),t)?i._rootToNode({node:t}):i._zoomToNode({node:t}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage={nodeGroup:[],background:[],content:[]},this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(e){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:e.node})},t.prototype._rootToNode=function(e){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:e.node})},t.prototype.findTarget=function(e,t){var n;return this.seriesModel.getViewRoot().eachNode({attr:"viewChildren",order:"preorder"},function(i){var a=this._storage.background[i.getRawIndex()];if(a){var r=a.transformCoordToLocal(e,t),o=a.shape;if(!(o.x<=r[0]&&r[0]<=o.x+o.width&&o.y<=r[1]&&r[1]<=o.y+o.height))return!1;n={node:i,offsetX:r[0],offsetY:r[1]}}},this),n},t.type="treemap"}(Ow);var yA=Hr,vA=ao,xA=-1,bA=function(){function e(t){var n=t.mappingMethod,i=t.type,a=this.option=Fr(t);this.type=i,this.mappingMethod=n,this._normalizeData=PA[n];var r=e.visualHandlers[i];this.applyVisual=r.applyVisual,this.getColorMapper=r.getColorMapper,this._normalizedToVisual=r._normalizedToVisual[n],"piecewise"===n?(wA(a),function(e){var t=e.pieceList;e.hasSpecialVisual=!1,Hr(t,function(t,n){t.originIndex=n,null!=t.visual&&(e.hasSpecialVisual=!0)})}(a)):"category"===n?a.categories?function(e){var t=e.categories,n=e.categoryMap={},i=e.visual;if(yA(t,function(e,t){n[e]=t}),!Jr(i)){var a=[];ao(i)?yA(i,function(e,t){var i=n[t];a[null!=i?i:xA]=e}):a[-1]=i,i=kA(e,a)}for(var r=t.length-1;r>=0;r--)null==i[r]&&(delete n[t[r]],t.pop())}(a):wA(a,!0):(vo("linear"!==n||a.dataExtent),wA(a))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return Zr(this._normalizeData,this)},e.listVisualTypes=function(){return Xr(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){ao(e)?Hr(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,i){var a,r=Jr(t)?[]:ao(t)?{}:(a=!0,null);return e.eachVisual(t,function(e,t){var o=n.call(i,e,t);a?r=o:r[t]=o}),r},e.retrieveVisuals=function(t){var n,i={};return t&&yA(e.visualHandlers,function(e,a){t.hasOwnProperty(a)&&(i[a]=t[a],n=!0)}),n?i:null},e.prepareVisualTypes=function(e){if(Jr(e))e=e.slice();else{if(!vA(e))return[];var t=[];yA(e,function(e,n){t.push(n)}),e=t}return e.sort(function(e,t){return"color"===t&&"color"!==e&&0===e.indexOf("color")?1:-1}),e},e.dependsOn=function(e,t){return"color"===t?!(!e||0!==e.indexOf(t)):e===t},e.findPieceIndex=function(e,t,n){for(var i,a=1/0,r=0,o=t.length;ri&&(i=t);var r=i%2?i+2:i+3;a=[];for(var o=0;o0&&(v[0]=-v[0],v[1]=-v[1]);var b=y[0]<0?-1:1;if("start"!==i.__position&&"end"!==i.__position){var w=-Math.atan2(y[1],y[0]);p[0].8?"left":c[0]<-.8?"right":"center",u=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";break;case"start":i.x=-c[0]*h+l[0],i.y=-c[1]*g+l[1],d=c[0]>.8?"right":c[0]<-.8?"left":"center",u=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":i.x=h*b+l[0],i.y=l[1]+S,d=y[0]<0?"right":"left",i.originX=-h*b,i.originY=-S;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=x[0],i.y=x[1]+S,d="center",i.originY=-S;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-h*b+p[0],i.y=p[1]+S,d=y[0]>=0?"right":"left",i.originX=h*b,i.originY=-S}i.scaleX=i.scaleY=a,i.setStyle({verticalAlign:i.__verticalAlign||u,align:i.__align||d})}}}function C(e,t){var n=e.__specifiedRotation;if(null==n){var i=o.tangentAt(t);e.attr("rotation",(1===t?-1:1)*Math.PI/2-Math.atan2(i[1],i[0]))}else e.attr("rotation",n)}},t}(qc),aO=function(){function e(e){this.group=new qc,this._LineCtor=e||iO}return e.prototype.updateData=function(e){var t=this;this._progressiveEls=null;var n=this,i=n.group,a=n._lineData;n._lineData=e,a||i.removeAll();var r=rO(e);e.diff(a).add(function(n){t._doAdd(e,n,r)}).update(function(n,i){t._doUpdate(a,e,i,n,r)}).remove(function(e){i.remove(a.getItemGraphicEl(e))}).execute()},e.prototype.updateLayout=function(){var e=this._lineData;e&&e.eachItemGraphicEl(function(t,n){t.updateLayout(e,n)},this)},e.prototype.incrementalPrepareUpdate=function(e){this._seriesScope=rO(e),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(e,t){function n(e){e.isGroup||function(e){return e.animators&&e.animators.length>0}(e)||(e.incremental=!0,e.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var i=e.start;i=0?i+=p:i-=p:h>=0?i-=p:i+=p}return i}function gO(e,t){var n=[],i=Al,a=[[],[],[]],r=[[],[]],o=[];t/=2,e.eachEdge(function(e,s){var l=e.getLayout(),p=e.getVisual("fromSymbol"),c=e.getVisual("toSymbol");l.__original||(l.__original=[Bo(l[0]),Bo(l[1])],l[2]&&l.__original.push(Bo(l[2])));var d=l.__original;if(null!=l[2]){if(Ro(a[0],d[0]),Ro(a[1],d[2]),Ro(a[2],d[1]),p&&"none"!==p){var u=GA(e.node1),m=hO(a,d[0],u*t);i(a[0][0],a[1][0],a[2][0],m,n),a[0][0]=n[3],a[1][0]=n[4],i(a[0][1],a[1][1],a[2][1],m,n),a[0][1]=n[3],a[1][1]=n[4]}if(c&&"none"!==c){u=GA(e.node2),m=hO(a,d[1],u*t);i(a[0][0],a[1][0],a[2][0],m,n),a[1][0]=n[1],a[2][0]=n[2],i(a[0][1],a[1][1],a[2][1],m,n),a[1][1]=n[1],a[2][1]=n[2]}Ro(l[0],a[0]),Ro(l[1],a[2]),Ro(l[2],a[1])}else{if(Ro(r[0],d[0]),Ro(r[1],d[1]),Lo(o,r[1],r[0]),zo(o,o),p&&"none"!==p){u=GA(e.node1);No(r[0],r[0],o,u*t)}if(c&&"none"!==c){u=GA(e.node2);No(r[1],r[1],o,-u*t)}Ro(l[0],r[0]),Ro(l[1],r[1])}})}function fO(e){return"view"===e.type}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.init=function(e,t){var n=new LM,i=new aO,a=this.group;this._controller=new SP(t.getZr()),this._controllerHost={target:a},a.add(n.group),a.add(i.group),this._symbolDraw=n,this._lineDraw=i,this._firstRender=!0},t.prototype.render=function(e,t,n){var i=this,a=e.coordinateSystem;this._model=e;var r=this._symbolDraw,o=this._lineDraw,s=this.group;if(fO(a)){var l={x:a.x,y:a.y,scaleX:a.scaleX,scaleY:a.scaleY};this._firstRender?s.attr(l):gf(s,l,e)}gO(e.getGraph(),qA(e));var p=e.getData();r.updateData(p);var c=e.getEdgeData();o.updateData(c),this._updateNodeAndLinkScale(),this._updateController(e,t,n),clearTimeout(this._layoutTimeout);var d=e.forceLayout,u=e.get(["force","layoutAnimation"]);d&&this._startForceLayoutIteration(d,u);var m=e.get("layout");p.graph.eachNode(function(t){var n=t.dataIndex,a=t.getGraphicEl(),r=t.getModel();if(a){a.off("drag").off("dragend");var o=r.get("draggable");o&&a.on("drag",function(r){switch(m){case"force":d.warmUp(),!i._layouting&&i._startForceLayoutIteration(d,u),d.setFixed(n),p.setItemLayout(n,[a.x,a.y]);break;case"circular":p.setItemLayout(n,[a.x,a.y]),t.setLayout({fixed:!0},!0),jA(e,"symbolSize",t,[r.offsetX,r.offsetY]),i.updateLayout(e);break;default:p.setItemLayout(n,[a.x,a.y]),VA(e.getGraph(),e),i.updateLayout(e)}}).on("dragend",function(){d&&d.setUnfixed(n)}),a.setDraggable(o,!!r.get("cursor")),"adjacency"===r.get(["emphasis","focus"])&&(nh(a).focus=t.getAdjacentDataIndices())}}),p.graph.eachEdge(function(e){var t=e.getGraphicEl(),n=e.getModel().get(["emphasis","focus"]);t&&"adjacency"===n&&(nh(t).focus={edge:[e.dataIndex],node:[e.node1.dataIndex,e.node2.dataIndex]})});var h="circular"===e.get("layout")&&e.get(["circular","rotateLabel"]),g=p.getLayout("cx"),f=p.getLayout("cy");p.graph.eachNode(function(e){WA(e,h,g,f)}),this._firstRender=!1},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose(),this._controllerHost=null},t.prototype._startForceLayoutIteration=function(e,t){var n=this;!function i(){e.step(function(e){n.updateLayout(n._model),(n._layouting=!e)&&(t?n._layoutTimeout=setTimeout(i,16):i())})}()},t.prototype._updateController=function(e,t,n){var i=this,a=this._controller,r=this._controllerHost,o=this.group;a.setPointerChecker(function(t,i,a){var r=o.getBoundingRect();return r.applyTransform(o.transform),r.contain(i,a)&&!PP(t,n,e)}),fO(e.coordinateSystem)?(a.enable(e.get("roam")),r.zoomLimit=e.get("scaleLimit"),r.zoom=e.coordinateSystem.getZoom(),a.off("pan").off("zoom").on("pan",function(t){EP(r,t.dx,t.dy),n.dispatchAction({seriesId:e.id,type:"graphRoam",dx:t.dx,dy:t.dy})}).on("zoom",function(t){MP(r,t.scale,t.originX,t.originY),n.dispatchAction({seriesId:e.id,type:"graphRoam",zoom:t.scale,originX:t.originX,originY:t.originY}),i._updateNodeAndLinkScale(),gO(e.getGraph(),qA(e)),i._lineDraw.updateLayout(),n.updateLabelLayout()})):a.disable()},t.prototype._updateNodeAndLinkScale=function(){var e=this._model,t=e.getData(),n=qA(e);t.eachItemGraphicEl(function(e,t){e&&e.setSymbolScale(n)})},t.prototype.updateLayout=function(e){gO(e.getGraph(),qA(e)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},t.prototype.remove=function(){clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},t.type="graph"}(Ow);function yO(e){return"_EC_"+e}var vO=function(){function e(e){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=e||!1}return e.prototype.isDirected=function(){return this._directed},e.prototype.addNode=function(e,t){e=null==e?""+t:""+e;var n=this._nodesMap;if(!n[yO(e)]){var i=new xO(e,t);return i.hostGraph=this,this.nodes.push(i),n[yO(e)]=i,i}},e.prototype.getNodeByIndex=function(e){var t=this.data.getRawIndex(e);return this.nodes[t]},e.prototype.getNodeById=function(e){return this._nodesMap[yO(e)]},e.prototype.addEdge=function(e,t,n){var i=this._nodesMap,a=this._edgesMap;if(io(e)&&(e=this.nodes[e]),io(t)&&(t=this.nodes[t]),e instanceof xO||(e=i[yO(e)]),t instanceof xO||(t=i[yO(t)]),e&&t){var r=e.id+"-"+t.id,o=new bO(e,t,n);return o.hostGraph=this,this._directed&&(e.outEdges.push(o),t.inEdges.push(o)),e.edges.push(o),e!==t&&t.edges.push(o),this.edges.push(o),a[r]=o,o}},e.prototype.getEdgeByIndex=function(e){var t=this.edgeData.getRawIndex(e);return this.edges[t]},e.prototype.getEdge=function(e,t){e instanceof xO&&(e=e.id),t instanceof xO&&(t=t.id);var n=this._edgesMap;return this._directed?n[e+"-"+t]:n[e+"-"+t]||n[t+"-"+e]},e.prototype.eachNode=function(e,t){for(var n=this.nodes,i=n.length,a=0;a=0&&e.call(t,n[a],a)},e.prototype.eachEdge=function(e,t){for(var n=this.edges,i=n.length,a=0;a=0&&n[a].node1.dataIndex>=0&&n[a].node2.dataIndex>=0&&e.call(t,n[a],a)},e.prototype.breadthFirstTraverse=function(e,t,n,i){if(t instanceof xO||(t=this._nodesMap[yO(t)]),t){for(var a="out"===n?"outEdges":"in"===n?"inEdges":"edges",r=0;r=0&&n.node2.dataIndex>=0});for(a=0,r=i.length;a=0&&this[e][t].setItemVisual(this.dataIndex,n,i)},getVisual:function(n){return this[e][t].getItemVisual(this.dataIndex,n)},setLayout:function(n,i){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,n,i)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}function SO(e,t,n,i,a){for(var r=new vO(i),o=0;o "+u)),p++)}var m,h=n.get("coordinateSystem");if("cartesian2d"===h||"polar"===h)m=pT(e,n);else{var g=bx.get(h),f=g&&g.dimensions||[];Gr(f,"value")<0&&f.concat(["value"]);var y=tT(e,{coordDimensions:f,encodeDefine:n.getEncode()}).dimensions;(m=new eT(y,n)).initData(e)}var v=new eT(["value"],n);return v.initData(l,s),a&&a(m,v),jD({mainData:m,struct:r,structAttr:"graph",datas:{node:m,edge:v},datasAttr:{node:"data",edge:"edgeData"}}),r.update(),r}Ur(xO,wO("hostGraph","data")),Ur(bO,wO("hostGraph","edgeData"));!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}Xe(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new nk(i,i),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},t.prototype.mergeDefaultAndTheme=function(t){e.prototype.mergeDefaultAndTheme.apply(this,arguments),_d(t,"edgeLabel",["show"])},t.prototype.getInitialData=function(e,t){var n,i=e.edges||e.links||[],a=e.data||e.nodes||[],r=this;if(a&&i){OA(n=this)&&(n.__curvenessList=[],n.__edgeMap={},RA(n));var o=SO(a,i,this,!0,function(e,t){e.wrapMethod("getItemModel",function(e){var t=r._categoriesModels[e.getShallow("category")];return t&&(t.parentModel=e.parentModel,e.parentModel=t),e});var n=Ty.prototype.getModel;function i(e,t){var i=n.call(this,e,t);return i.resolveParentPath=a,i}function a(e){if(e&&("label"===e[0]||"label"===e[1])){var t=e.slice();return"label"===e[0]?t[0]="edgeLabel":"label"===e[1]&&(t[1]="edgeLabel"),t}return e}t.wrapMethod("getItemModel",function(e){return e.resolveParentPath=a,e.getModel=i,e})});return Hr(o.edges,function(e){!function(e,t,n,i){if(OA(n)){var a=BA(e,t,n),r=n.__edgeMap,o=r[FA(a)];r[a]&&!o?r[a].isForward=!0:o&&r[a]&&(o.isForward=!0,r[a].isForward=!1),r[a]=r[a]||[],r[a].push(i)}}(e.node1,e.node2,this,e.dataIndex)},this),o.data}},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.getCategoriesData=function(){return this._categoriesData},t.prototype.formatTooltip=function(e,t,n){if("edge"===n){var i=this.getData(),a=this.getDataParams(e,n),r=i.graph.getEdgeByIndex(e),o=i.getName(r.node1.dataIndex),s=i.getName(r.node2.dataIndex),l=[];return null!=o&&l.push(o),null!=s&&l.push(s),rw("nameValue",{name:l.join(" > "),value:a.value,noValue:null==a.value})}return yw({series:this,dataIndex:e,multipleSeries:t})},t.prototype._updateCategoriesData=function(){var e=Wr(this.option.categories||[],function(e){return null!=e.value?e:Vr({value:0},e)}),t=new eT(["value"],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray(function(e){return t.getItemModel(e)})},t.prototype.setZoom=function(e){this.option.zoom=e},t.prototype.setCenter=function(e){this.option.center=e},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},t.type="series.graph",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}}}(ww);var CO=function(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0},_O=function(e){function t(t){var n=e.call(this,t)||this;return n.type="pointer",n}return Xe(t,e),t.prototype.getDefaultShape=function(){return new CO},t.prototype.buildPath=function(e,t){var n=Math.cos,i=Math.sin,a=t.r,r=t.width,o=t.angle,s=t.x-n(o)*r*(r>=a/3?1:2),l=t.y-i(o)*r*(r>=a/3?1:2);o=t.angle-Math.PI/2,e.moveTo(s,l),e.lineTo(t.x+n(o)*r,t.y+i(o)*r),e.lineTo(t.x+n(t.angle)*a,t.y+i(t.angle)*a),e.lineTo(t.x-n(o)*r,t.y-i(o)*r),e.lineTo(s,l)},t}(Im);function TO(e,t){var n=null==e?"":e+"";return t&&(to(t)?n=t.replace("{value}",n):eo(t)&&(n=t(e))),n}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.render=function(e,t,n){this.group.removeAll();var i=e.get(["axisLine","lineStyle","color"]),a=function(e,t){var n=e.get("center"),i=t.getWidth(),a=t.getHeight(),r=Math.min(i,a);return{cx:Zc(n[0],t.getWidth()),cy:Zc(n[1],t.getHeight()),r:Zc(e.get("radius"),r/2)}}(e,n);this._renderMain(e,t,n,i,a),this._data=e.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(e,t,n,i,a){var r=this.group,o=e.get("clockwise"),s=-e.get("startAngle")/180*Math.PI,l=-e.get("endAngle")/180*Math.PI,p=e.getModel("axisLine"),c=p.get("roundCap")?xI:Ng,d=p.get("show"),u=p.getModel("lineStyle"),m=u.get("width"),h=[s,l];om(h,!o);for(var g=(l=h[1])-(s=h[0]),f=s,y=[],v=0;d&&v=e&&(0===t?0:i[t-1][0])Math.PI/2&&(L+=Math.PI):"tangential"===N?L=-_-Math.PI/2:io(N)&&(L=N*Math.PI/180),0===L?d.add(new Um({style:iy(x,{text:O,x:B,y:F,verticalAlign:c<-.8?"top":c>.8?"bottom":"middle",align:p<-.4?"left":p>.4?"right":"center"},{inheritColor:R}),silent:!0})):d.add(new Um({style:iy(x,{text:O,x:B,y:F,verticalAlign:"middle",align:"center"},{inheritColor:R}),silent:!0,originX:B,originY:F,rotation:L}))}if(v.get("show")&&P!==b){A=(A=v.get("distance"))?A+l:l;for(var V=0;V<=w;V++){p=Math.cos(_),c=Math.sin(_);var q=new $g({shape:{x1:p*(h-A)+u,y1:c*(h-A)+m,x2:p*(h-C-A)+u,y2:c*(h-C-A)+m},silent:!0,style:I});"auto"===I.stroke&&q.setStyle({stroke:i((P+V/w)/b)}),d.add(q),_+=E}_-=E}else _+=T}},t.prototype._renderPointer=function(e,t,n,i,a,r,o,s,l){var p=this.group,c=this._data,d=this._progressEls,u=[],m=e.get(["pointer","show"]),h=e.getModel("progress"),g=h.get("show"),f=e.getData(),y=f.mapDimension("value"),v=+e.get("min"),x=+e.get("max"),b=[v,x],w=[r,o];function S(t,n){var i,r=f.getItemModel(t).getModel("pointer"),o=Zc(r.get("width"),a.r),s=Zc(r.get("length"),a.r),l=e.get(["pointer","icon"]),p=r.get("offsetCenter"),c=Zc(p[0],a.r),d=Zc(p[1],a.r),u=r.get("keepAspect");return(i=l?HS(l,c-o/2,d-s,o,s,null,u):new _O({shape:{angle:-Math.PI/2,width:o,r:s,x:c,y:d}})).rotation=-(n+Math.PI/2),i.x=a.cx,i.y=a.cy,i}function C(e,t){var n=h.get("roundCap")?xI:Ng,i=h.get("overlap"),o=i?h.get("width"):l/f.count(),p=i?a.r-o:a.r-(e+1)*o,c=i?a.r:a.r-e*o,d=new n({shape:{startAngle:r,endAngle:t,cx:a.cx,cy:a.cy,clockwise:s,r0:p,r:c}});return i&&(d.z2=x-f.get(y,e)%x),d}(g||m)&&(f.diff(c).add(function(t){var n=f.get(y,t);if(m){var i=S(t,r);ff(i,{rotation:-((isNaN(+n)?w[0]:Xc(n,b,w,!0))+Math.PI/2)},e),p.add(i),f.setItemGraphicEl(t,i)}if(g){var a=C(t,r),o=h.get("clip");ff(a,{shape:{endAngle:Xc(n,b,w,o)}},e),p.add(a),ih(e.seriesIndex,f.dataType,t,a),u[t]=a}}).update(function(t,n){var i=f.get(y,t);if(m){var a=c.getItemGraphicEl(n),o=a?a.rotation:r,s=S(t,o);s.rotation=o,gf(s,{rotation:-((isNaN(+i)?w[0]:Xc(i,b,w,!0))+Math.PI/2)},e),p.add(s),f.setItemGraphicEl(t,s)}if(g){var l=d[n],v=C(t,l?l.shape.endAngle:r),x=h.get("clip");gf(v,{shape:{endAngle:Xc(i,b,w,x)}},e),p.add(v),ih(e.seriesIndex,f.dataType,t,v),u[t]=v}}).execute(),f.each(function(e){var t=f.getItemModel(e),n=t.getModel("emphasis"),a=n.get("focus"),r=n.get("blurScope"),o=n.get("disabled");if(m){var s=f.getItemGraphicEl(e),l=f.getItemVisual(e,"style"),p=l.fill;if(s instanceof Om){var c=s.style;s.useStyle(Vr({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},l))}else s.useStyle(l),"pointer"!==s.type&&s.setColor(p);s.setStyle(t.getModel(["pointer","itemStyle"]).getItemStyle()),"auto"===s.style.fill&&s.setStyle("fill",i(Xc(f.get(y,e),b,[0,1],!0))),s.z2EmphasisLift=0,Yh(s,t),Hh(s,a,r,o)}if(g){var d=u[e];d.useStyle(f.getItemVisual(e,"style")),d.setStyle(t.getModel(["progress","itemStyle"]).getItemStyle()),d.z2EmphasisLift=0,Yh(d,t),Hh(d,a,r,o)}}),this._progressEls=u)},t.prototype._renderAnchor=function(e,t){var n=e.getModel("anchor");if(n.get("show")){var i=n.get("size"),a=n.get("icon"),r=n.get("offsetCenter"),o=n.get("keepAspect"),s=HS(a,t.cx-i/2+Zc(r[0],t.r),t.cy-i/2+Zc(r[1],t.r),i,i,null,o);s.z2=n.get("showAbove")?1:0,s.setStyle(n.getModel("itemStyle").getItemStyle()),this.group.add(s)}},t.prototype._renderTitleAndDetail=function(e,t,n,i,a){var r=this,o=e.getData(),s=o.mapDimension("value"),l=+e.get("min"),p=+e.get("max"),c=new qc,d=[],u=[],m=e.isAnimationEnabled(),h=e.get(["pointer","showAbove"]);o.diff(this._data).add(function(e){d[e]=new Um({silent:!0}),u[e]=new Um({silent:!0})}).update(function(e,t){d[e]=r._titleEls[t],u[e]=r._detailEls[t]}).execute(),o.each(function(t){var n=o.getItemModel(t),r=o.get(s,t),g=new qc,f=i(Xc(r,[l,p],[0,1],!0)),y=n.getModel("title");if(y.get("show")){var v=y.get("offsetCenter"),x=a.cx+Zc(v[0],a.r),b=a.cy+Zc(v[1],a.r);(I=d[t]).attr({z2:h?0:2,style:iy(y,{x:x,y:b,text:o.getName(t),align:"center",verticalAlign:"middle"},{inheritColor:f})}),g.add(I)}var w=n.getModel("detail");if(w.get("show")){var S=w.get("offsetCenter"),C=a.cx+Zc(S[0],a.r),_=a.cy+Zc(S[1],a.r),T=Zc(w.get("width"),a.r),E=Zc(w.get("height"),a.r),M=e.get(["progress","show"])?o.getItemVisual(t,"style").fill:f,I=u[t],k=w.get("formatter");I.attr({z2:h?0:2,style:iy(w,{x:C,y:_,text:TO(r,k),width:isNaN(T)?null:T,height:isNaN(E)?null:E,align:"center",verticalAlign:"middle"},{inheritColor:M})}),dy(I,{normal:w},r,function(e){return TO(e,k)}),m&&uy(I,t,o,e,{getFormattedLabel:function(e,t,n,i,a,o){return TO(o?o.interpolatedValue:r,k)}}),g.add(I)}c.add(g)}),this.group.add(c),this._titleEls=d,this._detailEls=u},t.type="gauge"})(Ow),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath="itemStyle",n}Xe(t,e),t.prototype.getInitialData=function(e,t){return tk(this,["value"])},t.type="series.gauge",t.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,"#E6EBF8"]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:"#63677A",width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:"#63677A",width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:"#464646",fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:"#fff",borderWidth:0,borderColor:"#5470c6"}},title:{show:!0,offsetCenter:[0,"20%"],color:"#464646",fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc",width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:"#464646",fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}}}(ww);var EO=["itemStyle","opacity"],MO=function(e){function t(t,n){var i=e.call(this)||this,a=i,r=new jg,o=new Um;return a.setTextContent(o),i.setTextGuideLine(r),i.updateData(t,n,!0),i}return Xe(t,e),t.prototype.updateData=function(e,t,n){var i=this,a=e.hostModel,r=e.getItemModel(t),o=e.getItemLayout(t),s=r.getModel("emphasis"),l=r.get(EO);l=null==l?1:l,n||wf(i),i.useStyle(e.getItemVisual(t,"style")),i.style.lineJoin="round",n?(i.setShape({points:o.points}),i.style.opacity=0,ff(i,{style:{opacity:l}},a,t)):gf(i,{style:{opacity:l},shape:{points:o.points}},a,t),Yh(i,r),this._updateLabel(e,t),Hh(this,s.get("focus"),s.get("blurScope"),s.get("disabled"))},t.prototype._updateLabel=function(e,t){var n=this,i=this.getTextGuideLine(),a=n.getTextContent(),r=e.hostModel,o=e.getItemModel(t),s=e.getItemLayout(t).label,l=e.getItemVisual(t,"style"),p=l.fill;ty(a,ny(o),{labelFetcher:e.hostModel,labelDataIndex:t,defaultOpacity:l.opacity,defaultText:e.getName(t)},{normal:{align:s.textAlign,verticalAlign:s.verticalAlign}}),n.setTextConfig({local:!0,inside:!!s.inside,insideStroke:p,outsideFill:p});var c=s.linePoints;i.setShape({points:c}),n.textGuideLineConfig={anchor:c?new Os(c[0][0],c[0][1]):null},gf(a,{style:{x:s.x,y:s.y}},r,t),a.attr({rotation:s.rotation,originX:s.x,originY:s.y,z2:10}),mM(n,hM(o),{stroke:p})},t}(zg);(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreLabelLineUpdate=!0,n}Xe(t,e),t.prototype.render=function(e,t,n){var i=e.getData(),a=this._data,r=this.group;i.diff(a).add(function(e){var t=new MO(i,e);i.setItemGraphicEl(e,t),r.add(t)}).update(function(e,t){var n=a.getItemGraphicEl(t);n.updateData(i,e),r.add(n),i.setItemGraphicEl(e,n)}).remove(function(t){bf(a.getItemGraphicEl(t),e,t)}).execute(),this._data=i},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type="funnel"})(Ow),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new nk(Zr(this.getData,this),Zr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.getInitialData=function(e,t){return tk(this,{coordDimensions:["value"],encodeDefaulter:Qr(Jv,this)})},t.prototype._defaultLabelLine=function(e){_d(e,"labelLine",["show"]);var t=e.labelLine,n=e.emphasis.labelLine;t.show=t.show&&e.label.show,n.show=n.show&&e.emphasis.label.show},t.prototype.getDataParams=function(t){var n=this.getData(),i=e.prototype.getDataParams.call(this,t),a=n.mapDimension("value"),r=n.getSum(a);return i.percent=r?+(n.get(a,t)/r*100).toFixed(2):0,i.$vars.push("percent"),i},t.type="series.funnel",t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}}}(ww);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._dataGroup=new qc,n._initialized=!1,n}Xe(t,e),t.prototype.init=function(){this.group.add(this._dataGroup)},t.prototype.render=function(e,t,n,i){this._progressiveEls=null;var a=this._dataGroup,r=e.getData(),o=this._data,s=e.coordinateSystem,l=s.dimensions,p=PO(e);if(r.diff(o).add(function(e){DO(kO(r,a,e,l,s),r,e,p)}).update(function(t,n){var i=o.getItemGraphicEl(n),a=IO(r,t,l,s);r.setItemGraphicEl(t,i),gf(i,{shape:{points:a}},e,t),wf(i),DO(i,r,t,p)}).remove(function(e){var t=o.getItemGraphicEl(e);a.remove(t)}).execute(),!this._initialized){this._initialized=!0;var c=function(e,t,n){var i=e.model,a=e.getRect(),r=new qm({shape:{x:a.x,y:a.y,width:a.width,height:a.height}}),o="horizontal"===i.get("layout")?"width":"height";return r.setShape(o,0),ff(r,{shape:{width:a.width,height:a.height}},t,n),r}(s,e,function(){setTimeout(function(){a.removeClipPath()})});a.setClipPath(c)}this._data=r},t.prototype.incrementalPrepareRender=function(e,t,n){this._initialized=!0,this._data=null,this._dataGroup.removeAll()},t.prototype.incrementalRender=function(e,t,n){for(var i=t.getData(),a=t.coordinateSystem,r=a.dimensions,o=PO(t),s=this._progressiveEls=[],l=e.start;l5)return;var i=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);"none"!==i.behavior&&this._dispatchExpand({axisExpandWindow:i.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!this._mouseDownPoint&&BO(this,"mousemove")){var t=this._model,n=t.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]),i=n.behavior;"jump"===i&&this._throttledDispatchExpand.debounceNextCall(t.get("axisExpandDebounce")),this._throttledDispatchExpand("none"===i?null:{axisExpandWindow:n.axisExpandWindow,animation:"jump"===i?null:{duration:0}})}}};function BO(e,t){var n=e._model;return n.get("axisExpandable")&&n.get("axisExpandTriggerOn")===t}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(e){var t=this.option;e&&Nr(t,e,!0),this._initDimensions()},t.prototype.contains=function(e,t){var n=e.get("parallelIndex");return null!=n&&t.getComponent("parallel",n)===this},t.prototype.setAxisExpand=function(e){Hr(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(t){e.hasOwnProperty(t)&&(this.option[t]=e[t])},this)},t.prototype._initDimensions=function(){var e=this.dimensions=[],t=this.parallelAxisIndex=[];Hr(Kr(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(e){return(e.get("parallelIndex")||0)===this.componentIndex},this),function(n){e.push("dim"+n.get("dim")),t.push(n.componentIndex)})},t.type="parallel",t.dependencies=["parallelAxis"],t.layoutMode="box",t.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null}}(Bv);var FO=function(e){function t(t,n,i,a,r){var o=e.call(this,t,n,i)||this;return o.type=a||"value",o.axisIndex=r,o}return Xe(t,e),t.prototype.isHorizontal=function(){return"horizontal"!==this.coordinateSystem.getModel().get("layout")},t}(UE);function NO(e,t,n,i,a,r){e=e||0;var o=n[1]-n[0];if(null!=a&&(a=VO(a,[0,o])),null!=r&&(r=Math.max(r,null!=a?a:0)),"all"===i){var s=Math.abs(t[1]-t[0]);s=VO(s,[0,o]),a=r=VO(s,[a,r]),i=0}t[0]=VO(t[0],n),t[1]=VO(t[1],n);var l=LO(t,i);t[i]+=e;var p,c=a||0,d=n.slice();return l.sign<0?d[0]+=c:d[1]-=c,t[i]=VO(t[i],d),p=LO(t,i),null!=a&&(p.sign!==l.sign||p.spanr&&(t[1-i]=t[i]+p.sign*r),t}function LO(e,t){var n=e[t]-e[1-t];return{span:Math.abs(n),sign:n>0?-1:n<0?1:t?-1:1}}function VO(e,t){return Math.min(null!=t[1]?t[1]:1/0,Math.max(null!=t[0]?t[0]:-1/0,e))}var qO=Hr,GO=Math.min,zO=Math.max,UO=Math.floor,jO=Math.ceil,HO=Qc,WO=Math.PI;!function(){function e(e,t,n){this.type="parallel",this._axesMap=Eo(),this._axesLayout={},this.dimensions=e.dimensions,this._model=e,this._init(e,t,n)}e.prototype._init=function(e,t,n){var i=e.dimensions,a=e.parallelAxisIndex;qO(i,function(e,n){var i=a[n],r=t.getComponent("parallelAxis",i),o=this._axesMap.set(e,new FO(e,pE(r),[0,0],r.get("type"),i)),s="category"===o.type;o.onBand=s&&r.get("boundaryGap"),o.inverse=r.get("inverse"),r.axis=o,o.model=r,o.coordinateSystem=r.coordinateSystem=this},this)},e.prototype.update=function(e,t){this._updateAxesFromSeries(this._model,e)},e.prototype.containPoint=function(e){var t=this._makeLayoutInfo(),n=t.axisBase,i=t.layoutBase,a=t.pixelDimIndex,r=e[1-a],o=e[a];return r>=n&&r<=n+t.axisLength&&o>=i&&o<=i+t.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype._updateAxesFromSeries=function(e,t){t.eachSeries(function(n){if(e.contains(n,t)){var i=n.getData();qO(this.dimensions,function(e){var t=this._axesMap.get(e);t.scale.unionExtentFromData(i,i.mapDimension(e)),lE(t.scale,t.model)},this)}},this)},e.prototype.resize=function(e,t){this._rect=Iv(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()}),this._layoutAxes()},e.prototype.getRect=function(){return this._rect},e.prototype._makeLayoutInfo=function(){var e,t=this._model,n=this._rect,i=["x","y"],a=["width","height"],r=t.get("layout"),o="horizontal"===r?0:1,s=n[a[o]],l=[0,s],p=this.dimensions.length,c=$O(t.get("axisExpandWidth"),l),d=$O(t.get("axisExpandCount")||0,[0,p]),u=t.get("axisExpandable")&&p>3&&p>d&&d>1&&c>0&&s>0,m=t.get("axisExpandWindow");m?(e=$O(m[1]-m[0],l),m[1]=m[0]+e):(e=$O(c*(d-1),l),(m=[c*(t.get("axisExpandCenter")||UO(p/2))-e/2])[1]=m[0]+e);var h=(s-e)/(p-d);h<3&&(h=0);var g=[UO(HO(m[0]/c,1))+1,jO(HO(m[1]/c,1))-1],f=h/c*m[0];return{layout:r,pixelDimIndex:o,layoutBase:n[i[o]],layoutLength:s,axisBase:n[i[1-o]],axisLength:n[a[1-o]],axisExpandable:u,axisExpandWidth:c,axisCollapseWidth:h,axisExpandWindow:m,axisCount:p,winInnerIndices:g,axisExpandWindow0Pos:f}},e.prototype._layoutAxes=function(){var e=this._rect,t=this._axesMap,n=this.dimensions,i=this._makeLayoutInfo(),a=i.layout;t.each(function(e){var t=[0,i.axisLength],n=e.inverse?1:0;e.setExtent(t[n],t[1-n])}),qO(n,function(t,n){var r=(i.axisExpandable?YO:KO)(n,i),o={horizontal:{x:r.position,y:i.axisLength},vertical:{x:0,y:r.position}},s={horizontal:WO/2,vertical:0},l=[o[a].x+e.x,o[a].y+e.y],p=s[a],c=[1,0,0,1,0,0];ks(c,c,p),Is(c,c,l),this._axesLayout[t]={position:l,rotation:p,transform:c,axisNameAvailableWidth:r.axisNameAvailableWidth,axisLabelShow:r.axisLabelShow,nameTruncateMaxWidth:r.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},e.prototype.getAxis=function(e){return this._axesMap.get(e)},e.prototype.dataToPoint=function(e,t){return this.axisCoordToPoint(this._axesMap.get(t).dataToCoord(e),t)},e.prototype.eachActiveState=function(e,t,n,i){null==n&&(n=0),null==i&&(i=e.count());var a=this._axesMap,r=this.dimensions,o=[],s=[];Hr(r,function(t){o.push(e.mapDimension(t)),s.push(a.get(t).model)});for(var l=this.hasAxisBrushed(),p=n;pa*(1-c[0])?(l="jump",o=s-a*(1-c[2])):(o=s-a*c[1])>=0&&(o=s-a*(1-c[1]))<=0&&(o=0),(o*=t.axisExpandWidth/p)?NO(o,i,r,"all"):l="none";else{var u=i[1]-i[0];(i=[zO(0,r[1]*s/u-u/2)])[1]=GO(r[1],i[0]+u),i[0]=i[1]-u}return{axisExpandWindow:i,behavior:l}}}();function $O(e,t){return GO(zO(e,t[0]),t[1])}function KO(e,t){var n=t.layoutLength/(t.axisCount-1);return{position:n*e,axisNameAvailableWidth:n,axisLabelShow:!0}}function YO(e,t){var n,i,a=t.layoutLength,r=t.axisExpandWidth,o=t.axisCount,s=t.axisCollapseWidth,l=t.winInnerIndices,p=s,c=!1;return e=0;n--)Jc(t[n])},t.prototype.getActiveState=function(e){var t=this.activeIntervals;if(!t.length)return"normal";if(null==e||isNaN(+e))return"inactive";if(1===t.length){var n=t[0];if(n[0]<=e&&e<=n[1])return"active"}else for(var i=0,a=t.length;i6}(e)||r){if(o&&!r){"single"===s.brushMode&&gR(e);var l=Fr(s);l.brushType=AR(l.brushType,o),l.panelId=o===ZO?null:o.panelId,r=e._creatingCover=sR(e,l),e._covers.push(r)}if(r){var p=BR[AR(e._brushType,o)];r.__brushOption.range=p.getCreatingRange(IR(e,r,e._track)),i&&(lR(e,r),p.updateCommon(e,r)),pR(e,r),a={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&mR(e,t,n)&&gR(e)&&(a={isEnd:i,removeOnClick:!0});return a}function AR(e,t){return"auto"===e?t.defaultBrushType:e}var OR={mousedown:function(e){if(this._dragging)RR(this,e);else if(!e.target||!e.target.draggable){kR(e);var t=this.group.transformCoordToLocal(e.offsetX,e.offsetY);this._creatingCover=null,(this._creatingPanel=mR(this,e,t))&&(this._dragging=!0,this._track=[t.slice()])}},mousemove:function(e){var t=e.offsetX,n=e.offsetY,i=this.group.transformCoordToLocal(t,n);if(function(e,t,n){if(e._brushType&&!function(e,t,n){var i=e._zr;return t<0||t>i.getWidth()||n<0||n>i.getHeight()}(e,t.offsetX,t.offsetY)){var i=e._zr,a=e._covers,r=mR(e,t,n);if(!e._dragging)for(var o=0;o=0&&(r[a[o].depth]=new Ty(a[o],this,t));if(i&&n){var s=SO(i,n,this,!0,function(e,t){e.wrapMethod("getItemModel",function(e,t){var n=e.parentModel,i=n.getData().getItemLayout(t);if(i){var a=i.depth,r=n.levelModels[a];r&&(e.parentModel=r)}return e}),t.wrapMethod("getItemModel",function(e,t){var n=e.parentModel,i=n.getGraph().getEdgeByIndex(t).node1.getLayout();if(i){var a=i.depth,r=n.levelModels[a];r&&(e.parentModel=r)}return e})});return s.data}},t.prototype.setNodePosition=function(e,t){var n=(this.option.data||this.option.nodes)[e];n.localX=t[0],n.localY=t[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(e,t,n){function i(e){return isNaN(e)||null==e}if("edge"===n){var a=this.getDataParams(e,n),r=a.data,o=a.value;return rw("nameValue",{name:r.source+" -- "+r.target,value:o,noValue:i(o)})}var s=this.getGraph().getNodeByIndex(e).getLayout().value,l=this.getDataParams(e,n).data.name;return rw("nameValue",{name:null!=l?l+"":null,value:s,noValue:i(s)})},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(t,n){var i=e.prototype.getDataParams.call(this,t,n);if(null==i.value&&"node"===n){var a=this.getGraph().getNodeByIndex(t).getLayout().value;i.value=a}return i},t.type="series.sankey",t.defaultOption={z:2,coordinateSystem:"view",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:"#314656",opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:"#212121"}},animationEasing:"linear",animationDuration:1e3}}(ww);var HR=function(){function e(){}return e.prototype.getInitialData=function(e,t){var n,i,a=t.getComponent("xAxis",this.get("xAxisIndex")),r=t.getComponent("yAxis",this.get("yAxisIndex")),o=a.get("type"),s=r.get("type");"category"===o?(e.layout="horizontal",n=a.getOrdinalMeta(),i=!0):"category"===s?(e.layout="vertical",n=r.getOrdinalMeta(),i=!0):e.layout=e.layout||"horizontal";var l=["x","y"],p="horizontal"===e.layout?0:1,c=this._baseAxisDim=l[p],d=l[1-p],u=[a,r],m=u[p].get("type"),h=u[1-p].get("type"),g=e.data;if(g&&i){var f=[];Hr(g,function(e,t){var n;Jr(e)?(n=e.slice(),e.unshift(t)):Jr(e.value)?((n=Vr({},e)).value=n.value.slice(),e.value.unshift(t)):n=e,f.push(n)}),e.data=f}var y=this.defaultValueDimensions,v=[{name:c,type:O_(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:d,type:O_(h),dimsDef:y.slice()}];return tk(this,{coordDimensions:v,dimensionsCount:y.length+1,encodeDefaulter:Qr(Qv,v,this)})},e.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},e}(),WR=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],n.visualDrawType="stroke",n}return Xe(t,e),t.type="series.boxplot",t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}},animationDuration:800},t}(ww);Ur(WR,HR,!0);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.render=function(e,t,n){var i=e.getData(),a=this.group,r=this._data;this._data||a.removeAll();var o="horizontal"===e.get("layout")?1:0;i.diff(r).add(function(e){if(i.hasValue(e)){var t=YR(i.getItemLayout(e),i,e,o,!0);i.setItemGraphicEl(e,t),a.add(t)}}).update(function(e,t){var n=r.getItemGraphicEl(t);if(i.hasValue(e)){var s=i.getItemLayout(e);n?(wf(n),XR(s,n,i,e)):n=YR(s,i,e,o),a.add(n),i.setItemGraphicEl(e,n)}else a.remove(n)}).remove(function(e){var t=r.getItemGraphicEl(e);t&&a.remove(t)}).execute(),this._data=i},t.prototype.remove=function(e){var t=this.group,n=this._data;this._data=null,n&&n.eachItemGraphicEl(function(e){e&&t.remove(e)})},t.type="boxplot"}(Ow);var $R=function(){},KR=function(e){function t(t){var n=e.call(this,t)||this;return n.type="boxplotBoxPath",n}return Xe(t,e),t.prototype.getDefaultShape=function(){return new $R},t.prototype.buildPath=function(e,t){var n=t.points,i=0;for(e.moveTo(n[i][0],n[i][1]),i++;i<4;i++)e.lineTo(n[i][0],n[i][1]);for(e.closePath();i0?"borderColor":"borderColor0"])||n.get(["itemStyle",e>0?"color":"color0"]);0===e&&(a=n.get(["itemStyle","borderColorDoji"]));var r=n.getModel("itemStyle").getItemStyle(QR);t.useStyle(r),t.style.fill=null,t.style.stroke=a}var pB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],n}return Xe(t,e),t.prototype.getShadowDim=function(){return"open"},t.prototype.brushSelector=function(e,t,n){var i=t.getItemLayout(e);return i&&n.rect(i.brushRect)},t.type="series.candlestick",t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderColorDoji:null,borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},t}(ww);Ur(pB,HR,!0);var cB=["itemStyle","borderColor"],dB=["itemStyle","borderColor0"],uB=["itemStyle","borderColorDoji"],mB=["itemStyle","color"],hB=["itemStyle","color0"];Pw(),Pw();function gB(e,t,n,i,a,r){return n>i?-1:n0?e.get(a,t-1)<=i?1:-1:1}function fB(e,t){var n=t.rippleEffectColor||t.color;e.eachChild(function(e){e.attr({z:t.z,zlevel:t.zlevel,style:{stroke:"stroke"===t.brushType?n:null,fill:"fill"===t.brushType?n:null}})})}var yB=function(e){function t(t,n){var i=e.call(this)||this,a=new OM(t,n),r=new qc;return i.add(a),i.add(r),i.updateData(t,n),i}return Xe(t,e),t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(e){for(var t=e.symbolType,n=e.color,i=e.rippleNumber,a=this.childAt(1),r=0;r0&&(r=this._getLineLength(i)/l*1e3),r!==this._period||o!==this._loop||s!==this._roundTrip){i.stopAnimation();var c=void 0;c=eo(p)?p(n):p,i.__t>0&&(c=-r*i.__t),this._animateSymbol(i,r,c,o,s)}this._period=r,this._loop=o,this._roundTrip=s}},t.prototype._animateSymbol=function(e,t,n,i,a){if(t>0){e.__t=0;var r=this,o=e.animate("",i).when(a?2*t:t,{__t:a?2:1}).delay(n).during(function(){r._updateSymbolPosition(e)});i||o.done(function(){r.remove(e)}),o.start()}},t.prototype._getLineLength=function(e){return jo(e.__p1,e.__cp1)+jo(e.__cp1,e.__p2)},t.prototype._updateAnimationPoints=function(e,t){e.__p1=t[0],e.__p2=t[1],e.__cp1=t[2]||[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]},t.prototype.updateData=function(e,t,n){this.childAt(0).updateData(e,t,n),this._updateEffectSymbol(e,t)},t.prototype._updateSymbolPosition=function(e){var t=e.__p1,n=e.__p2,i=e.__cp1,a=e.__t<1?e.__t:2-e.__t,r=[e.x,e.y],o=r.slice(),s=kl,l=Pl;r[0]=s(t[0],i[0],n[0],a),r[1]=s(t[1],i[1],n[1],a);var p=e.__t<1?l(t[0],i[0],n[0],a):l(n[0],i[0],t[0],1-a),c=e.__t<1?l(t[1],i[1],n[1],a):l(n[1],i[1],t[1],1-a);e.rotation=-Math.atan2(c,p)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==e.__lastT&&e.__lastT=0&&!(i[r]<=t);r--);r=Math.min(r,a-2)}else{for(r=o;rt);r++);r=Math.min(r-1,a-2)}var s=(t-i[r])/(i[r+1]-i[r]),l=n[r],p=n[r+1];e.x=l[0]*(1-s)+s*p[0],e.y=l[1]*(1-s)+s*p[1];var c=e.__t<1?p[0]-l[0]:l[0]-p[0],d=e.__t<1?p[1]-l[1]:l[1]-p[1];e.rotation=-Math.atan2(d,c)-Math.PI/2,this._lastFrame=r,this._lastFramePercent=t,e.ignore=!1}},t}(vB),wB=function(){this.polyline=!1,this.curveness=0,this.segs=[]},SB=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return Xe(t,e),t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},t.prototype.getDefaultShape=function(){return new wB},t.prototype.buildPath=function(e,t){var n,i=t.segs,a=t.curveness;if(t.polyline)for(n=this._off;n0){e.moveTo(i[n++],i[n++]);for(var o=1;o0){var d=(s+p)/2-(l-c)*a,u=(l+c)/2-(p-s)*a;e.quadraticCurveTo(d,u,p,c)}else e.lineTo(p,c)}this.incremental&&(this._off=n,this.notClear=!0)},t.prototype.findDataIndex=function(e,t){var n=this.shape,i=n.segs,a=n.curveness,r=this.style.lineWidth;if(n.polyline)for(var o=0,s=0;s0)for(var p=i[s++],c=i[s++],d=1;d0){if(cm(p,c,(p+u)/2-(c-m)*a,(c+m)/2-(u-p)*a,u,m,r,e,t))return o}else if(lm(p,c,u,m,r,e,t))return o;o++}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),i=this.getBoundingRect();return e=n[0],t=n[1],i.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape.segs,n=1/0,i=1/0,a=-1/0,r=-1/0,o=0;o0&&(r.dataIndex=n+e.__startIndex)})},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),_B={seriesType:"lines",plan:Pw(),reset:function(e){var t=e.coordinateSystem;if(t){var n=e.get("polyline"),i=e.pipelineContext.large;return{progress:function(a,r){var o=[];if(i){var s=void 0,l=a.end-a.start;if(n){for(var p=0,c=a.start;c0&&(l||s.configLayer(r,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(o/10+.9,1),0)})),a.updateData(i);var p=e.get("clip",!0)&&ZM(e.coordinateSystem,!1,e);p?this.group.setClipPath(p):this.group.removeClipPath(),this._lastZlevel=r,this._finished=!0},t.prototype.incrementalPrepareRender=function(e,t,n){var i=e.getData();this._updateLineDraw(i,e).incrementalPrepareUpdate(i),this._clearLayer(n),this._finished=!1},t.prototype.incrementalRender=function(e,t,n){this._lineDraw.incrementalUpdate(e,t.getData()),this._finished=e.end===t.getData().count()},t.prototype.eachRendered=function(e){this._lineDraw&&this._lineDraw.eachRendered(e)},t.prototype.updateTransform=function(e,t,n){var i=e.getData(),a=e.pipelineContext;if(!this._finished||a.large||a.progressiveRender)return{update:!0};var r=_B.reset(e,t,n);r.progress&&r.progress({start:0,end:i.count(),count:i.count()},i),this._lineDraw.updateLayout(),this._clearLayer(n)},t.prototype._updateLineDraw=function(e,t){var n=this._lineDraw,i=this._showEffect(t),a=!!t.get("polyline"),r=t.pipelineContext.large;return n&&i===this._hasEffet&&a===this._isPolyline&&r===this._isLargeDraw||(n&&n.remove(),n=this._lineDraw=r?new CB:new aO(a?i?bB:xB:i?vB:iO),this._hasEffet=i,this._isPolyline=a,this._isLargeDraw=r),this.group.add(n.group),n},t.prototype._showEffect=function(e){return!!e.get(["effect","show"])},t.prototype._clearLayer=function(e){var t=e.getZr();"svg"===t.painter.getType()||null==this._lastZlevel||t.painter.getLayer(this._lastZlevel).clear(!0)},t.prototype.remove=function(e,t){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(t)},t.prototype.dispose=function(e,t){this.remove(e,t)},t.type="lines"}(Ow),"undefined"==typeof Uint32Array?Array:Uint32Array),EB="undefined"==typeof Float64Array?Array:Float64Array;function MB(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=Wr(t,function(e){var t={coords:[e[0].coord,e[1].coord]};return e[0].name&&(t.fromName=e[0].name),e[1].name&&(t.toName=e[1].name),Lr([t,e[0],e[1]])}))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath="lineStyle",n.visualDrawType="stroke",n}Xe(t,e),t.prototype.init=function(t){t.data=t.data||[],MB(t);var n=this._processFlatCoordsArray(t.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(t.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},t.prototype.mergeOption=function(t){if(MB(t),t.data){var n=this._processFlatCoordsArray(t.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(t.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},t.prototype.appendData=function(e){var t=this._processFlatCoordsArray(e.data);t.flatCoords&&(this._flatCoords?(this._flatCoords=Mo(this._flatCoords,t.flatCoords),this._flatCoordsOffset=Mo(this._flatCoordsOffset,t.flatCoordsOffset)):(this._flatCoords=t.flatCoords,this._flatCoordsOffset=t.flatCoordsOffset),e.data=new Float32Array(t.count)),this.getRawData().appendData(e.data)},t.prototype._getCoordsFromItemModel=function(e){var t=this.getData().getItemModel(e),n=t.option instanceof Array?t.option:t.getShallow("coords");return n},t.prototype.getLineCoordsCount=function(e){return this._flatCoordsOffset?this._flatCoordsOffset[2*e+1]:this._getCoordsFromItemModel(e).length},t.prototype.getLineCoords=function(e,t){if(this._flatCoordsOffset){for(var n=this._flatCoordsOffset[2*e],i=this._flatCoordsOffset[2*e+1],a=0;a ")})},t.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},t.prototype.getProgressive=function(){var e=this.option.progressive;return null==e?this.option.large?1e4:this.get("progressive"):e},t.prototype.getProgressiveThreshold=function(){var e=this.option.progressiveThreshold;return null==e?this.option.large?2e4:this.get("progressiveThreshold"):e},t.prototype.getZLevelKey=function(){var e=this.getModel("effect"),t=e.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:e.get("show")&&t>0?t+"":""},t.type="series.lines",t.dependencies=["grid","polar","geo","calendar"],t.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}}}(ww);var IB=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=wr.createCanvas();this.canvas=e}return e.prototype.update=function(e,t,n,i,a,r){var o=this._getBrush(),s=this._getGradient(a,"inRange"),l=this._getGradient(a,"outOfRange"),p=this.pointSize+this.blurSize,c=this.canvas,d=c.getContext("2d"),u=e.length;c.width=t,c.height=n;for(var m=0;m0){var T=r(y)?s:l;y>0&&(y=y*C+S),x[b++]=T[_],x[b++]=T[_+1],x[b++]=T[_+2],x[b++]=T[_+3]*y*256}else b+=4}return d.putImageData(v,0,0),c},e.prototype._getBrush=function(){var e=this._brushCanvas||(this._brushCanvas=wr.createCanvas()),t=this.pointSize+this.blurSize,n=2*t;e.width=n,e.height=n;var i=e.getContext("2d");return i.clearRect(0,0,n,n),i.shadowOffsetX=n,i.shadowBlur=this.blurSize,i.shadowColor="#000",i.beginPath(),i.arc(-t,t,this.pointSize,0,2*Math.PI,!0),i.closePath(),i.fill(),e},e.prototype._getGradient=function(e,t){for(var n=this._gradientPixels,i=n[t]||(n[t]=new Uint8ClampedArray(1024)),a=[0,0,0,0],r=0,o=0;o<256;o++)e[t](o/255,!0,a),i[r++]=a[0],i[r++]=a[1],i[r++]=a[2],i[r++]=a[3];return i},e}();function kB(e){var t=e.dimensions;return"lng"===t[0]&&"lat"===t[1]}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.render=function(e,t,n){var i;t.eachComponent("visualMap",function(t){t.eachTargetSeries(function(n){n===e&&(i=t)})}),this._progressiveEls=null,this.group.removeAll();var a=e.coordinateSystem;"cartesian2d"===a.type||"calendar"===a.type?this._renderOnCartesianAndCalendar(e,n,0,e.getData().count()):kB(a)&&this._renderOnGeo(a,e,i,n)},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll()},t.prototype.incrementalRender=function(e,t,n,i){var a=t.coordinateSystem;a&&(kB(a)?this.render(t,n,i):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(t,i,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){Xf(this._progressiveEls||this.group,e)},t.prototype._renderOnCartesianAndCalendar=function(e,t,n,i,a){var r,o,s,l,p=e.coordinateSystem,c=QM(p,"cartesian2d");if(c){var d=p.getAxis("x"),u=p.getAxis("y");0,r=d.getBandWidth()+.5,o=u.getBandWidth()+.5,s=d.scale.getExtent(),l=u.scale.getExtent()}for(var m=this.group,h=e.getData(),g=e.getModel(["emphasis","itemStyle"]).getItemStyle(),f=e.getModel(["blur","itemStyle"]).getItemStyle(),y=e.getModel(["select","itemStyle"]).getItemStyle(),v=e.get(["itemStyle","borderRadius"]),x=ny(e),b=e.getModel("emphasis"),w=b.get("focus"),S=b.get("blurScope"),C=b.get("disabled"),_=c?[h.mapDimension("x"),h.mapDimension("y"),h.mapDimension("value")]:[h.mapDimension("time"),h.mapDimension("value")],T=n;Ts[1]||kl[1])continue;var P=p.dataToPoint([I,k]);E=new qm({shape:{x:P[0]-r/2,y:P[1]-o/2,width:r,height:o},style:M})}else{if(isNaN(h.get(_[1],T)))continue;E=new qm({z2:1,shape:p.dataToRect([h.get(_[0],T)]).contentShape,style:M})}if(h.hasItemOption){var D=h.getItemModel(T),A=D.getModel("emphasis");g=A.getModel("itemStyle").getItemStyle(),f=D.getModel(["blur","itemStyle"]).getItemStyle(),y=D.getModel(["select","itemStyle"]).getItemStyle(),v=D.get(["itemStyle","borderRadius"]),w=A.get("focus"),S=A.get("blurScope"),C=A.get("disabled"),x=ny(D)}E.shape.r=v;var O=e.getRawValue(T),R="-";O&&null!=O[2]&&(R=O[2]+""),ty(E,x,{labelFetcher:e,labelDataIndex:T,defaultOpacity:M.opacity,defaultText:R}),E.ensureState("emphasis").style=g,E.ensureState("blur").style=f,E.ensureState("select").style=y,Hh(E,w,S,C),E.incremental=a,a&&(E.states.emphasis.hoverLayer=!0),m.add(E),h.setItemGraphicEl(T,E),this._progressiveEls&&this._progressiveEls.push(E)}},t.prototype._renderOnGeo=function(e,t,n,i){var a=n.targetVisuals.inRange,r=n.targetVisuals.outOfRange,o=t.getData(),s=this._hmLayer||this._hmLayer||new IB;s.blurSize=t.get("blurSize"),s.pointSize=t.get("pointSize"),s.minOpacity=t.get("minOpacity"),s.maxOpacity=t.get("maxOpacity");var l=e.getViewRect().clone(),p=e.getRoamTransform();l.applyTransform(p);var c=Math.max(l.x,0),d=Math.max(l.y,0),u=Math.min(l.width+l.x,i.getWidth()),m=Math.min(l.height+l.y,i.getHeight()),h=u-c,g=m-d,f=[o.mapDimension("lng"),o.mapDimension("lat"),o.mapDimension("value")],y=o.mapArray(f,function(t,n,i){var a=e.dataToPoint([t,n]);return a[0]-=c,a[1]-=d,a.push(i),a}),v=n.getExtent(),x="visualMap.continuous"===n.type?function(e,t){var n=e[1]-e[0];return t=[(t[0]-e[0])/n,(t[1]-e[0])/n],function(e){return e>=t[0]&&e<=t[1]}}(v,n.option.range):function(e,t,n){var i=e[1]-e[0],a=(t=Wr(t,function(t){return{interval:[(t.interval[0]-e[0])/i,(t.interval[1]-e[0])/i]}})).length,r=0;return function(e){var i;for(i=r;i=0;i--){var o;if((o=t[i].interval)[0]<=e&&e<=o[1]){r=i;break}}return i>=0&&i0?1:-1}(n,r,a,i,d),function(e,t,n,i,a,r,o,s,l,p){var c,d=l.valueDim,u=l.categoryDim,m=Math.abs(n[u.wh]),h=e.getItemVisual(t,"symbolSize");c=Jr(h)?h.slice():null==h?["100%","100%"]:[h,h];c[u.index]=Zc(c[u.index],m),c[d.index]=Zc(c[d.index],i?m:Math.abs(r)),p.symbolSize=c;var g=p.symbolScale=[c[0]/s,c[1]/s];g[d.index]*=(l.isHorizontal?-1:1)*o}(e,t,a,r,0,d.boundingLength,d.pxSign,p,i,d),function(e,t,n,i,a){var r=e.get(PB)||0;r&&(AB.attr({scaleX:t[0],scaleY:t[1],rotation:n}),AB.updateTransform(),r/=AB.getLineScale(),r*=t[i.valueDim.index]);a.valueLineWidth=r||0}(n,d.symbolScale,l,i,d);var u=d.symbolSize,m=$S(n.get("symbolOffset"),u);return function(e,t,n,i,a,r,o,s,l,p,c,d){var u=c.categoryDim,m=c.valueDim,h=d.pxSign,g=Math.max(t[m.index]+s,0),f=g;if(i){var y=Math.abs(l),v=mo(e.get("symbolMargin"),"15%")+"",x=!1;v.lastIndexOf("!")===v.length-1&&(x=!0,v=v.slice(0,v.length-1));var b=Zc(v,t[m.index]),w=Math.max(g+2*b,0),S=x?0:2*b,C=hd(i),_=C?i:YB((y+S)/w);w=g+2*(b=(y-_*g)/2/(x?_:Math.max(_-1,1))),S=x?0:2*b,C||"fixed"===i||(_=p?YB((Math.abs(p)+S)/w):0),f=_*w-S,d.repeatTimes=_,d.symbolMargin=b}var T=h*(f/2),E=d.pathPosition=[];E[u.index]=n[u.wh]/2,E[m.index]="start"===o?T:"end"===o?l-T:l/2,r&&(E[0]+=r[0],E[1]+=r[1]);var M=d.bundlePosition=[];M[u.index]=n[u.xy],M[m.index]=n[m.xy];var I=d.barRectShape=Vr({},n);I[m.wh]=h*Math.max(Math.abs(n[m.wh]),Math.abs(E[m.index]+T)),I[u.wh]=n[u.wh];var k=d.clipShape={};k[u.xy]=-n[u.xy],k[u.wh]=c.ecSize[u.wh],k[m.xy]=0,k[m.wh]=n[m.wh]}(n,u,a,r,0,m,s,d.valueLineWidth,d.boundingLength,d.repeatCutLength,i,d),d}function RB(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function BB(e){var t=e.symbolPatternSize,n=HS(e.symbolType,-t/2,-t/2,t,t);return n.attr({culling:!0}),"image"!==n.type&&n.setStyle({strokeNoScale:!0}),n}function FB(e,t,n,i){var a=e.__pictorialBundle,r=n.symbolSize,o=n.valueLineWidth,s=n.pathPosition,l=t.valueDim,p=n.repeatTimes||0,c=0,d=r[t.valueDim.index]+o+2*n.symbolMargin;for(WB(e,function(e){e.__pictorialAnimationIndex=c,e.__pictorialRepeatTimes=p,c0:i<0)&&(a=p-1-e),t[l.index]=d*(a-p/2+.5)+s[l.index],{x:t[0],y:t[1],scaleX:n.symbolScale[0],scaleY:n.symbolScale[1],rotation:n.rotation}}}function NB(e,t,n,i){var a=e.__pictorialBundle,r=e.__pictorialMainPath;r?$B(r,null,{x:n.pathPosition[0],y:n.pathPosition[1],scaleX:n.symbolScale[0],scaleY:n.symbolScale[1],rotation:n.rotation},n,i):(r=e.__pictorialMainPath=BB(n),a.add(r),$B(r,{x:n.pathPosition[0],y:n.pathPosition[1],scaleX:0,scaleY:0,rotation:n.rotation},{scaleX:n.symbolScale[0],scaleY:n.symbolScale[1]},n,i))}function LB(e,t,n){var i=Vr({},t.barRectShape),a=e.__pictorialBarRect;a?$B(a,null,{shape:i},t,n):((a=e.__pictorialBarRect=new qm({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}})).disableMorphing=!0,e.add(a))}function VB(e,t,n,i){if(n.symbolClip){var a=e.__pictorialClipPath,r=Vr({},n.clipShape),o=t.valueDim,s=n.animationModel,l=n.dataIndex;if(a)gf(a,{shape:r},s,l);else{r[o.wh]=0,a=new qm({shape:r}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var p={};p[o.wh]=n.clipShape[o.wh],Zf[i?"updateProps":"initProps"](a,{shape:p},s,l)}}}function qB(e,t){var n=e.getItemModel(t);return n.getAnimationDelayParams=GB,n.isAnimationEnabled=zB,n}function GB(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function zB(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function UB(e,t,n,i){var a=new qc,r=new qc;return a.add(r),a.__pictorialBundle=r,r.x=n.bundlePosition[0],r.y=n.bundlePosition[1],n.symbolRepeat?FB(a,t,n):NB(a,0,n),LB(a,n,i),VB(a,t,n,i),a.__pictorialShapeStr=HB(e,n),a.__pictorialSymbolMeta=n,a}function jB(e,t,n,i){var a=i.__pictorialBarRect;a&&a.removeTextContent();var r=[];WB(i,function(e){r.push(e)}),i.__pictorialMainPath&&r.push(i.__pictorialMainPath),i.__pictorialClipPath&&(n=null),Hr(r,function(e){vf(e,{scaleX:0,scaleY:0},n,t,function(){i.parent&&i.parent.remove(i)})}),e.setItemGraphicEl(t,null)}function HB(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function WB(e,t,n){Hr(e.__pictorialBundle.children(),function(i){i!==e.__pictorialBarRect&&t.call(n,i)})}function $B(e,t,n,i,a,r){t&&e.attr(t),i.symbolClip&&!a?n&&e.attr(n):n&&Zf[a?"updateProps":"initProps"](e,n,i.animationModel,i.dataIndex,r)}function KB(e,t,n){var i=n.dataIndex,a=n.itemModel,r=a.getModel("emphasis"),o=r.getModel("itemStyle").getItemStyle(),s=a.getModel(["blur","itemStyle"]).getItemStyle(),l=a.getModel(["select","itemStyle"]).getItemStyle(),p=a.getShallow("cursor"),c=r.get("focus"),d=r.get("blurScope"),u=r.get("scale");WB(e,function(e){if(e instanceof Om){var t=e.style;e.useStyle(Vr({image:t.image,x:t.x,y:t.y,width:t.width,height:t.height},n.style))}else e.useStyle(n.style);var i=e.ensureState("emphasis");i.style=o,u&&(i.scaleX=1.1*e.scaleX,i.scaleY=1.1*e.scaleY),e.ensureState("blur").style=s,e.ensureState("select").style=l,p&&(e.cursor=p),e.z2=n.z2});var m=t.valueDim.posDesc[+(n.boundingLength>0)],h=e.__pictorialBarRect;h.ignoreClip=!0,ty(h,ny(a),{labelFetcher:t.seriesModel,labelDataIndex:i,defaultText:DM(t.seriesModel.getData(),i),inheritColor:n.style.fill,defaultOpacity:n.style.opacity,defaultOutsidePosition:m}),Hh(e,c,d,r.get("disabled"))}function YB(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n.defaultSymbol="roundRect",n}Xe(t,e),t.prototype.getInitialData=function(t){return t.stack=null,e.prototype.getInitialData.apply(this,arguments)},t.type="series.pictorialBar",t.dependencies=["grid"],t.defaultOption=Iy(fI.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:"#212121"}}})}(fI);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._layers=[],n}Xe(t,e),t.prototype.render=function(e,t,n){var i=e.getData(),a=this,r=this.group,o=e.getLayerSeries(),s=i.getLayout("layoutInfo"),l=s.rect,p=s.boundaryGap;function c(e){return e.name}r.x=0,r.y=l.y+p[0];var d=new P_(this._layersSeries||[],o,c,c),u=[];function m(t,n,s){var l=a._layers;if("remove"!==t){for(var p,c,d=[],m=[],h=o[n].indices,g=0;gT&&!od(M-T)&&M0?(a.virtualPiece?a.virtualPiece.updateData(!1,i,e,t,n):(a.virtualPiece=new XB(i,e,t,n),l.add(a.virtualPiece)),r.piece.off("click"),a.virtualPiece.on("click",function(e){a._rootToNode(r.parentNode)})):a.virtualPiece&&(l.remove(a.virtualPiece),a.virtualPiece=null)}(o,s),this._initEvents(),this._oldChildren=c},t.prototype._initEvents=function(){var e=this;this.group.off("click"),this.group.on("click",function(t){var n=!1;e.seriesModel.getViewRoot().eachNode(function(i){if(!n&&i.piece&&i.piece===t.target){var a=i.getModel().get("nodeClick");if("rootToNode"===a)e._rootToNode(i);else if("link"===a){var r=i.getModel(),o=r.get("link");if(o)Sv(o,r.get("target",!0)||"_blank")}n=!0}})})},t.prototype._rootToNode=function(e){e!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:ZB,from:this.uid,seriesId:this.seriesModel.id,targetNode:e})},t.prototype.containPoint=function(e,t){var n=t.getData().getItemLayout(0);if(n){var i=e[0]-n.cx,a=e[1]-n.cy,r=Math.sqrt(i*i+a*a);return r<=n.r&&r>=n.r0}},t.type="sunburst"})(Ow),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreStyleOnData=!0,n}Xe(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};QB(n);var i=this._levelModels=Wr(e.levels||[],function(e){return new Ty(e,this,t)},this),a=JD.createTree(n,this,function(e){e.wrapMethod("getItemModel",function(e,t){var n=a.getNodeByDataIndex(t),r=i[n.depth];return r&&(e.parentModel=r),e})});return a.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.getDataParams=function(t){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return n.treePathInfo=iA(i,this),n},t.prototype.getLevelModel=function(e){return this._levelModels&&this._levelModels[e.depth]},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(e){e?this._viewRoot=e:e=this._viewRoot;var t=this.getRawData().tree.root;e&&(e===t||t.contains(e))||(this._viewRoot=t)},t.prototype.enableAriaDecal=function(){aA(this)},t.type="series.sunburst",t.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"}}(ww);function QB(e){var t=0;Hr(e.children,function(e){QB(e);var n=e.value;Jr(n)&&(n=n[0]),t+=n});var n=e.value;Jr(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),Jr(e.value)?e.value[0]=n:e.value=n}Math.PI;var JB={color:"fill",borderColor:"stroke"},eF={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},tF=Bd(),nF=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},t.prototype.getInitialData=function(e,t){return pT(null,this)},t.prototype.getDataParams=function(t,n,i){var a=e.prototype.getDataParams.call(this,t,n);return i&&(a.info=tF(i).info),a},t.type="series.custom",t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},t}(ww);function iF(e,t){return t=t||[0,0],Wr(["x","y"],function(n,i){var a=this.getAxis(n),r=t[i],o=e[i]/2;return"category"===a.type?a.getBandWidth():Math.abs(a.dataToCoord(r-o)-a.dataToCoord(r+o))},this)}function aF(e,t){return t=t||[0,0],Wr([0,1],function(n){var i=t[n],a=e[n]/2,r=[],o=[];return r[n]=i-a,o[n]=i+a,r[1-n]=o[1-n]=t[1-n],Math.abs(this.dataToPoint(r)[n]-this.dataToPoint(o)[n])},this)}function rF(e,t){var n=this.getAxis(),i=t instanceof Array?t[0]:t,a=(e instanceof Array?e[0]:e)/2;return"category"===n.type?n.getBandWidth():Math.abs(n.dataToCoord(i-a)-n.dataToCoord(i+a))}function oF(e,t){return t=t||[0,0],Wr(["Radius","Angle"],function(n,i){var a=this["get"+n+"Axis"](),r=t[i],o=e[i]/2,s="category"===a.type?a.getBandWidth():Math.abs(a.dataToCoord(r-o)-a.dataToCoord(r+o));return"Angle"===n&&(s=s*Math.PI/180),s},this)}function sF(e,t,n,i){return e&&(e.legacy||!1!==e.legacy&&!n&&!i&&"tspan"!==t&&("text"===t||Po(e,"text")))}function lF(e,t,n){var i,a,r,o=e;if("text"===t)r=o;else{r={},Po(o,"text")&&(r.text=o.text),Po(o,"rich")&&(r.rich=o.rich),Po(o,"textFill")&&(r.fill=o.textFill),Po(o,"textStroke")&&(r.stroke=o.textStroke),Po(o,"fontFamily")&&(r.fontFamily=o.fontFamily),Po(o,"fontSize")&&(r.fontSize=o.fontSize),Po(o,"fontStyle")&&(r.fontStyle=o.fontStyle),Po(o,"fontWeight")&&(r.fontWeight=o.fontWeight),a={type:"text",style:r,silent:!0},i={};var s=Po(o,"textPosition");n?i.position=s?o.textPosition:"inside":s&&(i.position=o.textPosition),Po(o,"textPosition")&&(i.position=o.textPosition),Po(o,"textOffset")&&(i.offset=o.textOffset),Po(o,"textRotation")&&(i.rotation=o.textRotation),Po(o,"textDistance")&&(i.distance=o.textDistance)}return pF(r,e),Hr(r.rich,function(e){pF(e,e)}),{textConfig:i,textContent:a}}function pF(e,t){t&&(t.font=t.textFont||t.font,Po(t,"textStrokeWidth")&&(e.lineWidth=t.textStrokeWidth),Po(t,"textAlign")&&(e.align=t.textAlign),Po(t,"textVerticalAlign")&&(e.verticalAlign=t.textVerticalAlign),Po(t,"textLineHeight")&&(e.lineHeight=t.textLineHeight),Po(t,"textWidth")&&(e.width=t.textWidth),Po(t,"textHeight")&&(e.height=t.textHeight),Po(t,"textBackgroundColor")&&(e.backgroundColor=t.textBackgroundColor),Po(t,"textPadding")&&(e.padding=t.textPadding),Po(t,"textBorderColor")&&(e.borderColor=t.textBorderColor),Po(t,"textBorderWidth")&&(e.borderWidth=t.textBorderWidth),Po(t,"textBorderRadius")&&(e.borderRadius=t.textBorderRadius),Po(t,"textBoxShadowColor")&&(e.shadowColor=t.textBoxShadowColor),Po(t,"textBoxShadowBlur")&&(e.shadowBlur=t.textBoxShadowBlur),Po(t,"textBoxShadowOffsetX")&&(e.shadowOffsetX=t.textBoxShadowOffsetX),Po(t,"textBoxShadowOffsetY")&&(e.shadowOffsetY=t.textBoxShadowOffsetY))}function cF(e,t,n){var i=e;i.textPosition=i.textPosition||n.position||"inside",null!=n.offset&&(i.textOffset=n.offset),null!=n.rotation&&(i.textRotation=n.rotation),null!=n.distance&&(i.textDistance=n.distance);var a=i.textPosition.indexOf("inside")>=0,r=e.fill||"#000";dF(i,t);var o=null==i.textFill;return a?o&&(i.textFill=n.insideFill||"#fff",!i.textStroke&&n.insideStroke&&(i.textStroke=n.insideStroke),!i.textStroke&&(i.textStroke=r),null==i.textStrokeWidth&&(i.textStrokeWidth=2)):(o&&(i.textFill=e.fill||n.outsideFill||"#000"),!i.textStroke&&n.outsideStroke&&(i.textStroke=n.outsideStroke)),i.text=t.text,i.rich=t.rich,Hr(t.rich,function(e){dF(e,e)}),i}function dF(e,t){t&&(Po(t,"fill")&&(e.textFill=t.fill),Po(t,"stroke")&&(e.textStroke=t.fill),Po(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),Po(t,"font")&&(e.font=t.font),Po(t,"fontStyle")&&(e.fontStyle=t.fontStyle),Po(t,"fontWeight")&&(e.fontWeight=t.fontWeight),Po(t,"fontSize")&&(e.fontSize=t.fontSize),Po(t,"fontFamily")&&(e.fontFamily=t.fontFamily),Po(t,"align")&&(e.textAlign=t.align),Po(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),Po(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),Po(t,"width")&&(e.textWidth=t.width),Po(t,"height")&&(e.textHeight=t.height),Po(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),Po(t,"padding")&&(e.textPadding=t.padding),Po(t,"borderColor")&&(e.textBorderColor=t.borderColor),Po(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),Po(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),Po(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),Po(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),Po(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Po(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Po(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),Po(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),Po(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),Po(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}var uF={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},mF=Xr(uF),hF=($r(xc,function(e,t){return e[t]=1,e},{}),xc.join(", "),["","style","shape","extra"]),gF=Bd();function fF(e,t,n,i,a){var r=e+"Animation",o=mf(e,i,a)||{},s=gF(t).userDuring;return o.duration>0&&(o.during=s?Zr(CF,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),Vr(o,n[r]),o}function yF(e,t,n,i){var a=(i=i||{}).dataIndex,r=i.isInit,o=i.clearStyle,s=n.isAnimationEnabled(),l=gF(e),p=t.style;l.userDuring=t.during;var c={},d={};if(function(e,t,n){for(var i=0;i=0)){var d=e.getAnimationStyleProps(),u=d?d.style:null;if(u){!a&&(a=i.style={});var m=Xr(n);for(p=0;p0&&e.animateFrom(u,m)}else!function(e,t,n,i,a){if(a){var r=fF("update",e,t,i,n);r.duration>0&&e.animateFrom(a,r)}}(e,t,a||0,n,c);vF(e,t),p?e.dirty():e.markRedraw()}function vF(e,t){for(var n=gF(e).leaveToProps,i=0;i=0){!r&&(r=i[e]={});var u=Xr(o);for(c=0;ci[1]&&i.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:i[1],r0:i[0]},api:{coord:function(i){var a=t.dataToRadius(i[0]),r=n.dataToAngle(i[1]),o=e.coordToPoint([a,r]);return o.push(a,r*Math.PI/180),o},size:Zr(oF,e)}}},calendar:function(e){var t=e.getRect(),n=e.getRangeInfo();return{coordSys:{type:"calendar",x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:n.start,end:n.end,weeks:n.weeks,dayCount:n.allDay}},api:{coord:function(t,n){return e.dataToPoint(t,n)}}}}};function GF(e){return e instanceof Im}function zF(e){return e instanceof Tu}var UF=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.render=function(e,t,n,i){this._progressiveEls=null;var a=this._data,r=e.getData(),o=this.group,s=KF(e,r,t,n);a||o.removeAll(),r.diff(a).add(function(t){XF(n,null,t,s(t,i),e,o,r)}).remove(function(t){var n=a.getItemGraphicEl(t);n&&xF(n,tF(n).option,e)}).update(function(t,l){var p=a.getItemGraphicEl(l);XF(n,p,t,s(t,i),e,o,r)}).execute();var l=e.get("clip",!0)?ZM(e.coordinateSystem,!1,e):null;l?o.setClipPath(l):o.removeClipPath(),this._data=r},t.prototype.incrementalPrepareRender=function(e,t,n){this.group.removeAll(),this._data=null},t.prototype.incrementalRender=function(e,t,n,i,a){var r=t.getData(),o=KF(t,r,n,i),s=this._progressiveEls=[];function l(e){e.isGroup||(e.incremental=!0,e.ensureState("emphasis").hoverLayer=!0)}for(var p=e.start;p=0?t.getStore().get(a,n):void 0}var r=t.get(i.name,n),o=i&&i.ordinalMeta;return o?o.categories[r]:r},styleEmphasis:function(n,i){0;null==i&&(i=s);var a=v(i,DF).getItemStyle(),r=x(i,DF),o=iy(r,null,null,!0,!0);o.text=r.getShallow("show")?go(e.getFormattedLabel(i,DF),e.getFormattedLabel(i,AF),DM(t,i)):null;var l=ay(r,null,!0);return w(n,a),a=cF(a,o,l),n&&b(a,n),a.legacy=!0,a},visual:function(e,n){if(null==n&&(n=s),Po(JB,e)){var i=t.getItemVisual(n,"style");return i?i[JB[e]]:null}if(Po(eF,e))return t.getItemVisual(n,e)},barLayout:function(e){if("cartesian2d"===r.type){return function(e){var t=[],n=e.axis,i="axis0";if("category"===n.type){for(var a=n.getBandWidth(),r=0;r=d;h--){var g=t.childAt(h);nN(t,g,a)}}(e,d,n,i,a),o>=0?r.replaceAt(d,o):r.add(d),d}function QF(e,t,n){var i,a=tF(e),r=t.type,o=t.shape,s=t.style;return n.isUniversalTransitionEnabled()||null!=r&&r!==a.customGraphicType||"path"===r&&((i=o)&&(Po(i,"pathData")||Po(i,"d")))&&oN(o)!==a.customPathData||"image"===r&&Po(s,"image")&&s.image!==a.customImagePath}function JF(e,t,n){var i=t?eN(e,t):e,a=t?tN(e,i,DF):e.style,r=e.type,o=i?i.textConfig:null,s=e.textContent,l=s?t?eN(s,t):s:null;if(a&&(n.isLegacy||sF(a,r,!!o,!!l))){n.isLegacy=!0;var p=lF(a,r,!t);!o&&p.textConfig&&(o=p.textConfig),!l&&p.textContent&&(l=p.textContent)}if(!t&&l){var c=l;!c.type&&(c.type="text")}var d=t?n[t]:n.normal;d.cfg=o,d.conOpt=l}function eN(e,t){return t?e?e[t]:null:e}function tN(e,t,n){var i=t&&t.style;return null==i&&n===DF&&e&&(i=e.styleEmphasis),i}function nN(e,t,n){t&&xF(t,tF(e).option,n)}function iN(e,t){var n=e&&e.name;return null!=n?n:"e\0\0"+t}function aN(e,t){var n=this.context,i=null!=e?n.newChildren[e]:null,a=null!=t?n.oldChildren[t]:null;ZF(n.api,a,n.dataIndex,i,n.seriesModel,n.group)}function rN(e){var t=this.context,n=t.oldChildren[e];n&&xF(n,tF(n).option,t.seriesModel)}function oN(e){return e&&(e.pathData||e.d)}function sN(e){e.registerChartView(UF),e.registerSeriesModel(nF)}var lN=Bd(),pN=Fr,cN=Zr,dN=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(e,t,n,i){var a=t.get("value"),r=t.get("status");if(this._axisModel=e,this._axisPointerModel=t,this._api=n,i||this._lastValue!==a||this._lastStatus!==r){this._lastValue=a,this._lastStatus=r;var o=this._group,s=this._handle;if(!r||"hide"===r)return o&&o.hide(),void(s&&s.hide());o&&o.show(),s&&s.show();var l={};this.makeElOption(l,a,e,t,n);var p=l.graphicKey;p!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=p;var c=this._moveAnimation=this.determineAnimation(e,t);if(o){var d=Qr(uN,t,c);this.updatePointerEl(o,l,d),this.updateLabelEl(o,l,d,t)}else o=this._group=new qc,this.createPointerEl(o,l,e,t),this.createLabelEl(o,l,e,t),n.getZr().add(o);fN(o,t,!0),this._renderHandle(a)}},e.prototype.remove=function(e){this.clear(e)},e.prototype.dispose=function(e){this.clear(e)},e.prototype.determineAnimation=function(e,t){var n=t.get("animation"),i=e.axis,a="category"===i.type,r=t.get("snap");if(!r&&!a)return!1;if("auto"===n||null==n){var o=this.animationThreshold;if(a&&i.getBandWidth()>o)return!0;if(r){var s=Gk(e).seriesDataCount,l=i.getExtent();return Math.abs(l[0]-l[1])/s>o}return!1}return!0===n},e.prototype.makeElOption=function(e,t,n,i,a){},e.prototype.createPointerEl=function(e,t,n,i){var a=t.pointer;if(a){var r=lN(e).pointerEl=new Zf[a.type](pN(t.pointer));e.add(r)}},e.prototype.createLabelEl=function(e,t,n,i){if(t.label){var a=lN(e).labelEl=new Um(pN(t.label));e.add(a),hN(a,i)}},e.prototype.updatePointerEl=function(e,t,n){var i=lN(e).pointerEl;i&&t.pointer&&(i.setStyle(t.pointer.style),n(i,{shape:t.pointer.shape}))},e.prototype.updateLabelEl=function(e,t,n,i){var a=lN(e).labelEl;a&&(a.setStyle(t.label.style),n(a,{x:t.label.x,y:t.label.y}),hN(a,i))},e.prototype._renderHandle=function(e){if(!this._dragging&&this.updateHandleTransform){var t,n=this._axisPointerModel,i=this._api.getZr(),a=this._handle,r=n.getModel("handle"),o=n.get("status");if(!r.get("show")||!o||"hide"===o)return a&&i.remove(a),void(this._handle=null);this._handle||(t=!0,a=this._handle=jf(r.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(e){xs(e.event)},onmousedown:cN(this._onHandleDragMove,this,0,0),drift:cN(this._onHandleDragMove,this),ondragend:cN(this._onHandleDragEnd,this)}),i.add(a)),fN(a,n,!1),a.setStyle(r.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=r.get("size");Jr(s)||(s=[s,s]),a.scaleX=s[0]/2,a.scaleY=s[1]/2,Uw(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,t)}},e.prototype._moveHandleToValue=function(e,t){uN(this._axisPointerModel,!t&&this._moveAnimation,this._handle,gN(this.getHandleTransform(e,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(e,t){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(gN(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(gN(i)),lN(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){if(this._handle){var e=this._payloadInfo,t=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:e.cursorPoint[0],y:e.cursorPoint[1],tooltipOption:e.tooltipOption,axesInfo:[{axisDim:t.axis.dim,axisIndex:t.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get("value");this._moveHandleToValue(e),this._api.dispatchAction({type:"hideTip"})}},e.prototype.clear=function(e){this._lastValue=null,this._lastStatus=null;var t=e.getZr(),n=this._group,i=this._handle;t&&n&&(this._lastGraphicKey=null,n&&t.remove(n),i&&t.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),jw(this,"_doDispatchAxisPointer")},e.prototype.doClear=function(){},e.prototype.buildLabel=function(e,t,n){return{x:e[n=n||0],y:e[1-n],width:t[n],height:t[1-n]}},e}();function uN(e,t,n,i){mN(lN(n).lastProp,i)||(lN(n).lastProp=i,t?gf(n,i,e):(n.stopAnimation(),n.attr(i)))}function mN(e,t){if(ao(e)&&ao(t)){var n=!0;return Hr(t,function(t,i){n=n&&mN(e[i],t)}),!!n}return e===t}function hN(e,t){e[t.get(["label","show"])?"show":"hide"]()}function gN(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function fN(e,t,n){var i=t.get("z"),a=t.get("zlevel");e&&e.traverse(function(e){"group"!==e.type&&(null!=i&&(e.z=i),null!=a&&(e.zlevel=a),e.silent=n)})}function yN(e){var t,n=e.get("type"),i=e.getModel(n+"Style");return"line"===n?(t=i.getLineStyle()).fill=null:"shadow"===n&&((t=i.getAreaStyle()).stroke=null),t}function vN(e,t,n,i,a){var r=xN(n.get("value"),t.axis,t.ecModel,n.get("seriesDataIndices"),{precision:n.get(["label","precision"]),formatter:n.get(["label","formatter"])}),o=n.getModel("label"),s=gv(o.get("padding")||0),l=o.getFont(),p=_c(r,l),c=a.position,d=p.width+s[1]+s[3],u=p.height+s[0]+s[2],m=a.align;"right"===m&&(c[0]-=d),"center"===m&&(c[0]-=d/2);var h=a.verticalAlign;"bottom"===h&&(c[1]-=u),"middle"===h&&(c[1]-=u/2),function(e,t,n,i){var a=i.getWidth(),r=i.getHeight();e[0]=Math.min(e[0]+t,a)-t,e[1]=Math.min(e[1]+n,r)-n,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}(c,d,u,i);var g=o.get("backgroundColor");g&&"auto"!==g||(g=t.get(["axisLine","lineStyle","color"])),e.label={x:c[0],y:c[1],style:iy(o,{text:r,font:l,fill:o.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function xN(e,t,n,i,a){e=t.scale.parse(e);var r=t.scale.getLabel({value:e},{precision:a.precision}),o=a.formatter;if(o){var s={value:dE(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};Hr(i,function(e){var t=n.getSeriesByIndex(e.seriesIndex),i=e.dataIndexInside,a=t&&t.getDataParams(i);a&&s.seriesData.push(a)}),to(o)?r=o.replace("{value}",r):eo(o)&&(r=o(s))}return r}function bN(e,t,n){var i=[1,0,0,1,0,0];return ks(i,i,n.rotation),Is(i,i,n.position),Lf([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}function wN(e,t,n,i,a,r){var o=Ok.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=a.get(["label","margin"]),vN(t,i,a,r,{position:bN(i.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function SN(e,t,n){return{x1:e[n=n||0],y1:e[1-n],x2:t[n],y2:t[1-n]}}function CN(e,t,n){return{x:e[n=n||0],y:e[1-n],width:t[n],height:t[1-n]}}function _N(e,t,n,i,a,r){return{cx:e,cy:t,r0:n,r:i,startAngle:a,endAngle:r,clockwise:!0}}var TN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.grid,s=i.get("type"),l=EN(o,r).getOtherAxis(r).getGlobalExtent(),p=r.toGlobalCoord(r.dataToCoord(t,!0));if(s&&"none"!==s){var c=yN(i),d=MN[s](r,p,l);d.style=c,e.graphicKey=d.type,e.pointer=d}wN(t,e,Ck(o.model,n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=Ck(t.axis.grid.model,t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=bN(t.axis,e,i);return{x:a[0],y:a[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,i){var a=n.axis,r=a.grid,o=a.getGlobalExtent(!0),s=EN(r,a).getOtherAxis(a).getGlobalExtent(),l="x"===a.dim?0:1,p=[e.x,e.y];p[l]+=t[l],p[l]=Math.min(o[1],p[l]),p[l]=Math.max(o[0],p[l]);var c=(s[1]+s[0])/2,d=[c,c];d[l]=p[l];return{x:p[0],y:p[1],rotation:e.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},t}(dN);function EN(e,t){var n={};return n[t.dim+"AxisIndex"]=t.index,e.getCartesian(n)}var MN={line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:SN([t,n[0]],[t,n[1]],IN(e))}},shadow:function(e,t,n){var i=Math.max(1,e.getBandWidth()),a=n[1]-n[0];return{type:"Rect",shape:CN([t-i/2,n[0]],[i,a],IN(e))}}};function IN(e){return"x"===e.dim?0:1}var kN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="axisPointer",t.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},t}(Bv),PN=Bd(),DN=Hr;function AN(e,t,n){if(!gr.node){var i=t.getZr();PN(i).records||(PN(i).records={}),function(e,t){if(PN(e).initialized)return;function n(n,i){e.on(n,function(n){var a=function(e){var t={showTip:[],hideTip:[]},n=function(i){var a=t[i.type];a?a.push(i):(i.dispatchAction=n,e.dispatchAction(i))};return{dispatchAction:n,pendings:t}}(t);DN(PN(e).records,function(e){e&&i(e,n,a.dispatchAction)}),function(e,t){var n,i=e.showTip.length,a=e.hideTip.length;i?n=e.showTip[i-1]:a&&(n=e.hideTip[a-1]);n&&(n.dispatchAction=null,t.dispatchAction(n))}(a.pendings,t)})}PN(e).initialized=!0,n("click",Qr(RN,"click")),n("mousemove",Qr(RN,"mousemove")),n("globalout",ON)}(i,t),(PN(i).records[e]||(PN(i).records[e]={})).handler=n}}function ON(e,t,n){e.handler("leave",null,n)}function RN(e,t,n,i){t.handler(e,n,i)}function BN(e,t){if(!gr.node){var n=t.getZr();(PN(n).records||{})[e]&&(PN(n).records[e]=null)}}var FN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.render=function(e,t,n){var i=t.getComponent("tooltip"),a=e.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";AN("axisPointer",n,function(e,t,n){"none"!==a&&("leave"===e||a.indexOf(e)>=0)&&n({type:"updateAxisPointer",currTrigger:e,x:t&&t.offsetX,y:t&&t.offsetY})})},t.prototype.remove=function(e,t){BN("axisPointer",t)},t.prototype.dispose=function(e,t){BN("axisPointer",t)},t.type="axisPointer",t}(kw);function NN(e,t){var n,i=[],a=e.seriesIndex;if(null==a||!(n=t.getSeriesByIndex(a)))return{point:[]};var r=n.getData(),o=Rd(r,e);if(null==o||o<0||Jr(o))return{point:[]};var s=r.getItemGraphicEl(o),l=n.coordinateSystem;if(n.getTooltipPosition)i=n.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var p=l.getBaseAxis(),c=l.getOtherAxis(p).dim,d=p.dim,u="x"===c||"radius"===c?1:0,m=r.mapDimension(d),h=[];h[u]=r.get(m,o),h[1-u]=r.get(r.getCalculationInfo("stackResultDimension"),o),i=l.dataToPoint(h)||[]}else i=l.dataToPoint(r.getValues(Wr(l.dimensions,function(e){return r.mapDimension(e)}),o))||[];else if(s){var g=s.getBoundingRect().clone();g.applyTransform(s.transform),i=[g.x+g.width/2,g.y+g.height/2]}return{point:i,el:s}}var LN=Bd();function VN(e,t,n){var i=e.currTrigger,a=[e.x,e.y],r=e,o=e.dispatchAction||Zr(n.dispatchAction,n),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){jN(a)&&(a=NN({seriesIndex:r.seriesIndex,dataIndex:r.dataIndex},t).point);var l=jN(a),p=r.axesInfo,c=s.axesInfo,d="leave"===i||jN(a),u={},m={},h={list:[],map:{}},g={showPointer:Qr(GN,m),showTooltip:Qr(zN,h)};Hr(s.coordSysMap,function(e,t){var n=l||e.containPoint(a);Hr(s.coordSysAxesInfo[t],function(e,t){var i=e.axis,r=function(e,t){for(var n=0;n<(e||[]).length;n++){var i=e[n];if(t.axis.dim===i.axisDim&&t.axis.model.componentIndex===i.axisIndex)return i}}(p,e);if(!d&&n&&(!p||r)){var o=r&&r.value;null!=o||l||(o=i.pointToData(a)),null!=o&&qN(e,o,g,!1,u)}})});var f={};return Hr(c,function(e,t){var n=e.linkGroup;n&&!m[t]&&Hr(n.axesInfo,function(t,i){var a=m[i];if(t!==e&&a){var r=a.value;n.mapper&&(r=e.axis.scale.parse(n.mapper(r,UN(t),UN(e)))),f[e.key]=r}})}),Hr(f,function(e,t){qN(c[t],e,g,!0,u)}),function(e,t,n){var i=n.axesInfo=[];Hr(t,function(t,n){var a=t.axisPointerModel.option,r=e[n];r?(!t.useHandle&&(a.status="show"),a.value=r.value,a.seriesDataIndices=(r.payloadBatch||[]).slice()):!t.useHandle&&(a.status="hide"),"show"===a.status&&i.push({axisDim:t.axis.dim,axisIndex:t.axis.model.componentIndex,value:a.value})})}(m,c,u),function(e,t,n,i){if(jN(t)||!e.list.length)return void i({type:"hideTip"});var a=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};i({type:"showTip",escapeConnect:!0,x:t[0],y:t[1],tooltipOption:n.tooltipOption,position:n.position,dataIndexInside:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:e.list})}(h,a,e,o),function(e,t,n){var i=n.getZr(),a="axisPointerLastHighlights",r=LN(i)[a]||{},o=LN(i)[a]={};Hr(e,function(e,t){var n=e.axisPointerModel.option;"show"===n.status&&e.triggerEmphasis&&Hr(n.seriesDataIndices,function(e){var t=e.seriesIndex+" | "+e.dataIndex;o[t]=e})});var s=[],l=[];Hr(r,function(e,t){!o[t]&&l.push(e)}),Hr(o,function(e,t){!r[t]&&s.push(e)}),l.length&&n.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&n.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(c,0,n),u}}function qN(e,t,n,i,a){var r=e.axis;if(!r.scale.isBlank()&&r.containData(t))if(e.involveSeries){var o=function(e,t){var n=t.axis,i=n.dim,a=e,r=[],o=Number.MAX_VALUE,s=-1;return Hr(t.seriesModels,function(t,l){var p,c,d=t.getData().mapDimensionsAll(i);if(t.getAxisTooltipData){var u=t.getAxisTooltipData(d,e,n);c=u.dataIndices,p=u.nestestValue}else{if(!(c=t.getData().indicesOfNearest(d[0],e,"category"===n.type?.5:null)).length)return;p=t.getData().get(d[0],c[0])}if(null!=p&&isFinite(p)){var m=e-p,h=Math.abs(m);h<=o&&((h=0&&s<0)&&(o=h,s=m,a=p,r.length=0),Hr(c,function(e){r.push({seriesIndex:t.seriesIndex,dataIndexInside:e,dataIndex:t.getData().getRawIndex(e)})}))}}),{payloadBatch:r,snapToValue:a}}(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&null==a.seriesIndex&&Vr(a,s[0]),!i&&e.snap&&r.containData(l)&&null!=l&&(t=l),n.showPointer(e,t,s),n.showTooltip(e,o,l)}else n.showPointer(e,t)}function GN(e,t,n,i){e[t.key]={value:n,payloadBatch:i}}function zN(e,t,n,i){var a=n.payloadBatch,r=t.axis,o=r.model,s=t.axisPointerModel;if(t.triggerTooltip&&a.length){var l=t.coordSys.model,p=Uk(l),c=e.map[p];c||(c=e.map[p]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},e.list.push(c)),c.dataByAxis.push({axisDim:r.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:i,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function UN(e){var t=e.axis.model,n={},i=n.axisDim=e.axis.dim;return n.axisIndex=n[i+"AxisIndex"]=t.componentIndex,n.axisName=n[i+"AxisName"]=t.name,n.axisId=n[i+"AxisId"]=t.id,n}function jN(e){return!e||null==e[0]||isNaN(e[0])||null==e[1]||isNaN(e[1])}function HN(e){Hk.registerAxisPointerClass("CartesianAxisPointer",TN),e.registerComponentModel(kN),e.registerComponentView(FN),e.registerPreprocessor(function(e){if(e){(!e.axisPointer||0===e.axisPointer.length)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!Jr(t)&&(e.axisPointer.link=[t])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=Vk(e,t)}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},VN)}function WN(e){xE(iP),xE(HN)}var $N=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis;"angle"===r.dim&&(this.animationThreshold=Math.PI/18);var o=r.polar,s=o.getOtherAxis(r).getExtent(),l=r.dataToCoord(t),p=i.get("type");if(p&&"none"!==p){var c=yN(i),d=KN[p](r,o,l,s);d.style=c,e.graphicKey=d.type,e.pointer=d}var u=function(e,t,n,i,a){var r=t.axis,o=r.dataToCoord(e),s=i.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l,p,c,d=i.getRadiusAxis().getExtent();if("radius"===r.dim){var u=[1,0,0,1,0,0];ks(u,u,s),Is(u,u,[i.cx,i.cy]),l=Lf([o,-a],u);var m=t.getModel("axisLabel").get("rotate")||0,h=Ok.innerTextLayout(s,m*Math.PI/180,-1);p=h.textAlign,c=h.textVerticalAlign}else{var g=d[1];l=i.coordToPoint([g+a,o]);var f=i.cx,y=i.cy;p=Math.abs(l[0]-f)/g<.3?"center":l[0]>f?"left":"right",c=Math.abs(l[1]-y)/g<.3?"middle":l[1]>y?"top":"bottom"}return{position:l,align:p,verticalAlign:c}}(t,n,0,o,i.get(["label","margin"]));vN(e,n,i,a,u)},t}(dN);var KN={line:function(e,t,n,i){return"angle"===e.dim?{type:"Line",shape:SN(t.coordToPoint([i[0],n]),t.coordToPoint([i[1],n]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r:n}}},shadow:function(e,t,n,i){var a=Math.max(1,e.getBandWidth()),r=Math.PI/180;return"angle"===e.dim?{type:"Sector",shape:_N(t.cx,t.cy,i[0],i[1],(-n-a/2)*r,(a/2-n)*r)}:{type:"Sector",shape:_N(t.cx,t.cy,n-a/2,n+a/2,0,2*Math.PI)}}},YN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.findAxisModel=function(e){var t;return this.ecModel.eachComponent(e,function(e){e.getCoordSysModel()===this&&(t=e)},this),t},t.type="polar",t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}(Bv),XN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Xe(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Vd).models[0]},t.type="polarAxis",t}(Bv);Ur(XN,fE);var ZN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="angleAxis",t}(XN),QN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="radiusAxis",t}(XN),JN=function(e){function t(t,n){return e.call(this,"radius",t,n)||this}return Xe(t,e),t.prototype.pointToData=function(e,t){return this.polar.pointToData(e,t)["radius"===this.dim?0:1]},t}(UE);JN.prototype.dataToRadius=UE.prototype.dataToCoord,JN.prototype.radiusToData=UE.prototype.coordToData;var eL=Bd(),tL=function(e){function t(t,n){return e.call(this,"angle",t,n||[0,360])||this}return Xe(t,e),t.prototype.pointToData=function(e,t){return this.polar.pointToData(e,t)["radius"===this.dim?0:1]},t.prototype.calculateCategoryInterval=function(){var e=this,t=e.getLabelModel(),n=e.scale,i=n.getExtent(),a=n.count();if(i[1]-i[0]<1)return 0;var r=i[0],o=e.dataToCoord(r+1)-e.dataToCoord(r),s=Math.abs(o),l=_c(null==r?"":r+"",t.getFont(),"center","top"),p=Math.max(l.height,7)/s;isNaN(p)&&(p=1/0);var c=Math.max(0,Math.floor(p)),d=eL(e.model),u=d.lastAutoInterval,m=d.lastTickCount;return null!=u&&null!=m&&Math.abs(u-c)<=1&&Math.abs(m-a)<=1&&u>c?c=u:(d.lastTickCount=a,d.lastAutoInterval=c),c},t}(UE);tL.prototype.dataToAngle=UE.prototype.dataToCoord,tL.prototype.angleToData=UE.prototype.coordToData;var nL=["radius","angle"],iL=function(){function e(e){this.dimensions=nL,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new JN,this._angleAxis=new tL,this.axisPointerEnabled=!0,this.name=e||"",this._radiusAxis.polar=this._angleAxis.polar=this}return e.prototype.containPoint=function(e){var t=this.pointToCoord(e);return this._radiusAxis.contain(t[0])&&this._angleAxis.contain(t[1])},e.prototype.containData=function(e){return this._radiusAxis.containData(e[0])&&this._angleAxis.containData(e[1])},e.prototype.getAxis=function(e){return this["_"+e+"Axis"]},e.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},e.prototype.getAxesByScale=function(e){var t=[],n=this._angleAxis,i=this._radiusAxis;return n.scale.type===e&&t.push(n),i.scale.type===e&&t.push(i),t},e.prototype.getAngleAxis=function(){return this._angleAxis},e.prototype.getRadiusAxis=function(){return this._radiusAxis},e.prototype.getOtherAxis=function(e){var t=this._angleAxis;return e===t?this._radiusAxis:t},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},e.prototype.getTooltipAxes=function(e){var t=null!=e&&"auto"!==e?this.getAxis(e):this.getBaseAxis();return{baseAxes:[t],otherAxes:[this.getOtherAxis(t)]}},e.prototype.dataToPoint=function(e,t){return this.coordToPoint([this._radiusAxis.dataToRadius(e[0],t),this._angleAxis.dataToAngle(e[1],t)])},e.prototype.pointToData=function(e,t){var n=this.pointToCoord(e);return[this._radiusAxis.radiusToData(n[0],t),this._angleAxis.angleToData(n[1],t)]},e.prototype.pointToCoord=function(e){var t=e[0]-this.cx,n=e[1]-this.cy,i=this.getAngleAxis(),a=i.getExtent(),r=Math.min(a[0],a[1]),o=Math.max(a[0],a[1]);i.inverse?r=o-360:o=r+360;var s=Math.sqrt(t*t+n*n);t/=s,n/=s;for(var l=Math.atan2(-n,t)/Math.PI*180,p=lo;)l+=360*p;return[s,l]},e.prototype.coordToPoint=function(e){var t=e[0],n=e[1]/180*Math.PI;return[Math.cos(n)*t+this.cx,-Math.sin(n)*t+this.cy]},e.prototype.getArea=function(){var e=this.getAngleAxis(),t=this.getRadiusAxis().getExtent().slice();t[0]>t[1]&&t.reverse();var n=e.getExtent(),i=Math.PI/180;return{cx:this.cx,cy:this.cy,r0:t[0],r:t[1],startAngle:-n[0]*i,endAngle:-n[1]*i,clockwise:e.inverse,contain:function(e,t){var n=e-this.cx,i=t-this.cy,a=n*n+i*i-1e-4,r=this.r,o=this.r0;return a<=r*r&&a>=o*o}}},e.prototype.convertToPixel=function(e,t,n){return aL(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return aL(t)===this?this.pointToData(n):null},e}();function aL(e){var t=e.seriesModel,n=e.polarModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}function rL(e,t){var n=this,i=n.getAngleAxis(),a=n.getRadiusAxis();if(i.scale.setExtent(1/0,-1/0),a.scale.setExtent(1/0,-1/0),e.eachSeries(function(e){if(e.coordinateSystem===n){var t=e.getData();Hr(gE(t,"radius"),function(e){a.scale.unionExtentFromData(t,e)}),Hr(gE(t,"angle"),function(e){i.scale.unionExtentFromData(t,e)})}}),lE(i.scale,i.model),lE(a.scale,a.model),"category"===i.type&&!i.onBand){var r=i.getExtent(),o=360/i.scale.count();i.inverse?r[1]+=o:r[1]-=o,i.setExtent(r[0],r[1])}}function oL(e,t){var n;if(e.type=t.get("type"),e.scale=pE(t),e.onBand=t.get("boundaryGap")&&"category"===e.type,e.inverse=t.get("inverse"),function(e){return"angleAxis"===e.mainType}(t)){e.inverse=e.inverse!==t.get("clockwise");var i=t.get("startAngle"),a=null!==(n=t.get("endAngle"))&&void 0!==n?n:i+(e.inverse?-360:360);e.setExtent(i,a)}t.axis=e,e.model=t}var sL={dimensions:nL,create:function(e,t){var n=[];return e.eachComponent("polar",function(e,i){var a=new iL(i+"");a.update=rL;var r=a.getRadiusAxis(),o=a.getAngleAxis(),s=e.findAxisModel("radiusAxis"),l=e.findAxisModel("angleAxis");oL(r,s),oL(o,l),function(e,t,n){var i=t.get("center"),a=n.getWidth(),r=n.getHeight();e.cx=Zc(i[0],a),e.cy=Zc(i[1],r);var o=e.getRadiusAxis(),s=Math.min(a,r)/2,l=t.get("radius");null==l?l=[0,"100%"]:Jr(l)||(l=[0,l]);var p=[Zc(l[0],s),Zc(l[1],s)];o.inverse?o.setExtent(p[1],p[0]):o.setExtent(p[0],p[1])}(a,e,t),n.push(a),e.coordinateSystem=a,a.model=e}),e.eachSeries(function(e){if("polar"===e.get("coordinateSystem")){var t=e.getReferringComponents("polar",Vd).models[0];0,e.coordinateSystem=t.coordinateSystem}}),n}},lL=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function pL(e,t,n){t[1]>t[0]&&(t=t.slice().reverse());var i=e.coordToPoint([t[0],n]),a=e.coordToPoint([t[1],n]);return{x1:i[0],y1:i[1],x2:a[0],y2:a[1]}}function cL(e){return e.getRadiusAxis().inverse?0:1}function dL(e){var t=e[0],n=e[e.length-1];t&&n&&Math.abs(Math.abs(t.coord-n.coord)-360)<1e-4&&e.pop()}var uL=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="PolarAxisPointer",n}return Xe(t,e),t.prototype.render=function(e,t){if(this.group.removeAll(),e.get("show")){var n=e.axis,i=n.polar,a=i.getRadiusAxis().getExtent(),r=n.getTicksCoords(),o=n.getMinorTicksCoords(),s=Wr(n.getViewLabels(),function(e){e=Fr(e);var t=n.scale,i="ordinal"===t.type?t.getRawOrdinalNumber(e.tickValue):e.tickValue;return e.coord=n.dataToCoord(i),e});dL(s),dL(r),Hr(lL,function(t){!e.get([t,"show"])||n.scale.isBlank()&&"axisLine"!==t||mL[t](this.group,e,i,r,o,a,s)},this)}},t.type="angleAxis",t}(Hk),mL={axisLine:function(e,t,n,i,a,r){var o,s=t.getModel(["axisLine","lineStyle"]),l=n.getAngleAxis(),p=Math.PI/180,c=l.getExtent(),d=cL(n),u=d?0:1,m=360===Math.abs(c[1]-c[0])?"Circle":"Arc";(o=0===r[u]?new Zf[m]({shape:{cx:n.cx,cy:n.cy,r:r[d],startAngle:-c[0]*p,endAngle:-c[1]*p,clockwise:l.inverse},style:s.getLineStyle(),z2:1,silent:!0}):new Vg({shape:{cx:n.cx,cy:n.cy,r:r[d],r0:r[u]},style:s.getLineStyle(),z2:1,silent:!0})).style.fill=null,e.add(o)},axisTick:function(e,t,n,i,a,r){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=r[cL(n)],p=Wr(i,function(e){return new $g({shape:pL(n,[l,l+s],e.coord)})});e.add(Of(p,{style:qr(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,n,i,a,r){if(a.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),p=r[cL(n)],c=[],d=0;dh?"left":"right",y=Math.abs(m[1]-g)/u<.3?"middle":m[1]>g?"top":"bottom";if(s&&s[d]){var v=s[d];ao(v)&&v.textStyle&&(o=new Ty(v.textStyle,l,l.ecModel))}var x=new Um({silent:Ok.isLabelSilent(t),style:iy(o,{x:m[0],y:m[1],fill:o.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:i.formattedLabel,align:f,verticalAlign:y})});if(e.add(x),c){var b=Ok.makeAxisEventDataBase(t);b.targetType="axisLabel",b.value=i.rawLabel,nh(x).eventData=b}},this)},splitLine:function(e,t,n,i,a,r){var o=t.getModel("splitLine").getModel("lineStyle"),s=o.get("color"),l=0;s=s instanceof Array?s:[s];for(var p=[],c=0;c=0?"p":"n",E=b;v&&(i[s][_]||(i[s][_]={p:b,n:b}),E=i[s][_][T]);var M=void 0,I=void 0,k=void 0,P=void 0;if("radius"===d.dim){var D=d.dataToCoord(C)-b,A=r.dataToCoord(_);Math.abs(D)=P})}}})}var wL={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},SL={splitNumber:5},CL=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="polar",t}(kw);function _L(e){xE(HN),Hk.registerAxisPointerClass("PolarAxisPointer",$N),e.registerCoordinateSystem("polar",sL),e.registerComponentModel(YN),e.registerComponentView(CL),fk(e,"angle",ZN,wL),fk(e,"radius",QN,SL),e.registerComponentView(uL),e.registerComponentView(fL),e.registerLayout(Qr(bL,"bar"))}function TL(e,t){t=t||{};var n=e.coordinateSystem,i=e.axis,a={},r=i.position,o=i.orient,s=n.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],p={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};a.position=["vertical"===o?p.vertical[r]:l[0],"horizontal"===o?p.horizontal[r]:l[3]];a.rotation=Math.PI/2*{horizontal:0,vertical:1}[o];a.labelDirection=a.tickDirection=a.nameDirection={top:-1,bottom:1,right:1,left:-1}[r],e.get(["axisTick","inside"])&&(a.tickDirection=-a.tickDirection),mo(t.labelInside,e.get(["axisLabel","inside"]))&&(a.labelDirection=-a.labelDirection);var c=t.rotate;return null==c&&(c=e.get(["axisLabel","rotate"])),a.labelRotation="top"===r?-c:c,a.z2=1,a}var EL=["axisLine","axisTickLabel","axisName"],ML=["splitArea","splitLine"],IL=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="SingleAxisPointer",n}Xe(t,e),t.prototype.render=function(t,n,i,a){var r=this.group;r.removeAll();var o=this._axisGroup;this._axisGroup=new qc;var s=TL(t),l=new Ok(t,s);Hr(EL,l.add,l),r.add(this._axisGroup),r.add(l.getGroup()),Hr(ML,function(e){t.get([e,"show"])&&IL[e](this,this.group,this._axisGroup,t)},this),Gf(o,this._axisGroup,t),e.prototype.render.call(this,t,n,i,a)},t.prototype.remove=function(){Kk(this)},t.type="singleAxis"}(Hk),{splitLine:function(e,t,n,i){var a=i.axis;if(!a.scale.isBlank()){var r=i.getModel("splitLine"),o=r.getModel("lineStyle"),s=o.get("color");s=s instanceof Array?s:[s];for(var l=o.get("width"),p=i.coordinateSystem.getRect(),c=a.isHorizontal(),d=[],u=0,m=a.getTicksCoords({tickModel:r}),h=[],g=[],f=0;f=t.y&&e[1]<=t.y+t.height:n.contain(n.toLocalCoord(e[1]))&&e[0]>=t.y&&e[0]<=t.y+t.height},e.prototype.pointToData=function(e){var t=this.getAxis();return[t.coordToData(t.toLocalCoord(e["horizontal"===t.orient?0:1]))]},e.prototype.dataToPoint=function(e){var t=this.getAxis(),n=this.getRect(),i=[],a="horizontal"===t.orient?0:1;return e instanceof Array&&(e=e[0]),i[a]=t.toGlobalCoord(t.dataToCoord(+e)),i[1-a]=0===a?n.y+n.height/2:n.x+n.width/2,i},e.prototype.convertToPixel=function(e,t,n){return AL(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return AL(t)===this?this.pointToData(n):null}}();function AL(e){var t=e.seriesModel,n=e.singleAxisModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}var OL=["x","y"],RL=["width","height"],BL=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Xe(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.coordinateSystem,s=NL(o,1-FL(r)),l=o.dataToPoint(t)[0],p=i.get("type");if(p&&"none"!==p){var c=yN(i),d=BL[p](r,l,s);d.style=c,e.graphicKey=d.type,e.pointer=d}wN(t,e,TL(n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=TL(t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=bN(t.axis,e,i);return{x:a[0],y:a[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(e,t,n,i){var a=n.axis,r=a.coordinateSystem,o=FL(a),s=NL(r,o),l=[e.x,e.y];l[o]+=t[o],l[o]=Math.min(s[1],l[o]),l[o]=Math.max(s[0],l[o]);var p=NL(r,1-o),c=(p[1]+p[0])/2,d=[c,c];return d[o]=l[o],{x:l[0],y:l[1],rotation:e.rotation,cursorPoint:d,tooltipOption:{verticalAlign:"middle"}}}}(dN),{line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:SN([t,n[0]],[t,n[1]],FL(e))}},shadow:function(e,t,n){var i=e.getBandWidth(),a=n[1]-n[0];return{type:"Rect",shape:CN([t-i/2,n[0]],[i,a],FL(e))}}});function FL(e){return e.isHorizontal()?0:1}function NL(e,t){var n=e.getRect();return[n[OL[t]],n[OL[t]]+n[RL[t]]]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.type="single"}(kw);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.init=function(t,n,i){var a=Av(t);e.prototype.init.apply(this,arguments),LL(t,a)},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),LL(this.option,t)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type="calendar",t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}}}(Bv);function LL(e,t){var n,i=e.cellSize;1===(n=Jr(i)?i:e.cellSize=[i,i]).length&&(n[1]=n[0]);var a=Wr([0,1],function(e){return function(e,t){return null!=e[Tv[t][0]]||null!=e[Tv[t][1]]&&null!=e[Tv[t][2]]}(t,e)&&(n[e]="auto"),null!=n[e]&&"auto"!==n[e]});Dv(e,t,{type:"box",ignoreSize:a})}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.render=function(e,t,n){var i=this.group;i.removeAll();var a=e.coordinateSystem,r=a.getRangeInfo(),o=a.getOrient(),s=t.getLocaleModel();this._renderDayRect(e,r,i),this._renderLines(e,r,o,i),this._renderYearText(e,r,o,i),this._renderMonthText(e,s,o,i),this._renderWeekText(e,s,r,o,i)},t.prototype._renderDayRect=function(e,t,n){for(var i=e.coordinateSystem,a=e.getModel("itemStyle").getItemStyle(),r=i.getCellWidth(),o=i.getCellHeight(),s=t.start.time;s<=t.end.time;s=i.getNextNDay(s,1).time){var l=i.dataToRect([s],!1).tl,p=new qm({shape:{x:l[0],y:l[1],width:r,height:o},cursor:"default",style:a});n.add(p)}},t.prototype._renderLines=function(e,t,n,i){var a=this,r=e.coordinateSystem,o=e.getModel(["splitLine","lineStyle"]).getLineStyle(),s=e.get(["splitLine","show"]),l=o.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var p=t.start,c=0;p.time<=t.end.time;c++){u(p.formatedDate),0===c&&(p=r.getDateInfo(t.start.y+"-"+t.start.m));var d=p.date;d.setMonth(d.getMonth()+1),p=r.getDateInfo(d)}function u(t){a._firstDayOfMonth.push(r.getDateInfo(t)),a._firstDayPoints.push(r.dataToRect([t],!1).tl);var l=a._getLinePointsOfOneWeek(e,t,n);a._tlpoints.push(l[0]),a._blpoints.push(l[l.length-1]),s&&a._drawSplitline(l,o,i)}u(r.getNextNDay(t.end.time,1).formatedDate),s&&this._drawSplitline(a._getEdgesPoints(a._tlpoints,l,n),o,i),s&&this._drawSplitline(a._getEdgesPoints(a._blpoints,l,n),o,i)},t.prototype._getEdgesPoints=function(e,t,n){var i=[e[0].slice(),e[e.length-1].slice()],a="horizontal"===n?0:1;return i[0][a]=i[0][a]-t/2,i[1][a]=i[1][a]+t/2,i},t.prototype._drawSplitline=function(e,t,n){var i=new jg({z2:20,shape:{points:e},style:t});n.add(i)},t.prototype._getLinePointsOfOneWeek=function(e,t,n){for(var i=e.coordinateSystem,a=i.getDateInfo(t),r=[],o=0;o<7;o++){var s=i.getNextNDay(a.time,o),l=i.dataToRect([s.time],!1);r[2*s.day]=l.tl,r[2*s.day+1]=l["horizontal"===n?"bl":"tr"]}return r},t.prototype._formatterLabel=function(e,t){return to(e)&&e?(n=e,Hr(t,function(e,t){n=n.replace("{"+t+"}",i?ps(e):e)}),n):eo(e)?e(t):t.nameMap;var n,i},t.prototype._yearTextPositionControl=function(e,t,n,i,a){var r=t[0],o=t[1],s=["center","bottom"];"bottom"===i?(o+=a,s=["center","top"]):"left"===i?r-=a:"right"===i?(r+=a,s=["center","top"]):o-=a;var l=0;return"left"!==i&&"right"!==i||(l=Math.PI/2),{rotation:l,x:r,y:o,style:{align:s[0],verticalAlign:s[1]}}},t.prototype._renderYearText=function(e,t,n,i){var a=e.getModel("yearLabel");if(a.get("show")){var r=a.get("margin"),o=a.get("position");o||(o="horizontal"!==n?"top":"left");var s=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],l=(s[0][0]+s[1][0])/2,p=(s[0][1]+s[1][1])/2,c="horizontal"===n?0:1,d={top:[l,s[c][1]],bottom:[l,s[1-c][1]],left:[s[1-c][0],p],right:[s[c][0],p]},u=t.start.y;+t.end.y>+t.start.y&&(u=u+"-"+t.end.y);var m=a.get("formatter"),h={start:t.start.y,end:t.end.y,nameMap:u},g=this._formatterLabel(m,h),f=new Um({z2:30,style:iy(a,{text:g})});f.attr(this._yearTextPositionControl(f,d[o],n,o,r)),i.add(f)}},t.prototype._monthTextPositionControl=function(e,t,n,i,a){var r="left",o="top",s=e[0],l=e[1];return"horizontal"===n?(l+=a,t&&(r="center"),"start"===i&&(o="bottom")):(s+=a,t&&(o="middle"),"start"===i&&(r="right")),{x:s,y:l,align:r,verticalAlign:o}},t.prototype._renderMonthText=function(e,t,n,i){var a=e.getModel("monthLabel");if(a.get("show")){var r=a.get("nameMap"),o=a.get("margin"),s=a.get("position"),l=a.get("align"),p=[this._tlpoints,this._blpoints];r&&!to(r)||(r&&(t=Fy(r)||t),r=t.get(["time","monthAbbr"])||[]);var c="start"===s?0:1,d="horizontal"===n?0:1;o="start"===s?-o:o;for(var u="center"===l,m=0;m=i.start.time&&n.timeo.end.time&&e.reverse(),e},e.prototype._getRangeInfo=function(e){var t,n=[this.getDateInfo(e[0]),this.getDateInfo(e[1])];n[0].time>n[1].time&&(t=!0,n.reverse());var i=Math.floor(n[1].time/VL)-Math.floor(n[0].time/VL)+1,a=new Date(n[0].time),r=a.getDate(),o=n[1].date.getDate();a.setDate(r+i-1);var s=a.getDate();if(s!==o)for(var l=a.getTime()-n[1].time>0?1:-1;(s=a.getDate())!==o&&(a.getTime()-n[1].time)*l>0;)i-=l,a.setDate(s-l);var p=Math.floor((i+n[0].day+6)/7),c=t?1-p:p-1;return t&&n.reverse(),{range:[n[0].formatedDate,n[1].formatedDate],start:n[0],end:n[1],allDay:i,weeks:p,nthWeek:c,fweek:n[0].day,lweek:n[1].day}},e.prototype._getDateByWeeksAndDay=function(e,t,n){var i=this._getRangeInfo(n);if(e>i.weeks||0===e&&ti.lweek)return null;var a=7*(e-1)-i.fweek+t,r=new Date(i.start.time);return r.setDate(+i.start.d+a),this.getDateInfo(r)},e.create=function(t,n){var i=[];return t.eachComponent("calendar",function(a){var r=new e(a,t,n);i.push(r),a.coordinateSystem=r}),t.eachSeries(function(e){"calendar"===e.get("coordinateSystem")&&(e.coordinateSystem=i[e.get("calendarIndex")||0])}),i},e.dimensions=["time","value"]}();function qL(e){var t=e.calendarModel,n=e.seriesModel;return t?t.coordinateSystem:n?n.coordinateSystem:null}function GL(e,t){var n;return Hr(t,function(t){null!=e[t]&&"auto"!==e[t]&&(n=!0)}),n}var zL=["transition","enterFrom","leaveTo"],UL=zL.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function jL(e,t,n){if(n&&(!e[n]&&t[n]&&(e[n]={}),e=e[n],t=t[n]),e&&t)for(var i=n?zL:UL,a=0;a=0;l--){var u,m,h;if(h=null!=(m=Dd((u=n[l]).id,null))?a.get(m):null){var g=h.parent,f=(d=WL(g),{}),y=kv(h,u,g===i?{width:r,height:o}:{width:d.width,height:d.height},null,{hv:u.hv,boundingMode:u.bounding},f);if(!WL(h).isNew&&y){for(var v=u.transition,x={},b=0;b=0)?x[w]=S:h[w]=S}gf(h,x,e,0)}else h.attr(f)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each(function(n){YL(n,WL(n).option,t,e._lastGraphicModel)}),this._elMap=Eo()},t.prototype.dispose=function(){this._clear()},t.type="graphic"}(kw);function $L(e){var t=Po(HL,e)?HL[e]:kf(e);var n=new t({});return WL(n).type=e,n}function KL(e,t,n,i){var a=$L(n);return t.add(a),i.set(e,a),WL(a).id=e,WL(a).isNew=!0,a}function YL(e,t,n,i){e&&e.parent&&("group"===e.type&&e.traverse(function(e){YL(e,t,n,i)}),xF(e,t,i),n.removeKey(WL(e).id))}function XL(e,t,n,i){e.isGroup||Hr([["cursor",Tu.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],function(n){var i=n[0];Po(t,i)?e[i]=ho(t[i],n[1]):null==e[i]&&(e[i]=n[1])}),Hr(Xr(t),function(n){if(0===n.indexOf("on")){var i=t[n];e[n]=eo(i)?i:null}}),Po(t,"draggable")&&(e.draggable=t.draggable),null!=t.name&&(e.name=t.name),null!=t.id&&(e.id=t.id)}var ZL=["x","y","radius","angle","single"],QL=["cartesian2d","polar","singleAxis"];function JL(e){return e+"Axis"}function eV(e,t){var n,i=Eo(),a=[],r=Eo();e.eachComponent({mainType:"dataZoom",query:t},function(e){r.get(e.uid)||s(e)});do{n=!1,e.eachComponent("dataZoom",o)}while(n);function o(e){!r.get(e.uid)&&function(e){var t=!1;return e.eachTargetAxis(function(e,n){var a=i.get(e);a&&a[n]&&(t=!0)}),t}(e)&&(s(e),n=!0)}function s(e){r.set(e.uid,!0),a.push(e),e.eachTargetAxis(function(e,t){(i.get(e)||i.set(e,[]))[t]=!0})}return a}function tV(e){var t=e.ecModel,n={infoList:[],infoMap:Eo()};return e.eachTargetAxis(function(e,i){var a=t.getComponent(JL(e),i);if(a){var r=a.getCoordSysModel();if(r){var o=r.uid,s=n.infoMap.get(o);s||(s={model:r,axisModels:[]},n.infoList.push(s),n.infoMap.set(o,s)),s.axisModels.push(a)}}}),n}var nV=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(e){this.indexMap[e]||(this.indexList.push(e),this.indexMap[e]=!0)},e}(),iV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._autoThrottle=!0,n._noTarget=!0,n._rangePropMode=["percent","percent"],n}return Xe(t,e),t.prototype.init=function(e,t,n){var i=aV(e);this.settledOption=i,this.mergeDefaultAndTheme(e,n),this._doInit(i)},t.prototype.mergeOption=function(e){var t=aV(e);Nr(this.option,e,!0),Nr(this.settledOption,t,!0),this._doInit(t)},t.prototype._doInit=function(e){var t=this.option;this._setDefaultThrottle(e),this._updateRangeUse(e);var n=this.settledOption;Hr([["start","startValue"],["end","endValue"]],function(e,i){"value"===this._rangePropMode[i]&&(t[e[0]]=n[e[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var e=this.get("orient",!0),t=this._targetAxisInfoMap=Eo();this._fillSpecifiedTargetAxis(t)?this._orient=e||this._makeAutoOrientByTargetAxis():(this._orient=e||"horizontal",this._fillAutoTargetAxisByOrient(t,this._orient)),this._noTarget=!0,t.each(function(e){e.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(e){var t=!1;return Hr(ZL,function(n){var i=this.getReferringComponents(JL(n),qd);if(i.specified){t=!0;var a=new nV;Hr(i.models,function(e){a.add(e.componentIndex)}),e.set(n,a)}},this),t},t.prototype._fillAutoTargetAxisByOrient=function(e,t){var n=this.ecModel,i=!0;if(i){var a="vertical"===t?"y":"x";r(n.findComponents({mainType:a+"Axis"}),a)}i&&r(n.findComponents({mainType:"singleAxis",filter:function(e){return e.get("orient",!0)===t}}),"single");function r(t,n){var a=t[0];if(a){var r=new nV;if(r.add(a.componentIndex),e.set(n,r),i=!1,"x"===n||"y"===n){var o=a.getReferringComponents("grid",Vd).models[0];o&&Hr(t,function(e){a.componentIndex!==e.componentIndex&&o===e.getReferringComponents("grid",Vd).models[0]&&r.add(e.componentIndex)})}}}i&&Hr(ZL,function(t){if(i){var a=n.findComponents({mainType:JL(t),filter:function(e){return"category"===e.get("type",!0)}});if(a[0]){var r=new nV;r.add(a[0].componentIndex),e.set(t,r),i=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var e;return this.eachTargetAxis(function(t){!e&&(e=t)},this),"y"===e?"vertical":"horizontal"},t.prototype._setDefaultThrottle=function(e){if(e.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var t=this.ecModel.option;this.option.throttle=t.animation&&t.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(e){var t=this._rangePropMode,n=this.get("rangeMode");Hr([["start","startValue"],["end","endValue"]],function(i,a){var r=null!=e[i[0]],o=null!=e[i[1]];r&&!o?t[a]="percent":!r&&o?t[a]="value":n?t[a]=n[a]:r&&(t[a]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var e;return this.eachTargetAxis(function(t,n){null==e&&(e=this.ecModel.getComponent(JL(t),n))},this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each(function(n,i){Hr(n.indexList,function(n){e.call(t,i,n)})})},t.prototype.getAxisProxy=function(e,t){var n=this.getAxisModel(e,t);if(n)return n.__dzAxisProxy},t.prototype.getAxisModel=function(e,t){var n=this._targetAxisInfoMap.get(e);if(n&&n.indexMap[t])return this.ecModel.getComponent(JL(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;Hr([["start","startValue"],["end","endValue"]],function(i){null==e[i[0]]&&null==e[i[1]]||(t[i[0]]=n[i[0]]=e[i[0]],t[i[1]]=n[i[1]]=e[i[1]])},this),this._updateRangeUse(e)},t.prototype.setCalculatedRange=function(e){var t=this.option;Hr(["start","startValue","end","endValue"],function(n){t[n]=e[n]})},t.prototype.getPercentRange=function(){var e=this.findRepresentativeAxisProxy();if(e)return e.getDataPercentWindow()},t.prototype.getValueRange=function(e,t){var n;if(null==e&&null==t){if(n=this.findRepresentativeAxisProxy())return n.getDataValueWindow()}else if(n=this.getAxisProxy(e,t))return n.getDataValueWindow()},t.prototype.findRepresentativeAxisProxy=function(e){if(e)return e.__dzAxisProxy;for(var t,n=this._targetAxisInfoMap.keys(),i=0;i=0}(t)){var n=JL(this._dimName),i=t.getReferringComponents(n,Vd).models[0];i&&this._axisIndex===i.componentIndex&&e.push(t)}},this),e},e.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},e.prototype.getMinMaxSpan=function(){return Fr(this._minMaxSpan)},e.prototype.calculateDataWindow=function(e){var t,n=this._dataExtent,i=this.getAxisModel().axis.scale,a=this._dataZoomModel.getRangePropMode(),r=[0,100],o=[],s=[];oV(["start","end"],function(l,p){var c=e[l],d=e[l+"Value"];"percent"===a[p]?(null==c&&(c=r[p]),d=i.parse(Xc(c,r,n))):(t=!0,c=Xc(d=null==d?n[p]:i.parse(d),n,r)),s[p]=null==d||isNaN(d)?n[p]:d,o[p]=null==c||isNaN(c)?r[p]:c}),sV(s),sV(o);var l=this._minMaxSpan;function p(e,t,n,a,r){var o=r?"Span":"ValueSpan";NO(0,e,n,"all",l["min"+o],l["max"+o]);for(var s=0;s<2;s++)t[s]=Xc(e[s],n,a,!0),r&&(t[s]=i.parse(t[s]))}return t?p(s,o,n,r,!1):p(o,s,r,n,!0),{valueWindow:s,percentWindow:o}},e.prototype.reset=function(e){if(e===this._dataZoomModel){var t=this.getTargetSeriesModels();this._dataExtent=function(e,t,n){var i=[1/0,-1/0];oV(n,function(e){!function(e,t,n){t&&Hr(gE(t,n),function(n){var i=t.getApproximateExtent(n);i[0]e[1]&&(e[1]=i[1])})}(i,e.getData(),t)});var a=e.getAxisModel(),r=rE(a.axis.scale,a,i).calculate();return[r.min,r.max]}(this,this._dimName,t),this._updateMinMaxSpan();var n=this.calculateDataWindow(e.settledOption);this._valueWindow=n.valueWindow,this._percentWindow=n.percentWindow,this._setAxisModel()}},e.prototype.filterData=function(e,t){if(e===this._dataZoomModel){var n=this._dimName,i=this.getTargetSeriesModels(),a=e.get("filterMode"),r=this._valueWindow;"none"!==a&&oV(i,function(e){var t=e.getData(),i=t.mapDimensionsAll(n);if(i.length){if("weakFilter"===a){var o=t.getStore(),s=Wr(i,function(e){return t.getDimensionIndex(e)},t);t.filterSelf(function(e){for(var t,n,a,l=0;lr[1];if(c&&!d&&!u)return!0;c&&(a=!0),d&&(t=!0),u&&(n=!0)}return a&&t&&n})}else oV(i,function(n){if("empty"===a)e.setData(t=t.map(n,function(e){return function(e){return e>=r[0]&&e<=r[1]}(e)?e:NaN}));else{var i={};i[n]=r,t.selectRange(i)}});oV(i,function(e){t.setApproximateExtent(r,e)})}})}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._dataExtent;oV(["min","max"],function(i){var a=t.get(i+"Span"),r=t.get(i+"ValueSpan");null!=r&&(r=this.getAxisModel().axis.scale.parse(r)),null!=r?a=Xc(n[0]+r,n,[0,100],!0):null!=a&&(r=Xc(a,[0,100],n,!0)-n[0]),e[i+"Span"]=a,e[i+"ValueSpan"]=r},this)},e.prototype._setAxisModel=function(){var e=this.getAxisModel(),t=this._percentWindow,n=this._valueWindow;if(t){var i=nd(n,[0,500]);i=Math.min(i,20);var a=e.axis.scale.rawExtentInfo;0!==t[0]&&a.setDeterminedMinMax("min",+n[0].toFixed(i)),100!==t[1]&&a.setDeterminedMinMax("max",+n[1].toFixed(i)),a.freeze()}},e}();var pV={getTargetSeries:function(e){function t(t){e.eachComponent("dataZoom",function(n){n.eachTargetAxis(function(i,a){var r=e.getComponent(JL(i),a);t(i,a,r,n)})})}t(function(e,t,n,i){n.__dzAxisProxy=null});var n=[];t(function(t,i,a,r){a.__dzAxisProxy||(a.__dzAxisProxy=new lV(t,i,r,e),n.push(a.__dzAxisProxy))});var i=Eo();return Hr(n,function(e){Hr(e.getTargetSeriesModels(),function(e){i.set(e.uid,e)})}),i},overallReset:function(e,t){e.eachComponent("dataZoom",function(e){e.eachTargetAxis(function(t,n){var i=e.getAxisProxy(t,n);i&&i.reset(e)}),e.eachTargetAxis(function(n,i){var a=e.getAxisProxy(n,i);a&&a.filterData(e,t)})}),e.eachComponent("dataZoom",function(e){var t=e.findRepresentativeAxisProxy();if(t){var n=t.getDataPercentWindow(),i=t.getDataValueWindow();e.setCalculatedRange({start:n[0],end:n[1],startValue:i[0],endValue:i[1]})}})}};var cV=!1;function dV(e){cV||(cV=!0,e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,pV),function(e){e.registerAction("dataZoom",function(e,t){Hr(eV(t,e),function(t){t.setRawRange({start:e.start,end:e.end,startValue:e.startValue,endValue:e.endValue})})})}(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"}))}var uV=function(){},mV={};function hV(e){return mV[e]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;Hr(this.option.feature,function(e,n){var i=hV(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(t)),Nr(e,i.defaultOption))})},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}}}(Bv);function gV(e,t){var n=gv(t.get("padding")),i=t.getItemStyle(["color","opacity"]);return i.fill=t.get("backgroundColor"),e=new qm({shape:{x:e.x-n[3],y:e.y-n[0],width:e.width+n[1]+n[3],height:e.height+n[0]+n[2],r:t.get("borderRadius")},style:i,silent:!0,z2:-1})}!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Xe(t,e),t.prototype.render=function(e,t,n,i){var a=this.group;if(a.removeAll(),e.get("show")){var r=+e.get("itemSize"),o="vertical"===e.get("orient"),s=e.get("feature")||{},l=this._features||(this._features={}),p=[];Hr(s,function(e,t){p.push(t)}),new P_(this._featureNames||[],p).add(c).update(c).remove(Qr(c,null)).execute(),this._featureNames=p,function(e,t,n){var i=t.getBoxLayoutParams(),a=t.get("padding"),r={width:n.getWidth(),height:n.getHeight()},o=Iv(i,r,a);Mv(t.get("orient"),e,t.get("itemGap"),o.width,o.height),kv(e,i,r,a)}(a,e,n),a.add(gV(a.getBoundingRect(),e)),o||a.eachChild(function(e){var t=e.__title,i=e.ensureState("emphasis"),o=i.textConfig||(i.textConfig={}),s=e.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!eo(l)&&t){var p=l.style||(l.style={}),c=_c(t,Um.makeFont(p)),d=e.x+a.x,u=!1;e.y+a.y+r+c.height>n.getHeight()&&(o.position="top",u=!0);var m=u?-5-c.height:r+10;d+c.width/2>n.getWidth()?(o.position=["100%",m],p.align="right"):d-c.width/2<0&&(o.position=[0,m],p.align="left")}})}function c(c,d){var u,m=p[c],h=p[d],g=s[m],f=new Ty(g,e,e.ecModel);if(i&&null!=i.newTitle&&i.featureName===m&&(g.title=i.newTitle),m&&!h){if(function(e){return 0===e.indexOf("my")}(m))u={onclick:f.option.onclick,featureName:m};else{var y=hV(m);if(!y)return;u=new y}l[m]=u}else if(!(u=l[h]))return;u.uid=My("toolbox-feature"),u.model=f,u.ecModel=t,u.api=n;var v=u instanceof uV;m||!h?!f.get("show")||v&&u.unusable?v&&u.remove&&u.remove(t,n):(!function(i,s,l){var p,c,d=i.getModel("iconStyle"),u=i.getModel(["emphasis","iconStyle"]),m=s instanceof uV&&s.getIcons?s.getIcons():i.get("icon"),h=i.get("title")||{};to(m)?(p={})[l]=m:p=m;to(h)?(c={})[l]=h:c=h;var g=i.iconPaths={};Hr(p,function(l,p){var m=jf(l,{},{x:-r/2,y:-r/2,width:r,height:r});m.setStyle(d.getItemStyle()),m.ensureState("emphasis").style=u.getItemStyle();var h=new Um({style:{text:c[p],align:u.get("textAlign"),borderRadius:u.get("textBorderRadius"),padding:u.get("textPadding"),fill:null,font:py({fontStyle:u.get("textFontStyle"),fontFamily:u.get("textFontFamily"),fontSize:u.get("textFontSize"),fontWeight:u.get("textFontWeight")},t)},ignore:!0});m.setTextContent(h),Kf({el:m,componentModel:e,itemName:p,formatterParamsExtra:{title:c[p]}}),m.__title=c[p],m.on("mouseover",function(){var t=u.getItemStyle(),i=o?null==e.get("right")&&"right"!==e.get("left")?"right":"left":null==e.get("bottom")&&"bottom"!==e.get("top")?"bottom":"top";h.setStyle({fill:u.get("textFill")||t.fill||t.stroke||"#000",backgroundColor:u.get("textBackgroundColor")}),m.setTextConfig({position:u.get("textPosition")||i}),h.ignore=!e.get("showTitle"),n.enterEmphasis(this)}).on("mouseout",function(){"emphasis"!==i.get(["iconStatus",p])&&n.leaveEmphasis(this),h.hide()}),("emphasis"===i.get(["iconStatus",p])?Dh:Ah)(m),a.add(m),m.on("click",Zr(s.onclick,s,t,n,p)),g[p]=m})}(f,u,m),f.setIconStatus=function(e,t){var n=this.option,i=this.iconPaths;n.iconStatus=n.iconStatus||{},n.iconStatus[e]=t,i[e]&&("emphasis"===t?Dh:Ah)(i[e])},u instanceof uV&&u.render&&u.render(f,t,n,i)):v&&u.dispose&&u.dispose(t,n)}},t.prototype.updateView=function(e,t,n,i){Hr(this._features,function(e){e instanceof uV&&e.updateView&&e.updateView(e.model,t,n,i)})},t.prototype.remove=function(e,t){Hr(this._features,function(n){n instanceof uV&&n.remove&&n.remove(e,t)}),this.group.removeAll()},t.prototype.dispose=function(e,t){Hr(this._features,function(n){n instanceof uV&&n.dispose&&n.dispose(e,t)})},t.type="toolbox"}(kw);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Xe(t,e),t.prototype.onclick=function(e,t){var n=this.model,i=n.get("name")||e.get("title.0.text")||"echarts",a="svg"===t.getZr().painter.getType(),r=a?"svg":n.get("type",!0)||"png",o=t.getConnectedDataURL({type:r,backgroundColor:n.get("backgroundColor",!0)||e.get("backgroundColor")||"#fff",connectedBackgroundColor:n.get("connectedBackgroundColor"),excludeComponents:n.get("excludeComponents"),pixelRatio:n.get("pixelRatio")}),s=gr.browser;if(eo(MouseEvent)&&(s.newEdge||!s.ie&&!s.edge)){var l=document.createElement("a");l.download=i+"."+r,l.target="_blank",l.href=o;var p=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});l.dispatchEvent(p)}else if(window.navigator.msSaveOrOpenBlob||a){var c=o.split(","),d=c[0].indexOf("base64")>-1,u=a?decodeURIComponent(c[1]):c[1];d&&(u=window.atob(u));var m=i+"."+r;if(window.navigator.msSaveOrOpenBlob){for(var h=u.length,g=new Uint8Array(h);h--;)g[h]=u.charCodeAt(h);var f=new Blob([g]);window.navigator.msSaveOrOpenBlob(f,m)}else{var y=document.createElement("iframe");document.body.appendChild(y);var v=y.contentWindow,x=v.document;x.open("image/svg+xml","replace"),x.write(u),x.close(),v.focus(),x.execCommand("SaveAs",!0,m),document.body.removeChild(y)}}else{var b=n.get("lang"),w='',S=window.open();S.document.write(w),S.document.title=i}},t.getDefaultOption=function(e){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:e.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:e.getLocaleModel().get(["toolbox","saveAsImage","lang"])}}}(uV);var fV="__ec_magicType_stack__",yV=[["line","bar"],["stack"]],vV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Xe(t,e),t.prototype.getIcons=function(){var e=this.model,t=e.get("icon"),n={};return Hr(e.get("type"),function(e){t[e]&&(n[e]=t[e])}),n},t.getDefaultOption=function(e){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:e.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},t.prototype.onclick=function(e,t,n){var i=this.model,a=i.get(["seriesIndex",n]);if(vV[n]){var r,o={series:[]};Hr(yV,function(e){Gr(e,n)>=0&&Hr(e,function(e){i.setIconStatus(e,"normal")})}),i.setIconStatus(n,"emphasis"),e.eachComponent({mainType:"series",query:null==a?null:{seriesIndex:a}},function(e){var t=e.subType,a=e.id,r=vV[n](t,a,e,i);r&&(qr(r,e.option),o.series.push(r));var s=e.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===n||"bar"===n)){var l=s.getAxesByScale("ordinal")[0];if(l){var p=l.dim+"Axis",c=e.getReferringComponents(p,Vd).models[0].componentIndex;o[p]=o[p]||[];for(var d=0;d<=c;d++)o[p][c]=o[p][c]||{};o[p][c].boundaryGap="bar"===n}}});var s=n;"stack"===n&&(r=Nr({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(s="tiled")),t.dispatchAction({type:"changeMagicType",currentType:s,newOption:o,newTitle:r,featureName:"magicType"})}}}(uV),{line:function(e,t,n,i){if("bar"===e)return Nr({id:t,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(e,t,n,i){if("line"===e)return Nr({id:t,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(e,t,n,i){var a=n.get("stack")===fV;if("line"===e||"bar"===e)return i.setIconStatus("stack",a?"normal":"emphasis"),Nr({id:t,stack:a?"":fV},i.get(["option","stack"])||{},!0)}});S_({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var xV=new Array(60).join("-"),bV="\t";function wV(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var SV=new RegExp("[\t]+","g");function CV(e,t){var n=e.split(new RegExp("\n*"+xV+"\n*","g")),i={series:[]};return Hr(n,function(e,n){if(function(e){if(e.slice(0,e.indexOf("\n")).indexOf(bV)>=0)return!0}(e)){var a=function(e){for(var t=e.split(/\n+/g),n=[],i=Wr(wV(t.shift()).split(SV),function(e){return{name:e,data:[]}}),a=0;a=0)&&e(a,i._targetInfoList)})}return e.prototype.setOutputRanges=function(e,t){return this.matchOutputRanges(e,t,function(e,t,n){if((e.coordRanges||(e.coordRanges=[])).push(t),!e.coordRange){e.coordRange=t;var i=BV[e.brushType](0,n,t);e.__rangeOffset={offset:NV[e.brushType](i.values,e.range,[1,1]),xyMinMax:i.xyMinMax}}}),e},e.prototype.matchOutputRanges=function(e,t,n){Hr(e,function(e){var i=this.findTargetInfo(e,t);i&&!0!==i&&Hr(i.coordSyses,function(i){var a=BV[e.brushType](1,i,e.range,!0);n(e,a.values,i,t)})},this)},e.prototype.setInputRanges=function(e,t){Hr(e,function(e){var n,i,a,r,o,s=this.findTargetInfo(e,t);if(e.range=e.range||[],s&&!0!==s){e.panelId=s.panelId;var l=BV[e.brushType](0,s.coordSys,e.coordRange),p=e.__rangeOffset;e.range=p?NV[e.brushType](l.values,p.offset,(n=l.xyMinMax,i=p.xyMinMax,a=VV(n),r=VV(i),o=[a[0]/r[0],a[1]/r[1]],isNaN(o[0])&&(o[0]=1),isNaN(o[1])&&(o[1]=1),o)):l.values}},this)},e.prototype.makePanelOpts=function(e,t){return Wr(this._targetInfoList,function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:NR(i),isTargetByCursor:VR(i,e,n.coordSysModel),getLinearBrushOtherExtent:LR(i)}})},e.prototype.controlSeries=function(e,t,n){var i=this.findTargetInfo(e,n);return!0===i||i&&Gr(i.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,i=DV(t,e),a=0;ae[1]&&e.reverse(),e}function DV(e,t){return Nd(e,t,{includeMainTypes:IV})}var AV={grid:function(e,t){var n=e.xAxisModels,i=e.yAxisModels,a=e.gridModels,r=Eo(),o={},s={};(n||i||a)&&(Hr(n,function(e){var t=e.axis.grid.model;r.set(t.id,t),o[t.id]=!0}),Hr(i,function(e){var t=e.axis.grid.model;r.set(t.id,t),s[t.id]=!0}),Hr(a,function(e){r.set(e.id,e),o[e.id]=!0,s[e.id]=!0}),r.each(function(e){var a=e.coordinateSystem,r=[];Hr(a.getCartesians(),function(e,t){(Gr(n,e.getAxis("x").model)>=0||Gr(i,e.getAxis("y").model)>=0)&&r.push(e)}),t.push({panelId:"grid--"+e.id,gridModel:e,coordSysModel:e,coordSys:r[0],coordSyses:r,getPanelRect:RV.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})}))},geo:function(e,t){Hr(e.geoModels,function(e){var n=e.coordinateSystem;t.push({panelId:"geo--"+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:RV.geo})})}},OV=[function(e,t){var n=e.xAxisModel,i=e.yAxisModel,a=e.gridModel;return!a&&n&&(a=n.axis.grid.model),!a&&i&&(a=i.axis.grid.model),a&&a===t.gridModel},function(e,t){var n=e.geoModel;return n&&n===t.geoModel}],RV={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(Nf(e)),t}},BV={lineX:Qr(FV,0),lineY:Qr(FV,1),rect:function(e,t,n,i){var a=e?t.pointToData([n[0][0],n[1][0]],i):t.dataToPoint([n[0][0],n[1][0]],i),r=e?t.pointToData([n[0][1],n[1][1]],i):t.dataToPoint([n[0][1],n[1][1]],i),o=[PV([a[0],r[0]]),PV([a[1],r[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,n,i){var a=[[1/0,-1/0],[1/0,-1/0]];return{values:Wr(n,function(n){var r=e?t.pointToData(n,i):t.dataToPoint(n,i);return a[0][0]=Math.min(a[0][0],r[0]),a[1][0]=Math.min(a[1][0],r[1]),a[0][1]=Math.max(a[0][1],r[0]),a[1][1]=Math.max(a[1][1],r[1]),r}),xyMinMax:a}}};function FV(e,t,n,i){var a=n.getAxis(["x","y"][e]),r=PV(Wr([0,1],function(e){return t?a.coordToData(a.toLocalCoord(i[e]),!0):a.toGlobalCoord(a.dataToCoord(i[e]))})),o=[];return o[e]=r,o[1-e]=[NaN,NaN],{values:r,xyMinMax:o}}var NV={lineX:Qr(LV,0),lineY:Qr(LV,1),rect:function(e,t,n){return[[e[0][0]-n[0]*t[0][0],e[0][1]-n[0]*t[0][1]],[e[1][0]-n[1]*t[1][0],e[1][1]-n[1]*t[1][1]]]},polygon:function(e,t,n){return Wr(e,function(e,i){return[e[0]-n[0]*t[i][0],e[1]-n[1]*t[i][1]]})}};function LV(e,t,n,i){return[t[0]-i[e]*n[0],t[1]-i[e]*n[1]]}function VV(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var qV,GV,zV=Hr,UV=Sd+"toolbox-dataZoom_",jV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Xe(t,e),t.prototype.render=function(e,t,n,i){this._brushController||(this._brushController=new oR(n.getZr()),this._brushController.on("brush",Zr(this._onBrush,this)).mount()),function(e,t,n,i,a){var r=n._isZoomActive;i&&"takeGlobalCursor"===i.type&&(r="dataZoomSelect"===i.key&&i.dataZoomSelectActive);n._isZoomActive=r,e.setIconStatus("zoom",r?"emphasis":"normal");var o=new kV(HV(e),t,{include:["grid"]}),s=o.makePanelOpts(a,function(e){return e.xAxisDeclared&&!e.yAxisDeclared?"lineX":!e.xAxisDeclared&&e.yAxisDeclared?"lineY":"rect"});n._brushController.setPanels(s).enableBrush(!(!r||!s.length)&&{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()})}(e,t,this,i,n),function(e,t){e.setIconStatus("back",function(e){return MV(e).length}(t)>1?"emphasis":"normal")}(e,t)},t.prototype.onclick=function(e,t,n){jV[n].call(this)},t.prototype.remove=function(e,t){this._brushController&&this._brushController.unmount()},t.prototype.dispose=function(e,t){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(e){var t=e.areas;if(e.isEnd&&t.length){var n={},i=this.ecModel;this._brushController.updateCovers([]),new kV(HV(this.model),i,{include:["grid"]}).matchOutputRanges(t,i,function(e,t,n){if("cartesian2d"===n.type){var i=e.brushType;"rect"===i?(a("x",n,t[0]),a("y",n,t[1])):a({lineX:"x",lineY:"y"}[i],n,t)}}),function(e,t){var n=MV(e);TV(t,function(t,i){for(var a=n.length-1;a>=0&&!n[a][i];a--);if(a<0){var r=e.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(r){var o=r.getPercentRange();n[0][i]={dataZoomId:i,start:o[0],end:o[1]}}}}),n.push(t)}(i,n),this._dispatchZoomAction(n)}function a(e,t,a){var r=t.getAxis(e),o=r.model,s=function(e,t,n){var i;return n.eachComponent({mainType:"dataZoom",subType:"select"},function(n){n.getAxisModel(e,t.componentIndex)&&(i=n)}),i}(e,o,i),l=s.findRepresentativeAxisProxy(o);if(l){var p=l.getMinMaxSpan();null==p.minValueSpan&&null==p.maxValueSpan||(a=NO(0,a.slice(),r.scale.getExtent(),0,p.minValueSpan,p.maxValueSpan))}s&&(n[s.id]={dataZoomId:s.id,startValue:a[0],endValue:a[1]})}},t.prototype._dispatchZoomAction=function(e){var t=[];zV(e,function(e,n){t.push(Fr(e))}),t.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:t})},t.getDefaultOption=function(e){return{show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:e.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}}}(uV),{zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(function(e){var t=MV(e),n=t[t.length-1];t.length>1&&t.pop();var i={};return TV(n,function(e,n){for(var a=t.length-1;a>=0;a--)if(e=t[a][n]){i[n]=e;break}}),i}(this.ecModel))}});function HV(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return null==t.xAxisIndex&&null==t.xAxisId&&(t.xAxisIndex="all"),null==t.yAxisIndex&&null==t.yAxisId&&(t.yAxisIndex="all"),t}qV="dataZoom",GV=function(e){var t=e.getComponent("toolbox",0),n=["feature","dataZoom"];if(t&&null!=t.get(n)){var i=t.getModel(n),a=[],r=Nd(e,HV(i));return zV(r.xAxisModels,function(e){return o(e,"xAxis","xAxisIndex")}),zV(r.yAxisModels,function(e){return o(e,"yAxis","yAxisIndex")}),a}function o(e,t,n){var r=e.componentIndex,o={type:"select",$fromToolbox:!0,filterMode:i.get("filterMode",!0)||"filter",id:UV+t+r};o[n]=r,a.push(o)}},vo(null==ix.get(qV)&&GV),ix.set(qV,GV);var WV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="tooltip",t.dependencies=["axisPointer"],t.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},t}(Bv);function $V(e){var t=e.get("confine");return null!=t?!!t:"richText"===e.get("renderMode")}function KV(e){if(gr.domSupported)for(var t=document.documentElement.style,n=0,i=e.length;n-1?(p+="top:50%",c+="translateY(-50%) rotate("+(o="left"===s?-225:-45)+"deg)"):(p+="left:50%",c+="translateX(-50%) rotate("+(o="top"===s?225:45)+"deg)");var d=o*Math.PI/180,u=l+a,m=u*Math.abs(Math.cos(d))+u*Math.abs(Math.sin(d)),h=t+" solid "+a+"px;";return'
'}(n,i,a)),to(e))r.innerHTML=e+o;else if(e){r.innerHTML="",Jr(e)||(e=[e]);for(var s=0;s=0?this._tryShow(n,i):"leave"===t&&this._hide(i))},this))},t.prototype._keepShow=function(){var e=this._tooltipModel,t=this._ecModel,n=this._api,i=e.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==i&&"click"!==i){var a=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!n.isDisposed()&&a.manuallyShowTip(e,t,n,{x:a._lastX,y:a._lastY,dataByCoordSys:a._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(e,t,n,i){if(i.from!==this.uid&&!gr.node&&n.getDom()){var a=dq(i,n);this._ticket="";var r=i.dataByCoordSys,o=function(e,t,n){var i=Ld(e).queryOptionMap,a=i.keys()[0];if(!a||"series"===a)return;var r=Gd(t,a,i.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=r.models[0];if(!o)return;var s,l=n.getViewOfComponentModel(o);if(l.group.traverse(function(t){var n=nh(t).tooltipConfig;if(n&&n.name===e.name)return s=t,!0}),s)return{componentMainType:a,componentIndex:o.componentIndex,el:s}}(i,t,n);if(o){var s=o.el.getBoundingRect().clone();s.applyTransform(o.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:o.el,position:i.position,positionDefault:"bottom"},a)}else if(i.tooltip&&null!=i.x&&null!=i.y){var l=lq;l.x=i.x,l.y=i.y,l.update(),nh(l).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:l},a)}else if(r)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:r,tooltipOption:i.tooltipOption},a);else if(null!=i.seriesIndex){if(this._manuallyAxisShowTip(e,t,n,i))return;var p=NN(i,t),c=p.point[0],d=p.point[1];null!=c&&null!=d&&this._tryShow({offsetX:c,offsetY:d,target:p.el,position:i.position,positionDefault:"bottom"},a)}else null!=i.x&&null!=i.y&&(n.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:n.getZr().findHover(i.x,i.y).target},a))}},t.prototype.manuallyHideTip=function(e,t,n,i){var a=this._tooltipContent;this._tooltipModel&&a.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,i.from!==this.uid&&this._hide(dq(i,n))},t.prototype._manuallyAxisShowTip=function(e,t,n,i){var a=i.seriesIndex,r=i.dataIndex,o=t.getComponent("axisPointer").coordSysAxesInfo;if(null!=a&&null!=r&&null!=o){var s=t.getSeriesByIndex(a);if(s)if("axis"===cq([s.getData().getItemModel(r),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return n.dispatchAction({type:"updateAxisPointer",seriesIndex:a,dataIndex:r,position:i.position}),!0}},t.prototype._tryShow=function(e,t){var n=e.target;if(this._tooltipModel){this._lastX=e.offsetX,this._lastY=e.offsetY;var i=e.dataByCoordSys;if(i&&i.length)this._showAxisTooltip(i,e);else if(n){var a,r;if("legend"===nh(n).ssrType)return;this._lastDataByCoordSys=null,OS(n,function(e){return null!=nh(e).dataIndex?(a=e,!0):null!=nh(e).tooltipConfig?(r=e,!0):void 0},!0),a?this._showSeriesItemTooltip(e,a,t):r?this._showComponentItemTooltip(e,r,t):this._hide(t)}else this._lastDataByCoordSys=null,this._hide(t)}},t.prototype._showOrMove=function(e,t){var n=e.get("showDelay");t=Zr(t,this),clearTimeout(this._showTimout),n>0?this._showTimout=setTimeout(t,n):t()},t.prototype._showAxisTooltip=function(e,t){var n=this._ecModel,i=this._tooltipModel,a=[t.offsetX,t.offsetY],r=cq([t.tooltipOption],i),o=this._renderMode,s=[],l=rw("section",{blocks:[],noHeader:!0}),p=[],c=new fw;Hr(e,function(e){Hr(e.dataByAxis,function(e){var t=n.getComponent(e.axisDim+"Axis",e.axisIndex),a=e.value;if(t&&t.axis&&null!=a){var r=xN(a,t.axis,n,e.seriesDataIndices,e.valueLabelOpt),d=rw("section",{header:r,noHeader:!xo(r),sortBlocks:!0,blocks:[]});l.blocks.push(d),Hr(e.seriesDataIndices,function(l){var u=n.getSeriesByIndex(l.seriesIndex),m=l.dataIndexInside,h=u.getDataParams(m);if(!(h.dataIndex<0)){h.axisDim=e.axisDim,h.axisIndex=e.axisIndex,h.axisType=e.axisType,h.axisId=e.axisId,h.axisValue=dE(t.axis,{value:a}),h.axisValueLabel=r,h.marker=c.makeTooltipMarker("item",wv(h.color),o);var g=xb(u.formatTooltip(m,!0,null)),f=g.frag;if(f){var y=cq([u],i).get("valueFormatter");d.blocks.push(y?Vr({valueFormatter:y},f):f)}g.text&&p.push(g.text),s.push(h)}})}})}),l.blocks.reverse(),p.reverse();var d=t.position,u=r.get("order"),m=dw(l,c,o,u,n.get("useUTC"),r.get("textStyle"));m&&p.unshift(m);var h="richText"===o?"\n\n":"
",g=p.join(h);this._showOrMove(r,function(){this._updateContentNotChangedOnAxis(e,s)?this._updatePosition(r,d,a[0],a[1],this._tooltipContent,s):this._showTooltipContent(r,g,s,Math.random()+"",a[0],a[1],d,null,c)})},t.prototype._showSeriesItemTooltip=function(e,t,n){var i=this._ecModel,a=nh(t),r=a.seriesIndex,o=i.getSeriesByIndex(r),s=a.dataModel||o,l=a.dataIndex,p=a.dataType,c=s.getData(p),d=this._renderMode,u=e.positionDefault,m=cq([c.getItemModel(l),s,o&&(o.coordinateSystem||{}).model],this._tooltipModel,u?{position:u}:null),h=m.get("trigger");if(null==h||"item"===h){var g=s.getDataParams(l,p),f=new fw;g.marker=f.makeTooltipMarker("item",wv(g.color),d);var y=xb(s.formatTooltip(l,!1,p)),v=m.get("order"),x=m.get("valueFormatter"),b=y.frag,w=b?dw(x?Vr({valueFormatter:x},b):b,f,d,v,i.get("useUTC"),m.get("textStyle")):y.text,S="item_"+s.name+"_"+l;this._showOrMove(m,function(){this._showTooltipContent(m,w,g,S,e.offsetX,e.offsetY,e.position,e.target,f)}),n({type:"showTip",dataIndexInside:l,dataIndex:c.getRawIndex(l),seriesIndex:r,from:this.uid})}},t.prototype._showComponentItemTooltip=function(e,t,n){var i=nh(t),a=i.tooltipConfig.option||{};if(to(a)){a={content:a,formatter:a}}var r=[a],o=this._ecModel.getComponent(i.componentMainType,i.componentIndex);o&&r.push(o),r.push({formatter:a.content});var s=e.positionDefault,l=cq(r,this._tooltipModel,s?{position:s}:null),p=l.get("content"),c=Math.random()+"",d=new fw;this._showOrMove(l,function(){var n=Fr(l.get("formatterParams")||{});this._showTooltipContent(l,p,n,c,e.offsetX,e.offsetY,e.position,t,d)}),n({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(e,t,n,i,a,r,o,s,l){if(this._ticket="",e.get("showContent")&&e.get("show")){var p=this._tooltipContent;p.setEnterable(e.get("enterable"));var c=e.get("formatter");o=o||e.get("position");var d=t,u=this._getNearestPoint([a,r],n,e.get("trigger"),e.get("borderColor")).color;if(c)if(to(c)){var m=e.ecModel.get("useUTC"),h=Jr(n)?n[0]:n;d=c,h&&h.axisType&&h.axisType.indexOf("time")>=0&&(d=Xy(h.axisValue,d,m)),d=xv(d,n,!0)}else if(eo(c)){var g=Zr(function(t,i){t===this._ticket&&(p.setContent(i,l,e,u,o),this._updatePosition(e,o,a,r,p,n,s))},this);this._ticket=i,d=c(n,i,g)}else d=c;p.setContent(d,l,e,u,o),p.show(e,u),this._updatePosition(e,o,a,r,p,n,s)}},t.prototype._getNearestPoint=function(e,t,n,i){return"axis"===n||Jr(t)?{color:i||("html"===this._renderMode?"#fff":"none")}:Jr(t)?void 0:{color:i||t.color||t.borderColor}},t.prototype._updatePosition=function(e,t,n,i,a,r,o){var s=this._api.getWidth(),l=this._api.getHeight();t=t||e.get("position");var p=a.getSize(),c=e.get("align"),d=e.get("verticalAlign"),u=o&&o.getBoundingRect().clone();if(o&&u.applyTransform(o.transform),eo(t)&&(t=t([n,i],r,a.el,u,{viewSize:[s,l],contentSize:p.slice()})),Jr(t))n=Zc(t[0],s),i=Zc(t[1],l);else if(ao(t)){var m=t;m.width=p[0],m.height=p[1];var h=Iv(m,{width:s,height:l});n=h.x,i=h.y,c=null,d=null}else if(to(t)&&o){var g=function(e,t,n,i){var a=n[0],r=n[1],o=Math.ceil(Math.SQRT2*i)+8,s=0,l=0,p=t.width,c=t.height;switch(e){case"inside":s=t.x+p/2-a/2,l=t.y+c/2-r/2;break;case"top":s=t.x+p/2-a/2,l=t.y-r-o;break;case"bottom":s=t.x+p/2-a/2,l=t.y+c+o;break;case"left":s=t.x-a-o,l=t.y+c/2-r/2;break;case"right":s=t.x+p+o,l=t.y+c/2-r/2}return[s,l]}(t,u,p,e.get("borderWidth"));n=g[0],i=g[1]}else{g=function(e,t,n,i,a,r,o){var s=n.getSize(),l=s[0],p=s[1];null!=r&&(e+l+r+2>i?e-=l+r:e+=r);null!=o&&(t+p+o>a?t-=p+o:t+=o);return[e,t]}(n,i,a,s,l,c?null:20,d?null:20);n=g[0],i=g[1]}if(c&&(n-=uq(c)?p[0]/2:"right"===c?p[0]:0),d&&(i-=uq(d)?p[1]/2:"bottom"===d?p[1]:0),$V(e)){g=function(e,t,n,i,a){var r=n.getSize(),o=r[0],s=r[1];return e=Math.min(e+o,i)-o,t=Math.min(t+s,a)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}(n,i,a,s,l);n=g[0],i=g[1]}a.moveTo(n,i)},t.prototype._updateContentNotChangedOnAxis=function(e,t){var n=this._lastDataByCoordSys,i=this._cbParamsList,a=!!n&&n.length===e.length;return a&&Hr(n,function(n,r){var o=n.dataByAxis||[],s=(e[r]||{}).dataByAxis||[];(a=a&&o.length===s.length)&&Hr(o,function(e,n){var r=s[n]||{},o=e.seriesDataIndices||[],l=r.seriesDataIndices||[];(a=a&&e.value===r.value&&e.axisType===r.axisType&&e.axisId===r.axisId&&o.length===l.length)&&Hr(o,function(e,t){var n=l[t];a=a&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex}),i&&Hr(e.seriesDataIndices,function(e){var n=e.seriesIndex,r=t[n],o=i[n];r&&o&&o.data!==r.data&&(a=!1)})})}),this._lastDataByCoordSys=e,this._cbParamsList=t,!!a},t.prototype._hide=function(e){this._lastDataByCoordSys=null,e({type:"hideTip",from:this.uid})},t.prototype.dispose=function(e,t){!gr.node&&t.getDom()&&(jw(this,"_updatePosition"),this._tooltipContent.dispose(),BN("itemTooltip",t))},t.type="tooltip",t}(kw);function cq(e,t,n){var i,a=t.ecModel;n?(i=new Ty(n,a,a),i=new Ty(t.option,i,a)):i=t;for(var r=e.length-1;r>=0;r--){var o=e[r];o&&(o instanceof Ty&&(o=o.get("tooltip",!0)),to(o)&&(o={formatter:o}),o&&(i=new Ty(o,i,a)))}return i}function dq(e,t){return e.dispatchAction||Zr(t.dispatchAction,t)}function uq(e){return"center"===e||"middle"===e}function mq(e){xE(HN),e.registerComponentModel(WV),e.registerComponentView(pq),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},Do),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},Do)}var hq=Hr;function gq(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!0}function fq(e,t,n){var i={};return hq(t,function(t){var a,r=i[t]=((a=function(){}).prototype.__hidden=a.prototype,new a);hq(e[t],function(e,i){if(bA.isValidType(i)){var a={type:i,visual:e};n&&n(a,t),r[i]=new bA(a),"opacity"===i&&((a=Fr(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new bA(a))}})}),i}function yq(e,t,n){var i;Hr(n,function(e){t.hasOwnProperty(e)&&gq(t[e])&&(i=!0)}),i&&Hr(n,function(n){t.hasOwnProperty(n)&&gq(t[n])?e[n]=Fr(t[n]):delete e[n]})}vq(0),vq(1);function vq(e){var t=["x","y"],n=["width","height"];return{point:function(t,n,i){if(t){var a=i.range;return xq(t[e],a)}},rect:function(i,a,r){if(i){var o=r.range,s=[i[t[e]],i[t[e]]+i[n[e]]];return s[1]=t&&(e=t-1),e<0&&(e=0)),this.option.currentIndex=e},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(e){this.option.autoPlay=!!e},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var e,t=this.option,n=t.data||[],i=t.axisType,a=this._names=[];"category"===i?(e=[],Hr(n,function(t,n){var i,r=Dd(Ed(t),"");ao(t)?(i=Fr(t)).value=n:i=n,e.push(i),a.push(r)})):e=n;var r={category:"ordinal",time:"time",value:"number"}[i]||"number";(this._data=new eT([{name:"value",type:r}],this)).initData(e,a)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if("category"===this.get("axisType"))return this._names.slice()},t.type="timeline",t.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},t}(Bv),_q=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="timeline.slider",t.defaultOption=Iy(Cq.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),t}(Cq);Ur(_q,vb.prototype);var Tq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="timeline",t}(kw),Eq=function(e){function t(t,n,i,a){var r=e.call(this,t,n,i)||this;return r.type=a||"value",r}return Xe(t,e),t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return"horizontal"===this.model.get("orient")},t}(UE),Mq=Math.PI,Iq=Bd();!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.init=function(e,t){this.api=t},t.prototype.render=function(e,t,n){if(this.model=e,this.api=n,this.ecModel=t,this.group.removeAll(),e.get("show",!0)){var i=this._layout(e,n),a=this._createGroup("_mainGroup"),r=this._createGroup("_labelGroup"),o=this._axis=this._createAxis(i,e);e.formatTooltip=function(e){return rw("nameValue",{noName:!0,value:o.scale.getLabel({value:e})})},Hr(["AxisLine","AxisTick","Control","CurrentPointer"],function(t){this["_render"+t](i,a,o,e)},this),this._renderAxisLabel(i,r,o,e),this._position(i,e)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(e,t){var n,i,a,r,o=e.get(["label","position"]),s=e.get("orient"),l=function(e,t){return Iv(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()},e.get("padding"))}(e,t),p={horizontal:"center",vertical:(n=null==o||"auto"===o?"horizontal"===s?l.y+l.height/2=0||"+"===n?"left":"right"},c={horizontal:n>=0||"+"===n?"top":"bottom",vertical:"middle"},d={horizontal:0,vertical:Mq/2},u="vertical"===s?l.height:l.width,m=e.getModel("controlStyle"),h=m.get("show",!0),g=h?m.get("itemSize"):0,f=h?m.get("itemGap"):0,y=g+f,v=e.get(["label","rotate"])||0;v=v*Mq/180;var x=m.get("position",!0),b=h&&m.get("showPlayBtn",!0),w=h&&m.get("showPrevBtn",!0),S=h&&m.get("showNextBtn",!0),C=0,_=u;"left"===x||"bottom"===x?(b&&(i=[0,0],C+=y),w&&(a=[C,0],C+=y),S&&(r=[_-g,0],_-=y)):(b&&(i=[_-g,0],_-=y),w&&(a=[0,0],C+=y),S&&(r=[_-g,0],_-=y));var T=[C,_];return e.get("inverse")&&T.reverse(),{viewRect:l,mainLength:u,orient:s,rotation:d[s],labelRotation:v,labelPosOpt:n,labelAlign:e.get(["label","align"])||p[s],labelBaseline:e.get(["label","verticalAlign"])||e.get(["label","baseline"])||c[s],playPosition:i,prevBtnPosition:a,nextBtnPosition:r,axisExtent:T,controlSize:g,controlGap:f}},t.prototype._position=function(e,t){var n=this._mainGroup,i=this._labelGroup,a=e.viewRect;if("vertical"===e.orient){var r=[1,0,0,1,0,0],o=a.x,s=a.y+a.height;Is(r,r,[-o,-s]),ks(r,r,-Mq/2),Is(r,r,[o,s]),(a=a.clone()).applyTransform(r)}var l=f(a),p=f(n.getBoundingRect()),c=f(i.getBoundingRect()),d=[n.x,n.y],u=[i.x,i.y];u[0]=d[0]=l[0][0];var m,h=e.labelPosOpt;null==h||to(h)?(y(d,p,l,1,m="+"===h?0:1),y(u,c,l,1,1-m)):(y(d,p,l,1,m=h>=0?0:1),u[1]=d[1]+h);function g(e){e.originX=l[0][0]-e.x,e.originY=l[1][0]-e.y}function f(e){return[[e.x,e.x+e.width],[e.y,e.y+e.height]]}function y(e,t,n,i,a){e[i]+=n[i][a]-t[i][a]}n.setPosition(d),i.setPosition(u),n.rotation=i.rotation=e.rotation,g(n),g(i)},t.prototype._createAxis=function(e,t){var n=t.getData(),i=t.get("axisType"),a=function(e,t){if(t=t||e.get("type"),t)switch(t){case"category":return new ST({ordinalMeta:e.getCategories(),extent:[1/0,-1/0]});case"time":return new LT({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});default:return new _T}}(t,i);a.getTicks=function(){return n.mapArray(["value"],function(e){return{value:e}})};var r=n.getDataExtent("value");a.setExtent(r[0],r[1]),a.calcNiceTicks();var o=new Eq("value",a,e.axisExtent,i);return o.model=t,o},t.prototype._createGroup=function(e){var t=this[e]=new qc;return this.group.add(t),t},t.prototype._renderAxisLine=function(e,t,n,i){var a=n.getExtent();if(i.get(["lineStyle","show"])){var r=new $g({shape:{x1:a[0],y1:0,x2:a[1],y2:0},style:Vr({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});t.add(r);var o=this._progressLine=new $g({shape:{x1:a[0],x2:this._currentPointer?this._currentPointer.x:a[0],y1:0,y2:0},style:qr({lineCap:"round",lineWidth:r.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});t.add(o)}},t.prototype._renderAxisTick=function(e,t,n,i){var a=this,r=i.getData(),o=n.scale.getTicks();this._tickSymbols=[],Hr(o,function(e){var o=n.dataToCoord(e.value),s=r.getItemModel(e.value),l=s.getModel("itemStyle"),p=s.getModel(["emphasis","itemStyle"]),c=s.getModel(["progress","itemStyle"]),d={x:o,y:0,onclick:Zr(a._changeTimeline,a,e.value)},u=kq(s,l,t,d);u.ensureState("emphasis").style=p.getItemStyle(),u.ensureState("progress").style=c.getItemStyle(),jh(u);var m=nh(u);s.get("tooltip")?(m.dataIndex=e.value,m.dataModel=i):m.dataIndex=m.dataModel=null,a._tickSymbols.push(u)})},t.prototype._renderAxisLabel=function(e,t,n,i){var a=this;if(n.getLabelModel().get("show")){var r=i.getData(),o=n.getViewLabels();this._tickLabels=[],Hr(o,function(i){var o=i.tickValue,s=r.getItemModel(o),l=s.getModel("label"),p=s.getModel(["emphasis","label"]),c=s.getModel(["progress","label"]),d=n.dataToCoord(i.tickValue),u=new Um({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:Zr(a._changeTimeline,a,o),silent:!1,style:iy(l,{text:i.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});u.ensureState("emphasis").style=iy(p),u.ensureState("progress").style=iy(c),t.add(u),jh(u),Iq(u).dataIndex=o,a._tickLabels.push(u)})}},t.prototype._renderControl=function(e,t,n,i){var a=e.controlSize,r=e.rotation,o=i.getModel("controlStyle").getItemStyle(),s=i.getModel(["emphasis","controlStyle"]).getItemStyle(),l=i.getPlayState(),p=i.get("inverse",!0);function c(e,n,l,p){if(e){var c=Ic(ho(i.get(["controlStyle",n+"BtnSize"]),a),a),d=function(e,t,n,i){var a=i.style,r=jf(e.get(["controlStyle",t]),i||{},new zs(n[0],n[1],n[2],n[3]));a&&r.setStyle(a);return r}(i,n+"Icon",[0,-c/2,c,c],{x:e[0],y:e[1],originX:a/2,originY:0,rotation:p?-r:0,rectHover:!0,style:o,onclick:l});d.ensureState("emphasis").style=s,t.add(d),jh(d)}}c(e.nextBtnPosition,"next",Zr(this._changeTimeline,this,p?"-":"+")),c(e.prevBtnPosition,"prev",Zr(this._changeTimeline,this,p?"+":"-")),c(e.playPosition,l?"stop":"play",Zr(this._handlePlayClick,this,!l),!0)},t.prototype._renderCurrentPointer=function(e,t,n,i){var a=i.getData(),r=i.getCurrentIndex(),o=a.getItemModel(r).getModel("checkpointStyle"),s=this,l={onCreate:function(e){e.draggable=!0,e.drift=Zr(s._handlePointerDrag,s),e.ondragend=Zr(s._handlePointerDragend,s),Pq(e,s._progressLine,r,n,i,!0)},onUpdate:function(e){Pq(e,s._progressLine,r,n,i)}};this._currentPointer=kq(o,o,this._mainGroup,{},this._currentPointer,l)},t.prototype._handlePlayClick=function(e){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:e,from:this.uid})},t.prototype._handlePointerDrag=function(e,t,n){this._clearTimer(),this._pointerChangeTimeline([n.offsetX,n.offsetY])},t.prototype._handlePointerDragend=function(e){this._pointerChangeTimeline([e.offsetX,e.offsetY],!0)},t.prototype._pointerChangeTimeline=function(e,t){var n=this._toAxisCoord(e)[0],i=Jc(this._axis.getExtent().slice());n>i[1]&&(n=i[1]),n=0&&(o[r]=+o[r].toFixed(d)),[o,c]}var Nq={min:Qr(Fq,"min"),max:Qr(Fq,"max"),average:Qr(Fq,"average"),median:Qr(Fq,"median")};function Lq(e,t){if(t){var n=e.getData(),i=e.coordinateSystem,a=i&&i.dimensions;if(!function(e){return!isNaN(parseFloat(e.x))&&!isNaN(parseFloat(e.y))}(t)&&!Jr(t.coord)&&Jr(a)){var r=Vq(t,n,i,e);if((t=Fr(t)).type&&Nq[t.type]&&r.baseAxis&&r.valueAxis){var o=Gr(a,r.baseAxis.dim),s=Gr(a,r.valueAxis.dim),l=Nq[t.type](n,r.baseDataDim,r.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[null!=t.xAxis?t.xAxis:t.radiusAxis,null!=t.yAxis?t.yAxis:t.angleAxis]}if(null!=t.coord&&Jr(a))for(var p=t.coord,c=0;c<2;c++)Nq[p[c]]&&(p[c]=zq(n,n.mapDimension(a[c]),p[c]));else t.coord=[];return t}}function Vq(e,t,n,i){var a={};return null!=e.valueIndex||null!=e.valueDim?(a.valueDataDim=null!=e.valueIndex?t.getDimension(e.valueIndex):e.valueDim,a.valueAxis=n.getAxis(function(e,t){var n=e.getData().getDimensionInfo(t);return n&&n.coordDim}(i,a.valueDataDim)),a.baseAxis=n.getOtherAxis(a.valueAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim)):(a.baseAxis=i.getBaseAxis(),a.valueAxis=n.getOtherAxis(a.baseAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim),a.valueDataDim=t.mapDimension(a.valueAxis.dim)),a}function qq(e,t){return!(e&&e.containData&&t.coord&&!Bq(t))||e.containData(t.coord)}function Gq(e,t){return e?function(e,n,i,a){return Cb(a<2?e.coord&&e.coord[a]:e.value,t[a])}:function(e,n,i,a){return Cb(e.value,t[a])}}function zq(e,t,n){if("average"===n){var i=0,a=0;return e.each(t,function(e,t){isNaN(e)||(i+=e,a++)}),i/a}return"median"===n?e.getMedian(t):e.getDataExtent(t)["max"===n?1:0]}var Uq=Bd(),jq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.init=function(){this.markerGroupMap=Eo()},t.prototype.render=function(e,t,n){var i=this,a=this.markerGroupMap;a.each(function(e){Uq(e).keep=!1}),t.eachSeries(function(e){var a=Rq.getMarkerModelFromSeries(e,i.type);a&&i.renderSeries(e,a,t,n)}),a.each(function(e){!Uq(e).keep&&i.group.remove(e.group)})},t.prototype.markKeep=function(e){Uq(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;Hr(e,function(e){var i=Rq.getMarkerModelFromSeries(e,n.type);i&&i.getData().eachItemGraphicEl(function(e){e&&(t?Oh(e):Rh(e))})})},t.type="marker",t}(kw);function Hq(e,t,n){var i=t.coordinateSystem;e.each(function(a){var r,o=e.getItemModel(a),s=Zc(o.get("x"),n.getWidth()),l=Zc(o.get("y"),n.getHeight());if(isNaN(s)||isNaN(l)){if(t.getMarkerPosition)r=t.getMarkerPosition(e.getValues(e.dimensions,a));else if(i){var p=e.get(i.dimensions[0],a),c=e.get(i.dimensions[1],a);r=i.dataToPoint([p,c])}}else r=[s,l];isNaN(s)||(r[0]=s),isNaN(l)||(r[1]=l),e.setItemLayout(a,r)})}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=Rq.getMarkerModelFromSeries(e,"markPoint");t&&(Hq(t.getData(),e,n),this.markerGroupMap.get(e.id).updateLayout())},this)},t.prototype.renderSeries=function(e,t,n,i){var a=e.coordinateSystem,r=e.id,o=e.getData(),s=this.markerGroupMap,l=s.get(r)||s.set(r,new LM),p=function(e,t,n){var i;i=e?Wr(e&&e.dimensions,function(e){return Vr(Vr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:"value",type:"float"}];var a=new eT(i,n),r=Wr(n.get("data"),Qr(Lq,t));e&&(r=Kr(r,Qr(qq,e)));var o=Gq(!!e,i);return a.initData(r,null,o),a}(a,e,t);t.setData(p),Hq(t.getData(),e,i),p.each(function(e){var n=p.getItemModel(e),i=n.getShallow("symbol"),a=n.getShallow("symbolSize"),r=n.getShallow("symbolRotate"),s=n.getShallow("symbolOffset"),l=n.getShallow("symbolKeepAspect");if(eo(i)||eo(a)||eo(r)||eo(s)){var c=t.getRawValue(e),d=t.getDataParams(e);eo(i)&&(i=i(c,d)),eo(a)&&(a=a(c,d)),eo(r)&&(r=r(c,d)),eo(s)&&(s=s(c,d))}var u=n.getModel("itemStyle").getItemStyle(),m=kS(o,"color");u.fill||(u.fill=m),p.setItemVisual(e,{symbol:i,symbolSize:a,symbolRotate:r,symbolOffset:s,symbolKeepAspect:l,style:u})}),l.updateData(p),this.group.add(l.group),p.eachItemGraphicEl(function(e){e.traverse(function(e){nh(e).dataModel=t})}),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markPoint"}(jq);var Wq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.createMarkerModelFromSeries=function(e,n,i){return new t(e,n,i)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(Rq),$q=Bd(),Kq=function(e,t,n,i){var a,r=e.getData();if(Jr(i))a=i;else{var o=i.type;if("min"===o||"max"===o||"average"===o||"median"===o||null!=i.xAxis||null!=i.yAxis){var s=void 0,l=void 0;if(null!=i.yAxis||null!=i.xAxis)s=t.getAxis(null!=i.yAxis?"y":"x"),l=mo(i.yAxis,i.xAxis);else{var p=Vq(i,r,t,e);s=p.valueAxis,l=zq(r,lT(r,p.valueDataDim),o)}var c="x"===s.dim?0:1,d=1-c,u=Fr(i),m={coord:[]};u.type=null,u.coord=[],u.coord[d]=-1/0,m.coord[d]=1/0;var h=n.get("precision");h>=0&&io(l)&&(l=+l.toFixed(Math.min(h,20))),u.coord[c]=m.coord[c]=l,a=[u,m,{type:o,valueIndex:i.valueIndex,value:l}]}else a=[]}var g=[Lq(e,a[0]),Lq(e,a[1]),Vr({},a[2])];return g[2].type=g[2].type||null,Nr(g[2],g[0]),Nr(g[2],g[1]),g};function Yq(e){return!isNaN(e)&&!isFinite(e)}function Xq(e,t,n,i){var a=1-e,r=i.dimensions[e];return Yq(t[a])&&Yq(n[a])&&t[e]===n[e]&&i.getAxis(r).containData(t[e])}function Zq(e,t){if("cartesian2d"===e.type){var n=t[0].coord,i=t[1].coord;if(n&&i&&(Xq(1,n,i,e)||Xq(0,n,i,e)))return!0}return qq(e,t[0])&&qq(e,t[1])}function Qq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Zc(s.get("x"),a.getWidth()),p=Zc(s.get("y"),a.getHeight());if(isNaN(l)||isNaN(p)){if(i.getMarkerPosition)r=i.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=o.dimensions,d=e.get(c[0],t),u=e.get(c[1],t);r=o.dataToPoint([d,u])}if(QM(o,"cartesian2d")){var m=o.getAxis("x"),h=o.getAxis("y");c=o.dimensions;Yq(e.get(c[0],t))?r[0]=m.toGlobalCoord(m.getExtent()[n?0:1]):Yq(e.get(c[1],t))&&(r[1]=h.toGlobalCoord(h.getExtent()[n?0:1]))}isNaN(l)||(r[0]=l),isNaN(p)||(r[1]=p)}else r=[l,p];e.setItemLayout(t,r)}var Jq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=Rq.getMarkerModelFromSeries(e,"markLine");if(t){var i=t.getData(),a=$q(t).from,r=$q(t).to;a.each(function(t){Qq(a,t,!0,e,n),Qq(r,t,!1,e,n)}),i.each(function(e){i.setItemLayout(e,[a.getItemLayout(e),r.getItemLayout(e)])}),this.markerGroupMap.get(e.id).updateLayout()}},this)},t.prototype.renderSeries=function(e,t,n,i){var a=e.coordinateSystem,r=e.id,o=e.getData(),s=this.markerGroupMap,l=s.get(r)||s.set(r,new aO);this.group.add(l.group);var p=function(e,t,n){var i;i=e?Wr(e&&e.dimensions,function(e){return Vr(Vr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})}):[{name:"value",type:"float"}];var a=new eT(i,n),r=new eT(i,n),o=new eT([],n),s=Wr(n.get("data"),Qr(Kq,t,e,n));e&&(s=Kr(s,Qr(Zq,e)));var l=Gq(!!e,i);return a.initData(Wr(s,function(e){return e[0]}),null,l),r.initData(Wr(s,function(e){return e[1]}),null,l),o.initData(Wr(s,function(e){return e[2]})),o.hasItemOption=!0,{from:a,to:r,line:o}}(a,e,t),c=p.from,d=p.to,u=p.line;$q(t).from=c,$q(t).to=d,t.setData(u);var m=t.get("symbol"),h=t.get("symbolSize"),g=t.get("symbolRotate"),f=t.get("symbolOffset");function y(t,n,a){var r=t.getItemModel(n);Qq(t,n,a,e,i);var s=r.getModel("itemStyle").getItemStyle();null==s.fill&&(s.fill=kS(o,"color")),t.setItemVisual(n,{symbolKeepAspect:r.get("symbolKeepAspect"),symbolOffset:ho(r.get("symbolOffset",!0),f[a?0:1]),symbolRotate:ho(r.get("symbolRotate",!0),g[a?0:1]),symbolSize:ho(r.get("symbolSize"),h[a?0:1]),symbol:ho(r.get("symbol",!0),m[a?0:1]),style:s})}Jr(m)||(m=[m,m]),Jr(h)||(h=[h,h]),Jr(g)||(g=[g,g]),Jr(f)||(f=[f,f]),p.from.each(function(e){y(c,e,!0),y(d,e,!1)}),u.each(function(e){var t=u.getItemModel(e).getModel("lineStyle").getLineStyle();u.setItemLayout(e,[c.getItemLayout(e),d.getItemLayout(e)]),null==t.stroke&&(t.stroke=c.getItemVisual(e,"style").fill),u.setItemVisual(e,{fromSymbolKeepAspect:c.getItemVisual(e,"symbolKeepAspect"),fromSymbolOffset:c.getItemVisual(e,"symbolOffset"),fromSymbolRotate:c.getItemVisual(e,"symbolRotate"),fromSymbolSize:c.getItemVisual(e,"symbolSize"),fromSymbol:c.getItemVisual(e,"symbol"),toSymbolKeepAspect:d.getItemVisual(e,"symbolKeepAspect"),toSymbolOffset:d.getItemVisual(e,"symbolOffset"),toSymbolRotate:d.getItemVisual(e,"symbolRotate"),toSymbolSize:d.getItemVisual(e,"symbolSize"),toSymbol:d.getItemVisual(e,"symbol"),style:t})}),l.updateData(u),p.line.eachItemGraphicEl(function(e){nh(e).dataModel=t,e.traverse(function(e){nh(e).dataModel=t})}),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markLine",t}(jq);function eG(e){e.registerComponentModel(Wq),e.registerComponentView(Jq),e.registerPreprocessor(function(e){Dq(e.series,"markLine")&&(e.markLine=e.markLine||{})})}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.createMarkerModelFromSeries=function(e,n,i){return new t(e,n,i)},t.type="markArea",t.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}}}(Rq);var tG=Bd(),nG=function(e,t,n,i){var a=i[0],r=i[1];if(a&&r){var o=Lq(e,a),s=Lq(e,r),l=o.coord,p=s.coord;l[0]=mo(l[0],-1/0),l[1]=mo(l[1],-1/0),p[0]=mo(p[0],1/0),p[1]=mo(p[1],1/0);var c=Lr([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function iG(e){return!isNaN(e)&&!isFinite(e)}function aG(e,t,n,i){var a=1-e;return iG(t[a])&&iG(n[a])}function rG(e,t){var n=t.coord[0],i=t.coord[1],a={coord:n,x:t.x0,y:t.y0},r={coord:i,x:t.x1,y:t.y1};return QM(e,"cartesian2d")?!(!n||!i||!aG(1,n,i)&&!aG(0,n,i))||function(e,t,n){return!(e&&e.containZone&&t.coord&&n.coord&&!Bq(t)&&!Bq(n))||e.containZone(t.coord,n.coord)}(e,a,r):qq(e,a)||qq(e,r)}function oG(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Zc(s.get(n[0]),a.getWidth()),p=Zc(s.get(n[1]),a.getHeight());if(isNaN(l)||isNaN(p)){if(i.getMarkerPosition){var c=e.getValues(["x0","y0"],t),d=e.getValues(["x1","y1"],t),u=o.clampData(c),m=o.clampData(d),h=[];"x0"===n[0]?h[0]=u[0]>m[0]?d[0]:c[0]:h[0]=u[0]>m[0]?c[0]:d[0],"y0"===n[1]?h[1]=u[1]>m[1]?d[1]:c[1]:h[1]=u[1]>m[1]?c[1]:d[1],r=i.getMarkerPosition(h,n,!0)}else{var g=[v=e.get(n[0],t),x=e.get(n[1],t)];o.clampData&&o.clampData(g,g),r=o.dataToPoint(g,!0)}if(QM(o,"cartesian2d")){var f=o.getAxis("x"),y=o.getAxis("y"),v=e.get(n[0],t),x=e.get(n[1],t);iG(v)?r[0]=f.toGlobalCoord(f.getExtent()["x0"===n[0]?0:1]):iG(x)&&(r[1]=y.toGlobalCoord(y.getExtent()["y0"===n[1]?0:1]))}isNaN(l)||(r[0]=l),isNaN(p)||(r[1]=p)}else r=[l,p];return r}var sG=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]];!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}Xe(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries(function(e){var t=Rq.getMarkerModelFromSeries(e,"markArea");if(t){var i=t.getData();i.each(function(t){var a=Wr(sG,function(a){return oG(i,t,a,e,n)});i.setItemLayout(t,a),i.getItemGraphicEl(t).setShape("points",a)})}},this)},t.prototype.renderSeries=function(e,t,n,i){var a=e.coordinateSystem,r=e.id,o=e.getData(),s=this.markerGroupMap,l=s.get(r)||s.set(r,{group:new qc});this.group.add(l.group),this.markKeep(l);var p=function(e,t,n){var i,a,r=["x0","y0","x1","y1"];if(e){var o=Wr(e&&e.dimensions,function(e){var n=t.getData();return Vr(Vr({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})});a=Wr(r,function(e,t){return{name:e,type:o[t%2].type}}),i=new eT(a,n)}else i=new eT(a=[{name:"value",type:"float"}],n);var s=Wr(n.get("data"),Qr(nG,t,e,n));e&&(s=Kr(s,Qr(rG,e)));var l=e?function(e,t,n,i){return Cb(e.coord[Math.floor(i/2)][i%2],a[i])}:function(e,t,n,i){return Cb(e.value,a[i])};return i.initData(s,null,l),i.hasItemOption=!0,i}(a,e,t);t.setData(p),p.each(function(t){var n=Wr(sG,function(n){return oG(p,t,n,e,i)}),r=a.getAxis("x").scale,s=a.getAxis("y").scale,l=r.getExtent(),c=s.getExtent(),d=[r.parse(p.get("x0",t)),r.parse(p.get("x1",t))],u=[s.parse(p.get("y0",t)),s.parse(p.get("y1",t))];Jc(d),Jc(u);var m=!!(l[0]>d[1]||l[1]u[1]||c[1]=0},t.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},t}(Bv),pG=Qr,cG=Hr,dG=qc,uG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return Xe(t,e),t.prototype.init=function(){this.group.add(this._contentGroup=new dG),this.group.add(this._selectorGroup=new dG),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(e,t,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),e.get("show",!0)){var a=e.get("align"),r=e.get("orient");a&&"auto"!==a||(a="right"===e.get("left")&&"vertical"===r?"right":"left");var o=e.get("selector",!0),s=e.get("selectorPosition",!0);!o||s&&"auto"!==s||(s="horizontal"===r?"end":"start"),this.renderInner(a,e,t,n,o,r,s);var l=e.getBoxLayoutParams(),p={width:n.getWidth(),height:n.getHeight()},c=e.get("padding"),d=Iv(l,p,c),u=this.layoutInner(e,a,d,i,o,s),m=Iv(qr({width:u.width,height:u.height},l),p,c);this.group.x=m.x-u.x,this.group.y=m.y-u.y,this.group.markRedraw(),this.group.add(this._backgroundEl=gV(u,e))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(e,t,n,i,a,r,o){var s=this.getContentGroup(),l=Eo(),p=t.get("selectedMode"),c=[];n.eachRawSeries(function(e){!e.get("legendHoverLink")&&c.push(e.id)}),cG(t.getData(),function(a,r){var o=a.get("name");if(!this.newlineDisabled&&(""===o||"\n"===o)){var d=new dG;return d.newline=!0,void s.add(d)}var u=n.getSeriesByName(o)[0];if(!l.get(o)){if(u){var m=u.getData(),h=m.getVisual("legendLineStyle")||{},g=m.getVisual("legendIcon"),f=m.getVisual("style"),y=this._createItem(u,o,r,a,t,e,h,f,g,p,i);y.on("click",pG(mG,o,null,i,c)).on("mouseover",pG(gG,u.name,null,i,c)).on("mouseout",pG(fG,u.name,null,i,c)),n.ssr&&y.eachChild(function(e){var t=nh(e);t.seriesIndex=u.seriesIndex,t.dataIndex=r,t.ssrType="legend"}),l.set(o,!0)}else n.eachRawSeries(function(s){if(!l.get(o)&&s.legendVisualProvider){var d=s.legendVisualProvider;if(!d.containName(o))return;var u=d.indexOfName(o),m=d.getItemVisual(u,"style"),h=d.getItemVisual(u,"legendIcon"),g=Jl(m.fill);g&&0===g[3]&&(g[3]=.2,m=Vr(Vr({},m),{fill:op(g,"rgba")}));var f=this._createItem(s,o,r,a,t,e,{},m,h,p,i);f.on("click",pG(mG,null,o,i,c)).on("mouseover",pG(gG,null,o,i,c)).on("mouseout",pG(fG,null,o,i,c)),n.ssr&&f.eachChild(function(e){var t=nh(e);t.seriesIndex=s.seriesIndex,t.dataIndex=r,t.ssrType="legend"}),l.set(o,!0)}},this);0}},this),a&&this._createSelector(a,t,i,r,o)},t.prototype._createSelector=function(e,t,n,i,a){var r=this.getSelectorGroup();cG(e,function(e){var i=e.type,a=new Um({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect"})}});r.add(a),ty(a,{normal:t.getModel("selectorLabel"),emphasis:t.getModel(["emphasis","selectorLabel"])},{defaultText:e.title}),jh(a)})},t.prototype._createItem=function(e,t,n,i,a,r,o,s,l,p,c){var d=e.visualDrawType,u=a.get("itemWidth"),m=a.get("itemHeight"),h=a.isSelected(t),g=i.get("symbolRotate"),f=i.get("symbolKeepAspect"),y=i.get("icon"),v=function(e,t,n,i,a,r,o){function s(e,t){"auto"===e.lineWidth&&(e.lineWidth=t.lineWidth>0?2:0),cG(e,function(n,i){"inherit"===e[i]&&(e[i]=t[i])})}var l=t.getModel("itemStyle"),p=l.getItemStyle(),c=0===e.lastIndexOf("empty",0)?"fill":"stroke",d=l.getShallow("decal");p.decal=d&&"inherit"!==d?vC(d,o):i.decal,"inherit"===p.fill&&(p.fill=i[a]);"inherit"===p.stroke&&(p.stroke=i[c]);"inherit"===p.opacity&&(p.opacity=("fill"===a?i:n).opacity);s(p,i);var u=t.getModel("lineStyle"),m=u.getLineStyle();if(s(m,n),"auto"===p.fill&&(p.fill=i.fill),"auto"===p.stroke&&(p.stroke=i.fill),"auto"===m.stroke&&(m.stroke=i.fill),!r){var h=t.get("inactiveBorderWidth"),g=p[c];p.lineWidth="auto"===h?i.lineWidth>0&&g?2:0:p.lineWidth,p.fill=t.get("inactiveColor"),p.stroke=t.get("inactiveBorderColor"),m.stroke=u.get("inactiveColor"),m.lineWidth=u.get("inactiveWidth")}return{itemStyle:p,lineStyle:m}}(l=y||l||"roundRect",i,o,s,d,h,c),x=new dG,b=i.getModel("textStyle");if(!eo(e.getLegendIcon)||y&&"inherit"!==y){var w="inherit"===y&&e.getData().getVisual("symbol")?"inherit"===g?e.getData().getVisual("symbolRotate"):g:0;x.add(function(e){var t=e.icon||"roundRect",n=HS(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);n.setStyle(e.itemStyle),n.rotation=(e.iconRotate||0)*Math.PI/180,n.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2);return n}({itemWidth:u,itemHeight:m,icon:l,iconRotate:w,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:f}))}else x.add(e.getLegendIcon({itemWidth:u,itemHeight:m,icon:l,iconRotate:g,itemStyle:v.itemStyle,lineStyle:v.lineStyle,symbolKeepAspect:f}));var S="left"===r?u+5:-5,C=r,_=a.get("formatter"),T=t;to(_)&&_?T=_.replace("{name}",null!=t?t:""):eo(_)&&(T=_(t));var E=h?b.getTextColor():i.get("inactiveColor");x.add(new Um({style:iy(b,{text:T,x:S,y:m/2,fill:E,align:C,verticalAlign:"middle"},{inheritColor:E})}));var M=new qm({shape:x.getBoundingRect(),style:{fill:"transparent"}}),I=i.getModel("tooltip");return I.get("show")&&Kf({el:M,componentModel:a,itemName:t,itemTooltipOption:I.option}),x.add(M),x.eachChild(function(e){e.silent=!0}),M.silent=!p,this.getContentGroup().add(x),jh(x),x.__legendDataIndex=n,x},t.prototype.layoutInner=function(e,t,n,i,a,r){var o=this.getContentGroup(),s=this.getSelectorGroup();Mv(e.get("orient"),o,e.get("itemGap"),n.width,n.height);var l=o.getBoundingRect(),p=[-l.x,-l.y];if(s.markRedraw(),o.markRedraw(),a){Mv("horizontal",s,e.get("selectorItemGap",!0));var c=s.getBoundingRect(),d=[-c.x,-c.y],u=e.get("selectorButtonGap",!0),m=e.getOrient().index,h=0===m?"width":"height",g=0===m?"height":"width",f=0===m?"y":"x";"end"===r?d[m]+=l[h]+u:p[m]+=c[h]+u,d[1-m]+=l[g]/2-c[g]/2,s.x=d[0],s.y=d[1],o.x=p[0],o.y=p[1];var y={x:0,y:0};return y[h]=l[h]+u+c[h],y[g]=Math.max(l[g],c[g]),y[f]=Math.min(0,c[f]+d[1-m]),y}return o.x=p[0],o.y=p[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(kw);function mG(e,t,n,i){fG(e,t,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=e?e:t}),gG(e,t,n,i)}function hG(e){for(var t,n=e.getZr().storage.getDisplayList(),i=0,a=n.length;in[a],h=[-d.x,-d.y];t||(h[i]=l[s]);var g=[0,0],f=[-u.x,-u.y],y=ho(e.get("pageButtonGap",!0),e.get("itemGap",!0));m&&("end"===e.get("pageButtonPosition",!0)?f[i]+=n[a]-u[a]:g[i]+=u[a]+y);f[1-i]+=d[r]/2-u[r]/2,l.setPosition(h),p.setPosition(g),c.setPosition(f);var v={x:0,y:0};if(v[a]=m?n[a]:d[a],v[r]=Math.max(d[r],u[r]),v[o]=Math.min(0,u[o]+f[1-i]),p.__rectSize=n[a],m){var x={x:0,y:0};x[a]=Math.max(n[a]-u[a]-y,0),x[r]=v[r],p.setClipPath(new qm({shape:x})),p.__rectSize=x[a]}else c.eachChild(function(e){e.attr({invisible:!0,silent:!0})});var b=this._getPageInfo(e);return null!=b.pageIndex&&gf(l,{x:b.contentPosition[0],y:b.contentPosition[1]},m?e:null),this._updatePageInfoView(e,b),v},t.prototype._pageGo=function(e,t,n){var i=this._getPageInfo(t)[e];null!=i&&n.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:t.id})},t.prototype._updatePageInfoView=function(e,t){var n=this._controllerGroup;Hr(["pagePrev","pageNext"],function(i){var a=null!=t[i+"DataIndex"],r=n.childOfName(i);r&&(r.setStyle("fill",a?e.get("pageIconColor",!0):e.get("pageIconInactiveColor",!0)),r.cursor=a?"pointer":"default")});var i=n.childOfName("pageText"),a=e.get("pageFormatter"),r=t.pageIndex,o=null!=r?r+1:0,s=t.pageCount;i&&a&&i.setStyle("text",to(a)?a.replace("{current}",null==o?"":o+"").replace("{total}",null==s?"":s+""):a({current:o,total:s}))},t.prototype._getPageInfo=function(e){var t=e.get("scrollDataIndex",!0),n=this.getContentGroup(),i=this._containerGroup.__rectSize,a=e.getOrient().index,r=xG[a],o=bG[a],s=this._findTargetItemIndex(t),l=n.children(),p=l[s],c=l.length,d=c?1:0,u={contentPosition:[n.x,n.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!p)return u;var m=v(p);u.contentPosition[a]=-m.s;for(var h=s+1,g=m,f=m,y=null;h<=c;++h)(!(y=v(l[h]))&&f.e>g.s+i||y&&!x(y,g.s))&&(g=f.i>g.i?f:y)&&(null==u.pageNextDataIndex&&(u.pageNextDataIndex=g.i),++u.pageCount),f=y;for(h=s-1,g=m,f=m,y=null;h>=-1;--h)(y=v(l[h]))&&x(f,y.s)||!(g.i=t&&e.s<=t+i}},t.prototype._findTargetItemIndex=function(e){return this._showController?(this.getContentGroup().eachChild(function(i,a){var r=i.__legendDataIndex;null==n&&null!=r&&(n=a),r===e&&(t=a)}),null!=t?t:n):0;var t,n},t.type="legend.scroll"}(uG);var wG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="dataZoom.inside",t.defaultOption=Iy(iV.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(iV),SG=Bd();function CG(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function _G(e,t){e.isDisposed()||e.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:t})}function TG(e,t,n,i){return e.coordinateSystem.containPoint([n,i])}function EG(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,function(e,t){var n=SG(t),i=n.coordSysRecordMap||(n.coordSysRecordMap=Eo());i.each(function(e){e.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(e){Hr(tV(e).infoList,function(n){var a=n.model.uid,r=i.get(a)||i.set(a,function(e,t){var n={model:t,containsPoint:Qr(TG,t),dispatchAction:Qr(_G,e),dataZoomInfoMap:null,controller:null},i=n.controller=new SP(e.getZr());return Hr(["pan","zoom","scrollMove"],function(e){i.on(e,function(t){var i=[];n.dataZoomInfoMap.each(function(a){if(t.isAvailableBehavior(a.model.option)){var r=(a.getRange||{})[e],o=r&&r(a.dzReferCoordSysInfo,n.model.mainType,n.controller,t);!a.model.get("disabled",!0)&&o&&i.push({dataZoomId:a.model.id,start:o[0],end:o[1]})}}),i.length&&n.dispatchAction(i)})}),n}(t,n.model));(r.dataZoomInfoMap||(r.dataZoomInfoMap=Eo())).set(e.uid,{dzReferCoordSysInfo:n,model:e,getRange:null})})}),i.each(function(e){var t,n=e.controller,a=e.dataZoomInfoMap;if(a){var r=a.keys()[0];null!=r&&(t=a.get(r))}if(t){var o=function(e){var t,n="type_",i={type_true:2,type_move:1,type_false:0,type_undefined:-1},a=!0;return e.each(function(e){var r=e.model,o=!r.get("disabled",!0)&&(!r.get("zoomLock",!0)||"move");i[n+o]>i[n+t]&&(t=o),a=a&&r.get("preventDefaultMouseMove",!0)}),{controlType:t,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!a}}}(a);n.enable(o.controlType,o.opt),n.setPointerChecker(e.containsPoint),Uw(e,"dispatchAction",t.model.get("throttle",!0),"fixRate")}else CG(i,e)})})}var MG=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return Xe(t,e),t.prototype.render=function(t,n,i){e.prototype.render.apply(this,arguments),t.noTarget()?this._clear():(this.range=t.getPercentRange(),function(e,t,n){SG(e).coordSysRecordMap.each(function(e){var i=e.dataZoomInfoMap.get(t.uid);i&&(i.getRange=n)})}(i,t,{pan:Zr(IG.pan,this),zoom:Zr(IG.zoom,this),scrollMove:Zr(IG.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){!function(e,t){for(var n=SG(e).coordSysRecordMap,i=n.keys(),a=0;a0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(r[1]-r[0])+r[0],p=Math.max(1/i.scale,0);r[0]=(r[0]-l)*p+l,r[1]=(r[1]-l)*p+l;var c=this.dataZoomModel.findRepresentativeAxisProxy();if(c){var d=c.getMinMaxSpan();if(NO(0,r,[0,100],0,d.minSpan,d.maxSpan),this.range=r,a[0]!==r[0]||a[1]!==r[1])return r}}},pan:kG(function(e,t,n,i,a,r){var o=PG[i]([r.oldX,r.oldY],[r.newX,r.newY],t,a,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:kG(function(e,t,n,i,a,r){return PG[i]([0,0],[r.scrollDelta,r.scrollDelta],t,a,n).signal*(e[1]-e[0])*r.scrollDelta})};function kG(e){return function(t,n,i,a){var r=this.range,o=r.slice(),s=t.axisModels[0];if(s)return NO(e(o,s,t,n,i,a),o,[0,100],"all"),this.range=o,r[0]!==o[0]||r[1]!==o[1]?o:void 0}}var PG={grid:function(e,t,n,i,a){var r=n.axis,o={},s=a.model.coordinateSystem.getRect();return e=e||[0,0],"x"===r.dim?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=r.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=r.inverse?-1:1),o},polar:function(e,t,n,i,a){var r=n.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),p=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),"radiusAxis"===n.mainType?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=r.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=p[1]-p[0],o.pixelStart=p[0],o.signal=r.inverse?-1:1),o},singleAxis:function(e,t,n,i,a){var r=n.axis,o=a.model.coordinateSystem.getRect(),s={};return e=e||[0,0],"horizontal"===r.orient?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=r.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=r.inverse?-1:1),s}};function DG(e){dV(e),e.registerComponentModel(wG),e.registerComponentView(MG),EG(e)}var AG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=Iy(iV.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:"#fff",borderColor:"#ACB8D1"},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),t}(iV),OG=qm,RG="horizontal",BG="vertical",FG=["line","bar","candlestick","scatter","custom"],NG={easing:"cubicOut",duration:100,delay:0},LG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return Xe(t,e),t.prototype.init=function(e,t){this.api=t,this._onBrush=Zr(this._onBrush,this),this._onBrushEnd=Zr(this._onBrushEnd,this)},t.prototype.render=function(t,n,i,a){if(e.prototype.render.apply(this,arguments),Uw(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),!1!==t.get("show")){if(t.noTarget())return this._clear(),void this.group.removeAll();a&&"dataZoom"===a.type&&a.from===this.uid||this._buildView(),this._updateView()}else this.group.removeAll()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){jw(this,"_dispatchZoomAction");var e=this.api.getZr();e.off("mousemove",this._onBrush),e.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var e=this.group;e.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var t=this._displayables.sliderGroup=new qc;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),e.add(t),this._positionGroup()},t.prototype._resetLocation=function(){var e=this.dataZoomModel,t=this.api,n=e.get("brushSelect")?7:0,i=this._findCoordRect(),a={width:t.getWidth(),height:t.getHeight()},r=this._orient===RG?{right:a.width-i.x-i.width,top:a.height-30-7-n,width:i.width,height:30}:{right:7,top:i.y,width:30,height:i.height},o=Av(e.option);Hr(["right","top","width","height"],function(e){"ph"===o[e]&&(o[e]=r[e])});var s=Iv(o,a);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===BG&&this._size.reverse()},t.prototype._positionGroup=function(){var e=this.group,t=this._location,n=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),a=i&&i.get("inverse"),r=this._displayables.sliderGroup,o=(this._dataShadowInfo||{}).otherAxisInverse;r.attr(n!==RG||a?n===RG&&a?{scaleY:o?1:-1,scaleX:-1}:n!==BG||a?{scaleY:o?-1:1,scaleX:-1,rotation:Math.PI/2}:{scaleY:o?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:o?1:-1,scaleX:1});var s=e.getBoundingRect([r]);e.x=t.x-s.x,e.y=t.y-s.y,e.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var e=this.dataZoomModel,t=this._size,n=this._displayables.sliderGroup,i=e.get("brushSelect");n.add(new OG({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get("backgroundColor")},z2:-40}));var a=new OG({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:"transparent"},z2:0,onclick:Zr(this._onClickPanel,this)}),r=this.api.getZr();i?(a.on("mousedown",this._onBrushStart,this),a.cursor="crosshair",r.on("mousemove",this._onBrush),r.on("mouseup",this._onBrushEnd)):(r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)),n.add(a)},t.prototype._renderDataShadow=function(){var e=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],e){var t=this._size,n=this._shadowSize||[],i=e.series,a=i.getRawData(),r=i.getShadowDim&&i.getShadowDim(),o=r&&a.getDimensionInfo(r)?i.getShadowDim():e.otherDim;if(null!=o){var s=this._shadowPolygonPts,l=this._shadowPolylinePts;if(a!==this._shadowData||o!==this._shadowDim||t[0]!==n[0]||t[1]!==n[1]){var p=a.getDataExtent(o),c=.3*(p[1]-p[0]);p=[p[0]-c,p[1]+c];var d,u=[0,t[1]],m=[0,t[0]],h=[[t[0],0],[0,0]],g=[],f=m[1]/(a.count()-1),y=0,v=Math.round(a.count()/t[0]);a.each([o],function(e,t){if(v>0&&t%v)y+=f;else{var n=null==e||isNaN(e)||""===e,i=n?0:Xc(e,p,u,!0);n&&!d&&t?(h.push([h[h.length-1][0],0]),g.push([g[g.length-1][0],0])):!n&&d&&(h.push([y,0]),g.push([y,0])),h.push([y,i]),g.push([y,i]),y+=f,d=n}}),s=this._shadowPolygonPts=h,l=this._shadowPolylinePts=g}this._shadowData=a,this._shadowDim=o,this._shadowSize=[t[0],t[1]];for(var x=this.dataZoomModel,b=0;b<3;b++){var w=S(1===b);this._displayables.sliderGroup.add(w),this._displayables.dataShadowSegs.push(w)}}}function S(e){var t=x.getModel(e?"selectedDataBackground":"dataBackground"),n=new qc,i=new zg({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),a=new jg({shape:{points:l},segmentIgnoreThreshold:1,style:t.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return n.add(i),n.add(a),n}},t.prototype._prepareDataShadowInfo=function(){var e=this.dataZoomModel,t=e.get("showDataShadow");if(!1!==t){var n,i=this.ecModel;return e.eachTargetAxis(function(a,r){var o=e.getAxisProxy(a,r);o&&Hr(o.getTargetSeriesModels(),function(e){if(!(n||!0!==t&&Gr(FG,e.get("type"))<0)){var o,s=i.getComponent(JL(a),r).axis,l=function(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}(a),p=e.coordinateSystem;null!=l&&p.getOtherAxis&&(o=p.getOtherAxis(s).inverse),l=e.getData().mapDimension(l),n={thisAxis:s,series:e,thisDim:a,otherDim:l,otherAxisInverse:o}}},this)},this),n}},t.prototype._renderHandle=function(){var e=this.group,t=this._displayables,n=t.handles=[null,null],i=t.handleLabels=[null,null],a=this._displayables.sliderGroup,r=this._size,o=this.dataZoomModel,s=this.api,l=o.get("borderRadius")||0,p=o.get("brushSelect"),c=t.filler=new OG({silent:p,style:{fill:o.get("fillerColor")},textConfig:{position:"inside"}});a.add(c),a.add(new OG({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:r[0],height:r[1],r:l},style:{stroke:o.get("dataBackgroundColor")||o.get("borderColor"),lineWidth:1,fill:"rgba(0,0,0,0)"}})),Hr([0,1],function(t){var r=o.get("handleIcon");!zS[r]&&r.indexOf("path://")<0&&r.indexOf("image://")<0&&(r="path://"+r);var s=HS(r,-1,0,2,2,null,!0);s.attr({cursor:VG(this._orient),draggable:!0,drift:Zr(this._onDragMove,this,t),ondragend:Zr(this._onDragEnd,this),onmouseover:Zr(this._showDataInfo,this,!0),onmouseout:Zr(this._showDataInfo,this,!1),z2:5});var l=s.getBoundingRect(),p=o.get("handleSize");this._handleHeight=Zc(p,this._size[1]),this._handleWidth=l.width/l.height*this._handleHeight,s.setStyle(o.getModel("handleStyle").getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState("emphasis").style=o.getModel(["emphasis","handleStyle"]).getItemStyle(),jh(s);var c=o.get("handleColor");null!=c&&(s.style.fill=c),a.add(n[t]=s);var d=o.getModel("textStyle");e.add(i[t]=new Um({silent:!0,invisible:!0,style:iy(d,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:d.getTextColor(),font:d.getFont()}),z2:10}))},this);var d=c;if(p){var u=Zc(o.get("moveHandleSize"),r[1]),m=t.moveHandle=new qm({style:o.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:r[1]-.5,height:u}}),h=.8*u,g=t.moveHandleIcon=HS(o.get("moveHandleIcon"),-h/2,-h/2,h,h,"#fff",!0);g.silent=!0,g.y=r[1]+u/2-.5,m.ensureState("emphasis").style=o.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var f=Math.min(r[1]/2,Math.max(u,10));(d=t.moveZone=new qm({invisible:!0,shape:{y:r[1]-f,height:u+f}})).on("mouseover",function(){s.enterEmphasis(m)}).on("mouseout",function(){s.leaveEmphasis(m)}),a.add(m),a.add(g),a.add(d)}d.attr({draggable:!0,cursor:VG(this._orient),drift:Zr(this._onDragMove,this,"all"),ondragstart:Zr(this._showDataInfo,this,!0),ondragend:Zr(this._onDragEnd,this),onmouseover:Zr(this._showDataInfo,this,!0),onmouseout:Zr(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[Xc(e[0],[0,100],t,!0),Xc(e[1],[0,100],t,!0)]},t.prototype._updateInterval=function(e,t){var n=this.dataZoomModel,i=this._handleEnds,a=this._getViewExtent(),r=n.findRepresentativeAxisProxy();if(r){var o=r.getMinMaxSpan(),s=[0,100];NO(t,i,a,n.get("zoomLock")?"all":e,null!=o.minSpan?Xc(o.minSpan,s,a,!0):null,null!=o.maxSpan?Xc(o.maxSpan,s,a,!0):null);var l=this._range,p=this._range=Jc([Xc(i[0],a,s,!0),Xc(i[1],a,s,!0)]);return!l||l[0]!==p[0]||l[1]!==p[1]}return!1},t.prototype._updateView=function(e){var t=this._displayables,n=this._handleEnds,i=Jc(n.slice()),a=this._size;Hr([0,1],function(e){var i=t.handles[e],r=this._handleHeight;i.attr({scaleX:r/2,scaleY:r/2,x:n[e]+(e?-1:1),y:a[1]/2-r/2})},this),t.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:a[1]});var r={x:i[0],width:i[1]-i[0]};t.moveHandle&&(t.moveHandle.setShape(r),t.moveZone.setShape(r),t.moveZone.getBoundingRect(),t.moveHandleIcon&&t.moveHandleIcon.attr("x",r.x+r.width/2));for(var o=t.dataShadowSegs,s=[0,i[0],i[1],a[0]],l=0;lt[0]||n[1]<0||n[1]>t[1])){var i=this._handleEnds,a=(i[0]+i[1])/2,r=this._updateInterval("all",n[0]-a);this._updateView(),r&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(e){var t=e.offsetX,n=e.offsetY;this._brushStart=new Os(t,n),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(e){if(this._brushing){var t=this._displayables.brushRect;if(this._brushing=!1,t){t.attr("ignore",!0);var n=t.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(n.width)<5)){var i=this._getViewExtent(),a=[0,100];this._range=Jc([Xc(n.x,i,a,!0),Xc(n.x+n.width,i,a,!0)]),this._handleEnds=[n.x,n.x+n.width],this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(e){this._brushing&&(xs(e.event),this._updateBrushRect(e.offsetX,e.offsetY))},t.prototype._updateBrushRect=function(e,t){var n=this._displayables,i=this.dataZoomModel,a=n.brushRect;a||(a=n.brushRect=new OG({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),n.sliderGroup.add(a)),a.attr("ignore",!1);var r=this._brushStart,o=this._displayables.sliderGroup,s=o.transformCoordToLocal(e,t),l=o.transformCoordToLocal(r.x,r.y),p=this._size;s[0]=Math.max(Math.min(p[0],s[0]),0),a.setShape({x:l[0],y:0,width:s[0]-l[0],height:p[1]})},t.prototype._dispatchZoomAction=function(e){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:e?NG:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=tV(this.dataZoomModel).infoList;if(!e&&t.length){var n=t[0].model.coordinateSystem;e=n.getRect&&n.getRect()}if(!e){var i=this.api.getWidth(),a=this.api.getHeight();e={x:.2*i,y:.2*a,width:.6*i,height:.6*a}}return e},t.type="dataZoom.slider",t}(rV);function VG(e){return"vertical"===e?"ns-resize":"ew-resize"}function qG(e){e.registerComponentModel(AG),e.registerComponentView(LG),dV(e)}function GG(e){xE(DG),xE(qG)}var zG=function(e,t,n){var i=Fr((UG[e]||{})[t]);return n&&Jr(i)?i[i.length-1]:i},UG={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},jG=bA.mapVisual,HG=bA.eachVisual,WG=Jr,$G=Hr,KG=Jc,YG=Xc,XG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.stateList=["inRange","outOfRange"],n.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],n.layoutMode={type:"box",ignoreSize:!0},n.dataBound=[-1/0,1/0],n.targetVisuals={},n.controllerVisuals={},n}return Xe(t,e),t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&yq(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=Zr(e,this),this.controllerVisuals=fq(this.option.controller,t,e),this.targetVisuals=fq(this.option.target,t,e)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var e=this.option.seriesIndex,t=[];return null==e||"all"===e?this.ecModel.eachSeries(function(e,n){t.push(n)}):t=Cd(e),t},t.prototype.eachTargetSeries=function(e,t){Hr(this.getTargetSeriesIndices(),function(n){var i=this.ecModel.getSeriesByIndex(n);i&&e.call(t,i)},this)},t.prototype.isTargetSeries=function(e){var t=!1;return this.eachTargetSeries(function(n){n===e&&(t=!0)}),t},t.prototype.formatValueText=function(e,t,n){var i,a=this.option,r=a.precision,o=this.dataBound,s=a.formatter;n=n||["<",">"],Jr(e)&&(e=e.slice(),i=!0);var l=t?e:i?[p(e[0]),p(e[1])]:p(e);return to(s)?s.replace("{value}",i?l[0]:l).replace("{value2}",i?l[1]:l):eo(s)?i?s(e[0],e[1]):s(e):i?e[0]===o[0]?n[0]+" "+l[1]:e[1]===o[1]?n[1]+" "+l[0]:l[0]+" - "+l[1]:l;function p(e){return e===o[0]?"min":e===o[1]?"max":(+e).toFixed(Math.min(r,20))}},t.prototype.resetExtent=function(){var e=this.option,t=KG([e.min,e.max]);this._dataExtent=t},t.prototype.getDataDimensionIndex=function(e){var t=this.option.dimension;if(null!=t)return e.getDimensionIndex(t);for(var n=e.dimensions,i=n.length-1;i>=0;i--){var a=n[i],r=e.getDimensionInfo(a);if(!r.isCalculationCoord)return r.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var e=this.ecModel,t=this.option,n={inRange:t.inRange,outOfRange:t.outOfRange},i=t.target||(t.target={}),a=t.controller||(t.controller={});Nr(i,n),Nr(a,n);var r=this.isCategory();function o(n){WG(t.color)&&!n.inRange&&(n.inRange={color:t.color.slice().reverse()}),n.inRange=n.inRange||{color:e.get("gradientColor")}}o.call(this,i),o.call(this,a),function(e,t,n){var i=e[t],a=e[n];i&&!a&&(a=e[n]={},$G(i,function(e,t){if(bA.isValidType(t)){var n=zG(t,"inactive",r);null!=n&&(a[t]=n,"color"!==t||a.hasOwnProperty("opacity")||a.hasOwnProperty("colorAlpha")||(a.opacity=[0,0]))}}))}.call(this,i,"inRange","outOfRange"),function(e){var t=(e.inRange||{}).symbol||(e.outOfRange||{}).symbol,n=(e.inRange||{}).symbolSize||(e.outOfRange||{}).symbolSize,i=this.get("inactiveColor"),a=this.getItemSymbol()||"roundRect";$G(this.stateList,function(o){var s=this.itemSize,l=e[o];l||(l=e[o]={color:r?i:[i]}),null==l.symbol&&(l.symbol=t&&Fr(t)||(r?a:[a])),null==l.symbolSize&&(l.symbolSize=n&&Fr(n)||(r?s[0]:[s[0],s[0]])),l.symbol=jG(l.symbol,function(e){return"none"===e?a:e});var p=l.symbolSize;if(null!=p){var c=-1/0;HG(p,function(e){e>c&&(c=e)}),l.symbolSize=jG(p,function(e){return YG(e,[0,c],[0,s[0]],!0)})}},this)}.call(this,a)},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(e){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(e){return null},t.prototype.getVisualMeta=function(e){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},t}(Bv),ZG=[20,140],QG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(e){e.mappingMethod="linear",e.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(null==t[0]||isNaN(t[0]))&&(t[0]=ZG[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=ZG[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):Jr(t)&&(t[0]>t[1]&&t.reverse(),t[0]=Math.max(t[0],e[0]),t[1]=Math.min(t[1],e[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),Hr(this.stateList,function(e){var t=this.option.controller[e].symbolSize;t&&t[0]!==t[1]&&(t[0]=t[1]/3)},this)},t.prototype.setSelected=function(e){this.option.range=e.slice(),this._resetRange()},t.prototype.getSelected=function(){var e=this.getExtent(),t=Jc((this.get("range")||[]).slice());return t[0]>e[1]&&(t[0]=e[1]),t[1]>e[1]&&(t[1]=e[1]),t[0]=n[1]||e<=t[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(e){var t=[];return this.eachTargetSeries(function(n){var i=[],a=n.getData();a.each(this.getDataDimensionIndex(a),function(t,n){e[0]<=t&&t<=e[1]&&i.push(n)},this),t.push({seriesId:n.id,dataIndex:i})},this),t},t.prototype.getVisualMeta=function(e){var t=JG(this,"outOfRange",this.getExtent()),n=JG(this,"inRange",this.option.range.slice()),i=[];function a(t,n){i.push({value:t,color:e(t,n)})}for(var r=0,o=0,s=n.length,l=t.length;oe[1])break;n.push({color:this.getControllerVisual(r,"color",t),offset:a/100})}return n.push({color:this.getControllerVisual(e[1],"color",t),offset:1}),n},t.prototype._createBarPoints=function(e,t){var n=this.visualMapModel.itemSize;return[[n[0]-t[0],e[0]],[n[0],e[0]],[n[0],e[1]],[n[0]-t[1],e[1]]]},t.prototype._createBarGroup=function(e){var t=this._orient,n=this.visualMapModel.get("inverse");return new qc("horizontal"!==t||n?"horizontal"===t&&n?{scaleX:"bottom"===e?-1:1,rotation:-Math.PI/2}:"vertical"!==t||n?{scaleX:"left"===e?1:-1}:{scaleX:"left"===e?1:-1,scaleY:-1}:{scaleX:"bottom"===e?1:-1,rotation:Math.PI/2})},t.prototype._updateHandle=function(e,t){if(this._useHandle){var n=this._shapes,i=this.visualMapModel,a=n.handleThumbs,r=n.handleLabels,o=i.itemSize,s=i.getExtent();rz([0,1],function(l){var p=a[l];p.setStyle("fill",t.handlesColor[l]),p.y=e[l];var c=az(e[l],[0,o[1]],s,!0),d=this.getControllerVisual(c,"symbolSize");p.scaleX=p.scaleY=d/o[0],p.x=o[0]-d/2;var u=Lf(n.handleLabelPoints[l],Nf(p,this.group));r[l].setStyle({x:u[0],y:u[1],text:i.formatValueText(this._dataInterval[l]),verticalAlign:"middle",align:"vertical"===this._orient?this._applyTransform("left",n.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(e,t,n,i){var a=this.visualMapModel,r=a.getExtent(),o=a.itemSize,s=[0,o[1]],l=this._shapes,p=l.indicator;if(p){p.attr("invisible",!1);var c=this.getControllerVisual(e,"color",{convertOpacityToAlpha:!0}),d=this.getControllerVisual(e,"symbolSize"),u=az(e,r,s,!0),m=o[0]-d/2,h={x:p.x,y:p.y};p.y=u,p.x=m;var g=Lf(l.indicatorLabelPoint,Nf(p,this.group)),f=l.indicatorLabel;f.attr("invisible",!1);var y=this._applyTransform("left",l.mainGroup),v="horizontal"===this._orient;f.setStyle({text:(n||"")+a.formatValueText(t),verticalAlign:v?y:"middle",align:v?"center":y});var x={x:m,y:u,style:{fill:c}},b={style:{x:g[0],y:g[1]}};if(a.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var w={duration:100,easing:"cubicInOut",additive:!0};p.x=h.x,p.y=h.y,p.animateTo(x,w),f.animateTo(b,w)}else p.attr(x),f.attr(b);this._firstShowIndicator=!1;var S=this._shapes.handleLabels;if(S)for(var C=0;Ca[1]&&(p[1]=1/0),t&&(p[0]===-1/0?this._showIndicator(l,p[1],"< ",o):p[1]===1/0?this._showIndicator(l,p[0],"> ",o):this._showIndicator(l,l,"≈ ",o));var c=this._hoverLinkDataIndices,d=[];(t||cz(n))&&(d=this._hoverLinkDataIndices=n.findTargetDataIndices(p));var u=function(e,t){var n={},i={};return a(e||[],n),a(t||[],i,n),[r(n),r(i)];function a(e,t,n){for(var i=0,a=e.length;i=0&&(a.dimension=r,i.push(a))}}),e.getData().setVisual("visualMeta",i)}}];function gz(e,t,n,i){for(var a=t.targetVisuals[i],r=bA.prepareVisualTypes(a),o={color:kS(e.getData(),"color")},s=0,l=r.length;s0:e.splitNumber>0)&&!e.calculable?"piecewise":"continuous"}),e.registerAction(uz,mz),Hr(hz,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(yz))}function wz(e){e.registerComponentModel(QG),e.registerComponentView(lz),bz(e)}var Sz=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return Xe(t,e),t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],Cz[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var a=this.option.categories;this.resetVisual(function(e,t){"categories"===i?(e.mappingMethod="category",e.categories=Fr(a)):(e.dataExtent=this.getExtent(),e.mappingMethod="piecewise",e.pieceList=Wr(this._pieceList,function(e){return e=Fr(e),"inRange"!==t&&(e.visual=null),e}))})},t.prototype.completeVisualOption=function(){var t=this.option,n={},i=bA.listVisualTypes(),a=this.isCategory();function r(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}Hr(t.pieces,function(e){Hr(i,function(t){e.hasOwnProperty(t)&&(n[t]=1)})}),Hr(n,function(e,n){var i=!1;Hr(this.stateList,function(e){i=i||r(t,e,n)||r(t.target,e,n)},this),!i&&Hr(this.stateList,function(e){(t[e]||(t[e]={}))[n]=zG(n,"inRange"===e?"active":"inactive",a)})},this),e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(e,t){var n=this.option,i=this._pieceList,a=(t?n:e).selected||{};if(n.selected=a,Hr(i,function(e,t){var n=this.getSelectedMapKey(e);a.hasOwnProperty(n)||(a[n]=!0)},this),"single"===n.selectedMode){var r=!1;Hr(i,function(e,t){var n=this.getSelectedMapKey(e);a[n]&&(r?a[n]=!1:r=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(e){return"categories"===this._mode?e.value+"":e.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var e=this.option;return e.pieces&&e.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(e){this.option.selected=Fr(e)},t.prototype.getValueState=function(e){var t=bA.findPieceIndex(e,this._pieceList);return null!=t&&this.option.selected[this.getSelectedMapKey(this._pieceList[t])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(e){var t=[],n=this._pieceList;return this.eachTargetSeries(function(i){var a=[],r=i.getData();r.each(this.getDataDimensionIndex(r),function(t,i){bA.findPieceIndex(t,n)===e&&a.push(i)},this),t.push({seriesId:i.id,dataIndex:a})},this),t},t.prototype.getRepresentValue=function(e){var t;if(this.isCategory())t=e.value;else if(null!=e.value)t=e.value;else{var n=e.interval||[];t=n[0]===-1/0&&n[1]===1/0?0:(n[0]+n[1])/2}return t},t.prototype.getVisualMeta=function(e){if(!this.isCategory()){var t=[],n=["",""],i=this,a=this._pieceList.slice();if(a.length){var r=a[0].interval[0];r!==-1/0&&a.unshift({interval:[-1/0,r]}),(r=a[a.length-1].interval[1])!==1/0&&a.push({interval:[r,1/0]})}else a.push({interval:[-1/0,1/0]});var o=-1/0;return Hr(a,function(e){var t=e.interval;t&&(t[0]>o&&s([o,t[0]],"outOfRange"),s(t.slice()),o=t[1])},this),{stops:t,outerColors:n}}function s(a,r){var o=i.getRepresentValue({interval:a});r||(r=i.getValueState(o));var s=e(o,r);a[0]===-1/0?n[0]=s:a[1]===1/0?n[1]=s:t.push({value:a[0],color:s},{value:a[1],color:s})}},t.type="visualMap.piecewise",t.defaultOption=Iy(XG.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}(XG),Cz={splitNumber:function(e){var t=this.option,n=Math.min(t.precision,20),i=this.getExtent(),a=t.splitNumber;a=Math.max(parseInt(a,10),1),t.splitNumber=a;for(var r=(i[1]-i[0])/a;+r.toFixed(n)!==r&&n<5;)n++;t.precision=n,r=+r.toFixed(n),t.minOpen&&e.push({interval:[-1/0,i[0]],close:[0,0]});for(var o=0,s=i[0];o","≥"][t[0]]];e.text=e.text||this.formatValueText(null!=e.value?e.value:e.interval,!1,n)},this)}};function _z(e,t){var n=e.inverse;("vertical"===e.orient?!n:n)&&t.reverse()}var Tz=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return Xe(t,e),t.prototype.doRender=function(){var e=this.group;e.removeAll();var t=this.visualMapModel,n=t.get("textGap"),i=t.textStyleModel,a=i.getFont(),r=i.getTextColor(),o=this._getItemAlign(),s=t.itemSize,l=this._getViewData(),p=l.endsText,c=mo(t.get("showLabel",!0),!p);p&&this._renderEndsText(e,p[0],s,c,o),Hr(l.viewPieceList,function(i){var l=i.piece,p=new qc;p.onclick=Zr(this._onItemClick,this,l),this._enableHoverLink(p,i.indexInModelPieceList);var d=t.getRepresentValue(l);if(this._createItemSymbol(p,d,[0,0,s[0],s[1]]),c){var u=this.visualMapModel.getValueState(d);p.add(new Um({style:{x:"right"===o?-n:s[0]+n,y:s[1]/2,text:l.text,verticalAlign:"middle",align:o,font:a,fill:r,opacity:"outOfRange"===u?.5:1}}))}e.add(p)},this),p&&this._renderEndsText(e,p[1],s,c,o),Mv(t.get("orient"),e,t.get("itemGap")),this.renderBackground(e),this.positionGroup(e)},t.prototype._enableHoverLink=function(e,t){var n=this;e.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(e){var i=n.visualMapModel;i.option.hoverLink&&n.api.dispatchAction({type:e,batch:iz(i.findTargetDataIndices(t),i)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if("vertical"===t.orient)return nz(e,this.api,e.itemSize);var n=t.align;return n&&"auto"!==n||(n="left"),n},t.prototype._renderEndsText=function(e,t,n,i,a){if(t){var r=new qc,o=this.visualMapModel.textStyleModel;r.add(new Um({style:iy(o,{x:i?"right"===a?n[0]:0:n[0]/2,y:n[1]/2,verticalAlign:"middle",align:i?a:"center",text:t})})),e.add(r)}},t.prototype._getViewData=function(){var e=this.visualMapModel,t=Wr(e.getPieceList(),function(e,t){return{piece:e,indexInModelPieceList:t}}),n=e.get("text"),i=e.get("orient"),a=e.get("inverse");return("horizontal"===i?a:!a)?t.reverse():n&&(n=n.slice().reverse()),{viewPieceList:t,endsText:n}},t.prototype._createItemSymbol=function(e,t,n){e.add(HS(this.getControllerVisual(t,"symbol"),n[0],n[1],n[2],n[3],this.getControllerVisual(t,"color")))},t.prototype._onItemClick=function(e){var t=this.visualMapModel,n=t.option,i=n.selectedMode;if(i){var a=Fr(n.selected),r=t.getSelectedMapKey(e);"single"===i||!0===i?(a[r]=!0,Hr(a,function(e,t){a[t]=t===r})):a[r]=!a[r],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:a})}},t.type="visualMap.piecewise",t}(ez);function Ez(e){e.registerComponentModel(Sz),e.registerComponentView(Tz),bz(e)}function Mz(e){xE(wz),xE(Ez)}Bd();var Iz={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},kz=function(){function e(e){if(null==(this._condVal=to(e)?new RegExp(e):co(e)?e:null)){var t="";0,xd(t)}}return e.prototype.evaluate=function(e){var t=typeof e;return to(t)?this._condVal.test(e):!!io(t)&&this._condVal.test(e+"")},e}(),Pz=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),Dz=function(){function e(){}return e.prototype.evaluate=function(){for(var e=this.children,t=0;t=Gz:-l>=Gz),u=l>0?l%Gz:l%Gz+Gz,m=!1;m=!!d||!mp(c)&&u>=qz==!!p;var h=e+n*Vz(r),g=t+i*Lz(r);this._start&&this._add("M",h,g);var f=Math.round(a*zz);if(d){var y=1/this._p,v=(p?1:-1)*(Gz-y);this._add("A",n,i,f,1,+p,e+n*Vz(r+v),t+i*Lz(r+v)),y>.01&&this._add("A",n,i,f,0,+p,h,g)}else{var x=e+n*Vz(o),b=t+i*Lz(o);this._add("A",n,i,f,+m,+p,x,b)}},e.prototype.rect=function(e,t,n,i){this._add("M",e,t),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},e.prototype.closePath=function(){this._d.length>0&&this._add("Z")},e.prototype._add=function(e,t,n,i,a,r,o,s,l){for(var p=[],c=this._p,d=1;d"}(a,r)+("style"!==a?ps(o):o||"")+(i?""+n+Wr(i,function(t){return e(t)}).join(n)+n:"")+("")}(e)}function tU(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function nU(e,t,n,i){return Jz("svg","root",{width:e,height:t,xmlns:Yz,"xmlns:xlink":Xz,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+e+" "+t},n)}var iU=0;function aU(){return iU++}var rU={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},oU="transform-origin";function sU(e,t,n){var i=Vr({},e.shape);Vr(i,t),e.buildPath(n,i);var a=new Uz;return a.reset(Cp(e)),n.rebuildPath(a,1),a.generateStr(),a.getStr()}function lU(e,t){var n=t.originX,i=t.originY;(n||i)&&(e[oU]=n+"px "+i+"px")}var pU={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function cU(e,t){var n=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function dU(e){return to(e)?rU[e]?"cubic-bezier("+rU[e]+")":Fl(e)?e:"":""}function uU(e,t,n,i){var a=e.animators,r=a.length,o=[];if(e instanceof ef){var s=function(e,t,n){var i,a,r=e.shape.paths,o={};if(Hr(r,function(e){var t=tU(n.zrId);t.animation=!0,uU(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,l=Xr(r),p=l.length;if(p){var c=r[a=l[p-1]];for(var d in c){var u=c[d];o[d]=o[d]||{d:""},o[d].d+=u.d||""}for(var m in s){var h=s[m].animation;h.indexOf(a)>=0&&(i=h)}}}),i){t.d=!1;var s=cU(o,n);return i.replace(a,s)}}(e,t,n);if(s)o.push(s);else if(!r)return}else if(!r)return;for(var l={},p=0;p0}).length)return cU(c,n)+" "+a[0]+" both"}for(var f in l){(s=g(l[f]))&&o.push(s)}if(o.length){var y=n.zrId+"-cls-"+aU();n.cssNodes["."+y]={animation:o.join(",")},t.class=y}}function mU(e,t,n,i){var a=JSON.stringify(e),r=n.cssStyleCache[a];r||(r=n.zrId+"-cls-"+aU(),n.cssStyleCache[a]=r,n.cssNodes["."+r+(i?":hover":"")]=e),t.class=t.class?t.class+" "+r:r}var hU=Math.round;function gU(e){return e&&to(e.src)}function fU(e){return e&&eo(e.toDataURL)}function yU(e,t,n,i){Kz(function(a,r){var o="fill"===a||"stroke"===a;o&&wp(r)?IU(t,e,a,i):o&&vp(r)?kU(n,e,a,i):e[a]=o&&"none"===r?"transparent":r},t,n,!1),function(e,t,n){var i=e.style;if(function(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}(i)){var a=function(e){var t=e.style,n=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),n[0],n[1]].join(",")}(e),r=n.shadowCache,o=r[a];if(!o){var s=e.getGlobalScale(),l=s[0],p=s[1];if(!l||!p)return;var c=i.shadowOffsetX||0,d=i.shadowOffsetY||0,u=i.shadowBlur,m=dp(i.shadowColor),h=m.opacity,g=m.color,f=u/2/l+" "+u/2/p;o=n.zrId+"-s"+n.shadowIdx++,n.defs[o]=Jz("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[Jz("feDropShadow","",{dx:c/l,dy:d/p,stdDeviation:f,"flood-color":g,"flood-opacity":h})]),r[a]=o}t.filter=Sp(o)}}(n,e,i)}function vU(e,t){var n=$c(t);n&&(n.each(function(t,n){null!=t&&(e[(Zz+n).toLowerCase()]=t+"")}),t.isSilent()&&(e[Zz+"silent"]="true"))}function xU(e){return mp(e[0]-1)&&mp(e[1])&&mp(e[2])&&mp(e[3]-1)}function bU(e,t,n){if(t&&(!function(e){return mp(e[4])&&mp(e[5])}(t)||!xU(t))){var i=n?10:1e4;e.transform=xU(t)?"translate("+hU(t[4]*i)/i+" "+hU(t[5]*i)/i+")":function(e){return"matrix("+hp(e[0])+","+hp(e[1])+","+hp(e[2])+","+hp(e[3])+","+gp(e[4])+","+gp(e[5])+")"}(t)}}function wU(e,t,n){for(var i=e.points,a=[],r=0;r=0&&o||r;s&&(a=pp(s))}var l=i.lineWidth;l&&(l/=!i.strokeNoScale&&e.transform?e.transform[0]:1);var p={cursor:"pointer"};a&&(p.fill=a),i.stroke&&(p.stroke=i.stroke),l&&(p["stroke-width"]=l),mU(p,t,n,!0)}}(e,r,t),Jz(s,e.id+"",r)}function MU(e,t){return e instanceof Im?EU(e,t):e instanceof Om?function(e,t){var n=e.style,i=n.image;if(i&&!to(i)&&(gU(i)?i=i.src:fU(i)&&(i=i.toDataURL())),i){var a=n.x||0,r=n.y||0,o={href:i,width:n.width,height:n.height};return a&&(o.x=a),r&&(o.y=r),bU(o,e.transform),yU(o,n,e,t),vU(o,e),t.animation&&uU(e,o,t),Jz("image",e.id+"",o)}}(e,t):e instanceof Pm?function(e,t){var n=e.style,i=n.text;if(null!=i&&(i+=""),i&&!isNaN(n.x)&&!isNaN(n.y)){var a=n.font||yr,r=n.x||0,o=function(e,t,n){return"top"===n?e+=t/2:"bottom"===n&&(e-=t/2),e}(n.y||0,Mc(a),n.textBaseline),s={"dominant-baseline":"central","text-anchor":fp[n.textAlign]||n.textAlign};if(Ym(n)){var l="",p=n.fontStyle,c=$m(n.fontSize);if(!parseFloat(c))return;var d=n.fontFamily||fr,u=n.fontWeight;l+="font-size:"+c+";font-family:"+d+";",p&&"normal"!==p&&(l+="font-style:"+p+";"),u&&"normal"!==u&&(l+="font-weight:"+u+";"),s.style=l}else s.style="font: "+a;return i.match(/\s/)&&(s["xml:space"]="preserve"),r&&(s.x=r),o&&(s.y=o),bU(s,e.transform),yU(s,n,e,t),vU(s,e),t.animation&&uU(e,s,t),Jz("text",e.id+"",s,void 0,i)}}(e,t):void 0}function IU(e,t,n,i){var a,r=e[n],o={gradientUnits:r.global?"userSpaceOnUse":"objectBoundingBox"};if(xp(r))a="linearGradient",o.x1=r.x,o.y1=r.y,o.x2=r.x2,o.y2=r.y2;else{if(!bp(r))return void 0;a="radialGradient",o.cx=ho(r.x,.5),o.cy=ho(r.y,.5),o.r=ho(r.r,.5)}for(var s=r.colorStops,l=[],p=0,c=s.length;pl?jU(e,null==n[d+1]?null:n[d+1].elm,n,s,d):HU(e,t,o,l))}(n,i,a):qU(a)?(qU(e.text)&&NU(n,""),jU(n,null,a,0,a.length-1)):qU(i)?HU(n,i,0,i.length-1):qU(e.text)&&NU(n,""):e.text!==t.text&&(qU(i)&&HU(n,i,0,i.length-1),NU(n,t.text)))}var KU=0,YU=function(){function e(e,t,n){if(this.type="svg",this.refreshHover=XU("refreshHover"),this.configLayer=XU("configLayer"),this.storage=t,this._opts=n=Vr({},n),this.root=e,this._id="zr"+KU++,this._oldVNode=nU(n.width,n.height),e&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var a=this._svgDom=this._oldVNode.elm=Qz("svg");WU(null,this._oldVNode),i.appendChild(a),e.appendChild(i)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var e=this.renderToVNode({willUpdate:!0});e.attrs.style="position:absolute;left:0;top:0;user-select:none",function(e,t){if(zU(e,t))$U(e,t);else{var n=e.elm,i=BU(n);UU(t),null!==i&&(AU(i,t.elm,FU(n)),HU(i,[e],0,0))}}(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return MU(e,tU(this._id))},e.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),n=this._width,i=this._height,a=tU(this._id);a.animation=e.animation,a.willUpdate=e.willUpdate,a.compress=e.compress,a.emphasis=e.emphasis;var r=[],o=this._bgVNode=function(e,t,n,i){var a;if(n&&"none"!==n)if(a=Jz("rect","bg",{width:e,height:t,x:"0",y:"0"}),wp(n))IU({fill:n},a.attrs,"fill",i);else if(vp(n))kU({style:{fill:n},dirty:Do,getBoundingRect:function(){return{width:e,height:t}}},a.attrs,"fill",i);else{var r=dp(n),o=r.color,s=r.opacity;a.attrs.fill=o,s<1&&(a.attrs["fill-opacity"]=s)}return a}(n,i,this._backgroundColor,a);o&&r.push(o);var s=e.compress?null:this._mainVNode=Jz("g","main",{},[]);this._paintList(t,a,s?s.children:r),s&&r.push(s);var l=Wr(Xr(a.defs),function(e){return a.defs[e]});if(l.length&&r.push(Jz("defs","defs",{},l)),e.animation){var p=function(e,t,n){var i=(n=n||{}).newline?"\n":"",a=" {"+i,r=i+"}",o=Wr(Xr(e),function(t){return t+a+Wr(Xr(e[t]),function(n){return n+":"+e[t][n]+";"}).join(i)+r}).join(i),s=Wr(Xr(t),function(e){return"@keyframes "+e+a+Wr(Xr(t[e]),function(n){return n+a+Wr(Xr(t[e][n]),function(i){var a=t[e][n][i];return"d"===i&&(a='path("'+a+'")'),i+":"+a+";"}).join(i)+r}).join(i)+r}).join(i);return o||s?[""].join(i):""}(a.cssNodes,a.cssAnims,{newline:!0});if(p){var c=Jz("style","stl",{},[],p);r.push(c)}}return nU(n,i,r,e.useViewBox)},e.prototype.renderToString=function(e){return e=e||{},eU(this.renderToVNode({animation:ho(e.cssAnimation,!0),emphasis:ho(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:ho(e.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(e,t,n){for(var i,a,r=e.length,o=[],s=0,l=0,p=0;p=0&&(!d||!a||d[h]!==a[h]);h--);for(var g=m-1;g>h;g--)i=o[--s-1];for(var f=h+1;f=o)}}for(var c=this.__startIndex;c15)break}n.prevElClipPaths&&d.restore()};if(m)if(0===m.length)s=l.__endIndex;else for(var b=u.dpr,w=0;w0&&e>i[0]){for(s=0;se);s++);o=n[i[s]]}if(i.splice(s+1,0,e),n[e]=t,!t.virtual)if(o){var l=o.dom;l.nextSibling?r.insertBefore(t.dom,l.nextSibling):r.appendChild(t.dom)}else r.firstChild?r.insertBefore(t.dom,r.firstChild):r.appendChild(t.dom);t.painter||(t.painter=this)}},e.prototype.eachLayer=function(e,t){for(var n=this._zlevelList,i=0;i0?nj:0),this._needsManuallyCompositing),p.__builtin__||Br("ZLevel "+l+" has been used by unkown layer "+p.id),p!==r&&(p.__used=!0,p.__startIndex!==a&&(p.__dirty=!0),p.__startIndex=a,p.incremental?p.__drawIndex=-1:p.__drawIndex=a,t(a),r=p),1&s.__dirty&&!s.__inHover&&(p.__dirty=!0,p.incremental&&p.__drawIndex<0&&(p.__drawIndex=a))}t(a),this.eachBuiltinLayer(function(e,t){!e.__used&&e.getElementCount()>0&&(e.__dirty=!0,e.__startIndex=e.__endIndex=e.__drawIndex=0),e.__dirty&&e.__drawIndex<0&&(e.__drawIndex=e.__startIndex)})},e.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},e.prototype._clearLayer=function(e){e.clear()},e.prototype.setBackgroundColor=function(e){this._backgroundColor=e,Hr(this._layers,function(e){e.setUnpainted()})},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?Nr(n[e],t,!0):n[e]=t;for(var i=0;i({legendKey:e,left:!0}),sj=e=>({background:e});function lj(e,n){1&e&&t.ɵɵelementContainer(0)}function pj(e,n){if(1&e&&t.ɵɵtemplate(0,lj,1,0,"ng-container",7),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("ngTemplateOutlet",e.widgetTitlePanel)}}function cj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Min")))}function dj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Max")))}function uj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Avg")))}function mj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Total")))}function hj(e,n){1&e&&(t.ɵɵelementStart(0,"th",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Latest")))}function gj(e,n){1&e&&t.ɵɵelementContainer(0)}function fj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].min,"html"),t.ɵɵsanitizeHtml)}}function yj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].max,"html"),t.ɵɵsanitizeHtml)}}function vj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].avg,"html"),t.ɵɵsanitizeHtml)}}function xj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].total,"html"),t.ɵɵsanitizeHtml)}}function bj(e,n){if(1&e&&(t.ɵɵelement(0,"td",11),t.ɵɵpipe(1,"safe")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(1,1,n.legendData.data[e.dataIndex].latest,"html"),t.ɵɵsanitizeHtml)}}function wj(e,n){if(1&e&&(t.ɵɵelementStart(0,"tr")(1,"th"),t.ɵɵtemplate(2,gj,1,0,"ng-container",10),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(3,fj,2,4,"td",11),t.ɵɵconditionalCreate(4,yj,2,4,"td",11),t.ɵɵconditionalCreate(5,vj,2,4,"td",11),t.ɵɵconditionalCreate(6,xj,2,4,"td",11),t.ɵɵconditionalCreate(7,bj,2,4,"td",11),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2),a=t.ɵɵreference(8);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",a)("ngTemplateOutletContext",t.ɵɵpureFunction1(7,oj,e)),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showMin?3:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showMax?4:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showAvg?5:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showTotal?6:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===i.legendConfig.showLatest?7:-1)}}function Sj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",6)(1,"table",8)(2,"thead")(3,"tr"),t.ɵɵelement(4,"th"),t.ɵɵconditionalCreate(5,cj,3,3,"th",9),t.ɵɵconditionalCreate(6,dj,3,3,"th",9),t.ɵɵconditionalCreate(7,uj,3,3,"th",9),t.ɵɵconditionalCreate(8,mj,3,3,"th",9),t.ɵɵconditionalCreate(9,hj,3,3,"th",9),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"tbody"),t.ɵɵrepeaterCreate(11,wj,8,9,"tr",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵconditional(!0===e.legendConfig.showMin?5:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showMax?6:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showAvg?7:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showTotal?8:-1),t.ɵɵadvance(),t.ɵɵconditional(!0===e.legendConfig.showLatest?9:-1),t.ɵɵadvance(2),t.ɵɵrepeater(e.legendKeys)}}function Cj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelement(2,"div",14)(3,"div",15),t.ɵɵpipe(4,"safe"),t.ɵɵelementEnd()()),2&e){const e=n.legendKey,i=n.left;t.ɵɵclassProp("left",i),t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction1(8,sj,e.dataKey.color)),t.ɵɵadvance(),t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(4,5,e.dataKey.label,"html"),t.ɵɵsanitizeHtml)}}class _j{constructor(e,t,n){this.renderer=e,this.sanitizer=t,this.widgetComponent=n,this.updateXAxisTimeWindow=(e,t)=>{e.min=t.minTime,e.max=t.maxTime}}ngOnInit(){this.initEchart(),this.initLegend()}ngAfterViewInit(){this.myChart=function(e,t,n){var i=!(n&&n.ssr);if(i){var a=y_(e);if(a)return a}var r=new n_(e,t,n);return r.id="ec_"+g_++,m_[r.id]=r,i&&zd(e,f_,r.id),ZC(r),SC.trigger("afterinit",r),r}(this.echartContainer.nativeElement,null,{renderer:"svg"}),this.initResize(),this.xAxis=this.setupXAxis(),this.yAxis=this.setupYAxis(),this.option={...this.setupAnimationSettings(),formatter:e=>this.setupTooltipElement(e),backgroundColor:"transparent",darkMode:!1,tooltip:{show:!0,trigger:"axis",confine:!0,padding:[8,12],appendTo:"body",textStyle:{fontFamily:"Roboto",fontSize:12,fontWeight:"normal",lineHeight:16}},grid:[{backgroundColor:null,borderColor:"#ccc",borderWidth:1,bottom:45,left:5,right:5,show:!1,top:10}],xAxis:[this.xAxis],yAxis:[this.yAxis],series:this.setupChartLines(),dataZoom:[{type:"inside",disabled:!1,realtime:!0,filterMode:"none"},{type:"slider",show:!0,showDetail:!1,realtime:!0,filterMode:"none",bottom:5}]},this.myChart.setOption(this.option),this.updateAxisOffset(!1)}onDataUpdated(){const e=[];this.onResize(),this.updateXAxisTimeWindow(this.xAxis,this.ctx.defaultSubscription.timeWindow);for(const t in this.ctx.data){e[t]=[];for(const[n,i]of this.ctx.data[t].data)e[t].push({name:n,value:[n,i]})}const t=[];for(const n of e)t.push({data:n});this.option.series=t,this.myChart.setOption(this.option),this.updateAxisOffset()}updateAxisOffset(e=!0){const t=nt(this.myChart,this.yAxis.mainType,this.yAxis.id),n=it(this.myChart,this.yAxis.mainType,this.yAxis.id,this.yAxis.name),i=nt(this.myChart,this.xAxis.mainType,this.xAxis.id),a=t+n,r=i+it(this.myChart,this.yAxis.mainType,this.yAxis.id,this.yAxis.name)+35;this.option.grid[0].left===a&&this.option.grid[0].bottom===r||(this.option.grid[0].left=a,this.yAxis.nameGap=t,this.option.grid[0].bottom=r,this.xAxis.nameGap=i,this.myChart.setOption(this.option,{replaceMerge:["yAxis","xAxis","grid"],lazyUpdate:e}))}initEchart(){xE([mq,WN,Mz,GG,eG,_L,yP,gI,GI,rk,vP,sN,kM,aj,ZU])}initLegend(){this.showLegend=this.ctx.settings.showLegend,this.showLegend&&(this.legendConfig=this.ctx.settings.legendConfig,this.legendData=this.ctx.defaultSubscription.legendData,this.legendKeys=this.legendData.keys,this.legendClass=`legend-${this.legendConfig.position}`,this.legendConfig.sortDataKeys?this.legendKeys=this.legendData.keys.sort((e,t)=>e.dataKey.label.localeCompare(t.dataKey.label)):this.legendKeys=this.legendData.keys)}initResize(){this.shapeResize$=new ResizeObserver(()=>{this.onResize()}),this.shapeResize$.observe(this.echartContainer.nativeElement)}onResize(){this.myChart.resize()}setupTooltipElement(e){const t=this.renderer.createElement("div");if(this.renderer.setStyle(t,"display","flex"),this.renderer.setStyle(t,"flex-direction","column"),this.renderer.setStyle(t,"align-items","flex-start"),this.renderer.setStyle(t,"gap","16px"),e.length){const n=this.renderer.createElement("div");this.renderer.setStyle(n,"display","flex"),this.renderer.setStyle(n,"flex-direction","column"),this.renderer.setStyle(n,"align-items","flex-start"),this.renderer.setStyle(n,"gap","4px"),this.renderer.appendChild(n,this.setTooltipDate(e));for(const[t,i]of e.entries())this.renderer.appendChild(n,this.constructTooltipSeriesElement(i,t));this.renderer.appendChild(t,n)}return t}constructTooltipSeriesElement(e,t){const n=this.renderer.createElement("div");this.renderer.setStyle(n,"display","flex"),this.renderer.setStyle(n,"flex-direction","row"),this.renderer.setStyle(n,"align-items","center"),this.renderer.setStyle(n,"align-self","stretch"),this.renderer.setStyle(n,"gap","12px");const i=this.renderer.createElement("div");this.renderer.setStyle(i,"display","flex"),this.renderer.setStyle(i,"align-items","center"),this.renderer.setStyle(i,"gap","8px"),this.renderer.appendChild(n,i);const a=this.renderer.createElement("div");this.renderer.setStyle(a,"width","8px"),this.renderer.setStyle(a,"height","8px"),this.renderer.setStyle(a,"border-radius","50%"),this.renderer.setStyle(a,"background",e.color),this.renderer.appendChild(i,a);const r=this.renderer.createElement("div");this.renderer.setProperty(r,"innerHTML",this.sanitizer.sanitize(u.HTML,e.seriesName)),this.renderer.setStyle(r,"font-family","Roboto"),this.renderer.setStyle(r,"font-size","12px"),this.renderer.setStyle(r,"font-style","normal"),this.renderer.setStyle(r,"font-weight",400),this.renderer.setStyle(r,"line-height","16px"),this.renderer.setStyle(r,"color","rgba(0, 0, 0, 0.76)"),this.renderer.appendChild(i,r);const o=ne(this.ctx.data[t].dataKey.decimals)?this.ctx.data[t].dataKey.decimals:this.ctx.decimals,s=ne(this.ctx.data[t].dataKey.units)?this.ctx.data[t].dataKey.units:this.ctx.units,l=ie(e.value[1],o,s,!1),p=this.renderer.createElement("div");return this.renderer.setProperty(p,"innerHTML",this.sanitizer.sanitize(u.HTML,l)),this.renderer.setStyle(p,"flex","1"),this.renderer.setStyle(p,"text-align","end"),this.renderer.setStyle(p,"font-family","Roboto"),this.renderer.setStyle(p,"font-size","12px"),this.renderer.setStyle(p,"font-style","normal"),this.renderer.setStyle(p,"font-weight",500),this.renderer.setStyle(p,"line-height","16px"),this.renderer.setStyle(p,"color","rgba(0, 0, 0, 0.76)"),this.renderer.appendChild(n,p),n}setTooltipDate(e){const t=this.renderer.createElement("div");return this.renderer.appendChild(t,this.renderer.createText(new Date(e[0].value[0]).toLocaleString("en-GB"))),this.renderer.setStyle(t,"font-family","Roboto"),this.renderer.setStyle(t,"font-size","11px"),this.renderer.setStyle(t,"font-style","normal"),this.renderer.setStyle(t,"font-weight","400"),this.renderer.setStyle(t,"line-height","16px"),this.renderer.setStyle(t,"color","rgba(0, 0, 0, 0.76)"),t}setupAnimationSettings(){return{animation:!0,animationDelay:0,animationDelayUpdate:0,animationDuration:500,animationDurationUpdate:300,animationEasing:"cubicOut",animationEasingUpdate:"cubicOut",animationThreshold:2e3}}setupChartLines(){const e=[];for(const[t,n]of this.ctx.datasources[0].dataKeys.entries())e.push({id:t,name:n.label,type:"line",showSymbol:!1,smooth:!1,step:!1,stackStrategy:"all",data:[],lineStyle:{color:n.color},itemStyle:{color:n.color}});return e}setupYAxis(){return{type:"value",position:"left",mainType:"yAxis",id:"yAxis",offset:0,nameLocation:"middle",nameRotate:90,alignTicks:!0,scale:!0,show:!0,axisLabel:{color:"rgba(0, 0, 0, 0.54)",fontFamily:"Roboto",fontSize:12,fontStyle:"normal",fontWeight:400,show:!0,formatter:e=>ie(e,this.ctx.decimals,this.ctx.units,!1)},splitLine:{show:!0},axisLine:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.54)"}},axisTick:{lineStyle:{color:"rgba(0, 0, 0, 0.54)"},show:!0},nameTextStyle:{color:"rgba(0, 0, 0, 0.54)",fontFamily:"Roboto",fontSize:12,fontStyle:"normal",fontWeight:600}}}setupXAxis(){return{id:"xAxis",mainType:"xAxis",show:!0,type:"time",position:"bottom",offset:0,nameLocation:"middle",max:this.ctx.defaultSubscription.timeWindow.maxTime,min:this.ctx.defaultSubscription.timeWindow.minTime,nameTextStyle:{color:"rgba(0, 0, 0, 0.54)",fontStyle:"normal",fontWeight:600,fontFamily:"Roboto",fontSize:12},axisPointer:{shadowStyle:{color:"rgba(210,219,238,0.2)"}},splitLine:{show:!0},axisTick:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.54)"}},axisLine:{onZero:!1,show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.54)"}},axisLabel:{color:"rgba(0, 0, 0, 0.54)",fontFamily:"Roboto",fontSize:10,fontStyle:"normal",fontWeight:400,show:!0,hideOverlap:!0}}}static{this.ɵfac=function(e){return new(e||_j)(t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(at.DomSanitizer),t.ɵɵdirectiveInject(rt.WidgetComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:_j,selectors:[["tb-gateway-statistics-chart"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(rj,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.echartContainer=e.first)}},inputs:{ctx:"ctx",widgetTitlePanel:"widgetTitlePanel"},decls:9,vars:4,consts:[["echartContainer",""],["legendItem",""],[1,"tb-time-series-chart-panel"],[1,"tb-time-series-chart-overlay"],[1,"tb-time-series-chart-content"],[1,"tb-time-series-chart-shape"],[1,"tb-time-series-chart-legend"],[4,"ngTemplateOutlet"],[1,"tb-time-series-chart-legend-table","vertical"],[1,"tb-time-series-chart-legend-type-label","right","legend","legend-row-color"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"tb-time-series-chart-legend-value","legend",3,"innerHTML"],[1,"tb-time-series-chart-legend-item"],[1,"tb-time-series-chart-legend-item-label"],[1,"tb-time-series-chart-legend-item-label-circle"],[1,"legend","legend-label-color",3,"innerHTML"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",2),t.ɵɵelement(1,"div",3),t.ɵɵconditionalCreate(2,pj,1,1,"ng-container"),t.ɵɵelementStart(3,"div",4),t.ɵɵelement(4,"div",5,0),t.ɵɵconditionalCreate(6,Sj,13,5,"div",6),t.ɵɵtemplate(7,Cj,5,10,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵconditional(n.widgetComponent.dashboardWidget.showWidgetTitlePanel?2:-1),t.ɵɵadvance(),t.ɵɵclassMap(n.legendClass),t.ɵɵadvance(3),t.ɵɵconditional(n.showLegend?6:-1))},dependencies:t.ɵɵgetComponentDepsFactory(_j,[ce,C]),styles:['@charset "UTF-8";.tb-time-series-chart-panel[_ngcontent-%COMP%]{width:100%;height:100%;position:relative;display:flex;flex-direction:column;gap:8px;padding:12px}.tb-time-series-chart-panel[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]:not(.tb-time-series-chart-overlay){z-index:1}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-overlay[_ngcontent-%COMP%]{position:absolute;inset:12px}.tb-time-series-chart-panel[_ngcontent-%COMP%] div.tb-widget-title[_ngcontent-%COMP%]{padding:0}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%]{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;gap:8px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%]{flex-direction:column-reverse}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-right[_ngcontent-%COMP%]{flex-direction:row}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-left[_ngcontent-%COMP%]{flex-direction:row-reverse}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-shape[_ngcontent-%COMP%]{flex:1;min-width:0;min-height:0;display:flex;align-items:center;justify-content:center}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-right[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-left[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]{display:inline-grid;grid-auto-flow:column;grid-template-rows:repeat(auto-fit,minmax(16px,min-content));max-width:calc(25% - 8px);height:fit-content;max-height:100%}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-bottom[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]{align-self:center}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%] .tb-time-series-chart-legend.tb-simple-legend[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-bottom[_ngcontent-%COMP%] .tb-time-series-chart-legend.tb-simple-legend[_ngcontent-%COMP%]{justify-content:center}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-top[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]:not(.tb-simple-legend), .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content.legend-bottom[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]:not(.tb-simple-legend){width:100%}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%]{display:flex;align-items:flex-start;align-self:stretch;column-gap:16px;row-gap:8px;flex-wrap:wrap;overflow:auto;width:fit-content;max-width:100%;max-height:calc(35% - 8px)}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%]{border-spacing:0;table-layout:fixed}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table.vertical[_ngcontent-%COMP%]{width:100%;table-layout:auto}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table.vertical[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{width:95%}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:not(:last-child), .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:not(:last-child){padding-right:16px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:not(:last-child) th[_ngcontent-%COMP%], .tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:not(:last-child) td[_ngcontent-%COMP%]{padding-bottom:8px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%]{align-items:flex-end}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-table[_ngcontent-%COMP%] .tb-time-series-chart-legend-item.left[_ngcontent-%COMP%]{align-items:flex-start}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;-webkit-user-select:none;user-select:none}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%] .tb-time-series-chart-legend-item-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;color:#ccc;white-space:nowrap;cursor:pointer}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-item[_ngcontent-%COMP%] .tb-time-series-chart-legend-item-label[_ngcontent-%COMP%] .tb-time-series-chart-legend-item-label-circle[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;background-color:#ccc}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-type-label[_ngcontent-%COMP%]{white-space:nowrap;text-align:left}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-type-label.right[_ngcontent-%COMP%]{text-align:right}.tb-time-series-chart-panel[_ngcontent-%COMP%] .tb-time-series-chart-content[_ngcontent-%COMP%] .tb-time-series-chart-legend[_ngcontent-%COMP%] .tb-time-series-chart-legend-value[_ngcontent-%COMP%]{white-space:nowrap;text-align:right}.tb-time-series-chart-panel[_ngcontent-%COMP%] .legend[_ngcontent-%COMP%]{font-size:12px;font-style:normal;font-weight:500;letter-spacing:normal;line-height:16px}.tb-time-series-chart-panel[_ngcontent-%COMP%] .legend.legend-row-color[_ngcontent-%COMP%]{color:#00000061}.tb-time-series-chart-panel[_ngcontent-%COMP%] .legend.legend-label-color[_ngcontent-%COMP%]{color:#000}']})}}const Tj=["statisticChart"];function Ej(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.openEditCommandDialog())}),t.ɵɵelementStart(2,"mat-icon",13),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",12),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onDeleteClick())}),t.ɵɵelementStart(6,"mat-icon",13),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"action.edit"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"action.delete"))))}function Mj(e,n){if(1&e&&t.ɵɵelement(0,"tb-gateway-statistics-chart",14,0),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("ctx",e.ctx)}}function Ij(e,n){if(1&e&&t.ɵɵelement(0,"tb-custom-statistics-table",15),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("data",e.subscriptionData)}}function kj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵconditionalCreate(1,Mj,2,1,"tb-gateway-statistics-chart",14)(2,Ij,1,1,"tb-custom-statistics-table",15),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵconditional(e.isNumericData?1:2)}}function Pj(e,n){1&e&&(t.ɵɵelementStart(0,"div",11),t.ɵɵelement(1,"div",16),t.ɵɵelementStart(2,"div",17),t.ɵɵtext(3,"attribute.no-telemetry-text"),t.ɵɵelementEnd()())}class Dj{constructor(e,t,n,i,a,r){this.fb=e,this.attributeService=t,this.destroyRef=n,this.dialog=i,this.dialogService=a,this.utils=r,this.subscriptionData=[],this.statisticForm=this.fb.group({command:[]}),this.isNumericData=!1,this.commands=[],this.subscribed=!1,this.dataTypeDefined=!1,this.subscriptionOptions={callbacks:{onDataUpdated:()=>this.ctx.ngZone.run(()=>{this.isDataOnlyNumbers(),this.isNumericData&&this.statisticChart?.onDataUpdated()}),onDataUpdateError:(e,t)=>this.ctx.ngZone.run(()=>{this.onDataUpdateError(t)})},useDashboardTimewindow:!1,legendConfig:A(S.timeseries)},this.statisticForm.get("command").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.subscribed=!1,this.subscriptionInfo&&e?.attributeOnGateway&&this.createSubscription(this.ctx.defaultSubscription.datasources[0].entity,e.attributeOnGateway)})}ngAfterViewInit(){if(this.ctx.defaultSubscription.datasources.length){const e=this.ctx.defaultSubscription.datasources[0].entity;if(e.id.id===O)return;this.getGatewayGeneralConfig().pipe(de(this.destroyRef)).subscribe(t=>{this.commands=t?.statistics.commands.reverse()??[],this.commands.length&&(this.statisticForm.get("command").setValue(this.commands[0]),this.createSubscription(e,this.commands[0].attributeOnGateway))})}}openEditCommandDialog(){const e=this.statisticForm.get("command").value,t="string"==typeof e||!e,n="string"==typeof e?{attributeOnGateway:e}:e;let i;this.dialog.open(mr,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{titleText:t?"gateway.statistics.create-command":"gateway.statistics.edit-command",buttonText:t?"action.add":"action.apply",command:n,existingCommands:this.commands.map(e=>e.attributeOnGateway)}}).afterClosed().pipe(Ue(e=>ke(this.getGatewayGeneralConfig(),Ie(e))),Ue(([e,t])=>(this.commands=[...e?.statistics.commands.filter(e=>e.attributeOnGateway!==t?.prev?.attributeOnGateway)??[],...t?.current?[{...t.current}]:[]],i=t?.current,this.updateStatisticsCommands(e,this.commands))),de(this.destroyRef)).subscribe(()=>{i&&this.statisticForm.get("command").patchValue(i)})}onDeleteClick(){const e=this.statisticForm.get("command").value.attributeOnGateway;this.dialogService.confirm(this.ctx.translate.instant("gateway.statistics.delete-command",{command:e}),this.ctx.translate.instant("gateway.statistics.delete-command-data"),this.ctx.translate.instant("action.cancel"),this.ctx.translate.instant("action.confirm")).pipe(ze(Boolean),Ue(()=>this.getGatewayGeneralConfig()),Ue(t=>(this.commands=[...t.statistics.commands.filter(t=>t.attributeOnGateway!==e)],this.updateStatisticsCommands(t,this.commands))),de(this.destroyRef)).subscribe()}getGatewayGeneralConfig(){const e=this.ctx.defaultSubscription.datasources[0].entity;return e.id.id===O?Ie(null):this.attributeService.getEntityAttributes(e.id,P.SHARED_SCOPE,["general_configuration"]).pipe(Ae(e=>e[0]?.value))}updateStatisticsCommands(e,t){const n=this.ctx.defaultSubscription.datasources[0].entity;return n.id.id!==O&&e?this.attributeService.saveEntityAttributes(n.id,P.SHARED_SCOPE,[{key:"general_configuration",value:{...e,statistics:{...e.statistics,commands:t}}}]):Ie(null)}createSubscription(e,t){const n=[{type:B.entity,entityType:R.DEVICE,entityId:e.id.id,entityName:e.name,timeseries:[]}];n[0].timeseries=[{name:t,label:t,settings:{}}],this.subscriptionInfo=n,this.changeSubscription(n)}onDataUpdateError(e){const t=this.utils.parseException(e);let n=t.name;t.message&&(n+=": "+t.message),console.error(n)}isDataOnlyNumbers(){this.subscriptionData=this.ctx.defaultSubscription.data[0]?.data??[],this.subscriptionData.length&&!this.dataTypeDefined&&(this.isNumericData=this.subscriptionData.every(e=>!isNaN(+e[1])),this.dataTypeDefined=!0),this.ctx.detectChanges()}changeSubscription(e){this.ctx.defaultSubscription?.unsubscribe(),this.ctx.datasources[0].entity&&this.ctx.subscriptionApi.createSubscriptionFromInfo(S.timeseries,e,this.subscriptionOptions,!1,!0).pipe(de(this.destroyRef)).subscribe(e=>{this.dataTypeDefined=!1,this.ctx.defaultSubscription=e,this.ctx.settings.showLegend=!1,this.ctx.data=e.data,this.ctx.datasources=e.datasources,this.isDataOnlyNumbers(),this.subscribed=!0})}static{this.ɵfac=function(e){return new(e||Dj)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(Z.AttributeService),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(Z.DialogService),t.ɵɵdirectiveInject(Z.UtilsService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Dj,selectors:[["tb-gateway-statistics"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Tj,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.statisticChart=e.first)}},inputs:{ctx:"ctx"},decls:18,vars:13,consts:[["statisticChart",""],[1,"flex","flex-1","flex-col","max-h-full"],[1,"entry-container","flex","items-center"],[1,"tb-form-panel","stroked","w-full","flex-1",3,"formGroup"],["translate","",1,"tb-form-panel-title"],[1,"entry-container","flex","w-full","gap-2"],["formControlName","command",1,"flex-1",3,"onCreateNewClicked","commands"],["appearance","outline",1,"flex-1"],["matInput","","disabled","",3,"tbTruncateWithTooltip","value"],[1,"actions-container","flex","flex-col","p-2","min-w-16"],[1,"chart-box","flex","flex-1","flex-col","overflow-auto"],[1,"tb-no-data-available","h-full"],["type","button","matSuffix","","mat-icon-button","","aria-label","Edit","matTooltipPosition","above",1,"action-button",3,"click","matTooltip"],[1,"material-icons"],[1,"flex-1",3,"ctx"],[1,"h-full","flex-1",3,"data"],[1,"tb-no-data-bg"],["translate","",1,"tb-no-data-text"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4),t.ɵɵtext(4,"gateway.statistics.entry"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",5)(6,"tb-statistics-commands-autocomplete",6),t.ɵɵlistener("onCreateNewClicked",function(){return n.openEditCommandDialog()}),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-form-field",7)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",8),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"div",9),t.ɵɵconditionalCreate(15,Ej,8,8),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(16,kj,3,1,"div",10)(17,Pj,4,0,"div",11),t.ɵɵelementEnd()),2&e){let e,i,a,r;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.statisticForm),t.ɵɵadvance(4),t.ɵɵproperty("commands",n.commands),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.statistics.command")),t.ɵɵadvance(2),t.ɵɵproperty("tbTruncateWithTooltip",(null==(e=n.statisticForm.get("command").value)?null:e.command)??t.ɵɵpipeBind1(12,9,"gateway.statistics.no-config-commands-found"))("value",(null==(i=n.statisticForm.get("command").value)?null:i.command)??t.ɵɵpipeBind1(13,11,"gateway.statistics.no-config-commands-found")),t.ɵɵadvance(4),t.ɵɵconditional(null!=(a=n.statisticForm.get("command").value)&&a.attributeOnGateway?15:-1),t.ɵɵadvance(),t.ɵɵconditional(null!=(r=n.statisticForm.get("command").value)&&r.attributeOnGateway&&n.subscriptionData.length&&n.subscribed?16:17)}},dependencies:t.ɵɵgetComponentDepsFactory(Dj,[C,qn,Kn,_j]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;padding:4px;display:flex;flex-direction:column}[_nghost-%COMP%] .action-button[_ngcontent-%COMP%]{opacity:.7}@media screen and (max-width:599px){[_nghost-%COMP%] .entry-container[_ngcontent-%COMP%]{flex-direction:column}[_nghost-%COMP%] .actions-container[_ngcontent-%COMP%]{flex-direction:row}}']})}}var Aj;e("GatewayStatisticsComponent",Dj),e("BACnetRequestTypes",Aj),function(e){e.WriteProperty="writeProperty",e.ReadProperty="readProperty"}(Aj||e("BACnetRequestTypes",Aj={}));const Oj=e("BACnetRequestTypesTranslates",new Map([[Aj.WriteProperty,"gateway.rpc.write-property"],[Aj.ReadProperty,"gateway.rpc.read-property"]]));var Rj;e("BACnetObjectTypes",Rj),function(e){e.BinaryInput="binaryInput",e.BinaryOutput="binaryOutput",e.AnalogInput="analogInput",e.AnalogOutput="analogOutput",e.BinaryValue="binaryValue",e.AnalogValue="analogValue"}(Rj||e("BACnetObjectTypes",Rj={}));const Bj=e("BACnetObjectTypesTranslates",new Map([[Rj.AnalogOutput,"gateway.rpc.analog-output"],[Rj.AnalogInput,"gateway.rpc.analog-input"],[Rj.BinaryOutput,"gateway.rpc.binary-output"],[Rj.BinaryInput,"gateway.rpc.binary-input"],[Rj.BinaryValue,"gateway.rpc.binary-value"],[Rj.AnalogValue,"gateway.rpc.analog-value"]]));var Fj;e("BLEMethods",Fj),function(e){e.WRITE="write",e.READ="read",e.SCAN="scan"}(Fj||e("BLEMethods",Fj={}));const Nj=e("BLEMethodsTranslates",new Map([[Fj.WRITE,"gateway.rpc.write"],[Fj.READ,"gateway.rpc.read"],[Fj.SCAN,"gateway.rpc.scan"]]));var Lj,Vj;e("CANByteOrders",Lj),function(e){e.LITTLE="LITTLE",e.BIG="BIG"}(Lj||e("CANByteOrders",Lj={})),e("SocketMethodProcessings",Vj),function(e){e.WRITE="write",e.READ="read"}(Vj||e("SocketMethodProcessings",Vj={}));const qj=e("SocketMethodProcessingsTranslates",new Map([[Vj.WRITE,"gateway.rpc.write"],[Vj.READ,"gateway.rpc.read"]]));var Gj;e("SNMPMethods",Gj),function(e){e.SET="set",e.MULTISET="multiset",e.GET="get",e.BULKWALK="bulkwalk",e.TABLE="table",e.MULTIGET="multiget",e.GETNEXT="getnext",e.BULKGET="bulkget",e.WALKS="walk"}(Gj||e("SNMPMethods",Gj={}));const zj=e("SNMPMethodsTranslations",new Map([[Gj.SET,"gateway.rpc.set"],[Gj.MULTISET,"gateway.rpc.multiset"],[Gj.GET,"gateway.rpc.get"],[Gj.BULKWALK,"gateway.rpc.bulk-walk"],[Gj.TABLE,"gateway.rpc.table"],[Gj.MULTIGET,"gateway.rpc.multi-get"],[Gj.GETNEXT,"gateway.rpc.get-next"],[Gj.BULKGET,"gateway.rpc.bulk-get"],[Gj.WALKS,"gateway.rpc.walk"]]));var Uj,jj,Hj;e("SocketEncodings",Uj),function(e){e.UTF_8="utf-8"}(Uj||e("SocketEncodings",Uj={})),e("S7DeviceType",jj),function(e){e.PLC="PLC",e.LOGO="LOGO"}(jj||e("S7DeviceType",jj={})),e("S7RequestType",Hj),function(e){e.READ="read",e.WRITE="write"}(Hj||e("S7RequestType",Hj={}));const Wj=e("S7RequestTypeTranslates",new Map([[Hj.READ,"gateway.rpc.read"],[Hj.WRITE,"gateway.rpc.write"]]));var $j;e("S7AddressType",$j),function(e){e.DATA="data",e.TAG="tag",e.VM="vm"}($j||e("S7AddressType",$j={}));const Kj=e("S7AddressTypeTranslates",new Map([[$j.DATA,"gateway.rpc.data"],[$j.TAG,"gateway.rpc.tag"]])),Yj=e("S7SelectableAddressTypes",[$j.DATA,$j.TAG]);var Xj;e("S7DataType",Xj),function(e){e.BOOLEAN="boolean",e.STRING="string",e.RAW="raw",e.BYTES="bytes",e.BIT="bit",e.BYTE="byte",e.USINT="usint",e.UINT8="uint8",e.SINT="sint",e.INT8="int8",e.INT="int",e.INT16="int16",e.SHORT="short",e.UINT="uint",e.UINT16="uint16",e.WORD="word",e.DINT="dint",e.INT32="int32",e.UDINT="udint",e.UINT32="uint32",e.DWORD="dword",e.REAL="real",e.FLOAT="float",e.FLOAT32="float32",e.LREAL="lreal",e.DOUBLE="double",e.FLOAT64="float64"}(Xj||e("S7DataType",Xj={}));const Zj=e("S7BooleanDataTypes",[Xj.BOOLEAN]);var Qj;e("RestSecurityType",Qj),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic"}(Qj||e("RestSecurityType",Qj={}));const Jj=e("RestSecurityTypeTranslationsMap",new Map([[Qj.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Qj.BASIC,"gateway.broker.security-types.basic"]]));class eH{transform(e){return e.map(e=>(e?.value??e).toString()).join(", ")}static{this.ɵfac=function(e){return new(e||eH)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getRpcTemplateArrayView",type:eH,pure:!0})}}e("RpcTemplateArrayViewPipe",eH);class tH{constructor(){this.differs=s(m),this.keyValues=[]}transform(e){if(!e||!(e instanceof Map)&&"object"!=typeof e)return null;this.differ??=this.differs.find(e).create();const t=this.differ.diff(e);return t&&(this.keyValues=[],t.forEachItem(e=>{ne(e.currentValue)&&this.keyValues.push(this.makeKeyValuePair(e.key,e.currentValue))})),this.keyValues}makeKeyValuePair(e,t){return{key:e,value:t}}static{this.ɵfac=function(e){return new(e||tH)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"keyValueIsNotEmpty",type:tH,pure:!1})}}e("KeyValueIsNotEmptyPipe",tH);const nH=e=>({$implicit:e,innerValue:!1}),iH=e=>({"padding-left":e}),aH=(e,t)=>({"boolean-true":e,"boolean-false":t}),rH=e=>({$implicit:e,innerValue:!0});function oH(e,n){if(1&e&&t.ɵɵelementContainer(0,10),2&e){const e=n.$implicit;t.ɵɵnextContext();const i=t.ɵɵreference(16);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,nH,e))}}function sH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13),t.ɵɵtext(1),t.ɵɵpipe(2,"getRpcTemplateArrayView"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,e.value)," ")}}function lH(e,n){if(1&e&&t.ɵɵelementContainer(0,14),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(10);t.ɵɵproperty("ngTemplateOutlet",e)}}function pH(e,n){if(1&e&&t.ɵɵelementContainer(0,14),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(8);t.ɵɵproperty("ngTemplateOutlet",e)}}function cH(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate1(" ",e.value," ")}}function dH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div"),t.ɵɵconditionalCreate(1,pH,1,1,"ng-container",14)(2,cH,1,1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext().$implicit,i=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction2(3,aH,!0===e.value,!1===e.value)),t.ɵɵadvance(),t.ɵɵconditional(n.type===i.ConnectorType.SNMP&&"method"===e.key?1:2)}}function uH(e,n){if(1&e&&(t.ɵɵtext(0),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵtextInterpolate(t.ɵɵpipeBind1(1,1,n.SNMPMethodsTranslations.get(e.value)))}}function mH(e,n){if(1&e&&t.ɵɵelementContainer(0,10),2&e){const e=n.$implicit;t.ɵɵnextContext(3);const i=t.ɵɵreference(16);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,rH,e))}}function hH(e,n){if(1&e&&(t.ɵɵrepeaterCreate(0,mH,1,4,"ng-container",10,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(2,"keyvalue")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵrepeater(t.ɵɵpipeBind2(2,0,e.value,n.originalOrder))}}function gH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",11)(1,"div",12),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(4,sH,3,3,"div",13),t.ɵɵconditionalCreate(5,lH,1,1,"ng-container",14),t.ɵɵconditionalCreate(6,dH,3,6,"div",15),t.ɵɵtemplate(7,uH,2,3,"ng-template",null,1,t.ɵɵtemplateRefExtractor)(9,hH,3,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=n.innerValue,a=t.ɵɵnextContext(2);t.ɵɵstyleMap(t.ɵɵpureFunction1(10,iH,i?"16px":"0")),t.ɵɵclassMap(a.getRpcParamsRowClasses(e.value)),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",i?e.key:t.ɵɵpipeBind1(3,8,"gateway.rpc."+e.key)," "),t.ɵɵadvance(2),t.ɵɵconditional(a.isArray(e.value)?4:-1),t.ɵɵadvance(),t.ɵɵconditional(a.isObject(e.value)?5:-1),t.ɵɵadvance(),t.ɵɵconditional(a.isObject(e.value)||a.isArray(e.value)?-1:6)}}function fH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",4)(1,"mat-expansion-panel-header")(2,"mat-panel-title",5)(3,"span",6),t.ɵɵtext(4),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-panel-description")(6,"button",7),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteTemplate(n,i))}),t.ɵɵelementStart(7,"mat-icon",8),t.ɵɵtext(8,"delete"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",9),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.applyTemplate(n,i))}),t.ɵɵelementStart(10,"mat-icon",8),t.ɵɵtext(11,"play_arrow"),t.ɵɵelementEnd()()()(),t.ɵɵrepeaterCreate(12,oH,1,4,"ng-container",10,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(14,"keyValueIsNotEmpty"),t.ɵɵtemplate(15,gH,11,12,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit;t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(e.name)),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name),t.ɵɵadvance(8),t.ɵɵrepeater(t.ɵɵpipeBind1(14,3,e.config))}}class yH{constructor(e){this.attributeService=e,this.saveTemplate=new p,this.useTemplate=new p,this.ConnectorType=gt,this.originalOrder=()=>0,this.isObject=e=>K(e),this.isArray=e=>Array.isArray(e),this.SNMPMethodsTranslations=zj}applyTemplate(e,t){e.stopPropagation(),this.useTemplate.emit(t)}deleteTemplate(e,t){e.stopPropagation();const n=this.rpcTemplates.findIndex(e=>e.name==t.name);this.rpcTemplates.splice(n,1);const i=`${this.connectorType}_template`;this.attributeService.saveEntityAttributes({id:this.ctx.defaultSubscription.targetDeviceId,entityType:R.DEVICE},P.SERVER_SCOPE,[{key:i,value:this.rpcTemplates}]).subscribe(()=>{})}getRpcParamsRowClasses(e){return this.isObject(e)?"flex-col":"flex-row justify-between items-center"}static{this.ɵfac=function(e){return new(e||yH)(t.ɵɵdirectiveInject(Z.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yH,selectors:[["tb-gateway-service-rpc-connector-templates"]],inputs:{connectorType:"connectorType",ctx:"ctx",rpcTemplates:"rpcTemplates"},outputs:{saveTemplate:"saveTemplate",useTemplate:"useTemplate"},decls:5,vars:3,consts:[["RPCTemplateRef",""],["SNMPMethod",""],["RPCObjectRow",""],[1,"mat-subtitle-1","title"],["hideToggle",""],[1,"template-name"],["matTooltipPosition","above",3,"matTooltip"],["mat-icon-button","","matTooltip","Delete",3,"click"],[1,"material-icons"],["mat-icon-button","","matTooltip","Use",3,"click"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"rpc-params-row","flex"],[1,"template-key"],["tbTruncateWithTooltip","",1,"array-value"],[3,"ngTemplateOutlet"],[3,"class"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵrepeaterCreate(3,fH,17,5,"mat-expansion-panel",4,t.ɵɵrepeaterTrackByIdentity)),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.templates-title")),t.ɵɵadvance(2),t.ɵɵrepeater(n.rpcTemplates))},dependencies:t.ɵɵgetComponentDepsFactory(yH,[ce,C,eH,tH]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;padding:0}[_nghost-%COMP%] .title[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .template-key[_ngcontent-%COMP%]{color:#00000061;height:32px;line-height:32px}[_nghost-%COMP%] .boolean-true[_ngcontent-%COMP%], [_nghost-%COMP%] .boolean-false[_ngcontent-%COMP%]{border-radius:3px;height:32px;line-height:32px;padding:0 12px;width:fit-content;font-size:14px;text-transform:capitalize}[_nghost-%COMP%] .boolean-false[_ngcontent-%COMP%]{color:#d12730;background-color:#d1273014}[_nghost-%COMP%] .boolean-true[_ngcontent-%COMP%]{color:#198038;background-color:#19803814}[_nghost-%COMP%] mat-expansion-panel[_ngcontent-%COMP%]{margin-top:10px;overflow:visible}[_nghost-%COMP%] .mat-expansion-panel-header-description[_ngcontent-%COMP%]{flex-direction:row-reverse;align-items:center;margin-right:0;flex:0}[_nghost-%COMP%] .mat-expansion-panel-header-description[_ngcontent-%COMP%] > mat-icon[_ngcontent-%COMP%]{margin-left:15px;color:#00000061}[_nghost-%COMP%] .mat-expansion-panel-header[_ngcontent-%COMP%]{padding:0 0 0 12px}[_nghost-%COMP%] .mat-expansion-panel-header.mat-expansion-panel-header.mat-expanded[_ngcontent-%COMP%]{height:48px}[_nghost-%COMP%] .mat-expansion-panel-header[_ngcontent-%COMP%] .mat-content.mat-content-hide-toggle[_ngcontent-%COMP%]{margin-right:0}[_nghost-%COMP%] .rpc-params-row[_ngcontent-%COMP%]{overflow:hidden;white-space:nowrap}[_nghost-%COMP%] .rpc-params-row[_ngcontent-%COMP%] [_ngcontent-%COMP%]:not(:first-child){white-space:pre;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .template-name[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;display:block}[_nghost-%COMP%] .mat-content{align-items:center}[_nghost-%COMP%] .mat-expansion-panel-header-title[_ngcontent-%COMP%]{flex:1;margin:0}[_nghost-%COMP%] .array-value[_ngcontent-%COMP%]{margin-left:10px}']})}}function vH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rpc.template-name-required")," "))}function xH(e,n){1&e&&(t.ɵɵelementStart(0,"div",7),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rpc.template-name-duplicate")," "))}e("GatewayServiceRPCConnectorTemplatesComponent",yH);class bH extends D{constructor(e,t,n,i,a){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.config=this.data.config,this.templates=this.data.templates,this.templateNameCtrl=this.fb.control("",[ve.required])}validateDuplicateName(e){const t=e.value.trim();return!!this.templates.find(e=>e.name===t)}close(){this.dialogRef.close()}save(){this.templateNameCtrl.setValue(this.templateNameCtrl.value.trim()),this.templateNameCtrl.valid&&this.dialogRef.close(this.templateNameCtrl.value)}static{this.ɵfac=function(e){return new(e||bH)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bH,selectors:[["tb-gateway-service-rpc-connector-template-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:20,vars:10,consts:[["color","primary",1,"justify-between"],["translate",""],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"mat-content","flex","flex-col",2,"width","600px"],["appearance","outline",1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[1,"mat-mdc-form-field-error",2,"margin-top","-15px","padding-left","10px","font-size","14px"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-toolbar",0)(1,"h2",1),t.ɵɵtext(2,"gateway.rpc.save-template"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"button",2),t.ɵɵlistener("click",function(){return n.close()}),t.ɵɵelementStart(4,"mat-icon",3),t.ɵɵtext(5,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(6,"div",4)(7,"mat-form-field",5)(8,"mat-label",1),t.ɵɵtext(9,"gateway.rpc.template-name"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",6),t.ɵɵconditionalCreate(11,vH,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(12,xH,3,3,"div",7),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",8)(14,"button",9),t.ɵɵlistener("click",function(){return n.close()}),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵlistener("click",function(){return n.save()}),t.ɵɵtext(18),t.ɵɵpipe(19,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(10),t.ɵɵproperty("formControl",n.templateNameCtrl),t.ɵɵadvance(),t.ɵɵconditional(n.templateNameCtrl.hasError("required")?11:-1),t.ɵɵadvance(),t.ɵɵconditional(n.validateDuplicateName(n.templateNameCtrl)?12:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(16,6,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",!n.templateNameCtrl.valid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(19,8,"action.save")," "))},dependencies:t.ɵɵgetComponentDepsFactory(bH,[C]),encapsulation:2})}}function wH(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SecurityTypeTranslationsMap.get(e))," ")}}function SH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function CH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.password-required"))}function _H(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"div",6),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",7)(4,"mat-form-field",8),t.ɵɵelement(5,"input",9),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,SH,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",5)(9,"div",6),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",11),t.ɵɵpipe(14,"translate"),t.ɵɵconditionalCreate(15,CH,3,3,"mat-icon",10),t.ɵɵelementStart(16,"div",12),t.ɵɵelement(17,"tb-toggle-password",13),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,8,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched?7:-1),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,10,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("password").hasError("required")&&e.securityFormGroup.get("password").touched?15:-1),t.ɵɵadvance(),t.ɵɵclassProp("hide-toggle",e.securityFormGroup.get("password").hasError("required"))}}e("GatewayServiceRPCConnectorTemplateDialogComponent",bH);class TH{constructor(e){this.fb=e,this.BrokerSecurityType=Qj,this.securityTypes=Object.values(Qj),this.SecurityTypeTranslationsMap=Jj,this.destroy$=new _e,this.propagateChange=e=>{},this.securityFormGroup=this.fb.group({type:[Qj.ANONYMOUS,[]],username:["",[ve.required,ve.pattern(hn)]],password:["",[ve.required,ve.pattern(hn)]]}),this.observeSecurityForm()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){e.type||(e.type=Qj.ANONYMOUS),this.securityFormGroup.reset(e),this.updateView(e)}validate(){return this.securityFormGroup.valid?null:{securityForm:{valid:!1}}}updateView(e){this.propagateChange(e)}updateValidators(e){e===Qj.BASIC?(this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1})):(this.securityFormGroup.get("username").disable({emitEvent:!1}),this.securityFormGroup.get("password").disable({emitEvent:!1}))}observeSecurityForm(){this.securityFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.updateView(e)),this.securityFormGroup.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.updateValidators(e))}static{this.ɵfac=function(e){return new(e||TH)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:TH,selectors:[["tb-rest-connector-security"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>TH),multi:!0},{provide:xe,useExisting:a(()=>TH),multi:!0}])],decls:8,vars:2,consts:[[1,"tb-form-row","space-between","same-padding","tb-flex","column",3,"formGroup"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fields-label"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["translate","",1,"fixed-title-width"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","username",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","password","name","value","formControlName","password",3,"placeholder"],["matSuffix","",1,"tb-flex","no-gap","align-center","fill-height"],[1,"tb-flex","align-center","fill-height"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.security"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-select",3),t.ɵɵrepeaterCreate(5,wH,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(7,_H,18,12),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(5),t.ɵɵrepeater(n.securityTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.securityFormGroup.get("type").value===n.BrokerSecurityType.BASIC?7:-1))},dependencies:t.ɵɵgetComponentDepsFactory(TH,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block;margin-bottom:10px}[_nghost-%COMP%] .fields-label[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .hide-toggle[_ngcontent-%COMP%]{display:none}'],changeDetection:o.OnPush})}}e("RestConnectorSecurityComponent",TH);const EH=e=>({type:e});function MH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.bACnetRequestTypesTranslates.get(e))," ")}}function IH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.bACnetObjectTypesTranslates.get(e))," ")}}function kH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",6),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",7)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",8),t.ɵɵrepeaterCreate(10,MH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",5)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",10),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",11)(18,"mat-form-field",12)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-select",13),t.ɵɵrepeaterCreate(23,IH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"mat-form-field",12)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(29,"input",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"mat-form-field",7)(31,"mat-label"),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",15),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,6,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,8,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.bACnetRequestTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,10,"gateway.rpc.requestTimeout")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,12,"gateway.rpc.objectType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.bACnetObjectTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,14,"gateway.rpc.identifier")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,16,"gateway.rpc.propertyId"))}}function PH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.bLEMethodsTranslates.get(e))," ")}}function DH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",16),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",17),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",7)(11,"mat-label"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-select",18),t.ɵɵrepeaterCreate(15,PH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-slide-toggle",19),t.ɵɵtext(18),t.ɵɵpipe(19,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,4,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,6,"gateway.rpc.characteristicUUID")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,8,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵrepeater(e.bLEMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(19,10,"gateway.rpc.withResponse")," ")}}function AH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e)," ")}}function OH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",20),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",21),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",22),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-slide-toggle",23),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-slide-toggle",24),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",11)(20,"mat-form-field",12)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",25),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",12)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-select",26),t.ɵɵrepeaterCreate(30,AH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(32,"div",11)(33,"mat-form-field",12)(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",27),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field",12)(39,"mat-label"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(43,"mat-form-field",5)(44,"mat-label"),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(48,"mat-form-field",5)(49,"mat-label"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(52,"input",30),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,11,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,13,"gateway.rpc.nodeID")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,15,"gateway.rpc.isExtendedID")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,17,"gateway.rpc.isFD")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,19,"gateway.rpc.bitrateSwitch")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,21,"gateway.rpc.dataLength")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,23,"gateway.rpc.dataByteorder")),t.ɵɵadvance(3),t.ɵɵrepeater(e.cANByteOrders),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,25,"gateway.rpc.dataBefore")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,27,"gateway.rpc.dataAfter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(46,29,"gateway.rpc.dataInHEX")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(51,31,"gateway.rpc.dataExpression"))}}function RH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",32),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.methodFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,4,"gateway.rpc.valueExpression")))}function BH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",32),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",34),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,3,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,5,"gateway.rpc.valueExpression")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.rpc.withResponse")," "))}function FH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",32),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",34),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,3,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,5,"gateway.rpc.valueExpression")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.rpc.withResponse")," "))}function NH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SNMPMethodsTranslations.get(e))," ")}}function LH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",39)(1,"mat-form-field",41),t.ɵɵelement(2,"input",42),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-icon",43),t.ɵɵpipe(4,"translate"),t.ɵɵlistener("click",function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext(3);return t.ɵɵresetView(i.removeSNMPoid(n))}),t.ɵɵtext(5,"delete "),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵproperty("formControl",e),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.remove")))}}function VH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",35),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",7)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",36),t.ɵɵrepeaterCreate(10,NH,3,4,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-slide-toggle",34),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"fieldset",37)(16,"span",38),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵrepeaterCreate(19,LH,6,5,"div",39,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(21,"button",40),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addSNMPoid())}),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.rpc.requestFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,7,"gateway.rpc.method")),t.ɵɵadvance(3),t.ɵɵrepeater(e.sNMPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,9,"gateway.rpc.withResponse")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(18,11,"gateway.rpc.oids"),"*"),t.ɵɵadvance(2),t.ɵɵrepeater(e.getFormArrayControls("oid")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,13,"gateway.rpc.add-oid")," ")}}function qH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function GH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",53),t.ɵɵelementContainerStart(1,56),t.ɵɵelementStart(2,"mat-form-field",12),t.ɵɵelement(3,"input",57),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",58),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-icon",59),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext(4);return t.ɵɵresetView(i.removeHTTPHeader(n))}),t.ɵɵtext(8,"delete "),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()}if(2&e){const e=n.$index;t.ɵɵadvance(),t.ɵɵproperty("formGroupName",e),t.ɵɵadvance(5),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,3,"gateway.rpc.remove")))}}function zH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",52)(1,"div",53)(2,"span",54),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",54),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",55),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵrepeaterCreate(10,GH,9,5,"div",53,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,2,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,4,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵrepeater(e.getFormArrayControls("httpHeaders"))}}function UH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",44),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",11)(6,"mat-form-field",45)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",46),t.ɵɵrepeaterCreate(11,qH,2,2,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"mat-form-field",12)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(17,"input",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",11)(19,"mat-form-field",12)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",48),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",12)(25,"mat-label"),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(28,"input",49),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",12)(30,"mat-label"),t.ɵɵtext(31),t.ɵɵpipe(32,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(33,"input",50),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"mat-form-field",5)(35,"mat-label"),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(38,"input",32),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"fieldset",51)(40,"span",38),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(43,zH,12,6,"div",52),t.ɵɵelementStart(44,"button",40),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())}),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,10,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,12,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵrepeater(e.hTTPMethods),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,14,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,16,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(27,18,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(32,20,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,22,"gateway.rpc.valueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(42,24,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵconditional(e.getFormArrayControls("httpHeaders").length?43:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(46,26,"gateway.rpc.add-header")," ")}}function jH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function HH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",63),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.requestValueExpression")))}function WH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",53),t.ɵɵelementContainerStart(1,56),t.ɵɵelementStart(2,"mat-form-field",12),t.ɵɵelement(3,"input",64),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",12),t.ɵɵelement(6,"input",65),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-icon",59),t.ɵɵpipe(8,"translate"),t.ɵɵlistener("click",function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext(4);return t.ɵɵresetView(i.removeHTTPHeader(n))}),t.ɵɵtext(9,"delete "),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()}if(2&e){const e=n.$index;t.ɵɵadvance(),t.ɵɵproperty("formGroupName",e),t.ɵɵadvance(2),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(4,5,"gateway.rpc.set"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,7,"gateway.rpc.remove")))}}function $H(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",52)(1,"div",53)(2,"span",54),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",54),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",55),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵrepeaterCreate(10,WH,10,9,"div",53,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,2,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,4,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵrepeater(e.getFormArrayControls("httpHeaders"))}}function KH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",53)(1,"mat-form-field",45)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",46),t.ɵɵrepeaterCreate(6,jH,2,2,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"mat-form-field",12)(9,"mat-label"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(12,"input",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"div",53)(14,"mat-form-field",12)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",48),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",12)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",60),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",12)(25,"mat-label"),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(28,"input",61),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(29,HH,5,3,"mat-form-field",5),t.ɵɵelementStart(30,"mat-form-field",5)(31,"mat-label"),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",62),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"fieldset",51)(36,"span",38),t.ɵɵtext(37),t.ɵɵpipe(38,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(39,$H,12,6,"div",52),t.ɵɵelementStart(40,"button",40),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())}),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,10,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵrepeater(e.hTTPMethods),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,12,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(17,14,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,16,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(27,18,"gateway.rpc.tries")),t.ɵɵadvance(3),t.ɵɵconditional(e.commandForm.get("httpMethod").value!==e.HTTPMethods.GET&&e.commandForm.get("httpMethod").value!==e.HTTPMethods.HEAD?29:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,20,"gateway.rpc.responseValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(38,22,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵconditional(e.getFormArrayControls("httpHeaders").length?39:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(42,24,"gateway.rpc.add-header")," ")}}function YH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rpc.json-value-invalid")," "))}function XH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",66),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",5)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",67),t.ɵɵelementStart(10,"mat-icon",68),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext(2);return t.ɵɵresetView(i.openEditJSONDialog(n))}),t.ɵɵtext(12,"edit "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(13,YH,3,3,"mat-error"),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.statistics.command")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,7,"widget-config.datasource-parameters")),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,9,"gateway.rpc-command-edit-params"))),t.ɵɵadvance(3),t.ɵɵconditional(e.commandForm.get("params").hasError("invalidJSON")?13:-1)}}function ZH(e,n){if(1&e&&t.ɵɵconditionalCreate(0,kH,35,18)(1,DH,20,12)(2,OH,53,33)(3,RH,10,6)(4,BH,13,9)(5,FH,13,9)(6,VH,24,15)(7,UH,47,28)(8,KH,43,26)(9,XH,14,11),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵconditional((e=n.connectorType)===n.ConnectorType.BACNET?0:e===n.ConnectorType.BLE?1:e===n.ConnectorType.CAN?2:e===n.ConnectorType.FTP?3:e===n.ConnectorType.OCPP?4:e===n.ConnectorType.XMPP?5:e===n.ConnectorType.SNMP?6:e===n.ConnectorType.REST?7:e===n.ConnectorType.REQUEST?8:9)}}class QH{constructor(e,t){this.fb=e,this.dialog=t,this.sendCommand=new p,this.saveTemplate=new p,this.ConnectorType=gt,this.bACnetRequestTypes=Object.values(Aj),this.bACnetObjectTypes=Object.values(Rj),this.bLEMethods=Object.values(Fj),this.cANByteOrders=Object.values(Lj),this.sNMPMethods=Object.values(Gj),this.hTTPMethods=Object.values(bt),this.HTTPMethods=bt,this.bACnetRequestTypesTranslates=Oj,this.bACnetObjectTypesTranslates=Bj,this.bLEMethodsTranslates=Nj,this.SNMPMethodsTranslations=zj,this.gatewayConnectorDefaultTypesTranslates=ft,this.urlPattern=/^[-a-zA-Zd_$:{}?~+=\/.0-9-]*$/,this.numbersOnlyPattern=/^[0-9]*$/,this.hexOnlyPattern=/^[0-9A-Fa-f ]+$/,this.propagateChange=e=>{},this.destroy$=new _e}ngOnInit(){this.commandForm=this.connectorParamsFormGroupByType(this.connectorType),this.observeFormChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}connectorParamsFormGroupByType(e){let t;switch(e){case gt.BACNET:t=this.fb.group({method:[null,[ve.required,ve.pattern(hn)]],requestType:[null,[ve.required,ve.pattern(hn)]],requestTimeout:[null,[ve.required,ve.min(10),ve.pattern(this.numbersOnlyPattern)]],objectType:[null,[]],identifier:[null,[ve.required,ve.min(1),ve.pattern(this.numbersOnlyPattern)]],propertyId:[null,[ve.required,ve.pattern(hn)]]});break;case gt.BLE:t=this.fb.group({methodRPC:[null,[ve.required,ve.pattern(hn)]],characteristicUUID:["00002A00-0000-1000-8000-00805F9B34FB",[ve.required,ve.pattern(hn)]],methodProcessing:[null,[ve.required]],withResponse:[!1,[]]});break;case gt.CAN:t=this.fb.group({method:[null,[ve.required,ve.pattern(hn)]],nodeID:[null,[ve.required,ve.min(0),ve.pattern(this.numbersOnlyPattern)]],isExtendedID:[!1,[]],isFD:[!1,[]],bitrateSwitch:[!1,[]],dataLength:[null,[ve.min(1),ve.pattern(this.numbersOnlyPattern)]],dataByteorder:[null,[]],dataBefore:[null,[ve.pattern(hn),ve.pattern(this.hexOnlyPattern)]],dataAfter:[null,[ve.pattern(hn),ve.pattern(this.hexOnlyPattern)]],dataInHEX:[null,[ve.pattern(hn),ve.pattern(this.hexOnlyPattern)]],dataExpression:[null,[ve.pattern(hn)]]});break;case gt.FTP:t=this.fb.group({methodFilter:[null,[ve.required,ve.pattern(hn)]],valueExpression:[null,[ve.required,ve.pattern(hn)]]});break;case gt.OCPP:case gt.XMPP:t=this.fb.group({methodRPC:[null,[ve.required,ve.pattern(hn)]],valueExpression:[null,[ve.required,ve.pattern(hn)]],withResponse:[!1,[]]});break;case gt.SNMP:t=this.fb.group({requestFilter:[null,[ve.required,ve.pattern(hn)]],method:[null,[ve.required]],withResponse:[!1,[]],oid:this.fb.array([],[ve.required])});break;case gt.REST:t=this.fb.group({methodFilter:[null,[ve.required,ve.pattern(hn)]],httpMethod:[null,[ve.required]],requestUrlExpression:[null,[ve.required,ve.pattern(this.urlPattern)]],responseTimeout:[null,[ve.required,ve.min(10),ve.pattern(this.numbersOnlyPattern)]],timeout:[null,[ve.required,ve.min(10),ve.pattern(this.numbersOnlyPattern)]],tries:[null,[ve.required,ve.min(1),ve.pattern(this.numbersOnlyPattern)]],valueExpression:[null,[ve.required,ve.pattern(hn)]],httpHeaders:this.fb.array([]),security:[{},[ve.required]]});break;case gt.REQUEST:t=this.fb.group({methodFilter:[null,[ve.required,ve.pattern(hn)]],httpMethod:[null,[ve.required]],requestUrlExpression:[null,[ve.required,ve.pattern(this.urlPattern)]],responseTimeout:[null,[ve.required,ve.min(10),ve.pattern(this.numbersOnlyPattern)]],timeout:[null,[ve.required,ve.min(10),ve.pattern(this.numbersOnlyPattern)]],tries:[null,[ve.required,ve.min(1),ve.pattern(this.numbersOnlyPattern)]],requestValueExpression:[null,[ve.required,ve.pattern(hn)]],responseValueExpression:[null,[ve.pattern(hn)]],httpHeaders:this.fb.array([])});break;default:t=this.fb.group({command:[null,[ve.required,ve.pattern(hn)]],params:[{},[ut]]})}return t}addSNMPoid(e=null){const t=this.commandForm.get("oid");t&&t.push(this.fb.control(e,[ve.required,ve.pattern(hn)]),{emitEvent:!1})}removeSNMPoid(e){this.commandForm.get("oid").removeAt(e)}addHTTPHeader(e={headerName:null,value:null}){const t=this.commandForm.get("httpHeaders"),n=this.fb.group({headerName:[e.headerName,[ve.required,ve.pattern(hn)]],value:[e.value,[ve.required,ve.pattern(hn)]]});t&&t.push(n,{emitEvent:!1})}removeHTTPHeader(e){this.commandForm.get("httpHeaders").removeAt(e)}getFormArrayControls(e){return this.commandForm.get(e).controls}openEditJSONDialog(e){e&&e.stopPropagation(),this.dialog.open(ot,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{jsonValue:this.commandForm.get("params").value,required:!0}}).afterClosed().subscribe(e=>{e&&this.commandForm.get("params").setValue(e)})}save(){this.saveTemplate.emit()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}clearFromArrayByName(e){const t=this.commandForm.get(e);for(;0!==t.length;)t.removeAt(0)}writeValue(e){if("object"==typeof e){switch(e=ae(e),this.connectorType){case gt.SNMP:this.clearFromArrayByName("oid"),e.oid.forEach(e=>{this.addSNMPoid(e)}),delete e.oid;break;case gt.REQUEST:case gt.REST:this.clearFromArrayByName("httpHeaders"),e.httpHeaders&&Object.entries(e.httpHeaders).forEach(e=>{this.addHTTPHeader({headerName:e[0],value:e[1]})}),delete e.httpHeaders}this.commandForm.patchValue(e,{onlySelf:!1})}}observeFormChanges(){this.commandForm.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.connectorType!==gt.REST&&this.connectorType!==gt.REQUEST||(e.httpHeaders=e.httpHeaders.reduce((e,t)=>(e[t.headerName]=t.value,e),{})),this.commandForm.valid&&this.propagateChange({...this.commandForm.value,...e})})}static{this.ɵfac=function(e){return new(e||QH)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(Ke.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:QH,selectors:[["tb-gateway-service-rpc-connector"]],inputs:{connectorType:"connectorType"},outputs:{sendCommand:"sendCommand",saveTemplate:"saveTemplate"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>QH),multi:!0}])],decls:12,vars:16,consts:[[1,"command-form","flex","flex-col",3,"formGroup"],[1,"mat-subtitle-1","title"],[1,"template-actions","flex","flex-row","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline"],["matInput","","formControlName","method","placeholder","set_state"],["appearance","outline",1,"mat-block"],["formControlName","requestType"],[3,"value"],["matInput","","formControlName","requestTimeout","type","number","min","10","step","1","placeholder","1000"],[1,"flex","flex-1","flex-row","gap-2.5"],["appearance","outline",1,"flex-1"],["formControlName","objectType"],["matInput","","formControlName","identifier","type","number","min","1","step","1","placeholder","1"],["matInput","","formControlName","propertyId","placeholder","presentValue"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],["matInput","","formControlName","characteristicUUID","placeholder","00002A00-0000-1000-8000-00805F9B34FB"],["formControlName","methodProcessing"],["formControlName","withResponse",1,"mat-slide"],["matInput","","formControlName","method","placeholder","sendSameData"],["matInput","","formControlName","nodeID","type","number","placeholder","4","min","0","step","1"],["formControlName","isExtendedID",1,"mat-slide","margin"],["formControlName","isFD",1,"mat-slide","margin"],["formControlName","bitrateSwitch",1,"mat-slide","margin"],["matInput","","formControlName","dataLength","type","number","placeholder","2","min","1","step","1"],["formControlName","dataByteorder"],["matInput","","formControlName","dataBefore","placeholder","00AA"],["matInput","","formControlName","dataAfter","placeholder","0102"],["matInput","","formControlName","dataInHEX","placeholder","aa bb cc dd ee ff aa bb aa bb cc d ee ff"],["matInput","","formControlName","dataExpression","placeholder","userSpeed if maxAllowedSpeed > userSpeed else maxAllowedSpeed"],["matInput","","formControlName","methodFilter","placeholder","read"],["matInput","","formControlName","valueExpression","placeholder","${params}"],["matInput","","formControlName","methodRPC","placeholder","rpc1"],["formControlName","withResponse",1,"mat-slide","margin"],["matInput","","formControlName","requestFilter","placeholder","setData"],["formControlName","method"],["formArrayName","oid",1,"fields","flex","flex-col","gap-2.5","border"],[1,"fields-label"],[1,"flex","flex-1","flex-row","items-center","justify-center","gap-2.5"],["mat-raised-button","",1,"self-start",3,"click"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex-1"],["matInput","","required","",3,"formControl"],[1,"flex-[1_1_30px]",2,"cursor","pointer","max-width","30px","min-width","30px",3,"click","matTooltip"],["matInput","","formControlName","methodFilter","placeholder","post_attributes"],["appearance","outline",1,"max-w-4/12","flex-[1_1_33%]"],["formControlName","httpMethod"],["matInput","","formControlName","requestUrlExpression","placeholder","http://127.0.0.1:5000/my_devices"],["matInput","","formControlName","responseTimeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","1000"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","3"],["formArrayName","httpHeaders",1,"fields","flex","flex-col","gap-2.5","border"],[1,"flex","flex-col","gap-2.5","border"],[1,"flex","flex-row","items-center","justify-center","gap-2.5"],[1,"title","flex-1"],[2,"width","30px"],[3,"formGroupName"],["matInput","","formControlName","headerName"],["matInput","","formControlName","value","placeholder","application/json"],[2,"cursor","pointer","width","30px",3,"click","matTooltip"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","1"],["matInput","","formControlName","responseValueExpression","placeholder","${temp}"],["matInput","","formControlName","requestValueExpression","placeholder","${params}"],["matInput","","formControlName","headerName",3,"placeholder"],["matInput","","formControlName","value"],["matInput","","formControlName","command"],["matInput","","formControlName","params","type","JSON","tb-json-to-string",""],["aria-hidden","false","aria-label","help-icon","matIconSuffix","",1,"material-icons-outlined",2,"cursor","pointer",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(4,ZH,10,1),t.ɵɵelementStart(5,"div",2)(6,"button",3),t.ɵɵlistener("click",function(){return n.save()}),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",4),t.ɵɵlistener("click",function(){return n.sendCommand.emit()}),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,7,"gateway.rpc.title",t.ɵɵpureFunction1(14,EH,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorType?4:-1),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,10,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,12,"gateway.rpc-command-send")," "))},dependencies:t.ɵɵgetComponentDepsFactory(QH,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;padding:0}[_nghost-%COMP%] .title[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%]{flex-wrap:nowrap}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%] > button[_ngcontent-%COMP%]{margin-top:10px}[_nghost-%COMP%] .mat-mdc-slide-toggle.margin[_ngcontent-%COMP%]{margin-bottom:10px;margin-left:10px}[_nghost-%COMP%] .fields[_ngcontent-%COMP%] .fields-label[_ngcontent-%COMP%]{font-weight:500}[_nghost-%COMP%] .border[_ngcontent-%COMP%]{padding:16px;margin-bottom:10px;box-shadow:0 0 #0003,0 0 #00000024,0 0 #0000001f;border:solid 1px #e0e0e0;border-radius:4px}[_nghost-%COMP%] .border[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{color:#0000008a}[_nghost-%COMP%] .border[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{color:#00000061}[_nghost-%COMP%] .border[_ngcontent-%COMP%] .mat-divider[_ngcontent-%COMP%]{margin-left:-16px;margin-right:-16px;margin-bottom:16px}']})}}function JH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function eW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.ModbusFunctionCodeTranslationsMap.get(e)))}}function tW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",8),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function nW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",8),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function iW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"mat-form-field",3)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",11),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,nW,3,3,"mat-icon",8),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,4,"gateway.rpc.value")),t.ɵɵadvance(2),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,6,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.rpcParametersFormGroup.get("value").hasError("required")&&e.rpcParametersFormGroup.get("value").touched?7:-1)}}class aW{constructor(e){this.fb=e,this.ModbusEditableDataTypes=an,this.ModbusFunctionCodeTranslationsMap=ln,this.modbusDataTypes=Object.values(nn),this.writeFunctionCodes=[5,6,15,16],this.defaultFunctionCodes=[3,4,6,16],this.readFunctionCodes=[1,2,3,4],this.bitsFunctionCodes=[...this.readFunctionCodes,...this.writeFunctionCodes],this.destroy$=new _e,this.rpcParametersFormGroup=this.fb.group({type:[nn.BYTES,[ve.required]],functionCode:[this.defaultFunctionCodes[0],[ve.required]],value:[{value:"",disabled:!0},[ve.required,ve.pattern(hn)]],address:[null,[ve.required]],objectsCount:[1,[ve.required]]}),this.updateFunctionCodes(this.rpcParametersFormGroup.get("type").value),this.observeValueChanges(),this.observeKeyDataType(),this.observeFunctionCode()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.rpcParametersFormGroup.valid?null:{rpcParametersFormGroup:{valid:!1}}}writeValue(e){this.rpcParametersFormGroup.patchValue(e,{emitEvent:!1})}observeValueChanges(){this.rpcParametersFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e),this.onTouched()})}observeKeyDataType(){this.rpcParametersFormGroup.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.ModbusEditableDataTypes.includes(e)||this.rpcParametersFormGroup.get("objectsCount").patchValue(rn[e],{emitEvent:!1}),this.updateFunctionCodes(e)})}observeFunctionCode(){this.rpcParametersFormGroup.get("functionCode").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.updateValueEnabling(e))}updateValueEnabling(e){this.writeFunctionCodes.includes(e)?this.rpcParametersFormGroup.get("value").enable({emitEvent:!1}):(this.rpcParametersFormGroup.get("value").setValue(null),this.rpcParametersFormGroup.get("value").disable({emitEvent:!1}))}updateFunctionCodes(e){this.functionCodes=e===nn.BITS?this.bitsFunctionCodes:this.defaultFunctionCodes,this.functionCodes.includes(this.rpcParametersFormGroup.get("functionCode").value)||this.rpcParametersFormGroup.get("functionCode").patchValue(this.functionCodes[0],{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||aW)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:aW,selectors:[["tb-gateway-modbus-rpc-parameters"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>aW),multi:!0},{provide:xe,useExisting:a(()=>aW),multi:!0}])],decls:37,vars:30,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","no-padding-top","hint-container"],[1,"flex","flex-1","flex-row","gap-2.5"],["appearance","outline",1,"flex-1"],["formControlName","type"],[3,"value"],["formControlName","functionCode"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],[1,"flex"],["matInput","","name","value","formControlName","value",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"br"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",2)(8,"mat-form-field",3)(9,"mat-label"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-select",4),t.ɵɵrepeaterCreate(13,JH,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",3)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-select",6),t.ɵɵrepeaterCreate(20,eW,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",2)(23,"mat-form-field",3)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",7),t.ɵɵpipe(28,"translate"),t.ɵɵconditionalCreate(29,tW,3,3,"mat-icon",8),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",3)(31,"mat-label"),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",9),t.ɵɵpipe(35,"translate"),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(36,iW,8,8,"div",10),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,14,"gateway.rpc.hint.modbus-response-reading")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,16,"gateway.rpc.hint.modbus-writing-functions")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,18,"gateway.rpc.type")),t.ɵɵadvance(3),t.ɵɵrepeater(n.modbusDataTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(18,20,"gateway.rpc.functionCode")),t.ɵɵadvance(3),t.ɵɵrepeater(n.functionCodes),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,22,"gateway.rpc.address")),t.ɵɵadvance(2),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,24,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.rpcParametersFormGroup.get("address").hasError("required")&&n.rpcParametersFormGroup.get("address").touched?29:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,26,"gateway.rpc.objectsCount")),t.ɵɵadvance(2),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(35,28,"gateway.set")))("readonly",!n.ModbusEditableDataTypes.includes(n.rpcParametersFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵconditional(n.writeFunctionCodes.includes(n.rpcParametersFormGroup.get("functionCode").value)?36:-1))},dependencies:t.ɵɵgetComponentDepsFactory(aW,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:o.OnPush})}}function rW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",1)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",6),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.responseTopicExpression")))}function oW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field",1)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",7),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.responseTimeout")))}class sW{constructor(e){this.fb=e,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new _e,this.rpcParametersFormGroup=this.fb.group({methodFilter:[null,[ve.required,ve.pattern(hn)]],requestTopicExpression:[null,[ve.required,ve.pattern(hn)]],responseTopicExpression:[{value:null,disabled:!0},[ve.required,ve.pattern(hn)]],responseTimeout:[{value:null,disabled:!0},[ve.min(10),ve.pattern(gn)]],valueExpression:[null,[ve.required,ve.pattern(hn)]],withResponse:[!1,[]]}),this.observeValueChanges(),this.observeWithResponse()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.rpcParametersFormGroup.valid?null:{rpcParametersFormGroup:{valid:!1}}}writeValue(e){this.rpcParametersFormGroup.patchValue(e,{emitEvent:!1}),this.toggleResponseFields(e.withResponse)}observeValueChanges(){this.rpcParametersFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e),this.onTouched()})}observeWithResponse(){this.rpcParametersFormGroup.get("withResponse").valueChanges.pipe(Fe(e=>this.toggleResponseFields(e)),Ne(this.destroy$)).subscribe()}toggleResponseFields(e){const t=this.rpcParametersFormGroup.get("responseTopicExpression"),n=this.rpcParametersFormGroup.get("responseTimeout");e?(t.enable(),n.enable()):(t.disable(),n.disable())}static{this.ɵfac=function(e){return new(e||sW)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:sW,selectors:[["tb-gateway-mqtt-rpc-parameters"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>sW),multi:!0},{provide:xe,useExisting:a(()=>sW),multi:!0}])],decls:21,vars:15,consts:[[3,"formGroup"],["appearance","outline"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","requestTopicExpression","placeholder","sensor/${deviceName}/request/${methodName}/${requestId}"],["formControlName","withResponse",1,"margin",3,"click"],["matInput","","formControlName","valueExpression","placeholder","${params}"],["matInput","","formControlName","responseTopicExpression","placeholder","sensor/${deviceName}/response/${methodName}/${requestId}"],["matInput","","formControlName","responseTimeout","type","number","placeholder","10000","min","10","step","1"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"mat-form-field",1)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",1)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",3),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-slide-toggle",4),t.ɵɵlistener("click",function(e){return e.stopPropagation()}),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(14,rW,5,3,"mat-form-field",1),t.ɵɵconditionalCreate(15,oW,5,3,"mat-form-field",1),t.ɵɵelementStart(16,"mat-form-field",1)(17,"mat-label"),t.ɵɵtext(18),t.ɵɵpipe(19,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(20,"input",5),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){let e,i;t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.rpc.method-name")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,9,"gateway.rpc.requestTopicExpression")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,11,"gateway.rpc.withResponse")," "),t.ɵɵadvance(2),t.ɵɵconditional(null!=(e=n.rpcParametersFormGroup.get("withResponse"))&&e.value?14:-1),t.ɵɵadvance(),t.ɵɵconditional(null!=(i=n.rpcParametersFormGroup.get("withResponse"))&&i.value?15:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(19,13,"gateway.rpc.valueExpression"))}},dependencies:t.ɵɵgetComponentDepsFactory(sW,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:flex;flex-direction:column}[_nghost-%COMP%] .mat-mdc-slide-toggle.margin[_ngcontent-%COMP%]{margin-bottom:10px;margin-left:10px}'],changeDetection:o.OnPush})}}function lW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",15),t.ɵɵelement(1,"mat-icon",24),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵproperty("svgIcon",t.ɵɵinterpolate(i.valueTypes.get(e).icon)),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,4,i.valueTypes.get(e).name))}}function pW(e,n){1&e&&(t.ɵɵelement(0,"input",18),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.set")))}function cW(e,n){1&e&&(t.ɵɵelement(0,"input",19),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.set")))}function dW(e,n){1&e&&(t.ɵɵelement(0,"input",20),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.set")))}function uW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",21)(1,"mat-option",15),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",15),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function mW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",22),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function hW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",8)(2,"div",9),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11)(6,"mat-select",12)(7,"mat-select-trigger")(8,"div",13),t.ɵɵelement(9,"mat-icon",14),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵrepeaterCreate(13,lW,5,6,"mat-option",15,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",16)(16,"div",9),t.ɵɵtext(17,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-form-field",17),t.ɵɵconditionalCreate(19,pW,2,4,"input",18)(20,cW,2,4,"input",19)(21,dW,2,4,"input",20)(22,uW,5,2,"mat-select",21),t.ɵɵconditionalCreate(23,mW,3,3,"mat-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",23),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.removeArgument(n))}),t.ɵɵelementStart(26,"mat-icon"),t.ɵɵtext(27,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e,i,a;const r=n.$implicit,o=t.ɵɵnextContext();t.ɵɵproperty("formGroup",r),t.ɵɵadvance(9),t.ɵɵproperty("svgIcon",null==(e=o.valueTypes.get(r.get("type").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,7,null==(i=o.valueTypes.get(r.get("type").value))?null:i.name)),t.ɵɵadvance(2),t.ɵɵrepeater(o.valueTypeKeys),t.ɵɵadvance(6),t.ɵɵconditional((a=r.get("type").value)===o.MappingValueType.STRING?19:a===o.MappingValueType.INTEGER?20:a===o.MappingValueType.DOUBLE?21:a===o.MappingValueType.BOOLEAN?22:-1),t.ɵɵadvance(4),t.ɵɵconditional(r.get(r.get("type").value+"Value").hasError("required")&&r.get(r.get("type").value+"Value").touched?23:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(25,9,"gateway.rpc.remove")))}}class gW{constructor(e,t){this.fb=e,this.cdr=t,this.valueTypeKeys=Object.values(on),this.MappingValueType=on,this.valueTypes=sn,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new _e,this.rpcParametersFormGroup=this.fb.group({method:[null,[ve.required,ve.pattern(hn)]],arguments:this.fb.array([])}),this.observeValueChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.rpcParametersFormGroup.valid?null:{rpcParametersFormGroup:{valid:!1}}}writeValue(e){this.clearArguments(),e.arguments?.map(({type:e,value:t})=>({type:e,[e+"Value"]:t})).forEach(e=>this.addArgument(e)),this.cdr.markForCheck(),this.rpcParametersFormGroup.get("method").patchValue(e.method)}observeValueChanges(){this.rpcParametersFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{const t=e.arguments.map(({type:e,...t})=>({type:e,value:t[e+"Value"]}));this.onChange({method:e.method,arguments:t}),this.onTouched()})}removeArgument(e){this.rpcParametersFormGroup.get("arguments").removeAt(e)}addArgument(e={}){const t=this.fb.group({type:[e.type??on.STRING],stringValue:[e.stringValue??{value:"",disabled:!(Y(e,{})||e.stringValue)},[ve.required,ve.pattern(hn)]],integerValue:[{value:e.integerValue??0,disabled:!ne(e.integerValue)},[ve.required,ve.pattern(gn)]],doubleValue:[{value:e.doubleValue??0,disabled:!ne(e.doubleValue)},[ve.required]],booleanValue:[{value:e.booleanValue??!1,disabled:!ne(e.booleanValue)},[ve.required]]});this.observeTypeChange(t),this.rpcParametersFormGroup.get("arguments").push(t,{emitEvent:!1})}clearArguments(){const e=this.rpcParametersFormGroup.get("arguments");for(;0!==e.length;)e.removeAt(0)}observeTypeChange(e){e.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(t=>{e.disable({emitEvent:!1}),e.get("type").enable({emitEvent:!1}),e.get(t+"Value").enable({emitEvent:!1})})}static{this.ɵfac=function(e){return new(e||gW)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gW,selectors:[["tb-gateway-opc-rpc-parameters"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>gW),multi:!0},{provide:xe,useExisting:a(()=>gW),multi:!0}])],decls:19,vars:13,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","tb-flex","no-padding-top","hint-container"],["appearance","outline",1,"tb-flex"],["matInput","","formControlName","method","placeholder","multiply"],["formArrayName","arguments",1,"tb-form-panel","stroked","arguments-container"],[1,"fields-label"],[1,"flex","flex-1","items-center","justify-center","gap-2.5",3,"formGroup"],["mat-raised-button","",1,"self-start",3,"click"],[1,"tb-form-row","column-xs","type-container","items-center","justify-between"],["translate","",1,"tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],[3,"value"],[1,"tb-form-row","column-xs","value-container","item-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],["matInput","","required","","formControlName","stringValue",3,"placeholder"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder"],["formControlName","booleanValue"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","matTooltip"],[1,"tb-mat-20",3,"svgIcon"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",2)(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"input",3),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"fieldset",4)(10,"strong")(11,"span",5),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()(),t.ɵɵrepeaterCreate(14,hW,28,11,"div",6,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(16,"button",7),t.ɵɵlistener("click",function(){return n.addArgument()}),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.rpc.hint.opc-method")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,7,"gateway.rpc.method")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,9,"gateway.rpc.arguments")),t.ɵɵadvance(2),t.ɵɵrepeater(n.rpcParametersFormGroup.get("arguments").controls),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.rpc.add-argument")," "))},dependencies:t.ɵɵgetComponentDepsFactory(gW,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%] .arguments-container[_ngcontent-%COMP%]{margin-bottom:10px}[_nghost-%COMP%] .type-container[_ngcontent-%COMP%]{width:40%}[_nghost-%COMP%] .value-container[_ngcontent-%COMP%]{width:50%}[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:o.OnPush})}}function fW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SocketMethodProcessingsTranslates.get(e))," ")}}function yW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}class vW extends Ha{constructor(){super(...arguments),this.SocketMethodProcessingsTranslates=qj,this.socketMethodProcessings=Object.values(Vj),this.socketEncoding=Object.values(xt)}initFormGroup(){return this.fb.group({methodRPC:[null,[ve.required,ve.pattern(hn)]],methodProcessing:[Vj.WRITE,[ve.required]],encoding:[Uj.UTF_8,[ve.required,ve.pattern(hn)]],withResponse:[!1,[]]})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(vW)))(n||vW)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:vW,selectors:[["tb-gateway-socket-rpc-parameters"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>vW),multi:!0},{provide:xe,useExisting:a(()=>vW),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:23,vars:13,consts:[[3,"formGroup"],["appearance","outline",1,"w-full"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],["appearance","outline",1,"mat-block"],["formControlName","methodProcessing"],[3,"value"],["formControlName","encoding"],["formControlName","withResponse",1,"mat-slide","margin"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"mat-form-field",1)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",3)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",4),t.ɵɵrepeaterCreate(11,fW,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"mat-form-field",3)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-select",6),t.ɵɵrepeaterCreate(18,yW,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(20,"mat-slide-toggle",7),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,7,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵrepeater(n.socketMethodProcessings),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,9,"gateway.encoding")),t.ɵɵadvance(3),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(22,11,"gateway.rpc.withResponse")," "))},dependencies:t.ɵɵgetComponentDepsFactory(vW,[C]),encapsulation:2,changeDetection:o.OnPush})}}function xW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.loading-devices")))}function bW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.devices-load-error")))}function wW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.rpc.no-devices-found")))}function SW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function CW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function _W(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function TW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.S7RequestTypeTranslates.get(e)))}}function EW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.S7AddressTypeTranslates.get(e)))}}function MW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",2)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-select",10),t.ɵɵrepeaterCreate(5,EW,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rpc.addressType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.s7AddressTypes)}}function IW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function kW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.db-number-required"))}function PW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.db-number-min"))}function DW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.start-required"))}function AW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.start-min"))}function OW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.size-required"))}function RW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.size-min"))}function BW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.bit-required"))}function FW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.bit-range"))}function NW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",2)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",15),t.ɵɵconditionalCreate(5,BW,2,3,"tb-error-icon",6)(6,FW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.bit"));const n=e.formGroup.get("bit").touched;t.ɵɵadvance(3),t.ɵɵconditional(e.formGroup.get("bit").hasError("required")&&n?5:(e.formGroup.get("bit").hasError("min")||e.formGroup.get("bit").hasError("max"))&&n?6:-1)}}function LW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"mat-form-field",2)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",11),t.ɵɵrepeaterCreate(6,IW,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"mat-form-field",2)(9,"mat-label"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(12,"input",12),t.ɵɵconditionalCreate(13,kW,2,3,"tb-error-icon",6)(14,PW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"div",1)(16,"mat-form-field",2)(17,"mat-label"),t.ɵɵtext(18),t.ɵɵpipe(19,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(20,"input",13),t.ɵɵconditionalCreate(21,DW,2,3,"tb-error-icon",6)(22,AW,2,3,"tb-error-icon",6),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",2)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",14),t.ɵɵconditionalCreate(28,OW,2,3,"tb-error-icon",6)(29,RW,2,3,"tb-error-icon",6),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(30,NW,7,4,"mat-form-field",2),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.rpc.dataType")),t.ɵɵadvance(3),t.ɵɵrepeater(e.s7DataTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,10,"gateway.rpc.dbNumber"));const n=e.formGroup.get("dbNumber").touched;t.ɵɵadvance(3),t.ɵɵconditional(e.formGroup.get("dbNumber").hasError("required")&&n?13:e.formGroup.get("dbNumber").hasError("min")&&n?14:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(19,12,"gateway.rpc.start"));const i=e.formGroup.get("start").touched;t.ɵɵadvance(3),t.ɵɵconditional(e.formGroup.get("start").hasError("required")&&i?21:e.formGroup.get("start").hasError("min")&&i?22:-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,14,"gateway.rpc.size"));const a=e.formGroup.get("size").touched;t.ɵɵadvance(3),t.ɵɵconditional(e.formGroup.get("size").hasError("required")&&a?28:e.formGroup.get("size").hasError("min")&&a?29:-1),t.ɵɵadvance(2),t.ɵɵconditional(e.isBooleanDataType?30:-1)}}function VW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.tag-required"))}function qW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.tag-pattern"))}function GW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",16),t.ɵɵconditionalCreate(5,VW,2,3,"tb-error-icon",6)(6,qW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.tag"));const n=e.formGroup.get("tag").touched;t.ɵɵadvance(3),t.ɵɵconditional(e.formGroup.get("tag").hasError("required")&&n?5:e.formGroup.get("tag").hasError("pattern")&&n?6:-1)}}function zW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.vm-address-required"))}function UW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.rpc.vm-address-pattern"))}function jW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",17),t.ɵɵconditionalCreate(5,zW,2,3,"tb-error-icon",6)(6,UW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.vmAddress"));const n=e.formGroup.get("vmAddress").touched;t.ɵɵadvance(3),t.ɵɵconditional(e.formGroup.get("vmAddress").hasError("required")&&n?5:e.formGroup.get("vmAddress").hasError("pattern")&&n?6:-1)}}function HW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function WW(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",6),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.value-pattern"))}function $W(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",18),t.ɵɵconditionalCreate(5,HW,2,3,"tb-error-icon",6)(6,WW,2,3,"tb-error-icon",6),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.rpc.value"));const n=e.formGroup.get("value").touched;t.ɵɵadvance(3),t.ɵɵconditional(e.formGroup.get("value").hasError("required")&&n?5:e.formGroup.get("value").hasError("pattern")&&n?6:-1)}}class KW extends Ha{constructor(){super(...arguments),this.S7RequestType=Hj,this.S7AddressType=$j,this.S7DeviceType=jj,this.S7RequestTypeTranslates=Wj,this.S7AddressTypeTranslates=Kj,this.s7DataTypes=Object.values(Xj),this.s7DeviceTypes=Object.values(jj),this.s7RequestTypes=Array.from(Wj.keys()),this.s7AddressTypes=Yj,this.devices=[],this.devicesLoaded=!1,this.devicesLoadError=!1,this.cdr=s(d)}get isBooleanDataType(){return Zj.includes(this.formGroup.get("dataType").value)}ngOnInit(){this.loadDevices()}initFormGroup(){const e=this.fb.group({deviceName:[null,[ve.required]],deviceType:[jj.PLC,[ve.required]],requestType:[Hj.READ,[ve.required]],type:[$j.DATA,[ve.required]],dataType:[Xj.BOOLEAN,[ve.required]],dbNumber:[0,[ve.required,ve.min(0)]],start:[0,[ve.required,ve.min(0)]],size:[1,[ve.required,ve.min(0)]],bit:[0,[ve.required,ve.min(0),ve.max(7)]],tag:[{value:null,disabled:!0},[ve.required,ve.pattern(hn)]],vmAddress:[{value:null,disabled:!0},[ve.required,ve.pattern(hn)]],value:[{value:null,disabled:!0},[ve.required,ve.pattern(hn)]]});return e.get("deviceType").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>this.onDeviceTypeChange(e)),e.get("requestType").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>this.updateValueEnabling(e)),e.get("type").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>this.updateAddressTypeEnabling(e)),e.get("dataType").valueChanges.pipe(de(this.destroyRef)).subscribe(()=>this.updateBitEnabling()),e}onWriteValue(e){if(super.onWriteValue(e),e&&"object"==typeof e){const t=e.type===$j.VM?jj.LOGO:jj.PLC;this.formGroup.get("deviceType").setValue(t,{emitEvent:!1}),this.onDeviceTypeChange(t),this.updateValueEnabling(this.formGroup.get("requestType").value),this.cdr.markForCheck()}}mapOnChangeValue(e){const{deviceType:t,...n}=e;return n}onDeviceTypeChange(e){const t=this.formGroup.get("type");e===jj.LOGO?t.setValue($j.VM,{emitEvent:!1}):t.value===$j.VM&&t.setValue($j.DATA,{emitEvent:!1}),this.updateAddressTypeEnabling(t.value)}updateAddressTypeEnabling(e){const t=this.formGroup.get("dataType"),n=this.formGroup.get("dbNumber"),i=this.formGroup.get("start"),a=this.formGroup.get("size"),r=this.formGroup.get("tag"),o=this.formGroup.get("vmAddress");this.toggleControl(t,e===$j.DATA),this.toggleControl(n,e===$j.DATA),this.toggleControl(i,e===$j.DATA),this.toggleControl(a,e===$j.DATA),this.toggleControl(r,e===$j.TAG),this.toggleControl(o,e===$j.VM),this.updateBitEnabling()}updateBitEnabling(){const e=this.formGroup.get("bit"),t=this.formGroup.get("type").value===$j.DATA,n=this.isBooleanDataType;this.toggleControl(e,t&&n)}updateValueEnabling(e){this.toggleControl(this.formGroup.get("value"),e===Hj.WRITE)}loadDevices(){const e=this.ctx.stateController.getStateParams().connector_rpc.value,t={entityFilter:{type:L.entityType,entityType:R.DEVICE},pageLink:N(100),entityFields:[{type:F.ENTITY_FIELD,key:"name"}],keyFilters:[this.buildAttributeEqualsFilter("connectorType",e.type),this.buildAttributeEqualsFilter("connectorName",e.name)]};this.ctx.entityService.findEntityDataByQuery(t).pipe(de(this.destroyRef)).subscribe({next:e=>{this.devices=e.data.map(e=>e.latest[F.ENTITY_FIELD]?.name?.value).filter(e=>!!e),this.devicesLoaded=!0,this.cdr.markForCheck()},error:()=>{this.devicesLoadError=!0,this.devicesLoaded=!0,this.cdr.markForCheck()}})}buildAttributeEqualsFilter(e,t){return{key:{type:F.CLIENT_ATTRIBUTE,key:e},valueType:G.STRING,predicate:{type:q.STRING,operation:V.EQUAL,value:{defaultValue:t},ignoreCase:!0}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(KW)))(n||KW)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:KW,selectors:[["tb-gateway-s7-rpc-parameters"]],inputs:{ctx:"ctx"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>KW),multi:!0},{provide:xe,useExisting:a(()=>KW),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:33,vars:17,consts:[[3,"formGroup"],[1,"flex","flex-1","flex-row","gap-2.5"],["appearance","outline",1,"flex-1"],["formControlName","deviceName"],["disabled",""],[3,"value"],["matSuffix","",3,"tooltipText"],["formControlName","deviceType"],["formControlName","requestType"],["appearance","outline",1,"w-full"],["formControlName","type"],["formControlName","dataType"],["matInput","","type","number","min","0","formControlName","dbNumber"],["matInput","","type","number","min","0","formControlName","start"],["matInput","","type","number","min","0","formControlName","size"],["matInput","","type","number","min","0","max","7","formControlName","bit"],["matInput","","formControlName","tag","placeholder","DB0.DBX0.0"],["matInput","","formControlName","vmAddress","placeholder","VW30"],["matInput","","formControlName","value"]],template:function(e,n){1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1)(2,"mat-form-field",2)(3,"mat-label"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-select",3),t.ɵɵconditionalCreate(7,xW,3,3,"mat-option",4)(8,bW,3,3,"mat-option",4)(9,wW,3,3,"mat-option",4),t.ɵɵrepeaterCreate(10,SW,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(12,CW,2,3,"tb-error-icon",6),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",2)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-select",7),t.ɵɵrepeaterCreate(18,_W,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",1)(21,"mat-form-field",2)(22,"mat-label"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",8),t.ɵɵrepeaterCreate(26,TW,3,4,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(28,MW,7,3,"mat-form-field",2),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(29,LW,31,16),t.ɵɵconditionalCreate(30,GW,7,4,"mat-form-field",9),t.ɵɵconditionalCreate(31,jW,7,4,"mat-form-field",9),t.ɵɵconditionalCreate(32,$W,7,4,"mat-form-field",9),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,11,"gateway.rpc.deviceName")),t.ɵɵadvance(3),t.ɵɵconditional(n.devicesLoaded?n.devicesLoadError?8:n.devices.length?-1:9:7),t.ɵɵadvance(3),t.ɵɵrepeater(n.devices),t.ɵɵadvance(2),t.ɵɵconditional(n.formGroup.get("deviceName").hasError("required")&&n.formGroup.get("deviceName").touched?12:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,13,"gateway.rpc.deviceType")),t.ɵɵadvance(3),t.ɵɵrepeater(n.s7DeviceTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,15,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵrepeater(n.s7RequestTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.formGroup.get("deviceType").value!==n.S7DeviceType.LOGO?28:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("type").value===n.S7AddressType.DATA?29:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("type").value===n.S7AddressType.TAG?30:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("type").value===n.S7AddressType.VM?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.formGroup.get("requestType").value===n.S7RequestType.WRITE?32:-1))},dependencies:t.ɵɵgetComponentDepsFactory(KW,[C,si]),encapsulation:2,changeDetection:o.OnPush})}}const YW=e=>({border:e}),XW=e=>({type:e});function ZW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function QW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-min")," "))}function JW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field",6)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-select",7),t.ɵɵrepeaterCreate(5,ZW,2,2,"mat-option",8,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",9)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",10),t.ɵɵconditionalCreate(12,QW,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",11),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.sendCommand())}),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵrepeater(e.RPCCommands),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.statistics.timeout")),t.ɵɵadvance(3),t.ɵɵconditional(e.commandForm.get("time").hasError("min")?12:-1),t.ɵɵadvance(),t.ɵɵproperty("disabled",e.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,9,"gateway.rpc-command-send")," ")}}function e$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector",14),t.ɵɵlistener("sendCommand",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.sendCommand())})("saveTemplate",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.saveTemplate())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("connectorType",e.connectorType)}}function t$(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-modbus-rpc-parameters",16)}function n$(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-mqtt-rpc-parameters",16)}function i$(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-opc-rpc-parameters",16)}function a$(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-socket-rpc-parameters",16)}function r$(e,n){if(1&e&&t.ɵɵelement(0,"tb-gateway-s7-rpc-parameters",17),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ctx",e.ctx)}}function o$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",13)(1,"div",15),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(4,t$,1,0,"tb-gateway-modbus-rpc-parameters",16)(5,n$,1,0,"tb-gateway-mqtt-rpc-parameters",16)(6,i$,1,0,"tb-gateway-opc-rpc-parameters",16)(7,a$,1,0,"tb-gateway-socket-rpc-parameters",16)(8,r$,1,1,"tb-gateway-s7-rpc-parameters",17),t.ɵɵelementStart(9,"div",18)(10,"button",19),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.saveTemplate())}),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",11),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.sendCommand())}),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,6,"gateway.rpc.title",t.ɵɵpureFunction1(13,XW,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵconditional((e=n.connectorType)===n.ConnectorType.MODBUS?4:e===n.ConnectorType.MQTT?5:e===n.ConnectorType.OPCUA?6:e===n.ConnectorType.SOCKET?7:e===n.ConnectorType.S7?8:-1),t.ɵɵadvance(6),t.ɵɵproperty("disabled",n.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,9,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,11,"gateway.rpc-command-send")," ")}}function s$(e,n){if(1&e&&t.ɵɵconditionalCreate(0,e$,1,1,"tb-gateway-service-rpc-connector",12)(1,o$,16,15,"div",13),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.typesWithUpdatedParams.has(e.connectorType)?1:0)}}function l$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"mat-icon",20),t.ɵɵtext(2,"schedule"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"span"),t.ɵɵtext(4),t.ɵɵpipe(5,"date"),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(5,1,e.resultTime,"yyyy/MM/dd HH:mm:ss"))}}function p$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector-templates",21),t.ɵɵlistener("useTemplate",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.useTemplate(n))}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("rpcTemplates",e.templates)("ctx",e.ctx)("connectorType",e.connectorType)}}class c${constructor(e,t,n,i,a){this.fb=e,this.dialog=t,this.utils=n,this.cd=i,this.attributeService=a,this.contentTypes=z,this.RPCCommands=["Ping","Stats","Devices","Update","Version","Restart","Reboot"],this.templates=[],this.ConnectorType=gt,this.gatewayConnectorDefaultTypesTranslates=ft,this.typesWithUpdatedParams=new Set([gt.MQTT,gt.OPCUA,gt.MODBUS,gt.SOCKET,gt.S7]),this.modbusReadFunctionCodes=[1,2,3,4],this.subscriptionOptions={callbacks:{onDataUpdated:()=>this.ctx.ngZone.run(()=>{this.updateTemplates()}),onDataUpdateError:(e,t)=>this.ctx.ngZone.run(()=>{this.onDataUpdateError(t)}),dataLoading:()=>{}}},this.commandForm=this.fb.group({command:[null,[ve.required]],time:[60,[ve.required,ve.min(1)]],params:["{}",[ut]],result:[null]})}ngOnInit(){if(this.isConnector=this.ctx.settings.isConnector,this.isConnector){this.connectorType=this.ctx.stateController.getStateParams().connector_rpc.value.type;const e=[{type:B.entity,entityType:R.DEVICE,entityId:this.ctx.defaultSubscription.targetDeviceId,entityName:"Connector",attributes:[{name:`${this.connectorType}_template`}]}];this.ctx.subscriptionApi.createSubscriptionFromInfo(S.latest,e,this.subscriptionOptions,!1,!0).subscribe(e=>{this.subscription=e})}else this.commandForm.get("command").setValue(this.RPCCommands[0])}sendCommand(e){this.resultTime=null;const t=e||this.commandForm.value,n=this.isConnector?`${this.connectorType}_`:"gateway_",i=this.isConnector?this.getCommandFromParamsByType(t.params):t.command.toLowerCase(),a=this.ctx.stateController.getStateParams().connector_rpc?.value.configurationJson.id,r=a?{...t.params,connectorId:a}:t.params;this.ctx.controlApi.sendTwoWayCommand(n+i,r,t.time).subscribe({next:e=>{this.resultTime=(new Date).getTime(),this.commandForm.get("result").setValue(JSON.stringify(e))},error:e=>{this.resultTime=(new Date).getTime(),console.error(e),this.commandForm.get("result").setValue(JSON.stringify(e.error))}})}getCommandFromParamsByType(e){switch(this.connectorType){case gt.MQTT:case gt.FTP:case gt.SNMP:case gt.REST:case gt.REQUEST:return e.methodFilter;case gt.MODBUS:return this.modbusReadFunctionCodes.includes(e.functionCode)?"get":"set";case gt.BACNET:case gt.CAN:case gt.OPCUA:return e.method;case gt.BLE:case gt.OCPP:case gt.SOCKET:case gt.XMPP:return e.methodRPC;case gt.S7:return e.requestType;default:return e.command}}saveTemplate(){this.dialog.open(bH,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{config:this.commandForm.value.params,templates:this.templates}}).afterClosed().subscribe(e=>{if(e){const t={name:e,config:this.commandForm.value.params,type:this.connectorType},n=this.templates,i=n.findIndex(e=>e.name==t.name);i>-1&&n.splice(i,1),n.push(t);const a=`${this.connectorType}_template`;this.attributeService.saveEntityAttributes({id:this.ctx.defaultSubscription.targetDeviceId,entityType:R.DEVICE},P.SERVER_SCOPE,[{key:a,value:n}]).subscribe(()=>{this.cd.detectChanges()})}})}useTemplate(e){this.commandForm.get("params").patchValue(e.config)}updateTemplates(){this.templates=this.subscription.data[0].data[0][1].length?JSON.parse(this.subscription.data[0].data[0][1]):[],this.cd.detectChanges()}onDataUpdateError(e){const t=this.utils.parseException(e);let n=t.name;t.message&&(n+=": "+t.message),console.error(n)}static{this.ɵfac=function(e){return new(e||c$)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(Z.UtilsService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(Z.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:c$,selectors:[["tb-gateway-service-rpc"]],inputs:{ctx:"ctx",dialogRef:"dialogRef"},decls:11,vars:15,consts:[[1,"flex","flex-1","flex-col"],[1,"command-form","lt-sm:flex-col","flex","flex-row","gap-2.5",3,"formGroup"],[1,"result-block",3,"formGroup"],[1,"result-time","flex","flex-1","flex-row","items-center","justify-center"],["readonly","true","formControlName","result",3,"contentType"],[1,"border",3,"rpcTemplates","ctx","connectorType"],["appearance","outline"],["formControlName","command"],[3,"value"],["appearance","outline",1,"flex-1"],["matInput","","formControlName","time","type","number","min","1"],["mat-raised-button","","color","primary",3,"click","disabled"],["formControlName","params",3,"connectorType"],[1,"rpc-parameters","flex","flex-col"],["formControlName","params",3,"sendCommand","saveTemplate","connectorType"],[1,"mat-subtitle-1","tb-form-panel-title"],["formControlName","params"],["formControlName","params",3,"ctx"],[1,"fex-row","template-actions","flex","flex-1","items-center","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],[1,"material-icons"],[1,"border",3,"useTemplate","rpcTemplates","ctx","connectorType"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵconditionalCreate(2,JW,16,11)(3,s$,2,1),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"section",2)(5,"span"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵconditionalCreate(8,l$,6,4,"div",3),t.ɵɵelementEnd(),t.ɵɵelement(9,"tb-json-content",4),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(10,p$,1,3,"tb-gateway-service-rpc-connector-templates",5)),2&e&&(t.ɵɵclassMap(t.ɵɵpureFunction1(13,YW,n.isConnector)),t.ɵɵadvance(),t.ɵɵclassProp("gateway-command-form",!n.isConnector),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(),t.ɵɵconditional(n.isConnector?3:2),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(7,11,"gateway.rpc-command-result")," "),t.ɵɵadvance(2),t.ɵɵconditional(n.resultTime?8:-1),t.ɵɵadvance(),t.ɵɵproperty("contentType",n.contentTypes.JSON),t.ɵɵadvance(),t.ɵɵconditional(n.isConnector?10:-1))},dependencies:t.ɵɵgetComponentDepsFactory(c$,[ce,C,QH,aW,sW,gW,yH,vW,KW]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;overflow:auto;display:flex;flex-direction:row;padding:0 5px}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{height:100%;overflow:auto}[_nghost-%COMP%] > tb-gateway-service-rpc-connector-templates[_ngcontent-%COMP%]:last-child{margin-left:10px}[_nghost-%COMP%] tb-gateway-service-rpc-connector-templates[_ngcontent-%COMP%]{flex:1 1 30%;max-width:30%}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%]{flex-wrap:nowrap;padding:0 5px 5px}[_nghost-%COMP%] .command-form.gateway-command-form[_ngcontent-%COMP%]{padding-top:4px}[_nghost-%COMP%] .command-form[_ngcontent-%COMP%] > button[_ngcontent-%COMP%]{margin-top:10px}[_nghost-%COMP%] .rpc-parameters[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%]{padding:0 5px;display:flex;flex-direction:column;flex:1}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-weight:600;position:relative;font-size:14px;margin-bottom:10px}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] .result-time[_ngcontent-%COMP%]{font-weight:400;font-size:14px;line-height:32px;position:absolute;left:0;top:25px;z-index:5;color:#0000008a}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] .result-time[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{padding-left:10px}[_nghost-%COMP%] .result-block[_ngcontent-%COMP%] tb-json-content[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] .border[_ngcontent-%COMP%]{padding:16px;box-shadow:0 0 #0003,0 0 #00000024,0 0 #0000001f;border:solid 1px #e0e0e0;border-radius:4px}']})}}function d$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration-delete-dialog-input-required")," "))}e("GatewayServiceRPCComponent",c$);class u$ extends D{constructor(e,t,n,i,a){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.gatewayName=this.data.gatewayName,this.gatewayControl=this.fb.control("")}close(){this.dialogRef.close()}turnOff(){this.dialogRef.close(!0)}static{this.ɵfac=function(e){return new(e||u$)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:u$,selectors:[["tb-gateway-remote-configuration-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:24,vars:14,consts:[["color","warn"],["translate",""],[1,"flex-1"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"mat-content","flex-col",2,"max-width","600px"],[3,"innerHTML"],["appearance","outline",1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","warn","type","button","cdkFocusInitial","",3,"click"],["mat-button","","color","warn","type","button",3,"click","disabled"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-toolbar",0)(1,"mat-icon"),t.ɵɵtext(2,"warning"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"h2",1),t.ɵɵtext(4,"gateway.configuration-delete-dialog-header"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2),t.ɵɵelementStart(6,"button",3),t.ɵɵlistener("click",function(){return n.close()}),t.ɵɵelementStart(7,"mat-icon",4),t.ɵɵtext(8,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",5),t.ɵɵelement(10,"span",6),t.ɵɵpipe(11,"translate"),t.ɵɵelementStart(12,"mat-form-field",7)(13,"mat-label",1),t.ɵɵtext(14,"gateway.configuration-delete-dialog-input"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",8),t.ɵɵconditionalCreate(16,d$,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",9)(18,"button",10),t.ɵɵlistener("click",function(){return n.close()}),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",11),t.ɵɵlistener("click",function(){return n.turnOff()}),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(10),t.ɵɵproperty("innerHTML",t.ɵɵinterpolate2("",t.ɵɵpipeBind1(11,8,"gateway.configuration-delete-dialog-body")," ",n.gatewayName,""),t.ɵɵsanitizeHtml),t.ɵɵadvance(5),t.ɵɵproperty("formControl",n.gatewayControl),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayControl.hasError("required")?16:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(20,10,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.gatewayControl.value!==n.gatewayName),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,12,"gateway.configuration-delete-dialog-confirm")," "))},dependencies:t.ɵɵgetComponentDepsFactory(u$,[C]),encapsulation:2})}}var m$;e("GatewayRemoteConfigurationDialogComponent",u$),function(e){e.tls="tls",e.accessToken="accessToken"}(m$||(m$={}));const h$="configuration_drafts",g$="RemoteLoggingLevel",f$=new Map([[m$.tls,"gateway.security-types.tls"],[m$.accessToken,"gateway.security-types.access-token"]]);var y$,v$;!function(e){e.none="NONE",e.critical="CRITICAL",e.error="ERROR",e.warning="WARNING",e.info="INFO",e.debug="DEBUG"}(y$||(y$={})),function(e){e.memory="memory",e.file="file"}(v$||(v$={}));const x$=new Map([[v$.memory,"gateway.storage-types.memory-storage"],[v$.file,"gateway.storage-types.file-storage"]]);var b$;!function(e){e.mqtt="MQTT",e.modbus="Modbus",e.opcua="OPC-UA",e.ble="BLE",e.request="Request",e.can="CAN",e.bacnet="BACnet",e.custom="Custom"}(b$||(b$={}));const w$={config:{},name:"",configType:null,enabled:!1};function S$(e){return JSON.stringify(e.value)===JSON.stringify({})?{validJSON:!0}:null}function C$(e){return e.replace("_","").replace("-","").replace(/^\s+|\s+/g,"").toLowerCase()+".json"}function _$(e,t){return'[loggers]}}keys=root, service, connector, converter, tb_connection, storage, extension}}[handlers]}}keys=consoleHandler, serviceHandler, connectorHandler, converterHandler, tb_connectionHandler, storageHandler, extensionHandler}}[formatters]}}keys=LogFormatter}}[logger_root]}}level=ERROR}}handlers=consoleHandler}}[logger_connector]}}level={ERROR}}}handlers=connectorHandler}}formatter=LogFormatter}}qualname=connector}}[logger_storage]}}level={ERROR}}}handlers=storageHandler}}formatter=LogFormatter}}qualname=storage}}[logger_tb_connection]}}level={ERROR}}}handlers=tb_connectionHandler}}formatter=LogFormatter}}qualname=tb_connection}}[logger_service]}}level={ERROR}}}handlers=serviceHandler}}formatter=LogFormatter}}qualname=service}}[logger_converter]}}level={ERROR}}}handlers=converterHandler}}formatter=LogFormatter}}qualname=converter}}[logger_extension]}}level={ERROR}}}handlers=connectorHandler}}formatter=LogFormatter}}qualname=extension}}[handler_consoleHandler]}}class=StreamHandler}}level={ERROR}}}formatter=LogFormatter}}args=(sys.stdout,)}}[handler_connectorHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}connector.log", "d", 1, 7,)}}[handler_storageHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}storage.log", "d", 1, 7,)}}[handler_serviceHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}service.log", "d", 1, 7,)}}[handler_converterHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}converter.log", "d", 1, 3,)}}[handler_extensionHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}extension.log", "d", 1, 3,)}}[handler_tb_connectionHandler]}}level={ERROR}}}class=logging.handlers.TimedRotatingFileHandler}}formatter=LogFormatter}}args=("{./logs/}tb_connection.log", "d", 1, 3,)}}[formatter_LogFormatter]}}format="%(asctime)s - %(levelname)s - [%(filename)s] - %(module)s - %(lineno)d - %(message)s" }}datefmt="%Y-%m-%d %H:%M:%S"'.replace(/{ERROR}/g,e).replace(/{.\/logs\/}/g,t)}function T$(e){return{id:e,entityType:R.DEVICE}}function E$(e){const t={};return Object.prototype.hasOwnProperty.call(e,"thingsboard")&&(t.host=e.thingsboard.host,t.port=e.thingsboard.port,t.remoteConfiguration=e.thingsboard.remoteConfiguration,Object.prototype.hasOwnProperty.call(e.thingsboard.security,m$.accessToken)?(t.securityType=m$.accessToken,t.accessToken=e.thingsboard.security.accessToken):(t.securityType=m$.tls,t.caCertPath=e.thingsboard.security.caCert,t.privateKeyPath=e.thingsboard.security.privateKey,t.certPath=e.thingsboard.security.cert)),Object.prototype.hasOwnProperty.call(e,"storage")&&Object.prototype.hasOwnProperty.call(e.storage,"type")&&(e.storage.type===v$.memory?(t.storageType=v$.memory,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count):e.storage.type===v$.file&&(t.storageType=v$.file,t.dataFolderPath=e.storage.data_folder_path,t.maxFilesCount=e.storage.max_file_count,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count)),t}function M$(e){const t={};for(const n of e)n.enabled||(t[n.name]={connector:n.configType,config:n.config});return t}function I$(e){const t={thingsboard:k$(e)};return function(e,t){for(const n of t)if(n.enabled){const t=n.configType;Array.isArray(e[t])||(e[t]=[]);const i={name:n.name,config:n.config};e[t].push(i)}}(t,e.connectors),t}function k$(e){let t;t=e.securityType===m$.accessToken?{accessToken:e.accessToken}:{caCert:e.caCertPath,privateKey:e.privateKeyPath,cert:e.certPath};const n={host:e.host,remoteConfiguration:e.remoteConfiguration,port:e.port,security:t};let i;i=e.storageType===v$.memory?{type:v$.memory,read_records_count:e.readRecordsCount,max_records_count:e.maxRecordsCount}:{type:v$.file,data_folder_path:e.dataFolderPath,max_file_count:e.maxFilesCount,max_read_records_count:e.readRecordsCount,max_records_per_file:e.maxRecordsCount};const a=[];for(const t of e.connectors)if(t.enabled){const e={configuration:C$(t.name),name:t.name,type:t.configType};a.push(e)}return{thingsboard:n,connectors:a,storage:i,logs:window.btoa(_$(e.remoteLoggingLevel,e.remoteLoggingPathToLogs))}}const P$=["formContainer"],D$=(e,t,n)=>({"gap-1.25":e,"flex-row":t,"flex-col":n}),A$=(e,t,n)=>({"gap-1.25":e,"flex-row justify-end item-center":t,"flex-col justify-evenly item-center":n});function O$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e.value.toString())," ")}}function R$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-host-required "),t.ɵɵelementEnd())}function B$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-required "),t.ɵɵelementEnd())}function F$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-min "),t.ɵɵelementEnd())}function N$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-max "),t.ɵɵelementEnd())}function L$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.thingsboard-port-pattern "),t.ɵɵelementEnd())}function V$(e,n){1&e&&(t.ɵɵelementStart(0,"div",13)(1,"mat-form-field",17)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",17)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",30),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",17)(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",31),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.tls-path-ca-certificate")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,5,"gateway.tls-path-private-key")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,7,"gateway.tls-path-client-certificate")))}function q$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function G$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.path-logs-required "),t.ɵɵelementEnd())}function z$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e.value.toString())," ")}}function U$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-pack-size-required "),t.ɵɵelementEnd())}function j$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-pack-size-min "),t.ɵɵelementEnd())}function H$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-pack-size-pattern "),t.ɵɵelementEnd())}function W$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-records-required "),t.ɵɵelementEnd())}function $$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-records-min "),t.ɵɵelementEnd())}function K$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-records-pattern "),t.ɵɵelementEnd())}function Y$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-files-required "),t.ɵɵelementEnd())}function X$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-files-min "),t.ɵɵelementEnd())}function Z$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-max-files-pattern "),t.ɵɵelementEnd())}function Q$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.storage-path-required "),t.ɵɵelementEnd())}function J$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-form-field",9)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",32),t.ɵɵconditionalCreate(6,Y$,2,0,"mat-error",11),t.ɵɵconditionalCreate(7,X$,2,0,"mat-error",11),t.ɵɵconditionalCreate(8,Z$,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",9)(10,"mat-label"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",33),t.ɵɵconditionalCreate(14,Q$,2,0,"mat-error",11),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction3(12,D$,e.layoutGap,e.alignment,!e.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.storage-max-files")),t.ɵɵadvance(3),t.ɵɵconditional(e.gatewayConfigurationGroup.get("maxFilesCount").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.gatewayConfigurationGroup.get("maxFilesCount").hasError("min")?7:-1),t.ɵɵadvance(),t.ɵɵconditional(e.gatewayConfigurationGroup.get("maxFilesCount").hasError("pattern")?8:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,10,"gateway.storage-path")),t.ɵɵadvance(3),t.ɵɵconditional(e.gatewayConfigurationGroup.get("dataFolderPath").hasError("required")?14:-1)}}function eK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",7),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function tK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.connector-type-required "),t.ɵɵelementEnd())}function nK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",11),t.ɵɵtext(1," gateway.connector-name-required "),t.ɵɵelementEnd())}function iK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",23)(1,"div",34)(2,"div",35),t.ɵɵelement(3,"mat-slide-toggle",36),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",37)(5,"mat-form-field",9)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",38),t.ɵɵlistener("selectionChange",function(){const n=t.ɵɵrestoreView(e).$implicit,i=t.ɵɵnextContext();return t.ɵɵresetView(i.changeConnectorType(n))}),t.ɵɵrepeaterCreate(10,eK,2,2,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(12,tK,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",9)(14,"mat-label"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"input",39),t.ɵɵlistener("blur",function(){const n=t.ɵɵrestoreView(e),i=n.$implicit,a=n.$index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.changeConnectorName(i,a))}),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(18,nK,2,0,"mat-error",11),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",40)(20,"button",41),t.ɵɵpipe(21,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e),a=i.$implicit,r=i.$index,o=t.ɵɵnextContext();return t.ɵɵresetView(o.openConfigDialog(n,r,a.get("config").value,a.get("name").value))}),t.ɵɵelementStart(22,"mat-icon"),t.ɵɵtext(23,"more_horiz"),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",41),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",function(){const n=t.ɵɵrestoreView(e).$index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.removeConnector(n))}),t.ɵɵelementStart(26,"mat-icon"),t.ɵɵtext(27,"close"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,i=n.$index,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("formGroupName",i),t.ɵɵadvance(3),t.ɵɵclassMap(t.ɵɵpureFunction3(25,D$,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,17,"gateway.connector-type")),t.ɵɵadvance(3),t.ɵɵrepeater(a.connectorTypes),t.ɵɵadvance(2),t.ɵɵconditional(e.get("configType").hasError("required")?12:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,19,"gateway.connector-name")),t.ɵɵadvance(3),t.ɵɵconditional(e.get("name").hasError("required")?18:-1),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction3(29,A$,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(),t.ɵɵclassProp("mat-warn",e.get("config").invalid),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(21,21,"gateway.update-config")))("disabled",a.isReadOnlyForm),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(25,23,"gateway.delete")))("disabled",a.isReadOnlyForm)}}function aK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",42),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.exportConfig())}),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"gateway.download-tip")))("disabled",!e.gatewayConfigurationGroup.dirty||e.gatewayConfigurationGroup.invalid),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,6,"action.download")," ")}}function rK(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",28),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"gateway.save-tip")))("disabled",!e.gatewayConfigurationGroup.dirty||e.gatewayConfigurationGroup.invalid),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,6,"action.save")," ")}}class oK extends U{constructor(e,t,n,i,a,r,o,s,l,p,c){super(e),this.store=e,this.elementRef=t,this.utils=n,this.ngZone=i,this.fb=a,this.window=r,this.dialog=o,this.translate=s,this.deviceService=l,this.attributeService=p,this.importExport=c,this.alignment=!0,this.layoutGap=!0,this.securityTypes=f$,this.gatewayLogLevels=Object.keys(y$).map(e=>y$[e]),this.connectorTypes=Object.keys(b$),this.storageTypes=x$,this.toastTargetId="gateway-configuration-widget"+this.utils.guid(),this.isReadOnlyForm=!1}get connectors(){return this.gatewayConfigurationGroup.get("connectors")}ngOnInit(){this.initWidgetSettings(this.ctx.settings),this.ctx.datasources&&this.ctx.datasources.length&&(this.deviceNameForm=this.ctx.datasources[0].name),this.buildForm(),this.ctx.updateWidgetParams(),this.formResize$=new ResizeObserver(()=>{this.resize()}),this.formResize$.observe(this.formContainerRef.nativeElement)}ngOnDestroy(){this.formResize$&&this.formResize$.disconnect(),this.subscribeGateway$.unsubscribe(),this.subscribeStorageType$.unsubscribe()}initWidgetSettings(e){let t;t=e.gatewayTitle&&e.gatewayTitle.length?this.utils.customTranslation(e.gatewayTitle,e.gatewayTitle):this.translate.instant("gateway.gateway"),this.ctx.widgetTitle=t,this.isReadOnlyForm=!!e.readOnly&&e.readOnly,this.archiveFileName=e.archiveFileName?.length?e.archiveFileName:"gatewayConfiguration",this.gatewayType=e.gatewayType?.length?e.gatewayType:"Gateway",this.gatewayNameExists=this.utils.customTranslation(e.gatewayNameExists,e.gatewayNameExists)||this.translate.instant("gateway.gateway-exists"),this.successfulSaved=this.utils.customTranslation(e.successfulSave,e.successfulSave)||this.translate.instant("gateway.gateway-saved"),this.updateWidgetDisplaying()}resize(){this.ngZone.run(()=>{this.updateWidgetDisplaying(),this.ctx.detectChanges()})}updateWidgetDisplaying(){this.ctx.$container&&this.ctx.$container[0].offsetWidth<=425?(this.layoutGap=!1,this.alignment=!1):(this.layoutGap=!0,this.alignment=!0)}saveAttribute(e,t,n){const i=this.gatewayConfigurationGroup.get("gateway").value,a={key:e,value:t};return this.attributeService.saveEntityAttributes(T$(i),n,[a])}createConnector(e=w$){this.connectors.push(this.fb.group({enabled:[e.enabled],configType:[e.configType,[ve.required]],name:[e.name,[ve.required]],config:[e.config,[ve.nullValidator,S$]]}))}getFormField(e){return this.gatewayConfigurationGroup.get(e)}buildForm(){this.gatewayConfigurationGroup=this.fb.group({gateway:[null,[]],accessToken:[null,[ve.required]],securityType:[m$.accessToken],host:[this.window.location.hostname,[ve.required]],port:[1883,[ve.required,ve.min(1),ve.max(65535),ve.pattern(/^-?[0-9]+$/)]],remoteConfiguration:[!0],caCertPath:["/etc/thingsboard-gateway/ca.pem"],privateKeyPath:["/etc/thingsboard-gateway/privateKey.pem"],certPath:["/etc/thingsboard-gateway/certificate.pem"],remoteLoggingLevel:[y$.debug],remoteLoggingPathToLogs:["./logs/",[ve.required]],storageType:[v$.memory],readRecordsCount:[100,[ve.required,ve.min(1),ve.pattern(/^-?[0-9]+$/)]],maxRecordsCount:[1e4,[ve.required,ve.min(1),ve.pattern(/^-?[0-9]+$/)]],maxFilesCount:[5,[ve.required,ve.min(1),ve.pattern(/^-?[0-9]+$/)]],dataFolderPath:["./data/",[ve.required]],connectors:this.fb.array([])}),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1}),this.subscribeStorageType$=this.getFormField("storageType").valueChanges.subscribe(e=>{e===v$.memory?(this.getFormField("maxFilesCount").disable(),this.getFormField("dataFolderPath").disable()):(this.getFormField("maxFilesCount").enable(),this.getFormField("dataFolderPath").enable())}),this.subscribeGateway$=this.getFormField("gateway").valueChanges.subscribe(e=>{null!==e?Pe([this.deviceService.getDeviceCredentials(e).pipe(Fe(e=>{this.getFormField("accessToken").patchValue(e.credentialsId)})),...this.getAttributes(e)]).subscribe(()=>{this.gatewayConfigurationGroup.markAsPristine(),this.ctx.detectChanges()}):this.getFormField("accessToken").patchValue("")})}gatewayExist(){this.ctx.showErrorToast(this.gatewayNameExists,"top","left",this.toastTargetId)}exportConfig(){const e=this.gatewayConfigurationGroup.value,t={};var n,i,a;t["tb_gateway.yaml"]=function(e){let t;t="thingsboard:\n",t+=" host: "+e.host+"\n",t+=" remoteConfiguration: "+e.remoteConfiguration+"\n",t+=" port: "+e.port+"\n",t+=" security:\n",e.securityType===m$.accessToken?t+=" access-token: "+e.accessToken+"\n":(t+=" ca_cert: "+e.caCertPath+"\n",t+=" privateKey: "+e.privateKeyPath+"\n",t+=" cert: "+e.certPath+"\n"),t+="storage:\n",e.storageType===v$.memory?(t+=" type: memory\n",t+=" read_records_count: "+e.readRecordsCount+"\n",t+=" max_records_count: "+e.maxRecordsCount+"\n"):(t+=" type: file\n",t+=" data_folder_path: "+e.dataFolderPath+"\n",t+=" max_file_count: "+e.maxFilesCount+"\n",t+=" max_read_records_count: "+e.readRecordsCount+"\n",t+=" max_records_per_file: "+e.maxRecordsCount+"\n"),t+="connectors:\n";for(const n of e.connectors)n.enabled&&(t+=" -\n",t+=" name: "+n.name+"\n",t+=" type: "+n.configType+"\n",t+=" configuration: "+C$(n.name)+"\n");return t}(e),function(e,t){for(const n of t)n.enabled&&(e[C$(n.name)]=JSON.stringify(n.config))}(t,e.connectors),n=t,i=e.remoteLoggingLevel,a=e.remoteLoggingPathToLogs,n["logs.conf"]=_$(i,a),this.importExport.exportJSZip(t,this.archiveFileName),this.saveAttribute(g$,this.gatewayConfigurationGroup.value.remoteLoggingLevel.toUpperCase(),P.SHARED_SCOPE)}addNewConnector(){this.createConnector()}removeConnector(e){e>-1&&(this.connectors.removeAt(e),this.connectors.markAsDirty())}openConfigDialog(e,t,n,i){e&&(e.stopPropagation(),e.preventDefault()),this.dialog.open(ot,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{jsonValue:n,required:!0,title:this.translate.instant("gateway.title-connectors-json",{typeName:i})}}).afterClosed().subscribe(e=>{e&&(this.connectors.at(t).get("config").patchValue(e),this.ctx.detectChanges())})}createConnectorName(e,t,n=0){const i=n?t+n:t;return-1===e.findIndex(e=>e.name===i)?i:this.createConnectorName(e,t,++n)}validateConnectorName(e,t,n,i=0){for(let a=0;a{this.ctx.showSuccessToast(this.successfulSaved,2e3,"top","left",this.toastTargetId),this.gatewayConfigurationGroup.markAsPristine()})}getAttributes(e){const t=[];return t.push(Pe([this.getAttribute("current_configuration",P.CLIENT_SCOPE,e),this.getAttribute(h$,P.SERVER_SCOPE,e)]).pipe(Fe(([e,t])=>{this.setFormGatewaySettings(e),this.setFormConnectorsDraft(t),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1})}))),t.push(this.getAttribute(g$,P.SHARED_SCOPE,e).pipe(Fe(e=>this.processLoggingLevel(e)))),t}getAttribute(e,t,n){return this.attributeService.getEntityAttributes(T$(n),t,[e])}setFormGatewaySettings(e){if(this.connectors.clear(),e.length>0){const t=JSON.parse(window.atob(e[0].value));for(const e of Object.keys(t)){const n=t[e];if("thingsboard"===e)null!==n&&Object.keys(n).length>0&&this.gatewayConfigurationGroup.patchValue(E$(n));else for(const t of Object.keys(n)){let i="No name";Object.prototype.hasOwnProperty.call(n[t],"name")&&(i=n[t].name);const a={enabled:!0,configType:e,config:n[t].config,name:i};this.createConnector(a)}}}}setFormConnectorsDraft(e){if(e.length>0){const t=JSON.parse(window.atob(e[0].value));for(const e of Object.keys(t)){const n={enabled:!1,configType:t[e].connector,config:t[e].config,name:e};this.createConnector(n)}}}processLoggingLevel(e){let t=y$.debug;e.length>0&&y$[e[0].value.toLowerCase()]&&(t=y$[e[0].value.toLowerCase()]),this.getFormField("remoteLoggingLevel").patchValue(t)}static{this.ɵfac=function(e){return new(e||oK)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(t.ElementRef),t.ɵɵdirectiveInject(Z.UtilsService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(fe.UntypedFormBuilder),t.ɵɵdirectiveInject(X),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(Z.DeviceService),t.ɵɵdirectiveInject(Z.AttributeService),t.ɵɵdirectiveInject(st.ImportExportService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:oK,selectors:[["tb-gateway-form"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(P$,7),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.formContainerRef=e.first)}},inputs:{ctx:"ctx",isStateForm:"isStateForm"},features:[t.ɵɵInheritDefinitionFeature],decls:108,vars:102,consts:[["formContainer",""],["tb-toast","",1,"gateway-form",3,"ngSubmit","formGroup","toastTarget"],["multi","true",1,"mat-body-2"],[1,"tb-panel-title"],["formControlName","gateway","required","",3,"gatewayNameExist","deviceName","isStateForm","newGatewayType"],["appearance","outline",1,"flex"],["formControlName","securityType"],[3,"value"],[1,"flex"],["appearance","outline",1,"flex-1"],["matInput","","type","text","formControlName","host"],["translate",""],["matInput","","type","number","formControlName","port"],[1,"flex","flex-col"],["formControlName","remoteConfiguration"],["formControlName","remoteLoggingLevel"],["matInput","","type","text","formControlName","remoteLoggingPathToLogs"],["appearance","outline"],["formControlName","storageType"],["matInput","","type","number","formControlName","readRecordsCount"],["matInput","","type","number","formControlName","maxRecordsCount"],[1,"flex",3,"class"],[1,"gateway-config","flex","flex-col"],["formArrayName","connectors"],[1,"no-data-found","items-center","justify-center"],["mat-raised-button","","type","button","matTooltipPosition","above",3,"click","matTooltip"],[1,"form-action-buttons","flex","flex-row","items-center","justify-end"],["mat-raised-button","","color","primary","type","button",3,"disabled","matTooltip"],["mat-raised-button","","color","primary","type","submit",3,"disabled","matTooltip"],["matInput","","type","text","formControlName","caCertPath"],["matInput","","type","text","formControlName","privateKeyPath"],["matInput","","type","text","formControlName","certPath"],["matInput","","type","number","formControlName","maxFilesCount"],["matInput","","type","text","formControlName","dataFolderPath"],[1,"flex","flex-row","items-stretch","justify-between","gap-2",3,"formGroupName"],[1,"flex","flex-col","justify-center"],["formControlName","enabled"],[1,"flex-full","flex"],["formControlName","configType",3,"selectionChange"],["matInput","","type","text","formControlName","name",3,"blur"],[1,"action-buttons","flex"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],["mat-raised-button","","color","primary","type","button",3,"click","disabled","matTooltip"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"form",1,0),t.ɵɵlistener("ngSubmit",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.save())}),t.ɵɵelementStart(2,"mat-accordion",2)(3,"mat-expansion-panel")(4,"mat-expansion-panel-header")(5,"mat-panel-title")(6,"div",3),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵpipe(9,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"tb-entity-gateway-select",4),t.ɵɵlistener("gatewayNameExist",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.gatewayExist())}),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",5)(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-select",6),t.ɵɵrepeaterCreate(16,O$,3,4,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(18,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",8)(20,"mat-form-field",9)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",10),t.ɵɵconditionalCreate(25,R$,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",9)(27,"mat-label"),t.ɵɵtext(28),t.ɵɵpipe(29,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(30,"input",12),t.ɵɵconditionalCreate(31,B$,2,0,"mat-error",11),t.ɵɵconditionalCreate(32,F$,2,0,"mat-error",11),t.ɵɵconditionalCreate(33,N$,2,0,"mat-error",11),t.ɵɵconditionalCreate(34,L$,2,0,"mat-error",11),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(35,V$,16,9,"div",13),t.ɵɵelementStart(36,"mat-checkbox",14),t.ɵɵtext(37),t.ɵɵpipe(38,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"div",8)(40,"mat-form-field",9)(41,"mat-label"),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-select",15),t.ɵɵrepeaterCreate(45,q$,2,2,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"mat-form-field",9)(48,"mat-label"),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(51,"input",16),t.ɵɵconditionalCreate(52,G$,2,0,"mat-error",11),t.ɵɵelementEnd()()(),t.ɵɵelementStart(53,"mat-expansion-panel")(54,"mat-expansion-panel-header")(55,"mat-panel-title")(56,"div",3),t.ɵɵtext(57),t.ɵɵpipe(58,"translate"),t.ɵɵpipe(59,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(60,"div",13)(61,"mat-form-field",17)(62,"mat-label"),t.ɵɵtext(63),t.ɵɵpipe(64,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(65,"mat-select",18),t.ɵɵrepeaterCreate(66,z$,3,4,"mat-option",7,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(68,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(69,"div",8)(70,"mat-form-field",9)(71,"mat-label"),t.ɵɵtext(72),t.ɵɵpipe(73,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(74,"input",19),t.ɵɵconditionalCreate(75,U$,2,0,"mat-error",11),t.ɵɵconditionalCreate(76,j$,2,0,"mat-error",11),t.ɵɵconditionalCreate(77,H$,2,0,"mat-error",11),t.ɵɵelementEnd(),t.ɵɵelementStart(78,"mat-form-field",9)(79,"mat-label"),t.ɵɵtext(80),t.ɵɵpipe(81,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(82,"input",20),t.ɵɵconditionalCreate(83,W$,2,0,"mat-error",11),t.ɵɵconditionalCreate(84,$$,2,0,"mat-error",11),t.ɵɵconditionalCreate(85,K$,2,0,"mat-error",11),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(86,J$,15,16,"div",21),t.ɵɵelementEnd()(),t.ɵɵelementStart(87,"mat-expansion-panel")(88,"mat-expansion-panel-header")(89,"mat-panel-title")(90,"div",3),t.ɵɵtext(91),t.ɵɵpipe(92,"translate"),t.ɵɵpipe(93,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(94,"div",22),t.ɵɵrepeaterCreate(95,iK,28,33,"section",23,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(97,"span",24),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(100,"div")(101,"button",25),t.ɵɵpipe(102,"translate"),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addNewConnector())}),t.ɵɵtext(103),t.ɵɵpipe(104,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(105,"section",26),t.ɵɵconditionalCreate(106,aK,4,8,"button",27),t.ɵɵconditionalCreate(107,rK,4,8,"button",28),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("toastTarget",t.ɵɵinterpolate(n.toastTargetId))("formGroup",n.gatewayConfigurationGroup),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,52,t.ɵɵpipeBind1(8,50,"gateway.thingsboard"))),t.ɵɵadvance(3),t.ɵɵproperty("deviceName",n.deviceNameForm)("isStateForm",n.isStateForm)("newGatewayType",n.gatewayType),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,54,"gateway.security-type")),t.ɵɵadvance(3),t.ɵɵrepeater(t.ɵɵpipeBind1(18,56,n.securityTypes)),t.ɵɵadvance(3),t.ɵɵclassMap(t.ɵɵpureFunction3(90,D$,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,58,"gateway.thingsboard-host")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("host").hasError("required")?25:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(29,60,"gateway.thingsboard-port")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("required")?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("min")?32:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("max")?33:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("port").hasError("pattern")?34:-1),t.ɵɵadvance(),t.ɵɵconditional("tls"===n.gatewayConfigurationGroup.get("securityType").value?35:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(38,62,"gateway.remote")),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(94,D$,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(43,64,"gateway.remote-logging-level")),t.ɵɵadvance(3),t.ɵɵrepeater(n.gatewayLogLevels),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(50,66,"gateway.path-logs")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("remoteLoggingPathToLogs").hasError("required")?52:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(59,70,t.ɵɵpipeBind1(58,68,"gateway.storage"))),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(64,72,"gateway.storage-type")),t.ɵɵadvance(3),t.ɵɵrepeater(t.ɵɵpipeBind1(68,74,n.storageTypes)),t.ɵɵadvance(3),t.ɵɵclassMap(t.ɵɵpureFunction3(98,D$,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(73,76,"gateway.storage-pack-size")),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("readRecordsCount").hasError("required")?75:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("readRecordsCount").hasError("min")?76:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("readRecordsCount").hasError("pattern")?77:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(81,78,"file"!==n.gatewayConfigurationGroup.get("storageType").value?"gateway.storage-max-records":"gateway.storage-max-file-records")," "),t.ɵɵadvance(3),t.ɵɵconditional(n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("required")?83:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("min")?84:-1),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("pattern")?85:-1),t.ɵɵadvance(),t.ɵɵconditional("file"===n.gatewayConfigurationGroup.get("storageType").value?86:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(93,82,t.ɵɵpipeBind1(92,80,"gateway.connectors-config"))),t.ɵɵadvance(4),t.ɵɵrepeater(n.connectors.controls),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.connectors.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(99,84,"gateway.no-connectors")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(102,86,"gateway.connector-add"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(104,88,"action.add")," "),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("remoteConfiguration").value?-1:106),t.ɵɵadvance(),t.ɵɵconditional(n.gatewayConfigurationGroup.get("remoteConfiguration").value?107:-1))},dependencies:t.ɵɵgetComponentDepsFactory(oK,[ce,C]),styles:['@charset "UTF-8";[_nghost-%COMP%] .gateway-form[_ngcontent-%COMP%]{height:100%;padding:5px;background-color:transparent;overflow-y:auto;overflow-x:hidden}[_nghost-%COMP%] .gateway-form[_ngcontent-%COMP%] .form-action-buttons[_ngcontent-%COMP%]{padding-top:8px}[_nghost-%COMP%] .gateway-form[_ngcontent-%COMP%] .gateway-config[_ngcontent-%COMP%] .no-data-found[_ngcontent-%COMP%]{position:relative;display:flex;height:40px}']})}}e("GatewayFormComponent",oK);class sK{transform(e,t){return Qa.parseVersion(e)>=Qa.parseVersion(Fi.get(t))}static{this.ɵfac=function(e){return new(e||sK)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"isLatestVersionConfig",type:sK,pure:!0})}}class lK{constructor(e){this.translate=e}transform(e){return e.hasError("required")?this.translate.instant("gateway.port-required"):e.hasError("min")||e.hasError("max")?this.translate.instant("gateway.port-limits-error",{min:Bi.MIN,max:Bi.MAX}):""}static{this.ɵfac=function(e){return new(e||lK)(t.ɵɵdirectiveInject(me.TranslateService,16))}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getGatewayPortTooltip",type:lK,pure:!0})}}class pK{transform(e,t,n,i){switch(e){case gt.OPCUA:return this.getOpcConnectorHelpLink(t,n);case gt.MQTT:return this.getMqttConnectorHelpLink(t,n,i);case gt.BACNET:return this.getBacnetConnectorHelpLink(t,n);case gt.REST:return this.getRestConnectorHelpLink(n)}}getOpcConnectorHelpLink(e,t){if(t!==Ni.CONST)return`widget/lib/gateway/${e}-${t}_fn`}getMqttConnectorHelpLink(e,t,n){if(t!==pi.CONST)return n?e!==Wi.ATTRIBUTES&&e!==Wi.TIMESERIES||n!==li.JSON?`widget/lib/gateway/mqtt-${n}-expression_fn`:"widget/lib/gateway/mqtt-json-key-expression_fn":"widget/lib/gateway/mqtt-expression_fn"}getBacnetConnectorHelpLink(e,t){if(t!==Ni.CONST)return`widget/lib/gateway/bacnet-device-${e}-${t}_fn`}getRestConnectorHelpLink(e){if(e!==Ti.CONST)return"widget/lib/gateway/rest-json_fn"}static{this.ɵfac=function(e){return new(e||pK)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getConnectorMappingHelpLink",type:pK,pure:!0})}}function cK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.gatewayConnectorDefaultTypesTranslatesMap.get(e)," ")}}function dK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.connectorForm.get("name").hasError("duplicateName")?"gateway.connector-duplicate-name":"gateway.name-required"))}}function uK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",10),t.ɵɵelement(4,"input",20),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,2,"gateway.set"))))}function mK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",10),t.ɵɵelement(4,"input",21),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,2,"gateway.set"))))}function hK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function gK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",22)(2,"mat-label",23),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,3,"gateway.fill-connector-defaults-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,5,"gateway.fill-connector-defaults")," "))}function fK(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",24)(2,"mat-label",23),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,3,"gateway.send-change-data-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,5,"gateway.send-change-data")," "))}class yK extends D{constructor(e,t,n,i,a,r){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.isLatestVersionConfig=r,this.connectorType=gt,this.gatewayConnectorDefaultTypesTranslatesMap=ft,this.gatewayLogLevel=Object.values(mt),this.submitted=!1,this.destroy$=new _e,this.updateConnectorTypesByVersion(),this.connectorForm=this.fb.group({type:[gt.MQTT,[]],name:["",[ve.required,this.uniqNameRequired(),ve.pattern(hn)]],logLevel:[mt.INFO,[]],useDefaults:[!0,[]],sendDataOnlyOnChange:[!1,[]],class:["",[]],key:["auto",[]]})}ngOnInit(){this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}helpLinkId(){return v+"/docs/iot-gateway/configuration/"}cancel(){this.dialogRef.close(null)}add(){this.submitted=!0;const e=this.connectorForm.getRawValue();if(e.useDefaults){const t=tn(e.type),n=this.data.gatewayVersion;n&&(e.configVersion=n),e.configurationJson=(this.isLatestVersionConfig.transform(n,e.type)?t[Fi.get(e.type)]:t[ht.Legacy])??t,this.connectorForm.valid&&this.dialogRef.close(e)}else this.connectorForm.valid&&this.dialogRef.close(e)}uniqNameRequired(){return e=>{const t=e.value.trim().toLowerCase();return this.data.dataSourceData.some(({value:{name:e}})=>e.toLowerCase()===t)?{duplicateName:{valid:!1}}:null}}updateConnectorTypesByVersion(){const e=vt.keys();for(let t of e)if(t===ht.Legacy||Qa.parseVersion(this.data.gatewayVersion)>=Qa.parseVersion(t)){this.connectorTypes=vt.get(t);break}}observeTypeChange(){this.connectorForm.get("type").valueChanges.pipe(Fe(e=>{const t=this.connectorForm.get("useDefaults");e===gt.GRPC||e===gt.CUSTOM?t.setValue(!1):t.value||t.setValue(!0)}),Ne(this.destroy$)).subscribe()}static{this.ɵfac=function(e){return new(e||yK)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(sK))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yK,selectors:[["tb-add-connector-dialog"]],features:[t.ɵɵProvidersFeature([sK]),t.ɵɵInheritDefinitionFeature],decls:45,vars:24,consts:[[1,"add-connector",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","type"],[3,"value"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["formControlName","logLevel"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","useDefaults",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8)(13,"div",9),t.ɵɵtext(14,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-form-field",10)(16,"mat-select",11),t.ɵɵrepeaterCreate(17,cK,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",8)(20,"div",13),t.ɵɵtext(21,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",10),t.ɵɵelement(23,"input",14),t.ɵɵpipe(24,"translate"),t.ɵɵconditionalCreate(25,dK,3,3,"mat-icon",15),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(26,uK,6,4,"div",8),t.ɵɵconditionalCreate(27,mK,6,4,"div",8),t.ɵɵelementStart(28,"div",8)(29,"div",9),t.ɵɵtext(30,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",10)(32,"mat-select",16),t.ɵɵrepeaterCreate(33,hK,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(35,gK,6,7,"div",8),t.ɵɵconditionalCreate(36,fK,6,7,"div",8),t.ɵɵpipe(37,"withReportStrategy"),t.ɵɵelementEnd()(),t.ɵɵelementStart(38,"div",17)(39,"button",18),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"button",19),t.ɵɵlistener("click",function(){return n.add()}),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,13,"gateway.add-connector")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLinkId()),t.ɵɵadvance(11),t.ɵɵrepeater(n.connectorTypes),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(24,15,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorForm.get("name").hasError("required")&&n.connectorForm.get("name").touched||n.connectorForm.get("name").hasError("duplicateName")?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.connectorForm.get("type").value===n.connectorType.CUSTOM?26:-1),t.ɵɵadvance(),t.ɵɵconditional(n.connectorForm.get("type").value===n.connectorType.GRPC?27:-1),t.ɵɵadvance(6),t.ɵɵrepeater(n.gatewayLogLevel),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorForm.get("type").value!==n.connectorType.GRPC&&n.connectorForm.get("type").value!==n.connectorType.CUSTOM?35:-1),t.ɵɵadvance(),t.ɵɵconditional(n.connectorForm.get("type").value!==n.connectorType.MQTT||t.ɵɵpipeBind2(37,17,n.data.gatewayVersion,n.connectorType.MQTT)?-1:36),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(41,20,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.connectorForm.invalid||!n.connectorForm.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(44,22,"action.add")," "))},dependencies:t.ɵɵgetComponentDepsFactory(yK,[C,ar]),styles:['@charset "UTF-8";[_nghost-%COMP%] .add-connector[_ngcontent-%COMP%]{min-width:400px;width:500px}']})}}e("AddConnectorDialogComponent",yK);const vK=()=>({maxWidth:"970px"});function xK(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1,"gateway.device-info.source"),t.ɵɵelementEnd())}function bK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",18),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function wK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"mat-form-field",16)(2,"mat-select",17),t.ɵɵrepeaterCreate(3,bK,3,4,"mat-option",18,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵrepeater(e.sourceTypes)}}function SK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",13),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-info.device-name-expression-required"))}function CK(e,n){if(1&e&&(t.ɵɵelement(0,"div",14),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,e.connectorType,"name-field",e.mappingFormGroup.get("deviceNameExpressionSource").value,e.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,vK))}}function _K(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",18),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function TK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"mat-form-field",16)(2,"mat-select",20),t.ɵɵrepeaterCreate(3,_K,3,4,"mat-option",18,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵrepeater(e.sourceTypes)}}function EK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",13),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-info.device-profile-expression-required"))}function MK(e,n){if(1&e&&(t.ɵɵelement(0,"div",14),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,vK))}}function IK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",15)(1,"div",8),t.ɵɵtext(2,"gateway.device-info.profile-name"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(3,TK,5,0,"div",9),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11),t.ɵɵelement(6,"input",19),t.ɵɵpipe(7,"translate"),t.ɵɵconditionalCreate(8,EK,3,3,"mat-icon",13),t.ɵɵconditionalCreate(9,MK,2,8,"div",14),t.ɵɵpipe(10,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵconditional(e.useSource?3:-1),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,5,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("deviceProfileExpression").hasError("required")&&e.mappingFormGroup.get("deviceProfileExpression").touched?8:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(10,7,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType)?9:-1)}}class kK extends U{get deviceInfoType(){return this.deviceInfoTypeValue}set deviceInfoType(e){this.deviceInfoTypeValue!==e&&(this.deviceInfoTypeValue=e)}constructor(e,t,n,i){super(e),this.store=e,this.translate=t,this.dialog=n,this.fb=i,this.SourceTypeTranslationsMap=Hi,this.DeviceInfoType=Ta,this.useSource=!0,this.required=!1,this.connectorType=gt.MQTT,this.sourceTypes=Object.values(pi),this.destroy$=new _e,this.propagateChange=e=>{}}ngOnInit(){this.mappingFormGroup=this.fb.group({deviceNameExpression:["",this.required?[ve.required,ve.pattern(hn)]:[ve.pattern(hn)]]}),this.useSource&&this.mappingFormGroup.addControl("deviceNameExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.deviceInfoType===Ta.FULL&&(this.useSource&&this.mappingFormGroup.addControl("deviceProfileExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.mappingFormGroup.addControl("deviceProfileExpression",this.fb.control("",this.required?[ve.required,ve.pattern(hn)]:[ve.pattern(hn)]))),this.mappingFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.updateView(e)})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){this.mappingFormGroup.patchValue(e,{emitEvent:!1})}validate(){return this.mappingFormGroup.valid?null:{mappingForm:{valid:!1}}}updateView(e){this.propagateChange(e)}static{this.ɵfac=function(e){return new(e||kK)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:kK,selectors:[["tb-device-info-table"]],inputs:{useSource:"useSource",required:"required",connectorType:"connectorType",convertorType:"convertorType",sourceTypes:"sourceTypes",deviceInfoType:"deviceInfoType"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>kK),multi:!0},{provide:xe,useExisting:a(()=>kK),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:23,vars:19,consts:[[1,"tb-form-panel","stroked",3,"formGroup"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-table","no-padding","no-gap"],[1,"tb-form-table-header"],["translate","",1,"tb-form-table-header-cell","w-1/5"],["translate","",1,"tb-form-table-header-cell","w-1/2"],[1,"tb-form-table-body","no-gap"],[1,"tb-form-table-row","tb-form-row","no-border","same-padding","pt-4"],["translate","",1,"tb-required","w-1/5"],[1,"no-gap","w-1/5"],[1,"tb-form-table-row-cell","tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","deviceNameExpression",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-form-table-row","tb-form-row","no-border","same-padding","pb-4"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","!w-full"],["formControlName","deviceNameExpressionSource"],[3,"value"],["matInput","","name","value","formControlName","deviceProfileExpression",3,"placeholder"],["formControlName","deviceProfileExpressionSource"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2,"device.device"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",2)(4,"div",3)(5,"div",4),t.ɵɵtext(6,"gateway.device-info.entity-field"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(7,xK,2,0,"div",4),t.ɵɵelementStart(8,"div",5),t.ɵɵtext(9," gateway.device-info.expression "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8),t.ɵɵtext(13,"gateway.device-info.name"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(14,wK,5,0,"div",9),t.ɵɵelementStart(15,"div",10)(16,"mat-form-field",11),t.ɵɵelement(17,"input",12),t.ɵɵpipe(18,"translate"),t.ɵɵconditionalCreate(19,SK,3,3,"mat-icon",13),t.ɵɵconditionalCreate(20,CK,2,8,"div",14),t.ɵɵpipe(21,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(22,IK,11,12,"div",15),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(),t.ɵɵclassProp("tb-required",n.required),t.ɵɵadvance(6),t.ɵɵconditional(n.useSource?7:-1),t.ɵɵadvance(4),t.ɵɵclassProp("pb-4",n.deviceInfoType!==n.DeviceInfoType.FULL),t.ɵɵadvance(3),t.ɵɵconditional(n.useSource?14:-1),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,12,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.mappingFormGroup.get("deviceNameExpression").hasError("required")&&n.mappingFormGroup.get("deviceNameExpression").touched?19:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(21,14,n.connectorType,"name-field",n.mappingFormGroup.get("deviceNameExpressionSource").value,n.convertorType)?20:-1),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceInfoType===n.DeviceInfoType.FULL?22:-1))},dependencies:t.ɵɵgetComponentDepsFactory(kK,[C,pK]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:o.OnPush})}}Ye([T()],kK.prototype,"useSource",void 0),Ye([T()],kK.prototype,"required",void 0);const PK=()=>({maxWidth:"970px"});function DK(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",7),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵproperty("svgIcon",null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.icon)}}function AK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",17),t.ɵɵelement(1,"mat-icon",18),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){let e,i;const a=n.$implicit,r=t.ɵɵnextContext(2);t.ɵɵproperty("value",a),t.ɵɵadvance(),t.ɵɵproperty("svgIcon",t.ɵɵinterpolate(null==(e=r.valueTypes.get(a))?null:e.icon)),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,4,null==(i=r.valueTypes.get(a))?null:i.name))}}function OK(e,n){if(1&e&&t.ɵɵrepeaterCreate(0,AK,5,6,"mat-option",17,t.ɵɵrepeaterTrackByIdentity),2&e){const e=t.ɵɵnextContext();t.ɵɵrepeater(e.valueTypeKeys)}}function RK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",8)(1,"span"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.raw")))}function BK(e,n){1&e&&(t.ɵɵelement(0,"input",10),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.set")))}function FK(e,n){1&e&&(t.ɵɵelement(0,"input",11),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.set")))}function NK(e,n){1&e&&(t.ɵɵelement(0,"input",12),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.set")))}function LK(e,n){1&e&&(t.ɵɵelement(0,"input",13),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.set")))}function VK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",14)(1,"mat-option",17),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",17),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function qK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",15),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function GK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",19),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tb-help-popup",e.helpLink)("tb-help-popup-style",t.ɵɵpureFunction0(2,PK))}}class zK{constructor(e){this.fb=e,this.valueTypeKeys=Object.values(on),this.valueTypes=sn,this.MappingValueType=on,this.destroy$=new _e,this.onChange=e=>{},this.valueTypeFormGroup=this.fb.group({type:[on.STRING],stringValue:[{value:"",disabled:this.rawData},[ve.required,ve.pattern(hn)]],integerValue:[{value:0,disabled:!0},[ve.required,ve.pattern(gn)]],doubleValue:[{value:0,disabled:!0},[ve.required]],booleanValue:[{value:!1,disabled:!0},[ve.required]],rawValue:[{value:"",disabled:!this.rawData},[ve.required,ve.pattern(hn)]]}),this.valueTypeFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(({type:e,...t})=>{this.onChange({type:e,value:t[e+"Value"]})}),this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}observeTypeChange(){this.valueTypeFormGroup.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.toggleTypeInputs(e))}toggleTypeInputs(e){this.valueTypeFormGroup.disable({emitEvent:!1}),this.valueTypeFormGroup.get("type").enable({emitEvent:!1}),this.valueTypeFormGroup.get(e+"Value").enable({emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){const t=this.getValueType(e?.value),n={stringValue:"",rawValue:"",integerValue:0,doubleValue:0,booleanValue:!1,type:t};n[t+"Value"]=e?.value,this.toggleTypeInputs(t),this.valueTypeFormGroup.patchValue(n,{emitEvent:!1})}validate(){return this.valueTypeFormGroup.valid?null:{valueTypeFormGroup:{valid:!1}}}getValueType(e){if(this.rawData)return"raw";switch(typeof e){case"boolean":return on.BOOLEAN;case"number":return Number.isInteger(e)?on.INTEGER:on.DOUBLE;default:return on.STRING}}static{this.ɵfac=function(e){return new(e||zK)(t.ɵɵdirectiveInject(fe.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:zK,selectors:[["tb-type-value-field"]],inputs:{rawData:"rawData",helpLink:"helpLink"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>zK),multi:!0},{provide:xe,useExisting:a(()=>zK),multi:!0}])],decls:27,vars:11,consts:[[3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],["value","raw"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex","tb-suffix-absolute"],["matInput","","required","","formControlName","stringValue",3,"placeholder"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder"],["matInput","","required","","formControlName","rawValue",3,"placeholder"],["formControlName","booleanValue"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"click","tb-help-popup","tb-help-popup-style"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,0),t.ɵɵelementStart(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3)(5,"mat-form-field",4)(6,"mat-select",5)(7,"mat-select-trigger")(8,"div",6),t.ɵɵconditionalCreate(9,DK,1,1,"mat-icon",7),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(14,OK,2,0)(15,RK,4,3,"mat-option",8),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(16,"div",1)(17,"div",2),t.ɵɵtext(18,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",9),t.ɵɵconditionalCreate(20,BK,2,4,"input",10)(21,FK,2,4,"input",11)(22,NK,2,4,"input",12)(23,LK,2,4,"input",13)(24,VK,5,2,"mat-select",14),t.ɵɵconditionalCreate(25,qK,3,3,"mat-icon",15),t.ɵɵconditionalCreate(26,GK,1,3,"div",16),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){let e,i,a;t.ɵɵproperty("formGroup",n.valueTypeFormGroup),t.ɵɵadvance(9),t.ɵɵconditional(n.rawData?-1:9),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,7,null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.name)||t.ɵɵpipeBind1(13,9,"gateway.raw")),t.ɵɵadvance(3),t.ɵɵconditional(n.rawData?15:14),t.ɵɵadvance(6),t.ɵɵconditional((i=n.valueTypeFormGroup.get("type").value)===n.MappingValueType.STRING?20:i===n.MappingValueType.INTEGER?21:i===n.MappingValueType.DOUBLE?22:"raw"===i?23:i===n.MappingValueType.BOOLEAN?24:-1),t.ɵɵadvance(5),t.ɵɵconditional(null!=(a=n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value))&&a.hasError("required")&&n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value).touched?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.helpLink?26:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(zK,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%]{gap:16px;display:grid;width:100%}']})}}function UK(e,n){if(1&e&&t.ɵɵelement(0,"tb-type-value-field",12),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("helpLink",e.helpLink)}}function jK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",4)(1,"div",5),t.ɵɵelementContainerStart(2,6),t.ɵɵelementStart(3,"mat-expansion-panel",7)(4,"mat-expansion-panel-header",8)(5,"mat-panel-title")(6,"div",9),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,UK,1,1,"ng-template",10),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",11),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))}),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e;const i=n.$implicit,a=n.$index,r=n.$count;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i),t.ɵɵadvance(),t.ɵɵproperty("expanded",a===r-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate((null==(e=i.get("typeValue").value)?null:e.value)??""),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,"gateway.delete-argument"))}}function HK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1),t.ɵɵrepeaterCreate(1,jK,13,6,"div",4,t.ɵɵcomponentInstance().trackByKey,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.valueListFormArray.controls)}}function WK(e,n){1&e&&(t.ɵɵelementStart(0,"div",2)(1,"span",13),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate("gateway.no-value"))}Ye([T()],zK.prototype,"rawData",void 0);class $K{constructor(e){this.fb=e,this.destroy$=new _e,this.onChange=e=>{}}ngOnInit(){this.valueListFormArray=this.fb.array([]),this.valueListFormArray.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e.map(({typeValue:e})=>({...e})))})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}trackByKey(e,t){return t}addKey(){const e=this.fb.group({typeValue:[]});this.valueListFormArray.push(e)}deleteKey(e,t){e&&e.stopPropagation(),this.valueListFormArray.removeAt(t),this.valueListFormArray.markAsDirty()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){for(const t of e){const e={typeValue:[t]},n=this.fb.group(e);this.valueListFormArray.push(n)}}validate(){return this.valueListFormArray.valid?null:{valueListForm:{valid:!1}}}static{this.ɵfac=function(e){return new(e||$K)(t.ɵɵdirectiveInject(fe.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$K,selectors:[["tb-type-value-panel"]],inputs:{helpLink:"helpLink"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>$K),multi:!0},{provide:xe,useExisting:a(()=>$K),multi:!0}])],decls:7,vars:4,consts:[[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["formControlName","typeValue",3,"helpLink"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0),t.ɵɵconditionalCreate(1,HK,3,0,"div",1)(2,WK,3,1,"div",2),t.ɵɵelementStart(3,"div")(4,"button",3),t.ɵɵlistener("click",function(){return n.addKey()}),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(),t.ɵɵconditional(n.valueListFormArray.controls.length?1:2),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,2,"gateway.add-value")," "))},dependencies:t.ɵɵgetComponentDepsFactory($K,[C,zK]),styles:['@charset "UTF-8";[_nghost-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw}[_nghost-%COMP%] .key-panel[_ngcontent-%COMP%]{height:250px;overflow:auto}[_nghost-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}const KK=()=>({maxWidth:"970px"});function YK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵtext(1),t.ɵɵelementEnd(),t.ɵɵtext(2)),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," "),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",":","  ")}}function XK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function ZK(e,n){if(1&e&&(t.ɵɵelement(0,"div",25),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext(3).$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,n.connectorType,n.keysType,e.get("type").value,n.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,KK))}}function QK(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",35),2&e){let e;const n=t.ɵɵnextContext(4).$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("svgIcon",null==(e=i.valueTypes.get(n.get("type").value))?null:e.icon)}}function JK(e,n){if(1&e&&(t.ɵɵelementStart(0,"span"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){let e;const n=t.ɵɵnextContext(4).$implicit,i=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,(null==(e=i.valueTypes.get(n.get("type").value))?null:e.name)??i.valueTypes.get(n.get("type").value))," ")}}function eY(e,n){1&e&&(t.ɵɵelementStart(0,"span"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.raw")))}function tY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-select-trigger")(1,"div",34),t.ɵɵconditionalCreate(2,QK,1,1,"mat-icon",35),t.ɵɵconditionalCreate(3,JK,3,3,"span")(4,eY,3,3,"span"),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵnextContext(3).$implicit,i=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵconditional(null!=(e=i.valueTypes.get(n.get("type").value))&&e.icon?2:-1),t.ɵɵadvance(),t.ɵɵconditional(i.rawData?4:3)}}function nY(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",36),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(6);t.ɵɵproperty("svgIcon",t.ɵɵinterpolate(n.valueTypes.get(e).icon))}}function iY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",30),t.ɵɵconditionalCreate(1,nY,1,2,"mat-icon",36),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){let e,i;const a=n.$implicit,r=t.ɵɵnextContext(6);t.ɵɵproperty("value",a),t.ɵɵadvance(),t.ɵɵconditional(null!=(e=r.valueTypes.get(a))&&e.icon?1:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,3,(null==(i=r.valueTypes.get(a))?null:i.name)??r.valueTypes.get(a))," ")}}function aY(e,n){if(1&e&&t.ɵɵrepeaterCreate(0,iY,5,5,"mat-option",30,t.ɵɵrepeaterTrackByIdentity),2&e){const e=t.ɵɵnextContext(5);t.ɵɵrepeater(e.valueTypeKeys)}}function rY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",30)(1,"span"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("value","raw"),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.raw")))}function oY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function sY(e,n){if(1&e&&(t.ɵɵelement(0,"div",25),t.ɵɵpipe(1,"getConnectorMappingHelpLink")),2&e){const e=t.ɵɵnextContext(3).$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind4(1,2,n.connectorType,n.keysType,e.get("type").value,n.convertorType))("tb-help-popup-style",t.ɵɵpureFunction0(7,KK))}}function lY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",18)(2,"div",19),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",20)(5,"div",21),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",22),t.ɵɵelement(10,"input",23),t.ɵɵpipe(11,"translate"),t.ɵɵconditionalCreate(12,XK,3,3,"mat-icon",24),t.ɵɵconditionalCreate(13,ZK,2,8,"div",25),t.ɵɵpipe(14,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",18)(16,"div",19),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",26)(19,"div",27),t.ɵɵtext(20,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",28)(22,"mat-select",29),t.ɵɵconditionalCreate(23,tY,5,2,"mat-select-trigger"),t.ɵɵconditionalCreate(24,aY,2,0)(25,rY,4,4,"mat-option",30),t.ɵɵelementEnd()()(),t.ɵɵelementStart(26,"div",31)(27,"div",21),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29),t.ɵɵpipe(30,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",32),t.ɵɵelement(32,"input",33),t.ɵɵpipe(33,"translate"),t.ɵɵconditionalCreate(34,oY,3,3,"mat-icon",24),t.ɵɵconditionalCreate(35,sY,2,8,"div",25),t.ɵɵpipe(36,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,16,"gateway.JSONPath-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,18,"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,20,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?12:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(14,22,n.connectorType,n.keysType,e.get("type").value,n.convertorType)?13:-1),t.ɵɵadvance(10),t.ɵɵconditional(n.rawData?-1:23),t.ɵɵadvance(),t.ɵɵconditional(n.rawData?25:24),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,27,"gateway.JSONPath-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(30,29,"gateway.value")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(33,31,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?34:-1),t.ɵɵadvance(),t.ɵɵconditional(t.ɵɵpipeBind4(36,33,n.connectorType,n.keysType,e.get("type").value,n.convertorType)?35:-1)}}function pY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function cY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function dY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",20)(2,"div",27),t.ɵɵtext(3,"gateway.key"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",22),t.ɵɵelement(5,"input",23),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,pY,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",20)(9,"div",27),t.ɵɵtext(10,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",37),t.ɵɵelement(12,"input",33),t.ɵɵpipe(13,"translate"),t.ɵɵconditionalCreate(14,cY,3,3,"mat-icon",24),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,6,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?7:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(13,8,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?14:-1)}}function uY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function mY(e,n){1&e&&t.ɵɵelement(0,"tb-type-value-panel",42)}function hY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",20)(2,"div",21),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",22),t.ɵɵelement(7,"input",38),t.ɵɵpipe(8,"translate"),t.ɵɵconditionalCreate(9,uY,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",10)(11,"mat-expansion-panel",39)(12,"mat-expansion-panel-header",40)(13,"mat-panel-title")(14,"div",41),t.ɵɵpipe(15,"translate"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(18,mY,1,0,"ng-template",15),t.ɵɵelementEnd()()()),2&e){let e;const n=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,10,"gateway.hints.method-name"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,12,"gateway.method-name")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,14,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.get("method").hasError("required")&&n.get("method").touched?9:-1),t.ɵɵadvance(5),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,16,"gateway.hints.arguments"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate2(" ",t.ɵɵpipeBind1(17,18,"gateway.arguments"),""," ("+(null==(e=n.get("arguments").value)?null:e.length)+")"," ")}}function gY(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",17),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function fY(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,lY,37,38,"div",1),t.ɵɵconditionalCreate(1,dY,15,10,"div",1),t.ɵɵconditionalCreate(2,hY,19,20,"div",1),t.ɵɵconditionalCreate(3,gY,1,2,"tb-report-strategy",17)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(e.keysType!==e.MappingKeysType.CUSTOM&&e.keysType!==e.MappingKeysType.RPC_METHODS?0:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.MappingKeysType.CUSTOM?1:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.MappingKeysType.RPC_METHODS?2:-1),t.ɵɵadvance(),t.ɵɵconditional(!e.withReportStrategy||e.keysType!==e.MappingKeysType.ATTRIBUTES&&e.keysType!==e.MappingKeysType.TIMESERIES?-1:3)}}function yY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header",13)(5,"mat-panel-title"),t.ɵɵconditionalCreate(6,YK,3,2),t.ɵɵelementStart(7,"div",14),t.ɵɵtext(8),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,fY,4,4,"ng-template",15),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",16),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))}),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(3),t.ɵɵconditional(r.keysType!==r.MappingKeysType.RPC_METHODS?6:-1),t.ɵɵadvance(2),t.ɵɵtextInterpolate(r.valueTitle(e)),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function vY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,yY,14,7,"div",9,t.ɵɵcomponentInstance().trackByKey,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function xY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",43),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class bY extends U{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.valueTypeEnum=on,this.valueTypes=sn,this.valueTypeKeys=Object.values(on),this.rawData=!1,this.withReportStrategy=!0,this.keysDataApplied=new p,this.MappingKeysType=Wi,this.ReportStrategyDefaultValue=dn,this.ConnectorType=gt,this.errorText=""}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===Wi.RPC_METHODS?this.fb.group({method:["",[ve.required]],arguments:[[],[]]}):this.keysType===Wi.CUSTOM?this.fb.group({key:["",[ve.required,ve.pattern(hn)]],value:["",[ve.required,ve.pattern(hn)]]}):this.fb.group({key:["",[ve.required,ve.pattern(hn)]],type:[this.rawData?"raw":this.valueTypeKeys[0]],value:["",[ve.required,ve.pattern(hn)]],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]}),this.keysListFormArray.push(e)}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){let e=this.keysListFormArray.value.map(({reportStrategy:e,...t})=>({...t,...e&&{reportStrategy:e}}));if(this.keysType===Wi.CUSTOM){e={};for(let t of this.keysListFormArray.value)e[t.key]=t.value}this.keysDataApplied.emit(e)}prepareKeysFormArray(e){const t=[];return e&&(this.keysType===Wi.CUSTOM&&(e=Object.keys(e).map(t=>({key:t,value:e[t],type:""}))),e.forEach(e=>{let n;if(this.keysType===Wi.RPC_METHODS)n=this.fb.group({method:[e.method,[ve.required]],arguments:[[...e.arguments],[]]});else if(this.keysType===Wi.CUSTOM){const{key:t,value:i}=e;n=this.fb.group({key:[t,[ve.required,ve.pattern(hn)]],value:[i,[ve.required,ve.pattern(hn)]]})}else{const{key:t,value:i,type:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[ve.required,ve.pattern(hn)]],type:[a],value:[i,[ve.required,ve.pattern(hn)]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)})),this.fb.array(t)}valueTitle(e){const t=this.keysType===Wi.RPC_METHODS?e.get("method").value:e.get("value").value;return ne(t)?"object"==typeof t?JSON.stringify(t):t:""}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===Wi.ATTRIBUTES||this.keysType===Wi.TIMESERIES))}static{this.ɵfac=function(e){return new(e||bY)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(lt.TbPopoverComponent),t.ɵɵdirectiveInject(et.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bY,selectors:[["tb-mapping-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",connectorType:"connectorType",convertorType:"convertorType",sourceType:"sourceType",valueTypeEnum:"valueTypeEnum",valueTypes:"valueTypes",valueTypeKeys:"valueTypeKeys",rawData:"rawData",withReportStrategy:"withReportStrategy"},outputs:{keysDataApplied:"keysDataApplied"},features:[t.ɵɵInheritDefinitionFeature],decls:18,vars:15,consts:[[1,"tb-mapping-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex","flex-row","flex-wrap"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[3,"value"],[1,"tb-form-row","column-xs","flex","items-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"no-gap","flex","flex-1"],["matInput","","required","","formControlName","value",3,"placeholder"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],[1,"tb-mat-20",3,"svgIcon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],["matInput","","name","value","formControlName","method",3,"placeholder"],[1,"tb-settings"],[1,"flex","flex-wrap"],[1,"title-container",3,"tb-hint-tooltip-icon"],["formControlName","arguments"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(5,vY,3,0,"div",3)(6,xY,3,1,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",function(){return n.addKey()}),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",function(){return n.applyKeysData()}),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(bY,[C,ri,$K,pK]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:500px;overflow:auto}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] tb-value-input[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] .tb-mapping-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}Ye([T()],bY.prototype,"rawData",void 0),Ye([T()],bY.prototype,"withReportStrategy",void 0);const wY=()=>({maxWidth:"970px"}),SY=(e,t)=>[e,t];function CY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function _Y(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.QualityTranslationsMap.get(e))," ")}}function TY(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.ConvertorTypeTranslationsMap.get(e))," ")}}function EY(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("convertorType",e.ConvertorTypeEnum.JSON)("deviceInfoType",e.DeviceInfoType.FULL)}}function MY(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",38),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)("convertorType",e.ConvertorTypeEnum.BYTES)("sourceTypes",t.ɵɵpureFunction2(3,SY,e.sourceTypesEnum.MSG,e.sourceTypesEnum.CONST))}}function IY(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",39),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function kY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function PY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function DY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",31)(2,"div",32),t.ɵɵtext(3,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",42)(5,"mat-chip-listbox",43),t.ɵɵrepeaterCreate(6,kY,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(8,"mat-chip",44),t.ɵɵelement(9,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",46,0),t.ɵɵpipe(12,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(11),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))}),t.ɵɵelementStart(13,"tb-icon",47),t.ɵɵtext(14,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",31)(16,"div",32),t.ɵɵtext(17,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",42)(19,"mat-chip-listbox",43),t.ɵɵrepeaterCreate(20,PY,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(22,"mat-chip",44),t.ɵɵelement(23,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",46,1),t.ɵɵpipe(26,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(25),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))}),t.ɵɵelementStart(27,"tb-icon",47),t.ɵɵtext(28,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵrepeater(e.converterAttributes),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,6,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵrepeater(e.converterTelemetry),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(26,8,"action.edit")))}}function AY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function OY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function RY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",21)(2,"div",48),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",23),t.ɵɵelement(7,"input",49),t.ɵɵpipe(8,"translate"),t.ɵɵconditionalCreate(9,AY,3,3,"mat-icon",40),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",50)(11,"div",35),t.ɵɵtext(12,"gateway.extension-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",15),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",31)(17,"div",32),t.ɵɵtext(18,"gateway.keys"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",42)(20,"mat-chip-listbox",43),t.ɵɵrepeaterCreate(21,OY,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(23,"mat-chip",44),t.ɵɵelement(24,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"button",46,2),t.ɵɵpipe(27,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(26),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.CUSTOM))}),t.ɵɵelementStart(28,"tb-icon",47),t.ɵɵtext(29,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,10,"gateway.extension-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,12,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,14,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingForm.get("converter.custom.extension").hasError("required")&&e.mappingForm.get("converter.custom.extension").touched?9:-1),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,16,"gateway.extension-configuration-hint")),t.ɵɵadvance(6),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵrepeater(e.customKeys),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(27,18,"action.edit")))}}function BY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2,"gateway.topic-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",23),t.ɵɵelement(4,"input",24),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,CY,3,3,"mat-icon",25),t.ɵɵelement(7,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",21)(9,"div",27),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23)(14,"mat-select",28),t.ɵɵtemplate(15,_Y,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(16,30),t.ɵɵelementStart(17,"div",31)(18,"div",32),t.ɵɵtext(19,"gateway.payload-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"tb-toggle-select",33),t.ɵɵtemplate(21,TY,3,4,"tb-toggle-option",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",34)(23,"div",35),t.ɵɵtext(24,"gateway.data-conversion"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"div",15),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(28,36),t.ɵɵconditionalCreate(29,EY,1,2,"tb-device-info-table",37)(30,MY,1,6,"tb-device-info-table",38),t.ɵɵconditionalCreate(31,IY,1,2,"tb-report-strategy",39),t.ɵɵconditionalCreate(32,DY,29,10,"div",14),t.ɵɵconditionalCreate(33,RY,30,20,"div",14),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,16,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.mappingForm.get("topicFilter").hasError("required")&&n.mappingForm.get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(24,wY)),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,18,"gateway.response-topic-Qos-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,20,"gateway.mqtt-qos")," "),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.qualityTypes),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.convertorTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,22,n.DataConversionTranslationsMap.get(n.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroupName",n.converterType),t.ɵɵadvance(),t.ɵɵconditional((e=n.converterType)===n.ConvertorTypeEnum.JSON?29:e===n.ConvertorTypeEnum.BYTES?30:-1),t.ɵɵadvance(2),t.ɵɵconditional(n.data.withReportStrategy?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.converterType===n.ConvertorTypeEnum.BYTES||n.converterType===n.ConvertorTypeEnum.JSON?32:-1),t.ɵɵadvance(),t.ɵɵconditional(n.converterType===n.ConvertorTypeEnum.CUSTOM?33:-1)}}function FY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.RequestTypesTranslationsMap.get(e))," ")}}function NY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function LY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2,"gateway.topic-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",23),t.ɵɵelement(4,"input",55),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,NY,3,3,"mat-icon",25),t.ɵɵelement(7,"div",26),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"gateway.set")))("formControl",e.mappingForm.get("requestValue").get(e.requestMappingType).get("topicFilter")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue").get(e.requestMappingType).get("topicFilter").hasError("required")&&e.mappingForm.get("requestValue").get(e.requestMappingType).get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(8,wY))}}function VY(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",54),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)}}function qY(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",54),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.PARTIAL)}}function GY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function zY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-info.device-name-expression-required"))}function UY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function jY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-name-expression-required"))}function HY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-value-expression-required"))}function WY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-topic-expression-required"))}function $Y(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",34)(1,"div",56),t.ɵɵtext(2,"gateway.from-device-request-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",57),t.ɵɵtext(4," gateway.from-device-request-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",58)(6,"div",59)(7,"div",60),t.ɵɵtext(8,"gateway.device-info.device-name-expression"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",61)(10,"div",62)(11,"mat-form-field",23)(12,"mat-select",63),t.ɵɵtemplate(13,GY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",64),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,zY,3,3,"mat-icon",25),t.ɵɵelement(18,"div",26),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",21)(20,"div",22),t.ɵɵtext(21,"gateway.attribute-name-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",61)(23,"div",62)(24,"mat-form-field",23)(25,"mat-select",65),t.ɵɵtemplate(26,UY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"mat-form-field",23),t.ɵɵelement(28,"input",66),t.ɵɵpipe(29,"translate"),t.ɵɵtemplate(30,jY,3,3,"mat-icon",25),t.ɵɵelement(31,"div",26),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(32,"div",34)(33,"div",56),t.ɵɵtext(34,"gateway.to-device-response-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"div",57),t.ɵɵtext(36," gateway.to-device-response-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"div",21)(38,"div",22),t.ɵɵtext(39,"gateway.response-value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"mat-form-field",23),t.ɵɵelement(41,"input",67),t.ɵɵpipe(42,"translate"),t.ɵɵtemplate(43,HY,3,3,"mat-icon",25),t.ɵɵelement(44,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"div",21)(46,"div",22),t.ɵɵtext(47,"gateway.response-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(48,"mat-form-field",23),t.ɵɵelement(49,"input",68),t.ɵɵpipe(50,"translate"),t.ɵɵtemplate(51,WY,3,3,"mat-icon",25),t.ɵɵelement(52,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(53,"div",69)(54,"mat-slide-toggle",70)(55,"mat-label",71),t.ɵɵpipe(56,"translate"),t.ɵɵtext(57),t.ɵɵpipe(58,"translate"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(13),t.ɵɵproperty("ngForOf",e.sourceTypes),t.ɵɵadvance(2),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,25,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.deviceInfo.deviceNameExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.deviceInfo.deviceNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(37,wY)),t.ɵɵadvance(8),t.ɵɵproperty("ngForOf",e.sourceTypes),t.ɵɵadvance(2),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(29,27,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.attributeNameExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.attributeNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(38,wY)),t.ɵɵadvance(10),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(42,29,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.valueExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.valueExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(39,wY)),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(50,31,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeRequests.topicExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeRequests.topicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(40,wY)),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(56,33,"gateway.retain-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(58,35,"gateway.retain")," ")}}function KY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-filter-required"))}function YY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-filter-required"))}function XY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-value-expression-required"))}function ZY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-topic-expression-required"))}function QY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",23),t.ɵɵelement(6,"input",72),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,KY,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",48),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",73),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,YY,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",21)(19,"div",22),t.ɵɵtext(20,"gateway.response-value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",23),t.ɵɵelement(22,"input",67),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,XY,3,3,"mat-icon",25),t.ɵɵelement(25,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"div",21)(27,"div",22),t.ɵɵtext(28,"gateway.response-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",23),t.ɵɵelement(30,"input",68),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,ZY,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",69)(35,"mat-slide-toggle",70)(36,"mat-label",71),t.ɵɵpipe(37,"translate"),t.ɵɵtext(38),t.ɵɵpipe(39,"translate"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,25,"gateway.device-name-filter-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,27,"gateway.device-name-filter")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,29,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.deviceNameFilter").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.deviceNameFilter").touched),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,31,"gateway.attribute-filter-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,33,"gateway.attribute-filter")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,35,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.attributeFilter").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.attributeFilter").touched),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(23,37,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.valueExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.valueExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(45,wY)),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(31,39,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.attributeUpdates.topicExpression").hasError("required")&&e.mappingForm.get("requestValue.attributeUpdates.topicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(46,wY)),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(37,41,"gateway.retain-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(39,43,"gateway.retain")," ")}}function JY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-filter-required"))}function eX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-filter-required"))}function tX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-topic-expression-required"))}function nX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-expression-required"))}function iX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.response-topic-expression-required"))}function aX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(4);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.QualityTranslationsMap.get(e))," ")}}function rX(e,n){if(1&e&&t.ɵɵelement(0,"tb-error-icon",81),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("tooltipText",e.responseTimeoutErrorTooltip)}}function oX(e,n){1&e&&(t.ɵɵelementStart(0,"span",82),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function sX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",21)(2,"div",22),t.ɵɵtext(3,"gateway.response-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",23),t.ɵɵelement(5,"input",78),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,iX,3,3,"mat-icon",25),t.ɵɵelement(8,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",27),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23)(15,"mat-select",79),t.ɵɵtemplate(16,aX,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(17,"div",21)(18,"div",22),t.ɵɵtext(19,"gateway.response-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",23),t.ɵɵelement(21,"input",80),t.ɵɵpipe(22,"translate"),t.ɵɵconditionalCreate(23,rX,1,1,"tb-error-icon",81)(24,oX,2,0,"span",82),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,12,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.responseTopicExpression").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.responseTopicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(20,wY)),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,14,"gateway.response-topic-Qos-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,16,"gateway.response-topic-Qos")," "),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.qualityTypes),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,18,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").hasError("required")||e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").hasError("min"))&&e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").touched?23:24)}}function lX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",74)(1,"tb-toggle-select",33)(2,"tb-toggle-option",41),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-option",41),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",21)(9,"div",48),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23),t.ɵɵelement(14,"input",72),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,JY,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",21)(18,"div",48),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",23),t.ɵɵelement(23,"input",75),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,eX,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"div",21)(27,"div",22),t.ɵɵtext(28,"gateway.request-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",23),t.ɵɵelement(30,"input",76),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,tX,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",21)(35,"div",22),t.ɵɵtext(36,"gateway.value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",23),t.ɵɵelement(38,"input",67),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,nX,3,3,"mat-icon",25),t.ɵɵelement(41,"div",26),t.ɵɵelementEnd()(),t.ɵɵtemplate(42,sX,25,21,"ng-container",77)),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("value",e.ServerSideRPCType.TWO_WAY),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,27,"gateway.with-response")," "),t.ɵɵadvance(2),t.ɵɵproperty("value",e.ServerSideRPCType.ONE_WAY),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,29,"gateway.without-response")," "),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,31,"gateway.device-name-filter-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,33,"gateway.device-name-filter")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,35,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.deviceNameFilter").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.deviceNameFilter").touched),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,37,"gateway.method-filter-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,39,"gateway.method-filter")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(24,41,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.methodFilter").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.methodFilter").touched),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(31,43,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.requestTopicExpression").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.requestTopicExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(47,wY)),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(39,45,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.valueExpression").hasError("required")&&e.mappingForm.get("requestValue.serverSideRpc.valueExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/mqtt-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(48,wY)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.type").value===e.ServerSideRPCType.TWO_WAY)}}function pX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",32),t.ɵɵtext(2,"gateway.request-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",23)(4,"mat-select",51),t.ɵɵtemplate(5,FY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(6,52)(7,53),t.ɵɵconditionalCreate(8,LY,8,9,"div",21),t.ɵɵconditionalCreate(9,VY,1,1,"tb-device-info-table",54)(10,qY,1,1,"tb-device-info-table",54)(11,$Y,59,41)(12,QY,40,47)(13,lX,43,49),t.ɵɵelementContainerEnd()()),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.requestTypes),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.mappingForm.get("requestValue").get(n.requestMappingType)),t.ɵɵadvance(),t.ɵɵconditional(n.requestMappingType===n.RequestTypeEnum.ATTRIBUTE_REQUEST||n.requestMappingType===n.RequestTypeEnum.CONNECT_REQUEST||n.requestMappingType===n.RequestTypeEnum.DISCONNECT_REQUEST?8:-1),t.ɵɵadvance(),t.ɵɵconditional((e=n.requestMappingType)===n.RequestTypeEnum.CONNECT_REQUEST?9:e===n.RequestTypeEnum.DISCONNECT_REQUEST?10:e===n.RequestTypeEnum.ATTRIBUTE_REQUEST?11:e===n.RequestTypeEnum.ATTRIBUTE_UPDATE?12:e===n.RequestTypeEnum.SERVER_SIDE_RPC?13:-1)}}function cX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function dX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",40),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-node-required"))}function uX(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",39),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function mX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function hX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function gX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function fX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function yX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",83)(1,"div",84)(2,"div",85),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",86)(7,"mat-form-field",87)(8,"mat-select",88),t.ɵɵtemplate(9,cX,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"mat-form-field",87),t.ɵɵelement(11,"input",89),t.ɵɵpipe(12,"translate"),t.ɵɵtemplate(13,dX,3,3,"mat-icon",25),t.ɵɵelement(14,"div",26),t.ɵɵpipe(15,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()(),t.ɵɵelement(16,"tb-device-info-table",90),t.ɵɵconditionalCreate(17,uX,1,2,"tb-report-strategy",39),t.ɵɵelementStart(18,"div",31)(19,"div",32),t.ɵɵtext(20,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",42)(22,"mat-chip-listbox",43),t.ɵɵtemplate(23,mX,2,1,"mat-chip",91),t.ɵɵelementStart(24,"mat-chip",44),t.ɵɵelement(25,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",46,3),t.ɵɵpipe(28,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(27),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))}),t.ɵɵelementStart(29,"tb-icon",47),t.ɵɵtext(30,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(31,"div",31)(32,"div",32),t.ɵɵtext(33,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"div",42)(35,"mat-chip-listbox",43),t.ɵɵtemplate(36,hX,2,1,"mat-chip",91),t.ɵɵelementStart(37,"mat-chip",44),t.ɵɵelement(38,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"button",46,4),t.ɵɵpipe(41,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(40),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))}),t.ɵɵelementStart(42,"tb-icon",47),t.ɵɵtext(43,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(44,"div",31)(45,"div",32),t.ɵɵtext(46,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(47,"div",42)(48,"mat-chip-listbox",43),t.ɵɵtemplate(49,gX,2,1,"mat-chip",91),t.ɵɵelementStart(50,"mat-chip",44),t.ɵɵelement(51,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"button",46,5),t.ɵɵpipe(54,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(53),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES_UPDATES))}),t.ɵɵelementStart(55,"tb-icon",47),t.ɵɵtext(56,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(57,"div",31)(58,"div",32),t.ɵɵtext(59,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(60,"div",42)(61,"mat-chip-listbox",43),t.ɵɵtemplate(62,fX,2,1,"mat-chip",91),t.ɵɵelementStart(63,"mat-chip",44),t.ɵɵelement(64,"label",45),t.ɵɵelementEnd()(),t.ɵɵelementStart(65,"button",46,6),t.ɵɵpipe(67,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(66),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.RPC_METHODS))}),t.ɵɵelementStart(68,"tb-icon",47),t.ɵɵtext(69,"edit"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,29,"gateway.device-node-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,31,"gateway.device-node")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",t.ɵɵpureFunction2(47,SY,e.OPCUaSourceTypesEnum.PATH,e.OPCUaSourceTypesEnum.IDENTIFIER)),t.ɵɵadvance(2),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,33,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("deviceNodePattern").hasError("required")&&e.mappingForm.get("deviceNodePattern").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup",t.ɵɵpipeBind3(15,35,e.ConnectorType.OPCUA,"device-node",e.mappingForm.get("deviceNodeSource").value))("tb-help-popup-style",t.ɵɵpureFunction0(50,wY)),t.ɵɵadvance(2),t.ɵɵproperty("connectorType",e.ConnectorType.OPCUA)("sourceTypes",e.OPCUaSourceTypes)("deviceInfoType",e.DeviceInfoType.FULL),t.ɵɵadvance(),t.ɵɵconditional(e.data.withReportStrategy?17:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.opcAttributes),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcAttributes),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,39,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.opcTelemetry),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcTelemetry),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(41,41,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.opcAttributesUpdates),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcAttributesUpdates),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(54,43,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.opcRpcMethods),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcRpcMethods),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(67,45,"action.edit")))}}class vX extends D{constructor(e,t,n,i,a,r,o,s,l){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.translate=l,this.MappingType=qi,this.qualityTypes=Zi,this.QualityTranslationsMap=di,this.convertorTypes=Object.values(li),this.ConvertorTypeEnum=li,this.ConvertorTypeTranslationsMap=ui,this.sourceTypes=Object.values(pi),this.OPCUaSourceTypes=Object.values(Ni),this.OPCUaSourceTypesEnum=Ni,this.sourceTypesEnum=pi,this.SourceTypeTranslationsMap=Hi,this.requestTypes=Object.values(mi),this.RequestTypeEnum=mi,this.RequestTypesTranslationsMap=hi,this.DeviceInfoType=Ta,this.ServerSideRPCType=ta,this.MappingKeysType=Wi,this.MappingHintTranslationsMap=ea,this.MappingTypeTranslationsMap=Gi,this.DataConversionTranslationsMap=gi,this.HelpLinkByMappingTypeMap=Ji,this.ConnectorType=gt,this.ReportStrategyDefaultValue=dn,this.keysPopupClosed=!0,this.destroy$=new _e,this.createMappingForm()}get converterAttributes(){if(this.converterType)return this.mappingForm.get("converter").get(this.converterType).value.attributes.map(e=>e.key)}get converterTelemetry(){if(this.converterType)return this.mappingForm.get("converter").get(this.converterType).value.timeseries.map(e=>e.key)}get opcAttributes(){return this.mappingForm.get("attributes").value?.map(e=>e.key)||[]}get opcTelemetry(){return this.mappingForm.get("timeseries").value?.map(e=>e.key)||[]}get opcRpcMethods(){return this.mappingForm.get("rpc_methods").value?.map(e=>e.method)||[]}get opcAttributesUpdates(){return this.mappingForm.get("attributes_updates")?.value?.map(e=>e.key)||[]}get converterType(){return this.mappingForm.get("converter")?.get("type").value}get customKeys(){return Object.keys(this.mappingForm.get("converter").get("custom").value.extensionConfig)}get requestMappingType(){return this.mappingForm.get("requestType").value}get responseTimeoutErrorTooltip(){const e=this.mappingForm.get("requestValue.serverSideRpc.responseTimeout");return e.hasError("required")?this.translate.instant("gateway.response-timeout-required"):e.hasError("min")?this.translate.instant("gateway.response-timeout-limits-error",{min:1}):""}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}createMappingForm(){switch(this.data.mappingType){case qi.DATA:this.mappingForm=this.fb.group({}),this.createDataMappingForm();break;case qi.REQUESTS:this.mappingForm=this.fb.group({}),this.createRequestMappingForm();break;case qi.OPCUA:this.createOPCUAMappingForm()}}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){this.mappingForm.valid&&this.dialogRef.close(this.prepareMappingData())}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))this.popoverService.hidePopover(i);else{const e=(this.data.mappingType!==qi.OPCUA?this.mappingForm.get("converter").get(this.converterType):this.mappingForm).get(n),t={keys:e.value,keysType:n,rawData:this.mappingForm.get("converter.type")?.value===li.BYTES,panelTitle:$i.get(n),addKeyTitle:Ki.get(n),deleteKeyTitle:Yi.get(n),noKeysText:Xi.get(n),withReportStrategy:this.data.withReportStrategy,connectorType:this.data.mappingType===qi.OPCUA?gt.OPCUA:gt.MQTT,convertorType:this.converterType};this.data.mappingType===qi.OPCUA&&(t.valueTypeKeys=Object.values(Ni),t.valueTypeEnum=Ni,t.valueTypes=Hi,t.sourceType=this.mappingForm.get("deviceNodeSource").value),this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,bY,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(Ne(this.destroy$)).subscribe(t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty()}),this.popoverComponent.tbHideStart.pipe(Ne(this.destroy$)).subscribe(()=>{this.keysPopupClosed=!0})}}prepareMappingData(){const e=this.mappingForm.value;switch(Q(e),this.data.mappingType){case qi.DATA:const{converter:t,topicFilter:n,subscriptionQos:i}=e,{reportStrategy:a,...r}=t[t.type];return{topicFilter:n,subscriptionQos:i,...a?{reportStrategy:a}:{},converter:{type:t.type,...r}};case qi.REQUESTS:return{requestType:e.requestType,requestValue:e.requestValue[e.requestType]};default:return e}}getFormValueData(){if(this.data.value&&Object.keys(this.data.value).length)switch(this.data.mappingType){case qi.DATA:const{converter:e,topicFilter:t,subscriptionQos:n,reportStrategy:i}=this.data.value;return{topicFilter:t,subscriptionQos:n,converter:{type:e.type,[e.type]:{...e,...i?{reportStrategy:i}:{}}}};case qi.REQUESTS:return{requestType:this.data.value.requestType,requestValue:{[this.data.value.requestType]:this.data.value.requestValue}};default:return this.data.value}}createDataMappingForm(){this.mappingForm.addControl("topicFilter",this.fb.control("",[ve.required,ve.pattern(hn)])),this.mappingForm.addControl("subscriptionQos",this.fb.control(0)),this.mappingForm.addControl("converter",this.fb.group({type:[li.JSON,[]],json:this.fb.group({deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),bytes:this.fb.group({deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),custom:this.fb.group({extension:["",[ve.required,ve.pattern(hn)]],extensionConfig:[{},[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})})),this.mappingForm.patchValue(this.getFormValueData()),this.mappingForm.get("converter.type").valueChanges.pipe(je(this.mappingForm.get("converter.type").value),Ne(this.destroy$)).subscribe(e=>{const t=this.mappingForm.get("converter");t.get("json").disable({emitEvent:!1}),t.get("bytes").disable({emitEvent:!1}),t.get("custom").disable({emitEvent:!1}),t.get(e).enable({emitEvent:!1})})}createRequestMappingForm(){this.mappingForm.addControl("requestType",this.fb.control(mi.CONNECT_REQUEST,[])),this.mappingForm.addControl("requestValue",this.fb.group({connectRequests:this.fb.group({topicFilter:["",[ve.required,ve.pattern(hn)]],deviceInfo:[{},[]]}),disconnectRequests:this.fb.group({topicFilter:["",[ve.required,ve.pattern(hn)]],deviceInfo:[{},[]]}),attributeRequests:this.fb.group({topicFilter:["",[ve.required,ve.pattern(hn)]],deviceInfo:this.fb.group({deviceNameExpressionSource:[pi.MSG,[]],deviceNameExpression:["",[ve.required]]}),attributeNameExpressionSource:[pi.MSG,[]],attributeNameExpression:["",[ve.required,ve.pattern(hn)]],topicExpression:["",[ve.required,ve.pattern(hn)]],valueExpression:["",[ve.required,ve.pattern(hn)]],retain:[!1,[]]}),attributeUpdates:this.fb.group({deviceNameFilter:["",[ve.required,ve.pattern(hn)]],attributeFilter:["",[ve.required,ve.pattern(hn)]],topicExpression:["",[ve.required,ve.pattern(hn)]],valueExpression:["",[ve.required,ve.pattern(hn)]],retain:[!0,[]]}),serverSideRpc:this.fb.group({type:[ta.TWO_WAY,[]],deviceNameFilter:["",[ve.required,ve.pattern(hn)]],methodFilter:["",[ve.required,ve.pattern(hn)]],requestTopicExpression:["",[ve.required,ve.pattern(hn)]],responseTopicExpression:["",[ve.required,ve.pattern(hn)]],valueExpression:["",[ve.required,ve.pattern(hn)]],responseTopicQoS:[0,[]],responseTimeout:[1e4,[ve.required,ve.min(1)]]}),reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})),this.mappingForm.get("requestType").valueChanges.pipe(je(this.mappingForm.get("requestType").value),Ne(this.destroy$)).subscribe(e=>{const t=this.mappingForm.get("requestValue");t.get("connectRequests").disable({emitEvent:!1}),t.get("disconnectRequests").disable({emitEvent:!1}),t.get("attributeRequests").disable({emitEvent:!1}),t.get("attributeUpdates").disable({emitEvent:!1}),t.get("serverSideRpc").disable({emitEvent:!1}),t.get(e).enable()}),this.mappingForm.get("requestValue.serverSideRpc.type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{const t=this.mappingForm.get("requestValue.serverSideRpc");e===ta.ONE_WAY?(t.get("responseTopicExpression").disable({emitEvent:!1}),t.get("responseTopicQoS").disable({emitEvent:!1}),t.get("responseTimeout").disable({emitEvent:!1})):(t.get("responseTopicExpression").enable({emitEvent:!1}),t.get("responseTopicQoS").enable({emitEvent:!1}),t.get("responseTimeout").enable({emitEvent:!1}))}),this.mappingForm.patchValue(this.getFormValueData())}createOPCUAMappingForm(){this.mappingForm=this.fb.group({deviceNodeSource:[Ni.PATH,[]],deviceNodePattern:["",[ve.required]],deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]],rpc_methods:[[],[]],attributes_updates:[[],[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.mappingForm.patchValue(this.getFormValueData())}static{this.ɵfac=function(e){return new(e||vX)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(pt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(me.TranslateService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:vX,selectors:[["tb-mapping-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:26,vars:19,consts:[["attributesButton",""],["telemetryButton",""],["keysButton",""],["opcAttributesButton",""],["opcTelemetryButton",""],["attributesUpdatesButton",""],["rpcMethodsButton",""],[1,"key-mapping",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-hint","tb-primary-fill"],[3,"ngSwitch"],[3,"ngSwitchCase"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex"],["matInput","","name","value","formControlName","topicFilter",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","subscriptionQos"],[3,"value",4,"ngFor","ngForOf"],["formGroupName","converter"],[1,"tb-form-row","space-between","tb-flex"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[3,"formGroupName"],["formControlName","deviceInfo","required","true",3,"convertorType","deviceInfoType"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","convertorType","sourceTypes"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","extension",3,"placeholder"],[1,"tb-form-row","space-between","same-padding","tb-flex","column"],["formControlName","requestType"],["formGroupName","requestValue"],[3,"formGroup"],["formControlName","deviceInfo","required","true",3,"deviceInfoType"],["matInput","","name","value",3,"formControl","placeholder"],["translate","",1,"tb-form-panel-title","tb-required"],["translate","",1,"tb-form-hint","tb-primary-fill"],["formGroupName","deviceInfo",1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-flex","no-flex","align-center"],["translate","",1,"tb-required"],[1,"flex","flex-1","gap-2"],[1,"flex","w-1/4"],["formControlName","deviceNameExpressionSource"],["matInput","","name","value","formControlName","deviceNameExpression",3,"placeholder"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","valueExpression",3,"placeholder"],["matInput","","name","value","formControlName","topicExpression",3,"placeholder"],[1,"tb-form-row"],["formControlName","retain",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","deviceNameFilter",3,"placeholder"],["matInput","","name","value","formControlName","attributeFilter",3,"placeholder"],[1,"tb-flex","row","center","align-center","no-gap","fill-width"],["matInput","","name","value","formControlName","methodFilter",3,"placeholder"],["matInput","","name","value","formControlName","requestTopicExpression",3,"placeholder"],[4,"ngIf"],["matInput","","name","value","formControlName","responseTopicExpression",3,"placeholder"],["formControlName","responseTopicQoS"],["matInput","","name","value","type","number","min","1","formControlName","responseTimeout",3,"placeholder"],["matSuffix","",3,"tooltipText"],["translate","","matSuffix","",1,"block","pr-2"],[1,"device-node-row","tb-form-row","column-xs","pr-4"],["translate","",1,"tb-flex","no-flex","align-center","w-1/5"],[1,"tb-required",3,"tb-hint-tooltip-icon"],[1,"flex","w-1/5"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","deviceNodeSource"],["matInput","","name","value","formControlName","deviceNodePattern",3,"placeholder"],["formControlName","deviceInfo","required","true",3,"connectorType","sourceTypes","deviceInfoType"],[4,"ngFor","ngForOf"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",7)(1,"mat-toolbar",8)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",9)(6,"div",10),t.ɵɵelementStart(7,"button",11),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵelementStart(8,"mat-icon",12),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",13)(11,"div",14)(12,"div",15),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(15,16),t.ɵɵtemplate(16,BY,34,25,"ng-template",17)(17,pX,14,4,"ng-template",17)(18,yX,70,51,"ng-template",17),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",18)(20,"button",19),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"button",20),t.ɵɵlistener("click",function(){return n.add()}),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,11,n.MappingTypeTranslationsMap.get(null==n.data?null:n.data.mappingType))),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.HelpLinkByMappingTypeMap.get(n.data.mappingType)),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,13,n.MappingHintTranslationsMap.get(null==n.data?null:n.data.mappingType))," "),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.data.mappingType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingType.DATA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingType.REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingType.OPCUA),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(22,15,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.mappingForm.invalid||!n.mappingForm.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,17,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(vX,[ce,C,pK,Xn,kK,si,ri]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:grid;height:100%}[_nghost-%COMP%] .key-mapping[_ngcontent-%COMP%]{max-width:900px;display:flex;flex-direction:column}[_nghost-%COMP%] .key-mapping[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{min-height:64px}[_nghost-%COMP%] .key-mapping[_ngcontent-%COMP%] tb-toggle-select[_ngcontent-%COMP%]{padding:4px 0}[_nghost-%COMP%] .mat-mdc-dialog-content[_ngcontent-%COMP%]{height:670px}[_nghost-%COMP%] .ellipsis-chips-container[_ngcontent-%COMP%]{max-width:70%}[_nghost-%COMP%] .key-mapping .mat-mdc-chip-listbox .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center;flex-wrap:nowrap}[_nghost-%COMP%] .tb-form-row .fixed-title-width{min-width:40px;width:35%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-form-row .mat-mdc-form-field{width:0}[_nghost-%COMP%] .device-node-row.tb-form-row{gap:12px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}e("MappingDialogComponent",vX);const xX=["searchInput"],bX=()=>({minWidth:"96px",textAlign:"center"});function wX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",23)(2,"span",24),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",25),t.ɵɵelementStart(6,"button",10),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageMapping(n))}),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",10),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())}),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,e.mappingTypeTranslationsMap.get(e.mappingType))),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,7,"action.add"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,9,"action.search")))}}function SX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext();t.ɵɵclassProp("request-column",n.mappingType===n.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,3,e.title)," ")}}function CX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();t.ɵɵclassProp("request-column",a.mappingType===a.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e[i.def]," ")}}function _X(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,13),t.ɵɵtemplate(1,SX,3,5,"mat-header-cell",26)(2,CX,2,3,"mat-cell",27),t.ɵɵelementContainerEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("matColumnDef",e.def)}}function TX(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function EX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageMapping(n,i))}),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteMapping(n,i))}),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"action.edit"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"action.delete"))))}function MX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,EX,8,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",31),t.ɵɵelementContainer(4,32),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"button",34),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(7,"mat-icon",35),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",36,2),t.ɵɵelementContainer(11,32),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,bX)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function IX(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function kX(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class PX{set mappingType(e){this.mappingTypeValue!==e&&(this.mappingTypeValue=e)}get mappingType(){return this.mappingTypeValue}constructor(e,t,n,i){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=i,this.required=!1,this.withReportStrategy=!0,this.mappingTypeTranslationsMap=Gi,this.mappingTypeEnum=qi,this.displayedColumns=[],this.mappingColumns=[],this.textSearchMode=!1,this.hidePageSize=!1,this.activeValue=!1,this.dirtyValue=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new _e,this.mappingFormGroup=this.fb.array([]),this.dirtyValue=!this.activeValue,this.dataSource=new DX}ngOnInit(){this.setMappingColumns(),this.displayedColumns.push(...this.mappingColumns.map(e=>e.def),"actions"),this.mappingFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.updateTableData(e,this.textSearch.value.trim()),this.onChange(e),this.onTouched()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Re(150),Oe((e,t)=>(e??"")===t.trim()),Ne(this.destroy$)).subscribe(e=>{const t=e.trim();this.updateTableData(this.mappingFormGroup.value,t.trim())})}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){this.mappingFormGroup.clear(),this.pushDataAsFormArrays(e)}validate(){return!this.required||this.mappingFormGroup.controls.length?null:{mappingFormGroup:{valid:!1}}}enterFilterMode(){this.textSearchMode=!0,setTimeout(()=>{this.searchInputField.nativeElement.focus(),this.searchInputField.nativeElement.setSelectionRange(0,0)},10)}exitFilterMode(){this.updateTableData(this.mappingFormGroup.value),this.textSearchMode=!1,this.textSearch.reset()}manageMapping(e,t){e&&e.stopPropagation();const n=ne(t),i=n?this.getMappingIndex(t):-1,a=n?this.mappingFormGroup.at(i).value:{};this.dialog.open(vX,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{mappingType:this.mappingType,value:a,buttonTitle:n?"action.apply":"action.add",withReportStrategy:this.withReportStrategy}}).afterClosed().pipe(Ge(1),Ne(this.destroy$)).subscribe(e=>{e&&(n?this.mappingFormGroup.at(i).patchValue(e):this.pushDataAsFormArrays([e]),this.mappingFormGroup.markAsDirty())})}updateTableData(e,t){let n=e.map(e=>this.getMappingValue(e));t&&(n=n.filter(e=>Object.values(e).some(e=>e.toString().toLowerCase().includes(t.toLowerCase())))),this.dataSource.loadData(n)}deleteMapping(e,t){e&&e.stopPropagation();const n=this.getMappingIndex(t),i=this.mappingFormGroup.controls[n].value,a=i.deviceInfo?.deviceNameExpression??i.topicFilter??this.getRequestDetails(i);this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:a}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).subscribe(e=>{e&&(this.mappingFormGroup.removeAt(n),this.mappingFormGroup.markAsDirty())})}getMappingIndex(e){const t=e.__raw;return this.mappingFormGroup.controls.findIndex(e=>e.value===t)}pushDataAsFormArrays(e){e?.length&&e.forEach(e=>this.mappingFormGroup.push(this.fb.control(e)))}getMappingValue(e){let t;switch(this.mappingType){case qi.DATA:const n=ui.get(e.converter?.type);t={topicFilter:e.topicFilter,QoS:e.subscriptionQos,converter:n?this.translate.instant(n):""};break;case qi.REQUESTS:t={requestType:e.requestType,type:this.translate.instant(hi.get(e.requestType)),details:this.getRequestDetails(e)};break;case qi.OPCUA:const i=e.deviceInfo?.deviceNameExpression,a=e.deviceInfo?.deviceProfileExpression,{deviceNodePattern:r}=e;t={deviceNodePattern:r,deviceNamePattern:i,deviceProfileExpression:a};break;default:t={}}return Object.defineProperty(t,"__raw",{value:e,enumerable:!1}),t}getRequestDetails(e){let t;return t=e.requestType===mi.ATTRIBUTE_UPDATE?e.requestValue.attributeFilter:e.requestType===mi.SERVER_SIDE_RPC?e.requestValue.methodFilter:e.requestValue.topicFilter,t}setMappingColumns(){switch(this.mappingType){case qi.DATA:this.mappingColumns.push({def:"topicFilter",title:"gateway.topic-filter"},{def:"QoS",title:"gateway.mqtt-qos"},{def:"converter",title:"gateway.payload-type"});break;case qi.REQUESTS:this.mappingColumns.push({def:"type",title:"gateway.type"},{def:"details",title:"gateway.details"});break;case qi.OPCUA:this.mappingColumns.push({def:"deviceNodePattern",title:"gateway.device-node"},{def:"deviceNamePattern",title:"gateway.device-name"},{def:"deviceProfileExpression",title:"gateway.device-profile"})}}static{this.ɵfac=function(e){return new(e||PX)(t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(Z.DialogService),t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:PX,selectors:[["tb-mapping-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(xX,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{required:"required",withReportStrategy:"withReportStrategy",mappingType:"mappingType"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>PX),multi:!0},{provide:xe,useExisting:a(()=>PX),multi:!0}])],decls:41,vars:35,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-mapping-table","tb-absolute-fill"],[1,"tb-mapping-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-mapping-table-title"],[1,"flex-1"],["class","table-value-column",3,"request-column",4,"matHeaderCellDef"],["tbTruncateWithTooltip","","class","table-value-column",3,"request-column",4,"matCellDef"],[1,"table-value-column"],["tbTruncateWithTooltip","",1,"table-value-column"],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵconditionalCreate(3,wX,14,11,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",6)(7,"button",7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",9,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵpipe(18,"translate"),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())}),t.ɵɵelementStart(19,"mat-icon"),t.ɵɵtext(20,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(21,"div",11)(22,"table",12),t.ɵɵrepeaterCreate(23,_X,3,1,"ng-container",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementContainerStart(25,14),t.ɵɵtemplate(26,TX,1,0,"mat-header-cell",15)(27,MX,12,6,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,IX,1,0,"mat-header-row",17)(29,kX,1,0,"mat-row",18),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"section",19),t.ɵɵpipe(31,"async"),t.ɵɵelementStart(32,"button",20),t.ɵɵlistener("click",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))}),t.ɵɵelementStart(33,"mat-icon",21),t.ɵɵtext(34,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"span"),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(38,"span",22),t.ɵɵpipe(39,"async"),t.ɵɵtext(40," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,21,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,23,"action.search"))),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,25,"common.enter-search")))("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,27,"action.close"))),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵrepeater(n.mappingColumns),t.ɵɵadvance(5),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(31,29,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,31,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(39,33,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(PX,[ce,C,Yn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%]{width:100%;height:100%;background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content.tb-outlined-border[_ngcontent-%COMP%]{box-shadow:0 0 #0003,0 0 #00000024,0 0 #0000001f;border:solid 1px #e0e0e0;border-radius:4px}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .tb-mapping-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:21%}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column.request-column[_ngcontent-%COMP%]{width:35%}[_nghost-%COMP%] .tb-mapping-table[_ngcontent-%COMP%] .tb-mapping-table-content[_ngcontent-%COMP%] .ellipsis[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width:599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-mapping-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:o.OnPush})}}e("MappingTableComponent",PX),Ye([T()],PX.prototype,"required",void 0),Ye([T()],PX.prototype,"withReportStrategy",void 0);let DX=class extends j{constructor(){super()}};function AX(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SecurityTypeTranslationsMap.get(e))," ")}}function OX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function RX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"div",6),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",7)(4,"mat-form-field",8),t.ɵɵelement(5,"input",9),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,OX,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",5)(9,"div",11),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",12),t.ɵɵpipe(14,"translate"),t.ɵɵelementStart(15,"div",13),t.ɵɵelement(16,"tb-toggle-password",14),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,5,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched?7:-1),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,7,"gateway.set")))}}function BX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function FX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function NX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"div",11),t.ɵɵtext(2,"gateway.mode"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",7)(4,"mat-form-field",8)(5,"mat-select",20),t.ɵɵrepeaterCreate(6,BX,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(8,"div",5)(9,"div",11),t.ɵɵtext(10,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",9),t.ɵɵpipe(14,"translate"),t.ɵɵconditionalCreate(15,FX,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",5)(17,"div",11),t.ɵɵtext(18,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",7)(20,"mat-form-field",8),t.ɵɵelement(21,"input",12),t.ɵɵpipe(22,"translate"),t.ɵɵelementStart(23,"div",13),t.ɵɵelement(24,"tb-toggle-password",14),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(6),t.ɵɵrepeater(e.modeTypes),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,5,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched?15:-1),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,7,"gateway.set")))}}function LX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",15),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",5)(4,"div",16),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",7)(8,"mat-form-field",8),t.ɵɵelement(9,"input",17),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",5)(12,"div",16),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"div",7)(16,"mat-form-field",8),t.ɵɵelement(17,"input",18),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",5)(20,"div",16),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"div",7)(24,"mat-form-field",8),t.ɵɵelement(25,"input",19),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(27,NX,25,9)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,11,"gateway.path-hint")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,13,"gateway.CA-certificate-path")),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,15,"gateway.set"))),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,17,"gateway.private-key-path")),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,19,"gateway.set"))),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,21,"gateway.client-cert-path")),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(26,23,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mode()===e.SecurityMode.extendedCertificates?27:-1)}}e("MappingDatasource",DX);class VX{constructor(e,t){this.fb=e,this.cdr=t,this.title="gateway.security",this.mode=n(na.certificates),this.BrokerSecurityType=Li,this.SecurityMode=na,this.securityTypes=Object.values(Li),this.modeTypes=Object.values(Vi),this.SecurityTypeTranslationsMap=ji,this.destroy$=new _e,r(()=>{this.mode()===na.basic&&(this.securityTypes=this.securityTypes.filter(e=>e!==Li.CERTIFICATES))})}ngOnInit(){this.securityFormGroup=this.fb.group({type:[Li.ANONYMOUS,[]],username:["",[ve.required,ve.pattern(hn)]],password:["",[ve.pattern(hn)]],pathToCACert:["",[ve.pattern(hn)]],pathToPrivateKey:["",[ve.pattern(hn)]],pathToClientCert:["",[ve.pattern(hn)]]}),this.mode()===na.extendedCertificates&&this.securityFormGroup.addControl("mode",this.fb.control(Vi.NONE,[])),this.securityFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{Q(e),this.onChange(e),this.onTouched()}),this.securityFormGroup.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.updateValidators(e))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){if(e)e.type||(e.type=Li.ANONYMOUS),this.updateValidators(e.type),this.securityFormGroup.reset(e,{emitEvent:!1});else{const e={type:Li.ANONYMOUS};this.securityFormGroup.reset(e,{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.securityFormGroup.get("type").value!==Li.BASIC||this.securityFormGroup.valid?null:{securityForm:{valid:!1}}}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}updateValidators(e){if(e)if(this.securityFormGroup.get("username").disable({emitEvent:!1}),this.securityFormGroup.get("password").disable({emitEvent:!1}),this.securityFormGroup.get("pathToCACert").disable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").disable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").disable({emitEvent:!1}),this.securityFormGroup.get("mode")?.disable({emitEvent:!1}),e===Li.BASIC)this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1});else if(e===Li.CERTIFICATES&&(this.securityFormGroup.get("pathToCACert").enable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").enable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").enable({emitEvent:!1}),this.mode()===na.extendedCertificates)){const e=this.securityFormGroup.get("mode");e&&!e.value&&e.setValue(Vi.NONE,{emitEvent:!1}),e?.enable({emitEvent:!1}),this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1})}}static{this.ɵfac=function(e){return new(e||VX)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:VX,selectors:[["tb-security-config"]],inputs:{title:"title",mode:[1,"mode"]},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>VX),multi:!0},{provide:xe,useExisting:a(()=>VX),multi:!0}])],decls:10,vars:5,consts:[[1,"tb-form-row","space-between","same-padding","tb-flex","column",3,"formGroup"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],[1,"fixed-title-width","tb-required"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","username",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width"],["matInput","","type","password","name","value","formControlName","password",3,"placeholder"],["matSuffix","",1,"tb-flex","no-gap","align-center","fill-height"],[1,"tb-flex","align-center","fill-height"],[1,"tb-form-hint","tb-primary-fill"],["tbTruncateWithTooltip","",1,"fixed-title-width"],["matInput","","name","value","formControlName","pathToCACert",3,"placeholder"],["matInput","","name","value","formControlName","pathToPrivateKey",3,"placeholder"],["matInput","","name","value","formControlName","pathToClientCert",3,"placeholder"],["formControlName","mode"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵrepeaterCreate(6,AX,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(8,RX,17,9)(9,LX,28,25),t.ɵɵelementEnd()),2&e){let e;t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,n.title)),t.ɵɵadvance(3),t.ɵɵrepeater(n.securityTypes),t.ɵɵadvance(2),t.ɵɵconditional((e=n.securityFormGroup.get("type").value)===n.BrokerSecurityType.BASIC?8:e===n.BrokerSecurityType.CERTIFICATES?9:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(VX,[C,Yn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:o.OnPush})}}e("SecurityConfigComponent",VX);const qX=()=>({min:1e3}),GX=()=>({min:50}),zX=()=>({min:100});function UX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.server-url-required"))}function jX(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",9),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.timeout-error",t.ɵɵpureFunction0(4,qX)))}function HX(e,n){1&e&&(t.ɵɵelementStart(0,"span",10),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function WX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function $X(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind2(1,1,"gateway.scan-period-error",t.ɵɵpureFunction0(4,qX)))}function KX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind2(1,1,"gateway.poll-period-error",t.ɵɵpureFunction0(4,GX)))}function YX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",6),t.ɵɵpipe(2,"translate"),t.ɵɵelementStart(3,"div",7),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"mat-form-field",3),t.ɵɵelement(7,"input",20),t.ɵɵpipe(8,"translate"),t.ɵɵconditionalCreate(9,KX,3,5,"mat-icon",5),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,6,"gateway.hints.poll-period"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,8,"gateway.poll-period")),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,10,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("required")||e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("min"))&&e.serverConfigFormGroup.get("pollPeriodInMillis").touched?9:-1)}}function XX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind2(1,1,"gateway.sub-check-period-error",t.ɵɵpureFunction0(4,zX)))}class ZX{constructor(e){this.fb=e,this.hideNewFields=!1,this.securityPolicyTypes=Ui,this.SecurityMode=na,this.destroy$=new _e,this.serverConfigFormGroup=this.fb.group({url:["",[ve.required,ve.pattern(hn)]],timeoutInMillis:[1e3,[ve.required,ve.min(1e3)]],scanPeriodInMillis:[H,[ve.required,ve.min(1e3)]],pollPeriodInMillis:[5e3,[ve.required,ve.min(50)]],enableSubscriptions:[!0,[]],subCheckPeriodInMillis:[100,[ve.required,ve.min(100)]],showMap:[!1,[]],security:[zi.BASIC128,[]],identity:[]}),this.serverConfigFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e),this.onTouched()})}ngAfterViewInit(){this.hideNewFields&&this.serverConfigFormGroup.get("pollPeriodInMillis").disable({emitEvent:!1})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.serverConfigFormGroup.valid?null:{serverConfigFormGroup:{valid:!1}}}writeValue(e){const{timeoutInMillis:t=1e3,scanPeriodInMillis:n=H,pollPeriodInMillis:i=5e3,enableSubscriptions:a=!0,subCheckPeriodInMillis:r=100,showMap:o=!1,security:s=zi.BASIC128,identity:l={}}=e;this.serverConfigFormGroup.reset({...e,timeoutInMillis:t,scanPeriodInMillis:n,pollPeriodInMillis:i,enableSubscriptions:a,subCheckPeriodInMillis:r,showMap:o,security:s,identity:l},{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||ZX)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ZX,selectors:[["tb-opc-server-config"]],inputs:{hideNewFields:"hideNewFields"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>ZX),multi:!0},{provide:xe,useExisting:a(()=>ZX),multi:!0}])],decls:64,vars:65,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],["tbTruncateWithTooltip","","translate","",1,"fixed-title-width"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","url",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip",""],["matInput","","type","number","min","1000","name","value","formControlName","timeoutInMillis",3,"placeholder"],["matSuffix","",3,"tooltipText"],["translate","","matSuffix","",1,"block","pr-2"],["formControlName","security"],[3,"value"],["matInput","","type","number","min","1000","name","value","formControlName","scanPeriodInMillis",3,"placeholder"],["matInput","","type","number","min","100","name","value","formControlName","subCheckPeriodInMillis",3,"placeholder"],[1,"tb-form-row"],["formControlName","enableSubscriptions",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","showMap",1,"mat-slide"],["formControlName","identity",3,"mode"],["matInput","","type","number","min","50","name","value","formControlName","pollPeriodInMillis",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.server-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",3),t.ɵɵelement(5,"input",4),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,UX,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",6),t.ɵɵpipe(10,"translate"),t.ɵɵelementStart(11,"div",7),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-form-field",3),t.ɵɵelement(15,"input",8),t.ɵɵpipe(16,"translate"),t.ɵɵconditionalCreate(17,jX,2,5,"tb-error-icon",9)(18,HX,2,0,"span",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",1)(20,"div",6),t.ɵɵpipe(21,"translate"),t.ɵɵelementStart(22,"div",7),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"mat-form-field",3)(26,"mat-select",11),t.ɵɵrepeaterCreate(27,WX,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",1)(30,"div",6),t.ɵɵpipe(31,"translate"),t.ɵɵelementStart(32,"div",7),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(35,"mat-form-field",3),t.ɵɵelement(36,"input",13),t.ɵɵpipe(37,"translate"),t.ɵɵconditionalCreate(38,$X,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(39,YX,10,12,"div",1),t.ɵɵelementStart(40,"div",1)(41,"div",6),t.ɵɵpipe(42,"translate"),t.ɵɵelementStart(43,"div",7),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",3),t.ɵɵelement(47,"input",14),t.ɵɵpipe(48,"translate"),t.ɵɵconditionalCreate(49,XX,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(50,"div",15)(51,"mat-slide-toggle",16)(52,"mat-label",17),t.ɵɵpipe(53,"translate"),t.ɵɵelementStart(54,"div",7),t.ɵɵtext(55),t.ɵɵpipe(56,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(57,"div",15)(58,"mat-slide-toggle",18)(59,"mat-label",17),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61),t.ɵɵpipe(62,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelement(63,"tb-security-config",19),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,33,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.serverConfigFormGroup.get("url").hasError("required")&&n.serverConfigFormGroup.get("url").touched?7:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,35,"gateway.hints.opc-timeout"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,37,"gateway.timeout")),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,39,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((n.serverConfigFormGroup.get("timeoutInMillis").hasError("required")||n.serverConfigFormGroup.get("timeoutInMillis").hasError("min"))&&n.serverConfigFormGroup.get("timeoutInMillis").touched?17:18),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(21,41,"gateway.hints.security-policy"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,43,"gateway.security-policy")),t.ɵɵadvance(4),t.ɵɵrepeater(n.securityPolicyTypes),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(31,45,"gateway.hints.scan-period"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(34,47,"gateway.scan-period")),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(37,49,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("scanPeriodInMillis").touched?38:-1),t.ɵɵadvance(),t.ɵɵconditional(n.hideNewFields?-1:39),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(42,51,"gateway.hints.sub-check-period"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(45,53,"gateway.sub-check-period")),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(48,55,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("subCheckPeriodInMillis").touched?49:-1),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(53,57,"gateway.hints.enable-subscription"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(56,59,"gateway.enable-subscription")),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(60,61,"gateway.hints.show-map"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(62,63,"gateway.show-map")," "),t.ɵɵadvance(2),t.ɵɵproperty("mode",n.SecurityMode.extendedCertificates))},dependencies:t.ɵɵgetComponentDepsFactory(ZX,[C,VX,Yn,si]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:o.OnPush})}}e("OpcServerConfigComponent",ZX),Ye([T()],ZX.prototype,"hideNewFields",void 0);class QX extends Wa{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=qi,this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){let t;return t=e?.server&&"mapping"in e?.server?er.mapMappingToUpgradedVersion(e.server.mapping):e&&"mapping"in e?er.mapMappingToCurrentVersion(e.mapping):[],{server:e.server?er.mapServerToUpgradedVersion(e.server):{},mapping:t}}getMappedValue(e){return{server:er.mapServerToDowngradedVersion(e)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(QX)))(n||QX)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:QX,selectors:[["tb-opc-ua-legacy-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>QX),multi:!0},{provide:xe,useExisting:a(()=>QX),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:11,vars:18,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server",3,"hideNewFields"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"required","withReportStrategy","mappingType"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-opc-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,12,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,14,"gateway.server"),"*")),t.ɵɵadvance(2),t.ɵɵproperty("hideNewFields",n.isLegacy),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,16,"gateway.data-mapping"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("required",!0)("withReportStrategy",n.withReportStrategy)("mappingType",n.mappingTypes.OPCUA))},dependencies:t.ɵɵgetComponentDepsFactory(QX,[ce,C,PX,ZX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}e("OpcUaLegacyBasicConfigComponent",QX),Ye([T()],QX.prototype,"withReportStrategy",void 0);class JX extends Wa{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=qi,this.isLegacy=!1}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){return{server:e.server??{},mapping:e.mapping??[]}}getMappedValue(e){return{server:e.server,mapping:e.mapping}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(JX)))(n||JX)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:JX,selectors:[["tb-opc-ua-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>JX),multi:!0},{provide:xe,useExisting:a(()=>JX),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:11,vars:18,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server",3,"hideNewFields"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"required","withReportStrategy","mappingType"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-opc-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,12,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,14,"gateway.server"),"*")),t.ɵɵadvance(2),t.ɵɵproperty("hideNewFields",n.isLegacy),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,16,"gateway.data-mapping"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("required",!0)("withReportStrategy",n.withReportStrategy)("mappingType",n.mappingTypes.OPCUA))},dependencies:t.ɵɵgetComponentDepsFactory(JX,[ce,C,VX,PX,ZX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}e("OpcUaBasicConfigComponent",JX),Ye([T()],JX.prototype,"withReportStrategy",void 0);class eZ extends Wa{constructor(){super(...arguments),this.withReportStrategy=!0,this.MappingType=qi}initBasicFormGroup(){return this.fb.group({mapping:[],requestsMapping:[],broker:[],workers:[]})}getRequestDataArray(e){const t=[];return re(e)&&Object.keys(e).forEach(n=>{for(const i of e[n])t.push({requestType:n,requestValue:i})}),t}getRequestDataObject(e){return e.reduce((e,{requestType:t,requestValue:n})=>(e[t].push(n),e),{connectRequests:[],disconnectRequests:[],attributeRequests:[],attributeUpdates:[],serverSideRpc:[]})}getBrokerMappedValue(e,t){return{...e,maxNumberOfWorkers:t.maxNumberOfWorkers??100,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker??10}}writeValue(e){this.basicFormGroup.setValue(this.mapConfigToFormValue(e),{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(eZ)))(n||eZ)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:eZ,inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵInheritDefinitionFeature]})}}function tZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.max-number-of-workers-required"))}function nZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.max-messages-queue-for-worker-required"))}e("MqttBasicConfigDirective",eZ),Ye([T()],eZ.prototype,"withReportStrategy",void 0);class iZ{constructor(e){this.fb=e,this.destroy$=new _e,this.workersConfigFormGroup=this.fb.group({maxNumberOfWorkers:[100,[ve.required,ve.min(1)]],maxMessageNumberPerWorker:[10,[ve.required,ve.min(1)]]}),this.workersConfigFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e),this.onTouched()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{maxNumberOfWorkers:t,maxMessageNumberPerWorker:n}=e;this.workersConfigFormGroup.reset({maxNumberOfWorkers:t||100,maxMessageNumberPerWorker:n||10},{emitEvent:!1})}validate(){return this.workersConfigFormGroup.valid?null:{workersConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||iZ)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:iZ,selectors:[["tb-workers-config-control"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>iZ),multi:!0},{provide:xe,useExisting:a(()=>iZ),multi:!0}])],decls:21,vars:25,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",2,"width","50%",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip",""],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","type","number","min","1","formControlName","maxNumberOfWorkers",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","type","number","min","1","formControlName","maxMessageNumberPerWorker",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"div",3),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",4),t.ɵɵelement(8,"input",5),t.ɵɵpipe(9,"translate"),t.ɵɵconditionalCreate(10,tZ,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",1)(12,"div",2),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"div",3),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-form-field",4),t.ɵɵelement(18,"input",7),t.ɵɵpipe(19,"translate"),t.ɵɵconditionalCreate(20,nZ,3,3,"mat-icon",6),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.workersConfigFormGroup),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,13,"gateway.max-number-of-workers-hint"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,15,"gateway.max-number-of-workers")),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(9,17,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("min")||n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("required")&&n.workersConfigFormGroup.get("maxNumberOfWorkers").touched?10:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(13,19,"gateway.max-messages-queue-for-worker-hint"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,21,"gateway.max-messages-queue-for-worker")),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,23,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("min")||n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("required")&&n.workersConfigFormGroup.get("maxMessageNumberPerWorker").touched?20:-1))},dependencies:t.ɵɵgetComponentDepsFactory(iZ,[C,Yn]),encapsulation:2,changeDetection:o.OnPush})}}function aZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function rZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.brokerConfigFormGroup.get("port")))}}function oZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function sZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("clientId"))}),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"gateway.generate-client-id")))}e("WorkersConfigControlComponent",iZ);class lZ{constructor(e,t){this.fb=e,this.cdr=t,this.mqttVersions=ci,this.portLimits=Bi,this.destroy$=new _e,this.brokerConfigFormGroup=this.fb.group({host:["",[ve.required,ve.pattern(hn)]],port:[null,[ve.required,ve.min(Bi.MIN),ve.max(Bi.MAX)]],version:[5,[]],clientId:["tb_gw_"+oe(5),[ve.pattern(hn)]],security:[]}),this.brokerConfigFormGroup.valueChanges.subscribe(e=>{this.onChange(e),this.onTouched()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}generate(e){this.brokerConfigFormGroup.get(e)?.patchValue("tb_gw_"+oe(5))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{version:t=5,clientId:n=`tb_gw_${oe(5)}`,security:i={}}=e;this.brokerConfigFormGroup.reset({...e,version:t,clientId:n,security:i},{emitEvent:!1}),this.cdr.markForCheck()}validate(){return this.brokerConfigFormGroup.valid?null:{brokerConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||lZ)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:lZ,selectors:[["tb-broker-config-control"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>lZ),multi:!0},{provide:xe,useExisting:a(()=>lZ),multi:!0}])],decls:30,vars:20,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["formControlName","version"],[3,"value"],["matInput","","name","value","formControlName","clientId",3,"placeholder"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip"],["formControlName","security"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",3),t.ɵɵelement(5,"input",4),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,aZ,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",2),t.ɵɵtext(10,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",3),t.ɵɵelement(12,"input",6),t.ɵɵpipe(13,"translate"),t.ɵɵconditionalCreate(14,rZ,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"div",1)(16,"div",7),t.ɵɵtext(17,"gateway.mqtt-version"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-form-field",3)(19,"mat-select",8),t.ɵɵrepeaterCreate(20,oZ,2,2,"mat-option",9,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",1)(23,"div",7),t.ɵɵtext(24,"gateway.client-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",3),t.ɵɵelement(26,"input",10),t.ɵɵpipe(27,"translate"),t.ɵɵconditionalCreate(28,sZ,4,4,"button",11),t.ɵɵelementEnd()(),t.ɵɵelement(29,"tb-security-config",12),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.brokerConfigFormGroup),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,14,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.brokerConfigFormGroup.get("host").hasError("required")&&n.brokerConfigFormGroup.get("host").touched?7:-1),t.ɵɵadvance(5),t.ɵɵproperty("min",t.ɵɵinterpolate(n.portLimits.MIN))("max",t.ɵɵinterpolate(n.portLimits.MAX))("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(13,16,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((n.brokerConfigFormGroup.get("port").hasError("required")||n.brokerConfigFormGroup.get("port").hasError("min")||n.brokerConfigFormGroup.get("port").hasError("max"))&&n.brokerConfigFormGroup.get("port").touched?14:-1),t.ɵɵadvance(6),t.ɵɵrepeater(n.mqttVersions),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(27,18,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.brokerConfigFormGroup.get("clientId").value?-1:28))},dependencies:t.ɵɵgetComponentDepsFactory(lZ,[C,VX,lK]),encapsulation:2,changeDetection:o.OnPush})}}e("BrokerConfigControlComponent",lZ);class pZ extends eZ{mapConfigToFormValue(e){const{broker:t,mapping:n=[],requestsMapping:i}=e;return{workers:t&&(t.maxNumberOfWorkers||t.maxMessageNumberPerWorker)?{maxNumberOfWorkers:t.maxNumberOfWorkers,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker}:{},mapping:n??[],broker:t??{},requestsMapping:this.getRequestDataArray(i)}}getMappedValue(e){const{broker:t,workers:n,mapping:i,requestsMapping:a}=e||{};return{broker:this.getBrokerMappedValue(t,n),mapping:i,requestsMapping:a?.length?this.getRequestDataObject(a):{}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(pZ)))(n||pZ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:pZ,selectors:[["tb-mqtt-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>pZ),multi:!0},{provide:xe,useExisting:a(()=>pZ),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:19,vars:27,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","broker"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"withReportStrategy","required","mappingType"],["formControlName","requestsMapping",3,"withReportStrategy","mappingType"],[1,"tb-form-panel","no-border","no-padding"],["formControlName","workers"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-broker-config-control",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-tab",1),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"div",4),t.ɵɵelement(14,"tb-mapping-table",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-tab",1),t.ɵɵpipe(16,"translate"),t.ɵɵelementStart(17,"div",7),t.ɵɵelement(18,"tb-workers-config-control",8),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,17,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,19,"gateway.broker.connection"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,21,"gateway.data-mapping"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("required",!0)("mappingType",n.MappingType.DATA),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,23,"gateway.requests-mapping"))),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("mappingType",n.MappingType.REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,25,"gateway.workers-settings"))))},dependencies:t.ɵɵgetComponentDepsFactory(pZ,[ce,C,iZ,lZ,PX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}e("MqttBasicConfigComponent",pZ);class cZ extends eZ{mapConfigToFormValue(e){const{broker:t,mapping:n=[],connectRequests:i=[],disconnectRequests:a=[],attributeRequests:r=[],attributeUpdates:o=[],serverSideRpc:s=[]}=e,l=qa.mapRequestsToUpgradedVersion({connectRequests:i,disconnectRequests:a,attributeRequests:r,attributeUpdates:o,serverSideRpc:s});return{workers:t&&(t.maxNumberOfWorkers||t.maxMessageNumberPerWorker)?{maxNumberOfWorkers:t.maxNumberOfWorkers,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker}:{},mapping:qa.mapMappingToUpgradedVersion(n)||[],broker:t||{},requestsMapping:this.getRequestDataArray(l)}}getMappedValue(e){const{broker:t,workers:n,mapping:i,requestsMapping:a}=e||{},r=a?.length?this.getRequestDataObject(a):{};return{broker:this.getBrokerMappedValue(t,n),mapping:qa.mapMappingToDowngradedVersion(i),...qa.mapRequestsToDowngradedVersion(r)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(cZ)))(n||cZ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:cZ,selectors:[["tb-mqtt-legacy-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>cZ),multi:!0},{provide:xe,useExisting:a(()=>cZ),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:19,vars:27,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","broker"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","mapping",3,"withReportStrategy","required","mappingType"],["formControlName","requestsMapping",3,"withReportStrategy","mappingType"],[1,"tb-form-panel","no-border","no-padding"],["formControlName","workers"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-broker-config-control",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-mapping-table",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-tab",1),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"div",4),t.ɵɵelement(14,"tb-mapping-table",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-tab",1),t.ɵɵpipe(16,"translate"),t.ɵɵelementStart(17,"div",7),t.ɵɵelement(18,"tb-workers-config-control",8),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,17,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,19,"gateway.broker.connection"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,21,"gateway.data-mapping"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("required",!0)("mappingType",n.MappingType.DATA),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,23,"gateway.requests-mapping"))),t.ɵɵadvance(3),t.ɵɵproperty("withReportStrategy",n.withReportStrategy)("mappingType",n.MappingType.REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,25,"gateway.workers-settings"))))},dependencies:t.ɵɵgetComponentDepsFactory(cZ,[ce,C,iZ,lZ,PX]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}e("MqttLegacyBasicConfigComponent",cZ);class dZ extends D{constructor(e,t,n,i,a){super(t,n,a),this.fb=e,this.store=t,this.router=n,this.data=i,this.dialogRef=a,this.portLimits=Bi,this.modbusProtocolTypes=Object.values(ia),this.modbusMethodTypes=Object.values(aa),this.modbusSerialMethodTypes=Object.values(ra),this.modbusParities=Object.values(oa),this.modbusByteSizes=da,this.modbusBaudrates=ca,this.modbusOrderType=Object.values(sa),this.ModbusProtocolType=ia,this.ModbusParityLabelsMap=va,this.ModbusProtocolLabelsMap=ya,this.ModbusMethodLabelsMap=fa,this.ReportStrategyDefaultValue=dn,this.modbusHelpLink=v+"/docs/iot-gateway/config/modbus/#section-master-description-and-configuration-parameters",this.serialSpecificControlKeys=["serialPort","baudrate","stopbits","bytesize","parity","strict"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new _e,this.showSecurityControl=this.fb.control(!1),this.initializeSlaveFormGroup(),this.updateSlaveFormGroup(),this.updateControlsEnabling(this.data.value.type),this.observeTypeChange(),this.observeShowSecurity(),this.showSecurityControl.patchValue(!!this.data.value.security&&!Y(this.data.value.security,{}))}get protocolType(){return this.slaveConfigFormGroup.get("type").value}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}cancel(){this.dialogRef.close(null)}add(){this.slaveConfigFormGroup.valid&&this.dialogRef.close(this.getSlaveResultData())}initializeSlaveFormGroup(){this.slaveConfigFormGroup=this.fb.group({type:[ia.TCP],host:["",[ve.required,ve.pattern(hn)]],port:[null,[ve.required,ve.min(Bi.MIN),ve.max(Bi.MAX)]],serialPort:["",[ve.required,ve.pattern(hn)]],method:[aa.SOCKET,[ve.required]],baudrate:[this.modbusBaudrates[0]],stopbits:[1],bytesize:[da[0]],parity:[oa.None],strict:[!0],unitId:[null,[ve.required]],deviceName:["",[ve.required,ve.pattern(hn)]],deviceType:["",[ve.required,ve.pattern(hn)]],timeout:[35],byteOrder:[sa.BIG],wordOrder:[sa.BIG],retries:[ua],retryOnEmpty:[!0],retryOnInvalid:[!0],pollPeriod:[1e3,[ve.required]],connectAttemptTimeMs:[500,[ve.required]],connectAttemptCount:[5,[ve.required]],waitAfterFailedAttemptsMs:[3e4,[ve.required]],values:[{}],security:[{}]}),this.addFieldsToFormGroup()}updateSlaveFormGroup(){this.slaveConfigFormGroup.patchValue({...this.data.value,port:this.data.value.type===ia.Serial?null:this.data.value.port,serialPort:this.data.value.type===ia.Serial?this.data.value.port:"",retries:!1===this.data.value.retries?0:ee(this.data.value.retries)?this.data.value.retries:ua,values:{attributes:this.data.value.attributes??[],timeseries:this.data.value.timeseries??[],attributeUpdates:this.data.value.attributeUpdates??[],rpc:this.data.value.rpc??[]}})}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.updateControlsEnabling(e),this.updateMethodType(e)})}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==aa.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===ia.Serial?ra.ASCII:aa.SOCKET,{emitEvent:!1})}updateControlsEnabling(e){const[t,n]=e===ia.Serial?[this.serialSpecificControlKeys,this.tcpUdpSpecificControlKeys]:[this.tcpUdpSpecificControlKeys,this.serialSpecificControlKeys];t.forEach(e=>this.slaveConfigFormGroup.get(e)?.enable({emitEvent:!1})),n.forEach(e=>this.slaveConfigFormGroup.get(e)?.disable({emitEvent:!1})),this.updateSecurityEnabling(this.showSecurityControl.value)}observeShowSecurity(){this.showSecurityControl.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.updateSecurityEnabling(e))}updateSecurityEnabling(e){e&&this.protocolType!==ia.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||dZ)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef))}}static{this.ɵdir=t.ɵɵdefineDirective({type:dZ,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusSlaveDialogAbstract",dZ);const uZ=()=>({maxWidth:"970px"});function mZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",15),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate3(" ",e.get("tag").value,"",": ","",e.get("value").value," ")}}function hZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",16)(1,"div",19),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"span",20),t.ɵɵtext(5),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",21),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"span",22),t.ɵɵtext(10),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",21),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"span",22),t.ɵɵtext(15),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(3,6,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.method":"gateway.key"),": "),t.ɵɵadvance(3),t.ɵɵtextInterpolate(e.get("tag").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(8,8,"gateway.address"),": "),t.ɵɵadvance(3),t.ɵɵtextInterpolate(e.get("address").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(13,10,"gateway.type"),": "),t.ɵɵadvance(3),t.ɵɵtextInterpolate(e.get("type").value)}}function gZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.keysType===e.ModbusValueKey.RPC_REQUESTS?"gateway.method-required":"gateway.key-required"))}}function fZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function yZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(5);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.ModbusFunctionCodeTranslationsMap.get(e))," ")}}function vZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",32),t.ɵɵtext(2,"gateway.function-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",29)(4,"mat-select",40),t.ɵɵrepeaterCreate(5,yZ,3,4,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵrepeater(n.functionCodesMap.get(e.get("id").value)||n.defaultFunctionCodes)}}function xZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.objects-count-required"))}function bZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.modbus.max-bit"))}function wZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",41),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",42),t.ɵɵelement(5,"input",43),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,bZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(3).$implicit;t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.bit"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("bit").hasError("max")&&e.get("bit").touched?7:-1)}}function SZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(6);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.BitTargetTypeTranslationMap.get(e)))}}function CZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",41),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit-target-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",44)(5,"mat-form-field",45)(6,"mat-select",46),t.ɵɵrepeaterCreate(7,SZ,3,4,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.bit-target-type"))),t.ɵɵadvance(6),t.ɵɵrepeater(e.bitTargetTypes)}}function _Z(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,wZ,8,9,"div",27),t.ɵɵconditionalCreate(1,CZ,9,4,"div",27)),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵconditional(e.get("objectsCount").value>1?0:-1),t.ɵɵadvance(),t.ɵɵconditional(n.hideNewFields?-1:1)}}function TZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function EZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",34),t.ɵɵelement(1,"mat-icon",54),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(5);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵproperty("svgIcon",t.ɵɵinterpolate(i.ModifierTypesMap.get(e).icon)),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,4,i.ModifierTypesMap.get(e).name))}}function MZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.modifier-invalid"))}function IZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",38)(1,"mat-expansion-panel",13)(2,"mat-expansion-panel-header",14)(3,"mat-panel-title")(4,"mat-slide-toggle",47),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(5,"mat-label",48),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",44)(10,"div",49)(11,"div",32),t.ɵɵtext(12,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",45)(14,"mat-select",50)(15,"mat-select-trigger")(16,"div",51),t.ɵɵelement(17,"mat-icon",52),t.ɵɵelementStart(18,"span"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd()()(),t.ɵɵrepeaterCreate(21,EZ,5,6,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(23,"div",27)(24,"div",32),t.ɵɵtext(25,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",42),t.ɵɵelement(27,"input",53),t.ɵɵpipe(28,"translate"),t.ɵɵconditionalCreate(29,MZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()()()}if(2&e){let e,n;const i=t.ɵɵnextContext(2).$implicit,a=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("expanded",a.enableModifiersControlMap.get(i.get("id").value).value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",a.enableModifiersControlMap.get(i.get("id").value)),t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,10,"gateway.hints.modbus.modifier"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,12,"gateway.modifier")," "),t.ɵɵadvance(10),t.ɵɵproperty("svgIcon",null==(e=a.ModifierTypesMap.get(i.get("modifierType").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,14,null==(n=a.ModifierTypesMap.get(i.get("modifierType").value))?null:n.name)),t.ɵɵadvance(2),t.ɵɵrepeater(a.modifierTypes),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,16,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(i.get("modifierValue").hasError("pattern")&&i.get("modifierValue").touched?29:-1)}}function kZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",31),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function PZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",27)(1,"div",55),t.ɵɵtext(2,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",29),t.ɵɵelement(4,"input",56),t.ɵɵpipe(5,"translate"),t.ɵɵconditionalCreate(6,kZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,3,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?6:-1)}}function DZ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",39),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Key)("isExpansionMode",!0)}}function AZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",23),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelement(3,"div",24),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",25)(5,"div",26),t.ɵɵtext(6,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",27)(8,"div",28),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",29),t.ɵɵelement(13,"input",30),t.ɵɵpipe(14,"translate"),t.ɵɵconditionalCreate(15,gZ,3,3,"mat-icon",31),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",25)(17,"div",26),t.ɵɵtext(18,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",27)(20,"div",32),t.ɵɵtext(21," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",29)(23,"mat-select",33),t.ɵɵrepeaterCreate(24,fZ,2,2,"mat-option",34,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(26,vZ,7,0,"div",27),t.ɵɵelementStart(27,"div",27)(28,"div",35),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"gateway.objects-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",29),t.ɵɵelement(32,"input",36),t.ɵɵpipe(33,"translate"),t.ɵɵconditionalCreate(34,xZ,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(35,_Z,2,2),t.ɵɵelementStart(36,"div",27)(37,"div",35),t.ɵɵpipe(38,"translate"),t.ɵɵtext(39,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"mat-form-field",29),t.ɵɵelement(41,"input",37),t.ɵɵpipe(42,"translate"),t.ɵɵconditionalCreate(43,TZ,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(44,IZ,30,18,"div",38),t.ɵɵconditionalCreate(45,PZ,7,5,"div",27),t.ɵɵconditionalCreate(46,DZ,1,2,"tb-report-strategy",39),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,25,"gateway.hints.modbus.data-keys")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/modbus-functions-data-types_fn")("tb-help-popup-style",t.ɵɵpureFunction0(41,uZ)),t.ɵɵadvance(5),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(9,27,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.hints.modbus.method":"gateway.hints.modbus.key"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,29,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.method-name":"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,31,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("tag").hasError("required")&&e.get("tag").touched?15:-1),t.ɵɵadvance(9),t.ɵɵrepeater(n.modbusDataTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.withFunctionCode?26:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(29,33,"gateway.hints.modbus.objects-count"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(33,35,"gateway.set")))("readonly",!n.ModbusEditableDataTypes.includes(e.get("type").value)),t.ɵɵadvance(2),t.ɵɵconditional(e.get("objectsCount").hasError("required")&&e.get("objectsCount").touched?34:-1),t.ɵɵadvance(),t.ɵɵconditional(e.get("type").value===n.ModbusDataType.BITS?35:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(38,37,"gateway.hints.modbus.address"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(42,39,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("address").hasError("required")&&e.get("address").touched?43:-1),t.ɵɵadvance(),t.ɵɵconditional(n.showModifiersMap.get(e.get("id").value)?44:-1),t.ɵɵadvance(),t.ɵɵconditional(n.isMaster?45:-1),t.ɵɵadvance(),t.ɵɵconditional(n.withReportStrategy?46:-1)}}function OZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",10)(1,"div",11),t.ɵɵelementContainerStart(2,12),t.ɵɵelementStart(3,"mat-expansion-panel",13)(4,"mat-expansion-panel-header",14)(5,"mat-panel-title"),t.ɵɵconditionalCreate(6,mZ,2,3,"div",15)(7,hZ,16,12,"div",16),t.ɵɵelementEnd()(),t.ɵɵtemplate(8,AZ,47,42,"ng-template",17),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",18),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))}),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(3),t.ɵɵconditional(r.isMaster?6:7),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,r.deleteKeyTitle))}}function RZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,OZ,13,6,"div",10,t.ɵɵcomponentInstance().trackByControlId,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function BZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",57),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class FZ{constructor(e,t){this.fb=e,this.popover=t,this.isMaster=!1,this.hideNewFields=!1,this.keysDataApplied=new p,this.withFunctionCode=!0,this.withReportStrategy=!0,this.enableModifiersControlMap=new Map,this.showModifiersMap=new Map,this.functionCodesMap=new Map,this.defaultFunctionCodes=[],this.modbusDataTypes=Object.values(nn),this.modifierTypes=Object.values(Ca),this.bitTargetTypes=Object.values(ha),this.BitTargetTypeTranslationMap=ga,this.ModbusEditableDataTypes=an,this.ModbusFunctionCodeTranslationsMap=ln,this.ModifierTypesMap=_a,this.ReportStrategyDefaultValue=dn,this.ModbusDataType=nn,this.ModbusValueKey=pa,this.destroy$=new _e,this.defaultReadFunctionCodes=[3,4],this.bitsReadFunctionCodes=[1,2],this.defaultWriteFunctionCodes=[6,16],this.bitsWriteFunctionCodes=[5,15]}ngOnInit(){this.withFunctionCode=!this.isMaster||this.keysType!==pa.ATTRIBUTES&&this.keysType!==pa.TIMESERIES,this.withReportStrategy=!(this.isMaster||this.keysType!==pa.ATTRIBUTES&&this.keysType!==pa.TIMESERIES||this.hideNewFields),this.keysListFormArray=this.prepareKeysFormArray(this.values),this.defaultFunctionCodes=this.getDefaultFunctionCodes()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}trackByControlId(e,t){return t.value.id}addKey(){const e=oe(5),t=this.fb.group({tag:["",[ve.required,ve.pattern(hn)]],value:[{value:"",disabled:!this.isMaster},[ve.required,ve.pattern(hn)]],type:[nn.BYTES,[ve.required]],address:[null,[ve.required]],objectsCount:[1,[ve.required]],functionCode:[{value:this.getDefaultFunctionCodes()[0],disabled:!this.withFunctionCode},[ve.required]],reportStrategy:[{value:null,disabled:!this.withReportStrategy}],modifierType:[{value:Ca.MULTIPLIER,disabled:!0}],modifierValue:[{value:1,disabled:!0},[ve.pattern(fn)]],bit:[{value:null,disabled:!0}],bitTargetType:[{value:ha.IntegerType,disabled:!0}],id:[{value:e,disabled:!0}]});this.showModifiersMap.set(e,!1),this.enableModifiersControlMap.set(e,this.fb.control(!1)),this.observeKeyDataType(t),this.observeObjectsCount(t),this.observeEnableModifier(t),this.keysListFormArray.push(t)}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover.hide()}applyKeysData(){this.keysDataApplied.emit(this.getFormValue())}getFormValue(){return this.mapKeysWithModifier(this.withReportStrategy?this.cleanUpEmptyStrategies(this.keysListFormArray.value):this.keysListFormArray.value)}cleanUpEmptyStrategies(e){return e.map(e=>{const{reportStrategy:t,...n}=e;return t?e:n})}mapKeysWithModifier(e){return e.map((e,t)=>{if(this.showModifiersMap.get(this.keysListFormArray.controls[t].get("id").value)){const{modifierType:t,modifierValue:n,...i}=e;return t?{...i,[t]:n}:i}return e})}prepareKeysFormArray(e){const t=[];return e&&e.forEach(e=>{const n=this.createDataKeyFormGroup(e);this.observeKeyDataType(n),this.observeObjectsCount(n),this.observeEnableModifier(n),this.functionCodesMap.set(n.get("id").value,this.getFunctionCodes(e.type)),t.push(n)}),this.fb.array(t)}createDataKeyFormGroup(e){const{tag:t,value:n,type:i,address:a,objectsCount:r,functionCode:o,multiplier:s,divider:l,reportStrategy:p,bit:c,bitTargetType:d}=e,u=oe(5),m=this.shouldShowModifier(i);return this.showModifiersMap.set(u,m),this.enableModifiersControlMap.set(u,this.fb.control((s||l)&&m)),this.fb.group({tag:[t,[ve.required,ve.pattern(hn)]],value:[{value:n,disabled:!this.isMaster},[ve.required,ve.pattern(hn)]],type:[i,[ve.required]],address:[a,[ve.required]],objectsCount:[r,[ve.required]],functionCode:[{value:o,disabled:!this.withFunctionCode},[ve.required]],modifierType:[{value:l?Ca.DIVIDER:Ca.MULTIPLIER,disabled:!this.enableModifiersControlMap.get(u).value}],bit:[{value:c,disabled:i!==nn.BITS||r<2},[ve.max(r-1)]],bitTargetType:[{value:d??ha.IntegerType,disabled:i!==nn.BITS||this.hideNewFields}],modifierValue:[{value:s??l??1,disabled:!this.enableModifiersControlMap.get(u).value},[ve.pattern(fn)]],id:[{value:u,disabled:!0}],reportStrategy:[{value:p,disabled:!this.withReportStrategy}]})}shouldShowModifier(e){return!(this.isMaster||this.keysType!==pa.ATTRIBUTES&&this.keysType!==pa.TIMESERIES||this.ModbusEditableDataTypes.includes(e))}observeKeyDataType(e){e.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(t=>{this.ModbusEditableDataTypes.includes(t)||e.get("objectsCount").patchValue(rn[t],{emitEvent:!1}),this.toggleBitsFields(e);const n=this.shouldShowModifier(t);this.showModifiersMap.set(e.get("id").value,n),this.updateFunctionCodes(e,t)})}observeObjectsCount(e){e.get("objectsCount").valueChanges.pipe(Be(()=>e.get("type").value===nn.BITS),Ne(this.destroy$)).subscribe(()=>this.toggleBitsFields(e))}toggleBitsFields(e){const{objectsCount:t,type:n,bit:i,bitTargetType:a}=e.controls,r=n.value===nn.BITS,o=t.value>1;r&&o?(i.enable({emitEvent:!1}),i.setValidators(ve.max(t.value-1))):i.disable({emitEvent:!1}),i.updateValueAndValidity({emitEvent:!1}),a[r?"enable":"disable"]({emitEvent:!1})}observeEnableModifier(e){this.enableModifiersControlMap.get(e.get("id").value).valueChanges.pipe(Ne(this.destroy$)).subscribe(t=>this.toggleModifierControls(e,t))}toggleModifierControls(e,t){const n=e.get("modifierType"),i=e.get("modifierValue");n[t?"enable":"disable"]({emitEvent:!1}),i[t?"enable":"disable"]({emitEvent:!1}),n.markAsDirty(),i.markAsDirty()}updateFunctionCodes(e,t){const n=this.getFunctionCodes(t);this.functionCodesMap.set(e.get("id").value,n),n.includes(e.get("functionCode").value)||e.get("functionCode").patchValue(n[0],{emitEvent:!1})}getFunctionCodes(e){const t=[...e===nn.BITS?this.bitsWriteFunctionCodes:[],...this.defaultWriteFunctionCodes];if(this.keysType===pa.ATTRIBUTES_UPDATES)return t.sort((e,t)=>e-t);const n=[...this.defaultReadFunctionCodes];return e===nn.BITS&&n.push(...this.bitsReadFunctionCodes),this.keysType===pa.RPC_REQUESTS&&n.push(...t),n.sort((e,t)=>e-t)}getDefaultFunctionCodes(){return this.keysType===pa.ATTRIBUTES_UPDATES?this.defaultWriteFunctionCodes:this.keysType===pa.RPC_REQUESTS?[...this.defaultReadFunctionCodes,...this.defaultWriteFunctionCodes]:this.defaultReadFunctionCodes}static{this.ɵfac=function(e){return new(e||FZ)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(lt.TbPopoverComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:FZ,selectors:[["tb-modbus-data-keys-panel"]],inputs:{isMaster:"isMaster",hideNewFields:"hideNewFields",panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keysType:"keysType",values:"values"},outputs:{keysDataApplied:"keysDataApplied"},decls:18,vars:15,consts:[[1,"tb-modbus-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],[1,"flex","justify-between","pt-4"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],["tbTruncateWithTooltip","",1,"title-container"],[1,"tb-flex"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"title-container","tb-flex"],["tbTruncateWithTooltip","",1,"key-label"],[1,"title-container"],[1,"key-label"],[1,"tb-form-hint","tb-primary-fill","tb-flex","align-center"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","tag",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width"],["formControlName","type"],[3,"value"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],["matInput","","type","number","min","0","max","65535","name","value","formControlName","address",3,"placeholder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],["formControlName","functionCode"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],["matInput","","formControlName","bit","step","1","type","number","min","0",3,"placeholder"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","bitTargetType"],[1,"mat-slide",3,"click","formControl"],[3,"tb-hint-tooltip-icon"],[1,"tb-form-row","column-xs","w-full"],["formControlName","modifierType"],[1,"tb-flex","align-center"],[1,"tb-mat-18",3,"svgIcon"],["matInput","","required","","formControlName","modifierValue","step","0.1","type","number",3,"placeholder"],[1,"tb-mat-20",3,"svgIcon"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","value",3,"placeholder"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(5,RZ,3,0,"div",3)(6,BZ,3,1,"div",4),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",5)(8,"button",6),t.ɵɵlistener("click",function(){return n.addKey()}),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"button",8),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",9),t.ɵɵlistener("click",function(){return n.applyKeysData()}),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(FZ,[C,ri,Yn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{width:180px}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .key-label[_ngcontent-%COMP%]{font-weight:400}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:calc(100vh - 112px);max-height:500px;overflow:auto}[_nghost-%COMP%] .tb-modbus-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}']})}}e("ModbusDataKeysPanelComponent",FZ),Ye([T()],FZ.prototype,"isMaster",void 0),Ye([T()],FZ.prototype,"hideNewFields",void 0);const NZ=()=>({$implicit:null}),LZ=e=>({$implicit:e});function VZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5),t.ɵɵelementContainer(1,7),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(3);t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",n)("ngTemplateOutletContext",t.ɵɵpureFunction0(3,NZ))}}function qZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab",8),t.ɵɵpipe(1,"translate"),t.ɵɵelementStart(2,"div",5),t.ɵɵelementContainer(3,7),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2),a=t.ɵɵreference(3);t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,5,i.ModbusValuesTranslationsMap.get(e)))),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i.valuesFormGroup.get(e)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",a)("ngTemplateOutletContext",t.ɵɵpureFunction1(7,LZ,e))}}function GZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group",6),t.ɵɵrepeaterCreate(1,qZ,4,9,"mat-tab",8,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵrepeater(e.modbusRegisterTypes)}}function zZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function UZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function jZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function HZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.tag," ")}}function WZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",11)(4,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(5,zZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(7,"mat-chip",13),t.ɵɵelement(8,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",15,1),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(10),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES,i))}),t.ɵɵelementStart(12,"tb-icon",16),t.ɵɵtext(13,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",9)(15,"div",10),t.ɵɵtext(16,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",11)(18,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(19,UZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(21,"mat-chip",13),t.ɵɵelement(22,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",15,2),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(24),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.TIMESERIES,i))}),t.ɵɵelementStart(26,"tb-icon",16),t.ɵɵtext(27,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(28,"div",9)(29,"div",10),t.ɵɵtext(30,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"div",11)(32,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(33,jZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(35,"mat-chip",13),t.ɵɵelement(36,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"button",15,3),t.ɵɵpipe(39,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(38),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES_UPDATES,i))}),t.ɵɵelementStart(40,"tb-icon",16),t.ɵɵtext(41,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"div",9)(43,"div",10),t.ɵɵtext(44,"gateway.rpc-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(45,"div",11)(46,"mat-chip-listbox",12),t.ɵɵrepeaterCreate(47,HZ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(49,"mat-chip",13),t.ɵɵelement(50,"label",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"button",15,4),t.ɵɵpipe(53,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(52),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.RPC_REQUESTS,i))}),t.ɵɵelementStart(54,"tb-icon",16),t.ɵɵtext(55,"edit"),t.ɵɵelementEnd()()()()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,16,"action.edit")))("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(25,18,"action.edit")))("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(39,20,"action.edit")))("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(),t.ɵɵrepeater(i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(53,22,"action.edit")))("disabled",i.disabled)}}class $Z{constructor(e,t,n,i,a,r){this.fb=e,this.popoverService=t,this.renderer=n,this.viewContainerRef=i,this.cdr=a,this.destroyRef=r,this.singleMode=!1,this.hideNewFields=!1,this.disabled=!1,this.modbusRegisterTypes=Object.values(la),this.modbusValueKeys=Object.values(pa),this.ModbusValuesTranslationsMap=ma,this.ModbusValueKey=pa}ngOnInit(){this.initializeValuesFormGroup(),this.observeValuesChanges()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){if(this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide(),this.singleMode)this.valuesFormGroup.setValue(this.getSingleRegisterState(e),{emitEvent:!1});else{const{holding_registers:t,coils_initializer:n,input_registers:i,discrete_inputs:a}=e;this.valuesFormGroup.setValue({holding_registers:this.getSingleRegisterState(t),coils_initializer:this.getSingleRegisterState(n),input_registers:this.getSingleRegisterState(i),discrete_inputs:this.getSingleRegisterState(a)},{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.valuesFormGroup.valid?null:{valuesFormGroup:{valid:!1}}}setDisabledState(e){this.disabled=e,this.cdr.markForCheck()}getValueGroup(e,t){return t?this.valuesFormGroup.get(t).get(e):this.valuesFormGroup.get(e)}manageKeys(e,t,n,i){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const a=t._elementRef.nativeElement;if(this.popoverService.hasPopover(a))return void this.popoverService.hidePopover(a);const r=this.getValueGroup(n,i),o={values:r.value,isMaster:!this.singleMode,keysType:n,panelTitle:xa.get(n),addKeyTitle:ba.get(n),deleteKeyTitle:wa.get(n),noKeysText:Sa.get(n),hideNewFields:this.hideNewFields};this.popoverComponent=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,FZ,"leftTop",!1,null,o,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(de(this.destroyRef)).subscribe(e=>{this.popoverComponent.hide(),r.patchValue(e),r.markAsDirty(),this.cdr.markForCheck()})}initializeValuesFormGroup(){const e=()=>this.fb.group(this.modbusValueKeys.reduce((e,t)=>(e[t]=this.fb.control([[],[]]),e),{}));this.singleMode?this.valuesFormGroup=e():this.valuesFormGroup=this.fb.group(this.modbusRegisterTypes.reduce((t,n)=>(t[n]=e(),t),{}))}observeValuesChanges(){this.valuesFormGroup.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.onChange(e),this.onTouched()})}getSingleRegisterState(e){return{attributes:e?.attributes??[],timeseries:e?.timeseries??[],attributeUpdates:e?.attributeUpdates??[],rpc:e?.rpc??[]}}static{this.ɵfac=function(e){return new(e||$Z)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(pt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$Z,selectors:[["tb-modbus-values"]],inputs:{singleMode:"singleMode",hideNewFields:"hideNewFields"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>$Z),multi:!0},{provide:xe,useExisting:a(()=>$Z),multi:!0}])],decls:4,vars:1,consts:[["singleView",""],["attributesButton",""],["telemetryButton",""],["attributesUpdatesButton",""],["rpcRequestsButton",""],[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[3,"formGroup"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"label"],[1,"tb-form-row","space-between","tb-flex"],["translate","",1,"fixed-title-width"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","disabled","matTooltip"],["matButtonIcon",""]],template:function(e,n){1&e&&(t.ɵɵconditionalCreate(0,VZ,2,4,"div",5)(1,GZ,3,1,"mat-tab-group",6),t.ɵɵtemplate(2,WZ,56,24,"ng-template",null,0,t.ɵɵtemplateRefExtractor)),2&e&&t.ɵɵconditional(n.singleMode?0:1)},dependencies:t.ɵɵgetComponentDepsFactory($Z,[ce,C,Xn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .ellipsis-chips-container{max-width:70%}[_nghost-%COMP%] .mat-mdc-tab-body-wrapper{min-height:320px} .mdc-evolution-chip-set__chips{align-items:center}'],changeDetection:o.OnPush})}}function KZ(e,n){1&e&&(t.ɵɵelementStart(0,"div",2)(1,"div",10),t.ɵɵtext(2,"gateway.server-hostname"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",5)(4,"mat-form-field",6),t.ɵɵelement(5,"input",15),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,2,"gateway.set"))))}function YZ(e,n){1&e&&(t.ɵɵelementStart(0,"div",14)(1,"mat-slide-toggle",16)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.request-client-certificate")," "))}e("ModbusValuesComponent",$Z),Ye([T()],$Z.prototype,"singleMode",void 0),Ye([T()],$Z.prototype,"hideNewFields",void 0);class XZ{constructor(e,t){this.fb=e,this.cdr=t,this.isMaster=!1,this.disabled=!1,this.destroy$=new _e,this.securityConfigFormGroup=this.fb.group({certfile:["",[ve.required,ve.pattern(hn)]],keyfile:["",[ve.required,ve.pattern(hn)]],password:["",[ve.required,ve.pattern(hn)]],server_hostname:["",[ve.pattern(hn)]],reqclicert:[{value:!1,disabled:!0}]}),this.observeValueChanges()}ngOnChanges(){this.updateMasterEnabling()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.disabled=e,this.disabled?this.securityConfigFormGroup.disable({emitEvent:!1}):this.securityConfigFormGroup.enable({emitEvent:!1}),this.updateMasterEnabling(),this.cdr.markForCheck()}validate(){return this.securityConfigFormGroup.valid?null:{securityConfigFormGroup:{valid:!1}}}writeValue(e){const{certfile:t,password:n,keyfile:i,server_hostname:a}=e,r={certfile:t??"",password:n??"",keyfile:i??"",server_hostname:a??"",reqclicert:!!e.reqclicert};this.securityConfigFormGroup.reset(r,{emitEvent:!1})}updateMasterEnabling(){this.isMaster?(this.disabled||this.securityConfigFormGroup.get("reqclicert").enable({emitEvent:!1}),this.securityConfigFormGroup.get("server_hostname").disable({emitEvent:!1})):(this.disabled||this.securityConfigFormGroup.get("server_hostname").enable({emitEvent:!1}),this.securityConfigFormGroup.get("reqclicert").disable({emitEvent:!1}))}observeValueChanges(){this.securityConfigFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e),this.onTouched()})}static{this.ɵfac=function(e){return new(e||XZ)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:XZ,selectors:[["tb-modbus-security-config"]],inputs:{isMaster:"isMaster"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>XZ),multi:!0},{provide:xe,useExisting:a(()=>XZ),multi:!0}]),t.ɵɵNgOnChangesFeature],decls:33,vars:26,consts:[[1,"tb-form-panel","no-border","no-padding",3,"formGroup"],[1,"tb-form-hint","tb-primary-fill"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["tbTruncateWithTooltip","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","required","","formControlName","certfile",3,"placeholder"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["matInput","","name","value","required","","formControlName","keyfile",3,"placeholder"],["translate","",1,"fixed-title-width"],["matInput","","type","password","required","","name","value","formControlName","password",3,"placeholder"],["matSuffix","",1,"tb-flex","no-gap","align-center","fill-height"],[1,"tb-flex","align-center","fill-height"],[1,"tb-form-row"],["matInput","","name","value","formControlName","server_hostname",3,"placeholder"],["formControlName","reqclicert",1,"mat-slide"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",2)(5,"div",3),t.ɵɵpipe(6,"translate"),t.ɵɵelementStart(7,"span",4),t.ɵɵtext(8,"gateway.client-cert-path"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",5)(10,"mat-form-field",6),t.ɵɵelement(11,"input",7),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(13,"div",2)(14,"div",8),t.ɵɵpipe(15,"translate"),t.ɵɵelementStart(16,"span",4),t.ɵɵtext(17,"gateway.private-key-path"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",5)(19,"mat-form-field",6),t.ɵɵelement(20,"input",9),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",2)(23,"div",10),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"div",5)(26,"mat-form-field",6),t.ɵɵelement(27,"input",11),t.ɵɵpipe(28,"translate"),t.ɵɵelementStart(29,"div",12),t.ɵɵelement(30,"tb-toggle-password",13),t.ɵɵelementEnd()()()(),t.ɵɵconditionalCreate(31,KZ,7,4,"div",2),t.ɵɵconditionalCreate(32,YZ,5,3,"div",14),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityConfigFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,14,"gateway.hints.path-in-os")),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,16,"gateway.hints.ca-cert"))),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,18,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,20,"gateway.private-key-path"))),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(21,22,"gateway.set"))),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,24,"gateway.set"))),t.ɵɵadvance(4),t.ɵɵconditional(n.isMaster?-1:31),t.ɵɵadvance(),t.ɵɵconditional(n.isMaster?32:-1))},dependencies:t.ɵɵgetComponentDepsFactory(XZ,[C,Yn]),encapsulation:2,changeDetection:o.OnPush})}}function ZZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusProtocolLabelsMap.get(e))}}function QZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function JZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",47),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,QZ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.host"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched?7:-1)}}function eQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.slaveConfigFormGroup.get("port")))}}function tQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",48),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,eQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,9,"gateway.hints.modbus.port"))),t.ɵɵadvance(4),t.ɵɵproperty("min",t.ɵɵinterpolate(e.portLimits.MIN))("max",t.ɵɵinterpolate(e.portLimits.MAX))("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,11,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function nQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function iQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",49),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,nQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.serial-port"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched?7:-1)}}function aQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusMethodLabelsMap.get(e))}}function rQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function oQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function sQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusParityLabelsMap.get(e))}}function lQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15)(5,"mat-select",50),t.ɵɵrepeaterCreate(6,rQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",13)(9,"div",14),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-select",51),t.ɵɵrepeaterCreate(14,oQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",13)(17,"div",14),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",15),t.ɵɵelement(21,"input",52),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",53),t.ɵɵrepeaterCreate(29,sQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",23)(32,"mat-slide-toggle",54)(33,"mat-label",34),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,13,"gateway.hints.modbus.baudrate"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusBaudrates),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,15,"gateway.hints.modbus.bytesize"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusByteSizes),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,17,"gateway.hints.modbus.stopbits"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,19,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(25,21,"gateway.hints.modbus.parity"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusParities),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(34,23,"gateway.hints.modbus.strict"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(36,25,"gateway.strict")," ")}}function pQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function cQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function dQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function uQ(e,n){1&e&&(t.ɵɵelementStart(0,"div",23)(1,"mat-slide-toggle",55)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.send-data-on-change")," "))}function mQ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",24),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function hQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function gQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function fQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",31)(1,"mat-expansion-panel",56)(2,"mat-expansion-panel-header",57)(3,"mat-panel-title")(4,"mat-slide-toggle",58),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",59),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("expanded",e.showSecurityControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showSecurityControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,3,"gateway.tls-connection")," ")}}e("ModbusSecurityConfigComponent",XZ),Ye([T()],XZ.prototype,"isMaster",void 0);class yQ extends dZ{constructor(e,t,n,i,a){super(e,t,n,i,a),this.fb=e,this.store=t,this.router=n,this.data=i,this.dialogRef=a}getSlaveResultData(){const{values:e,type:t,serialPort:n,...i}=this.slaveConfigFormGroup.value,a={...i,type:t,...e};return t===ia.Serial&&(a.port=n),a.reportStrategy||delete a.reportStrategy,Q(a),a}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("reportStrategy",this.fb.control(null))}static{this.ɵfac=function(e){return new(e||yQ)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yQ,selectors:[["tb-modbus-slave-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:144,vars:112,consts:[[1,"slaves-config-container"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"tb-form-panel",3,"formGroup"],[1,"stroked","tb-form-panel"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","method"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","unitId",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],[1,"tb-form-row"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["formControlName","byteOrder"],["formControlName","wordOrder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],["matInput","","type","number","min","0","name","retries","formControlName","retries",3,"placeholder"],["formControlName","retryOnEmpty",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnInvalid",1,"mat-slide"],[1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","100","name","value","formControlName","pollPeriod",3,"placeholder"],["translate","",1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","500","name","value","formControlName","connectAttemptTimeMs",3,"placeholder"],["matInput","","type","number","min","1","name","value","formControlName","connectAttemptCount",3,"placeholder"],["matInput","","type","number","min","30000","name","value","formControlName","waitAfterFailedAttemptsMs",3,"placeholder"],["formControlName","values",3,"singleMode","hideNewFields"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matInput","","name","value","formControlName","serialPort",3,"placeholder"],["formControlName","baudrate"],["formControlName","bytesize"],["matInput","","type","number","min","0","name","value","formControlName","stopbits",3,"placeholder"],["formControlName","parity"],["formControlName","strict",1,"mat-slide"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide","justify-start",3,"click","formControl"],["formControlName","security",1,"security-config"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8)(13,"div",9)(14,"div",10),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",11),t.ɵɵrepeaterCreate(17,ZZ,2,2,"tb-toggle-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",8),t.ɵɵconditionalCreate(20,JZ,8,9,"div",13),t.ɵɵconditionalCreate(21,tQ,8,13,"div",13)(22,iQ,8,9,"div",13),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",16),t.ɵɵrepeaterCreate(29,aQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵconditionalCreate(31,lQ,37,27),t.ɵɵelementStart(32,"div",13)(33,"div",17),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(36,"mat-form-field",15),t.ɵɵelement(37,"input",18),t.ɵɵpipe(38,"translate"),t.ɵɵconditionalCreate(39,pQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(40,"div",13)(41,"div",20),t.ɵɵtext(42,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-form-field",15),t.ɵɵelement(44,"input",21),t.ɵɵpipe(45,"translate"),t.ɵɵconditionalCreate(46,cQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"div",13)(48,"div",20),t.ɵɵtext(49,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(50,"mat-form-field",15),t.ɵɵelement(51,"input",22),t.ɵɵpipe(52,"translate"),t.ɵɵconditionalCreate(53,dQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(54,uQ,5,3,"div",23)(55,mQ,1,2,"tb-report-strategy",24),t.ɵɵelementStart(56,"div",25)(57,"mat-expansion-panel",26)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",27),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",8)(63,"div",13)(64,"div",14),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",15),t.ɵɵelement(68,"input",28),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",13)(71,"div",14),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",15)(75,"mat-select",29),t.ɵɵrepeaterCreate(76,hQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(78,"div",13)(79,"div",14),t.ɵɵpipe(80,"translate"),t.ɵɵtext(81,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(82,"mat-form-field",15)(83,"mat-select",30),t.ɵɵrepeaterCreate(84,gQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(86,fQ,9,5,"div",31),t.ɵɵelementStart(87,"div",23)(88,"div",14),t.ɵɵpipe(89,"translate"),t.ɵɵtext(90,"gateway.retries"),t.ɵɵelementEnd(),t.ɵɵelementStart(91,"mat-form-field",15),t.ɵɵelement(92,"input",32),t.ɵɵpipe(93,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"div",23)(95,"mat-slide-toggle",33)(96,"mat-label",34),t.ɵɵpipe(97,"translate"),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(100,"div",23)(101,"mat-slide-toggle",35)(102,"mat-label",34),t.ɵɵpipe(103,"translate"),t.ɵɵtext(104),t.ɵɵpipe(105,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(106,"div",13)(107,"div",36),t.ɵɵpipe(108,"translate"),t.ɵɵelementStart(109,"span",37),t.ɵɵtext(110," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"mat-form-field",15),t.ɵɵelement(112,"input",38),t.ɵɵpipe(113,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(114,"div",13)(115,"div",39),t.ɵɵpipe(116,"translate"),t.ɵɵtext(117,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(118,"mat-form-field",15),t.ɵɵelement(119,"input",40),t.ɵɵpipe(120,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(121,"div",13)(122,"div",39),t.ɵɵpipe(123,"translate"),t.ɵɵtext(124,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(125,"mat-form-field",15),t.ɵɵelement(126,"input",41),t.ɵɵpipe(127,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(128,"div",13)(129,"div",39),t.ɵɵpipe(130,"translate"),t.ɵɵtext(131,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(132,"mat-form-field",15),t.ɵɵelement(133,"input",42),t.ɵɵpipe(134,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(135,"div",25),t.ɵɵelement(136,"tb-modbus-values",43),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(137,"div",44)(138,"button",45),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(141,"button",46),t.ɵɵlistener("click",function(){return n.add()}),t.ɵɵtext(142),t.ɵɵpipe(143,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,60,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵrepeater(n.modbusProtocolTypes),t.ɵɵadvance(3),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?21:22),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(25,62,"gateway.hints.modbus.framer-type"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType===n.ModbusProtocolType.Serial?31:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(34,64,"gateway.hints.modbus.unit-id"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(38,66,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched?39:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(45,68,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched?46:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(52,70,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched?53:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?54:55),t.ɵɵadvance(10),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(65,72,"gateway.hints.modbus.connection-timeout"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(69,74,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(72,76,"gateway.hints.modbus.byte-order"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(80,78,"gateway.hints.modbus.word-order"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?86:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(89,80,"gateway.hints.modbus.retries"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(93,82,"gateway.set"))),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(97,84,"gateway.hints.modbus.retries-on-empty"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(99,86,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(103,88,"gateway.hints.modbus.retries-on-invalid"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(105,90,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(108,92,"gateway.hints.modbus.poll-period"))),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(113,94,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(116,96,"gateway.hints.modbus.connect-attempt-time"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(120,98,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(123,100,"gateway.hints.modbus.connect-attempt-count"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(127,102,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(130,104,"gateway.hints.modbus.wait-after-failed-attempts"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(134,106,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,108,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(143,110,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(yQ,[C,$Z,XZ,lK,ri,Yn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .slaves-config-container[_ngcontent-%COMP%]{width:80vw;max-width:900px}[_nghost-%COMP%] .slave-name-label[_ngcontent-%COMP%]{margin-right:16px;color:#000000de}[_nghost-%COMP%] .fixed-title-width-260[_ngcontent-%COMP%]{min-width:260px}[_nghost-%COMP%] .security-config .fixed-title-width{min-width:230px}'],changeDetection:o.OnPush})}}function vQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusProtocolLabelsMap.get(e))}}function xQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function bQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",47),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,xQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.host"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched?7:-1)}}function wQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.slaveConfigFormGroup.get("port")))}}function SQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",48),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,wQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,9,"gateway.hints.modbus.port"))),t.ɵɵadvance(4),t.ɵɵproperty("min",t.ɵɵinterpolate(e.portLimits.MIN))("max",t.ɵɵinterpolate(e.portLimits.MAX))("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,11,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function CQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function _Q(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",17),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15),t.ɵɵelement(5,"input",49),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,CQ,3,3,"mat-icon",19),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.serial-port"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched?7:-1)}}function TQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusMethodLabelsMap.get(e))}}function EQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function MQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function IQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusParityLabelsMap.get(e))}}function kQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",15)(5,"mat-select",50),t.ɵɵrepeaterCreate(6,EQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",13)(9,"div",14),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-select",51),t.ɵɵrepeaterCreate(14,MQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",13)(17,"div",14),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",15),t.ɵɵelement(21,"input",52),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",53),t.ɵɵrepeaterCreate(29,IQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",23)(32,"mat-slide-toggle",54)(33,"mat-label",34),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,13,"gateway.hints.modbus.baudrate"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusBaudrates),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,15,"gateway.hints.modbus.bytesize"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusByteSizes),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,17,"gateway.hints.modbus.stopbits"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,19,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(25,21,"gateway.hints.modbus.parity"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusParities),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(34,23,"gateway.hints.modbus.strict"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(36,25,"gateway.strict")," ")}}function PQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function DQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function AQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function OQ(e,n){1&e&&(t.ɵɵelementStart(0,"div",23)(1,"mat-slide-toggle",55)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.send-data-on-change")," "))}function RQ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",24),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function BQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function FQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",12),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function NQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",31)(1,"mat-expansion-panel",56)(2,"mat-expansion-panel-header",57)(3,"mat-panel-title")(4,"mat-slide-toggle",58),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",59),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("expanded",e.showSecurityControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showSecurityControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,3,"gateway.tls-connection")," ")}}e("ModbusSlaveDialogComponent",yQ);class LQ extends dZ{constructor(e,t,n,i,a){super(e,t,n,i,a),this.fb=e,this.store=t,this.router=n,this.data=i,this.dialogRef=a}getSlaveResultData(){const{values:e,type:t,serialPort:n,...i}=this.slaveConfigFormGroup.value,a={...i,type:t,...e};return t===ia.Serial&&(a.port=n),Q(a),a}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("sendDataOnlyOnChange",this.fb.control(!1))}static{this.ɵfac=function(e){return new(e||LQ)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:LQ,selectors:[["tb-modbus-legacy-slave-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:144,vars:112,consts:[[1,"slaves-config-container"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content","",1,"tb-form-panel",3,"formGroup"],[1,"stroked","tb-form-panel"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","method"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","unitId",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],[1,"tb-form-row"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["formControlName","byteOrder"],["formControlName","wordOrder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],["matInput","","type","number","min","0","name","retries","formControlName","retries",3,"placeholder"],["formControlName","retryOnEmpty",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnInvalid",1,"mat-slide"],[1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","100","name","value","formControlName","pollPeriod",3,"placeholder"],["translate","",1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","500","name","value","formControlName","connectAttemptTimeMs",3,"placeholder"],["matInput","","type","number","min","1","name","value","formControlName","connectAttemptCount",3,"placeholder"],["matInput","","type","number","min","30000","name","value","formControlName","waitAfterFailedAttemptsMs",3,"placeholder"],["formControlName","values",3,"singleMode","hideNewFields"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matInput","","name","value","formControlName","serialPort",3,"placeholder"],["formControlName","baudrate"],["formControlName","bytesize"],["matInput","","type","number","min","0","name","value","formControlName","stopbits",3,"placeholder"],["formControlName","parity"],["formControlName","strict",1,"mat-slide"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide","justify-start",3,"click","formControl"],["formControlName","security",1,"security-config"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",2)(6,"div",3),t.ɵɵelementStart(7,"button",4),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵelementStart(8,"mat-icon",5),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7)(12,"div",8)(13,"div",9)(14,"div",10),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",11),t.ɵɵrepeaterCreate(17,vQ,2,2,"tb-toggle-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",8),t.ɵɵconditionalCreate(20,bQ,8,9,"div",13),t.ɵɵconditionalCreate(21,SQ,8,13,"div",13)(22,_Q,8,9,"div",13),t.ɵɵelementStart(23,"div",13)(24,"div",14),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",15)(28,"mat-select",16),t.ɵɵrepeaterCreate(29,TQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵconditionalCreate(31,kQ,37,27),t.ɵɵelementStart(32,"div",13)(33,"div",17),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(36,"mat-form-field",15),t.ɵɵelement(37,"input",18),t.ɵɵpipe(38,"translate"),t.ɵɵconditionalCreate(39,PQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(40,"div",13)(41,"div",20),t.ɵɵtext(42,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-form-field",15),t.ɵɵelement(44,"input",21),t.ɵɵpipe(45,"translate"),t.ɵɵconditionalCreate(46,DQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"div",13)(48,"div",20),t.ɵɵtext(49,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(50,"mat-form-field",15),t.ɵɵelement(51,"input",22),t.ɵɵpipe(52,"translate"),t.ɵɵconditionalCreate(53,AQ,3,3,"mat-icon",19),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(54,OQ,5,3,"div",23)(55,RQ,1,2,"tb-report-strategy",24),t.ɵɵelementStart(56,"div",25)(57,"mat-expansion-panel",26)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",27),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",8)(63,"div",13)(64,"div",14),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",15),t.ɵɵelement(68,"input",28),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",13)(71,"div",14),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",15)(75,"mat-select",29),t.ɵɵrepeaterCreate(76,BQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(78,"div",13)(79,"div",14),t.ɵɵpipe(80,"translate"),t.ɵɵtext(81,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(82,"mat-form-field",15)(83,"mat-select",30),t.ɵɵrepeaterCreate(84,FQ,2,2,"mat-option",12,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(86,NQ,9,5,"div",31),t.ɵɵelementStart(87,"div",23)(88,"div",14),t.ɵɵpipe(89,"translate"),t.ɵɵtext(90,"gateway.retries"),t.ɵɵelementEnd(),t.ɵɵelementStart(91,"mat-form-field",15),t.ɵɵelement(92,"input",32),t.ɵɵpipe(93,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"div",23)(95,"mat-slide-toggle",33)(96,"mat-label",34),t.ɵɵpipe(97,"translate"),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(100,"div",23)(101,"mat-slide-toggle",35)(102,"mat-label",34),t.ɵɵpipe(103,"translate"),t.ɵɵtext(104),t.ɵɵpipe(105,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(106,"div",13)(107,"div",36),t.ɵɵpipe(108,"translate"),t.ɵɵelementStart(109,"span",37),t.ɵɵtext(110," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"mat-form-field",15),t.ɵɵelement(112,"input",38),t.ɵɵpipe(113,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(114,"div",13)(115,"div",39),t.ɵɵpipe(116,"translate"),t.ɵɵtext(117,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(118,"mat-form-field",15),t.ɵɵelement(119,"input",40),t.ɵɵpipe(120,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(121,"div",13)(122,"div",39),t.ɵɵpipe(123,"translate"),t.ɵɵtext(124,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(125,"mat-form-field",15),t.ɵɵelement(126,"input",41),t.ɵɵpipe(127,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(128,"div",13)(129,"div",39),t.ɵɵpipe(130,"translate"),t.ɵɵtext(131,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(132,"mat-form-field",15),t.ɵɵelement(133,"input",42),t.ɵɵpipe(134,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(135,"div",25),t.ɵɵelement(136,"tb-modbus-values",43),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(137,"div",44)(138,"button",45),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(141,"button",46),t.ɵɵlistener("click",function(){return n.add()}),t.ɵɵtext(142),t.ɵɵpipe(143,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,60,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵrepeater(n.modbusProtocolTypes),t.ɵɵadvance(3),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?21:22),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(25,62,"gateway.hints.modbus.framer-type"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType===n.ModbusProtocolType.Serial?31:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(34,64,"gateway.hints.modbus.unit-id"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(38,66,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched?39:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(45,68,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched?46:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(52,70,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched?53:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?54:55),t.ɵɵadvance(10),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(65,72,"gateway.hints.modbus.connection-timeout"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(69,74,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(72,76,"gateway.hints.modbus.byte-order"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(80,78,"gateway.hints.modbus.word-order"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?86:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(89,80,"gateway.hints.modbus.retries"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(93,82,"gateway.set"))),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(97,84,"gateway.hints.modbus.retries-on-empty"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(99,86,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(103,88,"gateway.hints.modbus.retries-on-invalid"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(105,90,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(108,92,"gateway.hints.modbus.poll-period"))),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(113,94,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(116,96,"gateway.hints.modbus.connect-attempt-time"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(120,98,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(123,100,"gateway.hints.modbus.connect-attempt-count"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(127,102,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(130,104,"gateway.hints.modbus.wait-after-failed-attempts"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(134,106,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,108,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(143,110,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(LQ,[ce,C,$Z,XZ,lK,ri]),styles:['@charset "UTF-8";[_nghost-%COMP%] .slaves-config-container[_ngcontent-%COMP%]{width:80vw;max-width:900px}[_nghost-%COMP%] .slave-name-label[_ngcontent-%COMP%]{margin-right:16px;color:#000000de}[_nghost-%COMP%] .fixed-title-width-260[_ngcontent-%COMP%]{min-width:260px}[_nghost-%COMP%] .security-config .fixed-title-width{min-width:230px}'],changeDetection:o.OnPush})}}function VQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusProtocolLabelsMap.get(e))}}function qQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function GQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9),t.ɵɵelement(5,"input",34),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,qQ,3,3,"mat-icon",35),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.host"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched?7:-1)}}function zQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.slaveConfigFormGroup.get("port")))}}function UQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9),t.ɵɵelement(5,"input",36),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,zQ,3,3,"mat-icon",35),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,9,"gateway.hints.modbus.port"))),t.ɵɵadvance(4),t.ɵɵproperty("min",t.ɵɵinterpolate(e.portLimits.MIN))("max",t.ɵɵinterpolate(e.portLimits.MAX))("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,11,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function jQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function HQ(e,n){if(1&e&&t.ɵɵconditionalCreate(0,jQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext(2);t.ɵɵconditional(e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched?0:-1)}}function WQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9),t.ɵɵelement(5,"input",37),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,HQ,1,1),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.modbus.serial-port"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched?7:-1)}}function $Q(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.ModbusMethodLabelsMap.get(e))}}function KQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function YQ(e,n){if(1&e&&t.ɵɵconditionalCreate(0,KQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.slaveConfigFormGroup.get("unitId").hasError("required")&&e.slaveConfigFormGroup.get("unitId").touched?0:-1)}}function XQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function ZQ(e,n){if(1&e&&t.ɵɵconditionalCreate(0,XQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.slaveConfigFormGroup.get("deviceName").hasError("required")&&e.slaveConfigFormGroup.get("deviceName").touched?0:-1)}}function QQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",35),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function JQ(e,n){if(1&e&&t.ɵɵconditionalCreate(0,QQ,3,3,"mat-icon",35),2&e){const e=t.ɵɵnextContext();t.ɵɵconditional(e.slaveConfigFormGroup.get("deviceType").hasError("required")&&e.slaveConfigFormGroup.get("deviceType").touched?0:-1)}}function eJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function tJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",8),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",9)(5,"mat-select",38),t.ɵɵrepeaterCreate(6,eJ,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.baudrate"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.modbusBaudrates)}}function nJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function iJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function aJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",26)(1,"mat-expansion-panel",39)(2,"mat-expansion-panel-header",40)(3,"mat-panel-title")(4,"mat-slide-toggle",41),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(5,"mat-label"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",42),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("expanded",e.showSecurityControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",e.showSecurityControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,3,"gateway.tls-connection")," ")}}e("ModbusLegacySlaveDialogComponent",LQ);class rJ{constructor(e){this.fb=e,this.ModbusProtocolLabelsMap=ya,this.ModbusMethodLabelsMap=fa,this.portLimits=Bi,this.modbusProtocolTypes=Object.values(ia),this.modbusMethodTypes=Object.values(aa),this.modbusSerialMethodTypes=Object.values(ra),this.modbusOrderType=Object.values(sa),this.ModbusProtocolType=ia,this.modbusBaudrates=ca,this.isSlaveEnabled=!1,this.serialSpecificControlKeys=["serialPort","baudrate"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new _e,this.showSecurityControl=this.fb.control(!1),this.slaveConfigFormGroup=this.fb.group({type:[ia.TCP],host:["",[ve.required,ve.pattern(hn)]],port:[null,[ve.required,ve.min(Bi.MIN),ve.max(Bi.MAX)]],serialPort:["",[ve.required,ve.pattern(hn)]],method:[aa.SOCKET],unitId:[null,[ve.required]],baudrate:[this.modbusBaudrates[0]],deviceName:["",[ve.required,ve.pattern(hn)]],deviceType:["",[ve.required,ve.pattern(hn)]],pollPeriod:[1e3,[ve.required]],sendDataToThingsBoard:[!1],byteOrder:[sa.BIG],wordOrder:[sa.BIG],security:[],identity:this.fb.group({vendorName:["",[ve.pattern(hn)]],productCode:["",[ve.pattern(hn)]],vendorUrl:["",[ve.pattern(hn)]],productName:["",[ve.pattern(hn)]],modelName:["",[ve.pattern(hn)]]}),values:[]}),this.observeValueChanges(),this.observeTypeChange(),this.observeShowSecurity()}get protocolType(){return this.slaveConfigFormGroup.get("type").value}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}validate(){return this.slaveConfigFormGroup.valid?null:{slaveConfigFormGroup:{valid:!1}}}writeValue(e){this.showSecurityControl.patchValue(!!e.security&&!Y(e.security,{})),this.updateSlaveConfig(e)}setDisabledState(e){this.isSlaveEnabled=!e,this.updateFormEnableState()}observeValueChanges(){this.slaveConfigFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{e.type===ia.Serial&&(e.port=e.serialPort,delete e.serialPort),this.onChange(e),this.onTouched()})}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.updateFormEnableState(),this.updateMethodType(e)})}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==aa.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===ia.Serial?ra.ASCII:aa.SOCKET,{emitEvent:!1})}updateFormEnableState(){this.isSlaveEnabled?(this.slaveConfigFormGroup.enable({emitEvent:!1}),this.showSecurityControl.enable({emitEvent:!1})):(this.slaveConfigFormGroup.disable({emitEvent:!1}),this.showSecurityControl.disable({emitEvent:!1})),this.updateEnablingByProtocol(),this.updateSecurityEnable(this.showSecurityControl.value)}observeShowSecurity(){this.showSecurityControl.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>this.updateSecurityEnable(e))}updateSecurityEnable(e){e&&this.isSlaveEnabled&&this.protocolType!==ia.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}updateEnablingByProtocol(){const e=this.protocolType===ia.Serial,t=e?this.serialSpecificControlKeys:this.tcpUdpSpecificControlKeys,n=e?this.tcpUdpSpecificControlKeys:this.serialSpecificControlKeys;this.isSlaveEnabled&&t.forEach(e=>this.slaveConfigFormGroup.get(e)?.enable({emitEvent:!1})),n.forEach(e=>this.slaveConfigFormGroup.get(e)?.disable({emitEvent:!1}))}updateSlaveConfig(e){const{vendorName:t="",productCode:n="",vendorUrl:i="",productName:a="",modelName:r=""}=e.identity??{},o={vendorName:t,productCode:n,vendorUrl:i,productName:a,modelName:r},{type:s=ia.TCP,method:l=aa.RTU,unitId:p=0,deviceName:c="",deviceType:d="",pollPeriod:u=1e3,sendDataToThingsBoard:m=!1,byteOrder:h=sa.BIG,wordOrder:g=sa.BIG,security:f={},values:y={},baudrate:v=this.modbusBaudrates[0],host:x="",port:b=null}=e,w={type:s,method:l,unitId:p,deviceName:c,deviceType:d,pollPeriod:u,sendDataToThingsBoard:!!m,byteOrder:h,wordOrder:g,security:f,identity:o,values:y,baudrate:v,host:s===ia.Serial?"":x,port:s===ia.Serial?null:b,serialPort:s===ia.Serial?b:""};this.slaveConfigFormGroup.setValue(w,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||rJ)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:rJ,selectors:[["tb-modbus-slave-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>rJ),multi:!0},{provide:xe,useExisting:a(()=>rJ),multi:!0}])],decls:115,vars:68,consts:[[1,"slave-container",3,"formGroup"],[1,"slave-content","tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["translate","",1,"fixed-title-width"],["formControlName","type","appearance","fill"],[3,"value"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","method"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","unitId",3,"placeholder"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","100","name","value","formControlName","pollPeriod",3,"placeholder"],[1,"tb-form-row"],["formControlName","sendDataToThingsBoard",1,"mat-slide"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],["formControlName","byteOrder"],["formControlName","wordOrder"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[3,"formGroup"],["matInput","","name","value","formControlName","vendorName",3,"placeholder"],["matInput","","name","value","formControlName","productCode",3,"placeholder"],["matInput","","name","value","formControlName","vendorUrl",3,"placeholder"],["matInput","","name","value","formControlName","productName",3,"placeholder"],["matInput","","name","value","formControlName","modelName",3,"placeholder"],["formControlName","values"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matInput","","name","value","formControlName","serialPort",3,"placeholder"],["formControlName","baudrate"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],["formControlName","security"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),t.ɵɵtext(4,"gateway.server-slave-config"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",4),t.ɵɵrepeaterCreate(6,VQ,2,2,"tb-toggle-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",6),t.ɵɵconditionalCreate(9,GQ,8,9,"div",7),t.ɵɵconditionalCreate(10,UQ,8,13,"div",7)(11,WQ,8,9,"div",7),t.ɵɵelementStart(12,"div",7)(13,"div",8),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-form-field",9)(17,"mat-select",10),t.ɵɵrepeaterCreate(18,$Q,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(20,"div",7)(21,"div",11),t.ɵɵpipe(22,"translate"),t.ɵɵtext(23,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",9),t.ɵɵelement(25,"input",12),t.ɵɵpipe(26,"translate"),t.ɵɵconditionalCreate(27,YQ,1,1),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"div",7)(29,"div",13),t.ɵɵtext(30,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(31,"mat-form-field",9),t.ɵɵelement(32,"input",14),t.ɵɵpipe(33,"translate"),t.ɵɵconditionalCreate(34,ZQ,1,1),t.ɵɵelementEnd()(),t.ɵɵelementStart(35,"div",7)(36,"div",13),t.ɵɵtext(37,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field",9),t.ɵɵelement(39,"input",15),t.ɵɵpipe(40,"translate"),t.ɵɵconditionalCreate(41,JQ,1,1),t.ɵɵelementEnd()(),t.ɵɵelementStart(42,"div",7)(43,"div",16),t.ɵɵpipe(44,"translate"),t.ɵɵelementStart(45,"span",17),t.ɵɵtext(46," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"mat-form-field",9),t.ɵɵelement(48,"input",18),t.ɵɵpipe(49,"translate"),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(50,tJ,8,4,"div",7),t.ɵɵelementStart(51,"div",19)(52,"mat-slide-toggle",20)(53,"mat-label"),t.ɵɵtext(54),t.ɵɵpipe(55,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(56,"div",21)(57,"mat-expansion-panel",22)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",23),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",6)(63,"div",7)(64,"div",8),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",9)(68,"mat-select",24),t.ɵɵrepeaterCreate(69,nJ,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(71,"div",7)(72,"div",8),t.ɵɵpipe(73,"translate"),t.ɵɵtext(74,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(75,"mat-form-field",9)(76,"mat-select",25),t.ɵɵrepeaterCreate(77,iJ,2,2,"mat-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(79,aJ,9,5,"div",26),t.ɵɵelementContainerStart(80,27),t.ɵɵelementStart(81,"div",7)(82,"div",3),t.ɵɵtext(83,"gateway.vendor-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(84,"mat-form-field",9),t.ɵɵelement(85,"input",28),t.ɵɵpipe(86,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(87,"div",7)(88,"div",3),t.ɵɵtext(89,"gateway.product-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(90,"mat-form-field",9),t.ɵɵelement(91,"input",29),t.ɵɵpipe(92,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(93,"div",7)(94,"div",3),t.ɵɵtext(95,"gateway.vendor-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(96,"mat-form-field",9),t.ɵɵelement(97,"input",30),t.ɵɵpipe(98,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(99,"div",7)(100,"div",3),t.ɵɵtext(101,"gateway.product-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(102,"mat-form-field",9),t.ɵɵelement(103,"input",31),t.ɵɵpipe(104,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(105,"div",7)(106,"div",3),t.ɵɵtext(107,"gateway.model-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(108,"mat-form-field",9),t.ɵɵelement(109,"input",32),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()(),t.ɵɵelementStart(111,"div",21)(112,"div",23),t.ɵɵtext(113,"gateway.values"),t.ɵɵelementEnd(),t.ɵɵelement(114,"tb-modbus-values",33),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(6),t.ɵɵrepeater(n.modbusProtocolTypes),t.ɵɵadvance(3),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?9:-1),t.ɵɵadvance(),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?10:11),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,38,"gateway.hints.modbus.framer-type"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,40,"gateway.hints.modbus.unit-id"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(26,42,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched?27:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(33,44,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched?34:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(40,46,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched?41:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(44,48,"gateway.hints.modbus.poll-period"))),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(49,50,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType===n.ModbusProtocolType.Serial?50:-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(55,52,"gateway.send-data-to-platform")," "),t.ɵɵadvance(10),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(65,54,"gateway.hints.modbus.byte-order"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(73,56,"gateway.hints.modbus.word-order"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵconditional(n.protocolType!==n.ModbusProtocolType.Serial?79:-1),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup.get("identity")),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(86,58,"gateway.set"))),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(92,60,"gateway.set"))),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(98,62,"gateway.set"))),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(104,64,"gateway.set"))),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(110,66,"gateway.set"))))},dependencies:t.ɵɵgetComponentDepsFactory(rJ,[C,$Z,XZ,lK,Yn]),encapsulation:2,changeDetection:o.OnPush})}}e("ModbusSlaveConfigComponent",rJ);const oJ=["searchInput"],sJ=()=>["deviceName","info","unitId","type","actions"],lJ=()=>({minWidth:"96px",textAlign:"center"});function pJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"div",27)(2,"span",28),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",29),t.ɵɵelementStart(6,"button",12),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageSlave(n))}),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",12),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())}),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.servers-slaves")),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,7,"action.add"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,9,"action.search"))))}function cJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.device-name")))}function dJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.deviceName)}}function uJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.info")," "))}function mJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.host??e.port)}}function hJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.unit-id")," "))}function gJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.unitId)}}function fJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",30)(1,"div"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.type")))}function yJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.ModbusProtocolLabelsMap.get(e.type)," ")}}function vJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function xJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageSlave(n,i))}),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",12),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteSlave(n,i))}),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"action.edit"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"action.delete"))))}function bJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,xJ,8,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",33),t.ɵɵelementContainer(4,34),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",35)(6,"button",36),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(7,"mat-icon",37),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",38,2),t.ɵɵelementContainer(11,34),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,lJ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function wJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function SJ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class CJ{constructor(e,t,n,i,a){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=i,this.cdr=a,this.isLegacy=!1,this.textSearchMode=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.ModbusProtocolLabelsMap=ya,this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new _e,this.masterFormGroup=this.fb.group({slaves:this.fb.array([])}),this.dataSource=new _J}get slaves(){return this.masterFormGroup.get("slaves")}ngOnInit(){this.masterFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.updateTableData(e.slaves,this.textSearch.value.trim()),this.onChange(e),this.onTouched()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Re(150),Oe((e,t)=>(e??"")===t.trim()),Ne(this.destroy$)).subscribe(e=>this.updateTableData(this.slaves.value,e.trim()))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){this.slaves.clear(),this.pushDataAsFormArrays(e.slaves)}enterFilterMode(){this.textSearchMode=!0,this.cdr.detectChanges();const e=this.searchInputField.nativeElement;e.focus(),e.setSelectionRange(0,0)}exitFilterMode(){this.updateTableData(this.slaves.value),this.textSearchMode=!1,this.textSearch.reset()}manageSlave(e,t){e&&e.stopPropagation();const n=ne(t),i=n?this.getSlaveIndex(t):-1,a=n?this.slaves.at(i).value:{};this.getSlaveDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ge(1),Ne(this.destroy$)).subscribe(e=>{e&&(n?this.slaves.at(i).patchValue(e):this.slaves.push(this.fb.control(e)),this.masterFormGroup.markAsDirty())})}getSlaveIndex(e){return this.slaves.controls.findIndex(t=>t.value===e)}getSlaveDialog(e,t){return this.isLegacy?this.dialog.open(LQ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,hideNewFields:!0,buttonTitle:t}}):this.dialog.open(yQ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,hideNewFields:!1}})}deleteSlave(e,t){e&&e.stopPropagation();const n=this.getSlaveIndex(t);this.dialogService.confirm(this.translate.instant("gateway.delete-slave-title",{name:t.deviceName}),this.translate.instant("gateway.delete-slave-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ge(1),Ne(this.destroy$)).subscribe(e=>{e&&(this.slaves.removeAt(n),this.masterFormGroup.markAsDirty())})}updateTableData(e,t){t&&(e=e.filter(e=>Object.values(e).some(e=>e.toString().toLowerCase().includes(t.toLowerCase())))),this.dataSource.loadData(e)}pushDataAsFormArrays(e){e?.length&&e.forEach(e=>this.slaves.push(this.fb.control(e)))}static{this.ɵfac=function(e){return new(e||CJ)(t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(Z.DialogService),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:CJ,selectors:[["tb-modbus-master-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(oJ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{isLegacy:"isLegacy"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>CJ),multi:!0}])],decls:55,vars:44,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-master-table","tb-absolute-fill"],[1,"tb-form-panel","no-border","no-padding","padding-top","hint-container"],["tbTruncateWithTooltip","",1,"tb-form-hint","tb-primary-fill","tb-flex"],[1,"tb-master-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","table-value-column",4,"matHeaderCellDef"],["class","table-value-column",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-master-table-title"],[1,"flex-1"],[1,"table-value-column"],["tbTruncateWithTooltip",""],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"div",5),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"div",6)(6,"mat-toolbar",7),t.ɵɵconditionalCreate(7,pJ,14,11,"div",8),t.ɵɵpipe(8,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-toolbar",7)(10,"div",8)(11,"button",9),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"mat-icon"),t.ɵɵtext(14,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",10)(16,"mat-label"),t.ɵɵtext(17," "),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",11,0),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",12),t.ɵɵpipe(22,"translate"),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())}),t.ɵɵelementStart(23,"mat-icon"),t.ɵɵtext(24,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(25,"div",13)(26,"table",14),t.ɵɵelementContainerStart(27,15),t.ɵɵtemplate(28,cJ,4,3,"mat-header-cell",16)(29,dJ,3,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(30,15),t.ɵɵtemplate(31,uJ,3,3,"mat-header-cell",16)(32,mJ,3,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(33,15),t.ɵɵtemplate(34,hJ,3,3,"mat-header-cell",16)(35,gJ,3,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(36,15),t.ɵɵtemplate(37,fJ,4,3,"mat-header-cell",16)(38,yJ,2,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(39,18),t.ɵɵtemplate(40,vJ,1,0,"mat-header-cell",19)(41,bJ,12,6,"mat-cell",20),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(42,wJ,1,0,"mat-header-row",21)(43,SJ,1,0,"mat-row",22),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"section",23),t.ɵɵpipe(45,"async"),t.ɵɵelementStart(46,"button",24),t.ɵɵlistener("click",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageSlave(i))}),t.ɵɵelementStart(47,"mat-icon",25),t.ɵɵtext(48,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"span"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(52,"span",26),t.ɵɵpipe(53,"async"),t.ɵɵtext(54," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,26,"gateway.hints.modbus-master")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(8,28,n.dataSource.isEmpty())?7:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,30,"action.search"))),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(20,32,"common.enter-search")))("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,34,"action.close"))),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","deviceName"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","info"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","unitId"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","type"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(42,sJ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(43,sJ)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(45,36,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(51,38,"gateway.add-slave")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(53,40,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(CJ,[ce,C,Yn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%]{width:100%;height:calc(100% - 60px);background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .tb-master-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-master-table[_ngcontent-%COMP%] .tb-master-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:15%}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width:599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-master-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{z-index:1000}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:o.OnPush})}}e("ModbusMasterTableComponent",CJ),Ye([ct()],CJ.prototype,"isLegacy",void 0);class _J extends j{constructor(){super()}}e("SlavesDatasource",_J);class TJ extends Wa{constructor(){super(),this.enableSlaveControl=new we(!1),this.enableSlaveControl.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.updateSlaveEnabling(e),this.basicFormGroup.get("slave").updateValueAndValidity({emitEvent:!!this.onChange})})}writeValue(e){super.writeValue(e),this.onEnableSlaveControl(e)}validate(){const{master:e,slave:t}=this.basicFormGroup.value,n=!e?.slaves?.length&&(Y(t,{})||!t);return!this.basicFormGroup.valid||n?{basicFormGroup:{valid:!1}}:null}initBasicFormGroup(){return this.fb.group({master:[],slave:[]})}updateSlaveEnabling(e){e?this.basicFormGroup.get("slave").enable({emitEvent:!1}):this.basicFormGroup.get("slave").disable({emitEvent:!1})}onEnableSlaveControl(e){this.enableSlaveControl.setValue(!!e.slave&&!Y(e.slave,{}))}static{this.ɵfac=function(e){return new(e||TJ)}}static{this.ɵdir=t.ɵɵdefineDirective({type:TJ,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusBasicConfigDirective",TJ);class EJ extends TJ{constructor(){super(...arguments),this.isLegacy=!1}mapConfigToFormValue({master:e,slave:t}){return{master:e?.slaves?e:{slaves:[]},slave:t??{}}}getMappedValue(e){return{master:e.master,slave:e.slave}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(EJ)))(n||EJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:EJ,selectors:[["tb-modbus-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>EJ),multi:!0},{provide:xe,useExisting:a(()=>EJ),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:19,vars:22,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","master",3,"isLegacy"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-form-hint","tb-primary-fill","tb-flex","center"],[1,"tb-form-row"],[1,"mat-slide",3,"formControl"],["formControlName","slave"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-modbus-master-table",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4)(10,"div",5),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",6)(14,"mat-slide-toggle",7)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(18,"tb-modbus-slave-config",8),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,12,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,14,"gateway.master-connections"))),t.ɵɵadvance(2),t.ɵɵproperty("isLegacy",n.isLegacy),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,16,"gateway.server-config"))),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,18,"gateway.hints.modbus-server")),t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.enableSlaveControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,20,"gateway.enable")," "))},dependencies:t.ɵɵgetComponentDepsFactory(EJ,[ce,C,rJ,CJ,Xn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:o.OnPush})}}e("ModbusBasicConfigComponent",EJ);class MJ extends TJ{constructor(){super(...arguments),this.isLegacy=!0}mapConfigToFormValue(e){return{master:e.master?.slaves?e.master:{slaves:[]},slave:e.slave?Ja.mapSlaveToUpgradedVersion(e.slave):{}}}getMappedValue(e){return{master:e.master,slave:e.slave?Ja.mapSlaveToDowngradedVersion(e.slave):{}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(MJ)))(n||MJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:MJ,selectors:[["tb-modbus-legacy-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>MJ),multi:!0},{provide:xe,useExisting:a(()=>MJ),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:19,vars:22,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","master",3,"isLegacy"],[1,"tb-form-panel","no-border","no-padding","padding-top"],[1,"tb-form-hint","tb-primary-fill","tb-flex","center"],[1,"tb-form-row"],[1,"mat-slide",3,"formControl"],["formControlName","slave"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-modbus-master-table",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4)(10,"div",5),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",6)(14,"mat-slide-toggle",7)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(18,"tb-modbus-slave-config",8),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,12,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,14,"gateway.master-connections"))),t.ɵɵadvance(2),t.ɵɵproperty("isLegacy",n.isLegacy),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,16,"gateway.server-config"))),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,18,"gateway.hints.modbus-server")),t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.enableSlaveControl),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,20,"gateway.enable")," "))},dependencies:t.ɵɵgetComponentDepsFactory(MJ,[ce,C,rJ,CJ,Xn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:o.OnPush})}}e("ModbusLegacyBasicConfigComponent",MJ);const IJ=()=>({maxWidth:"970px"});function kJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," ")}}function PJ(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate1(" ",e.get("methodRPC").value," ")}}function DJ(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate1(" ",e.get("attributeOnThingsBoard").value," ")}}function AJ(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵtextInterpolate2(" ",e.get("requestExpression").value+" - ","",e.get("attributeNameExpression").value," ")}}function OJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵconditionalCreate(1,PJ,1,1)(2,DJ,1,1)(3,AJ,1,2),t.ɵɵelementEnd()),2&e){let e;const n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵconditional((e=n.keysType)===n.SocketValueKey.RPC_METHODS?1:e===n.SocketValueKey.ATTRIBUTES_UPDATES?2:e===n.SocketValueKey.ATTRIBUTES_REQUESTS?3:-1)}}function RJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function BJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function FJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function NJ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",33),2&e){const e=t.ɵɵnextContext(5);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function LJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",17)(2,"div",18),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",19)(5,"div",20),t.ɵɵpipe(6,"translate"),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"div",21)(11,"mat-form-field",22),t.ɵɵelement(12,"input",23),t.ɵɵpipe(13,"translate"),t.ɵɵconditionalCreate(14,RJ,3,3,"mat-icon",24),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",19)(19,"div",25)(20,"span",26),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"div",27),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"label",28),t.ɵɵtext(25,"from"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",29),t.ɵɵelement(27,"input",30),t.ɵɵpipe(28,"translate"),t.ɵɵconditionalCreate(29,BJ,3,3,"mat-icon",24),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"label",31),t.ɵɵtext(31,"to"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",29),t.ɵɵelement(33,"input",32),t.ɵɵpipe(34,"translate"),t.ɵɵconditionalCreate(35,FJ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(36,NJ,1,2,"tb-report-strategy",33),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(n.keysType===n.SocketValueKey.ATTRIBUTES?t.ɵɵpipeBind1(6,16,"gateway.hints.socket.key-attribute"):t.ɵɵpipeBind1(7,18,"gateway.hints.socket.key-telemetry"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,20,"gateway.key")," "),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(13,22,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?14:-1),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,24,"gateway.byte")),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/byte_fn")("tb-help-popup-style",t.ɵɵpureFunction0(30,IJ)),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,26,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("byteFrom").hasError("required")&&e.get("byteFrom").touched?29:-1),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(34,28,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("byteTo").hasError("required")&&e.get("byteTo").touched?35:-1),t.ɵɵadvance(),t.ɵɵconditional(!n.withReportStrategy||n.keysType!==n.SocketValueKey.ATTRIBUTES&&n.keysType!==n.SocketValueKey.TIMESERIES?-1:36)}}function VJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function qJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function GJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",1)(1,"div",19)(2,"div",34),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",21)(6,"mat-form-field",22),t.ɵɵelement(7,"input",35),t.ɵɵpipe(8,"translate"),t.ɵɵconditionalCreate(9,VJ,3,3,"mat-icon",24),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",19)(11,"div",36),t.ɵɵpipe(12,"translate"),t.ɵɵtext(13," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",21)(15,"mat-form-field",22)(16,"mat-select",37),t.ɵɵrepeaterCreate(17,qJ,2,2,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",39)(20,"mat-slide-toggle",40),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(21,"mat-label",41),t.ɵɵpipe(22,"translate"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,9,"gateway.method-name")," "),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,11,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("methodRPC").hasError("required")&&e.get("methodRPC").touched?9:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,13,"gateway.hints.encoding"))),t.ɵɵadvance(6),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(4),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(22,15,"gateway.hints.socket.with-response"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(24,17,"gateway.rpc.withResponse")," ")}}function zJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e)," ")}}function UJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e)," ")}}function jJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-expression-required"))}function HJ(e,n){1&e&&t.ɵɵelement(0,"div",27),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/request-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,IJ))}function WJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e)," ")}}function $J(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-name-expression-required"))}function KJ(e,n){1&e&&t.ɵɵelement(0,"div",27),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/attribute-name-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,IJ))}function YJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",19)(2,"div",36),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",21)(6,"mat-form-field",22)(7,"mat-select",42),t.ɵɵrepeaterCreate(8,zJ,3,4,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",19)(11,"div",34),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",43)(15,"mat-form-field",22)(16,"mat-select",44),t.ɵɵrepeaterCreate(17,UJ,3,4,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"mat-form-field",22),t.ɵɵelement(20,"input",45),t.ɵɵpipe(21,"translate"),t.ɵɵconditionalCreate(22,jJ,3,3,"mat-icon",24),t.ɵɵconditionalCreate(23,HJ,1,3,"div",27),t.ɵɵelementEnd()()(),t.ɵɵelementStart(24,"div",19)(25,"div",34),t.ɵɵtext(26),t.ɵɵpipe(27,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"div",43)(29,"mat-form-field",22)(30,"mat-select",46),t.ɵɵrepeaterCreate(31,WJ,3,4,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",22),t.ɵɵelement(34,"input",47),t.ɵɵpipe(35,"translate"),t.ɵɵconditionalCreate(36,$J,3,3,"mat-icon",24),t.ɵɵconditionalCreate(37,KJ,1,3,"div",27),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,12,"gateway.hints.socket.attribute-requests-type"))),t.ɵɵadvance(6),t.ɵɵrepeater(n.requestsType),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,14,"gateway.request-expression")," "),t.ɵɵadvance(5),t.ɵɵrepeater(n.expressionType),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(21,16,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("requestExpression").hasError("required")&&e.get("requestExpression").touched?22:-1),t.ɵɵadvance(),t.ɵɵconditional(e.get("requestExpressionSource").value===n.ExpressionType.Expression?23:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,18,"gateway.attribute-name-expression")," "),t.ɵɵadvance(5),t.ɵɵrepeater(n.expressionType),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(35,20,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("attributeNameExpression").hasError("required")&&e.get("attributeNameExpression").touched?36:-1),t.ɵɵadvance(),t.ɵɵconditional(e.get("attributeNameExpressionSource").value===n.ExpressionType.Expression?37:-1)}}function XJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function ZJ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",24),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.socket.attribute-on-platform-required"))}function QJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",1)(1,"div",19)(2,"div",36),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",21)(6,"mat-form-field",22)(7,"mat-select",37),t.ɵɵrepeaterCreate(8,XJ,2,2,"mat-option",38,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",19)(11,"div",34),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",21)(15,"mat-form-field",22),t.ɵɵelement(16,"input",48),t.ɵɵpipe(17,"translate"),t.ɵɵconditionalCreate(18,ZJ,3,3,"mat-icon",24),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,6,"gateway.hints.encoding"))),t.ɵɵadvance(6),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,8,"gateway.attribute-on-platform")," "),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(17,10,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("attributeOnThingsBoard").hasError("required")&&e.get("attributeOnThingsBoard").touched?18:-1)}}function JJ(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,LJ,37,31,"div",1),t.ɵɵconditionalCreate(1,GJ,25,19,"div",1),t.ɵɵconditionalCreate(2,YJ,38,22,"div",1),t.ɵɵconditionalCreate(3,QJ,19,12,"div",1)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(e.keysType===e.SocketValueKey.TIMESERIES||e.keysType===e.SocketValueKey.ATTRIBUTES?0:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.SocketValueKey.RPC_METHODS?1:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.SocketValueKey.ATTRIBUTES_REQUESTS?2:-1),t.ɵɵadvance(),t.ɵɵconditional(e.keysType===e.SocketValueKey.ATTRIBUTES_UPDATES?3:-1)}}function e1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header",13)(5,"mat-panel-title"),t.ɵɵconditionalCreate(6,kJ,2,1,"div",14)(7,OJ,4,1,"div",14),t.ɵɵelementEnd()(),t.ɵɵtemplate(8,JJ,4,4,"ng-template",15),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",16),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))}),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(3),t.ɵɵconditional(r.keysType===r.SocketValueKey.TIMESERIES||r.keysType===r.SocketValueKey.ATTRIBUTES?6:7),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,r.deleteKeyTitle))}}function t1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,e1,13,6,"div",9,t.ɵɵcomponentInstance().trackByKey,!0),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function n1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",49),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class i1 extends U{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=new p,this.SocketValueKey=yi,this.socketEncoding=Object.values(xt),this.requestsType=Object.values(xi),this.expressionType=Object.values(bi),this.ExpressionType=bi,this.ReportStrategyDefaultValue=dn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===yi.RPC_METHODS?this.fb.group({methodRPC:["",[ve.required]],encoding:[xt.UTF16,[ve.required]],withResponse:[!0]}):this.keysType===yi.ATTRIBUTES_UPDATES?this.fb.group({encoding:[xt.UTF16,[ve.required]],attributeOnThingsBoard:["",[ve.required]]}):this.keysType===yi.ATTRIBUTES_REQUESTS?this.fb.group({type:[xi.Shared],requestExpressionSource:[bi.Constant],attributeNameExpressionSource:[bi.Constant],requestExpression:["",[ve.required]],attributeNameExpression:["",[ve.required]]}):this.fb.group({key:["",[ve.required,ve.pattern(hn)]],byteFrom:[0,[ve.required]],byteTo:[0,[ve.required]],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]}),this.keysListFormArray.push(e)}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){let e=this.keysListFormArray.value.map(({reportStrategy:e,...t})=>({...t,...e&&{reportStrategy:e}}));this.keysDataApplied.emit(e)}prepareKeysFormArray(e){const t=[];return e?.forEach(e=>{let n;if(this.keysType===yi.RPC_METHODS){const t=e;n=this.fb.group({methodRPC:[t.methodRPC,[ve.required]],encoding:[t.encoding,[ve.required]],withResponse:[t.withResponse]})}else if(this.keysType===yi.ATTRIBUTES_REQUESTS){const t=e;n=this.fb.group({type:[t.type??xi.Shared],requestExpressionSource:[t.requestExpressionSource??bi.Constant],attributeNameExpressionSource:[t.attributeNameExpressionSource??bi.Constant],requestExpression:[t.requestExpression,[ve.required]],attributeNameExpression:[t.attributeNameExpression,[ve.required]]})}else if(this.keysType===yi.ATTRIBUTES_UPDATES)n=this.fb.group({encoding:[e.encoding??xt.UTF16],attributeOnThingsBoard:[e.attributeOnThingsBoard,[ve.required]]});else{const{key:t,byteFrom:i,byteTo:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[ve.required,ve.pattern(hn)]],byteFrom:[i??0,[ve.required]],byteTo:[a??0,[ve.required]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)}),this.fb.array(t)}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===yi.ATTRIBUTES||this.keysType===yi.TIMESERIES))}static{this.ɵfac=function(e){return new(e||i1)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(lt.TbPopoverComponent),t.ɵɵdirectiveInject(et.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:i1,selectors:[["tb-device-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",withReportStrategy:"withReportStrategy"},outputs:{keysDataApplied:"keysDataApplied"},features:[t.ɵɵInheritDefinitionFeature],decls:18,vars:15,consts:[[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"fixed-title-width","tb-flex","align-center"],[1,"tb-required"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["for","byteFrom",1,"tb-small-label"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","flex-1"],["matInput","","required","","formControlName","byteFrom","type","number","id","byteFrom",3,"placeholder"],["for","byteTo",1,"tb-small-label"],["matInput","","required","","formControlName","byteTo","type","number","id","byteTo",3,"placeholder"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","methodRPC",3,"placeholder"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","encoding"],[3,"value"],[1,"tb-form-row"],["formControlName","withResponse",1,"mat-slide",3,"click"],[3,"tb-hint-tooltip-icon"],["formControlName","type"],[1,"tb-flex"],["formControlName","requestExpressionSource"],["matInput","","name","value","formControlName","requestExpression",3,"placeholder"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","attributeOnThingsBoard",3,"placeholder"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(5,t1,3,0,"div",3)(6,n1,3,1,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",function(){return n.addKey()}),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",function(){return n.applyKeysData()}),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(i1,[ce,C,ri]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:500px;overflow:auto}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-small-label[_ngcontent-%COMP%]{font-size:16px;padding-right:0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:o.OnPush})}}e("DeviceDataKeysPanelComponent",i1),Ye([T()],i1.prototype,"withReportStrategy",void 0);const a1=()=>({maxWidth:"970px"});function r1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-filter-required"))}function o1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function s1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",19),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function l1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",26),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function p1(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",27),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function c1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function d1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function u1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.type," ")}}function m1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.encoding," ")}}function h1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.methodRPC," ")}}class g1 extends D{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.destroyRef=l,this.cdr=p,this.deviceFormGroup=this.fb.group({address:["",[ve.required,ve.pattern(hn)]],deviceName:["",[ve.required,ve.pattern(hn)]],deviceType:["",[ve.required,ve.pattern(hn)]],encoding:[xt.UTF8],telemetry:[[]],attributes:[[]],attributeRequests:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.SocketValueKey=yi,this.socketDeviceHelpLink=v+"/docs/iot-gateway/config/socket/#device-subsection",this.socketEncoding=Object.values(xt),this.ReportStrategyDefaultValue=dn,this.deviceFormGroup.patchValue(this.data.value,{emitEvent:!1})}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.deviceFormGroup.valid){const e=this.deviceFormGroup.value;Q(e),this.dialogRef.close(e)}}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))return void this.popoverService.hidePopover(i);const a=this.deviceFormGroup.get(n),r={keys:a.value,keysType:n,panelTitle:vi.get(n),addKeyTitle:wi.get(n),deleteKeyTitle:Si.get(n),noKeysText:Ci.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,i1,"leftBottom",!1,null,r,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(de(this.destroyRef)).subscribe(e=>{this.popoverComponent.hide(),a.patchValue(e),a.markAsDirty(),this.cdr.markForCheck()}),this.popoverComponent.tbHideStart.pipe(de(this.destroyRef)).subscribe(()=>{this.keysPopupClosed=!0})}static{this.ɵfac=function(e){return new(e||g1)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(pt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:g1,selectors:[["tb-device-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:125,vars:60,consts:[["socketTelemetryButton",""],["attributesButton",""],["attributeRequestsButton",""],["attributesUpdatesButton",""],["rpcMethodsButton",""],[1,"dialog-mapping",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width"],["translate","",1,"tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","encoding"],[3,"value"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],[1,"tb-form-row","space-between","tb-flex"],["translate","",1,"fixed-title-width"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",5)(1,"mat-toolbar",6)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",7)(6,"div",8),t.ɵɵelementStart(7,"button",9),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())}),t.ɵɵelementStart(8,"mat-icon",10),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",11)(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",15),t.ɵɵtext(15," gateway.address-filter "),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"div",16)(17,"mat-form-field",17),t.ɵɵelement(18,"input",18),t.ɵɵpipe(19,"translate"),t.ɵɵconditionalCreate(20,r1,3,3,"mat-icon",19),t.ɵɵelement(21,"div",20),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",13)(23,"div",21),t.ɵɵtext(24,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"div",16)(26,"mat-form-field",17),t.ɵɵelement(27,"input",22),t.ɵɵpipe(28,"translate"),t.ɵɵconditionalCreate(29,o1,3,3,"mat-icon",19),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"div",13)(31,"div",21),t.ɵɵtext(32,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"div",16)(34,"mat-form-field",17),t.ɵɵelement(35,"input",23),t.ɵɵpipe(36,"translate"),t.ɵɵconditionalCreate(37,s1,3,3,"mat-icon",19),t.ɵɵelementEnd()()(),t.ɵɵelementStart(38,"div",13)(39,"div",24),t.ɵɵpipe(40,"translate"),t.ɵɵtext(41," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",16)(43,"mat-form-field",17)(44,"mat-select",25),t.ɵɵrepeaterCreate(45,l1,2,2,"mat-option",26,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵconditionalCreate(47,p1,1,2,"tb-report-strategy",27),t.ɵɵelementStart(48,"div",28)(49,"div",29),t.ɵɵtext(50,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(51,"div",30)(52,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(53,c1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(55,"mat-chip",32),t.ɵɵelement(56,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(57,"button",34,0),t.ɵɵpipe(59,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(58);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.TIMESERIES))}),t.ɵɵelementStart(60,"tb-icon",35),t.ɵɵtext(61,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(62,"div",28)(63,"div",29),t.ɵɵtext(64,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(65,"div",30)(66,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(67,d1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(69,"mat-chip",32),t.ɵɵelement(70,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(71,"button",34,1),t.ɵɵpipe(73,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(72);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES))}),t.ɵɵelementStart(74,"tb-icon",35),t.ɵɵtext(75,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(76,"div",28)(77,"div",29),t.ɵɵtext(78,"gateway.attribute-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(79,"div",30)(80,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(81,u1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(83,"mat-chip",32),t.ɵɵelement(84,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(85,"button",34,2),t.ɵɵpipe(87,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(86);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES_REQUESTS))}),t.ɵɵelementStart(88,"tb-icon",35),t.ɵɵtext(89,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(90,"div",28)(91,"div",29),t.ɵɵtext(92,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(93,"div",30)(94,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(95,m1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(97,"mat-chip",32),t.ɵɵelement(98,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(99,"button",34,3),t.ɵɵpipe(101,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(100);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES_UPDATES))}),t.ɵɵelementStart(102,"tb-icon",35),t.ɵɵtext(103,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(104,"div",28)(105,"div",29),t.ɵɵtext(106,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(107,"div",30)(108,"mat-chip-listbox",31),t.ɵɵrepeaterCreate(109,h1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(111,"mat-chip",32),t.ɵɵelement(112,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(113,"button",34,4),t.ɵɵpipe(115,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(114);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.RPC_METHODS))}),t.ɵɵelementStart(116,"tb-icon",35),t.ɵɵtext(117,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(118,"div",36)(119,"button",37),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())}),t.ɵɵtext(120),t.ɵɵpipe(121,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"button",38),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())}),t.ɵɵtext(123),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,35,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.socketDeviceHelpLink),t.ɵɵadvance(12),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,37,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("address").hasError("required")&&n.deviceFormGroup.get("address").touched?20:-1),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/address-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(59,a1)),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,39,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("deviceName").hasError("required")&&n.deviceFormGroup.get("deviceName").touched?29:-1),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(36,41,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("deviceType").hasError("required")&&n.deviceFormGroup.get("deviceType").touched?37:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(40,43,"gateway.hints.encoding"))),t.ɵɵadvance(6),t.ɵɵrepeater(n.socketEncoding),t.ɵɵadvance(2),t.ɵɵconditional(n.data.withReportStrategy?47:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(59,45,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(73,47,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(87,49,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(101,51,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(115,53,"action.edit"))),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(121,55,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(124,57,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(g1,[C,Xn,ri]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:grid;height:100%}[_nghost-%COMP%] .tb-form-panel[_ngcontent-%COMP%]{width:77vw;max-width:800px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%]{max-width:900px;display:flex;flex-direction:column}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{min-height:64px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] tb-toggle-select[_ngcontent-%COMP%]{padding:4px 0}[_nghost-%COMP%] .mat-mdc-dialog-content[_ngcontent-%COMP%]{height:670px}[_nghost-%COMP%] .ellipsis-chips-container[_ngcontent-%COMP%]{max-width:70%}[_nghost-%COMP%] .dialog-mapping .mat-mdc-chip-listbox .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center}[_nghost-%COMP%] .tb-form-row .fixed-title-width{min-width:40px;width:35%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center}[_nghost-%COMP%] .tb-form-row .mat-mdc-form-field{width:0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}[_nghost-%COMP%] .device-config{gap:12px;padding-left:10px;padding-right:10px}[_nghost-%COMP%] .device-node-pattern-field{flex-basis:3%}'],changeDetection:o.OnPush})}}e("DeviceDialogComponent",g1);const f1=["searchInput"],y1=()=>["address","deviceName","actions"],v1=()=>({minWidth:"96px",textAlign:"center"});function x1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",25)(2,"span",26),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",27),t.ɵɵelementStart(6,"button",10),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageDevices(n))}),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",10),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())}),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.devices")),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,7,"action.add"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,9,"action.search"))))}function b1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.address-filter")," "))}function w1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.address)}}function S1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.device-name")))}function C1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.deviceName)}}function _1(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function T1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageDevices(n,i))}),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteDevice(n,i))}),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"action.edit"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"action.delete"))))}function E1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,T1,8,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",31),t.ɵɵelementContainer(4,32),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"button",34),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(7,"mat-icon",35),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",36,2),t.ɵɵelementContainer(11,32),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,v1)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function M1(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function I1(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class k1{constructor(e,t,n,i,a){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=i,this.cdr=a,this.withReportStrategy=!0,this.textSearchMode=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.onChange=()=>{},this.destroy$=new _e,this.devicesFormGroup=this.fb.array([]),this.dataSource=new P1}ngOnInit(){this.devicesFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.updateTableData(e,this.textSearch.value.trim()),this.onChange(e)})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(Re(150),Oe((e,t)=>(e??"")===t.trim()),Ne(this.destroy$)).subscribe(e=>this.updateTableData(this.devicesFormGroup.value,e.trim()))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.devicesFormGroup.clear(),this.pushDataAsFormArrays(e)}enterFilterMode(){this.textSearchMode=!0,this.cdr.detectChanges();const e=this.searchInputField.nativeElement;e.focus(),e.setSelectionRange(0,0)}exitFilterMode(){this.updateTableData(this.devicesFormGroup.value),this.textSearchMode=!1,this.textSearch.reset()}manageDevices(e,t){e&&e.stopPropagation();const n=ne(t),i=n?this.getDeviceIndex(t):-1,a=n?this.devicesFormGroup.at(i).value:{};this.getDeviceDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ge(1),Ne(this.destroy$)).subscribe(e=>{e&&(n?this.devicesFormGroup.at(i).patchValue(e):this.devicesFormGroup.push(this.fb.control(e)),this.devicesFormGroup.markAsDirty())})}getDeviceIndex(e){return this.devicesFormGroup.controls.findIndex(t=>t.value===e)}validate(){return this.devicesFormGroup.controls.length?null:{devicesFormGroup:{valid:!1}}}getDeviceDialog(e,t){return this.dialog.open(g1,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}deleteDevice(e,t){e&&e.stopPropagation();const n=this.getDeviceIndex(t);this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:t.deviceName}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ge(1),Ne(this.destroy$)).subscribe(e=>{e&&(this.devicesFormGroup.removeAt(n),this.devicesFormGroup.markAsDirty())})}updateTableData(e,t){t&&(e=e.filter(e=>Object.values(e).some(e=>e.toString().toLowerCase().includes(t.toLowerCase())))),this.dataSource.loadData(e)}pushDataAsFormArrays(e){e?.length&&e.forEach(e=>this.devicesFormGroup.push(this.fb.control(e)))}static{this.ɵfac=function(e){return new(e||k1)(t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(Z.DialogService),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:k1,selectors:[["tb-devices-config-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(f1,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>k1),multi:!0},{provide:xe,useExisting:a(()=>k1),multi:!0}])],decls:45,vars:39,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-device-table","tb-absolute-fill"],[1,"tb-device-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","table-value-column",4,"matHeaderCellDef"],["class","table-value-column",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-device-table-title"],[1,"flex-1"],[1,"table-value-column"],["tbTruncateWithTooltip",""],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵconditionalCreate(3,x1,14,11,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",6)(7,"button",7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",9,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵpipe(18,"translate"),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())}),t.ɵɵelementStart(19,"mat-icon"),t.ɵɵtext(20,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(21,"div",11)(22,"table",12),t.ɵɵelementContainerStart(23,13),t.ɵɵtemplate(24,b1,3,3,"mat-header-cell",14)(25,w1,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,13),t.ɵɵtemplate(27,S1,4,3,"mat-header-cell",14)(28,C1,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,16),t.ɵɵtemplate(30,_1,1,0,"mat-header-cell",17)(31,E1,12,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(32,M1,1,0,"mat-header-row",19)(33,I1,1,0,"mat-row",20),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"section",21),t.ɵɵpipe(35,"async"),t.ɵɵelementStart(36,"button",22),t.ɵɵlistener("click",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))}),t.ɵɵelementStart(37,"mat-icon",23),t.ɵɵtext(38,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"span"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"span",24),t.ɵɵpipe(43,"async"),t.ɵɵtext(44," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,23,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,25,"action.search"))),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,27,"common.enter-search")))("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,29,"action.close"))),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","address"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","deviceName"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(37,y1))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(38,y1)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(35,31,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,33,"gateway.add-device")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(43,35,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(k1,[ce,C,Yn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%]{width:100%;height:100%;background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:35%}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width:599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:o.OnPush})}}e("DevicesConfigTableComponent",k1),Ye([T()],k1.prototype,"withReportStrategy",void 0);let P1=class extends j{constructor(){super()}};function D1(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",5),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function A1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function O1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.socketConfigFormGroup.get("port")))}}function R1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",10),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.socketConfigFormGroup.get("bufferSize").hasError("min")?"gateway.buffer-size-range":"gateway.buffer-size-required"))}}e("DevicesDatasource",P1);class B1{constructor(e){this.fb=e,this.portLimits=Bi,this.socketTypes=Object.values(fi),this.onChange=e=>{},this.destroy$=new _e,this.socketConfigFormGroup=this.fb.group({address:["",[ve.required,ve.pattern(hn)]],type:[fi.TCP],port:[5e4,[ve.required,ve.min(Bi.MIN),ve.max(Bi.MAX)]],bufferSize:[1024,[ve.required,ve.min(1),ve.pattern(hn)]]}),this.socketConfigFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e)})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){const{address:t="",type:n=fi.TCP,port:i=5e4,bufferSize:a=1024}=e??{};this.socketConfigFormGroup.reset({address:t,type:n,port:i,bufferSize:a})}validate(){return this.socketConfigFormGroup.valid?null:{socketConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||B1)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:B1,selectors:[["tb-socket-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>B1),multi:!0},{provide:xe,useExisting:a(()=>B1),multi:!0}])],decls:35,vars:30,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],[1,"fixed-title-width"],["tbTruncateWithTooltip",""],["formControlName","type","appearance","fill"],[3,"value"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","name","value","min","1","formControlName","bufferSize",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"tb-toggle-select",4),t.ɵɵrepeaterCreate(7,D1,2,2,"tb-toggle-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",1)(10,"div",6),t.ɵɵtext(11,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"div",7)(13,"mat-form-field",8),t.ɵɵelement(14,"input",9),t.ɵɵpipe(15,"translate"),t.ɵɵconditionalCreate(16,A1,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(17,"div",1)(18,"div",6),t.ɵɵtext(19,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"div",7)(21,"mat-form-field",8),t.ɵɵelement(22,"input",11),t.ɵɵpipe(23,"translate"),t.ɵɵconditionalCreate(24,O1,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(25,"div",1)(26,"div",12),t.ɵɵpipe(27,"translate"),t.ɵɵtext(28),t.ɵɵpipe(29,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"div",7)(31,"mat-form-field",8),t.ɵɵelement(32,"input",13),t.ɵɵpipe(33,"translate"),t.ɵɵconditionalCreate(34,R1,3,3,"mat-icon",10),t.ɵɵelementEnd()()()()),2&e&&(t.ɵɵproperty("formGroup",n.socketConfigFormGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,18,"gateway.connection-type")),t.ɵɵadvance(3),t.ɵɵrepeater(n.socketTypes),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,20,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.socketConfigFormGroup.get("address").hasError("required")&&n.socketConfigFormGroup.get("address").touched?16:-1),t.ɵɵadvance(6),t.ɵɵproperty("min",t.ɵɵinterpolate(n.portLimits.MIN))("max",t.ɵɵinterpolate(n.portLimits.MAX))("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(23,22,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((n.socketConfigFormGroup.get("port").hasError("required")||n.socketConfigFormGroup.get("port").hasError("min")||n.socketConfigFormGroup.get("port").hasError("max"))&&n.socketConfigFormGroup.get("port").touched?24:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(27,24,"gateway.hints.buffer-size"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(29,26,"gateway.buffer-size")," "),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(33,28,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.socketConfigFormGroup.get("bufferSize").hasError("required")||n.socketConfigFormGroup.get("bufferSize").hasError("min")&&n.socketConfigFormGroup.get("bufferSize").touched?34:-1))},dependencies:t.ɵɵgetComponentDepsFactory(B1,[C,lK,Yn]),encapsulation:2,changeDetection:o.OnPush})}}e("SocketConfigComponent",B1);class F1 extends Wa{constructor(){super(...arguments),this.isLegacy=!1}getMappedValue(e){return e}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:e.socket??{},devices:e.devices??[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(F1)))(n||F1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:F1,selectors:[["tb-socket-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>F1),multi:!0},{provide:xe,useExisting:a(()=>F1),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:10,vars:15,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","socket"],["formControlName","devices",3,"withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-socket-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-devices-config-table",4),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,9,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,11,"gateway.socket"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,13,"gateway.devices"),"*")),t.ɵɵadvance(2),t.ɵɵproperty("withReportStrategy",!n.isLegacy))},dependencies:t.ɵɵgetComponentDepsFactory(F1,[ce,C,B1,k1]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}e("SocketBasicConfigComponent",F1);class N1 extends Wa{constructor(){super(...arguments),this.isLegacy=!0}getMappedValue(e){return tr.mapSocketToDowngradedVersion(e)}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:tr.mapSocketToUpgradedVersion(e),devices:e?.devices?tr.mapDevicesToUpgradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(N1)))(n||N1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:N1,selectors:[["tb-socket-legacy-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>N1),multi:!0},{provide:xe,useExisting:a(()=>N1),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:10,vars:15,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","socket"],["formControlName","devices",3,"withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-socket-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-devices-config-table",4),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,9,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,11,"gateway.socket"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,13,"gateway.devices"),"*")),t.ɵɵadvance(2),t.ɵɵproperty("withReportStrategy",!n.isLegacy))},dependencies:t.ɵɵgetComponentDepsFactory(N1,[ce,C,B1,k1]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}function L1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.name-required"))}function V1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function q1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.applicationConfigFormGroup.get("port")))}}function G1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.object-id-required"))}function z1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",6),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.vendor-id-required"))}function U1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SegmentationTypeTranslationsMap.get(e))," ")}}e("SocketLegacyBasicConfigComponent",N1);class j1 extends Ha{constructor(){super(...arguments),this.segmentationTypes=Object.values(Ea),this.SegmentationTypeTranslationsMap=Ma,this.portLimits=Bi}get applicationConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({objectName:["",[ve.required,ve.pattern(hn)]],host:["",[ve.required,ve.pattern(hn)]],port:[null,[ve.required,ve.min(Bi.MIN),ve.max(Bi.MAX)]],mask:[""],objectIdentifier:[null,[ve.required]],vendorIdentifier:[null,[ve.required]],maxApduLengthAccepted:[],segmentationSupported:[Ea.BOTH],networkNumber:[],deviceDiscoveryTimeoutInSec:[]})}mapOnChangeValue(e){return Q(e),e}onWriteValue(e){const{maxApduLengthAccepted:t=1476,segmentationSupported:n=Ea.BOTH,networkNumber:i=3,deviceDiscoveryTimeoutInSec:a=5,...r}=e;this.formGroup.reset({...r,maxApduLengthAccepted:t,segmentationSupported:n,networkNumber:i,deviceDiscoveryTimeoutInSec:a},{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(j1)))(n||j1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:j1,selectors:[["tb-bacnet-application-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>j1),multi:!0},{provide:xe,useExisting:a(()=>j1),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:83,vars:70,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","autocomplete","off","name","value","formControlName","objectName",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["matInput","","name","value","formControlName","mask",3,"placeholder"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","objectIdentifier",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","vendorIdentifier",3,"placeholder"],[1,"tb-form-panel","stroked"],[1,"tb-settings"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","padding-top"],["matInput","","type","number","min","0","name","value","formControlName","maxApduLengthAccepted",3,"placeholder"],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","segmentationSupported"],[3,"value"],["matInput","","type","number","min","0","name","value","formControlName","networkNumber",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","deviceDiscoveryTimeoutInSec",3,"placeholder"],["translate","","matSuffix","",1,"block","pr-2"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.bacnet.object-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3)(5,"mat-form-field",4),t.ɵɵelement(6,"input",5),t.ɵɵpipe(7,"translate"),t.ɵɵconditionalCreate(8,L1,3,3,"mat-icon",6),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",1)(10,"div",2),t.ɵɵtext(11,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",4),t.ɵɵelement(13,"input",7),t.ɵɵpipe(14,"translate"),t.ɵɵconditionalCreate(15,V1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"div",1)(17,"div",2),t.ɵɵtext(18,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",4),t.ɵɵelement(20,"input",8),t.ɵɵpipe(21,"translate"),t.ɵɵconditionalCreate(22,q1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"div",1)(24,"div",9),t.ɵɵtext(25,"gateway.network-mask"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",4),t.ɵɵelement(27,"input",10),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(29,"div",1)(30,"div",11),t.ɵɵpipe(31,"translate"),t.ɵɵtext(32,"gateway.object-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"mat-form-field",4),t.ɵɵelement(34,"input",12),t.ɵɵpipe(35,"translate"),t.ɵɵconditionalCreate(36,G1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"div",1)(38,"div",11),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"gateway.vendor-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(41,"mat-form-field",4),t.ɵɵelement(42,"input",13),t.ɵɵpipe(43,"translate"),t.ɵɵconditionalCreate(44,z1,3,3,"mat-icon",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"div",14)(46,"mat-expansion-panel",15)(47,"mat-expansion-panel-header")(48,"mat-panel-title")(49,"div",16),t.ɵɵtext(50,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(51,"div",17)(52,"div",1)(53,"div",11),t.ɵɵpipe(54,"translate"),t.ɵɵtext(55,"gateway.bacnet.apdu-length"),t.ɵɵelementEnd(),t.ɵɵelementStart(56,"mat-form-field",4),t.ɵɵelement(57,"input",18),t.ɵɵpipe(58,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(59,"div",1)(60,"div",19),t.ɵɵpipe(61,"translate"),t.ɵɵtext(62,"gateway.bacnet.segmentation.label"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"mat-form-field",4)(64,"mat-select",20),t.ɵɵrepeaterCreate(65,U1,3,4,"mat-option",21,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(67,"div",1)(68,"div",19),t.ɵɵpipe(69,"translate"),t.ɵɵtext(70,"gateway.bacnet.network-number"),t.ɵɵelementEnd(),t.ɵɵelementStart(71,"mat-form-field",4),t.ɵɵelement(72,"input",22),t.ɵɵpipe(73,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(74,"div",1)(75,"div",19),t.ɵɵpipe(76,"translate"),t.ɵɵtext(77,"gateway.bacnet.device-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(78,"mat-form-field",4),t.ɵɵelement(79,"input",23),t.ɵɵpipe(80,"translate"),t.ɵɵelementStart(81,"span",24),t.ɵɵtext(82,"gateway.suffix.s"),t.ɵɵelementEnd()()()()()()()),2&e&&(t.ɵɵproperty("formGroup",n.applicationConfigFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,40,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("objectName").hasError("required")&&n.applicationConfigFormGroup.get("objectName").touched?8:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,42,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("host").hasError("required")&&n.applicationConfigFormGroup.get("host").touched?15:-1),t.ɵɵadvance(5),t.ɵɵproperty("min",t.ɵɵinterpolate(n.portLimits.MIN))("max",t.ɵɵinterpolate(n.portLimits.MAX))("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(21,44,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional((n.applicationConfigFormGroup.get("port").hasError("required")||n.applicationConfigFormGroup.get("port").hasError("min")||n.applicationConfigFormGroup.get("port").hasError("max"))&&n.applicationConfigFormGroup.get("port").touched?22:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,46,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(31,48,"gateway.hints.bacnet.object-id"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(35,50,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("objectIdentifier").hasError("required")&&n.applicationConfigFormGroup.get("objectIdentifier").touched?36:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(39,52,"gateway.hints.bacnet.vendor-id"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(43,54,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.applicationConfigFormGroup.get("vendorIdentifier").hasError("required")&&n.applicationConfigFormGroup.get("vendorIdentifier").touched?44:-1),t.ɵɵadvance(9),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(54,56,"gateway.hints.bacnet.apdu-length"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(58,58,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(61,60,"gateway.hints.bacnet.segmentation"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.segmentationTypes),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(69,62,"gateway.hints.bacnet.network-number"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(73,64,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(76,66,"gateway.hints.bacnet.device-timeout"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(80,68,"gateway.set"))))},dependencies:t.ɵɵgetComponentDepsFactory(j1,[C,lK]),encapsulation:2,changeDetection:o.OnPush})}}function H1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",11),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function W1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",15)(6,"mat-form-field",6),t.ɵɵelement(7,"input",16),t.ɵɵpipe(8,"translate"),t.ɵɵconditionalCreate(9,H1,3,3,"mat-icon",11),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(e.keyType===e.BacnetDeviceKeysType.TIMESERIES?t.ɵɵpipeBind1(1,6,"gateway.hints.socket.key-telemetry"):t.ɵɵpipeBind1(2,8,"gateway.hints.socket.key-attribute"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,10,"gateway.key")," "),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,12,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.formGroup.get("key").hasError("required")&&e.formGroup.get("key").touched?9:-1)}}function $1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",11),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function K1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",15)(5,"mat-form-field",6),t.ɵɵelement(6,"input",17),t.ɵɵpipe(7,"translate"),t.ɵɵconditionalCreate(8,$1,3,3,"mat-icon",11),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,6,"gateway.hints.method"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,8,"gateway.method")," "),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,10,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.formGroup.get("method").hasError("required")&&e.formGroup.get("method").touched?8:-1)}}function Y1(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",8),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.BacnetRequestTypeTranslationsMap.get(e))," ")}}function X1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",18)(2,"div",14),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"tb-toggle-select",19),t.ɵɵrepeaterCreate(7,Y1,3,4,"tb-toggle-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,3,"gateway.hints.bacnet.request-type"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,5,"gateway.bacnet.request-type.label")),t.ɵɵadvance(3),t.ɵɵrepeater(e.requestTypes)}}function Z1(e,n){1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",4),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.request-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",6),t.ɵɵelement(5,"input",20),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,4,"gateway.hints.bacnet.request-timeout"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,6,"gateway.set"))))}function Q1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.BacnetKeyObjectTypeTranslationsMap.get(e))," ")}}function J1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",11),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.object-id-required"))}function e0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",8),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.BacnetPropertyIdTranslationsMap.get(e))," ")}}function t0(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",13),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}class n0 extends Ha{constructor(){super(...arguments),this.withReportStrategy=!0,this.propertyIds=Fa.get(Oa.analogOutput),this.objectTypes=Object.values(Oa),this.requestTypes=Object.values(La),this.ReportStrategyDefaultValue=dn,this.BacnetDeviceKeysType=Ia,this.BacnetKeyObjectTypeTranslationsMap=Ra,this.BacnetPropertyIdTranslationsMap=Na,this.BacnetRequestTypeTranslationsMap=Va}ngOnInit(){this.formGroup=this.initKeyFormGroup(),this.observeValueChanges(),this.observeObjectType()}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keyType===Ia.ATTRIBUTES||this.keyType===Ia.TIMESERIES))}initKeyFormGroup(){return this.fb.group({key:[{value:"",disabled:this.keyType===Ia.RPC_METHODS},[ve.required,ve.pattern(hn)]],method:[{value:"",disabled:this.keyType!==Ia.RPC_METHODS},[ve.required,ve.pattern(hn)]],objectType:[Oa.analogOutput],objectId:[0,[ve.required]],propertyId:[Ba.presentValue],requestTimeout:[{value:0,disabled:this.keyType!==Ia.RPC_METHODS}],requestType:[{value:La.Write,disabled:this.keyType!==Ia.RPC_METHODS}],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]})}observeObjectType(){this.formGroup.get("objectType").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.propertyIds=Fa.get(e),this.propertyIds.includes(this.formGroup.get("propertyId").value)||this.formGroup.get("propertyId").patchValue(this.propertyIds[0],{emitEvent:!1})})}initFormGroup(){return this.fb.group({})}mapOnChangeValue({reportStrategy:e,...t}){return e?{...t,reportStrategy:e}:t}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(n0)))(n||n0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:n0,selectors:[["tb-bacnet-device-data-key"]],inputs:{keyType:"keyType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",c]},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>n0),multi:!0},{provide:xe,useExisting:a(()=>n0),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:35,vars:18,consts:[[1,"tb-form-panel","no-border","no-padding",3,"formGroup"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap","raw-value-option"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","objectType"],[3,"value"],[1,"tb-form-table-row-cell","tb-flex","no-gap"],["matInput","","type","number","min","0","name","value","formControlName","objectId",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["formControlName","propertyId"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matInput","","name","value","formControlName","method",3,"placeholder"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],["formControlName","requestType","appearance","fill"],["matInput","","type","number","min","0","name","value","formControlName","requestTimeout",3,"placeholder"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3),t.ɵɵconditionalCreate(5,W1,10,14)(6,K1,9,12),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",1)(8,"div",2),t.ɵɵtext(9,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(10,X1,9,7,"div",3),t.ɵɵconditionalCreate(11,Z1,7,8,"div",3),t.ɵɵelementStart(12,"div",3)(13,"div",4),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15,"gateway.object-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",5)(17,"mat-form-field",6)(18,"mat-select",7),t.ɵɵrepeaterCreate(19,Q1,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",9)(22,"mat-form-field",6),t.ɵɵelement(23,"input",10),t.ɵɵpipe(24,"translate"),t.ɵɵconditionalCreate(25,J1,3,3,"mat-icon",11),t.ɵɵelementEnd()()(),t.ɵɵelementStart(26,"div",3)(27,"div",4),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"gateway.property-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",6)(31,"mat-select",12),t.ɵɵrepeaterCreate(32,e0,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(34,t0,1,2,"tb-report-strategy",13),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(5),t.ɵɵconditional(n.keyType!==n.BacnetDeviceKeysType.RPC_METHODS?5:6),t.ɵɵadvance(5),t.ɵɵconditional(n.keyType===n.BacnetDeviceKeysType.RPC_METHODS?10:-1),t.ɵɵadvance(),t.ɵɵconditional(n.keyType===n.BacnetDeviceKeysType.RPC_METHODS?11:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,12,"gateway.hints.bacnet.key-object-id"))),t.ɵɵadvance(6),t.ɵɵrepeater(n.objectTypes),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(24,14,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.formGroup.get("objectId").hasError("required")&&n.formGroup.get("objectId").touched?25:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,16,"gateway.hints.bacnet.property-id"))),t.ɵɵadvance(5),t.ɵɵrepeater(n.propertyIds),t.ɵɵadvance(2),t.ɵɵconditional(n.isReportStrategyDisabled()?-1:34))},dependencies:t.ɵɵgetComponentDepsFactory(n0,[C,ri]),encapsulation:2,changeDetection:o.OnPush})}}function i0(e,n){if(1&e&&t.ɵɵelement(0,"tb-bacnet-device-data-key",17),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("formControl",e)("keyType",n.keysType)("withReportStrategy",n.withReportStrategy)}}function a0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header",13)(5,"mat-panel-title")(6,"div",14),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,i0,1,3,"ng-template",15),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",16),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))}),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",(null==e.value?null:e.value.key)??(null==e.value?null:e.value.method)," "),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,r.deleteKeyTitle))}}function r0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,a0,13,6,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function o0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",18),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class s0 extends U{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=i(),this.ReportStrategyDefaultValue=dn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}addKey(){this.keysListFormArray.push(this.fb.control({}))}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){this.keysDataApplied.emit(this.keysListFormArray.value)}prepareKeysFormArray(e){const t=[];return e?.forEach(e=>{t.push(this.fb.control(e))}),this.fb.array(t)}static{this.ɵfac=function(e){return new(e||s0)(t.ɵɵdirectiveInject(fe.UntypedFormBuilder),t.ɵɵdirectiveInject(lt.TbPopoverComponent),t.ɵɵdirectiveInject(et.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:s0,selectors:[["tb-bacnet-device-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",c]},outputs:{keysDataApplied:"keysDataApplied"},features:[t.ɵɵInheritDefinitionFeature],decls:18,vars:15,consts:[[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","key-panel"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[3,"formControl","keyType","withReportStrategy"],["translate","",1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(5,r0,3,0,"div",3)(6,o0,3,1,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",function(){return n.addKey()}),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",function(){return n.applyKeysData()}),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,n.addKeyTitle)," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(s0,[C,n0]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%]{width:77vw;max-width:700px}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{max-width:11vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .key-panel[_ngcontent-%COMP%]{height:500px;overflow:auto}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-form-panel[_ngcontent-%COMP%] .mat-mdc-icon-button[_ngcontent-%COMP%]{width:56px;height:56px;padding:16px;color:#0000008a}[_nghost-%COMP%] .tb-device-keys-panel[_ngcontent-%COMP%] .tb-small-label[_ngcontent-%COMP%]{font-size:16px;padding-right:0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:o.OnPush})}}function l0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function p0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function c0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"mat-expansion-panel",35)(2,"mat-expansion-panel-header")(3,"mat-panel-title")(4,"div",36),t.ɵɵtext(5,"gateway.advanced-configuration-settings"),t.ɵɵelementEnd()()(),t.ɵɵelement(6,"tb-string-items-list",37),t.ɵɵpipe(7,"translate"),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,4,"gateway.bacnet.alt-responses-address")))("placeholder",t.ɵɵinterpolate(null!=(e=n.deviceFormGroup.get("altResponsesAddresses").value)&&e.length?"":t.ɵɵpipeBind1(8,6,"gateway.address")))}}function d0(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",21),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function u0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.hints.poll-period-required"))}function m0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function h0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function g0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function f0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.method," ")}}class y0 extends D{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.cdr=l,this.destroyRef=p,this.deviceFormGroup=this.fb.group({host:["",[ve.required,ve.pattern(hn)]],port:["",[ve.required]],networkMask:[""],deviceInfo:[],altResponsesAddresses:[{value:[],disabled:this.data.hideNewFields}],pollPeriod:[1e4,[ve.required,ve.min(0)]],timeseries:[[]],attributes:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.BacnetDeviceKeysType=Ia,this.DeviceInfoType=Ta,this.deviceHelpLink=v+"/docs/iot-gateway/config/bacnet/#device-object-settings",this.sourceTypes=Object.values(bi),this.ConnectorType=gt,this.ReportStrategyDefaultValue=dn,this.deviceFormGroup.patchValue(this.data.value,{emitEvent:!1})}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.deviceFormGroup.valid){const{altResponsesAddresses:e,reportStrategy:t,...n}=this.deviceFormGroup.value;this.dialogRef.close({altResponsesAddresses:e??[],...t?{reportStrategy:t}:{},...n})}}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))return void this.popoverService.hidePopover(i);const a=this.deviceFormGroup.get(n),r={keys:a.value,keysType:n,panelTitle:ka.get(n),addKeyTitle:Pa.get(n),deleteKeyTitle:Da.get(n),noKeysText:Aa.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,s0,"leftBottom",!1,null,r,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.subscribe(e=>{this.popoverComponent.hide(),a.patchValue(e),a.markAsDirty(),this.cdr.markForCheck()}),this.popoverComponent.tbHideStart.pipe(de(this.destroyRef)).subscribe(()=>{this.keysPopupClosed=!0})}static{this.ɵfac=function(e){return new(e||y0)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(pt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:y0,selectors:[["tb-bacnet-device-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:106,vars:56,consts:[["attributesButton",""],["socketTelemetryButton",""],["attributesUpdatesButton",""],["rpcMethodsButton",""],[1,"dialog-mapping",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","port",3,"placeholder"],["translate","",1,"fixed-title-width"],["matInput","","name","value","formControlName","networkMask",3,"placeholder"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","sourceTypes","connectorType"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],[1,"fixed-title-width","tb-required"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","0","name","value","formControlName","pollPeriod",3,"placeholder"],[1,"tb-form-row","space-between","tb-flex"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],[1,"tb-settings","chips-panel","w-full"],["translate","",1,"tb-form-panel-title"],["editable","","appearance","outline","floatLabel","always","formControlName","altResponsesAddresses",1,"chips-list",3,"label","placeholder"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",4)(1,"mat-toolbar",5)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",6)(6,"div",7),t.ɵɵelementStart(7,"button",8),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())}),t.ɵɵelementStart(8,"mat-icon",9),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",10)(11,"div",11)(12,"div",12)(13,"div",13),t.ɵɵtext(14,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-form-field",14),t.ɵɵelement(16,"input",15),t.ɵɵpipe(17,"translate"),t.ɵɵconditionalCreate(18,l0,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(19,"div",12)(20,"div",13),t.ɵɵtext(21,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",14),t.ɵɵelement(23,"input",17),t.ɵɵpipe(24,"translate"),t.ɵɵconditionalCreate(25,p0,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"div",12)(27,"div",18),t.ɵɵtext(28,"gateway.network-mask"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",14),t.ɵɵelement(30,"input",19),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(32,c0,9,8,"div",12),t.ɵɵelement(33,"tb-device-info-table",20),t.ɵɵconditionalCreate(34,d0,1,2,"tb-report-strategy",21),t.ɵɵelementStart(35,"div",12)(36,"div",22)(37,"span",23),t.ɵɵtext(38,"gateway.poll-period"),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"mat-form-field",14),t.ɵɵelement(40,"input",24),t.ɵɵpipe(41,"translate"),t.ɵɵconditionalCreate(42,u0,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(43,"div",25)(44,"div",18),t.ɵɵtext(45,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(46,"div",26)(47,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(48,m0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(50,"mat-chip",28),t.ɵɵelement(51,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"button",30,0),t.ɵɵpipe(54,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(53);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES))}),t.ɵɵelementStart(55,"tb-icon",31),t.ɵɵtext(56,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(57,"div",25)(58,"div",18),t.ɵɵtext(59,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(60,"div",26)(61,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(62,h0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(64,"mat-chip",28),t.ɵɵelement(65,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(66,"button",30,1),t.ɵɵpipe(68,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(67);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.TIMESERIES))}),t.ɵɵelementStart(69,"tb-icon",31),t.ɵɵtext(70,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(71,"div",25)(72,"div",18),t.ɵɵtext(73,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"div",26)(75,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(76,g0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(78,"mat-chip",28),t.ɵɵelement(79,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(80,"button",30,2),t.ɵɵpipe(82,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(81);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES_UPDATES))}),t.ɵɵelementStart(83,"tb-icon",31),t.ɵɵtext(84,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(85,"div",25)(86,"div",18),t.ɵɵtext(87,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(88,"div",26)(89,"mat-chip-listbox",27),t.ɵɵrepeaterCreate(90,f0,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(92,"mat-chip",28),t.ɵɵelement(93,"label",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"button",30,3),t.ɵɵpipe(96,"translate"),t.ɵɵlistener("click",function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(95);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.RPC_METHODS))}),t.ɵɵelementStart(97,"tb-icon",31),t.ɵɵtext(98,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(99,"div",32)(100,"button",33),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())}),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(103,"button",34),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())}),t.ɵɵtext(104),t.ɵɵpipe(105,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,34,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.deviceHelpLink),t.ɵɵadvance(10),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(17,36,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("host").hasError("required")&&n.deviceFormGroup.get("host").touched?18:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(24,38,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("port").hasError("required")&&n.deviceFormGroup.get("port").touched?25:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(31,40,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.data.hideNewFields?-1:32),t.ɵɵadvance(),t.ɵɵproperty("deviceInfoType",n.DeviceInfoType.FULL)("sourceTypes",n.sourceTypes)("connectorType",n.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?34:-1),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(41,42,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("pollPeriod").hasError("required")&&n.deviceFormGroup.get("pollPeriod").touched?42:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(54,44,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("timeseries").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("timeseries").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(68,46,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(82,48,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵrepeater(n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(96,50,"action.edit"))),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,52,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(105,54,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(y0,[C,Xn,Yn,kK,ri]),styles:['@charset "UTF-8";[_nghost-%COMP%]{display:grid;height:100%}[_nghost-%COMP%] .tb-form-panel[_ngcontent-%COMP%]{width:77vw;max-width:800px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%]{max-width:900px;display:flex;flex-direction:column}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{min-height:64px}[_nghost-%COMP%] .dialog-mapping[_ngcontent-%COMP%] tb-toggle-select[_ngcontent-%COMP%]{padding:4px 0}[_nghost-%COMP%] .mat-mdc-dialog-content[_ngcontent-%COMP%]{height:670px}[_nghost-%COMP%] .ellipsis-chips-container[_ngcontent-%COMP%]{max-width:70%}[_nghost-%COMP%] .chips-panel[_ngcontent-%COMP%]{padding:6px 6px 6px 0}[_nghost-%COMP%] .dialog-mapping .mat-mdc-chip-listbox .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center}[_nghost-%COMP%] .tb-form-row .fixed-title-width{min-width:40px;width:35%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center}[_nghost-%COMP%] .tb-form-row .mat-mdc-form-field{width:0}[_nghost-%COMP%] .tb-form-row .chips-list .mat-mdc-form-field{width:100%}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}[_nghost-%COMP%] .device-config{gap:12px;padding-left:10px;padding-right:10px}[_nghost-%COMP%] .device-node-pattern-field{flex-basis:3%}'],changeDetection:o.OnPush})}}const v0=()=>["deviceName","host","port","actions"],x0=()=>({minWidth:"96px",textAlign:"center"});function b0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",25)(2,"span",26),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",27),t.ɵɵelementStart(6,"button",10),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageDevices(n))}),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",10),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())}),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.devices")),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,7,"action.add"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,9,"action.search"))))}function w0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.device-name")))}function S0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(null==e.deviceInfo?null:e.deviceInfo.deviceNameExpression)}}function C0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.host")," "))}function _0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.host)}}function T0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.port")," "))}function E0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.port)}}function M0(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function I0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageDevices(n,i))}),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteDevice(n,i))}),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"action.edit"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"action.delete"))))}function k0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,I0,8,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",31),t.ɵɵelementContainer(4,32),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"button",34),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(7,"mat-icon",35),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",36,2),t.ɵɵelementContainer(11,32),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,x0)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function P0(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function D0(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class A0 extends Xa{constructor(){super(...arguments),this.hideNewFields=!1}getDatasource(){return new O0}manageDevices(e,t){e&&e.stopPropagation();const n=ne(t),i=n?this.getEntityIndex(t):-1,a=n?this.entityFormArray.at(i).value:{};this.getDeviceDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ge(1),de(this.destroyRef)).subscribe(e=>{e&&(n?this.entityFormArray.at(i).patchValue(e):this.entityFormArray.push(this.fb.control(e)),this.entityFormArray.markAsDirty())})}deleteDevice(e,t){e&&e.stopPropagation();this.getEntityIndex(t);this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:t.deviceInfo?.deviceNameExpression}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ge(1),de(this.destroyRef)).subscribe(e=>{if(e){const e=this.entityFormArray.value.findIndex(e=>JSON.stringify(e)===JSON.stringify(t));this.entityFormArray.removeAt(e),this.entityFormArray.markAsDirty()}})}getEntityIndex(e){return this.entityFormArray.controls.findIndex(t=>t.value===e)}getDeviceDialog(e,t){return this.dialog.open(y0,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy,hideNewFields:this.hideNewFields}})}updateTableData(e,t){t&&(e=e.filter(e=>Object.values(e).some(e=>e.toString().toLowerCase().includes(t.toLowerCase())||e.deviceNameExpression?.toString().toLowerCase().includes(t.toLowerCase())))),this.dataSource.loadData(e)}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(A0)))(n||A0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:A0,selectors:[["tb-bacnet-devices-config-table"]],inputs:{hideNewFields:[2,"hideNewFields","hideNewFields",c]},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>A0),multi:!0},{provide:xe,useExisting:a(()=>A0),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:48,vars:40,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-device-table","tb-absolute-fill"],[1,"tb-device-table-content","flex","flex-col"],[1,"mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","table-value-column",4,"matHeaderCellDef"],["class","table-value-column",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"tb-device-table-title"],[1,"flex-1"],[1,"table-value-column"],["tbTruncateWithTooltip",""],[1,"w-12"],[1,"lt-lg:!hidden","flex","flex-1","flex-row","items-stretch","justify-end"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵconditionalCreate(3,b0,14,11,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",6)(7,"button",7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",9,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",10),t.ɵɵpipe(18,"translate"),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())}),t.ɵɵelementStart(19,"mat-icon"),t.ɵɵtext(20,"close"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(21,"div",11)(22,"table",12),t.ɵɵelementContainerStart(23,13),t.ɵɵtemplate(24,w0,4,3,"mat-header-cell",14)(25,S0,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,13),t.ɵɵtemplate(27,C0,3,3,"mat-header-cell",14)(28,_0,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,13),t.ɵɵtemplate(30,T0,3,3,"mat-header-cell",14)(31,E0,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(32,16),t.ɵɵtemplate(33,M0,1,0,"mat-header-cell",17)(34,k0,12,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(35,P0,1,0,"mat-header-row",19)(36,D0,1,0,"mat-row",20),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"section",21),t.ɵɵpipe(38,"async"),t.ɵɵelementStart(39,"button",22),t.ɵɵlistener("click",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))}),t.ɵɵelementStart(40,"mat-icon",23),t.ɵɵtext(41,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"span"),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(45,"span",24),t.ɵɵpipe(46,"async"),t.ɵɵtext(47," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,24,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,26,"action.search"))),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(16,28,"common.enter-search")))("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,30,"action.close"))),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","deviceName"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","host"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","port"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(38,v0))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(39,v0)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(38,32,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(44,34,"gateway.add-device")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(46,36,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(A0,[ce,C,Yn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%]{width:100%;height:100%;background:#fff;overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .mat-toolbar-tools[_ngcontent-%COMP%]{min-height:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{overflow:hidden}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-right:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%]{table-layout:fixed;min-width:450px}[_nghost-%COMP%] .tb-device-table[_ngcontent-%COMP%] .tb-device-table-content[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%] .mat-mdc-table[_ngcontent-%COMP%] .table-value-column[_ngcontent-%COMP%]{padding:0 12px;width:21%}[_nghost-%COMP%] .no-data-found[_ngcontent-%COMP%]{height:calc(100% - 120px)}@media screen and (max-width:599px){[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{height:auto;min-height:100px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .tb-device-table-title[_ngcontent-%COMP%]{padding-bottom:5px;width:100%}}[_nghost-%COMP%] mat-cell.tb-value-cell{cursor:pointer}[_nghost-%COMP%] mat-cell.tb-value-cell .mat-icon{height:24px;width:24px;font-size:24px;color:#757575}'],changeDetection:o.OnPush})}}class O0 extends j{constructor(){super()}}class R0 extends Wa{initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.application??{},devices:e.devices??[]}}getMappedValue(e){return{application:e.application,devices:e.devices??[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(R0)))(n||R0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:R0,selectors:[["tb-bacnet-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>R0),multi:!0},{provide:xe,useExisting:a(()=>R0),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:11,vars:16,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","application"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","devices",3,"hideNewFields","withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-bacnet-application-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-bacnet-devices-config-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,10,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,12,"gateway.application"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,14,"gateway.devices"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("hideNewFields",n.isLegacy)("withReportStrategy",n.withReportStrategy))},dependencies:t.ɵɵgetComponentDepsFactory(R0,[ce,C,j1,A0]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}class B0 extends Wa{constructor(){super(...arguments),this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.general?nr.mapApplicationToUpgradedVersion(e.general):{},devices:e.devices?.length?nr.mapDevicesToUpgradedVersion(e.devices):[]}}getMappedValue(e){return{general:e.application?nr.mapApplicationToDowngradedVersion(e.application):{},devices:e.devices?.length?nr.mapDevicesToDowngradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(B0)))(n||B0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:B0,selectors:[["tb-bacnet-legacy-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>B0),multi:!0},{provide:xe,useExisting:a(()=>B0),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:11,vars:16,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","application"],[1,"tb-form-panel","no-border","no-padding","padding-top","tb-flex","fill-height"],["formControlName","devices",3,"hideNewFields","withReportStrategy"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-bacnet-application-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"div",4),t.ɵɵelement(10,"tb-bacnet-devices-config-table",5),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,10,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,12,"gateway.application"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,14,"gateway.devices"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("hideNewFields",n.isLegacy)("withReportStrategy",n.withReportStrategy))},dependencies:t.ɵɵgetComponentDepsFactory(B0,[ce,C,j1,A0]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}[_nghost-%COMP%] .mat-mdc-tab-group, [_nghost-%COMP%] .mat-mdc-tab-body-wrapper{height:100%}'],changeDetection:o.OnPush})}}function F0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",5),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function N0(e,n){if(1&e&&(t.ɵɵelement(0,"tb-error-icon",8),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵpipe(2,"translate")),2&e){t.ɵɵnextContext();const e=t.ɵɵreadContextLet(16);t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(2,3,t.ɵɵpipeBind1(1,1,e)))}}class L0 extends Ha{constructor(){super(...arguments),this.portLimits=Bi}get serverConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({host:["",[ve.required,ve.pattern(hn)]],port:[null,[ve.required,ve.min(Bi.MIN),ve.max(Bi.MAX)]],SSL:[!1],security:this.fb.group({cert:[""],key:[""]})})}mapOnChangeValue(e){return Q(e),e}onWriteValue(e){this.formGroup.reset(e,{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(L0)))(n||L0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:L0,selectors:[["tb-rest-server-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>L0),multi:!0},{provide:xe,useExisting:a(()=>L0),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:46,vars:54,consts:[[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","host",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"tb-form-row","column-xs"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["matSuffix","",3,"tooltipText"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","space-between","tb-flex","fill-width"],["formControlName","SSL",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],[3,"formGroup"],["tbTruncateWithTooltip","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],[1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","cert",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",3),t.ɵɵelement(6,"input",4),t.ɵɵpipe(7,"translate"),t.ɵɵconditionalCreate(8,F0,3,3,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",6)(10,"div",2),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",3),t.ɵɵelement(14,"input",7),t.ɵɵpipe(15,"translate"),t.ɵɵdeclareLet(16),t.ɵɵconditionalCreate(17,N0,3,5,"tb-error-icon",8),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",9)(19,"div",10),t.ɵɵtext(20,"gateway.security"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",11)(22,"mat-slide-toggle",12)(23,"mat-label",13),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(27,14),t.ɵɵelementStart(28,"div",11)(29,"div",15),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31),t.ɵɵpipe(32,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"div",16)(34,"mat-form-field",3),t.ɵɵelement(35,"input",17),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(37,"div",11)(38,"div",15),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",16)(43,"mat-form-field",3),t.ɵɵelement(44,"input",18),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e){t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,29,"gateway.hints.rest.host"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,31,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.serverConfigFormGroup.get("host").hasError("required")&&n.serverConfigFormGroup.get("host").touched?8:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,33,"gateway.hints.rest.port"))),t.ɵɵadvance(4),t.ɵɵproperty("min",t.ɵɵinterpolate(n.portLimits.MIN))("max",t.ɵɵinterpolate(n.portLimits.MAX))("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,35,"gateway.set"))),t.ɵɵadvance(2);const e=t.ɵɵstoreLet(n.serverConfigFormGroup.get("port"));t.ɵɵadvance(),t.ɵɵconditional((e.hasError("required")||e.hasError("min")||e.hasError("max"))&&e.touched?17:-1),t.ɵɵadvance(6),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(24,38,"gateway.hints.rest.ssl-verify"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(26,40,"gateway.rest.ssl-verify")," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.serverConfigFormGroup.get("security")),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(30,42,"gateway.hints.rest.cert"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(32,44,"gateway.certificate")),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(36,46,"gateway.set"))),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(39,48,"gateway.hints.rest.key"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,50,"gateway.key")),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(45,52,"gateway.set")))}},dependencies:t.ɵɵgetComponentDepsFactory(L0,[C,lK,Yn,si]),encapsulation:2,changeDetection:o.OnPush})}}const V0=()=>({min:1});function q0(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.ResponseTypeTranslationsMap.get(e)))}}function G0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function z0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",4),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function U0(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,5),t.ɵɵelementStart(1,"div",6)(2,"div",7),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",8)(6,"mat-form-field",9)(7,"mat-select",10),t.ɵɵrepeaterCreate(8,G0,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",6)(11,"div",7),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",8)(15,"mat-form-field",9)(16,"mat-select",11),t.ɵɵrepeaterCreate(17,z0,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.responseConfigFormGroup.get(e.ResponseType.CONST)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rest.on-success")),t.ɵɵadvance(5),t.ɵɵrepeater(e.responseStatuses),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,5,"gateway.rest.on-error")),t.ɵɵadvance(5),t.ɵɵrepeater(e.responseStatuses)}}function j0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.response-timeout-required"))}function H0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,V0)))}function W0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function $0(e,n){1&e&&(t.ɵɵelementStart(0,"span",16),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function K0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-required"))}function Y0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-pattern"))}function X0(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,5),t.ɵɵelementStart(1,"div",6)(2,"mat-slide-toggle",12)(3,"mat-label"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(6,"div",6)(7,"div",13),t.ɵɵtext(8,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",9),t.ɵɵelement(10,"input",14),t.ɵɵpipe(11,"translate"),t.ɵɵconditionalCreate(12,j0,2,3,"tb-error-icon",15)(13,H0,2,5,"tb-error-icon",15)(14,W0,2,3,"tb-error-icon",15)(15,$0,2,0,"span",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"div",6)(17,"div",13),t.ɵɵtext(18,"gateway.rest.response-attribute"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",9),t.ɵɵelement(20,"input",17),t.ɵɵpipe(21,"translate"),t.ɵɵconditionalCreate(22,K0,2,3,"tb-error-icon",15)(23,Y0,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(),n=e.responseConfigFormGroup.get(e.ResponseType.ADVANCED);t.ɵɵproperty("formGroup",n),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,8,"gateway.rest.response-expected")," "),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,10,"gateway.set")));const i=n.get("timeout").touched;t.ɵɵadvance(2),t.ɵɵconditional(n.get("timeout").hasError("required")&&i?12:n.get("timeout").hasError("min")&&i?13:n.get("timeout").hasError("pattern")&&i?14:15),t.ɵɵadvance(8),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(21,12,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.get("responseAttribute").hasError("required")&&n.get("responseAttribute").touched?22:n.get("responseAttribute").hasError("pattern")&&n.get("responseAttribute").touched?23:-1)}}class Z0 extends Ha{get responseConfigFormGroup(){return this.formGroup}constructor(){super(),this.ResponseTypeTranslationsMap=Ii,this.ResponseType=Ei,this.responseTypes=Object.values(Ei),this.responseStatuses=Object.values(Mi),this.observeIsExpected()}initFormGroup(){return this.fb.group({type:[Ei.DEFAULT],[Ei.CONST]:this.fb.group({successResponse:[Mi.OK],unsuccessfulResponse:[Mi.ERROR]}),[Ei.ADVANCED]:this.fb.group({responseExpected:[!0],timeout:[null,[ve.required,ve.min(.001),ve.pattern(mn)]],responseAttribute:["",[ve.required,ve.pattern(hn)]]})})}mapOnChangeValue({type:e,...t}){return{type:e,...t[e]??{}}}onWriteValue(e){const{type:t=Ei.DEFAULT,...n}=e??{};this.toggleIsExpected(n.responseExpected,t),this.responseConfigFormGroup.patchValue({type:t,[t]:n},{emitEvent:!1})}toggleIsExpected(e,t){const n=e&&t===Ei.ADVANCED;this.toggleControl(this.responseConfigFormGroup.get(Ei.ADVANCED).get("timeout"),n),this.toggleControl(this.responseConfigFormGroup.get(Ei.ADVANCED).get("responseAttribute"),n)}observeIsExpected(){De(this.responseConfigFormGroup.get("type").valueChanges,this.responseConfigFormGroup.get(Ei.ADVANCED).get("responseExpected").valueChanges).pipe(de(this.destroyRef)).subscribe(()=>this.toggleIsExpected(this.responseConfigFormGroup.get(Ei.ADVANCED).get("responseExpected").value,this.responseConfigFormGroup.get("type").value))}static{this.ɵfac=function(e){return new(e||Z0)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Z0,selectors:[["tb-rest-response-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>Z0),multi:!0},{provide:xe,useExisting:a(()=>Z0),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:10,vars:5,consts:[[1,"tb-form-row","space-between","same-padding","tb-flex","column","size-full",3,"formGroup"],[1,"tb-flex","row","space-between","align-center","no-gap","fill-width"],[1,"fixed-title-width","tb-required"],["formControlName","type","appearance","fill"],[3,"value"],[3,"formGroup"],[1,"tb-form-row"],[1,"fixed-title-width"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","successResponse"],["formControlName","unsuccessfulResponse"],["formControlName","responseExpected",1,"mat-slide"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["matSuffix","",3,"tooltipText"],["translate","","matSuffix","",1,"block","pr-2"],["matInput","","type","text","name","value","formControlName","responseAttribute",3,"placeholder"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵrepeaterCreate(6,q0,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(8,U0,19,7,"ng-container",5)(9,X0,24,14,"ng-container",5),t.ɵɵelementEnd()),2&e){let e;t.ɵɵproperty("formGroup",n.responseConfigFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.response")),t.ɵɵadvance(3),t.ɵɵrepeater(n.responseTypes),t.ɵɵadvance(2),t.ɵɵconditional((e=n.responseConfigFormGroup.get("type").value)===n.ResponseType.CONST?8:e===n.ResponseType.ADVANCED?9:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(Z0,[C,si]),encapsulation:2,changeDetection:o.OnPush})}}function Q0(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.endpoint-required"))}function J0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",17),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function e2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.http-methods-required"))}function t2(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",17),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.RestConvertorTypeTranslationsMap.get(e)))}}function n2(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",27),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function i2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",40),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function a2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",40),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function r2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",28)(1,"div",20)(2,"div",21),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",33)(6,"mat-chip-listbox",34),t.ɵɵrepeaterCreate(7,i2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(9,"mat-chip",35),t.ɵɵelement(10,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"button",37,0),t.ɵɵpipe(13,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(12),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))}),t.ɵɵelementStart(14,"tb-icon",38),t.ɵɵtext(15,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(16,"div",20)(17,"div",39),t.ɵɵtext(18,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",33)(20,"mat-chip-listbox",34),t.ɵɵrepeaterCreate(21,a2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(23,"mat-chip",35),t.ɵɵelement(24,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"button",37,1),t.ɵɵpipe(27,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(26),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))}),t.ɵɵelementStart(28,"tb-icon",38),t.ɵɵtext(29,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.attributes")),t.ɵɵadvance(3),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵrepeater(e.converterAttributes),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(13,9,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵrepeater(e.converterTelemetry),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(27,11,"action.edit")))}}function o2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",15),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function s2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",40),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function l2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",28)(1,"div",11)(2,"div",12),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",41),t.ɵɵelement(7,"input",42),t.ɵɵpipe(8,"translate"),t.ɵɵconditionalCreate(9,o2,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",43)(11,"div",24),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",25),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",20)(18,"div",21),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",44)(22,"mat-chip-listbox",34),t.ɵɵrepeaterCreate(23,s2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(25,"mat-chip",35),t.ɵɵelement(26,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(27,"button",37,2),t.ɵɵpipe(29,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(28),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.CUSTOM))}),t.ɵɵelementStart(30,"tb-icon",38),t.ɵɵtext(31,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,12,"gateway.hints.rest.extension"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,14,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,16,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("converter.extension").hasError("required")&&e.mappingFormGroup.get("converter.extension").touched?9:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,18,"gateway.extension-configuration")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,20,"gateway.extension-configuration-hint")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,22,"gateway.keys")),t.ɵɵadvance(3),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵrepeater(e.customKeys),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(29,24,"action.edit")))}}class p2 extends D{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.destroyRef=l,this.cd=p,this.mappingFormGroup=this.fb.group({endpoint:["",[ve.required,ve.pattern(hn)]],HTTPMethods:[[bt.POST],[ve.required]],security:[{type:Li.ANONYMOUS}],converter:this.fb.group({type:[_i.JSON,[]],deviceInfo:[],reportStrategy:[],attributes:[[]],timeseries:[[]],extension:["",[ve.required,ve.pattern(hn)]],extensionConfig:[]}),response:[]}),this.keysPopupClosed=!0,this.helpLink=`${v}/docs/iot-gateway/config/rest/#mapping-section`,this.httpMethods=Object.values(bt),this.converterTypes=Object.values(_i),this.restSourceTypes=Object.values(Ti),this.SecurityMode=na,this.MappingKeysType=Wi,this.DeviceInfoType=Ta,this.RestConvertorTypeTranslationsMap=Oi,this.RestDataConversionTranslationsMap=Ri,this.RestConverterType=_i,this.ConnectorType=gt,this.ReportStrategyDefaultValue=dn,this.setInitialFormValue(),this.observeConverterTypeChange(),this.toggleConverterFieldsByType(this.converterType)}get converterType(){return this.mappingFormGroup.get("converter")?.get("type").value}get converterAttributes(){if(this.converterType)return this.mappingFormGroup.get("converter").value.attributes.map(e=>e.key)}get converterTelemetry(){if(this.converterType)return this.mappingFormGroup.get("converter").value.timeseries.map(e=>e.key)}get customKeys(){return Object.keys(this.mappingFormGroup.get("converter").value.extensionConfig??{})}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.mappingFormGroup.valid){const{converter:e,...t}=this.mappingFormGroup.value,{reportStrategy:n,...i}=e,a={...t,reportStrategy:n,converter:i};Q(a),this.dialogRef.close(a)}}manageKeys(e,t,n){e?.stopPropagation(),this.popoverComponent&&!this.popoverComponent.tbHidden&&this.popoverComponent.hide();const i=t._elementRef.nativeElement;if(this.popoverService.hasPopover(i))this.popoverService.hidePopover(i);else{const e=this.mappingFormGroup.get("converter").get(n),t={keys:e.value,keysType:n,panelTitle:$i.get(n),addKeyTitle:Ki.get(n),deleteKeyTitle:Yi.get(n),noKeysText:Xi.get(n),withReportStrategy:this.data.withReportStrategy,convertorType:this.converterType,connectorType:gt.REST};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,bY,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(de(this.destroyRef)).subscribe(t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty(),this.cd.markForCheck()}),this.popoverComponent.tbHideStart.pipe(de(this.destroyRef)).subscribe(()=>{this.keysPopupClosed=!0})}}setInitialFormValue(){const{converter:e,reportStrategy:t,...n}=this.data.value;this.mappingFormGroup.patchValue({...n,converter:{...e,...t?{reportStrategy:t}:{}}},{emitEvent:!1})}observeConverterTypeChange(){this.mappingFormGroup.get("converter").get("type").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>this.toggleConverterFieldsByType(e))}toggleConverterFieldsByType(e){const t=e===_i.JSON;this.mappingFormGroup.get("converter").get("attributes")[t?"enable":"disable"]({emitEvent:!1}),this.mappingFormGroup.get("converter").get("timeseries")[t?"enable":"disable"]({emitEvent:!1}),this.mappingFormGroup.get("converter").get("extension")[t?"disable":"enable"]({emitEvent:!1}),this.mappingFormGroup.get("converter").get("extensionConfig")[t?"disable":"enable"]({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||p2)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(pt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:p2,selectors:[["tb-rest-mapping-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:59,vars:48,consts:[["attributesButton",""],["telemetryButton",""],["keysButton",""],[1,"h-full","w-[77vw]","max-w-3xl",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row"],[1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","endpoint",3,"placeholder"],["matSuffix","",3,"tooltipText"],["formControlName","HTTPMethods","multiple",""],[3,"value"],["formControlName","security",3,"mode"],["formGroupName","converter"],[1,"tb-form-row","space-between","tb-flex"],[1,"fixed-title-width"],["formControlName","type","appearance","fill"],[1,"tb-form-panel","stroked"],[1,"tb-form-panel-title"],[1,"tb-form-hint","tb-primary-fill"],["formControlName","deviceInfo","required","true",1,"device-info",3,"sourceTypes","convertorType","deviceInfoType","connectorType"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],[1,"tb-form-panel","no-border","no-padding","w-full"],["formControlName","response"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],[1,"tb-flex","max-w-70%"],[1,"tb-flex","gw-chip-list",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["translate","",1,"fixed-title-width"],["tbTruncateWithTooltip",""],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex"],["matInput","","name","value","formControlName","extension",3,"placeholder"],[1,"tb-form-row","space-between","same-padding","tb-flex","column"],[1,"tb-flex","ellipsis-chips-container"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",3)(1,"mat-toolbar",4)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",5)(6,"div",6),t.ɵɵelementStart(7,"button",7),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵelementStart(8,"mat-icon",8),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",9)(11,"div",10)(12,"div",11)(13,"div",12),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-form-field",13),t.ɵɵelement(18,"input",14),t.ɵɵpipe(19,"translate"),t.ɵɵconditionalCreate(20,Q0,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(21,"div",11)(22,"div",12),t.ɵɵpipe(23,"translate"),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",13)(27,"mat-select",16),t.ɵɵrepeaterCreate(28,J0,2,2,"mat-option",17,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(30,e2,2,3,"tb-error-icon",15),t.ɵɵelementEnd()(),t.ɵɵelement(31,"tb-security-config",18),t.ɵɵelementContainerStart(32,19),t.ɵɵelementStart(33,"div",20)(34,"div",21),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"tb-toggle-select",22),t.ɵɵrepeaterCreate(38,t2,3,4,"tb-toggle-option",17,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(40,"div",23)(41,"div",24),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"div",25),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(47,"tb-device-info-table",26),t.ɵɵconditionalCreate(48,n2,1,2,"tb-report-strategy",27),t.ɵɵconditionalCreate(49,r2,30,13,"div",28)(50,l2,32,26,"div",28),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelement(51,"tb-rest-response-config",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"div",30)(53,"button",31),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(54),t.ɵɵpipe(55,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(56,"button",32),t.ɵɵlistener("click",function(){return n.add()}),t.ɵɵtext(57),t.ɵɵpipe(58,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,26,"gateway.data-mapping")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLink),t.ɵɵadvance(7),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,28,"gateway.hints.rest.endpoint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,30,"gateway.rest.endpoint")),t.ɵɵadvance(3),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,32,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(n.mappingFormGroup.get("endpoint").hasError("required")&&n.mappingFormGroup.get("endpoint").touched?20:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(23,34,"gateway.hints.rest.http-methods"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(25,36,"gateway.rest.http-methods")),t.ɵɵadvance(4),t.ɵɵrepeater(n.httpMethods),t.ɵɵadvance(2),t.ɵɵconditional(n.mappingFormGroup.get("HTTPMethods").hasError("required")&&n.mappingFormGroup.get("HTTPMethods").touched?30:-1),t.ɵɵadvance(),t.ɵɵproperty("mode",n.SecurityMode.basic),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,38,"gateway.payload-type")),t.ɵɵadvance(3),t.ɵɵrepeater(n.converterTypes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(43,40,"gateway.data-conversion")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(46,42,n.RestDataConversionTranslationsMap.get(n.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("sourceTypes",n.restSourceTypes)("convertorType",n.RestConverterType.JSON)("deviceInfoType",n.DeviceInfoType.FULL)("connectorType",n.ConnectorType.REST),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?48:-1),t.ɵɵadvance(),t.ɵɵconditional(n.converterType===n.RestConverterType.JSON?49:50),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(55,44,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.mappingFormGroup.invalid||!n.mappingFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(58,46,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(p2,[C,Xn,kK,VX,Z0,si,ri]),styles:['@charset "UTF-8";[_nghost-%COMP%] .device-info .fixed-title-width{min-width:0}'],changeDetection:o.OnPush})}}const c2=()=>["endpoint","httpMethods","securityType","actions"];function d2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"span",30),t.ɵɵelementStart(5,"button",10),t.ɵɵpipe(6,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageMapping(n))}),t.ɵɵelementStart(7,"mat-icon"),t.ɵɵtext(8,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",10),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())}),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.data-mapping")," "),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"action.add"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,9,"action.search"))))}function u2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",31)(1,"div",32),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rest.endpoint")))}function m2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",33)(1,"div",32),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.endpoint)}}function h2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rest.http-methods")," "))}function g2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",39),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function f2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",35)(1,"mat-chip-listbox",36),t.ɵɵrepeaterCreate(2,g2,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(4,"mat-chip",37),t.ɵɵelement(5,"label",38),t.ɵɵelementEnd()()()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵproperty("tbEllipsisChipList",e.HTTPMethods),t.ɵɵadvance(),t.ɵɵrepeater(e.HTTPMethods)}}function y2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",40),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.security-type")," "))}function v2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40)(1,"div",32),t.ɵɵtext(2),t.ɵɵpipe(3,"titlecase"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,null==e.security?null:e.security.type))}}function x2(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",41)}function b2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageMapping(n,i))}),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteMapping(n,i))}),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"action.edit"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"action.delete"))))}function w2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,b2,8,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",42),t.ɵɵelementContainer(4,43),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",44)(6,"button",45),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(7,"mat-icon",46),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",47,2),t.ɵɵelementContainer(11,43),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(4),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function S2(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",48)}function C2(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class _2 extends Xa{getDatasource(){return new T2}manageMapping(e,t){e&&e.stopPropagation();const n=ne(t);this.getMappingDialog(t??{},n?"action.apply":"action.add").afterClosed().pipe(de(this.destroyRef)).subscribe(e=>{if(e){if(n){const n=this.entityFormArray.value.findIndex(e=>JSON.stringify(e)===JSON.stringify(t));this.entityFormArray.at(n).patchValue(e)}else this.entityFormArray.push(this.fb.control(e));this.entityFormArray.markAsDirty()}})}deleteMapping(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:t.endpoint}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(de(this.destroyRef)).subscribe(e=>{if(e){const e=this.entityFormArray.value.findIndex(e=>JSON.stringify(e)===JSON.stringify(t));this.entityFormArray.removeAt(e),this.entityFormArray.markAsDirty()}})}updateTableData(e,t){t&&(e=e.filter(e=>Object.values(e).some(e=>e.toString().toLowerCase().includes(t.toLowerCase())||e.type?.toLowerCase().includes(t.toLowerCase())))),this.dataSource.loadData(e)}getMappingDialog(e,t){return this.dialog.open(p2,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(_2)))(n||_2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:_2,selectors:[["tb-rest-mapping-table"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>_2),multi:!0},{provide:xe,useExisting:a(()=>_2),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:47,vars:40,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-absolute-fill","size-full"],[1,"flex","size-full","flex-col"],[1,"gw-table-toolbar","mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"gw-connector-table"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","!w-1/5",4,"matHeaderCellDef"],["class","w-1/5",4,"matCellDef"],["class","w-1/3 !pl-0",4,"matHeaderCellDef"],["class","w-1/3",4,"matCellDef"],["class","w-1/6",4,"matHeaderCellDef"],["class","w-1/6",4,"matCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"flex-1"],[1,"!w-1/5"],["tbTruncateWithTooltip",""],[1,"w-1/5"],[1,"w-1/3","!pl-0"],[1,"w-1/3"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text","http-method-label","font-medium"],["tbTruncateWithTooltip","",1,"http-method-label","font-medium"],[1,"w-1/6"],[1,"w-12"],[1,"lt-lg:!hidden","flex","min-w-24","flex-1","flex-row","items-stretch","justify-end","text-center"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵconditionalCreate(3,d2,13,11,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"button",7),t.ɵɵpipe(7,"translate"),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",8)(11,"mat-label"),t.ɵɵtext(12," "),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",9,0),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵpipe(17,"translate"),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())}),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"table",12),t.ɵɵelementContainerStart(22,13),t.ɵɵtemplate(23,u2,4,3,"mat-header-cell",14)(24,m2,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,h2,3,3,"mat-header-cell",16)(27,f2,6,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,13),t.ɵɵtemplate(29,y2,3,3,"mat-header-cell",18)(30,v2,4,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(31,20),t.ɵɵtemplate(32,x2,1,0,"mat-header-cell",21)(33,w2,12,3,"mat-cell",22),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(34,S2,1,0,"mat-header-row",23)(35,C2,1,0,"mat-row",24),t.ɵɵelementEnd(),t.ɵɵelementStart(36,"section",25),t.ɵɵpipe(37,"async"),t.ɵɵelementStart(38,"button",26),t.ɵɵlistener("click",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))}),t.ɵɵelementStart(39,"mat-icon",27),t.ɵɵtext(40,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(41,"span"),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(44,"span",28),t.ɵɵpipe(45,"async"),t.ɵɵtext(46," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,24,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,26,"action.search"))),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,28,"common.enter-search")))("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(17,30,"action.close"))),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","endpoint"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","httpMethods"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","securityType"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(38,c2))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(39,c2)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(37,32,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(43,34,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(45,36,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(_2,[ce,C,Yn,Xn]),styles:[".http-method-label[_ngcontent-%COMP%]{font-size:12px}"],changeDetection:o.OnPush})}}let T2=class extends j{constructor(){super()}};function E2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" : ",e.value.value," ")}}function M2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",21),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function I2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",21),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function k2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",16)(1,"div",17),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",18)(5,"mat-form-field",19),t.ɵɵelement(6,"input",20),t.ɵɵpipe(7,"translate"),t.ɵɵconditionalCreate(8,M2,3,3,"mat-icon",21),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",16)(10,"div",22),t.ɵɵtext(11,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19),t.ɵɵelement(13,"input",23),t.ɵɵpipe(14,"translate"),t.ɵɵconditionalCreate(15,I2,3,3,"mat-icon",21),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,7,"gateway.key")),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,9,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("key").hasError("required")&&e.get("key").touched?8:-1),t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,11,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.get("value").hasError("required")&&e.get("value").touched?15:-1)}}function P2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵelementContainerStart(2,11),t.ɵɵelementStart(3,"mat-expansion-panel",12)(4,"mat-expansion-panel-header")(5,"mat-panel-title")(6,"div",13),t.ɵɵtext(7),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(8,E2,2,1,"div",13),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,k2,16,13,"ng-template",14),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",15),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.deleteKey(n,i))}),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=n.$count;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i===a-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",null==e.value?null:e.value.key," "),t.ɵɵadvance(),t.ɵɵconditional(null!=e.value&&e.value.value?8:-1),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,"gateway.rest.delete-http-header"))}}function D2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,P2,14,7,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function A2(e,n){1&e&&(t.ɵɵelementStart(0,"div",4)(1,"span",24),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.rest.no-http-headers")))}class O2 extends U{constructor(e,t){super(t),this.fb=e,this.store=t,this.withReportStrategy=!0,this.keysDataApplied=i(),this.ReportStrategyDefaultValue=dn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}addKey(){this.keysListFormArray.push(this.fb.group({key:["",[ve.required,ve.pattern(hn)]],value:["",[ve.required,ve.pattern(hn)]]}))}deleteKey(e,t){e&&e.stopPropagation(),this.keysListFormArray.removeAt(t),this.keysListFormArray.markAsDirty()}cancel(){this.popover?.hide()}applyKeysData(){this.keysDataApplied.emit(this.keysListFormArray.value.reduce((e,{key:t,value:n})=>({...e,[t]:n}),{}))}prepareKeysFormArray(e){const t=[];return Object.keys(e)?.forEach(n=>{t.push(this.fb.group({key:[n,[ve.required,ve.pattern(hn)]],value:[e[n],[ve.required,ve.pattern(hn)]]}))}),this.fb.array(t)}static{this.ɵfac=function(e){return new(e||O2)(t.ɵɵdirectiveInject(fe.UntypedFormBuilder),t.ɵɵdirectiveInject(et.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:O2,selectors:[["tb-rest-http-headers-panel"]],inputs:{keys:"keys",popover:"popover",withReportStrategy:[2,"withReportStrategy","withReportStrategy",c]},outputs:{keysDataApplied:"keysDataApplied"},features:[t.ɵɵInheritDefinitionFeature],decls:18,vars:15,consts:[[1,"w-[77vw]","max-w-2xl"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],[1,"tb-form-panel","no-border","no-padding","h-[500px]"],[1,"tb-flex","no-flex","center","align-center","h-[500px]"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-flex","flex-end"],["mat-button","","color","primary","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"tb-form-panel","no-border","no-padding","tb-flex","no-flex","row","center","fill-width"],[1,"tb-form-panel","stroked","tb-flex"],[3,"formGroup"],[1,"tb-settings",3,"expanded"],["tbTruncateWithTooltip","",1,"max-w-[11vw]"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",1,"gw-delete-icon-button",3,"click","matTooltip"],[1,"tb-form-row"],[1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","name","value","formControlName","key",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","type","text","name","value","formControlName","value",3,"placeholder"],[1,"tb-prompt"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(5,D2,3,0,"div",3)(6,A2,4,3,"div",4),t.ɵɵelementStart(7,"div")(8,"button",5),t.ɵɵlistener("click",function(){return n.addKey()}),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",6)(12,"button",7),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"button",8),t.ɵɵlistener("click",function(){return n.applyKeysData()}),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,7,"gateway.rest.http-headers"),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵconditional(n.keysListFormArray.controls.length?5:6),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(10,9,"gateway.rest.add-http-header")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,11,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,13,"action.apply")," "))},dependencies:t.ɵɵgetComponentDepsFactory(O2,[C]),encapsulation:2,changeDetection:o.OnPush})}}const R2=()=>({min:1}),B2=()=>({maxWidth:"970px"});function F2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,i.RestRequestTypesTranslationsMap.get(e)))}}function N2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.endpoint-required"))}function L2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.endpoint-pattern"))}function V2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function q2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.http-methods-required"))}function G2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵpipe(2,"titlecase"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,e))}}function z2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.rest.endpoint"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",21),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,N2,2,3,"tb-error-icon",22)(8,L2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",9)(10,"div",19),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"gateway.rest.http-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",20)(14,"mat-select",23),t.ɵɵrepeaterCreate(15,V2,2,2,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(17,q2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",9)(19,"div",24),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",20)(23,"mat-select",25),t.ɵɵrepeaterCreate(24,G2,3,4,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,10,"gateway.hints.rest.endpoint"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,12,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("endpoint").hasError("required")&&e.mappingFormGroup.get("endpoint").touched?7:e.mappingFormGroup.get("endpoint").hasError("pattern")&&e.mappingFormGroup.get("endpoint").touched?8:-1),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,14,"gateway.hints.rest.http-methods"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.httpMethods),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("HTTPMethods").hasError("required")&&e.mappingFormGroup.get("HTTPMethods").touched?17:-1),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(20,16,"gateway.hints.rest.scope-type"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.requestsScopeType)}}function U2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-required"))}function j2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-pattern"))}function H2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.device-name-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",26),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,U2,2,3,"tb-error-icon",22)(8,j2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.device-name-filter-hint"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("deviceNameFilter").hasError("required")&&e.mappingFormGroup.get("deviceNameFilter").touched?7:e.mappingFormGroup.get("deviceNameFilter").hasError("pattern")&&e.mappingFormGroup.get("deviceNameFilter").touched?8:-1)}}function W2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.method-filter-required"))}function $2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.method-filter-pattern"))}function K2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.method-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",27),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,W2,2,3,"tb-error-icon",22)(8,$2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.rest.method-filter"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("methodFilter").hasError("required")&&e.mappingFormGroup.get("methodFilter").touched?7:e.mappingFormGroup.get("methodFilter").hasError("pattern")&&e.mappingFormGroup.get("methodFilter").touched?8:-1)}}function Y2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-filter-required"))}function X2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-filter-pattern"))}function Z2(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.attribute-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",28),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,Y2,2,3,"tb-error-icon",22)(8,X2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,5,"gateway.hints.rest.attribute-filter"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("attributeFilter").hasError("required")&&e.mappingFormGroup.get("attributeFilter").touched?7:e.mappingFormGroup.get("attributeFilter").hasError("pattern")&&e.mappingFormGroup.get("attributeFilter").touched?8:-1)}}function Q2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.request-url-expression-required"))}function J2(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.request-url-expression-pattern"))}function e3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",13),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function t3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.value-expression-required"))}function n3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.value-expression-pattern"))}function i3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",29)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.rest.request-url-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",30),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,Q2,2,3,"tb-error-icon",22)(8,J2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",9)(10,"div",19),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"gateway.rest.http-method"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",20)(14,"mat-select",31),t.ɵɵrepeaterCreate(15,e3,2,2,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵelementStart(17,"div",9)(18,"div",19),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"gateway.value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",20),t.ɵɵelement(22,"input",32),t.ɵɵpipe(23,"translate"),t.ɵɵconditionalCreate(24,t3,2,3,"tb-error-icon",22)(25,n3,2,3,"tb-error-icon",22),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,12,"gateway.hints.rest.attribute-url-expression"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,14,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("requestUrlExpression").hasError("required")&&e.mappingFormGroup.get("requestUrlExpression").touched?7:e.mappingFormGroup.get("requestUrlExpression").hasError("pattern")&&e.mappingFormGroup.get("requestUrlExpression").touched?8:-1),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,16,"gateway.hints.rest.http-method"))),t.ɵɵadvance(5),t.ɵɵrepeater(e.httpMethods),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,18,"gateway.hints.rest.value-expression"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(23,20,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("valueExpression").hasError("required")&&e.mappingFormGroup.get("valueExpression").touched?24:e.mappingFormGroup.get("valueExpression").hasError("pattern")&&e.mappingFormGroup.get("valueExpression").touched?25:-1)}}function a3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,R2)))}function r3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function o3(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function s3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2,"gateway.response-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",20),t.ɵɵelement(4,"input",33),t.ɵɵpipe(5,"translate"),t.ɵɵconditionalCreate(6,a3,2,5,"tb-error-icon",22)(7,r3,2,3,"tb-error-icon",22)(8,o3,2,0,"span",34),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,3,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("responseTimeout").hasError("min")&&e.mappingFormGroup.get("responseTimeout").touched?6:e.mappingFormGroup.get("responseTimeout").hasError("pattern")&&e.mappingFormGroup.get("responseTimeout").touched?7:8)}}function l3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-required"))}function p3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.device-name-filter-pattern"))}function c3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-name-expression-required"))}function d3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.attribute-name-expression-pattern"))}function u3(e,n){1&e&&t.ɵɵelement(0,"div",38),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/rest-json_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,B2))}function m3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",19),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.device-name-filter"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",20),t.ɵɵelement(5,"input",35),t.ɵɵpipe(6,"translate"),t.ɵɵconditionalCreate(7,l3,2,3,"tb-error-icon",22)(8,p3,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",9)(10,"div",36),t.ɵɵtext(11,"gateway.attribute-name-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",20),t.ɵɵelement(13,"input",37),t.ɵɵpipe(14,"translate"),t.ɵɵconditionalCreate(15,c3,2,3,"tb-error-icon",22)(16,d3,2,3,"tb-error-icon",22)(17,u3,1,3,"div",38),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,8,"gateway.device-name-filter-hint"))),t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,10,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("deviceNameExpression").hasError("required")&&e.mappingFormGroup.get("deviceNameExpression").touched?7:e.mappingFormGroup.get("deviceNameExpression").hasError("pattern")&&e.mappingFormGroup.get("deviceNameExpression").touched?8:-1),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(14,12,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("attributeNameExpression").hasError("required")&&e.mappingFormGroup.get("attributeNameExpression").touched?15:e.mappingFormGroup.get("attributeNameExpression").hasError("pattern")&&e.mappingFormGroup.get("attributeNameExpression").touched?16:17)}}function h3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,R2)))}function g3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function f3(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function y3(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",20),t.ɵɵelement(4,"input",39),t.ɵɵpipe(5,"translate"),t.ɵɵconditionalCreate(6,h3,2,5,"tb-error-icon",22)(7,g3,2,3,"tb-error-icon",22)(8,f3,2,0,"span",34),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,3,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("timeout").hasError("min")&&e.mappingFormGroup.get("timeout").touched?6:e.mappingFormGroup.get("timeout").hasError("pattern")&&e.mappingFormGroup.get("timeout").touched?7:8)}}function v3(e,n){1&e&&(t.ɵɵelementStart(0,"div",14)(1,"mat-slide-toggle",40)(2,"mat-label",41),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,3,"gateway.hints.rest.update-ssl"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,5,"gateway.rest.ssl-verify")," "))}function x3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",53),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.value)}}function b3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,R2)))}function w3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function S3(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function C3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.tries-min"))}function _3(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",22),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.tries-pattern"))}function T3(e,n){1&e&&(t.ɵɵelementStart(0,"div",14)(1,"mat-slide-toggle",54)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,1,"gateway.rest.allow-redirects")," "))}function E3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"mat-expansion-panel",42)(2,"mat-expansion-panel-header")(3,"mat-panel-title",43)(4,"div",44),t.ɵɵtext(5,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(6,"div",45)(7,"div",10),t.ɵɵtext(8,"gateway.rest.http-headers"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"div",46)(10,"mat-chip-listbox",47),t.ɵɵpipe(11,"keyvalue"),t.ɵɵrepeaterCreate(12,x3,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(14,"keyvalue"),t.ɵɵelementStart(15,"mat-chip",48),t.ɵɵelement(16,"label",49),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"button",50,0),t.ɵɵpipe(19,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(18),a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageKeys(n,i))}),t.ɵɵelementStart(20,"tb-icon",51),t.ɵɵtext(21,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(22,"div",9)(23,"div",10),t.ɵɵtext(24,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",20),t.ɵɵelement(26,"input",39),t.ɵɵpipe(27,"translate"),t.ɵɵconditionalCreate(28,b3,2,5,"tb-error-icon",22)(29,w3,2,3,"tb-error-icon",22)(30,S3,2,0,"span",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"div",9)(32,"div",10),t.ɵɵtext(33,"gateway.rest.tries"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"mat-form-field",20),t.ɵɵelement(35,"input",52),t.ɵɵpipe(36,"translate"),t.ɵɵconditionalCreate(37,C3,2,3,"tb-error-icon",22)(38,_3,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(39,T3,5,3,"div",14),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(10),t.ɵɵproperty("tbEllipsisChipList",t.ɵɵpipeBind1(11,10,e.mappingFormGroup.get("httpHeaders").value)),t.ɵɵadvance(2),t.ɵɵrepeater(t.ɵɵpipeBind1(14,12,e.mappingFormGroup.get("httpHeaders").value)),t.ɵɵadvance(5),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,14,"action.edit"))),t.ɵɵadvance(9),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(27,16,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("timeout").hasError("min")&&e.mappingFormGroup.get("timeout").touched?28:e.mappingFormGroup.get("timeout").hasError("pattern")&&e.mappingFormGroup.get("timeout").touched?29:30),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(36,18,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.mappingFormGroup.get("tries").hasError("min")&&e.mappingFormGroup.get("tries").touched?37:e.mappingFormGroup.get("tries").hasError("pattern")&&e.mappingFormGroup.get("tries").touched?38:-1),t.ɵɵadvance(2),t.ɵɵconditional(e.requestType===e.RestRequestType.ATTRIBUTE_UPDATE?39:-1)}}class M3 extends D{constructor(e,t,n,i,a,r,o,s,l,p){super(e,t,i),this.store=e,this.router=t,this.data=n,this.dialogRef=i,this.fb=a,this.popoverService=r,this.renderer=o,this.viewContainerRef=s,this.cdr=l,this.destroyRef=p,this.requestTypes=Object.values(ki),this.requestsScopeType=Object.values(Di),this.httpMethods=Object.values(bt),this.helpLink=`${v}/docs/iot-gateway/config/rest/#attribute-request-section`,this.RestRequestTypesTranslationsMap=Pi,this.SecurityMode=na,this.RestRequestType=ki,this.mappingFormGroup=this.fb.group({requestType:[ki.ATTRIBUTE_REQUEST],endpoint:["",[ve.required,ve.pattern(hn)]],HTTPMethods:[[bt.POST],[ve.required]],HTTPMethod:[bt.POST,[ve.required]],type:[Di.Shared],security:[{type:Li.ANONYMOUS}],timeout:[null,[ve.min(.001),ve.pattern(mn)]],deviceNameExpression:["",[ve.required,ve.pattern(hn)]],attributeNameExpression:["",[ve.required,ve.pattern(hn)]],SSLVerify:[!1],deviceNameFilter:["",[ve.required,ve.pattern(hn)]],methodFilter:["",[ve.required,ve.pattern(hn)]],attributeFilter:["",[ve.required,ve.pattern(hn)]],requestUrlExpression:[this.data.defaultRequestUrl,[ve.required,ve.pattern(hn)]],valueExpression:["",[ve.required,ve.pattern(hn)]],responseTimeout:[null,[ve.min(.001),ve.pattern(mn)]],tries:[null,[ve.min(1),ve.pattern(mn)]],allowRedirects:[!1],httpHeaders:[{}]}),this.keysPopupClosed=!0,this.mappingFormGroup.patchValue(this.data.value,{emitEvent:!1}),this.observeRequestTypeChange(),this.toggleFieldsByRequestType(this.mappingFormGroup.get("requestType").value)}get requestType(){return this.mappingFormGroup.get("requestType").value}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.mappingFormGroup.valid){const{requestType:e,...t}=this.mappingFormGroup.value;Q(t),this.dialogRef.close({requestType:e,requestValue:t})}}manageKeys(e,t){e.stopPropagation();const n=t._elementRef.nativeElement;if(this.popoverService.hasPopover(n))return void this.popoverService.hidePopover(n);this.popoverService.hasPopover(n)&&this.popoverService.hidePopover(n),this.keysPopupClosed=!1;const i=this.popoverService.displayPopover(n,this.renderer,this.viewContainerRef,O2,"leftBottom",!1,null,{keys:this.mappingFormGroup.get("httpHeaders").value,withReportStrategy:this.data.withReportStrategy},{},{},{},!0);i.tbComponentRef.instance.popover=i,i.tbComponentRef.instance.keysDataApplied.subscribe(e=>{i.hide(),this.mappingFormGroup.get("httpHeaders").patchValue(e),this.mappingFormGroup.get("httpHeaders").markAsDirty(),this.cdr.markForCheck()}),i.tbHideStart.pipe(de(this.destroyRef)).subscribe(()=>{this.keysPopupClosed=!0})}observeRequestTypeChange(){this.mappingFormGroup.get("requestType").valueChanges.pipe(Oe(),de(this.destroyRef)).subscribe(e=>this.toggleFieldsByRequestType(e))}toggleFieldsByRequestType(e){this.mappingFormGroup.disable({emitEvent:!1}),Ai.get("all").forEach(e=>this.mappingFormGroup.get(e).enable({emitEvent:!1})),Ai.get(e).forEach(e=>this.mappingFormGroup.get(e).enable({emitEvent:!1}))}static{this.ɵfac=function(e){return new(e||M3)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(tt.Router),t.ɵɵdirectiveInject($e),t.ɵɵdirectiveInject(Ke.MatDialogRef),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(pt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:M3,selectors:[["tb-rest-requests-mapping-dialog"]],features:[t.ɵɵInheritDefinitionFeature],decls:37,vars:23,consts:[["button",""],[1,"h-full","w-[77vw]","max-w-3xl",3,"formGroup"],["color","primary"],[1,"flex-1"],[3,"tb-help"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["mat-dialog-content",""],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-row"],["translate","",1,"fixed-title-width"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex"],["formControlName","requestType"],[3,"value"],[1,"tb-form-row","tb-flex","fill-width"],["formControlName","security",3,"mode"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","color","primary","type","button","cdkFocusInitial","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"],["translate","",1,"fixed-title-width","tb-required",3,"tb-hint-tooltip-icon"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","type","text","name","value","formControlName","endpoint",3,"placeholder"],["matSuffix","",3,"tooltipText"],["formControlName","HTTPMethods","multiple",""],["translate","",1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["formControlName","type"],["matInput","","type","text","name","value","formControlName","deviceNameFilter",3,"placeholder"],["matInput","","type","text","name","value","formControlName","methodFilter",3,"placeholder"],["matInput","","type","text","name","value","formControlName","attributeFilter",3,"placeholder"],[1,"tb-form-row","request-url-row"],["matInput","","type","text","name","value","formControlName","requestUrlExpression",3,"placeholder"],["formControlName","HTTPMethod"],["matInput","","type","text","name","value","formControlName","valueExpression",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","responseTimeout",3,"placeholder"],["translate","","matSuffix","",1,"block","pr-2"],["matInput","","type","text","name","value","formControlName","deviceNameExpression",3,"placeholder"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","type","text","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matSuffix","","tb-help-popup-placement","left",1,"see-example","p-1",3,"tb-help-popup","tb-help-popup-style"],["matInput","","type","number","min","0","name","value","formControlName","timeout",3,"placeholder"],["formControlName","SSLVerify",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],[1,"tb-settings"],[1,"justify-end"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","space-between","tb-flex"],[1,"tb-flex","gw-chip-list"],[1,"tb-flex",3,"tbEllipsisChipList"],[1,"mat-mdc-chip","ellipsis-chip"],[1,"ellipsis-text"],["type","button","mat-icon-button","","color","primary","matTooltipPosition","above",3,"click","matTooltip"],["matButtonIcon",""],["matInput","","type","number","min","0","name","value","formControlName","tries",3,"placeholder"],["tbTruncateWithTooltip",""],["formControlName","allowRedirects",1,"mat-slide"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",1)(1,"mat-toolbar",2)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",3)(6,"div",4),t.ɵɵelementStart(7,"button",5),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵelementStart(8,"mat-icon",6),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",7)(11,"div",8)(12,"div",9)(13,"div",10),t.ɵɵtext(14,"gateway.request-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"mat-form-field",11)(16,"mat-select",12),t.ɵɵrepeaterCreate(17,F2,3,4,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(19,z2,26,18),t.ɵɵconditionalCreate(20,H2,9,9,"div",9),t.ɵɵconditionalCreate(21,K2,9,9,"div",9),t.ɵɵconditionalCreate(22,Z2,9,9,"div",9),t.ɵɵconditionalCreate(23,i3,26,22),t.ɵɵconditionalCreate(24,s3,9,5,"div",9),t.ɵɵconditionalCreate(25,m3,18,14),t.ɵɵconditionalCreate(26,y3,9,5,"div",9),t.ɵɵconditionalCreate(27,v3,6,7,"div",14),t.ɵɵelement(28,"tb-security-config",15),t.ɵɵconditionalCreate(29,E3,40,20,"div",8),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"div",16)(31,"button",17),t.ɵɵlistener("click",function(){return n.cancel()}),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"button",18),t.ɵɵlistener("click",function(){return n.add()}),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,17,"gateway.requests-mapping")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLink),t.ɵɵadvance(11),t.ɵɵrepeater(n.requestTypes),t.ɵɵadvance(2),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_REQUEST?19:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType!==n.RestRequestType.ATTRIBUTE_REQUEST?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.SERVER_SIDE_RPC?21:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_UPDATE?22:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType!==n.RestRequestType.ATTRIBUTE_REQUEST?23:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.SERVER_SIDE_RPC?24:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_REQUEST?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_REQUEST?26:-1),t.ɵɵadvance(),t.ɵɵconditional(n.requestType===n.RestRequestType.ATTRIBUTE_UPDATE?27:-1),t.ɵɵadvance(),t.ɵɵproperty("mode",n.SecurityMode.basic),t.ɵɵadvance(),t.ɵɵconditional(n.requestType!==n.RestRequestType.ATTRIBUTE_REQUEST?29:-1),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(33,19,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.mappingFormGroup.invalid||!n.mappingFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(36,21,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(M3,[ce,C,Xn,VX,si]),styles:["[_nghost-%COMP%] .tb-form-row.request-url-row[_ngcontent-%COMP%]{gap:6px}"],changeDetection:o.OnPush})}}const I3=()=>["type","details","actions"],k3=()=>({});function P3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",26),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"span",27),t.ɵɵelementStart(5,"button",10),t.ɵɵpipe(6,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageMapping(n))}),t.ɵɵelementStart(7,"mat-icon"),t.ɵɵtext(8,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",10),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.enterFilterMode())}),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"search"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.requests-mapping")," "),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,7,"action.add"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,9,"action.search"))))}function D3(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",28)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.type")))}function A3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",29),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,i.RestRequestTypesTranslationsMap.get(e.requestType)))}}function O3(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",31),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.details")," "))}function R3(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext();t.ɵɵtextInterpolate1(" ",n.Object.values(e.requestValue.httpHeaders??t.ɵɵpureFunction0(1,k3)).join(", ")," ")}}function B3(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.methodFilter," ")}}function F3(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.endpoint," ")}}function N3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",29),t.ɵɵconditionalCreate(2,R3,1,2)(3,B3,1,1)(4,F3,1,1),t.ɵɵelementEnd()()),2&e){let e;const i=n.$implicit;t.ɵɵadvance(2),t.ɵɵconditional("attributeUpdates"===(e=i.requestType)?2:"serverSideRpc"===e?3:4)}}function L3(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function V3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",10),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageMapping(n,i))}),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",10),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteMapping(n,i))}),t.ɵɵelementStart(6,"tb-icon"),t.ɵɵtext(7,"delete"),t.ɵɵelementEnd()()}2&e&&(t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,4,"action.edit"))),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(5,6,"action.delete"))))}function q3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,V3,8,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",33),t.ɵɵelementContainer(4,34),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",35)(6,"button",36),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(7,"mat-icon",37),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",38,2),t.ɵɵelementContainer(11,34),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(4),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function G3(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function z3(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class U3 extends Xa{constructor(){super(...arguments),this.Object=Object,this.RestRequestTypesTranslationsMap=Pi}getDatasource(){return new j3}manageMapping(e,t){e&&e.stopPropagation();const n=ne(t);this.getMappingDialog(t,n?"action.apply":"action.add").afterClosed().pipe(de(this.destroyRef)).subscribe(e=>{if(e){if(n){const n=this.entityFormArray.value.findIndex(e=>JSON.stringify(e)===JSON.stringify(t));this.entityFormArray.at(n).patchValue(e)}else this.entityFormArray.push(this.fb.control(e));this.entityFormArray.markAsDirty()}})}deleteMapping(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:this.getRequestDetails(t)}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(de(this.destroyRef)).subscribe(e=>{if(e){const e=this.entityFormArray.value.findIndex(e=>JSON.stringify(e)===JSON.stringify(t));this.entityFormArray.removeAt(e),this.entityFormArray.markAsDirty()}})}updateTableData(e,t){t&&(e=e.filter(e=>{const n=this.getRequestDetails(e);return Object.values(e).some(e=>te(e)&&this.translate.instant(Pi.get(e)).toLowerCase().includes(t.toLowerCase())||n?.toLowerCase().includes(t.toLowerCase()))})),this.dataSource.loadData(e)}getRequestDetails(e){let t;switch(e.requestType){case"attributeUpdates":t=Object.values(e.requestValue.httpHeaders).join(", ");break;case"serverSideRpc":t=e.requestValue.methodFilter;break;default:t=e.requestValue.endpoint}return t}validate(){return null}getMappingDialog(e,t){return this.dialog.open(M3,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,defaultRequestUrl:this.defaultRequestUrl,withReportStrategy:this.withReportStrategy}})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(U3)))(n||U3)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:U3,selectors:[["tb-rest-request-mapping-table"]],inputs:{defaultRequestUrl:"defaultRequestUrl"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>U3),multi:!0},{provide:xe,useExisting:a(()=>U3),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:44,vars:39,consts:[["searchInput",""],["rowActions",""],["cellActionsMenu","matMenu"],[1,"tb-absolute-fill","size-full"],[1,"flex","size-full","flex-col"],[1,"gw-table-toolbar","mat-mdc-table-toolbar"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],["appearance","outline",1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"gw-connector-table"],["mat-table","",3,"dataSource"],[3,"matColumnDef"],["class","!w-1/3",4,"matHeaderCellDef"],["class","w-1/3",4,"matCellDef"],["class","w-1/3 !pl-0",4,"matHeaderCellDef"],["matColumnDef","actions","stickyEnd",""],["class","w-12",4,"matHeaderCellDef"],[4,"matCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],[4,"matRowDef","matRowDefColumns"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"title-container"],[1,"flex-1"],[1,"!w-1/3"],["tbTruncateWithTooltip",""],[1,"w-1/3"],[1,"w-1/3","!pl-0"],[1,"w-12"],[1,"lt-lg:!hidden","flex","min-w-24","flex-1","flex-row","items-stretch","justify-end","text-center"],[3,"ngTemplateOutlet"],[1,"gt-md:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",4)(2,"mat-toolbar",5),t.ɵɵconditionalCreate(3,P3,13,11,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"button",7),t.ɵɵpipe(7,"translate"),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",8)(11,"mat-label"),t.ɵɵtext(12," "),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",9,0),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵpipe(17,"translate"),t.ɵɵlistener("click",function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.exitFilterMode())}),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"table",12),t.ɵɵelementContainerStart(22,13),t.ɵɵtemplate(23,D3,4,3,"mat-header-cell",14)(24,A3,4,3,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,O3,3,3,"mat-header-cell",16)(27,N3,5,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,17),t.ɵɵtemplate(29,L3,1,0,"mat-header-cell",18)(30,q3,12,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(31,G3,1,0,"mat-header-row",20)(32,z3,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"section",22),t.ɵɵpipe(34,"async"),t.ɵɵelementStart(35,"button",23),t.ɵɵlistener("click",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))}),t.ɵɵelementStart(36,"mat-icon",24),t.ɵɵtext(37,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"span"),t.ɵɵtext(39),t.ɵɵpipe(40,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(41,"span",25),t.ɵɵpipe(42,"async"),t.ɵɵtext(43," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵconditional(!1===t.ɵɵpipeBind1(4,23,n.dataSource.isEmpty())?3:-1),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,25,"action.search"))),t.ɵɵadvance(7),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,27,"common.enter-search")))("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(17,29,"action.close"))),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("matColumnDef","type"),t.ɵɵadvance(3),t.ɵɵproperty("matColumnDef","details"),t.ɵɵadvance(6),t.ɵɵproperty("matHeaderRowDef",t.ɵɵpureFunction0(37,I3))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(38,I3)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(34,31,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(40,33,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(42,35,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(U3,[ce,C,Yn]),encapsulation:2,changeDetection:o.OnPush})}}class j3 extends j{constructor(){super()}}class H3 extends Wa{initBasicFormGroup(){return this.fb.group({server:[],mapping:[],requestsMapping:[]})}getRequestDataArray(e){const t=[];return re(e)&&Object.keys(e).forEach(n=>{for(const i of e[n])t.push({requestType:n,requestValue:i})}),t}getRequestDataObject(e){return e.reduce((e,{requestType:t,requestValue:n})=>(e[t]?.push(n),e),{attributeRequests:[],attributeUpdates:[],serverSideRpc:[]})}updateDefaultUrl({host:e,port:t,SSL:n}){this.defaultRequestUrl=e&&t?`${n?"https":"http"}//${e}:${t}/`:document.location.origin}writeValue(e){this.basicFormGroup.setValue(this.mapConfigToFormValue(e),{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(H3)))(n||H3)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:H3,features:[t.ɵɵInheritDefinitionFeature]})}}class W3 extends H3{mapConfigToFormValue(e){return{server:e.server??{},mapping:e.mapping??[],requestsMapping:this.getRequestDataArray(e.requestsMapping)}}getMappedValue(e){return this.updateDefaultUrl(e?.server??{}),{server:e.server??{},mapping:e.mapping??[],requestsMapping:this.getRequestDataObject(e.requestsMapping??[])}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(W3)))(n||W3)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:W3,selectors:[["tb-rest-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>W3),multi:!0},{provide:xe,useExisting:a(()=>W3),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:13,vars:19,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server"],["formControlName","mapping"],["formControlName","requestsMapping",3,"defaultRequestUrl"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-rest-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-rest-mapping-table",4),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-tab",1),t.ɵɵpipe(11,"translate"),t.ɵɵelement(12,"tb-rest-request-mapping-table",5),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,11,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,13,"gateway.server"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,15,"gateway.data-mapping"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,17,"gateway.requests-mapping"))),t.ɵɵadvance(2),t.ɵɵproperty("defaultRequestUrl",n.defaultRequestUrl))},dependencies:t.ɵɵgetComponentDepsFactory(W3,[ce,C,L0,_2,U3]),encapsulation:2,changeDetection:o.OnPush})}}class $3 extends H3{mapConfigToFormValue({attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}){return{server:{...a??{}},mapping:ir.mapMappingToUpgradedVersion(i),requestsMapping:this.getRequestDataArray({attributeRequests:e,attributeUpdates:t,serverSideRpc:n})}}getMappedValue({requestsMapping:e,mapping:t=[],server:n={}}){this.updateDefaultUrl(n);const{attributeRequests:i=[],attributeUpdates:a=[],serverSideRpc:r=[]}=this.getRequestDataObject(e);return{...n,mapping:ir.mapMappingToDowngradedVersion(t),attributeRequests:i,attributeUpdates:a,serverSideRpc:r}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory($3)))(n||$3)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:$3,selectors:[["tb-rest-legacy-basic-config"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>$3),multi:!0},{provide:xe,useExisting:a(()=>$3),multi:!0}]),t.ɵɵInheritDefinitionFeature],decls:13,vars:19,consts:[[3,"formGroup"],[3,"label"],[3,"ngTemplateOutlet"],["formControlName","server"],["formControlName","mapping"],["formControlName","requestsMapping",3,"defaultRequestUrl"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"mat-tab-group",0)(1,"mat-tab",1),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,2),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",1),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-rest-server-config",3),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-tab",1),t.ɵɵpipe(8,"translate"),t.ɵɵelement(9,"tb-rest-mapping-table",4),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-tab",1),t.ɵɵpipe(11,"translate"),t.ɵɵelement(12,"tb-rest-request-mapping-table",5),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,11,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,13,"gateway.server"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(8,15,"gateway.data-mapping"),"*")),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,17,"gateway.requests-mapping"))),t.ɵɵadvance(2),t.ɵɵproperty("defaultRequestUrl",n.defaultRequestUrl))},dependencies:t.ɵɵgetComponentDepsFactory($3,[ce,C,L0,_2,U3]),encapsulation:2,changeDetection:o.OnPush})}}const K3=(e,t)=>({hasErrors:e,noErrors:t}),Y3=()=>({minWidth:"144px",maxWidth:"144px",textAlign:"center"}),X3=()=>({minWidth:"144px",maxWidth:"144px",width:"144px",textAlign:"center"}),Z3=e=>({"tb-current-entity":e});function Q3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",31),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"async"),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onAddConnector(n))}),t.ɵɵelementStart(3,"mat-icon"),t.ɵɵtext(4,"add"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,3,"action.add")))("disabled",t.ɵɵpipeBind1(2,5,e.isLoading$))}}function J3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",7)(1,"button",32),t.ɵɵlistener("click",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onAddConnector(n))}),t.ɵɵelementStart(2,"mat-icon",33),t.ɵɵtext(3,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"span"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,1,"gateway.add-connector")))}function e5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",34),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-enabled")," "))}function t5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"mat-slide-toggle",35),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return n.stopPropagation(),t.ɵɵresetView(a.onEnableConnector(i))}),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("checked",i.activeConnectors.includes(e.key))}}function n5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",36),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-name")))}function i5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.key," ")}}function a5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",37),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-type")," "))}function r5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.returnType(e)," ")}}function o5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",37),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration")," "))}function s5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",38)(1,"div",39),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(i.isConnectorSynced(e)?"status-sync":"status-unsync"),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.isConnectorSynced(e)?"sync":"out of sync"," ")}}function l5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",37),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-status")," "))}function p5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell",38)(1,"span",40),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))}),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction2(4,K3,+i.getErrorsCount(e)>0,0===+i.getErrorsCount(e)||""===i.getErrorsCount(e))),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate("Errors: "+i.getErrorsCount(e)))}}function c5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell"),t.ɵɵelement(1,"div",41),t.ɵɵelementStart(2,"div",42),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,Y3)),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.connectors-table-actions")))}function d5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"div",43)(2,"button",44),t.ɵɵpipe(3,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))}),t.ɵɵelementStart(4,"mat-icon"),t.ɵɵtext(5,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"button",45),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))}),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",45),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))}),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"div",46)(15,"button",47),t.ɵɵlistener("click",function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())}),t.ɵɵelementStart(16,"mat-icon",48),t.ɵɵtext(17,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"mat-menu",49,1)(20,"button",44),t.ɵɵpipe(21,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))}),t.ɵɵelementStart(22,"mat-icon"),t.ɵɵtext(23,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",45),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))}),t.ɵɵelementStart(26,"mat-icon"),t.ɵɵtext(27,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"button",45),t.ɵɵpipe(29,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))}),t.ɵɵelementStart(30,"mat-icon"),t.ɵɵtext(31,"delete"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,i=t.ɵɵreference(19);t.ɵɵadvance(),t.ɵɵstyleMap(t.ɵɵpureFunction0(23,X3)),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(3,11,"gateway.rpc.rpc"))("disabled",!e.value.configurationJson.id),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(7,13,"gateway.logs.logs")),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,15,"gateway.delete-connector")),t.ɵɵadvance(5),t.ɵɵproperty("matMenuTriggerFor",i),t.ɵɵadvance(5),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(21,17,"gateway.rpc.rpc"))("disabled",!e.value.configurationJson.id),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(25,19,"gateway.logs.logs")),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(29,21,"gateway.delete-connector"))}}function u5(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",50)}function m5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-row",51),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.selectConnector(n,i))}),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction1(2,Z3,i.isSameConnector(e)))}}function h5(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",26),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1("v",e.connectorForm.get("configVersion").value)}}function g5(e,n){1&e&&t.ɵɵelement(0,"div",27),2&e&&t.ɵɵproperty("tb-help",n)}function f5(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-select",28)(1,"tb-toggle-option",52),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-option",52),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("value",e.ConnectorConfigurationModes.BASIC),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,4,"gateway.basic")," "),t.ɵɵadvance(2),t.ɵɵproperty("value",e.ConnectorConfigurationModes.ADVANCED),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,6,"gateway.advanced")," ")}}function y5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function v5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-legacy-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function x5(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,y5,2,4,"tb-mqtt-basic-config",55),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵconditionalBranchCreate(2,v5,2,4,"tb-mqtt-legacy-basic-config",55)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)?0:2)}}function b5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function w5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-legacy-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function S5(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,b5,2,4,"tb-opc-ua-basic-config",55),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵconditionalBranchCreate(2,w5,2,4,"tb-opc-ua-legacy-basic-config",55)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.OPCUA)?0:2)}}function C5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-basic-config",58),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function _5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-legacy-basic-config",58),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function T5(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,C5,1,1,"tb-modbus-basic-config",57),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵconditionalBranchCreate(2,_5,1,1,"tb-modbus-legacy-basic-config",57)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.MODBUS)?0:2)}}function E5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-basic-config",58),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function M5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-legacy-basic-config",58),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){t.ɵɵnextContext(4);const e=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",e)}}function I5(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,E5,1,1,"tb-socket-basic-config",57),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵconditionalBranchCreate(2,M5,1,1,"tb-socket-legacy-basic-config",57)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.SOCKET)?0:2)}}function k5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function P5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-legacy-basic-config",56),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function D5(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,k5,2,4,"tb-bacnet-basic-config",55),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵconditionalBranchCreate(2,P5,2,4,"tb-bacnet-legacy-basic-config",55)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.BACNET)?0:2)}}function A5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-basic-config",60),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function O5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-legacy-basic-config",60),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(4);return t.ɵɵresetView(n.basicConfigInitSubject.next())}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(4),n=t.ɵɵreference(42);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function R5(e,n){if(1&e&&(t.ɵɵconditionalCreate(0,A5,2,4,"tb-rest-basic-config",59),t.ɵɵpipe(1,"isLatestVersionConfig"),t.ɵɵconditionalBranchCreate(2,O5,2,4,"tb-rest-legacy-basic-config",59)),2&e){const e=t.ɵɵnextContext(3);t.ɵɵconditional(t.ɵɵpipeBind2(1,1,e.connectorForm.get("configVersion").value,e.ConnectorType.REST)?0:2)}}function B5(e,n){if(1&e&&t.ɵɵconditionalCreate(0,x5,3,4)(1,S5,3,4)(2,T5,3,4)(3,I5,3,4)(4,D5,3,4)(5,R5,3,4),2&e){let e;const n=t.ɵɵnextContext(2);t.ɵɵconditional((e=n.initialConnector.type)===n.ConnectorType.MQTT?0:e===n.ConnectorType.OPCUA?1:e===n.ConnectorType.MODBUS?2:e===n.ConnectorType.SOCKET?3:e===n.ConnectorType.BACNET?4:e===n.ConnectorType.REST?5:-1)}}function F5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group")(1,"mat-tab",61),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,62),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",61),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-json-object-edit",63),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(42);t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,8,"gateway.general"))),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(),t.ɵɵproperty("label",t.ɵɵinterpolate1("",t.ɵɵpipeBind1(5,10,"gateway.configuration"),"*")),t.ɵɵadvance(2),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,12,"gateway.configuration")))("fillHeight",!0)}}function N5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",30),t.ɵɵconditionalCreate(1,B5,6,1)(2,F5,8,14,"mat-tab-group"),t.ɵɵelementStart(3,"div",53)(4,"button",54),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onSaveConnector())}),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵconditional((null==(e=n.connectorForm.get("mode"))?null:e.value)===n.ConnectorConfigurationModes.BASIC?1:2),t.ɵɵadvance(3),t.ɵɵproperty("disabled",!n.connectorForm.dirty||n.connectorForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,3,"action.save")," ")}}function L5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",70),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.connectorForm.get("name").hasError("duplicateName")?"gateway.connector-duplicate-name":"gateway.name-required"))}}function V5(e,n){1&e&&(t.ɵɵelementStart(0,"div",65)(1,"div",75),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",67)(4,"mat-form-field",68),t.ɵɵelement(5,"input",78),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,2,"gateway.set"))))}function q5(e,n){1&e&&(t.ɵɵelementStart(0,"div",65)(1,"div",75),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",67)(4,"mat-form-field",68),t.ɵɵelement(5,"input",79),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,2,"gateway.set"))))}function G5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function z5(e,n){1&e&&(t.ɵɵelementStart(0,"div",65)(1,"mat-slide-toggle",80)(2,"mat-label",81),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,3,"gateway.send-change-data-hint"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,5,"gateway.send-change-data")," "))}function U5(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",77),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Connector)}}function j5(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",64)(1,"div",65)(2,"div",66),t.ɵɵtext(3,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",67)(5,"mat-form-field",68),t.ɵɵelement(6,"input",69),t.ɵɵpipe(7,"translate"),t.ɵɵconditionalCreate(8,L5,3,3,"mat-icon",70),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(9,V5,7,4,"div",65),t.ɵɵconditionalCreate(10,q5,7,4,"div",65),t.ɵɵelementStart(11,"div",71)(12,"div",72),t.ɵɵtext(13,"gateway.logs-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",73)(15,"mat-slide-toggle",74)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",65)(20,"div",75),t.ɵɵtext(21,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",67)(23,"mat-form-field",68)(24,"mat-select",76),t.ɵɵrepeaterCreate(25,G5,2,2,"mat-option",52,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()()(),t.ɵɵconditionalCreate(27,z5,6,7,"div",65),t.ɵɵpipe(28,"withReportStrategy"),t.ɵɵconditionalCreate(29,U5,1,2,"tb-report-strategy",77),t.ɵɵpipe(30,"withReportStrategy"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.connectorForm),t.ɵɵadvance(6),t.ɵɵproperty("placeholder",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,9,"gateway.set"))),t.ɵɵadvance(2),t.ɵɵconditional(e.connectorForm.get("name").hasError("required")&&e.connectorForm.get("name").touched||e.connectorForm.get("name").hasError("duplicateName")?8:-1),t.ɵɵadvance(),t.ɵɵconditional(e.connectorForm.get("type").value===e.ConnectorType.CUSTOM?9:-1),t.ɵɵadvance(),t.ɵɵconditional(e.connectorForm.get("type").value===e.ConnectorType.GRPC?10:-1),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.enable-remote-logging")," "),t.ɵɵadvance(8),t.ɵɵrepeater(e.gatewayLogLevel),t.ɵɵadvance(2),t.ɵɵconditional(e.connectorForm.get("type").value!==e.ConnectorType.MQTT||t.ɵɵpipeBind2(28,13,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)?-1:27),t.ɵɵadvance(2),t.ɵɵconditional(t.ɵɵpipeBind2(30,16,e.connectorForm.get("configVersion").value,e.connectorForm.get("type").value)?29:-1)}}class H5{isErrorState(e){return e&&e.invalid}}e("ForceErrorStateMatcher",H5);class W5 extends U{constructor(e,t,n,i,a,r,o,s,l,p,c){super(e),this.store=e,this.fb=t,this.translate=n,this.attributeService=i,this.dialogService=a,this.dialog=r,this.telemetryWsService=o,this.zone=s,this.utils=l,this.withReportStrategy=p,this.cd=c,this.ConnectorType=gt,this.allowBasicConfig=new Set([gt.MQTT,gt.OPCUA,gt.MODBUS,gt.SOCKET,gt.BACNET,gt.REST]),this.gatewayLogLevel=Object.values(mt),this.displayedColumns=["enabled","key","type","syncStatus","errors","actions"],this.GatewayConnectorTypesTranslatesMap=ft,this.ConnectorConfigurationModes=pn,this.ReportStrategyDefaultValue=dn,this.connectorHelpLinksMap=yt,this.basicConfigInitSubject=new _e,this.activeData=[],this.inactiveData=[],this.sharedAttributeData=[],this.subscriptionOptions={callbacks:{onDataUpdated:()=>this.ctx.ngZone.run(()=>{this.onErrorsUpdated()}),onDataUpdateError:(e,t)=>this.ctx.ngZone.run(()=>{this.onDataUpdateError(t)})}},this.destroy$=new _e,this.attributeUpdateSubject=new _e,this.initDataSources(),this.initConnectorForm(),this.observeAttributeChange()}ngAfterViewInit(){this.dataSource.sort=this.sort,this.dataSource.sortingDataAccessor=this.getSortingDataAccessor(),this.ctx.$scope.gatewayConnectors=this,this.loadConnectors(),this.loadGatewayState(),this.observeModeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}onSaveConnector(){this.saveConnector(this.getUpdatedConnectorData(this.connectorForm.value),!1)}saveConnector(e,t=!0){const n=t||this.activeConnectors.includes(this.initialConnector.name)?P.SHARED_SCOPE:P.SERVER_SCOPE;Pe(this.getEntityAttributeTasks(e,n)).pipe(Ge(1)).subscribe(n=>{this.showToast(t?this.translate.instant("gateway.connector-created"):this.translate.instant("gateway.connector-updated")),this.initialConnector=e,this.updateData(!0),this.connectorForm.markAsPristine()})}getEntityAttributeTasks(e,t){const n=[],i=[{key:e.name,value:e}],a=[],r=!this.activeConnectors.includes(e.name)&&t===P.SHARED_SCOPE||!this.inactiveConnectors.includes(e.name)&&t===P.SERVER_SCOPE,o=this.initialConnector&&this.initialConnector.name!==e.name;return o&&(a.push({key:this.initialConnector.name}),this.removeConnectorFromList(this.initialConnector.name,!0),this.removeConnectorFromList(this.initialConnector.name,!1)),r&&(t===P.SHARED_SCOPE?this.activeConnectors.push(e.name):this.inactiveConnectors.push(e.name)),(o||r)&&n.push(this.getSaveEntityAttributesTask(t)),n.push(this.attributeService.saveEntityAttributes(this.device,t,i)),a.length&&n.push(this.attributeService.deleteEntityAttributes(this.device,t,a)),n}getSaveEntityAttributesTask(e){const t=e===P.SHARED_SCOPE?"active_connectors":"inactive_connectors",n=e===P.SHARED_SCOPE?this.activeConnectors:this.inactiveConnectors;return this.attributeService.saveEntityAttributes(this.device,e,[{key:t,value:n}])}removeConnectorFromList(e,t){const n=t?this.activeConnectors:this.inactiveConnectors,i=n.indexOf(e);-1!==i&&n.splice(i,1)}getUpdatedConnectorData(e){const t={...e};return t.configuration=`${se(t.name)}.json`,delete t.basicConfig,t.type!==gt.GRPC&&delete t.key,t.type!==gt.CUSTOM&&delete t.class,this.allowBasicConfig.has(t.type)||delete t.mode,this.withReportStrategy.transform(t.configVersion,t.type)&&(t.configurationJson.reportStrategy=t.reportStrategy,le(t.reportStrategy)&&delete t.reportStrategy,le(t.configurationJson.reportStrategy)&&delete t.configurationJson.reportStrategy),this.gatewayVersion&&!t.configVersion&&(t.configVersion=this.gatewayVersion),t.ts=Date.now(),t}updateData(e=!1){this.pageLink.sortOrder.property=this.sort.active,this.pageLink.sortOrder.direction=x[this.sort.direction.toUpperCase()],this.attributeDataSource.loadAttributes(this.device,P.CLIENT_SCOPE,this.pageLink,e).subscribe(e=>{this.activeData=e.data.filter(e=>this.activeConnectors.includes(e.key)),this.combineData(),this.generateSubscription(),this.setClientData(e)}),this.inactiveConnectorsDataSource.loadAttributes(this.device,P.SHARED_SCOPE,this.pageLink,e).subscribe(e=>{this.sharedAttributeData=e.data.filter(e=>this.activeConnectors.includes(e.key)),this.combineData()}),this.serverDataSource.loadAttributes(this.device,P.SERVER_SCOPE,this.pageLink,e).subscribe(e=>{this.inactiveData=e.data.filter(e=>this.inactiveConnectors.includes(e.key)),this.combineData()})}isConnectorSynced(e){const t=e.value;if(!t.ts||e.skipSync||!this.isGatewayActive)return!1;if(-1===this.activeData.findIndex(e=>("string"==typeof e.value?JSON.parse(e.value):e.value).name===t.name))return!1;return-1!==this.sharedAttributeData.findIndex(e=>{const n=e.value,i=n.name===t.name,a=Y(n.configurationJson,{})&&i,r=this.hasSameConfig(n.configurationJson,t.configurationJson),o=n.ts&&n.ts<=t.ts;return i&&o&&(r||a)})}hasSameConfig(e,t){const{name:n,id:i,enableRemoteLogging:a,logLevel:r,reportStrategy:o,configVersion:s,...l}=e,{name:p,id:c,enableRemoteLogging:d,logLevel:u,reportStrategy:m,configVersion:h,...g}=t;return Y(l,g)}combineData(){const e=[...this.activeData,...this.inactiveData,...this.sharedAttributeData].reduce((e,t)=>{const n=e.findIndex(e=>e.key===t.key);return-1===n?e.push(t):t.lastUpdateTs>e[n].lastUpdateTs&&!this.isConnectorSynced(e[n])&&(e[n]={...t,skipSync:!0}),e},[]);this.dataSource.data=e.map(e=>({...e,value:"string"==typeof e.value?JSON.parse(e.value):e.value}))}clearOutConnectorForm(){this.initialConnector=null,this.connectorForm.setValue({mode:pn.BASIC,name:"",type:gt.MQTT,sendDataOnlyOnChange:!1,enableRemoteLogging:!1,logLevel:mt.INFO,key:"auto",class:"",configuration:"",configurationJson:{},basicConfig:{},configVersion:"",reportStrategy:[{value:{},disabled:!0}]},{emitEvent:!1}),this.connectorForm.markAsPristine()}selectConnector(e,t){e&&e.stopPropagation();const n=t.value;n?.name!==this.initialConnector?.name&&this.confirmConnectorChange().subscribe(e=>{e&&this.setFormValue(n)})}isSameConnector(e){if(!this.initialConnector)return!1;const t=e.value;return this.initialConnector.name===t.name}showToast(e){this.store.dispatch({type:"[Notification] Show",notification:{message:e,type:"success",duration:1e3,verticalPosition:"top",horizontalPosition:"left",target:"dashboardRoot",forceDismiss:!0}})}returnType(e){const t=e.value;return this.GatewayConnectorTypesTranslatesMap.get(t.type)}deleteConnector(e,t){t?.stopPropagation();const n=`Delete connector "${e.key}"?`;this.dialogService.confirm(n,"All connector data will be deleted.","Cancel","Delete").pipe(Ge(1),Ue(t=>{if(!t)return;const n=[],i=this.activeConnectors.includes(e.value?.name)?P.SHARED_SCOPE:P.SERVER_SCOPE;return n.push(this.attributeService.deleteEntityAttributes(this.device,i,[e])),this.removeConnectorFromList(e.key,!0),this.removeConnectorFromList(e.key,!1),n.push(this.getSaveEntityAttributesTask(i)),Pe(n)})).subscribe(()=>{this.initialConnector&&this.initialConnector.name!==e.key||(this.clearOutConnectorForm(),this.cd.detectChanges()),this.updateData(!0)})}connectorLogs(e,t){t&&t.stopPropagation();const n=ae(this.ctx.stateController.getStateParams());n.connector_logs=e,n.targetEntityParamName="connector_logs",this.ctx.stateController.openState("connector_logs",n)}connectorRpc(e,t){t&&t.stopPropagation();const n=ae(this.ctx.stateController.getStateParams());n.connector_rpc=e,n.targetEntityParamName="connector_rpc",this.ctx.stateController.openState("connector_rpc",n)}onEnableConnector(e){e.value.ts=(new Date).getTime(),this.updateActiveConnectorKeys(e.key),this.attributeUpdateSubject.next(e)}getErrorsCount(e){const t=e.key,n=this.subscription&&this.subscription.data.find(e=>e&&e.dataKey.name===`${t}_ERRORS_COUNT`);return n&&this.activeConnectors.includes(t)?n.data[0][1]||0:"Inactive"}onAddConnector(e){e?.stopPropagation(),this.confirmConnectorChange().pipe(Ge(1),Be(Boolean),Ue(()=>this.openAddConnectorDialog()),Be(Boolean)).subscribe(e=>this.addConnector(e))}addConnector(e){e.configurationJson||(e.configurationJson={}),this.gatewayVersion&&!e.configVersion&&(e.configVersion=this.gatewayVersion),e.basicConfig=e.configurationJson,this.initialConnector=e;const t=this.connectorForm.get("type").value;this.setInitialConnectorValues(e),this.saveConnector(this.getUpdatedConnectorData(e)),t!==e.type&&this.allowBasicConfig.has(e.type)?this.basicConfigInitSubject.pipe(Ge(1)).subscribe(()=>{this.patchConnectorBasicConfig(e.basicConfig)}):this.patchConnectorBasicConfig(e.basicConfig)}setInitialConnectorValues(e){const{basicConfig:t,mode:n,enableRemoteLogging:i,...a}=e;this.toggleReportStrategy(e),this.connectorForm.get("mode").setValue(this.allowBasicConfig.has(e.type)?e.mode??pn.BASIC:null,{emitEvent:!1}),this.connectorForm.get("enableRemoteLogging").setValue(i,{emitEvent:!1}),this.connectorForm.patchValue(a,{emitEvent:!1})}openAddConnectorDialog(){return this.ctx.ngZone.run(()=>this.dialog.open(yK,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{dataSourceData:this.dataSource.data,gatewayVersion:this.gatewayVersion}}).afterClosed())}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=this.dataSource.data.some(e=>e.value.name.toLowerCase()===t),i=this.initialConnector?.name.toLowerCase()===t;return n&&!i?{duplicateName:{valid:!1}}:null}}initDataSources(){const e={property:"key",direction:x.ASC};this.pageLink=new b(1e3,0,null,e),this.attributeDataSource=new Zn(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.inactiveConnectorsDataSource=new Zn(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.serverDataSource=new Zn(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.dataSource=new f([])}initConnectorForm(){this.connectorForm=this.fb.group({mode:[pn.BASIC],name:["",[ve.required,this.uniqNameRequired(),ve.pattern(hn)]],type:["",[ve.required]],enableRemoteLogging:[!1],logLevel:["",[ve.required]],sendDataOnlyOnChange:[!1],key:["auto"],class:[""],configuration:[""],configurationJson:[{},[ve.required]],basicConfig:[{}],configVersion:[""],reportStrategy:[{value:{},disabled:!0}]})}getSortingDataAccessor(){return(e,t)=>{switch(t){case"syncStatus":return this.isConnectorSynced(e)?1:0;case"enabled":return this.activeConnectors.includes(e.key)?1:0;case"errors":const n=this.getErrorsCount(e);return"string"==typeof n?this.sort.direction.toUpperCase()===x.DESC?-1:1/0:n;default:return e[t]||e.value[t]}}}loadConnectors(){this.device&&this.device.id!==O&&Pe([this.attributeService.getEntityAttributes(this.device,P.SHARED_SCOPE,["active_connectors"]),this.attributeService.getEntityAttributes(this.device,P.SERVER_SCOPE,["inactive_connectors"]),this.attributeService.getEntityAttributes(this.device,P.CLIENT_SCOPE,["Version"])]).pipe(Ne(this.destroy$)).subscribe(e=>{this.activeConnectors=this.parseConnectors(e[0]),this.inactiveConnectors=this.parseConnectors(e[1]),this.gatewayVersion=e[2][0]?.value,this.updateData(!0)})}loadGatewayState(){this.attributeService.getEntityAttributes(this.device,P.SERVER_SCOPE).pipe(Ne(this.destroy$)).subscribe(e=>{const t=e.find(e=>"active"===e.key).value,n=e.find(e=>"lastDisconnectTime"===e.key)?.value,i=e.find(e=>"lastConnectTime"===e.key)?.value;this.isGatewayActive=this.getGatewayStatus(t,i,n)})}parseConnectors(e){const t=e?.[0]?.value||[];return te(t)?JSON.parse(t):t}observeModeChange(){this.connectorForm.get("mode").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{e===pn.BASIC&&this.patchConnectorBasicConfig(this.connectorForm.get("configurationJson").value)})}observeAttributeChange(){this.attributeUpdateSubject.pipe(Re(300),Fe(e=>this.executeAttributeUpdates(e)),Ne(this.destroy$)).subscribe()}updateActiveConnectorKeys(e){if(this.activeConnectors.includes(e)){const t=this.activeConnectors.indexOf(e);-1!==t&&this.activeConnectors.splice(t,1),this.inactiveConnectors.push(e)}else{const t=this.inactiveConnectors.indexOf(e);-1!==t&&this.inactiveConnectors.splice(t,1),this.activeConnectors.push(e)}}executeAttributeUpdates(e){Pe(this.getAttributeExecutionTasks(e)).pipe(Ge(1),Fe(()=>this.updateData(!0)),Ne(this.destroy$)).subscribe()}getAttributeExecutionTasks(e){const t=this.activeConnectors.includes(e.key),n=t?P.SERVER_SCOPE:P.SHARED_SCOPE,i=t?P.SHARED_SCOPE:P.SERVER_SCOPE;return[this.attributeService.saveEntityAttributes(this.device,P.SHARED_SCOPE,[{key:"active_connectors",value:this.activeConnectors}]),this.attributeService.saveEntityAttributes(this.device,P.SERVER_SCOPE,[{key:"inactive_connectors",value:this.inactiveConnectors}]),this.attributeService.deleteEntityAttributes(this.device,n,[e]),this.attributeService.saveEntityAttributes(this.device,i,[e])]}onDataUpdateError(e){const t=this.utils.parseException(e);let n=t.name;t.message&&(n+=": "+t.message),console.error(n)}onErrorsUpdated(){this.cd.detectChanges()}onDataUpdated(){const e=this.ctx.defaultSubscription.data,t=e.find(e=>"active"===e.dataKey.name).data[0][1],n=e.find(e=>"lastDisconnectTime"===e.dataKey.name).data[0][1],i=e.find(e=>"lastConnectTime"===e.dataKey.name).data[0][1];this.isGatewayActive=this.getGatewayStatus(t,i,n),this.cd.detectChanges()}getGatewayStatus(e,t,n){return!!e&&(!n||t>n)}generateSubscription(){if(this.subscription&&this.subscription.unsubscribe(),this.device){const e=[{type:B.entity,entityType:R.DEVICE,entityId:this.device.id,entityName:"Gateway",timeseries:[]}];this.dataSource.data.forEach(t=>{e[0].timeseries.push({name:`${t.key}_ERRORS_COUNT`,label:`${t.key}_ERRORS_COUNT`})}),this.ctx.subscriptionApi.createSubscriptionFromInfo(S.latest,e,this.subscriptionOptions,!1,!0).subscribe(e=>{this.subscription=e})}}createBasicConfigWatcher(){this.basicConfigSub&&this.basicConfigSub.unsubscribe(),this.basicConfigSub=this.connectorForm.get("basicConfig").valueChanges.pipe(Be(()=>!!this.initialConnector),Ne(this.destroy$)).subscribe(e=>{const t=this.connectorForm.get("configurationJson"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;if(!Y(e,t?.value)&&this.allowBasicConfig.has(n)&&i===pn.BASIC){const n={...t.value,...e};this.connectorForm.get("configurationJson").patchValue(n,{emitEvent:!1})}})}createJsonConfigWatcher(){this.jsonConfigSub&&this.jsonConfigSub.unsubscribe(),this.jsonConfigSub=this.connectorForm.get("configurationJson").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{const t=this.connectorForm.get("basicConfig"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;!Y(e,t?.value)&&this.allowBasicConfig.has(n)&&i===pn.ADVANCED&&this.connectorForm.get("basicConfig").patchValue(e,{emitEvent:!1})})}confirmConnectorChange(){return this.initialConnector&&this.connectorForm.dirty?this.dialogService.confirm(this.translate.instant("gateway.change-connector-title"),this.translate.instant("gateway.change-connector-text"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0):Ie(!0)}setFormValue(e){this.connectorForm.disabled&&this.connectorForm.enable();const t=Qa.getConfig({configuration:"",key:"auto",configurationJson:{},...e},this.gatewayVersion);this.gatewayVersion&&!t.configVersion&&(t.configVersion=this.gatewayVersion),t.basicConfig=t.configurationJson,this.initialConnector=t,this.updateConnector(t)}updateConnector(e){this.jsonConfigSub?.unsubscribe(),this.allowBasicConfig.has(e.type)?this.updateBasicConfigConnector(e):(this.setInitialConnectorValues(e),this.connectorForm.markAsPristine(),this.createJsonConfigWatcher())}updateBasicConfigConnector(e){this.basicConfigSub?.unsubscribe();const t=this.connectorForm.get("type").value;this.setInitialConnectorValues(e),t!==e.type&&this.allowBasicConfig.has(e.type)&&e.mode!==pn.ADVANCED?this.basicConfigInitSubject.asObservable().pipe(Ge(1)).subscribe(()=>{this.patchConnectorBasicConfig(e.basicConfig)}):this.patchConnectorBasicConfig(e.basicConfig)}patchConnectorBasicConfig(e){this.connectorForm.get("basicConfig").patchValue(e,{emitEvent:!1}),this.connectorForm.markAsPristine(),this.createBasicConfigWatcher(),this.createJsonConfigWatcher()}toggleReportStrategy(e){const t=this.connectorForm.get("reportStrategy"),n=this.connectorForm.get("sendDataOnlyOnChange");this.connectorForm.get("reportStrategy").reset(e.reportStrategy,{emitEvent:!1}),this.withReportStrategy.transform(e.configVersion,e.type)?(t.enable({emitEvent:!1}),n.disable({emitEvent:!1})):(t.disable({emitEvent:!1}),e.type===gt.MQTT&&n.enable({emitEvent:!1}))}setClientData(e){if(this.initialConnector){const t=e.data.find(e=>e.key===this.initialConnector.name);t&&(t.value="string"==typeof t.value?JSON.parse(t.value):t.value,this.isConnectorSynced(t)&&t.value.configurationJson&&this.setFormValue({...t.value,mode:this.connectorForm.get("mode").value??t.value.mode}))}}static{this.ɵfac=function(e){return new(e||W5)(t.ɵɵdirectiveInject(et.Store),t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(me.TranslateService),t.ɵɵdirectiveInject(Z.AttributeService),t.ɵɵdirectiveInject(Z.DialogService),t.ɵɵdirectiveInject(Ke.MatDialog),t.ɵɵdirectiveInject(Z.TelemetryWebsocketService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(Z.UtilsService),t.ɵɵdirectiveInject(ar),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:W5,selectors:[["tb-gateway-connector"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(g,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.sort=e.first)}},inputs:{ctx:"ctx",device:"device"},features:[t.ɵɵProvidersFeature([{provide:dt,useClass:H5},ar]),t.ɵɵInheritDefinitionFeature],decls:43,vars:22,consts:[["generalTabContent",""],["cellActionsMenu","matMenu"],[1,"connector-container","tb-form-panel","no-border"],[1,"table-section","tb-form-panel","no-padding","section-container","flex"],[1,"mat-mdc-table-toolbar","justify-between"],["mat-icon-button","","matTooltipPosition","above",3,"disabled","matTooltip"],[1,"table-container"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["mat-table","","matSort","","matSortDisableClear","",3,"dataSource","matSortActive","matSortDirection"],["matColumnDef","enabled","sticky",""],["style","width: 60px;min-width: 60px;",4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","key"],["mat-sort-header","","style","width: 40%",4,"matHeaderCellDef"],["matColumnDef","type"],["mat-sort-header","","style","width: 30%",4,"matHeaderCellDef"],["style","text-transform: uppercase",4,"matCellDef"],["matColumnDef","syncStatus"],["matColumnDef","errors"],["matColumnDef","actions","stickyEnd",""],[4,"matHeaderCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","mat-row-select",3,"class","click",4,"matRowDef","matRowDefColumns"],[1,"tb-form-panel","section-container","flex",3,"formGroup"],[1,"tb-form-panel-title","tb-flex","no-flex","space-between","align-center"],[1,"tb-form-panel-title","tb-flex","no-flex","align-center"],[1,"version-placeholder"],[3,"tb-help"],["formControlName","mode","appearance","fill"],["translate","",1,"no-data-found","items-center","justify-center"],[1,"tb-form-panel","section-container","no-border","no-padding","tb-flex","space-between"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],["mat-button","",1,"connector",3,"click"],[1,"tb-mat-96"],[2,"width","60px","min-width","60px"],[3,"click","checked"],["mat-sort-header","",2,"width","40%"],["mat-sort-header","",2,"width","30%"],[2,"text-transform","uppercase"],[1,"status"],["matTooltipPosition","above",1,"dot",3,"click","matTooltip"],[1,"gt-md:!hidden",2,"width","48px","min-width","48px","max-width","48px"],[1,"lt-lg:!hidden"],[1,"lt-md:!hidden","flex-row","justify-end"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip","disabled"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"gt-sm:!hidden"],["mat-icon-button","",3,"click","matMenuTriggerFor"],[1,"material-icons"],["xPosition","before"],[1,"mat-row-select"],[1,"mat-row-select",3,"click"],[3,"value"],[1,"flex","justify-end"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],["formControlName","basicConfig",3,"generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"initialized","generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"generalTabContent"],["formControlName","basicConfig",3,"initialized","generalTabContent"],["formControlName","basicConfig",1,"h-full",3,"generalTabContent","withReportStrategy"],["formControlName","basicConfig",1,"h-full",3,"initialized","generalTabContent","withReportStrategy"],[3,"label"],[3,"ngTemplateOutlet"],["jsonRequired","","formControlName","configurationJson",1,"configuration-json",3,"fillHeight","label"],[1,"tb-form-panel","no-border","no-padding","padding-top","section-container","flex",3,"formGroup"],[1,"tb-form-row","column-xs"],["translate","",1,"fixed-title-width","tb-required"],[1,"tb-flex","no-gap"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row"],["formControlName","enableRemoteLogging",1,"mat-slide"],["translate","",1,"fixed-title-width"],["formControlName","logLevel"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[3,"tb-hint-tooltip-icon"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",2)(1,"section",3)(2,"mat-toolbar",4)(3,"h2"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(6,Q3,5,7,"button",5),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",6),t.ɵɵconditionalCreate(8,J3,7,3,"section",7),t.ɵɵelementStart(9,"table",8),t.ɵɵelementContainerStart(10,9),t.ɵɵtemplate(11,e5,3,3,"mat-header-cell",10)(12,t5,2,1,"mat-cell",11),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,12),t.ɵɵtemplate(14,n5,3,3,"mat-header-cell",13)(15,i5,2,1,"mat-cell",11),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(16,14),t.ɵɵtemplate(17,a5,3,3,"mat-header-cell",15)(18,r5,2,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(19,17),t.ɵɵtemplate(20,o5,3,3,"mat-header-cell",15)(21,s5,3,3,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(22,18),t.ɵɵtemplate(23,l5,3,3,"mat-header-cell",15)(24,p5,2,7,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,19),t.ɵɵtemplate(26,c5,5,6,"mat-header-cell",20)(27,d5,32,24,"mat-cell",11),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,u5,1,0,"mat-header-row",21)(29,m5,1,4,"mat-row",22),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"section",23)(31,"div",24)(32,"div",25),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵconditionalCreate(35,h5,2,1,"span",26),t.ɵɵconditionalCreate(36,g5,1,1,"div",27),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(37,f5,7,8,"tb-toggle-select",28),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"span",29),t.ɵɵtext(39," gateway.select-connector "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(40,N5,7,5,"section",30),t.ɵɵelementEnd()(),t.ɵɵtemplate(41,j5,31,19,"ng-template",null,0,t.ɵɵtemplateRefExtractor)),2&e){let e;t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,18,"gateway.connectors")),t.ɵɵadvance(2),t.ɵɵconditional(null!=n.dataSource&&(null!=n.dataSource.data&&n.dataSource.data.length)?6:-1),t.ɵɵadvance(2),t.ɵɵconditional(null!=n.dataSource&&null!=n.dataSource.data&&n.dataSource.data.length?-1:8),t.ɵɵadvance(),t.ɵɵproperty("dataSource",n.dataSource)("matSortActive",n.pageLink.sortOrder.property)("matSortDirection",n.pageLink.sortDirection()),t.ɵɵadvance(19),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate2(" ",null!=n.initialConnector&&n.initialConnector.type?n.GatewayConnectorTypesTranslatesMap.get(n.initialConnector.type):""," ",t.ɵɵpipeBind1(34,20,"gateway.configuration")," "),t.ɵɵadvance(2),t.ɵɵconditional(n.connectorForm.get("configVersion").value?35:-1),t.ɵɵadvance(),t.ɵɵconditional((e=n.connectorHelpLinksMap.get(null==n.initialConnector?null:n.initialConnector.type))?36:-1,e),t.ɵɵadvance(),t.ɵɵconditional(n.initialConnector&&n.allowBasicConfig.has(n.initialConnector.type)?37:-1),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.initialConnector),t.ɵɵadvance(2),t.ɵɵconditional(n.initialConnector?40:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(W5,[ce,C,ar,sK,pZ,cZ,JX,QX,EJ,MJ,F1,N1,ri,R0,B0,$3,W3]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block;overflow-x:auto;padding:0}[_nghost-%COMP%] .version-placeholder[_ngcontent-%COMP%]{color:gray;font-size:12px}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%]{height:100%;width:100%;flex-direction:row}@media screen and (max-width:1279px){[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%]{flex-direction:column}}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] > section[_ngcontent-%COMP%]:not(.table-section){max-width:unset}@media screen and (min-width:1280px){[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] > section[_ngcontent-%COMP%]:not(.table-section){max-width:50%}}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .table-section[_ngcontent-%COMP%]{min-height:35vh;overflow:hidden}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .table-section[_ngcontent-%COMP%] .table-container[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .flex[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .input-container[_ngcontent-%COMP%]{height:auto}[_nghost-%COMP%] .connector-container[_ngcontent-%COMP%] .section-container[_ngcontent-%COMP%]{background-color:#fff}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{background:transparent;color:#000000de!important}[_nghost-%COMP%] .mat-mdc-slide-toggle[_ngcontent-%COMP%]{margin:0 8px}[_nghost-%COMP%] .status[_ngcontent-%COMP%]{text-align:center;border-radius:16px;font-weight:500;width:fit-content;padding:5px 15px}[_nghost-%COMP%] .status-sync[_ngcontent-%COMP%]{background:#1980380f;color:#198038}[_nghost-%COMP%] .status-unsync[_ngcontent-%COMP%]{background:#cb25300f;color:#cb2530}[_nghost-%COMP%] mat-row[_ngcontent-%COMP%]{cursor:pointer}[_nghost-%COMP%] .dot[_ngcontent-%COMP%]{height:12px;width:12px;background-color:#bbb;border-radius:50%;display:inline-block}[_nghost-%COMP%] .hasErrors[_ngcontent-%COMP%]{background-color:#cb2530}[_nghost-%COMP%] .noErrors[_ngcontent-%COMP%]{background-color:#198038}[_nghost-%COMP%] .connector-container .mat-mdc-tab-group, [_nghost-%COMP%] .connector-container .mat-mdc-tab-body-wrapper{height:100%}[_nghost-%COMP%] .connector-container .mat-mdc-tab-body.mat-mdc-tab-body-active{position:absolute}[_nghost-%COMP%] .connector-container .tb-form-row .fixed-title-width{min-width:120px;width:30%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[_nghost-%COMP%] .connector-container .tb-add-new{display:flex;z-index:999;pointer-events:none;background-color:#fff}[_nghost-%COMP%] .connector-container .tb-add-new button.connector{height:auto;padding-right:12px;font-size:20px;border-style:dashed;border-width:2px;border-radius:8px;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;color:#00000061}@media screen and (min-width:960px){[_nghost-%COMP%] .configuration-json .ace_tooltip{transform:translate(-250px,-120px)}}']})}}e("GatewayConnectorComponent",W5);class $5{constructor(e){this.deviceService=e}download(e){e&&e.stopPropagation(),this.deviceId&&this.deviceService.downloadGatewayDockerComposeFile(this.deviceId).subscribe(()=>{})}static{this.ɵfac=function(e){return new(e||$5)(t.ɵɵdirectiveInject(Z.DeviceService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$5,selectors:[["tb-gateway-command"]],inputs:{deviceId:"deviceId"},decls:32,vars:9,consts:[["mat-dialog-content","",1,"tb-form-panel","no-border",2,"padding","16px 16px 8px"],[1,"tb-no-data-text"],[1,"tb-form-panel","stroked"],["translate","",1,"tb-form-panel-title"],[1,"tb-form-row","no-border","no-padding","space-between"],["translate","",1,"tb-no-data-text","tb-commands-hint"],["mat-stroked-button","","color","primary","href","https://docs.docker.com/compose/install/","target","_blank"],["mat-stroked-button","","color","primary",3,"click"],["usePlainMarkdown","","containerClass","start-code","data","\n ```bash\n docker compose up\n {:copy-code}\n ```\n "]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",2)(5,"div",3),t.ɵɵtext(6,"device.connectivity.install-necessary-client-tools"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",4)(8,"div",5),t.ɵɵtext(9,"gateway.install-docker-compose"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"a",6)(11,"mat-icon"),t.ɵɵtext(12,"description"),t.ɵɵelementEnd(),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",2)(16,"div",3),t.ɵɵtext(17,"gateway.download-configuration-file"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",4)(19,"div",5),t.ɵɵtext(20,"gateway.download-docker-compose"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",7),t.ɵɵlistener("click",function(e){return n.download(e)}),t.ɵɵelementStart(22,"mat-icon"),t.ɵɵtext(23,"download"),t.ɵɵelementEnd(),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(26,"div",2)(27,"div",3),t.ɵɵtext(28,"gateway.launch-gateway"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",5),t.ɵɵtext(30,"gateway.launch-docker-compose"),t.ɵɵelementEnd(),t.ɵɵelement(31,"tb-markdown",8),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,3,"gateway.docker-label")),t.ɵɵadvance(11),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,5,"common.documentation")," "),t.ɵɵadvance(11),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,7,"action.download")," "))},dependencies:t.ɵɵgetComponentDepsFactory($5,[C]),styles:['@charset "UTF-8";[_nghost-%COMP%] .tb-commands-hint[_ngcontent-%COMP%]{color:inherit;font-weight:400;flex:1}[_nghost-%COMP%] .tb-markdown-view .start-code .code-wrapper{padding:0}[_nghost-%COMP%] .tb-markdown-view .start-code .code-wrapper pre[class*=language-]{margin:0;background:#f3f6fa;border-color:#305680;padding-right:38px;overflow:scroll;padding-bottom:4px;min-height:42px;scrollbar-width:thin}[_nghost-%COMP%] .tb-markdown-view .start-code .code-wrapper pre[class*=language-]::-webkit-scrollbar{width:4px;height:4px}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn{right:-2px}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn p{color:#305680}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn p, [_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn div{background-color:#f3f6fa}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn div img{display:none}[_nghost-%COMP%] .tb-markdown-view .start-code button.clipboard-btn div:after{content:"";position:initial;display:block;width:18px;height:18px;background:#305680;mask-image:url(/assets/copy-code-icon.svg);-webkit-mask-image:url(/assets/copy-code-icon.svg);mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat}']})}}var K5,Y5,X5;e("DeviceGatewayCommandComponent",$5),e("GatewayBasicConfigTab",K5),function(e){e[e.general=0]="general",e[e.logs=1]="logs",e[e.storage=2]="storage",e[e.grpc=3]="grpc",e[e.statistics=4]="statistics",e[e.other=5]="other"}(K5||e("GatewayBasicConfigTab",K5={})),e("StorageTypes",Y5),function(e){e.MEMORY="memory",e.FILE="file",e.SQLITE="sqlite"}(Y5||e("StorageTypes",Y5={})),e("LocalLogsConfigs",X5),function(e){e.service="service",e.connector="connector",e.converter="converter",e.tb_connection="tb_connection",e.storage="storage",e.extension="extension"}(X5||e("LocalLogsConfigs",X5={}));const Z5=e("LocalLogsConfigTranslateMap",new Map([[X5.service,"Service"],[X5.connector,"Connector"],[X5.converter,"Converter"],[X5.tb_connection,"TB Connection"],[X5.storage,"Storage"],[X5.extension,"Extension"]])),Q5=e("StorageTypesTranslationMap",new Map([[Y5.MEMORY,"gateway.storage-types.memory-storage"],[Y5.FILE,"gateway.storage-types.file-storage"],[Y5.SQLITE,"gateway.storage-types.sqlite"]]));var J5;e("LogSavingPeriod",J5),function(e){e.days="D",e.hours="H",e.minutes="M",e.seconds="S"}(J5||e("LogSavingPeriod",J5={}));const e4=e("LogSavingPeriodTranslations",new Map([[J5.days,"gateway.logs.days"],[J5.hours,"gateway.logs.hours"],[J5.minutes,"gateway.logs.minutes"],[J5.seconds,"gateway.logs.seconds"]]));var t4;e("SecurityTypes",t4),function(e){e.ACCESS_TOKEN="accessToken",e.USERNAME_PASSWORD="usernamePassword",e.TLS_ACCESS_TOKEN="tlsAccessToken",e.TLS_PRIVATE_KEY="tlsPrivateKey"}(t4||e("SecurityTypes",t4={}));const n4=e("SecurityTypesTranslationsMap",new Map([[t4.ACCESS_TOKEN,"gateway.security-types.access-token"],[t4.USERNAME_PASSWORD,"gateway.security-types.username-password"],[t4.TLS_ACCESS_TOKEN,"gateway.security-types.tls-access-token"]])),i4=e("logsHandlerClass","thingsboard_gateway.tb_utility.tb_rotating_file_handler.TimedRotatingFileHandler"),a4=e("logsLegacyHandlerClass","thingsboard_gateway.tb_utility.tb_handler.TimedRotatingFileHandler");function r4(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",5),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.storageTypesTranslationMap.get(e))," ")}}function o4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-read-record-count-required")," "))}function s4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-read-record-count-min")," "))}function l4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-read-record-count-pattern")," "))}function p4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-required")," "))}function c4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-min")," "))}function d4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-pattern")," "))}function u4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",7)(1,"mat-form-field",8)(2,"mat-label",9),t.ɵɵtext(3,"gateway.storage-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",10),t.ɵɵconditionalCreate(5,o4,3,3,"mat-error"),t.ɵɵconditionalCreate(6,s4,3,3,"mat-error"),t.ɵɵconditionalCreate(7,l4,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",11),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label",9),t.ɵɵtext(13,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",12),t.ɵɵconditionalCreate(15,p4,3,3,"mat-error"),t.ɵɵconditionalCreate(16,c4,3,3,"mat-error"),t.ɵɵconditionalCreate(17,d4,3,3,"mat-error"),t.ɵɵelementStart(18,"mat-icon",11),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵconditional(e.storageFormGroup.get("read_records_count").hasError("required")?5:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("read_records_count").hasError("min")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("read_records_count").hasError("pattern")?7:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(9,10,"gateway.hints.read-record-count"))),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_records_count").hasError("required")?15:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_count").hasError("min")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_count").hasError("pattern")?17:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,12,"gateway.hints.max-records-count")))}}function m4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-data-folder-path-required")," "))}function h4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-data-folder-path-pattern")," "))}function g4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-files-required")," "))}function f4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-files-min")," "))}function y4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-files-pattern")," "))}function v4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-required")," "))}function x4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-min")," "))}function b4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-pattern")," "))}function w4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-required")," "))}function S4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-min")," "))}function C4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-records-pattern")," "))}function _4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",13)(2,"mat-form-field",14)(3,"mat-label",9),t.ɵɵtext(4,"gateway.storage-data-folder-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",15),t.ɵɵconditionalCreate(6,m4,3,3,"mat-error"),t.ɵɵconditionalCreate(7,h4,3,3,"mat-error"),t.ɵɵelement(8,"mat-hint"),t.ɵɵelementStart(9,"mat-icon",16),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",8)(13,"mat-label",9),t.ɵɵtext(14,"gateway.storage-max-files"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",17),t.ɵɵconditionalCreate(16,g4,3,3,"mat-error"),t.ɵɵconditionalCreate(17,f4,3,3,"mat-error"),t.ɵɵconditionalCreate(18,y4,3,3,"mat-error"),t.ɵɵelementStart(19,"mat-icon",11),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",7)(23,"mat-form-field",8)(24,"mat-label",9),t.ɵɵtext(25,"gateway.storage-max-read-record-count-storage"),t.ɵɵelementEnd(),t.ɵɵelement(26,"input",18),t.ɵɵconditionalCreate(27,v4,3,3,"mat-error"),t.ɵɵconditionalCreate(28,x4,3,3,"mat-error"),t.ɵɵconditionalCreate(29,b4,3,3,"mat-error"),t.ɵɵelementStart(30,"mat-icon",11),t.ɵɵpipe(31,"translate"),t.ɵɵtext(32,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",8)(34,"mat-label",9),t.ɵɵtext(35,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(36,"input",19),t.ɵɵconditionalCreate(37,w4,3,3,"mat-error"),t.ɵɵconditionalCreate(38,S4,3,3,"mat-error"),t.ɵɵconditionalCreate(39,C4,3,3,"mat-error"),t.ɵɵelementStart(40,"mat-icon",11),t.ɵɵpipe(41,"translate"),t.ɵɵtext(42,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵconditional(e.storageFormGroup.get("data_folder_path").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("data_folder_path").hasError("pattern")?7:-1),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,19,"gateway.hints.data-folder"))),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_file_count").hasError("required")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_file_count").hasError("min")?17:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_file_count").hasError("pattern")?18:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(20,21,"gateway.hints.max-file-count"))),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("required")?27:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("min")?28:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("pattern")?29:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(31,23,"gateway.hints.max-read-count"))),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_records_per_file").hasError("required")?37:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_per_file").hasError("min")?38:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_records_per_file").hasError("pattern")?39:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(41,25,"gateway.hints.max-records")))}}function T4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-path-required")," "))}function E4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-path-pattern")," "))}function M4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-check-in-hours-required")," "))}function I4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-check-in-hours-min")," "))}function k4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-check-in-hours-pattern")," "))}function P4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-in-days-required")," "))}function D4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-in-days-min")," "))}function A4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.messages-ttl-in-days-pattern")," "))}function O4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-required")," "))}function R4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-min")," "))}function B4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.storage-max-read-record-count-pattern")," "))}function F4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.size-limit-required")," "))}function N4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.size-limit-min")," "))}function L4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.size-limit-pattern")," "))}function V4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.max-db-amount-required")," "))}function q4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.max-db-amount-min")," "))}function G4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.max-db-amount-pattern")," "))}function z4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.oversize-check-period-required")," "))}function U4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.oversize-check-period-min")," "))}function j4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.oversize-check-period-pattern")," "))}function H4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.writing-batch-size-required")," "))}function W4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.writing-batch-size-min")," "))}function $4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.writing-batch-size-pattern")," "))}function K4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",13)(2,"mat-form-field",14)(3,"mat-label",9),t.ɵɵtext(4,"gateway.storage-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",20),t.ɵɵconditionalCreate(6,T4,3,3,"mat-error"),t.ɵɵconditionalCreate(7,E4,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",11),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",8)(12,"mat-label",9),t.ɵɵtext(13,"gateway.messages-ttl-check-in-hours"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",21),t.ɵɵconditionalCreate(15,M4,3,3,"mat-error"),t.ɵɵconditionalCreate(16,I4,3,3,"mat-error"),t.ɵɵconditionalCreate(17,k4,3,3,"mat-error"),t.ɵɵelementStart(18,"mat-icon",11),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",7)(22,"mat-form-field",8)(23,"mat-label",9),t.ɵɵtext(24,"gateway.messages-ttl-in-days"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",22),t.ɵɵconditionalCreate(26,P4,3,3,"mat-error"),t.ɵɵconditionalCreate(27,D4,3,3,"mat-error"),t.ɵɵconditionalCreate(28,A4,3,3,"mat-error"),t.ɵɵelementStart(29,"mat-icon",23),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(32,"mat-form-field",8)(33,"mat-label",9),t.ɵɵtext(34,"gateway.storage-max-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(35,"input",18),t.ɵɵconditionalCreate(36,O4,3,3,"mat-error"),t.ɵɵconditionalCreate(37,R4,3,3,"mat-error"),t.ɵɵconditionalCreate(38,B4,3,3,"mat-error"),t.ɵɵelementStart(39,"mat-icon",23),t.ɵɵpipe(40,"translate"),t.ɵɵtext(41,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(42,"div",7)(43,"mat-form-field",8)(44,"mat-label",9),t.ɵɵtext(45,"gateway.size-limit"),t.ɵɵelementEnd(),t.ɵɵelement(46,"input",24),t.ɵɵconditionalCreate(47,F4,3,3,"mat-error"),t.ɵɵconditionalCreate(48,N4,3,3,"mat-error"),t.ɵɵconditionalCreate(49,L4,3,3,"mat-error"),t.ɵɵelementStart(50,"mat-icon",23),t.ɵɵpipe(51,"translate"),t.ɵɵtext(52,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(53,"mat-form-field",8)(54,"mat-label",9),t.ɵɵtext(55,"gateway.max-db-amount"),t.ɵɵelementEnd(),t.ɵɵelement(56,"input",25),t.ɵɵconditionalCreate(57,V4,3,3,"mat-error"),t.ɵɵconditionalCreate(58,q4,3,3,"mat-error"),t.ɵɵconditionalCreate(59,G4,3,3,"mat-error"),t.ɵɵelementStart(60,"mat-icon",23),t.ɵɵpipe(61,"translate"),t.ɵɵtext(62,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(63,"div",7)(64,"mat-form-field",8)(65,"mat-label",9),t.ɵɵtext(66,"gateway.oversize-check-period"),t.ɵɵelementEnd(),t.ɵɵelement(67,"input",26),t.ɵɵconditionalCreate(68,z4,3,3,"mat-error"),t.ɵɵconditionalCreate(69,U4,3,3,"mat-error"),t.ɵɵconditionalCreate(70,j4,3,3,"mat-error"),t.ɵɵelementStart(71,"mat-icon",23),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(74,"mat-form-field",8)(75,"mat-label",9),t.ɵɵtext(76,"gateway.writing-batch-size"),t.ɵɵelementEnd(),t.ɵɵelement(77,"input",27),t.ɵɵconditionalCreate(78,H4,3,3,"mat-error"),t.ɵɵconditionalCreate(79,W4,3,3,"mat-error"),t.ɵɵconditionalCreate(80,$4,3,3,"mat-error"),t.ɵɵelementStart(81,"mat-icon",23),t.ɵɵpipe(82,"translate"),t.ɵɵtext(83,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵconditional(e.storageFormGroup.get("data_file_path").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("data_file_path").hasError("pattern")?7:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(9,39,"gateway.hints.data-folder"))),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("required")?15:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("min")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("pattern")?17:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,41,"gateway.hints.ttl-check-hour"))),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_in_days").hasError("required")?26:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_in_days").hasError("min")?27:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("messages_ttl_in_days").hasError("pattern")?28:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(30,43,"gateway.hints.ttl-messages-day"))),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("required")?36:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("min")?37:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_read_records_count").hasError("pattern")?38:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(40,45,"gateway.hints.max-read-count"))),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("size_limit").hasError("required")?47:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("size_limit").hasError("min")?48:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("size_limit").hasError("pattern")?49:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(51,47,"gateway.size-limit-hint"))),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("max_db_amount").hasError("required")?57:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_db_amount").hasError("min")?58:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("max_db_amount").hasError("pattern")?59:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(61,49,"gateway.max-db-amount-hint"))),t.ɵɵadvance(8),t.ɵɵconditional(e.storageFormGroup.get("oversize_check_period").hasError("required")?68:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("oversize_check_period").hasError("min")?69:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("oversize_check_period").hasError("pattern")?70:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(72,51,"gateway.oversize-check-period-hint"))),t.ɵɵadvance(7),t.ɵɵconditional(e.storageFormGroup.get("writing_batch_size").hasError("required")?78:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("writing_batch_size").hasError("min")?79:-1),t.ɵɵadvance(),t.ɵɵconditional(e.storageFormGroup.get("writing_batch_size").hasError("pattern")?80:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(82,53,"gateway.writing-batch-size-hint")))}}class Y4{constructor(e,t){this.fb=e,this.destroyRef=t,this.initialized=new p,this.StorageTypes=Y5,this.storageTypes=Object.values(Y5),this.storageTypesTranslationMap=Q5,this.onChange=()=>{},this.numberValidators=[ve.min(1),ve.pattern(mn)],this.requiredNumberValidators=[ve.required,...this.numberValidators],this.requiredDirValidators=[ve.required,ve.pattern(yn)],this.storageConfig={[Y5.MEMORY]:{read_records_count:this.requiredNumberValidators,max_records_count:this.requiredNumberValidators},[Y5.FILE]:{data_folder_path:this.requiredDirValidators,max_file_count:this.requiredNumberValidators,max_read_records_count:this.requiredNumberValidators,max_records_per_file:this.requiredNumberValidators},[Y5.SQLITE]:{data_file_path:this.requiredDirValidators,messages_ttl_check_in_hours:this.requiredNumberValidators,messages_ttl_in_days:this.requiredNumberValidators,max_read_records_count:this.requiredNumberValidators,size_limit:this.numberValidators,max_db_amount:this.numberValidators,oversize_check_period:this.numberValidators,writing_batch_size:this.numberValidators}},this.storageFormGroup=this.initStorageFormGroup(),this.observeStorageTypeChanges(),this.storageFormGroup.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.onChange(e)})}ngAfterViewInit(){this.updateValidators(this.storageFormGroup.get("type").value),this.initialized.emit({storage:this.storageFormGroup.value})}writeValue(e){ne(e)&&(this.storageFormGroup.patchValue(e,{emitEvent:!1}),this.updateValidators(e.type))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.storageFormGroup.valid?null:{storageFormGroup:{valid:!1}}}initStorageFormGroup(){return this.fb.group({type:[Y5.MEMORY,[ve.required]],read_records_count:[100],max_records_count:[1e5],data_folder_path:["./data/"],max_file_count:[10],max_read_records_count:[10],max_records_per_file:[1e4],data_file_path:["./data/"],messages_ttl_check_in_hours:[1],messages_ttl_in_days:[7],size_limit:[1024],max_db_amount:[10],oversize_check_period:[1],writing_batch_size:[1e3]})}observeStorageTypeChanges(){this.storageFormGroup.get("type").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.updateValidators(e)})}updateValidators(e){const t=this.storageConfig[e];Object.keys(this.storageFormGroup.controls).forEach(e=>{if("type"===e)return;const n=this.storageFormGroup.get(e),i=t[e];i?(n.enable({emitEvent:!1}),n.setValidators(i),n.updateValueAndValidity({emitEvent:!1}),n.markAsTouched({emitEvent:!1})):(n.disable({emitEvent:!1}),n.clearValidators(),n.updateValueAndValidity({emitEvent:!1}),n.markAsUntouched({emitEvent:!1}))})}static{this.ɵfac=function(e){return new(e||Y4)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Y4,selectors:[["tb-gateway-storage-configuration"]],outputs:{initialized:"initialized"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>Y4),multi:!0},{provide:xe,useExisting:a(()=>Y4),multi:!0}])],decls:15,vars:5,consts:[[1,"mat-content","mat-padding","flex","w-full","flex-col","gap-2",3,"formGroup"],[1,"tb-form-panel","no-padding-bottom","w-full"],["translate","",1,"tb-form-panel-title"],["translate","",1,"tb-form-panel-hint"],["formControlName","type",1,"flex"],[3,"value"],[1,"tb-form-panel-hint"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["translate",""],["type","number","matInput","","formControlName","read_records_count"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","number","matInput","","formControlName","max_records_count"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs","align-start","mb-2"],["appearance","outline","subscriptSizing","dynamic",1,"flex"],["matInput","","formControlName","data_folder_path"],["aria-hidden","false","aria-label","help-icon","matSuffix","",1,"mat-form-field-infix","pointer-event","suffix-icon",2,"cursor","pointer",3,"matTooltip"],["matInput","","type","number","formControlName","max_file_count"],["matInput","","type","number","formControlName","max_read_records_count"],["matInput","","type","number","formControlName","max_records_per_file"],["matInput","","formControlName","data_file_path"],["matInput","","type","number","formControlName","messages_ttl_check_in_hours"],["matInput","","type","number","formControlName","messages_ttl_in_days"],["matIconSuffix","",1,"cursor-pointer",3,"matTooltip"],["matInput","","type","number","formControlName","size_limit"],["matInput","","type","number","formControlName","max_db_amount"],["matInput","","type","number","formControlName","oversize_check_period"],["matInput","","type","number","formControlName","writing_batch_size"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2),t.ɵɵtext(3,"gateway.storage"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",3),t.ɵɵtext(5,"gateway.hints.storage"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"tb-toggle-select",4),t.ɵɵrepeaterCreate(7,r4,3,4,"tb-toggle-option",5,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"div",6),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(12,u4,21,14,"section",7)(13,_4,43,27,"section")(14,K4,84,55,"section"),t.ɵɵelementEnd()()),2&e){let e;t.ɵɵproperty("formGroup",n.storageFormGroup),t.ɵɵadvance(7),t.ɵɵrepeater(n.storageTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(11,3,"gateway.hints."+n.storageFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵconditional((e=n.storageFormGroup.get("type").value)===n.StorageTypes.MEMORY?12:e===n.StorageTypes.FILE?13:e===n.StorageTypes.SQLITE?14:-1)}},dependencies:t.ɵɵgetComponentDepsFactory(Y4,[C]),encapsulation:2})}}function X4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-required")," "))}function Z4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-min")," "))}function Q4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-max")," "))}function J4(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-pattern")," "))}function e6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-timeout-required")," "))}function t6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-timeout-min")," "))}function n6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-timeout-pattern")," "))}function i6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-required")," "))}function a6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-min")," "))}function r6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-keep-alive-pattern")," "))}function o6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-time-between-pings-required")," "))}function s6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-time-between-pings-min")," "))}function l6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-time-between-pings-pattern")," "))}function p6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-max-pings-without-data-required")," "))}function c6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-max-pings-without-data-min")," "))}function d6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-max-pings-without-data-pattern")," "))}function u6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-ping-interval-without-data-required")," "))}function m6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-ping-interval-without-data-min")," "))}function h6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.grpc-min-ping-interval-without-data-pattern")," "))}class g6{constructor(e,t){this.fb=e,this.destroyRef=t,this.initialized=new p,this.onChange=()=>{},this.grpcFormGroup=this.initGrpcFormGroup(),this.grpcFormGroup.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.onChange(e)}),this.grpcFormGroup.get("enabled").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.toggleRpcFields(e)})}ngAfterViewInit(){this.initialized.emit({grpc:this.grpcFormGroup.value})}writeValue(e){e&&this.toggleRpcFields(e.enabled),this.grpcFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.grpcFormGroup.valid?null:{grpcFormGroup:{valid:!1}}}toggleRpcFields(e){const t=this.grpcFormGroup;e?(t.get("serverPort").enable({emitEvent:!1}),t.get("keepAliveTimeMs").enable({emitEvent:!1}),t.get("keepAliveTimeoutMs").enable({emitEvent:!1}),t.get("keepalivePermitWithoutCalls").enable({emitEvent:!1}),t.get("maxPingsWithoutData").enable({emitEvent:!1}),t.get("minTimeBetweenPingsMs").enable({emitEvent:!1}),t.get("minPingIntervalWithoutDataMs").enable({emitEvent:!1})):(t.get("serverPort").disable({emitEvent:!1}),t.get("keepAliveTimeMs").disable({emitEvent:!1}),t.get("keepAliveTimeoutMs").disable({emitEvent:!1}),t.get("keepalivePermitWithoutCalls").disable({emitEvent:!1}),t.get("maxPingsWithoutData").disable({emitEvent:!1}),t.get("minTimeBetweenPingsMs").disable({emitEvent:!1}),t.get("minPingIntervalWithoutDataMs").disable({emitEvent:!1}))}initGrpcFormGroup(){return this.fb.group({enabled:[!1],serverPort:[9595,[ve.required,ve.min(1),ve.max(65535),ve.pattern(mn)]],keepAliveTimeMs:[1e4,[ve.required,ve.min(1),ve.pattern(mn)]],keepAliveTimeoutMs:[5e3,[ve.required,ve.min(1),ve.pattern(mn)]],keepalivePermitWithoutCalls:[!0],maxPingsWithoutData:[0,[ve.required,ve.min(0),ve.pattern(mn)]],minTimeBetweenPingsMs:[1e4,[ve.required,ve.min(1),ve.pattern(mn)]],minPingIntervalWithoutDataMs:[5e3,[ve.required,ve.min(1),ve.pattern(mn)]]})}static{this.ɵfac=function(e){return new(e||g6)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:g6,selectors:[["tb-gateway-grpc-configuration"]],outputs:{initialized:"initialized"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>g6),multi:!0},{provide:xe,useExisting:a(()=>g6),multi:!0}])],decls:75,vars:54,consts:[[1,"mat-content","mat-padding","flex","flex-col","gap-2",3,"formGroup"],[1,"tb-form-panel","no-padding-bottom","w-full"],["color","primary","formControlName","enabled",1,"mat-slide"],[1,"tb-form-row","no-border","no-padding",3,"tb-hint-tooltip-icon"],["color","primary","formControlName","keepalivePermitWithoutCalls",1,"mat-slide"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["translate",""],["matInput","","formControlName","serverPort","type","number","min","0"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","keepAliveTimeoutMs","type","number","min","0"],["matInput","","formControlName","keepAliveTimeMs","type","number","min","0"],["matInput","","formControlName","minTimeBetweenPingsMs","type","number","min","0"],["matInput","","formControlName","maxPingsWithoutData","type","number","min","0"],["matInput","","formControlName","minPingIntervalWithoutDataMs","type","number","min","0"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"mat-slide-toggle",2),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",3),t.ɵɵpipe(6,"translate"),t.ɵɵelementStart(7,"mat-slide-toggle",4),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"section")(11,"section",5)(12,"mat-form-field",6)(13,"mat-label",7),t.ɵɵtext(14,"gateway.server-port"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",8),t.ɵɵelementStart(16,"mat-icon",9),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(19,X4,3,3,"mat-error"),t.ɵɵconditionalCreate(20,Z4,3,3,"mat-error"),t.ɵɵconditionalCreate(21,Q4,3,3,"mat-error"),t.ɵɵconditionalCreate(22,J4,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",6)(24,"mat-label",7),t.ɵɵtext(25,"gateway.grpc-keep-alive-timeout"),t.ɵɵelementEnd(),t.ɵɵelement(26,"input",10),t.ɵɵelementStart(27,"mat-icon",9),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(30,e6,3,3,"mat-error"),t.ɵɵconditionalCreate(31,t6,3,3,"mat-error"),t.ɵɵconditionalCreate(32,n6,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"section",5)(34,"mat-form-field",6)(35,"mat-label",7),t.ɵɵtext(36,"gateway.grpc-keep-alive"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",11),t.ɵɵelementStart(38,"mat-icon",9),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(41,i6,3,3,"mat-error"),t.ɵɵconditionalCreate(42,a6,3,3,"mat-error"),t.ɵɵconditionalCreate(43,r6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",6)(45,"mat-label",7),t.ɵɵtext(46,"gateway.grpc-min-time-between-pings"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",12),t.ɵɵelementStart(48,"mat-icon",9),t.ɵɵpipe(49,"translate"),t.ɵɵtext(50,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(51,o6,3,3,"mat-error"),t.ɵɵconditionalCreate(52,s6,3,3,"mat-error"),t.ɵɵconditionalCreate(53,l6,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(54,"section",5)(55,"mat-form-field",6)(56,"mat-label",7),t.ɵɵtext(57,"gateway.grpc-max-pings-without-data"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",13),t.ɵɵelementStart(59,"mat-icon",9),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(62,p6,3,3,"mat-error"),t.ɵɵconditionalCreate(63,c6,3,3,"mat-error"),t.ɵɵconditionalCreate(64,d6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(65,"mat-form-field",6)(66,"mat-label",7),t.ɵɵtext(67,"gateway.grpc-min-ping-interval-without-data"),t.ɵɵelementEnd(),t.ɵɵelement(68,"input",14),t.ɵɵelementStart(69,"mat-icon",9),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(72,u6,3,3,"mat-error"),t.ɵɵconditionalCreate(73,m6,3,3,"mat-error"),t.ɵɵconditionalCreate(74,h6,3,3,"mat-error"),t.ɵɵelementEnd()()()()()),2&e&&(t.ɵɵproperty("formGroup",n.grpcFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,36,"gateway.grpc")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,38,"gateway.hints.permit-without-calls"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,40,"gateway.permit-without-calls")," "),t.ɵɵadvance(8),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(17,42,"gateway.hints.server-port"))),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("required")?19:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("min")?20:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("max")?21:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("serverPort").hasError("pattern")?22:-1),t.ɵɵadvance(5),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(28,44,"gateway.hints.grpc-keep-alive-timeout"))),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("required")?30:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("min")?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("pattern")?32:-1),t.ɵɵadvance(6),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(39,46,"gateway.hints.grpc-keep-alive"))),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeMs").hasError("required")?41:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeMs").hasError("min")?42:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("keepAliveTimeMs").hasError("pattern")?43:-1),t.ɵɵadvance(5),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(49,48,"gateway.hints.grpc-min-time-between-pings"))),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("required")?51:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("min")?52:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("pattern")?53:-1),t.ɵɵadvance(6),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(60,50,"gateway.hints.grpc-max-pings-without-data"))),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("maxPingsWithoutData").hasError("required")?62:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("maxPingsWithoutData").hasError("min")?63:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("maxPingsWithoutData").hasError("pattern")?64:-1),t.ɵɵadvance(5),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(70,52,"gateway.hints.grpc-min-ping-interval-without-data"))),t.ɵɵadvance(3),t.ɵɵconditional(n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("required")?72:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("min")?73:-1),t.ɵɵadvance(),t.ɵɵconditional(n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("pattern")?74:-1))},dependencies:t.ɵɵgetComponentDepsFactory(g6,[C]),encapsulation:2})}}function f6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.date-format-required")," "))}function y6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.log-format-required")," "))}function v6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function x6(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",18),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(i.localLogsConfigTranslateMap.get(e))}}function b6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function w6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.file-path-required")," "))}function S6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.saving-period-required")," "))}function C6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.saving-period-min")," "))}function _6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",14),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,e.value)," ")}}function T6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.backup-count-required")," "))}function E6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.logs.backup-count-min")," "))}class M6{constructor(e,t){this.fb=e,this.destroyRef=t,this.initialized=new p,this.logSavingPeriods=e4,this.localLogsConfigs=Object.keys(X5),this.localLogsConfigTranslateMap=Z5,this.gatewayLogLevel=Object.values(mt),this.remoteLogLevel=Object.values(mt).filter(e=>e!==mt.NONE),this.onChange=()=>{},this.logsFormGroup=this.initLogsFormGroup(),this.showRemoteLogsControl=this.fb.control(!1),this.logsFormGroup.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{this.onChange(e)}),this.logSelector=this.fb.control(X5.service);for(const e of Object.keys(X5))this.addLocalLogConfig(e,{});this.showRemoteLogsControl.valueChanges.pipe(de(this.destroyRef)).subscribe(e=>this.logsFormGroup.get("logLevel")[e?"enable":"disable"]())}ngAfterViewInit(){this.initialized.emit({logs:this.logsFormGroup.value})}writeValue(e){this.logsFormGroup.patchValue(e,{emitEvent:!1}),this.updateRemoteLogs(e?.logLevel??mt.NONE)}registerOnChange(e){this.onChange=e}registerOnTouched(e){}getLogFormGroup(e){return this.logsFormGroup.get(`local.${e}`)}validate(){return this.logsFormGroup.valid?null:{logsFormGroup:{valid:!1}}}initLogsFormGroup(){return this.fb.group({dateFormat:["%Y-%m-%d %H:%M:%S",[ve.required,ve.pattern(/^[^\s].*[^\s]$/)]],logFormat:["%(asctime)s.%(msecs)03d - |%(levelname)s| - [%(filename)s] - %(module)s - %(funcName)s - %(lineno)d - %(message)s",[ve.required,ve.pattern(/^[^\s].*[^\s]$/)]],type:["remote",[ve.required]],logLevel:[{value:mt.INFO,disabled:!0}],local:this.fb.group({})})}addLocalLogConfig(e,t){const n=this.logsFormGroup.get("local"),i=this.fb.group({logLevel:[t.logLevel||mt.INFO,[ve.required]],filePath:[t.filePath||"./logs",[ve.required]],backupCount:[t.backupCount||7,[ve.required,ve.min(0)]],savingTime:[t.savingTime||3,[ve.required,ve.min(0)]],savingPeriod:[t.savingPeriod||J5.days,[ve.required]]});n.addControl(e,i,{emitEvent:!1})}updateRemoteLogs(e){const t=e&&e!==mt.NONE;this.showRemoteLogsControl.patchValue(t,{emitEvent:!1}),this.logsFormGroup.get("logLevel")[t?"enable":"disable"]({emitEvent:!1}),this.logsFormGroup.get("logLevel").patchValue(e===mt.NONE?mt.INFO:e,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||M6)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:M6,selectors:[["tb-gateway-logs-configuration"]],outputs:{initialized:"initialized"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>M6),multi:!0},{provide:xe,useExisting:a(()=>M6),multi:!0}])],decls:76,vars:33,consts:[[1,"mat-content","mat-padding","flex","flex-col","gap-2",3,"formGroup"],[1,"tb-form-panel","no-padding-bottom"],[1,"flex","flex-col"],["appearance","outline"],["translate",""],["matInput","","formControlName","dateFormat"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","logFormat","rows","2"],[1,"tb-form-panel"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],[3,"tb-hint-tooltip-icon"],["formControlName","logLevel"],[3,"value"],["formGroupName","local",1,"tb-form-panel","no-padding-bottom"],["translate","",1,"tb-form-panel-title"],[1,"toggle-group",3,"formControl"],[1,"first-capital",3,"value"],[3,"formGroup"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["matInput","","formControlName","filePath"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","saving-period"],["matInput","","formControlName","savingTime","type","number","min","0"],["appearance","outline","hideRequiredMarker","",2,"min-width","110px","width","30%"],["formControlName","savingPeriod"],["matInput","","formControlName","backupCount","type","number","min","0"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-form-field",3)(4,"mat-label",4),t.ɵɵtext(5,"gateway.logs.date-format"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",5),t.ɵɵconditionalCreate(7,f6,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",6),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",3)(12,"mat-label",4),t.ɵɵtext(13,"gateway.logs.log-format"),t.ɵɵelementEnd(),t.ɵɵelement(14,"textarea",7),t.ɵɵconditionalCreate(15,y6,3,3,"mat-error"),t.ɵɵelementStart(16,"mat-icon",6),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",8)(20,"mat-expansion-panel",9)(21,"mat-expansion-panel-header",10)(22,"mat-panel-title")(23,"mat-slide-toggle",11),t.ɵɵlistener("click",function(e){return e.stopPropagation()}),t.ɵɵelementStart(24,"mat-label")(25,"div",12),t.ɵɵpipe(26,"translate"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(29,"mat-form-field",3)(30,"mat-label",4),t.ɵɵtext(31,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-select",13),t.ɵɵrepeaterCreate(33,v6,2,2,"mat-option",14,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(35,"div",15)(36,"div",16),t.ɵɵtext(37,"gateway.logs.local"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"tb-toggle-select",17),t.ɵɵrepeaterCreate(39,x6,2,2,"tb-toggle-option",18,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(41,19),t.ɵɵelementStart(42,"div",20)(43,"mat-form-field",21)(44,"mat-label",4),t.ɵɵtext(45,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(46,"mat-select",13),t.ɵɵrepeaterCreate(47,b6,2,2,"mat-option",14,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementStart(49,"mat-form-field",21)(50,"mat-label",4),t.ɵɵtext(51,"gateway.logs.file-path"),t.ɵɵelementEnd(),t.ɵɵelement(52,"input",22),t.ɵɵconditionalCreate(53,w6,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(54,"div",20)(55,"div",23)(56,"mat-form-field",21)(57,"mat-label",4),t.ɵɵtext(58,"gateway.logs.saving-period"),t.ɵɵelementEnd(),t.ɵɵelement(59,"input",24),t.ɵɵconditionalCreate(60,S6,3,3,"mat-error"),t.ɵɵconditionalCreate(61,C6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(62,"mat-form-field",25)(63,"mat-select",26),t.ɵɵrepeaterCreate(64,_6,3,4,"mat-option",14,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(66,"keyvalue"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(67,"mat-form-field",21)(68,"mat-label",4),t.ɵɵtext(69,"gateway.logs.backup-count"),t.ɵɵelementEnd(),t.ɵɵelement(70,"input",27),t.ɵɵconditionalCreate(71,T6,3,3,"mat-error"),t.ɵɵconditionalCreate(72,E6,3,3,"mat-error"),t.ɵɵelementStart(73,"mat-icon",6),t.ɵɵpipe(74,"translate"),t.ɵɵtext(75,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.logsFormGroup),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("dateFormat").hasError("required")?7:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(9,21,"gateway.hints.date-form"))),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("logFormat").hasError("required")?15:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(17,23,"gateway.hints.log-format"))),t.ɵɵadvance(4),t.ɵɵproperty("expanded",n.showRemoteLogsControl.value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",n.showRemoteLogsControl),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(26,25,"gateway.hints.remote-log"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,27,"gateway.logs.remote")),t.ɵɵadvance(6),t.ɵɵrepeater(n.remoteLogLevel),t.ɵɵadvance(5),t.ɵɵproperty("formControl",n.logSelector),t.ɵɵadvance(),t.ɵɵrepeater(n.localLogsConfigs),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",n.getLogFormGroup(n.logSelector.value)),t.ɵɵadvance(6),t.ɵɵrepeater(n.gatewayLogLevel),t.ɵɵadvance(6),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".filePath").hasError("required")?53:-1),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("required")?60:-1),t.ɵɵadvance(),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("min")?61:-1),t.ɵɵadvance(3),t.ɵɵrepeater(t.ɵɵpipeBind1(66,29,n.logSavingPeriods)),t.ɵɵadvance(7),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("required")?71:-1),t.ɵɵadvance(),t.ɵɵconditional(n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("min")?72:-1),t.ɵɵadvance(),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(74,31,"gateway.hints.backup-count"))))},dependencies:t.ɵɵgetComponentDepsFactory(M6,[ce,C]),encapsulation:2})}}function I6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"security.clientId-required")," "))}function k6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",5),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tooltipText",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,3,"gateway.copy-client-id")))("copyText",e.usernameFormGroup.get("clientId").value)}}function P6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("clientId"))}),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"device.generate-client-id")))}function D6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"security.username-required")," "))}function A6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",5),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tooltipText",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,3,"gateway.copy-username")))("copyText",e.usernameFormGroup.get("username").value)}}function O6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("username"))}),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"device.generate-user-name")))}function R6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",5),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("tooltipText",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,3,"gateway.copy-password")))("copyText",e.usernameFormGroup.get("password").value)}}function B6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",12),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.generate("password"))}),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"device.generate-password")))}function F6(e,n){1&e&&(t.ɵɵelement(0,"tb-error",11),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"device.client-id-or-user-name-necessary"))}function N6(e,n){1&e&&(t.ɵɵelement(0,"tb-error",11),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"gateway.hints.username-required-with-password"))}class L6{constructor(e,t){this.fb=e,this.destroyRef=t,this.onChange=()=>{},this.initForm(),this.usernameFormGroup.valueChanges.pipe(de(this.destroyRef),Oe((e,t)=>Y(e,t))).subscribe(e=>this.onChange(e))}writeValue(e){Y(e,this.usernameFormGroup.value)||this.usernameFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){e?this.usernameFormGroup.disable({emitEvent:!1}):(this.usernameFormGroup.enable(),this.usernameFormGroup.updateValueAndValidity({emitEvent:!1}))}validate(){return this.usernameFormGroup.disabled||this.usernameFormGroup.valid?null:{usernameFormGroup:{valid:!1}}}initForm(){this.usernameFormGroup=this.createSecurityFormGroup()}createSecurityFormGroup(){return this.fb.group({clientId:[null,[ve.pattern(/^[^.\s]+$/)]],username:[null,[ve.pattern(/^[^.\s]+$/)]],password:[null,[ve.pattern(/^[^.\s]+$/)]]},{validators:[this.atLeastOneRequired,this.usernameRequired]})}atLeastOneRequired(e){const t=e.get("clientId").value,n=e.get("username").value;return t||n?null:{atLeastOneRequired:!0}}usernameRequired(e){const t=e.get("username").value,n=e.get("password").value;return!t&&n?{usernameRequired:!0}:null}generate(e){this.usernameFormGroup.get(e).patchValue(oe(20))}static{this.ɵfac=function(e){return new(e||L6)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:L6,selectors:[["tb-gateway-username-configuration"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>L6),multi:!0},{provide:xe,useExisting:a(()=>L6),multi:!0}])],decls:33,vars:20,consts:[[3,"formGroup"],[1,"xs:flex-col","no-border","no-padding","tb-standard-fields","flex","gap-2"],["appearance","outline",1,"flex","flex-1"],["translate",""],["matInput","","formControlName","clientId"],["matSuffix","","miniButton","false","tooltipPosition","above","icon","content_copy",3,"copyText","tooltipText"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","username"],["appearance","outline","subscriptSizing","dynamic",2,"width","100%"],["matInput","","formControlName","password"],[1,"block",3,"error"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"section",0)(1,"div",1)(2,"mat-form-field",2)(3,"mat-label",3),t.ɵɵtext(4,"security.clientId"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",4),t.ɵɵconditionalCreate(6,I6,3,3,"mat-error"),t.ɵɵconditionalCreate(7,k6,2,5,"tb-copy-button",5)(8,P6,4,4,"button",6),t.ɵɵelementStart(9,"mat-icon",7),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",2)(13,"mat-label",3),t.ɵɵtext(14,"security.username"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",8),t.ɵɵconditionalCreate(16,D6,3,3,"mat-error"),t.ɵɵconditionalCreate(17,A6,2,5,"tb-copy-button",5)(18,O6,4,4,"button",6),t.ɵɵelementStart(19,"mat-icon",7),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"mat-form-field",9)(23,"mat-label",3),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",10),t.ɵɵconditionalCreate(26,R6,2,5,"tb-copy-button",5)(27,B6,4,4,"button",6),t.ɵɵelementStart(28,"mat-icon",7),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵconditionalCreate(31,F6,2,3,"tb-error",11),t.ɵɵconditionalCreate(32,N6,2,3,"tb-error",11)),2&e&&(t.ɵɵproperty("formGroup",n.usernameFormGroup),t.ɵɵadvance(6),t.ɵɵconditional(n.usernameFormGroup.get("clientId").hasError("required")?6:-1),t.ɵɵadvance(),t.ɵɵconditional(n.usernameFormGroup.get("clientId").value?7:8),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(10,14,"gateway.hints.client-id"))),t.ɵɵadvance(7),t.ɵɵconditional(n.usernameFormGroup.get("username").hasError("required")?16:-1),t.ɵɵadvance(),t.ɵɵconditional(n.usernameFormGroup.get("username").value?17:18),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(20,16,"gateway.hints.username"))),t.ɵɵadvance(7),t.ɵɵconditional(n.usernameFormGroup.get("password").value?26:27),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(29,18,"gateway.hints.password"))),t.ɵɵadvance(3),t.ɵɵconditional(n.usernameFormGroup.hasError("atLeastOneRequired")&&n.usernameFormGroup.touched?31:-1),t.ɵɵadvance(),t.ɵɵconditional(n.usernameFormGroup.hasError("usernameRequired")&&n.usernameFormGroup.touched?32:-1))},dependencies:t.ɵɵgetComponentDepsFactory(L6,[C]),encapsulation:2})}}class V6{constructor(e,t){this.deviceService=e,this.destroyRef=t,this.initialCredentialsSubject=new Ee(null)}get initialCredentials(){return this.initialCredentialsSubject.value}get initialCredentials$(){return this.initialCredentialsSubject.asObservable()}updateCredentials(e){let t={};switch(e.type){case t4.USERNAME_PASSWORD:this.shouldUpdateCredentials(e)&&(t=this.generateMqttCredentials(e));break;case t4.ACCESS_TOKEN:case t4.TLS_ACCESS_TOKEN:this.shouldUpdateAccessToken(e)&&(t={credentialsType:W.ACCESS_TOKEN,credentialsId:e.accessToken,credentialsValue:null})}return this.initialCredentialsSubject.next({...this.initialCredentials,...t}),Object.keys(t).length?this.deviceService.saveDeviceCredentials(this.initialCredentials):Ie(null)}setInitialCredentials(e){this.deviceService.getDeviceCredentials(e.id).pipe(de(this.destroyRef)).subscribe(e=>{this.initialCredentialsSubject.next({...e,version:null})})}shouldUpdateSecurityConfig(e){switch(e.type){case t4.USERNAME_PASSWORD:return this.shouldUpdateCredentials(e);case t4.ACCESS_TOKEN:case t4.TLS_ACCESS_TOKEN:return this.shouldUpdateAccessToken(e)}}credentialsToSecurityConfig(e){const t=e.credentialsType===W.MQTT_BASIC?t4.USERNAME_PASSWORD:t4.ACCESS_TOKEN;if(e.credentialsType!==W.MQTT_BASIC)return{type:t,accessToken:e.credentialsId};if(e.credentialsValue){const{clientId:n,userName:i,password:a}=JSON.parse(e.credentialsValue);return{type:t,clientId:n,username:i,password:a}}}shouldUpdateCredentials(e){if(this.initialCredentials.credentialsType!==W.MQTT_BASIC)return!0;const t=JSON.parse(this.initialCredentials.credentialsValue);return!(t.clientId===e.clientId&&t.userName===e.username&&t.password===e.password)}shouldUpdateAccessToken(e){return this.initialCredentials.credentialsType!==W.ACCESS_TOKEN||this.initialCredentials.credentialsId!==e.accessToken}generateMqttCredentials(e){const{clientId:t,username:n,password:i}=e,a={...t&&{clientId:t},...n&&{userName:n},...i&&{password:i}};return{credentialsType:W.MQTT_BASIC,credentialsValue:JSON.stringify(a)}}static{this.ɵfac=function(e){return new(e||V6)(t.ɵɵinject(Z.DeviceService),t.ɵɵinject(t.DestroyRef))}}static{this.ɵprov=t.ɵɵdefineInjectable({token:V6,factory:V6.ɵfac})}}function q6(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e.value)," ")}}function G6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"security.access-token-required")," "))}function z6(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",10),t.ɵɵpipe(1,"translate")),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("tooltipText",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,3,"device.copy-access-token")))("copyText",e.securityFormGroup.get("accessToken").value)}}function U6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.generateAccessToken())}),t.ɵɵelementStart(2,"mat-icon"),t.ɵɵtext(3,"autorenew"),t.ɵɵelementEnd()()}2&e&&t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,2,"device.generate-access-token")))}function j6(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",5)(1,"mat-label",8),t.ɵɵtext(2,"security.access-token"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",9),t.ɵɵconditionalCreate(4,G6,3,3,"mat-error"),t.ɵɵconditionalCreate(5,z6,2,5,"tb-copy-button",10)(6,U6,4,4,"button",11),t.ɵɵelementStart(7,"mat-icon",12),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵconditional(e.securityFormGroup.get("accessToken").hasError("required")?4:-1),t.ɵɵadvance(),t.ɵɵconditional(e.securityFormGroup.get("accessToken").value?5:6),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,4,"gateway.hints.token")))}}function H6(e,n){1&e&&(t.ɵɵelement(0,"tb-file-input",7),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"translate"),t.ɵɵpipe(3,"translate")),2&e&&t.ɵɵproperty("hint",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,8,"gateway.hints.ca-cert")))("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,10,"security.ca-cert")))("dropLabel",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,12,"gateway.drop-file")))("allowedExtensions","pem,cert,key")("accept",".pem, application/pem,.cert, application/cert, .key,application/key")}class W6{constructor(e,t,n,i){this.fb=e,this.cd=t,this.gatewayCredentialsService=n,this.destroyRef=i,this.initialized=new p,this.securityTypes=n4,this.onChange=()=>{},this.securityFormGroup=this.createSecurityFormGroup(),this.setupFormListeners()}ngAfterViewInit(){const{usernamePassword:e,...t}=this.securityFormGroup.value;this.initialized.emit({thingsboard:{security:e?{...t,...e}:t}})}writeValue(e){const t=e??this.gatewayCredentialsService.credentialsToSecurityConfig(this.gatewayCredentialsService.initialCredentials),n=this.securityFormGroup.getRawValue(),{usernamePassword:i,...a}=n,r=i?{...a,...i}:a;Y(t,r)||this.updateFormBySecurityConfig(t)}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.securityFormGroup.valid?null:{securityFormGroup:{valid:!1}}}updateFormBySecurityConfig(e){const{clientId:t,username:n,password:i,...a}=e??{};a?.type===t4.USERNAME_PASSWORD?this.securityFormGroup.patchValue({...a,usernamePassword:{clientId:t,username:n,password:i}},{emitEvent:!1}):this.securityFormGroup.patchValue(a,{emitEvent:!1}),this.toggleBySecurityType(this.securityFormGroup.get("type").value)}createSecurityFormGroup(){return this.fb.group({type:[t4.ACCESS_TOKEN,[ve.required]],accessToken:[null,[ve.required,ve.pattern(/^[^.\s]+$/)]],caCert:[null,[ve.required]],usernamePassword:[]})}setupFormListeners(){this.securityFormGroup.valueChanges.pipe(de(this.destroyRef)).subscribe(({usernamePassword:e,...t})=>{this.onChange(e?{...t,...e}:t)}),this.securityFormGroup.get("type").valueChanges.pipe(de(this.destroyRef),Oe()).subscribe(e=>{this.toggleBySecurityType(e)}),this.securityFormGroup.get("caCert").valueChanges.pipe(de(this.destroyRef)).subscribe(()=>this.cd.detectChanges())}toggleBySecurityType(e){switch(e){case t4.ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").disable({emitEvent:!1}),this.securityFormGroup.get("usernamePassword").disable({emitEvent:!1});break;case t4.TLS_PRIVATE_KEY:this.securityFormGroup.get("caCert").enable({emitEvent:!1}),this.securityFormGroup.get("accessToken").disable({emitEvent:!1}),this.securityFormGroup.get("usernamePassword").disable({emitEvent:!1});break;case t4.TLS_ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").enable({emitEvent:!1}),this.securityFormGroup.get("usernamePassword").disable({emitEvent:!1});break;case t4.USERNAME_PASSWORD:this.securityFormGroup.get("usernamePassword").enable({emitEvent:!1}),this.securityFormGroup.get("accessToken").disable({emitEvent:!1}),this.securityFormGroup.get("caCert").disable({emitEvent:!1}),this.cd.detectChanges()}}generateAccessToken(){this.securityFormGroup.get("accessToken").patchValue(oe(20))}static{this.ɵfac=function(e){return new(e||W6)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(V6),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:W6,selectors:[["tb-gateway-security-configuration"]],outputs:{initialized:"initialized"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>W6),multi:!0},{provide:xe,useExisting:a(()=>W6),multi:!0}])],decls:11,vars:7,consts:[[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],[3,"formGroup"],["formControlName","type",1,"toggle-group","flex"],[3,"value"],["appearance","outline"],["formControlName","usernamePassword"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel"],["translate",""],["matInput","","formControlName","accessToken"],["matSuffix","","miniButton","false","tooltipPosition","above","icon","content_copy",3,"copyText","tooltipText"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1),t.ɵɵtext(2,"security.security"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(3,2),t.ɵɵelementStart(4,"tb-toggle-select",3),t.ɵɵrepeaterCreate(5,q6,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵpipe(7,"keyvalue"),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(8,j6,10,6,"mat-form-field",5),t.ɵɵelement(9,"tb-gateway-username-configuration",6),t.ɵɵconditionalCreate(10,H6,4,14,"tb-file-input",7),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(2),t.ɵɵrepeater(t.ɵɵpipeBind1(7,5,n.securityTypes)),t.ɵɵadvance(3),t.ɵɵconditional(n.securityFormGroup.get("type").value.toLowerCase().includes("accesstoken")?8:-1),t.ɵɵadvance(),t.ɵɵclassProp("hidden","usernamePassword"!==n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵconditional(n.securityFormGroup.get("type").value.toLowerCase().includes("tls")?10:-1))},dependencies:t.ɵɵgetComponentDepsFactory(W6,[ce,C,L6]),encapsulation:2})}}const $6=["configGroup"];function K6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-host-required")))}function Y6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-required")))}function X6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-min")))}function Z6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-max")))}function Q6(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.thingsboard-port-pattern")))}function J6(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-security-configuration",20),t.ɵɵlistener("initialized",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext(2);return t.ɵɵresetView(i.onInitialized(n))}),t.ɵɵelementEnd()}}function e7(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",19),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("isConfig",!0)("defaultValue",e.ReportStrategyDefaultValue.Gateway)}}function t7(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",8)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",10),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",9),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-slide-toggle",11),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"div",12)(13,"mat-form-field",13)(14,"mat-label",14),t.ɵɵtext(15,"gateway.thingsboard-host"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵconditionalCreate(20,K6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",13)(22,"mat-label",14),t.ɵɵtext(23,"gateway.thingsboard-port"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",17),t.ɵɵconditionalCreate(25,Y6,3,3,"mat-error")(26,X6,3,3,"mat-error")(27,Z6,3,3,"mat-error")(28,Q6,3,3,"mat-error"),t.ɵɵelementStart(29,"mat-icon",16),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵconditionalCreate(32,J6,1,0,"tb-gateway-security-configuration",18),t.ɵɵpipe(33,"async"),t.ɵɵconditionalCreate(34,e7,1,3,"tb-report-strategy",19),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,14,"gateway.hints.remote-configuration"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,16,"gateway.remote-configuration")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(8,18,"gateway.hints.remote-shell"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,20,"gateway.remote-shell")," "),t.ɵɵadvance(7),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,22,"gateway.hints.host"))),t.ɵɵadvance(3),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.host").hasError("required")?20:-1),t.ɵɵadvance(5),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.port").hasError("required")?25:e.basicFormGroup.get("thingsboard.port").hasError("min")?26:e.basicFormGroup.get("thingsboard.port").hasError("max")?27:e.basicFormGroup.get("thingsboard.port").hasError("pattern")?28:-1),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(30,24,"gateway.hints.port"))),t.ɵɵadvance(3),t.ɵɵconditional(t.ɵɵpipeBind1(33,26,e.initialCredentials$)?32:-1),t.ɵɵadvance(2),t.ɵɵconditional(e.withReportStrategy?34:-1)}}function n7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",22)(1,"mat-label",32),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-slide-toggle",33)(6,"mat-label",32),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(2,6,"gateway.hints.enable-general-statistics"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,8,"gateway.statistics.general-statistics")," "),t.ɵɵadvance(3),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(7,10,"gateway.hints.enable-custom-statistics"))),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,12,"gateway.statistics.custom-statistics")," "))}function i7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",22),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.statistics")," "))}function a7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.send-period-required")))}function r7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.send-period-min")))}function o7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.send-period-pattern")))}function s7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.custom-send-period-required")))}function l7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.custom-send-period-min")))}function p7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.custom-send-period-pattern")))}function c7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-required")))}function d7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-pattern")," "))}function u7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.time-series-name-already-exists")))}function m7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-required")))}function h7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-min")))}function g7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.timeout-pattern")))}function f7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.command-required")))}function y7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.command-pattern")))}function v7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",30)(1,"section",34)(2,"section",35)(3,"mat-form-field",36)(4,"mat-label",14),t.ɵɵtext(5,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",37),t.ɵɵconditionalCreate(7,c7,3,3,"mat-error")(8,d7,3,3,"mat-error")(9,u7,3,3,"mat-error"),t.ɵɵelementStart(10,"mat-icon",16),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"mat-form-field",36)(14,"mat-label",14),t.ɵɵtext(15,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",38),t.ɵɵconditionalCreate(17,m7,3,3,"mat-error")(18,h7,3,3,"mat-error")(19,g7,3,3,"mat-error"),t.ɵɵelementStart(20,"mat-icon",16),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(23,"section")(24,"mat-form-field",39)(25,"mat-label",14),t.ɵɵtext(26,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",40),t.ɵɵconditionalCreate(28,f7,3,3,"mat-error")(29,y7,3,3,"mat-error"),t.ɵɵelementStart(30,"mat-icon",16),t.ɵɵpipe(31,"translate"),t.ɵɵtext(32,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(33,"section")(34,"mat-expansion-panel",41)(35,"mat-expansion-panel-header")(36,"mat-panel-title")(37,"div",27),t.ɵɵtext(38,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(39,"mat-form-field",36)(40,"mat-label",14),t.ɵɵtext(41,"gateway.statistics.install-cmd"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",42),t.ɵɵelementStart(43,"mat-icon",43),t.ɵɵpipe(44,"translate"),t.ɵɵtext(45,"info_outlined "),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(46,"button",44),t.ɵɵpipe(47,"translate"),t.ɵɵlistener("click",function(n){const i=t.ɵɵrestoreView(e).$index,a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.removeCommandControl(i,n))}),t.ɵɵelementStart(48,"mat-icon"),t.ɵɵtext(49,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,i=n.$index,a=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("formGroupName",i),t.ɵɵadvance(6),t.ɵɵconditional(e.get("attributeOnGateway").hasError("required")?7:e.get("attributeOnGateway").hasError("pattern")?8:e.get("attributeOnGateway").hasError("duplicateName")?9:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(11,15,"gateway.hints.attribute"))),t.ɵɵadvance(7),t.ɵɵconditional(e.get("timeout").hasError("required")?17:e.get("timeout").hasError("min")?18:e.get("timeout").hasError("pattern")?19:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(21,17,"gateway.hints.timeout"))),t.ɵɵadvance(8),t.ɵɵconditional(e.get("command").hasError("required")?28:e.get("command").hasError("pattern")?29:-1),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(31,19,"gateway.hints.command"))),t.ɵɵadvance(13),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(44,21,"gateway.hints.install-cmd"))),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(47,23,"gateway.statistics.remove")))("disabled",!a.basicFormGroup.get("thingsboard.remoteConfiguration").value)}}function x7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",21),t.ɵɵconditionalCreate(2,n7,10,14)(3,i7,3,3,"mat-slide-toggle",22),t.ɵɵelementStart(4,"mat-form-field",23)(5,"mat-label",14),t.ɵɵtext(6,"gateway.statistics.send-period"),t.ɵɵelementEnd(),t.ɵɵelement(7,"input",24),t.ɵɵconditionalCreate(8,a7,3,3,"mat-error")(9,r7,3,3,"mat-error")(10,o7,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",23)(12,"mat-label",14),t.ɵɵtext(13,"gateway.statistics.custom-send-period"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",25),t.ɵɵconditionalCreate(15,s7,3,3,"mat-error")(16,l7,3,3,"mat-error")(17,p7,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",26)(19,"div",27),t.ɵɵtext(20,"gateway.statistics.commands"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",28),t.ɵɵtext(22,"gateway.hints.commands"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(23,29),t.ɵɵrepeaterCreate(24,v7,50,25,"div",30,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(26,"button",31),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.addCommand())}),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵconditional(e.hasUpdatedStatistics?2:3),t.ɵɵadvance(6),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("required")?8:e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("min")?9:e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("pattern")?10:-1),t.ɵɵadvance(7),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.statistics.customStatsSendPeriodInSeconds").hasError("required")?15:e.basicFormGroup.get("thingsboard.statistics.customStatsSendPeriodInSeconds").hasError("min")?16:e.basicFormGroup.get("thingsboard.statistics.customStatsSendPeriodInSeconds").hasError("pattern")?17:-1),t.ɵɵadvance(9),t.ɵɵrepeater(e.commandFormArray().controls),t.ɵɵadvance(2),t.ɵɵproperty("disabled",!e.basicFormGroup.get("thingsboard.remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(28,5,"gateway.statistics.add")," ")}}function b7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-timeout-seconds-required")))}function w7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-timeout-seconds-min")))}function S7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-timeout-seconds-pattern")))}function C7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-check-period-seconds-required")))}function _7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-check-period-seconds-min")))}function T7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.inactivity-check-period-seconds-pattern")))}function E7(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",35)(1,"mat-form-field",36)(2,"mat-label",14),t.ɵɵtext(3,"gateway.inactivity-timeout-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",53),t.ɵɵconditionalCreate(5,b7,3,3,"mat-error")(6,w7,3,3,"mat-error")(7,S7,3,3,"mat-error"),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",36)(12,"mat-label",14),t.ɵɵtext(13,"gateway.inactivity-check-period-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",54),t.ɵɵconditionalCreate(15,C7,3,3,"mat-error")(16,_7,3,3,"mat-error")(17,T7,3,3,"mat-error"),t.ɵɵelementStart(18,"mat-icon",16),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("required")?5:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("min")?6:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("pattern")?7:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(9,6,"gateway.hints.inactivity-timeout"))),t.ɵɵadvance(7),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("required")?15:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("min")?16:e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("pattern")?17:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(19,8,"gateway.hints.inactivity-period")))}}function M7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.min-pack-send-delay-required")))}function I7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.min-pack-send-delay-min")))}function k7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.min-pack-send-delay-pattern")))}function P7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.mqtt-qos-required")))}function D7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.mqtt-qos-range")))}function A7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.mqtt-qos-range")))}function O7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.check-connectors-configuration-required")))}function R7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.check-connectors-configuration-min")))}function B7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.check-connectors-configuration-pattern")))}function F7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.max-payload-size-bytes-required")))}function N7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.max-payload-size-bytes-min")))}function L7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.max-payload-size-bytes-pattern")))}function V7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.min-pack-size-to-send-required")))}function q7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.min-pack-size-to-send-min")))}function G7(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error"),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.min-pack-size-to-send-pattern")))}function z7(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",45)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",46),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(7,E7,21,10,"section",35),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",8)(9,"div",27),t.ɵɵtext(10,"gateway.advanced"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"section",35)(12,"mat-form-field",36)(13,"mat-label",14),t.ɵɵtext(14,"gateway.min-pack-send-delay"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",47),t.ɵɵconditionalCreate(16,M7,3,3,"mat-error")(17,I7,3,3,"mat-error")(18,k7,3,3,"mat-error"),t.ɵɵelementStart(19,"mat-icon",16),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"mat-form-field",36)(23,"mat-label",14),t.ɵɵtext(24,"gateway.mqtt-qos"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",48)(26,"mat-option",49),t.ɵɵtext(27,"0"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-option",49),t.ɵɵtext(29,"1"),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(30,P7,3,3,"mat-error")(31,D7,3,3,"mat-error")(32,A7,3,3,"mat-error"),t.ɵɵelementStart(33,"mat-icon",16),t.ɵɵpipe(34,"translate"),t.ɵɵtext(35,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(36,"section",35)(37,"mat-form-field",36)(38,"mat-label",14),t.ɵɵtext(39,"gateway.statistics.check-connectors-configuration"),t.ɵɵelementEnd(),t.ɵɵelement(40,"input",50),t.ɵɵconditionalCreate(41,O7,3,3,"mat-error")(42,R7,3,3,"mat-error")(43,B7,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",36)(45,"mat-label",14),t.ɵɵtext(46,"gateway.statistics.max-payload-size-bytes"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",51),t.ɵɵconditionalCreate(48,F7,3,3,"mat-error")(49,N7,3,3,"mat-error")(50,L7,3,3,"mat-error"),t.ɵɵelementStart(51,"mat-icon",16),t.ɵɵpipe(52,"translate"),t.ɵɵtext(53,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(54,"section",35)(55,"mat-form-field",36)(56,"mat-label",14),t.ɵɵtext(57,"gateway.statistics.min-pack-size-to-send"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",52),t.ɵɵconditionalCreate(59,V7,3,3,"mat-error")(60,q7,3,3,"mat-error")(61,G7,3,3,"mat-error"),t.ɵɵelementStart(62,"mat-icon",16),t.ɵɵpipe(63,"translate"),t.ɵɵtext(64,"info_outlined "),t.ɵɵelementEnd()()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassProp("no-padding-bottom",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value),t.ɵɵadvance(),t.ɵɵproperty("tb-hint-tooltip-icon",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,21,"gateway.hints.check-device-activity"))),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,23,"gateway.checking-device-activity")," "),t.ɵɵadvance(2),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value?7:-1),t.ɵɵadvance(9),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("required")?16:e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("min")?17:e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("pattern")?18:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(20,25,"gateway.hints.minimal-pack-delay"))),t.ɵɵadvance(7),t.ɵɵproperty("value",0),t.ɵɵadvance(2),t.ɵɵproperty("value",1),t.ɵɵadvance(2),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.qos").hasError("required")?30:e.basicFormGroup.get("thingsboard.qos").hasError("min")?31:e.basicFormGroup.get("thingsboard.qos").hasError("max")?32:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(34,27,"gateway.hints.qos"))),t.ɵɵadvance(8),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("required")?41:e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("min")?42:e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("pattern")?43:-1),t.ɵɵadvance(7),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("required")?48:e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("min")?49:e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("pattern")?50:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(52,29,"gateway.hints.max-payload-size-bytes"))),t.ɵɵadvance(8),t.ɵɵconditional(e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("required")?59:e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("min")?60:e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("pattern")?61:-1),t.ɵɵadvance(3),t.ɵɵproperty("matTooltip",t.ɵɵinterpolate(t.ɵɵpipeBind1(63,31,"gateway.hints.min-pack-size-to-send")))}}class U7{constructor(e,t,n,i,a){this.fb=e,this.deviceService=t,this.gatewayCredentialsService=n,this.destroyRef=i,this.dialog=a,this.gatewayVersion=ht.Legacy,this.dialogMode=!1,this.withReportStrategy=!1,this.initialized=new p,this.ReportStrategyDefaultValue=dn,this.initialCredentials$=this.gatewayCredentialsService.initialCredentials$,this.onChange=()=>{},this.destroy$=new _e,this.initBasicFormGroup(),this.observeFormChanges(),this.basicFormGroup.valueChanges.pipe(Ne(this.destroy$)).subscribe(()=>{this.onChange(this.basicFormGroup.getRawValue())})}ngOnChanges(e){e.withReportStrategy&&!e.withReportStrategy.firstChange&&this.withReportStrategy&&this.basicFormGroup.get("thingsboard.reportStrategy").enable({emitEvent:!1}),e.gatewayVersion?.previousValue!==e.gatewayVersion.currentValue&&this.onVersionChange()}ngAfterViewInit(){this.defaultTab&&(this.configGroup.selectedIndex=K5[this.defaultTab])}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){if(!e||Y(e,this.basicFormGroup.value))return;this.basicFormGroup.patchValue(e,{emitEvent:!1});const t=this.basicFormGroup.get("thingsboard.reportStrategy"),n=e?.thingsboard?.reportStrategy;"DISABLED"===n?.type?t.disable({emitEvent:!1}):this.withReportStrategy&&t.enable({emitEvent:!1});const i=e?.thingsboard?.statistics?.commands??[],a=this.commandFormArray().getRawValue();Y(i,a)||(this.commandFormArray().clear({emitEvent:!1}),i.forEach(e=>this.addCommand(e,!1)))}validate(){return this.basicFormGroup.valid?null:{basicFormGroup:{valid:!1}}}commandFormArray(){return this.basicFormGroup.get("thingsboard.statistics.commands")}removeCommandControl(e,t){""!==t.pointerType&&(this.commandFormArray().removeAt(e),this.basicFormGroup.markAsDirty())}openConfigurationConfirmDialog(){this.deviceService.getDevice(this.device.id).pipe(Ne(this.destroy$)).subscribe(e=>{this.dialog.open(u$,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{gatewayName:e.name}}).afterClosed().pipe(Ge(1)).subscribe(e=>{e||this.basicFormGroup.get("thingsboard.remoteConfiguration").setValue(!0,{emitEvent:!1})})})}addCommand(e,t=!0){const{attributeOnGateway:n=null,command:i=null,timeout:a=10,installCmd:r=""}=e||{},o=this.fb.group({attributeOnGateway:[n,[ve.required,ve.pattern(hn),this.uniqNameRequired()]],command:[i,[ve.required,ve.pattern(/^(?=\S).*\S$/)]],timeout:[a,[ve.required,ve.min(1),ve.pattern(mn),ve.pattern(/^[^.\s]+$/)]],installCmd:[r,ve.pattern(hn)]});this.commandFormArray().push(o,{emitEvent:t})}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase();return e.dirty&&t&&this.commandFormArray().value.some(e=>e.attributeOnGateway?.toLowerCase()===t)?{duplicateName:{valid:!1}}:null}}onInitialized(e){this.basicFormGroup.patchValue(e,{emitEvent:!1}),this.initialized.emit(this.basicFormGroup.value)}initBasicFormGroup(){this.basicFormGroup=this.fb.group({thingsboard:this.initThingsboardFormGroup(),storage:[],grpc:[],connectors:this.fb.array([]),logs:[]})}initThingsboardFormGroup(){return this.fb.group({host:[window.location.hostname,[ve.required,ve.pattern(/^[^\s]+$/)]],port:[1883,[ve.required,ve.min(1),ve.max(65535),ve.pattern(mn)]],remoteShell:[!1],remoteConfiguration:[!0],checkConnectorsConfigurationInSeconds:[60,[ve.required,ve.min(1),ve.pattern(mn)]],statistics:this.fb.group({enable:[!0],enableCustom:[{value:!1,disabled:!0}],statsSendPeriodInSeconds:[3600,[ve.required,ve.min(60),ve.pattern(mn)]],customStatsSendPeriodInSeconds:[3600,[ve.required,ve.min(60),ve.pattern(mn)]],commands:this.fb.array([])}),maxPayloadSizeBytes:[8196,[ve.required,ve.min(100),ve.pattern(mn)]],minPackSendDelayMS:[50,[ve.required,ve.min(10),ve.pattern(mn)]],minPackSizeToSend:[500,[ve.required,ve.min(100),ve.pattern(mn)]],handleDeviceRenaming:[!0],checkingDeviceActivity:this.initCheckingDeviceActivityFormGroup(),security:[],qos:[1],reportStrategy:[null]})}initCheckingDeviceActivityFormGroup(){return this.fb.group({checkDeviceInactivity:[!1],inactivityTimeoutSeconds:[300,[ve.min(1),ve.pattern(mn)]],inactivityCheckPeriodSeconds:[10,[ve.min(1),ve.pattern(mn)]]})}onVersionChange(){if(this.hasUpdatedStatistics=Qa.parseVersion(this.gatewayVersion)>=Qa.parseVersion(ht.v3_7_3),this.hasUpdatedStatistics){const e=this.basicFormGroup.get("thingsboard.statistics.enableCustom");e.enable({emitEvent:!1}),this.basicFormGroup.get("thingsboard.statistics.enable").valueChanges.pipe(de(this.destroyRef)).subscribe(t=>{t||e.patchValue(!1,{emitEvent:!1}),e[t?"enable":"disable"]({emitEvent:!1})})}}observeFormChanges(){this.observeRemoteConfigurationChanges(),this.observeDeviceActivityChanges()}observeRemoteConfigurationChanges(){this.basicFormGroup.get("thingsboard.remoteConfiguration").valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{e||this.openConfigurationConfirmDialog()})}observeDeviceActivityChanges(){const e=this.basicFormGroup.get("thingsboard.checkingDeviceActivity");e.get("checkDeviceInactivity").valueChanges.pipe(Ne(this.destroy$)).subscribe(t=>{e.updateValueAndValidity();const n=[ve.min(1),ve.required,ve.pattern(mn)];t?(e.get("inactivityTimeoutSeconds").setValidators(n),e.get("inactivityCheckPeriodSeconds").setValidators(n)):(e.get("inactivityTimeoutSeconds").clearValidators(),e.get("inactivityCheckPeriodSeconds").clearValidators()),e.get("inactivityTimeoutSeconds").updateValueAndValidity({emitEvent:!1}),e.get("inactivityCheckPeriodSeconds").updateValueAndValidity({emitEvent:!1})})}static{this.ɵfac=function(e){return new(e||U7)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(Z.DeviceService),t.ɵɵdirectiveInject(V6),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(Ke.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:U7,selectors:[["tb-gateway-basic-configuration"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery($6,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.configGroup=e.first)}},inputs:{device:"device",defaultTab:"defaultTab",gatewayVersion:"gatewayVersion",dialogMode:"dialogMode",withReportStrategy:"withReportStrategy"},outputs:{initialized:"initialized"},features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>U7),multi:!0},{provide:xe,useExisting:a(()=>U7),multi:!0}]),t.ɵɵNgOnChangesFeature],decls:20,vars:27,consts:[["configGroup",""],[1,"tab-group-block",3,"formGroup"],[3,"label"],["matTabContent",""],["formControlName","logs",1,"configuration-block",3,"initialized"],["formControlName","storage",3,"initialized"],["formControlName","grpc",3,"initialized"],["formGroupName","thingsboard",1,"mat-content","mat-padding","configuration-block"],[1,"tb-form-panel","no-padding-bottom"],[1,"tb-form-row","no-border","no-padding",3,"tb-hint-tooltip-icon"],["color","primary","formControlName","remoteConfiguration",1,"mat-slide"],["color","primary","formControlName","remoteShell",1,"mat-slide"],[1,"no-border","no-padding","tb-standard-fields","xs:flex-col","flex","gap-2"],["appearance","outline",1,"flex","flex-1"],["translate",""],["matInput","","formControlName","host"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["matInput","","formControlName","port","type","number","min","0"],["formControlName","security"],["formControlName","reportStrategy",1,"tb-form-panel",3,"isExpansionMode","isConfig","defaultValue"],["formControlName","security",3,"initialized"],["formGroupName","statistics",1,"tb-form-panel","no-padding-bottom"],["color","primary","formControlName","enable",1,"mat-slide"],["appearance","outline"],["matInput","","formControlName","statsSendPeriodInSeconds","type","number","min","60"],["matInput","","formControlName","customStatsSendPeriodInSeconds","type","number","min","60"],[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],["translate","",1,"tb-form-panel-hint"],["formGroupName","statistics"],["formArrayName","commands",1,"statistics-container","flex","flex-row"],["mat-stroked-button","","color","primary","type","button",2,"width","fit-content",3,"click","disabled"],[3,"tb-hint-tooltip-icon"],["color","primary","formControlName","enableCustom",1,"mat-slide"],[1,"tb-form-panel","stroked","no-padding-bottom","no-gap","command-container",3,"formGroupName"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields","column-xs"],["appearance","outline",1,"flex"],["matInput","","formControlName","attributeOnGateway"],["matInput","","formControlName","timeout","type","number","min","0"],["appearance","outline",1,"mat-block"],["matInput","","formControlName","command"],[1,"tb-settings","pb-4"],["matInput","","formControlName","installCmd"],["matIconSuffix","",1,"cursor-pointer",3,"matTooltip"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","disabled","matTooltip"],["formGroupName","checkingDeviceActivity",1,"tb-form-panel"],["color","primary","formControlName","checkDeviceInactivity",1,"mat-slide"],["matInput","","formControlName","minPackSendDelayMS","type","number","min","0"],["formControlName","qos"],[3,"value"],["matInput","","formControlName","checkConnectorsConfigurationInSeconds","type","number","min","0"],["matInput","","formControlName","maxPayloadSizeBytes","type","number","min","0"],["matInput","","formControlName","minPackSizeToSend","type","number","min","0"],["matInput","","formControlName","inactivityTimeoutSeconds","type","number","min","0"],["matInput","","type","number","min","0","formControlName","inactivityCheckPeriodSeconds"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-tab-group",1,0)(2,"mat-tab",2),t.ɵɵpipe(3,"translate"),t.ɵɵtemplate(4,t7,35,28,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-tab",2),t.ɵɵpipe(6,"translate"),t.ɵɵelementStart(7,"tb-gateway-logs-configuration",4),t.ɵɵlistener("initialized",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(i))}),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"mat-tab",2),t.ɵɵpipe(9,"translate"),t.ɵɵelementStart(10,"tb-gateway-storage-configuration",5),t.ɵɵlistener("initialized",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(i))}),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-tab",2),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"tb-gateway-grpc-configuration",6),t.ɵɵlistener("initialized",function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(i))}),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-tab",2),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,x7,29,7,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-tab",2),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,z7,65,33,"ng-template",3),t.ɵɵelementEnd()()}2&e&&(t.ɵɵclassProp("dialog-mode",n.dialogMode),t.ɵɵproperty("formGroup",n.basicFormGroup),t.ɵɵadvance(2),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(3,15,"gateway.general"))),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(6,17,"gateway.logs.logs"))),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(9,19,"gateway.storage"))),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(12,21,"gateway.grpc"))),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(15,23,"gateway.statistics.statistics"))),t.ɵɵadvance(3),t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(18,25,"gateway.other"))))},dependencies:t.ɵɵgetComponentDepsFactory(U7,[ce,C,ri,Y4,g6,M6,W6]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:grid;grid-template-rows:min-content minmax(auto,1fr) min-content}[_nghost-%COMP%] .configuration-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}[_nghost-%COMP%] .mat-toolbar[_ngcontent-%COMP%]{grid-row:1;background:transparent;color:#000000de!important}[_nghost-%COMP%] .tab-group-block[_ngcontent-%COMP%]{min-width:0;height:100%;min-height:0;grid-row:2}[_nghost-%COMP%] .toggle-group[_ngcontent-%COMP%]{margin-right:auto}[_nghost-%COMP%] .first-capital[_ngcontent-%COMP%]{text-transform:capitalize}[_nghost-%COMP%] textarea[_ngcontent-%COMP%]{resize:none}[_nghost-%COMP%] .saving-period[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] .command-container[_ngcontent-%COMP%]{width:100%}[_nghost-%COMP%] mat-form-field[_ngcontent-%COMP%] mat-error[_ngcontent-%COMP%]{display:none!important}[_nghost-%COMP%] mat-form-field[_ngcontent-%COMP%] mat-error[_ngcontent-%COMP%]:first-child{display:block!important}[_nghost-%COMP%] .pointer-event{pointer-events:all}[_nghost-%COMP%] .toggle-group span{padding:0 25px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{color:#e0e0e0}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix:hover{color:#9e9e9e}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex;align-items:center}']})}}e("GatewayBasicConfigurationComponent",U7),Ye([T()],U7.prototype,"dialogMode",void 0),Ye([T()],U7.prototype,"withReportStrategy",void 0);class j7{constructor(e){this.fb=e,this.destroy$=new _e,this.advancedFormControl=this.fb.control(""),this.advancedFormControl.valueChanges.pipe(Ne(this.destroy$)).subscribe(e=>{this.onChange(e),this.onTouched()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){this.advancedFormControl.reset(e,{emitEvent:!1})}validate(){return this.advancedFormControl.valid?null:{advancedFormControl:{valid:!1}}}static{this.ɵfac=function(e){return new(e||j7)(t.ɵɵdirectiveInject(fe.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:j7,selectors:[["tb-gateway-advanced-configuration"]],features:[t.ɵɵProvidersFeature([{provide:ye,useExisting:a(()=>j7),multi:!0},{provide:xe,useExisting:a(()=>j7),multi:!0}])],decls:2,vars:5,consts:[["fillHeight","true","jsonRequired","",1,"flex","h-full","flex-col","p-2",3,"label","formControl"]],template:function(e,n){1&e&&(t.ɵɵelement(0,"tb-json-object-edit",0),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("label",t.ɵɵinterpolate(t.ɵɵpipeBind1(1,3,"gateway.configuration")))("formControl",n.advancedFormControl)},dependencies:t.ɵɵgetComponentDepsFactory(j7,[C]),encapsulation:2})}}function H7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",14),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.cancel())}),t.ɵɵelementStart(1,"mat-icon",15),t.ɵɵtext(2,"close"),t.ɵɵelementEnd()()}}function W7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-basic-configuration",16),t.ɵɵpipe(1,"withReportStrategy"),t.ɵɵlistener("initialized",function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onInitialized(n))}),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("device",e.device)("defaultTab",e.defaultTab)("gatewayVersion",e.gatewayVersion)("dialogMode",!!e.dialogRef)("withReportStrategy",t.ɵɵpipeBind1(1,5,e.gatewayVersion))}}function $7(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-advanced-configuration",10)}function K7(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",17),t.ɵɵlistener("click",function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.cancel())}),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()}2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"action.cancel")," "))}e("GatewayAdvancedConfigurationComponent",j7);class Y7{constructor(e,t,n,i,a){this.fb=e,this.attributeService=t,this.cd=n,this.gatewayCredentialsService=i,this.destroyRef=a,this.ConfigurationModes=pn,this.gatewayConfigAttributeKeys=["general_configuration","grpc_configuration","logs_configuration","storage_configuration","RemoteLoggingLevel","mode"],this.useUpdatedLogs=!1,this.gatewayConfigGroup=this.fb.group({basicConfig:[],advancedConfig:[],mode:[pn.BASIC]}),this.observeAlignConfigs()}ngAfterViewInit(){this.fetchConfigAttribute(this.device)}saveConfig(){const{mode:e,advancedConfig:t}=pe(this.removeEmpty(this.gatewayConfigGroup.value)),n={mode:e,...t};n.thingsboard.statistics.commands=Object.values(n.thingsboard.statistics.commands??[]),n.thingsboard.reportStrategy||(n.thingsboard.reportStrategy={type:"DISABLED"});const i=this.generateAttributes(n);this.attributeService.saveEntityAttributes(this.device,P.SHARED_SCOPE,i).pipe(Ue(e=>this.gatewayCredentialsService.updateCredentials(n.thingsboard.security)),de(this.destroyRef)).subscribe(()=>{this.dialogRef?this.dialogRef.close():(this.gatewayConfigGroup.markAsPristine(),this.cd.detectChanges())})}onInitialized(e){this.gatewayConfigGroup.get("basicConfig").patchValue(e,{emitEvent:!1}),this.gatewayConfigGroup.get("advancedConfig").patchValue(e,{emitEvent:!1})}observeAlignConfigs(){this.gatewayConfigGroup.get("basicConfig").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{const t=this.gatewayConfigGroup.get("advancedConfig");Y(t.value,e)||this.gatewayConfigGroup.get("mode").value!==pn.BASIC||t.patchValue(e,{emitEvent:!1})}),this.gatewayConfigGroup.get("advancedConfig").valueChanges.pipe(de(this.destroyRef)).subscribe(e=>{const t=this.gatewayConfigGroup.get("basicConfig");Y(t.value,e)||this.gatewayConfigGroup.get("mode").value!==pn.ADVANCED||t.patchValue(e,{emitEvent:!1})})}generateAttributes(e){const t=[],n=(e,n)=>{t.push({key:e,value:n})},i=(e,t)=>{t={...t,ts:(new Date).getTime()},n(e,t)};return n("RemoteLoggingLevel",e.logs?.logLevel??mt.NONE),delete e.connectors,n("logs_configuration",this.generateLogsFile(e.logs)),i("grpc_configuration",e.grpc),i("storage_configuration",e.storage),i("general_configuration",e.thingsboard),n("mode",e.mode),t}cancel(){this.dialogRef&&this.dialogRef.close()}removeEmpty(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>null!=t).map(([e,t])=>[e,t===Object(t)?this.removeEmpty(t):t]))}generateLogsFile(e){const t={version:1,disable_existing_loggers:!1,formatters:{LogFormatter:{class:"logging.Formatter",format:e.logFormat,datefmt:e.dateFormat}},handlers:{consoleHandler:{class:"logging.StreamHandler",formatter:"LogFormatter",level:0,stream:"ext://sys.stdout"}},loggers:{...this.useUpdatedLogs?{}:{database:{handlers:["consoleHandler"],level:"DEBUG",propagate:!1}}},root:{level:"ERROR",handlers:["consoleHandler"]},ts:(new Date).getTime()};return this.addLocalLoggers(t,e?.local),t}addLocalLoggers(e,t){if(t)for(const n of Object.keys(t))e.handlers[n+"Handler"]=this.createHandlerObj(t[n],n),e.loggers[n]=this.createLoggerObj(t[n],n)}createHandlerObj(e,t){return{class:this.useUpdatedLogs?i4:a4,formatter:"LogFormatter",filename:`${e.filePath}/${t}.log`,backupCount:e.backupCount,interval:e.savingTime,when:e.savingPeriod,encoding:"utf-8"}}createLoggerObj(e,t){return{handlers:[`${t}Handler`,"consoleHandler"],level:e.logLevel,propagate:!1}}fetchConfigAttribute(e){e.id!==O&&this.attributeService.getEntityAttributes(e,P.CLIENT_SCOPE).pipe(He(t=>t.length?Ie(t):this.attributeService.getEntityAttributes(e,P.SHARED_SCOPE,this.gatewayConfigAttributeKeys)),de(this.destroyRef)).subscribe(e=>{this.gatewayVersion=e.find(e=>"Version"===e.key)?.value,this.useUpdatedLogs=Qa.parseVersion(this.gatewayVersion??ht.Legacy)>=Qa.parseVersion(ht.v3_6_3),this.updateConfigs(e),this.cd.detectChanges()})}updateConfigs(e){let t={},n=mt.NONE;this.gatewayCredentialsService.setInitialCredentials(this.device),e.forEach(e=>{switch(e.key){case"general_configuration":e.value&&(t={...t,thingsboard:e.value});break;case"grpc_configuration":e.value&&(t={...t,grpc:e.value});break;case"logs_configuration":e.value&&(t={...t,logs:this.logsToObj(e.value)});break;case"storage_configuration":e.value&&(t={...t,storage:e.value});break;case"mode":t={...t,mode:e.value??pn.BASIC};break;case"RemoteLoggingLevel":e.value&&(n=e.value)}}),t.logs&&(t={...t,logs:{...t.logs,logLevel:n}}),t.thingsboard?.security?this.gatewayCredentialsService.initialCredentials$.pipe(Be(Boolean),Ge(1),de(this.destroyRef)).subscribe(e=>{this.gatewayCredentialsService.shouldUpdateSecurityConfig(t.thingsboard.security)&&(t.thingsboard.security=this.gatewayCredentialsService.credentialsToSecurityConfig(e)),this.gatewayConfigGroup.get("basicConfig").patchValue(t,{emitEvent:!1}),this.gatewayConfigGroup.get("advancedConfig").patchValue(t,{emitEvent:!1})}):(this.gatewayConfigGroup.get("basicConfig").patchValue(t,{emitEvent:!1}),this.gatewayConfigGroup.get("advancedConfig").patchValue(t,{emitEvent:!1}))}logsToObj(e){const{format:t,datefmt:n}=e.formatters.LogFormatter;return{local:Object.keys(X5).reduce((t,n)=>{const i=e.handlers[`${n}Handler`]||{},a=e.loggers[n]||{};return t[n]={logLevel:a.level||mt.INFO,filePath:i.filename?.split(`/${n}`)[0]||"./logs",backupCount:i.backupCount||7,savingTime:i.interval||3,savingPeriod:i.when||J5.days},t},{}),logFormat:t,dateFormat:n}}static{this.ɵfac=function(e){return new(e||Y7)(t.ɵɵdirectiveInject(fe.FormBuilder),t.ɵɵdirectiveInject(Z.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(V6),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Y7,selectors:[["tb-gateway-configuration"]],inputs:{device:"device",defaultTab:"defaultTab",dialogRef:"dialogRef"},features:[t.ɵɵProvidersFeature([V6])],decls:24,vars:25,consts:[[1,"flex","size-full","max-w-full","flex-col",3,"formGroup"],["color","primary"],[1,"tb-flex","space-between","align-center","h-16"],["tbTruncateWithTooltip",""],[1,"flex","items-center"],["formControlName","mode",3,"appearance"],[3,"value"],["mat-icon-button","","type","button"],[1,"content-wrapper","flex-1"],["formControlName","basicConfig",3,"device","defaultTab","gatewayVersion","dialogMode","withReportStrategy"],["formControlName","advancedConfig"],[1,"flex","h-full","items-center","justify-end","gap-2","pr-4"],["mat-button","","color","primary","type","button"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],["mat-icon-button","","type","button",3,"click"],[1,"material-icons"],["formControlName","basicConfig",3,"initialized","device","defaultTab","gatewayVersion","dialogMode","withReportStrategy"],["mat-button","","color","primary","type","button",3,"click"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"mat-toolbar",1)(2,"div",2)(3,"h2")(4,"div",3),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",4)(8,"tb-toggle-select",5)(9,"tb-toggle-option",6),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"tb-toggle-option",6),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd()(),t.ɵɵconditionalCreate(15,H7,3,0,"button",7),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8),t.ɵɵconditionalCreate(17,W7,2,7,"tb-gateway-basic-configuration",9)(18,$7,1,0,"tb-gateway-advanced-configuration",10),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",11),t.ɵɵconditionalCreate(20,K7,3,3,"button",12),t.ɵɵelementStart(21,"button",13),t.ɵɵlistener("click",function(){return n.saveConfig()}),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.gatewayConfigGroup),t.ɵɵadvance(),t.ɵɵclassProp("page-header",!n.dialogRef),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(6,17,"gateway.gateway-configuration")),t.ɵɵadvance(3),t.ɵɵclassProp("dialog-toggle",!!n.dialogRef),t.ɵɵproperty("appearance",t.ɵɵinterpolate(n.dialogRef?"stroked":"fill")),t.ɵɵadvance(),t.ɵɵproperty("value",n.ConfigurationModes.BASIC),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,19,"gateway.basic")," "),t.ɵɵadvance(2),t.ɵɵproperty("value",n.ConfigurationModes.ADVANCED),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(14,21,"gateway.advanced")," "),t.ɵɵadvance(2),t.ɵɵconditional(n.dialogRef?15:-1),t.ɵɵadvance(2),t.ɵɵconditional(n.gatewayConfigGroup.get("mode").value===n.ConfigurationModes.BASIC?17:18),t.ɵɵadvance(3),t.ɵɵconditional(n.dialogRef?20:-1),t.ɵɵadvance(),t.ɵɵproperty("disabled",n.gatewayConfigGroup.invalid||!n.gatewayConfigGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,23,"action.save")," "))},dependencies:t.ɵɵgetComponentDepsFactory(Y7,[C,ar,U7,j7]),styles:['@charset "UTF-8";[_nghost-%COMP%]{overflow:hidden;padding:0!important;max-height:75vh;height:75vh;width:800px;max-width:80vw}@media screen and (max-width:599px){[_nghost-%COMP%]{max-height:100%;height:100%;width:100%;max-width:100%}}[_nghost-%COMP%] .page-header.mat-toolbar[_ngcontent-%COMP%]{background:transparent;color:#000000de!important}[_nghost-%COMP%] .content-wrapper[_ngcontent-%COMP%]{min-height:calc(100% - 116px)}.dialog-toggle[_ngcontent-%COMP%] .mat-button-toggle-button{color:#ffffffbf}']})}}e("GatewayConfigurationComponent",Y7);class X7{constructor(){}static{this.ɵfac=function(e){return new(e||X7)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:X7,selectors:[["tb-lib-styles-entry"]],decls:0,vars:0,template:function(e,t){},styles:['@charset "UTF-8";.gw-delete-icon-button{color:#0000008a}.gw-connector-table .mat-mdc-table{table-layout:fixed}.gw-chip-list .mdc-evolution-chip-set__chips{justify-content:flex-end;align-items:center}.gw-table-toolbar.mat-mdc-table-toolbar.mat-mdc-table-toolbar{padding:0 8px}.see-example{display:flex}.tb-default .size-min{width:-moz-min-content;width:min-content;height:-moz-min-content;height:min-content}.tb-default .h-\\[500px\\]{height:500px}.tb-default .max-h-full{max-height:100%}.tb-default .w-12{width:3rem}.tb-default .w-\\[77vw\\]{width:77vw}.tb-default .max-w-2xl{max-width:42rem}.tb-default .max-w-3xl{max-width:48rem}.tb-default .max-w-4\\/12{max-width:33.333333%}.tb-default .max-w-\\[11vw\\]{max-width:11vw}.tb-default .flex-\\[1_1_30px\\]{flex:1 1 30px}.tb-default .flex-\\[1_1_33\\%\\]{flex:1 1 33%}.tb-default .gap-1\\.25{gap:.3125rem}.tb-default .\\!pl-0{padding-left:0!important}@media(max-width:599px){.tb-default .lt-sm\\:flex-col{flex-direction:column}}\n'],encapsulation:2})}}const Z7=(e,t)=>{const n=e[h];if(n.styles?.length){const e=n.styles[0];let i=document.getElementById(t);if(!i){i=document.createElement("style"),i.id=t;(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}i.innerHTML=e}};class Q7{constructor(e,t,n){this.translate=e,this.store=t,this.destroyRef=n,Lt(e,t),this.translate.onLangChange.pipe(de(this.destroyRef),Be(e=>e.lang!==wt.English)).subscribe(()=>{Lt(e,t)}),(e=>{Z7(X7,e)})("tb-gateway-css")}static{this.ɵfac=function(e){return new(e||Q7)(t.ɵɵinject(me.TranslateService),t.ɵɵinject(me.TranslateStore),t.ɵɵinject(t.DestroyRef))}}static{this.ɵmod=t.ɵɵdefineNgModule({type:Q7})}static{this.ɵinj=t.ɵɵdefineInjector({imports:[ce,C,ge,Dj,c$,oK,Y7,Pn,$5,W5]})}}e("GatewayExtensionModule",Q7),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(Q7,{imports:[ce,C,ge,Dj,c$,oK,Y7,Pn,$5,W5]})}}});//# sourceMappingURL=gateway-management-extension.js.map diff --git a/application/src/main/data/upgrade/lts/4.4.1.0/schema_update.sql b/application/src/main/data/upgrade/lts/4.4.1.0/schema_update.sql index 7d857eb6b2..8779620567 100644 --- a/application/src/main/data/upgrade/lts/4.4.1.0/schema_update.sql +++ b/application/src/main/data/upgrade/lts/4.4.1.0/schema_update.sql @@ -6,3 +6,5 @@ -- Tenant-scoped paging over calculated fields (WHERE tenant_id = ? ORDER BY id LIMIT ?), issued for every tenant -- when the calculated field actors initialize, otherwise scans the whole table and sorts on each call. CREATE INDEX IF NOT EXISTS idx_calculated_field_tenant_id_id ON calculated_field(tenant_id, id); + +ALTER TABLE ai_model ADD COLUMN IF NOT EXISTS customer_access_enabled BOOLEAN NOT NULL DEFAULT FALSE; diff --git a/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java b/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java index 27c3b76e73..b3e79c092d 100644 --- a/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java +++ b/application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java @@ -37,6 +37,7 @@ import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.springdoc.core.customizers.OpenApiCustomizer; import org.springdoc.core.customizers.OperationCustomizer; +import org.springdoc.core.customizers.ParameterCustomizer; import org.springdoc.core.discoverer.SpringDocParameterNameDiscoverer; import org.springdoc.core.models.GroupedOpenApi; import org.springdoc.core.properties.SpringDocConfigProperties; @@ -49,11 +50,14 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Profile; +import org.springframework.core.MethodParameter; import org.springframework.http.HttpStatus; +import org.springframework.util.ClassUtils; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.ai.model.chat.AiChatModelConfig; import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; +import org.thingsboard.server.common.data.query.AliasEntityType; import org.thingsboard.server.exception.ThingsboardCredentialsExpiredResponse; import org.thingsboard.server.exception.ThingsboardErrorResponse; import org.thingsboard.server.service.security.auth.rest.LoginRequest; @@ -108,6 +112,7 @@ public class SwaggerConfiguration { // Keyed by the schema name that swagger-core generates (see resolveSchemaName). private final Map> schemaPropertyOrders = new ConcurrentHashMap<>(); private final Map> schemaOwnProps = new ConcurrentHashMap<>(); + private final Map> schemaNotRequiredProps = new ConcurrentHashMap<>(); // Tracks schema name → fully-qualified class names to detect collisions. private final Map> schemaNameToClasses = new ConcurrentHashMap<>(); @@ -269,7 +274,8 @@ public class SwaggerConfiguration { var requestBody = new RequestBody().description("Refresh token request") .content(new Content().addMediaType(APPLICATION_JSON_VALUE, - new MediaType().schema(new Schema().addProperty("refreshToken", new Schema<>().type("string"))))); + new MediaType().schema(new Schema().types(Set.of("object")) + .addProperty("refreshToken", new Schema<>().types(Set.of("string")))))); operation.requestBody(requestBody); @@ -291,6 +297,38 @@ public class SwaggerConfiguration { .build(); } + // springdoc infers the parameter type from the Java type only when @Parameter(schema = @Schema(...)) + // sets neither type nor implementation; otherwise (e.g. schema = @Schema(minimum = "1")) it falls back + // to "string". Restore integer/int32 or integer/int64 for int and long parameters, keeping the rest of the schema. + @Bean + public ParameterCustomizer integerParameterCustomizer() { + return (parameter, methodParameter) -> { + if (parameter == null || parameter.getSchema() == null) { + return parameter; + } + Schema schema = parameter.getSchema(); + boolean isString = "string".equals(schema.getType()) || Set.of("string").equals(schema.getTypes()); + String format = integerFormat(methodParameter); + if (isString && format != null && schema.getFormat() == null) { + schema.setType("integer"); + schema.setTypes(Set.of("integer")); + schema.setFormat(format); + } + return parameter; + }; + } + + private static String integerFormat(MethodParameter methodParameter) { + Class type = ClassUtils.resolvePrimitiveIfNecessary(methodParameter.getParameterType()); + if (Integer.class.equals(type)) { + return "int32"; + } + if (Long.class.equals(type)) { + return "int64"; + } + return null; + } + @Bean @Lazy(false) ModelConverter mapAwareConverter() { @@ -349,6 +387,10 @@ public class SwaggerConfiguration { if (!ownProps.isEmpty()) { schemaOwnProps.put(schemaName, ownProps); } + Set notRequiredProps = computeNotRequiredPropNames(beanDesc); + if (!notRequiredProps.isEmpty()) { + schemaNotRequiredProps.put(schemaName, notRequiredProps); + } } catch (Exception e) { log.debug("Failed to resolve property order for {}: {}", cls.getName(), e.getMessage()); } @@ -361,9 +403,11 @@ public class SwaggerConfiguration { }; } + // The document is OpenAPI 3.1 (see springDocProperties above), which serializes + // Schema.types; a schema built with Schema.type(...) is written without a type. private void addDefaultSchemas(OpenAPI openAPI) { Schema errorCodeSchema = new Schema<>() - .type("integer") + .types(Set.of("integer")) .description("Platform error code") ._enum(Arrays.stream(ThingsboardErrorCode.values()) .map(ThingsboardErrorCode::getErrorCode) @@ -374,11 +418,17 @@ public class SwaggerConfiguration { registerSchema(components, "ThingsboardErrorResponse", ThingsboardErrorResponse.class); registerSchema(components, "ThingsboardCredentialsExpiredResponse", ThingsboardCredentialsExpiredResponse.class); components.addSchemas("ThingsboardErrorCode", errorCodeSchema); + // AliasEntityId.entityType is a plain string, so no schema references AliasEntityType; + // register it to keep the alias names in the spec and in generated clients. + components.addSchemas("AliasEntityType", new Schema() + .types(Set.of("string")) + .description("Alias for an entity of the current user, used as AliasEntityId.entityType") + ._enum(Arrays.stream(AliasEntityType.values()).map(Enum::name).toList())); registerSchema(components, "AiChatModelConfig", AiChatModelConfig.class); } private static void registerSchema(Components components, String name, Class cls) { - ResolvedSchema resolved = ModelConverters.getInstance() + ResolvedSchema resolved = ModelConverters.getInstance(true) .readAllAsResolvedSchema(new AnnotatedType().type(cls)); components.addSchemas(name, resolved.schema); if (resolved.referencedSchemas != null) { @@ -528,6 +578,8 @@ public class SwaggerConfiguration { deduplicateAllOfProperties(schema, schemas, ownProps); }); + removeNotRequiredProperties(schemas); + // Reorder properties for all component schemas. This runs after all // schemas are finalized so it covers schemas the ModelConverter only // saw as a $ref (e.g. interface-based discriminator types like EntityId). @@ -1112,6 +1164,46 @@ public class SwaggerConfiguration { return own; } + // Honour an explicit @Schema(requiredMode = NOT_REQUIRED): swagger-core skips @NotNull + // for such properties, but still adds the ones with @NotBlank / @NotEmpty to 'required'. + void removeNotRequiredProperties(Map schemas) { + schemas.forEach((schemaName, schema) -> { + Set notRequiredProps = schemaNotRequiredProps.getOrDefault(schemaName, Set.of()); + removeRequiredProperties(schema, notRequiredProps); + }); + } + + private static Set computeNotRequiredPropNames(com.fasterxml.jackson.databind.BeanDescription beanDesc) { + Set notRequired = new LinkedHashSet<>(); + for (var prop : beanDesc.findProperties()) { + var member = prop.getPrimaryMember(); + if (member == null) continue; + var schemaAnnotation = member.getAnnotation(io.swagger.v3.oas.annotations.media.Schema.class); + if (schemaAnnotation != null && schemaAnnotation.requiredMode() == io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED) { + notRequired.add(prop.getName()); + } + } + return notRequired; + } + + private static void removeRequiredProperties(Schema schema, Set notRequiredProps) { + if (notRequiredProps.isEmpty()) { + return; + } + List schemas = new ArrayList<>(); + schemas.add(schema); + if (schema.getAllOf() != null) { + schemas.addAll(schema.getAllOf()); + } + for (Schema s : schemas) { + if (s.getRequired() != null && s.getRequired().stream().anyMatch(notRequiredProps::contains)) { + List required = new ArrayList<>(s.getRequired()); + required.removeAll(notRequiredProps); + s.setRequired(required.isEmpty() ? null : required); + } + } + } + @SuppressWarnings("unchecked") private static void reorderSchemaProperties(Schema schema, List propOrder) { if (schema.getProperties() != null && schema.getProperties().size() > 1) { diff --git a/application/src/main/java/org/thingsboard/server/controller/AdminController.java b/application/src/main/java/org/thingsboard/server/controller/AdminController.java index 4b54eca8f2..8f6ff14d60 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AdminController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AdminController.java @@ -132,7 +132,7 @@ public class AdminController extends BaseController { public AdminSettings getAdminSettings( @Parameter(description = "A string value of the key (e.g. 'general' or 'mail').") @PathVariable("key") String key, - @Parameter(description = "Use system settings if settings are not defined on tenant level.") + @Parameter(description = "Deprecated, not used.") @RequestParam(required = false, defaultValue = "false") boolean systemByDefault) throws Exception { Authority authority = getCurrentUser().getAuthority(); AdminSettings adminSettings; @@ -141,7 +141,7 @@ public class AdminController extends BaseController { adminSettings = checkNotNull(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, key), "No Administration settings found for key: " + key); } else { accessControlService.checkPermission(getCurrentUser(), Resource.WHITE_LABELING, Operation.READ); - adminSettings = getTenantAdminSettings(getTenantId(), key, systemByDefault); + adminSettings = getTenantAdminSettings(getTenantId(), key, false); } if (adminSettings.getKey().equals(MAIL_SETTINGS_KEY)) { ((ObjectNode) adminSettings.getJsonValue()).remove("refreshToken"); diff --git a/application/src/main/java/org/thingsboard/server/controller/AiChatController.java b/application/src/main/java/org/thingsboard/server/controller/AiChatController.java index 8b14c71743..bbd9366776 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AiChatController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AiChatController.java @@ -109,6 +109,20 @@ class AiChatController extends BaseController { return withTraceLogging(chatId, aiChatService.sendChatMessage(chatId, request, tbAccessToken, acceptLanguage, clientOrigin, user)); } + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @PostMapping(value = "/{chatId}/resume", produces = MediaType.TEXT_EVENT_STREAM_VALUE) + public Flux> resumeChat( + @PathVariable UUID chatId, + @RequestHeader(AUTHORIZATION_HEADER) String tbAccessToken, + @RequestHeader(value = HttpHeaders.ACCEPT_LANGUAGE, required = false) String acceptLanguage, + HttpServletRequest httpRequest + ) throws ThingsboardException { + SecurityUser user = getCurrentUser(); + accessControlService.checkPermission(user, Resource.AI, Operation.WRITE); + String clientOrigin = systemSecurityService.getBaseUrl(user.getTenantId(), user.getCustomerId(), httpRequest); + return withTraceLogging(chatId, aiChatService.resumeChat(chatId, tbAccessToken, acceptLanguage, clientOrigin, user)); + } + private Flux> withTraceLogging(UUID chatId, Flux> events) { return events.doOnNext(event -> { if (log.isTraceEnabled()) { diff --git a/application/src/main/java/org/thingsboard/server/controller/AiModelController.java b/application/src/main/java/org/thingsboard/server/controller/AiModelController.java index 646e3e06af..47ee513702 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AiModelController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AiModelController.java @@ -21,9 +21,12 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.async.DeferredResult; import org.thingsboard.server.common.data.ai.AiModel; +import org.thingsboard.server.common.data.ai.AiModelInfo; +import org.thingsboard.server.common.data.ai.dto.TbChatPrompt; import org.thingsboard.server.common.data.ai.dto.TbChatRequest; import org.thingsboard.server.common.data.ai.dto.TbChatResponse; import org.thingsboard.server.common.data.ai.model.chat.AiChatModelConfig; +import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.AiModelId; import org.thingsboard.server.common.data.page.PageData; @@ -32,6 +35,7 @@ import org.thingsboard.server.common.data.permission.Resource; import org.thingsboard.server.config.annotations.ApiOperation; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.ai.AiChatModelService; +import org.thingsboard.server.service.security.model.SecurityUser; import java.time.Duration; import java.util.Optional; @@ -45,6 +49,7 @@ import static org.thingsboard.server.controller.ControllerConstants.PAGE_SIZE_DE import static org.thingsboard.server.controller.ControllerConstants.SORT_ORDER_DESCRIPTION; import static org.thingsboard.server.controller.ControllerConstants.SORT_PROPERTY_DESCRIPTION; import static org.thingsboard.server.controller.ControllerConstants.TENANT_AUTHORITY_PARAGRAPH; +import static org.thingsboard.server.controller.ControllerConstants.TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH; @Validated @RestController @@ -115,6 +120,31 @@ class AiModelController extends BaseController { return aiModelService.findAiModelsByTenantId(user.getTenantId(), pageLink); } + @ApiOperation( + value = "Get AI model infos (getAiModelInfos)", + notes = "Returns a page of AI model infos: AI models with the provider credentials removed, so 'configuration.providerConfig' is always null. " + + PAGE_DATA_PARAMETERS + TENANT_AUTHORITY_PARAGRAPH + ) + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @GetMapping("/infos") + public PageData getAiModelInfos( + @Parameter(description = PAGE_SIZE_DESCRIPTION, required = true) + @RequestParam int pageSize, + @Parameter(description = PAGE_NUMBER_DESCRIPTION, required = true) + @RequestParam int page, + @Parameter(description = AI_MODEL_TEXT_SEARCH_DESCRIPTION) + @RequestParam(required = false) String textSearch, + @Parameter(description = SORT_PROPERTY_DESCRIPTION, schema = @Schema(allowableValues = {"createdTime", "name", "provider", "modelId"})) + @RequestParam(required = false) String sortProperty, + @Parameter(description = SORT_ORDER_DESCRIPTION, schema = @Schema(allowableValues = {"ASC", "DESC"})) + @RequestParam(required = false) String sortOrder + ) throws ThingsboardException { + var user = getCurrentUser(); + accessControlService.checkPermission(user, Resource.AI_MODEL, Operation.READ); + var pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder); + return aiModelService.findAiModelsByTenantId(user.getTenantId(), pageLink).mapData(AiModelInfo::from); + } + @ApiOperation( value = "Delete AI model by ID (deleteAiModelById)", notes = "Deletes the AI model record by its `id`. " + @@ -152,15 +182,53 @@ class AiModelController extends BaseController { @PreAuthorize("hasAuthority('TENANT_ADMIN')") @PostMapping("/chat") public DeferredResult sendChatRequest(@Valid @RequestBody TbChatRequest tbChatRequest) throws ThingsboardException { - ChatRequest langChainChatRequest = tbChatRequest.toLangChainChatRequest(); - AiChatModelConfig chatModelConfig = tbChatRequest.chatModelConfig(); + return executeChatRequest(tbChatRequest.chatModelConfig(), tbChatRequest.toLangChainChatRequest()); + } - ListenableFuture future = aiChatModelService.sendChatRequestAsync(getTenantId(), chatModelConfig, langChainChatRequest) + @ApiOperation( + value = "Send request to a saved AI chat model (sendChatRequestToAiModel)", + notes = "Submits a single prompt - made up of an optional system message and a required user message - to the AI chat model " + + "with the specified `id`, using its saved configuration, and returns either the generated answer or an error envelope. " + + "The user must have the 'INVOKE' permission for AI models, and customer users additionally require the model to have customer access enabled. " + + "Roles that grant all operations, such as the default 'Customer Administrator' role, include 'INVOKE', " + + "so enabling customer access makes the model callable by every customer user with such a role." + + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH + ) + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") + @PostMapping("/{modelUuid}/chat") + public DeferredResult sendChatRequestToAiModel( + @Parameter( + description = "ID of the AI model record", + required = true, + example = "de7900d4-30e2-11f0-9cd2-0242ac120002" + ) + @PathVariable UUID modelUuid, + @Valid @RequestBody TbChatPrompt tbChatPrompt + ) throws ThingsboardException { + AiModel model = checkAiModelId(new AiModelId(modelUuid), Operation.INVOKE); + if (!(model.getConfiguration() instanceof AiChatModelConfig chatModelConfig)) { + throw new ThingsboardException("AI model with id [" + modelUuid + "] is not a chat model", ThingsboardErrorCode.BAD_REQUEST_PARAMS); + } + return executeChatRequest(chatModelConfig, tbChatPrompt.toLangChainChatRequest()); + } + + private DeferredResult executeChatRequest(AiChatModelConfig chatModelConfig, ChatRequest chatRequest) throws ThingsboardException { + SecurityUser user = getCurrentUser(); + ListenableFuture future = aiChatModelService.sendChatRequestAsync(user.getTenantId(), chatModelConfig, chatRequest) .transform(chatResponse -> (TbChatResponse) new TbChatResponse.Success(chatResponse.aiMessage().text()), directExecutor()) - .catching(Throwable.class, ex -> new TbChatResponse.Failure(ex.getMessage()), directExecutor()); + .catching(Throwable.class, ex -> toFailure(user, ex), directExecutor()); Integer requestTimeoutSeconds = chatModelConfig.timeoutSeconds(); return requestTimeoutSeconds != null ? wrapFuture(future, Duration.ofSeconds(requestTimeoutSeconds).toMillis()) : wrapFuture(future); } + private TbChatResponse.Failure toFailure(SecurityUser user, Throwable ex) { + if (!user.isCustomerUser()) { + return new TbChatResponse.Failure(ex.getMessage()); + } + // Provider errors may reveal configuration details that customer users must not see + log.debug("[{}] Chat request of customer user [{}] failed", user.getTenantId(), user.getId(), ex); + return new TbChatResponse.Failure("Failed to get a response from the AI model"); + } + } diff --git a/application/src/main/java/org/thingsboard/server/controller/AiResourceController.java b/application/src/main/java/org/thingsboard/server/controller/AiResourceController.java new file mode 100644 index 0000000000..b49e7ae14c --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/controller/AiResourceController.java @@ -0,0 +1,88 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.controller; + +import com.fasterxml.jackson.databind.JsonNode; +import lombok.RequiredArgsConstructor; +import org.springframework.http.CacheControl; +import org.springframework.http.ContentDisposition; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import org.thingsboard.server.common.data.exception.ThingsboardException; +import org.thingsboard.server.common.data.permission.Operation; +import org.thingsboard.server.common.data.permission.Resource; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.ai.resource.AiResourceService; +import org.thingsboard.server.service.security.model.SecurityUser; + +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.UUID; + +@RequiredArgsConstructor +@RestController +@TbCoreComponent +@RequestMapping("/api/ai/resources") +class AiResourceController extends BaseController { + + private final AiResourceService aiResourceService; + + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @GetMapping("/config") + public JsonNode getAiResourcesConfig() throws ThingsboardException { + SecurityUser user = getCurrentUser(); + accessControlService.checkPermission(user, Resource.AI, Operation.READ); + return aiResourceService.getConfig(user); + } + + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + @ResponseStatus(HttpStatus.CREATED) + public JsonNode uploadAiResource(@RequestPart("file") MultipartFile file) throws ThingsboardException { + SecurityUser user = getCurrentUser(); + accessControlService.checkPermission(user, Resource.AI, Operation.WRITE); + return aiResourceService.upload(file, user); + } + + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @GetMapping("/{resourceId}") + public ResponseEntity downloadAiResource(@PathVariable UUID resourceId) throws ThingsboardException { + SecurityUser user = getCurrentUser(); + accessControlService.checkPermission(user, Resource.AI, Operation.READ); + AiResourceService.AiResourceContent content = aiResourceService.download(resourceId, user); + return ResponseEntity.ok() + .contentType(MediaType.parseMediaType(content.mediaType())) + .header(HttpHeaders.CONTENT_DISPOSITION, disposition(content.name())) + .header("X-Content-Type-Options", "nosniff") + .cacheControl(CacheControl.maxAge(Duration.ofHours(1)).cachePrivate()) + .body(content.data()); + } + + private static String disposition(String name) { + ContentDisposition.Builder builder = ContentDisposition.attachment(); + boolean ascii = StandardCharsets.US_ASCII.newEncoder().canEncode(name); + return (ascii ? builder.filename(name) : builder.filename(name, StandardCharsets.UTF_8)).build().toString(); + } + + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @DeleteMapping("/{resourceId}") + @ResponseStatus(HttpStatus.NO_CONTENT) + public void deleteAiResource(@PathVariable UUID resourceId) throws ThingsboardException { + SecurityUser user = getCurrentUser(); + accessControlService.checkPermission(user, Resource.AI, Operation.WRITE); + aiResourceService.delete(resourceId, user); + } + +} diff --git a/application/src/main/java/org/thingsboard/server/controller/AiSolutionController.java b/application/src/main/java/org/thingsboard/server/controller/AiSolutionController.java index 0bd771ecee..3bc73f3428 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AiSolutionController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AiSolutionController.java @@ -5,6 +5,7 @@ package org.thingsboard.server.controller; import com.fasterxml.jackson.databind.JsonNode; import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -24,6 +25,7 @@ import org.thingsboard.server.service.ai.solution.AiSolutionService; import org.thingsboard.server.service.security.model.SecurityUser; import org.thingsboard.server.service.security.system.SystemSecurityService; +import java.util.List; import java.util.UUID; import static org.thingsboard.server.config.ThingsboardSecurityConfiguration.AUTHORIZATION_HEADER; @@ -61,16 +63,27 @@ public class AiSolutionController extends BaseController { return aiSolutionService.getSolutions(user); } + @Deprecated(forRemoval = true) @PreAuthorize("hasAuthority('TENANT_ADMIN')") @PostMapping("/{solutionId}/{step}/chat") public JsonNode chat(@PathVariable UUID solutionId, @PathVariable SolutionStep step, @RequestBody String message) throws ThingsboardException { + return sendMessage(solutionId, step, new SolutionChatMessage(message, null)); + } + + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @PostMapping(value = "/{solutionId}/{step}/messages", consumes = MediaType.APPLICATION_JSON_VALUE) + public JsonNode sendMessage(@PathVariable UUID solutionId, + @PathVariable SolutionStep step, + @RequestBody SolutionChatMessage request) throws ThingsboardException { SecurityUser user = getCurrentUser(); accessControlService.checkPermission(user, Resource.AI, Operation.WRITE); - return aiSolutionService.chat(solutionId, step, message, user); + return aiSolutionService.chat(solutionId, step, request.message(), request.resources(), user); } + record SolutionChatMessage(String message, List resources) {} + @PreAuthorize("hasAuthority('TENANT_ADMIN')") @PostMapping("/{solutionId}/create") public JsonNode createSolution(@PathVariable UUID solutionId) throws ThingsboardException { diff --git a/application/src/main/java/org/thingsboard/server/controller/AlarmController.java b/application/src/main/java/org/thingsboard/server/controller/AlarmController.java index c621d1eed0..6d40eab14b 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AlarmController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AlarmController.java @@ -191,10 +191,10 @@ public class AlarmController extends BaseController { @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") @PostMapping(value = "/alarm/{alarmId}/assign/{assigneeId}") @ResponseStatus(value = HttpStatus.OK) - public Alarm assignAlarm(@Parameter(description = ALARM_ID_PARAM_DESCRIPTION) - @PathVariable(ALARM_ID) String strAlarmId, - @Parameter(description = ASSIGN_ID_PARAM_DESCRIPTION) - @PathVariable(ASSIGNEE_ID) String strAssigneeId + public AlarmInfo assignAlarm(@Parameter(description = ALARM_ID_PARAM_DESCRIPTION) + @PathVariable(ALARM_ID) String strAlarmId, + @Parameter(description = ASSIGN_ID_PARAM_DESCRIPTION) + @PathVariable(ASSIGNEE_ID) String strAssigneeId ) throws Exception { checkParameter(ALARM_ID, strAlarmId); checkParameter(ASSIGNEE_ID, strAssigneeId); @@ -212,8 +212,8 @@ public class AlarmController extends BaseController { @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") @DeleteMapping(value = "/alarm/{alarmId}/assign") @ResponseStatus(value = HttpStatus.OK) - public Alarm unassignAlarm(@Parameter(description = ALARM_ID_PARAM_DESCRIPTION) - @PathVariable(ALARM_ID) String strAlarmId + public AlarmInfo unassignAlarm(@Parameter(description = ALARM_ID_PARAM_DESCRIPTION) + @PathVariable(ALARM_ID) String strAlarmId ) throws Exception { checkParameter(ALARM_ID, strAlarmId); AlarmId alarmId = new AlarmId(toUUID(strAlarmId)); diff --git a/application/src/main/java/org/thingsboard/server/controller/ControllerConstants.java b/application/src/main/java/org/thingsboard/server/controller/ControllerConstants.java index 63b0f83b23..573174558d 100644 --- a/application/src/main/java/org/thingsboard/server/controller/ControllerConstants.java +++ b/application/src/main/java/org/thingsboard/server/controller/ControllerConstants.java @@ -1833,454 +1833,6 @@ public class ControllerConstants { "the connectivity fields and other important parameters dependent on the specific integration type. Let's review the configuration object for the MQTT Integration type below. " + NEW_LINE + INTEGRATION_CONFIGURATION_EXAMPLE + NEW_LINE; - // Default converter uplinks messages - - static final String DEFAULT_TTI_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"end_device_ids\": {\n" + - " \"device_id\": \"eui-1000000000000001\",\n" + - " \"application_ids\": {\n" + - " \"application_id\": \"application-tti-name\"\n" + - " },\n" + - " \"dev_eui\": \"1000000000000001\",\n" + - " \"join_eui\": \"2000000000000001\",\n" + - " \"dev_addr\": \"20000001\"\n" + - " },\n" + - " \"correlation_ids\": [\"as:up:01H0PZDGB1NW6NAPD815NGHPF6\", \"gs:conn:01H0FJRSXSYT7VKNYXJ89F95XT\", \"gs:up:host:01H0FJRSY3MZMGPPFBQ4FZV4T8\", \"gs:uplink:01H0PZDG4HHGFRTXRTXD4PFTH7\", \"ns:uplink:01H0PZDG4JZ3BM0K6J89EQK1J7\", \"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H0PZDG4J02F85RYFPCNSNXCR\", \"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01H0PZDGB081PMP806BJHNHX1A\"],\n" + - " \"received_at\": \"2023-05-18T08:25:26.112483370Z\",\n" + - " \"uplink_message\": {\n" + - " \"session_key_id\": \"AYfg8rhha5n+FWx0ZaAprA==\",\n" + - " \"f_port\": 85,\n" + - " \"f_cnt\": 5017,\n" + - " \"frm_payload\": \"Ae0DM18OTGM=\",\n" + - " \"rx_metadata\": [{\n" + - " \"gateway_ids\": {\n" + - " \"gateway_id\": \"eui-6A7E111A10000000\",\n" + - " \"eui\": \"6A7E111A10000000\"\n" + - " },\n" + - " \"time\": \"2023-05-18T08:25:25.885310Z\",\n" + - " \"timestamp\": 818273765,\n" + - " \"rssi\": -24,\n" + - " \"channel_rssi\": -24,\n" + - " \"snr\": 12,\n" + - " \"frequency_offset\": \"671\",\n" + - " \"uplink_token\": \"CiIKIAoUZXVpLTZBN0UxMTFBMTAwMDAwMDASCCThJP/+9k6eEOW7l4YDGgwI9cGXowYQ5KPhrwMgiI2rp+jpOA=\",\n" + - " \"channel_index\": 2,\n" + - " \"received_at\": \"2023-05-18T08:25:25.869324983Z\"\n" + - " }, {\n" + - " \"gateway_ids\": {\n" + - " \"gateway_id\": \"packetbroker\"\n" + - " },\n" + - " \"packet_broker\": {\n" + - " \"message_id\": \"01H0PZDG4MF9AYSMNY44MAVTDH\",\n" + - " \"forwarder_net_id\": \"000013\",\n" + - " \"forwarder_tenant_id\": \"ttn\",\n" + - " \"forwarder_cluster_id\": \"eu1.cloud.thethings.network\",\n" + - " \"forwarder_gateway_eui\": \"6A7E111A10000000\",\n" + - " \"forwarder_gateway_id\": \"eui-6a7e111a10000000\",\n" + - " \"home_network_net_id\": \"000013\",\n" + - " \"home_network_tenant_id\": \"tenant\",\n" + - " \"home_network_cluster_id\": \"eu1.cloud.thethings.industries\"\n" + - " },\n" + - " \"time\": \"2023-05-18T08:25:25.885310Z\",\n" + - " \"rssi\": -24,\n" + - " \"channel_rssi\": -24,\n" + - " \"snr\": 12,\n" + - " \"frequency_offset\": \"671\",\n" + - " \"uplink_token\": \"eyJnIjoiWlhsS2FHSkhZMmxQYVVwQ1RWUkpORkl3VGs1VE1XTnBURU5LYkdKdFRXbFBhVXBDVFZSSk5GSXdUazVKYVhkcFlWaFphVTlwU201a01uaGhWVlJvZDFSWFVuRmlSM1JtVFcxT2RVbHBkMmxrUjBadVNXcHZhV05ZY0RKT1IyeExaREpSZVZwR1pIUmpNRXBLVlVoR2RFNVZkR3BWVTBvNUxua3paVVJTWVRaM1lXOU1kbTQwVm5sdmIyWmlPWGN1ZUhCZmVrcElaa3hIWlZadGRVUlFVeTVuYlRaVlZXRXdkakpHV0VKMGJUUjZaMjVXUkVoeGVHRjRaMlJKTlVkS1VsbERhemc1VDNCbk5rVk1iM1JDUkVZM1VWbHdZbEJDTkdOblNqWjBlbkphYUV4MFRVMHhZMVZFTTFac01XdExURUo0YURaMFExTnhhMVJsWWw4eE5FdHlVVXcyZUhsRWFFbEhlakJITXpoTE0xaFdlRzR5VUVjMk4wNUViME5WTkhoTmRrazFZVk5oWkUwd2FXVnFjR294VGtoMFduZHlZMDFxVlVGNmRsbERUazlNY2s5eFdVeFpWMk5XTG1WVFFYVkpNVkptT1U5NWRqUTNhSEoxTUZoalYxRT0iLCJhIjp7ImZuaWQiOiIwMDAwMTMiLCJmdGlkIjoidHRuIiwiZmNpZCI6ImV1MS5jbG91ZC50aGV0aGluZ3MubmV0d29yayJ9fQ==\",\n" + - " \"received_at\": \"2023-05-18T08:25:25.906038642Z\"\n" + - " }],\n" + - " \"settings\": {\n" + - " \"data_rate\": {\n" + - " \"lora\": {\n" + - " \"bandwidth\": 125000,\n" + - " \"spreading_factor\": 7,\n" + - " \"coding_rate\": \"4/5\"\n" + - " }\n" + - " },\n" + - " \"frequency\": \"868500000\",\n" + - " \"timestamp\": 818273765,\n" + - " \"time\": \"2023-05-18T08:25:25.885310Z\"\n" + - " },\n" + - " \"received_at\": \"2023-05-18T08:25:25.906399073Z\",\n" + - " \"consumed_airtime\": \"0.097536s\",\n" + - " \"network_ids\": {\n" + - " \"net_id\": \"000013\",\n" + - " \"tenant_id\": \"tenant\",\n" + - " \"cluster_id\": \"eu1\",\n" + - " \"cluster_address\": \"eu1.cloud.thethings.industries\",\n" + - " \"tenant_address\": \"tenant.eu1.cloud.thethings.industries\"\n" + - " }\n" + - " }\n" + - "}"; - - static final String DEFAULT_TTN_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"end_device_ids\": {\n" + - " \"device_id\": \"eui-1000000000000001\",\n" + - " \"application_ids\": {\n" + - " \"application_id\": \"application-tts-name\"\n" + - " },\n" + - " \"dev_eui\": \"1000000000000001\",\n" + - " \"join_eui\": \"2000000000000001\",\n" + - " \"dev_addr\": \"20000001\"\n" + - " },\n" + - " \"correlation_ids\": [\"as:up:01H0S7ZJQ9MQPMVY49FT3SE07M\", \"gs:conn:01H03BQZ9342X3Y86DJ2P704E5\", \"gs:up:host:01H03BQZ99EGAM52KK1300GFKN\", \"gs:uplink:01H0S7ZJGS6D9TJSKJN8XNTMAV\", \"ns:uplink:01H0S7ZJGS9KKD4HTTPKFEMWCV\", \"rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H0S7ZJGSF3M38ZRZVTM38DEC\", \"rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01H0S7ZJQ8R2EH5AA269AKM8DX\"],\n" + - " \"received_at\": \"2023-05-19T05:33:35.848446463Z\",\n" + - " \"uplink_message\": {\n" + - " \"session_key_id\": \"AYfqmb0pc/1uRZv9xUydgQ==\",\n" + - " \"f_port\": 85,\n" + - " \"f_cnt\": 10335,\n" + - " \"frm_payload\": \"Ae0DM18OTGM=\",\n" + - " \"rx_metadata\": [{\n" + - " \"gateway_ids\": {\n" + - " \"gateway_id\": \"eui-6a7e111a10000000\",\n" + - " \"eui\": \"6A7E111A10000000\"\n" + - " },\n" + - " \"time\": \"2023-05-19T05:33:35.608982Z\",\n" + - " \"timestamp\": 3893546133,\n" + - " \"rssi\": -35,\n" + - " \"channel_rssi\": -35,\n" + - " \"snr\": 13.2,\n" + - " \"frequency_offset\": \"69\",\n" + - " \"uplink_token\": \"CiIKIAoUZXVpLTZhN2UxMTFhMTAwMDAwMDASCCThJP/+9k6eEJWZy8AOGgwIr5ScowYQvNbUsQIgiMy8y6jwpwE=\",\n" + - " \"channel_index\": 3,\n" + - " \"received_at\": \"2023-05-19T05:33:35.607383681Z\"\n" + - " }],\n" + - " \"settings\": {\n" + - " \"data_rate\": {\n" + - " \"lora\": {\n" + - " \"bandwidth\": 125000,\n" + - " \"spreading_factor\": 7,\n" + - " \"coding_rate\": \"4/5\"\n" + - " }\n" + - " },\n" + - " \"frequency\": \"867100000\",\n" + - " \"timestamp\": 3893546133,\n" + - " \"time\": \"2023-05-19T05:33:35.608982Z\"\n" + - " },\n" + - " \"received_at\": \"2023-05-19T05:33:35.641841782Z\",\n" + - " \"consumed_airtime\": \"0.056576s\",\n" + - " \"network_ids\": {\n" + - " \"net_id\": \"000013\",\n" + - " \"tenant_id\": \"ttn\",\n" + - " \"cluster_id\": \"eu1\",\n" + - " \"cluster_address\": \"eu1.cloud.thethings.network\"\n" + - " }\n" + - " }\n" + - "}\n"; - - static final String DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE = - "{\n" + - " \"cmd\": \"rx\",\n" + - " \"seqno\": 3040,\n" + - " \"EUI\": \"1000000000000001\",\n" + - " \"ts\": 1684478801936,\n" + - " \"fcnt\": 2,\n" + - " \"port\": 85,\n" + - " \"freq\": 867500000,\n" + - " \"rssi\": -21,\n" + - " \"snr\": 10,\n" + - " \"toa\": 206,\n" + - " \"dr\": \"SF9 BW125 4/5\",\n" + - " \"ack\": false,\n" + - " \"bat\": 94,\n" + - " \"offline\": false,\n" + - " \"data\": \"01ed03335f0e4c63\"\n" + - "}\n"; - - static final String DEFAULT_CHIRPSTACK_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"deduplicationId\": \"57433366-50a6-4dc2-8145-2df1bbc70d9e\",\n" + - " \"time\": \"2023-05-22T07:47:05.404859+00:00\",\n" + - " \"deviceInfo\": {\n" + - " \"tenantId\": \"52f14cd4-c6f1-4fbd-8f87-4025e1d49242\",\n" + - " \"tenantName\": \"ChirpStack\",\n" + - " \"applicationId\": \"ca739e26-7b67-4f14-b69e-d568c22a5a75\",\n" + - " \"applicationName\": \"Chirpstack application\",\n" + - " \"deviceProfileId\": \"605d08d4-65f5-4d2c-8a5a-3d2457662f79\",\n" + - " \"deviceProfileName\": \"Chirpstack default device profile\",\n" + - " \"deviceName\": \"Device name\",\n" + - " \"devEui\": \"1000000000000001\",\n" + - " \"tags\": {}\n" + - " },\n" + - " \"devAddr\": \"20000001\",\n" + - " \"adr\": true,\n" + - " \"dr\": 5,\n" + - " \"fCnt\": 4,\n" + - " \"fPort\": 85,\n" + - " \"confirmed\": false,\n" + - " \"data\": \"Ae0DM18OTGM=\",\n" + - " \"rxInfo\": [{\n" + - " \"gatewayId\": \"6a7e111a10000000\",\n" + - " \"uplinkId\": 24022,\n" + - " \"time\": \"2023-05-22T07:47:05.404859+00:00\",\n" + - " \"rssi\": -35,\n" + - " \"snr\": 11.5,\n" + - " \"channel\": 2,\n" + - " \"rfChain\": 1,\n" + - " \"location\": {},\n" + - " \"context\": \"EFwMtA==\",\n" + - " \"metadata\": {\n" + - " \"region_common_name\": \"EU868\",\n" + - " \"region_config_id\": \"eu868\"\n" + - " },\n" + - " \"crcStatus\": \"CRC_OK\"\n" + - " }],\n" + - " \"txInfo\": {\n" + - " \"frequency\": 868500000,\n" + - " \"modulation\": {\n" + - " \"lora\": {\n" + - " \"bandwidth\": 125000,\n" + - " \"spreadingFactor\": 7,\n" + - " \"codeRate\": \"CR_4_5\"\n" + - " }\n" + - " }\n" + - " }\n" + - "}"; - - static final String DEFAULT_SIGFOX_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"device\": \"2203961\",\n" + - " \"time\": \"1686298419\",\n" + - " \"data\": \"2502af2102462a\",\n" + - " \"seqNumber\": \"570\",\n" + - " \"deviceTypeId\": \"630ceaea10d051194ec0246e\",\n" + - " \"ack\": \"false\",\n" + - " \"customData#int1\": \"37\",\n" + - " \"customData#int2\": \"2\"\n" + - "}"; - - static final String DEFAULT_SIGFOX_UPLINK_CONVERTER_METADATA = "{\n" + - " \"Header:accept-encoding\": \"gzip,deflate\",\n" + - " \"Header:content-type\": \"application/json\",\n" + - " \"Header:content-length\": \"243\",\n" + - " \"Header:user-agent\": \"SIGFOX\",\n" + - " \"Header:accept-charset\": \"UTF-8;q=0.9,*;q=0.7\",\n" + - " \"Header:accept-language\": \"en\"" + - "}\n"; - - static final String DEFAULT_AZURE_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"deviceId\": \"8F4A2C6D\",\n" + - " \"deviceType\": \"Packing machine\",\n" + - " \"temperature\": 25.5,\n" + - " \"pressure\": 1013.25,\n" + - " \"vibration\": {\n" + - " \"x\": 0.02,\n" + - " \"y\": 0.03,\n" + - " \"z\": 0.015\n" + - " },\n" + - " \"location\": {\n" + - " \"latitude\": 37.7749,\n" + - " \"longitude\": -122.4194,\n" + - " \"altitude\": 10\n" + - " },\n" + - " \"timestamp\": \"2023-06-09T10:30:00Z\",\n" + - " \"status\": \"ALARM\",\n" + - " \"alarms\": [\n" + - " {\n" + - " \"type\": \"temperature\",\n" + - " \"severity\": \"high\",\n" + - " \"message\": \"Temperature exceeds threshold.\"\n" + - " },\n" + - " {\n" + - " \"type\": \"vibration\",\n" + - " \"severity\": \"critical\",\n" + - " \"message\": \"Excessive vibration detected.\"\n" + - " }\n" + - " ],\n" + - " \"metadata\": {\n" + - " \"version\": 1,\n" + - " \"batteryLevel\": 100,\n" + - " \"batteryStatus\": \"Charging\",\n" + - " \"manufacturer\": \"Example corporation\"\n" + - " }\n" + - "}"; - - static final String DEFAULT_AWS_IOT_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"device_id\": \"3G7H1j-9zF\",\n" + - " \"timestamp\": \"2023-06-10T12:00:00Z\",\n" + - " \"sensor_data\": {\n" + - " \"temperature\": 25.3,\n" + - " \"humidity\": 62.8,\n" + - " \"pressure\": 1012.5\n" + - " },\n" + - " \"location\": {\n" + - " \"latitude\": 37.7749,\n" + - " \"longitude\": -122.4194\n" + - " },\n" + - " \"status\": \"active\",\n" + - " \"power_status\": \"on\",\n" + - " \"vibration\": {\n" + - " \"x\": 0.02,\n" + - " \"y\": 0.03,\n" + - " \"z\": 0.01\n" + - " },\n" + - " \"fault_codes\": [100, 204, 301],\n" + - " \"battery_level\": 78.5\n" + - "}\n"; - - static final String DEFAULT_KNP_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"deviceName\":\"Device A\",\n" + - " \"deviceType\":\"thermostat\",\n" + - " \"customerName\":\"customer\",\n" + - " \"groupName\":\"thermostat devices\",\n" + - " \"attributes\": {\n" + - " \"model\":\"Model A\",\n" + - " \"serialNumber\":\"SN111\"\n" + - " },\n" + - " \"telemetry\": {\n" + - " \"temperature\":42,\n" + - " \"humidity\":80\n" + - " }\n" + - "}\n"; - - static final String DEFAULT_THINGSPARK_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"DevEUI_uplink\": {\n" + - " \"Time\": \"2024-11-28T21:08:22.138+00:00\",\n" + - " \"DevEUI\": \"1000000000000001\",\n" + - " \"FPort\": 1,\n" + - " \"FCntUp\": 26,\n" + - " \"LostUplinksAS\": 0,\n" + - " \"ADRbit\": 1,\n" + - " \"MType\": 2,\n" + - " \"FCntDn\": 2,\n" + - " \"payload_hex\": \"01ed03335f0e4c63\",\n" + - " \"mic_hex\": \"e7214986\",\n" + - " \"Lrcid\": \"00000211\",\n" + - " \"LrrRSSI\": -114,\n" + - " \"LrrSNR\": 4.75,\n" + - " \"LrrESP\": -115.2547,\n" + - " \"SpFact\": 9,\n" + - " \"SubBand\": \"G0\",\n" + - " \"Channel\": \"LC1\",\n" + - " \"Lrrid\": \"100019D4\",\n" + - " \"Late\": 0,\n" + - " \"LrrLAT\": 32.516357,\n" + - " \"LrrLON\": -106.824348,\n" + - " \"Lrrs\": {\n" + - " \"Lrr\": [{\n" + - " \"Lrrid\": \"100019D4\",\n" + - " \"Chain\": 0,\n" + - " \"LrrRSSI\": -114,\n" + - " \"LrrSNR\": 4.75,\n" + - " \"LrrESP\": -115.2547\n" + - " }]\n" + - " },\n" + - " \"DevLrrCnt\": 1,\n" + - " \"CustomerID\": \"100045194\",\n" + - " \"CustomerData\": {\n" + - " \"loc\": {\n" + - " \"lat\": \"32.592782\",\n" + - " \"lon\": \"-106.927742\"\n" + - " },\n" + - " \"alr\": {\n" + - " \"pro\": \"DL/TBRG\",\n" + - " \"ver\": \"1\"\n" + - " },\n" + - " \"tags\": [\"EnvironSens\", \"RainGauge\", \"CDRRC\"],\n" + - " \"doms\": [],\n" + - " \"name\": \"RainGauge 5483_Test\"\n" + - " },\n" + - " \"BaseStationData\": {\n" + - " \"doms\": [],\n" + - " \"name\": \"iStation US #6_CDRRC_Summerford\"\n" + - " },\n" + - " \"ModelCfg\": \"0\",\n" + - " \"DriverCfg\": {\n" + - " \"mod\": {\n" + - " \"pId\": \"dl\",\n" + - " \"mId\": \"dl-tbrg\",\n" + - " \"ver\": \"1\"\n" + - " },\n" + - " \"app\": {\n" + - " \"pId\": \"dl\",\n" + - " \"mId\": \"dl-tbrg\",\n" + - " \"ver\": \"1\"\n" + - " }\n" + - " },\n" + - " \"InstantPER\": 0,\n" + - " \"MeanPER\": 0.037037,\n" + - " \"DevAddr\": \"00FDA112\",\n" + - " \"TxPower\": 18,\n" + - " \"NbTrans\": 2,\n" + - " \"Frequency\": 902.5,\n" + - " \"DynamicClass\": \"A\"\n" + - " }\n" + - "}"; - - static final String DEFAULT_TPE_UPLINK_CONVERTER_MESSAGE = "{\n" + - " \"DevEUI_uplink\": {\n" + - " \"Time\": \"2024-11-28T21:08:22.138+00:00\",\n" + - " \"DevEUI\": \"1000000000000001\",\n" + - " \"FPort\": 1,\n" + - " \"FCntUp\": 26,\n" + - " \"LostUplinksAS\": 0,\n" + - " \"ADRbit\": 1,\n" + - " \"MType\": 2,\n" + - " \"FCntDn\": 2,\n" + - " \"payload_hex\": \"01ed03335f0e4c63\",\n" + - " \"mic_hex\": \"e7214986\",\n" + - " \"Lrcid\": \"00000211\",\n" + - " \"LrrRSSI\": -114,\n" + - " \"LrrSNR\": 4.75,\n" + - " \"LrrESP\": -115.2547,\n" + - " \"SpFact\": 9,\n" + - " \"SubBand\": \"G0\",\n" + - " \"Channel\": \"LC1\",\n" + - " \"Lrrid\": \"100019D4\",\n" + - " \"Late\": 0,\n" + - " \"LrrLAT\": 32.516357,\n" + - " \"LrrLON\": -106.824348,\n" + - " \"Lrrs\": {\n" + - " \"Lrr\": [{\n" + - " \"Lrrid\": \"100019D4\",\n" + - " \"Chain\": 0,\n" + - " \"LrrRSSI\": -114,\n" + - " \"LrrSNR\": 4.75,\n" + - " \"LrrESP\": -115.2547\n" + - " }]\n" + - " },\n" + - " \"DevLrrCnt\": 1,\n" + - " \"CustomerID\": \"100045194\",\n" + - " \"CustomerData\": {\n" + - " \"loc\": {\n" + - " \"lat\": \"32.592782\",\n" + - " \"lon\": \"-106.927742\"\n" + - " },\n" + - " \"alr\": {\n" + - " \"pro\": \"DL/TBRG\",\n" + - " \"ver\": \"1\"\n" + - " },\n" + - " \"tags\": [\"EnvironSens\", \"RainGauge\", \"CDRRC\"],\n" + - " \"doms\": [],\n" + - " \"name\": \"RainGauge 5483_Test\"\n" + - " },\n" + - " \"BaseStationData\": {\n" + - " \"doms\": [],\n" + - " \"name\": \"iStation US #6_CDRRC_Summerford\"\n" + - " },\n" + - " \"ModelCfg\": \"0\",\n" + - " \"DriverCfg\": {\n" + - " \"mod\": {\n" + - " \"pId\": \"dl\",\n" + - " \"mId\": \"dl-tbrg\",\n" + - " \"ver\": \"1\"\n" + - " },\n" + - " \"app\": {\n" + - " \"pId\": \"dl\",\n" + - " \"mId\": \"dl-tbrg\",\n" + - " \"ver\": \"1\"\n" + - " }\n" + - " },\n" + - " \"InstantPER\": 0,\n" + - " \"MeanPER\": 0.037037,\n" + - " \"DevAddr\": \"00FDA112\",\n" + - " \"TxPower\": 18,\n" + - " \"NbTrans\": 2,\n" + - " \"Frequency\": 902.5,\n" + - " \"DynamicClass\": \"A\"\n" + - " }\n" + - "}"; - - // Default converter uplinks messages - static final String REPORT_PARAMS_EXAMPLE = "{\n" + " \"type\": \"pdf\",\n" + " \"timezone\": \"Europe/Kiev\",\n" + diff --git a/application/src/main/java/org/thingsboard/server/controller/ConverterController.java b/application/src/main/java/org/thingsboard/server/controller/ConverterController.java index 398af4d4ca..b0d58eee4a 100644 --- a/application/src/main/java/org/thingsboard/server/controller/ConverterController.java +++ b/application/src/main/java/org/thingsboard/server/controller/ConverterController.java @@ -5,7 +5,6 @@ package org.thingsboard.server.controller; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.ImmutableMap; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.JsonParser; @@ -63,6 +62,7 @@ import org.thingsboard.server.config.annotations.ApiOperation; import org.thingsboard.server.dao.event.EventService; import org.thingsboard.server.dao.subscription.PlatformFeature; import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.converter.ConverterDefaultsService; import org.thingsboard.server.service.entitiy.converter.TbConverterService; import org.thingsboard.server.service.security.model.SecurityUser; @@ -82,17 +82,6 @@ import static org.thingsboard.server.controller.ControllerConstants.CONVERTER_ID import static org.thingsboard.server.controller.ControllerConstants.CONVERTER_TEXT_SEARCH_DESCRIPTION; import static org.thingsboard.server.controller.ControllerConstants.CONVERTER_TYPE_DESCRIPTION; import static org.thingsboard.server.controller.ControllerConstants.DEDICATED_CONVERTER_DEFINITION; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_AWS_IOT_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_AZURE_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_CHIRPSTACK_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_KNP_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_SIGFOX_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_SIGFOX_UPLINK_CONVERTER_METADATA; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_THINGSPARK_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_TPE_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_TTI_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_TTN_UPLINK_CONVERTER_MESSAGE; import static org.thingsboard.server.controller.ControllerConstants.INCLUDE_GATEWAY_INFO; import static org.thingsboard.server.controller.ControllerConstants.INTEGRATION_NAME; import static org.thingsboard.server.controller.ControllerConstants.INTEGRATION_NAME_PARAM_DESCRIPTION; @@ -122,25 +111,7 @@ public class ConverterController extends AutoCommitController { private final JsInvokeService jsInvokeService; private final Optional tbelInvokeService; private final TbConverterService tbConverterService; - - private static final Map converterDefaultMessages = ImmutableMap.builder() - .put(IntegrationType.LORIOT, DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.SIGFOX, DEFAULT_SIGFOX_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.TTI, DEFAULT_TTI_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.TTN, DEFAULT_TTN_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.CHIRPSTACK, DEFAULT_CHIRPSTACK_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.AZURE_IOT_HUB, DEFAULT_AZURE_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.AZURE_EVENT_HUB, DEFAULT_AZURE_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.AZURE_SERVICE_BUS, DEFAULT_AZURE_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.AWS_IOT, DEFAULT_AWS_IOT_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.KPN, DEFAULT_KNP_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.THINGPARK, DEFAULT_THINGSPARK_UPLINK_CONVERTER_MESSAGE) - .put(IntegrationType.TPE, DEFAULT_TPE_UPLINK_CONVERTER_MESSAGE) - .build(); - - private final static Map converterDefaultMetadatas = Map.of( - IntegrationType.SIGFOX, DEFAULT_SIGFOX_UPLINK_CONVERTER_METADATA - ); + private final ConverterDefaultsService converterDefaultsService; public static final String CONVERTER_ID = "converterId"; @@ -258,8 +229,9 @@ public class ConverterController extends AutoCommitController { } private JsonNode createDefaultDebugIn(Converter converter, String converterType, String integrationType, String integrationName, Integer converterVersion) throws ThingsboardException { - if ((converter == null && !ConverterType.UPLINK.name().equals(converterType)) || - (converter != null && !ConverterType.UPLINK.equals(converter.getType()))) { + boolean isUplink = converter != null ? ConverterType.UPLINK.equals(converter.getType()) : ConverterType.UPLINK.name().equals(converterType); + boolean isDownlink = converter != null ? ConverterType.DOWNLINK.equals(converter.getType()) : ConverterType.DOWNLINK.name().equals(converterType); + if (!isUplink && !isDownlink) { return null; } @@ -273,6 +245,16 @@ public class ConverterController extends AutoCommitController { integrationName = targetIntegrationInfo.getSecond(); } + if (isDownlink) { + Optional downlinkMetadata = converterDefaultsService.getMetadata(targetIntegrationType, ConverterType.DOWNLINK); + Optional downlinkPayload = converterDefaultsService.getPayload(targetIntegrationType, ConverterType.DOWNLINK); + Optional downlinkMsgType = converterDefaultsService.getDownlinkMsgType(targetIntegrationType); + if (downlinkMetadata.isEmpty() && downlinkPayload.isEmpty() && downlinkMsgType.isEmpty()) { + return null; + } + return createDownlinkDebugIn(integrationName, downlinkMetadata, downlinkPayload, downlinkMsgType); + } + if (converterVersion == null) { converterVersion = converter != null ? converter.getConverterVersion() : null; } @@ -288,10 +270,9 @@ public class ConverterController extends AutoCommitController { String inContent; ContentType contentType; - inContent = converterDefaultMessages.get(targetIntegrationType); - if (converterDefaultMetadatas.containsKey(targetIntegrationType)) { - metadata.setAll(JacksonUtil.fromString(converterDefaultMetadatas.get(targetIntegrationType), ObjectNode.class)); - } + inContent = converterDefaultsService.getPayload(targetIntegrationType, ConverterType.UPLINK).orElse(null); + converterDefaultsService.getMetadata(targetIntegrationType, ConverterType.UPLINK) + .ifPresent(defaultMetadata -> metadata.setAll(JacksonUtil.fromString(defaultMetadata, ObjectNode.class))); contentType = ContentType.JSON; debugIn.put("inMetadata", JacksonUtil.toString(metadata)); @@ -301,6 +282,21 @@ public class ConverterController extends AutoCommitController { return debugIn.isEmpty() ? null : debugIn; } + private JsonNode createDownlinkDebugIn(String integrationName, Optional metadata, Optional payload, Optional msgType) { + ObjectNode debugIn = JacksonUtil.newObjectNode(); + metadata.ifPresent(value -> debugIn.put("inMetadata", JacksonUtil.toString(JacksonUtil.fromString(value, ObjectNode.class)))); + payload.ifPresent(value -> { + debugIn.put("inContent", value); + debugIn.put("inContentType", ContentType.JSON.name()); + }); + msgType.ifPresent(value -> debugIn.put("inMsgType", value)); + ObjectNode integrationMetadata = JacksonUtil.newObjectNode(); + integrationMetadata.put(INTEGRATION_NAME, integrationName); + debugIn.put("inIntegrationMetadata", JacksonUtil.toString(integrationMetadata)); + + return debugIn; + } + private Pair getTargetIntegrationTypeAndName(Converter converter, String integrationType) throws ThingsboardException { IntegrationType targetIntegrationType = null; String targetIntegrationName = ""; @@ -319,7 +315,8 @@ public class ConverterController extends AutoCommitController { } if (targetIntegrationType != null && StringUtils.isBlank(targetIntegrationName)) { - targetIntegrationName = "Test " + targetIntegrationType.getDirectory(); + targetIntegrationName = converterDefaultsService.getIntegrationName(targetIntegrationType) + .orElse("Test " + targetIntegrationType.getDirectory()); } return (targetIntegrationType == null) ? null : Pair.of(targetIntegrationType, targetIntegrationName); diff --git a/application/src/main/java/org/thingsboard/server/controller/DeviceController.java b/application/src/main/java/org/thingsboard/server/controller/DeviceController.java index fc7cf3a950..85aeeecdbb 100644 --- a/application/src/main/java/org/thingsboard/server/controller/DeviceController.java +++ b/application/src/main/java/org/thingsboard/server/controller/DeviceController.java @@ -10,7 +10,9 @@ import com.google.common.util.concurrent.MoreExecutors; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import jakarta.annotation.Nullable; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -583,6 +585,8 @@ public class DeviceController extends BaseController { "In order to enable claiming devices feature a system parameter security.claim.allowClaimingByDefault should be set to true, " + "otherwise a server-side claimingAllowed attribute with the value true is obligatory for provisioned devices. \n" + "See official documentation for more details regarding claiming." + CUSTOMER_AUTHORITY_PARAGRAPH + RBAC_CLAIM_CHECK) + @ApiResponse(responseCode = "200", description = "OK", + content = @Content(schema = @Schema(implementation = ClaimResult.class))) @PreAuthorize("hasAuthority('CUSTOMER_USER')") @RequestMapping(value = "/customer/device/{deviceName}/claim", method = RequestMethod.POST) @ResponseBody diff --git a/application/src/main/java/org/thingsboard/server/controller/EdgeController.java b/application/src/main/java/org/thingsboard/server/controller/EdgeController.java index af73926527..5276cfcb53 100644 --- a/application/src/main/java/org/thingsboard/server/controller/EdgeController.java +++ b/application/src/main/java/org/thingsboard/server/controller/EdgeController.java @@ -189,6 +189,10 @@ public class EdgeController extends BaseController { Operation operation = created ? Operation.CREATE : Operation.WRITE; + if (!created) { + checkEdgeId(edge.getId(), Operation.WRITE); + } + if (!entityGroupIds.isEmpty()) { for (EntityGroupId entityGroupId : entityGroupIds) { accessControlService.checkPermission(getCurrentUser(), Resource.EDGE, operation, @@ -546,7 +550,7 @@ public class EdgeController extends BaseController { @PathVariable(ENTITY_GROUP_ID) String strEntityGroupId, @Parameter(description = PAGE_SIZE_DESCRIPTION, required = true, schema = @Schema(minimum = "1")) @RequestParam int pageSize, - @Parameter(description = PAGE_NUMBER_DESCRIPTION, required = true, schema = @Schema(minimum = "1")) + @Parameter(description = PAGE_NUMBER_DESCRIPTION, required = true, schema = @Schema(minimum = "0")) @RequestParam int page, @Parameter(description = EDGE_TEXT_SEARCH_DESCRIPTION) @RequestParam(required = false) String textSearch, diff --git a/application/src/main/java/org/thingsboard/server/controller/EntityGroupController.java b/application/src/main/java/org/thingsboard/server/controller/EntityGroupController.java index 0813fe6b5d..cdf2f171c8 100644 --- a/application/src/main/java/org/thingsboard/server/controller/EntityGroupController.java +++ b/application/src/main/java/org/thingsboard/server/controller/EntityGroupController.java @@ -1389,7 +1389,7 @@ public class EntityGroupController extends AutoCommitController { Edge edge = checkEdgeId(edgeId, Operation.WRITE); EntityGroupId entityGroupId = new EntityGroupId(toUUID(strEntityGroupId)); - checkEntityGroupId(entityGroupId, Operation.READ); + checkEntityGroupId(entityGroupId, Operation.WRITE); EntityType groupType = checkStrEntityGroupType("groupType", strGroupType); EntityGroup savedEntityGroup = checkNotNull(entityGroupService.assignEntityGroupToEdge(getCurrentUser().getTenantId(), entityGroupId, edgeId, groupType)); diff --git a/application/src/main/java/org/thingsboard/server/controller/IntegrationController.java b/application/src/main/java/org/thingsboard/server/controller/IntegrationController.java index e2ef0e3e23..2a7ce581af 100644 --- a/application/src/main/java/org/thingsboard/server/controller/IntegrationController.java +++ b/application/src/main/java/org/thingsboard/server/controller/IntegrationController.java @@ -5,7 +5,9 @@ package org.thingsboard.server.controller; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; @@ -142,14 +144,10 @@ public class IntegrationController extends AutoCommitController { checkEntity(integration.getId(), integration, Resource.INTEGRATION); - if (!integration.isEdgeTemplate()) { - try { - Integration copy = new Integration(integration); - secretConfigurationService.replaceSecretUsages(tenantId, copy.getConfiguration()); - integrationManagerService.validateIntegrationConfiguration(copy).get(20, TimeUnit.SECONDS); - } catch (ExecutionException e) { - throwRealCause(e); - } + try { + tbIntegrationService.validateIntegrationConfiguration(tenantId, integration); + } catch (ExecutionException e) { + throwRealCause(e); } Integration result = checkNotNull(integrationService.saveIntegration(integration)); @@ -479,6 +477,8 @@ public class IntegrationController extends AutoCommitController { notes = "Returns a ZIP containing integration.json, uplink.json, optional downlink.json, " + "and form.json. Sensitive fields are tokenized via @TemplateField annotations on " + "the integration's runtime POJO.") + @ApiResponse(responseCode = "200", description = "OK", + content = @Content(mediaType = "application/zip", schema = @Schema(type = "string", format = "binary"))) @PreAuthorize("hasAuthority('TENANT_ADMIN')") @GetMapping("/integration/{integrationId}/export-package") public ResponseEntity exportIntegrationPackage( diff --git a/application/src/main/java/org/thingsboard/server/controller/IotHubController.java b/application/src/main/java/org/thingsboard/server/controller/IotHubController.java index f3d32fedc8..b6d01d3342 100644 --- a/application/src/main/java/org/thingsboard/server/controller/IotHubController.java +++ b/application/src/main/java/org/thingsboard/server/controller/IotHubController.java @@ -32,10 +32,17 @@ import java.util.UUID; import org.thingsboard.server.common.data.id.IotHubInstalledItemId; import org.thingsboard.server.common.data.permission.Operation; import org.thingsboard.server.common.data.permission.Resource; +import org.thingsboard.server.dao.device.DeviceConnectivityHostSource; import org.thingsboard.server.dao.device.DeviceConnectivityService; import org.thingsboard.server.dao.iot_hub.IotHubInstalledItemService; import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.security.system.ResolvedBaseUrl; import org.thingsboard.server.service.security.system.SystemSecurityService; +import org.thingsboard.server.service.iot_hub.DevicePackageEntityState; +import org.thingsboard.server.service.iot_hub.DevicePackageUpdateService; +import org.thingsboard.server.service.iot_hub.DeviceUpdateRequest; +import org.thingsboard.server.service.iot_hub.DeviceUpdateResult; +import org.thingsboard.server.service.iot_hub.InstalledItemKeptEntities; import org.thingsboard.server.service.iot_hub.InstallItemVersionResult; import org.thingsboard.server.service.iot_hub.InstallPlan; import org.thingsboard.server.service.iot_hub.InstallPlanResult; @@ -51,6 +58,7 @@ import org.thingsboard.server.service.iot_hub.IotHubService; public class IotHubController extends BaseController { private final IotHubService iotHubService; + private final DevicePackageUpdateService devicePackageUpdateService; private final IotHubInstalledItemService iotHubInstalledItemService; private final DeviceConnectivityService deviceConnectivityService; private final SystemSecurityService systemSecurityService; @@ -95,6 +103,23 @@ public class IotHubController extends BaseController { return iotHubService.registerDeviceInstall(getCurrentUser(), versionId, descriptor); } + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @GetMapping("/installedItems/{installedItemId}/deviceUpdate/check") + @ResponseBody + public List checkDeviceUpdate(@PathVariable UUID installedItemId) throws ThingsboardException { + checkAllPermissions(); + return devicePackageUpdateService.check(getCurrentUser(), new IotHubInstalledItemId(installedItemId)); + } + + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @PostMapping("/installedItems/{installedItemId}/deviceUpdate") + @ResponseBody + public DeviceUpdateResult updateDevicePackage(@PathVariable UUID installedItemId, + @RequestBody DeviceUpdateRequest request) throws ThingsboardException { + checkAllPermissions(); + return devicePackageUpdateService.apply(getCurrentUser(), new IotHubInstalledItemId(installedItemId), request); + } + @PreAuthorize("hasAuthority('TENANT_ADMIN')") @PostMapping("/installedItems/{installedItemId}/update/{versionId}") @ResponseBody @@ -153,13 +178,22 @@ public class IotHubController extends BaseController { iotHubService.deleteInstalledItem(getCurrentUser(), new IotHubInstalledItemId(installedItemId)); } + @PreAuthorize("hasAuthority('TENANT_ADMIN')") + @GetMapping("/installedItems/{installedItemId}/keptEntities") + @ResponseBody + public InstalledItemKeptEntities getInstalledItemKeptEntities(@PathVariable UUID installedItemId) throws ThingsboardException { + checkAllPermissions(); + return iotHubService.findKeptEntities(getTenantId(), new IotHubInstalledItemId(installedItemId)); + } + @PreAuthorize("hasAuthority('TENANT_ADMIN')") @GetMapping("/connectivity") @ResponseBody public JsonNode getConnectivitySettings(HttpServletRequest request) throws Exception { checkAllPermissions(); - String baseUrl = systemSecurityService.getBaseUrl(getTenantId(), getCurrentUser().getCustomerId(), request); - return deviceConnectivityService.getConnectivityInfo(baseUrl); + ResolvedBaseUrl baseUrl = systemSecurityService.resolveBaseUrl(getTenantId(), getCurrentUser().getCustomerId(), request); + return deviceConnectivityService.getConnectivityInfo(baseUrl.url(), + baseUrl.fromRequest() ? DeviceConnectivityHostSource.REQUEST : DeviceConnectivityHostSource.BASE_URL); } private void checkAllPermissions() throws ThingsboardException { diff --git a/application/src/main/java/org/thingsboard/server/controller/RpcV2Controller.java b/application/src/main/java/org/thingsboard/server/controller/RpcV2Controller.java index c8bd2ac06d..bfc253f687 100644 --- a/application/src/main/java/org/thingsboard/server/controller/RpcV2Controller.java +++ b/application/src/main/java/org/thingsboard/server/controller/RpcV2Controller.java @@ -160,6 +160,8 @@ public class RpcV2Controller extends AbstractRpcController { } @ApiOperation(value = "Get persistent RPC requests", notes = "Allows to query RPC calls for specific device using pagination." + TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) + @ApiResponse(responseCode = "200", description = "OK", + content = @Content(schema = @Schema(implementation = PageDataRpc.class))) @PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')") @RequestMapping(value = "/persistent/device/{deviceId}", method = RequestMethod.GET) @ResponseBody @@ -244,4 +246,13 @@ public class RpcV2Controller extends AbstractRpcController { tbClusterService.pushMsgToRuleEngine(getTenantId(), rpc.getDeviceId(), msg, null); } } + + /** + * Documents the {@code PageData} that {@link #getPersistedRpcByDevice} returns + * through a {@code DeferredResult}. Used only by the OpenAPI spec. + */ + @Schema(name = "PageDataRpc") + private static final class PageDataRpc extends PageData { + } + } diff --git a/application/src/main/java/org/thingsboard/server/controller/SignUpController.java b/application/src/main/java/org/thingsboard/server/controller/SignUpController.java index aff74dfcd0..305385a8e3 100644 --- a/application/src/main/java/org/thingsboard/server/controller/SignUpController.java +++ b/application/src/main/java/org/thingsboard/server/controller/SignUpController.java @@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.rule.engine.api.MailService; import org.thingsboard.rule.engine.api.NotificationCenter; @@ -340,7 +341,7 @@ public class SignUpController extends BaseController { @ApiOperation(value = "Mobile Login redirect (mobileLogin)", notes = "This method generates redirect to the special link that is handled by mobile application. Useful for email verification flow on mobile app.") - @GetMapping(value = "/noauth/login", params = {"pkgName, platform"}) + @GetMapping(value = "/noauth/login", params = {"pkgName", "platform"}) public ResponseEntity mobileLogin( @Parameter(description = "Mobile app package name. Used to identify the application and build the redirect link.", required = true) @RequestParam(value = "pkgName") String pkgName, @@ -406,7 +407,9 @@ public class SignUpController extends BaseController { String baseUrl = MiscUtils.constructBaseUrl(request); String loginUrl; if (!StringUtils.isEmpty(pkgName)) { - loginUrl = String.format("%s/api/noauth/login?pkgName=%s", baseUrl, pkgName); + loginUrl = UriComponentsBuilder.fromUriString(baseUrl).path("/api/noauth/login") + .queryParam("pkgName", pkgName).queryParam("platform", platform) + .encode().toUriString(); } else { loginUrl = String.format("%s/login", baseUrl); } diff --git a/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java b/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java index c072b6b09d..f10009830c 100644 --- a/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java +++ b/application/src/main/java/org/thingsboard/server/controller/SystemInfoController.java @@ -3,7 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.controller; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import io.swagger.v3.oas.annotations.Hidden; import jakarta.annotation.PostConstruct; @@ -21,6 +20,7 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.DashboardInfo; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.SystemParams; +import org.thingsboard.server.common.data.SystemVersionInfo; import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.TenantId; @@ -34,6 +34,7 @@ import org.thingsboard.server.common.data.settings.UserSettings; import org.thingsboard.server.common.data.settings.UserSettingsType; import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; import org.thingsboard.server.common.msg.edqs.EdqsService; +import org.thingsboard.server.config.annotations.ApiOperation; import org.thingsboard.server.dao.mobile.QrCodeSettingService; import org.thingsboard.server.dao.subscription.PlatformFeature; import org.thingsboard.server.dao.subscription.SubscriptionService; @@ -52,7 +53,8 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -@Hidden +import static org.thingsboard.server.controller.ControllerConstants.SYSTEM_OR_TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH; + @RestController @TbCoreComponent @RequestMapping("/api") @@ -117,23 +119,26 @@ public class SystemInfoController extends BaseController { @PostConstruct public void init() { - JsonNode info = buildInfoObject(); - log.info("System build info: {}", info); + log.info("System build info: {}", JacksonUtil.toString(buildInfoObject())); } + @ApiOperation(value = "Get platform version (getSystemVersionInfo)", + notes = "Returns the version and edition of the platform build." + SYSTEM_OR_TENANT_OR_CUSTOMER_AUTHORITY_PARAGRAPH) @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") @RequestMapping(value = "/system/info", method = RequestMethod.GET) @ResponseBody - public JsonNode getSystemVersionInfo() { + public SystemVersionInfo getSystemVersionInfo() { return buildInfoObject(); } + @Hidden @RequestMapping(value = "/noauth/system/development", method = RequestMethod.GET) @ResponseBody public Boolean isDevelopment() { return subscriptionService.isDevelopment(TenantId.SYS_TENANT_ID); } + @Hidden @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") @RequestMapping(value = "/system/params", method = RequestMethod.GET) @ResponseBody @@ -230,17 +235,11 @@ public class SystemInfoController extends BaseController { currentUser.getAdditionalInfo().get("defaultDashboardFullscreen").booleanValue()); } - private JsonNode buildInfoObject() { - ObjectNode infoObject = JacksonUtil.newObjectNode(); + private SystemVersionInfo buildInfoObject() { if (buildProperties != null) { - infoObject.put("version", buildProperties.getVersion()); - infoObject.put("artifact", buildProperties.getArtifact()); - infoObject.put("name", buildProperties.getName()); - } else { - infoObject.put("version", "unknown"); + return new SystemVersionInfo(buildProperties.getVersion(), buildProperties.getArtifact(), buildProperties.getName(), "PE"); } - infoObject.put("type", "PE"); - return infoObject; + return new SystemVersionInfo("unknown", null, null, "PE"); } } diff --git a/application/src/main/java/org/thingsboard/server/controller/UserPermissionsController.java b/application/src/main/java/org/thingsboard/server/controller/UserPermissionsController.java index 44822fd830..3440db9c46 100644 --- a/application/src/main/java/org/thingsboard/server/controller/UserPermissionsController.java +++ b/application/src/main/java/org/thingsboard/server/controller/UserPermissionsController.java @@ -70,7 +70,7 @@ public class UserPermissionsController extends BaseController { @PathVariable(ENTITY_ID) String strEntityId, @Parameter(description = OPERATION_PARAM_DESCRIPTION, required = true, schema = @Schema(allowableValues = {"ALL", "CREATE", "READ", "WRITE", "DELETE", "RPC_CALL", "READ_CREDENTIALS", "WRITE_CREDENTIALS", "READ_ATTRIBUTES", "WRITE_ATTRIBUTES", "READ_TELEMETRY", "WRITE_TELEMETRY","ADD_TO_GROUP", - "REMOVE_FROM_GROUP", "CHANGE_OWNER", "IMPERSONATE", "CLAIM_DEVICES", "SHARE_GROUP", "ASSIGN_TO_TENANT", "READ_CALCULATED_FIELD", "WRITE_CALCULATED_FIELD"})) + "REMOVE_FROM_GROUP", "CHANGE_OWNER", "IMPERSONATE", "CLAIM_DEVICES", "SHARE_GROUP", "ASSIGN_TO_TENANT", "READ_CALCULATED_FIELD", "WRITE_CALCULATED_FIELD", "INVOKE"})) @PathVariable(OPERATION) Operation operation) { EntityId entityId = EntityIdFactory.getByTypeAndId(entityType, strEntityId); try { diff --git a/application/src/main/java/org/thingsboard/server/service/ai/DefaultTbAiService.java b/application/src/main/java/org/thingsboard/server/service/ai/DefaultTbAiService.java index fbd6764cec..f3b60383eb 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/DefaultTbAiService.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/DefaultTbAiService.java @@ -25,6 +25,7 @@ import org.thingsboard.server.service.ai.transport.TbAiOperation; import org.thingsboard.server.service.ai.transport.TbAiOperations; import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.security.model.SecurityUser; +import org.thingsboard.server.service.ai.transport.TbAiTurnLink; import reactor.core.publisher.Flux; import reactor.core.publisher.Sinks; @@ -57,9 +58,12 @@ class DefaultTbAiService implements TbAiService { } @Override - public Flux> processStream(UUID chatId, TbAiCall>> call, SecurityUser user) { + public Flux> processStream(UUID chatId, TbAiCall>> call, SecurityUser user, + TbAiTurnLink link, boolean checkCredits) { checkEnabled(); - checkApiUsage(user); + if (checkCredits) { + checkApiUsage(user); + } TbAiClient.TokenProvider tokenProvider = createCheckedTokenProvider(user); return Flux.defer(() -> { // Eager subscribe so client cancel does not drop the trailing creditsUsed event. @@ -85,7 +89,8 @@ class DefaultTbAiService implements TbAiService { clientSink::tryEmitComplete ); - return clientSink.asFlux(); + Flux> client = clientSink.asFlux(); + return link != null ? client.doOnCancel(link::clientLeft) : client; }); } @@ -161,10 +166,20 @@ class DefaultTbAiService implements TbAiService { if (response.isSuccess()) { return response.getValue(); } else { - throw new ThingsboardRuntimeException(response.getError(), ThingsboardErrorCode.GENERAL); + throw new ThingsboardRuntimeException(response.getError(), toErrorCode(response.getStatus())); } } + static ThingsboardErrorCode toErrorCode(int status) { + return switch (status) { + case 400, 413, 415, 422 -> ThingsboardErrorCode.BAD_REQUEST_PARAMS; + case 404 -> ThingsboardErrorCode.ITEM_NOT_FOUND; + case 409 -> ThingsboardErrorCode.VERSION_CONFLICT; + case 429 -> ThingsboardErrorCode.TOO_MANY_REQUESTS; + default -> ThingsboardErrorCode.GENERAL; + }; + } + private void checkApiUsage(SecurityUser user) { if (!apiUsageStateService.getApiUsageState(user.getTenantId()).isAiEnabled()) { throw new ThingsboardRuntimeException("Out of AI credits", ThingsboardErrorCode.TOO_MANY_REQUESTS); diff --git a/application/src/main/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProvider.java b/application/src/main/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProvider.java index 18b518b49a..871f34f253 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProvider.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProvider.java @@ -12,7 +12,6 @@ import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.dao.subscription.SubscriptionService; import org.thingsboard.server.exception.ThingsboardRuntimeException; import org.thingsboard.server.queue.util.TbCoreComponent; -import org.thingsboard.server.service.install.ProjectInfo; import org.thingsboard.server.service.security.model.SecurityUser; import java.util.Map; @@ -27,7 +26,6 @@ import java.util.function.Supplier; class OnPremiseTbAiTokenProvider implements TbAiTokenProvider { private final SubscriptionService subscriptionService; - private final ProjectInfo projectInfo; @Override public String getToken(SecurityUser user) { @@ -65,8 +63,7 @@ class OnPremiseTbAiTokenProvider implements TbAiTokenProvider { private Map additionalInfo(UUID userId, TenantId tenantId) { return Map.of( TbAiHeaders.USER_ID, userId.toString(), - TbAiHeaders.TENANT_ID, tenantId.getId().toString(), - TbAiHeaders.TB_VERSION, projectInfo.getProjectVersion() + TbAiHeaders.TENANT_ID, tenantId.getId().toString() ); } diff --git a/application/src/main/java/org/thingsboard/server/service/ai/TbAiService.java b/application/src/main/java/org/thingsboard/server/service/ai/TbAiService.java index 6473d29bcc..26f3497385 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/TbAiService.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/TbAiService.java @@ -7,6 +7,7 @@ import org.springframework.http.codec.ServerSentEvent; import org.thingsboard.ai.common.client.TbAiClient; import org.thingsboard.ai.common.data.usage.ApiUsageInfo; import org.thingsboard.server.service.security.model.SecurityUser; +import org.thingsboard.server.service.ai.transport.TbAiTurnLink; import reactor.core.publisher.Flux; import java.util.UUID; @@ -19,7 +20,17 @@ public interface TbAiService { JsonNode process(TbAiCall action, SecurityUser user, boolean checkCredits); - Flux> processStream(UUID chatId, TbAiCall>> action, SecurityUser user); + default Flux> processStream(UUID chatId, TbAiCall>> action, SecurityUser user) { + return processStream(chatId, action, user, null, true); + } + + /** + * Streams a chat turn to the browser. {@code link}, when given, is told when the browser stops listening, which + * ThingsBoard itself never does before the turn ends. {@code checkCredits} is false for following a turn that has + * already been paid for. + */ + Flux> processStream(UUID chatId, TbAiCall>> action, SecurityUser user, + TbAiTurnLink link, boolean checkCredits); boolean isEnabled(); diff --git a/application/src/main/java/org/thingsboard/server/service/ai/chat/AiChatService.java b/application/src/main/java/org/thingsboard/server/service/ai/chat/AiChatService.java index 2e989304af..2eae20227a 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/chat/AiChatService.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/chat/AiChatService.java @@ -26,4 +26,6 @@ public interface AiChatService { SecurityUser user ); + Flux> resumeChat(UUID chatId, String tbAccessToken, String acceptLanguage, String clientOrigin, SecurityUser user); + } diff --git a/application/src/main/java/org/thingsboard/server/service/ai/chat/DefaultAiChatService.java b/application/src/main/java/org/thingsboard/server/service/ai/chat/DefaultAiChatService.java index cb60ca296a..1b15fc8045 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/chat/DefaultAiChatService.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/chat/DefaultAiChatService.java @@ -8,12 +8,14 @@ import org.springframework.http.codec.ServerSentEvent; import org.springframework.stereotype.Service; import org.thingsboard.ai.common.channel.ChannelProtocol; import org.thingsboard.ai.common.channel.ChatOperationRequest; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.ai.TbAiService; import org.thingsboard.server.service.ai.transport.TbAiOperation; import org.thingsboard.server.service.ai.transport.TbAiOperations; import org.thingsboard.server.service.ai.transport.TbAiTransport; import org.thingsboard.server.service.ai.transport.TbAiTurnContext; +import org.thingsboard.server.service.ai.transport.TbAiTurnLink; import org.thingsboard.server.service.security.model.SecurityUser; import reactor.core.publisher.Flux; @@ -24,6 +26,8 @@ import java.util.UUID; @RequiredArgsConstructor class DefaultAiChatService implements AiChatService { + private static final JsonNode TOOL_CARDS = JacksonUtil.newObjectNode().put("toolCards", true); + private final TbAiService tbAiService; private final TbAiTransport tbAiTransport; private final TbAiOperations operations; @@ -49,7 +53,7 @@ class DefaultAiChatService implements AiChatService { @Override public JsonNode getChatMessages(UUID chatId, SecurityUser user) { return tbAiService.process(tokenProvider -> operations.execute( - new TbAiOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, null)), user, tokenProvider), user, false); + new TbAiOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, TOOL_CARDS)), user, tokenProvider), user, false); } @Override @@ -63,10 +67,20 @@ class DefaultAiChatService implements AiChatService { UUID chatId, JsonNode request, String tbAccessToken, String acceptLanguage, String clientOrigin, SecurityUser user ) { + var link = new TbAiTurnLink(); + return tbAiService.processStream(chatId, tokenProvider -> { + var context = new TbAiTurnContext(user, tbAccessToken, acceptLanguage, tokenProvider, clientOrigin); + return tbAiTransport.sendChatMessage(chatId, request, context, link); + }, user, link, true); + } + + @Override + public Flux> resumeChat(UUID chatId, String tbAccessToken, String acceptLanguage, String clientOrigin, SecurityUser user) { + var link = new TbAiTurnLink(); return tbAiService.processStream(chatId, tokenProvider -> { var context = new TbAiTurnContext(user, tbAccessToken, acceptLanguage, tokenProvider, clientOrigin); - return tbAiTransport.sendChatMessage(chatId, request, context); - }, user); + return tbAiTransport.resumeChat(chatId, context, link); + }, user, link, false); } } diff --git a/application/src/main/java/org/thingsboard/server/service/ai/resource/AiResourceService.java b/application/src/main/java/org/thingsboard/server/service/ai/resource/AiResourceService.java new file mode 100644 index 0000000000..ece2210823 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/ai/resource/AiResourceService.java @@ -0,0 +1,24 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.ai.resource; + +import com.fasterxml.jackson.databind.JsonNode; +import org.springframework.web.multipart.MultipartFile; +import org.thingsboard.server.common.data.exception.ThingsboardException; +import org.thingsboard.server.service.security.model.SecurityUser; + +import java.util.UUID; + +public interface AiResourceService { + + JsonNode getConfig(SecurityUser user); + + JsonNode upload(MultipartFile file, SecurityUser user) throws ThingsboardException; + + AiResourceContent download(UUID resourceId, SecurityUser user); + + void delete(UUID resourceId, SecurityUser user); + + record AiResourceContent(String name, String mediaType, byte[] data) {} + +} diff --git a/application/src/main/java/org/thingsboard/server/service/ai/resource/DefaultAiResourceService.java b/application/src/main/java/org/thingsboard/server/service/ai/resource/DefaultAiResourceService.java new file mode 100644 index 0000000000..82788db693 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/ai/resource/DefaultAiResourceService.java @@ -0,0 +1,84 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.ai.resource; + +import com.fasterxml.jackson.databind.JsonNode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.thingsboard.ai.common.channel.ChannelProtocol; +import org.thingsboard.ai.common.channel.ResourceOperationRequest; +import org.thingsboard.ai.common.channel.ResourceUploadRequest; +import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; +import org.thingsboard.server.common.data.exception.ThingsboardException; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.ai.TbAiService; +import org.thingsboard.server.service.ai.transport.TbAiOperation; +import org.thingsboard.server.service.ai.transport.TbAiOperations; +import org.thingsboard.server.service.security.model.SecurityUser; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.UUID; + +@Service +@TbCoreComponent +@RequiredArgsConstructor +class DefaultAiResourceService implements AiResourceService { + + private final TbAiService tbAiService; + private final TbAiOperations operations; + + @Override + public JsonNode getConfig(SecurityUser user) { + return tbAiService.process(tokenProvider -> operations.execute( + new TbAiOperation(ChannelProtocol.RESOURCE_CONFIG, null), user, tokenProvider), user, false); + } + + @Override + public JsonNode upload(MultipartFile file, SecurityUser user) throws ThingsboardException { + if (file == null || file.isEmpty()) { + throw new ThingsboardException("The file is empty", ThingsboardErrorCode.BAD_REQUEST_PARAMS); + } + long maxSize = getConfig(user).path("maxSize").asLong(0); + if (maxSize > 0 && file.getSize() > maxSize) { + throw new ThingsboardException("The file is too large: " + file.getOriginalFilename(), ThingsboardErrorCode.BAD_REQUEST_PARAMS); + } + String data; + try { + data = base64(file); + } catch (IOException e) { + throw new ThingsboardException("Failed to read the file", e, ThingsboardErrorCode.GENERAL); + } + var request = new ResourceUploadRequest(file.getOriginalFilename(), file.getContentType(), data); + return tbAiService.process(tokenProvider -> operations.execute( + new TbAiOperation(ChannelProtocol.RESOURCE_UPLOAD, request), user, tokenProvider), user, false); + } + + private static String base64(MultipartFile file) throws IOException { + var encoded = new ByteArrayOutputStream((int) Math.min(Integer.MAX_VALUE - 8, (file.getSize() + 2) / 3 * 4)); + try (InputStream in = file.getInputStream(); OutputStream encoder = Base64.getEncoder().wrap(encoded)) { + in.transferTo(encoder); + } + return encoded.toString(StandardCharsets.ISO_8859_1); + } + + @Override + public AiResourceContent download(UUID resourceId, SecurityUser user) { + JsonNode content = tbAiService.process(tokenProvider -> operations.execute( + new TbAiOperation(ChannelProtocol.RESOURCE_GET, new ResourceOperationRequest(resourceId)), user, tokenProvider), user, false); + return new AiResourceContent(content.path("name").asText(), content.path("mediaType").asText(), + Base64.getDecoder().decode(content.path("data").asText())); + } + + @Override + public void delete(UUID resourceId, SecurityUser user) { + tbAiService.process(tokenProvider -> operations.execute( + new TbAiOperation(ChannelProtocol.RESOURCE_DELETE, new ResourceOperationRequest(resourceId)), user, tokenProvider), user, false); + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/ai/solution/AiSolutionService.java b/application/src/main/java/org/thingsboard/server/service/ai/solution/AiSolutionService.java index 514672a782..b0f7763131 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/solution/AiSolutionService.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/solution/AiSolutionService.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode; import org.thingsboard.ai.common.data.solution.SolutionStep; import org.thingsboard.server.service.security.model.SecurityUser; +import java.util.List; import java.util.UUID; public interface AiSolutionService { @@ -16,7 +17,7 @@ public interface AiSolutionService { JsonNode getSolutions(SecurityUser user); - JsonNode chat(UUID solutionId, SolutionStep step, String message, SecurityUser user); + JsonNode chat(UUID solutionId, SolutionStep step, String message, List resources, SecurityUser user); JsonNode createSolution(UUID solutionId, SecurityUser user); diff --git a/application/src/main/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionService.java b/application/src/main/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionService.java index a93b1c6872..c110699cbd 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionService.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionService.java @@ -4,8 +4,12 @@ package org.thingsboard.server.service.ai.solution; import com.fasterxml.jackson.databind.JsonNode; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.thingsboard.ai.common.data.solution.SolutionStep; +import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; +import org.thingsboard.server.exception.ThingsboardRuntimeException; +import org.thingsboard.server.common.data.util.CollectionsUtil; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.ai.common.channel.ChannelProtocol; import org.thingsboard.ai.common.channel.SolutionChatRequest; @@ -18,6 +22,7 @@ import org.thingsboard.server.service.ai.transport.TbAiOperations; import org.thingsboard.server.service.ai.transport.TbAiTurnContext; import org.thingsboard.server.service.security.model.SecurityUser; +import java.util.List; import java.util.UUID; @Service @@ -47,9 +52,14 @@ public class DefaultAiSolutionService implements AiSolutionService { } @Override - public JsonNode chat(UUID solutionId, SolutionStep step, String message, SecurityUser user) { + public JsonNode chat(UUID solutionId, SolutionStep step, String message, List resources, SecurityUser user) { + String text = StringUtils.defaultString(message); + List attached = CollectionsUtil.isEmpty(resources) ? null : resources; + if (StringUtils.isBlank(text) && attached == null) { + throw new ThingsboardRuntimeException("Message cannot be blank", ThingsboardErrorCode.BAD_REQUEST_PARAMS); + } return tbAiService.process(tokenProvider -> operations.execute( - new TbAiOperation(ChannelProtocol.SOLUTION_CHAT, new SolutionChatRequest(solutionId, step, message)), user, tokenProvider), user); + new TbAiOperation(ChannelProtocol.SOLUTION_CHAT, new SolutionChatRequest(solutionId, step, text, attached)), user, tokenProvider), user); } @Override diff --git a/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperations.java b/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperations.java index 3904f7b6e1..5d6b1c4846 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperations.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperations.java @@ -83,11 +83,11 @@ class ChannelTbAiOperations { static TbAiResponse toResponse(OperationResult result) { TbAiResponse response; if (result.isSuccess()) { - response = TbAiResponse.builder().success(true).value(result.body()).build(); + response = TbAiResponse.builder().success(true).status(result.status()).value(result.body()).build(); } else { JsonNode message = result.body() != null ? result.body().get("message") : null; String error = message != null && message.isTextual() ? message.asText() : reasonPhrase(result.status()); - response = TbAiResponse.builder().success(false).error(error).build(); + response = TbAiResponse.builder().success(false).status(result.status()).error(error).build(); } response.setCreditsUsed(result.creditsUsed()); return response; diff --git a/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransport.java b/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransport.java index c7b3dbabf5..c8e49e4797 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransport.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransport.java @@ -39,10 +39,22 @@ class ChannelTbAiTransport implements TbAiTransport { private final TbAiRequestExecutor requestExecutor; @Override - public Flux> sendChatMessage(UUID chatId, JsonNode request, TbAiTurnContext context) { + public Flux> sendChatMessage(UUID chatId, JsonNode request, TbAiTurnContext context, TbAiTurnLink link) { + return turn(ChannelProtocol.CHAT_SEND, chatId, request, context, link); + } + + @Override + public Flux> resumeChat(UUID chatId, TbAiTurnContext context, TbAiTurnLink link) { + return turn(ChannelProtocol.CHAT_RESUME, chatId, null, context, link); + } + + private Flux> turn(String type, UUID chatId, JsonNode request, TbAiTurnContext context, TbAiTurnLink link) { return Flux.create(sink -> { - var turn = new ChannelTurn(chatId, request, context, sink); + var turn = new ChannelTurn(type, chatId, request, context, sink); sink.onDispose(turn::abandon); + if (link != null) { + link.onClientLeft(turn::detach); + } turn.start(false); }); } @@ -56,6 +68,7 @@ class ChannelTbAiTransport implements TbAiTransport { private final class ChannelTurn implements TbAiChannelExchange { + private final String type; private final UUID chatId; private final JsonNode request; private final TbAiTurnContext context; @@ -65,8 +78,10 @@ class ChannelTbAiTransport implements TbAiTransport { private volatile String op; private volatile boolean frameSeen; private volatile boolean retried; + private volatile boolean detached; - private ChannelTurn(UUID chatId, JsonNode request, TbAiTurnContext context, FluxSink> sink) { + private ChannelTurn(String type, UUID chatId, JsonNode request, TbAiTurnContext context, FluxSink> sink) { + this.type = type; this.chatId = chatId; this.request = request; this.context = context; @@ -98,6 +113,23 @@ class ChannelTbAiTransport implements TbAiTransport { end(null); } + void detach() { + detached = true; + sendDetach(); + } + + private void sendDetach() { + TbAiPooledConnection current = connection; + if (finished.get() || current == null || !current.supports(ChannelProtocol.TURN_RESUME_CAPABILITY)) { + return; + } + try { + current.send(new ChannelFrame(ChannelProtocol.CHAT_DETACH, null, null, null, op)); + } catch (ChannelException e) { + log.debug("[{}] Failed to detach from the AI turn: {}", chatId, e.getMessage()); + } + } + @Override public void onFrame(TbAiPooledConnection frameConnection, ChannelFrame frame) { try { @@ -153,13 +185,21 @@ class ChannelTbAiTransport implements TbAiTransport { acquired.unreserve(System.nanoTime()); return; } - ChannelFrame start = ChannelFrame.request(ChannelProtocol.CHAT_SEND, + if (ChannelProtocol.CHAT_RESUME.equals(type) && !acquired.supports(ChannelProtocol.TURN_RESUME_CAPABILITY)) { + acquired.unreserve(System.nanoTime()); + end(null); + return; + } + ChannelFrame start = ChannelFrame.request(type, acquired.codec().toPayload(new ChatTurnRequest(chatId, request, context.acceptLanguage()))) .withOrigin(context.clientOrigin()); op = start.id(); connection = acquired; try { acquired.start(this, start); + if (detached) { + sendDetach(); + } } catch (ChannelException e) { connection = null; acquired.finish(op, System.nanoTime()); diff --git a/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiChannelPool.java b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiChannelPool.java index a79614d9a0..9cb93f24d1 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiChannelPool.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiChannelPool.java @@ -14,10 +14,12 @@ import org.springframework.stereotype.Component; import org.thingsboard.ai.common.channel.ChannelProtocol; import org.thingsboard.ai.common.channel.TbAiChannelClient; import org.thingsboard.ai.common.client.TbAiClient; +import org.thingsboard.ai.common.client.TbAiHeaders; import org.thingsboard.common.util.ThingsBoardThreadFactory; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.install.ProjectInfo; import reactor.core.scheduler.Schedulers; import java.time.Duration; @@ -59,6 +61,7 @@ class TbAiChannelPool { private static final int MAX_ACQUIRE_ATTEMPTS = 3; private final TbAiChannelClient channelClient; + private final String tbVersion; private final int maxConnections; private final int maxOperationsPerConnection; private final long idleTimeoutNanos; @@ -71,17 +74,19 @@ class TbAiChannelPool { @Autowired TbAiChannelPool(TbAiChannelClient channelClient, + ProjectInfo projectInfo, @Value("${ai.channel.pool.max_connections:2000}") int maxConnections, @Value("${ai.channel.pool.max_operations_per_connection:20}") int maxOperationsPerConnection, @Value("${ai.channel.pool.idle_timeout_seconds:60}") long idleTimeoutSeconds, @Value("${ai.channel.pool.max_age_minutes:10}") long maxAgeMinutes) { - this(channelClient, maxConnections, maxOperationsPerConnection, Duration.ofSeconds(idleTimeoutSeconds), - Duration.ofMinutes(maxAgeMinutes), System::nanoTime, true); + this(channelClient, projectInfo.getProjectVersion(), maxConnections, maxOperationsPerConnection, + Duration.ofSeconds(idleTimeoutSeconds), Duration.ofMinutes(maxAgeMinutes), System::nanoTime, true); } - TbAiChannelPool(TbAiChannelClient channelClient, int maxConnections, int maxOperationsPerConnection, + TbAiChannelPool(TbAiChannelClient channelClient, String tbVersion, int maxConnections, int maxOperationsPerConnection, Duration idleTimeout, Duration maxAge, LongSupplier nanoClock, boolean startSweeper) { this.channelClient = channelClient; + this.tbVersion = tbVersion; this.maxConnections = maxConnections; this.maxOperationsPerConnection = maxOperationsPerConnection; this.idleTimeoutNanos = idleTimeout.toNanos(); @@ -293,12 +298,9 @@ class TbAiChannelPool { return true; } - private static TbAiClient.TokenProvider handshakeTokenProvider(TbAiTurnContext context) { + private TbAiClient.TokenProvider handshakeTokenProvider(TbAiTurnContext context) { TbAiClient.TokenProvider delegate = context.tokenProvider(); String acceptLanguage = context.acceptLanguage(); - if (acceptLanguage == null || acceptLanguage.isBlank()) { - return delegate; - } return new TbAiClient.TokenProvider() { @Override public String getToken() { @@ -308,7 +310,10 @@ class TbAiChannelPool { @Override public Map getAdditionalInfo() { var headers = new HashMap<>(delegate.getAdditionalInfo()); - headers.put(HttpHeaders.ACCEPT_LANGUAGE, acceptLanguage); + headers.put(TbAiHeaders.TB_VERSION, tbVersion); + if (acceptLanguage != null && !acceptLanguage.isBlank()) { + headers.put(HttpHeaders.ACCEPT_LANGUAGE, acceptLanguage); + } return headers; } }; diff --git a/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnection.java b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnection.java index c5bb359d08..3b77aad205 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnection.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnection.java @@ -53,6 +53,7 @@ final class TbAiPooledConnection implements ChannelFrameListener { private volatile ChannelSession session; private volatile int maxFrameBytes = TbAiChannelClient.DEFAULT_MAX_FRAME_BYTES; + private volatile List serverCapabilities = List.of(); /** * Created with one reservation for the caller that opens it, so callers waiting on the same handshake cannot @@ -108,6 +109,14 @@ final class TbAiPooledConnection implements ChannelFrameListener { return ready; } + /** + * Whether TB AI listed {@code capability} in its hello. Frames a capability adds must not be sent without it: an + * older TB AI closes the connection on a frame type it does not know. + */ + boolean supports(String capability) { + return serverCapabilities.contains(capability); + } + /** * The session arrived. If the handshake already failed (the connect timed out), the session is closed: it is * stored first and {@link #failed} closes whatever is stored after failing {@code ready}, so one of the two always @@ -293,6 +302,9 @@ final class TbAiPooledConnection implements ChannelFrameListener { if (hello.maxFrameBytes() != null && hello.maxFrameBytes() > 0 && hello.maxFrameBytes() < Integer.MAX_VALUE) { maxFrameBytes = hello.maxFrameBytes().intValue(); } + if (hello.capabilities() != null) { + serverCapabilities = List.copyOf(hello.capabilities()); + } ready.complete(this); } case ChannelProtocol.ERROR -> { diff --git a/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiTransport.java b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiTransport.java index 1a1e700a22..da40a9de62 100644 --- a/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiTransport.java +++ b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiTransport.java @@ -10,6 +10,12 @@ import java.util.UUID; public interface TbAiTransport { - Flux> sendChatMessage(UUID chatId, JsonNode request, TbAiTurnContext context); + Flux> sendChatMessage(UUID chatId, JsonNode request, TbAiTurnContext context, TbAiTurnLink link); + + /** + * Follows the turn running in the chat: a {@code turnResumed} event, every event of the turn so far, then the live + * ones. Completes at once when no turn is running or when TB AI cannot resume turns. + */ + Flux> resumeChat(UUID chatId, TbAiTurnContext context, TbAiTurnLink link); } diff --git a/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiTurnLink.java b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiTurnLink.java new file mode 100644 index 0000000000..c4014cdbe7 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/ai/transport/TbAiTurnLink.java @@ -0,0 +1,41 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.ai.transport; + +/** + * Connects the browser end of an AI chat stream to its turn on TB AI. ThingsBoard keeps listening to a turn after the + * browser leaves (the turn bills its credits at its end), so leaving is reported separately: TB AI then knows nobody + * follows the turn, and a pending approval expires soon instead of waiting its full timeout for a user who left. + */ +public final class TbAiTurnLink { + + private final Object lock = new Object(); + private Runnable onClientLeft; + private boolean clientLeft; + + public void onClientLeft(Runnable listener) { + boolean leftAlready; + synchronized (lock) { + onClientLeft = listener; + leftAlready = clientLeft; + } + if (leftAlready) { + listener.run(); + } + } + + public void clientLeft() { + Runnable listener; + synchronized (lock) { + if (clientLeft) { + return; + } + clientLeft = true; + listener = onClientLeft; + } + if (listener != null) { + listener.run(); + } + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/converter/ConverterDefaultsService.java b/application/src/main/java/org/thingsboard/server/service/converter/ConverterDefaultsService.java new file mode 100644 index 0000000000..d8584bce2f --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/converter/ConverterDefaultsService.java @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.converter; + +import org.thingsboard.server.common.data.converter.ConverterType; +import org.thingsboard.server.common.data.integration.IntegrationType; + +import java.util.Optional; + +public interface ConverterDefaultsService { + + Optional getPayload(IntegrationType integrationType, ConverterType converterType); + + Optional getMetadata(IntegrationType integrationType, ConverterType converterType); + + Optional getIntegrationName(IntegrationType integrationType); + + Optional getDownlinkMsgType(IntegrationType integrationType); + +} diff --git a/application/src/main/java/org/thingsboard/server/service/converter/DefaultConverterDefaultsService.java b/application/src/main/java/org/thingsboard/server/service/converter/DefaultConverterDefaultsService.java new file mode 100644 index 0000000000..574fb83d1e --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/converter/DefaultConverterDefaultsService.java @@ -0,0 +1,66 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.converter; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.converter.ConverterType; +import org.thingsboard.server.common.data.integration.IntegrationType; +import org.thingsboard.server.queue.util.TbCoreComponent; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Optional; + +@TbCoreComponent +@Service +@Slf4j +public class DefaultConverterDefaultsService implements ConverterDefaultsService { + + private static final String CONVERTERS_DIR = "converters"; + private static final String PAYLOAD_FILE = "payload.json"; + private static final String METADATA_FILE = "metadata.json"; + private static final String INTEGRATION_FILE = "integration.json"; + private static final String MSG_TYPE_FILE = "msgType.txt"; + + @Override + public Optional getPayload(IntegrationType integrationType, ConverterType converterType) { + return getFileContent(integrationType, converterType.getDirectory() + "/" + PAYLOAD_FILE); + } + + @Override + public Optional getMetadata(IntegrationType integrationType, ConverterType converterType) { + return getFileContent(integrationType, converterType.getDirectory() + "/" + METADATA_FILE); + } + + @Override + public Optional getIntegrationName(IntegrationType integrationType) { + return getFileContent(integrationType, INTEGRATION_FILE) + .map(content -> JacksonUtil.toJsonNode(content).get("name").asText()); + } + + @Override + public Optional getDownlinkMsgType(IntegrationType integrationType) { + return getFileContent(integrationType, ConverterType.DOWNLINK.getDirectory() + "/" + MSG_TYPE_FILE) + .map(String::trim); + } + + private Optional getFileContent(IntegrationType integrationType, String relativePath) { + if (integrationType.getDirectory() == null) { + return Optional.empty(); + } + String path = String.join("/", CONVERTERS_DIR, integrationType.getDirectory(), relativePath); + try (InputStream in = getClass().getClassLoader().getResourceAsStream(path)) { + if (in == null) { + return Optional.empty(); + } + return Optional.of(new String(in.readAllBytes(), StandardCharsets.UTF_8)); + } catch (IOException e) { + log.warn("Failed to read converter defaults file {}", path, e); + return Optional.empty(); + } + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/device/DeviceBulkImportService.java b/application/src/main/java/org/thingsboard/server/service/device/DeviceBulkImportService.java index 815d11b832..50bce64a6c 100644 --- a/application/src/main/java/org/thingsboard/server/service/device/DeviceBulkImportService.java +++ b/application/src/main/java/org/thingsboard/server/service/device/DeviceBulkImportService.java @@ -11,6 +11,7 @@ import lombok.SneakyThrows; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.DeviceProfileProvisionType; @@ -89,7 +90,10 @@ public class DeviceBulkImportService extends AbstractBulkImportService { additionalInfo.set("description", new TextNode(value)); break; case IS_GATEWAY: - additionalInfo.set("gateway", BooleanNode.valueOf(Boolean.parseBoolean(value))); + additionalInfo.set(DataConstants.GATEWAY_PARAMETER, BooleanNode.valueOf(Boolean.parseBoolean(value))); + break; + case OVERWRITE_ACTIVITY_TIME: + additionalInfo.set(DataConstants.OVERWRITE_ACTIVITY_TIME_PARAMETER, BooleanNode.valueOf(Boolean.parseBoolean(value))); break; } device.setAdditionalInfo(additionalInfo); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeEntityTenantChecker.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEntityTenantChecker.java new file mode 100644 index 0000000000..5d3397a509 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEntityTenantChecker.java @@ -0,0 +1,78 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.service.edge; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.HasTenantId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.dao.entity.EntityDaoRegistry; +import org.thingsboard.server.dao.entity.EntityService; +import org.thingsboard.server.exception.DataValidationException; +import org.thingsboard.server.queue.util.TbCoreComponent; + +/** + * Checks that entities referenced by edge messages belong to the edge's tenant. + */ +@Slf4j +@Component +@TbCoreComponent +@RequiredArgsConstructor +public class EdgeEntityTenantChecker { + + private final EntityService entityService; + private final EntityDaoRegistry entityDaoRegistry; + + /** + * Returns true if the entity exists and belongs to the tenant. + * Uses the entity services, so cached and tenant-scoped lookups are used where available. + */ + public boolean isTenantEntity(TenantId tenantId, EntityId entityId) { + if (entityId == null) { + return false; + } + try { + return entityService.fetchEntity(tenantId, entityId) + .map(entity -> entity instanceof HasTenantId hasTenantId && tenantId.equals(hasTenantId.getTenantId())) + .orElse(false); + } catch (IllegalArgumentException e) { + log.warn("[{}] Unsupported entity type of {}", tenantId, entityId); + return false; + } + } + + /** + * Loads the entity regardless of its tenant, so that an id of another tenant's entity is detected. + * Returns null if the entity doesn't exist, throws if it belongs to a different tenant. + */ + @SuppressWarnings("unchecked") + public T findTenantEntity(TenantId tenantId, EntityId entityId) { + Object entity = findEntity(tenantId, entityId); + if (entity instanceof HasTenantId hasTenantId && !tenantId.equals(hasTenantId.getTenantId())) { + throw new DataValidationException(entityId.getEntityType() + " " + entityId.getId() + " belongs to a different tenant!"); + } + return (T) entity; + } + + /** + * Returns the tenant of the entity regardless of the given tenant, or null if the entity doesn't exist. + */ + public TenantId findEntityTenantId(TenantId tenantId, EntityId entityId) { + return findEntity(tenantId, entityId) instanceof HasTenantId hasTenantId ? hasTenantId.getTenantId() : null; + } + + private Object findEntity(TenantId tenantId, EntityId entityId) { + if (entityId == null) { + return null; + } + try { + return entityDaoRegistry.getDao(entityId.getEntityType()).findById(tenantId, entityId.getId()); + } catch (IllegalArgumentException e) { + log.warn("[{}] Unsupported entity type of {}", tenantId, entityId); + return null; + } + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java index c57a79de6f..ba3c678d2b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtils.java @@ -774,7 +774,10 @@ public class EdgeMsgConstructorUtils { } public static UserCredentialsUpdateMsg constructUserCredentialsUpdatedMsg(UserCredentials userCredentials) { - return UserCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(userCredentials)).build(); + // activation and reset tokens allow taking over the account and are not used by edge + ObjectNode userCredentialsNode = (ObjectNode) JacksonUtil.valueToTree(userCredentials); + userCredentialsNode.remove(List.of("activateToken", "activateTokenExpTime", "resetToken", "resetTokenExpTime")); + return UserCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(userCredentialsNode)).build(); } public static WidgetsBundleUpdateMsg constructWidgetsBundleUpdateMsg(UpdateMsgType msgType, WidgetsBundle widgetsBundle, List widgets) { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgSummaryUtils.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgSummaryUtils.java new file mode 100644 index 0000000000..051a5409b0 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeMsgSummaryUtils.java @@ -0,0 +1,77 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.service.edge; + +import com.google.protobuf.Descriptors.FieldDescriptor; +import com.google.protobuf.Message; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.StringJoiner; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * Describes edge protobuf messages without their payloads, so they can be logged or put into notifications + * without exposing entity JSON, credentials, tokens or secrets. + */ +public final class EdgeMsgSummaryUtils { + + private static final String MSB = "MSB"; + private static final String LSB = "LSB"; + + private EdgeMsgSummaryUtils() { + } + + // e.g. DownlinkMsg[downlinkMsgId=12, deviceUpdateMsg x2, deviceCredentialsUpdateMsg x1] + // e.g. DeviceUpdateMsg[msgType=ENTITY_UPDATED_RPC_MESSAGE, id=1d6f1e2c-...] + public static String toSummary(Message msg) { + if (msg == null) { + return "null"; + } + Map fields = msg.getAllFields(); + StringJoiner summary = new StringJoiner(", ", msg.getDescriptorForType().getName() + "[", "]"); + fields.forEach((field, value) -> { + String name = field.getName(); + if (field.isRepeated()) { + summary.add(name + " x" + ((List) value).size()); + return; + } + switch (field.getJavaType()) { + case INT, LONG -> { + FieldDescriptor lsbField = name.endsWith(MSB) ? findPairField(msg, name, MSB, LSB) : null; + if (lsbField != null && value instanceof Long msb && msg.getField(lsbField) instanceof Long lsb) { + summary.add(name.substring(0, name.length() - MSB.length()) + "=" + new UUID(msb, lsb)); + } else if (!isPrintedWithPair(msg, fields, name)) { + summary.add(name + "=" + value); + } + } + case BOOLEAN, ENUM -> summary.add(name + "=" + value); + case MESSAGE -> summary.add(name); + // strings and bytes may hold entity JSON, credentials or secrets + default -> { + } + } + }); + return summary.toString(); + } + + // LSB part of an id is printed together with its MSB part + private static boolean isPrintedWithPair(Message msg, Map fields, String name) { + if (!name.endsWith(LSB)) { + return false; + } + FieldDescriptor msbField = findPairField(msg, name, LSB, MSB); + return msbField != null && fields.containsKey(msbField); + } + + private static FieldDescriptor findPairField(Message msg, String name, String suffix, String pairSuffix) { + return msg.getDescriptorForType().findFieldByName(name.substring(0, name.length() - suffix.length()) + pairSuffix); + } + + public static String toSummary(Collection msgs) { + return msgs.stream().map(EdgeMsgSummaryUtils::toSummary).collect(Collectors.joining(", ", "[", "]")); + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeUplinkMessageDispatcher.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeUplinkMessageDispatcher.java index 185f144096..b91855c69a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeUplinkMessageDispatcher.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeUplinkMessageDispatcher.java @@ -37,6 +37,9 @@ import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataRequestMsg; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; +import org.thingsboard.server.gen.edge.v1.SendEmailUplinkMsg; +import org.thingsboard.server.gen.edge.v1.SendNotificationUplinkMsg; +import org.thingsboard.server.gen.edge.v1.SendSmsUplinkMsg; import org.thingsboard.server.gen.edge.v1.SchedulerEventUpdateMsg; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UserCredentialsRequestMsg; @@ -45,6 +48,7 @@ import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetBundleTypesRequestMsg; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeContextComponent; +import org.thingsboard.server.service.edge.EdgeMsgSummaryUtils; import java.util.ArrayList; import java.util.List; @@ -177,6 +181,21 @@ public class EdgeUplinkMessageDispatcher { result.add(ctx.getEdgeRequestsService().processEntityViewsRequestMsg(edge.getTenantId(), edge, entityViewRequestMsg)); } } + if (uplinkMsg.getSendEmailUplinkMsgCount() > 0) { + for (SendEmailUplinkMsg sendEmailUplinkMsg : uplinkMsg.getSendEmailUplinkMsgList()) { + result.add(ctx.getEdgeRequestsService().processSendEmailMsg(edge.getTenantId(), edge, sendEmailUplinkMsg)); + } + } + if (uplinkMsg.getSendSmsUplinkMsgCount() > 0) { + for (SendSmsUplinkMsg sendSmsUplinkMsg : uplinkMsg.getSendSmsUplinkMsgList()) { + result.add(ctx.getEdgeRequestsService().processSendSmsMsg(edge.getTenantId(), edge, sendSmsUplinkMsg)); + } + } + if (uplinkMsg.getSendNotificationUplinkMsgCount() > 0) { + for (SendNotificationUplinkMsg sendNotificationUplinkMsg : uplinkMsg.getSendNotificationUplinkMsgList()) { + result.add(ctx.getEdgeRequestsService().processSendNotificationMsg(edge.getTenantId(), edge, sendNotificationUplinkMsg)); + } + } if (uplinkMsg.getEntityGroupEntitiesRequestMsgCount() > 0) { for (EntityGroupRequestMsg entityGroupEntitiesRequestMsg : uplinkMsg.getEntityGroupEntitiesRequestMsgList()) { result.add(ctx.getEdgeRequestsService().processEntityGroupEntitiesRequest(edge.getTenantId(), edge, entityGroupEntitiesRequestMsg)); @@ -238,7 +257,7 @@ public class EdgeUplinkMessageDispatcher { } } } catch (Exception e) { - String failureMsg = String.format("Can't process uplink msg [%s] from edge", uplinkMsg); + String failureMsg = String.format("Can't process uplink msg [%s] from edge", EdgeMsgSummaryUtils.toSummary(uplinkMsg)); log.trace("[{}][{}] Can't process uplink msg [{}]", edge.getTenantId(), edge.getId(), uplinkMsg, e); ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(edge.getTenantId()).edgeId(edge.getId()) .customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(e.getMessage()).build()); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java index 71d16a966e..a6072ea341 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/BaseEdgeProcessor.java @@ -50,8 +50,10 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; import org.thingsboard.server.common.data.msg.TbMsgType; +import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageDataIterable; import org.thingsboard.server.common.data.page.PageDataIterableByTenantIdEntityId; +import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.RelationTypeGroup; import org.thingsboard.server.common.data.rule.RuleChain; @@ -60,13 +62,14 @@ import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgDataType; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.edge.EdgeSynchronizationManager; -import org.thingsboard.server.dao.entity.EntityDaoRegistry; import org.thingsboard.server.dao.model.ModelConstants; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.TbQueueCallback; import org.thingsboard.server.queue.TbQueueMsgMetadata; import org.thingsboard.server.service.edge.EdgeContextComponent; +import org.thingsboard.server.service.edge.EdgeEntityTenantChecker; import org.thingsboard.server.service.executors.DbCallbackExecutorService; import org.thingsboard.server.service.security.permission.OwnersCacheService; import org.thingsboard.server.service.state.DefaultDeviceStateService; @@ -92,7 +95,7 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { protected EdgeContextComponent edgeCtx; @Autowired - protected EntityDaoRegistry entityDaoRegistry; + protected EdgeEntityTenantChecker edgeEntityTenantChecker; @Autowired protected EdgeSynchronizationManager edgeSynchronizationManager; @@ -187,9 +190,19 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { JsonNode body, EdgeId sourceEdgeId) { List> futures = new ArrayList<>(); if (TenantId.SYS_TENANT_ID.equals(tenantId)) { - PageDataIterable edges = new PageDataIterable<>(link -> edgeCtx.getEdgeService().findActiveEdges(link), 1024); - for (Edge edge : edges) { - futures.add(saveEdgeEvent(edge.getTenantId(), edge.getId(), type, actionType, entityId, body, null, false)); + if (type.isSystemLevelSupported()) { + PageDataIterable edges = new PageDataIterable<>(this::getActiveEdges, 1024); + for (Edge edge : edges) { + futures.add(saveEdgeEvent(edge.getTenantId(), edge.getId(), type, actionType, entityId, body, null, false)); + } + } else { + // tenant entity updated in system context + TenantId entityTenantId = entityId != null ? findEntityTenantId(tenantId, entityId) : null; + if (entityTenantId != null && !entityTenantId.isSysTenantId()) { + futures = processActionForAllEdgesByTenantId(entityTenantId, type, actionType, entityId, body, sourceEdgeId, null); + } else { + log.debug("[{}] Skipping {} event for entity {} that does not belong to a tenant", tenantId, type, entityId); + } } } else { futures = processActionForAllEdgesByTenantId(tenantId, type, actionType, entityId, body, sourceEdgeId, null); @@ -197,6 +210,10 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { return Futures.transform(Futures.allAsList(futures), voids -> null, dbCallbackExecutorService); } + private PageData getActiveEdges(PageLink link) { + return edgeCtx.getEdgeService().findActiveEdges(link); + } + protected List> processActionForAllEdgesByTenantId(TenantId tenantId, EdgeEventType type, EdgeEventActionType actionType, @@ -238,9 +255,15 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { EdgeEventActionType actionType = EdgeEventActionType.valueOf(edgeNotificationMsg.getAction()); EntityId entityId = EntityIdFactory.getByEdgeEventTypeAndUuid(type, new UUID(edgeNotificationMsg.getEntityIdMSB(), edgeNotificationMsg.getEntityIdLSB())); EdgeId originatorEdgeId = safeGetEdgeId(edgeNotificationMsg.getOriginatorEdgeIdMSB(), edgeNotificationMsg.getOriginatorEdgeIdLSB()); - if (type.isAllEdgesRelated()) { + if (type.isAllTenantEdgesRelated()) { return processEntityNotificationForAllEdges(tenantId, type, actionType, entityId, originatorEdgeId); - } else { + } else { // Edge-assigned: device, asset, dashboard, entity view, rule chain, alarm.. + if (tenantId.isSysTenantId()) { + // tenant entity updated in system context + TenantId entityTenantId = findEntityTenantId(tenantId, entityId); + return entityTenantId != null && !entityTenantId.isSysTenantId() ? + processEntityNotification(entityTenantId, edgeNotificationMsg) : Futures.immediateFuture(null); + } JsonNode body = JacksonUtil.toJsonNode(edgeNotificationMsg.getBody()); EdgeId edgeId = safeGetEdgeId(edgeNotificationMsg.getEdgeIdMSB(), edgeNotificationMsg.getEdgeIdLSB()); EntityGroupId entityGroupId = constructEntityGroupId(tenantId, edgeNotificationMsg); @@ -396,8 +419,17 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { return customerId; } - protected boolean isEntityExists(TenantId tenantId, EntityId entityId) { - return entityDaoRegistry.getDao(entityId.getEntityType()).existsById(tenantId, entityId.getId()); + protected boolean isTenantEntity(TenantId tenantId, EntityId entityId) { + return edgeEntityTenantChecker.isTenantEntity(tenantId, entityId); + } + + // returns the existing entity of the tenant or null, throws if the id belongs to another tenant's entity + protected T findTenantEntity(TenantId tenantId, EntityId entityId) { + return edgeEntityTenantChecker.findTenantEntity(tenantId, entityId); + } + + private TenantId findEntityTenantId(TenantId tenantId, EntityId entityId) { + return edgeEntityTenantChecker.findEntityTenantId(tenantId, entityId); } protected void createRelationFromEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId) { @@ -467,6 +499,9 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { protected void changeOwnerIfRequired(TenantId tenantId, CustomerId customerId, EntityId entityId) throws ThingsboardException { EntityId newOwnerId = getOwnerId(tenantId, customerId); + if (!isTenantEntity(tenantId, newOwnerId)) { + throw new DataValidationException("Owner " + newOwnerId + " belongs to a different tenant!"); + } EntityId currentOwnerId; switch (entityId.getEntityType()) { case DEVICE -> { @@ -526,14 +561,23 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { } protected void safeAddEntityToGroup(TenantId tenantId, EntityGroupId entityGroupId, EntityId entityId) { - if (entityGroupId != null && !ModelConstants.NULL_UUID.equals(entityGroupId.getId())) { - EntityGroup entityGroup = edgeCtx.getEntityGroupService().findEntityGroupById(tenantId, entityGroupId); - if (entityGroup != null) { - edgeCtx.getEntityGroupService().addEntityToEntityGroup(tenantId, entityGroupId, entityId); - } + if (entityGroupId != null && !ModelConstants.NULL_UUID.equals(entityGroupId.getId()) && findTenantEntityGroup(tenantId, entityGroupId) != null) { + edgeCtx.getEntityGroupService().addEntityToEntityGroup(tenantId, entityGroupId, entityId); } } + protected void safeRemoveEntityFromGroup(TenantId tenantId, EntityGroupId entityGroupId, EntityId entityId) { + if (findTenantEntityGroup(tenantId, entityGroupId) != null) { + edgeCtx.getEntityGroupService().removeEntityFromEntityGroup(tenantId, entityGroupId, entityId); + } + } + + // returns the entity group if it is owned by the tenant or its customer, otherwise null + private EntityGroup findTenantEntityGroup(TenantId tenantId, EntityGroupId entityGroupId) { + EntityGroup entityGroup = edgeCtx.getEntityGroupService().findEntityGroupById(tenantId, entityGroupId); + return entityGroup != null && isTenantEntity(tenantId, entityGroup.getOwnerId()) ? entityGroup : null; + } + protected boolean isSaveRequired(HasVersion current, HasVersion updated) { if (current != null) { current.setVersion(null); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ai/BaseAiModelProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ai/BaseAiModelProcessor.java index bfeea73752..3ae2959f2b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ai/BaseAiModelProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ai/BaseAiModelProcessor.java @@ -1,8 +1,10 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.service.edge.rpc.processor.ai; import com.datastax.oss.driver.api.core.uuid.Uuids; +import com.fasterxml.jackson.databind.JsonNode; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.util.Pair; @@ -29,18 +31,24 @@ public abstract class BaseAiModelProcessor extends BaseEdgeProcessor { boolean isCreated = false; boolean isNameUpdated = false; try { - AiModel aiModel = JacksonUtil.fromString(aiModelUpdateMsg.getEntity(), AiModel.class, true); + JsonNode aiModelJson = JacksonUtil.toJsonNode(aiModelUpdateMsg.getEntity()); + AiModel aiModel = JacksonUtil.treeToValueIgnoringUnknown(aiModelJson, AiModel.class); if (aiModel == null) { - throw new RuntimeException("[{" + tenantId + "}] aiModelUpdateMsg {" + aiModelUpdateMsg + " } cannot be converted to aiModel"); + throw new RuntimeException("[{" + tenantId + "}] aiModelUpdateMsg for aiModel {" + aiModelId + "} cannot be converted to aiModel"); } - Optional aiModelById = edgeCtx.getAiModelService().findAiModelById(tenantId, aiModelId); - if (aiModelById.isEmpty()) { + AiModel aiModelById = findTenantEntity(tenantId, aiModelId); + aiModel.setTenantId(tenantId); + if (aiModelById == null) { aiModel.setCreatedTime(Uuids.unixTimestamp(aiModelId.getId())); isCreated = true; aiModel.setId(null); } else { aiModel.setId(aiModelId); + // edge versions without customer access support do not send this field + if (!aiModelJson.has("customerAccessEnabled")) { + aiModel.setCustomerAccessEnabled(aiModelById.isCustomerAccessEnabled()); + } } String aiModelName = aiModel.getName(); @@ -61,7 +69,7 @@ public abstract class BaseAiModelProcessor extends BaseEdgeProcessor { edgeCtx.getAiModelService().save(aiModel, false); } catch (Exception e) { - log.error("[{}] Failed to process aiModel update msg [{}]", tenantId, aiModelUpdateMsg, e); + log.error("[{}] Failed to process aiModel update msg for aiModel [{}]", tenantId, aiModelId, e); throw e; } return Pair.of(isCreated, isNameUpdated); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java index d2e523f5e5..5bfff3a3a1 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/BaseAlarmProcessor.java @@ -44,11 +44,13 @@ public abstract class BaseAlarmProcessor extends BaseEdgeProcessor { if (alarm == null) { throw new RuntimeException("[{" + tenantId + "}] alarmUpdateMsg {" + alarmUpdateMsg + "} cannot be converted to alarm"); } - if (alarm.getOriginator() == null) { + if (alarm.getOriginator() == null || !isTenantEntity(tenantId, alarm.getOriginator())) { log.warn("[{}] Originator not found for the alarm msg {}", tenantId, alarmUpdateMsg); return Futures.immediateFuture(null); } + alarm.setTenantId(tenantId); try { + findTenantEntity(tenantId, alarmId); switch (alarmUpdateMsg.getMsgType()) { case ENTITY_CREATED_RPC_MESSAGE: edgeCtx.getAlarmService().createAlarm(AlarmCreateOrUpdateActiveRequest.fromAlarm(alarm, null, alarmId)); @@ -84,9 +86,15 @@ public abstract class BaseAlarmProcessor extends BaseEdgeProcessor { } try { Alarm alarm = edgeCtx.getAlarmService().findAlarmById(tenantId, new AlarmId(alarmComment.getAlarmId().getId())); - if (alarm == null) { + if (alarm == null || !tenantId.equals(alarm.getTenantId())) { return Futures.immediateFuture(null); } + if (alarmComment.getId() != null) { + AlarmComment alarmCommentById = edgeCtx.getAlarmCommentService().findAlarmCommentById(tenantId, alarmComment.getId()); + if (alarmCommentById != null && !alarm.getId().equals(alarmCommentById.getAlarmId())) { + return Futures.immediateFuture(null); + } + } switch (alarmCommentUpdateMsg.getMsgType()) { case ENTITY_CREATED_RPC_MESSAGE: alarmCommentDao.save(tenantId, alarmComment); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/apikey/BaseApiKeyProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/apikey/BaseApiKeyProcessor.java index cf705883ae..4ed9c7d637 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/apikey/BaseApiKeyProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/apikey/BaseApiKeyProcessor.java @@ -10,6 +10,7 @@ import org.thingsboard.server.common.data.id.ApiKeyId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.data.pat.ApiKey; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.ApiKeyUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @@ -21,10 +22,15 @@ public abstract class BaseApiKeyProcessor extends BaseEdgeProcessor { try { ApiKey apiKey = JacksonUtil.fromString(apiKeyUpdateMsg.getEntity(), ApiKey.class, true); if (apiKey == null) { - throw new RuntimeException("[{" + tenantId + "}] apiKeyUpdateMsg {" + apiKeyUpdateMsg + " } cannot be converted to apiKey"); + throw new RuntimeException("[{" + tenantId + "}] apiKeyUpdateMsg for apiKey {" + apiKeyId + "} cannot be converted to apiKey"); + } + + ApiKey existingApiKey = findTenantEntity(tenantId, apiKeyId); + apiKey.setTenantId(tenantId); + if (apiKey.getUserId() == null || !isTenantEntity(tenantId, apiKey.getUserId())) { + throw new DataValidationException("API key is referencing to non-existent user!"); } - ApiKey existingApiKey = edgeCtx.getApiKeyService().findApiKeyById(tenantId, apiKeyId); if (existingApiKey == null) { apiKey.setCreatedTime(Uuids.unixTimestamp(apiKeyId.getId())); isCreated = true; @@ -33,7 +39,7 @@ public abstract class BaseApiKeyProcessor extends BaseEdgeProcessor { apiKey.setId(apiKeyId); edgeCtx.getApiKeyService().saveApiKey(tenantId, apiKey, apiKey.getValue(), false); } catch (Exception e) { - log.error("[{}] Failed to process apiKey update msg [{}]", tenantId, apiKeyUpdateMsg, e); + log.error("[{}] Failed to process apiKey update msg for apiKey [{}]", tenantId, apiKeyId, e); throw e; } return isCreated; @@ -41,7 +47,7 @@ public abstract class BaseApiKeyProcessor extends BaseEdgeProcessor { protected void deleteApiKey(TenantId tenantId, Edge edge, ApiKeyId apiKeyId) { ApiKey apiKey = edgeCtx.getApiKeyService().findApiKeyById(tenantId, apiKeyId); - if (apiKey != null) { + if (apiKey != null && tenantId.equals(apiKey.getTenantId())) { edgeCtx.getApiKeyService().deleteApiKey(tenantId, apiKey, false); pushEntityEventToRuleEngine(tenantId, edge, apiKey, TbMsgType.ENTITY_DELETED); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java index c39a57e635..c72acdec48 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/AssetEdgeProcessor.java @@ -55,7 +55,7 @@ public class AssetEdgeProcessor extends BaseAssetProcessor implements AssetProce if (assetUpdateMsg.hasEntityGroupIdMSB() && assetUpdateMsg.hasEntityGroupIdLSB()) { EntityGroupId entityGroupId = new EntityGroupId( new UUID(assetUpdateMsg.getEntityGroupIdMSB(), assetUpdateMsg.getEntityGroupIdLSB())); - edgeCtx.getEntityGroupService().removeEntityFromEntityGroup(tenantId, entityGroupId, assetId); + safeRemoveEntityFromGroup(tenantId, entityGroupId, assetId); } else if (EdgeVersionComparator.INSTANCE.compare(edgeVersion, EdgeVersion.V_4_3_0) >= 0) { deleteAsset(tenantId, edge, assetId); } else { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java index 4f24d921cd..bea145b5af 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/BaseAssetProcessor.java @@ -36,7 +36,8 @@ public abstract class BaseAssetProcessor extends BaseEdgeProcessor { if (asset == null) { throw new RuntimeException("[{" + tenantId + "}] assetUpdateMsg {" + assetUpdateMsg + " } cannot be converted to asset"); } - Asset assetById = edgeCtx.getAssetService().findAssetById(tenantId, assetId); + Asset assetById = findTenantEntity(tenantId, assetId); + asset.setTenantId(tenantId); if (assetById == null) { created = true; asset.setId(null); @@ -91,7 +92,7 @@ public abstract class BaseAssetProcessor extends BaseEdgeProcessor { protected void deleteAsset(TenantId tenantId, Edge edge, AssetId assetId) { Asset assetById = edgeCtx.getAssetService().findAssetById(tenantId, assetId); - if (assetById != null) { + if (assetById != null && tenantId.equals(assetById.getTenantId())) { edgeCtx.getAssetService().deleteAsset(tenantId, assetId); pushEntityEventToRuleEngine(tenantId, edge, assetById, TbMsgType.ENTITY_DELETED); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java index fd5eee5b67..39c1aa7700 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/BaseAssetProfileProcessor.java @@ -31,7 +31,8 @@ public abstract class BaseAssetProfileProcessor extends BaseEdgeProcessor { if (assetProfile == null) { throw new RuntimeException("[{" + tenantId + "}] assetProfileUpdateMsg {" + assetProfileUpdateMsg + "} cannot be converted to asset profile"); } - AssetProfile assetProfileById = edgeCtx.getAssetProfileService().findAssetProfileById(tenantId, assetProfileId); + AssetProfile assetProfileById = findTenantEntity(tenantId, assetProfileId); + assetProfile.setTenantId(tenantId); if (assetProfileById == null) { created = true; assetProfile.setId(null); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/BaseCalculatedFieldProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/BaseCalculatedFieldProcessor.java index 626f5e4168..dd1db3a6f3 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/BaseCalculatedFieldProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/BaseCalculatedFieldProcessor.java @@ -10,8 +10,10 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.cf.CalculatedField; import org.thingsboard.server.common.data.id.CalculatedFieldId; +import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.service.DataValidator; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.CalculatedFieldUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @@ -30,7 +32,18 @@ public abstract class BaseCalculatedFieldProcessor extends BaseEdgeProcessor { throw new RuntimeException("[{" + tenantId + "}] calculatedFieldUpdateMsg {" + calculatedFieldUpdateMsg + " } cannot be converted to calculatedField"); } - CalculatedField calculatedFieldById = edgeCtx.getCalculatedFieldService().findById(tenantId, calculatedFieldId); + CalculatedField calculatedFieldById = findTenantEntity(tenantId, calculatedFieldId); + calculatedField.setTenantId(tenantId); + if (calculatedField.getEntityId() == null || !isTenantEntity(tenantId, calculatedField.getEntityId())) { + throw new DataValidationException("Calculated field is referencing to non-existent entity!"); + } + if (calculatedField.getConfiguration() != null) { + for (EntityId referencedEntityId : calculatedField.getConfiguration().getReferencedEntities()) { + if (!isTenantEntity(tenantId, referencedEntityId)) { + throw new DataValidationException("Calculated field argument is referencing to non-existent entity!"); + } + } + } if (calculatedFieldById == null) { calculatedField.setCreatedTime(Uuids.unixTimestamp(calculatedFieldId.getId())); isCreated = true; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/CalculatedFieldEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/CalculatedFieldEdgeProcessor.java index dfaca5475f..141abe1298 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/CalculatedFieldEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/cf/CalculatedFieldEdgeProcessor.java @@ -58,7 +58,7 @@ public class CalculatedFieldEdgeProcessor extends BaseCalculatedFieldProcessor i return Futures.immediateFuture(null); case ENTITY_DELETED_RPC_MESSAGE: CalculatedField calculatedField = edgeCtx.getCalculatedFieldService().findById(tenantId, calculatedFieldId); - if (calculatedField != null) { + if (calculatedField != null && tenantId.equals(calculatedField.getTenantId())) { edgeCtx.getCalculatedFieldService().deleteCalculatedField(tenantId, calculatedFieldId); } return Futures.immediateFuture(null); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java index 7728410302..3de8ccf770 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/BaseDashboardProcessor.java @@ -31,7 +31,8 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { if (dashboard == null) { throw new RuntimeException("[{" + tenantId + "}] dashboardUpdateMsg {" + dashboardUpdateMsg + "} cannot be converted to dashboard"); } - Dashboard dashboardById = edgeCtx.getDashboardService().findDashboardById(tenantId, dashboardId); + Dashboard dashboardById = findTenantEntity(tenantId, dashboardId); + dashboard.setTenantId(tenantId); if (dashboardById == null) { created = true; dashboard.setId(null); @@ -68,7 +69,7 @@ public abstract class BaseDashboardProcessor extends BaseEdgeProcessor { protected void deleteDashboard(TenantId tenantId, Edge edge, DashboardId dashboardId) { Dashboard dashboardById = edgeCtx.getDashboardService().findDashboardById(tenantId, dashboardId); - if (dashboardById != null) { + if (dashboardById != null && tenantId.equals(dashboardById.getTenantId())) { edgeCtx.getDashboardService().deleteDashboard(tenantId, dashboardId); pushEntityEventToRuleEngine(tenantId, edge, dashboardById, TbMsgType.ENTITY_DELETED); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java index 64960cde69..a8b66aebab 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/dashboard/DashboardEdgeProcessor.java @@ -51,7 +51,7 @@ public class DashboardEdgeProcessor extends BaseDashboardProcessor implements Da if (dashboardUpdateMsg.hasEntityGroupIdMSB() && dashboardUpdateMsg.hasEntityGroupIdLSB()) { EntityGroupId entityGroupId = new EntityGroupId( new UUID(dashboardUpdateMsg.getEntityGroupIdMSB(), dashboardUpdateMsg.getEntityGroupIdLSB())); - edgeCtx.getEntityGroupService().removeEntityFromEntityGroup(tenantId, entityGroupId, dashboardId); + safeRemoveEntityFromGroup(tenantId, entityGroupId, dashboardId); } else if (EdgeVersionComparator.INSTANCE.compare(edgeVersion, EdgeVersion.V_4_3_0) >= 0) { deleteDashboard(tenantId, edge, dashboardId); } else { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java index 975b50dd67..2e64895fa3 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/BaseDeviceProcessor.java @@ -42,7 +42,8 @@ public abstract class BaseDeviceProcessor extends BaseEdgeProcessor { if (device == null) { throw new RuntimeException("[{" + tenantId + "}] deviceUpdateMsg {" + deviceUpdateMsg + "} cannot be converted to device"); } - Device deviceById = edgeCtx.getDeviceService().findDeviceById(tenantId, deviceId); + Device deviceById = findTenantEntity(tenantId, deviceId); + device.setTenantId(tenantId); if (deviceById == null) { created = true; device.setId(null); @@ -94,12 +95,12 @@ public abstract class BaseDeviceProcessor extends BaseEdgeProcessor { protected void updateDeviceCredentials(TenantId tenantId, DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg) { DeviceCredentials deviceCredentials = JacksonUtil.fromString(deviceCredentialsUpdateMsg.getEntity(), DeviceCredentials.class, true); if (deviceCredentials == null) { - throw new RuntimeException("[{" + tenantId + "}] deviceCredentialsUpdateMsg {" + deviceCredentialsUpdateMsg + "} cannot be converted to device credentials"); + throw new RuntimeException("[{" + tenantId + "}] deviceCredentialsUpdateMsg cannot be converted to device credentials"); } Device device = edgeCtx.getDeviceService().findDeviceById(tenantId, deviceCredentials.getDeviceId()); if (device != null) { - log.debug("[{}] Updating device credentials for device [{}]. New device credentials Id [{}], value [{}]", - tenantId, device.getName(), deviceCredentials.getCredentialsId(), deviceCredentials.getCredentialsValue()); + log.debug("[{}] Updating device credentials for device [{}]. New device credentials type [{}]", + tenantId, device.getName(), deviceCredentials.getCredentialsType()); try { DeviceCredentials deviceCredentialsByDeviceId = edgeCtx.getDeviceCredentialsService().findDeviceCredentialsByDeviceId(tenantId, device.getId()); if (deviceCredentialsByDeviceId == null) { @@ -112,12 +113,11 @@ public abstract class BaseDeviceProcessor extends BaseEdgeProcessor { edgeCtx.getDeviceCredentialsService().updateDeviceCredentials(tenantId, deviceCredentialsByDeviceId); } catch (Exception e) { - log.error("[{}] Can't update device credentials for device [{}], deviceCredentialsUpdateMsg [{}]", - tenantId, device.getName(), deviceCredentialsUpdateMsg, e); + log.error("[{}] Can't update device credentials for device [{}]", tenantId, device.getName(), e); throw new RuntimeException(e); } } else { - log.warn("[{}] Can't find device by id [{}], deviceCredentialsUpdateMsg [{}]", tenantId, deviceCredentials.getDeviceId(), deviceCredentialsUpdateMsg); + log.warn("[{}] Can't find device by id [{}], skipping device credentials update", tenantId, deviceCredentials.getDeviceId()); } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java index 72f3fe99a0..896f502189 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/DeviceEdgeProcessor.java @@ -76,7 +76,7 @@ public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DevicePr if (deviceUpdateMsg.hasEntityGroupIdMSB() && deviceUpdateMsg.hasEntityGroupIdLSB()) { EntityGroupId entityGroupId = new EntityGroupId( new UUID(deviceUpdateMsg.getEntityGroupIdMSB(), deviceUpdateMsg.getEntityGroupIdLSB())); - edgeCtx.getEntityGroupService().removeEntityFromEntityGroup(tenantId, entityGroupId, deviceId); + safeRemoveEntityFromGroup(tenantId, entityGroupId, deviceId); } else if (EdgeVersionComparator.INSTANCE.compare(edgeVersion, EdgeVersion.V_4_3_0) >= 0) { deleteDevice(tenantId, edge, deviceId); } else { @@ -100,7 +100,7 @@ public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DevicePr @Override public ListenableFuture processDeviceCredentialsMsgFromEdge(TenantId tenantId, EdgeId edgeId, DeviceCredentialsUpdateMsg deviceCredentialsUpdateMsg) { - log.debug("[{}] Executing processDeviceCredentialsMsgFromEdge, deviceCredentialsUpdateMsg [{}]", tenantId, deviceCredentialsUpdateMsg); + log.debug("[{}][{}] Executing processDeviceCredentialsMsgFromEdge", tenantId, edgeId); try { edgeSynchronizationManager.getEdgeId().set(edgeId); @@ -157,7 +157,7 @@ public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DevicePr private ListenableFuture processDeviceRpcStatusFromEdge(TenantId tenantId, Edge edge, DeviceRpcCallMsg deviceRpcCallMsg) { RpcId rpcId = new RpcId(new UUID(deviceRpcCallMsg.getRequestUuidMSB(), deviceRpcCallMsg.getRequestUuidLSB())); Rpc existingRpc = edgeCtx.getTbRpcService().findRpcById(tenantId, rpcId); - if (existingRpc == null) { + if (existingRpc == null || !tenantId.equals(existingRpc.getTenantId())) { // RPC is unknown to the cloud (edge-originated or already deleted) - nothing to sync log.debug("[{}][{}] Ignoring RPC status [{}] from edge - RPC not found", tenantId, rpcId, deviceRpcCallMsg.getRpcStatus()); return Futures.immediateFuture(null); @@ -196,6 +196,10 @@ public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DevicePr SettableFuture futureToSet = SettableFuture.create(); UUID requestUuid = new UUID(deviceRpcCallMsg.getRequestUuidMSB(), deviceRpcCallMsg.getRequestUuidLSB()); DeviceId deviceId = new DeviceId(new UUID(deviceRpcCallMsg.getDeviceIdMSB(), deviceRpcCallMsg.getDeviceIdLSB())); + if (!isTenantEntity(tenantId, deviceId)) { + log.warn("[{}] Skipping RPC response because device doesn't exist, {}", tenantId, deviceRpcCallMsg); + return Futures.immediateFuture(null); + } FromDeviceRpcResponse response; if (!StringUtils.isEmpty(deviceRpcCallMsg.getResponseMsg().getError())) { @@ -225,6 +229,10 @@ public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DevicePr private ListenableFuture processDeviceRpcRequestFromEdge(TenantId tenantId, Edge edge, DeviceRpcCallMsg deviceRpcCallMsg) { DeviceId deviceId = new DeviceId(new UUID(deviceRpcCallMsg.getDeviceIdMSB(), deviceRpcCallMsg.getDeviceIdLSB())); + if (!isTenantEntity(tenantId, deviceId)) { + log.warn("[{}] Skipping RPC request because device doesn't exist, {}", tenantId, deviceRpcCallMsg); + return Futures.immediateFuture(null); + } try { TbMsgMetaData metaData = new TbMsgMetaData(); String requestId = Integer.toString(deviceRpcCallMsg.getRequestId()); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java index b84a4f1f17..dd71635b80 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/BaseDeviceProfileProcessor.java @@ -31,7 +31,8 @@ public abstract class BaseDeviceProfileProcessor extends BaseEdgeProcessor { if (deviceProfile == null) { throw new RuntimeException("[{" + tenantId + "}] deviceProfileUpdateMsg {" + deviceProfileUpdateMsg + "} cannot be converted to device profile"); } - DeviceProfile deviceProfileById = edgeCtx.getDeviceProfileService().findDeviceProfileById(tenantId, deviceProfileId); + DeviceProfile deviceProfileById = findTenantEntity(tenantId, deviceProfileId); + deviceProfile.setTenantId(tenantId); if (deviceProfileById == null) { created = true; deviceProfile.setId(null); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java index 3ca87a5511..04bc19623a 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/BaseEntityViewProcessor.java @@ -15,6 +15,7 @@ import org.thingsboard.server.common.data.id.EntityGroupId; import org.thingsboard.server.common.data.id.EntityViewId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.msg.TbMsgType; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.dao.service.DataValidator; import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @@ -34,7 +35,11 @@ public abstract class BaseEntityViewProcessor extends BaseEdgeProcessor { if (entityView == null) { throw new RuntimeException("[{" + tenantId + "}] entityViewUpdateMsg {" + entityViewUpdateMsg + "} cannot be converted to entity view"); } - EntityView entityViewById = edgeCtx.getEntityViewService().findEntityViewById(tenantId, entityViewId); + EntityView entityViewById = findTenantEntity(tenantId, entityViewId); + entityView.setTenantId(tenantId); + if (entityView.getEntityId() == null || !isTenantEntity(tenantId, entityView.getEntityId())) { + throw new DataValidationException("Entity view is referencing to non-existent entity!"); + } if (entityViewById == null) { created = true; entityView.setId(null); @@ -84,7 +89,7 @@ public abstract class BaseEntityViewProcessor extends BaseEdgeProcessor { protected void deleteEntityView(TenantId tenantId, Edge edge, EntityViewId entityViewId) { EntityView entityViewById = edgeCtx.getEntityViewService().findEntityViewById(tenantId, entityViewId); - if (entityViewById != null) { + if (entityViewById != null && tenantId.equals(entityViewById.getTenantId())) { edgeCtx.getEntityViewService().deleteEntityView(tenantId, entityViewId); pushEntityEventToRuleEngine(tenantId, edge, entityViewById, TbMsgType.ENTITY_DELETED); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java index ee3aafb725..a40416ad9b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/entityview/EntityViewEdgeProcessor.java @@ -54,7 +54,7 @@ public class EntityViewEdgeProcessor extends BaseEntityViewProcessor implements if (entityViewUpdateMsg.hasEntityGroupIdMSB() && entityViewUpdateMsg.hasEntityGroupIdLSB()) { EntityGroupId entityGroupId = new EntityGroupId( new UUID(entityViewUpdateMsg.getEntityGroupIdMSB(), entityViewUpdateMsg.getEntityGroupIdLSB())); - edgeCtx.getEntityGroupService().removeEntityFromEntityGroup(tenantId, entityGroupId, entityViewId); + safeRemoveEntityFromGroup(tenantId, entityGroupId, entityViewId); } else if (EdgeVersionComparator.INSTANCE.compare(edgeVersion, EdgeVersion.V_4_3_0) >= 0) { deleteEntityView(tenantId, edge, entityViewId); } else { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java index 5f5c188908..0b88435d4e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/BaseRelationProcessor.java @@ -24,14 +24,16 @@ public abstract class BaseRelationProcessor extends BaseEdgeProcessor { switch (relationUpdateMsg.getMsgType()) { case ENTITY_CREATED_RPC_MESSAGE: case ENTITY_UPDATED_RPC_MESSAGE: - if (isEntityExists(tenantId, entityRelation.getTo()) && isEntityExists(tenantId, entityRelation.getFrom())) { + if (isTenantEntity(tenantId, entityRelation.getTo()) && isTenantEntity(tenantId, entityRelation.getFrom())) { edgeCtx.getRelationService().saveRelation(tenantId, entityRelation); } else { log.warn("[{}] Skipping relating update msg because from/to entity doesn't exists on edge, {}", tenantId, relationUpdateMsg); } break; case ENTITY_DELETED_RPC_MESSAGE: - edgeCtx.getRelationService().deleteRelation(tenantId, entityRelation); + if (isTenantEntity(tenantId, entityRelation.getTo()) && isTenantEntity(tenantId, entityRelation.getFrom())) { + edgeCtx.getRelationService().deleteRelation(tenantId, entityRelation); + } break; case UNRECOGNIZED: default: diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/report/BaseReportTemplateProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/report/BaseReportTemplateProcessor.java index 237c6ce5bc..2bff1bb889 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/report/BaseReportTemplateProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/report/BaseReportTemplateProcessor.java @@ -29,7 +29,8 @@ public abstract class BaseReportTemplateProcessor extends BaseEdgeProcessor { if (reportTemplate == null) { throw new RuntimeException("[{" + tenantId + "}] reportTemplateUpdateMsg {" + reportTemplateUpdateMsg + "} cannot be converted to report template"); } - ReportTemplate reportTemplateById = edgeCtx.getReportTemplateService().findReportTemplateById(tenantId, reportTemplateId); + ReportTemplate reportTemplateById = findTenantEntity(tenantId, reportTemplateId); + reportTemplate.setTenantId(tenantId); if (reportTemplateById == null) { created = true; reportTemplate.setId(null); @@ -48,7 +49,7 @@ public abstract class BaseReportTemplateProcessor extends BaseEdgeProcessor { protected void deleteReportTemplate(TenantId tenantId, ReportTemplateId reportTemplateId) { ReportTemplate reportTemplateToDelete = edgeCtx.getReportTemplateService().findReportTemplateById(tenantId, reportTemplateId); - if (reportTemplateToDelete != null) { + if (reportTemplateToDelete != null && tenantId.equals(reportTemplateToDelete.getTenantId())) { edgeCtx.getReportTemplateService().deleteReportTemplate(tenantId, reportTemplateId); pushReportTemplateDeletedEventToRuleEngine(tenantId, reportTemplateToDelete); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java index ec3f24fc55..f7fe050938 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/BaseResourceProcessor.java @@ -31,7 +31,8 @@ public abstract class BaseResourceProcessor extends BaseEdgeProcessor { throw new RuntimeException("[{" + tenantId + "}] resourceUpdateMsg {" + resourceUpdateMsg + " } cannot be converted to resource"); } boolean created = false; - TbResource resourceById = edgeCtx.getResourceService().findResourceById(tenantId, tbResourceId); + TbResource resourceById = findTenantEntity(tenantId, tbResourceId); + resource.setTenantId(tenantId); if (resourceById == null) { resource.setCreatedTime(Uuids.unixTimestamp(tbResourceId.getId())); created = true; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/BaseRuleChainProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/BaseRuleChainProcessor.java index 7872cdc690..e7f5cbed3c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/BaseRuleChainProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/BaseRuleChainProcessor.java @@ -13,6 +13,7 @@ import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.common.data.rule.RuleChainType; import org.thingsboard.server.common.data.rule.RuleNode; import org.thingsboard.server.dao.service.DataValidator; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @@ -27,7 +28,7 @@ public class BaseRuleChainProcessor extends BaseEdgeProcessor { protected Pair saveOrUpdateRuleChain(TenantId tenantId, RuleChainId ruleChainId, RuleChainUpdateMsg ruleChainUpdateMsg, RuleChainType ruleChainType) { boolean created = false; - RuleChain ruleChainFromDb = edgeCtx.getRuleChainService().findRuleChainById(tenantId, ruleChainId); + RuleChain ruleChainFromDb = findTenantEntity(tenantId, ruleChainId); if (ruleChainFromDb == null) { created = true; } @@ -36,6 +37,8 @@ public class BaseRuleChainProcessor extends BaseEdgeProcessor { if (ruleChain == null) { throw new RuntimeException("[{" + tenantId + "}] ruleChainUpdateMsg {" + ruleChainUpdateMsg + "} cannot be converted to rule chain"); } + ruleChain.setTenantId(tenantId); + ruleChain.setId(created ? null : ruleChainId); boolean isRoot = ruleChain.isRoot(); if (RuleChainType.CORE.equals(ruleChainType)) { ruleChain.setRoot(false); @@ -57,6 +60,9 @@ public class BaseRuleChainProcessor extends BaseEdgeProcessor { if (ruleChainMetadata == null) { throw new RuntimeException("[{" + tenantId + "}] ruleChainMetadataUpdateMsg {" + ruleChainMetadataUpdateMsg + "} cannot be converted to rule chain metadata"); } + if (ruleChainMetadata.getRuleChainId() == null || !isTenantEntity(tenantId, ruleChainMetadata.getRuleChainId())) { + throw new DataValidationException("Rule chain metadata is referencing to non-existent rule chain!"); + } if (!ruleChainMetadata.getNodes().isEmpty()) { ruleChainMetadata.setVersion(null); for (RuleNode ruleNode : ruleChainMetadata.getNodes()) { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java index 5090ac3166..368ad05aee 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainEdgeProcessor.java @@ -48,7 +48,7 @@ public class RuleChainEdgeProcessor extends BaseRuleChainProcessor { return saveOrUpdateRuleChain(tenantId, ruleChainId, ruleChainUpdateMsg, edge); case ENTITY_DELETED_RPC_MESSAGE: RuleChain ruleChainToDelete = edgeCtx.getRuleChainService().findRuleChainById(tenantId, ruleChainId); - if (ruleChainToDelete != null) { + if (ruleChainToDelete != null && tenantId.equals(ruleChainToDelete.getTenantId())) { edgeCtx.getRuleChainService().unassignRuleChainFromEdge(tenantId, ruleChainId, edge.getId(), false); } return Futures.immediateFuture(null); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/BaseSchedulerEventProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/BaseSchedulerEventProcessor.java index fb938c2aa9..5c5a6e7b78 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/BaseSchedulerEventProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/BaseSchedulerEventProcessor.java @@ -8,12 +8,16 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.SchedulerEventId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.report.ReportConfig; import org.thingsboard.server.common.data.scheduler.SchedulerEvent; import org.thingsboard.server.common.data.scheduler.SchedulerEventInfo; import org.thingsboard.server.dao.service.DataValidator; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.SchedulerEventUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; +import static org.thingsboard.server.common.data.DataConstants.GENERATE_REPORT; + @Slf4j public abstract class BaseSchedulerEventProcessor extends BaseEdgeProcessor { @@ -27,7 +31,9 @@ public abstract class BaseSchedulerEventProcessor extends BaseEdgeProcessor { if (schedulerEvent == null) { throw new RuntimeException("[{" + tenantId + "}] schedulerEventUpdateMsg {" + schedulerEventUpdateMsg + "} cannot be converted to scheduler event"); } - SchedulerEvent existingSchedulerEvent = edgeCtx.getSchedulerEventService().findSchedulerEventById(tenantId, schedulerEventId); + SchedulerEvent existingSchedulerEvent = findTenantEntity(tenantId, schedulerEventId); + schedulerEvent.setTenantId(tenantId); + checkReportConfig(tenantId, schedulerEvent); if (existingSchedulerEvent == null) { created = true; schedulerEvent.setId(null); @@ -48,6 +54,16 @@ public abstract class BaseSchedulerEventProcessor extends BaseEdgeProcessor { return created; } + private void checkReportConfig(TenantId tenantId, SchedulerEvent schedulerEvent) { + if (GENERATE_REPORT.equals(schedulerEvent.getType())) { + ReportConfig reportConfig = JacksonUtil.treeToValue(schedulerEvent.getConfiguration(), ReportConfig.class); + if (reportConfig == null || reportConfig.getReportTemplateId() == null || !isTenantEntity(tenantId, reportConfig.getReportTemplateId()) + || reportConfig.getUserId() == null || !isTenantEntity(tenantId, reportConfig.getUserId())) { + throw new DataValidationException("Scheduler event is referencing to non-existent report template or user!"); + } + } + } + private void updateEnabledBasedOnCreationRules(SchedulerEvent newSchedulerEvent) { boolean isEnabled = newSchedulerEvent.isEnabled() && isEnabledDuringCreation(); newSchedulerEvent.setEnabled(isEnabled); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/SchedulerEventEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/SchedulerEventEdgeProcessor.java index e9398cb5dd..1889ea4954 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/SchedulerEventEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/scheduler/SchedulerEventEdgeProcessor.java @@ -46,7 +46,7 @@ public class SchedulerEventEdgeProcessor extends BaseSchedulerEventProcessor imp } case ENTITY_DELETED_RPC_MESSAGE -> { SchedulerEvent schedulerEventToDelete = edgeCtx.getSchedulerEventService().findSchedulerEventById(tenantId, schedulerEventId); - if (schedulerEventToDelete != null) { + if (schedulerEventToDelete != null && tenantId.equals(schedulerEventToDelete.getTenantId())) { edgeCtx.getSchedulerEventService().unassignSchedulerEventFromEdge(tenantId, schedulerEventId, edge.getId()); } yield Futures.immediateFuture(null); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java index 4a9f916f9e..4ced88f193 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessor.java @@ -16,11 +16,15 @@ import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; +import java.util.Set; + @Slf4j @Component @TbCoreComponent public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor { + private static final Set EDGE_SYNCED_SETTINGS_KEYS = Set.of("general", "connectivity"); + @Override public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { AdminSettings adminSettings = null; @@ -34,6 +38,11 @@ public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor { if (adminSettings == null) { return null; } + if (!EDGE_SYNCED_SETTINGS_KEYS.contains(adminSettings.getKey())) { + log.trace("Skipping admin settings [{}] sync to edge [{}] - not in the edge allow-list", + adminSettings.getKey(), edgeEvent.getEdgeId()); + return null; + } AdminSettingsUpdateMsg msg = AdminSettingsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(adminSettings)).build(); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java index 3332de3aad..04d7939917 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/telemetry/BaseTelemetryProcessor.java @@ -109,7 +109,7 @@ public abstract class BaseTelemetryProcessor extends BaseEdgeProcessor { log.trace("[{}] processTelemetryMsg [{}]", tenantId, entityData); List> result = new ArrayList<>(); EntityId entityId = constructEntityId(entityData.getEntityType(), entityData.getEntityIdMSB(), entityData.getEntityIdLSB()); - if (entityId != null && isEntityExists(tenantId, entityId)) { + if (entityId != null && isTenantEntity(tenantId, entityId)) { if ((entityData.hasPostAttributesMsg() || entityData.hasPostTelemetryMsg() || entityData.hasAttributesUpdatedMsg())) { Pair pair = getBaseMsgMetadataAndCustomerId(tenantId, entityId); TbMsgMetaData metaData = pair.getKey(); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java index 6fad0e2187..9432be7b3e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantProfileEdgeProcessor.java @@ -5,6 +5,7 @@ package org.thingsboard.server.service.edge.rpc.processor.tenant; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.EdgeUtils; +import org.thingsboard.server.common.data.Tenant; import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; @@ -27,6 +28,11 @@ public class TenantProfileEdgeProcessor extends BaseEdgeProcessor { public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { TenantProfileId tenantProfileId = new TenantProfileId(edgeEvent.getEntityId()); if (EdgeEventActionType.UPDATED.equals(edgeEvent.getAction())) { + // tenant profile updates are pushed to all edges, send only the profile of the edge's tenant + Tenant tenant = edgeCtx.getTenantService().findTenantById(edgeEvent.getTenantId()); + if (tenant == null || !tenantProfileId.equals(tenant.getTenantProfileId())) { + return null; + } TenantProfile tenantProfile = edgeCtx.getTenantProfileService().findTenantProfileById(edgeEvent.getTenantId(), tenantProfileId); if (tenantProfile != null) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/BaseUserProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/BaseUserProcessor.java index 62971a7888..5a12be3498 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/BaseUserProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/BaseUserProcessor.java @@ -17,8 +17,10 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.data.security.UserCredentials; +import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.service.DataValidator; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @@ -26,6 +28,8 @@ import org.thingsboard.server.service.security.permission.UserPermissionsService import java.util.UUID; +import java.util.Objects; + @Slf4j public abstract class BaseUserProcessor extends BaseEdgeProcessor { @@ -42,10 +46,17 @@ public abstract class BaseUserProcessor extends BaseEdgeProcessor { try { User user = JacksonUtil.fromString(userUpdateMsg.getEntity(), User.class, true); if (user == null) { - throw new IllegalArgumentException(String.format("[%s] Failed to parse User from UserUpdateMsg: %s", tenantId, userUpdateMsg)); + throw new IllegalArgumentException(String.format("[%s] Failed to parse User from UserUpdateMsg for user %s", tenantId, userId)); + } + if (user.getAuthority() != Authority.TENANT_ADMIN && user.getAuthority() != Authority.CUSTOMER_USER) { + throw new DataValidationException("User authority " + user.getAuthority() + " is not allowed!"); } + user.setTenantId(tenantId); User userById = edgeCtx.getUserService().findUserById(tenantId, userId); + if (userById != null && !tenantId.equals(userById.getTenantId())) { + throw new DataValidationException("User " + userId + " belongs to a different tenant!"); + } if (userById == null) { isCreated = true; user.setId(null); @@ -71,7 +82,7 @@ public abstract class BaseUserProcessor extends BaseEdgeProcessor { } safeAddToEntityGroup(tenantId, userUpdateMsg, userId); } catch (Exception e) { - log.error("[{}] Failed to process user update msg [{}]", tenantId, userUpdateMsg, e); + log.error("[{}] Failed to process user update msg for user [{}]", tenantId, userId, e); throw new RuntimeException(e); } @@ -88,7 +99,8 @@ public abstract class BaseUserProcessor extends BaseEdgeProcessor { private boolean updateUserEmailIfDuplicateExists(TenantId tenantId, UserId userId, User user) { String email = user.getEmail(); - User userByEmail = edgeCtx.getUserService().findUserByTenantIdAndEmail(tenantId, email); + // email is unique across all tenants + User userByEmail = edgeCtx.getUserService().findUserByEmail(tenantId, email); if (userByEmail != null && !userByEmail.getId().equals(user.getId())) { String[] splitEmail = email.split("@"); @@ -118,7 +130,7 @@ public abstract class BaseUserProcessor extends BaseEdgeProcessor { private User deleteUser(TenantId tenantId, UserId userId) throws ThingsboardException { User userById = edgeCtx.getUserService().findUserById(tenantId, userId); - if (userById == null) { + if (userById == null || !tenantId.equals(userById.getTenantId())) { log.trace("[{}] User with id {} does not exist", tenantId, userId); return null; } @@ -128,27 +140,50 @@ public abstract class BaseUserProcessor extends BaseEdgeProcessor { } protected void updateUserCredentials(TenantId tenantId, UserCredentialsUpdateMsg updateMsg) { - UserCredentials userCredentials = JacksonUtil.fromString(updateMsg.getEntity(), UserCredentials.class, true); - if (userCredentials == null) { - throw new IllegalArgumentException(String.format("[%s] Failed to parse UserCredentials from updateMsg: %s", tenantId, updateMsg)); + UserCredentials edgeUserCredentials = JacksonUtil.fromString(updateMsg.getEntity(), UserCredentials.class, true); + if (edgeUserCredentials == null) { + throw new IllegalArgumentException(String.format("[%s] Failed to parse UserCredentials from UserCredentialsUpdateMsg", tenantId)); } - User user = edgeCtx.getUserService().findUserById(tenantId, userCredentials.getUserId()); - if (user == null) { - log.warn("[{}] Can't find user by id [{}] skipping credentials update. UserCredentialsUpdateMsg [{}]", - tenantId, userCredentials.getUserId(), updateMsg); + User user = edgeCtx.getUserService().findUserById(tenantId, edgeUserCredentials.getUserId()); + if (user == null || !tenantId.equals(user.getTenantId())) { + log.warn("[{}] Can't find user by id [{}] skipping credentials update", tenantId, edgeUserCredentials.getUserId()); return; } + if (edgeUserCredentials.getId() != null) { + UserCredentials userCredentialsById = edgeCtx.getUserService().findUserCredentialsById(tenantId, edgeUserCredentials.getId()); + if (userCredentialsById != null && !user.getId().equals(userCredentialsById.getUserId())) { + log.warn("[{}] User credentials [{}] belong to a different user, skipping credentials update", tenantId, edgeUserCredentials.getId()); + return; + } + } log.debug("[{}] Updating user credentials for user [{}]. New credentials Id [{}], enabled [{}]", - tenantId, user.getName(), userCredentials.getId(), userCredentials.isEnabled()); + tenantId, user.getName(), edgeUserCredentials.getId(), edgeUserCredentials.isEnabled()); try { - UserCredentials userCredentialsByUserId = edgeCtx.getUserService().findUserCredentialsByUserId(tenantId, user.getId()); - if (userCredentialsByUserId != null && !userCredentialsByUserId.getId().equals(userCredentials.getId())) { - edgeCtx.getUserService().deleteUserCredentials(tenantId, userCredentialsByUserId); + UserCredentials savedUserCredentials = edgeCtx.getUserService().findUserCredentialsByUserId(tenantId, user.getId()); + if (savedUserCredentials != null && !savedUserCredentials.getId().equals(edgeUserCredentials.getId())) { + edgeCtx.getUserService().deleteUserCredentials(tenantId, savedUserCredentials); + } + // only password and enabled flag come from edge, tokens, login attempts and password history stay as on cloud + UserCredentials updatedUserCredentials = savedUserCredentials != null ? savedUserCredentials : new UserCredentials(); + boolean passwordChanged = !Objects.equals(updatedUserCredentials.getPassword(), edgeUserCredentials.getPassword()); + updatedUserCredentials.setId(edgeUserCredentials.getId()); + updatedUserCredentials.setUserId(user.getId()); + updatedUserCredentials.setEnabled(edgeUserCredentials.isEnabled()); + updatedUserCredentials.setPassword(edgeUserCredentials.getPassword()); + if (passwordChanged && updatedUserCredentials.getPassword() != null) { + edgeCtx.getUserService().updatePasswordHistory(updatedUserCredentials); + } + if (updatedUserCredentials.isEnabled()) { + // user is activated on edge + updatedUserCredentials.setActivateToken(null); + updatedUserCredentials.setActivateTokenExpTime(null); + } else if (edgeUserCredentials.getActivateToken() != null && updatedUserCredentials.getActivateToken() == null) { + // user activation is pending on edge, cloud uses its own token + edgeCtx.getUserService().generateUserActivationToken(updatedUserCredentials); } - edgeCtx.getUserService().saveUserCredentials(tenantId, userCredentials, false); + edgeCtx.getUserService().saveUserCredentials(tenantId, updatedUserCredentials, false); } catch (Exception e) { - log.error("[{}] Can't update user credentials for user [{}], userCredentialsUpdateMsg [{}]", - tenantId, user.getName(), updateMsg, e); + log.error("[{}] Can't update user credentials for user [{}]", tenantId, user.getName(), e); throw new RuntimeException(e); } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java index 3d4e6805da..d0119b5acb 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/user/UserEdgeProcessor.java @@ -63,7 +63,7 @@ public class UserEdgeProcessor extends BaseUserProcessor implements UserProcesso if (userUpdateMsg.hasEntityGroupIdMSB() && userUpdateMsg.hasEntityGroupIdLSB()) { EntityGroupId entityGroupId = new EntityGroupId( new UUID(userUpdateMsg.getEntityGroupIdMSB(), userUpdateMsg.getEntityGroupIdLSB())); - edgeCtx.getEntityGroupService().removeEntityFromEntityGroup(tenantId, entityGroupId, userId); + safeRemoveEntityFromGroup(tenantId, entityGroupId, userId); yield Futures.immediateFuture(null); } else if (EdgeVersionComparator.INSTANCE.compare(edgeVersion, EdgeVersion.V_4_3_0) >= 0) { deleteUserAndPushEntityDeletedEventToRuleEngine(tenantId, userId, edge); @@ -74,7 +74,7 @@ public class UserEdgeProcessor extends BaseUserProcessor implements UserProcesso }; } catch (DataValidationException | ThingsboardException e) { if (e.getMessage().contains("limit reached")) { - log.warn("[{}] Number of allowed users violated {}", tenantId, userUpdateMsg, e); + log.warn("[{}] Number of allowed users violated, user [{}]", tenantId, userId, e); return Futures.immediateFuture(null); } else { return Futures.immediateFailedFuture(e); @@ -86,7 +86,7 @@ public class UserEdgeProcessor extends BaseUserProcessor implements UserProcesso @Override public ListenableFuture processUserCredentialsMsgFromEdge(TenantId tenantId, Edge edge, UserCredentialsUpdateMsg userCredentialsUpdateMsg) { - log.debug("[{}] Executing processUserCredentialsMsgFromEdge, userCredentialsUpdateMsg [{}]", tenantId, userCredentialsUpdateMsg); + log.debug("[{}][{}] Executing processUserCredentialsMsgFromEdge", tenantId, edge.getId()); try { edgeSynchronizationManager.getEdgeId().set(edge.getId()); @@ -136,7 +136,7 @@ public class UserEdgeProcessor extends BaseUserProcessor implements UserProcesso switch (edgeEvent.getAction()) { case ADDED, ADDED_TO_ENTITY_GROUP, UPDATED, ASSIGNED_TO_EDGE -> { User user = edgeCtx.getUserService().findUserById(edgeEvent.getTenantId(), userId); - if (user != null) { + if (user != null && edgeEvent.getTenantId().equals(user.getTenantId())) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/wl/WhiteLabelingEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/wl/WhiteLabelingEdgeProcessor.java index ebed77616f..26841f770e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/wl/WhiteLabelingEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/wl/WhiteLabelingEdgeProcessor.java @@ -65,6 +65,9 @@ public class WhiteLabelingEdgeProcessor extends BaseEdgeProcessor { if (whiteLabeling == null) { return null; } + if (isSystemMailTemplates(whiteLabeling.getType(), tenantId)) { + return null; + } UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); WhiteLabelingProto whiteLabelingProto = EdgeMsgConstructorUtils.constructWhiteLabeling(msgType, whiteLabeling); DownlinkMsg.Builder builder = DownlinkMsg.newBuilder() @@ -80,6 +83,9 @@ public class WhiteLabelingEdgeProcessor extends BaseEdgeProcessor { } case DELETED -> { WhiteLabeling whiteLabeling = JacksonUtil.convertValue(edgeEvent.getBody(), WhiteLabeling.class); + if (whiteLabeling != null && isSystemMailTemplates(whiteLabeling.getType(), whiteLabeling.getTenantId())) { + return null; + } WhiteLabelingProto whiteLabelingProto = EdgeMsgConstructorUtils.constructWhiteLabeling(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE, whiteLabeling); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) @@ -92,6 +98,12 @@ public class WhiteLabelingEdgeProcessor extends BaseEdgeProcessor { return null; } + private boolean isSystemMailTemplates(WhiteLabelingType type, TenantId tenantId) { + // System mail templates are not synced to the Edge. The Edge is a thin mail client: it + // delegates every send to the Cloud, which renders with its own templates. + return WhiteLabelingType.MAIL_TEMPLATES.equals(type) && TenantId.SYS_TENANT_ID.equals(tenantId); + } + private WhiteLabelingType getWhiteLabelingType(EdgeEventType type) { return switch (type) { case WHITE_LABELING -> WhiteLabelingType.GENERAL; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcService.java index ff4d3c95fb..b2b7ea6cf0 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcService.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.service.edge.rpc.service; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -39,9 +40,11 @@ import org.thingsboard.server.common.msg.edge.EdgeHighPriorityMsg; import org.thingsboard.server.common.msg.edge.EdgeSessionMsg; import org.thingsboard.server.common.msg.edge.FromEdgeSyncResponse; import org.thingsboard.server.common.msg.edge.ToEdgeSyncRequest; +import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.gen.edge.v1.EdgeRpcServiceGrpc; import org.thingsboard.server.gen.edge.v1.RequestMsg; import org.thingsboard.server.gen.edge.v1.ResponseMsg; +import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeContextComponent; @@ -94,6 +97,7 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i private final TbServiceInfoProvider serviceInfoProvider; private final TelemetrySubscriptionService tsSubService; private final TbTransactionalCache edgeIdServiceIdCache; + private final PartitionService partitionService; private final ConcurrentMap pendingDisconnectNotifications = new ConcurrentHashMap<>(); private final ConcurrentMap> localSyncEdgeRequests = new ConcurrentHashMap<>(); @@ -198,20 +202,21 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i Edge edge = state.getEdge(); TenantId tenantId = state.getTenantId(); log.info("[{}][{}] edge [{}] connected successfully.", tenantId, state.getSessionId(), edgeId); - if (sessions.hasByEdgeId(edgeId)) { - EdgeGrpcSessionManager existingSession = sessions.getByEdgeId(edgeId); - if (existingSession != null) { - UUID sessionId = existingSession.getState().getSessionId(); - log.info("[{}][{}] Replacing existing session [{}] for edge [{}]", tenantId, state.getSessionId(), sessionId, edgeId); - existingSession.destroyAndMarkAsZombieIfFailed(); - sessions.removeBySessionId(sessionId); - } + // Swap first, destroy after: while the slow teardown runs, the replaced session is no longer current, so its own + // late disconnect takes the stale-session path instead of clearing the state of this connect. + EdgeGrpcSessionManager replaced = sessions.put(edgeSession); + if (replaced != null) { + UUID replacedSessionId = replaced.getState().getSessionId(); + log.info("[{}][{}] Replacing existing session [{}] for edge [{}]", tenantId, state.getSessionId(), replacedSessionId, edgeId); + sessions.removeBySessionId(replacedSessionId); + replaced.destroyAndMarkAsZombieIfFailed(); } - sessions.put(edgeSession); + // Claim ownership before active=true: the previous node reads this entry on disconnect to decide + // whether to clear the flag. + edgeIdServiceIdCache.put(edgeId, serviceInfoProvider.getServiceId()); save(tenantId, edgeId, ACTIVITY_STATE, true); long lastConnectTs = System.currentTimeMillis(); save(tenantId, edgeId, LAST_CONNECT_TIME, lastConnectTs); - edgeIdServiceIdCache.put(edgeId, serviceInfoProvider.getServiceId()); // If the edge reconnected within the disconnect-notification delay window, suppress the pending // "disconnected" notification - the drop was transient (debounce for flapping edges). cancelPendingDisconnectNotification(edgeId); @@ -228,11 +233,14 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i EdgeGrpcSessionManager toRemove = sessions.removeByEdgeIdIfCurrent(edgeId, sessionId); if (toRemove != null) { sessions.removeBySessionId(sessionId); - save(tenantId, edgeId, ACTIVITY_STATE, false); - long lastDisconnectTs = System.currentTimeMillis(); - save(tenantId, edgeId, LAST_DISCONNECT_TIME, lastDisconnectTs); - pushRuleEngineMessage(tenantId, edge, lastDisconnectTs, TbMsgType.DISCONNECT_EVENT); - scheduleDisconnectNotification(edge); + // Skip all disconnect side effects if a newer session already owns the edge, on this or another node. + // The local check and the inactive write are atomic with a same-node reconnect. + if (!isOwnedByAnotherNode(edgeId) && sessions.runIfNoSession(edgeId, () -> save(tenantId, edgeId, ACTIVITY_STATE, false))) { + long lastDisconnectTs = System.currentTimeMillis(); + save(tenantId, edgeId, LAST_DISCONNECT_TIME, lastDisconnectTs); + pushRuleEngineMessage(tenantId, edge, lastDisconnectTs, TbMsgType.DISCONNECT_EVENT); + scheduleDisconnectNotification(edge); + } toRemove.onEdgeDisconnect(); // keep the slow teardown last, after the state transition is fully recorded toRemove.destroyAndMarkAsZombieIfFailed(); @@ -427,6 +435,21 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i return wrapper != null && serviceInfoProvider.getServiceId().equals(wrapper.get()); } + // The edge's cache entry names another node that is still a live TB-Core service. No entry, or an entry naming + // a node that has left the cluster, does not count: the cache has no TTL by default and only the owner evicts it, + // so honouring a dead owner would keep the edge marked active forever. + private boolean isOwnedByAnotherNode(EdgeId edgeId) { + TbCacheValueWrapper wrapper = edgeIdServiceIdCache.get(edgeId); + if (wrapper == null) { + return false; + } + String ownerServiceId = wrapper.get(); + if (ownerServiceId == null || serviceInfoProvider.getServiceId().equals(ownerServiceId)) { + return false; + } + return partitionService.getAllServiceIds(ServiceType.TB_CORE).contains(ownerServiceId); + } + // The edge has a live owner somewhere in the cluster (the cache is cluster-wide), regardless of which node. private boolean isConnectedClusterWide(EdgeId edgeId) { return edgeIdServiceIdCache.get(edgeId) != null; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeGrpcSession.java index 301a2a41c5..1dab09bf75 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeGrpcSession.java @@ -48,6 +48,7 @@ import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; import org.thingsboard.server.service.edge.EdgeContextComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.service.edge.EdgeMsgSummaryUtils; import org.thingsboard.server.service.edge.rpc.DownlinkMessageMapper; import org.thingsboard.server.service.edge.rpc.EdgeSessionState; import org.thingsboard.server.service.edge.rpc.EdgeSyncCursor; @@ -497,7 +498,7 @@ public class EdgeGrpcSession implements EdgeSession { ctx.getStatsCounterService().ifPresent(statsCounterService -> statsCounterService.recordEvent(EdgeStatsKey.DOWNLINK_MSGS_TMP_FAILED, edge.getTenantId(), getEdgeId(), 1)); log.warn("[{}][{}] {} on attempt {}", getTenantId(), getEdgeId(), failureMsg, attempt); - log.debug("[{}][{}] entities in failed batch: {}", getTenantId(), getEdgeId(), copy); + log.debug("[{}][{}] entities in failed batch: {}", getTenantId(), getEdgeId(), EdgeMsgSummaryUtils.toSummary(copy)); } log.trace("[{}][{}][{}] downlink msg(s) are going to be send.", getTenantId(), getEdgeId(), copy.size()); for (DownlinkMsg downlinkMsg : copy) { @@ -506,7 +507,7 @@ public class EdgeGrpcSession implements EdgeSession { "env variable on the edge and restart it.", clientMaxInboundMessageSize); String message = String.format("Downlink msg size %s exceeds client max inbound message size %s. " + "Please increase value of CLOUD_RPC_MAX_INBOUND_MESSAGE_SIZE env variable on the edge and restart it.", downlinkMsg.getSerializedSize(), clientMaxInboundMessageSize); - log.error("[{}][{}][{}] {} Message {}", getTenantId(), getEdgeId(), getSessionId(), message, downlinkMsg); + log.error("[{}][{}][{}] {} Message {}", getTenantId(), getEdgeId(), getSessionId(), message, EdgeMsgSummaryUtils.toSummary(downlinkMsg)); ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(getTenantId()) .edgeId(getEdgeId()).customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(message).error(error).build()); ctx.getStatsCounterService().ifPresent(statsCounterService -> @@ -521,9 +522,10 @@ public class EdgeGrpcSession implements EdgeSession { if (attempt < MAX_DOWNLINK_ATTEMPTS) { scheduleDownlinkMsgsPackSend(attempt + 1); } else { - String failureMsg = String.format("Failed to deliver messages: %s", copy); + String failedMsgsSummary = EdgeMsgSummaryUtils.toSummary(copy); + String failureMsg = String.format("Failed to deliver messages: %s", failedMsgsSummary); log.warn("[{}][{}] Failed to deliver the batch after {} attempts. Next messages are going to be discarded {}", - getTenantId(), getEdgeId(), MAX_DOWNLINK_ATTEMPTS, copy); + getTenantId(), getEdgeId(), MAX_DOWNLINK_ATTEMPTS, failedMsgsSummary); ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(getTenantId()).edgeId(getEdgeId()) .customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg) .error("Failed to deliver messages after " + MAX_DOWNLINK_ATTEMPTS + " attempts").build()); @@ -574,7 +576,7 @@ public class EdgeGrpcSession implements EdgeSession { } private ConnectResponseMsg processConnect(ConnectRequestMsg request) { - log.trace("[{}] processConnect [{}]", getSessionId(), request); + log.trace("[{}] processConnect, routing key [{}], edge version [{}]", getSessionId(), request.getEdgeRoutingKey(), request.getEdgeVersion()); Optional optional = ctx.getEdgeService().findEdgeByRoutingKey(TenantId.SYS_TENANT_ID, request.getEdgeRoutingKey()); if (optional.isPresent()) { Edge edge = optional.get(); @@ -601,7 +603,7 @@ public class EdgeGrpcSession implements EdgeSession { .build(); } String error = "Failed to validate the edge!"; - String failureMsg = String.format("%s Provided request secret: %s", error, request.getEdgeSecret()); + String failureMsg = String.format("%s Provided request secret doesn't match the edge secret.", error); ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId).edgeId(edge.getId()) .customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(error).build()); return ConnectResponseMsg.newBuilder() diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolder.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolder.java index 8b7e34f1a6..0f1f224e3c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolder.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolder.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.service.edge.rpc.session; import lombok.Data; @@ -16,6 +17,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; @@ -36,11 +38,14 @@ public class EdgeSessionsHolder { unique.forEach(consumer); } - public void put(EdgeGrpcSessionManager session) { + /** + * Registers the session as the current one for its edge and returns the session it replaced, or null. + */ + public EdgeGrpcSessionManager put(EdgeGrpcSessionManager session) { UUID sessionId = session.getState().getSessionId(); EdgeId edgeId = session.getState().getEdgeId(); sessionsById.put(sessionId, session); - sessions.put(edgeId, session); + return sessions.put(edgeId, session); } public EdgeGrpcSessionManager getByEdgeId(EdgeId id) { @@ -88,6 +93,22 @@ public class EdgeSessionsHolder { return removed.get(); } + /** + * Runs the action only if no session is registered for the edge, as one atomic step with {@link #put}. + * Returns whether it ran. The action holds the bin lock of {@link #sessions}, so it must be cheap and non-blocking. + */ + public boolean runIfNoSession(EdgeId id, Runnable action) { + AtomicBoolean ran = new AtomicBoolean(); + sessions.compute(id, (edgeId, current) -> { + if (current == null) { + action.run(); + ran.set(true); + } + return current; + }); + return ran.get(); + } + public EdgeGrpcSessionManager removeBySessionId(UUID sessionId) { return sessionsById.remove(sessionId); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/DefaultEdgeRequestsService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/DefaultEdgeRequestsService.java index edf292b6c0..c5fab0f2f7 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/DefaultEdgeRequestsService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/DefaultEdgeRequestsService.java @@ -10,12 +10,23 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; +import com.google.firebase.messaging.FirebaseMessagingException; +import com.google.firebase.messaging.MessagingErrorCode; +import jakarta.annotation.PreDestroy; import lombok.extern.slf4j.Slf4j; import org.checkerframework.checker.nullness.qual.Nullable; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.common.util.ListeningExecutor; +import org.thingsboard.common.util.ThingsBoardExecutors; +import org.thingsboard.rule.engine.api.MailService; +import org.thingsboard.rule.engine.api.SmsService; +import org.thingsboard.rule.engine.api.notification.FirebaseService; +import org.thingsboard.rule.engine.api.notification.SlackService; import org.thingsboard.server.common.data.AttributeScope; +import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.DashboardInfo; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; @@ -28,7 +39,9 @@ import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; +import org.thingsboard.server.common.data.group.EntityGroup; import org.thingsboard.server.common.data.id.AssetId; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DashboardId; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EdgeId; @@ -44,6 +57,11 @@ import org.thingsboard.server.common.data.id.WidgetsBundleId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; import org.thingsboard.server.common.data.kv.DataType; import org.thingsboard.server.common.data.kv.TsKvEntry; +import org.thingsboard.server.common.data.notification.NotificationDeliveryMethod; +import org.thingsboard.server.common.data.notification.settings.MobileAppNotificationDeliveryMethodConfig; +import org.thingsboard.server.common.data.notification.settings.NotificationSettings; +import org.thingsboard.server.common.data.notification.settings.SlackNotificationDeliveryMethodConfig; +import org.thingsboard.server.common.data.notification.targets.slack.SlackFile; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.permission.GroupPermission; @@ -58,15 +76,18 @@ import org.thingsboard.server.common.data.widget.WidgetType; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.dao.asset.AssetService; import org.thingsboard.server.dao.attributes.AttributesService; +import org.thingsboard.server.dao.cf.CalculatedFieldService; import org.thingsboard.server.dao.dashboard.DashboardService; import org.thingsboard.server.dao.device.DeviceService; -import org.thingsboard.server.dao.cf.CalculatedFieldService; import org.thingsboard.server.dao.edge.EdgeEventService; +import org.thingsboard.server.dao.entity.EntityService; import org.thingsboard.server.dao.exception.IncorrectParameterException; import org.thingsboard.server.dao.group.EntityGroupService; import org.thingsboard.server.dao.grouppermission.GroupPermissionService; +import org.thingsboard.server.dao.notification.NotificationSettingsService; import org.thingsboard.server.dao.relation.RelationService; import org.thingsboard.server.dao.role.RoleService; +import org.thingsboard.server.dao.secret.SecretConfigurationService; import org.thingsboard.server.dao.timeseries.TimeseriesService; import org.thingsboard.server.dao.user.UserService; import org.thingsboard.server.dao.widget.WidgetTypeService; @@ -78,18 +99,32 @@ import org.thingsboard.server.gen.edge.v1.EntityGroupRequestMsg; import org.thingsboard.server.gen.edge.v1.EntityViewsRequestMsg; import org.thingsboard.server.gen.edge.v1.RelationRequestMsg; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataRequestMsg; +import org.thingsboard.server.gen.edge.v1.SendEmailUplinkMsg; +import org.thingsboard.server.gen.edge.v1.SendNotificationUplinkMsg; +import org.thingsboard.server.gen.edge.v1.SendSmsUplinkMsg; import org.thingsboard.server.gen.edge.v1.UserCredentialsRequestMsg; import org.thingsboard.server.gen.edge.v1.WidgetBundleTypesRequestMsg; import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.edge.EdgeEntityTenantChecker; import org.thingsboard.server.service.entitiy.entityview.TbEntityViewService; import org.thingsboard.server.service.executors.DbCallbackExecutorService; +import org.thingsboard.server.service.executors.NotificationExecutorService; +import org.thingsboard.server.service.mail.EdgeMailRequest; +import org.thingsboard.server.service.mail.MailExecutorService; +import org.thingsboard.server.service.notification.EdgeNotificationRequest; +import org.thingsboard.server.service.security.permission.OwnersCacheService; +import org.thingsboard.server.service.sms.EdgeSmsRequest; +import org.thingsboard.server.service.sms.SmsExecutorService; import org.thingsboard.server.service.state.DefaultDeviceStateService; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Service @@ -121,6 +156,15 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { @Autowired private DashboardService dashboardService; + @Autowired + private EntityService entityService; + + @Autowired + private EdgeEntityTenantChecker edgeEntityTenantChecker; + + @Autowired + private OwnersCacheService ownersCacheService; + @Autowired private TbEntityViewService entityViewService; @@ -145,6 +189,44 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { @Autowired private DbCallbackExecutorService dbCallbackExecutorService; + @Autowired + private MailService mailService; + + @Autowired + private SmsService smsService; + + @Autowired + private SlackService slackService; + + @Autowired + private FirebaseService firebaseService; + + @Autowired + private NotificationSettingsService notificationSettingsService; + + @Autowired + private SecretConfigurationService secretConfigurationService; + + @Autowired + private MailExecutorService mailExecutor; + + @Autowired + private SmsExecutorService smsExecutor; + + @Autowired + private NotificationExecutorService notificationExecutor; + + @Value("${edges.rpc.delegated_send_timeout_sec:20}") + private int delegatedSendTimeoutSec; + + private final ScheduledExecutorService sendTimeoutScheduler = + ThingsBoardExecutors.newSingleThreadScheduledExecutor("edge-delegated-send-watchdog"); + + @PreDestroy + public void destroy() { + sendTimeoutScheduler.shutdownNow(); + } + @Override public ListenableFuture processRuleChainMetadataRequestMsg(TenantId tenantId, Edge edge, RuleChainMetadataRequestMsg ruleChainMetadataRequestMsg) { log.trace("[{}] processRuleChainMetadataRequestMsg [{}][{}]", tenantId, edge.getName(), ruleChainMetadataRequestMsg); @@ -152,6 +234,9 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { return Futures.immediateFuture(null); } RuleChainId ruleChainId = new RuleChainId(new UUID(ruleChainMetadataRequestMsg.getRuleChainIdMSB(), ruleChainMetadataRequestMsg.getRuleChainIdLSB())); + if (!isTenantEntity(tenantId, ruleChainId)) { + return Futures.immediateFuture(null); + } return saveEdgeEvent(tenantId, edge.getId(), EdgeEventType.RULE_CHAIN_METADATA, EdgeEventActionType.ADDED, ruleChainId, null); } @@ -166,6 +251,9 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { log.warn("[{}] Type doesn't supported {}", tenantId, entityId.getEntityType()); return Futures.immediateFuture(null); } + if (!isTenantEntity(tenantId, entityId)) { + return Futures.immediateFuture(null); + } String scope = attributesRequestMsg.getScope(); ListenableFuture> findAttrFuture = attributesService.findAll(tenantId, entityId, AttributeScope.valueOf(scope)); return Futures.transformAsync(findAttrFuture, ssAttributes @@ -262,6 +350,9 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { EntityId entityId = EntityIdFactory.getByTypeAndUuid( EntityType.valueOf(relationRequestMsg.getEntityType()), new UUID(relationRequestMsg.getEntityIdMSB(), relationRequestMsg.getEntityIdLSB())); + if (!isTenantEntity(tenantId, entityId)) { + return Futures.immediateFuture(null); + } List>> futures = new ArrayList<>(); futures.add(findRelationByQuery(tenantId, edge, entityId, EntitySearchDirection.FROM)); @@ -385,6 +476,9 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { return Futures.immediateFuture(null); } DeviceId deviceId = new DeviceId(new UUID(deviceCredentialsRequestMsg.getDeviceIdMSB(), deviceCredentialsRequestMsg.getDeviceIdLSB())); + if (!isTenantEntity(tenantId, deviceId)) { + return Futures.immediateFuture(null); + } return saveEdgeEvent(tenantId, edge.getId(), EdgeEventType.DEVICE, EdgeEventActionType.CREDENTIALS_UPDATED, deviceId, null); } @@ -396,6 +490,9 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { return Futures.immediateFuture(null); } UserId userId = new UserId(new UUID(userCredentialsRequestMsg.getUserIdMSB(), userCredentialsRequestMsg.getUserIdLSB())); + if (!isTenantEntity(tenantId, userId)) { + return Futures.immediateFuture(null); + } return saveEdgeEvent(tenantId, edge.getId(), EdgeEventType.USER, EdgeEventActionType.CREDENTIALS_UPDATED, userId, null); } @@ -408,7 +505,7 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { if (widgetBundleTypesRequestMsg.getWidgetBundleIdMSB() != 0 && widgetBundleTypesRequestMsg.getWidgetBundleIdLSB() != 0) { WidgetsBundleId widgetsBundleId = new WidgetsBundleId(new UUID(widgetBundleTypesRequestMsg.getWidgetBundleIdMSB(), widgetBundleTypesRequestMsg.getWidgetBundleIdLSB())); WidgetsBundle widgetsBundleById = widgetsBundleService.findWidgetsBundleById(tenantId, widgetsBundleId); - if (widgetsBundleById != null) { + if (widgetsBundleById != null && (TenantId.SYS_TENANT_ID.equals(widgetsBundleById.getTenantId()) || tenantId.equals(widgetsBundleById.getTenantId()))) { List widgetTypesToPush = widgetTypeService.findWidgetTypesByWidgetsBundleId(widgetsBundleById.getTenantId(), widgetsBundleId); for (WidgetType widgetType : widgetTypesToPush) { @@ -474,34 +571,72 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { log.trace("[{}] processEntityGroupEntitiesRequest [{}][{}]", tenantId, edge.getName(), entityGroupEntitiesRequestMsg); if (entityGroupEntitiesRequestMsg.getEntityGroupIdMSB() != 0 && entityGroupEntitiesRequestMsg.getEntityGroupIdLSB() != 0) { EntityGroupId entityGroupId = new EntityGroupId(new UUID(entityGroupEntitiesRequestMsg.getEntityGroupIdMSB(), entityGroupEntitiesRequestMsg.getEntityGroupIdLSB())); - ListenableFuture> entityIdsFuture; - try { - // TODO: refactor this to pagination - entityIdsFuture = entityGroupService.findAllEntityIdsAsync(edge.getTenantId(), entityGroupId, new PageLink(Integer.MAX_VALUE)); - } catch (IncorrectParameterException e) { - log.warn("[{}] Entity group not found to process entityGroupEntitiesRequestMsg {}", tenantId, entityGroupEntitiesRequestMsg, e); + EntityGroup entityGroup = entityGroupService.findEntityGroupById(tenantId, entityGroupId); + if (entityGroup == null || !isTenantEntity(tenantId, entityGroup.getOwnerId())) { return Futures.immediateFuture(null); } - return Futures.transformAsync(entityIdsFuture, entityIds -> { - if (entityIds != null && !entityIds.isEmpty()) { - EntityType groupType = EntityType.valueOf(entityGroupEntitiesRequestMsg.getType()); - return switch (groupType) { - case DEVICE -> syncDevices(edge, entityIds, entityGroupId); - case ASSET -> syncAssets(edge, entityIds, entityGroupId); - case ENTITY_VIEW -> syncEntityViews(edge, entityIds, entityGroupId); - case DASHBOARD -> syncDashboards(edge, entityIds, entityGroupId); - case USER -> syncUsers(edge, entityIds, entityGroupId); - default -> Futures.immediateFuture(null); - }; - } else { - log.trace("No entities found for the requested entity group {} [{}]", entityGroupId.getId(), entityGroupEntitiesRequestMsg.getType()); + ListenableFuture assignedFuture = + entityGroupService.checkEntityGroupAssignedToEdgeAsync(tenantId, edge.getId(), entityGroupId, entityGroup.getType()); + return Futures.transformAsync(assignedFuture, assigned -> { + if (!Boolean.TRUE.equals(assigned) && !isEdgePublicUsersGroup(tenantId, edge, entityGroup)) { + log.warn("[{}][{}] Entity group {} is not assigned to edge, skipping request", tenantId, edge.getId(), entityGroupId); return Futures.immediateFuture(null); } + return syncEntityGroupEntities(tenantId, edge, entityGroup); }, dbCallbackExecutorService); } return Futures.immediateFuture(null); } + // Public Users groups are sent to the edge on sync without an edge assignment + private boolean isEdgePublicUsersGroup(TenantId tenantId, Edge edge, EntityGroup entityGroup) { + if (!EntityType.USER.equals(entityGroup.getType()) || !EntityGroup.GROUP_PUBLIC_USERS_NAME.equals(entityGroup.getName()) + || !EntityType.CUSTOMER.equals(entityGroup.getOwnerId().getEntityType())) { + return false; + } + Customer publicCustomer = findCustomer(tenantId, new CustomerId(entityGroup.getOwnerId().getId())); + if (publicCustomer == null || !publicCustomer.isPublic()) { + return false; + } + // the edge's owner chain (customer, parent customers, tenant) + return ownersCacheService.getOwners(tenantId, edge.getId(), edge).contains(publicCustomer.getOwnerId()); + } + + private Customer findCustomer(TenantId tenantId, CustomerId customerId) { + return entityService.fetchEntity(tenantId, customerId) + .filter(Customer.class::isInstance) + .map(Customer.class::cast) + .filter(customer -> tenantId.equals(customer.getTenantId())) + .orElse(null); + } + + private ListenableFuture syncEntityGroupEntities(TenantId tenantId, Edge edge, EntityGroup entityGroup) { + EntityGroupId entityGroupId = entityGroup.getId(); + ListenableFuture> entityIdsFuture; + try { + // TODO: refactor this to pagination + entityIdsFuture = entityGroupService.findAllEntityIdsAsync(edge.getTenantId(), entityGroupId, new PageLink(Integer.MAX_VALUE)); + } catch (IncorrectParameterException e) { + log.warn("[{}] Entity group {} not found to process entity group entities request", tenantId, entityGroupId, e); + return Futures.immediateFuture(null); + } + return Futures.transformAsync(entityIdsFuture, entityIds -> { + if (entityIds != null && !entityIds.isEmpty()) { + return switch (entityGroup.getType()) { + case DEVICE -> syncDevices(edge, entityIds, entityGroupId); + case ASSET -> syncAssets(edge, entityIds, entityGroupId); + case ENTITY_VIEW -> syncEntityViews(edge, entityIds, entityGroupId); + case DASHBOARD -> syncDashboards(edge, entityIds, entityGroupId); + case USER -> syncUsers(edge, entityIds, entityGroupId); + default -> Futures.immediateFuture(null); + }; + } else { + log.trace("No entities found for the requested entity group {} [{}]", entityGroupId.getId(), entityGroup.getType()); + return Futures.immediateFuture(null); + } + }, dbCallbackExecutorService); + } + @Override public ListenableFuture processEntityGroupPermissionsRequest(TenantId tenantId, Edge edge, EntityGroupRequestMsg entityGroupEntitiesRequestMsg) { log.trace("[{}] processEntityGroupPermissionsRequest [{}][{}]", tenantId, edge.getName(), entityGroupEntitiesRequestMsg); @@ -691,6 +826,170 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { return Futures.immediateFuture(null); } + @Override + public ListenableFuture processSendEmailMsg(TenantId tenantId, Edge edge, SendEmailUplinkMsg sendEmailUplinkMsg) { + return submitEdgeSend(tenantId, edge, "email", mailExecutor, () -> sendEmailForEdge(tenantId, sendEmailUplinkMsg)); + } + + private void sendEmailForEdge(TenantId tenantId, SendEmailUplinkMsg sendEmailUplinkMsg) throws Exception { + EdgeMailRequest request = parseSendRequest(sendEmailUplinkMsg.getRequest(), EdgeMailRequest.class); + if (request == null || request.getMethod() == null) { + log.warn("[{}] Received empty send email request from edge", tenantId); + return; + } + switch (request.getMethod()) { + case SEND_BASIC -> + mailService.sendEmail(tenantId, request.getTo(), request.getSubject(), request.getMessage()); + case SEND_TB_EMAIL -> + mailService.send(tenantId, null, request.getTbEmail()); + case ACTIVATION -> + mailService.sendActivationEmail(tenantId, request.getActivationLink(), request.getTtlMs(), request.getTo()); + case ACCOUNT_ACTIVATED -> + mailService.sendAccountActivatedEmail(tenantId, request.getLoginLink(), request.getTo()); + case RESET_PASSWORD -> + mailService.sendResetPasswordEmail(tenantId, request.getPasswordResetLink(), request.getTtlMs(), request.getTo()); + case PASSWORD_WAS_RESET -> + mailService.sendPasswordWasResetEmail(tenantId, request.getLoginLink(), request.getTo()); + case TWO_FA -> + mailService.sendTwoFaVerificationEmail(tenantId, request.getTo(), request.getVerificationCode(), request.getExpirationTimeSeconds()); + case ACCOUNT_LOCKOUT -> + mailService.sendAccountLockoutEmail(tenantId, request.getLockoutEmail(), request.getTo(), request.getMaxFailedLoginAttempts()); + case API_USAGE_STATE -> + mailService.sendApiFeatureStateEmail(tenantId, request.getApiFeature(), request.getStateValue(), request.getTo(), request.getRecordState()); + case TEST_MAIL -> + mailService.sendTestMail(tenantId, request.getTestConfig(), request.getTo()); + } + } + + @Override + public ListenableFuture processSendSmsMsg(TenantId tenantId, Edge edge, SendSmsUplinkMsg sendSmsUplinkMsg) { + return submitEdgeSend(tenantId, edge, "sms", smsExecutor, () -> sendSmsForEdge(tenantId, sendSmsUplinkMsg)); + } + + private void sendSmsForEdge(TenantId tenantId, SendSmsUplinkMsg sendSmsUplinkMsg) throws Exception { + EdgeSmsRequest request = parseSendRequest(sendSmsUplinkMsg.getRequest(), EdgeSmsRequest.class); + if (request == null || request.getMethod() == null) { + log.warn("[{}] Received empty send sms request from edge", tenantId); + return; + } + switch (request.getMethod()) { + case SEND_SMS -> + smsService.sendSms(tenantId, null, request.getNumbers(), request.getMessage()); + case SEND_TEST_SMS -> + smsService.sendTestSms(tenantId, request.getTestSmsRequest()); + } + } + + @Override + public ListenableFuture processSendNotificationMsg(TenantId tenantId, Edge edge, SendNotificationUplinkMsg sendNotificationUplinkMsg) { + return submitEdgeSend(tenantId, edge, "notification", notificationExecutor, () -> sendNotificationForEdge(tenantId, sendNotificationUplinkMsg)); + } + + private ListenableFuture submitEdgeSend(TenantId tenantId, Edge edge, String what, + ListeningExecutor executor, EdgeSendTask task) { + log.trace("[{}] processing edge-delegated {} send [{}]", tenantId, what, edge.getName()); + ListenableFuture future = Futures.withTimeout(executor.submit(() -> { + task.execute(); + return null; + }), delegatedSendTimeoutSec, TimeUnit.SECONDS, sendTimeoutScheduler); + Futures.addCallback(future, new FutureCallback<>() { + @Override + public void onSuccess(@Nullable Void result) { + } + + @Override + public void onFailure(Throwable t) { + log.warn("[{}] Failed to send {} requested by edge [{}]", tenantId, what, edge.getName(), t); + } + }, dbCallbackExecutorService); + return future; + } + + private void sendNotificationForEdge(TenantId tenantId, SendNotificationUplinkMsg sendNotificationUplinkMsg) throws Exception { + EdgeNotificationRequest request = parseSendRequest(sendNotificationUplinkMsg.getRequest(), EdgeNotificationRequest.class); + if (request == null || request.getMethod() == null) { + log.warn("[{}] Received empty send notification request from edge", tenantId); + return; + } + switch (request.getMethod()) { + case SEND_SLACK -> sendSlackForEdge(tenantId, request); + case SEND_MOBILE_PUSH -> sendMobilePushForEdge(tenantId, request); + } + } + + private void sendSlackForEdge(TenantId tenantId, EdgeNotificationRequest request) { + SlackNotificationDeliveryMethodConfig config = getSlackConfig(tenantId); + if (config == null) { + log.warn("[{}] Slack is not configured on the cloud; dropping edge-delegated notification", tenantId); + return; + } + List files = null; + if (request.getFiles() != null) { + files = request.getFiles().stream() + .map(file -> SlackFile.builder().name(file.getName()).type(file.getType()).data(file.getData()).build()) + .toList(); + } + slackService.sendMessage(tenantId, config.getBotToken(), request.getConversationId(), request.getMessage(), files); + } + + private void sendMobilePushForEdge(TenantId tenantId, EdgeNotificationRequest request) throws Exception { + MobileAppNotificationDeliveryMethodConfig config = getMobileAppConfig(tenantId); + if (config == null || request.getFcmTokens() == null) { + log.warn("[{}] Mobile app notifications are not configured on the cloud; dropping edge-delegated push", tenantId); + return; + } + String credentials = config.getFirebaseServiceAccountCredentials(); + for (String fcmToken : request.getFcmTokens()) { + try { + firebaseService.sendMessage(tenantId, credentials, fcmToken, request.getSubject(), request.getBody(), request.getData(), request.getBadge()); + } catch (FirebaseMessagingException e) { + MessagingErrorCode errorCode = e.getMessagingErrorCode(); + if (MessagingErrorCode.UNREGISTERED == errorCode || MessagingErrorCode.INVALID_ARGUMENT == errorCode + || MessagingErrorCode.SENDER_ID_MISMATCH == errorCode) { + log.debug("[{}] Edge-delegated push rejected, FCM token is no longer valid: {}", tenantId, errorCode); + continue; + } + throw e; + } + } + } + + private SlackNotificationDeliveryMethodConfig getSlackConfig(TenantId tenantId) { + NotificationSettings settings = notificationSettingsService.findNotificationSettings(tenantId); + SlackNotificationDeliveryMethodConfig config = (SlackNotificationDeliveryMethodConfig) settings.getDeliveryMethodsConfigs().get(NotificationDeliveryMethod.SLACK); + if (config == null) { + return null; + } + return secretConfigurationService.replaceSecretUsages(tenantId, config, SlackNotificationDeliveryMethodConfig.class); + } + + private MobileAppNotificationDeliveryMethodConfig getMobileAppConfig(TenantId tenantId) { + NotificationSettings settings = notificationSettingsService.findNotificationSettings(tenantId); + boolean isSystem = false; + var config = (MobileAppNotificationDeliveryMethodConfig) settings.getDeliveryMethodsConfigs().get(NotificationDeliveryMethod.MOBILE_APP); + if (!tenantId.isSysTenantId() && (config == null || config.isUseSystemSettings())) { + settings = notificationSettingsService.findNotificationSettings(TenantId.SYS_TENANT_ID); + config = (MobileAppNotificationDeliveryMethodConfig) settings.getDeliveryMethodsConfigs().get(NotificationDeliveryMethod.MOBILE_APP); + isSystem = true; + } + if (config == null) { + return null; + } + return secretConfigurationService.replaceSecretUsages(isSystem ? TenantId.SYS_TENANT_ID : tenantId, config, MobileAppNotificationDeliveryMethodConfig.class); + } + + private static T parseSendRequest(String request, Class clazz) throws IOException { + return request != null ? JacksonUtil.IGNORE_UNKNOWN_PROPERTIES_JSON_MAPPER.readValue(request, clazz) : null; + } + + private boolean isTenantEntity(TenantId tenantId, EntityId entityId) { + boolean tenantEntity = edgeEntityTenantChecker.isTenantEntity(tenantId, entityId); + if (!tenantEntity) { + log.warn("[{}] Entity {} not found, skipping request", tenantId, entityId); + } + return tenantEntity; + } + private ListenableFuture saveEdgeEvent(TenantId tenantId, EdgeId edgeId, EdgeEventType type, @@ -713,4 +1012,9 @@ public class DefaultEdgeRequestsService implements EdgeRequestsService { return edgeEventService.saveAsync(edgeEvent); } + @FunctionalInterface + private interface EdgeSendTask { + void execute() throws Exception; + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java index 75a70b73bf..7963195dd8 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/sync/EdgeRequestsService.java @@ -13,6 +13,9 @@ import org.thingsboard.server.gen.edge.v1.EntityGroupRequestMsg; import org.thingsboard.server.gen.edge.v1.EntityViewsRequestMsg; import org.thingsboard.server.gen.edge.v1.RelationRequestMsg; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataRequestMsg; +import org.thingsboard.server.gen.edge.v1.SendEmailUplinkMsg; +import org.thingsboard.server.gen.edge.v1.SendNotificationUplinkMsg; +import org.thingsboard.server.gen.edge.v1.SendSmsUplinkMsg; import org.thingsboard.server.gen.edge.v1.UserCredentialsRequestMsg; import org.thingsboard.server.gen.edge.v1.WidgetBundleTypesRequestMsg; @@ -42,4 +45,10 @@ public interface EdgeRequestsService { ListenableFuture processEntityGroupEntitiesRequest(TenantId tenantId, Edge edge, EntityGroupRequestMsg entityGroupEntitiesRequestMsg); ListenableFuture processEntityGroupPermissionsRequest(TenantId tenantId, Edge edge, EntityGroupRequestMsg userGroupEntitiesRequestMsg); + + ListenableFuture processSendEmailMsg(TenantId tenantId, Edge edge, SendEmailUplinkMsg sendEmailUplinkMsg); + + ListenableFuture processSendSmsMsg(TenantId tenantId, Edge edge, SendSmsUplinkMsg sendSmsUplinkMsg); + + ListenableFuture processSendNotificationMsg(TenantId tenantId, Edge edge, SendNotificationUplinkMsg sendNotificationUplinkMsg); } diff --git a/application/src/main/java/org/thingsboard/server/service/entitiy/integration/DefaultTbIntegrationService.java b/application/src/main/java/org/thingsboard/server/service/entitiy/integration/DefaultTbIntegrationService.java index f578321567..879da5cf47 100644 --- a/application/src/main/java/org/thingsboard/server/service/entitiy/integration/DefaultTbIntegrationService.java +++ b/application/src/main/java/org/thingsboard/server/service/entitiy/integration/DefaultTbIntegrationService.java @@ -15,21 +15,27 @@ import org.thingsboard.server.common.data.LibraryConvertersInfo; import org.thingsboard.server.common.data.converter.ConverterType; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; import org.thingsboard.server.common.data.integration.IntegrationInfo; import org.thingsboard.server.common.data.integration.IntegrationType; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.dao.converter.ConverterService; import org.thingsboard.server.dao.integration.IntegrationService; +import org.thingsboard.server.dao.secret.SecretConfigurationService; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.converter.ConverterLibraryService; import org.thingsboard.server.service.entitiy.AbstractTbEntityService; +import org.thingsboard.server.service.integration.IntegrationManagerService; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; @Slf4j @Service @@ -40,6 +46,8 @@ public class DefaultTbIntegrationService extends AbstractTbEntityService impleme private final IntegrationService integrationService; private final ConverterLibraryService converterLibraryService; private final ConverterService converterService; + private final IntegrationManagerService integrationManagerService; + private final SecretConfigurationService secretConfigurationService; @Override public PageData findTenantIntegrationInfos(TenantId tenantId, PageLink pageLink, boolean isEdgeTemplate) { @@ -94,4 +102,14 @@ public class DefaultTbIntegrationService extends AbstractTbEntityService impleme return result; } + @Override + public void validateIntegrationConfiguration(TenantId tenantId, Integration integration) throws ExecutionException, InterruptedException, TimeoutException { + if (integration.isEdgeTemplate()) { + return; + } + Integration copy = new Integration(integration); + secretConfigurationService.replaceSecretUsages(tenantId, copy.getConfiguration()); + integrationManagerService.validateIntegrationConfiguration(copy).get(20, TimeUnit.SECONDS); + } + } diff --git a/application/src/main/java/org/thingsboard/server/service/entitiy/integration/TbIntegrationService.java b/application/src/main/java/org/thingsboard/server/service/entitiy/integration/TbIntegrationService.java index 9bd0f08877..ba32fc4d9c 100644 --- a/application/src/main/java/org/thingsboard/server/service/entitiy/integration/TbIntegrationService.java +++ b/application/src/main/java/org/thingsboard/server/service/entitiy/integration/TbIntegrationService.java @@ -5,12 +5,15 @@ package org.thingsboard.server.service.entitiy.integration; import org.thingsboard.server.common.data.IntegrationConvertersInfo; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; import org.thingsboard.server.common.data.integration.IntegrationInfo; import org.thingsboard.server.common.data.integration.IntegrationType; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; public interface TbIntegrationService { @@ -19,4 +22,10 @@ public interface TbIntegrationService { PageData findIntegrationInfosByTenantIdAndEdgeId(TenantId tenantId, EdgeId edgeId, PageLink pageLink); Map getIntegrationsConvertersInfo(TenantId tenantId); + + /** + * The check before an integration is saved: its configuration, with the secrets it uses, is validated by its type. + * An edge template isn't validated. An invalid configuration fails with an {@link ExecutionException}. + */ + void validateIntegrationConfiguration(TenantId tenantId, Integration integration) throws ExecutionException, InterruptedException, TimeoutException; } diff --git a/application/src/main/java/org/thingsboard/server/service/install/lts/V4_4_1_0Migration.java b/application/src/main/java/org/thingsboard/server/service/install/lts/V4_4_1_0Migration.java index 7b79bc59be..4c43d447e1 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/lts/V4_4_1_0Migration.java +++ b/application/src/main/java/org/thingsboard/server/service/install/lts/V4_4_1_0Migration.java @@ -2,16 +2,30 @@ // SPDX-License-Identifier: BUSL-1.1 package org.thingsboard.server.service.install.lts; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.pat.ApiKey; +import org.thingsboard.server.common.data.permission.Operation; +import org.thingsboard.server.common.data.permission.Resource; +import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.dao.pat.ApiKeyService; import org.thingsboard.server.queue.util.TbCoreComponent; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import static org.thingsboard.server.dao.trendz.TrendzSyncService.TRENDZ_API_KEY_DESCRIPTION; + /** - * Registration-only migration with no {@link #apply()} (no data migration). + * Migration for version {@code 4.4.1.0}. *

- * {@link MigrationService} selects migrations from the injected {@link Migration} beans, not from the - * on-disk {@code data/upgrade/lts//} directories. So this bean is what makes the runner discover - * version {@code 4.4.1.0} and execute its {@code data/upgrade/lts/4.4.1.0/schema_update.sql}, which adds the - * {@code idx_calculated_field_tenant_id_id} index used by tenant-scoped calculated field paging. + * {@link MigrationService} selects migrations from the injected {@link Migration} beans, not from the on-disk + * {@code data/upgrade/lts//} directories, so this bean is what makes the runner discover version + * {@code 4.4.1.0} and execute its {@code data/upgrade/lts/4.4.1.0/schema_update.sql}. *

* It needs a slot of its own rather than {@code 4.4.0.0}: that version is already released, and * {@link Version#isInRange} is exclusive at the lower bound, so an installation already on {@code 4.4.0.0} @@ -19,12 +33,71 @@ import org.thingsboard.server.queue.util.TbCoreComponent; *

* The dir/bean consistency (both ways) is guarded by a test in {@code MigrationIntegrationTest}. */ +@Slf4j @Component @TbCoreComponent +@RequiredArgsConstructor public class V4_4_1_0Migration implements Migration { + private final ApiKeyService apiKeyService; + @Override public String getVersion() { return "4.4.1.0"; } + + // Steps must be idempotent: a crash before the version is recorded re-runs them + @Override + public void apply() { + grantAiModelOperationsToTrendzApiKey(); + } + + // Mirrors the AI_MODEL entries of DefaultTrendzSyncService.buildTrendzPermissions() for keys created before this version + private void grantAiModelOperationsToTrendzApiKey() { + Map> aiModelOperationsByAuthority = Map.of( + Authority.TENANT_ADMIN, EnumSet.of(Operation.READ, Operation.INVOKE), + Authority.CUSTOMER_USER, EnumSet.of(Operation.INVOKE)); + + ApiKey trendzApiKey = apiKeyService.findInternalApiKeyByDescription(TenantId.SYS_TENANT_ID, TRENDZ_API_KEY_DESCRIPTION); + if (trendzApiKey == null || trendzApiKey.getPermissions() == null + || trendzApiKey.getPermissions().getOperationsByResource() == null) { + log.debug("No internal Trendz API key with stored permissions, nothing to grant"); + return; + } + + Map>> byAuthority = + new HashMap<>(trendzApiKey.getPermissions().getOperationsByResource()); + boolean changed = false; + + for (var entry : aiModelOperationsByAuthority.entrySet()) { + Authority authority = entry.getKey(); + Set aiModelOperations = entry.getValue(); + Map> byResource = byAuthority.get(authority); + if (byResource == null) { + continue; + } + Map> updatedByResource = new HashMap<>(byResource); + Set operations = updatedByResource.get(Resource.AI_MODEL); + if (operations != null && operations.containsAll(aiModelOperations)) { + continue; + } + Set updated = EnumSet.copyOf(aiModelOperations); + if (operations != null) { + updated.addAll(operations); + } + updatedByResource.put(Resource.AI_MODEL, updated); + changed = true; + byAuthority.put(authority, updatedByResource); + } + + if (!changed) { + log.debug("Internal Trendz API key already grants {} on {}", aiModelOperationsByAuthority, Resource.AI_MODEL); + return; + } + + trendzApiKey.getPermissions().setOperationsByResource(byAuthority); + // Keeps the key's value and evicts the cached permissions + apiKeyService.saveApiKey(TenantId.SYS_TENANT_ID, trendzApiKey); + log.info("Granted {} on {} to the internal Trendz API key", aiModelOperationsByAuthority, Resource.AI_MODEL); + } } diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultDevicePackageUpdateService.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultDevicePackageUpdateService.java new file mode 100644 index 0000000000..1becc88cf4 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultDevicePackageUpdateService.java @@ -0,0 +1,1001 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.databind.node.TextNode; +import com.google.gson.JsonParser; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.support.TransactionTemplate; +import org.springframework.web.client.RestClientException; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.api.AttributesSaveRequest; +import org.thingsboard.server.common.adaptor.JsonConverter; +import org.thingsboard.server.common.data.AttributeScope; +import org.thingsboard.server.common.data.Dashboard; +import org.thingsboard.server.common.data.Device; +import org.thingsboard.server.common.data.DeviceProfile; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.HasName; +import org.thingsboard.server.common.data.HasTenantId; +import org.thingsboard.server.common.data.HasVersion; +import org.thingsboard.server.common.data.audit.ActionType; +import org.thingsboard.server.common.data.converter.Converter; +import org.thingsboard.server.common.data.converter.ConverterType; +import org.thingsboard.server.common.data.exception.EntityVersionMismatchException; +import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; +import org.thingsboard.server.common.data.exception.ThingsboardException; +import org.thingsboard.server.common.data.id.ConverterId; +import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.DeviceId; +import org.thingsboard.server.common.data.id.DeviceProfileId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.IntegrationId; +import org.thingsboard.server.common.data.id.IotHubInstalledItemId; +import org.thingsboard.server.common.data.id.RuleChainId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; +import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor; +import org.thingsboard.server.common.data.iot_hub.IotHubInstalledItem; +import org.thingsboard.server.common.data.kv.AttributeKvEntry; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; +import org.thingsboard.server.common.data.rule.RuleChain; +import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.common.data.security.DeviceCredentials; +import org.thingsboard.server.common.data.security.DeviceCredentialsType; +import org.thingsboard.server.common.data.subscription.SubscriptionException; +import org.thingsboard.server.dao.attributes.AttributesService; +import org.thingsboard.server.dao.converter.ConverterService; +import org.thingsboard.server.dao.dashboard.DashboardService; +import org.thingsboard.server.dao.device.DeviceCredentialsService; +import org.thingsboard.server.dao.device.DeviceProfileService; +import org.thingsboard.server.dao.device.DeviceService; +import org.thingsboard.server.dao.entity.EntityService; +import org.thingsboard.server.dao.integration.IntegrationService; +import org.thingsboard.server.dao.iot_hub.IotHubInstalledItemService; +import org.thingsboard.server.dao.rule.RuleChainService; +import org.thingsboard.server.dao.subscription.PlatformFeature; +import org.thingsboard.server.dao.subscription.SubscriptionService; +import org.thingsboard.server.exception.DataValidationException; +import org.thingsboard.server.exception.EntitiesLimitExceededException; +import org.thingsboard.server.queue.util.TbCoreComponent; +import org.thingsboard.server.service.entitiy.AbstractTbEntityService; +import org.thingsboard.server.service.entitiy.integration.TbIntegrationService; +import org.thingsboard.server.service.rule.TbRuleChainService; +import org.thingsboard.server.service.security.model.SecurityUser; +import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Applies an update of an installed device package in one transaction. The install wizard resolves the templates + * of the new version (the same way it installs them) and sends the entity of each step; this service checks the + * plan, saves every entity and the new version of the installed item together, and rolls all of it back on a + * failure. The side effects of the saves (actors, integration restart, edge, caches) run after commit, so a + * rollback leaves no trace; the audit log, version control and the attributes, which aren't transactional, + * are written after commit too. + */ +@Service +@TbCoreComponent +@Slf4j +@RequiredArgsConstructor +public class DefaultDevicePackageUpdateService extends AbstractTbEntityService implements DevicePackageUpdateService { + + // Step type of the package -> the alias its templates refer to it by, e.g. ${deviceProfile.id} + private static final Map STEP_ALIASES = Map.of( + "DEVICE_PROFILE", "deviceProfile", + "DEVICE", "device", + "GATEWAY", "gateway", + "DASHBOARD", "dashboard", + "RULE_CHAIN", "ruleChain", + "UPLINK_CONVERTER", "uplinkConverter", + "DOWNLINK_CONVERTER", "downlinkConverter", + "INTEGRATION", "integration"); + private static final Pattern ENTITY_PLACEHOLDER = Pattern.compile("\\$\\{([A-Za-z]+)\\.([A-Za-z]+)}"); + private static final String UNEXPECTED_ERROR = "Failed to update the device package"; + + private final IotHubInstalledItemService installedItemService; + private final IotHubRestClient iotHubRestClient; + private final IotHubService iotHubService; + private final DevicePackageEntities packageEntities; + private final DeviceProfileService deviceProfileService; + private final DeviceService deviceService; + private final DeviceCredentialsService deviceCredentialsService; + private final DashboardService dashboardService; + private final RuleChainService ruleChainService; + private final TbRuleChainService tbRuleChainService; + private final ConverterService converterService; + private final IntegrationService integrationService; + private final TbIntegrationService tbIntegrationService; + private final SubscriptionService subscriptionService; + private final AttributesService attributesService; + private final TelemetrySubscriptionService telemetryService; + private final TransactionTemplate transactionTemplate; + + @Override + public List check(SecurityUser user, IotHubInstalledItemId installedItemId) { + TenantId tenantId = user.getTenantId(); + DeviceInstalledItemDescriptor descriptor = findDevicePackage(tenantId, installedItemId).descriptor(); + Set sharedIds = new HashSet<>(); + iotHubService.findKeptEntities(tenantId, installedItemId).getEntities().forEach(e -> sharedIds.add(e.getEntityId().getId())); + Map createdIds = createdIds(descriptor); + Map> recordedChecksums = recordedChecksums(tenantId); + + List states = new ArrayList<>(); + if (descriptor.getInstallState() == null) { + return states; + } + descriptor.getInstallState().forEach((stepName, state) -> { + EntityId entityId = DevicePackageEntities.entityIdOf(state, createdIds); + if (entityId == null || !DevicePackageEntities.CHECKSUM_TYPES.contains(entityId.getEntityType())) { + return; + } + DevicePackageEntities.Snapshot snapshot = packageEntities.load(tenantId, entityId); + JsonNode storedChecksum = state.get("checksum"); + // Changed by someone else only when no installed package recorded the current checksum: an update of another + // package that shares the entity, e.g. a converter, records it only in its own row + Boolean modified = snapshot == null || storedChecksum == null || !storedChecksum.isTextual() ? null : + !storedChecksum.asText().equals(snapshot.checksum()) + && !recordedChecksums.getOrDefault(entityId.getId(), Set.of()).contains(snapshot.checksum()); + states.add(new DevicePackageEntityState(stepName, entityId, snapshot != null, + snapshot != null ? snapshot.version() : null, modified, sharedIds.contains(entityId.getId()))); + }); + return states; + } + + @Override + public DeviceUpdateResult apply(SecurityUser user, IotHubInstalledItemId installedItemId, DeviceUpdateRequest request) { + TenantId tenantId = user.getTenantId(); + log.info("[{}] Updating device package {} to version {}", tenantId, installedItemId, request.getVersionId()); + Applied applied; + try { + DevicePackage devicePackage = findDevicePackage(tenantId, installedItemId); + JsonNode versionInfo = iotHubRestClient.getVersionInfo(request.getVersionId()); + if (versionInfo == null || !devicePackage.installedItem().getItemId().toString().equals(versionInfo.path("itemId").asText())) { + throw new IllegalArgumentException("The version belongs to another item"); + } + validatePlan(devicePackage, request); + checkFeatures(tenantId, request); + validateIntegrations(tenantId, request); + applied = transactionTemplate.execute(status -> applySteps(tenantId, devicePackage, request, versionInfo)); + } catch (StepFailure e) { + log.warn("[{}] Device package update of {} failed on step [{}], nothing was changed", tenantId, installedItemId, e.stepName, e.getCause()); + return DeviceUpdateResult.error(userMessage(e.getCause()), e.stepName); + } catch (RestClientException e) { + log.error("[{}] IoT Hub request failed while updating device package {}", tenantId, installedItemId, e); + return DeviceUpdateResult.error("IoT Hub is unavailable. Try again later.", null); + } catch (Exception e) { + log.warn("[{}] Device package update of {} failed, nothing was changed", tenantId, installedItemId, e); + return DeviceUpdateResult.error(userMessage(e), null); + } + afterCommit(user, tenantId, applied); + log.info("[{}] Updated device package {} to version {}", tenantId, installedItemId, request.getVersionId()); + return DeviceUpdateResult.success(applied.descriptor(), applied.outputs()); + } + + private DevicePackage findDevicePackage(TenantId tenantId, IotHubInstalledItemId installedItemId) { + IotHubInstalledItem installedItem = installedItemService.findById(tenantId, installedItemId); + if (installedItem == null || !"DEVICE".equals(installedItem.getItemType()) + || !(installedItem.getDescriptor() instanceof DeviceInstalledItemDescriptor descriptor)) { + throw new IllegalArgumentException("Installed device package not found"); + } + return new DevicePackage(installedItem, descriptor); + } + + /** + * The update may only change what the package owns, or what the user confirmed. The device and the gateway, + * whose credentials the firmware uses, are never changed. + */ + private void validatePlan(DevicePackage devicePackage, DeviceUpdateRequest request) { + if (request.getSteps() == null || request.getSteps().isEmpty()) { + throw new IllegalArgumentException("The update has no steps"); + } + Set ownedIds = ownedIds(devicePackage.descriptor()); + Set stateKeys = new HashSet<>(); + for (DeviceUpdateRequest.Step step : request.getSteps()) { + if (step.getName() == null || step.getAction() == null || !isKnownType(step.getType())) { + throw new IllegalArgumentException("Invalid update step: " + step.getName()); + } + // The key of the step's install state + if (!stateKeys.add(step.getId() != null ? step.getId() : step.getName())) { + throw new IllegalArgumentException("Duplicate update step: " + step.getName()); + } + boolean deviceOrGateway = "DEVICE".equals(step.getType()) || "GATEWAY".equals(step.getType()); + switch (step.getAction()) { + case KEEP, OVERWRITE -> { + if (step.getEntityId() == null && !"GATEWAY_CONNECTOR".equals(step.getType())) { + throw new IllegalArgumentException("No entity for update step: " + step.getName()); + } + boolean owned = step.getEntityId() != null && ownedIds.contains(step.getEntityId()); + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE && !owned && !step.isConfirmed() + && !"GATEWAY_CONNECTOR".equals(step.getType())) { + throw new IllegalArgumentException("Overwriting an entity of another package needs a confirmation: " + step.getName()); + } + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE && deviceOrGateway && owned) { + throw new IllegalArgumentException("The device and its credentials don't change on update"); + } + } + case CREATE -> { + } + } + if (step.getAction() != DeviceUpdateRequest.Action.KEEP && (step.getEntity() == null || !step.getEntity().isObject())) { + throw new IllegalArgumentException("No entity data for update step: " + step.getName()); + } + } + } + + /** Integrations and converters are saved as through their API, which needs the feature in the tenant's plan. */ + private void checkFeatures(TenantId tenantId, DeviceUpdateRequest request) { + boolean savesIntegrations = request.getSteps().stream().anyMatch(step -> step.getAction() != DeviceUpdateRequest.Action.KEEP + && ("INTEGRATION".equals(step.getType()) || step.getType().endsWith("_CONVERTER"))); + if (savesIntegrations) { + subscriptionService.checkFeatureAllowed(tenantId, PlatformFeature.INTEGRATIONS); + } + } + + /** The configuration of an integration is checked by a remote call, so before the transaction. */ + private void validateIntegrations(TenantId tenantId, DeviceUpdateRequest request) throws Exception { + for (DeviceUpdateRequest.Step step : request.getSteps()) { + if (!"INTEGRATION".equals(step.getType()) || step.getAction() == DeviceUpdateRequest.Action.KEEP) { + continue; + } + ObjectNode body = step.getEntity().deepCopy(); + // Converters this update creates have no id yet; the configuration doesn't depend on them + body.remove(List.of("id", "defaultConverterId", "downlinkConverterId")); + Integration integration = JacksonUtil.treeToValue(body, Integration.class); + integration.setTenantId(tenantId); + try { + tbIntegrationService.validateIntegrationConfiguration(tenantId, integration); + } catch (ExecutionException e) { + // What the integration reports, e.g. wrong credentials, is what the user has to fix + Throwable cause = e.getCause() != null ? e.getCause() : e; + throw new StepFailure(step.getName(), new IllegalArgumentException(cause.getMessage(), cause)); + } catch (TimeoutException e) { + throw new StepFailure(step.getName(), new IllegalStateException("Timeout to validate the integration configuration")); + } + } + } + + private Applied applySteps(TenantId tenantId, DevicePackage devicePackage, DeviceUpdateRequest request, JsonNode versionInfo) { + IotHubInstalledItem installedItem = lockInstalledItem(tenantId, devicePackage, request); + DeviceInstalledItemDescriptor previous = devicePackage.descriptor(); + Set ownedIds = ownedIds(previous); + Map aliasOutputs = new HashMap<>(); + Map outputs = new LinkedHashMap<>(); + Map installState = new LinkedHashMap<>(); + if (request.getInstallState() != null) { + request.getInstallState().forEach((key, value) -> { + if (value != null && value.has("formValues")) { + installState.put(key, JacksonUtil.newObjectNode().set("formValues", value.get("formValues"))); + } + }); + } + List stepEntityIds = new ArrayList<>(); + Map usedExistingIds = usedExistingIds(previous); + List saved = new ArrayList<>(); + List connectorSteps = new ArrayList<>(); + List attributes = new ArrayList<>(); + DashboardId dashboardId = null; + + for (DeviceUpdateRequest.Step step : request.getSteps()) { + try { + if ("GATEWAY_CONNECTOR".equals(step.getType())) { + // A connector lives in the gateway's attributes, which aren't transactional: saved after commit + if (step.getAction() != DeviceUpdateRequest.Action.KEEP) { + connectorSteps.add(copyWithEntity(step, resolvePlaceholders(step.getEntity(), aliasOutputs))); + } + continue; + } + JsonNode entity = step.getEntity() != null ? resolvePlaceholders(step.getEntity(), aliasOutputs) : null; + StepResult result = applyStep(tenantId, step, entity); + ObjectNode output = result.output(); + aliasOutputs.put(STEP_ALIASES.get(step.getType()), output); + outputs.put(step.getName(), output); + ObjectNode state = JacksonUtil.newObjectNode(); + state.set("entityOutput", output); + // The package's own entity stays the package's, whatever the request says, so later versions update it + boolean owned = step.getEntityId() != null && ownedIds.contains(step.getEntityId()); + String resolution = step.getResolution() == null || (owned && "use-existing".equals(step.getResolution())) ? "created" : step.getResolution(); + state.put("resolution", resolution); + // A kept entity keeps the checksum of what the package left: the current one would take the + // user's changes for the package's, and the next update would overwrite them without a warning + String checksum = step.getAction() == DeviceUpdateRequest.Action.KEEP ? previousChecksum(previous, step.getEntityId()) : result.checksum(); + if (checksum != null) { + state.put("checksum", checksum); + } + if (step.isDefaultConverter()) { + state.put("defaultConverter", true); + } + ObjectNode metadata = addedMetadata(step.getMetadata()); + if (metadata != null) { + state.set("metadata", metadata); + } + installState.put(step.getId() != null ? step.getId() : step.getName(), state); + // As at install, an entity used as it was is listed too, so a delete removes the metadata entries the + // package added to it; usedExistingEntityIds keeps it the user's + if (!stepEntityIds.contains(result.entityId())) { + stepEntityIds.add(result.entityId()); + } + if ("use-existing".equals(resolution)) { + usedExistingIds.putIfAbsent(result.entityId().getId(), result.entityId()); + } + if (result.entityId() instanceof DashboardId id) { + dashboardId = id; + } + if (result.saved() != null) { + saved.add(result.saved()); + } + if (step.getAction() != DeviceUpdateRequest.Action.KEEP && !"use-existing".equals(resolution)) { + // As at install, the step's attributes go with the entity it saved; written after commit + attributes.add(new StepAttributes(step.getName(), result.entityId(), step.getServerAttributes(), step.getSharedAttributes())); + } + } catch (StepFailure e) { + throw e; + } catch (Exception e) { + throw new StepFailure(step.getName(), e); + } + } + + // An update to the installed version itself, e.g. of ThingsBoard's default converter only, sends just the steps + // it changes: the other steps and the forms keep their install state + if (UUID.fromString(request.getVersionId()).equals(installedItem.getItemVersionId()) && previous.getInstallState() != null) { + previous.getInstallState().forEach((key, value) -> { + if (value instanceof ObjectNode state) { + installState.putIfAbsent(key, state); + } + }); + } + + DeviceInstalledItemDescriptor descriptor = new DeviceInstalledItemDescriptor(); + // The new version may not offer the method the package was installed with + descriptor.setSelectedInstallMethod(request.getSelectedInstallMethod() != null ? request.getSelectedInstallMethod() : previous.getSelectedInstallMethod()); + descriptor.setCreatedEntityIds(createdEntityIds(tenantId, previous, stepEntityIds)); + // Carried over like createdEntityIds, so an entity the user chose to use stays theirs after a version drops its step + Set tracked = createdIds(descriptor).keySet(); + descriptor.setUsedExistingEntityIds(usedExistingIds.values().stream().filter(id -> tracked.contains(id.getId())).toList()); + descriptor.setDashboardId(dashboardId != null ? dashboardId : existingDashboard(tenantId, previous)); + Map state = new LinkedHashMap<>(installState); + carryMetadataStates(previous, tracked, state); + descriptor.setInstallState(state); + + installedItem.setItemVersionId(UUID.fromString(request.getVersionId())); + installedItem.setItemName(versionInfo.get("name").asText()); + installedItem.setVersion(versionInfo.get("version").asText()); + installedItem.setDescriptor(descriptor); + installedItemService.save(tenantId, installedItem); + // Resolved once every entity is saved: attributes may refer to a later step's entity + List resolvedAttributes = attributes.stream().map(a -> new StepAttributes(a.stepName(), a.entityId(), + resolvePlaceholders(a.server(), aliasOutputs), resolvePlaceholders(a.shared(), aliasOutputs))).toList(); + return new Applied(descriptor, outputs, saved, connectorSteps, resolvedAttributes, aliasOutputs); + } + + /** The checksums the installed device packages recorded, by entity. */ + private Map> recordedChecksums(TenantId tenantId) { + Map> checksums = new HashMap<>(); + PageLink pageLink = new PageLink(100); + PageData page; + do { + page = installedItemService.findByTenantId(tenantId, List.of("DEVICE"), null, pageLink); + for (IotHubInstalledItem item : page.getData()) { + if (item.getDescriptor() instanceof DeviceInstalledItemDescriptor descriptor && descriptor.getInstallState() != null) { + descriptor.getInstallState().values().forEach(state -> { + UUID id = toUuid(state.path("entityOutput").path("id").asText()); + JsonNode checksum = state.get("checksum"); + if (id != null && checksum != null && checksum.isTextual()) { + checksums.computeIfAbsent(id, k -> new HashSet<>()).add(checksum.asText()); + } + }); + } + } + pageLink = pageLink.nextPageLink(); + } while (page.hasNext()); + return checksums; + } + + private static UUID toUuid(String id) { + try { + return UUID.fromString(id); + } catch (IllegalArgumentException e) { + return null; + } + } + + /** + * Another update of the package, e.g. a second click or another tab, waits here until this one commits, and then + * fails: the plan was made for the version installed before. Without it both would create the new entities. + */ + private IotHubInstalledItem lockInstalledItem(TenantId tenantId, DevicePackage devicePackage, DeviceUpdateRequest request) { + IotHubInstalledItem installedItem = installedItemService.findByIdForUpdate(tenantId, devicePackage.installedItem().getId()); + UUID planned = request.getFromVersionId() != null ? request.getFromVersionId() : devicePackage.installedItem().getItemVersionId(); + if (installedItem == null || !planned.equals(installedItem.getItemVersionId()) + || !Objects.equals(devicePackage.installedItem().getItemVersionId(), installedItem.getItemVersionId())) { + throw new IllegalArgumentException("The package was updated meanwhile. Check the update again."); + } + return installedItem; + } + + private StepResult applyStep(TenantId tenantId, DeviceUpdateRequest.Step step, JsonNode entity) throws ThingsboardException { + return switch (step.getType()) { + case "DEVICE_PROFILE" -> saveDeviceProfile(tenantId, step, entity); + case "DEVICE", "GATEWAY" -> saveDevice(tenantId, step, entity); + case "DASHBOARD" -> saveDashboard(tenantId, step, entity); + case "RULE_CHAIN" -> saveRuleChain(tenantId, step, entity); + case "UPLINK_CONVERTER", "DOWNLINK_CONVERTER" -> saveConverter(tenantId, step, entity); + case "INTEGRATION" -> saveIntegration(tenantId, step, entity); + default -> throw new IllegalArgumentException("Unsupported step type: " + step.getType()); + }; + } + + private StepResult saveDeviceProfile(TenantId tenantId, DeviceUpdateRequest.Step step, JsonNode entity) { + DeviceProfileId id = step.getEntityId() != null ? new DeviceProfileId(step.getEntityId()) : null; + DeviceProfile current = id != null ? deviceProfileService.findDeviceProfileById(tenantId, id) : null; + if (step.getAction() == DeviceUpdateRequest.Action.KEEP) { + existing(tenantId, current, step); + return kept(id, current.getName()); + } + DeviceProfile profile = JacksonUtil.treeToValue(entity, DeviceProfile.class); + profile.setTenantId(tenantId); + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE) { + existing(tenantId, current, step); + prepareOverwrite(profile, id, current, step); + // The tenant's default profile stays the default one + profile.setDefault(current.isDefault()); + } else { + profile.setId(null); + profile.setVersion(null); + } + DeviceProfile result = deviceProfileService.saveDeviceProfile(profile); + return savedResult(tenantId, result.getId(), result, step, output(result.getId(), result.getName())); + } + + private StepResult saveDevice(TenantId tenantId, DeviceUpdateRequest.Step step, JsonNode entity) { + DeviceId id = step.getEntityId() != null ? new DeviceId(step.getEntityId()) : null; + Device device; + boolean created = false; + if (step.getAction() == DeviceUpdateRequest.Action.CREATE) { + Device template = JacksonUtil.treeToValue(entity, Device.class); + template.setTenantId(tenantId); + template.setId(null); + template.setVersion(null); + device = deviceService.saveDevice(template); + created = true; + } else { + Device current = id != null ? deviceService.findDeviceById(tenantId, id) : null; + device = existing(tenantId, current, step); + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE) { + // Another device the user chose to overwrite; the package's own device never changes + Device template = JacksonUtil.treeToValue(entity, Device.class); + template.setTenantId(tenantId); + prepareOverwrite(template, id, current, step); + device = deviceService.saveDevice(template); + created = true; + } + } + DeviceCredentials credentials = deviceCredentialsService.findDeviceCredentialsByDeviceId(tenantId, device.getId()); + if (created && step.getCredentials() != null && step.getCredentials().isObject()) { + credentials = applyCredentials(tenantId, credentials, step.getCredentials()); + } + ObjectNode output = output(device.getId(), device.getName()); + if (credentials != null) { + output.put("token", credentials.getCredentialsId()); + } + if ("GATEWAY".equals(step.getType())) { + output.put("dockerComposeUrl", "/api/device-connectivity/gateway-launch/" + device.getId().getId() + "/docker-compose/download"); + } + SavedEntity saved = created ? new SavedEntity(device.getId(), device, step.getAction() == DeviceUpdateRequest.Action.CREATE) : null; + return new StepResult(device.getId(), output, null, saved); + } + + private DeviceCredentials applyCredentials(TenantId tenantId, DeviceCredentials credentials, JsonNode template) { + JsonNode type = template.get("credentialsType"); + if (type != null && type.isTextual()) { + credentials.setCredentialsType(DeviceCredentialsType.valueOf(type.asText())); + } + JsonNode value = template.get("credentialsValue"); + if (value != null && !value.isNull()) { + credentials.setCredentialsValue(value.isTextual() ? value.asText() : value.toString()); + } + JsonNode credentialsId = template.get("credentialsId"); + if (credentialsId != null && credentialsId.isTextual()) { + credentials.setCredentialsId(credentialsId.asText()); + } + return deviceCredentialsService.updateDeviceCredentials(tenantId, credentials); + } + + private StepResult saveDashboard(TenantId tenantId, DeviceUpdateRequest.Step step, JsonNode entity) { + DashboardId id = step.getEntityId() != null ? new DashboardId(step.getEntityId()) : null; + Dashboard current = id != null ? dashboardService.findDashboardById(tenantId, id) : null; + if (step.getAction() == DeviceUpdateRequest.Action.KEEP) { + existing(tenantId, current, step); + return kept(id, current.getTitle()); + } + Dashboard dashboard = JacksonUtil.treeToValue(entity, Dashboard.class); + dashboard.setTenantId(tenantId); + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE) { + existing(tenantId, current, step); + prepareOverwrite(dashboard, id, current, step); + // The dashboard keeps its owner and the customers it is assigned to + if (dashboard.getCustomerId() == null) { + dashboard.setCustomerId(current.getCustomerId()); + } + dashboard.setAssignedCustomers(current.getAssignedCustomers()); + } else { + dashboard.setId(null); + dashboard.setVersion(null); + } + Dashboard result = dashboardService.saveDashboard(dashboard); + return savedResult(tenantId, result.getId(), result, step, output(result.getId(), result.getTitle())); + } + + private StepResult saveRuleChain(TenantId tenantId, DeviceUpdateRequest.Step step, JsonNode entity) throws ThingsboardException { + RuleChainId id = step.getEntityId() != null ? new RuleChainId(step.getEntityId()) : null; + RuleChain current = id != null ? ruleChainService.findRuleChainById(tenantId, id) : null; + if (step.getAction() == DeviceUpdateRequest.Action.KEEP) { + existing(tenantId, current, step); + return kept(id, current.getName()); + } + JsonNode ruleChainJson = entity.has("ruleChain") ? entity.get("ruleChain") : entity; + RuleChain ruleChain = JacksonUtil.treeToValue(ruleChainJson, RuleChain.class); + ruleChain.setTenantId(tenantId); + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE) { + existing(tenantId, current, step); + prepareOverwrite(ruleChain, id, current, step); + // A rule chain the tenant made its root one stays the root + ruleChain.setRoot(current.isRoot()); + } else { + ruleChain.setId(null); + ruleChain.setVersion(null); + ruleChain.setRoot(false); + } + RuleChain result = ruleChainService.saveRuleChain(ruleChain); + if (entity.has("metadata") && entity.get("metadata").isObject()) { + RuleChainMetaData metadata = JacksonUtil.treeToValue(entity.get("metadata"), RuleChainMetaData.class); + metadata.setRuleChainId(result.getId()); + metadata.setVersion(result.getVersion()); + if (!ruleChainService.saveRuleChainMetaData(tenantId, metadata, tbRuleChainService::updateRuleNodeConfiguration).isSuccess()) { + throw new IllegalStateException("Failed to save the rule chain metadata"); + } + result = ruleChainService.findRuleChainById(tenantId, result.getId()); + } + return savedResult(tenantId, result.getId(), result, step, output(result.getId(), result.getName())); + } + + private StepResult saveConverter(TenantId tenantId, DeviceUpdateRequest.Step step, JsonNode entity) { + ConverterId id = step.getEntityId() != null ? new ConverterId(step.getEntityId()) : null; + Converter current = id != null ? converterService.findConverterById(tenantId, id) : null; + if (step.getAction() == DeviceUpdateRequest.Action.KEEP) { + existing(tenantId, current, step); + return kept(id, current.getName()); + } + Converter converter = JacksonUtil.treeToValue(entity, Converter.class); + converter.setTenantId(tenantId); + converter.setType("UPLINK_CONVERTER".equals(step.getType()) ? ConverterType.UPLINK : ConverterType.DOWNLINK); + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE) { + existing(tenantId, current, step); + prepareOverwrite(converter, id, current, step); + } else { + converter.setId(null); + converter.setVersion(null); + } + Converter result = converterService.saveConverter(converter); + return savedResult(tenantId, result.getId(), result, step, output(result.getId(), result.getName())); + } + + private StepResult saveIntegration(TenantId tenantId, DeviceUpdateRequest.Step step, JsonNode entity) { + IntegrationId id = step.getEntityId() != null ? new IntegrationId(step.getEntityId()) : null; + Integration current = id != null ? integrationService.findIntegrationById(tenantId, id) : null; + if (step.getAction() == DeviceUpdateRequest.Action.KEEP) { + existing(tenantId, current, step); + Integration merged = withMergedMetadata(current, step.getMetadata()); + if (merged != null) { + Integration result = integrationService.saveIntegration(merged); + return savedResult(tenantId, result.getId(), result, step, integrationOutput(result)); + } + return new StepResult(id, integrationOutput(current), null, null); + } + Integration integration = JacksonUtil.treeToValue(entity, Integration.class); + integration.setTenantId(tenantId); + if (step.getAction() == DeviceUpdateRequest.Action.OVERWRITE) { + existing(tenantId, current, step); + prepareOverwrite(integration, id, current, step); + // The devices keep sending to the same endpoint + integration.setRoutingKey(current.getRoutingKey()); + } else { + integration.setId(null); + integration.setVersion(null); + if (integration.getRoutingKey() == null) { + integration.setRoutingKey(UUID.randomUUID().toString()); + } + } + Integration result = integrationService.saveIntegration(integration); + return savedResult(tenantId, result.getId(), result, step, integrationOutput(result)); + } + + /** + * Carries over the state of an integration the package still tracks but this version has no step for, with the + * entries the package added to its metadata: a delete that keeps the integration removes them. + */ + private static void carryMetadataStates(DeviceInstalledItemDescriptor previous, Set tracked, Map state) { + if (previous.getInstallState() == null) { + return; + } + Set recorded = new HashSet<>(); + state.values().forEach(s -> { + UUID id = toUuid(s.path("entityOutput").path("id").asText()); + if (id != null) { + recorded.add(id); + } + }); + previous.getInstallState().forEach((key, previousState) -> { + UUID id = previousState != null ? toUuid(previousState.path("entityOutput").path("id").asText()) : null; + if (id != null && tracked.contains(id) && !recorded.contains(id) && previousState.has("metadata") && !state.containsKey(key)) { + state.put(key, previousState.deepCopy()); + } + }); + } + + /** The entries the step adds to the integration's metadata, which a delete of the package removes; null when none. */ + private static ObjectNode addedMetadata(JsonNode entries) { + if (entries == null || !entries.isObject()) { + return null; + } + ObjectNode added = JacksonUtil.newObjectNode(); + entries.fields().forEachRemaining(entry -> { + if (entry.getValue() != null && !entry.getValue().isNull()) { + added.put(entry.getKey(), entry.getValue().asText()); + } + }); + return added.isEmpty() ? null : added; + } + + /** + * A copy of the integration with the step's metadata entries merged into its metadata; null when that changes nothing. + * A copy: the integration may be the cache's own instance, which a rolled back update must not change. + */ + private static Integration withMergedMetadata(Integration integration, JsonNode entries) { + if (entries == null || !entries.isObject() || entries.isEmpty()) { + return null; + } + Integration copy = new Integration(integration); + ObjectNode configuration = copy.getConfiguration() instanceof ObjectNode current ? current : JacksonUtil.newObjectNode(); + JsonNode before = configuration.get("metadata"); + ObjectNode metadata = before instanceof ObjectNode current ? current.deepCopy() : JacksonUtil.newObjectNode(); + entries.fields().forEachRemaining(entry -> { + if (entry.getValue() == null || entry.getValue().isNull()) { + metadata.remove(entry.getKey()); + } else { + metadata.put(entry.getKey(), entry.getValue().asText()); + } + }); + if (metadata.equals(before) || (metadata.isEmpty() && before == null)) { + return null; + } + configuration.set("metadata", metadata); + copy.setConfiguration(configuration); + return copy; + } + + + /** + * The overwritten entity keeps its id and its current name (the user may have renamed it). The version the + * user reviewed makes the save fail if someone changed the entity since. + */ + private void prepareOverwrite(Object entity, EntityId id, Object current, DeviceUpdateRequest.Step step) { + switch (entity) { + case DeviceProfile p -> { p.setId((DeviceProfileId) id); p.setName(((DeviceProfile) current).getName()); } + case Device d -> { d.setId((DeviceId) id); d.setName(((Device) current).getName()); } + case Dashboard d -> { d.setId((DashboardId) id); d.setTitle(((Dashboard) current).getTitle()); } + case RuleChain r -> { r.setId((RuleChainId) id); r.setName(((RuleChain) current).getName()); } + case Converter c -> { c.setId((ConverterId) id); c.setName(((Converter) current).getName()); } + case Integration i -> { i.setId((IntegrationId) id); i.setName(((Integration) current).getName()); } + default -> throw new IllegalArgumentException("Unsupported entity: " + entity.getClass().getSimpleName()); + } + Long currentVersion = ((HasVersion) current).getVersion(); + if (step.getExpectedVersion() != null && !step.getExpectedVersion().equals(currentVersion)) { + throw new EntityVersionMismatchException(id.getEntityType(), null); + } + ((HasVersion) entity).setVersion(currentVersion); + } + + private T existing(TenantId tenantId, T current, DeviceUpdateRequest.Step step) { + if (current == null || !tenantId.equals(((HasTenantId) current).getTenantId())) { + throw new IllegalArgumentException(step.getName() + " was deleted. Check the update again."); + } + return current; + } + + private StepResult kept(EntityId id, String name) { + return new StepResult(id, output(id, name), null, null); + } + + /** The checksum the installed version recorded for the entity, under whichever step it was installed with. */ + private static String previousChecksum(DeviceInstalledItemDescriptor previous, UUID entityId) { + if (previous.getInstallState() == null || entityId == null) { + return null; + } + for (JsonNode state : previous.getInstallState().values()) { + JsonNode checksum = state.get("checksum"); + if (entityId.toString().equals(state.path("entityOutput").path("id").asText()) && checksum != null && checksum.isTextual()) { + return checksum.asText(); + } + } + return null; + } + + /** + * The checksum is of the entity the save returned: a profile or an integration read back by id inside the + * transaction may come from the cache, which is evicted only after commit. A rule chain is read back with + * its metadata, which isn't cached. + */ + private StepResult savedResult(TenantId tenantId, EntityId id, Object entity, DeviceUpdateRequest.Step step, ObjectNode output) { + String checksum = entity instanceof RuleChain ? packageEntities.checksum(tenantId, id) : EntityChecksum.of(entity); + return new StepResult(id, output, checksum, new SavedEntity(id, entity, step.getAction() == DeviceUpdateRequest.Action.CREATE)); + } + + private static ObjectNode output(EntityId id, String name) { + ObjectNode output = JacksonUtil.newObjectNode(); + output.put("id", id.getId().toString()); + output.put("name", name); + return output; + } + + /** With what the install instructions resolve: ${integration.routingKey}, ${integration.httpEndpoint}, ${integration.baseUrl}. */ + private static ObjectNode integrationOutput(Integration integration) { + ObjectNode output = output(integration.getId(), integration.getName()); + output.put("routingKey", integration.getRoutingKey()); + JsonNode configuration = integration.getConfiguration() != null ? integration.getConfiguration() : JacksonUtil.newObjectNode(); + JsonNode client = configuration.path("clientConfiguration"); + putText(output, "httpEndpoint", client.path("httpEndpoint"), configuration.path("httpEndpoint")); + putText(output, "baseUrl", client.path("baseUrl"), configuration.path("baseUrl")); + return output; + } + + private static void putText(ObjectNode output, String key, JsonNode first, JsonNode second) { + JsonNode value = first.isTextual() ? first : second; + if (value.isTextual()) { + output.put(key, value.asText()); + } + } + + /** Replaces ${.} of entities this update has saved, e.g. the id of a converter it created. */ + static JsonNode resolvePlaceholders(JsonNode node, Map aliasOutputs) { + if (node == null) { + return null; + } + if (node.isTextual()) { + String text = node.asText(); + Matcher matcher = ENTITY_PLACEHOLDER.matcher(text); + StringBuilder resolved = new StringBuilder(); + boolean changed = false; + while (matcher.find()) { + ObjectNode output = aliasOutputs.get(matcher.group(1)); + JsonNode value = output != null ? output.get(matcher.group(2)) : null; + String replacement = value != null && !value.isNull() ? value.asText() : matcher.group(); + changed |= value != null && !value.isNull(); + matcher.appendReplacement(resolved, Matcher.quoteReplacement(replacement)); + } + matcher.appendTail(resolved); + return changed ? TextNode.valueOf(resolved.toString()) : node; + } + if (node.isObject()) { + ObjectNode copy = JacksonUtil.newObjectNode(); + for (Iterator> it = node.fields(); it.hasNext(); ) { + Map.Entry field = it.next(); + copy.set(field.getKey(), resolvePlaceholders(field.getValue(), aliasOutputs)); + } + return copy; + } + if (node.isArray()) { + ArrayNode copy = JacksonUtil.newArrayNode(); + node.forEach(item -> copy.add(resolvePlaceholders(item, aliasOutputs))); + return copy; + } + return node; + } + + /** + * The ids the package tracks: the entities of this version's steps, and those of the installed version this one + * no longer uses, so deleting the package still deletes them. Entities deleted since are dropped. + */ + private List createdEntityIds(TenantId tenantId, DeviceInstalledItemDescriptor previous, List stepEntityIds) { + List ids = new ArrayList<>(stepEntityIds); + Set known = new HashSet<>(); + ids.forEach(id -> known.add(id.getId())); + if (previous.getCreatedEntityIds() != null) { + for (EntityId id : previous.getCreatedEntityIds()) { + if (known.add(id.getId()) && entityService.fetchEntity(tenantId, id).isPresent()) { + ids.add(id); + } + } + } + return ids; + } + + private DashboardId existingDashboard(TenantId tenantId, DeviceInstalledItemDescriptor previous) { + DashboardId id = previous.getDashboardId(); + return id != null && dashboardService.findDashboardById(tenantId, id) != null ? id : null; + } + + /** What isn't transactional: the audit log, version control and attributes. A failure here doesn't undo the update. */ + private void afterCommit(SecurityUser user, TenantId tenantId, Applied applied) { + for (SavedEntity saved : applied.saved()) { + try { + logEntityActionService.logEntityAction(tenantId, saved.id(), (HasName) saved.entity(), + saved.created() ? ActionType.ADDED : ActionType.UPDATED, user); + if (saved.id().getEntityType() != EntityType.DEVICE) { + autoCommit(user, saved.id()); + } + } catch (Exception e) { + log.warn("[{}] Failed to log the device package update of {}", tenantId, saved.id(), e); + } + } + for (StepAttributes step : applied.attributes()) { + try { + saveAttributes(tenantId, step.entityId(), AttributeScope.SERVER_SCOPE, step.server()); + saveAttributes(tenantId, step.entityId(), AttributeScope.SHARED_SCOPE, step.shared()); + } catch (Exception e) { + log.warn("[{}] Failed to save the attributes of device package step [{}]", tenantId, step.stepName(), e); + } + } + for (DeviceUpdateRequest.Step step : applied.connectorSteps()) { + try { + saveConnector(tenantId, applied.aliasOutputs().get("gateway"), step.getEntity()); + } catch (Exception e) { + log.warn("[{}] Failed to save the gateway connector of device package step [{}]", tenantId, step.getName(), e); + } + } + } + + private void saveConnector(TenantId tenantId, ObjectNode gateway, JsonNode connector) throws Exception { + if (gateway == null || connector == null || !connector.has("name")) { + return; + } + DeviceId gatewayId = new DeviceId(UUID.fromString(gateway.get("id").asText())); + String name = connector.get("name").asText(); + List active = new ArrayList<>(); + for (AttributeKvEntry entry : attributesService.find(tenantId, gatewayId, AttributeScope.SHARED_SCOPE, List.of("active_connectors")).get()) { + JsonNode value = JacksonUtil.toJsonNode(entry.getValueAsString()); + if (value != null && value.isArray()) { + value.forEach(v -> active.add(v.asText())); + } + } + if (!active.contains(name)) { + active.add(name); + } + ObjectNode attributes = JacksonUtil.newObjectNode(); + attributes.set("active_connectors", JacksonUtil.valueToTree(active)); + attributes.set(name, connector); + saveAttributes(tenantId, gatewayId, AttributeScope.SHARED_SCOPE, attributes); + } + + private void saveAttributes(TenantId tenantId, EntityId entityId, AttributeScope scope, JsonNode attributes) { + if (attributes == null || !attributes.isObject() || attributes.isEmpty()) { + return; + } + List entries = JsonConverter.convertToAttributes(JsonParser.parseString(attributes.toString())); + telemetryService.saveAttributes(AttributesSaveRequest.builder() + .tenantId(tenantId) + .entityId(entityId) + .scope(scope) + .entries(entries) + .build()); + } + + /** + * The message the wizard shows: the ones validation and limits give, as they are; anything else, e.g. a database + * error, as a common message, with the details in the log. + */ + static String userMessage(Throwable e) { + if (e instanceof EntityVersionMismatchException) { + return "Someone changed it while you were reviewing the update. Check the update again."; + } + if (e instanceof DataValidationException || e instanceof EntitiesLimitExceededException || e instanceof IllegalArgumentException + || e instanceof SubscriptionException) { + return e.getMessage(); + } + if (e instanceof ThingsboardException te && te.getErrorCode() != ThingsboardErrorCode.GENERAL) { + return te.getMessage(); + } + return UNEXPECTED_ERROR; + } + + private static boolean isKnownType(String type) { + return type != null && (STEP_ALIASES.containsKey(type) || "GATEWAY_CONNECTOR".equals(type)); + } + + /** + * The entities the package owns: those it created, not the ones the user chose to use as they were. The install adds + * those to createdEntityIds too, so they are subtracted; an entity of a step a later version dropped stays owned. + */ + private static Set ownedIds(DeviceInstalledItemDescriptor descriptor) { + Set ids = new HashSet<>(createdIds(descriptor).keySet()); + ids.removeAll(usedExistingIds(descriptor).keySet()); + return ids; + } + + /** + * The entities the user chose to use as they were. An install made before the descriptor kept them has them only in + * its install state, which the first update carries over into the descriptor. + */ + private static Map usedExistingIds(DeviceInstalledItemDescriptor descriptor) { + Map ids = new LinkedHashMap<>(); + if (descriptor.getUsedExistingEntityIds() != null) { + descriptor.getUsedExistingEntityIds().forEach(id -> ids.put(id.getId(), id)); + return ids; + } + Map createdIds = createdIds(descriptor); + if (descriptor.getInstallState() != null) { + descriptor.getInstallState().values().forEach(state -> { + UUID id = toUuid(state.path("entityOutput").path("id").asText()); + if (id != null && "use-existing".equals(state.path("resolution").asText()) && createdIds.containsKey(id)) { + ids.put(id, createdIds.get(id)); + } + }); + } + return ids; + } + + private static Map createdIds(DeviceInstalledItemDescriptor descriptor) { + Map ids = new HashMap<>(); + if (descriptor.getCreatedEntityIds() != null) { + descriptor.getCreatedEntityIds().forEach(id -> ids.put(id.getId(), id)); + } + return ids; + } + + private static DeviceUpdateRequest.Step copyWithEntity(DeviceUpdateRequest.Step step, JsonNode entity) { + DeviceUpdateRequest.Step copy = JacksonUtil.treeToValue(JacksonUtil.valueToTree(step), DeviceUpdateRequest.Step.class); + if (entity != null) { + copy.setEntity(entity); + } + return copy; + } + + private record DevicePackage(IotHubInstalledItem installedItem, DeviceInstalledItemDescriptor descriptor) { + } + + private record StepResult(EntityId entityId, ObjectNode output, String checksum, SavedEntity saved) { + } + + private record SavedEntity(EntityId id, Object entity, boolean created) { + } + + private record StepAttributes(String stepName, EntityId entityId, JsonNode server, JsonNode shared) { + } + + private record Applied(DeviceInstalledItemDescriptor descriptor, Map outputs, List saved, + List connectorSteps, List attributes, + Map aliasOutputs) { + } + + /** A step that failed: the transaction rolls back, and the wizard shows which step it was. */ + private static class StepFailure extends RuntimeException { + + private final String stepName; + + StepFailure(String stepName, Throwable cause) { + super(cause.getMessage(), cause); + this.stepName = stepName; + } + + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultIotHubService.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultIotHubService.java index 06ef375109..ddbe8ec5d7 100644 --- a/application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultIotHubService.java +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultIotHubService.java @@ -4,6 +4,7 @@ package org.thingsboard.server.service.iot_hub; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -32,6 +33,7 @@ import org.thingsboard.server.common.data.id.IntegrationId; import org.thingsboard.server.common.data.id.IotHubInstalledItemId; import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; import org.thingsboard.server.common.data.iot_hub.AlarmRuleInstalledItemDescriptor; import org.thingsboard.server.common.data.iot_hub.CalculatedFieldInstalledItemDescriptor; import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor; @@ -42,6 +44,8 @@ import org.thingsboard.server.common.data.iot_hub.SolutionTemplateInstalledItemD import org.thingsboard.server.common.data.iot_hub.WidgetInstalledItemDescriptor; import org.thingsboard.server.common.data.subscription.SubscriptionException; import org.thingsboard.server.exception.EntitiesLimitExceededException; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.service.solutions.SolutionService; import org.thingsboard.server.service.solutions.data.solution.SolutionInstallResponse; import org.thingsboard.server.common.data.permission.Operation; @@ -58,6 +62,7 @@ import org.thingsboard.server.dao.dashboard.DashboardService; import org.thingsboard.server.dao.device.DeviceProfileService; import org.thingsboard.server.dao.device.DeviceService; import org.thingsboard.server.dao.group.EntityGroupService; +import org.thingsboard.server.dao.entity.EntityService; import org.thingsboard.server.dao.integration.IntegrationService; import org.thingsboard.server.dao.iot_hub.IotHubInstalledItemService; import org.thingsboard.server.dao.rule.RuleChainService; @@ -79,10 +84,13 @@ import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; import java.util.HashSet; import java.util.HexFormat; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.UUID; @@ -118,6 +126,7 @@ public class DefaultIotHubService implements IotHubService { private final CalculatedFieldService calculatedFieldService; private final DeviceProfileService deviceProfileService; private final DeviceService deviceService; + private final EntityService entityService; private final TbDeviceService tbDeviceService; private final SolutionService solutionService; private final EntityGroupService entityGroupService; @@ -127,6 +136,7 @@ public class DefaultIotHubService implements IotHubService { private final ConverterService converterService; private final TbConverterService tbConverterService; private final ProjectInfo projectInfo; + private final DevicePackageEntities devicePackageEntities; // Field names of the marketplace version JSON payload. Both the install path and the // install-plan resolver parse the same shape, so the contract lives here in one place. @@ -410,6 +420,10 @@ public class DefaultIotHubService implements IotHubService { } String itemType = installedItem.getItemType(); + if ("DEVICE".equals(itemType)) { + // Updated in one transaction from the install wizard of the new version, see DevicePackageUpdateService + throw new IllegalArgumentException("A device package is updated by the install wizard of the new version"); + } IotHubInstalledItemDescriptor descriptor = installedItem.getDescriptor(); // Skip checksum validation for solution templates @@ -454,12 +468,6 @@ public class DefaultIotHubService implements IotHubService { case "CALCULATED_FIELD" -> updateCalculatedField(user, tenantId, (CalculatedFieldInstalledItemDescriptor) descriptor, fileData); case "ALARM_RULE" -> updateAlarmRule(user, tenantId, (AlarmRuleInstalledItemDescriptor) descriptor, fileData); case "RULE_CHAIN" -> updateRuleChain(tenantId, (RuleChainInstalledItemDescriptor) descriptor, fileData); - case "DEVICE" -> { - DeviceInstalledItemDescriptor dd = (DeviceInstalledItemDescriptor) descriptor; - deleteDevicePackageEntities(tenantId, dd.getCreatedEntityIds(), user); - dd.setCreatedEntityIds(null); - dd.setDashboardId(null); - } case "SOLUTION_TEMPLATE" -> { SolutionTemplateInstalledItemDescriptor stDescriptor = (SolutionTemplateInstalledItemDescriptor) descriptor; solutionService.deleteSolution(tenantId, stDescriptor, user); @@ -673,6 +681,8 @@ public class DefaultIotHubService implements IotHubService { installedItem.setItemName(itemName); installedItem.setItemType("DEVICE"); installedItem.setVersion(version); + // So that an update can tell whether someone changed an entity since + devicePackageEntities.addChecksums(tenantId, descriptor); installedItem.setDescriptor(descriptor); try { iotHubInstalledItemService.save(tenantId, installedItem); @@ -704,13 +714,41 @@ public class DefaultIotHubService implements IotHubService { } } - private void deleteDevicePackageEntities(TenantId tenantId, List createdEntityIds, SecurityUser user) { + private static final Map DELETE_ORDER = Map.of(EntityType.DEVICE, 0, EntityType.DEVICE_PROFILE, 1, + EntityType.DASHBOARD, 2, EntityType.RULE_CHAIN, 3, EntityType.INTEGRATION, 4, EntityType.CONVERTER, 5); + + /** + * Deletes what a device package created, except the entities another installed device package + * also uses (e.g. an integration it took over with Overwrite): deleting those would break that package, + * and the ones the user had before and the package took as they were (use existing). + * A kept integration loses the metadata entries the package added. + */ + private void deleteDevicePackageEntities(TenantId tenantId, IotHubInstalledItemId installedItemId, + DeviceInstalledItemDescriptor descriptor, SecurityUser user) { + List createdEntityIds = descriptor.getCreatedEntityIds(); if (createdEntityIds == null || createdEntityIds.isEmpty()) { return; } - List reversed = new ArrayList<>(createdEntityIds); - Collections.reverse(reversed); - for (EntityId entityId : reversed) { + Set usedExisting = usedExistingIds(descriptor); + List otherPackages = new ArrayList<>(); + Map> usedByOtherPackages = findEntitiesOfOtherDevicePackages(tenantId, installedItemId, otherPackages); + // An entity goes before what it refers to: a device before its profile, a profile before its default dashboard + // and rule chain, an integration before its converters. Within a type, the reverse of the creation order. + List ordered = new ArrayList<>(createdEntityIds); + Collections.reverse(ordered); + ordered.sort(Comparator.comparingInt(id -> DELETE_ORDER.getOrDefault(id.getEntityType(), DELETE_ORDER.size()))); + for (EntityId entityId : ordered) { + if (usedExisting.contains(entityId.getId())) { + log.info("[{}] Kept {} {}: the package took it as it was", tenantId, entityId.getEntityType(), entityId.getId()); + removeIntegrationMetadata(tenantId, entityId, descriptor, otherPackages); + continue; + } + Set usedBy = usedByOtherPackages.get(entityId.getId()); + if (usedBy != null) { + log.info("[{}] Kept {} {}: installed device packages {} use it", tenantId, entityId.getEntityType(), entityId.getId(), usedBy); + removeIntegrationMetadata(tenantId, entityId, descriptor, otherPackages); + continue; + } try { deleteDevicePackageEntity(tenantId, entityId, user); } catch (Exception e) { @@ -719,6 +757,113 @@ public class DefaultIotHubService implements IotHubService { } } + /** + * Removes from the kept integration's metadata the entries the package added, e.g. the profile name its converter + * reads, so that a later package of that model gets the default profile again. An entry another installed package + * also added stays. + */ + private void removeIntegrationMetadata(TenantId tenantId, EntityId entityId, DeviceInstalledItemDescriptor descriptor, + List otherPackages) { + if (entityId.getEntityType() != EntityType.INTEGRATION) { + return; + } + Set keys = addedMetadataKeys(descriptor, entityId.getId()); + otherPackages.forEach(other -> keys.removeAll(addedMetadataKeys(other, entityId.getId()))); + if (keys.isEmpty()) { + return; + } + try { + Integration integration = integrationService.findIntegrationById(tenantId, new IntegrationId(entityId.getId())); + if (integration == null || !(integration.getConfiguration() != null + && integration.getConfiguration().get("metadata") instanceof ObjectNode metadata) + || keys.stream().noneMatch(metadata::has)) { + return; + } + // A copy: the integration read may be the cache's own instance + Integration copy = new Integration(integration); + ((ObjectNode) copy.getConfiguration().get("metadata")).remove(keys); + integrationService.saveIntegration(copy); + log.info("[{}] Removed metadata entries {} of the deleted device package from integration {}", tenantId, keys, entityId.getId()); + } catch (Exception e) { + log.error("[{}] Failed to remove the deleted device package's metadata entries from integration {}", tenantId, entityId.getId(), e); + } + } + + /** The metadata entries the package's steps on the integration added, as its install state records them. */ + private static Set addedMetadataKeys(DeviceInstalledItemDescriptor descriptor, UUID integrationId) { + Set keys = new HashSet<>(); + if (descriptor.getInstallState() != null) { + descriptor.getInstallState().values().forEach(state -> { + if (state != null && integrationId.toString().equals(state.path("entityOutput").path("id").asText()) + && state.get("metadata") instanceof ObjectNode metadata) { + metadata.fieldNames().forEachRemaining(keys::add); + } + }); + } + return keys; + } + + /** The delete dialog shows these before the user confirms, so they must match what {@link #deleteDevicePackageEntities} keeps. */ + @Override + public InstalledItemKeptEntities findKeptEntities(TenantId tenantId, IotHubInstalledItemId installedItemId) { + IotHubInstalledItem installedItem = iotHubInstalledItemService.findById(tenantId, installedItemId); + if (installedItem == null) { + throw new IllegalArgumentException("Installed item not found"); + } + List kept = new ArrayList<>(); + Set usedByItems = new HashSet<>(); + int usedExistingCount = 0; + if (installedItem.getDescriptor() instanceof DeviceInstalledItemDescriptor dd && dd.getCreatedEntityIds() != null) { + Set usedExisting = usedExistingIds(dd); + Map> usedByOtherPackages = findEntitiesOfOtherDevicePackages(tenantId, installedItemId, new ArrayList<>()); + for (EntityId entityId : dd.getCreatedEntityIds()) { + Set usedBy = usedByOtherPackages.get(entityId.getId()); + boolean taken = usedExisting.contains(entityId.getId()); + if (usedBy != null || taken) { + kept.add(new InstalledItemKeptEntities.KeptEntity(entityId, entityService.fetchEntityName(tenantId, entityId).orElse(null))); + } + if (usedBy != null) { + usedByItems.addAll(usedBy); + } + if (taken) { + usedExistingCount++; + } + } + } + return new InstalledItemKeptEntities(kept, usedByItems.size(), usedExistingCount); + } + + /** The entities the package took as they were at install (use existing); none for installs before 4.4.1 kept them. */ + private static Set usedExistingIds(DeviceInstalledItemDescriptor descriptor) { + Set ids = new HashSet<>(); + if (descriptor.getUsedExistingEntityIds() != null) { + descriptor.getUsedExistingEntityIds().forEach(id -> ids.add(id.getId())); + } + return ids; + } + + /** The other installed device packages' entities, by id; the packages' descriptors go to {@code otherPackages}. */ + private Map> findEntitiesOfOtherDevicePackages(TenantId tenantId, IotHubInstalledItemId installedItemId, + List otherPackages) { + Map> usedBy = new HashMap<>(); + PageLink pageLink = new PageLink(100); + PageData page; + do { + page = iotHubInstalledItemService.findByTenantId(tenantId, List.of("DEVICE"), null, pageLink); + for (IotHubInstalledItem item : page.getData()) { + if (item.getId().equals(installedItemId) || !(item.getDescriptor() instanceof DeviceInstalledItemDescriptor dd)) { + continue; + } + otherPackages.add(dd); + if (dd.getCreatedEntityIds() != null) { + dd.getCreatedEntityIds().forEach(id -> usedBy.computeIfAbsent(id.getId(), k -> new HashSet<>()).add(item.getId())); + } + } + pageLink = pageLink.nextPageLink(); + } while (page.hasNext()); + return usedBy; + } + private void deleteDevicePackageEntity(TenantId tenantId, EntityId entityId, SecurityUser user) throws ThingsboardException { switch (entityId.getEntityType()) { case DEVICE -> { @@ -797,7 +942,7 @@ public class DefaultIotHubService implements IotHubService { } } } else if (descriptor instanceof DeviceInstalledItemDescriptor dd) { - deleteDevicePackageEntities(tenantId, dd.getCreatedEntityIds(), user); + deleteDevicePackageEntities(tenantId, installedItemId, dd, user); } else if (descriptor instanceof SolutionTemplateInstalledItemDescriptor st) { try { solutionService.deleteSolution(tenantId, st, user); diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageEntities.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageEntities.java new file mode 100644 index 0000000000..18c7540a2b --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageEntities.java @@ -0,0 +1,119 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.HasTenantId; +import org.thingsboard.server.common.data.HasVersion; +import org.thingsboard.server.common.data.id.ConverterId; +import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.DeviceProfileId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.IntegrationId; +import org.thingsboard.server.common.data.id.RuleChainId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor; +import org.thingsboard.server.common.data.rule.RuleChain; +import org.thingsboard.server.dao.converter.ConverterService; +import org.thingsboard.server.dao.dashboard.DashboardService; +import org.thingsboard.server.dao.device.DeviceProfileService; +import org.thingsboard.server.dao.integration.IntegrationService; +import org.thingsboard.server.dao.rule.RuleChainService; +import org.thingsboard.server.queue.util.TbCoreComponent; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +/** + * The entities of a device package whose content an update overwrites, and their checksums. A device, a gateway + * and a gateway connector don't have one: an update never changes them. + */ +@Component +@TbCoreComponent +@RequiredArgsConstructor +public class DevicePackageEntities { + + static final Set CHECKSUM_TYPES = Set.of(EntityType.DEVICE_PROFILE, EntityType.DASHBOARD, + EntityType.RULE_CHAIN, EntityType.CONVERTER, EntityType.INTEGRATION); + + private final DeviceProfileService deviceProfileService; + private final DashboardService dashboardService; + private final RuleChainService ruleChainService; + private final ConverterService converterService; + private final IntegrationService integrationService; + + /** The entity of the tenant, null when there is none, e.g. it was deleted. A rule chain comes with its metadata. */ + public Snapshot load(TenantId tenantId, EntityId entityId) { + Object entity = switch (entityId.getEntityType()) { + case DEVICE_PROFILE -> deviceProfileService.findDeviceProfileById(tenantId, (DeviceProfileId) entityId); + case DASHBOARD -> dashboardService.findDashboardById(tenantId, (DashboardId) entityId); + case RULE_CHAIN -> ruleChainService.findRuleChainById(tenantId, (RuleChainId) entityId); + case CONVERTER -> converterService.findConverterById(tenantId, (ConverterId) entityId); + case INTEGRATION -> integrationService.findIntegrationById(tenantId, (IntegrationId) entityId); + default -> throw new IllegalArgumentException("Unsupported entity type: " + entityId.getEntityType()); + }; + if (entity == null || !tenantId.equals(((HasTenantId) entity).getTenantId())) { + return null; + } + Object metadata = entity instanceof RuleChain ruleChain ? ruleChainService.loadRuleChainMetaData(tenantId, ruleChain.getId()) : null; + return new Snapshot(entity, metadata); + } + + public String checksum(TenantId tenantId, EntityId entityId) { + Snapshot snapshot = load(tenantId, entityId); + return snapshot != null ? snapshot.checksum() : null; + } + + /** + * Adds the checksum of each entity the install state names, so that an update can tell whether someone changed + * it since. Entities the user kept at install are left out: an update never overwrites them. + */ + public void addChecksums(TenantId tenantId, DeviceInstalledItemDescriptor descriptor) { + if (descriptor.getInstallState() == null || descriptor.getCreatedEntityIds() == null) { + return; + } + Map createdIds = new HashMap<>(); + descriptor.getCreatedEntityIds().forEach(id -> createdIds.put(id.getId(), id)); + descriptor.getInstallState().forEach((stepName, state) -> { + EntityId entityId = entityIdOf(state, createdIds); + if (entityId != null && CHECKSUM_TYPES.contains(entityId.getEntityType()) && state.isObject()) { + String checksum = checksum(tenantId, entityId); + if (checksum != null) { + ((ObjectNode) state).put("checksum", checksum); + } + } + }); + } + + /** The package entity an install-state step recorded, with its type from the ids the package created. */ + static EntityId entityIdOf(JsonNode state, Map createdIds) { + JsonNode id = state != null ? state.path("entityOutput").path("id") : null; + if (id == null || !id.isTextual() || "use-existing".equals(state.path("resolution").asText())) { + return null; + } + try { + return createdIds.get(UUID.fromString(id.asText())); + } catch (IllegalArgumentException e) { + return null; + } + } + + public record Snapshot(Object entity, Object metadata) { + + public Long version() { + return ((HasVersion) entity).getVersion(); + } + + public String checksum() { + return metadata != null ? EntityChecksum.of(entity, metadata) : EntityChecksum.of(entity); + } + + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageEntityState.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageEntityState.java new file mode 100644 index 0000000000..92e7b93ce2 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageEntityState.java @@ -0,0 +1,27 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.thingsboard.server.common.data.id.EntityId; + +/** An entity of an installed device package as an update finds it, before it changes anything. */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DevicePackageEntityState { + + private String stepName; + private EntityId entityId; + private boolean exists; + // Sent back with the update, which fails if someone changed the entity in between + private Long version; + // Changed since the package installed or last updated it; null when the install state has no checksum of it + // (installed before checksums were kept) + private Boolean modified; + // Other installed device packages use it, so overwriting it affects them + private boolean shared; + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageUpdateService.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageUpdateService.java new file mode 100644 index 0000000000..5688056c98 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/DevicePackageUpdateService.java @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import org.thingsboard.server.common.data.id.IotHubInstalledItemId; +import org.thingsboard.server.service.security.model.SecurityUser; + +import java.util.List; + +/** Updates an installed device package to another version of its item. */ +public interface DevicePackageUpdateService { + + /** The package's entities as they are now: whether they still exist, changed since, or are shared. */ + List check(SecurityUser user, IotHubInstalledItemId installedItemId); + + /** Applies the update in one transaction, together with the new version of the installed item, or nothing. */ + DeviceUpdateResult apply(SecurityUser user, IotHubInstalledItemId installedItemId, DeviceUpdateRequest request); + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/DeviceUpdateRequest.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/DeviceUpdateRequest.java new file mode 100644 index 0000000000..13a9c2937e --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/DeviceUpdateRequest.java @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import com.fasterxml.jackson.databind.JsonNode; +import lombok.Data; + +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * The update of an installed device package as the install wizard planned it: the entity of each install step + * of the new version, already resolved from its template, and what to do with it. The server applies all of it + * in one transaction, together with the new version of the installed item, or nothing. + */ +@Data +public class DeviceUpdateRequest { + + private String versionId; + // The version installed when the wizard planned the update; the update fails if the package changed since + private UUID fromVersionId; + // The install method of the new version's steps; the installed one when not set + private String selectedInstallMethod; + // The form values of the install state, by step: the server adds the entities to it + private Map installState; + private List steps; + + public enum Action { + // Taken as it is: the new version doesn't change it, or the user kept an entity they had + KEEP, + // Takes the entity from the step + OVERWRITE, + // A new entity: new in this version, deleted since install, or a copy next to one with the same name + CREATE + } + + @Data + public static class Step { + private String name; + // The package step's id, which keys its install state; the name when not set + private String id; + // InstallStepType of the package: DEVICE_PROFILE, DEVICE, GATEWAY, GATEWAY_CONNECTOR, DASHBOARD, RULE_CHAIN, + // UPLINK_CONVERTER, DOWNLINK_CONVERTER, INTEGRATION + private String type; + private Action action; + // KEEP and OVERWRITE: the entity + private UUID entityId; + // OVERWRITE: the version the user reviewed; a different one means someone changed the entity since + private Long expectedVersion; + // The user confirmed overwriting an entity of another package or one they didn't install with this package + private boolean confirmed; + // OVERWRITE and CREATE: the entity resolved from the template. ${.} of an entity this + // update creates is left for the server, which knows its id only once it is created. + private JsonNode entity; + // DEVICE and GATEWAY: the credentials template, if any + private JsonNode credentials; + // OVERWRITE and CREATE: the attributes of the saved entity, written after the transaction. Like the entity, + // they may keep ${.} of an entity this update creates. + private JsonNode serverAttributes; + private JsonNode sharedAttributes; + // The resolution the install state records for it + private String resolution; + // INTEGRATION: the step's metadata entries, which the package's converter reads. A KEEP merges them into the + // integration, e.g. one the package took as it was; null removes an entry + private JsonNode metadata; + // UPLINK_CONVERTER: the step takes ThingsBoard's default converter, which the install state records for the update check + private boolean defaultConverter; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/DeviceUpdateResult.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/DeviceUpdateResult.java new file mode 100644 index 0000000000..c229f42cff --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/DeviceUpdateResult.java @@ -0,0 +1,37 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor; + +import java.util.Map; + +/** + * Either everything was applied, or nothing was: on a failure the transaction was rolled back and failedStep + * names the step that failed, if one did. + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DeviceUpdateResult { + + private boolean success; + private String errorMessage; + private String failedStep; + private DeviceInstalledItemDescriptor descriptor; + // By step name: what the install instructions resolve, e.g. ${integration.httpEndpoint}, ${device.token} + private Map outputs; + + public static DeviceUpdateResult success(DeviceInstalledItemDescriptor descriptor, Map outputs) { + return new DeviceUpdateResult(true, null, null, descriptor, outputs); + } + + public static DeviceUpdateResult error(String errorMessage, String failedStep) { + return new DeviceUpdateResult(false, errorMessage, failedStep, null, null); + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/EntityChecksum.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/EntityChecksum.java new file mode 100644 index 0000000000..58a41b9d20 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/EntityChecksum.java @@ -0,0 +1,116 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.integration.Integration; +import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.common.data.rule.RuleNode; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.HexFormat; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +/** + * The checksum of an entity as the server stores it, kept in the install state of a device package. A different + * checksum later means someone changed the entity, even a widget resized. The fields the server sets, and the name, + * which an update keeps, don't count, nor do the debug settings, which the user turns on without changing what the + * entity does, and whether a profile is the default one, which changes when another profile becomes the default. + */ +final class EntityChecksum { + + private static final Set SKIPPED_KEYS = Set.of("id", "name", "title", "version", "createdTime", "tenantId", + "customerId", "ownerId", "assignedCustomers", "externalId", "ruleChainId", "resources", "debugMode", "debugSettings", "default"); + + private EntityChecksum() { + } + + /** A rule chain is checked with its metadata: pass both. */ + static String of(Object... parts) { + StringBuilder canonical = new StringBuilder(); + for (Object part : parts) { + JsonNode node = part instanceof RuleChainMetaData metadata ? ruleChainContent(metadata) : JacksonUtil.valueToTree(part); + if (part instanceof Integration && node.get("configuration") instanceof ObjectNode configuration) { + // Device packages on one integration add their entries to its metadata: that is no change to the integration + configuration.remove("metadata"); + } + appendCanonical(canonical, node, true); + canonical.append('|'); + } + try { + byte[] hash = MessageDigest.getInstance("SHA-256").digest(canonical.toString().getBytes(StandardCharsets.UTF_8)); + return HexFormat.of().formatHex(hash); + } catch (NoSuchAlgorithmException e) { + throw new IllegalStateException(e); + } + } + + /** + * What a rule chain does, as the IoT Hub checksum of a rule chain item takes it: the nodes' type, name and + * configuration, and the connections. Node ids, layout and debug settings change without the user changing + * what the rule chain does, e.g. when it is saved again. + */ + private static JsonNode ruleChainContent(RuleChainMetaData metadata) { + ObjectNode content = JacksonUtil.newObjectNode(); + ArrayNode nodes = content.putArray("nodes"); + if (metadata.getNodes() != null) { + for (RuleNode node : metadata.getNodes()) { + ObjectNode n = nodes.addObject(); + n.put("type", node.getType()); + n.put("name", node.getName()); + n.set("configuration", node.getConfiguration()); + n.put("singletonMode", node.isSingletonMode()); + n.put("queueName", node.getQueueName()); + } + } + content.set("connections", JacksonUtil.valueToTree(metadata.getConnections())); + content.set("ruleChainConnections", JacksonUtil.valueToTree(metadata.getRuleChainConnections())); + content.set("firstNodeIndex", JacksonUtil.valueToTree(metadata.getFirstNodeIndex())); + return content; + } + + /** JSON with the keys sorted, so the same entity always gives the same text. */ + private static void appendCanonical(StringBuilder out, JsonNode node, boolean topLevel) { + if (node == null || node.isNull() || node.isMissingNode()) { + out.append("null"); + } else if (node.isObject()) { + List keys = new ArrayList<>(); + for (Iterator it = node.fieldNames(); it.hasNext(); ) { + String key = it.next(); + if (!topLevel || !SKIPPED_KEYS.contains(key)) { + keys.add(key); + } + } + keys.sort(null); + out.append('{'); + for (int i = 0; i < keys.size(); i++) { + if (i > 0) { + out.append(','); + } + out.append(JacksonUtil.toString(keys.get(i))).append(':'); + appendCanonical(out, node.get(keys.get(i)), false); + } + out.append('}'); + } else if (node.isArray()) { + out.append('['); + for (int i = 0; i < node.size(); i++) { + if (i > 0) { + out.append(','); + } + appendCanonical(out, node.get(i), false); + } + out.append(']'); + } else { + out.append(node.toString()); + } + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/InstalledItemKeptEntities.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/InstalledItemKeptEntities.java new file mode 100644 index 0000000000..ad517c5327 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/InstalledItemKeptEntities.java @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.thingsboard.server.common.data.id.EntityId; + +import java.util.List; + +/** What deleting an installed item keeps: what other installed items use too, and what the user had before it. */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class InstalledItemKeptEntities { + + private List entities; + // How many other installed items use at least one of the kept entities + private int usedByItemsCount; + // How many of the kept entities the user had before and the package took as they were (use existing) + private int usedExistingCount; + + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class KeptEntity { + private EntityId entityId; + private String name; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/iot_hub/IotHubService.java b/application/src/main/java/org/thingsboard/server/service/iot_hub/IotHubService.java index b934344e91..e1d0cd666b 100644 --- a/application/src/main/java/org/thingsboard/server/service/iot_hub/IotHubService.java +++ b/application/src/main/java/org/thingsboard/server/service/iot_hub/IotHubService.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.JsonNode; import jakarta.servlet.http.HttpServletRequest; import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.IotHubInstalledItemId; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor; import org.thingsboard.server.service.security.model.SecurityUser; @@ -20,6 +21,8 @@ public interface IotHubService { void deleteInstalledItem(SecurityUser user, IotHubInstalledItemId installedItemId); + InstalledItemKeptEntities findKeptEntities(TenantId tenantId, IotHubInstalledItemId installedItemId); + InstallPlan resolveInstallPlan(SecurityUser user, String versionId); InstallPlanResult installPlan(SecurityUser user, InstallPlan plan, JsonNode data, HttpServletRequest request); diff --git a/application/src/main/java/org/thingsboard/server/service/mail/EdgeMailRequest.java b/application/src/main/java/org/thingsboard/server/service/mail/EdgeMailRequest.java new file mode 100644 index 0000000000..0115ec7069 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/mail/EdgeMailRequest.java @@ -0,0 +1,67 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.service.mail; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.thingsboard.rule.engine.api.TbEmail; +import org.thingsboard.server.common.data.ApiFeature; +import org.thingsboard.server.common.data.ApiUsageRecordState; +import org.thingsboard.server.common.data.ApiUsageStateValue; + +/** + * Describes a mail send that the Edge delegates to the Cloud. On the Edge, a mail send that depends + * on admin-configured (tenant/system) mail settings is packaged into this request and enqueued as a + * SEND_EMAIL cloud event. On the Cloud, {@code method} selects the matching {@code MailService} call + * so the Cloud resolves the config, renders the template and transmits via its own SMTP. + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EdgeMailRequest { + + public enum MailMethod { + SEND_BASIC, // sendEmail(to, subject, message) + SEND_TB_EMAIL, // send(TbEmail) + ACTIVATION, // sendActivationEmail(activationLink, ttlMs, to) + ACCOUNT_ACTIVATED, // sendAccountActivatedEmail(loginLink, to) + RESET_PASSWORD, // sendResetPasswordEmail(passwordResetLink, ttlMs, to) + PASSWORD_WAS_RESET,// sendPasswordWasResetEmail(loginLink, to) + TWO_FA, // sendTwoFaVerificationEmail(to, verificationCode, expirationTimeSeconds) + ACCOUNT_LOCKOUT, // sendAccountLockoutEmail(lockoutEmail, to, maxFailedLoginAttempts) + API_USAGE_STATE, // sendApiFeatureStateEmail(apiFeature, stateValue, to, recordState) + TEST_MAIL // sendTestMail(config, to) + } + + private MailMethod method; + + private String to; + private String subject; + private String message; + + private TbEmail tbEmail; + + private String activationLink; + private String loginLink; + private String passwordResetLink; + private Long ttlMs; + + private String verificationCode; + private Integer expirationTimeSeconds; + + private String lockoutEmail; + private Integer maxFailedLoginAttempts; + + private ApiFeature apiFeature; + private ApiUsageStateValue stateValue; + private ApiUsageRecordState recordState; + + private JsonNode testConfig; + +} diff --git a/application/src/main/java/org/thingsboard/server/service/notification/EdgeNotificationRequest.java b/application/src/main/java/org/thingsboard/server/service/notification/EdgeNotificationRequest.java new file mode 100644 index 0000000000..03ded08ed9 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/notification/EdgeNotificationRequest.java @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.service.notification; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Describes a notification delivery that the Edge delegates to the Cloud, for channels whose credentials + * live only on the Cloud (they are stored in the {@code notifications} admin settings that no longer sync + * to the Edge). {@code method} selects the channel: + *

    + *
  • {@code SEND_SLACK} - the Cloud resolves the Slack bot token and posts {@code message} (plus any + * {@code files}) to {@code conversationId}. The whole send is delegated.
  • + *
  • {@code SEND_MOBILE_PUSH} - the Edge keeps the notification record, device-token lookup and unread + * count locally and delegates only the FCM push: the Cloud resolves the Firebase credentials and pushes + * the already-built payload ({@code subject}/{@code body}/{@code data}/{@code badge}) to every + * {@code fcmToken}.
  • + *
+ */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EdgeNotificationRequest { + + public enum NotificationMethod { + SEND_SLACK, + SEND_MOBILE_PUSH + } + + private NotificationMethod method; + + // SEND_SLACK + private String conversationId; + private String message; + private List files; + + // SEND_MOBILE_PUSH + private Set fcmTokens; + private String subject; + private String body; + private Map data; + private Integer badge; + + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class SlackFileData { + private String name; + private String type; + private byte[] data; + } + +} diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/rest/LoginResponse.java b/application/src/main/java/org/thingsboard/server/service/security/auth/rest/LoginResponse.java index dfe8ab50b9..6447fee218 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/rest/LoginResponse.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/rest/LoginResponse.java @@ -1,10 +1,16 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.service.security.auth.rest; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import org.thingsboard.server.common.data.security.Authority; +/** + * Documents the body that {@code /api/auth/login} and {@code /api/auth/token} write: a + * {@link org.thingsboard.server.common.data.security.model.JwtPair} serialized without null fields. + */ @Schema @Data public class LoginResponse { @@ -13,8 +19,13 @@ public class LoginResponse { example = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZW5hbnRAdGhpbmdzYm9hcmQub3JnIi...") private String token; - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Refresh token", + @Schema(description = "Refresh token. Absent when the token is a two-factor authentication token (see scope)", example = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZW5hbnRAdGhpbmdzYm9hcmQub3JnIi...") private String refreshToken; + @Schema(description = "Set only when two-factor authentication is required: PRE_VERIFICATION_TOKEN when the user " + + "must verify a code, MFA_CONFIGURATION_TOKEN when the user must configure two-factor authentication first. " + + "The token then grants access only to the two-factor authentication API") + private Authority scope; + } diff --git a/application/src/main/java/org/thingsboard/server/service/security/permission/CustomerUserPermissions.java b/application/src/main/java/org/thingsboard/server/service/security/permission/CustomerUserPermissions.java index 2eab59f385..632dae9836 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/permission/CustomerUserPermissions.java +++ b/application/src/main/java/org/thingsboard/server/service/security/permission/CustomerUserPermissions.java @@ -11,6 +11,7 @@ import org.thingsboard.server.common.data.HasOwnerId; import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.data.TbResourceInfo; import org.thingsboard.server.common.data.TenantEntity; +import org.thingsboard.server.common.data.ai.AiModel; import org.thingsboard.server.common.data.alarm.Alarm; import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; import org.thingsboard.server.common.data.exception.ThingsboardException; @@ -93,6 +94,7 @@ public class CustomerUserPermissions extends AbstractPermissions { put(Resource.REPORT_TEMPLATE, reportTemplatePermissionChecker); put(Resource.REPORT, customerStandaloneEntityPermissionChecker); put(Resource.API_KEY, apiKeysPermissionChecker); + put(Resource.AI_MODEL, aiModelPermissionChecker); } private final PermissionChecker customerAlarmPermissionChecker = new PermissionChecker<>() { @@ -227,7 +229,7 @@ public class CustomerUserPermissions extends AbstractPermissions { } } } else { - if (operation == Operation.CLAIM_DEVICES) { + if (operation == Operation.CLAIM_DEVICES && user.getTenantId().equals(((HasOwnerId) entity).getOwnerId())) { return user.getUserPermissions().hasGenericPermission(resource, operation); } if (entity.getEntityType() == EntityType.CUSTOMER && user.getCustomerId().equals(entityId) || @@ -487,6 +489,29 @@ public class CustomerUserPermissions extends AbstractPermissions { } }; + // Customers may only invoke models with customer access enabled + private static final PermissionChecker aiModelPermissionChecker = new PermissionChecker() { + + @Override + public boolean hasPermission(SecurityUser user, Resource resource, Operation operation) { + return operation == Operation.INVOKE && user.getUserPermissions().hasGenericPermission(resource, operation); + } + + @Override + public boolean hasPermission(SecurityUser user, Operation operation, EntityId entityId, TenantEntity entity) { + if (operation != Operation.INVOKE) { + return false; + } + if (!user.getTenantId().equals(entity.getTenantId())) { + return false; + } + if (!(entity instanceof AiModel model) || !model.isCustomerAccessEnabled()) { + return false; + } + return user.getUserPermissions().hasGenericPermission(Resource.AI_MODEL, operation); + } + }; + private static final PermissionChecker apiKeysPermissionChecker = new PermissionChecker() { @Override diff --git a/application/src/main/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityService.java b/application/src/main/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityService.java index 57ada98db3..5a582026fd 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityService.java +++ b/application/src/main/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityService.java @@ -249,6 +249,11 @@ public class DefaultSystemSecurityService implements SystemSecurityService { @Override public String getBaseUrl(TenantId tenantId, CustomerId customerId, HttpServletRequest httpServletRequest) { + return resolveBaseUrl(tenantId, customerId, httpServletRequest).url(); + } + + @Override + public ResolvedBaseUrl resolveBaseUrl(TenantId tenantId, CustomerId customerId, HttpServletRequest httpServletRequest) { String baseUrl = null; AdminSettings generalSettings = adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, "general"); @@ -262,10 +267,10 @@ public class DefaultSystemSecurityService implements SystemSecurityService { } if (StringUtils.isEmpty(baseUrl) && httpServletRequest != null) { - baseUrl = MiscUtils.constructBaseUrl(httpServletRequest); + return new ResolvedBaseUrl(MiscUtils.constructBaseUrl(httpServletRequest), true); } - return formatBaseUrl(baseUrl); + return new ResolvedBaseUrl(formatBaseUrl(baseUrl), false); } @Override diff --git a/application/src/main/java/org/thingsboard/server/service/security/system/ResolvedBaseUrl.java b/application/src/main/java/org/thingsboard/server/service/security/system/ResolvedBaseUrl.java new file mode 100644 index 0000000000..33b7c49e47 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/security/system/ResolvedBaseUrl.java @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.security.system; + +/** + * Base URL as returned by {@link SystemSecurityService#getBaseUrl}, and whether it was built from + * the request rather than taken from the Base URL in General settings. + */ +public record ResolvedBaseUrl(String url, boolean fromRequest) { +} diff --git a/application/src/main/java/org/thingsboard/server/service/security/system/SystemSecurityService.java b/application/src/main/java/org/thingsboard/server/service/security/system/SystemSecurityService.java index df462aaf77..d1394bf280 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/system/SystemSecurityService.java +++ b/application/src/main/java/org/thingsboard/server/service/security/system/SystemSecurityService.java @@ -33,6 +33,8 @@ public interface SystemSecurityService { String getBaseUrl(TenantId tenantId, CustomerId customerId, HttpServletRequest httpServletRequest); + ResolvedBaseUrl resolveBaseUrl(TenantId tenantId, CustomerId customerId, HttpServletRequest httpServletRequest); + void logLoginAction(User user, Object authenticationDetails, ActionType actionType, Exception e); void logLoginAction(User user, Object authenticationDetails, ActionType actionType, String provider, Exception e); diff --git a/application/src/main/java/org/thingsboard/server/service/sms/EdgeSmsRequest.java b/application/src/main/java/org/thingsboard/server/service/sms/EdgeSmsRequest.java new file mode 100644 index 0000000000..ac6ca8c7ff --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/sms/EdgeSmsRequest.java @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.service.sms; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.thingsboard.server.common.data.sms.config.TestSmsRequest; + +/** + * Describes an SMS send that the Edge delegates to the Cloud. On the Edge, a send that depends on + * admin-configured (tenant/system) SMS provider settings cannot be resolved locally, so the call is + * packaged into this request and enqueued as a SEND_SMS cloud event; on the Cloud, {@code method} + * selects the matching {@code SmsService} call so the Cloud resolves the config and transmits via its + * own provider. + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EdgeSmsRequest { + + public enum SmsMethod { + SEND_SMS, // sendSms(customerId, numbersTo, message) + SEND_TEST_SMS // sendTestSms(testSmsRequest) + } + + private SmsMethod method; + + private String[] numbers; + private String message; + + private TestSmsRequest testSmsRequest; + +} diff --git a/application/src/main/java/org/thingsboard/server/service/trendz/DefaultTrendzSyncService.java b/application/src/main/java/org/thingsboard/server/service/trendz/DefaultTrendzSyncService.java index dbf379f658..6a956f69fd 100644 --- a/application/src/main/java/org/thingsboard/server/service/trendz/DefaultTrendzSyncService.java +++ b/application/src/main/java/org/thingsboard/server/service/trendz/DefaultTrendzSyncService.java @@ -372,7 +372,7 @@ public class DefaultTrendzSyncService implements TrendzSyncService { private AuthorityPermissionsInfo buildTrendzPermissions() { Map>> permissions = new HashMap<>(); - // TENANT_ADMIN + CUSTOMER_USER permissions (same for both) + // TENANT_ADMIN + CUSTOMER_USER permissions (shared by both) Map> tenantCustomerPermissions = new HashMap<>(); tenantCustomerPermissions.put(Resource.DEVICE, Set.of(Operation.READ, Operation.READ_ATTRIBUTES, Operation.WRITE_ATTRIBUTES, Operation.READ_TELEMETRY, Operation.WRITE_TELEMETRY, Operation.READ_CALCULATED_FIELD)); tenantCustomerPermissions.put(Resource.ASSET, Set.of(Operation.READ, Operation.READ_ATTRIBUTES, Operation.WRITE_ATTRIBUTES, Operation.READ_TELEMETRY, Operation.WRITE_TELEMETRY, Operation.READ_CALCULATED_FIELD)); @@ -386,8 +386,14 @@ public class DefaultTrendzSyncService implements TrendzSyncService { tenantCustomerPermissions.put(Resource.DEVICE_PROFILE, Set.of(Operation.READ, Operation.READ_CALCULATED_FIELD)); tenantCustomerPermissions.put(Resource.ASSET_PROFILE, Set.of(Operation.READ, Operation.READ_CALCULATED_FIELD)); - permissions.put(Authority.TENANT_ADMIN, tenantCustomerPermissions); - permissions.put(Authority.CUSTOMER_USER, tenantCustomerPermissions); + // Only tenant administrators list AI models; customer users only call the model chosen for them + Map> tenantAdminPermissions = new HashMap<>(tenantCustomerPermissions); + tenantAdminPermissions.put(Resource.AI_MODEL, Set.of(Operation.READ, Operation.INVOKE)); + Map> customerUserPermissions = new HashMap<>(tenantCustomerPermissions); + customerUserPermissions.put(Resource.AI_MODEL, Set.of(Operation.INVOKE)); + + permissions.put(Authority.TENANT_ADMIN, tenantAdminPermissions); + permissions.put(Authority.CUSTOMER_USER, customerUserPermissions); // SYS_ADMIN permissions Map> sysAdminPermissions = new HashMap<>(); diff --git a/application/src/main/resources/converters/AWS_IOT/uplink/payload.json b/application/src/main/resources/converters/AWS_IOT/uplink/payload.json new file mode 100644 index 0000000000..03c06da14d --- /dev/null +++ b/application/src/main/resources/converters/AWS_IOT/uplink/payload.json @@ -0,0 +1,22 @@ +{ + "device_id": "3G7H1j-9zF", + "timestamp": "2023-06-10T12:00:00Z", + "sensor_data": { + "temperature": 25.3, + "humidity": 62.8, + "pressure": 1012.5 + }, + "location": { + "latitude": 37.7749, + "longitude": -122.4194 + }, + "status": "active", + "power_status": "on", + "vibration": { + "x": 0.02, + "y": 0.03, + "z": 0.01 + }, + "fault_codes": [100, 204, 301], + "battery_level": 78.5 +} diff --git a/ui-ngx/src/assets/converters/tbel-aws-iot-decoder.raw b/application/src/main/resources/converters/AWS_IOT/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-aws-iot-decoder.raw rename to application/src/main/resources/converters/AWS_IOT/uplink/tbel.raw diff --git a/application/src/main/resources/converters/AZURE_EVENT_HUB/uplink/payload.json b/application/src/main/resources/converters/AZURE_EVENT_HUB/uplink/payload.json new file mode 100644 index 0000000000..2d71149a7f --- /dev/null +++ b/application/src/main/resources/converters/AZURE_EVENT_HUB/uplink/payload.json @@ -0,0 +1,36 @@ +{ + "deviceId": "8F4A2C6D", + "deviceType": "Packing machine", + "temperature": 25.5, + "pressure": 1013.25, + "vibration": { + "x": 0.02, + "y": 0.03, + "z": 0.015 + }, + "location": { + "latitude": 37.7749, + "longitude": -122.4194, + "altitude": 10 + }, + "timestamp": "2023-06-09T10:30:00Z", + "status": "ALARM", + "alarms": [ + { + "type": "temperature", + "severity": "high", + "message": "Temperature exceeds threshold." + }, + { + "type": "vibration", + "severity": "critical", + "message": "Excessive vibration detected." + } + ], + "metadata": { + "version": 1, + "batteryLevel": 100, + "batteryStatus": "Charging", + "manufacturer": "Example corporation" + } +} \ No newline at end of file diff --git a/ui-ngx/src/assets/converters/tbel-azure-decoder.raw b/application/src/main/resources/converters/AZURE_EVENT_HUB/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-azure-decoder.raw rename to application/src/main/resources/converters/AZURE_EVENT_HUB/uplink/tbel.raw diff --git a/application/src/main/resources/converters/AZURE_IOT_HUB/uplink/payload.json b/application/src/main/resources/converters/AZURE_IOT_HUB/uplink/payload.json new file mode 100644 index 0000000000..2d71149a7f --- /dev/null +++ b/application/src/main/resources/converters/AZURE_IOT_HUB/uplink/payload.json @@ -0,0 +1,36 @@ +{ + "deviceId": "8F4A2C6D", + "deviceType": "Packing machine", + "temperature": 25.5, + "pressure": 1013.25, + "vibration": { + "x": 0.02, + "y": 0.03, + "z": 0.015 + }, + "location": { + "latitude": 37.7749, + "longitude": -122.4194, + "altitude": 10 + }, + "timestamp": "2023-06-09T10:30:00Z", + "status": "ALARM", + "alarms": [ + { + "type": "temperature", + "severity": "high", + "message": "Temperature exceeds threshold." + }, + { + "type": "vibration", + "severity": "critical", + "message": "Excessive vibration detected." + } + ], + "metadata": { + "version": 1, + "batteryLevel": 100, + "batteryStatus": "Charging", + "manufacturer": "Example corporation" + } +} \ No newline at end of file diff --git a/application/src/main/resources/converters/AZURE_IOT_HUB/uplink/tbel.raw b/application/src/main/resources/converters/AZURE_IOT_HUB/uplink/tbel.raw new file mode 100644 index 0000000000..c5832ed24c --- /dev/null +++ b/application/src/main/resources/converters/AZURE_IOT_HUB/uplink/tbel.raw @@ -0,0 +1,84 @@ +var data = decodeToJson(payload); + +var deviceName = data.deviceId != null ? data.deviceId : "Device A"; +var deviceType = data.deviceType != null ? data.deviceType : "default"; +var groupName = "Control room"; +// var customerName = 'Customer A'; +// use assetName and assetType instead of deviceName and deviceType +// to automatically create assets instead of devices. +// var assetName = 'Asset A'; +// var assetType = 'building'; +var dateString = data.timestamp != null ? data.timestamp : ""; + +// --- attributes and telemetry objects --- +var telemetry = {}; +var attributes = {}; +// --- attributes and telemetry objects --- + +// --- Timestamp parsing +var timestamp = -1; +if (dateString != null) { + timestamp = new Date(dateString).getTime(); + if (timestamp == -1) { + var secondsSeparatorIndex = dateString.lastIndexOf('.') + 1; + var millisecondsEndIndex = dateString.lastIndexOf('+'); + if (millisecondsEndIndex == -1) { + millisecondsEndIndex = dateString.lastIndexOf('Z'); + } + if (millisecondsEndIndex == -1) { + millisecondsEndIndex = dateString.lastIndexOf('-'); + } + if (millisecondsEndIndex == -1) { + if (dateString.length >= secondsSeparatorIndex + 3) { + dateString = dateString.substring(0, secondsSeparatorIndex + 3); + } + } else { + dateString = dateString.substring(0, secondsSeparatorIndex + 3) + + dateString.substring(millisecondsEndIndex, dateString.length); + } + timestamp = new Date(dateString).getTime(); + } +} +// If we cannot parse timestamp - we will use the current timestamp +if (timestamp == -1) { + timestamp = Date.now(); +} +// --- Timestamp parsing + +// You can add some keys manually to attributes or telemetry +telemetry.receivedAlarms = data.alarms; + +// You can exclude some keys from the result +var excludeFromTelemetryList = ["deviceId", "deviceType", "alarms", "location", "timestamp", "version", "manufacturer"]; +var excludeFromAttributesList = ["batteryLevel", "batteryStatus"]; + +// Message parsing +var telemetryData = {}; +var attributesData = {}; +// To avoid paths in the decoded objects we passing false value to function as "pathInKey" argument. +// Warning: pathInKey can cause already found fields to be overwritten with the last value found, e.g. receive_at from uplink_message will be written receive_at in the root. +telemetryData.putAll(toFlatMap(data, excludeFromTelemetryList, false)); +attributesData.putAll(toFlatMap(data.?metadata, excludeFromAttributesList, false)); + +if (!telemetryData.isEmpty()) { + telemetry.putAll(telemetryData); +} +if (!attributesData.isEmpty()) { + attributes.putAll(attributesData); +} + +var result = { + deviceName: deviceName, + deviceType: deviceType, +// assetName: assetName, +// assetType: assetType, +// customerName: customerName, + groupName: groupName, + attributes: attributes, + telemetry: { + ts: timestamp, + values: telemetry + } +}; + +return result; diff --git a/application/src/main/resources/converters/AZURE_SERVICE_BUS/uplink/payload.json b/application/src/main/resources/converters/AZURE_SERVICE_BUS/uplink/payload.json new file mode 100644 index 0000000000..2d71149a7f --- /dev/null +++ b/application/src/main/resources/converters/AZURE_SERVICE_BUS/uplink/payload.json @@ -0,0 +1,36 @@ +{ + "deviceId": "8F4A2C6D", + "deviceType": "Packing machine", + "temperature": 25.5, + "pressure": 1013.25, + "vibration": { + "x": 0.02, + "y": 0.03, + "z": 0.015 + }, + "location": { + "latitude": 37.7749, + "longitude": -122.4194, + "altitude": 10 + }, + "timestamp": "2023-06-09T10:30:00Z", + "status": "ALARM", + "alarms": [ + { + "type": "temperature", + "severity": "high", + "message": "Temperature exceeds threshold." + }, + { + "type": "vibration", + "severity": "critical", + "message": "Excessive vibration detected." + } + ], + "metadata": { + "version": 1, + "batteryLevel": 100, + "batteryStatus": "Charging", + "manufacturer": "Example corporation" + } +} \ No newline at end of file diff --git a/application/src/main/resources/converters/AZURE_SERVICE_BUS/uplink/tbel.raw b/application/src/main/resources/converters/AZURE_SERVICE_BUS/uplink/tbel.raw new file mode 100644 index 0000000000..c5832ed24c --- /dev/null +++ b/application/src/main/resources/converters/AZURE_SERVICE_BUS/uplink/tbel.raw @@ -0,0 +1,84 @@ +var data = decodeToJson(payload); + +var deviceName = data.deviceId != null ? data.deviceId : "Device A"; +var deviceType = data.deviceType != null ? data.deviceType : "default"; +var groupName = "Control room"; +// var customerName = 'Customer A'; +// use assetName and assetType instead of deviceName and deviceType +// to automatically create assets instead of devices. +// var assetName = 'Asset A'; +// var assetType = 'building'; +var dateString = data.timestamp != null ? data.timestamp : ""; + +// --- attributes and telemetry objects --- +var telemetry = {}; +var attributes = {}; +// --- attributes and telemetry objects --- + +// --- Timestamp parsing +var timestamp = -1; +if (dateString != null) { + timestamp = new Date(dateString).getTime(); + if (timestamp == -1) { + var secondsSeparatorIndex = dateString.lastIndexOf('.') + 1; + var millisecondsEndIndex = dateString.lastIndexOf('+'); + if (millisecondsEndIndex == -1) { + millisecondsEndIndex = dateString.lastIndexOf('Z'); + } + if (millisecondsEndIndex == -1) { + millisecondsEndIndex = dateString.lastIndexOf('-'); + } + if (millisecondsEndIndex == -1) { + if (dateString.length >= secondsSeparatorIndex + 3) { + dateString = dateString.substring(0, secondsSeparatorIndex + 3); + } + } else { + dateString = dateString.substring(0, secondsSeparatorIndex + 3) + + dateString.substring(millisecondsEndIndex, dateString.length); + } + timestamp = new Date(dateString).getTime(); + } +} +// If we cannot parse timestamp - we will use the current timestamp +if (timestamp == -1) { + timestamp = Date.now(); +} +// --- Timestamp parsing + +// You can add some keys manually to attributes or telemetry +telemetry.receivedAlarms = data.alarms; + +// You can exclude some keys from the result +var excludeFromTelemetryList = ["deviceId", "deviceType", "alarms", "location", "timestamp", "version", "manufacturer"]; +var excludeFromAttributesList = ["batteryLevel", "batteryStatus"]; + +// Message parsing +var telemetryData = {}; +var attributesData = {}; +// To avoid paths in the decoded objects we passing false value to function as "pathInKey" argument. +// Warning: pathInKey can cause already found fields to be overwritten with the last value found, e.g. receive_at from uplink_message will be written receive_at in the root. +telemetryData.putAll(toFlatMap(data, excludeFromTelemetryList, false)); +attributesData.putAll(toFlatMap(data.?metadata, excludeFromAttributesList, false)); + +if (!telemetryData.isEmpty()) { + telemetry.putAll(telemetryData); +} +if (!attributesData.isEmpty()) { + attributes.putAll(attributesData); +} + +var result = { + deviceName: deviceName, + deviceType: deviceType, +// assetName: assetName, +// assetType: assetType, +// customerName: customerName, + groupName: groupName, + attributes: attributes, + telemetry: { + ts: timestamp, + values: telemetry + } +}; + +return result; diff --git a/ui-ngx/src/assets/converters/js-chirpstack-encoder.raw b/application/src/main/resources/converters/CHIRPSTACK/downlink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-chirpstack-encoder.raw rename to application/src/main/resources/converters/CHIRPSTACK/downlink/js.raw diff --git a/ui-ngx/src/assets/converters/tbel-chirpstack-encoder.raw b/application/src/main/resources/converters/CHIRPSTACK/downlink/tbel.raw similarity index 91% rename from ui-ngx/src/assets/converters/tbel-chirpstack-encoder.raw rename to application/src/main/resources/converters/CHIRPSTACK/downlink/tbel.raw index 3e8ec1d4b1..c2139ca26b 100644 --- a/ui-ngx/src/assets/converters/tbel-chirpstack-encoder.raw +++ b/application/src/main/resources/converters/CHIRPSTACK/downlink/tbel.raw @@ -15,9 +15,10 @@ // EXAMPLE — replace this: it encodes a single field ('powerState') from the downlink message. // Swap 'powerState' (and the 'unspecified' fallback) for the field(s) and encoding your device expects; // as written, any downlink without a 'powerState' field sends the constant value 'unspecified'. +// If powerState is present, encode it to base64; otherwise fall back to 'unspecified'. var base64Payload = (msg.powerState != null) - ? btoa(msg.powerState) // if powerState is present, encode it to base64 - : btoa('unspecified'); // fall back to 'unspecified' when absent + ? btoa(msg.powerState) + : btoa('unspecified'); // Result object with encoded downlink payload var result = { diff --git a/ui-ngx/src/assets/converters/js-chirpstack-decoder.raw b/application/src/main/resources/converters/CHIRPSTACK/uplink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-chirpstack-decoder.raw rename to application/src/main/resources/converters/CHIRPSTACK/uplink/js.raw diff --git a/application/src/main/resources/converters/CHIRPSTACK/uplink/payload.json b/application/src/main/resources/converters/CHIRPSTACK/uplink/payload.json new file mode 100644 index 0000000000..6f810567c9 --- /dev/null +++ b/application/src/main/resources/converters/CHIRPSTACK/uplink/payload.json @@ -0,0 +1,48 @@ +{ + "deduplicationId": "57433366-50a6-4dc2-8145-2df1bbc70d9e", + "time": "2023-05-22T07:47:05.404859+00:00", + "deviceInfo": { + "tenantId": "52f14cd4-c6f1-4fbd-8f87-4025e1d49242", + "tenantName": "ChirpStack", + "applicationId": "ca739e26-7b67-4f14-b69e-d568c22a5a75", + "applicationName": "Chirpstack application", + "deviceProfileId": "605d08d4-65f5-4d2c-8a5a-3d2457662f79", + "deviceProfileName": "Chirpstack default device profile", + "deviceName": "Device name", + "devEui": "1000000000000001", + "tags": {} + }, + "devAddr": "20000001", + "adr": true, + "dr": 5, + "fCnt": 4, + "fPort": 85, + "confirmed": false, + "data": "Ae0DM18OTGM=", + "rxInfo": [{ + "gatewayId": "6a7e111a10000000", + "uplinkId": 24022, + "time": "2023-05-22T07:47:05.404859+00:00", + "rssi": -35, + "snr": 11.5, + "channel": 2, + "rfChain": 1, + "location": {}, + "context": "EFwMtA==", + "metadata": { + "region_common_name": "EU868", + "region_config_id": "eu868" + }, + "crcStatus": "CRC_OK" + }], + "txInfo": { + "frequency": 868500000, + "modulation": { + "lora": { + "bandwidth": 125000, + "spreadingFactor": 7, + "codeRate": "CR_4_5" + } + } + } +} \ No newline at end of file diff --git a/ui-ngx/src/assets/converters/tbel-chirpstack-decoder.raw b/application/src/main/resources/converters/CHIRPSTACK/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-chirpstack-decoder.raw rename to application/src/main/resources/converters/CHIRPSTACK/uplink/tbel.raw diff --git a/application/src/main/resources/converters/KPN/uplink/payload.json b/application/src/main/resources/converters/KPN/uplink/payload.json new file mode 100644 index 0000000000..4c83b35838 --- /dev/null +++ b/application/src/main/resources/converters/KPN/uplink/payload.json @@ -0,0 +1,14 @@ +{ + "deviceName":"Device A", + "deviceType":"thermostat", + "customerName":"customer", + "groupName":"thermostat devices", + "attributes": { + "model":"Model A", + "serialNumber":"SN111" + }, + "telemetry": { + "temperature":42, + "humidity":80 + } +} diff --git a/ui-ngx/src/assets/converters/tbel-kpn-decoder.raw b/application/src/main/resources/converters/KPN/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-kpn-decoder.raw rename to application/src/main/resources/converters/KPN/uplink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-loriot-encoder.raw b/application/src/main/resources/converters/LORIOT/downlink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-loriot-encoder.raw rename to application/src/main/resources/converters/LORIOT/downlink/js.raw diff --git a/ui-ngx/src/assets/converters/tbel-loriot-encoder.raw b/application/src/main/resources/converters/LORIOT/downlink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-loriot-encoder.raw rename to application/src/main/resources/converters/LORIOT/downlink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-loriot-decoder.raw b/application/src/main/resources/converters/LORIOT/uplink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-loriot-decoder.raw rename to application/src/main/resources/converters/LORIOT/uplink/js.raw diff --git a/application/src/main/resources/converters/LORIOT/uplink/payload.json b/application/src/main/resources/converters/LORIOT/uplink/payload.json new file mode 100644 index 0000000000..4be8f5dab4 --- /dev/null +++ b/application/src/main/resources/converters/LORIOT/uplink/payload.json @@ -0,0 +1,17 @@ +{ + "cmd": "rx", + "seqno": 3040, + "EUI": "1000000000000001", + "ts": 1684478801936, + "fcnt": 2, + "port": 85, + "freq": 867500000, + "rssi": -21, + "snr": 10, + "toa": 206, + "dr": "SF9 BW125 4/5", + "ack": false, + "bat": 94, + "offline": false, + "data": "01ed03335f0e4c63" +} diff --git a/ui-ngx/src/assets/converters/tbel-loriot-decoder.raw b/application/src/main/resources/converters/LORIOT/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-loriot-decoder.raw rename to application/src/main/resources/converters/LORIOT/uplink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-mqtt-encoder.raw b/application/src/main/resources/converters/MQTT/downlink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-mqtt-encoder.raw rename to application/src/main/resources/converters/MQTT/downlink/js.raw diff --git a/ui-ngx/src/assets/converters/tbel-mqtt-encoder.raw b/application/src/main/resources/converters/MQTT/downlink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-mqtt-encoder.raw rename to application/src/main/resources/converters/MQTT/downlink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-mqtt-decoder.raw b/application/src/main/resources/converters/MQTT/uplink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-mqtt-decoder.raw rename to application/src/main/resources/converters/MQTT/uplink/js.raw diff --git a/ui-ngx/src/assets/converters/tbel-mqtt-decoder.raw b/application/src/main/resources/converters/MQTT/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-mqtt-decoder.raw rename to application/src/main/resources/converters/MQTT/uplink/tbel.raw diff --git a/ui-ngx/src/assets/converters/tbel-opc-ua-encoder.raw b/application/src/main/resources/converters/OPC_UA/downlink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-opc-ua-encoder.raw rename to application/src/main/resources/converters/OPC_UA/downlink/tbel.raw diff --git a/application/src/main/resources/converters/SIGFOX/uplink/metadata.json b/application/src/main/resources/converters/SIGFOX/uplink/metadata.json new file mode 100644 index 0000000000..8c483fcc96 --- /dev/null +++ b/application/src/main/resources/converters/SIGFOX/uplink/metadata.json @@ -0,0 +1,7 @@ +{ + "Header:accept-encoding": "gzip,deflate", + "Header:content-type": "application/json", + "Header:content-length": "243", + "Header:user-agent": "SIGFOX", + "Header:accept-charset": "UTF-8;q=0.9,*;q=0.7", + "Header:accept-language": "en"} diff --git a/application/src/main/resources/converters/SIGFOX/uplink/payload.json b/application/src/main/resources/converters/SIGFOX/uplink/payload.json new file mode 100644 index 0000000000..c2a40f1893 --- /dev/null +++ b/application/src/main/resources/converters/SIGFOX/uplink/payload.json @@ -0,0 +1,10 @@ +{ + "device": "2203961", + "time": "1686298419", + "data": "2502af2102462a", + "seqNumber": "570", + "deviceTypeId": "630ceaea10d051194ec0246e", + "ack": "false", + "customData#int1": "37", + "customData#int2": "2" +} \ No newline at end of file diff --git a/ui-ngx/src/assets/converters/tbel-sigfox-decoder.raw b/application/src/main/resources/converters/SIGFOX/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-sigfox-decoder.raw rename to application/src/main/resources/converters/SIGFOX/uplink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-thingpark-decoder.raw b/application/src/main/resources/converters/THINGPARK/uplink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-thingpark-decoder.raw rename to application/src/main/resources/converters/THINGPARK/uplink/js.raw diff --git a/application/src/main/resources/converters/THINGPARK/uplink/payload.json b/application/src/main/resources/converters/THINGPARK/uplink/payload.json new file mode 100644 index 0000000000..669c9e1de6 --- /dev/null +++ b/application/src/main/resources/converters/THINGPARK/uplink/payload.json @@ -0,0 +1,73 @@ +{ + "DevEUI_uplink": { + "Time": "2024-11-28T21:08:22.138+00:00", + "DevEUI": "1000000000000001", + "FPort": 1, + "FCntUp": 26, + "LostUplinksAS": 0, + "ADRbit": 1, + "MType": 2, + "FCntDn": 2, + "payload_hex": "01ed03335f0e4c63", + "mic_hex": "e7214986", + "Lrcid": "00000211", + "LrrRSSI": -114, + "LrrSNR": 4.75, + "LrrESP": -115.2547, + "SpFact": 9, + "SubBand": "G0", + "Channel": "LC1", + "Lrrid": "100019D4", + "Late": 0, + "LrrLAT": 32.516357, + "LrrLON": -106.824348, + "Lrrs": { + "Lrr": [{ + "Lrrid": "100019D4", + "Chain": 0, + "LrrRSSI": -114, + "LrrSNR": 4.75, + "LrrESP": -115.2547 + }] + }, + "DevLrrCnt": 1, + "CustomerID": "100045194", + "CustomerData": { + "loc": { + "lat": "32.592782", + "lon": "-106.927742" + }, + "alr": { + "pro": "DL/TBRG", + "ver": "1" + }, + "tags": ["EnvironSens", "RainGauge", "CDRRC"], + "doms": [], + "name": "RainGauge 5483_Test" + }, + "BaseStationData": { + "doms": [], + "name": "iStation US #6_CDRRC_Summerford" + }, + "ModelCfg": "0", + "DriverCfg": { + "mod": { + "pId": "dl", + "mId": "dl-tbrg", + "ver": "1" + }, + "app": { + "pId": "dl", + "mId": "dl-tbrg", + "ver": "1" + } + }, + "InstantPER": 0, + "MeanPER": 0.037037, + "DevAddr": "00FDA112", + "TxPower": 18, + "NbTrans": 2, + "Frequency": 902.5, + "DynamicClass": "A" + } +} \ No newline at end of file diff --git a/ui-ngx/src/assets/converters/tbel-thingpark-decoder.raw b/application/src/main/resources/converters/THINGPARK/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-thingpark-decoder.raw rename to application/src/main/resources/converters/THINGPARK/uplink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-tpe-decoder.raw b/application/src/main/resources/converters/TPE/uplink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-tpe-decoder.raw rename to application/src/main/resources/converters/TPE/uplink/js.raw diff --git a/application/src/main/resources/converters/TPE/uplink/payload.json b/application/src/main/resources/converters/TPE/uplink/payload.json new file mode 100644 index 0000000000..669c9e1de6 --- /dev/null +++ b/application/src/main/resources/converters/TPE/uplink/payload.json @@ -0,0 +1,73 @@ +{ + "DevEUI_uplink": { + "Time": "2024-11-28T21:08:22.138+00:00", + "DevEUI": "1000000000000001", + "FPort": 1, + "FCntUp": 26, + "LostUplinksAS": 0, + "ADRbit": 1, + "MType": 2, + "FCntDn": 2, + "payload_hex": "01ed03335f0e4c63", + "mic_hex": "e7214986", + "Lrcid": "00000211", + "LrrRSSI": -114, + "LrrSNR": 4.75, + "LrrESP": -115.2547, + "SpFact": 9, + "SubBand": "G0", + "Channel": "LC1", + "Lrrid": "100019D4", + "Late": 0, + "LrrLAT": 32.516357, + "LrrLON": -106.824348, + "Lrrs": { + "Lrr": [{ + "Lrrid": "100019D4", + "Chain": 0, + "LrrRSSI": -114, + "LrrSNR": 4.75, + "LrrESP": -115.2547 + }] + }, + "DevLrrCnt": 1, + "CustomerID": "100045194", + "CustomerData": { + "loc": { + "lat": "32.592782", + "lon": "-106.927742" + }, + "alr": { + "pro": "DL/TBRG", + "ver": "1" + }, + "tags": ["EnvironSens", "RainGauge", "CDRRC"], + "doms": [], + "name": "RainGauge 5483_Test" + }, + "BaseStationData": { + "doms": [], + "name": "iStation US #6_CDRRC_Summerford" + }, + "ModelCfg": "0", + "DriverCfg": { + "mod": { + "pId": "dl", + "mId": "dl-tbrg", + "ver": "1" + }, + "app": { + "pId": "dl", + "mId": "dl-tbrg", + "ver": "1" + } + }, + "InstantPER": 0, + "MeanPER": 0.037037, + "DevAddr": "00FDA112", + "TxPower": 18, + "NbTrans": 2, + "Frequency": 902.5, + "DynamicClass": "A" + } +} \ No newline at end of file diff --git a/ui-ngx/src/assets/converters/tbel-tpe-decoder.raw b/application/src/main/resources/converters/TPE/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-tpe-decoder.raw rename to application/src/main/resources/converters/TPE/uplink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-ttn-tti-encoder.raw b/application/src/main/resources/converters/TTI/downlink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-ttn-tti-encoder.raw rename to application/src/main/resources/converters/TTI/downlink/js.raw diff --git a/ui-ngx/src/assets/converters/tbel-ttn-tti-encoder.raw b/application/src/main/resources/converters/TTI/downlink/tbel.raw similarity index 93% rename from ui-ngx/src/assets/converters/tbel-ttn-tti-encoder.raw rename to application/src/main/resources/converters/TTI/downlink/tbel.raw index a8306cddab..e6f37e8fdc 100644 --- a/ui-ngx/src/assets/converters/tbel-ttn-tti-encoder.raw +++ b/application/src/main/resources/converters/TTI/downlink/tbel.raw @@ -19,9 +19,10 @@ var fPort = (metadata.cs_fPort != null && metadata.cs_fPort != '') // EXAMPLE — replace this: it encodes a single field ('powerState') from the downlink message. // Swap 'powerState' (and the 'unspecified' fallback) for the field(s) and encoding your device expects; // as written, any downlink without a 'powerState' field sends the constant value 'unspecified'. +// If powerState is present, encode it to base64; otherwise fall back to 'unspecified'. var base64Payload = (msg.powerState != null) - ? btoa(msg.powerState) // if powerState is present, encode it to base64 - : btoa('unspecified'); // fall back to 'unspecified' when absent + ? btoa(msg.powerState) + : btoa('unspecified'); // The Things Stack (TTN/TTI) expects a 'downlinks' array; each entry is a single scheduled downlink. var data = { diff --git a/application/src/main/resources/converters/TTI/uplink/js.raw b/application/src/main/resources/converters/TTI/uplink/js.raw new file mode 100644 index 0000000000..9cc99a41a9 --- /dev/null +++ b/application/src/main/resources/converters/TTI/uplink/js.raw @@ -0,0 +1,73 @@ +// The Things Stack adds decoded_payload for a device registered from the LoRaWAN Device Repository, and the payload +// is then that JSON: its keys become telemetry. A Milesight-style history list keeps each record's time. +// Such a device gets the profile -, so all devices of one model share it, +// or the name the integration metadata gives it under profile.-. +// A device that is not in the Repository can name its model in decoded_payload: its payload formatter adds +// tbVersionIds: { brand_id, model_id }, which is not telemetry; they become the attributes brandId and modelId, as the +// integration writes them from version_ids. Any other device gets LoRaWAN Device. +// The keys the integration metadata lists under attributes.- (comma-separated) are saved as +// attributes, not telemetry: device information and settings. +var values = {}; +var attributes = {}; +var history = []; +var versionIds = null; +if (metadata.payloadFormat == 'JSON') { + values = decodeToJson(payload); + if (Array.isArray(values.history)) { + values.history.forEach(function (record) { + if (record.timestamp != null) { + var ts = record.timestamp * 1000; + delete record.timestamp; + history.push({ ts: ts, values: record }); + } + }); + delete values.history; + } + if (Object.prototype.hasOwnProperty.call(values, 'tbVersionIds')) { + versionIds = values.tbVersionIds; + delete values.tbVersionIds; + } +} +var brandId = metadata.brandId; +var modelId = metadata.modelId; +if ((brandId == null || modelId == null) && typeof versionIds === 'object' && versionIds !== null && !Array.isArray(versionIds)) { + brandId = versionIds.brand_id; + modelId = versionIds.model_id; + if (brandId != null && modelId != null) { + attributes.brandId = brandId; + attributes.modelId = modelId; + } +} +var profile = 'LoRaWAN Device'; +if (brandId != null && modelId != null) { + var model = brandId + '-' + modelId; + profile = model; + // The profile name chosen at install, kept in the integration metadata + var customProfile = metadata['profile.' + model]; + if (customProfile != null && customProfile != '') { + profile = customProfile; + } + var attributeKeys = metadata['attributes.' + model]; + if (attributeKeys != null && attributeKeys != '') { + attributeKeys.split(',').forEach(function (key) { + key = key.trim(); + if (key != '' && values.hasOwnProperty(key)) { + attributes[key] = values[key]; + delete values[key]; + } + }); + } +} +var result = { profile: profile, telemetry: { ts: metadata.ts, values: values } }; +if (history.length > 0) { + history.push({ ts: metadata.ts, values: values }); + result.telemetry = history; +} +if (Object.keys(attributes).length > 0) { + result.attributes = attributes; +} +return result; + +function decodeToJson(payload) { + return JSON.parse(String.fromCharCode.apply(String, payload)); +} diff --git a/application/src/main/resources/converters/TTI/uplink/payload.json b/application/src/main/resources/converters/TTI/uplink/payload.json new file mode 100644 index 0000000000..db2c29c4cb --- /dev/null +++ b/application/src/main/resources/converters/TTI/uplink/payload.json @@ -0,0 +1,95 @@ +{ + "end_device_ids": { + "device_id": "eui-1000000000000001", + "application_ids": { + "application_id": "application-tti-name" + }, + "dev_eui": "1000000000000001", + "join_eui": "2000000000000001", + "dev_addr": "20000001" + }, + "correlation_ids": ["as:up:01H0PZDGB1NW6NAPD815NGHPF6", "gs:conn:01H0FJRSXSYT7VKNYXJ89F95XT", "gs:up:host:01H0FJRSY3MZMGPPFBQ4FZV4T8", "gs:uplink:01H0PZDG4HHGFRTXRTXD4PFTH7", "ns:uplink:01H0PZDG4JZ3BM0K6J89EQK1J7", "rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H0PZDG4J02F85RYFPCNSNXCR", "rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01H0PZDGB081PMP806BJHNHX1A"], + "received_at": "2023-05-18T08:25:26.112483370Z", + "uplink_message": { + "session_key_id": "AYfg8rhha5n+FWx0ZaAprA==", + "f_port": 85, + "f_cnt": 5017, + "frm_payload": "A2fuAARofAUAAQbLAgd9qAMIfSUACXNmJwt9IAAMfTAA", + "decoded_payload": { + "temperature": 23.8, + "humidity": 62, + "pir": "trigger", + "light_level": 2, + "co2": 936, + "tvoc": 0.37, + "pressure": 1008.6, + "pm2_5": 32, + "pm10": 48 + }, + "rx_metadata": [{ + "gateway_ids": { + "gateway_id": "eui-6A7E111A10000000", + "eui": "6A7E111A10000000" + }, + "time": "2023-05-18T08:25:25.885310Z", + "timestamp": 818273765, + "rssi": -24, + "channel_rssi": -24, + "snr": 12, + "frequency_offset": "671", + "uplink_token": "CiIKIAoUZXVpLTZBN0UxMTFBMTAwMDAwMDASCCThJP/+9k6eEOW7l4YDGgwI9cGXowYQ5KPhrwMgiI2rp+jpOA=", + "channel_index": 2, + "received_at": "2023-05-18T08:25:25.869324983Z" + }, { + "gateway_ids": { + "gateway_id": "packetbroker" + }, + "packet_broker": { + "message_id": "01H0PZDG4MF9AYSMNY44MAVTDH", + "forwarder_net_id": "000013", + "forwarder_tenant_id": "ttn", + "forwarder_cluster_id": "eu1.cloud.thethings.network", + "forwarder_gateway_eui": "6A7E111A10000000", + "forwarder_gateway_id": "eui-6a7e111a10000000", + "home_network_net_id": "000013", + "home_network_tenant_id": "tenant", + "home_network_cluster_id": "eu1.cloud.thethings.industries" + }, + "time": "2023-05-18T08:25:25.885310Z", + "rssi": -24, + "channel_rssi": -24, + "snr": 12, + "frequency_offset": "671", + "uplink_token": "eyJnIjoiWlhsS2FHSkhZMmxQYVVwQ1RWUkpORkl3VGs1VE1XTnBURU5LYkdKdFRXbFBhVXBDVFZSSk5GSXdUazVKYVhkcFlWaFphVTlwU201a01uaGhWVlJvZDFSWFVuRmlSM1JtVFcxT2RVbHBkMmxrUjBadVNXcHZhV05ZY0RKT1IyeExaREpSZVZwR1pIUmpNRXBLVlVoR2RFNVZkR3BWVTBvNUxua3paVVJTWVRaM1lXOU1kbTQwVm5sdmIyWmlPWGN1ZUhCZmVrcElaa3hIWlZadGRVUlFVeTVuYlRaVlZXRXdkakpHV0VKMGJUUjZaMjVXUkVoeGVHRjRaMlJKTlVkS1VsbERhemc1VDNCbk5rVk1iM1JDUkVZM1VWbHdZbEJDTkdOblNqWjBlbkphYUV4MFRVMHhZMVZFTTFac01XdExURUo0YURaMFExTnhhMVJsWWw4eE5FdHlVVXcyZUhsRWFFbEhlakJITXpoTE0xaFdlRzR5VUVjMk4wNUViME5WTkhoTmRrazFZVk5oWkUwd2FXVnFjR294VGtoMFduZHlZMDFxVlVGNmRsbERUazlNY2s5eFdVeFpWMk5XTG1WVFFYVkpNVkptT1U5NWRqUTNhSEoxTUZoalYxRT0iLCJhIjp7ImZuaWQiOiIwMDAwMTMiLCJmdGlkIjoidHRuIiwiZmNpZCI6ImV1MS5jbG91ZC50aGV0aGluZ3MubmV0d29yayJ9fQ==", + "received_at": "2023-05-18T08:25:25.906038642Z" + }], + "settings": { + "data_rate": { + "lora": { + "bandwidth": 125000, + "spreading_factor": 7, + "coding_rate": "4/5" + } + }, + "frequency": "868500000", + "timestamp": 818273765, + "time": "2023-05-18T08:25:25.885310Z" + }, + "received_at": "2023-05-18T08:25:25.906399073Z", + "consumed_airtime": "0.097536s", + "version_ids": { + "brand_id": "milesight-iot", + "model_id": "am308", + "hardware_version": "1.x", + "firmware_version": "1.x", + "band_id": "EU_863_870" + }, + "network_ids": { + "net_id": "000013", + "tenant_id": "tenant", + "cluster_id": "eu1", + "cluster_address": "eu1.cloud.thethings.industries", + "tenant_address": "tenant.eu1.cloud.thethings.industries" + } + } +} \ No newline at end of file diff --git a/application/src/main/resources/converters/TTI/uplink/tbel.raw b/application/src/main/resources/converters/TTI/uplink/tbel.raw new file mode 100644 index 0000000000..ff5744a55e --- /dev/null +++ b/application/src/main/resources/converters/TTI/uplink/tbel.raw @@ -0,0 +1,69 @@ +// The Things Stack adds decoded_payload for a device registered from the LoRaWAN Device Repository, and the payload +// is then that JSON: its keys become telemetry. A Milesight-style history list keeps each record's time. +// Such a device gets the profile -, so all devices of one model share it, +// or the name the integration metadata gives it under profile.-. +// A device that is not in the Repository can name its model in decoded_payload: its payload formatter adds +// tbVersionIds: { brand_id, model_id }, which is not telemetry; they become the attributes brandId and modelId, as the +// integration writes them from version_ids. Any other device gets LoRaWAN Device. +// The keys the integration metadata lists under attributes.- (comma-separated) are saved as +// attributes, not telemetry: device information and settings. +var values = {}; +var attributes = {}; +var history = []; +var versionIds = null; +if (metadata.payloadFormat == "JSON") { + values = decodeToJson(payload); + if (values.history instanceof java.util.List) { + foreach (record : values.history) { + if (record.timestamp != null) { + var ts = record.timestamp * 1000; + record.remove("timestamp"); + history.add({ ts: ts, values: record }); + } + } + values.remove("history"); + } + if (values.containsKey("tbVersionIds")) { + versionIds = values.tbVersionIds; + values.remove("tbVersionIds"); + } +} +var brandId = metadata.brandId; +var modelId = metadata.modelId; +if ((brandId == null || modelId == null) && versionIds instanceof java.util.Map) { + brandId = versionIds.brand_id; + modelId = versionIds.model_id; + if (brandId != null && modelId != null) { + attributes.put("brandId", brandId); + attributes.put("modelId", modelId); + } +} +var profile = "LoRaWAN Device"; +if (brandId != null && modelId != null) { + var model = brandId + "-" + modelId; + profile = model; + // The profile name chosen at install, kept in the integration metadata + var customProfile = metadata["profile." + model]; + if (customProfile != null && customProfile != "") { + profile = customProfile; + } + var attributeKeys = metadata["attributes." + model]; + if (attributeKeys != null && attributeKeys != "") { + foreach (item : attributeKeys.split(",")) { + var key = item.trim(); + if (key != "" && values.containsKey(key)) { + attributes.put(key, values.get(key)); + values.remove(key); + } + } + } +} +var result = { profile: profile, telemetry: { ts: metadata.ts, values: values } }; +if (!history.isEmpty()) { + history.add({ ts: metadata.ts, values: values }); + result.telemetry = history; +} +if (!attributes.isEmpty()) { + result.attributes = attributes; +} +return result; diff --git a/application/src/main/resources/converters/TTN/downlink/js.raw b/application/src/main/resources/converters/TTN/downlink/js.raw new file mode 100644 index 0000000000..e30c1c75ef --- /dev/null +++ b/application/src/main/resources/converters/TTN/downlink/js.raw @@ -0,0 +1,49 @@ +// Encode downlink data from incoming Rule Engine message +// Shared by the TTN and TTI integrations (The Things Stack). + +// msg - JSON message payload downlink message json +// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. +// metadata - list of key-value pairs with additional data about the message +// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter + +/** Encoder **/ + +// Target device identifier used to build the TTN/TTI downlink topic (devId is assumed to be added via Originator fields rule node) +var devId = metadata.devId; +// LoRaWAN frame port the downlink is scheduled on (cs_fPort is assumed to be added via Originator attributes rule node, prefix 'cs_' (client-side) is added by rule node) +// Default port to 1 when the device fPort attribute is missing or empty. parseInt keeps f_port a number, as the TTN/TTI API expects. +var fPort = (metadata.cs_fPort != null && metadata.cs_fPort != '') + ? parseInt(metadata.cs_fPort) + : 1; + +// EXAMPLE — replace this: it encodes a single field ('powerState') from the downlink message. +// Swap 'powerState' (and the 'unspecified' fallback) for the field(s) and encoding your device expects; +// as written, any downlink without a 'powerState' field sends the constant value 'unspecified'. +var base64Payload = (msg.powerState != null) + ? btoa(msg.powerState) // if powerState is present, encode it to base64 + : btoa('unspecified'); // fall back to 'unspecified' when absent + +// The Things Stack (TTN/TTI) expects a 'downlinks' array; each entry is a single scheduled downlink. +var data = { + downlinks: [{ + // Frame port to deliver the payload on (must match the device's expected port). + f_port: fPort, + // false - best-effort downlink; set to true to request an acknowledgement from the device. + confirmed: false, + // Downlink payload, base64-encoded as required by the TTN/TTI API. + frm_payload: base64Payload, + // Scheduling priority for the network server: LOWEST, LOW, BELOW_NORMAL, NORMAL, ABOVE_NORMAL, HIGH, HIGHEST. + priority: "NORMAL" + }] +}; + +// Result object with encoded downlink payload +var result = { + contentType: "JSON", + data: JSON.stringify(data), + metadata: { + devId: devId + } +}; + +return result; diff --git a/application/src/main/resources/converters/TTN/downlink/tbel.raw b/application/src/main/resources/converters/TTN/downlink/tbel.raw new file mode 100644 index 0000000000..e6f37e8fdc --- /dev/null +++ b/application/src/main/resources/converters/TTN/downlink/tbel.raw @@ -0,0 +1,50 @@ +// Encode downlink data from incoming Rule Engine message +// Shared by the TTN and TTI integrations (The Things Stack). + +// msg - JSON message payload downlink message json +// msgType - type of message, for ex. 'ATTRIBUTES_UPDATED', 'POST_TELEMETRY_REQUEST', etc. +// metadata - list of key-value pairs with additional data about the message +// integrationMetadata - list of key-value pairs with additional data defined in Integration executing this converter + +/** Encoder **/ + +// Target device identifier used to build the TTN/TTI downlink topic (devId is assumed to be added via Originator fields rule node) +var devId = metadata.devId; +// LoRaWAN frame port the downlink is scheduled on (cs_fPort is assumed to be added via Originator attributes rule node, prefix 'cs_' (client-side) is added by rule node) +// Default port to 1 when the device fPort attribute is missing or empty. parseInt keeps f_port a number, as the TTN/TTI API expects. +var fPort = (metadata.cs_fPort != null && metadata.cs_fPort != '') + ? parseInt(metadata.cs_fPort) + : 1; + +// EXAMPLE — replace this: it encodes a single field ('powerState') from the downlink message. +// Swap 'powerState' (and the 'unspecified' fallback) for the field(s) and encoding your device expects; +// as written, any downlink without a 'powerState' field sends the constant value 'unspecified'. +// If powerState is present, encode it to base64; otherwise fall back to 'unspecified'. +var base64Payload = (msg.powerState != null) + ? btoa(msg.powerState) + : btoa('unspecified'); + +// The Things Stack (TTN/TTI) expects a 'downlinks' array; each entry is a single scheduled downlink. +var data = { + downlinks: [{ + // Frame port to deliver the payload on (must match the device's expected port). + f_port: fPort, + // false - best-effort downlink; set to true to request an acknowledgement from the device. + confirmed: false, + // Downlink payload, base64-encoded as required by the TTN/TTI API. + frm_payload: base64Payload, + // Scheduling priority for the network server: LOWEST, LOW, BELOW_NORMAL, NORMAL, ABOVE_NORMAL, HIGH, HIGHEST. + priority: "NORMAL" + }] +}; + +// Result object with encoded downlink payload +var result = { + contentType: "JSON", + data: JSON.stringify(data), + metadata: { + devId: devId + } +}; + +return result; diff --git a/application/src/main/resources/converters/TTN/uplink/js.raw b/application/src/main/resources/converters/TTN/uplink/js.raw new file mode 100644 index 0000000000..9cc99a41a9 --- /dev/null +++ b/application/src/main/resources/converters/TTN/uplink/js.raw @@ -0,0 +1,73 @@ +// The Things Stack adds decoded_payload for a device registered from the LoRaWAN Device Repository, and the payload +// is then that JSON: its keys become telemetry. A Milesight-style history list keeps each record's time. +// Such a device gets the profile -, so all devices of one model share it, +// or the name the integration metadata gives it under profile.-. +// A device that is not in the Repository can name its model in decoded_payload: its payload formatter adds +// tbVersionIds: { brand_id, model_id }, which is not telemetry; they become the attributes brandId and modelId, as the +// integration writes them from version_ids. Any other device gets LoRaWAN Device. +// The keys the integration metadata lists under attributes.- (comma-separated) are saved as +// attributes, not telemetry: device information and settings. +var values = {}; +var attributes = {}; +var history = []; +var versionIds = null; +if (metadata.payloadFormat == 'JSON') { + values = decodeToJson(payload); + if (Array.isArray(values.history)) { + values.history.forEach(function (record) { + if (record.timestamp != null) { + var ts = record.timestamp * 1000; + delete record.timestamp; + history.push({ ts: ts, values: record }); + } + }); + delete values.history; + } + if (Object.prototype.hasOwnProperty.call(values, 'tbVersionIds')) { + versionIds = values.tbVersionIds; + delete values.tbVersionIds; + } +} +var brandId = metadata.brandId; +var modelId = metadata.modelId; +if ((brandId == null || modelId == null) && typeof versionIds === 'object' && versionIds !== null && !Array.isArray(versionIds)) { + brandId = versionIds.brand_id; + modelId = versionIds.model_id; + if (brandId != null && modelId != null) { + attributes.brandId = brandId; + attributes.modelId = modelId; + } +} +var profile = 'LoRaWAN Device'; +if (brandId != null && modelId != null) { + var model = brandId + '-' + modelId; + profile = model; + // The profile name chosen at install, kept in the integration metadata + var customProfile = metadata['profile.' + model]; + if (customProfile != null && customProfile != '') { + profile = customProfile; + } + var attributeKeys = metadata['attributes.' + model]; + if (attributeKeys != null && attributeKeys != '') { + attributeKeys.split(',').forEach(function (key) { + key = key.trim(); + if (key != '' && values.hasOwnProperty(key)) { + attributes[key] = values[key]; + delete values[key]; + } + }); + } +} +var result = { profile: profile, telemetry: { ts: metadata.ts, values: values } }; +if (history.length > 0) { + history.push({ ts: metadata.ts, values: values }); + result.telemetry = history; +} +if (Object.keys(attributes).length > 0) { + result.attributes = attributes; +} +return result; + +function decodeToJson(payload) { + return JSON.parse(String.fromCharCode.apply(String, payload)); +} diff --git a/application/src/main/resources/converters/TTN/uplink/payload.json b/application/src/main/resources/converters/TTN/uplink/payload.json new file mode 100644 index 0000000000..b6e8b80b29 --- /dev/null +++ b/application/src/main/resources/converters/TTN/uplink/payload.json @@ -0,0 +1,72 @@ +{ + "end_device_ids": { + "device_id": "eui-1000000000000001", + "application_ids": { + "application_id": "application-tts-name" + }, + "dev_eui": "1000000000000001", + "join_eui": "2000000000000001", + "dev_addr": "20000001" + }, + "correlation_ids": ["as:up:01H0S7ZJQ9MQPMVY49FT3SE07M", "gs:conn:01H03BQZ9342X3Y86DJ2P704E5", "gs:up:host:01H03BQZ99EGAM52KK1300GFKN", "gs:uplink:01H0S7ZJGS6D9TJSKJN8XNTMAV", "ns:uplink:01H0S7ZJGS9KKD4HTTPKFEMWCV", "rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H0S7ZJGSF3M38ZRZVTM38DEC", "rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01H0S7ZJQ8R2EH5AA269AKM8DX"], + "received_at": "2023-05-19T05:33:35.848446463Z", + "uplink_message": { + "session_key_id": "AYfqmb0pc/1uRZv9xUydgQ==", + "f_port": 85, + "f_cnt": 10335, + "frm_payload": "A2fuAARofAUAAQbLAgd9qAMIfSUACXNmJwt9IAAMfTAA", + "decoded_payload": { + "temperature": 23.8, + "humidity": 62, + "pir": "trigger", + "light_level": 2, + "co2": 936, + "tvoc": 0.37, + "pressure": 1008.6, + "pm2_5": 32, + "pm10": 48 + }, + "rx_metadata": [{ + "gateway_ids": { + "gateway_id": "eui-6a7e111a10000000", + "eui": "6A7E111A10000000" + }, + "time": "2023-05-19T05:33:35.608982Z", + "timestamp": 3893546133, + "rssi": -35, + "channel_rssi": -35, + "snr": 13.2, + "frequency_offset": "69", + "uplink_token": "CiIKIAoUZXVpLTZhN2UxMTFhMTAwMDAwMDASCCThJP/+9k6eEJWZy8AOGgwIr5ScowYQvNbUsQIgiMy8y6jwpwE=", + "channel_index": 3, + "received_at": "2023-05-19T05:33:35.607383681Z" + }], + "settings": { + "data_rate": { + "lora": { + "bandwidth": 125000, + "spreading_factor": 7, + "coding_rate": "4/5" + } + }, + "frequency": "867100000", + "timestamp": 3893546133, + "time": "2023-05-19T05:33:35.608982Z" + }, + "received_at": "2023-05-19T05:33:35.641841782Z", + "consumed_airtime": "0.056576s", + "version_ids": { + "brand_id": "milesight-iot", + "model_id": "am308", + "hardware_version": "1.x", + "firmware_version": "1.x", + "band_id": "EU_863_870" + }, + "network_ids": { + "net_id": "000013", + "tenant_id": "ttn", + "cluster_id": "eu1", + "cluster_address": "eu1.cloud.thethings.network" + } + } +} diff --git a/application/src/main/resources/converters/TTN/uplink/tbel.raw b/application/src/main/resources/converters/TTN/uplink/tbel.raw new file mode 100644 index 0000000000..ff5744a55e --- /dev/null +++ b/application/src/main/resources/converters/TTN/uplink/tbel.raw @@ -0,0 +1,69 @@ +// The Things Stack adds decoded_payload for a device registered from the LoRaWAN Device Repository, and the payload +// is then that JSON: its keys become telemetry. A Milesight-style history list keeps each record's time. +// Such a device gets the profile -, so all devices of one model share it, +// or the name the integration metadata gives it under profile.-. +// A device that is not in the Repository can name its model in decoded_payload: its payload formatter adds +// tbVersionIds: { brand_id, model_id }, which is not telemetry; they become the attributes brandId and modelId, as the +// integration writes them from version_ids. Any other device gets LoRaWAN Device. +// The keys the integration metadata lists under attributes.- (comma-separated) are saved as +// attributes, not telemetry: device information and settings. +var values = {}; +var attributes = {}; +var history = []; +var versionIds = null; +if (metadata.payloadFormat == "JSON") { + values = decodeToJson(payload); + if (values.history instanceof java.util.List) { + foreach (record : values.history) { + if (record.timestamp != null) { + var ts = record.timestamp * 1000; + record.remove("timestamp"); + history.add({ ts: ts, values: record }); + } + } + values.remove("history"); + } + if (values.containsKey("tbVersionIds")) { + versionIds = values.tbVersionIds; + values.remove("tbVersionIds"); + } +} +var brandId = metadata.brandId; +var modelId = metadata.modelId; +if ((brandId == null || modelId == null) && versionIds instanceof java.util.Map) { + brandId = versionIds.brand_id; + modelId = versionIds.model_id; + if (brandId != null && modelId != null) { + attributes.put("brandId", brandId); + attributes.put("modelId", modelId); + } +} +var profile = "LoRaWAN Device"; +if (brandId != null && modelId != null) { + var model = brandId + "-" + modelId; + profile = model; + // The profile name chosen at install, kept in the integration metadata + var customProfile = metadata["profile." + model]; + if (customProfile != null && customProfile != "") { + profile = customProfile; + } + var attributeKeys = metadata["attributes." + model]; + if (attributeKeys != null && attributeKeys != "") { + foreach (item : attributeKeys.split(",")) { + var key = item.trim(); + if (key != "" && values.containsKey(key)) { + attributes.put(key, values.get(key)); + values.remove(key); + } + } + } +} +var result = { profile: profile, telemetry: { ts: metadata.ts, values: values } }; +if (!history.isEmpty()) { + history.add({ ts: metadata.ts, values: values }); + result.telemetry = history; +} +if (!attributes.isEmpty()) { + result.attributes = attributes; +} +return result; diff --git a/ui-ngx/src/assets/converters/js-encoder.raw b/application/src/main/resources/converters/default/downlink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-encoder.raw rename to application/src/main/resources/converters/default/downlink/js.raw diff --git a/ui-ngx/src/assets/converters/tbel-encoder.raw b/application/src/main/resources/converters/default/downlink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-encoder.raw rename to application/src/main/resources/converters/default/downlink/tbel.raw diff --git a/ui-ngx/src/assets/converters/js-decoder-v2.raw b/application/src/main/resources/converters/default/uplink/js-v2.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-decoder-v2.raw rename to application/src/main/resources/converters/default/uplink/js-v2.raw diff --git a/ui-ngx/src/assets/converters/js-decoder.raw b/application/src/main/resources/converters/default/uplink/js.raw similarity index 100% rename from ui-ngx/src/assets/converters/js-decoder.raw rename to application/src/main/resources/converters/default/uplink/js.raw diff --git a/ui-ngx/src/assets/converters/tbel-decoder.raw b/application/src/main/resources/converters/default/uplink/tbel.raw similarity index 100% rename from ui-ngx/src/assets/converters/tbel-decoder.raw rename to application/src/main/resources/converters/default/uplink/tbel.raw diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index adb655496f..992977aa83 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1115,6 +1115,9 @@ redis: nodes: "${REDIS_NODES:}" # Maximum number of redirects to follow when executing commands across the cluster. max-redirects: "${REDIS_MAX_REDIRECTS:12}" + # Period in seconds of the background refresh of the cluster slot map. It finds slots that moved to another node + # (after a failover, or when a node gets a new IP) even before a command to the old node fails. Set 0 to disable. + topology-refresh-period-sec: "${REDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC:30}" # if set false will be used pool config build from values of the pool config section useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}" sentinel: @@ -2020,6 +2023,10 @@ edges: max_inbound_message_size: "${EDGES_RPC_MAX_INBOUND_MESSAGE_SIZE:4194304}" # Maximum length of telemetry (time-series and attributes) message the cloud sends to the edge. By default, there is no limitation. max_telemetry_message_size: "${EDGES_RPC_MAX_TELEMETRY_MESSAGE_SIZE:0}" + # Maximum time the cloud spends on a mail/SMS/notification send delegated by the edge before failing it. + # Must stay below the edge's 'cloud.uplink_pack_timeout_sec' (60 seconds by default): if the uplink is not + # answered in time the edge resends everything still unacknowledged, which delivers the same mail or SMS twice. + delegated_send_timeout_sec: "${EDGES_RPC_DELEGATED_SEND_TIMEOUT_SEC:20}" storage: # Max records of edge event to read from DB and sent to the edge max_read_records_count: "${EDGES_STORAGE_MAX_READ_RECORDS_COUNT:50}" diff --git a/application/src/main/sbom/gateway-management-extension.cdx.json b/application/src/main/sbom/gateway-management-extension.cdx.json new file mode 100644 index 0000000000..e5669ac893 --- /dev/null +++ b/application/src/main/sbom/gateway-management-extension.cdx.json @@ -0,0 +1,206 @@ +{ + "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.6", + "version": 1, + "metadata": { + "tools": { + "components": [ + { + "type": "library", + "name": "cyclonedx-library", + "group": "@cyclonedx", + "version": "10.3.0", + "author": "Jan Kowalleck", + "description": "Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).", + "licenses": [ + { + "license": { + "id": "Apache-2.0" + } + } + ], + "externalReferences": [ + { + "url": "https://github.com/CycloneDX/cyclonedx-javascript-library/issues", + "type": "issue-tracker", + "comment": "as detected from PackageJson property \"bugs.url\"" + }, + { + "url": "git+https://github.com/CycloneDX/cyclonedx-javascript-library.git", + "type": "vcs", + "comment": "as detected from PackageJson property \"repository.url\"" + }, + { + "url": "https://github.com/CycloneDX/cyclonedx-javascript-library#readme", + "type": "website", + "comment": "as detected from PackageJson property \"homepage\"" + } + ], + "properties": [ + { + "name": "cdx:npm:package:constraint:engine:node", + "value": ">=20.18.0" + } + ] + } + ] + }, + "component": { + "type": "library", + "name": "gateway-management-extension", + "version": "ad35b4bb843b4743516186513de0de2036eba698", + "bom-ref": "pkg:github/thingsboard/gateway-management-extensions@ad35b4bb843b4743516186513de0de2036eba698", + "supplier": { + "name": "ThingsBoard, Inc.", + "url": [ + "https://thingsboard.io/" + ] + }, + "description": "ThingsBoard Gateway Management Extension", + "hashes": [ + { + "alg": "SHA-256", + "content": "88a02bcc1834d6b31dbf209b1cec8b72df8a6e8abe2ef23979c89bf2fb19002b" + }, + { + "alg": "SHA-512", + "content": "3edf11e676df22b2069c5f2a9f22fb582259d9f8df65f13696ef57c6286d12dd3d1ae912ca0154896d1fb286a8ebec288bb907af14fe24c77de272c419d74252" + } + ], + "licenses": [ + { + "license": { + "id": "Apache-2.0" + } + } + ], + "purl": "pkg:github/thingsboard/gateway-management-extensions@ad35b4bb843b4743516186513de0de2036eba698", + "externalReferences": [ + { + "url": "https://github.com/thingsboard/gateway-management-extensions/tree/ad35b4bb843b4743516186513de0de2036eba698", + "type": "vcs" + } + ] + }, + "supplier": { + "name": "ThingsBoard, Inc.", + "url": [ + "https://thingsboard.io/" + ] + }, + "properties": [ + { + "name": "cdx:reproducible", + "value": "true" + } + ] + }, + "components": [ + { + "type": "library", + "name": "echarts", + "version": "5.5.4-TB", + "bom-ref": "pkg:npm/echarts@5.5.4-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fecharts%2Farchive%2F5.5.4-TB.tar.gz", + "description": "Apache ECharts is a powerful, interactive charting and data visualization library for browser", + "licenses": [ + { + "license": { + "id": "Apache-2.0", + "acknowledgement": "declared" + } + } + ], + "purl": "pkg:npm/echarts@5.5.4-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fecharts%2Farchive%2F5.5.4-TB.tar.gz", + "externalReferences": [ + { + "url": "https://github.com/thingsboard/echarts/archive/5.5.4-TB.tar.gz", + "type": "distribution", + "comment": "as detected from yarn.lock property \"resolved\"" + }, + { + "url": "https://github.com/thingsboard/echarts/issues", + "type": "issue-tracker", + "comment": "as detected from PackageJson property \"bugs.url\"" + }, + { + "url": "git+https://github.com/thingsboard/echarts.git", + "type": "vcs", + "comment": "as detected from PackageJson property \"repository.url\"" + }, + { + "url": "https://github.com/thingsboard/echarts", + "type": "website", + "comment": "as detected from PackageJson property \"homepage\"" + } + ], + "properties": [ + { + "name": "cdx:npm:package:path", + "value": "node_modules/echarts" + } + ] + }, + { + "type": "library", + "name": "zrender", + "version": "5.5.1-TB", + "bom-ref": "pkg:npm/zrender@5.5.1-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fzrender%2Farchive%2F5.5.1-TB.tar.gz", + "description": "A lightweight graphic library providing 2d draw for Apache ECharts", + "licenses": [ + { + "license": { + "id": "BSD-3-Clause", + "acknowledgement": "declared" + } + } + ], + "purl": "pkg:npm/zrender@5.5.1-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fzrender%2Farchive%2F5.5.1-TB.tar.gz", + "externalReferences": [ + { + "url": "https://github.com/thingsboard/zrender/archive/5.5.1-TB.tar.gz", + "type": "distribution", + "comment": "as detected from yarn.lock property \"resolved\"" + }, + { + "url": "https://github.com/thingsboard/zrender/issues", + "type": "issue-tracker", + "comment": "as detected from PackageJson property \"bugs.url\"" + }, + { + "url": "git+https://github.com/thingsboard/zrender.git", + "type": "vcs", + "comment": "as detected from PackageJson property \"repository.url\"" + }, + { + "url": "https://github.com/thingsboard/zrender#readme", + "type": "website", + "comment": "as detected from PackageJson property \"homepage\"" + } + ], + "properties": [ + { + "name": "cdx:npm:package:path", + "value": "node_modules/zrender" + } + ] + } + ], + "dependencies": [ + { + "ref": "pkg:github/thingsboard/gateway-management-extensions@ad35b4bb843b4743516186513de0de2036eba698", + "dependsOn": [ + "pkg:npm/echarts@5.5.4-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fecharts%2Farchive%2F5.5.4-TB.tar.gz" + ] + }, + { + "ref": "pkg:npm/echarts@5.5.4-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fecharts%2Farchive%2F5.5.4-TB.tar.gz", + "dependsOn": [ + "pkg:npm/zrender@5.5.1-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fzrender%2Farchive%2F5.5.1-TB.tar.gz" + ] + }, + { + "ref": "pkg:npm/zrender@5.5.1-TB?download_url=https%3A%2F%2Fgithub.com%2Fthingsboard%2Fzrender%2Farchive%2F5.5.1-TB.tar.gz" + } + ] +} diff --git a/application/src/test/java/org/thingsboard/server/config/SwaggerConfigurationTest.java b/application/src/test/java/org/thingsboard/server/config/SwaggerConfigurationTest.java new file mode 100644 index 0000000000..859d361849 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/config/SwaggerConfigurationTest.java @@ -0,0 +1,65 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.config; + +import io.swagger.v3.core.converter.AnnotatedType; +import io.swagger.v3.core.converter.ModelConverters; +import io.swagger.v3.oas.models.media.Schema; +import org.junit.jupiter.api.Test; +import org.thingsboard.server.common.data.edge.EdgeInfo; +import org.thingsboard.server.common.data.report.Report; +import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.common.data.security.model.mfa.account.TwoFaAccountConfig; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; + +public class SwaggerConfigurationTest { + + @Test + public void testNotRequiredPropertiesAreRemovedFromRequired() { + SwaggerConfiguration config = new SwaggerConfiguration(); + // Local instance: the converter is not registered in the global ModelConverters singleton. + ModelConverters converters = new ModelConverters(true); + converters.addConverter(config.mapAwareConverter()); + + Map schemas = new HashMap<>(); + // Resolving the polymorphic parent produces the subtypes as allOf schemas. + for (Class cls : new Class[]{TwoFaAccountConfig.class, RuleChainMetaData.class, EdgeInfo.class, Report.class}) { + schemas.putAll(converters.readAll(new AnnotatedType(cls))); + } + + config.removeNotRequiredProperties(schemas); + + // @NotBlank / @NotEmpty + @Schema(requiredMode = NOT_REQUIRED) + assertThat(requiredOf(schemas.get("SmsTwoFaAccountConfig"))).doesNotContain("phoneNumber"); + assertThat(requiredOf(schemas.get("BackupCodeTwoFaAccountConfig"))).doesNotContain("codes"); + // @NotNull + @Schema(requiredMode = NOT_REQUIRED) + assertThat(requiredOf(schemas.get("Report"))).doesNotContain("templateId").contains("name"); + assertThat(requiredOf(schemas.get("RuleChainMetaData"))) + .doesNotContain("firstNodeIndex", "connections", "ruleChainConnections") + .contains("nodes"); + assertThat(requiredOf(schemas.get("EdgeInfo"))).doesNotContain("edgeLicenseKey").contains("name"); + } + + private static Set requiredOf(Schema schema) { + assertThat(schema).isNotNull(); + Set required = new HashSet<>(); + if (schema.getRequired() != null) { + required.addAll(schema.getRequired()); + } + if (schema.getAllOf() != null) { + for (Schema part : schema.getAllOf()) { + if (part.getRequired() != null) { + required.addAll(part.getRequired()); + } + } + } + return required; + } + +} diff --git a/application/src/test/java/org/thingsboard/server/controller/AbstractAiControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AbstractAiControllerTest.java index 3f3b1d13d8..92b16fde51 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AbstractAiControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AbstractAiControllerTest.java @@ -121,12 +121,23 @@ public abstract class AbstractAiControllerTest extends AbstractControllerTest { return TbAiClient.TbAiResponse.builder().success(false).error(error).build(); } + protected static TbAiClient.TbAiResponse failure(int status, String error) { + return TbAiClient.TbAiResponse.builder().success(false).status(status).error(error).build(); + } + protected static ObjectNode chatMessage(String from, String content) { return JacksonUtil.newObjectNode() .put("from", from) .put("content", content); } + protected MockHttpServletRequestBuilder resumeRequest(UUID chatId) { + MockHttpServletRequestBuilder request = post("/api/ai/chats/" + chatId + "/resume") + .accept(MediaType.TEXT_EVENT_STREAM); + setJwtToken(request); + return request; + } + protected MockHttpServletRequestBuilder sendMessageRequest(UUID chatId, JsonNode body, String acceptLanguage) { MockHttpServletRequestBuilder request = post("/api/ai/chats/" + chatId + "/messages") .contentType(MediaType.APPLICATION_JSON) diff --git a/application/src/test/java/org/thingsboard/server/controller/AbstractOnPremiseAiControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AbstractOnPremiseAiControllerTest.java index 4fc327c082..b2e9e86b6d 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AbstractOnPremiseAiControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AbstractOnPremiseAiControllerTest.java @@ -2,13 +2,11 @@ // SPDX-License-Identifier: BUSL-1.1 package org.thingsboard.server.controller; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.thingsboard.ai.common.client.TbAiClient; import org.thingsboard.ai.common.client.TbAiHeaders; import org.thingsboard.server.dao.subscription.SubscriptionService; -import org.thingsboard.server.service.install.ProjectInfo; import java.util.Map; @@ -24,8 +22,6 @@ public abstract class AbstractOnPremiseAiControllerTest extends AbstractAiContro @MockitoSpyBean protected SubscriptionService subscriptionService; - @Autowired - protected ProjectInfo projectInfo; protected void givenSubscriptionProvidesAiToken() { doReturn(AI_TOKEN).when(subscriptionService).getAiToken(); @@ -36,8 +32,7 @@ public abstract class AbstractOnPremiseAiControllerTest extends AbstractAiContro assertThat(tokenProvider.getToken()).isEqualTo(AI_TOKEN); assertThat(tokenProvider.getAdditionalInfo()).containsExactlyInAnyOrderEntriesOf(Map.of( TbAiHeaders.USER_ID, tenantAdminUserId.getId().toString(), - TbAiHeaders.TENANT_ID, tenantId.getId().toString(), - TbAiHeaders.TB_VERSION, projectInfo.getProjectVersion() + TbAiHeaders.TENANT_ID, tenantId.getId().toString() )); } diff --git a/application/src/test/java/org/thingsboard/server/controller/AdminControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AdminControllerTest.java index 33b13b1339..b571440e70 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AdminControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AdminControllerTest.java @@ -175,6 +175,17 @@ public class AdminControllerTest extends AbstractControllerTest { loginTenantAdmin(); } + @Test + public void testGetTenantAdminSettings() throws Exception { + loginTenantAdmin(); + for (String key : new String[]{"jwt", "mail", "general"}) { + AdminSettings adminSettings = doGet("/api/admin/settings/" + key + "?systemByDefault=true", AdminSettings.class); + assertThat(adminSettings.getTenantId()).isEqualTo(tenantId); + assertThat(adminSettings.getKey()).isEqualTo(key); + assertThat(adminSettings.getJsonValue().isEmpty()).isTrue(); + } + } + @Test public void testGetAndSaveDefaultJwtSettings() throws Exception { JwtSettings jwtSettings; diff --git a/application/src/test/java/org/thingsboard/server/controller/AiChatControllerOnPremiseTest.java b/application/src/test/java/org/thingsboard/server/controller/AiChatControllerOnPremiseTest.java index 04554f1494..27da3f6e79 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AiChatControllerOnPremiseTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AiChatControllerOnPremiseTest.java @@ -3,8 +3,10 @@ package org.thingsboard.server.controller; import org.thingsboard.server.service.ai.transport.TbAiTurnContext; +import org.thingsboard.server.service.ai.transport.TbAiTurnLink; import org.thingsboard.ai.common.channel.ChannelProtocol; import org.thingsboard.ai.common.channel.ChatOperationRequest; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import org.junit.Test; @@ -29,6 +31,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @DaoSqlTest public class AiChatControllerOnPremiseTest extends AbstractOnPremiseAiControllerTest { + private static final JsonNode TOOL_CARDS = JacksonUtil.newObjectNode().put("toolCards", true); + @Test public void shouldCreateChatWithOnPremiseToken_whenTenantAdmin() throws Exception { // GIVEN @@ -83,13 +87,13 @@ public class AiChatControllerOnPremiseTest extends AbstractOnPremiseAiController loginTenantAdmin(); givenSubscriptionProvidesAiToken(); UUID chatId = UUID.randomUUID(); - givenOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, null), success(JacksonUtil.newArrayNode())); + givenOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, TOOL_CARDS), success(JacksonUtil.newArrayNode())); // WHEN doGet("/api/ai/chats/" + chatId + "/messages").andExpect(status().isOk()); // THEN - TbAiTurnContext context = verifyOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, null)); + TbAiTurnContext context = verifyOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, TOOL_CARDS)); assertTokenProviderBelongsToTenantAdmin(context.tokenProvider()); } @@ -117,7 +121,7 @@ public class AiChatControllerOnPremiseTest extends AbstractOnPremiseAiController UUID chatId = UUID.randomUUID(); ObjectNode requestBody = sendMessageBody("What is the device status?", null); String acceptLanguage = "es-ES"; - given(tbAiTransport.sendChatMessage(eq(chatId), eq(requestBody), any(TbAiTurnContext.class))) + given(tbAiTransport.sendChatMessage(eq(chatId), eq(requestBody), any(TbAiTurnContext.class), any(TbAiTurnLink.class))) .willReturn(Flux.just(ServerSentEvent.builder().event("message").data("Checking device status...").build())); // WHEN @@ -128,7 +132,7 @@ public class AiChatControllerOnPremiseTest extends AbstractOnPremiseAiController // THEN ArgumentCaptor context = ArgumentCaptor.forClass(TbAiTurnContext.class); - verify(tbAiTransport).sendChatMessage(eq(chatId), eq(requestBody), context.capture()); + verify(tbAiTransport).sendChatMessage(eq(chatId), eq(requestBody), context.capture(), any(TbAiTurnLink.class)); assertThat(context.getValue().tbAccessToken()).isEqualTo("Bearer " + token); assertThat(context.getValue().acceptLanguage()).isEqualTo(acceptLanguage); assertTokenProviderBelongsToTenantAdmin(context.getValue().tokenProvider()); diff --git a/application/src/test/java/org/thingsboard/server/controller/AiChatControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AiChatControllerTest.java index 52de635b06..5af2769ff6 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AiChatControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AiChatControllerTest.java @@ -3,6 +3,7 @@ package org.thingsboard.server.controller; import org.thingsboard.server.service.ai.transport.TbAiTurnContext; +import org.thingsboard.server.service.ai.transport.TbAiTurnLink; import org.thingsboard.ai.common.channel.ChannelProtocol; import org.thingsboard.ai.common.channel.ChatOperationRequest; import com.fasterxml.jackson.databind.JsonNode; @@ -40,6 +41,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @DaoSqlTest public class AiChatControllerTest extends AbstractAiControllerTest { + private static final JsonNode TOOL_CARDS = JacksonUtil.newObjectNode().put("toolCards", true); + @MockitoBean private TbApiUsageReportClient apiUsageReportClient; @@ -103,14 +106,14 @@ public class AiChatControllerTest extends AbstractAiControllerTest { loginTenantAdmin(); UUID chatId = UUID.randomUUID(); ArrayNode messages = chatMessages(); - givenOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, null), success(messages)); + givenOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, TOOL_CARDS), success(messages)); // WHEN JsonNode result = doGet("/api/ai/chats/" + chatId + "/messages", JsonNode.class); // THEN assertThat(result).isEqualTo(messages); - verifyOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, null)); + verifyOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, TOOL_CARDS)); } @Test @@ -138,7 +141,7 @@ public class AiChatControllerTest extends AbstractAiControllerTest { ServerSentEvent.builder().event("message").data("Creating a high-temperature alarm rule...").build(), ServerSentEvent.builder().event("creditsUsed").data("{\"creditsUsed\":5}").build() ); - given(tbAiTransport.sendChatMessage(eq(chatId), eq(requestBody), any(TbAiTurnContext.class))).willReturn(upstream); + given(tbAiTransport.sendChatMessage(eq(chatId), eq(requestBody), any(TbAiTurnContext.class), any(TbAiTurnLink.class))).willReturn(upstream); // WHEN MvcResult asyncStart = mockMvc.perform(sendMessageRequest(chatId, requestBody, acceptLanguage)) @@ -156,12 +159,39 @@ public class AiChatControllerTest extends AbstractAiControllerTest { verify(apiUsageReportClient).report(any(), any(), eq(ApiUsageRecordKey.AI_CREDITS_COUNT), eq(5L)); ArgumentCaptor context = ArgumentCaptor.forClass(TbAiTurnContext.class); - verify(tbAiTransport).sendChatMessage(eq(chatId), eq(requestBody), context.capture()); + verify(tbAiTransport).sendChatMessage(eq(chatId), eq(requestBody), context.capture(), any(TbAiTurnLink.class)); assertThat(context.getValue().tbAccessToken()).isEqualTo("Bearer " + token); assertThat(context.getValue().acceptLanguage()).isEqualTo(acceptLanguage); assertTokenProviderBelongsToTenantAdmin(context.getValue().tokenProvider()); } + @Test + public void shouldStreamTheResumedTurnWithoutCheckingCredits_whenResumeChat() throws Exception { + // GIVEN — the browser reloaded while the assistant was still working, and AI credits ran out meanwhile + loginTenantAdmin(); + UUID chatId = UUID.randomUUID(); + givenAiCreditsExhausted(); + Flux> upstream = Flux.just( + ServerSentEvent.builder().event("turnResumed").data("{}").build(), + ServerSentEvent.builder().event("assistantMessage").data("{\"message\":\"Done.\"}").build() + ); + given(tbAiTransport.resumeChat(eq(chatId), any(TbAiTurnContext.class), any(TbAiTurnLink.class))).willReturn(upstream); + + // WHEN + MvcResult asyncStart = mockMvc.perform(resumeRequest(chatId)) + .andExpect(request().asyncStarted()) + .andReturn(); + String body = mockMvc.perform(asyncDispatch(asyncStart)) + .andExpect(status().isOk()) + .andReturn().getResponse().getContentAsString(); + + // THEN + assertThat(body).contains("event:turnResumed", "Done."); + ArgumentCaptor context = ArgumentCaptor.forClass(TbAiTurnContext.class); + verify(tbAiTransport).resumeChat(eq(chatId), context.capture(), any(TbAiTurnLink.class)); + assertThat(context.getValue().tbAccessToken()).isEqualTo("Bearer " + token); + } + // ------------------------------------------------------------------------ // AI credit-check semantics // ------------------------------------------------------------------------ @@ -224,7 +254,7 @@ public class AiChatControllerTest extends AbstractAiControllerTest { loginTenantAdmin(); UUID chatId = UUID.randomUUID(); String error = "Chat service unavailable"; - givenOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, null), failure(error)); + givenOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, TOOL_CARDS), failure(error)); // WHEN doGet("/api/ai/chats/" + chatId + "/messages") @@ -232,7 +262,7 @@ public class AiChatControllerTest extends AbstractAiControllerTest { .andExpect(statusReason(equalTo(error))); // THEN - verifyOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, null)); + verifyOperation(ChannelProtocol.CHAT_MESSAGES, new ChatOperationRequest(chatId, TOOL_CARDS)); } // ------------------------------------------------------------------------ diff --git a/application/src/test/java/org/thingsboard/server/controller/AiModelControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AiModelControllerTest.java index 84ce79e571..21ae626218 100644 --- a/application/src/test/java/org/thingsboard/server/controller/AiModelControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/AiModelControllerTest.java @@ -9,7 +9,10 @@ import org.junit.Test; import org.springframework.test.web.servlet.ResultActions; import org.thingsboard.common.util.SsrfProtectionValidator; import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.User; import org.thingsboard.server.common.data.ai.AiModel; +import org.thingsboard.server.common.data.ai.AiModelInfo; +import org.thingsboard.server.common.data.ai.dto.TbChatPrompt; import org.thingsboard.server.common.data.ai.dto.TbChatRequest; import org.thingsboard.server.common.data.ai.dto.TbChatResponse; import org.thingsboard.server.common.data.ai.dto.TbContent; @@ -18,20 +21,25 @@ import org.thingsboard.server.common.data.ai.model.chat.AnthropicChatModelConfig import org.thingsboard.server.common.data.ai.model.chat.GoogleAiGeminiChatModelConfig; import org.thingsboard.server.common.data.ai.model.chat.GoogleVertexAiGeminiChatModelConfig; import org.thingsboard.server.common.data.ai.model.chat.OpenAiChatModelConfig; +import org.thingsboard.server.common.data.ai.provider.AiProvider; import org.thingsboard.server.common.data.ai.provider.AnthropicProviderConfig; import org.thingsboard.server.common.data.ai.provider.GoogleAiGeminiProviderConfig; import org.thingsboard.server.common.data.ai.provider.GoogleVertexAiGeminiProviderConfig; import org.thingsboard.server.common.data.ai.provider.OpenAiProviderConfig; +import org.thingsboard.server.common.data.group.EntityGroup; +import org.thingsboard.server.common.data.group.EntityGroupInfo; import org.thingsboard.server.common.data.id.AiModelId; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.page.SortOrder; +import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.dao.service.DaoSqlTest; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -90,9 +98,26 @@ public class AiModelControllerTest extends AbstractControllerTest { assertThat(savedModel.getTenantId()).isEqualTo(tenantId); assertThat(savedModel.getName()).isEqualTo("Test model"); assertThat(savedModel.getConfiguration()).isEqualTo(model.getConfiguration()); + assertThat(savedModel.isCustomerAccessEnabled()).isFalse(); assertThat(savedModel.getExternalId()).isNull(); } + @Test + public void saveAiModel_whenCustomerAccessEnabledIsSet_shouldPersistIt() throws Exception { + // GIVEN + loginTenantAdmin(); + + AiModel model = constructValidOpenAiModel("Test model"); + model.setCustomerAccessEnabled(true); + + // WHEN + var savedModel = doPost("/api/ai/model", model, AiModel.class); + + // THEN + assertThat(savedModel.isCustomerAccessEnabled()).isTrue(); + assertThat(doGet("/api/ai/model/" + savedModel.getId(), AiModel.class).isCustomerAccessEnabled()).isTrue(); + } + @Test public void saveAiModel_whenUpdatingExistingModelAsTenantAdmin_shouldSucceed() throws Exception { // GIVEN @@ -244,6 +269,209 @@ public class AiModelControllerTest extends AbstractControllerTest { } } + @Test + public void sendChatRequest_whenChatModelConfigIsMissing_shouldReturnBadRequest() throws Exception { + // GIVEN + loginTenantAdmin(); + + // WHEN + ResultActions result = doPost("/api/ai/model/chat", constructChatPrompt()); + + // THEN + result.andExpect(status().isBadRequest()) + .andExpect(statusReason(containsString("chatModelConfig"))); + } + + /* --- Chat with saved model API tests --- */ + + @Test + public void sendChatRequestToAiModel_whenUserIsSysAdmin_shouldReturnForbidden() throws Exception { + // GIVEN + loginSysAdmin(); + + // WHEN + ResultActions result = doPost("/api/ai/model/" + Uuids.timeBased() + "/chat", constructChatPrompt()); + + // THEN + result.andExpect(status().isForbidden()).andExpect(statusReason(equalTo(msgErrorPermission))); + } + + @Test + public void sendChatRequestToAiModel_whenModelDoesNotExist_shouldReturnNotFound() throws Exception { + // GIVEN + loginTenantAdmin(); + + var nonexistentModelId = new AiModelId(Uuids.timeBased()); + + // WHEN + ResultActions result = doPost("/api/ai/model/" + nonexistentModelId + "/chat", constructChatPrompt()); + + // THEN + result.andExpect(status().isNotFound()) + .andExpect(statusReason(is("AI model with id [" + nonexistentModelId + "] is not found"))); + } + + @Test + public void sendChatRequestToAiModel_whenTenantAdminAndCustomerAccessDisabled_shouldBeAllowed() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(false); + SsrfProtectionValidator.setEnabled(true); + + try { + // WHEN + TbChatResponse response = doPostAsync("/api/ai/model/" + model.getId() + "/chat", constructChatPrompt(), TbChatResponse.class, status().isOk()); + + // THEN + assertThat(response).isInstanceOf(TbChatResponse.Failure.class); + assertThat(((TbChatResponse.Failure) response).errorDetails()).contains("URI is invalid"); + } finally { + SsrfProtectionValidator.setEnabled(false); + } + } + + @Test + public void sendChatRequestToAiModel_whenCustomerAdminAndCustomerAccessDisabled_shouldReturnForbidden() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(false); + loginCustomerAdminUser(); + + // WHEN + ResultActions result = doPost("/api/ai/model/" + model.getId() + "/chat", constructChatPrompt()); + + // THEN + result.andExpect(status().isForbidden()) + .andExpect(statusReason(equalTo("You don't have permission to perform 'INVOKE' operation with AI_MODEL 'Test model'!"))); + } + + @Test + public void sendChatRequestToAiModel_whenTenantAdmin_shouldUseStoredConfigurationAndReturnProviderError() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(); + SsrfProtectionValidator.setEnabled(true); + + try { + // WHEN + TbChatResponse response = doPostAsync("/api/ai/model/" + model.getId() + "/chat", constructChatPrompt(), TbChatResponse.class, status().isOk()); + + // THEN + assertThat(response).isInstanceOf(TbChatResponse.Failure.class); + assertThat(((TbChatResponse.Failure) response).errorDetails()).contains("URI is invalid"); + } finally { + SsrfProtectionValidator.setEnabled(false); + } + } + + @Test + public void sendChatRequestToAiModel_whenCustomerAdmin_shouldBeAllowedAndHideProviderError() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(); + loginCustomerAdminUser(); + SsrfProtectionValidator.setEnabled(true); + + try { + // WHEN + TbChatResponse response = doPostAsync("/api/ai/model/" + model.getId() + "/chat", constructChatPrompt(), TbChatResponse.class, status().isOk()); + + // THEN + assertThat(response).isInstanceOf(TbChatResponse.Failure.class); + assertThat(((TbChatResponse.Failure) response).errorDetails()).isEqualTo("Failed to get a response from the AI model"); + } finally { + SsrfProtectionValidator.setEnabled(false); + } + } + + @Test + public void sendChatRequestToAiModel_whenCustomerUserWithoutInvokePermission_shouldReturnForbidden() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(); + loginCustomerUser(); + + // WHEN + ResultActions result = doPost("/api/ai/model/" + model.getId() + "/chat", constructChatPrompt()); + + // THEN + result.andExpect(status().isForbidden()) + .andExpect(statusReason(equalTo("You don't have permission to perform 'INVOKE' operation with AI_MODEL 'Test model'!"))); + } + + @Test + public void sendChatRequestToAiModel_whenReadOnlyCustomerUser_shouldReturnForbidden() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(); + loginReadOnlyCustomerUser(); + + // WHEN + ResultActions result = doPost("/api/ai/model/" + model.getId() + "/chat", constructChatPrompt()); + + // THEN + result.andExpect(status().isForbidden()) + .andExpect(statusReason(equalTo("You don't have permission to perform 'INVOKE' operation with AI_MODEL 'Test model'!"))); + } + + /* --- Customer permission tests --- */ + + @Test + public void aiModelPermission_whenCustomerAdminGrantedAll_shouldAllowInvokeOnly() throws Exception { + // GIVEN + loginTenantAdmin(); + var modelConfig = constructValidOpenAiModel("Test model"); + modelConfig.setCustomerAccessEnabled(true); + var model = doPost("/api/ai/model", modelConfig, AiModel.class); + loginCustomerAdminUser(); + + // WHEN / THEN + assertThat(hasAiModelPermission(model, "INVOKE")).isTrue(); + assertThat(hasAiModelPermission(model, "READ")).isFalse(); + assertThat(hasAiModelPermission(model, "WRITE")).isFalse(); + assertThat(hasAiModelPermission(model, "DELETE")).isFalse(); + } + + @Test + public void aiModelPermission_whenCustomerAccessDisabled_shouldDenyReadAndInvokeForCustomerAdminOnly() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = doPost("/api/ai/model", constructValidOpenAiModel("Test model"), AiModel.class); + + // WHEN / THEN + assertThat(model.isCustomerAccessEnabled()).isFalse(); + assertThat(hasAiModelPermission(model, "READ")).isTrue(); + assertThat(hasAiModelPermission(model, "INVOKE")).isTrue(); + + loginCustomerAdminUser(); + assertThat(hasAiModelPermission(model, "READ")).isFalse(); + assertThat(hasAiModelPermission(model, "INVOKE")).isFalse(); + } + + @Test + public void aiModelPermission_whenReadOnlyCustomerUser_shouldDenyReadAndInvoke() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(); + loginReadOnlyCustomerUser(); + + // WHEN / THEN + assertThat(hasAiModelPermission(model, "READ")).isFalse(); + assertThat(hasAiModelPermission(model, "INVOKE")).isFalse(); + } + + @Test + public void aiModelPermission_whenCustomerUserHasNoRole_shouldDenyReadAndInvoke() throws Exception { + // GIVEN + loginTenantAdmin(); + var model = saveModelWithBlockedBaseUrl(); + loginCustomerUser(); + + // WHEN / THEN + assertThat(hasAiModelPermission(model, "READ")).isFalse(); + assertThat(hasAiModelPermission(model, "INVOKE")).isFalse(); + } + /* --- Get by ID API tests --- */ @Test @@ -442,6 +670,107 @@ public class AiModelControllerTest extends AbstractControllerTest { assertThat(result4.hasNext()).isFalse(); } + @Test + public void getAiModelInfos_whenUserIsSysAdmin_shouldReturnForbidden() throws Exception { + // GIVEN + loginSysAdmin(); + + // WHEN + ResultActions result = doGet("/api/ai/model/infos?pageSize=10&page=0"); + + // THEN + result.andExpect(status().isForbidden()).andExpect(statusReason(equalTo(msgErrorPermission))); + } + + @Test + public void getAiModelInfos_whenCustomerUserHasNoRole_shouldReturnForbidden() throws Exception { + // GIVEN + loginCustomerUser(); + + // WHEN + ResultActions result = doGet("/api/ai/model/infos?pageSize=10&page=0"); + + // THEN + result.andExpect(status().isForbidden()); + } + + @Test + public void getAiModelInfos_whenCustomerUser_shouldReturnForbidden() throws Exception { + // GIVEN + loginTenantAdmin(); + saveModelWithBlockedBaseUrl("Accessible model", true); + loginCustomerAdminUser(); + + // WHEN + ResultActions result = doGet("/api/ai/model/infos?pageSize=10&page=0"); + + // THEN + result.andExpect(status().isForbidden()).andExpect(statusReason(equalTo(msgErrorPermission))); + } + + @Test + public void getAiModelInfos_whenTenantAdmin_shouldReturnAllInfosWithoutProviderConfig() throws Exception { + // GIVEN + loginTenantAdmin(); + + var available = constructValidOpenAiModel("Available model"); + available.setCustomerAccessEnabled(true); + available = doPost("/api/ai/model", available, AiModel.class); + var unavailable = doPost("/api/ai/model", constructValidOpenAiModel("Unavailable model"), AiModel.class); + + // WHEN + PageData infos = doGetTypedWithPageLink("/api/ai/model/infos?", new TypeReference<>() {}, new PageLink(10)); + String response = doGet("/api/ai/model/infos?pageSize=10&page=0").andExpect(status().isOk()) + .andReturn().getResponse().getContentAsString(); + + // THEN + assertThat(infos.getData()).containsExactlyInAnyOrder(AiModelInfo.from(available), AiModelInfo.from(unavailable)); + assertThat(infos.getData()).allSatisfy(info -> { + assertThat(info.configuration().provider()).isEqualTo(AiProvider.OPENAI); + assertThat(info.configuration().providerConfig()).isNull(); + }); + assertThat(response).contains("\"providerConfig\":null").doesNotContain("test-api-key"); + } + + @Test + public void getAiModelInfos_testSearchAndSortByProviderAndModelId() throws Exception { + // GIVEN + loginTenantAdmin(); + + var anthropicModel = doPost("/api/ai/model", AiModel.builder() + .tenantId(tenantId) + .name("Test model 1") + .configuration(AnthropicChatModelConfig.builder() + .providerConfig(new AnthropicProviderConfig("test-api-key")) + .modelId("claude-sonnet-4-0") + .build()) + .build(), AiModel.class); + var geminiModel = doPost("/api/ai/model", AiModel.builder() + .tenantId(tenantId) + .name("Test model 2") + .configuration(GoogleAiGeminiChatModelConfig.builder() + .providerConfig(new GoogleAiGeminiProviderConfig("test-api-key")) + .modelId("gemini-2.5-pro") + .build()) + .build(), AiModel.class); + + // WHEN + PageData byProviderDesc = doGetTypedWithPageLink("/api/ai/model/infos?", new TypeReference<>() {}, + new PageLink(10, 0, null, SortOrder.of("provider", SortOrder.Direction.DESC))); + PageData byModelIdAsc = doGetTypedWithPageLink("/api/ai/model/infos?", new TypeReference<>() {}, + new PageLink(10, 0, null, SortOrder.of("modelId", SortOrder.Direction.ASC))); + PageData searchByProvider = doGetTypedWithPageLink("/api/ai/model/infos?", new TypeReference<>() {}, + new PageLink(10, 0, "google ai")); + PageData searchByModelId = doGetTypedWithPageLink("/api/ai/model/infos?", new TypeReference<>() {}, + new PageLink(10, 0, "sonnet")); + + // THEN + assertThat(byProviderDesc.getData()).containsExactly(AiModelInfo.from(geminiModel), AiModelInfo.from(anthropicModel)); + assertThat(byModelIdAsc.getData()).containsExactly(AiModelInfo.from(anthropicModel), AiModelInfo.from(geminiModel)); + assertThat(searchByProvider.getData()).containsExactly(AiModelInfo.from(geminiModel)); + assertThat(searchByModelId.getData()).containsExactly(AiModelInfo.from(anthropicModel)); + } + @Test public void getAiModels_testSortingByCreatedTime() throws Exception { // GIVEN @@ -703,6 +1032,54 @@ public class AiModelControllerTest extends AbstractControllerTest { assertThat(deleted).isFalse(); } + private AiModel saveModelWithBlockedBaseUrl() throws Exception { + return saveModelWithBlockedBaseUrl(true); + } + + private AiModel saveModelWithBlockedBaseUrl(boolean customerAccessEnabled) throws Exception { + return saveModelWithBlockedBaseUrl("Test model", customerAccessEnabled); + } + + private AiModel saveModelWithBlockedBaseUrl(String name, boolean customerAccessEnabled) throws Exception { + var modelConfig = OpenAiChatModelConfig.builder() + .providerConfig(OpenAiProviderConfig.builder() + .baseUrl("http://10.0.0.1:8080/") + .apiKey("test-api-key") + .build()) + .modelId("gpt-4o") + .build(); + + var model = AiModel.builder() + .tenantId(tenantId) + .name(name) + .configuration(modelConfig) + .customerAccessEnabled(customerAccessEnabled) + .build(); + + return doPost("/api/ai/model", model, AiModel.class); + } + + private TbChatPrompt constructChatPrompt() { + return new TbChatPrompt(null, new TbUserMessage(List.of(new TbContent.TbTextContent("hi")))); + } + + // The default Customer User role, which grants read-only operations on all resources + private void loginReadOnlyCustomerUser() throws Exception { + loginTenantAdmin(); + User user = new User(); + user.setAuthority(Authority.CUSTOMER_USER); + user.setTenantId(tenantId); + user.setCustomerId(customerId); + user.setEmail("read-only-customer@thingsboard.org"); + EntityGroupInfo customerUsers = findGroupByOwnerIdTypeAndName(customerId, EntityType.USER, EntityGroup.GROUP_CUSTOMER_USERS_NAME); + createUser(user, "customer", customerUsers.getId()); + login(user.getEmail(), "customer"); + } + + private boolean hasAiModelPermission(AiModel model, String operation) throws Exception { + return doGet("/api/permission/AI_MODEL/" + model.getId() + "/" + operation, Boolean.class); + } + private AiModel constructValidOpenAiModel(String name) { var modelConfig = OpenAiChatModelConfig.builder() .providerConfig(OpenAiProviderConfig.builder() diff --git a/application/src/test/java/org/thingsboard/server/controller/AiResourceControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/AiResourceControllerTest.java new file mode 100644 index 0000000000..5186939139 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/AiResourceControllerTest.java @@ -0,0 +1,224 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.controller; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.junit.Test; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.thingsboard.ai.common.channel.ChannelProtocol; +import org.thingsboard.ai.common.channel.ResourceOperationRequest; +import org.thingsboard.ai.common.channel.ResourceUploadRequest; +import org.thingsboard.ai.common.channel.SolutionChatRequest; +import org.thingsboard.ai.common.data.solution.SolutionStep; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.service.ai.transport.TbAiTurnContext; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.List; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@DaoSqlTest +public class AiResourceControllerTest extends AbstractAiControllerTest { + + private static final byte[] PNG = Base64.getDecoder().decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="); + + @Test + public void shouldForwardTheFileBase64Encoded_whenUploadingAResource() throws Exception { + // GIVEN + loginTenantAdmin(); + UUID resourceId = UUID.randomUUID(); + ObjectNode info = resourceInfo(resourceId, "chart.png", "image/png", PNG.length); + var request = new ResourceUploadRequest("chart.png", "image/png", Base64.getEncoder().encodeToString(PNG)); + givenOperation(ChannelProtocol.RESOURCE_CONFIG, null, success(limits(5 * 1024 * 1024))); + givenOperation(ChannelProtocol.RESOURCE_UPLOAD, request, success(info)); + + // WHEN + JsonNode result = readResponse(upload("chart.png", "image/png", PNG).andExpect(status().isCreated()), JsonNode.class); + + // THEN + assertThat(result).isEqualTo(info); + TbAiTurnContext context = verifyOperation(ChannelProtocol.RESOURCE_UPLOAD, request); + assertTokenProviderBelongsToTenantAdmin(context.tokenProvider()); + } + + @Test + public void shouldRejectAFileOverTheAiServiceLimit_withoutUploadingIt() throws Exception { + // GIVEN + loginTenantAdmin(); + givenOperation(ChannelProtocol.RESOURCE_CONFIG, null, success(limits(1024))); + + // WHEN + upload("huge.png", "image/png", new byte[1025]) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(equalTo("The file is too large: huge.png"))); + + // THEN + verify(tbAiOperations, never()).execute(argThat(operation -> operation != null && ChannelProtocol.RESOURCE_UPLOAD.equals(operation.type())), + any(TbAiTurnContext.class)); + } + + static JsonNode limits(long maxSize) { + return JacksonUtil.newObjectNode().put("maxSize", maxSize).put("maxPerMessage", 5); + } + + @Test + public void shouldServeTheFileWithItsTypeAndName_whenDownloadingAResource() throws Exception { + // GIVEN + loginTenantAdmin(); + UUID resourceId = UUID.randomUUID(); + ObjectNode content = JacksonUtil.newObjectNode() + .put("name", "chart.png") + .put("mediaType", "image/png") + .put("data", Base64.getEncoder().encodeToString(PNG)); + givenOperation(ChannelProtocol.RESOURCE_GET, new ResourceOperationRequest(resourceId), success(content)); + + // WHEN + MvcResult result = doGet("/api/ai/resources/" + resourceId).andExpect(status().isOk()).andReturn(); + + // THEN + assertThat(result.getResponse().getContentAsByteArray()).isEqualTo(PNG); + assertThat(result.getResponse().getContentType()).isEqualTo("image/png"); + assertThat(result.getResponse().getHeader(HttpHeaders.CONTENT_DISPOSITION)).isEqualTo("attachment; filename=\"chart.png\""); + assertThat(result.getResponse().getHeader("X-Content-Type-Options")).isEqualTo("nosniff"); + } + + @Test + public void shouldDeleteAnUnsentResource() throws Exception { + // GIVEN + loginTenantAdmin(); + UUID resourceId = UUID.randomUUID(); + givenOperation(ChannelProtocol.RESOURCE_DELETE, new ResourceOperationRequest(resourceId), success()); + + // WHEN + doDelete("/api/ai/resources/" + resourceId).andExpect(status().isNoContent()); + + // THEN + verifyOperation(ChannelProtocol.RESOURCE_DELETE, new ResourceOperationRequest(resourceId)); + } + + @Test + public void shouldKeepTheAiServiceStatus_whenAResourceIsMissingOrInvalid() throws Exception { + // GIVEN + loginTenantAdmin(); + UUID resourceId = UUID.randomUUID(); + givenOperation(ChannelProtocol.RESOURCE_GET, new ResourceOperationRequest(resourceId), failure(404, "Resource not found")); + givenOperation(ChannelProtocol.RESOURCE_DELETE, new ResourceOperationRequest(resourceId), failure(404, "Resource not found or already sent")); + + // WHEN + MvcResult download = doGet("/api/ai/resources/" + resourceId).andReturn(); + MvcResult delete = doDelete("/api/ai/resources/" + resourceId).andReturn(); + + // THEN + assertThat(download.getResponse().getStatus()).isEqualTo(404); + assertThat(delete.getResponse().getStatus()).isEqualTo(404); + assertThat(delete.getResponse().getContentAsString()).contains("Resource not found or already sent"); + } + + @Test + public void shouldReturnTheAcceptedFiles_whenGettingTheConfig() throws Exception { + // GIVEN + loginTenantAdmin(); + JsonNode limits = JacksonUtil.toJsonNode(""" + {"maxSize": 5242880, "maxPerMessage": 5, "mediaTypes": ["image/png"], "extensions": [".png"]} + """); + givenOperation(ChannelProtocol.RESOURCE_CONFIG, null, success(limits)); + + // WHEN + JsonNode result = doGet("/api/ai/resources/config", JsonNode.class); + + // THEN + assertThat(result).isEqualTo(limits); + } + + @Test + public void shouldSendTheAttachedResources_whenSendingASolutionMessage() throws Exception { + // GIVEN + loginTenantAdmin(); + UUID solutionId = UUID.randomUUID(); + UUID resourceId = UUID.randomUUID(); + var request = new SolutionChatRequest(solutionId, SolutionStep.DASHBOARDS_CONFIGURATION, "Like this", List.of(resourceId)); + ObjectNode solution = JacksonUtil.newObjectNode().put("id", solutionId.toString()); + givenOperation(ChannelProtocol.SOLUTION_CHAT, request, success(solution)); + + // WHEN + JsonNode result = readResponse(solutionMessage(solutionId, SolutionStep.DASHBOARDS_CONFIGURATION, """ + {"message": "Like this", "resources": ["%s"]} + """.formatted(resourceId)).andExpect(status().isOk()), JsonNode.class); + + // THEN + assertThat(result).isEqualTo(solution); + verifyOperation(ChannelProtocol.SOLUTION_CHAT, request); + } + + @Test + public void shouldRejectASolutionMessage_whenItHasNeitherTextNorFiles() throws Exception { + // GIVEN + loginTenantAdmin(); + + // WHEN + solutionMessage(UUID.randomUUID(), SolutionStep.INITIAL_CONFIGURATION, """ + {"message": " ", "resources": []} + """) + .andExpect(status().isBadRequest()) + .andExpect(statusReason(equalTo("Message cannot be blank"))); + + // THEN + verifyNoAiCalls(); + } + + @Test + public void shouldReturnForbiddenAndNotCallClient_whenCustomerUserUploads() throws Exception { + // GIVEN + loginCustomerUser(); + + // WHEN + upload("chart.png", "image/png", PNG) + .andExpect(status().isForbidden()) + .andExpect(statusReason(equalTo(msgErrorPermission))); + + // THEN + verifyNoAiCalls(); + } + + private ResultActions upload(String name, String mediaType, byte[] content) throws Exception { + var request = MockMvcRequestBuilders.multipart(HttpMethod.POST, "/api/ai/resources") + .file(new MockMultipartFile("file", name, mediaType, content)); + setJwtToken(request); + return mockMvc.perform(request); + } + + private ResultActions solutionMessage(UUID solutionId, SolutionStep step, String body) throws Exception { + var request = post("/api/ai/solution/" + solutionId + "/" + step + "/messages") + .contentType(MediaType.APPLICATION_JSON) + .content(body.getBytes(StandardCharsets.UTF_8)); + setJwtToken(request); + return mockMvc.perform(request); + } + + private static ObjectNode resourceInfo(UUID id, String name, String mediaType, int size) { + return JacksonUtil.newObjectNode() + .put("id", id.toString()) + .put("name", name) + .put("mediaType", mediaType) + .put("size", size); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/controller/ApiKeyControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/ApiKeyControllerTest.java index d84e7f5659..b0cca491a3 100644 --- a/application/src/test/java/org/thingsboard/server/controller/ApiKeyControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/ApiKeyControllerTest.java @@ -7,6 +7,8 @@ import com.fasterxml.jackson.core.type.TypeReference; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.pat.ApiKey; @@ -15,6 +17,7 @@ import org.thingsboard.server.common.data.permission.AuthorityPermissionsInfo; import org.thingsboard.server.common.data.permission.Operation; import org.thingsboard.server.common.data.permission.Resource; import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.dao.pat.ApiKeyService; import org.thingsboard.server.dao.service.DaoSqlTest; import java.util.HashMap; @@ -27,6 +30,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @DaoSqlTest public class ApiKeyControllerTest extends AbstractControllerTest { + @Autowired + private ApiKeyService apiKeyService; + @Before public void setUp() throws Exception { loginTenantAdmin(); @@ -152,6 +158,68 @@ public class ApiKeyControllerTest extends AbstractControllerTest { doDelete("/api/apiKey/" + savedApiKey.getId()).andExpect(status().isOk()); } + @Test + public void testRotateInternalApiKey_oldValueNoLongerAuthenticates() throws Exception { + loginSysAdmin(); + ApiKeyInfo apiKeyInfo = constructApiKeyInfo(sysAdminPermissionsInfo()); + apiKeyInfo.setTenantId(TenantId.SYS_TENANT_ID); + // internal keys cannot be created via REST, so build it directly through the service + ApiKey internalApiKey = apiKeyService.saveApiKey(TenantId.SYS_TENANT_ID, apiKeyInfo); + String originalValue = internalApiKey.getValue(); + try { + // authenticate with the original value to warm up the API key cache + setApiKey(originalValue); + doGetWithApiKey("/api/auth/user").andExpect(status().isOk()); + + ApiKey rotatedApiKey = doPost("/api/apiKey/" + internalApiKey.getId().getId() + "/rotate", ApiKey.class); + Assert.assertNotNull(rotatedApiKey); + Assert.assertNotNull(rotatedApiKey.getValue()); + Assert.assertNotEquals(originalValue, rotatedApiKey.getValue()); + + doGetWithApiKey("/api/auth/user").andExpect(status().isUnauthorized()); + + setApiKey(rotatedApiKey.getValue()); + doGetWithApiKey("/api/auth/user").andExpect(status().isOk()); + } finally { + resetApiKey(); + apiKeyService.deleteApiKey(TenantId.SYS_TENANT_ID, apiKeyService.findApiKeyById(TenantId.SYS_TENANT_ID, internalApiKey.getId()), true); + } + } + + @Test + public void testRotateApiKeyAsTenantAdmin_shouldBeForbidden() throws Exception { + ApiKeyInfo apiKeyInfo = constructApiKeyInfo("Tenant admin API key", true); + ApiKey apiKey = doPost("/api/apiKey", apiKeyInfo, ApiKey.class); + + doPost("/api/apiKey/" + apiKey.getId().getId() + "/rotate").andExpect(status().isForbidden()); + + doDelete("/api/apiKey/" + apiKey.getId()).andExpect(status().isOk()); + } + + @Test + public void testRotateApiKeyAsCustomerUser_shouldBeForbidden() throws Exception { + ApiKeyInfo apiKeyInfo = constructApiKeyInfo("Tenant admin API key", true); + ApiKey apiKey = doPost("/api/apiKey", apiKeyInfo, ApiKey.class); + + loginCustomerUser(); + doPost("/api/apiKey/" + apiKey.getId().getId() + "/rotate").andExpect(status().isForbidden()); + + loginTenantAdmin(); + doDelete("/api/apiKey/" + apiKey.getId()).andExpect(status().isOk()); + } + + @Test + public void testRotateRegularApiKeyOfAnotherUserAsSysAdmin_shouldBeBadRequest() throws Exception { + ApiKeyInfo apiKeyInfo = constructApiKeyInfo("Tenant admin API key", true); + ApiKey apiKey = doPost("/api/apiKey", apiKeyInfo, ApiKey.class); + + loginSysAdmin(); + doPost("/api/apiKey/" + apiKey.getId().getId() + "/rotate").andExpect(status().isBadRequest()); + + loginTenantAdmin(); + doDelete("/api/apiKey/" + apiKey.getId()).andExpect(status().isOk()); + } + @Test public void testDeleteApiKey() throws Exception { doDelete("/api/apiKey/" + UUID.randomUUID()).andExpect(status().isNotFound()); @@ -174,6 +242,16 @@ public class ApiKeyControllerTest extends AbstractControllerTest { return apiKeyInfo; } + private AuthorityPermissionsInfo sysAdminPermissionsInfo() { + Map> permissions = new HashMap<>(); + permissions.put(Resource.DEVICE, Set.of(Operation.READ)); + Map>> operationsByResource = new HashMap<>(); + operationsByResource.put(Authority.SYS_ADMIN, permissions); + AuthorityPermissionsInfo authorityPermissionsInfo = new AuthorityPermissionsInfo(); + authorityPermissionsInfo.setOperationsByResource(operationsByResource); + return authorityPermissionsInfo; + } + private ApiKeyInfo constructApiKeyInfo(AuthorityPermissionsInfo info) { ApiKeyInfo apiKeyInfo = new ApiKeyInfo(); apiKeyInfo.setDescription("API key description for internal API key"); diff --git a/application/src/test/java/org/thingsboard/server/controller/ConverterControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/ConverterControllerTest.java index e51e796f11..496f9c0d1e 100644 --- a/application/src/test/java/org/thingsboard/server/controller/ConverterControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/ConverterControllerTest.java @@ -8,11 +8,14 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.TextNode; import com.google.common.collect.Streams; import org.apache.commons.io.IOUtils; +import org.assertj.core.api.SoftAssertions; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.data.util.Pair; import org.springframework.test.context.TestPropertySource; import org.thingsboard.common.util.JacksonUtil; @@ -32,6 +35,7 @@ import org.thingsboard.server.common.data.integration.Integration; import org.thingsboard.server.common.data.integration.IntegrationType; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; +import org.thingsboard.server.common.data.script.ScriptLanguage; import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; import org.thingsboard.server.dao.service.DaoSqlTest; @@ -45,21 +49,13 @@ import java.util.Base64; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; +import java.util.regex.Pattern; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.containsString; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_AWS_IOT_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_AZURE_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_CHIRPSTACK_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_KNP_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_SIGFOX_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_THINGSPARK_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_TPE_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_TTI_UPLINK_CONVERTER_MESSAGE; -import static org.thingsboard.server.controller.ControllerConstants.DEFAULT_TTN_UPLINK_CONVERTER_MESSAGE; @TestPropertySource(properties = { "js.evaluator=local", @@ -77,25 +73,21 @@ public class ConverterControllerTest extends AbstractControllerTest { private static final JsonNode CUSTOM_DOWNLINK_CONVERTER_CONFIGURATION = JacksonUtil.newObjectNode() .put("encoder", "return {deviceName: 'Device A', deviceType: 'thermostat'};"); - private static final String DEFAULT_AWS_IOT_UPLINK_DECODER = "converters/tbel-aws-iot-decoder.raw"; - private static final String DEFAULT_AZURE_UPLINK_DECODER = "converters/tbel-azure-decoder.raw"; - private static final String DEFAULT_CHIRPSTACK_UPLINK_DECODER = "converters/tbel-chirpstack-decoder.raw"; private static final String CHIRPSTACK_UPLINK_DECODER = "converter/chirpstack_uplink_decoder.raw"; - private static final String DEFAULT_KPN_UPLINK_DECODER = "converters/tbel-kpn-decoder.raw"; - private static final String DEFAULT_LORIOT_UPLINK_DECODER = "converters/tbel-loriot-decoder.raw"; private static final String LORIOT_UPLINK_DECODER = "converter/loriot_uplink_decoder.raw"; - private static final String DEFAULT_SIGFOX_UPLINK_DECODER = "converters/tbel-sigfox-decoder.raw"; - private static final String DEFAULT_THINGPARK_UPLINK_DECODER = "converters/tbel-thingpark-decoder.raw"; private static final String THINGPARK_UPLINK_DECODER = "converter/thingpark_uplink_decoder.raw"; - private static final String DEFAULT_TPE_UPLINK_DECODER = "converters/tbel-tpe-decoder.raw"; private static final String TPE_UPLINK_DECODER = "converter/tpe_uplink_decoder.raw"; - private static final String DEFAULT_TTI_UPLINK_DECODER = "converters/tbel-tti-decoder.raw"; private static final String TTI_UPLINK_DECODER = "converter/tti_uplink_decoder.raw"; - private static final String DEFAULT_TTN_UPLINK_DECODER = "converters/tbel-ttn-decoder.raw"; private static final String TTN_UPLINK_DECODER = "converter/ttn_uplink_decoder.raw"; private static final String TTN_UPLINK_JSON_DECODER = "converter/ttn_uplink_json_decoder.raw"; private static final String LORIOT_UPLINK_DECODER_RETURN_ARRAY = "converter/loriot_uplink_decoder_array.raw"; private static final String TTN_DECODED_PAYLOAD = "payload/ttn_payload_with_decoded.json"; + private static final String TTN_CUSTOM_DECODER_PAYLOAD = "payload/ttn_custom_decoder_payload.json"; + private static final String TTI_CUSTOM_DECODER_PAYLOAD = "payload/tti_custom_decoder_payload.json"; + private static final String DEFAULT_V2_CONFIGURATION = "ui-ngx/src/assets/converters/default-converters-v2-configuration.json"; + private static final String THINGS_STACK_REPOSITORY_DEVICE_PAYLOAD = "payload/things_stack_repository_device_payload.json"; + private static final String THINGS_STACK_MANUAL_DEVICE_PAYLOAD = "payload/things_stack_manual_device_payload.json"; + private static final String THINGS_STACK_FORMATTER_DEVICE_PAYLOAD = "payload/things_stack_formatter_device_payload.json"; @Before public void beforeTest() throws Exception { @@ -591,10 +583,10 @@ public class ConverterControllerTest extends AbstractControllerTest { @Test public void testGettingDefaultPayloadForConverters() throws Exception { Map expectedPayloads = Map.of( - IntegrationType.LORIOT, DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE, - IntegrationType.CHIRPSTACK, DEFAULT_CHIRPSTACK_UPLINK_CONVERTER_MESSAGE, - IntegrationType.TTN, DEFAULT_TTN_UPLINK_CONVERTER_MESSAGE, - IntegrationType.TTI, DEFAULT_TTI_UPLINK_CONVERTER_MESSAGE); + IntegrationType.LORIOT, getDefaultPayload(IntegrationType.LORIOT), + IntegrationType.CHIRPSTACK, getDefaultPayload(IntegrationType.CHIRPSTACK), + IntegrationType.TTN, getDefaultPayload(IntegrationType.TTN), + IntegrationType.TTI, getDefaultPayload(IntegrationType.TTI)); for (IntegrationType integrationType : expectedPayloads.keySet()) { String integrationName = "TEST_" + integrationType; @@ -614,6 +606,57 @@ public class ConverterControllerTest extends AbstractControllerTest { } } + @Test + public void testDefaultDebugIn() throws Exception { + String urlTemplate = "/api/converter/{converterId}/debugIn?integrationType={integrationType}&converterType={converterType}"; + + SoftAssertions softly = new SoftAssertions(); + for (IntegrationType integrationType : IntegrationType.values()) { + String dir = integrationType.getDirectory(); + if (dir == null) { + continue; + } + String integrationName = readResource("converters/" + dir + "/integration.json") + .map(content -> JacksonUtil.toJsonNode(content).get("name").asText()) + .orElse("Test " + dir); + + ObjectNode uplink = doGet(urlTemplate, ObjectNode.class, EntityId.NULL_UUID, integrationType.name(), ConverterType.UPLINK.name()); + ObjectNode uplinkMetadata = JacksonUtil.fromString(uplink.get("inMetadata").asText(), ObjectNode.class); + softly.assertThat(uplinkMetadata.get("integrationName").asText()).as(dir + " uplink integrationName").isEqualTo(integrationName); + readResource("converters/" + dir + "/uplink/metadata.json") + .map(content -> JacksonUtil.fromString(content, ObjectNode.class)) + .ifPresent(expected -> expected.properties().forEach(entry -> + softly.assertThat(uplinkMetadata.get(entry.getKey())).as(dir + " uplink metadata " + entry.getKey()).isEqualTo(entry.getValue()))); + Optional payload = readResource("converters/" + dir + "/uplink/payload.json"); + if (payload.isPresent()) { + softly.assertThat(uplink.get("inContent").asText()).as(dir + " uplink payload").isEqualTo(payload.get()); + } else { + softly.assertThat(uplink.get("inContent").isNull()).as(dir + " uplink payload").isTrue(); + } + + String downlink = doGet(urlTemplate, EntityId.NULL_UUID, integrationType.name(), ConverterType.DOWNLINK.name()) + .andExpect(status().isOk()) + .andReturn().getResponse().getContentAsString(); + Optional downlinkMetadata = readResource("converters/" + dir + "/downlink/metadata.json"); + Optional downlinkPayload = readResource("converters/" + dir + "/downlink/payload.json"); + Optional downlinkMsgType = readResource("converters/" + dir + "/downlink/msgType.txt").map(String::trim); + if (downlinkMetadata.isPresent() || downlinkPayload.isPresent() || downlinkMsgType.isPresent()) { + JsonNode downlinkNode = JacksonUtil.toJsonNode(downlink); + softly.assertThat(Optional.ofNullable(downlinkNode.get("inMetadata")).map(JsonNode::asText).map(JacksonUtil::toJsonNode)) + .as(dir + " downlink metadata").isEqualTo(downlinkMetadata.map(JacksonUtil::toJsonNode)); + softly.assertThat(Optional.ofNullable(downlinkNode.get("inContent")).map(JsonNode::asText)) + .as(dir + " downlink payload").isEqualTo(downlinkPayload); + softly.assertThat(Optional.ofNullable(downlinkNode.get("inMsgType")).map(JsonNode::asText)) + .as(dir + " downlink msgType").isEqualTo(downlinkMsgType); + softly.assertThat(JacksonUtil.toJsonNode(downlinkNode.get("inIntegrationMetadata").asText()).get("integrationName").asText()) + .as(dir + " downlink integrationName").isEqualTo(integrationName); + } else { + softly.assertThat(downlink).as(dir + " downlink").isEmpty(); + } + } + softly.assertAll(); + } + @Test public void givenUplinkPayloadWithUtf8Chars_testConverting() { String textPayload = "Привіт,Genève Hôpital Etterbeek-Ixelles,我们一起去玩吧。,اللغة العربية"; @@ -674,14 +717,72 @@ public class ConverterControllerTest extends AbstractControllerTest { } @Test - public void testTTIDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"entityType\":\"DEVICE\",\"name\":\"eui-1000000000000001\",\"profile\":\"application-tti-name\"," + - "\"telemetry\":{\"ts\":1684398325906,\"values\":{\"battery\":95,\"temperature\":36.6,\"saturation\":99}},\"attributes\":{\"sn\":32310067,\"devAddr\":\"20000001\",\"fPort\":85,\"eui\":\"1000000000000001\"}}"; - - DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "eui-$eui", "$applicationId", Set.of("eui", "fPort", "devAddr")); - Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.TTI, 2); + public void testDefaultUplinkConverters() throws Exception { + Resource[] expectedFiles = new PathMatchingResourcePatternResolver().getResources("classpath*:converters/*/uplink/test/*/expected.json"); + assertThat(expectedFiles).isNotEmpty(); + + SoftAssertions softly = new SoftAssertions(); + for (Resource expectedFile : expectedFiles) { + String url = expectedFile.getURL().getPath(); + String casePath = url.substring(url.lastIndexOf("/converters/") + 1); + String[] parts = casePath.split("/"); + IntegrationType integrationType = IntegrationType.valueOf(parts[1]); + String uplinkDir = "converters/" + parts[1] + "/uplink/"; + String caseDir = uplinkDir + "test/" + parts[4] + "/"; + + JsonNode expected = JacksonUtil.toJsonNode(readResource(casePath).orElseThrow()); + String payload = readResource(caseDir + "payload.json").orElse(getDefaultPayload(integrationType)); + Converter converter = readResource(caseDir + "configuration.json") + .map(configuration -> createConverter(JacksonUtil.toJsonNode(configuration), integrationType, 2)) + .orElse(null); + String metadata = readResource(uplinkDir + "metadata.json").orElse("{}"); + + int decoders = 0; + for (ScriptLanguage scriptLang : ScriptLanguage.values()) { + Optional decoder = readResource(uplinkDir + scriptLang.name().toLowerCase() + ".raw"); + if (decoder.isPresent()) { + decoders++; + String output = decodeUplink(decoder.get(), scriptLang, payload, metadata, converter); + softly.assertThat(JacksonUtil.toJsonNode(output)).as(casePath + " [" + scriptLang + "]").isEqualTo(expected); + } + } + softly.assertThat(decoders).as(casePath + ": no decoder found").isPositive(); + } + softly.assertAll(); + } - testDecoder(DEFAULT_TTI_UPLINK_DECODER, DEFAULT_TTI_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + @Test + public void testDefaultDownlinkConverters() throws Exception { + Resource[] expectedFiles = new PathMatchingResourcePatternResolver().getResources("classpath*:converters/*/downlink/test/*/expected.json"); + assertThat(expectedFiles).isNotEmpty(); + + SoftAssertions softly = new SoftAssertions(); + for (Resource expectedFile : expectedFiles) { + String url = expectedFile.getURL().getPath(); + String casePath = url.substring(url.lastIndexOf("/converters/") + 1); + String[] parts = casePath.split("/"); + String downlinkDir = "converters/" + parts[1] + "/downlink/"; + String caseDir = downlinkDir + "test/" + parts[4] + "/"; + + JsonNode expected = JacksonUtil.toJsonNode(readResource(casePath).orElseThrow()); + Optional casePayload = readResource(caseDir + "payload.json"); + String msg = casePayload.isPresent() ? casePayload.get() : readResource(downlinkDir + "payload.json").orElseThrow(); + String msgType = readResource(downlinkDir + "msgType.txt").map(String::trim).orElse("ATTRIBUTES_UPDATED"); + String metadata = readResource(downlinkDir + "metadata.json").orElse("{}"); + + int encoders = 0; + for (ScriptLanguage scriptLang : ScriptLanguage.values()) { + Optional encoder = readResource(downlinkDir + scriptLang.name().toLowerCase() + ".raw"); + if (encoder.isPresent()) { + encoders++; + JsonNode response = encodeDownlink(encoder.get(), scriptLang, msg, msgType, metadata); + softly.assertThat(response.get("error").asText()).as(casePath + " [" + scriptLang + "] error").isEmpty(); + softly.assertThat(JacksonUtil.toJsonNode(response.get("output").asText())).as(casePath + " [" + scriptLang + "]").isEqualTo(expected); + } + } + softly.assertThat(encoders).as(casePath + ": no encoder found").isPositive(); + } + softly.assertAll(); } @Test @@ -692,18 +793,134 @@ public class ConverterControllerTest extends AbstractControllerTest { DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "eui-$eui", "$applicationId", Set.of("eui", "fPort", "devAddr")); Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.TTI, 2); - testDecoder(TTI_UPLINK_DECODER, DEFAULT_TTI_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + testDecoder(TTI_UPLINK_DECODER, readResource(TTI_CUSTOM_DECODER_PAYLOAD).orElseThrow(), expectedDecodedMessage, converter); } + private static final String THINGS_STACK_REPOSITORY_DEVICE_RESULT = "{\"entityType\":\"DEVICE\",\"name\":\"am308-office\",\"profile\":\"milesight-iot-am308\",\"label\":\"am308-office\",\"group\":\"my-app\"," + + "\"telemetry\":[{\"ts\":1793170000000,\"values\":{\"temperature\":24.1,\"co2\":550}},{\"ts\":1793181600100,\"values\":{\"battery\":95,\"temperature\":24.5,\"co2\":560," + + "\"fCnt\":12,\"data\":\"AXVk\",\"rssi\":-60,\"snr\":9.5,\"channel\":2,\"consumedAirtime\":\"0.061696s\"}}]," + + "\"attributes\":{\"eui\":\"24E124707C481005\",\"joinEui\":\"24E124C0002A0001\",\"devAddr\":\"260B1234\",\"deviceId\":\"am308-office\",\"applicationId\":\"my-app\"," + + "\"fPort\":85,\"bandwidth\":125000,\"spreadingFactor\":7,\"codeRate\":\"4/5\",\"frequency\":868100000,\"brandId\":\"milesight-iot\",\"modelId\":\"am308\"," + + "\"hardwareVersion\":\"1.0\",\"firmwareVersion\":\"1.0\",\"bandId\":\"EU_863_870\",\"netId\":\"000013\",\"tenantId\":\"ttn\",\"clusterId\":\"eu1\"," + + "\"clusterAddress\":\"eu1.cloud.thethings.network\"}}"; + @Test - public void testTTNDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"entityType\":\"DEVICE\",\"name\":\"eui-1000000000000001\",\"profile\":\"application-tts-name\"," + - "\"telemetry\":{\"ts\":1684474415641,\"values\":{\"battery\":95,\"temperature\":36.6,\"saturation\":99}},\"attributes\":{\"sn\":32310067,\"devAddr\":\"20000001\",\"fPort\":85,\"eui\":\"1000000000000001\"}}"; + public void testThingsStackDefaultConvertersGiveRepositoryDeviceItsModelProfile() throws IOException { + testThingsStackDefaultConverters(THINGS_STACK_REPOSITORY_DEVICE_PAYLOAD, Map.of(), THINGS_STACK_REPOSITORY_DEVICE_RESULT); + } - DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "eui-$eui", "$applicationId", Set.of("eui", "fPort", "devAddr")); - Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.TTN, 2); + @Test + public void testThingsStackDefaultConvertersTakeProfileNameFromIntegrationMetadata() throws IOException { + String expectedDecodedMessage = THINGS_STACK_REPOSITORY_DEVICE_RESULT.replace("\"profile\":\"milesight-iot-am308\"", "\"profile\":\"AM308\""); + Map integrationMetadata = Map.of("profile.milesight-iot-am308", "AM308", "profile.milesight-iot-ws202", "WS202"); + + testThingsStackDefaultConverters(THINGS_STACK_REPOSITORY_DEVICE_PAYLOAD, integrationMetadata, expectedDecodedMessage); + } + + @Test + public void testThingsStackDefaultConvertersGiveManualDeviceRawData() throws IOException { + String expectedDecodedMessage = "{\"entityType\":\"DEVICE\",\"name\":\"manual-node\",\"profile\":\"LoRaWAN Device\",\"label\":\"manual-node\",\"group\":\"my-app\"," + + "\"telemetry\":{\"ts\":1793181600100,\"values\":{\"fCnt\":3,\"data\":\"Ae0DM18OTGM=\",\"rssi\":-70,\"snr\":7.0}}," + + "\"attributes\":{\"eui\":\"70B3D57ED006F370\",\"deviceId\":\"manual-node\",\"applicationId\":\"my-app\",\"fPort\":1,\"bandwidth\":125000," + + "\"spreadingFactor\":9,\"frequency\":868300000}}"; + + testThingsStackDefaultConverters(THINGS_STACK_MANUAL_DEVICE_PAYLOAD, Map.of("profile.milesight-iot-am308", "AM308"), expectedDecodedMessage); + } + + // temperatureUnit is not ASCII: decoded_payload reaches the decoders as UTF-8, and both must give the same text + private static final String THINGS_STACK_FORMATTER_DEVICE_RESULT = "{\"entityType\":\"DEVICE\",\"name\":\"macro-tracker-1\",\"profile\":\"lansitec-macro-tracker\",\"label\":\"macro-tracker-1\",\"group\":\"my-app\"," + + "\"telemetry\":{\"ts\":1794304800100,\"values\":{\"batteryLevel\":100,\"chargeState\":\"Charging\",\"temperatureUnit\":\"°C\",\"fCnt\":5,\"data\":\"IWQ+Az4AbFA=\",\"rssi\":-70,\"snr\":7.0}}," + + "\"attributes\":{\"brandId\":\"lansitec\",\"modelId\":\"macro-tracker\",\"eui\":\"70B3D57ED006F371\",\"deviceId\":\"macro-tracker-1\",\"applicationId\":\"my-app\",\"fPort\":1,\"bandwidth\":125000," + + "\"spreadingFactor\":9,\"frequency\":868300000}}"; + + // A device added without the Repository, whose payload formatter names its model in tbVersionIds: the profile of the + // model, and the brandId and modelId attributes, as a Repository device gets them from version_ids + @Test + public void testThingsStackDefaultConvertersGiveFormatterDeviceTheModelProfileOfItsDecodedPayload() throws IOException { + testThingsStackDefaultConverters(THINGS_STACK_FORMATTER_DEVICE_PAYLOAD, Map.of(), THINGS_STACK_FORMATTER_DEVICE_RESULT); + } + + @Test + public void testThingsStackDefaultConvertersTakeProfileNameOfFormatterDeviceFromIntegrationMetadata() throws IOException { + String expectedDecodedMessage = THINGS_STACK_FORMATTER_DEVICE_RESULT.replace("\"profile\":\"lansitec-macro-tracker\"", "\"profile\":\"Macro tracker\""); + + testThingsStackDefaultConverters(THINGS_STACK_FORMATTER_DEVICE_PAYLOAD, Map.of("profile.lansitec-macro-tracker", "Macro tracker"), expectedDecodedMessage); + } + + // version_ids come first: tbVersionIds of a Repository device does not change its profile, and is not telemetry either + @Test + public void testThingsStackDefaultConvertersPreferRepositoryModelToTbVersionIds() throws IOException { + ObjectNode payload = (ObjectNode) JacksonUtil.toJsonNode(readResource(THINGS_STACK_REPOSITORY_DEVICE_PAYLOAD).orElseThrow()); + ((ObjectNode) payload.get("uplink_message").get("decoded_payload")) + .set("tbVersionIds", JacksonUtil.toJsonNode("{\"brand_id\":\"lansitec\",\"model_id\":\"macro-tracker\"}")); + + testThingsStackDefaultConvertersOnPayload(payload.toString(), Map.of(), THINGS_STACK_REPOSITORY_DEVICE_RESULT); + } + + // tbVersionIds that is not an object (a text, null, a list) names no model, and is not telemetry either + @Test + public void testThingsStackDefaultConvertersIgnoreTbVersionIdsThatIsNotAnObject() throws IOException { + String expectedDecodedMessage = THINGS_STACK_FORMATTER_DEVICE_RESULT.replace("\"profile\":\"lansitec-macro-tracker\"", "\"profile\":\"LoRaWAN Device\"") + .replace("\"brandId\":\"lansitec\",\"modelId\":\"macro-tracker\",", ""); + for (String tbVersionIds : List.of("\"lansitec-macro-tracker\"", "null", "[\"lansitec\",\"macro-tracker\"]")) { + ObjectNode payload = (ObjectNode) JacksonUtil.toJsonNode(readResource(THINGS_STACK_FORMATTER_DEVICE_PAYLOAD).orElseThrow()); + ((ObjectNode) payload.get("uplink_message").get("decoded_payload")).set("tbVersionIds", JacksonUtil.toJsonNode(tbVersionIds)); + + testThingsStackDefaultConvertersOnPayload(payload.toString(), Map.of(), expectedDecodedMessage); + } + } + + // The keys the integration metadata lists for the model are attributes, not telemetry; spaces around them are ignored, + // and a listed key the uplink doesn't have is skipped. The model may come from tbVersionIds + @Test + public void testThingsStackDefaultConvertersSaveTheModelsListedKeysAsAttributes() throws IOException { + String expectedDecodedMessage = THINGS_STACK_FORMATTER_DEVICE_RESULT + .replace("\"chargeState\":\"Charging\",", "") + .replace("\"attributes\":{", "\"attributes\":{\"chargeState\":\"Charging\","); + + testThingsStackDefaultConverters(THINGS_STACK_FORMATTER_DEVICE_PAYLOAD, + Map.of("attributes.lansitec-macro-tracker", " chargeState , firmwareVersionOfTheTracker"), expectedDecodedMessage); + } - testDecoder(DEFAULT_TTN_UPLINK_DECODER, DEFAULT_TTN_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + // The list is per brand and model, not per profile name: a renamed profile keeps it. History records stay telemetry: + // temperature is in the history record (24.1) and in the latest values (24.5), and only the latest one is an attribute + @Test + public void testThingsStackDefaultConvertersTakeTheListOfARepositoryDeviceByItsModel() throws IOException { + String latestTemperature = "\"temperature\":24.5,"; + assertThat(THINGS_STACK_REPOSITORY_DEVICE_RESULT.split(Pattern.quote(latestTemperature), -1)).hasSize(2); + assertThat(THINGS_STACK_REPOSITORY_DEVICE_RESULT).contains("{\"temperature\":24.1,\"co2\":550}"); + String expectedDecodedMessage = THINGS_STACK_REPOSITORY_DEVICE_RESULT + .replace("\"profile\":\"milesight-iot-am308\"", "\"profile\":\"AM308\"") + .replace(latestTemperature, "") + .replace("\"attributes\":{", "\"attributes\":{\"temperature\":24.5,"); + + testThingsStackDefaultConverters(THINGS_STACK_REPOSITORY_DEVICE_PAYLOAD, + Map.of("profile.milesight-iot-am308", "AM308", "attributes.milesight-iot-am308", "temperature"), expectedDecodedMessage); + } + + // The list of another model changes nothing + @Test + public void testThingsStackDefaultConvertersIgnoreTheListOfAnotherModel() throws IOException { + testThingsStackDefaultConverters(THINGS_STACK_FORMATTER_DEVICE_PAYLOAD, + Map.of("attributes.lansitec-solar-tracker", "chargeState"), THINGS_STACK_FORMATTER_DEVICE_RESULT); + } + + // The TBEL and JS defaults are two copies of one script, so each of them must give this result for TTN and TTI + private void testThingsStackDefaultConverters(String payloadFile, Map integrationMetadata, String expectedResult) throws IOException { + testThingsStackDefaultConvertersOnPayload(readResource(payloadFile).orElseThrow(), integrationMetadata, expectedResult); + } + + private void testThingsStackDefaultConvertersOnPayload(String payload, Map integrationMetadata, String expectedResult) throws IOException { + JsonNode defaultConfigurations = JacksonUtil.toJsonNode(FrontEndSource.read(DEFAULT_V2_CONFIGURATION)); + for (IntegrationType integrationType : List.of(IntegrationType.TTN, IntegrationType.TTI)) { + Converter converter = createConverter(defaultConfigurations.get(integrationType.name()), integrationType, 2); + for (ScriptLanguage scriptLang : ScriptLanguage.values()) { + String decoder = readResource("converters/" + integrationType.getDirectory() + "/uplink/" + scriptLang.name().toLowerCase() + ".raw").orElseThrow(); + assertThat(JacksonUtil.toJsonNode(decodeUplink(decoder, scriptLang, payload, "{}", converter, integrationMetadata))) + .as("%s %s", integrationType, scriptLang) + .isEqualTo(JacksonUtil.toJsonNode(expectedResult)); + } + } } @Test @@ -714,7 +931,7 @@ public class ConverterControllerTest extends AbstractControllerTest { DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "eui-$eui", "$applicationId", Set.of("eui", "fPort", "devAddr")); Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.TTN, 2); - testDecoder(TTN_UPLINK_DECODER, DEFAULT_TTN_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + testDecoder(TTN_UPLINK_DECODER, readResource(TTN_CUSTOM_DECODER_PAYLOAD).orElseThrow(), expectedDecodedMessage, converter); } @Test @@ -731,17 +948,6 @@ public class ConverterControllerTest extends AbstractControllerTest { testDecoder(TTN_UPLINK_JSON_DECODER, payload, expectedDecodedMessage, converter); } - @Test - public void testThingParkDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"entityType\":\"DEVICE\",\"name\":\"Device 1000000000000001\",\"profile\":\"default\"," + - "\"telemetry\":{\"ts\":1732828102138,\"values\":{\"battery\":95,\"temperature\":36.6,\"saturation\":99}},\"attributes\":{\"sn\":32310067,\"mType\":2,\"eui\":\"1000000000000001\",\"fCntDn\":2}}"; - - DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "Device $eui", "", Set.of("eui", "mType", "fCntDn")); - Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.THINGPARK, 2); - - testDecoder(DEFAULT_THINGPARK_UPLINK_DECODER, DEFAULT_THINGSPARK_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); - } - @Test public void testThingParkNotDefaultDecoder() throws IOException { String expectedDecodedMessage = "{\"entityType\":\"DEVICE\",\"name\":\"Device 1000000000000001\",\"profile\":\"IndustrialSensorProfile\",\"customer\":\"MyCustomer\",\"group\":\"SensorsGroup\"," + @@ -750,18 +956,7 @@ public class ConverterControllerTest extends AbstractControllerTest { DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "Device $eui", "", Set.of("eui", "mType", "fCntDn")); Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.THINGPARK, 2); - testDecoder(THINGPARK_UPLINK_DECODER, DEFAULT_THINGSPARK_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); - } - - @Test - public void testTPEDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"entityType\":\"DEVICE\",\"name\":\"Device 1000000000000001\",\"profile\":\"default\"," + - "\"telemetry\":{\"ts\":1732828102138,\"values\":{\"battery\":95,\"temperature\":36.6,\"saturation\":99}},\"attributes\":{\"sn\":32310067,\"mType\":2,\"eui\":\"1000000000000001\",\"fCntDn\":2}}"; - - DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "Device $eui", "", Set.of("eui", "mType", "fCntDn")); - Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.TPE, 2); - - testDecoder(DEFAULT_TPE_UPLINK_DECODER, DEFAULT_TPE_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + testDecoder(THINGPARK_UPLINK_DECODER, getDefaultPayload(IntegrationType.THINGPARK), expectedDecodedMessage, converter); } @Test @@ -772,18 +967,7 @@ public class ConverterControllerTest extends AbstractControllerTest { DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "Device $eui", "", Set.of("eui", "mType", "fCntDn")); Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.TPE, 2); - testDecoder(TPE_UPLINK_DECODER, DEFAULT_TPE_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); - } - - @Test - public void testChirpStackDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"entityType\":\"ASSET\",\"name\":\"Asset 1000000000000001\",\"profile\":\"Chirpstack default device profile\"," + - "\"telemetry\":{\"ts\":1684741625404,\"values\":{\"battery\":95,\"temperature\":36.6,\"saturation\":99}},\"attributes\":{\"sn\":32310067,\"devAddr\":\"20000001\",\"fPort\":85,\"eui\":\"1000000000000001\"}}"; - - DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.ASSET, "Asset $eui", "$deviceProfileName", Set.of("eui", "fPort", "devAddr")); - Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.CHIRPSTACK, 2); - - testDecoder(DEFAULT_CHIRPSTACK_UPLINK_DECODER, DEFAULT_CHIRPSTACK_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + testDecoder(TPE_UPLINK_DECODER, getDefaultPayload(IntegrationType.TPE), expectedDecodedMessage, converter); } @Test @@ -794,18 +978,7 @@ public class ConverterControllerTest extends AbstractControllerTest { DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.ASSET, "Asset $eui", "$deviceProfileName", Set.of("eui", "fPort", "devAddr")); Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.CHIRPSTACK, 2); - testDecoder(CHIRPSTACK_UPLINK_DECODER, DEFAULT_CHIRPSTACK_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); - } - - @Test - public void testLoriotDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"entityType\":\"DEVICE\",\"name\":\"Device name 1000000000000001\"," + - "\"profile\":\"Device type\",\"telemetry\":{\"ts\":1684478801936,\"values\":{\"battery\":95,\"temperature\":36.6,\"saturation\":99}},\"attributes\":{\"sn\":32310067,\"fPort\":85,\"eui\":\"1000000000000001\"}}"; - - DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "Device name $eui", "Device type", Set.of("eui", "fPort")); - Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.LORIOT, 2); - - testDecoder(DEFAULT_LORIOT_UPLINK_DECODER, DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + testDecoder(CHIRPSTACK_UPLINK_DECODER, getDefaultPayload(IntegrationType.CHIRPSTACK), expectedDecodedMessage, converter); } @Test @@ -816,7 +989,7 @@ public class ConverterControllerTest extends AbstractControllerTest { DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "Device name $eui", "Device type", Set.of("eui", "fPort")); Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.LORIOT, 2); - testDecoder(LORIOT_UPLINK_DECODER, DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + testDecoder(LORIOT_UPLINK_DECODER, getDefaultPayload(IntegrationType.LORIOT), expectedDecodedMessage, converter); } @Test @@ -827,42 +1000,28 @@ public class ConverterControllerTest extends AbstractControllerTest { DedicatedConverterConfig config = createDedicatedConverterConfig(EntityType.DEVICE, "Device name $eui", "Device type", Set.of("eui", "fPort")); Converter converter = createConverter(JacksonUtil.valueToTree(config), IntegrationType.LORIOT, 2); - testDecoder(LORIOT_UPLINK_DECODER_RETURN_ARRAY, DEFAULT_LORIOT_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage, converter); + testDecoder(LORIOT_UPLINK_DECODER_RETURN_ARRAY, getDefaultPayload(IntegrationType.LORIOT), expectedDecodedMessage, converter); } - @Test - public void testAwsIotDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"deviceName\":\"Production 1 - 3G7H1j-9zF\",\"deviceType\":\"default\"," + - "\"groupName\":\"Production\",\"attributes\":{\"deviceId\":\"3G7H1j-9zF\"},\"telemetry\":{\"ts\":1686398400000,\"values\":" + - "{\"temperature\":25.3,\"humidity\":62.8,\"pressure\":1012.5,\"latitude\":37.7749,\"longitude\":-122.4194," + - "\"status\":\"active\",\"power_status\":\"on\",\"x\":0.02,\"y\":0.03,\"z\":0.01,\"fault_codes.0\":100,\"fault_codes.1\":204," + - "\"fault_codes.2\":301,\"battery_level\":78.5}}}"; - testDecoder(DEFAULT_AWS_IOT_UPLINK_DECODER, DEFAULT_AWS_IOT_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage); + private String getDefaultPayload(IntegrationType integrationType) throws IOException { + return readResource("converters/" + integrationType.getDirectory() + "/uplink/payload.json").orElseThrow(); } - @Test - public void testAzureDefaultDecoder() throws IOException { - String expectedDecodedMessage = "{\"deviceName\":\"8F4A2C6D\",\"deviceType\":\"Packing machine\",\"groupName\":\"Control room\"," + - "\"attributes\":{\"version\":1,\"manufacturer\":\"Example corporation\"},\"telemetry\":{\"ts\":1686306600000," + - "\"values\":{\"receivedAlarms\":[{\"type\":\"temperature\",\"severity\":\"high\",\"message\":\"Temperature exceeds threshold.\"}," + - "{\"type\":\"vibration\",\"severity\":\"critical\",\"message\":\"Excessive vibration detected.\"}],\"temperature\":25.5," + - "\"pressure\":1013.25,\"x\":0.02,\"y\":0.03,\"z\":0.015,\"status\":\"ALARM\",\"batteryLevel\":100,\"batteryStatus\":\"Charging\"}}}"; - testDecoder(DEFAULT_AZURE_UPLINK_DECODER, DEFAULT_AZURE_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage); - } + private JsonNode encodeDownlink(String encoder, ScriptLanguage scriptLang, String msg, String msgType, String metadata) { + ObjectNode inputParams = JacksonUtil.newObjectNode(); + inputParams.put("encoder", encoder); + inputParams.put("msg", msg); + inputParams.put("msgType", msgType); + inputParams.set("metadata", JacksonUtil.toJsonNode(metadata)); + inputParams.set("integrationMetadata", JacksonUtil.newObjectNode()); - @Test - public void testSigfoxDefaultConverters() throws IOException { - String expectedDecodedMessage = "{\"deviceName\":\"Sigfox-2203961\",\"deviceType\":\"Sigfox device\",\"groupName\":\"Control room devices\"," + - "\"attributes\":{\"sigfoxId\":\"2203961\",\"deviceTypeId\":\"630ceaea10d051194ec0246e\",\"autoCalibration\":\"on\"," + - "\"zeroPointAdjusted\":false,\"transmitPower\":\"full\",\"powerControl\":\"off\",\"fwVersion\":2},\"telemetry\":{\"ts\":\"1686298419000\"," + - "\"values\":{\"temperature\":28.7,\"humidity\":33,\"co2\":582,\"co2Baseline\":420,\"customData1\":\"37\",\"customData2\":\"2\"}}}"; - testDecoder(DEFAULT_SIGFOX_UPLINK_DECODER, DEFAULT_SIGFOX_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage); + return doPost("/api/converter/testDownLink?scriptLang=" + scriptLang, inputParams, JsonNode.class); } - @Test - public void testKpnDefaultConverter() throws IOException { - String expectedDecodedMessage = "{\"deviceName\":\"Device A\",\"deviceType\":\"thermostat\",\"customerName\":\"customer\",\"groupName\":\"thermostat devices\",\"attributes\":{\"model\":\"Model A\",\"serialNumber\":\"SN111\"},\"telemetry\":{\"temperature\":42,\"humidity\":80}}"; - testDecoder(DEFAULT_KPN_UPLINK_DECODER, DEFAULT_KNP_UPLINK_CONVERTER_MESSAGE, expectedDecodedMessage); + private Optional readResource(String path) throws IOException { + try (InputStream in = ConverterControllerTest.class.getClassLoader().getResourceAsStream(path)) { + return in == null ? Optional.empty() : Optional.of(new String(in.readAllBytes(), StandardCharsets.UTF_8)); + } } public void testDecoder(String decoderFileName, String payloadExample, String expectedResult) throws IOException { @@ -870,13 +1029,21 @@ public class ConverterControllerTest extends AbstractControllerTest { } public void testDecoder(String decoderFileName, String payloadExample, String expectedResult, Converter converter) throws IOException { - byte[] bytes = IOUtils.toByteArray(ConverterControllerTest.class.getClassLoader().getResourceAsStream(decoderFileName)); + assertThat(decodeUplink(readResource(decoderFileName).orElseThrow(), ScriptLanguage.TBEL, payloadExample, "{}", converter)).isEqualTo(expectedResult); + } + + private String decodeUplink(String decoder, ScriptLanguage scriptLang, String payloadExample, String metadata, Converter converter) { + return decodeUplink(decoder, scriptLang, payloadExample, metadata, converter, Map.of()); + } + // integrationMetadata: what the integration adds to the metadata of every uplink, from its configuration + private String decodeUplink(String decoder, ScriptLanguage scriptLang, String payloadExample, String metadata, Converter converter, + Map integrationMetadata) { String base64Payload = Base64.getEncoder().encodeToString(payloadExample.getBytes(StandardCharsets.UTF_8)); ObjectNode inputParams = JacksonUtil.newObjectNode(); - inputParams.set("decoder", new TextNode(new String(bytes))); - inputParams.set("metadata", JacksonUtil.newObjectNode()); + inputParams.set("decoder", new TextNode(decoder)); + inputParams.set("metadata", JacksonUtil.toJsonNode(metadata)); if (converter != null && converter.isDedicated()) { inputParams.set("payload", JacksonUtil.toJsonNode(payloadExample)); @@ -891,18 +1058,16 @@ public class ConverterControllerTest extends AbstractControllerTest { inputParams.set("payload", unwrapped.get("payload")); } inputParams.set("metadata",unwrapped.get("metadata")); + integrationMetadata.forEach(((ObjectNode) inputParams.get("metadata"))::put); } else { inputParams.set("payload", new TextNode(base64Payload)); } - JsonNode response = doPost("/api/converter/testUpLink?scriptLang=TBEL", inputParams, JsonNode.class); - String output; + JsonNode response = doPost("/api/converter/testUpLink?scriptLang=" + scriptLang, inputParams, JsonNode.class); if (converter != null && converter.getConverterVersion() == 2) { - output = response.get("outputMsg").toString(); - } else { - output = response.get("output").asText(); + return response.get("outputMsg").toString(); } - assertThat(output).isEqualTo(expectedResult); + return response.get("output").asText(); } public DedicatedConverterConfig createDedicatedConverterConfig(EntityType type, String name, String profile, Set attributes) { diff --git a/application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java index 3ddf6b3223..bf39aa94ce 100644 --- a/application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/DeviceControllerTest.java @@ -27,6 +27,7 @@ import org.testcontainers.shaded.org.awaitility.Awaitility; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.common.util.ThingsBoardExecutors; import org.thingsboard.server.common.data.AttributeScope; +import org.thingsboard.server.common.data.ClaimRequest; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; @@ -60,6 +61,8 @@ import org.thingsboard.server.common.data.sync.ie.importing.csv.BulkImportColumn import org.thingsboard.server.common.data.sync.ie.importing.csv.BulkImportRequest; import org.thingsboard.server.common.data.sync.ie.importing.csv.BulkImportResult; import org.thingsboard.server.dao.device.DeviceDao; +import org.thingsboard.server.dao.device.claim.ClaimResponse; +import org.thingsboard.server.dao.device.claim.ClaimResult; import org.thingsboard.server.dao.exception.DeviceCredentialsValidationException; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.exception.DataValidationException; @@ -1401,6 +1404,43 @@ public class DeviceControllerTest extends AbstractControllerTest { assertThat(retrieved.get().getStrValue()).isNotPresent(); } + @Test + public void testBulkImportDeviceWithOverwriteActivityTime() throws Exception { + String deviceName = "some_device"; + String deviceType = "some_type"; + BulkImportRequest request = new BulkImportRequest(); + request.setFile(String.format("NAME,TYPE,OVERWRITE_ACTIVITY_TIME\n%s,%s,true", deviceName, deviceType)); + BulkImportRequest.Mapping mapping = new BulkImportRequest.Mapping(); + BulkImportRequest.ColumnMapping name = new BulkImportRequest.ColumnMapping(); + name.setType(BulkImportColumnType.NAME); + BulkImportRequest.ColumnMapping type = new BulkImportRequest.ColumnMapping(); + type.setType(BulkImportColumnType.TYPE); + BulkImportRequest.ColumnMapping overwriteActivityTime = new BulkImportRequest.ColumnMapping(); + overwriteActivityTime.setType(BulkImportColumnType.OVERWRITE_ACTIVITY_TIME); + List columns = new ArrayList<>(); + columns.add(name); + columns.add(type); + columns.add(overwriteActivityTime); + + mapping.setColumns(columns); + mapping.setDelimiter(','); + mapping.setUpdate(true); + mapping.setHeader(true); + request.setMapping(mapping); + + BulkImportResult result = doPostWithTypedResponse("/api/device/bulk_import", request, new TypeReference<>() {}); + + Assert.assertEquals(1, result.getCreated().get()); + Assert.assertEquals(0, result.getErrors().get()); + Assert.assertTrue(result.getErrorsList().isEmpty()); + + Device savedDevice = doGet("/api/tenant/devices?deviceName=" + deviceName, Device.class); + + Assert.assertNotNull(savedDevice); + Assert.assertNotNull(savedDevice.getAdditionalInfo()); + Assert.assertTrue(savedDevice.getAdditionalInfo().get("overwriteActivityTime").asBoolean()); + } + @Test public void testSaveDeviceWithOutdatedVersion() throws Exception { Device device = createDevice("Device v1.0"); @@ -1518,4 +1558,97 @@ public class DeviceControllerTest extends AbstractControllerTest { assertThat(resavedSecondDevice.getExternalId()).isEqualTo(secondExternalId); } + @Test + public void testReclaimDeviceByCustomerUser() throws Exception { + Device device = createTenantDevice("Customer device to reclaim", customerId); + + loginCustomerAdminUser(); + doDeleteAsync("/api/customer/device/" + device.getName() + "/claim", String.class); + + loginTenantAdmin(); + Device reclaimedDevice = doGet("/api/device/" + device.getId().getId(), Device.class); + assertThat(reclaimedDevice.getOwnerId()).isEqualTo(tenantId); + } + + @Test + public void testReclaimDeviceOfDifferentCustomerByCustomerUser() throws Exception { + createDifferentCustomer(); + Device device = createTenantDevice("Different customer device", differentCustomerId); + + loginCustomerAdminUser(); + doDelete("/api/customer/device/" + device.getName() + "/claim").andExpect(status().isForbidden()); + + loginTenantAdmin(); + Device foundDevice = doGet("/api/device/" + device.getId().getId(), Device.class); + assertThat(foundDevice.getOwnerId()).isEqualTo(differentCustomerId); + } + + @Test + public void testReclaimSubCustomerDeviceByParentCustomerUser() throws Exception { + Device device = createTenantDevice("Sub-customer device to reclaim", subCustomerId); + + loginCustomerAdminUser(); + doDeleteAsync("/api/customer/device/" + device.getName() + "/claim", String.class); + + loginTenantAdmin(); + Device reclaimedDevice = doGet("/api/device/" + device.getId().getId(), Device.class); + assertThat(reclaimedDevice.getOwnerId()).isEqualTo(tenantId); + } + + @Test + public void testReclaimParentCustomerDeviceBySubCustomerUser() throws Exception { + Device device = createTenantDevice("Parent customer device", customerId); + + loginSubCustomerAdminUser(); + doDelete("/api/customer/device/" + device.getName() + "/claim").andExpect(status().isForbidden()); + + loginTenantAdmin(); + Device foundDevice = doGet("/api/device/" + device.getId().getId(), Device.class); + assertThat(foundDevice.getOwnerId()).isEqualTo(customerId); + } + + @Test + public void testReclaimDeviceByTenantAdmin() throws Exception { + Device device = createTenantDevice("Customer device to reclaim by tenant", customerId); + + doDeleteAsync("/api/customer/device/" + device.getName() + "/claim", String.class); + + Device reclaimedDevice = doGet("/api/device/" + device.getId().getId(), Device.class); + assertThat(reclaimedDevice.getOwnerId()).isEqualTo(tenantId); + } + + @Test + public void testClaimUnassignedDeviceByCustomerUser() throws Exception { + Device device = createTenantDevice("Unassigned device to claim", null); + claimDevicesService.registerClaimingInfo(tenantId, device.getId(), "secret", TimeUnit.MINUTES.toMillis(1)).get(); + + loginCustomerAdminUser(); + ClaimResult claimResult = doPostClaimAsync("/api/customer/device/" + device.getName() + "/claim", + new ClaimRequest("secret"), ClaimResult.class, status().isOk()); + assertThat(claimResult.getResponse()).isEqualTo(ClaimResponse.SUCCESS); + assertThat(claimResult.getDevice().getOwnerId()).isEqualTo(customerId); + } + + @Test + public void testClaimDeviceOfDifferentCustomerByCustomerUser() throws Exception { + createDifferentCustomer(); + Device device = createTenantDevice("Different customer device to claim", differentCustomerId); + + loginCustomerAdminUser(); + doPost("/api/customer/device/" + device.getName() + "/claim", new ClaimRequest(null)).andExpect(status().isForbidden()); + + loginTenantAdmin(); + Device foundDevice = doGet("/api/device/" + device.getId().getId(), Device.class); + assertThat(foundDevice.getOwnerId()).isEqualTo(differentCustomerId); + } + + private Device createTenantDevice(String name, CustomerId ownerId) throws Exception { + loginTenantAdmin(); + Device device = new Device(); + device.setName(name); + device.setType("default"); + device.setCustomerId(ownerId); + return doPost("/api/device", device, Device.class); + } + } diff --git a/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java index bfdff1a64d..b724258616 100644 --- a/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/EdgeControllerTest.java @@ -69,6 +69,7 @@ import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.page.TimePageLink; import org.thingsboard.server.common.data.permission.GroupPermission; +import org.thingsboard.server.common.data.permission.ShareGroupRequest; import org.thingsboard.server.common.data.queue.Queue; import org.thingsboard.server.common.data.role.Role; import org.thingsboard.server.common.data.role.RoleType; @@ -85,8 +86,8 @@ import org.thingsboard.server.dao.edge.EdgeDao; import org.thingsboard.server.dao.model.ModelConstants; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.edge.imitator.EdgeImitator; -import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; +import org.thingsboard.server.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; import org.thingsboard.server.gen.edge.v1.CustomTranslationUpdateMsg; @@ -259,6 +260,64 @@ public class EdgeControllerTest extends AbstractControllerTest { tenantAdminUser.getId(), tenantAdminUser.getEmail(), ActionType.ADDED, new DataValidationException(msgError)); } + @Test + public void testSaveEdgeWithIdOfDifferentTenant() throws Exception { + Edge savedEdge = doPost("/api/edge", constructEdge("My edge", "default"), Edge.class); + + loginDifferentTenant(); + try { + Edge edge = constructEdge("Different tenant edge", "other"); + edge.setId(savedEdge.getId()); + doPost("/api/edge", edge) + .andExpect(status().isForbidden()) + .andExpect(statusReason(containsString("You don't have permission to perform"))); + } finally { + deleteDifferentTenant(); + } + + loginTenantAdmin(); + Edge foundEdge = doGet("/api/edge/" + savedEdge.getId().getId().toString(), Edge.class); + Assert.assertEquals(tenantId, foundEdge.getTenantId()); + Assert.assertEquals(savedEdge.getName(), foundEdge.getName()); + Assert.assertEquals(savedEdge.getRoutingKey(), foundEdge.getRoutingKey()); + Assert.assertEquals(savedEdge.getSecret(), foundEdge.getSecret()); + } + + @Test + public void testAssignReadOnlyEntityGroupToEdgeByCustomerUser() throws Exception { + Edge edge = doPost("/api/edge", constructEdge("Customer edge", "default"), Edge.class); + doPost("/api/owner/CUSTOMER/" + customerId.getId() + "/EDGE/" + edge.getId().getId()) + .andExpect(status().isOk()); + + EntityGroup readOnlyGroup = new EntityGroup(); + readOnlyGroup.setType(EntityType.DEVICE); + readOnlyGroup.setName("Read only device group"); + readOnlyGroup = doPost("/api/entityGroup", readOnlyGroup, EntityGroup.class); + doPost("/api/entityGroup/" + readOnlyGroup.getId().getId() + "/share", + new ShareGroupRequest(customerId, true, null, true, null)) + .andExpect(status().isOk()); + + EntityGroup customerGroup = new EntityGroup(); + customerGroup.setType(EntityType.DEVICE); + customerGroup.setName("Customer device group"); + customerGroup.setOwnerId(customerId); + customerGroup = doPost("/api/entityGroup", customerGroup, EntityGroup.class); + + loginCustomerAdminUser(); + doGet("/api/entityGroup/" + readOnlyGroup.getId().getId()) + .andExpect(status().isOk()); + doPost("/api/edge/" + edge.getId().getId() + "/entityGroup/" + readOnlyGroup.getId().getId() + "/DEVICE") + .andExpect(status().isForbidden()); + doPost("/api/edge/" + edge.getId().getId() + "/entityGroup/" + customerGroup.getId().getId() + "/DEVICE") + .andExpect(status().isOk()); + + loginTenantAdmin(); + EntityGroupId readOnlyGroupId = readOnlyGroup.getId(); + PageData edgeGroups = doGetTypedWithPageLink("/api/entityGroups/edge/" + edge.getId().getId() + "/DEVICE?", + new TypeReference<>() {}, new PageLink(100)); + Assert.assertTrue(edgeGroups.getData().stream().noneMatch(g -> g.getId().equals(readOnlyGroupId))); + } + @Test public void testFindEdgeById() throws Exception { Edge edge = constructEdge("My edge", "default"); @@ -1047,9 +1106,7 @@ public class EdgeControllerTest extends AbstractControllerTest { Assert.assertTrue(popRuleChainMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "Edge Root Rule Chain")); Assert.assertTrue(popRuleChainMetadataMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, getEdgeRootRuleChainId(edgeImitator))); Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "general")); - Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "mail")); Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "connectivity")); - Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "jwt")); Assert.assertTrue(popDeviceProfileMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); Assert.assertTrue(popDeviceProfileMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); Assert.assertTrue(popAssetProfileMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); @@ -1770,9 +1827,7 @@ public class EdgeControllerTest extends AbstractControllerTest { Assert.assertTrue(popTenantProfileMsg(edgeImitator.getDownlinkMsgsDeque(), tenantProfileId)); Assert.assertTrue(popQueueMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "Main")); Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "general")); - Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "mail")); Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "connectivity")); - Assert.assertTrue(popAdminSettingsMsg(edgeImitator.getDownlinkMsgsDeque(), "jwt")); Assert.assertTrue(popRuleChainMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "Edge Root Rule Chain")); Assert.assertTrue(popRuleChainMetadataMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, getEdgeRootRuleChainId(edgeImitator))); Assert.assertTrue(popRoleMsg(edgeImitator.getDownlinkMsgsDeque(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "Tenant User", RoleType.GENERIC)); diff --git a/application/src/test/java/org/thingsboard/server/controller/SignUpControllerSqlTest.java b/application/src/test/java/org/thingsboard/server/controller/SignUpControllerSqlTest.java index 02b37c92ba..b100aa38c6 100644 --- a/application/src/test/java/org/thingsboard/server/controller/SignUpControllerSqlTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/SignUpControllerSqlTest.java @@ -8,7 +8,10 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.testcontainers.shaded.org.apache.commons.lang3.RandomStringUtils; import org.thingsboard.server.common.data.Customer; @@ -64,10 +67,13 @@ import java.util.concurrent.TimeUnit; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @DaoSqlTest public class SignUpControllerSqlTest extends AbstractControllerTest { @@ -217,6 +223,34 @@ public class SignUpControllerSqlTest extends AbstractControllerTest { removeCreatedUser(activatedUser); } + @Test + public void testActivationByEmailCodeFromMobileAppSendsWorkingMobileLoginLink() throws Exception { + String appSecret = StringUtils.randomAlphanumeric(24); + String mobilePkgName = "my.test.android.login." + RandomStringUtils.randomAlphabetic(6).toLowerCase(); + createMobileSelfRegistrationSettings(mobilePkgName, appSecret, PlatformType.ANDROID, createDashboard(), createDashboard()); + doSignUp(createMobileSignUpRequest(CUSTOMER_TEST_EMAIL, mobilePkgName, appSecret, PlatformType.ANDROID)); + User user = userService.findUserByEmail(tenantId, CUSTOMER_TEST_EMAIL); + String activateToken = userService.findUserCredentialsByUserId(tenantId, user.getId()).getActivateToken(); + + doPost("/api/noauth/activateByEmailCode", JsonNode.class, + "emailCode", activateToken, "pkgName", mobilePkgName, "platform", PlatformType.ANDROID.name()); + + ArgumentCaptor loginUrlCaptor = ArgumentCaptor.forClass(String.class); + verify(mailService).sendAccountActivatedEmail(any(), loginUrlCaptor.capture(), eq(CUSTOMER_TEST_EMAIL)); + String loginUrl = loginUrlCaptor.getValue(); + assertThat(loginUrl).contains("pkgName=" + mobilePkgName).contains("platform=ANDROID"); + + String loginPathAndQuery = loginUrl.substring(loginUrl.indexOf("/api/noauth/login")); + doGet(loginPathAndQuery) + .andExpect(status().isPermanentRedirect()) + .andExpect(header().string(HttpHeaders.LOCATION, "scheme://test/login")); + + int statusWithoutPlatform = doGet("/api/noauth/login?pkgName=" + mobilePkgName).andReturn().getResponse().getStatus(); + assertThat(statusWithoutPlatform).isNotEqualTo(HttpStatus.PERMANENT_REDIRECT.value()); + + removeCreatedUser(userService.findUserById(tenantId, user.getId())); + } + @Test public void testAcceptPrivacyPolicyStoresAcceptanceTimestamp() { doPost("/api/signup/acceptPrivacyPolicy", JsonNode.class); diff --git a/application/src/test/java/org/thingsboard/server/controller/TranslationControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/TranslationControllerTest.java index ad9edd430c..e28baac8ad 100644 --- a/application/src/test/java/org/thingsboard/server/controller/TranslationControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/TranslationControllerTest.java @@ -80,7 +80,7 @@ public class TranslationControllerTest extends AbstractControllerTest { JsonNode fullSystemTranslation = doGet("/api/translation/full/" + ES_ES, JsonNode.class); assertThat(fullSystemTranslation.get("save").asText()).isEqualTo("system"); assertThat(fullSystemTranslation.get("access").get("unauthorized").asText()).isEqualTo("No autorizado"); - assertThat(fullSystemTranslation.get("solution-template").get("solution-template").asText()).isEqualTo("Plantilla de solución"); + assertThat(fullSystemTranslation.get("device").get("device").asText()).isEqualTo("Dispositivo"); // get full tenant translation loginTenantAdmin(); @@ -88,7 +88,7 @@ public class TranslationControllerTest extends AbstractControllerTest { assertThat(fullTenantTranslation.get("save").asText()).isEqualTo("system"); assertThat(fullTenantTranslation.get("update").asText()).isEqualTo("tenant"); assertThat(fullTenantTranslation.get("access").get("unauthorized").asText()).isEqualTo("No autorizado"); - assertThat(fullTenantTranslation.get("solution-template").get("solution-template").asText()).isEqualTo("Plantilla de solución"); + assertThat(fullTenantTranslation.get("device").get("device").asText()).isEqualTo("Dispositivo"); // get full customer custom translation loginCustomerAdminUser(); @@ -97,7 +97,7 @@ public class TranslationControllerTest extends AbstractControllerTest { assertThat(fullCustomerTranslation.get("update").asText()).isEqualTo("tenant"); assertThat(fullCustomerTranslation.get("remove").asText()).isEqualTo("customer"); assertThat(fullCustomerTranslation.get("access").get("unauthorized").asText()).isEqualTo("No autorizado"); - assertThat(fullCustomerTranslation.get("solution-template").get("solution-template").asText()).isEqualTo("Plantilla de solución"); + assertThat(fullCustomerTranslation.get("device").get("device").asText()).isEqualTo("Dispositivo"); // get full subcustomer custom translation loginSubCustomerAdminUser(); @@ -107,7 +107,7 @@ public class TranslationControllerTest extends AbstractControllerTest { assertThat(fullSubCustomerTranslation.get("remove").asText()).isEqualTo("customer"); assertThat(fullSubCustomerTranslation.get("search").asText()).isEqualTo("subCustomer"); assertThat(fullSubCustomerTranslation.get("access").get("unauthorized").asText()).isEqualTo("No autorizado"); - assertThat(fullSubCustomerTranslation.get("solution-template").get("solution-template").asText()).isEqualTo("Plantilla de solución"); + assertThat(fullSubCustomerTranslation.get("device").get("device").asText()).isEqualTo("Dispositivo"); } @Test @@ -396,7 +396,7 @@ public class TranslationControllerTest extends AbstractControllerTest { assertThat(downloadedCustomTranslation.get("save").asText()).isEqualTo("system"); assertThat(downloadedCustomTranslation.get("access").get("unauthorized").asText()).isEqualTo("No autorizado"); - assertThat(downloadedCustomTranslation.get("solution-template").get("solution-template").asText()).isEqualTo("Plantilla de solución"); + assertThat(downloadedCustomTranslation.get("device").get("device").asText()).isEqualTo("Dispositivo"); } @Test diff --git a/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java index d464bf58a6..2b2232ecc9 100644 --- a/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/AbstractEdgeTest.java @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.Dashboard; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; +import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.EntityView; @@ -105,6 +106,7 @@ import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; import org.thingsboard.server.gen.edge.v1.SyncCompletedMsg; import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; @@ -117,6 +119,7 @@ import java.util.Optional; import java.util.TreeMap; import java.util.UUID; import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; import java.util.stream.Collectors; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -138,7 +141,7 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { registry.add("edges.rpc.port", () -> EDGE_PORT); } - public static final Integer CONNECT_MESSAGE_COUNT = 31; + public static final Integer CONNECT_MESSAGE_COUNT = 29; public static final Integer INSTALLATION_MESSAGE_COUNT = 6; public static final Integer SYNC_MESSAGE_COUNT = CONNECT_MESSAGE_COUNT + INSTALLATION_MESSAGE_COUNT; protected static final String THERMOSTAT_DEVICE_PROFILE_NAME = "Thermostat"; @@ -156,6 +159,16 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { private static List idsToRemove = new ArrayList<>(); + protected void sendUplinkMsgAndWaitForResponse(Consumer customizer) throws Exception { + UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder(); + uplinkMsgBuilder.setUplinkMsgId(EdgeUtils.nextPositiveInt()); + customizer.accept(uplinkMsgBuilder); + + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(uplinkMsgBuilder.build()); + Assert.assertTrue(edgeImitator.waitForResponses()); + } + @Before public void setupEdgeTest() throws Exception { loginSysAdmin(); @@ -199,6 +212,7 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { @After public void teardownEdgeTest() { try { + deleteDifferentTenant(); loginTenantAdmin(); customMenuDao.removeAllByIds(idsToRemove); idsToRemove = new ArrayList<>(); @@ -298,9 +312,9 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { validateMsgsCnt(RuleChainMetadataUpdateMsg.class, 1); validateRuleChainMetadataUpdates(ruleChainUUID); - // 4 messages ('general', 'mail', 'connectivity', 'jwt') - validateMsgsCnt(AdminSettingsUpdateMsg.class, 4); - validateAdminSettings(4); + // 2 messages ('general', 'connectivity') + validateMsgsCnt(AdminSettingsUpdateMsg.class, 2); + validateAdminSettings(2); // 5 messages // - 1 from default profile fetcher @@ -467,18 +481,16 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { for (AdminSettingsUpdateMsg adminSettingsUpdateMsg : adminSettingsUpdateMsgs) { AdminSettings adminSettings = JacksonUtil.fromString(adminSettingsUpdateMsg.getEntity(), AdminSettings.class, true); Assert.assertNotNull(adminSettings); + // Only allow-listed keys sync to the edge; provider/secret settings (e.g. 'mail', 'jwt', + // self-registration mappings) must never arrive on the edge. + Assert.assertTrue("Unexpected admin settings key synced to edge: " + adminSettings.getKey(), + adminSettings.getKey().equals("general") || adminSettings.getKey().equals("connectivity")); if (adminSettings.getKey().equals("general")) { validateGeneralAdminSettings(adminSettings); } - if (adminSettings.getKey().equals("mail")) { - validateMailAdminSettings(adminSettings); - } if (adminSettings.getKey().equals("connectivity")) { validateConnectivityAdminSettings(adminSettings); } - if (adminSettings.getKey().equals("jwt")) { - validateJwtAdminSettings(adminSettings); - } } } @@ -486,15 +498,6 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { Assert.assertNotNull(adminSettings.getJsonValue().get("baseUrl")); } - private void validateMailAdminSettings(AdminSettings adminSettings) { - JsonNode jsonNode = adminSettings.getJsonValue(); - Assert.assertNotNull(jsonNode.get("mailFrom")); - Assert.assertNotNull(jsonNode.get("smtpProtocol")); - Assert.assertNotNull(jsonNode.get("smtpHost")); - Assert.assertNotNull(jsonNode.get("smtpPort")); - Assert.assertNotNull(jsonNode.get("timeout")); - } - private void validateConnectivityAdminSettings(AdminSettings adminSettings) { JsonNode jsonNode = adminSettings.getJsonValue(); Assert.assertNotNull(jsonNode.get("http")); @@ -647,6 +650,23 @@ abstract public class AbstractEdgeTest extends AbstractControllerTest { return savedDevice; } + protected Device saveDifferentTenantDevice() throws Exception { + loginDifferentTenant(); + Device device = new Device(); + device.setName("Different Tenant Device"); + device.setType("default"); + Device savedDevice = doPost("/api/device", device, Device.class); + loginTenantAdmin(); + return savedDevice; + } + + protected void sendUplinkMsgAndVerifyNoDownlink(Consumer customizer) throws Exception { + edgeImitator.expectMessageAmount(1); + sendUplinkMsgAndWaitForResponse(customizer); + // edge events are polled every second, so 2 seconds cover a full poll cycle + Assert.assertFalse(edgeImitator.waitForMessages(2)); + } + protected Device saveDevice(String deviceName, String type) { return saveDevice(deviceName, type, null); } diff --git a/application/src/test/java/org/thingsboard/server/edge/AdminSettingsEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/AdminSettingsEdgeTest.java deleted file mode 100644 index 023d5db484..0000000000 --- a/application/src/test/java/org/thingsboard/server/edge/AdminSettingsEdgeTest.java +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. -// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 -package org.thingsboard.server.edge; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.protobuf.AbstractMessage; -import org.junit.Assert; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.server.common.data.AdminSettings; -import org.thingsboard.server.dao.service.DaoSqlTest; -import org.thingsboard.server.dao.settings.AdminSettingsService; -import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; - -@DaoSqlTest -public class AdminSettingsEdgeTest extends AbstractEdgeTest { - - @Autowired - private AdminSettingsService adminSettingsService; - - @Test - public void testAdminSettings_sysAdmin() throws Exception { - loginSysAdmin(); - - AdminSettings adminSettings = new AdminSettings(); - adminSettings.setKey("edgeTest"); - ObjectNode jsonValue = JacksonUtil.newObjectNode(); - jsonValue.put("key1", "value1"); - adminSettings.setJsonValue(jsonValue); - - edgeImitator.expectMessageAmount(1); - AdminSettings savedAdminSettings = doPost("/api/admin/settings", adminSettings, AdminSettings.class); - Assert.assertTrue(edgeImitator.waitForMessages()); - - AbstractMessage latestMessage = edgeImitator.getLatestMessage(); - Assert.assertTrue(latestMessage instanceof AdminSettingsUpdateMsg); - AdminSettingsUpdateMsg adminSettingsUpdateMsg = (AdminSettingsUpdateMsg) latestMessage; - AdminSettings adminSettingsMsg = JacksonUtil.fromString(adminSettingsUpdateMsg.getEntity(), AdminSettings.class, true); - Assert.assertNotNull(adminSettingsMsg); - Assert.assertEquals("edgeTest", adminSettingsMsg.getKey()); - Assert.assertEquals("value1", adminSettingsMsg.getJsonValue().get("key1").asText()); - - ObjectNode updatedJsonValue = (ObjectNode) savedAdminSettings.getJsonValue(); - updatedJsonValue.put("key2", "value2"); - savedAdminSettings.setJsonValue(updatedJsonValue); - - edgeImitator.expectMessageAmount(1); - doPost("/api/admin/settings", savedAdminSettings, AdminSettings.class); - Assert.assertTrue(edgeImitator.waitForMessages()); - - latestMessage = edgeImitator.getLatestMessage(); - Assert.assertTrue(latestMessage instanceof AdminSettingsUpdateMsg); - adminSettingsUpdateMsg = (AdminSettingsUpdateMsg) latestMessage; - adminSettingsMsg = JacksonUtil.fromString(adminSettingsUpdateMsg.getEntity(), AdminSettings.class, true); - Assert.assertNotNull(adminSettingsMsg); - Assert.assertEquals("edgeTest", adminSettingsMsg.getKey()); - Assert.assertEquals("value1", adminSettingsMsg.getJsonValue().get("key1").asText()); - Assert.assertEquals("value2", adminSettingsMsg.getJsonValue().get("key2").asText()); - - adminSettingsService.deleteAdminSettingsByTenantIdAndKey(savedAdminSettings.getTenantId(), "edgeTest"); - } - - @Test - public void testAdminSettings_tenant() throws Exception { - loginTenantAdmin(); - - AdminSettings tenantAdminSettings = new AdminSettings(); - tenantAdminSettings.setTenantId(tenantId); - tenantAdminSettings.setKey("tenantEdgeTest"); - ObjectNode tenantJsonValue = JacksonUtil.newObjectNode(); - tenantJsonValue.put("tenantKey1", "tenantValue1"); - tenantAdminSettings.setJsonValue(tenantJsonValue); - - edgeImitator.expectMessageAmount(1); - AdminSettings savedTenantAdminSettings = doPost("/api/admin/settings", tenantAdminSettings, AdminSettings.class); - Assert.assertTrue(edgeImitator.waitForMessages()); - - AbstractMessage latestMessage = edgeImitator.getLatestMessage(); - Assert.assertTrue(latestMessage instanceof AdminSettingsUpdateMsg); - AdminSettingsUpdateMsg adminSettingsUpdateMsg = (AdminSettingsUpdateMsg) latestMessage; - AdminSettings adminSettingsMsg = JacksonUtil.fromString(adminSettingsUpdateMsg.getEntity(), AdminSettings.class, true); - Assert.assertNotNull(adminSettingsMsg); - Assert.assertEquals("tenantEdgeTest", adminSettingsMsg.getKey()); - Assert.assertEquals("tenantValue1", adminSettingsMsg.getJsonValue().get("tenantKey1").asText()); - - // TENANT update - ObjectNode updatedTenantJsonValue = (ObjectNode) savedTenantAdminSettings.getJsonValue(); - updatedTenantJsonValue.put("tenantKey2", "tenantValue2"); - savedTenantAdminSettings.setJsonValue(updatedTenantJsonValue); - - edgeImitator.expectMessageAmount(1); - doPost("/api/admin/settings", savedTenantAdminSettings, AdminSettings.class); - Assert.assertTrue(edgeImitator.waitForMessages()); - - latestMessage = edgeImitator.getLatestMessage(); - Assert.assertTrue(latestMessage instanceof AdminSettingsUpdateMsg); - adminSettingsUpdateMsg = (AdminSettingsUpdateMsg) latestMessage; - adminSettingsMsg = JacksonUtil.fromString(adminSettingsUpdateMsg.getEntity(), AdminSettings.class, true); - Assert.assertNotNull(adminSettingsMsg); - Assert.assertEquals("tenantEdgeTest", adminSettingsMsg.getKey()); - Assert.assertEquals("tenantValue1", adminSettingsMsg.getJsonValue().get("tenantKey1").asText()); - Assert.assertEquals("tenantValue2", adminSettingsMsg.getJsonValue().get("tenantKey2").asText()); - - adminSettingsService.deleteAdminSettingsByTenantIdAndKey(savedTenantAdminSettings.getTenantId(), "tenantEdgeTest"); - } - -} diff --git a/application/src/test/java/org/thingsboard/server/edge/AiModelEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/AiModelEdgeTest.java index 2d33eafba7..a7695b8337 100644 --- a/application/src/test/java/org/thingsboard/server/edge/AiModelEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/AiModelEdgeTest.java @@ -1,16 +1,21 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.edge; import com.datastax.oss.driver.api.core.uuid.Uuids; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.protobuf.AbstractMessage; import com.google.protobuf.InvalidProtocolBufferException; import org.junit.Assert; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.ai.AiModel; import org.thingsboard.server.common.data.ai.model.chat.OpenAiChatModelConfig; import org.thingsboard.server.common.data.ai.provider.OpenAiProviderConfig; +import org.thingsboard.server.common.data.id.AiModelId; +import org.thingsboard.server.dao.ai.AiModelService; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.gen.edge.v1.AiModelUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; @@ -28,6 +33,9 @@ import static org.thingsboard.server.gen.edge.v1.UpdateMsgType.ENTITY_DELETED_RP @DaoSqlTest public class AiModelEdgeTest extends AbstractEdgeTest { + @Autowired + private AiModelService aiModelService; + private static final String DEFAULT_AI_MODEL_NAME = "Edge Test AiModel"; private static final String UPDATED_AI_MODEL_NAME = "Updated Edge Test AiModel"; @@ -139,6 +147,46 @@ public class AiModelEdgeTest extends AbstractEdgeTest { Assert.assertNotEquals(DEFAULT_AI_MODEL_NAME, aiModelFromCloud.getName()); } + @Test + public void testAiModelUpdateFromEdgeKeepsCustomerAccessEnabled() throws Exception { + AiModel aiModel = createSimpleAiModel(DEFAULT_AI_MODEL_NAME); + aiModel.setCustomerAccessEnabled(true); + + edgeImitator.expectMessageAmount(1); + AiModel savedAiModel = doPost("/api/ai/model", aiModel, AiModel.class); + Assert.assertTrue(edgeImitator.waitForMessages()); + Assert.assertTrue(savedAiModel.isCustomerAccessEnabled()); + + // edge versions without customerAccessEnabled send the model without this field + savedAiModel.setName(UPDATED_AI_MODEL_NAME); + ObjectNode legacyAiModelJson = (ObjectNode) JacksonUtil.valueToTree(savedAiModel); + legacyAiModelJson.remove("customerAccessEnabled"); + UplinkMsg uplinkMsg = getUplinkMsg(savedAiModel.getUuidId(), JacksonUtil.toString(legacyAiModelJson), UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE); + + checkAiModelOnCloud(uplinkMsg, savedAiModel.getUuidId(), UPDATED_AI_MODEL_NAME); + + AiModel aiModelFromCloud = doGet("/api/ai/model/" + savedAiModel.getUuidId(), AiModel.class); + Assert.assertTrue(aiModelFromCloud.isCustomerAccessEnabled()); + } + + @Test + public void testAiModelUpdateFromEdgeChangesCustomerAccessEnabled() throws Exception { + AiModel aiModel = createSimpleAiModel(DEFAULT_AI_MODEL_NAME); + aiModel.setCustomerAccessEnabled(true); + + edgeImitator.expectMessageAmount(1); + AiModel savedAiModel = doPost("/api/ai/model", aiModel, AiModel.class); + Assert.assertTrue(edgeImitator.waitForMessages()); + + savedAiModel.setCustomerAccessEnabled(false); + UplinkMsg uplinkMsg = getUplinkMsg(savedAiModel.getUuidId(), savedAiModel, UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE); + + checkAiModelOnCloud(uplinkMsg, savedAiModel.getUuidId(), DEFAULT_AI_MODEL_NAME); + + AiModel aiModelFromCloud = doGet("/api/ai/model/" + savedAiModel.getUuidId(), AiModel.class); + Assert.assertFalse(aiModelFromCloud.isCustomerAccessEnabled()); + } + private AiModel createSimpleAiModel(String name) { AiModel aiModel = new AiModel(); aiModel.setTenantId(tenantId); @@ -172,11 +220,15 @@ public class AiModelEdgeTest extends AbstractEdgeTest { } private UplinkMsg getUplinkMsg(UUID uuid, AiModel aiModel, UpdateMsgType updateMsgType) throws InvalidProtocolBufferException { + return getUplinkMsg(uuid, JacksonUtil.toString(aiModel), updateMsgType); + } + + private UplinkMsg getUplinkMsg(UUID uuid, String aiModelJson, UpdateMsgType updateMsgType) throws InvalidProtocolBufferException { UplinkMsg.Builder uplinkMsgBuilder = UplinkMsg.newBuilder(); AiModelUpdateMsg.Builder aiModelUpdateMsgBuilder = AiModelUpdateMsg.newBuilder(); aiModelUpdateMsgBuilder.setIdMSB(uuid.getMostSignificantBits()); aiModelUpdateMsgBuilder.setIdLSB(uuid.getLeastSignificantBits()); - aiModelUpdateMsgBuilder.setEntity(JacksonUtil.toString(aiModel)); + aiModelUpdateMsgBuilder.setEntity(aiModelJson); aiModelUpdateMsgBuilder.setMsgType(updateMsgType); testAutoGeneratedCodeByProtobuf(aiModelUpdateMsgBuilder); uplinkMsgBuilder.addAiModelUpdateMsg(aiModelUpdateMsgBuilder.build()); @@ -200,4 +252,21 @@ public class AiModelEdgeTest extends AbstractEdgeTest { Assert.assertEquals(resourceTitle, aiModel.getName()); } + @Test + public void testSendAiModelWithTenantIdOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + UUID uuid = Uuids.timeBased(); + AiModel aiModel = createSimpleAiModel("Edge AI Model With Different Tenant"); + aiModel.setTenantId(differentTenantId); + UplinkMsg uplinkMsg = getUplinkMsg(uuid, aiModel, UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(uplinkMsg); + Assert.assertTrue(edgeImitator.waitForResponses()); + + Optional aiModelFromCloud = aiModelService.findAiModelById(tenantId, new AiModelId(uuid)); + Assert.assertTrue(aiModelFromCloud.isPresent()); + Assert.assertEquals(tenantId, aiModelFromCloud.get().getTenantId()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java index 40a55683f6..1954d0c5bd 100644 --- a/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/AlarmEdgeTest.java @@ -28,6 +28,7 @@ import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.List; import java.util.Optional; @@ -282,4 +283,56 @@ public class AlarmEdgeTest extends AbstractEdgeTest { return alarmComment; } + @Test + public void testSendAlarmForEntityOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + Alarm alarm = new Alarm(); + alarm.setId(new AlarmId(Uuids.timeBased())); + alarm.setTenantId(differentTenantId); + alarm.setOriginator(device.getId()); + alarm.setType("Edge Alarm"); + alarm.setSeverity(AlarmSeverity.CRITICAL); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addAlarmUpdateMsg( + EdgeMsgConstructorUtils.constructAlarmUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, alarm))); + + loginDifferentTenant(); + doGet("/api/alarm/" + alarm.getUuidId()).andExpect(status().isNotFound()); + } + + @Test + public void testSendAlarmCommentWithIdOfCommentOfAnotherAlarmToCloud() throws Exception { + Device device = saveDevice("Alarm Comment Device", "default"); + Alarm firstAlarm = saveAlarm(device, "first alarm"); + Alarm secondAlarm = saveAlarm(device, "second alarm"); + + AlarmComment alarmComment = new AlarmComment(); + alarmComment.setComment(new TextNode("Original comment")); + alarmComment.setAlarmId(firstAlarm.getId()); + alarmComment = doPost("/api/alarm/" + firstAlarm.getUuidId() + "/comment", alarmComment, AlarmComment.class); + + AlarmComment edgeAlarmComment = new AlarmComment(); + edgeAlarmComment.setId(alarmComment.getId()); + edgeAlarmComment.setCreatedTime(alarmComment.getCreatedTime()); + edgeAlarmComment.setAlarmId(secondAlarm.getId()); + edgeAlarmComment.setComment(new TextNode("Changed comment")); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addAlarmCommentUpdateMsg(AlarmCommentUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE) + .setEntity(JacksonUtil.toString(edgeAlarmComment)) + .build())); + + PageData firstAlarmComments = doGetTyped("/api/alarm/" + firstAlarm.getUuidId() + "/comment?page=0&pageSize=10", new TypeReference<>() {}); + Assert.assertEquals(1, firstAlarmComments.getTotalElements()); + Assert.assertEquals(alarmComment.getComment(), firstAlarmComments.getData().get(0).getComment()); + PageData secondAlarmComments = doGetTyped("/api/alarm/" + secondAlarm.getUuidId() + "/comment?page=0&pageSize=10", new TypeReference<>() {}); + Assert.assertEquals(0, secondAlarmComments.getTotalElements()); + } + + private Alarm saveAlarm(Device device, String type) { + Alarm alarm = new Alarm(); + alarm.setOriginator(device.getId()); + alarm.setType(type); + alarm.setSeverity(AlarmSeverity.MINOR); + return doPost("/api/alarm", alarm, Alarm.class); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/ApiKeyEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/ApiKeyEdgeTest.java index 50f2647747..5d419c493d 100644 --- a/application/src/test/java/org/thingsboard/server/edge/ApiKeyEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/ApiKeyEdgeTest.java @@ -15,6 +15,9 @@ import org.thingsboard.server.common.data.group.EntityGroupInfo; import org.thingsboard.server.common.data.id.ApiKeyId; import org.thingsboard.server.common.data.pat.ApiKey; import org.thingsboard.server.common.data.pat.ApiKeyInfo; +import org.thingsboard.server.common.data.permission.AuthorityPermissionsInfo; +import org.thingsboard.server.common.data.permission.Operation; +import org.thingsboard.server.common.data.permission.Resource; import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.dao.pat.ApiKeyService; import org.thingsboard.server.dao.service.DaoSqlTest; @@ -25,7 +28,9 @@ import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; +import java.util.Map; import java.util.Optional; +import java.util.Set; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -225,4 +230,39 @@ public class ApiKeyEdgeTest extends AbstractEdgeTest { Assert.assertEquals(description, apiKey.getDescription()); } + @Test + public void testSendApiKeyForUserOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + UUID uuid = Uuids.timeBased(); + ApiKey apiKey = createSimpleApiKey("Different Tenant User Key"); + apiKey.setTenantId(differentTenantId); + apiKey.setUserId(savedDifferentTenantUser.getId()); + UplinkMsg uplinkMsg = getUplinkMsg(uuid, apiKey, UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(uplinkMsg); + Assert.assertTrue(edgeImitator.waitForResponses()); + + Assert.assertNull(apiKeyService.findApiKeyById(tenantId, new ApiKeyId(uuid))); + } + + @Test + public void testSendInternalApiKeyWithPermissionsToCloud() throws Exception { + UUID uuid = Uuids.timeBased(); + ApiKey apiKey = createSimpleApiKey("Internal Key From Edge"); + apiKey.setInternal(true); + AuthorityPermissionsInfo permissions = new AuthorityPermissionsInfo(); + permissions.setOperationsByResource(Map.of(Authority.SYS_ADMIN, Map.of(Resource.ALL, Set.of(Operation.ALL)))); + apiKey.setPermissions(permissions); + UplinkMsg uplinkMsg = getUplinkMsg(uuid, apiKey, UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE); + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(uplinkMsg); + Assert.assertTrue(edgeImitator.waitForResponses()); + + ApiKey savedApiKey = apiKeyService.findApiKeyById(tenantId, new ApiKeyId(uuid)); + Assert.assertNotNull(savedApiKey); + Assert.assertFalse(savedApiKey.isInternal()); + Assert.assertNull(savedApiKey.getPermissions()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/CalculatedFieldEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/CalculatedFieldEdgeTest.java index 7da491f7c9..f6c34f1ffa 100644 --- a/application/src/test/java/org/thingsboard/server/edge/CalculatedFieldEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/CalculatedFieldEdgeTest.java @@ -7,6 +7,7 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.InvalidProtocolBufferException; import org.junit.Assert; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.cf.CalculatedField; @@ -17,13 +18,16 @@ import org.thingsboard.server.common.data.cf.configuration.ReferencedEntityKey; import org.thingsboard.server.common.data.cf.configuration.SimpleCalculatedFieldConfiguration; import org.thingsboard.server.common.data.cf.configuration.TimeSeriesOutput; import org.thingsboard.server.common.data.debug.DebugSettings; +import org.thingsboard.server.common.data.id.CalculatedFieldId; import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.dao.cf.CalculatedFieldService; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.gen.edge.v1.CalculatedFieldRequestMsg; import org.thingsboard.server.gen.edge.v1.CalculatedFieldUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.Map; import java.util.Optional; @@ -33,6 +37,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @DaoSqlTest public class CalculatedFieldEdgeTest extends AbstractEdgeTest { + + @Autowired + private CalculatedFieldService calculatedFieldService; private static final String DEFAULT_CF_NAME = "Edge Test CalculatedField"; private static final String UPDATED_CF_NAME = "Updated Edge Test CalculatedField"; @@ -252,4 +259,30 @@ public class CalculatedFieldEdgeTest extends AbstractEdgeTest { Assert.assertEquals(JacksonUtil.newObjectNode(), calculatedField.getAdditionalInfo()); } + @Test + public void testSendCalculatedFieldForEntityOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + CalculatedField calculatedField = createSimpleCalculatedField(device.getId(), new SimpleCalculatedFieldConfiguration()); + calculatedField.setId(new CalculatedFieldId(Uuids.timeBased())); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addCalculatedFieldUpdateMsg( + EdgeMsgConstructorUtils.constructCalculatedFieldUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, calculatedField))); + + Assert.assertNull(calculatedFieldService.findById(tenantId, calculatedField.getId())); + } + + @Test + public void testSendCalculatedFieldDeleteForCalculatedFieldOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + CalculatedField calculatedField = createSimpleCalculatedField(device.getId(), new SimpleCalculatedFieldConfiguration()); + calculatedField.setTenantId(differentTenantId); + loginDifferentTenant(); + CalculatedField savedCalculatedField = doPost("/api/calculatedField", calculatedField, CalculatedField.class); + loginTenantAdmin(); + + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addCalculatedFieldUpdateMsg( + EdgeMsgConstructorUtils.constructCalculatedFieldDeleteMsg(savedCalculatedField.getId()))); + + Assert.assertNotNull(calculatedFieldService.findById(differentTenantId, savedCalculatedField.getId())); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java index 716d64fa56..609e96eb3e 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DashboardEdgeTest.java @@ -22,6 +22,7 @@ import org.thingsboard.server.gen.edge.v1.EntityGroupRequestMsg; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.Collections; import java.util.List; @@ -273,4 +274,21 @@ public class DashboardEdgeTest extends AbstractEdgeTest { return dashboard; } + @Test + public void testSendDashboardUpdateForDashboardOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + Dashboard dashboard = new Dashboard(); + dashboard.setTitle("Different Tenant Dashboard"); + dashboard = doPost("/api/dashboard", dashboard, Dashboard.class); + loginTenantAdmin(); + + Dashboard dashboardUpdate = new Dashboard(dashboard); + dashboardUpdate.setTitle("Updated Title"); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addDashboardUpdateMsg( + EdgeMsgConstructorUtils.constructDashboardUpdatedMsg(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE, dashboardUpdate, null))); + + loginDifferentTenant(); + Assert.assertEquals(dashboard.getTitle(), doGet("/api/dashboard/" + dashboard.getUuidId(), Dashboard.class).getTitle()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java index 8a4892f529..db600a0d17 100644 --- a/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/DeviceEdgeTest.java @@ -20,6 +20,7 @@ import org.springframework.test.context.DynamicPropertySource; import org.springframework.test.context.TestPropertySource; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.adaptor.JsonConverter; +import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceInfo; @@ -38,6 +39,7 @@ import org.thingsboard.server.common.data.group.EntityGroup; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.RpcId; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.ota.OtaPackageType; import org.thingsboard.server.common.data.rpc.Rpc; import org.thingsboard.server.common.data.rpc.RpcStatus; @@ -61,6 +63,7 @@ import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import org.thingsboard.server.transport.mqtt.mqttv3.MqttTestCallback; import org.thingsboard.server.transport.mqtt.mqttv3.MqttTestClient; @@ -754,6 +757,18 @@ public class DeviceEdgeTest extends AbstractEdgeTest { doGet("/api/rpc/persistent/" + unknownRpcId.getId()).andExpect(status().isNotFound()); } + @Test + public void testRpcV2StatusForRpcOfDifferentTenantFromEdge() throws Exception { + Device device = saveDifferentTenantDevice(); + Rpc rpc = savePersistentRpc(differentTenantId, device, RpcStatus.QUEUED); + + sendRpcStatusUplink(device, rpc.getId(), RpcStatus.SUCCESSFUL, "{\"result\":\"ok\"}"); + + Rpc rpcAfterUplink = rpcService.findById(differentTenantId, rpc.getId()); + Assert.assertEquals(RpcStatus.QUEUED, rpcAfterUplink.getStatus()); + Assert.assertNull(rpcAfterUplink.getResponse()); + } + @Test public void testRpcV2DeleteFromEdge() throws Exception { Device device = saveDeviceOnCloudAndVerifyDeliveryToEdge(); @@ -785,8 +800,12 @@ public class DeviceEdgeTest extends AbstractEdgeTest { } private Rpc savePersistentRpc(Device device, RpcStatus status) throws Exception { + return savePersistentRpc(tenantId, device, status); + } + + private Rpc savePersistentRpc(TenantId rpcTenantId, Device device, RpcStatus status) throws Exception { Rpc rpc = new Rpc(new RpcId(Uuids.timeBased())); - rpc.setTenantId(tenantId); + rpc.setTenantId(rpcTenantId); rpc.setDeviceId(device.getId()); rpc.setExpirationTime(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(1)); rpc.setRequest(JacksonUtil.newObjectNode().put("method", "test_method")); @@ -1073,4 +1092,83 @@ public class DeviceEdgeTest extends AbstractEdgeTest { verifyEdgeConnected(); } + @Test + public void testSendDeviceCredentialsRequestForDeviceOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addDeviceCredentialsRequestMsg(DeviceCredentialsRequestMsg.newBuilder() + .setDeviceIdMSB(device.getUuidId().getMostSignificantBits()) + .setDeviceIdLSB(device.getUuidId().getLeastSignificantBits()).build())); + } + + @Test + public void testSendAttributesRequestForDeviceOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + loginDifferentTenant(); + doPost("/api/plugins/telemetry/DEVICE/" + device.getUuidId() + "/attributes/" + DataConstants.SERVER_SCOPE, + JacksonUtil.toJsonNode("{\"key1\":\"value1\"}")); + loginTenantAdmin(); + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addAttributesRequestMsg(AttributesRequestMsg.newBuilder() + .setEntityType(EntityType.DEVICE.name()) + .setEntityIdMSB(device.getUuidId().getMostSignificantBits()) + .setEntityIdLSB(device.getUuidId().getLeastSignificantBits()) + .setScope(DataConstants.SERVER_SCOPE).build())); + } + + @Test + public void testSendDeviceUpdateForDeviceOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + Device deviceUpdate = new Device(device); + deviceUpdate.setName("Updated Name"); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addDeviceUpdateMsg( + EdgeMsgConstructorUtils.constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE, deviceUpdate, null))); + + loginDifferentTenant(); + Assert.assertEquals(device.getName(), doGet("/api/device/" + device.getUuidId(), Device.class).getName()); + } + + @Test + public void testSendDeviceDeleteForDeviceOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + DeviceUpdateMsg.Builder deviceDeleteMsgBuilder = DeviceUpdateMsg.newBuilder(); + deviceDeleteMsgBuilder.setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE); + deviceDeleteMsgBuilder.setIdMSB(device.getUuidId().getMostSignificantBits()); + deviceDeleteMsgBuilder.setIdLSB(device.getUuidId().getLeastSignificantBits()); + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addDeviceUpdateMsg(deviceDeleteMsgBuilder.build())); + + loginDifferentTenant(); + doGet("/api/device/" + device.getUuidId()).andExpect(status().isOk()); + } + + @Test + public void testSendDeviceWithTenantIdOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + Device device = new Device(); + device.setId(new DeviceId(Uuids.timeBased())); + device.setTenantId(differentTenantId); + device.setName("Edge Device With Different Tenant"); + device.setType("default"); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addDeviceUpdateMsg( + EdgeMsgConstructorUtils.constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, device, null))); + + Assert.assertEquals(tenantId, doGet("/api/device/" + device.getUuidId(), Device.class).getTenantId()); + } + + @Test + public void testSendDeviceUpdateWithCustomerOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + Customer customer = new Customer(); + customer.setTitle("Different Tenant Customer"); + Customer savedCustomer = doPost("/api/customer", customer, Customer.class); + loginTenantAdmin(); + + Device device = saveDeviceOnCloudAndVerifyDeliveryToEdge(); + Device deviceUpdate = new Device(device); + deviceUpdate.setCustomerId(savedCustomer.getId()); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addDeviceUpdateMsg( + EdgeMsgConstructorUtils.constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE, deviceUpdate, null))); + + Assert.assertEquals(tenantId, doGet("/api/device/" + device.getUuidId(), Device.class).getOwnerId()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/EntityGroupEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/EntityGroupEdgeTest.java index 6e507ab2e1..e44e60f6e4 100644 --- a/application/src/test/java/org/thingsboard/server/edge/EntityGroupEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/EntityGroupEdgeTest.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.node.TextNode; import org.awaitility.Awaitility; import org.junit.Assert; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.Dashboard; @@ -21,12 +22,15 @@ import org.thingsboard.server.common.data.group.EntityGroupInfo; import org.thingsboard.server.common.data.id.AssetId; import org.thingsboard.server.common.data.id.DashboardId; import org.thingsboard.server.common.data.id.DeviceId; +import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.EntityGroupId; import org.thingsboard.server.common.data.id.EntityViewId; import org.thingsboard.server.common.data.id.RoleId; +import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.permission.GroupPermission; import org.thingsboard.server.common.data.role.Role; import org.thingsboard.server.common.data.role.RoleType; +import org.thingsboard.server.dao.group.EntityGroupService; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; @@ -35,6 +39,8 @@ import org.thingsboard.server.gen.edge.v1.EntityGroupRequestMsg; import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; import org.thingsboard.server.gen.edge.v1.GroupPermissionProto; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import java.util.List; @@ -47,6 +53,9 @@ import static org.thingsboard.server.dao.customer.CustomerServiceImpl.PUBLIC_CUS @DaoSqlTest public class EntityGroupEdgeTest extends AbstractEdgeTest { + @Autowired + private EntityGroupService entityGroupService; + @Test public void testAllEdgeEntityGroup_autoAssignedToEdgeAfterUnAssign() throws Exception { sendAssetCreateMsgToCloud("Asset From Edge"); @@ -149,6 +158,109 @@ public class EntityGroupEdgeTest extends AbstractEdgeTest { } } + @Test + public void testSendDeviceDeleteFromGroupOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + Device device = new Device(); + device.setName("Different Tenant Group Device"); + device.setType("default"); + Device savedDevice = doPost("/api/device", device, Device.class); + EntityGroup deviceGroup = saveDifferentTenantGroup(EntityType.DEVICE, savedDevice.getId()); + loginTenantAdmin(); + + DeviceUpdateMsg deviceDeleteMsg = DeviceUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(savedDevice.getUuidId().getMostSignificantBits()) + .setIdLSB(savedDevice.getUuidId().getLeastSignificantBits()) + .setEntityGroupIdMSB(deviceGroup.getUuidId().getMostSignificantBits()) + .setEntityGroupIdLSB(deviceGroup.getUuidId().getLeastSignificantBits()) + .build(); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addDeviceUpdateMsg(deviceDeleteMsg)); + + Assert.assertTrue(findGroupEntityIds(deviceGroup).contains(savedDevice.getId())); + } + + @Test + public void testSendUserDeleteFromGroupOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + EntityGroup userGroup = saveDifferentTenantGroup(EntityType.USER, savedDifferentTenantUser.getId()); + loginTenantAdmin(); + + UserUpdateMsg userDeleteMsg = UserUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE) + .setIdMSB(savedDifferentTenantUser.getUuidId().getMostSignificantBits()) + .setIdLSB(savedDifferentTenantUser.getUuidId().getLeastSignificantBits()) + .setEntityGroupIdMSB(userGroup.getUuidId().getMostSignificantBits()) + .setEntityGroupIdLSB(userGroup.getUuidId().getLeastSignificantBits()) + .build(); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addUserUpdateMsg(userDeleteMsg)); + + Assert.assertTrue(findGroupEntityIds(userGroup).contains(savedDifferentTenantUser.getId())); + } + + @Test + public void testSendEntityGroupEntitiesRequestForGroupOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + Device device = new Device(); + device.setName("Different Tenant Requested Device"); + device.setType("default"); + Device savedDevice = doPost("/api/device", device, Device.class); + EntityGroup deviceGroup = saveDifferentTenantGroup(EntityType.DEVICE, savedDevice.getId()); + loginTenantAdmin(); + + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addEntityGroupEntitiesRequestMsg(EntityGroupRequestMsg.newBuilder() + .setEntityGroupIdMSB(deviceGroup.getUuidId().getMostSignificantBits()) + .setEntityGroupIdLSB(deviceGroup.getUuidId().getLeastSignificantBits()) + .setType(EntityType.DEVICE.name()) + .build())); + } + + @Test + public void testSendEntityGroupEntitiesRequestForGroupNotAssignedToEdgeToCloud() throws Exception { + EntityGroup entityGroup = new EntityGroup(); + entityGroup.setName("Device Group Not Assigned To Edge"); + entityGroup.setType(EntityType.DEVICE); + entityGroup = doPost("/api/entityGroup", entityGroup, EntityGroup.class); + saveDevice("Device Not Assigned To Edge", "default", entityGroup.getId()); + + EntityGroupId entityGroupId = entityGroup.getId(); + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addEntityGroupEntitiesRequestMsg(EntityGroupRequestMsg.newBuilder() + .setEntityGroupIdMSB(entityGroupId.getId().getMostSignificantBits()) + .setEntityGroupIdLSB(entityGroupId.getId().getLeastSignificantBits()) + .setType(EntityType.DEVICE.name()).build())); + } + + @Test + public void testSendDeviceUpdateWithGroupOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + Device differentTenantDevice = new Device(); + differentTenantDevice.setName("Different Tenant Grouped Device"); + differentTenantDevice.setType("default"); + differentTenantDevice = doPost("/api/device", differentTenantDevice, Device.class); + EntityGroup deviceGroup = saveDifferentTenantGroup(EntityType.DEVICE, differentTenantDevice.getId()); + loginTenantAdmin(); + + Device device = saveDevice("Group Test Device", "default"); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addDeviceUpdateMsg( + EdgeMsgConstructorUtils.constructDeviceUpdatedMsg(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE, device, deviceGroup.getId()))); + + Assert.assertFalse(findGroupEntityIds(deviceGroup).contains(device.getId())); + } + + private EntityGroup saveDifferentTenantGroup(EntityType groupType, EntityId entityId) throws Exception { + EntityGroup entityGroup = new EntityGroup(); + entityGroup.setType(groupType); + entityGroup.setName("Different Tenant " + groupType.name() + " Group"); + entityGroup.setOwnerId(differentTenantId); + EntityGroup savedGroup = doPost("/api/entityGroup", entityGroup, EntityGroup.class); + addEntitiesToEntityGroup(List.of(entityId), savedGroup.getId()); + return savedGroup; + } + + private List findGroupEntityIds(EntityGroup entityGroup) throws Exception { + return entityGroupService.findAllEntityIdsAsync(differentTenantId, entityGroup.getId(), new PageLink(100)).get(); + } + private EntityGroup createUserGroup() { EntityGroup entityGroup = new EntityGroup(); entityGroup.setType(EntityType.USER); diff --git a/application/src/test/java/org/thingsboard/server/edge/EntityViewEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/EntityViewEdgeTest.java index f32b2da333..176481a248 100644 --- a/application/src/test/java/org/thingsboard/server/edge/EntityViewEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/EntityViewEdgeTest.java @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.edge; +import com.datastax.oss.driver.api.core.uuid.Uuids; import com.fasterxml.jackson.core.type.TypeReference; import com.google.protobuf.AbstractMessage; import org.junit.Assert; @@ -25,6 +26,7 @@ import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.Collections; import java.util.List; @@ -304,4 +306,19 @@ public class EntityViewEdgeTest extends AbstractEdgeTest { return entityView; } + @Test + public void testSendEntityViewForEntityOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + EntityView entityView = new EntityView(); + entityView.setId(new EntityViewId(Uuids.timeBased())); + entityView.setTenantId(tenantId); + entityView.setName("Edge Entity View"); + entityView.setType("default"); + entityView.setEntityId(device.getId()); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addEntityViewUpdateMsg( + EdgeMsgConstructorUtils.constructEntityViewUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, entityView, null))); + + doGet("/api/entityView/" + entityView.getUuidId()).andExpect(status().isNotFound()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/RelationEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/RelationEdgeTest.java index 47a805d6c0..7b101b9dbe 100644 --- a/application/src/test/java/org/thingsboard/server/edge/RelationEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/RelationEdgeTest.java @@ -21,9 +21,12 @@ import org.thingsboard.server.gen.edge.v1.RelationRequestMsg; import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.UUID; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @DaoSqlTest public class RelationEdgeTest extends AbstractEdgeTest { @@ -198,4 +201,36 @@ public class RelationEdgeTest extends AbstractEdgeTest { return relation; } + @Test + public void testSendRelationRequestForEntityOfDifferentTenantToCloud() throws Exception { + EntityRelation relation = saveDifferentTenantRelation(); + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addRelationRequestMsg(RelationRequestMsg.newBuilder() + .setEntityType(EntityType.DEVICE.name()) + .setEntityIdMSB(relation.getFrom().getId().getMostSignificantBits()) + .setEntityIdLSB(relation.getFrom().getId().getLeastSignificantBits()).build())); + } + + @Test + public void testSendRelationDeleteForEntitiesOfDifferentTenantToCloud() throws Exception { + EntityRelation relation = saveDifferentTenantRelation(); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addRelationUpdateMsg( + EdgeMsgConstructorUtils.constructRelationUpdatedMsg(UpdateMsgType.ENTITY_DELETED_RPC_MESSAGE, relation))); + + loginDifferentTenant(); + doGet("/api/relation?fromId=" + relation.getFrom().getId() + "&fromType=DEVICE&relationType=test&toId=" + + relation.getTo().getId() + "&toType=ASSET").andExpect(status().isOk()); + } + + private EntityRelation saveDifferentTenantRelation() throws Exception { + Device device = saveDifferentTenantDevice(); + loginDifferentTenant(); + Asset asset = new Asset(); + asset.setName("Different Tenant Asset"); + asset.setType("default"); + asset = doPost("/api/asset", asset, Asset.class); + EntityRelation relation = doPost("/api/v2/relation", new EntityRelation(device.getId(), asset.getId(), "test"), EntityRelation.class); + loginTenantAdmin(); + return relation; + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/ReportTemplateEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/ReportTemplateEdgeTest.java index def2ccb2ea..6532ec9455 100644 --- a/application/src/test/java/org/thingsboard/server/edge/ReportTemplateEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/ReportTemplateEdgeTest.java @@ -244,5 +244,42 @@ public class ReportTemplateEdgeTest extends AbstractEdgeTest { private CustomerId normalizeCustomerId(CustomerId customerId) { return customerId == null || customerId.isNullUid() ? null : customerId; } -} + @Test + public void testReportTemplateWithTenantIdOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + ReportTemplate reportTemplate = createReportTemplate("Edge Report Template With Different Tenant", tenantId); + reportTemplate.setId(new ReportTemplateId(UUID.randomUUID())); + reportTemplate.setTenantId(differentTenantId); + + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(createUplinkMsg(reportTemplate)); + Assert.assertTrue(edgeImitator.waitForResponses()); + + ReportTemplate foundReportTemplate = doGet("/api/reportTemplate/" + reportTemplate.getId().getId(), ReportTemplate.class); + Assert.assertEquals(tenantId, foundReportTemplate.getTenantId()); + } + + @Test + public void testReportTemplateUpdateAndDeleteOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + ReportTemplate reportTemplate = createReportTemplate("Different Tenant Report Template", differentTenantId); + reportTemplate.setTenantId(differentTenantId); + ReportTemplate savedReportTemplate = doPost("/api/reportTemplate", reportTemplate, ReportTemplate.class); + loginTenantAdmin(); + + ReportTemplate reportTemplateUpdate = createReportTemplate("Updated From Edge", tenantId); + reportTemplateUpdate.setId(savedReportTemplate.getId()); + edgeImitator.expectResponsesAmount(2); + edgeImitator.sendUplinkMsg(createUpdateUplinkMsg(reportTemplateUpdate)); + edgeImitator.sendUplinkMsg(createDeleteUplinkMsg(savedReportTemplate)); + Assert.assertTrue(edgeImitator.waitForResponses()); + + loginDifferentTenant(); + ReportTemplate foundReportTemplate = doGet("/api/reportTemplate/" + savedReportTemplate.getUuidId(), ReportTemplate.class); + Assert.assertEquals(savedReportTemplate.getName(), foundReportTemplate.getName()); + Assert.assertEquals(differentTenantId, foundReportTemplate.getTenantId()); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java index 11caa4356b..c940f0693a 100644 --- a/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/ResourceEdgeTest.java @@ -11,11 +11,15 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.TbResource; +import org.thingsboard.server.common.data.TbResourceInfo; +import org.thingsboard.server.common.data.id.TbResourceId; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.Optional; import java.util.UUID; @@ -180,4 +184,17 @@ public class ResourceEdgeTest extends AbstractEdgeTest { Assert.assertEquals(TEST_DATA, tb.getEncodedData()); } + @Test + public void testSendResourceWithSystemTenantIdToCloud() throws Exception { + TbResource resource = createTbResource(); + resource.setId(new TbResourceId(Uuids.timeBased())); + resource.setTenantId(TenantId.SYS_TENANT_ID); + resource.setResourceKey("system_" + FILE_NAME); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addResourceUpdateMsg( + EdgeMsgConstructorUtils.constructResourceUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, resource))); + + TbResourceInfo resourceInfo = doGet("/api/resource/info/" + resource.getUuidId(), TbResourceInfo.class); + Assert.assertEquals(tenantId, resourceInfo.getTenantId()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/RuleChainEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/RuleChainEdgeTest.java index c568561318..1abdafeabb 100644 --- a/application/src/test/java/org/thingsboard/server/edge/RuleChainEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/RuleChainEdgeTest.java @@ -3,6 +3,7 @@ package org.thingsboard.server.edge; import com.datastax.oss.driver.api.core.uuid.Uuids; +import com.fasterxml.jackson.core.type.TypeReference; import org.junit.Assert; import org.junit.Test; import org.thingsboard.common.util.JacksonUtil; @@ -11,16 +12,21 @@ import org.thingsboard.rule.engine.util.TbMsgSource; import org.thingsboard.server.common.data.debug.DebugSettings; import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.id.RuleChainId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.common.data.rule.RuleChainType; import org.thingsboard.server.common.data.rule.RuleNode; import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; +import org.thingsboard.server.gen.edge.v1.RuleChainMetadataRequestMsg; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; +import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; import java.util.ArrayList; import java.util.Collections; @@ -259,4 +265,62 @@ public class RuleChainEdgeTest extends AbstractEdgeTest { Assert.assertTrue(edgeImitator.waitForMessages(5)); } + @Test + public void testSendRuleChainMetadataRequestForRuleChainOfDifferentTenantToCloud() throws Exception { + RuleChainId ruleChainId = getDifferentTenantRootRuleChainId(); + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addRuleChainMetadataRequestMsg(RuleChainMetadataRequestMsg.newBuilder() + .setRuleChainIdMSB(ruleChainId.getId().getMostSignificantBits()) + .setRuleChainIdLSB(ruleChainId.getId().getLeastSignificantBits()).build())); + } + + @Test + public void testSendRuleChainMetadataForRuleChainOfDifferentTenantToCloud() throws Exception { + RuleChainId ruleChainId = getDifferentTenantRootRuleChainId(); + loginDifferentTenant(); + RuleChainMetaData metaData = doGet("/api/ruleChain/" + ruleChainId.getId() + "/metadata", RuleChainMetaData.class); + int nodesCount = metaData.getNodes().size(); + loginTenantAdmin(); + + metaData.setNodes(List.of(metaData.getNodes().get(0))); + metaData.setConnections(null); + metaData.setFirstNodeIndex(0); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addRuleChainMetadataUpdateMsg( + EdgeMsgConstructorUtils.constructRuleChainMetadataUpdatedMsg(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE, metaData, EdgeVersion.V_LATEST))); + + loginDifferentTenant(); + RuleChainMetaData metaDataAfter = doGet("/api/ruleChain/" + ruleChainId.getId() + "/metadata", RuleChainMetaData.class); + Assert.assertEquals(nodesCount, metaDataAfter.getNodes().size()); + } + + @Test + public void testSendRuleChainWithIdOfDifferentTenantToCloud() throws Exception { + RuleChainId ruleChainId = getDifferentTenantRootRuleChainId(); + loginDifferentTenant(); + String ruleChainName = doGet("/api/ruleChain/" + ruleChainId.getId(), RuleChain.class).getName(); + loginTenantAdmin(); + + RuleChain edgeRuleChain = new RuleChain(); + edgeRuleChain.setTenantId(tenantId); + edgeRuleChain.setId(ruleChainId); + edgeRuleChain.setName("Changed Rule Chain"); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addRuleChainUpdateMsg(RuleChainUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE) + .setIdMSB(ruleChainId.getId().getMostSignificantBits()) + .setIdLSB(ruleChainId.getId().getLeastSignificantBits()) + .setEntity(JacksonUtil.toString(edgeRuleChain)) + .build())); + + loginDifferentTenant(); + Assert.assertEquals(ruleChainName, doGet("/api/ruleChain/" + ruleChainId.getId(), RuleChain.class).getName()); + loginTenantAdmin(); + } + + private RuleChainId getDifferentTenantRootRuleChainId() throws Exception { + loginDifferentTenant(); + RuleChain rootRuleChain = doGetTypedWithPageLink("/api/ruleChains?type={type}&", new TypeReference>() {}, + new PageLink(100), RuleChainType.CORE.name()).getData().stream().filter(RuleChain::isRoot).findFirst().orElseThrow(); + loginTenantAdmin(); + return rootRuleChain.getId(); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/SchedulerEventEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/SchedulerEventEdgeTest.java index b09d9a12f9..54621799ec 100644 --- a/application/src/test/java/org/thingsboard/server/edge/SchedulerEventEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/SchedulerEventEdgeTest.java @@ -10,8 +10,15 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.SchedulerEventId; +import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.report.ReportConfig; +import org.thingsboard.server.common.data.report.ReportTemplate; +import org.thingsboard.server.common.data.report.ReportTemplateType; +import org.thingsboard.server.common.data.report.TbReportFormat; +import org.thingsboard.server.common.data.report.configuration.CsvReportTemplateConfig; +import org.thingsboard.server.common.data.report.configuration.components.HeadingComponent; import org.thingsboard.server.common.data.scheduler.MonthlyRepeat; import org.thingsboard.server.common.data.scheduler.SchedulerEvent; import org.thingsboard.server.common.data.scheduler.SchedulerEventInfo; @@ -23,11 +30,14 @@ import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UplinkResponseMsg; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; +import java.util.ArrayList; +import java.util.List; import java.util.Optional; import java.util.UUID; import java.util.concurrent.TimeUnit; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.thingsboard.server.common.data.DataConstants.GENERATE_REPORT; @DaoSqlTest public class SchedulerEventEdgeTest extends AbstractEdgeTest { @@ -287,4 +297,71 @@ public class SchedulerEventEdgeTest extends AbstractEdgeTest { return schedulerEvent; } + @Test + public void testSchedulerEventWithTenantIdOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + SchedulerEvent schedulerEvent = createSchedulerEvent("Edge Scheduler Event With Different Tenant", tenantId); + schedulerEvent.setId(new SchedulerEventId(UUID.randomUUID())); + schedulerEvent.setTenantId(differentTenantId); + + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(createUplinkMsg(schedulerEvent)); + Assert.assertTrue(edgeImitator.waitForResponses()); + + SchedulerEvent foundSchedulerEvent = doGet("/api/schedulerEvent/" + schedulerEvent.getUuidId(), SchedulerEvent.class); + Assert.assertEquals(tenantId, foundSchedulerEvent.getTenantId()); + } + + @Test + public void testGenerateReportSchedulerEventWithUserOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + SchedulerEvent schedulerEvent = createGenerateReportSchedulerEvent(savedDifferentTenantUser.getId()); + + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(createUplinkMsg(schedulerEvent)); + Assert.assertTrue(edgeImitator.waitForResponses()); + + doGet("/api/schedulerEvent/" + schedulerEvent.getUuidId()).andExpect(status().isNotFound()); + } + + @Test + public void testGenerateReportSchedulerEventToCloud() throws Exception { + SchedulerEvent schedulerEvent = createGenerateReportSchedulerEvent(tenantAdminUserId); + + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(createUplinkMsg(schedulerEvent)); + Assert.assertTrue(edgeImitator.waitForResponses()); + + doGet("/api/schedulerEvent/" + schedulerEvent.getUuidId()).andExpect(status().isOk()); + } + + private SchedulerEvent createGenerateReportSchedulerEvent(UserId userId) throws Exception { + ReportTemplate reportTemplate = new ReportTemplate(); + reportTemplate.setTenantId(tenantId); + reportTemplate.setOwnerId(tenantId); + reportTemplate.setName("Scheduler Report Template"); + reportTemplate.setType(ReportTemplateType.REPORT); + reportTemplate.setFormat(TbReportFormat.CSV); + CsvReportTemplateConfig reportTemplateConfig = new CsvReportTemplateConfig(); + reportTemplateConfig.setEntityAliases(new ArrayList<>()); + reportTemplateConfig.setFilters(new ArrayList<>()); + HeadingComponent headingComponent = new HeadingComponent(); + headingComponent.setValue("Heading"); + reportTemplateConfig.setComponents(List.of(headingComponent)); + reportTemplate.setConfiguration(reportTemplateConfig); + ReportTemplate savedReportTemplate = doPost("/api/reportTemplate", reportTemplate, ReportTemplate.class); + + ReportConfig reportConfig = new ReportConfig(); + reportConfig.setReportTemplateId(savedReportTemplate.getId()); + reportConfig.setUserId(userId); + reportConfig.setTimezone("UTC"); + SchedulerEvent schedulerEvent = createSchedulerEvent("Edge Report Scheduler Event", tenantId); + schedulerEvent.setId(new SchedulerEventId(UUID.randomUUID())); + schedulerEvent.setType(GENERATE_REPORT); + schedulerEvent.setConfiguration(JacksonUtil.valueToTree(reportConfig)); + return schedulerEvent; + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/SendEmailEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/SendEmailEdgeTest.java new file mode 100644 index 0000000000..287d12ddbb --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/edge/SendEmailEdgeTest.java @@ -0,0 +1,198 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +package org.thingsboard.server.edge; + +import com.fasterxml.jackson.databind.JsonNode; +import org.junit.Test; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.api.MailService; +import org.thingsboard.rule.engine.api.TbEmail; +import org.thingsboard.server.common.data.ApiFeature; +import org.thingsboard.server.common.data.ApiUsageStateValue; +import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.gen.edge.v1.SendEmailUplinkMsg; +import org.thingsboard.server.service.mail.EdgeMailRequest; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; + +/** + * Verifies the send-email uplink: when the Edge delegates a mail send, the Cloud receives the + * SendEmailUplinkMsg and invokes its MailService (which resolves the config, renders and transmits). Here + * the EdgeImitator plays the Edge and sends the uplink; the Cloud's MailService is mocked so we can assert + * the delegated call arrives with the expected arguments (the Cloud, not the Edge, uses the tenant id of + * the connected edge). + */ +@DaoSqlTest +public class SendEmailEdgeTest extends AbstractEdgeTest { + + @MockitoBean + private MailService mailService; + + @Test + public void testSendBasicEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.SEND_BASIC) + .to("recipient@thingsboard.io") + .subject("Edge test subject") + .message("Edge test body") + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendEmail(eq(tenantId), eq("recipient@thingsboard.io"), eq("Edge test subject"), eq("Edge test body")); + } + + @Test + public void testSendTbEmailFromEdgeProcessedByCloud() throws Exception { + TbEmail tbEmail = TbEmail.builder() + .from("noreply@thingsboard.io") + .to("recipient@thingsboard.io") + .subject("Rule chain email") + .body("Alarm!") + .html(false) + .build(); + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.SEND_TB_EMAIL) + .tbEmail(tbEmail) + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)).send(eq(tenantId), isNull(), any(TbEmail.class)); + } + + @Test + public void testSendActivationEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.ACTIVATION) + .activationLink("http://localhost/activate?token=abc") + .ttlMs(60000L) + .to("recipient@thingsboard.io") + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendActivationEmail(eq(tenantId), eq("http://localhost/activate?token=abc"), eq(60000L), eq("recipient@thingsboard.io")); + } + + @Test + public void testSendAccountActivatedEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.ACCOUNT_ACTIVATED) + .loginLink("http://localhost/login") + .to("recipient@thingsboard.io") + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendAccountActivatedEmail(eq(tenantId), eq("http://localhost/login"), eq("recipient@thingsboard.io")); + } + + @Test + public void testSendResetPasswordEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.RESET_PASSWORD) + .passwordResetLink("http://localhost/reset?token=abc") + .ttlMs(60000L) + .to("recipient@thingsboard.io") + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendResetPasswordEmail(eq(tenantId), eq("http://localhost/reset?token=abc"), eq(60000L), eq("recipient@thingsboard.io")); + } + + @Test + public void testSendPasswordWasResetEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.PASSWORD_WAS_RESET) + .loginLink("http://localhost/login") + .to("recipient@thingsboard.io") + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendPasswordWasResetEmail(eq(tenantId), eq("http://localhost/login"), eq("recipient@thingsboard.io")); + } + + @Test + public void testSendTwoFaVerificationEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.TWO_FA) + .to("recipient@thingsboard.io") + .verificationCode("123456") + .expirationTimeSeconds(120) + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendTwoFaVerificationEmail(eq(tenantId), eq("recipient@thingsboard.io"), eq("123456"), eq(120)); + } + + @Test + public void testSendAccountLockoutEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.ACCOUNT_LOCKOUT) + .lockoutEmail("locked@thingsboard.io") + .to("recipient@thingsboard.io") + .maxFailedLoginAttempts(5) + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendAccountLockoutEmail(eq(tenantId), eq("locked@thingsboard.io"), eq("recipient@thingsboard.io"), eq(5)); + } + + @Test + public void testSendApiUsageStateEmailFromEdgeProcessedByCloud() throws Exception { + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.API_USAGE_STATE) + .apiFeature(ApiFeature.EMAIL) + .stateValue(ApiUsageStateValue.DISABLED) + .to("recipient@thingsboard.io") + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendApiFeatureStateEmail(eq(tenantId), eq(ApiFeature.EMAIL), eq(ApiUsageStateValue.DISABLED), eq("recipient@thingsboard.io"), isNull()); + } + + @Test + public void testSendTestMailFromEdgeProcessedByCloud() throws Exception { + JsonNode testConfig = JacksonUtil.newObjectNode().put("smtpHost", "localhost"); + EdgeMailRequest request = EdgeMailRequest.builder() + .method(EdgeMailRequest.MailMethod.TEST_MAIL) + .testConfig(testConfig) + .to("recipient@thingsboard.io") + .build(); + + sendEmailUplink(request); + + verify(mailService, timeout(30000)) + .sendTestMail(eq(tenantId), any(JsonNode.class), eq("recipient@thingsboard.io")); + } + + private void sendEmailUplink(EdgeMailRequest request) throws Exception { + SendEmailUplinkMsg sendEmailUplinkMsg = SendEmailUplinkMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) + .setRequest(JacksonUtil.toString(request)) + .build(); + sendUplinkMsgAndWaitForResponse(builder -> builder.addSendEmailUplinkMsg(sendEmailUplinkMsg)); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/edge/SendNotificationEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/SendNotificationEdgeTest.java new file mode 100644 index 0000000000..0c5731ccf5 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/edge/SendNotificationEdgeTest.java @@ -0,0 +1,106 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +package org.thingsboard.server.edge; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.api.notification.FirebaseService; +import org.thingsboard.rule.engine.api.notification.SlackService; +import org.thingsboard.server.common.data.notification.NotificationDeliveryMethod; +import org.thingsboard.server.common.data.notification.settings.MobileAppNotificationDeliveryMethodConfig; +import org.thingsboard.server.common.data.notification.settings.NotificationDeliveryMethodConfig; +import org.thingsboard.server.common.data.notification.settings.NotificationSettings; +import org.thingsboard.server.common.data.notification.settings.SlackNotificationDeliveryMethodConfig; +import org.thingsboard.server.dao.notification.NotificationSettingsService; +import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.gen.edge.v1.SendNotificationUplinkMsg; +import org.thingsboard.server.service.notification.EdgeNotificationRequest; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; + +/** + * Verifies the send-notification uplink: when the Edge delegates a Slack or mobile-push notification, the + * Cloud receives the SendNotificationUplinkMsg, resolves the channel credentials from its own notification + * settings and delivers. The EdgeImitator plays the Edge and sends the uplink; the Cloud's SlackService and + * FirebaseService are mocked so we can assert the delegated call arrives with the expected arguments. + */ +@DaoSqlTest +public class SendNotificationEdgeTest extends AbstractEdgeTest { + + @MockitoBean + private SlackService slackService; + + @MockitoBean + private FirebaseService firebaseService; + + @Autowired + private NotificationSettingsService notificationSettingsService; + + private void prepareNotificationSettings() { + SlackNotificationDeliveryMethodConfig slack = new SlackNotificationDeliveryMethodConfig(); + slack.setBotToken("xoxb-edge-test-token"); + MobileAppNotificationDeliveryMethodConfig mobile = new MobileAppNotificationDeliveryMethodConfig(); + mobile.setUseSystemSettings(false); + mobile.setFirebaseServiceAccountCredentials("{\"type\":\"service_account\"}"); + + NotificationSettings settings = new NotificationSettings(); + Map configs = new HashMap<>(); + configs.put(NotificationDeliveryMethod.SLACK, slack); + configs.put(NotificationDeliveryMethod.MOBILE_APP, mobile); + settings.setDeliveryMethodsConfigs(configs); + notificationSettingsService.saveNotificationSettings(tenantId, settings); + } + + @Test + public void testSendSlackNotificationFromEdgeProcessedByCloud() throws Exception { + prepareNotificationSettings(); + EdgeNotificationRequest request = EdgeNotificationRequest.builder() + .method(EdgeNotificationRequest.NotificationMethod.SEND_SLACK) + .conversationId("C0123456789") + .message("Edge Slack notification") + .build(); + + sendNotificationUplink(request); + + verify(slackService, timeout(30000)) + .sendMessage(eq(tenantId), anyString(), eq("C0123456789"), eq("Edge Slack notification"), any()); + } + + @Test + public void testSendMobilePushFromEdgeProcessedByCloud() throws Exception { + prepareNotificationSettings(); + EdgeNotificationRequest request = EdgeNotificationRequest.builder() + .method(EdgeNotificationRequest.NotificationMethod.SEND_MOBILE_PUSH) + .fcmTokens(Set.of("fcm-token-1")) + .subject("Edge subject") + .body("Edge body") + .badge(3) + .build(); + + sendNotificationUplink(request); + + verify(firebaseService, timeout(30000)) + .sendMessage(eq(tenantId), anyString(), eq("fcm-token-1"), eq("Edge subject"), eq("Edge body"), any(), eq(3)); + } + + private void sendNotificationUplink(EdgeNotificationRequest request) throws Exception { + SendNotificationUplinkMsg sendNotificationUplinkMsg = SendNotificationUplinkMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) + .setRequest(JacksonUtil.toString(request)) + .build(); + sendUplinkMsgAndWaitForResponse(builder -> builder.addSendNotificationUplinkMsg(sendNotificationUplinkMsg)); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/edge/SendSmsEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/SendSmsEdgeTest.java new file mode 100644 index 0000000000..e61838c47f --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/edge/SendSmsEdgeTest.java @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +package org.thingsboard.server.edge; + +import org.junit.Test; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.api.SmsService; +import org.thingsboard.server.common.data.sms.config.TestSmsRequest; +import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.gen.edge.v1.SendSmsUplinkMsg; +import org.thingsboard.server.service.sms.EdgeSmsRequest; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; + +/** + * Verifies the send-sms uplink: when the Edge delegates an SMS send, the Cloud receives the + * SendSmsUplinkMsg and invokes its SmsService (which resolves the config and transmits). Here the + * EdgeImitator plays the Edge and sends the uplink; the Cloud's SmsService is mocked so we can assert the + * delegated call arrives with the expected arguments (the Cloud, not the Edge, uses the tenant id of the + * connected edge). + */ +@DaoSqlTest +public class SendSmsEdgeTest extends AbstractEdgeTest { + + @MockitoBean + private SmsService smsService; + + @Test + public void testSendSmsFromEdgeProcessedByCloud() throws Exception { + EdgeSmsRequest request = EdgeSmsRequest.builder() + .method(EdgeSmsRequest.SmsMethod.SEND_SMS) + .numbers(new String[]{"+15551234567"}) + .message("Edge test message") + .build(); + + sendSmsUplink(request); + + verify(smsService, timeout(30000)) + .sendSms(eq(tenantId), isNull(), any(String[].class), eq("Edge test message")); + } + + @Test + public void testSendTestSmsFromEdgeProcessedByCloud() throws Exception { + TestSmsRequest testSmsRequest = new TestSmsRequest(); + testSmsRequest.setNumberTo("+15551234567"); + testSmsRequest.setMessage("Test message"); + EdgeSmsRequest request = EdgeSmsRequest.builder() + .method(EdgeSmsRequest.SmsMethod.SEND_TEST_SMS) + .testSmsRequest(testSmsRequest) + .build(); + + sendSmsUplink(request); + + verify(smsService, timeout(30000)).sendTestSms(eq(tenantId), any(TestSmsRequest.class)); + } + + private void sendSmsUplink(EdgeSmsRequest request) throws Exception { + SendSmsUplinkMsg sendSmsUplinkMsg = SendSmsUplinkMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) + .setRequest(JacksonUtil.toString(request)) + .build(); + sendUplinkMsgAndWaitForResponse(builder -> builder.addSendSmsUplinkMsg(sendSmsUplinkMsg)); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/edge/TelemetryEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/TelemetryEdgeTest.java index e61c92b619..af2522897e 100644 --- a/application/src/test/java/org/thingsboard/server/edge/TelemetryEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/TelemetryEdgeTest.java @@ -305,4 +305,44 @@ public class TelemetryEdgeTest extends AbstractEdgeTest { }); } + @Test + public void testSendTelemetryForDeviceOfDifferentTenantToCloud() throws Exception { + Device device = saveDifferentTenantDevice(); + loginDifferentTenant(); + String attributesUrl = "/api/plugins/telemetry/DEVICE/" + device.getUuidId() + "/attributes/"; + doPost(attributesUrl + DataConstants.SHARED_SCOPE, JacksonUtil.toJsonNode("{\"key1\":\"value1\"}")); + doPost(attributesUrl + DataConstants.SERVER_SCOPE, JacksonUtil.toJsonNode("{\"key2\":\"value2\"}")); + loginTenantAdmin(); + + TransportProtos.PostAttributeMsg attributesMsg = TransportProtos.PostAttributeMsg.newBuilder() + .addKv(TransportProtos.KeyValueProto.newBuilder() + .setKey("key1") + .setType(TransportProtos.KeyValueType.STRING_V) + .setStringV("updatedValue1").build()) + .build(); + EntityDataProto entityData = EntityDataProto.newBuilder() + .setEntityIdMSB(device.getUuidId().getMostSignificantBits()) + .setEntityIdLSB(device.getUuidId().getLeastSignificantBits()) + .setEntityType(device.getId().getEntityType().name()) + .setAttributesUpdatedMsg(attributesMsg) + .setPostAttributeScope(DataConstants.SHARED_SCOPE) + .setAttributeDeleteMsg(AttributeDeleteMsg.newBuilder() + .setScope(DataConstants.SERVER_SCOPE) + .addAttributeNames("key2").build()) + .build(); + sendUplinkMsgAndWaitForResponse(uplinkMsgBuilder -> uplinkMsgBuilder.addEntityData(entityData)); + + loginDifferentTenant(); + String valuesUrl = "/api/plugins/telemetry/DEVICE/" + device.getUuidId() + "/values/attributes/"; + Awaitility.await() + .pollDelay(3, TimeUnit.SECONDS) + .atMost(10, TimeUnit.SECONDS) + .untilAsserted(() -> { + JsonNode sharedAttributes = doGetAsync(valuesUrl + DataConstants.SHARED_SCOPE, JsonNode.class); + Assert.assertEquals("value1", sharedAttributes.get(0).get("value").asText()); + JsonNode serverAttributes = doGetAsync(valuesUrl + DataConstants.SERVER_SCOPE, JsonNode.class); + Assert.assertTrue(serverAttributes.findValuesAsText("key").contains("key2")); + }); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/TenantProfileEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/TenantProfileEdgeTest.java index 5904901d01..94ef371c9c 100644 --- a/application/src/test/java/org/thingsboard/server/edge/TenantProfileEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/TenantProfileEdgeTest.java @@ -14,6 +14,8 @@ import org.thingsboard.server.common.data.queue.ProcessingStrategyType; import org.thingsboard.server.common.data.queue.Queue; import org.thingsboard.server.common.data.queue.SubmitStrategy; import org.thingsboard.server.common.data.queue.SubmitStrategyType; +import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; +import org.thingsboard.server.common.data.tenant.profile.TenantProfileData; import org.thingsboard.server.common.data.tenant.profile.TenantProfileQueueConfiguration; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; @@ -25,6 +27,7 @@ import java.util.List; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @DaoSqlTest public class TenantProfileEdgeTest extends AbstractEdgeTest { @@ -55,6 +58,24 @@ public class TenantProfileEdgeTest extends AbstractEdgeTest { loginTenantAdmin(); } + @Test + public void testTenantProfileOfDifferentTenantNotSentToEdge() throws Exception { + loginSysAdmin(); + TenantProfile otherTenantProfile = new TenantProfile(); + otherTenantProfile.setName("Other Tenant Profile Edge Test"); + otherTenantProfile.setProfileData(new TenantProfileData()); + otherTenantProfile.getProfileData().setConfiguration(new DefaultTenantProfileConfiguration()); + otherTenantProfile = doPost("/api/tenantProfile", otherTenantProfile, TenantProfile.class); + + otherTenantProfile.setDescription("Updated other tenant profile"); + edgeImitator.expectMessageAmount(1); + doPost("/api/tenantProfile", otherTenantProfile, TenantProfile.class); + Assert.assertFalse(edgeImitator.waitForMessages(2)); + + doDelete("/api/tenantProfile/" + otherTenantProfile.getUuidId()).andExpect(status().isOk()); + loginTenantAdmin(); + } + @Test public void testIsolatedTenantProfile() throws Exception { loginSysAdmin(); diff --git a/application/src/test/java/org/thingsboard/server/edge/UserEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/UserEdgeTest.java index c9b792f4e6..629e6f9f15 100644 --- a/application/src/test/java/org/thingsboard/server/edge/UserEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/UserEdgeTest.java @@ -4,6 +4,7 @@ package org.thingsboard.server.edge; import com.fasterxml.jackson.databind.JsonNode; +import com.google.protobuf.AbstractMessage; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -15,16 +16,22 @@ import org.thingsboard.server.common.data.EdgeUtils; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.User; +import org.thingsboard.server.common.data.edge.Edge; +import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.group.EntityGroup; import org.thingsboard.server.common.data.group.EntityGroupInfo; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.EntityGroupId; import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserCredentialsId; import org.thingsboard.server.common.data.id.UserId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.TimePageLink; import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.common.data.security.UserCredentials; import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.dao.user.UserService; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.UplinkMsg; import org.thingsboard.server.gen.edge.v1.UserCredentialsRequestMsg; @@ -41,6 +48,7 @@ import java.util.concurrent.TimeUnit; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.thingsboard.server.dao.user.UserServiceImpl.DEFAULT_TOKEN_LENGTH; +import static org.thingsboard.server.dao.user.UserServiceImpl.USER_PASSWORD_HISTORY; @DaoSqlTest public class UserEdgeTest extends AbstractEdgeTest { @@ -48,6 +56,9 @@ public class UserEdgeTest extends AbstractEdgeTest { @Autowired private BCryptPasswordEncoder passwordEncoder; + @Autowired + private UserService userService; + private static final String DEFAULT_FIRST_NAME = "Boris"; private static final String DEFAULT_LAST_NAME = "Johnson"; private static final String UPDATED_LAST_NAME = "Borisov"; @@ -393,6 +404,88 @@ public class UserEdgeTest extends AbstractEdgeTest { Assert.assertEquals(savedTenantAdmin.getUuidId().getLeastSignificantBits(), userUpdateMsg.getIdLSB()); } + @Test + public void testSendUserWithTokenAuthorityFromEdgeToCloud() throws Exception { + UserId userId = new UserId(UUID.randomUUID()); + User user = buildUser(Authority.REFRESH_TOKEN, null); + user.setId(userId); + + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, user, null)) + .build()); + + Assert.assertNull(userService.findUserById(tenantId, userId)); + } + + @Test + public void testSendUserWithUnsupportedAuthorityFromEdgeToCloud() throws Exception { + UserId userId = new UserId(UUID.randomUUID()); + User sysAdmin = buildUser(Authority.SYS_ADMIN, null); + sysAdmin.setId(userId); + sysAdmin.setTenantId(TenantId.SYS_TENANT_ID); + UserCredentials userCredentials = buildCredentials(new UserCredentialsId(UUID.randomUUID()), userId, true); + userCredentials.setPassword(passwordEncoder.encode("password")); + + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, sysAdmin, null)) + .addUserCredentialsUpdateMsg(EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentials)) + .build()); + + Assert.assertNull(userService.findUserById(TenantId.SYS_TENANT_ID, userId)); + } + + @Test + public void testSendUserWithDifferentTenantIdFromEdgeToCloud() throws Exception { + UserId userId = new UserId(UUID.randomUUID()); + User tenantAdmin = buildUser(Authority.TENANT_ADMIN, null); + tenantAdmin.setId(userId); + tenantAdmin.setTenantId(TenantId.fromUUID(UUID.randomUUID())); + UserCredentials userCredentials = buildCredentials(new UserCredentialsId(UUID.randomUUID()), userId, false); + + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, tenantAdmin, null)) + .addUserCredentialsUpdateMsg(EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentials)) + .build()); + + User userFromCloud = doGet("/api/user/" + userId, User.class); + Assert.assertEquals(tenantId, userFromCloud.getTenantId()); + } + + @Test + public void testSendUserMsgsForUserOfAnotherTenantFromEdgeToCloud() throws Exception { + User sysAdmin = userService.findUserByEmail(TenantId.SYS_TENANT_ID, SYS_ADMIN_EMAIL); + UserCredentials sysAdminCredentials = userService.findUserCredentialsByUserId(TenantId.SYS_TENANT_ID, sysAdmin.getId()); + + // update, credentials update and delete for a user outside of edge's tenant + User tenantAdmin = buildUser(Authority.TENANT_ADMIN, null); + tenantAdmin.setId(sysAdmin.getId()); + UserCredentials userCredentials = buildCredentials(new UserCredentialsId(UUID.randomUUID()), sysAdmin.getId(), true); + userCredentials.setPassword(passwordEncoder.encode("password")); + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserUpdatedMsg(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE, tenantAdmin, null)) + .build()); + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserCredentialsUpdateMsg(EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentials)) + .build()); + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserDeleteMsg(sysAdmin.getId(), null)) + .build()); + + User sysAdminAfter = userService.findUserById(TenantId.SYS_TENANT_ID, sysAdmin.getId()); + Assert.assertNotNull(sysAdminAfter); + Assert.assertEquals(Authority.SYS_ADMIN, sysAdminAfter.getAuthority()); + Assert.assertEquals(TenantId.SYS_TENANT_ID, sysAdminAfter.getTenantId()); + UserCredentials sysAdminCredentialsAfter = userService.findUserCredentialsByUserId(TenantId.SYS_TENANT_ID, sysAdmin.getId()); + Assert.assertEquals(sysAdminCredentials.getId(), sysAdminCredentialsAfter.getId()); + Assert.assertEquals(sysAdminCredentials.getPassword(), sysAdminCredentialsAfter.getPassword()); + } + + private void sendUplinkMsg(UplinkMsg uplinkMsg) throws Exception { + edgeImitator.expectResponsesAmount(1); + edgeImitator.sendUplinkMsg(uplinkMsg); + Assert.assertTrue(edgeImitator.waitForResponses()); + } + private UplinkMsg buildUserUplinkMsg(UserId userId, CustomerId customerId, UserCredentialsId userCredentialsUuid, EntityGroupId entityGroupId) { User customerUser = buildUser(Authority.CUSTOMER_USER, customerId); customerUser.setId(userId); @@ -400,7 +493,8 @@ public class UserEdgeTest extends AbstractEdgeTest { userCredentials.setActivateToken(StringUtils.randomAlphanumeric(DEFAULT_TOKEN_LENGTH)); UserUpdateMsg userUpdateMsg = EdgeMsgConstructorUtils.constructUserUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, customerUser, entityGroupId); - UserCredentialsUpdateMsg userCredentialsMsg = EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentials); + // built directly, because constructUserCredentialsUpdatedMsg drops activation tokens + UserCredentialsUpdateMsg userCredentialsMsg = UserCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(userCredentials)).build(); return UplinkMsg.newBuilder() .addUserUpdateMsg(userUpdateMsg) @@ -464,4 +558,124 @@ public class UserEdgeTest extends AbstractEdgeTest { return opt.get(); } + @Test + public void testSendUserCredentialsRequestForUserOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + UUID userUuid = savedDifferentTenantUser.getUuidId(); + loginTenantAdmin(); + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addUserCredentialsRequestMsg(UserCredentialsRequestMsg.newBuilder() + .setUserIdMSB(userUuid.getMostSignificantBits()) + .setUserIdLSB(userUuid.getLeastSignificantBits()).build())); + } + + @Test + public void testUserActivationInDifferentTenant() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + verifyNoEdgeEvents(savedDifferentTenantUser.getId()); + } + + @Test + public void testSysAdminCredentialsUpdate() throws Exception { + loginSysAdmin(); + UserId sysAdminId = doGet("/api/auth/user", User.class).getId(); + resetTokens(); + doPost("/api/noauth/resetPasswordByEmail", JacksonUtil.newObjectNode().put("email", SYS_ADMIN_EMAIL)) + .andExpect(status().isOk()); + loginTenantAdmin(); + verifyNoEdgeEvents(sysAdminId); + } + + @Test + public void testTenantUserCredentialsUpdate() throws Exception { + resetTokens(); + edgeImitator.expectMessageAmount(1); + doPost("/api/noauth/resetPasswordByEmail", JacksonUtil.newObjectNode().put("email", TENANT_ADMIN_EMAIL)) + .andExpect(status().isOk()); + Assert.assertTrue(edgeImitator.waitForMessages()); + AbstractMessage latestMessage = edgeImitator.getLatestMessage(); + Assert.assertTrue(latestMessage instanceof UserCredentialsUpdateMsg); + UserCredentials userCredentials = JacksonUtil.fromString(((UserCredentialsUpdateMsg) latestMessage).getEntity(), UserCredentials.class, true); + Assert.assertNotNull(userCredentials); + Assert.assertEquals(tenantAdminUserId, userCredentials.getUserId()); + loginTenantAdmin(); + } + + private void verifyNoEdgeEvents(UserId userId) { + Awaitility.await() + .pollDelay(2, TimeUnit.SECONDS) + .atMost(5, TimeUnit.SECONDS) + .untilAsserted(() -> { + PageData edgeEvents = edgeEventService.findEdgeEvents(tenantId, edge.getId(), 0L, Long.MAX_VALUE, new TimePageLink(1000)); + Assert.assertTrue(edgeEvents.getData().stream().noneMatch(edgeEvent -> userId.getId().equals(edgeEvent.getEntityId()))); + }); + } + + @Test + public void testSendUserCredentialsWithIdOfDifferentTenantUserToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + UserCredentials differentTenantCredentials = userService.findUserCredentialsByUserId(differentTenantId, savedDifferentTenantUser.getId()); + UserCredentials userCredentials = buildCredentials(differentTenantCredentials.getId(), tenantAdminUserId, true); + userCredentials.setPassword(passwordEncoder.encode("password")); + + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserCredentialsUpdateMsg(EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentials)) + .build()); + + UserCredentials differentTenantCredentialsAfter = userService.findUserCredentialsByUserId(differentTenantId, savedDifferentTenantUser.getId()); + Assert.assertNotNull(differentTenantCredentialsAfter); + Assert.assertEquals(differentTenantCredentials.getPassword(), differentTenantCredentialsAfter.getPassword()); + } + + @Test + public void testSendUserCredentialsWithTokensAndLoginStateFromEdgeToCloud() throws Exception { + User user = buildUser(Authority.TENANT_ADMIN, null); + user.setEmail("edgeCredentialsUser@thingsboard.org"); + User savedUser = doPost("/api/user?sendActivationMail=false", user, User.class); + UserCredentials cloudCredentials = userService.findUserCredentialsByUserId(tenantId, savedUser.getId()); + cloudCredentials.setResetToken("cloudResetToken"); + cloudCredentials.setResetTokenExpTime(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1)); + cloudCredentials.setFailedLoginAttempts(3); + userService.saveUserCredentials(tenantId, cloudCredentials, false); + + UserCredentials edgeCredentials = buildCredentials(cloudCredentials.getId(), savedUser.getId(), true); + String edgePassword = passwordEncoder.encode("edgePassword"); + edgeCredentials.setPassword(edgePassword); + edgeCredentials.setActivateToken("edgeActivateToken"); + edgeCredentials.setResetToken("edgeResetToken"); + edgeCredentials.setResetTokenExpTime(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1)); + edgeCredentials.setFailedLoginAttempts(0); + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserCredentialsUpdateMsg(UserCredentialsUpdateMsg.newBuilder().setEntity(JacksonUtil.toString(edgeCredentials)).build()) + .build()); + + UserCredentials cloudCredentialsAfter = userService.findUserCredentialsByUserId(tenantId, savedUser.getId()); + Assert.assertEquals(edgePassword, cloudCredentialsAfter.getPassword()); + Assert.assertTrue(cloudCredentialsAfter.isEnabled()); + Assert.assertNull(cloudCredentialsAfter.getActivateToken()); + Assert.assertEquals("cloudResetToken", cloudCredentialsAfter.getResetToken()); + Assert.assertEquals(Integer.valueOf(3), cloudCredentialsAfter.getFailedLoginAttempts()); + Assert.assertTrue(cloudCredentialsAfter.getAdditionalInfo().get(USER_PASSWORD_HISTORY).toString().contains(edgePassword)); + } + + @Test + public void testSendUserWithEmailOfDifferentTenantUserFromEdgeToCloud() throws Exception { + loginDifferentTenant(); + loginTenantAdmin(); + UserId userId = new UserId(UUID.randomUUID()); + User user = buildUser(Authority.TENANT_ADMIN, null); + user.setId(userId); + user.setEmail(savedDifferentTenantUser.getEmail()); + + sendUplinkMsg(UplinkMsg.newBuilder() + .addUserUpdateMsg(EdgeMsgConstructorUtils.constructUserUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, user, null)) + .build()); + + User savedUser = userService.findUserById(tenantId, userId); + Assert.assertNotNull(savedUser); + Assert.assertEquals(tenantId, savedUser.getTenantId()); + Assert.assertNotEquals(savedDifferentTenantUser.getEmail(), savedUser.getEmail()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/edge/WidgetEdgeTest.java b/application/src/test/java/org/thingsboard/server/edge/WidgetEdgeTest.java index b648400f4d..52423fca3b 100644 --- a/application/src/test/java/org/thingsboard/server/edge/WidgetEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/WidgetEdgeTest.java @@ -11,9 +11,12 @@ import org.thingsboard.server.common.data.widget.WidgetType; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.gen.edge.v1.WidgetBundleTypesRequestMsg; import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; +import java.util.List; + import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @DaoSqlTest @@ -108,4 +111,25 @@ public class WidgetEdgeTest extends AbstractEdgeTest { Assert.assertEquals(savedWidgetsBundle.getUuidId().getLeastSignificantBits(), widgetsBundleUpdateMsg.getIdLSB()); } + @Test + public void testSendWidgetBundleTypesRequestForBundleOfDifferentTenantToCloud() throws Exception { + loginDifferentTenant(); + WidgetsBundle widgetsBundle = new WidgetsBundle(); + widgetsBundle.setTitle("Different Tenant Widget Bundle"); + WidgetsBundle savedWidgetsBundle = doPost("/api/widgetsBundle", widgetsBundle, WidgetsBundle.class); + WidgetType widgetType = new WidgetType(); + widgetType.setName("Different Tenant Widget Type"); + widgetType.setDescriptor(JacksonUtil.newObjectNode().put("key", "value")); + widgetType.setFqn("different_tenant_bundle.type_alias"); + doPost("/api/widgetType", widgetType, WidgetType.class); + doPost("/api/widgetsBundle/" + savedWidgetsBundle.getUuidId() + "/widgetTypeFqns", List.of(widgetType.getFqn())) + .andExpect(status().isOk()); + loginTenantAdmin(); + + sendUplinkMsgAndVerifyNoDownlink(uplinkMsgBuilder -> uplinkMsgBuilder.addWidgetBundleTypesRequestMsg(WidgetBundleTypesRequestMsg.newBuilder() + .setWidgetBundleIdMSB(savedWidgetsBundle.getUuidId().getMostSignificantBits()) + .setWidgetBundleIdLSB(savedWidgetsBundle.getUuidId().getLeastSignificantBits()) + .build())); + } + } diff --git a/application/src/test/java/org/thingsboard/server/service/ai/DefaultTbAiServiceTest.java b/application/src/test/java/org/thingsboard/server/service/ai/DefaultTbAiServiceTest.java index f1bc2bf74c..4f48e5c6c2 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/DefaultTbAiServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/DefaultTbAiServiceTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.MethodSource; import org.mockito.ArgumentCaptor; import org.mockito.Mock; @@ -33,18 +34,21 @@ import org.thingsboard.server.service.ai.transport.TbAiChannelRejectedException; import org.thingsboard.server.service.ai.transport.TbAiChannelUnavailableException; import org.thingsboard.server.service.ai.transport.TbAiOperation; import org.thingsboard.server.service.ai.transport.TbAiOperations; +import org.thingsboard.server.service.ai.transport.TbAiTurnLink; import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.security.model.SecurityUser; import reactor.core.Disposable; import reactor.core.publisher.Flux; import reactor.core.publisher.Sinks; +import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; @@ -165,6 +169,22 @@ class DefaultTbAiServiceTest { then(apiUsageReportClient).shouldHaveNoInteractions(); } + @ParameterizedTest + @CsvSource({"400, BAD_REQUEST_PARAMS", "413, BAD_REQUEST_PARAMS", "403, GENERAL", "404, ITEM_NOT_FOUND", + "409, VERSION_CONFLICT", "429, TOO_MANY_REQUESTS", "401, GENERAL", "500, GENERAL", "0, GENERAL"}) + void shouldKeepTheStatusOfTheAiService_whenProcessAndResponseIsFailure(int status, ThingsboardErrorCode errorCode) { + // GIVEN + given(apiUsageStateService.getApiUsageState(tenantId)).willReturn(enabledApiUsageState()); + given(call.apply(any())).willReturn(TbAiResponse.builder().success(false).status(status).error("The file is not UTF-8 text: notes.txt").build()); + + // WHEN + Throwable thrown = catchThrowable(() -> service.process(call, user, true)); + + // THEN + assertThat(thrown).isInstanceOf(ThingsboardRuntimeException.class).hasMessage("The file is not UTF-8 text: notes.txt"); + assertThat(((ThingsboardRuntimeException) thrown).getErrorCode()).isEqualTo(errorCode); + } + @Test void shouldReportCreditsThenThrowGeneral_whenProcessAndResponseIsFailure() { // GIVEN @@ -493,6 +513,54 @@ class DefaultTbAiServiceTest { new TbAiSettings(enabled, sseInactivityTimeoutSeconds, sseLogMaxDataLength), operations); } + @Test + void shouldTellTheTurnTheBrowserLeft_andStillReportCredits_whenClientCancelsMidStream() { + // GIVEN + given(apiUsageStateService.getApiUsageState(tenantId)).willReturn(enabledApiUsageState()); + upstream = Sinks.many().unicast().onBackpressureBuffer(); + AtomicBoolean left = new AtomicBoolean(); + TbAiTurnLink link = new TbAiTurnLink(); + link.onClientLeft(() -> left.set(true)); + Disposable client = service.processStream(chatId, tokenProvider -> upstream.asFlux(), user, link, true).subscribe(); + upstream.tryEmitNext(assistantMessage("hello")); + + // WHEN + client.dispose(); + upstream.tryEmitNext(creditsUsedEvent(150)); + upstream.tryEmitComplete(); + + // THEN + assertThat(left).isTrue(); + then(apiUsageReportClient).should().report(tenantId, customerId, ApiUsageRecordKey.AI_CREDITS_COUNT, 150L); + } + + @Test + void shouldNotTellTheTurnTheBrowserLeft_whenTheStreamEnds() { + // GIVEN + given(apiUsageStateService.getApiUsageState(tenantId)).willReturn(enabledApiUsageState()); + AtomicBoolean left = new AtomicBoolean(); + TbAiTurnLink link = new TbAiTurnLink(); + link.onClientLeft(() -> left.set(true)); + + // WHEN + service.processStream(chatId, tokenProvider -> Flux.just(assistantMessage("hello")), user, link, true) + .collectList().block(Duration.ofSeconds(5)); + + // THEN + assertThat(left).isFalse(); + } + + @Test + void shouldFollowTheTurnWithoutLookingAtCredits_whenCreditsAreNotChecked() { + // WHEN + List> events = service.processStream(chatId, tokenProvider -> Flux.just(assistantMessage("hello")), user, + new TbAiTurnLink(), false).collectList().block(Duration.ofSeconds(5)); + + // THEN + assertThat(events).extracting(ServerSentEvent::event).containsExactly("assistantMessage"); + then(apiUsageStateService).shouldHaveNoInteractions(); + } + private SecurityUser newUser(TenantId tenant) { SecurityUser u = new SecurityUser(); u.setId(userId); diff --git a/application/src/test/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProviderTest.java b/application/src/test/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProviderTest.java index c1d7c08a2a..3175d5ea05 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProviderTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/OnPremiseTbAiTokenProviderTest.java @@ -16,7 +16,6 @@ import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.dao.subscription.SubscriptionService; import org.thingsboard.server.exception.ThingsboardRuntimeException; -import org.thingsboard.server.service.install.ProjectInfo; import org.thingsboard.server.service.security.model.SecurityUser; import java.util.Map; @@ -30,12 +29,9 @@ import static org.mockito.BDDMockito.given; class OnPremiseTbAiTokenProviderTest { private final String aiToken = "on-premise-ai-token"; - private final String tbVersion = "4.3.0-AI-TEST"; @Mock SubscriptionService subscriptionService; - @Mock - ProjectInfo projectInfo; UUID userId; TenantId tenantId; @@ -48,7 +44,7 @@ class OnPremiseTbAiTokenProviderTest { userId = UUID.randomUUID(); tenantId = TenantId.fromUUID(UUID.randomUUID()); user = user(userId, tenantId); - provider = new OnPremiseTbAiTokenProvider(subscriptionService, projectInfo); + provider = new OnPremiseTbAiTokenProvider(subscriptionService); } // --------------------------------------------------------------------------------------------- @@ -89,9 +85,6 @@ class OnPremiseTbAiTokenProviderTest { @Test void shouldBuildHeadersWithoutOrigin_whenCalledForUser() { - // GIVEN - given(projectInfo.getProjectVersion()).willReturn(tbVersion); - // WHEN Map additionalInfo = provider.getAdditionalInfo(user); @@ -149,9 +142,6 @@ class OnPremiseTbAiTokenProviderTest { @Test void shouldBuildHeadersWithoutOrigin_whenCalledWithRawIds() { - // GIVEN - given(projectInfo.getProjectVersion()).willReturn(tbVersion); - // WHEN Map additionalInfo = provider.getAdditionalInfo(tenantId, new UserId(userId)); @@ -166,8 +156,7 @@ class OnPremiseTbAiTokenProviderTest { private Map expectedHeaders() { return Map.of( TbAiHeaders.USER_ID, userId.toString(), - TbAiHeaders.TENANT_ID, tenantId.getId().toString(), - TbAiHeaders.TB_VERSION, tbVersion + TbAiHeaders.TENANT_ID, tenantId.getId().toString() ); } diff --git a/application/src/test/java/org/thingsboard/server/service/ai/chat/DefaultAiChatServiceTest.java b/application/src/test/java/org/thingsboard/server/service/ai/chat/DefaultAiChatServiceTest.java index 5f3dcc12cf..a5606a95bf 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/chat/DefaultAiChatServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/chat/DefaultAiChatServiceTest.java @@ -20,6 +20,7 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.service.ai.TbAiService; import org.thingsboard.server.service.ai.transport.TbAiTransport; import org.thingsboard.server.service.ai.transport.TbAiTurnContext; +import org.thingsboard.server.service.ai.transport.TbAiTurnLink; import org.thingsboard.server.service.ai.transport.TbAiOperation; import org.thingsboard.server.service.ai.transport.TbAiOperations; import org.thingsboard.server.service.security.model.SecurityUser; @@ -133,7 +134,8 @@ class DefaultAiChatServiceTest { assertThat(captureProcessCall().apply(tokenProvider)).isSameAs(tbAiResponse); then(operations).should().execute(argThat(operation -> ChannelProtocol.CHAT_MESSAGES.equals(operation.type()) - && Objects.equals(new ChatOperationRequest(chatId, null), operation.payload())), same(user), same(tokenProvider)); + && Objects.equals(new ChatOperationRequest(chatId, JacksonUtil.newObjectNode().put("toolCards", true)), operation.payload())), + same(user), same(tokenProvider)); then(tbAiService).shouldHaveNoMoreInteractions(); } @@ -164,10 +166,10 @@ class DefaultAiChatServiceTest { .event("assistantMessage") .data("{\"message\":\"ok\"}") .build()); - given(tbAiService.processStream(eq(chatId), any(), same(user))).willReturn(expectedStream); + given(tbAiService.processStream(eq(chatId), any(), same(user), any(TbAiTurnLink.class), eq(true))).willReturn(expectedStream); var clientOrigin = "https://tb.example.com"; var expectedContext = new TbAiTurnContext(user, tbAccessToken, acceptLanguage, tokenProvider, clientOrigin); - given(tbAiTransport.sendChatMessage(eq(chatId), same(request), eq(expectedContext))).willReturn(expectedStream); + given(tbAiTransport.sendChatMessage(eq(chatId), same(request), eq(expectedContext), any(TbAiTurnLink.class))).willReturn(expectedStream); // WHEN Flux> result = service.sendChatMessage(chatId, request, tbAccessToken, acceptLanguage, clientOrigin, user); @@ -175,8 +177,35 @@ class DefaultAiChatServiceTest { // THEN assertThat(result).isSameAs(expectedStream); - assertThat(captureProcessStreamCall(chatId).apply(tokenProvider)).isSameAs(expectedStream); - then(tbAiTransport).should().sendChatMessage(eq(chatId), same(request), eq(expectedContext)); + ProcessStreamCall call = captureProcessStreamCall(chatId, true); + assertThat(call.action().apply(tokenProvider)).isSameAs(expectedStream); + then(tbAiTransport).should().sendChatMessage(eq(chatId), same(request), eq(expectedContext), same(call.link())); + then(tbAiTransport).shouldHaveNoMoreInteractions(); + then(tbAiService).shouldHaveNoMoreInteractions(); + } + + @Test + void shouldFollowTheRunningTurnWithoutCreditCheck_whenResumeChatCalled() { + // GIVEN + UUID chatId = UUID.randomUUID(); + Flux> expectedStream = Flux.just(ServerSentEvent.builder() + .event("turnResumed") + .data("{}") + .build()); + given(tbAiService.processStream(eq(chatId), any(), same(user), any(TbAiTurnLink.class), eq(false))).willReturn(expectedStream); + var clientOrigin = "https://tb.example.com"; + var expectedContext = new TbAiTurnContext(user, "tb-access-token", "en-US", tokenProvider, clientOrigin); + given(tbAiTransport.resumeChat(eq(chatId), eq(expectedContext), any(TbAiTurnLink.class))).willReturn(expectedStream); + + // WHEN + Flux> result = service.resumeChat(chatId, "tb-access-token", "en-US", clientOrigin, user); + + // THEN + assertThat(result).isSameAs(expectedStream); + + ProcessStreamCall call = captureProcessStreamCall(chatId, false); + assertThat(call.action().apply(tokenProvider)).isSameAs(expectedStream); + then(tbAiTransport).should().resumeChat(eq(chatId), eq(expectedContext), same(call.link())); then(tbAiTransport).shouldHaveNoMoreInteractions(); then(tbAiService).shouldHaveNoMoreInteractions(); } @@ -188,11 +217,14 @@ class DefaultAiChatServiceTest { return callCaptor.getValue(); } + private record ProcessStreamCall(TbAiService.TbAiCall>> action, TbAiTurnLink link) {} + @SuppressWarnings({"rawtypes", "unchecked"}) - private TbAiService.TbAiCall>> captureProcessStreamCall(UUID chatId) { + private ProcessStreamCall captureProcessStreamCall(UUID chatId, boolean checkCredits) { ArgumentCaptor callCaptor = ArgumentCaptor.forClass(TbAiService.TbAiCall.class); - then(tbAiService).should().processStream(eq(chatId), callCaptor.capture(), same(user)); - return callCaptor.getValue(); + ArgumentCaptor linkCaptor = ArgumentCaptor.forClass(TbAiTurnLink.class); + then(tbAiService).should().processStream(eq(chatId), callCaptor.capture(), same(user), linkCaptor.capture(), eq(checkCredits)); + return new ProcessStreamCall(callCaptor.getValue(), linkCaptor.getValue()); } private static ObjectNode createChatRequest(String title) { diff --git a/application/src/test/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionServiceTest.java b/application/src/test/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionServiceTest.java index d67d93c204..723dc0131e 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/solution/DefaultAiSolutionServiceTest.java @@ -22,6 +22,8 @@ import org.thingsboard.ai.common.channel.SolutionStepRequest; import org.thingsboard.ai.common.client.TbAiClient; import org.thingsboard.ai.common.data.solution.SolutionStep; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; +import org.thingsboard.server.exception.ThingsboardRuntimeException; import org.thingsboard.server.service.ai.TbAiService; import org.thingsboard.server.service.ai.transport.TbAiOperation; import org.thingsboard.server.service.ai.transport.TbAiOperations; @@ -29,10 +31,12 @@ import org.thingsboard.server.service.ai.transport.TbAiTurnContext; import org.thingsboard.server.service.security.model.SecurityUser; +import java.util.List; import java.util.Objects; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; @@ -121,6 +125,17 @@ class DefaultAiSolutionServiceTest { then(tbAiService).shouldHaveNoMoreInteractions(); } + @Test + void shouldRejectWithoutCallingTheAiService_whenAMessageHasNeitherTextNorFiles() { + // WHEN + Throwable thrown = catchThrowable(() -> service.chat(UUID.randomUUID(), SolutionStep.INITIAL_CONFIGURATION, null, List.of(), user)); + + // THEN + assertThat(thrown).isInstanceOf(ThingsboardRuntimeException.class).hasMessage("Message cannot be blank"); + assertThat(((ThingsboardRuntimeException) thrown).getErrorCode()).isEqualTo(ThingsboardErrorCode.BAD_REQUEST_PARAMS); + then(tbAiService).shouldHaveNoInteractions(); + } + @ParameterizedTest @EnumSource(SolutionStep.class) void shouldProcessWithCreditCheckAndDelegateToClient_whenChatCalled(SolutionStep step) { @@ -131,7 +146,7 @@ class DefaultAiSolutionServiceTest { given(tbAiService.process(any(), same(user))).willReturn(expectedResponse); // WHEN - JsonNode result = service.chat(solutionId, step, message, user); + JsonNode result = service.chat(solutionId, step, message, List.of(), user); // THEN assertThat(result).isSameAs(expectedResponse); diff --git a/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperationsTest.java b/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperationsTest.java index afeeca5223..c5771a6b26 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperationsTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiOperationsTest.java @@ -224,6 +224,7 @@ class ChannelTbAiOperationsTest { // THEN assertThat(response.isSuccess()).isFalse(); + assertThat(response.getStatus()).isEqualTo(404); assertThat(response.getError()).isEqualTo("Solution not found"); } @@ -247,7 +248,7 @@ class ChannelTbAiOperationsTest { void shouldSendCallOrigin_whenChannelWasOpenedWithAnother() { // GIVEN server = FakeTbAiServer.start((connection, frame) -> connection.result(frame, new OperationResult(200, null, 0))); - TbAiChannelPool sharedPool = new TbAiChannelPool(server.client(), 10, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), System::nanoTime, false); + TbAiChannelPool sharedPool = new TbAiChannelPool(server.client(), "4.4.0", 10, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), System::nanoTime, false); SecurityUser user = TbAiChannelPoolTest.user(); var channelOperations = new ChannelTbAiOperations(sharedPool, requestExecutor); @@ -294,7 +295,7 @@ class ChannelTbAiOperationsTest { ChannelTbAiOperations operations() { if (pool == null) { - pool = new TbAiChannelPool(server.client(), maxConnections, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), System::nanoTime, false); + pool = new TbAiChannelPool(server.client(), "4.4.0", maxConnections, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), System::nanoTime, false); } return new ChannelTbAiOperations(pool, requestExecutor); } diff --git a/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransportTest.java b/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransportTest.java index 8a2c16db71..a7095f83e3 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransportTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/transport/ChannelTbAiTransportTest.java @@ -118,7 +118,7 @@ class ChannelTbAiTransportTest { AtomicBoolean heartbeat = new AtomicBoolean(); // WHEN - Disposable subscription = transport.sendChatMessage(UUID.randomUUID(), request, context).subscribe(event -> heartbeat.set(true)); + Disposable subscription = transport.sendChatMessage(UUID.randomUUID(), request, context, null).subscribe(event -> heartbeat.set(true)); await().atMost(Duration.ofSeconds(5)).untilTrue(heartbeat); subscription.dispose(); @@ -129,6 +129,97 @@ class ChannelTbAiTransportTest { assertThat(server.openConnections.get()).isEqualTo(1); } + @Test + void shouldDetachButKeepListening_whenBrowserLeavesAndServerCanResumeTurns() { + // GIVEN + server = FakeTbAiServer.start(List.of(ChannelProtocol.TURN_RESUME_CAPABILITY), (connection, frame) -> { + if (ChannelProtocol.CHAT_SEND.equals(frame.type())) { + connection.sendFor(frame, ChannelProtocol.CHAT_EVENT, new ChatEventPayload("heartbeat", null)); + } + }); + pool = pool(); + var transport = new ChannelTbAiTransport(pool, requestExecutor); + var link = new TbAiTurnLink(); + AtomicBoolean heartbeat = new AtomicBoolean(); + transport.sendChatMessage(UUID.randomUUID(), request, context, link).subscribe(event -> heartbeat.set(true)); + await().atMost(Duration.ofSeconds(5)).untilTrue(heartbeat); + + // WHEN + link.clientLeft(); + + // THEN + await().atMost(Duration.ofSeconds(5)).until(() -> !server.received(ChannelProtocol.CHAT_DETACH).isEmpty()); + assertThat(server.received(ChannelProtocol.CHAT_DETACH).getFirst().op()) + .isEqualTo(server.received(ChannelProtocol.CHAT_SEND).getFirst().id()); + assertThat(server.received(ChannelProtocol.CANCEL)).isEmpty(); + } + + @Test + void shouldNotSendDetach_whenServerCannotResumeTurns() { + // GIVEN + server = FakeTbAiServer.start((connection, frame) -> { + if (ChannelProtocol.CHAT_SEND.equals(frame.type())) { + connection.sendFor(frame, ChannelProtocol.CHAT_EVENT, new ChatEventPayload("heartbeat", null)); + } + }); + pool = pool(); + var transport = new ChannelTbAiTransport(pool, requestExecutor); + var link = new TbAiTurnLink(); + AtomicBoolean heartbeat = new AtomicBoolean(); + transport.sendChatMessage(UUID.randomUUID(), request, context, link).subscribe(event -> heartbeat.set(true)); + await().atMost(Duration.ofSeconds(5)).untilTrue(heartbeat); + + // WHEN + link.clientLeft(); + transport.sendChatMessage(UUID.randomUUID(), request, context, null).subscribe(); + + // THEN + await().atMost(Duration.ofSeconds(5)).until(() -> server.received(ChannelProtocol.CHAT_SEND).size() == 2); + assertThat(server.received(ChannelProtocol.CHAT_DETACH)).isEmpty(); + assertThat(server.openConnections.get()).isEqualTo(1); + } + + @Test + void shouldRelayTheResumedTurn_whenServerCanResumeTurns() { + // GIVEN + UUID chatId = UUID.randomUUID(); + server = FakeTbAiServer.start(List.of(ChannelProtocol.TURN_RESUME_CAPABILITY), (connection, frame) -> { + if (ChannelProtocol.CHAT_RESUME.equals(frame.type())) { + connection.sendFor(frame, ChannelProtocol.CHAT_EVENT, new ChatEventPayload("turnResumed", JacksonUtil.newObjectNode())); + connection.sendFor(frame, ChannelProtocol.CHAT_EVENT, new ChatEventPayload("assistantMessage", + JacksonUtil.newObjectNode().put("message", "Done."))); + connection.sendFor(frame, ChannelProtocol.TURN_END, new TurnEnd(TurnEnd.Status.COMPLETED)); + } + }); + pool = pool(); + + // WHEN + List> events = new ChannelTbAiTransport(pool, requestExecutor) + .resumeChat(chatId, context, new TbAiTurnLink()) + .collectList().block(Duration.ofSeconds(10)); + + // THEN + assertThat(events).extracting(ServerSentEvent::event).containsExactly("turnResumed", "assistantMessage"); + ChatTurnRequest resume = server.codec.fromPayload(server.received(ChannelProtocol.CHAT_RESUME).getFirst().payload(), ChatTurnRequest.class); + assertThat(resume).isEqualTo(new ChatTurnRequest(chatId, null, context.acceptLanguage())); + } + + @Test + void shouldEndAtOnceWithoutAsking_whenServerCannotResumeTurns() { + // GIVEN + server = FakeTbAiServer.start((connection, frame) -> {}); + pool = pool(); + + // WHEN + List> events = new ChannelTbAiTransport(pool, requestExecutor) + .resumeChat(UUID.randomUUID(), context, new TbAiTurnLink()) + .collectList().block(Duration.ofSeconds(10)); + + // THEN + assertThat(events).isEmpty(); + assertThat(server.received(ChannelProtocol.CHAT_RESUME)).isEmpty(); + } + @Test void shouldSignalChannelUnavailable_whenServerHasNoChannelEndpoint() { // GIVEN @@ -159,13 +250,13 @@ class ChannelTbAiTransportTest { TbAiTurnContext turnContext = new TbAiTurnContext(context.tenantId(), context.userId(), context.user(), "Bearer user-jwt", "de-DE", context.tokenProvider(), "https://tb.example.com"); return new ChannelTbAiTransport(pool, requestExecutor) - .sendChatMessage(UUID.randomUUID(), request, turnContext) + .sendChatMessage(UUID.randomUUID(), request, turnContext, null) .collectList() .block(Duration.ofSeconds(10)); } TbAiChannelPool pool() { - return new TbAiChannelPool(server.client(), 10, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), System::nanoTime, false); + return new TbAiChannelPool(server.client(), "4.4.0", 10, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), System::nanoTime, false); } void stubExecutor() { diff --git a/application/src/test/java/org/thingsboard/server/service/ai/transport/FakeTbAiServer.java b/application/src/test/java/org/thingsboard/server/service/ai/transport/FakeTbAiServer.java index 3a7224e30d..1320677f5b 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/transport/FakeTbAiServer.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/transport/FakeTbAiServer.java @@ -3,6 +3,7 @@ package org.thingsboard.server.service.ai.transport; import com.fasterxml.jackson.databind.ObjectMapper; +import io.netty.handler.codec.http.HttpHeaders; import org.thingsboard.ai.common.channel.ChannelError; import org.thingsboard.ai.common.channel.ChannelFrame; import org.thingsboard.ai.common.channel.ChannelFrameCodec; @@ -36,12 +37,14 @@ class FakeTbAiServer implements AutoCloseable { final List received = new CopyOnWriteArrayList<>(); final AtomicInteger connections = new AtomicInteger(); final AtomicInteger openConnections = new AtomicInteger(); + final List handshakeHeaders = new CopyOnWriteArrayList<>(); private final DisposableServer server; - private FakeTbAiServer(Script script) { + private FakeTbAiServer(List capabilities, Script script) { server = HttpServer.create().host("127.0.0.1").port(0) .route(routes -> routes.ws(ChannelProtocol.WS_PATH, (inbound, outbound) -> { connections.incrementAndGet(); + handshakeHeaders.add(inbound.headers()); openConnections.incrementAndGet(); var connection = new Connection(); inbound.receive().asString().subscribe(text -> { @@ -49,7 +52,7 @@ class FakeTbAiServer implements AutoCloseable { received.add(frame); if (ChannelProtocol.HELLO.equals(frame.type())) { connection.send(ChannelFrame.of(ChannelProtocol.HELLO, codec.toPayload( - new ChannelHello(1, null, null, (long) TbAiChannelClient.DEFAULT_MAX_FRAME_BYTES)))); + new ChannelHello(1, capabilities, null, (long) TbAiChannelClient.DEFAULT_MAX_FRAME_BYTES)))); } else { script.onFrame(connection, frame); } @@ -63,7 +66,11 @@ class FakeTbAiServer implements AutoCloseable { } static FakeTbAiServer start(Script script) { - return new FakeTbAiServer(script); + return new FakeTbAiServer(null, script); + } + + static FakeTbAiServer start(List capabilities, Script script) { + return new FakeTbAiServer(capabilities, script); } static FakeTbAiServer rejecting(int status) { diff --git a/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiChannelPoolTest.java b/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiChannelPoolTest.java index 22f964499d..4b5a5e41df 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiChannelPoolTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiChannelPoolTest.java @@ -4,7 +4,9 @@ package org.thingsboard.server.service.ai.transport; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; +import org.springframework.http.HttpHeaders; import org.thingsboard.ai.common.channel.ChannelProtocol; +import org.thingsboard.ai.common.client.TbAiHeaders; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.service.security.model.SecurityUser; @@ -25,6 +27,8 @@ import static org.mockito.Mockito.mock; class TbAiChannelPoolTest { + static final String TB_VERSION = "4.4.0"; + AtomicLong now = new AtomicLong(1_000_000_000L); FakeTbAiServer server = FakeTbAiServer.start((connection, frame) -> {}); TbAiChannelPool pool; @@ -53,6 +57,37 @@ class TbAiChannelPoolTest { assertThat(pool.pooledConnections()).isEqualTo(1); } + @Test + void shouldSendTbVersionAndAcceptLanguage_whenOpeningChannel() { + // GIVEN + pool = pool(10); + TbAiTurnContext context = new TbAiTurnContext(user(), null, "de-DE", () -> "token", "https://tb.example.com"); + + // WHEN + join(pool.acquire(context, false)); + + // THEN + assertThat(server.handshakeHeaders).singleElement().satisfies(headers -> { + assertThat(headers.get(TbAiHeaders.TB_VERSION)).isEqualTo(TB_VERSION); + assertThat(headers.get(HttpHeaders.ACCEPT_LANGUAGE)).isEqualTo("de-DE"); + }); + } + + @Test + void shouldSendTbVersionWithoutAcceptLanguage_whenContextHasNoLanguage() { + // GIVEN + pool = pool(10); + + // WHEN + join(pool.acquire(context(user(), "https://tb.example.com"), false)); + + // THEN + assertThat(server.handshakeHeaders).singleElement().satisfies(headers -> { + assertThat(headers.get(TbAiHeaders.TB_VERSION)).isEqualTo(TB_VERSION); + assertThat(headers.contains(HttpHeaders.ACCEPT_LANGUAGE)).isFalse(); + }); + } + @Test void shouldReuseChannel_whenSameUserCallsAgain() { // GIVEN @@ -212,7 +247,7 @@ class TbAiChannelPoolTest { } TbAiChannelPool pool(int maxConnections) { - return new TbAiChannelPool(server.client(), maxConnections, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), now::get, false); + return new TbAiChannelPool(server.client(), TB_VERSION, maxConnections, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), now::get, false); } static TbAiPooledConnection join(CompletableFuture future) { diff --git a/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnectionTest.java b/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnectionTest.java index a2ec05d485..b77252bf94 100644 --- a/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnectionTest.java +++ b/application/src/test/java/org/thingsboard/server/service/ai/transport/TbAiPooledConnectionTest.java @@ -30,7 +30,7 @@ import static org.mockito.Mockito.never; class TbAiPooledConnectionTest { ChannelFrameCodec codec = new ChannelFrameCodec(new ObjectMapper()); - TbAiChannelPool pool = new TbAiChannelPool(mock(TbAiChannelClient.class), 10, 20, Duration.ofSeconds(60), + TbAiChannelPool pool = new TbAiChannelPool(mock(TbAiChannelClient.class), "4.4.0", 10, 20, Duration.ofSeconds(60), Duration.ofMinutes(10), System::nanoTime, false); TbAiChannelPool.PoolKey key = new TbAiChannelPool.PoolKey(TenantId.fromUUID(UUID.randomUUID()), new UserId(UUID.randomUUID())); diff --git a/application/src/test/java/org/thingsboard/server/service/converter/ConverterDefaultsResourcesTest.java b/application/src/test/java/org/thingsboard/server/service/converter/ConverterDefaultsResourcesTest.java new file mode 100644 index 0000000000..5d3d528434 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/converter/ConverterDefaultsResourcesTest.java @@ -0,0 +1,90 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.converter; + +import org.assertj.core.api.SoftAssertions; +import org.junit.jupiter.api.Test; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.integration.IntegrationType; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; + +class ConverterDefaultsResourcesTest { + + private static final String DEFAULT_DIR = "default"; + private static final String TEST_DIR = "test"; + private static final String INTEGRATION_FILE = "integration.json"; + private static final Set DIRECTIONS = Set.of("uplink", "downlink"); + private static final Set DEFAULT_FILES = Set.of("tbel.raw", "js.raw", "js-v2.raw"); + private static final Set INTEGRATION_FILES = Set.of("tbel.raw", "js.raw", "payload.json", "metadata.json", "msgType.txt"); + private static final Set TEST_CASE_FILES = Set.of("expected.json", "configuration.json", "payload.json"); + + @Test + void converterResourcesFollowLayout() throws IOException { + Map files = listFiles(); + assertThat(files).isNotEmpty(); + + Set topDirs = Arrays.stream(IntegrationType.values()) + .map(IntegrationType::getDirectory) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + topDirs.add(DEFAULT_DIR); + + SoftAssertions softly = new SoftAssertions(); + files.forEach((path, resource) -> { + String[] parts = path.split("/"); + softly.assertThat(parts[0]).as(path + ": unknown integration directory").isIn(topDirs); + if (parts.length == 2 && !DEFAULT_DIR.equals(parts[0])) { + softly.assertThat(parts[1]).as(path + ": unexpected file").isEqualTo(INTEGRATION_FILE); + } else { + softly.assertThat(parts.length > 1 ? parts[1] : "").as(path + ": unknown direction").isIn(DIRECTIONS); + if (parts.length == 3) { + Set allowed = DEFAULT_DIR.equals(parts[0]) ? DEFAULT_FILES : INTEGRATION_FILES; + softly.assertThat(parts[2]).as(path + ": unexpected file").isIn(allowed); + } else { + softly.assertThat(parts.length).as(path + ": expected //test//").isEqualTo(5); + softly.assertThat(parts.length > 2 ? parts[2] : "").as(path).isEqualTo(TEST_DIR); + softly.assertThat(parts[parts.length - 1]).as(path + ": unexpected test case file").isIn(TEST_CASE_FILES); + } + } + if (path.endsWith(".json")) { + softly.assertThatCode(() -> JacksonUtil.toJsonNode(resource.getContentAsString(StandardCharsets.UTF_8))) + .as(path + ": invalid JSON") + .doesNotThrowAnyException(); + } + }); + + files.keySet().stream() + .filter(path -> path.endsWith("/payload.json") || path.endsWith("/downlink/metadata.json")) + .map(path -> path.substring(0, path.lastIndexOf('/'))) + .filter(dir -> files.containsKey(dir + "/tbel.raw") || files.containsKey(dir + "/js.raw")) + .forEach(dir -> softly.assertThat(files.keySet()) + .as(dir + ": template and example without a test case") + .anyMatch(path -> path.startsWith(dir + "/" + TEST_DIR + "/"))); + softly.assertAll(); + } + + private Map listFiles() throws IOException { + Map files = new HashMap<>(); + for (Resource resource : new PathMatchingResourcePatternResolver().getResources("classpath*:converters/**/*.*")) { + if (!"file".equals(resource.getURL().getProtocol())) { + continue; + } + String url = resource.getURL().getPath(); + files.put(url.substring(url.lastIndexOf("/converters/") + "/converters/".length()), resource); + } + return files; + } + +} diff --git a/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtilsTest.java b/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtilsTest.java index 514a41e01b..4d9784a038 100644 --- a/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtilsTest.java +++ b/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtilsTest.java @@ -65,9 +65,11 @@ import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.common.data.rule.RuleNode; import org.thingsboard.server.common.data.scheduler.SchedulerEvent; import org.thingsboard.server.common.data.security.DeviceCredentials; +import org.thingsboard.server.common.data.security.UserCredentials; import org.thingsboard.server.gen.edge.v1.EdgeConfiguration; import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.gen.edge.v1.UserCredentialsUpdateMsg; import java.lang.reflect.Constructor; import java.util.List; @@ -568,4 +570,30 @@ public class EdgeMsgConstructorUtilsTest { Assertions.assertTrue(json.get("version") == null || json.get("version").isNull(), "ReportTemplate version should be null in serialized message"); } + + @Test + public void testUserCredentialsUpdatedMsgWithoutTokens() { + UserCredentials userCredentials = new UserCredentials(); + userCredentials.setUserId(new UserId(UUID.randomUUID())); + userCredentials.setEnabled(true); + userCredentials.setPassword("$2a$10$passwordHash"); + userCredentials.setActivateToken("activateToken"); + userCredentials.setActivateTokenExpTime(System.currentTimeMillis()); + userCredentials.setResetToken("resetToken"); + userCredentials.setResetTokenExpTime(System.currentTimeMillis()); + + UserCredentialsUpdateMsg userCredentialsUpdateMsg = EdgeMsgConstructorUtils.constructUserCredentialsUpdatedMsg(userCredentials); + UserCredentials sentUserCredentials = JacksonUtil.fromString(userCredentialsUpdateMsg.getEntity(), UserCredentials.class, true); + + Assertions.assertNotNull(sentUserCredentials); + Assertions.assertEquals(userCredentials.getUserId(), sentUserCredentials.getUserId()); + Assertions.assertEquals(userCredentials.getPassword(), sentUserCredentials.getPassword()); + Assertions.assertTrue(sentUserCredentials.isEnabled()); + Assertions.assertNull(sentUserCredentials.getActivateToken()); + Assertions.assertNull(sentUserCredentials.getActivateTokenExpTime()); + Assertions.assertNull(sentUserCredentials.getResetToken()); + Assertions.assertNull(sentUserCredentials.getResetTokenExpTime()); + Assertions.assertEquals("resetToken", userCredentials.getResetToken()); + } + } diff --git a/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgSummaryUtilsTest.java b/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgSummaryUtilsTest.java new file mode 100644 index 0000000000..d12691f00c --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgSummaryUtilsTest.java @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.service.edge; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; +import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.gen.edge.v1.UplinkMsg; + +import java.util.List; +import java.util.UUID; + +public class EdgeMsgSummaryUtilsTest { + + private static final String SECRET = "secret-access-token"; + + @Test + public void testDownlinkMsgSummaryHasNoPayload() { + DownlinkMsg downlinkMsg = DownlinkMsg.newBuilder() + .setDownlinkMsgId(12) + .addDeviceUpdateMsg(DeviceUpdateMsg.newBuilder().setEntity("{\"name\":\"Device\"}").build()) + .addDeviceUpdateMsg(DeviceUpdateMsg.newBuilder().setEntity("{\"name\":\"Device 2\"}").build()) + .addDeviceCredentialsUpdateMsg(DeviceCredentialsUpdateMsg.newBuilder().setEntity("{\"credentialsId\":\"" + SECRET + "\"}").build()) + .build(); + + String summary = EdgeMsgSummaryUtils.toSummary(downlinkMsg); + + Assertions.assertEquals("DownlinkMsg[downlinkMsgId=12, deviceUpdateMsg x2, deviceCredentialsUpdateMsg x1]", summary); + } + + @Test + public void testUplinkMsgsSummaryHasNoPayload() { + UplinkMsg uplinkMsg = UplinkMsg.newBuilder() + .setUplinkMsgId(3) + .addDeviceCredentialsUpdateMsg(DeviceCredentialsUpdateMsg.newBuilder().setEntity("{\"credentialsId\":\"" + SECRET + "\"}").build()) + .build(); + + String summary = EdgeMsgSummaryUtils.toSummary(List.of(uplinkMsg, uplinkMsg)); + + Assertions.assertEquals("[UplinkMsg[uplinkMsgId=3, deviceCredentialsUpdateMsg x1], UplinkMsg[uplinkMsgId=3, deviceCredentialsUpdateMsg x1]]", summary); + Assertions.assertFalse(summary.contains(SECRET)); + } + + @Test + public void testEntityMsgSummaryHasTypeAndIdWithoutPayload() { + UUID deviceUuid = UUID.randomUUID(); + DeviceUpdateMsg deviceUpdateMsg = DeviceUpdateMsg.newBuilder() + .setMsgType(UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE) + .setIdMSB(deviceUuid.getMostSignificantBits()) + .setIdLSB(deviceUuid.getLeastSignificantBits()) + .setEntity("{\"name\":\"" + SECRET + "\"}") + .build(); + + String summary = EdgeMsgSummaryUtils.toSummary(deviceUpdateMsg); + + Assertions.assertEquals("DeviceUpdateMsg[msgType=ENTITY_UPDATED_RPC_MESSAGE, id=" + deviceUuid + "]", summary); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessorTest.java b/application/src/test/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessorTest.java new file mode 100644 index 0000000000..220590f6a7 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/edge/rpc/processor/settings/AdminSettingsEdgeProcessorTest.java @@ -0,0 +1,112 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-License-Identifier: Apache-2.0 +package org.thingsboard.server.service.edge.rpc.processor.settings; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.AdminSettings; +import org.thingsboard.server.common.data.edge.EdgeEvent; +import org.thingsboard.server.common.data.id.AdminSettingsId; +import org.thingsboard.server.common.data.id.EdgeId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.dao.settings.AdminSettingsService; +import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; +import org.thingsboard.server.service.edge.EdgeContextComponent; + +import java.util.UUID; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +public class AdminSettingsEdgeProcessorTest { + + @Mock + private EdgeContextComponent edgeCtx; + @Mock + private AdminSettingsService adminSettingsService; + + private final TenantId tenantId = new TenantId(UUID.randomUUID()); + private AdminSettingsEdgeProcessor processor; + + @BeforeEach + public void setUp() { + processor = new AdminSettingsEdgeProcessor(); + ReflectionTestUtils.setField(processor, "edgeCtx", edgeCtx); + lenient().when(edgeCtx.getAdminSettingsService()).thenReturn(adminSettingsService); + } + + @Test + public void testTenantScopedAllowListedKeyIsSyncedToEdge() { + AdminSettings general = adminSettings(tenantId, "general"); + when(adminSettingsService.findAdminSettingsById(any(), any())).thenReturn(general); + + DownlinkMsg downlink = processor.convertEdgeEventToDownlink(edgeEvent(tenantId), EdgeVersion.V_4_2_2_4); + + Assertions.assertNotNull(downlink); + Assertions.assertEquals(1, downlink.getAdminSettingsUpdateMsgCount()); + AdminSettings synced = JacksonUtil.fromString(downlink.getAdminSettingsUpdateMsg(0).getEntity(), AdminSettings.class, true); + Assertions.assertNotNull(synced); + Assertions.assertEquals("general", synced.getKey()); + } + + @Test + public void testTenantScopedNonAllowListedKeyIsNotSyncedToEdge() { + AdminSettings mail = adminSettings(tenantId, "mail"); + when(adminSettingsService.findAdminSettingsById(any(), any())).thenReturn(mail); + + DownlinkMsg downlink = processor.convertEdgeEventToDownlink(edgeEvent(tenantId), EdgeVersion.V_4_2_2_4); + + Assertions.assertNull(downlink); + } + + @Test + public void testSystemScopedAllowListedKeyIsSyncedToEdge() { + AdminSettings connectivity = adminSettings(TenantId.SYS_TENANT_ID, "connectivity"); + when(adminSettingsService.findAdminSettingsById(any(), any())).thenReturn(connectivity); + + DownlinkMsg downlink = processor.convertEdgeEventToDownlink(edgeEvent(TenantId.SYS_TENANT_ID), EdgeVersion.V_4_2_2_4); + + Assertions.assertNotNull(downlink); + Assertions.assertEquals(1, downlink.getAdminSettingsUpdateMsgCount()); + } + + @ParameterizedTest + @ValueSource(strings = {"mail", "jwt", "sms", "notifications"}) + public void testSystemScopedNonAllowListedKeyIsNotSyncedToEdge(String key) { + AdminSettings settings = adminSettings(TenantId.SYS_TENANT_ID, key); + when(adminSettingsService.findAdminSettingsById(any(), any())).thenReturn(settings); + + DownlinkMsg downlink = processor.convertEdgeEventToDownlink(edgeEvent(TenantId.SYS_TENANT_ID), EdgeVersion.V_4_2_2_4); + + Assertions.assertNull(downlink); + } + + private EdgeEvent edgeEvent(TenantId eventTenantId) { + EdgeEvent edgeEvent = new EdgeEvent(); + edgeEvent.setTenantId(eventTenantId); + edgeEvent.setEdgeId(new EdgeId(UUID.randomUUID())); + edgeEvent.setEntityId(UUID.randomUUID()); + return edgeEvent; + } + + private AdminSettings adminSettings(TenantId settingsTenantId, String key) { + AdminSettings adminSettings = new AdminSettings(); + adminSettings.setId(new AdminSettingsId(UUID.randomUUID())); + adminSettings.setTenantId(settingsTenantId); + adminSettings.setKey(key); + adminSettings.setJsonValue(JacksonUtil.newObjectNode()); + return adminSettings; + } + +} diff --git a/application/src/test/java/org/thingsboard/server/service/edge/rpc/processor/wl/WhiteLabelingEdgeProcessorTest.java b/application/src/test/java/org/thingsboard/server/service/edge/rpc/processor/wl/WhiteLabelingEdgeProcessorTest.java new file mode 100644 index 0000000000..eb1933654f --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/edge/rpc/processor/wl/WhiteLabelingEdgeProcessorTest.java @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.edge.rpc.processor.wl; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.test.util.ReflectionTestUtils; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.wl.WhiteLabelingType; + +import java.util.UUID; + +public class WhiteLabelingEdgeProcessorTest { + + private final WhiteLabelingEdgeProcessor processor = new WhiteLabelingEdgeProcessor(); + private final TenantId tenantId = new TenantId(UUID.randomUUID()); + + @Test + public void testSystemMailTemplatesAreNotSyncedToEdge() { + // System mail templates are rendered on the cloud, so they must never be pushed to the edge. + Assertions.assertTrue(isSystemMailTemplates(WhiteLabelingType.MAIL_TEMPLATES, TenantId.SYS_TENANT_ID)); + } + + @Test + public void testTenantMailTemplatesAreStillSyncedToEdge() { + // Only system-scoped mail templates are skipped; tenant-scoped ones keep syncing. + Assertions.assertFalse(isSystemMailTemplates(WhiteLabelingType.MAIL_TEMPLATES, tenantId)); + } + + @Test + public void testSystemNonMailTemplatesAreStillSyncedToEdge() { + // Other system white-labeling (e.g. GENERAL) is not affected by the mail-templates skip. + Assertions.assertFalse(isSystemMailTemplates(WhiteLabelingType.GENERAL, TenantId.SYS_TENANT_ID)); + } + + private boolean isSystemMailTemplates(WhiteLabelingType type, TenantId tenantId) { + return Boolean.TRUE.equals(ReflectionTestUtils.invokeMethod(processor, "isSystemMailTemplates", type, tenantId)); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcServiceTest.java b/application/src/test/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcServiceTest.java new file mode 100644 index 0000000000..dce6ef5aa6 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcServiceTest.java @@ -0,0 +1,250 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.edge.rpc.service; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentMatcher; +import org.mockito.InOrder; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.context.ApplicationContext; +import org.springframework.test.util.ReflectionTestUtils; +import org.thingsboard.rule.engine.api.AttributesSaveRequest; +import org.thingsboard.server.cache.SimpleTbCacheValueWrapper; +import org.thingsboard.server.cache.TbTransactionalCache; +import org.thingsboard.server.cluster.TbClusterService; +import org.thingsboard.server.common.data.edge.Edge; +import org.thingsboard.server.common.data.id.EdgeId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.msg.TbMsgType; +import org.thingsboard.server.common.data.notification.rule.trigger.EdgeConnectionTrigger; +import org.thingsboard.server.common.data.notification.rule.trigger.NotificationRuleTrigger; +import org.thingsboard.server.common.msg.TbMsg; +import org.thingsboard.server.common.msg.notification.NotificationRuleProcessor; +import org.thingsboard.server.common.msg.queue.ServiceType; +import org.thingsboard.server.queue.discovery.PartitionService; +import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; +import org.thingsboard.server.service.edge.EdgeContextComponent; +import org.thingsboard.server.service.edge.rpc.EdgeSessionState; +import org.thingsboard.server.service.edge.rpc.session.EdgeSessionsHolder; +import org.thingsboard.server.service.edge.rpc.session.manager.EdgeGrpcSessionManager; +import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService; + +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.thingsboard.server.service.state.DefaultDeviceStateService.ACTIVITY_STATE; +import static org.thingsboard.server.service.state.DefaultDeviceStateService.LAST_DISCONNECT_TIME; + +@ExtendWith(MockitoExtension.class) +class EdgeGrpcServiceTest { + + private static final String THIS_NODE = "tb-core-1"; + private static final String OTHER_NODE = "tb-core-2"; + + @Mock + private ApplicationContext applicationContext; + @Mock + private TbClusterService clusterService; + @Mock + private TbServiceInfoProvider serviceInfoProvider; + @Mock + private TelemetrySubscriptionService tsSubService; + @Mock + private TbTransactionalCache edgeIdServiceIdCache; + @Mock + private PartitionService partitionService; + @Mock + private EdgeContextComponent ctx; + @Mock + private NotificationRuleProcessor ruleProcessor; + + private EdgeSessionsHolder sessions; + private EdgeGrpcService edgeGrpcService; + private Edge edge; + private EdgeId edgeId; + + @BeforeEach + void setUp() { + sessions = new EdgeSessionsHolder(); + edgeGrpcService = new EdgeGrpcService(sessions, applicationContext, clusterService, serviceInfoProvider, + tsSubService, edgeIdServiceIdCache, partitionService); + ReflectionTestUtils.setField(edgeGrpcService, "ctx", ctx); + edgeId = new EdgeId(UUID.randomUUID()); + edge = new Edge(edgeId); + edge.setTenantId(TenantId.fromUUID(UUID.randomUUID())); + edge.setName("test-edge"); + lenient().when(ctx.getRuleProcessor()).thenReturn(ruleProcessor); + } + + @Test + void givenNoCacheEntry_whenDisconnect_thenAllDisconnectSideEffectsRun() { + EdgeGrpcSessionManager session = registerSession(); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(null); + + onEdgeDisconnect(session); + + verify(tsSubService, times(1)).saveAttributes(argThat(activeStateWrite(false))); + verify(tsSubService, times(1)).saveAttributes(argThat(lastDisconnectTimeWrite())); + verify(clusterService, times(1)).pushMsgToRuleEngine(any(TenantId.class), any(EntityId.class), any(TbMsg.class), isNull()); + verify(ruleProcessor, times(1)).process(argThat(disconnectTrigger())); + } + + @Test + void givenEdgeOwnedByAnotherLiveNode_whenDisconnect_thenNoDisconnectSideEffects() { + EdgeGrpcSessionManager session = registerSession(); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(SimpleTbCacheValueWrapper.wrap(OTHER_NODE)); + when(partitionService.getAllServiceIds(ServiceType.TB_CORE)).thenReturn(Set.of(THIS_NODE, OTHER_NODE)); + + onEdgeDisconnect(session); + + verifyNoDisconnectSideEffects(); + } + + @Test + void givenOwnerNodeLeftCluster_whenDisconnect_thenInactiveStateIsPersisted() { + // the cache has no TTL by default, so a dead owner's claim must not keep the edge active forever + EdgeGrpcSessionManager session = registerSession(); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(SimpleTbCacheValueWrapper.wrap(OTHER_NODE)); + when(partitionService.getAllServiceIds(ServiceType.TB_CORE)).thenReturn(Set.of(THIS_NODE)); + + onEdgeDisconnect(session); + + verify(tsSubService, times(1)).saveAttributes(argThat(activeStateWrite(false))); + } + + @Test + void givenSameNodeReconnectDuringOwnershipCheck_whenDisconnect_thenNoDisconnectSideEffects() { + // the edge reconnects to this node after the stale session was removed, so the cache names this node + EdgeGrpcSessionManager session = registerSession(); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + when(edgeIdServiceIdCache.get(edgeId)).thenAnswer(invocation -> { + sessions.put(newSession()); + return SimpleTbCacheValueWrapper.wrap(THIS_NODE); + }); + + onEdgeDisconnect(session); + + verifyNoDisconnectSideEffects(); + } + + @Test + void givenReconnectDuringInactiveWrite_whenDisconnect_thenReconnectWaitsForTheWrite() throws Exception { + // a same-node reconnect racing the guard must be ordered after the inactive write, so its active=true wins + EdgeGrpcSessionManager session = registerSession(); + when(edgeIdServiceIdCache.get(edgeId)).thenReturn(null); + EdgeGrpcSessionManager replacement = newSession(); + Thread reconnect = new Thread(() -> sessions.put(replacement)); + AtomicBoolean reconnectBlockedDuringWrite = new AtomicBoolean(); + lenient().doAnswer(invocation -> { + reconnect.start(); + reconnect.join(200); + reconnectBlockedDuringWrite.set(reconnect.isAlive()); + return null; + }).when(tsSubService).saveAttributes(argThat(activeStateWrite(false))); + + onEdgeDisconnect(session); + reconnect.join(5000); + + assertThat(reconnectBlockedDuringWrite).isTrue(); + assertThat(sessions.getByEdgeId(edgeId)).isSameAs(replacement); + } + + @Test + void givenReplacedSessionDisconnectsDuringItsTeardown_whenConnect_thenNoDisconnectSideEffects() { + // the edge reconnects before its old stream is noticed dead; the old session's close fires while it is destroyed + EdgeGrpcSessionManager old = registerSession(); + doAnswer(invocation -> { + onEdgeDisconnect(old); + return null; + }).when(old).destroyAndMarkAsZombieIfFailed(); + EdgeGrpcSessionManager replacement = newSession(); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + + ReflectionTestUtils.invokeMethod(edgeGrpcService, "onEdgeConnect", edgeId, replacement); + + verify(tsSubService, never()).saveAttributes(argThat(activeStateWrite(false))); + verify(tsSubService, never()).saveAttributes(argThat(lastDisconnectTimeWrite())); + verify(clusterService, never()).pushMsgToRuleEngine(any(TenantId.class), any(EntityId.class), + argThat(msg -> TbMsgType.DISCONNECT_EVENT.equals(msg.getInternalType())), isNull()); + verify(ruleProcessor, never()).process(argThat(disconnectTrigger())); + verify(edgeIdServiceIdCache, never()).evict(edgeId); + assertThat(sessions.getByEdgeId(edgeId)).isSameAs(replacement); + assertThat(sessions.getSessionsById()).doesNotContainKey(old.getState().getSessionId()); + } + + @Test + void givenConnect_whenClaimingOwnership_thenCachePutHappensBeforeActiveStateWrite() { + // the previous node reads this cache entry on disconnect, so the claim must be visible before active=true + EdgeGrpcSessionManager session = newSession(); + when(serviceInfoProvider.getServiceId()).thenReturn(THIS_NODE); + + ReflectionTestUtils.invokeMethod(edgeGrpcService, "onEdgeConnect", edgeId, session); + + InOrder inOrder = inOrder(edgeIdServiceIdCache, tsSubService); + inOrder.verify(edgeIdServiceIdCache).put(edgeId, THIS_NODE); + inOrder.verify(tsSubService).saveAttributes(argThat(activeStateWrite(true))); + } + + private void verifyNoDisconnectSideEffects() { + verify(tsSubService, never()).saveAttributes(argThat(activeStateWrite(false))); + verify(tsSubService, never()).saveAttributes(argThat(lastDisconnectTimeWrite())); + verify(clusterService, never()).pushMsgToRuleEngine(any(TenantId.class), any(EntityId.class), any(TbMsg.class), isNull()); + verify(ruleProcessor, never()).process(argThat(disconnectTrigger())); + } + + private void onEdgeDisconnect(EdgeGrpcSessionManager session) { + ReflectionTestUtils.invokeMethod(edgeGrpcService, "onEdgeDisconnect", edge, session.getState().getSessionId()); + } + + private EdgeGrpcSessionManager registerSession() { + EdgeGrpcSessionManager session = newSession(); + sessions.put(session); + return session; + } + + private EdgeGrpcSessionManager newSession() { + EdgeSessionState state = new EdgeSessionState(); + state.setEdge(edge); + EdgeGrpcSessionManager session = mock(EdgeGrpcSessionManager.class); + lenient().when(session.getState()).thenReturn(state); + return session; + } + + private ArgumentMatcher activeStateWrite(boolean active) { + return request -> request != null + && edgeId.equals(request.getEntityId()) + && request.getEntries().stream().anyMatch(entry -> + ACTIVITY_STATE.equals(entry.getKey()) + && Boolean.valueOf(active).equals(entry.getBooleanValue().orElse(null))); + } + + private ArgumentMatcher lastDisconnectTimeWrite() { + return request -> request != null + && edgeId.equals(request.getEntityId()) + && request.getEntries().stream().anyMatch(entry -> LAST_DISCONNECT_TIME.equals(entry.getKey())); + } + + private ArgumentMatcher disconnectTrigger() { + return trigger -> trigger instanceof EdgeConnectionTrigger edgeTrigger && !edgeTrigger.isConnected(); + } + +} diff --git a/application/src/test/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolderTest.java b/application/src/test/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolderTest.java index 0cf28a8962..72e142939f 100644 --- a/application/src/test/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolderTest.java +++ b/application/src/test/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolderTest.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.service.edge.rpc.session; import org.junit.jupiter.api.BeforeEach; @@ -11,6 +12,7 @@ import org.thingsboard.server.service.edge.rpc.EdgeSessionState; import org.thingsboard.server.service.edge.rpc.session.manager.EdgeGrpcSessionManager; import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -81,6 +83,54 @@ class EdgeSessionsHolderTest { assertThat(holder.isCurrent(newSession())).isFalse(); } + @Test + void putReturnsTheSessionItReplaced() { + EdgeGrpcSessionManager first = newSession(); + EdgeGrpcSessionManager second = newSession(); + + assertThat(holder.put(first)).isNull(); + assertThat(holder.put(second)).isSameAs(first); + assertThat(holder.getByEdgeId(edgeId)).isSameAs(second); + } + + @Test + void runIfNoSessionRunsTheActionWhenTheEdgeHasNoSession() { + AtomicBoolean ran = new AtomicBoolean(); + + assertThat(holder.runIfNoSession(edgeId, () -> ran.set(true))).isTrue(); + assertThat(ran).isTrue(); + } + + @Test + void runIfNoSessionSkipsTheActionWhenTheEdgeHasASession() { + holder.put(newSession()); + AtomicBoolean ran = new AtomicBoolean(); + + assertThat(holder.runIfNoSession(edgeId, () -> ran.set(true))).isFalse(); + assertThat(ran).isFalse(); + } + + @Test + void putWaitsForARunningRunIfNoSessionAction() throws Exception { + EdgeGrpcSessionManager session = newSession(); + Thread put = new Thread(() -> holder.put(session)); + AtomicBoolean putBlockedDuringAction = new AtomicBoolean(); + + holder.runIfNoSession(edgeId, () -> { + put.start(); + try { + put.join(200); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + putBlockedDuringAction.set(put.isAlive()); + }); + put.join(5000); + + assertThat(putBlockedDuringAction).isTrue(); + assertThat(holder.getByEdgeId(edgeId)).isSameAs(session); + } + private EdgeGrpcSessionManager newSession() { EdgeSessionState state = new EdgeSessionState(); state.setEdge(edge); diff --git a/application/src/test/java/org/thingsboard/server/service/install/lts/V4_4_1_0MigrationTest.java b/application/src/test/java/org/thingsboard/server/service/install/lts/V4_4_1_0MigrationTest.java new file mode 100644 index 0000000000..16fd787351 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/install/lts/V4_4_1_0MigrationTest.java @@ -0,0 +1,153 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.install.lts; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.thingsboard.server.common.data.id.ApiKeyId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.pat.ApiKey; +import org.thingsboard.server.common.data.pat.ApiKeyInfo; +import org.thingsboard.server.common.data.permission.AuthorityPermissionsInfo; +import org.thingsboard.server.common.data.permission.Operation; +import org.thingsboard.server.common.data.permission.Resource; +import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.dao.pat.ApiKeyService; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.thingsboard.server.dao.trendz.TrendzSyncService.TRENDZ_API_KEY_DESCRIPTION; + +@ExtendWith(MockitoExtension.class) +class V4_4_1_0MigrationTest { + + private static final List AUTHORITIES = List.of(Authority.TENANT_ADMIN, Authority.CUSTOMER_USER); + + @Mock + private ApiKeyService apiKeyService; + + @InjectMocks + private V4_4_1_0Migration migration; + + @Test + void grantsAiModelOperationsPerAuthorityWithoutDroppingExistingOperations() { + givenTrendzApiKey(byAuthority(legacyPermissions(), AUTHORITIES)); + + migration.apply(); + + Map>> byAuthority = savedPermissions(); + assertEquals(Set.of(Operation.READ, Operation.INVOKE), byAuthority.get(Authority.TENANT_ADMIN).get(Resource.AI_MODEL)); + assertEquals(Set.of(Operation.INVOKE), byAuthority.get(Authority.CUSTOMER_USER).get(Resource.AI_MODEL), + "customer users must not get READ on AI_MODEL"); + assertEquals(Set.of(Operation.READ, Operation.READ_TELEMETRY), + byAuthority.get(Authority.TENANT_ADMIN).get(Resource.DEVICE), + "the operations the key already had must survive"); + } + + @Test + void keepsOperationsTheKeyAlreadyHadOnAiModel() { + Map> permissions = legacyPermissions(); + permissions.put(Resource.AI_MODEL, Set.of(Operation.READ, Operation.WRITE)); + givenTrendzApiKey(byAuthority(permissions, AUTHORITIES)); + + migration.apply(); + + Map>> byAuthority = savedPermissions(); + for (Authority authority : AUTHORITIES) { + assertEquals(Set.of(Operation.READ, Operation.WRITE, Operation.INVOKE), byAuthority.get(authority).get(Resource.AI_MODEL), + "expected the existing AI_MODEL operations plus INVOKE for " + authority); + } + } + + /** + * {@link Migration#apply()} re-runs when a node crashes before the version is recorded, so a key that already + * carries the operations must not be written again. + */ + @Test + void alreadyGrantedKeyIsNotSavedAgain() { + Map> tenantAdminPermissions = legacyPermissions(); + tenantAdminPermissions.put(Resource.AI_MODEL, Set.of(Operation.READ, Operation.INVOKE)); + Map> customerUserPermissions = legacyPermissions(); + customerUserPermissions.put(Resource.AI_MODEL, Set.of(Operation.INVOKE)); + givenTrendzApiKey(new HashMap<>(Map.of( + Authority.TENANT_ADMIN, tenantAdminPermissions, + Authority.CUSTOMER_USER, customerUserPermissions))); + + migration.apply(); + + verify(apiKeyService, never()).saveApiKey(any(), any()); + } + + @Test + void authorityTheKeyDoesNotCoverIsNotAdded() { + givenTrendzApiKey(byAuthority(legacyPermissions(), List.of(Authority.TENANT_ADMIN))); + + migration.apply(); + + Map>> byAuthority = savedPermissions(); + assertEquals(Set.of(Operation.READ, Operation.INVOKE), byAuthority.get(Authority.TENANT_ADMIN).get(Resource.AI_MODEL)); + assertFalse(byAuthority.containsKey(Authority.CUSTOMER_USER), "an authority the key never covered must stay absent"); + } + + @Test + void missingTrendzApiKeyIsNoOp() { + when(apiKeyService.findInternalApiKeyByDescription(TenantId.SYS_TENANT_ID, TRENDZ_API_KEY_DESCRIPTION)) + .thenReturn(null); + + migration.apply(); + + verify(apiKeyService, never()).saveApiKey(any(), any()); + } + + private Map>> savedPermissions() { + ArgumentCaptor saved = ArgumentCaptor.forClass(ApiKeyInfo.class); + verify(apiKeyService).saveApiKey(eq(TenantId.SYS_TENANT_ID), saved.capture()); + return saved.getValue().getPermissions().getOperationsByResource(); + } + + private void givenTrendzApiKey(Map>> byAuthority) { + ApiKey apiKey = new ApiKey(new ApiKeyId(UUID.randomUUID())); + apiKey.setTenantId(TenantId.SYS_TENANT_ID); + apiKey.setInternal(true); + apiKey.setDescription(TRENDZ_API_KEY_DESCRIPTION); + + AuthorityPermissionsInfo permissions = new AuthorityPermissionsInfo(); + permissions.setOperationsByResource(byAuthority); + apiKey.setPermissions(permissions); + + when(apiKeyService.findInternalApiKeyByDescription(TenantId.SYS_TENANT_ID, TRENDZ_API_KEY_DESCRIPTION)) + .thenReturn(apiKey); + } + + // Separate map instances per authority, the way a key deserialized from the permissions column arrives. + private Map>> byAuthority(Map> permissions, List authorities) { + Map>> byAuthority = new HashMap<>(); + authorities.forEach(authority -> byAuthority.put(authority, new HashMap<>(permissions))); + return byAuthority; + } + + // What a key created before 4.4.1.0 holds. Immutable inner sets on purpose: the migration must copy what it reads + // rather than mutate it. + private Map> legacyPermissions() { + Map> permissions = new HashMap<>(); + permissions.put(Resource.DEVICE, Set.of(Operation.READ, Operation.READ_TELEMETRY)); + permissions.put(Resource.ASSET, Set.of(Operation.READ, Operation.READ_TELEMETRY)); + permissions.put(Resource.DEVICE_PROFILE, Set.of(Operation.READ)); + return permissions; + } +} diff --git a/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultDevicePackageUpdateServiceTest.java b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultDevicePackageUpdateServiceTest.java new file mode 100644 index 0000000000..9c30892737 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultDevicePackageUpdateServiceTest.java @@ -0,0 +1,851 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.iot_hub; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; +import org.springframework.test.util.ReflectionTestUtils; +import org.springframework.transaction.support.TransactionCallback; +import org.springframework.transaction.support.TransactionTemplate; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.Dashboard; +import org.thingsboard.server.common.data.Device; +import org.thingsboard.server.common.data.DeviceProfile; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.AttributeScope; +import org.thingsboard.server.common.data.converter.Converter; +import org.thingsboard.server.common.data.debug.DebugSettings; +import org.thingsboard.server.common.data.exception.EntityVersionMismatchException; +import org.thingsboard.server.common.data.id.ConverterId; +import org.thingsboard.server.common.data.id.CustomerId; +import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.DeviceId; +import org.thingsboard.server.common.data.id.DeviceProfileId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.IntegrationId; +import org.thingsboard.server.common.data.id.IotHubInstalledItemId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.subscription.SubscriptionErrorCode; +import org.thingsboard.server.common.data.subscription.SubscriptionException; +import org.thingsboard.rule.engine.api.AttributesSaveRequest; +import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor; +import org.thingsboard.server.common.data.iot_hub.IotHubInstalledItem; +import org.thingsboard.server.dao.converter.ConverterService; +import org.thingsboard.server.dao.dashboard.DashboardService; +import org.thingsboard.server.dao.device.DeviceCredentialsService; +import org.thingsboard.server.dao.device.DeviceProfileService; +import org.thingsboard.server.dao.device.DeviceService; +import org.thingsboard.server.dao.entity.EntityService; +import org.thingsboard.server.dao.integration.IntegrationService; +import org.thingsboard.server.dao.iot_hub.IotHubInstalledItemService; +import org.thingsboard.server.dao.subscription.PlatformFeature; +import org.thingsboard.server.dao.subscription.SubscriptionService; +import org.thingsboard.server.exception.DataValidationException; +import org.thingsboard.server.service.entitiy.TbLogEntityActionService; +import org.thingsboard.server.service.entitiy.integration.TbIntegrationService; +import org.thingsboard.server.service.security.model.SecurityUser; +import org.thingsboard.server.service.telemetry.TelemetrySubscriptionService; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) +class DefaultDevicePackageUpdateServiceTest { + + private final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID()); + private final SecurityUser user = mock(SecurityUser.class); + private final UUID itemId = UUID.randomUUID(); + private final String versionId = UUID.randomUUID().toString(); + private final UUID installedVersionId = UUID.randomUUID(); + private final DeviceProfileId profileId = new DeviceProfileId(UUID.randomUUID()); + private final DashboardId dashboardId = new DashboardId(UUID.randomUUID()); + private final DeviceId deviceId = new DeviceId(UUID.randomUUID()); + private final IntegrationId integrationId = new IntegrationId(UUID.randomUUID()); + + @Mock + private IotHubInstalledItemService installedItemService; + @Mock + private IotHubRestClient iotHubRestClient; + @Mock + private DevicePackageEntities packageEntities; + @Mock + private DeviceProfileService deviceProfileService; + @Mock + private DashboardService dashboardService; + @Mock + private DeviceService deviceService; + @Mock + private DeviceCredentialsService deviceCredentialsService; + @Mock + private ConverterService converterService; + @Mock + private IntegrationService integrationService; + @Mock + private TransactionTemplate transactionTemplate; + @Mock + private EntityService entityService; + @Mock + private TbLogEntityActionService logEntityActionService; + @Mock + private TbIntegrationService tbIntegrationService; + @Mock + private SubscriptionService subscriptionService; + @Mock + private TelemetrySubscriptionService telemetryService; + @Mock + private IotHubService iotHubService; + + @InjectMocks + private DefaultDevicePackageUpdateService service; + + private IotHubInstalledItem installedItem; + // Set when the transaction callback threw, so the transaction would roll back + private final List rolledBack = new ArrayList<>(); + + @BeforeEach + void setUp() { + ReflectionTestUtils.setField(service, "entityService", entityService); + ReflectionTestUtils.setField(service, "logEntityActionService", logEntityActionService); + when(user.getTenantId()).thenReturn(tenantId); + + DeviceInstalledItemDescriptor descriptor = new DeviceInstalledItemDescriptor(); + descriptor.setSelectedInstallMethod("INTEGRATION_TTN"); + descriptor.setCreatedEntityIds(List.of(profileId, deviceId, dashboardId, integrationId)); + descriptor.setDashboardId(dashboardId); + // The package created these entities + descriptor.setInstallState(Map.of("Profile", stateOf(profileId, "created"), "AM308", stateOf(deviceId, "created"), + "Dashboard", stateOf(dashboardId, "created"), "Integration", stateOf(integrationId, "created"))); + installedItem = new IotHubInstalledItem(); + installedItem.setId(new IotHubInstalledItemId(UUID.randomUUID())); + installedItem.setTenantId(tenantId); + installedItem.setItemId(itemId); + installedItem.setItemType("DEVICE"); + installedItem.setVersion("1.0.0"); + installedItem.setItemVersionId(installedVersionId); + installedItem.setDescriptor(descriptor); + when(installedItemService.findById(tenantId, installedItem.getId())).thenReturn(installedItem); + when(installedItemService.findByIdForUpdate(tenantId, installedItem.getId())).thenReturn(installedItem); + + ObjectNode versionInfo = JacksonUtil.newObjectNode(); + versionInfo.put("itemId", itemId.toString()); + versionInfo.put("name", "AM308"); + versionInfo.put("version", "1.0.1"); + when(iotHubRestClient.getVersionInfo(versionId)).thenReturn(versionInfo); + + when(transactionTemplate.execute(any())).thenAnswer(invocation -> { + try { + return invocation.>getArgument(0).doInTransaction(null); + } catch (RuntimeException e) { + rolledBack.add(e); + throw e; + } + }); + when(packageEntities.checksum(any(), any())).thenReturn("checksum"); + when(entityService.fetchEntity(any(), any())).thenReturn(Optional.empty()); + Device device = new Device(deviceId); + device.setTenantId(tenantId); + device.setName("AM308"); + when(deviceService.findDeviceById(tenantId, deviceId)).thenReturn(device); + when(installedItemService.findByTenantId(any(), any(), any(), any())).thenReturn(new PageData<>()); + } + + @Test + void overwritesTheEntitiesAndRecordsTheNewVersionInOneTransaction() { + DeviceProfile profile = profile(3L, "AM308 renamed"); + when(deviceProfileService.findDeviceProfileById(tenantId, profileId)).thenReturn(profile); + when(deviceProfileService.saveDeviceProfile(any())).thenAnswer(i -> i.getArgument(0)); + Dashboard dashboard = dashboard(7L); + dashboard.setCustomerId(new CustomerId(UUID.randomUUID())); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard); + when(dashboardService.saveDashboard(any(Dashboard.class))).thenAnswer(i -> i.getArgument(0)); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + overwrite("AM308 profile", "DEVICE_PROFILE", profileId, 3L, JacksonUtil.newObjectNode().put("name", "milesight-iot-am308").put("description", "new")), + keep("AM308", "DEVICE", deviceId), + overwrite("Dashboard", "DASHBOARD", dashboardId, 7L, JacksonUtil.newObjectNode().put("title", "Template title")))); + + assertThat(result.isSuccess()).isTrue(); + ArgumentCaptor savedProfile = ArgumentCaptor.forClass(DeviceProfile.class); + verify(deviceProfileService).saveDeviceProfile(savedProfile.capture()); + // Same id, the name the user gave it, the version they reviewed + assertThat(savedProfile.getValue().getId()).isEqualTo(profileId); + assertThat(savedProfile.getValue().getName()).isEqualTo("AM308 renamed"); + assertThat(savedProfile.getValue().getDescription()).isEqualTo("new"); + assertThat(savedProfile.getValue().getVersion()).isEqualTo(3L); + ArgumentCaptor savedDashboard = ArgumentCaptor.forClass(Dashboard.class); + verify(dashboardService).saveDashboard(savedDashboard.capture()); + assertThat(savedDashboard.getValue().getCustomerId()).isEqualTo(dashboard.getCustomerId()); + + verify(installedItemService).save(tenantId, installedItem); + assertThat(installedItem.getVersion()).isEqualTo("1.0.1"); + assertThat(installedItem.getItemVersionId()).isEqualTo(UUID.fromString(versionId)); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + // Of the saved dashboard, not read back by id: inside the transaction that may come from the cache + assertThat(descriptor.getInstallState().get("Dashboard").get("checksum").asText()) + .isEqualTo(EntityChecksum.of(savedDashboard.getValue())); + assertThat(descriptor.getCreatedEntityIds()).contains(profileId, deviceId, dashboardId); + } + + @Test + void keptEntity_keepsTheChecksumThePackageLeft() { + // The user changed the dashboard since: its current checksum must not become the package's + ObjectNode dashboardState = JacksonUtil.newObjectNode().put("checksum", "installed").put("resolution", "created"); + dashboardState.set("entityOutput", JacksonUtil.newObjectNode().put("id", dashboardId.getId().toString())); + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("Dashboard", dashboardState)); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + DeviceUpdateRequest request = request(keep("Dashboard", "DASHBOARD", dashboardId)); + request.setSelectedInstallMethod("INTEGRATION_CHIRPSTACK"); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + assertThat(descriptor.getInstallState().get("Dashboard").get("checksum").asText()).isEqualTo("installed"); + assertThat(descriptor.getSelectedInstallMethod()).isEqualTo("INTEGRATION_CHIRPSTACK"); + verify(dashboardService, never()).saveDashboard(any(Dashboard.class)); + } + + @Test + void keptEntityOfAStepWithAnId_keepsItsChecksumUnderTheId() { + // Installed by a version whose step had no id: the entry is under the step's name + ObjectNode dashboardState = JacksonUtil.newObjectNode().put("checksum", "installed").put("resolution", "created"); + dashboardState.set("entityOutput", JacksonUtil.newObjectNode().put("id", dashboardId.getId().toString())); + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("Dashboard", dashboardState)); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + DeviceUpdateRequest.Step overview = keep("Overview", "DASHBOARD", dashboardId); + overview.setId("main-dashboard"); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(overview)); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + assertThat(descriptor.getInstallState().get("main-dashboard").get("checksum").asText()).isEqualTo("installed"); + assertThat(descriptor.getInstallState()).doesNotContainKeys("Dashboard", "Overview"); + } + + @Test + void keptEntity_doesNotTakeTheChecksumOfAnotherEntity() { + // The entry under the step's key was recorded for an entity deleted since + ObjectNode dashboardState = JacksonUtil.newObjectNode().put("checksum", "of-the-deleted-one").put("resolution", "created"); + dashboardState.set("entityOutput", JacksonUtil.newObjectNode().put("id", UUID.randomUUID().toString())); + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("Dashboard", dashboardState)); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(keep("Dashboard", "DASHBOARD", dashboardId))); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + assertThat(descriptor.getInstallState().get("Dashboard").has("checksum")).isFalse(); + } + + @Test + void useExistingOfAPackageEntity_staysThePackages() { + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + DeviceUpdateRequest.Step step = keep("Overview", "DASHBOARD", dashboardId); + step.setResolution("use-existing"); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + assertThat(descriptor.getInstallState().get("Overview").get("resolution").asText()).isEqualTo("created"); + assertThat(descriptor.getCreatedEntityIds()).contains(dashboardId); + } + + @Test + void useExistingAtInstall_staysUseExisting() { + // At install the user picked their own dashboard: the install adds it to createdEntityIds too + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("Dashboard", stateOf(dashboardId, "use-existing"))); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + DeviceUpdateRequest.Step step = keep("Dashboard", "DASHBOARD", dashboardId); + step.setResolution("use-existing"); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + assertThat(descriptor.getInstallState().get("Dashboard").get("resolution").asText()).isEqualTo("use-existing"); + } + + @Test + void overwritingAnEntityUsedAtInstall_needsAConfirmation() { + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("Dashboard", stateOf(dashboardId, "use-existing"))); + DeviceUpdateRequest.Step step = overwrite("Dashboard", "DASHBOARD", dashboardId, 9L, JacksonUtil.newObjectNode().put("title", "Dashboard")); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isFalse(); + verify(installedItemService, never()).save(any(), any()); + } + + @Test + void sharedEntityOverwrittenByAnotherPackage_isNotChangedBySomeoneElse() { + Dashboard shared = dashboard(9L); + DevicePackageEntities.Snapshot snapshot = new DevicePackageEntities.Snapshot(shared, null); + when(packageEntities.load(tenantId, dashboardId)).thenReturn(snapshot); + when(iotHubService.findKeptEntities(tenantId, installedItem.getId())).thenReturn(new InstalledItemKeptEntities(List.of(), 0, 0)); + // This package recorded the dashboard as it left it; the other one overwrote it since and recorded the new one + ObjectNode own = stateOf(dashboardId, "created").put("checksum", "as-this-package-left-it"); + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("Dashboard", own)); + IotHubInstalledItem other = otherPackage(Map.of("Dashboard", stateOf(dashboardId, "created").put("checksum", snapshot.checksum()))); + when(installedItemService.findByTenantId(any(), any(), any(), any())) + .thenReturn(new PageData<>(List.of(installedItem, other), 1, 2, false)); + + assertThat(service.check(user, installedItem.getId()).get(0).getModified()).isFalse(); + + shared.setConfiguration(JacksonUtil.newObjectNode().put("description", "Changed by hand")); + assertThat(service.check(user, installedItem.getId()).get(0).getModified()).isTrue(); + } + + @Test + void entityOfAStepAVersionDropped_staysThePackages() { + // v2 dropped the dashboard step: the install state no longer has it, createdEntityIds does + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of()); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + DeviceUpdateRequest.Step step = keep("Dashboard", "DASHBOARD", dashboardId); + step.setResolution("use-existing"); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + assertThat(descriptor.getInstallState().get("Dashboard").get("resolution").asText()).isEqualTo("created"); + } + + @Test + void entityUsedAtInstall_staysTheUsersAfterAVersionDropsItsStep() { + // Recorded at install; the step is gone from the install state since + DeviceInstalledItemDescriptor installed = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + installed.setUsedExistingEntityIds(List.of(dashboardId)); + installed.setInstallState(Map.of()); + DeviceUpdateRequest.Step step = overwrite("Dashboard", "DASHBOARD", dashboardId, 9L, JacksonUtil.newObjectNode().put("title", "Dashboard")); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isFalse(); + verify(installedItemService, never()).save(any(), any()); + } + + @Test + void entitiesUsedAtInstall_areCarriedIntoTheDescriptor() { + // Installed before the descriptor kept them: the install state has them + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("Dashboard", stateOf(dashboardId, "use-existing"))); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + when(entityService.fetchEntity(any(), any())).thenReturn(Optional.of(dashboard(9L))); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(keep("AM308", "DEVICE", deviceId))); + + assertThat(result.isSuccess()).isTrue(); + assertThat(((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).getUsedExistingEntityIds()).containsExactly(dashboardId); + } + + @Test + void keptIntegration_getsTheStepsMetadataEntries() { + // Taken as it was at install: other packages' entries stay, the step's are merged, a null one is removed + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("TTN", stateOf(integrationId, "use-existing"))); + Integration current = new Integration(); + current.setId(integrationId); + current.setTenantId(tenantId); + current.setName("TTN my-app"); + ObjectNode configuration = JacksonUtil.newObjectNode(); + configuration.set("metadata", JacksonUtil.newObjectNode().put("profile.other-model", "Other").put("profile.milesight-iot-am308", "AM308")); + current.setConfiguration(configuration); + when(integrationService.findIntegrationById(tenantId, integrationId)).thenReturn(current); + when(integrationService.saveIntegration(any())).thenAnswer(i -> i.getArgument(0)); + DeviceUpdateRequest.Step step = keep("TTN", "INTEGRATION", integrationId); + step.setResolution("use-existing"); + ObjectNode entries = JacksonUtil.newObjectNode().put("profile.lansitec-badge", "Badge"); + entries.putNull("profile.milesight-iot-am308"); + step.setMetadata(entries); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isTrue(); + ArgumentCaptor saved = ArgumentCaptor.forClass(Integration.class); + verify(integrationService).saveIntegration(saved.capture()); + JsonNode metadata = saved.getValue().getConfiguration().get("metadata"); + assertThat(metadata.get("profile.other-model").asText()).isEqualTo("Other"); + assertThat(metadata.get("profile.lansitec-badge").asText()).isEqualTo("Badge"); + assertThat(metadata.has("profile.milesight-iot-am308")).isFalse(); + // A copy is saved: the integration read, possibly the cache's own instance, stays as it is until the commit + assertThat(saved.getValue()).isNotSameAs(current); + assertThat(current.getConfiguration().get("metadata").has("profile.lansitec-badge")).isFalse(); + JsonNode state = ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).getInstallState().get("TTN"); + assertThat(state.get("resolution").asText()).isEqualTo("use-existing"); + // The entries the step added, which a delete of the package removes; not the one it removed + assertThat(state.get("metadata")).isEqualTo(JacksonUtil.newObjectNode().put("profile.lansitec-badge", "Badge")); + } + + @Test + void integrationOfAStepAVersionDropped_keepsItsMetadataEntries() { + // Taken as it was at install with the package's entries; the new version has no step for it + ObjectNode installed = stateOf(integrationId, "use-existing"); + installed.set("metadata", JacksonUtil.newObjectNode().put("profile.milesight-iot-am308", "AM308")); + ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).setInstallState(Map.of("TTN", installed)); + Integration integration = new Integration(); + integration.setId(integrationId); + when(entityService.fetchEntity(tenantId, integrationId)).thenReturn(Optional.of(integration)); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(keep("AM308", "DEVICE", deviceId))); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + assertThat(descriptor.getCreatedEntityIds()).contains(integrationId); + // A later delete that keeps the integration removes these entries + assertThat(descriptor.getInstallState().get("TTN").get("metadata")) + .isEqualTo(JacksonUtil.newObjectNode().put("profile.milesight-iot-am308", "AM308")); + } + + @Test + void integrationUsedByAStepNewToThePackage_isListedAsUsedAsItWas() { + // The installed version has no integration step; the new one takes the tenant's integration as it is + DeviceInstalledItemDescriptor installed = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + installed.setCreatedEntityIds(List.of(profileId, deviceId, dashboardId)); + installed.setInstallState(Map.of("Profile", stateOf(profileId, "created"), "AM308", stateOf(deviceId, "created"), + "Dashboard", stateOf(dashboardId, "created"))); + IntegrationId tenantsIntegrationId = new IntegrationId(UUID.randomUUID()); + Integration current = new Integration(); + current.setId(tenantsIntegrationId); + current.setTenantId(tenantId); + current.setName("TTN my-app"); + ObjectNode configuration = JacksonUtil.newObjectNode(); + configuration.set("metadata", JacksonUtil.newObjectNode().put("profile.other-model", "Other")); + current.setConfiguration(configuration); + when(integrationService.findIntegrationById(tenantId, tenantsIntegrationId)).thenReturn(current); + when(integrationService.saveIntegration(any())).thenAnswer(i -> i.getArgument(0)); + DeviceUpdateRequest.Step step = keep("TTN", "INTEGRATION", tenantsIntegrationId); + step.setResolution("use-existing"); + step.setMetadata(JacksonUtil.newObjectNode().put("profile.milesight-iot-am308", "AM308")); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isTrue(); + DeviceInstalledItemDescriptor descriptor = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + // A delete walks createdEntityIds and keeps what usedExistingEntityIds lists, removing only the package's + // entries from it (DefaultIotHubServiceTest#deleteInstalledItem_devicePackage_removesItsMetadataEntriesFromTheIntegrationItTookAsItWas) + assertThat(descriptor.getCreatedEntityIds()).containsOnlyOnce(tenantsIntegrationId); + assertThat(descriptor.getUsedExistingEntityIds()).containsExactly(tenantsIntegrationId); + JsonNode state = descriptor.getInstallState().get("TTN"); + assertThat(state.get("resolution").asText()).isEqualTo("use-existing"); + assertThat(state.get("metadata")).isEqualTo(JacksonUtil.newObjectNode().put("profile.milesight-iot-am308", "AM308")); + } + + @Test + void keptIntegrationWithTheEntriesItHas_isNotSaved() { + Integration current = new Integration(); + current.setId(integrationId); + current.setTenantId(tenantId); + current.setName("TTN my-app"); + ObjectNode configuration = JacksonUtil.newObjectNode(); + configuration.set("metadata", JacksonUtil.newObjectNode().put("profile.lansitec-badge", "Badge")); + current.setConfiguration(configuration); + when(integrationService.findIntegrationById(tenantId, integrationId)).thenReturn(current); + DeviceUpdateRequest.Step step = keep("TTN", "INTEGRATION", integrationId); + step.setMetadata(JacksonUtil.newObjectNode().put("profile.lansitec-badge", "Badge")); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isTrue(); + verify(integrationService, never()).saveIntegration(any()); + } + + @Test + void twoStepsWithOneKey_areRejected() { + DeviceUpdateRequest.Step first = keep("Overview", "DASHBOARD", dashboardId); + first.setId("main-dashboard"); + DeviceUpdateRequest.Step second = keep("Details", "DASHBOARD", dashboardId); + second.setId("main-dashboard"); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(first, second)); + + assertThat(result.isSuccess()).isFalse(); + verify(installedItemService, never()).save(any(), any()); + } + + @Test + void failedStep_rollsBackAndReportsTheStep() { + when(deviceProfileService.findDeviceProfileById(tenantId, profileId)).thenReturn(profile(3L, "AM308")); + when(deviceProfileService.saveDeviceProfile(any())).thenAnswer(i -> i.getArgument(0)); + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(7L)); + when(dashboardService.saveDashboard(any(Dashboard.class))).thenThrow(new DataValidationException("Dashboards limit reached")); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + overwrite("AM308 profile", "DEVICE_PROFILE", profileId, 3L, JacksonUtil.newObjectNode().put("name", "p")), + overwrite("Dashboard", "DASHBOARD", dashboardId, 7L, JacksonUtil.newObjectNode().put("title", "d")))); + + assertThat(result.isSuccess()).isFalse(); + assertThat(result.getFailedStep()).isEqualTo("Dashboard"); + assertThat(result.getErrorMessage()).isEqualTo("Dashboards limit reached"); + assertThat(rolledBack).hasSize(1); + verify(installedItemService, never()).save(any(), any()); + verifyNoInteractions(logEntityActionService); + assertThat(installedItem.getVersion()).isEqualTo("1.0.0"); + } + + @Test + void entityChangedSinceTheCheck_isAVersionConflict() { + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(8L)); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + overwrite("Dashboard", "DASHBOARD", dashboardId, 7L, JacksonUtil.newObjectNode().put("title", "d")))); + + assertThat(result.isSuccess()).isFalse(); + assertThat(result.getFailedStep()).isEqualTo("Dashboard"); + assertThat(result.getErrorMessage()).contains("Check the update again"); + verify(dashboardService, never()).saveDashboard(any(Dashboard.class)); + } + + @Test + void integrationGetsTheIdOfTheConverterCreatedInTheSameUpdate() throws Exception { + ConverterId converterId = new ConverterId(UUID.randomUUID()); + when(converterService.saveConverter(any())).thenAnswer(i -> { + Converter converter = i.getArgument(0); + converter.setId(converterId); + return converter; + }); + Integration current = new Integration(); + current.setId(integrationId); + current.setTenantId(tenantId); + current.setName("TTN my-app"); + current.setRoutingKey("routing-key"); + current.setVersion(2L); + when(integrationService.findIntegrationById(tenantId, integrationId)).thenReturn(current); + when(integrationService.saveIntegration(any())).thenAnswer(i -> i.getArgument(0)); + ObjectNode integration = JacksonUtil.newObjectNode().put("name", "Template name").put("type", "TTN").put("edgeTemplate", true); + integration.set("defaultConverterId", JacksonUtil.newObjectNode().put("entityType", "CONVERTER").put("id", "${uplinkConverter.id}")); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + create("Uplink", "UPLINK_CONVERTER", JacksonUtil.newObjectNode().put("name", "Uplink for TTN")), + overwrite("TTN", "INTEGRATION", integrationId, 2L, integration))); + + assertThat(result.isSuccess()).isTrue(); + ArgumentCaptor saved = ArgumentCaptor.forClass(Integration.class); + verify(integrationService).saveIntegration(saved.capture()); + assertThat(saved.getValue().getDefaultConverterId()).isEqualTo(converterId); + // The devices keep sending to the same endpoint + assertThat(saved.getValue().getRoutingKey()).isEqualTo("routing-key"); + assertThat(saved.getValue().getName()).isEqualTo("TTN my-app"); + assertThat(result.getOutputs().get("TTN").get("routingKey").asText()).isEqualTo("routing-key"); + } + + @Test + void overwrittenSharedConverter_isRecordedAsDefaultAndOnlyThePackagesOwnRowIsWritten() { + ConverterId converterId = new ConverterId(UUID.randomUUID()); + Converter current = new Converter(converterId); + current.setTenantId(tenantId); + current.setName("Uplink data converter for TTN my-app"); + current.setVersion(4L); + when(converterService.findConverterById(tenantId, converterId)).thenReturn(current); + when(converterService.saveConverter(any())).thenAnswer(i -> i.getArgument(0)); + // The package that created the converter records its checksum; one that took it as it was records none + ObjectNode created = JacksonUtil.newObjectNode().put("checksum", "before").put("resolution", "created"); + created.set("entityOutput", JacksonUtil.newObjectNode().put("id", converterId.getId().toString())); + ObjectNode usedExisting = JacksonUtil.newObjectNode().put("resolution", "use-existing"); + usedExisting.set("entityOutput", JacksonUtil.newObjectNode().put("id", converterId.getId().toString())); + IotHubInstalledItem creator = otherPackage(Map.of("Uplink", created)); + IotHubInstalledItem taker = otherPackage(Map.of("Uplink", usedExisting)); + when(installedItemService.findByTenantId(any(), any(), any(), any())) + .thenReturn(new PageData<>(List.of(installedItem, creator, taker), 1, 3, false)); + DeviceUpdateRequest.Step step = overwrite("Uplink", "UPLINK_CONVERTER", converterId, 4L, + JacksonUtil.newObjectNode().put("name", "Uplink").set("configuration", JacksonUtil.newObjectNode().put("tbelDecoder", "return {};"))); + step.setConfirmed(true); + step.setDefaultConverter(true); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(step)); + + assertThat(result.isSuccess()).isTrue(); + JsonNode state = ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).getInstallState().get("Uplink"); + assertThat(state.get("defaultConverter").asBoolean()).isTrue(); + // The other packages keep what they recorded: check() takes the checksum of any installed package + assertThat(created.get("checksum").asText()).isEqualTo("before"); + verify(installedItemService, never()).save(tenantId, creator); + verify(installedItemService, never()).save(tenantId, taker); + } + + @Test + void updateOfTheInstalledVersion_keepsTheInstallStateOfTheStepsItLeavesOut() { + ConverterId converterId = new ConverterId(UUID.randomUUID()); + Converter current = new Converter(converterId); + current.setTenantId(tenantId); + current.setName("Uplink data converter for TTN my-app"); + current.setVersion(4L); + when(converterService.findConverterById(tenantId, converterId)).thenReturn(current); + when(converterService.saveConverter(any())).thenAnswer(i -> i.getArgument(0)); + DeviceInstalledItemDescriptor installed = (DeviceInstalledItemDescriptor) installedItem.getDescriptor(); + installed.setCreatedEntityIds(List.of(profileId, deviceId, dashboardId, integrationId, converterId)); + installed.setInstallState(Map.of("Integration", stateOf(integrationId, "created"), "uplink", stateOf(converterId, "created"), + "Configuration", JacksonUtil.newObjectNode().set("formValues", JacksonUtil.newObjectNode().put("profileName", "am308")))); + ObjectNode versionInfo = JacksonUtil.newObjectNode().put("itemId", itemId.toString()).put("name", "AM308").put("version", "1.0.0"); + when(iotHubRestClient.getVersionInfo(installedVersionId.toString())).thenReturn(versionInfo); + // ThingsBoard's default converter changed: only the converter step is sent + DeviceUpdateRequest.Step step = overwrite("Uplink data converter", "UPLINK_CONVERTER", converterId, 4L, + JacksonUtil.newObjectNode().put("name", "Uplink").set("configuration", JacksonUtil.newObjectNode().put("tbelDecoder", "return {};"))); + step.setId("uplink"); + step.setDefaultConverter(true); + DeviceUpdateRequest request = request(step); + request.setVersionId(installedVersionId.toString()); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request); + + assertThat(result.isSuccess()).isTrue(); + Map state = ((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).getInstallState(); + ArgumentCaptor saved = ArgumentCaptor.forClass(Converter.class); + verify(converterService).saveConverter(saved.capture()); + assertThat(state.get("uplink").get("checksum").asText()).isEqualTo(EntityChecksum.of(saved.getValue())); + assertThat(state.get("uplink").get("defaultConverter").asBoolean()).isTrue(); + assertThat(state.get("Integration")).isEqualTo(stateOf(integrationId, "created")); + assertThat(state.get("Configuration").get("formValues").get("profileName").asText()).isEqualTo("am308"); + verify(integrationService, never()).saveIntegration(any()); + assertThat(installedItem.getItemVersionId()).isEqualTo(installedVersionId); + } + + @Test + void updateToAnotherVersion_dropsTheInstallStateOfTheStepsItLeavesOut() { + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(9L)); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(keep("Dashboard", "DASHBOARD", dashboardId))); + + assertThat(result.isSuccess()).isTrue(); + assertThat(((DeviceInstalledItemDescriptor) installedItem.getDescriptor()).getInstallState()).containsOnlyKeys("Dashboard"); + } + + @Test + void overwritingAnEntityOfAnotherPackage_needsAConfirmation() { + DashboardId foreign = new DashboardId(UUID.randomUUID()); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + overwrite("Dashboard", "DASHBOARD", foreign, 1L, JacksonUtil.newObjectNode().put("title", "d")))); + + assertThat(result.isSuccess()).isFalse(); + verify(transactionTemplate, never()).execute(any()); + } + + @Test + void theDeviceIsNeverOverwritten() { + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + overwrite("AM308", "DEVICE", deviceId, 1L, JacksonUtil.newObjectNode().put("name", "d")))); + + assertThat(result.isSuccess()).isFalse(); + assertThat(result.getErrorMessage()).isEqualTo("The device and its credentials don't change on update"); + verify(transactionTemplate, never()).execute(any()); + } + + @Test + void versionOfAnotherItem_isRejected() { + ObjectNode other = JacksonUtil.newObjectNode().put("itemId", UUID.randomUUID().toString()); + when(iotHubRestClient.getVersionInfo(versionId)).thenReturn(other); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(keep("AM308", "DEVICE", deviceId))); + + assertThat(result.isSuccess()).isFalse(); + verify(transactionTemplate, never()).execute(any()); + } + + @Test + void anotherUpdateCommittedMeanwhile_failsWithoutChanges() { + // E.g. a second click: it waits for the first one's lock and finds the package on another version + IotHubInstalledItem updated = new IotHubInstalledItem(); + updated.setId(installedItem.getId()); + updated.setItemVersionId(UUID.fromString(versionId)); + when(installedItemService.findByIdForUpdate(tenantId, installedItem.getId())).thenReturn(updated); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + create("Uplink", "UPLINK_CONVERTER", JacksonUtil.newObjectNode().put("name", "Uplink for TTN")))); + + assertThat(result.isSuccess()).isFalse(); + assertThat(result.getErrorMessage()).contains("Check the update again"); + verify(converterService, never()).saveConverter(any()); + verify(installedItemService, never()).save(any(), any()); + } + + @Test + void planOfAnotherInstalledVersion_isRejected() { + DeviceUpdateRequest request = request(keep("AM308", "DEVICE", deviceId)); + request.setFromVersionId(UUID.randomUUID()); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request); + + assertThat(result.isSuccess()).isFalse(); + verify(installedItemService, never()).save(any(), any()); + } + + @Test + void integrationsNotInThePlan_areRefused() { + doThrow(new SubscriptionException("Integrations feature is disabled!", SubscriptionErrorCode.FEATURE_DISABLED)) + .when(subscriptionService).checkFeatureAllowed(tenantId, PlatformFeature.INTEGRATIONS); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request( + create("Uplink", "UPLINK_CONVERTER", JacksonUtil.newObjectNode().put("name", "Uplink for TTN")))); + + assertThat(result.isSuccess()).isFalse(); + assertThat(result.getErrorMessage()).isEqualTo("Integrations feature is disabled!"); + verify(transactionTemplate, never()).execute(any()); + } + + @Test + void attributesOfAnOverwrittenEntity_areSavedAfterCommit() { + when(dashboardService.findDashboardById(tenantId, dashboardId)).thenReturn(dashboard(7L)); + when(dashboardService.saveDashboard(any(Dashboard.class))).thenAnswer(i -> i.getArgument(0)); + DeviceUpdateRequest.Step step = overwrite("Dashboard", "DASHBOARD", dashboardId, 7L, JacksonUtil.newObjectNode().put("title", "d")); + step.setServerAttributes(JacksonUtil.newObjectNode().put("deviceId", "${device.id}")); + + DeviceUpdateResult result = service.apply(user, installedItem.getId(), request(keep("AM308", "DEVICE", deviceId), step)); + + assertThat(result.isSuccess()).isTrue(); + ArgumentCaptor saved = ArgumentCaptor.forClass(AttributesSaveRequest.class); + verify(telemetryService).saveAttributes(saved.capture()); + assertThat(saved.getValue().getEntityId()).isEqualTo(dashboardId); + assertThat(saved.getValue().getScope()).isEqualTo(AttributeScope.SERVER_SCOPE); + assertThat(saved.getValue().getEntries().get(0).getValueAsString()).isEqualTo(deviceId.getId().toString()); + } + + @Test + void checksum_ignoresDebugSettingsAndTheDefaultProfile() { + Converter converter = new Converter(); + converter.setName("Uplink"); + converter.setConfiguration(JacksonUtil.newObjectNode().put("decoder", "return {};")); + String installed = EntityChecksum.of(converter); + converter.setDebugMode(true); + converter.setDebugSettings(DebugSettings.all()); + assertThat(EntityChecksum.of(converter)).isEqualTo(installed); + converter.setConfiguration(JacksonUtil.newObjectNode().put("decoder", "return {a: 1};")); + assertThat(EntityChecksum.of(converter)).isNotEqualTo(installed); + + DeviceProfile profile = profile(1L, "AM308"); + String profileChecksum = EntityChecksum.of(profile); + profile.setDefault(true); + assertThat(EntityChecksum.of(profile)).isEqualTo(profileChecksum); + } + + @Test + void checksum_ignoresTheMetadataOfAnIntegration() { + Integration integration = new Integration(); + integration.setName("TTN my-app"); + ObjectNode configuration = JacksonUtil.newObjectNode().put("host", "eu1.cloud.thethings.network"); + configuration.set("metadata", JacksonUtil.newObjectNode()); + integration.setConfiguration(configuration); + String installed = EntityChecksum.of(integration); + // Another package on the integration adds its profile name + ((ObjectNode) configuration.get("metadata")).put("profile.milesight-iot-am308", "AM308"); + assertThat(EntityChecksum.of(integration)).isEqualTo(installed); + assertThat(integration.getConfiguration().get("metadata").has("profile.milesight-iot-am308")).isTrue(); + configuration.put("host", "nam1.cloud.thethings.network"); + assertThat(EntityChecksum.of(integration)).isNotEqualTo(installed); + } + + @Test + void userMessage_showsValidationMessagesAndHidesInternalOnes() { + assertThat(DefaultDevicePackageUpdateService.userMessage(new DataValidationException("Rule chains limit reached"))) + .isEqualTo("Rule chains limit reached"); + assertThat(DefaultDevicePackageUpdateService.userMessage(new EntityVersionMismatchException(EntityType.DASHBOARD, null))) + .contains("Check the update again"); + assertThat(DefaultDevicePackageUpdateService.userMessage(new IllegalStateException("could not execute statement; SQL [n/a]"))) + .isEqualTo("Failed to update the device package"); + } + + @Test + void resolvePlaceholders_leavesUnknownAliasesAsTheyAre() { + ObjectNode device = JacksonUtil.newObjectNode().put("id", "123"); + ObjectNode node = JacksonUtil.newObjectNode().put("a", "${device.id}").put("b", "x ${device.id} ${gateway.id}"); + + ObjectNode resolved = (ObjectNode) DefaultDevicePackageUpdateService.resolvePlaceholders(node, Map.of("device", device)); + + assertThat(resolved.get("a").asText()).isEqualTo("123"); + assertThat(resolved.get("b").asText()).isEqualTo("x 123 ${gateway.id}"); + } + + private IotHubInstalledItem otherPackage(Map installState) { + DeviceInstalledItemDescriptor descriptor = new DeviceInstalledItemDescriptor(); + descriptor.setInstallState(installState); + IotHubInstalledItem item = new IotHubInstalledItem(); + item.setId(new IotHubInstalledItemId(UUID.randomUUID())); + item.setTenantId(tenantId); + item.setItemType("DEVICE"); + item.setDescriptor(descriptor); + return item; + } + + private DeviceProfile profile(Long version, String name) { + DeviceProfile profile = new DeviceProfile(profileId); + profile.setTenantId(tenantId); + profile.setName(name); + profile.setVersion(version); + return profile; + } + + private Dashboard dashboard(Long version) { + Dashboard dashboard = new Dashboard(dashboardId); + dashboard.setTenantId(tenantId); + dashboard.setTitle("AM308 dashboard"); + dashboard.setVersion(version); + return dashboard; + } + + private DeviceUpdateRequest request(DeviceUpdateRequest.Step... steps) { + DeviceUpdateRequest request = new DeviceUpdateRequest(); + request.setVersionId(versionId); + request.setSteps(List.of(steps)); + return request; + } + + private static DeviceUpdateRequest.Step keep(String name, String type, EntityId id) { + DeviceUpdateRequest.Step step = step(name, type, DeviceUpdateRequest.Action.KEEP); + step.setEntityId(id.getId()); + return step; + } + + private static DeviceUpdateRequest.Step overwrite(String name, String type, EntityId id, Long version, ObjectNode entity) { + DeviceUpdateRequest.Step step = step(name, type, DeviceUpdateRequest.Action.OVERWRITE); + step.setEntityId(id.getId()); + step.setExpectedVersion(version); + step.setEntity(entity); + return step; + } + + private static DeviceUpdateRequest.Step create(String name, String type, ObjectNode entity) { + DeviceUpdateRequest.Step step = step(name, type, DeviceUpdateRequest.Action.CREATE); + step.setEntity(entity); + return step; + } + + private static DeviceUpdateRequest.Step step(String name, String type, DeviceUpdateRequest.Action action) { + DeviceUpdateRequest.Step step = new DeviceUpdateRequest.Step(); + step.setName(name); + step.setType(type); + step.setAction(action); + return step; + } + + + private static ObjectNode stateOf(EntityId id, String resolution) { + ObjectNode state = JacksonUtil.newObjectNode().put("resolution", resolution); + state.set("entityOutput", JacksonUtil.newObjectNode().put("id", id.getId().toString())); + return state; + } + +} diff --git a/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java index 2f1a0ada5b..d63be65c5c 100644 --- a/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.service.iot_hub; import com.fasterxml.jackson.databind.JsonNode; @@ -7,20 +8,46 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.servlet.http.HttpServletRequest; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; import org.mockito.InOrder; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.jupiter.MockitoExtension; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.Device; +import org.thingsboard.server.common.data.id.DashboardId; +import org.thingsboard.server.common.data.id.DeviceId; +import org.thingsboard.server.common.data.id.DeviceProfileId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.IntegrationId; import org.thingsboard.server.common.data.id.IotHubInstalledItemId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; +import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor; import org.thingsboard.server.common.data.iot_hub.IotHubInstalledItem; import org.thingsboard.server.common.data.iot_hub.RuleChainInstalledItemDescriptor; +import org.thingsboard.server.common.data.Dashboard; +import org.thingsboard.server.common.data.DeviceProfile; +import org.thingsboard.server.common.data.converter.Converter; +import org.thingsboard.server.common.data.id.ConverterId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.dao.dashboard.DashboardService; +import org.thingsboard.server.dao.converter.ConverterService; +import org.thingsboard.server.dao.device.DeviceProfileService; +import org.thingsboard.server.dao.device.DeviceService; +import org.thingsboard.server.dao.entity.EntityService; +import org.thingsboard.server.dao.integration.IntegrationService; import org.thingsboard.server.dao.iot_hub.IotHubInstalledItemService; +import org.thingsboard.server.service.entitiy.dashboard.TbDashboardService; +import org.thingsboard.server.service.entitiy.converter.TbConverterService; +import org.thingsboard.server.service.entitiy.device.TbDeviceService; +import org.thingsboard.server.service.entitiy.device.profile.TbDeviceProfileService; import org.thingsboard.server.service.security.model.SecurityUser; import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; @@ -48,6 +75,26 @@ class DefaultIotHubServiceTest { private IotHubRestClient iotHubRestClient; @Mock private IotHubInstalledItemService iotHubInstalledItemService; + @Mock + private DeviceService deviceService; + @Mock + private EntityService entityService; + @Mock + private TbDeviceService tbDeviceService; + @Mock + private DashboardService dashboardService; + @Mock + private TbDashboardService tbDashboardService; + @Mock + private IntegrationService integrationService; + @Mock + private DeviceProfileService deviceProfileService; + @Mock + private TbDeviceProfileService tbDeviceProfileService; + @Mock + private ConverterService converterService; + @Mock + private TbConverterService tbConverterService; @Spy @InjectMocks @@ -411,4 +458,258 @@ class DefaultIotHubServiceTest { assertThat(result.isRolledBack()).isFalse(); assertThat(result.getErrorMessage()).contains("install failed"); } + + @Test + void deleteInstalledItem_devicePackage_removesEachEntityBeforeWhatItRefersTo() throws Exception { + mockTenant(); + DeviceProfile profile = new DeviceProfile(new DeviceProfileId(UUID.randomUUID())); + Dashboard dashboard = new Dashboard(new DashboardId(UUID.randomUUID())); + profile.setDefaultDashboardId(dashboard.getId()); + Integration integration = new Integration(new IntegrationId(UUID.randomUUID())); + Converter converter = new Converter(new ConverterId(UUID.randomUUID())); + // The profile and the integration listed first: in reverse order of creation, the dashboard would go before the + // profile that refers to it, and the converter before the integration that uses it. + IotHubInstalledItem deleted = devicePackage(profile.getId(), dashboard.getId(), integration.getId(), converter.getId()); + when(iotHubInstalledItemService.findById(tenantId, deleted.getId())).thenReturn(deleted); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(deleted), 1, 1, false)); + when(deviceProfileService.findDeviceProfileById(tenantId, profile.getId())).thenReturn(profile); + when(dashboardService.findDashboardById(tenantId, dashboard.getId())).thenReturn(dashboard); + when(integrationService.findIntegrationById(tenantId, integration.getId())).thenReturn(integration); + when(converterService.findConverterById(tenantId, converter.getId())).thenReturn(converter); + + service.deleteInstalledItem(user, deleted.getId()); + + InOrder order = inOrder(tbDeviceProfileService, tbDashboardService, integrationService, tbConverterService); + order.verify(tbDeviceProfileService).delete(profile, user); + order.verify(tbDashboardService).delete(dashboard, user); + order.verify(integrationService).deleteIntegration(tenantId, integration.getId()); + order.verify(tbConverterService).delete(converter, user); + } + + @Test + void deleteInstalledItem_devicePackage_keepsEntitiesAnotherDevicePackageUses() { + mockTenant(); + DeviceId deviceId = new DeviceId(UUID.randomUUID()); + DashboardId sharedDashboardId = new DashboardId(UUID.randomUUID()); + IotHubInstalledItem deleted = devicePackage(deviceId, sharedDashboardId); + IotHubInstalledItem other = devicePackage(sharedDashboardId); + other.setItemName("Other package"); + when(iotHubInstalledItemService.findById(tenantId, deleted.getId())).thenReturn(deleted); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(deleted, other), 1, 2, false)); + Device device = new Device(deviceId); + when(deviceService.findDeviceById(tenantId, deviceId)).thenReturn(device); + + service.deleteInstalledItem(user, deleted.getId()); + + verify(tbDeviceService).delete(device, user); + verify(dashboardService, never()).findDashboardById(any(), any()); + verify(tbDashboardService, never()).delete(any(), any()); + verify(iotHubInstalledItemService).deleteById(tenantId, deleted.getId()); + } + + @Test + void deleteInstalledItem_devicePackage_removesItsMetadataEntriesFromTheKeptIntegration() { + mockTenant(); + IntegrationId integrationId = new IntegrationId(UUID.randomUUID()); + IotHubInstalledItem deleted = devicePackage(integrationId); + setIntegrationState(deleted, integrationId, Map.of("profile.milesight-iot-am308", "am308-custom")); + IotHubInstalledItem other = devicePackage(integrationId); + setIntegrationState(other, integrationId, Map.of("profile.lansitec-badge", "Badge")); + when(iotHubInstalledItemService.findById(tenantId, deleted.getId())).thenReturn(deleted); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(deleted, other), 1, 2, false)); + Integration current = integration(integrationId, Map.of("profile.milesight-iot-am308", "am308-custom", + "profile.lansitec-badge", "Badge", "profile.added-by-user", "Mine")); + when(integrationService.findIntegrationById(tenantId, integrationId)).thenReturn(current); + + service.deleteInstalledItem(user, deleted.getId()); + + ArgumentCaptor saved = ArgumentCaptor.forClass(Integration.class); + verify(integrationService).saveIntegration(saved.capture()); + verify(integrationService, never()).deleteIntegration(any(), any()); + JsonNode metadata = saved.getValue().getConfiguration().get("metadata"); + assertThat(metadata.has("profile.milesight-iot-am308")).isFalse(); + assertThat(metadata.get("profile.lansitec-badge").asText()).isEqualTo("Badge"); + assertThat(metadata.get("profile.added-by-user").asText()).isEqualTo("Mine"); + // A copy is saved: the integration read may be the cache's own instance + assertThat(current.getConfiguration().get("metadata").has("profile.milesight-iot-am308")).isTrue(); + } + + @Test + void deleteInstalledItem_devicePackage_keepsTheMetadataEntryAnotherPackageAddedToo() { + mockTenant(); + IntegrationId integrationId = new IntegrationId(UUID.randomUUID()); + IotHubInstalledItem deleted = devicePackage(integrationId); + setIntegrationState(deleted, integrationId, Map.of("profile.milesight-iot-am308", "am308-custom")); + IotHubInstalledItem other = devicePackage(integrationId); + setIntegrationState(other, integrationId, Map.of("profile.milesight-iot-am308", "am308-custom")); + when(iotHubInstalledItemService.findById(tenantId, deleted.getId())).thenReturn(deleted); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(deleted, other), 1, 2, false)); + + service.deleteInstalledItem(user, deleted.getId()); + + // Nothing is left to remove once the other package's entry is subtracted: the integration isn't even read + verify(integrationService, never()).findIntegrationById(any(), any()); + verify(integrationService, never()).saveIntegration(any()); + verify(integrationService, never()).deleteIntegration(any(), any()); + } + + @Test + void deleteInstalledItem_devicePackage_removesItsMetadataEntriesFromTheIntegrationItTookAsItWas() { + mockTenant(); + IntegrationId integrationId = new IntegrationId(UUID.randomUUID()); + IotHubInstalledItem deleted = devicePackage(integrationId); + setIntegrationState(deleted, integrationId, Map.of("profile.milesight-iot-am308", "am308-custom")); + ((DeviceInstalledItemDescriptor) deleted.getDescriptor()).setUsedExistingEntityIds(List.of(integrationId)); + when(iotHubInstalledItemService.findById(tenantId, deleted.getId())).thenReturn(deleted); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(deleted), 1, 1, false)); + when(integrationService.findIntegrationById(tenantId, integrationId)) + .thenReturn(integration(integrationId, Map.of("profile.milesight-iot-am308", "am308-custom", "profile.added-by-user", "Mine"))); + + service.deleteInstalledItem(user, deleted.getId()); + + ArgumentCaptor saved = ArgumentCaptor.forClass(Integration.class); + verify(integrationService).saveIntegration(saved.capture()); + verify(integrationService, never()).deleteIntegration(any(), any()); + JsonNode metadata = saved.getValue().getConfiguration().get("metadata"); + assertThat(metadata.has("profile.milesight-iot-am308")).isFalse(); + assertThat(metadata.get("profile.added-by-user").asText()).isEqualTo("Mine"); + } + + @Test + void deleteInstalledItem_devicePackage_leavesTheKeptIntegrationWithoutItsEntriesAsItIs() { + mockTenant(); + IntegrationId integrationId = new IntegrationId(UUID.randomUUID()); + IotHubInstalledItem deleted = devicePackage(integrationId); + setIntegrationState(deleted, integrationId, Map.of("profile.milesight-iot-am308", "am308-custom")); + ((DeviceInstalledItemDescriptor) deleted.getDescriptor()).setUsedExistingEntityIds(List.of(integrationId)); + when(iotHubInstalledItemService.findById(tenantId, deleted.getId())).thenReturn(deleted); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(deleted), 1, 1, false)); + when(integrationService.findIntegrationById(tenantId, integrationId)) + .thenReturn(integration(integrationId, Map.of("profile.lansitec-badge", "Badge"))); + + service.deleteInstalledItem(user, deleted.getId()); + + verify(integrationService, never()).saveIntegration(any()); + verify(integrationService, never()).deleteIntegration(any(), any()); + } + + @Test + void findKeptEntities_devicePackage_namesTheSharedEntitiesAndCountsTheOtherPackages() { + DeviceId deviceId = new DeviceId(UUID.randomUUID()); + DashboardId sharedDashboardId = new DashboardId(UUID.randomUUID()); + DeviceProfileId sharedProfileId = new DeviceProfileId(UUID.randomUUID()); + IotHubInstalledItem checked = devicePackage(sharedProfileId, deviceId, sharedDashboardId); + IotHubInstalledItem first = devicePackage(sharedProfileId, sharedDashboardId); + IotHubInstalledItem second = devicePackage(sharedDashboardId); + IotHubInstalledItem unrelated = devicePackage(new DeviceId(UUID.randomUUID())); + when(iotHubInstalledItemService.findById(tenantId, checked.getId())).thenReturn(checked); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(checked, first, second, unrelated), 1, 4, false)); + when(entityService.fetchEntityName(tenantId, sharedProfileId)).thenReturn(Optional.of("Shared profile")); + when(entityService.fetchEntityName(tenantId, sharedDashboardId)).thenReturn(Optional.of("Shared dashboard")); + + InstalledItemKeptEntities kept = service.findKeptEntities(tenantId, checked.getId()); + + assertThat(kept.getEntities()).containsExactly( + new InstalledItemKeptEntities.KeptEntity(sharedProfileId, "Shared profile"), + new InstalledItemKeptEntities.KeptEntity(sharedDashboardId, "Shared dashboard")); + assertThat(kept.getUsedByItemsCount()).isEqualTo(2); + } + + @Test + void deleteInstalledItem_devicePackage_keepsEntitiesTheUserHadBefore() { + mockTenant(); + DeviceId deviceId = new DeviceId(UUID.randomUUID()); + DashboardId usersDashboardId = new DashboardId(UUID.randomUUID()); + IotHubInstalledItem deleted = devicePackage(deviceId, usersDashboardId); + ((DeviceInstalledItemDescriptor) deleted.getDescriptor()).setUsedExistingEntityIds(List.of(usersDashboardId)); + when(iotHubInstalledItemService.findById(tenantId, deleted.getId())).thenReturn(deleted); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(deleted), 1, 1, false)); + Device device = new Device(deviceId); + when(deviceService.findDeviceById(tenantId, deviceId)).thenReturn(device); + + service.deleteInstalledItem(user, deleted.getId()); + + verify(tbDeviceService).delete(device, user); + verify(tbDashboardService, never()).delete(any(), any()); + } + + @Test + void findKeptEntities_devicePackage_namesTheEntitiesTheUserHadBefore() { + DeviceId deviceId = new DeviceId(UUID.randomUUID()); + DashboardId usersDashboardId = new DashboardId(UUID.randomUUID()); + IotHubInstalledItem checked = devicePackage(deviceId, usersDashboardId); + ((DeviceInstalledItemDescriptor) checked.getDescriptor()).setUsedExistingEntityIds(List.of(usersDashboardId)); + when(iotHubInstalledItemService.findById(tenantId, checked.getId())).thenReturn(checked); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(checked), 1, 1, false)); + when(entityService.fetchEntityName(tenantId, usersDashboardId)).thenReturn(Optional.of("My dashboard")); + + InstalledItemKeptEntities kept = service.findKeptEntities(tenantId, checked.getId()); + + assertThat(kept.getEntities()).containsExactly(new InstalledItemKeptEntities.KeptEntity(usersDashboardId, "My dashboard")); + assertThat(kept.getUsedByItemsCount()).isZero(); + assertThat(kept.getUsedExistingCount()).isEqualTo(1); + } + + @Test + void findKeptEntities_devicePackageSharingNothing_keepsNothing() { + IotHubInstalledItem checked = devicePackage(new DeviceId(UUID.randomUUID())); + IotHubInstalledItem other = devicePackage(new DeviceId(UUID.randomUUID())); + when(iotHubInstalledItemService.findById(tenantId, checked.getId())).thenReturn(checked); + when(iotHubInstalledItemService.findByTenantId(eq(tenantId), eq(List.of("DEVICE")), isNull(), any())) + .thenReturn(new PageData<>(List.of(checked, other), 1, 2, false)); + + InstalledItemKeptEntities kept = service.findKeptEntities(tenantId, checked.getId()); + + assertThat(kept.getEntities()).isEmpty(); + assertThat(kept.getUsedByItemsCount()).isZero(); + } + + @Test + void updateItemVersion_devicePackage_deletesNothing() { + mockTenant(); + IotHubInstalledItem installed = devicePackage(new DeviceId(UUID.randomUUID()), new DashboardId(UUID.randomUUID())); + installed.setItemType("DEVICE"); + when(iotHubInstalledItemService.findById(tenantId, installed.getId())).thenReturn(installed); + + UpdateItemVersionResult result = service.updateItemVersion(user, installed.getId(), UUID.randomUUID().toString(), true, null); + + assertThat(result.isSuccess()).isFalse(); + verify(tbDeviceService, never()).delete(any(Device.class), any()); + verify(tbDashboardService, never()).delete(any(), any()); + verify(iotHubInstalledItemService, never()).save(any(), any()); + } + + private void setIntegrationState(IotHubInstalledItem item, IntegrationId integrationId, Map addedMetadata) { + ObjectNode state = JacksonUtil.newObjectNode().put("resolution", "created"); + state.set("entityOutput", JacksonUtil.newObjectNode().put("id", integrationId.getId().toString())); + state.set("metadata", JacksonUtil.valueToTree(addedMetadata)); + ((DeviceInstalledItemDescriptor) item.getDescriptor()).setInstallState(Map.of("TTN", state)); + } + + private Integration integration(IntegrationId id, Map metadata) { + Integration integration = new Integration(id); + integration.setTenantId(tenantId); + ObjectNode configuration = JacksonUtil.newObjectNode(); + configuration.set("metadata", JacksonUtil.valueToTree(metadata)); + integration.setConfiguration(configuration); + return integration; + } + + private IotHubInstalledItem devicePackage(EntityId... createdEntityIds) { + DeviceInstalledItemDescriptor descriptor = new DeviceInstalledItemDescriptor(); + descriptor.setCreatedEntityIds(List.of(createdEntityIds)); + IotHubInstalledItem item = installedItem(UUID.randomUUID()); + item.setDescriptor(descriptor); + return item; + } + } diff --git a/application/src/test/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityServiceTest.java b/application/src/test/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityServiceTest.java index 8ffd947991..9a46775ede 100644 --- a/application/src/test/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/security/system/DefaultSystemSecurityServiceTest.java @@ -8,11 +8,14 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.DisabledException; import org.springframework.security.authentication.LockedException; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.rule.engine.api.MailService; +import org.thingsboard.server.common.data.AdminSettings; import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; @@ -30,6 +33,7 @@ import org.thingsboard.server.service.security.permission.UserPermissionsService import java.util.UUID; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -201,4 +205,51 @@ public class DefaultSystemSecurityServiceTest { verify(mailService).sendAccountLockoutEmail(eq(tenantId), eq(username), eq(notificationEmail), eq(5)); } + @Test + public void resolveBaseUrlTakesRequestUrlWhenDifferentUrlsAreAllowed() { + givenGeneralSettings("https://tb.example.com", false); + + ResolvedBaseUrl baseUrl = systemSecurityService.resolveBaseUrl(tenantId, null, request()); + + assertThat(baseUrl.url()).isEqualTo("http://192.168.1.10:8080"); + assertThat(baseUrl.fromRequest()).isTrue(); + } + + @Test + public void resolveBaseUrlTakesSettingsUrlWhenDifferentUrlsAreProhibited() { + givenGeneralSettings("https://tb.example.com", true); + + ResolvedBaseUrl baseUrl = systemSecurityService.resolveBaseUrl(tenantId, null, request()); + + assertThat(baseUrl.url()).isEqualTo("https://tb.example.com"); + assertThat(baseUrl.fromRequest()).isFalse(); + } + + @Test + public void resolveBaseUrlFallsBackToRequestWhenSettingsUrlIsEmpty() { + givenGeneralSettings("", true); + + ResolvedBaseUrl baseUrl = systemSecurityService.resolveBaseUrl(tenantId, null, request()); + + assertThat(baseUrl.url()).isEqualTo("http://192.168.1.10:8080"); + assertThat(baseUrl.fromRequest()).isTrue(); + assertThat(systemSecurityService.getBaseUrl(tenantId, null, request())).isEqualTo(baseUrl.url()); + } + + private void givenGeneralSettings(String baseUrl, boolean prohibitDifferentUrl) { + AdminSettings generalSettings = new AdminSettings(); + generalSettings.setJsonValue(JacksonUtil.newObjectNode() + .put("baseUrl", baseUrl) + .put("prohibitDifferentUrl", prohibitDifferentUrl)); + when(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, "general")).thenReturn(generalSettings); + } + + private static MockHttpServletRequest request() { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setScheme("http"); + request.setServerName("192.168.1.10"); + request.setServerPort(8080); + return request; + } + } diff --git a/application/src/test/java/org/thingsboard/server/service/trendz/TrendzSyncServiceTest.java b/application/src/test/java/org/thingsboard/server/service/trendz/TrendzSyncServiceTest.java index 5ed6c7d49e..50f1ade968 100644 --- a/application/src/test/java/org/thingsboard/server/service/trendz/TrendzSyncServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/trendz/TrendzSyncServiceTest.java @@ -21,6 +21,9 @@ import org.springframework.web.client.RestTemplate; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.pat.ApiKey; +import org.thingsboard.server.common.data.permission.Operation; +import org.thingsboard.server.common.data.permission.Resource; +import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.common.data.trendz.TrendzConfiguration; import org.thingsboard.server.common.data.trendz.TrendzHealthcheckResult; import org.thingsboard.server.common.data.trendz.TrendzSettings; @@ -33,6 +36,8 @@ import org.thingsboard.server.dao.service.DaoSqlTest; import org.thingsboard.server.dao.trendz.TrendzSettingsService; import org.thingsboard.server.service.security.system.SystemSecurityService; +import java.util.Set; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -219,6 +224,10 @@ public class TrendzSyncServiceTest extends AbstractControllerTest { assertNotNull(apiKeyByDescription); assertTrue(apiKeyByDescription.isInternal()); assertEquals(DefaultTrendzSyncService.TRENDZ_API_KEY_DESCRIPTION, apiKeyByDescription.getDescription()); + assertEquals(Set.of(Operation.READ, Operation.INVOKE), + apiKeyByDescription.getPermissions().getPermissionsForAuthority(Authority.TENANT_ADMIN).get(Resource.AI_MODEL)); + assertEquals(Set.of(Operation.INVOKE), + apiKeyByDescription.getPermissions().getPermissionsForAuthority(Authority.CUSTOMER_USER).get(Resource.AI_MODEL)); } @Test diff --git a/application/src/test/resources/converters/AWS_IOT/uplink/test/default/expected.json b/application/src/test/resources/converters/AWS_IOT/uplink/test/default/expected.json new file mode 100644 index 0000000000..0d308ef7a3 --- /dev/null +++ b/application/src/test/resources/converters/AWS_IOT/uplink/test/default/expected.json @@ -0,0 +1,27 @@ +{ + "deviceName": "Production 1 - 3G7H1j-9zF", + "deviceType": "default", + "groupName": "Production", + "attributes": { + "deviceId": "3G7H1j-9zF" + }, + "telemetry": { + "ts": 1686398400000, + "values": { + "temperature": 25.3, + "humidity": 62.8, + "pressure": 1012.5, + "latitude": 37.7749, + "longitude": -122.4194, + "status": "active", + "power_status": "on", + "x": 0.02, + "y": 0.03, + "z": 0.01, + "fault_codes.0": 100, + "fault_codes.1": 204, + "fault_codes.2": 301, + "battery_level": 78.5 + } + } +} diff --git a/application/src/test/resources/converters/AZURE_EVENT_HUB/uplink/test/default/expected.json b/application/src/test/resources/converters/AZURE_EVENT_HUB/uplink/test/default/expected.json new file mode 100644 index 0000000000..1f51c201c3 --- /dev/null +++ b/application/src/test/resources/converters/AZURE_EVENT_HUB/uplink/test/default/expected.json @@ -0,0 +1,34 @@ +{ + "deviceName": "8F4A2C6D", + "deviceType": "Packing machine", + "groupName": "Control room", + "attributes": { + "version": 1, + "manufacturer": "Example corporation" + }, + "telemetry": { + "ts": 1686306600000, + "values": { + "receivedAlarms": [ + { + "type": "temperature", + "severity": "high", + "message": "Temperature exceeds threshold." + }, + { + "type": "vibration", + "severity": "critical", + "message": "Excessive vibration detected." + } + ], + "temperature": 25.5, + "pressure": 1013.25, + "x": 0.02, + "y": 0.03, + "z": 0.015, + "status": "ALARM", + "batteryLevel": 100, + "batteryStatus": "Charging" + } + } +} diff --git a/application/src/test/resources/converters/AZURE_IOT_HUB/uplink/test/default/expected.json b/application/src/test/resources/converters/AZURE_IOT_HUB/uplink/test/default/expected.json new file mode 100644 index 0000000000..1f51c201c3 --- /dev/null +++ b/application/src/test/resources/converters/AZURE_IOT_HUB/uplink/test/default/expected.json @@ -0,0 +1,34 @@ +{ + "deviceName": "8F4A2C6D", + "deviceType": "Packing machine", + "groupName": "Control room", + "attributes": { + "version": 1, + "manufacturer": "Example corporation" + }, + "telemetry": { + "ts": 1686306600000, + "values": { + "receivedAlarms": [ + { + "type": "temperature", + "severity": "high", + "message": "Temperature exceeds threshold." + }, + { + "type": "vibration", + "severity": "critical", + "message": "Excessive vibration detected." + } + ], + "temperature": 25.5, + "pressure": 1013.25, + "x": 0.02, + "y": 0.03, + "z": 0.015, + "status": "ALARM", + "batteryLevel": 100, + "batteryStatus": "Charging" + } + } +} diff --git a/application/src/test/resources/converters/AZURE_SERVICE_BUS/uplink/test/default/expected.json b/application/src/test/resources/converters/AZURE_SERVICE_BUS/uplink/test/default/expected.json new file mode 100644 index 0000000000..1f51c201c3 --- /dev/null +++ b/application/src/test/resources/converters/AZURE_SERVICE_BUS/uplink/test/default/expected.json @@ -0,0 +1,34 @@ +{ + "deviceName": "8F4A2C6D", + "deviceType": "Packing machine", + "groupName": "Control room", + "attributes": { + "version": 1, + "manufacturer": "Example corporation" + }, + "telemetry": { + "ts": 1686306600000, + "values": { + "receivedAlarms": [ + { + "type": "temperature", + "severity": "high", + "message": "Temperature exceeds threshold." + }, + { + "type": "vibration", + "severity": "critical", + "message": "Excessive vibration detected." + } + ], + "temperature": 25.5, + "pressure": 1013.25, + "x": 0.02, + "y": 0.03, + "z": 0.015, + "status": "ALARM", + "batteryLevel": 100, + "batteryStatus": "Charging" + } + } +} diff --git a/application/src/test/resources/converters/CHIRPSTACK/downlink/test/default/expected.json b/application/src/test/resources/converters/CHIRPSTACK/downlink/test/default/expected.json new file mode 100644 index 0000000000..a1b38e3c5c --- /dev/null +++ b/application/src/test/resources/converters/CHIRPSTACK/downlink/test/default/expected.json @@ -0,0 +1,5 @@ +{ + "contentType": "TEXT", + "data": "b24=", + "metadata": {} +} diff --git a/application/src/test/resources/converters/CHIRPSTACK/downlink/test/default/payload.json b/application/src/test/resources/converters/CHIRPSTACK/downlink/test/default/payload.json new file mode 100644 index 0000000000..699fe6a1f1 --- /dev/null +++ b/application/src/test/resources/converters/CHIRPSTACK/downlink/test/default/payload.json @@ -0,0 +1,3 @@ +{ + "powerState": "on" +} diff --git a/application/src/test/resources/converters/CHIRPSTACK/uplink/test/default/configuration.json b/application/src/test/resources/converters/CHIRPSTACK/uplink/test/default/configuration.json new file mode 100644 index 0000000000..93fe69e4f5 --- /dev/null +++ b/application/src/test/resources/converters/CHIRPSTACK/uplink/test/default/configuration.json @@ -0,0 +1,13 @@ +{ + "type": "ASSET", + "name": "Asset $eui", + "label": "", + "profile": "$deviceProfileName", + "customer": "", + "group": "", + "attributes": [ + "eui", + "fPort", + "devAddr" + ] +} diff --git a/application/src/test/resources/converters/CHIRPSTACK/uplink/test/default/expected.json b/application/src/test/resources/converters/CHIRPSTACK/uplink/test/default/expected.json new file mode 100644 index 0000000000..329310d0f6 --- /dev/null +++ b/application/src/test/resources/converters/CHIRPSTACK/uplink/test/default/expected.json @@ -0,0 +1,19 @@ +{ + "entityType": "ASSET", + "name": "Asset 1000000000000001", + "profile": "Chirpstack default device profile", + "telemetry": { + "ts": 1684741625404, + "values": { + "battery": 95, + "temperature": 36.6, + "saturation": 99 + } + }, + "attributes": { + "sn": 32310067, + "devAddr": "20000001", + "fPort": 85, + "eui": "1000000000000001" + } +} diff --git a/application/src/test/resources/converters/KPN/uplink/test/default/expected.json b/application/src/test/resources/converters/KPN/uplink/test/default/expected.json new file mode 100644 index 0000000000..f4a388afdf --- /dev/null +++ b/application/src/test/resources/converters/KPN/uplink/test/default/expected.json @@ -0,0 +1,14 @@ +{ + "deviceName": "Device A", + "deviceType": "thermostat", + "customerName": "customer", + "groupName": "thermostat devices", + "attributes": { + "model": "Model A", + "serialNumber": "SN111" + }, + "telemetry": { + "temperature": 42, + "humidity": 80 + } +} diff --git a/application/src/test/resources/converters/LORIOT/uplink/test/default/configuration.json b/application/src/test/resources/converters/LORIOT/uplink/test/default/configuration.json new file mode 100644 index 0000000000..321fb07878 --- /dev/null +++ b/application/src/test/resources/converters/LORIOT/uplink/test/default/configuration.json @@ -0,0 +1,12 @@ +{ + "type": "DEVICE", + "name": "Device name $eui", + "label": "", + "profile": "Device type", + "customer": "", + "group": "", + "attributes": [ + "eui", + "fPort" + ] +} diff --git a/application/src/test/resources/converters/LORIOT/uplink/test/default/expected.json b/application/src/test/resources/converters/LORIOT/uplink/test/default/expected.json new file mode 100644 index 0000000000..e9459790fc --- /dev/null +++ b/application/src/test/resources/converters/LORIOT/uplink/test/default/expected.json @@ -0,0 +1,18 @@ +{ + "entityType": "DEVICE", + "name": "Device name 1000000000000001", + "profile": "Device type", + "telemetry": { + "ts": 1684478801936, + "values": { + "battery": 95, + "temperature": 36.6, + "saturation": 99 + } + }, + "attributes": { + "sn": 32310067, + "fPort": 85, + "eui": "1000000000000001" + } +} diff --git a/application/src/test/resources/converters/SIGFOX/uplink/test/default/expected.json b/application/src/test/resources/converters/SIGFOX/uplink/test/default/expected.json new file mode 100644 index 0000000000..643cd5f66e --- /dev/null +++ b/application/src/test/resources/converters/SIGFOX/uplink/test/default/expected.json @@ -0,0 +1,25 @@ +{ + "deviceName": "Sigfox-2203961", + "deviceType": "Sigfox device", + "groupName": "Control room devices", + "attributes": { + "sigfoxId": "2203961", + "deviceTypeId": "630ceaea10d051194ec0246e", + "autoCalibration": "on", + "zeroPointAdjusted": false, + "transmitPower": "full", + "powerControl": "off", + "fwVersion": 2 + }, + "telemetry": { + "ts": "1686298419000", + "values": { + "temperature": 28.7, + "humidity": 33, + "co2": 582, + "co2Baseline": 420, + "customData1": "37", + "customData2": "2" + } + } +} diff --git a/application/src/test/resources/converters/THINGPARK/uplink/test/default/configuration.json b/application/src/test/resources/converters/THINGPARK/uplink/test/default/configuration.json new file mode 100644 index 0000000000..fb5c0ea5f3 --- /dev/null +++ b/application/src/test/resources/converters/THINGPARK/uplink/test/default/configuration.json @@ -0,0 +1,13 @@ +{ + "type": "DEVICE", + "name": "Device $eui", + "label": "", + "profile": "", + "customer": "", + "group": "", + "attributes": [ + "eui", + "mType", + "fCntDn" + ] +} diff --git a/application/src/test/resources/converters/THINGPARK/uplink/test/default/expected.json b/application/src/test/resources/converters/THINGPARK/uplink/test/default/expected.json new file mode 100644 index 0000000000..494de3f9e2 --- /dev/null +++ b/application/src/test/resources/converters/THINGPARK/uplink/test/default/expected.json @@ -0,0 +1,19 @@ +{ + "entityType": "DEVICE", + "name": "Device 1000000000000001", + "profile": "default", + "telemetry": { + "ts": 1732828102138, + "values": { + "battery": 95, + "temperature": 36.6, + "saturation": 99 + } + }, + "attributes": { + "sn": 32310067, + "mType": 2, + "eui": "1000000000000001", + "fCntDn": 2 + } +} diff --git a/application/src/test/resources/converters/TPE/uplink/test/default/configuration.json b/application/src/test/resources/converters/TPE/uplink/test/default/configuration.json new file mode 100644 index 0000000000..fb5c0ea5f3 --- /dev/null +++ b/application/src/test/resources/converters/TPE/uplink/test/default/configuration.json @@ -0,0 +1,13 @@ +{ + "type": "DEVICE", + "name": "Device $eui", + "label": "", + "profile": "", + "customer": "", + "group": "", + "attributes": [ + "eui", + "mType", + "fCntDn" + ] +} diff --git a/application/src/test/resources/converters/TPE/uplink/test/default/expected.json b/application/src/test/resources/converters/TPE/uplink/test/default/expected.json new file mode 100644 index 0000000000..494de3f9e2 --- /dev/null +++ b/application/src/test/resources/converters/TPE/uplink/test/default/expected.json @@ -0,0 +1,19 @@ +{ + "entityType": "DEVICE", + "name": "Device 1000000000000001", + "profile": "default", + "telemetry": { + "ts": 1732828102138, + "values": { + "battery": 95, + "temperature": 36.6, + "saturation": 99 + } + }, + "attributes": { + "sn": 32310067, + "mType": 2, + "eui": "1000000000000001", + "fCntDn": 2 + } +} diff --git a/application/src/test/resources/converters/TTI/downlink/test/default/expected.json b/application/src/test/resources/converters/TTI/downlink/test/default/expected.json new file mode 100644 index 0000000000..c05157e7f7 --- /dev/null +++ b/application/src/test/resources/converters/TTI/downlink/test/default/expected.json @@ -0,0 +1,5 @@ +{ + "contentType": "JSON", + "data": "{\"downlinks\":[{\"f_port\":1,\"confirmed\":false,\"frm_payload\":\"b24=\",\"priority\":\"NORMAL\"}]}", + "metadata": {} +} diff --git a/application/src/test/resources/converters/TTI/downlink/test/default/payload.json b/application/src/test/resources/converters/TTI/downlink/test/default/payload.json new file mode 100644 index 0000000000..699fe6a1f1 --- /dev/null +++ b/application/src/test/resources/converters/TTI/downlink/test/default/payload.json @@ -0,0 +1,3 @@ +{ + "powerState": "on" +} diff --git a/application/src/test/resources/converters/TTI/uplink/test/default/configuration.json b/application/src/test/resources/converters/TTI/uplink/test/default/configuration.json new file mode 100644 index 0000000000..15a9d478e8 --- /dev/null +++ b/application/src/test/resources/converters/TTI/uplink/test/default/configuration.json @@ -0,0 +1,13 @@ +{ + "type": "DEVICE", + "name": "eui-$eui", + "label": "", + "profile": "$applicationId", + "customer": "", + "group": "", + "attributes": [ + "eui", + "fPort", + "devAddr" + ] +} diff --git a/application/src/test/resources/converters/TTI/uplink/test/default/expected.json b/application/src/test/resources/converters/TTI/uplink/test/default/expected.json new file mode 100644 index 0000000000..5ac20bca97 --- /dev/null +++ b/application/src/test/resources/converters/TTI/uplink/test/default/expected.json @@ -0,0 +1,24 @@ +{ + "entityType": "DEVICE", + "name": "eui-1000000000000001", + "profile": "milesight-iot-am308", + "telemetry": { + "ts": 1684398325906, + "values": { + "temperature": 23.8, + "humidity": 62, + "pir": "trigger", + "light_level": 2, + "co2": 936, + "tvoc": 0.37, + "pressure": 1008.6, + "pm2_5": 32, + "pm10": 48 + } + }, + "attributes": { + "devAddr": "20000001", + "fPort": 85, + "eui": "1000000000000001" + } +} diff --git a/application/src/test/resources/converters/TTN/downlink/test/default/expected.json b/application/src/test/resources/converters/TTN/downlink/test/default/expected.json new file mode 100644 index 0000000000..c05157e7f7 --- /dev/null +++ b/application/src/test/resources/converters/TTN/downlink/test/default/expected.json @@ -0,0 +1,5 @@ +{ + "contentType": "JSON", + "data": "{\"downlinks\":[{\"f_port\":1,\"confirmed\":false,\"frm_payload\":\"b24=\",\"priority\":\"NORMAL\"}]}", + "metadata": {} +} diff --git a/application/src/test/resources/converters/TTN/downlink/test/default/payload.json b/application/src/test/resources/converters/TTN/downlink/test/default/payload.json new file mode 100644 index 0000000000..699fe6a1f1 --- /dev/null +++ b/application/src/test/resources/converters/TTN/downlink/test/default/payload.json @@ -0,0 +1,3 @@ +{ + "powerState": "on" +} diff --git a/application/src/test/resources/converters/TTN/uplink/test/default/configuration.json b/application/src/test/resources/converters/TTN/uplink/test/default/configuration.json new file mode 100644 index 0000000000..15a9d478e8 --- /dev/null +++ b/application/src/test/resources/converters/TTN/uplink/test/default/configuration.json @@ -0,0 +1,13 @@ +{ + "type": "DEVICE", + "name": "eui-$eui", + "label": "", + "profile": "$applicationId", + "customer": "", + "group": "", + "attributes": [ + "eui", + "fPort", + "devAddr" + ] +} diff --git a/application/src/test/resources/converters/TTN/uplink/test/default/expected.json b/application/src/test/resources/converters/TTN/uplink/test/default/expected.json new file mode 100644 index 0000000000..aba17ca611 --- /dev/null +++ b/application/src/test/resources/converters/TTN/uplink/test/default/expected.json @@ -0,0 +1,24 @@ +{ + "entityType": "DEVICE", + "name": "eui-1000000000000001", + "profile": "milesight-iot-am308", + "telemetry": { + "ts": 1684474415641, + "values": { + "temperature": 23.8, + "humidity": 62, + "pir": "trigger", + "light_level": 2, + "co2": 936, + "tvoc": 0.37, + "pressure": 1008.6, + "pm2_5": 32, + "pm10": 48 + } + }, + "attributes": { + "devAddr": "20000001", + "fPort": 85, + "eui": "1000000000000001" + } +} diff --git a/application/src/test/resources/payload/things_stack_formatter_device_payload.json b/application/src/test/resources/payload/things_stack_formatter_device_payload.json new file mode 100644 index 0000000000..adcf82b996 --- /dev/null +++ b/application/src/test/resources/payload/things_stack_formatter_device_payload.json @@ -0,0 +1,43 @@ +{ + "end_device_ids": { + "device_id": "macro-tracker-1", + "application_ids": { + "application_id": "my-app" + }, + "dev_eui": "70B3D57ED006F371" + }, + "received_at": "2026-11-10T10:00:00.123Z", + "uplink_message": { + "f_port": 1, + "f_cnt": 5, + "frm_payload": "IWQ+Az4AbFA=", + "decoded_payload": { + "tbVersionIds": { + "brand_id": "lansitec", + "model_id": "macro-tracker" + }, + "batteryLevel": 100, + "chargeState": "Charging", + "temperatureUnit": "°C" + }, + "rx_metadata": [ + { + "gateway_ids": { + "gateway_id": "ug56" + }, + "rssi": -70, + "snr": 7 + } + ], + "settings": { + "data_rate": { + "lora": { + "bandwidth": 125000, + "spreading_factor": 9 + } + }, + "frequency": "868300000" + }, + "received_at": "2026-11-10T10:00:00.100Z" + } +} diff --git a/application/src/test/resources/payload/things_stack_manual_device_payload.json b/application/src/test/resources/payload/things_stack_manual_device_payload.json new file mode 100644 index 0000000000..b8d810a8ea --- /dev/null +++ b/application/src/test/resources/payload/things_stack_manual_device_payload.json @@ -0,0 +1,34 @@ +{ + "end_device_ids": { + "device_id": "manual-node", + "application_ids": { + "application_id": "my-app" + }, + "dev_eui": "70B3D57ED006F370" + }, + "received_at": "2026-10-28T10:00:00.123Z", + "uplink_message": { + "f_port": 1, + "f_cnt": 3, + "frm_payload": "Ae0DM18OTGM=", + "rx_metadata": [ + { + "gateway_ids": { + "gateway_id": "ug56" + }, + "rssi": -70, + "snr": 7 + } + ], + "settings": { + "data_rate": { + "lora": { + "bandwidth": 125000, + "spreading_factor": 9 + } + }, + "frequency": "868300000" + }, + "received_at": "2026-10-28T10:00:00.100Z" + } +} diff --git a/application/src/test/resources/payload/things_stack_repository_device_payload.json b/application/src/test/resources/payload/things_stack_repository_device_payload.json new file mode 100644 index 0000000000..430f685aab --- /dev/null +++ b/application/src/test/resources/payload/things_stack_repository_device_payload.json @@ -0,0 +1,64 @@ +{ + "end_device_ids": { + "device_id": "am308-office", + "application_ids": { + "application_id": "my-app" + }, + "dev_eui": "24E124707C481005", + "join_eui": "24E124C0002A0001", + "dev_addr": "260B1234" + }, + "received_at": "2026-10-28T10:00:00.123Z", + "uplink_message": { + "f_port": 85, + "f_cnt": 12, + "frm_payload": "AXVk", + "decoded_payload": { + "battery": 95, + "temperature": 24.5, + "co2": 560, + "history": [ + { + "timestamp": 1793170000, + "temperature": 24.1, + "co2": 550 + } + ] + }, + "rx_metadata": [ + { + "gateway_ids": { + "gateway_id": "ug56" + }, + "rssi": -60, + "snr": 9.5, + "channel_index": 2 + } + ], + "settings": { + "data_rate": { + "lora": { + "bandwidth": 125000, + "spreading_factor": 7, + "coding_rate": "4/5" + } + }, + "frequency": "868100000" + }, + "received_at": "2026-10-28T10:00:00.100Z", + "consumed_airtime": "0.061696s", + "version_ids": { + "brand_id": "milesight-iot", + "model_id": "am308", + "hardware_version": "1.0", + "firmware_version": "1.0", + "band_id": "EU_863_870" + }, + "network_ids": { + "net_id": "000013", + "tenant_id": "ttn", + "cluster_id": "eu1", + "cluster_address": "eu1.cloud.thethings.network" + } + } +} diff --git a/application/src/test/resources/payload/tti_custom_decoder_payload.json b/application/src/test/resources/payload/tti_custom_decoder_payload.json new file mode 100644 index 0000000000..afe0ab6311 --- /dev/null +++ b/application/src/test/resources/payload/tti_custom_decoder_payload.json @@ -0,0 +1,77 @@ +{ + "end_device_ids": { + "device_id": "eui-1000000000000001", + "application_ids": { + "application_id": "application-tti-name" + }, + "dev_eui": "1000000000000001", + "join_eui": "2000000000000001", + "dev_addr": "20000001" + }, + "correlation_ids": ["as:up:01H0PZDGB1NW6NAPD815NGHPF6", "gs:conn:01H0FJRSXSYT7VKNYXJ89F95XT", "gs:up:host:01H0FJRSY3MZMGPPFBQ4FZV4T8", "gs:uplink:01H0PZDG4HHGFRTXRTXD4PFTH7", "ns:uplink:01H0PZDG4JZ3BM0K6J89EQK1J7", "rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H0PZDG4J02F85RYFPCNSNXCR", "rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01H0PZDGB081PMP806BJHNHX1A"], + "received_at": "2023-05-18T08:25:26.112483370Z", + "uplink_message": { + "session_key_id": "AYfg8rhha5n+FWx0ZaAprA==", + "f_port": 85, + "f_cnt": 5017, + "frm_payload": "Ae0DM18OTGM=", + "rx_metadata": [{ + "gateway_ids": { + "gateway_id": "eui-6A7E111A10000000", + "eui": "6A7E111A10000000" + }, + "time": "2023-05-18T08:25:25.885310Z", + "timestamp": 818273765, + "rssi": -24, + "channel_rssi": -24, + "snr": 12, + "frequency_offset": "671", + "uplink_token": "CiIKIAoUZXVpLTZBN0UxMTFBMTAwMDAwMDASCCThJP/+9k6eEOW7l4YDGgwI9cGXowYQ5KPhrwMgiI2rp+jpOA=", + "channel_index": 2, + "received_at": "2023-05-18T08:25:25.869324983Z" + }, { + "gateway_ids": { + "gateway_id": "packetbroker" + }, + "packet_broker": { + "message_id": "01H0PZDG4MF9AYSMNY44MAVTDH", + "forwarder_net_id": "000013", + "forwarder_tenant_id": "ttn", + "forwarder_cluster_id": "eu1.cloud.thethings.network", + "forwarder_gateway_eui": "6A7E111A10000000", + "forwarder_gateway_id": "eui-6a7e111a10000000", + "home_network_net_id": "000013", + "home_network_tenant_id": "tenant", + "home_network_cluster_id": "eu1.cloud.thethings.industries" + }, + "time": "2023-05-18T08:25:25.885310Z", + "rssi": -24, + "channel_rssi": -24, + "snr": 12, + "frequency_offset": "671", + "uplink_token": "eyJnIjoiWlhsS2FHSkhZMmxQYVVwQ1RWUkpORkl3VGs1VE1XTnBURU5LYkdKdFRXbFBhVXBDVFZSSk5GSXdUazVKYVhkcFlWaFphVTlwU201a01uaGhWVlJvZDFSWFVuRmlSM1JtVFcxT2RVbHBkMmxrUjBadVNXcHZhV05ZY0RKT1IyeExaREpSZVZwR1pIUmpNRXBLVlVoR2RFNVZkR3BWVTBvNUxua3paVVJTWVRaM1lXOU1kbTQwVm5sdmIyWmlPWGN1ZUhCZmVrcElaa3hIWlZadGRVUlFVeTVuYlRaVlZXRXdkakpHV0VKMGJUUjZaMjVXUkVoeGVHRjRaMlJKTlVkS1VsbERhemc1VDNCbk5rVk1iM1JDUkVZM1VWbHdZbEJDTkdOblNqWjBlbkphYUV4MFRVMHhZMVZFTTFac01XdExURUo0YURaMFExTnhhMVJsWWw4eE5FdHlVVXcyZUhsRWFFbEhlakJITXpoTE0xaFdlRzR5VUVjMk4wNUViME5WTkhoTmRrazFZVk5oWkUwd2FXVnFjR294VGtoMFduZHlZMDFxVlVGNmRsbERUazlNY2s5eFdVeFpWMk5XTG1WVFFYVkpNVkptT1U5NWRqUTNhSEoxTUZoalYxRT0iLCJhIjp7ImZuaWQiOiIwMDAwMTMiLCJmdGlkIjoidHRuIiwiZmNpZCI6ImV1MS5jbG91ZC50aGV0aGluZ3MubmV0d29yayJ9fQ==", + "received_at": "2023-05-18T08:25:25.906038642Z" + }], + "settings": { + "data_rate": { + "lora": { + "bandwidth": 125000, + "spreading_factor": 7, + "coding_rate": "4/5" + } + }, + "frequency": "868500000", + "timestamp": 818273765, + "time": "2023-05-18T08:25:25.885310Z" + }, + "received_at": "2023-05-18T08:25:25.906399073Z", + "consumed_airtime": "0.097536s", + "network_ids": { + "net_id": "000013", + "tenant_id": "tenant", + "cluster_id": "eu1", + "cluster_address": "eu1.cloud.thethings.industries", + "tenant_address": "tenant.eu1.cloud.thethings.industries" + } + } +} \ No newline at end of file diff --git a/application/src/test/resources/payload/ttn_custom_decoder_payload.json b/application/src/test/resources/payload/ttn_custom_decoder_payload.json new file mode 100644 index 0000000000..e9d39a3070 --- /dev/null +++ b/application/src/test/resources/payload/ttn_custom_decoder_payload.json @@ -0,0 +1,54 @@ +{ + "end_device_ids": { + "device_id": "eui-1000000000000001", + "application_ids": { + "application_id": "application-tts-name" + }, + "dev_eui": "1000000000000001", + "join_eui": "2000000000000001", + "dev_addr": "20000001" + }, + "correlation_ids": ["as:up:01H0S7ZJQ9MQPMVY49FT3SE07M", "gs:conn:01H03BQZ9342X3Y86DJ2P704E5", "gs:up:host:01H03BQZ99EGAM52KK1300GFKN", "gs:uplink:01H0S7ZJGS6D9TJSKJN8XNTMAV", "ns:uplink:01H0S7ZJGS9KKD4HTTPKFEMWCV", "rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01H0S7ZJGSF3M38ZRZVTM38DEC", "rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01H0S7ZJQ8R2EH5AA269AKM8DX"], + "received_at": "2023-05-19T05:33:35.848446463Z", + "uplink_message": { + "session_key_id": "AYfqmb0pc/1uRZv9xUydgQ==", + "f_port": 85, + "f_cnt": 10335, + "frm_payload": "Ae0DM18OTGM=", + "rx_metadata": [{ + "gateway_ids": { + "gateway_id": "eui-6a7e111a10000000", + "eui": "6A7E111A10000000" + }, + "time": "2023-05-19T05:33:35.608982Z", + "timestamp": 3893546133, + "rssi": -35, + "channel_rssi": -35, + "snr": 13.2, + "frequency_offset": "69", + "uplink_token": "CiIKIAoUZXVpLTZhN2UxMTFhMTAwMDAwMDASCCThJP/+9k6eEJWZy8AOGgwIr5ScowYQvNbUsQIgiMy8y6jwpwE=", + "channel_index": 3, + "received_at": "2023-05-19T05:33:35.607383681Z" + }], + "settings": { + "data_rate": { + "lora": { + "bandwidth": 125000, + "spreading_factor": 7, + "coding_rate": "4/5" + } + }, + "frequency": "867100000", + "timestamp": 3893546133, + "time": "2023-05-19T05:33:35.608982Z" + }, + "received_at": "2023-05-19T05:33:35.641841782Z", + "consumed_airtime": "0.056576s", + "network_ids": { + "net_id": "000013", + "tenant_id": "ttn", + "cluster_id": "eu1", + "cluster_address": "eu1.cloud.thethings.network" + } + } +} diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbCacheTransaction.java b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbCacheTransaction.java index 044fdb0f0b..556e6281b2 100644 --- a/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbCacheTransaction.java +++ b/common/cache/src/main/java/org/thingsboard/server/cache/RedisTbCacheTransaction.java @@ -4,7 +4,9 @@ package org.thingsboard.server.cache; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.RedisConnection; +import redis.clients.jedis.exceptions.JedisNoScriptException; import java.io.Serializable; import java.util.Objects; @@ -27,6 +29,16 @@ public class RedisTbCacheTransaction { + try (var connection = getConnection(rawPrefix)) { + executeScript(connection, EVICT_BY_PREFIX_SHA, EVICT_BY_PREFIX_LUA_SCRIPT, ReturnType.INTEGER, 0, rawPrefix, rawBatchSize); + } + return null; + }); } @Override @@ -222,14 +231,17 @@ public abstract class RedisTbTransactionalCache doWatch(rawKeysList)); + } + + private RedisConnection doWatch(byte[][] rawKeysList) { RedisConnection connection = getConnection(rawKeysList[0]); try { connection.watch(rawKeysList); @@ -249,6 +265,34 @@ public abstract class RedisTbTransactionalCache T retryOnClusterTopologyChange(Supplier command) { + try { + return command.get(); + } catch (RuntimeException e) { + if (!connectionFactory.isRedisClusterAware() || !isClusterTopologyError(e) + || !(getNativeCluster() instanceof TbJedisCluster cluster)) { + throw e; + } + log.warn("[{}] Redis cluster topology changed, renewing the slot map and retrying: {}", cacheName, e.getMessage()); + cluster.renewSlotCache(); + return command.get(); + } + } + + static boolean isClusterTopologyError(Throwable e) { + return e instanceof JedisConnectionException || e instanceof JedisRedirectionException + || e instanceof RedisConnectionFailureException || e instanceof ClusterRedirectException; + } + + private JedisCluster getNativeCluster() { + return ((JedisClusterConnection) connectionFactory.getClusterConnection()).getNativeConnection(); + } + protected byte[] getRawKey(K key) { String keyString = rawKeyPrefix + key.toString(); byte[] rawKey; @@ -295,6 +339,13 @@ public abstract class RedisTbTransactionalCache 0 ? Duration.ofSeconds(topologyRefreshPeriodSec) : null; + return new TbJedisClusterConnectionFactory(clusterConfiguration, buildClientConfig(), topologyRefreshPeriod); } private JedisClientConfiguration buildClientConfig() { diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/TbJedisCluster.java b/common/cache/src/main/java/org/thingsboard/server/cache/TbJedisCluster.java new file mode 100644 index 0000000000..06b13deb87 --- /dev/null +++ b/common/cache/src/main/java/org/thingsboard/server/cache/TbJedisCluster.java @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.cache; + +import org.apache.commons.pool2.impl.GenericObjectPoolConfig; +import redis.clients.jedis.Connection; +import redis.clients.jedis.HostAndPort; +import redis.clients.jedis.JedisClientConfig; +import redis.clients.jedis.JedisCluster; +import redis.clients.jedis.providers.ClusterConnectionProvider; + +import java.time.Duration; +import java.util.Set; + +/** + * {@link JedisCluster} whose slot map can be renewed on demand. + *

+ * Commands sent through the cluster command executor renew the slot map themselves, on MOVED and on repeated + * connection errors. Commands that need one node connection (WATCH/MULTI, a script pinned to one slot) borrow it + * through {@link #getConnectionFromSlot(int)}, which bypasses that executor. When such a command fails because the + * cluster topology changed, the caller must call {@link #renewSlotCache()}. Otherwise every later call goes to the + * old node again, and if that node's address is gone, it fails until the JVM restarts. + */ +public class TbJedisCluster extends JedisCluster { + + /** + * @param topologyRefreshPeriod period of the background slot map refresh, or {@code null} to disable it + */ + public TbJedisCluster(Set clusterNodes, JedisClientConfig clientConfig, GenericObjectPoolConfig poolConfig, + Duration topologyRefreshPeriod, int maxAttempts) { + // Same retry budget as the JedisCluster constructor used by Spring's JedisConnectionFactory. + super(clusterNodes, clientConfig, poolConfig, topologyRefreshPeriod, maxAttempts, + Duration.ofMillis((long) clientConfig.getSocketTimeoutMillis() * maxAttempts)); + } + + /** + * Reloads the slot map from the cluster. Seed nodes are asked first, so this works even when every known node + * address has changed. Returns immediately if another thread is already renewing it. + */ + public void renewSlotCache() { + ((ClusterConnectionProvider) provider).renewSlotCache(); + } + +} diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/TbJedisClusterConnectionFactory.java b/common/cache/src/main/java/org/thingsboard/server/cache/TbJedisClusterConnectionFactory.java new file mode 100644 index 0000000000..f1efc0276a --- /dev/null +++ b/common/cache/src/main/java/org/thingsboard/server/cache/TbJedisClusterConnectionFactory.java @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.cache; + +import org.apache.commons.pool2.impl.GenericObjectPoolConfig; +import org.springframework.data.redis.connection.RedisClusterConfiguration; +import org.springframework.data.redis.connection.jedis.JedisClientConfiguration; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.thingsboard.server.common.data.StringUtils; +import redis.clients.jedis.Connection; +import redis.clients.jedis.DefaultJedisClientConfig; +import redis.clients.jedis.HostAndPort; +import redis.clients.jedis.JedisClientConfig; +import redis.clients.jedis.JedisCluster; + +import java.time.Duration; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Cluster connection factory that creates a {@link TbJedisCluster}, so the cache can renew the Jedis slot map after + * a topology change, and the slot map is also refreshed in the background. + */ +public class TbJedisClusterConnectionFactory extends JedisConnectionFactory { + + private static final int DEFAULT_MAX_REDIRECTS = 5; // same default as JedisConnectionFactory#createCluster + + private final Duration topologyRefreshPeriod; + + /** + * @param topologyRefreshPeriod period of the background slot map refresh, or {@code null} to disable it + */ + public TbJedisClusterConnectionFactory(RedisClusterConfiguration clusterConfiguration, JedisClientConfiguration clientConfiguration, + Duration topologyRefreshPeriod) { + super(clusterConfiguration, clientConfiguration); + this.topologyRefreshPeriod = topologyRefreshPeriod; + } + + @Override + protected JedisCluster createCluster(RedisClusterConfiguration clusterConfig, GenericObjectPoolConfig poolConfig) { + Set nodes = clusterConfig.getClusterNodes().stream() + .map(node -> new HostAndPort(node.getHost(), node.getPort())) + .collect(Collectors.toSet()); + int maxRedirects = clusterConfig.getMaxRedirects() != null ? clusterConfig.getMaxRedirects() : DEFAULT_MAX_REDIRECTS; + return new TbJedisCluster(nodes, createClusterClientConfig(clusterConfig), poolConfig, topologyRefreshPeriod, maxRedirects); + } + + /** + * Builds the same Jedis client config as {@code JedisConnectionFactory#createClientConfig}, which is private. + */ + JedisClientConfig createClusterClientConfig(RedisClusterConfiguration clusterConfig) { + JedisClientConfiguration clientConfiguration = getClientConfiguration(); + DefaultJedisClientConfig.Builder builder = DefaultJedisClientConfig.builder(); + clientConfiguration.getClientName().ifPresent(builder::clientName); + builder.connectionTimeoutMillis(Math.toIntExact(clientConfiguration.getConnectTimeout().toMillis())); + builder.socketTimeoutMillis(Math.toIntExact(clientConfiguration.getReadTimeout().toMillis())); + builder.database(getDatabase()); + if (StringUtils.isNotEmpty(clusterConfig.getUsername())) { + builder.user(clusterConfig.getUsername()); + } + clusterConfig.getPassword().toOptional().map(String::new).ifPresent(builder::password); + if (clientConfiguration.isUseSsl()) { + builder.ssl(true); + clientConfiguration.getSslSocketFactory().ifPresent(builder::sslSocketFactory); + clientConfiguration.getHostnameVerifier().ifPresent(builder::hostnameVerifier); + clientConfiguration.getSslParameters().ifPresent(builder::sslParameters); + } + clientConfiguration.getCustomizer().ifPresent(customizer -> customizer.customize(builder)); + return builder.build(); + } + +} diff --git a/common/cache/src/main/java/org/thingsboard/server/cache/VersionedRedisTbCache.java b/common/cache/src/main/java/org/thingsboard/server/cache/VersionedRedisTbCache.java index 5f5c3e4162..8c8cb16543 100644 --- a/common/cache/src/main/java/org/thingsboard/server/cache/VersionedRedisTbCache.java +++ b/common/cache/src/main/java/org/thingsboard/server/cache/VersionedRedisTbCache.java @@ -91,7 +91,9 @@ public abstract class VersionedRedisTbCache cache = mock(RedisTbTransactionalCache.class); + private final RedisConnection connection = mock(RedisConnection.class); + private final RedisTbCacheTransaction transaction = new RedisTbCacheTransaction<>(cache, connection); + + @Test + void givenNoScriptOnExec_whenCommit_thenLoadsScriptsAndReportsNotApplied() { + when(connection.exec()).thenThrow(new InvalidDataAccessApiUsageException("NOSCRIPT No matching script.", + new JedisNoScriptException("NOSCRIPT No matching script."))); + + assertThat(transaction.commit()).isFalse(); + + verify(cache).loadScripts(connection); + verify(connection).close(); + } + + @Test + void givenOtherErrorOnExec_whenCommit_thenThrows() { + when(connection.exec()).thenThrow(new InvalidDataAccessApiUsageException("WRONGTYPE", new JedisDataException("WRONGTYPE"))); + + assertThatThrownBy(transaction::commit).isInstanceOf(InvalidDataAccessApiUsageException.class); + + verify(cache, never()).loadScripts(connection); + verify(connection).close(); + } + +} diff --git a/common/cache/src/test/java/org/thingsboard/server/cache/RedisTbTransactionalCacheTest.java b/common/cache/src/test/java/org/thingsboard/server/cache/RedisTbTransactionalCacheTest.java index d7e0b33cf7..b3c77c0864 100644 --- a/common/cache/src/test/java/org/thingsboard/server/cache/RedisTbTransactionalCacheTest.java +++ b/common/cache/src/test/java/org/thingsboard/server/cache/RedisTbTransactionalCacheTest.java @@ -4,19 +4,29 @@ package org.thingsboard.server.cache; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; +import org.springframework.dao.InvalidDataAccessApiUsageException; +import org.springframework.data.redis.ClusterRedirectException; +import org.springframework.data.redis.RedisConnectionFailureException; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisScriptingCommands; import org.springframework.data.redis.connection.ReturnType; +import org.springframework.data.redis.connection.jedis.JedisClusterConnection; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import redis.clients.jedis.HostAndPort; +import redis.clients.jedis.exceptions.JedisConnectionException; +import redis.clients.jedis.exceptions.JedisMovedDataException; import java.nio.charset.StandardCharsets; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -73,6 +83,87 @@ class RedisTbTransactionalCacheTest { assertThat(rawKeyString(cache, "device_1")).startsWith(scanPrefix); } + @Test + void givenClusterTopologyError_whenRetryOnClusterTopologyChange_thenRenewsSlotMapAndRetriesOnce() { + TestRedisCache cache = createCache(""); + TbJedisCluster cluster = mockCluster(); + AtomicInteger attempts = new AtomicInteger(); + + String result = cache.retryOnClusterTopologyChange(() -> { + if (attempts.incrementAndGet() == 1) { + throw new JedisConnectionException("Failed to connect to 10.0.0.1:6379."); + } + return "ok"; + }); + + assertThat(result).isEqualTo("ok"); + assertThat(attempts).hasValue(2); + verify(cluster).renewSlotCache(); + } + + @Test + void givenClusterTopologyErrorTwice_whenRetryOnClusterTopologyChange_thenThrowsAfterOneRetry() { + TestRedisCache cache = createCache(""); + TbJedisCluster cluster = mockCluster(); + AtomicInteger attempts = new AtomicInteger(); + + assertThatThrownBy(() -> cache.retryOnClusterTopologyChange(() -> { + attempts.incrementAndGet(); + throw new ClusterRedirectException(2050, "10.0.0.2", 6379, null); + })).isInstanceOf(ClusterRedirectException.class); + + assertThat(attempts).hasValue(2); + verify(cluster).renewSlotCache(); + } + + @Test + void givenOtherError_whenRetryOnClusterTopologyChange_thenThrowsWithoutRenewing() { + TestRedisCache cache = createCache(""); + TbJedisCluster cluster = mockCluster(); + AtomicInteger attempts = new AtomicInteger(); + + assertThatThrownBy(() -> cache.retryOnClusterTopologyChange(() -> { + attempts.incrementAndGet(); + throw new InvalidDataAccessApiUsageException("NOSCRIPT"); + })).isInstanceOf(InvalidDataAccessApiUsageException.class); + + assertThat(attempts).hasValue(1); + verify(cluster, never()).renewSlotCache(); + } + + @Test + void givenStandaloneRedis_whenRetryOnClusterTopologyChange_thenThrowsWithoutRetry() { + TestRedisCache cache = createCache(""); + AtomicInteger attempts = new AtomicInteger(); + + assertThatThrownBy(() -> cache.retryOnClusterTopologyChange(() -> { + attempts.incrementAndGet(); + throw new RedisConnectionFailureException("Connection refused"); + })).isInstanceOf(RedisConnectionFailureException.class); + + assertThat(attempts).hasValue(1); + verify(connectionFactory, never()).getClusterConnection(); + } + + @Test + void isClusterTopologyError() { + assertThat(RedisTbTransactionalCache.isClusterTopologyError(new JedisConnectionException("refused"))).isTrue(); + assertThat(RedisTbTransactionalCache.isClusterTopologyError(new JedisMovedDataException("MOVED 2050 10.0.0.2:6379", new HostAndPort("10.0.0.2", 6379), 2050))).isTrue(); + assertThat(RedisTbTransactionalCache.isClusterTopologyError(new RedisConnectionFailureException("refused"))).isTrue(); + assertThat(RedisTbTransactionalCache.isClusterTopologyError(new ClusterRedirectException(2050, "10.0.0.2", 6379, null))).isTrue(); + assertThat(RedisTbTransactionalCache.isClusterTopologyError(new InvalidDataAccessApiUsageException("NOSCRIPT"))).isFalse(); + assertThat(RedisTbTransactionalCache.isClusterTopologyError(new IllegalStateException())).isFalse(); + } + + private TbJedisCluster mockCluster() { + TbJedisCluster cluster = mock(TbJedisCluster.class); + JedisClusterConnection clusterConnection = mock(JedisClusterConnection.class); + when(clusterConnection.getNativeConnection()).thenReturn(cluster); + when(connectionFactory.isRedisClusterAware()).thenReturn(true); + when(connectionFactory.getClusterConnection()).thenReturn(clusterConnection); + return cluster; + } + private TestRedisCache createCache(String keyPrefix) { connectionFactory = mock(JedisConnectionFactory.class); RedisConnection connection = mock(RedisConnection.class); diff --git a/common/cache/src/test/java/org/thingsboard/server/cache/TbJedisClusterConnectionFactoryTest.java b/common/cache/src/test/java/org/thingsboard/server/cache/TbJedisClusterConnectionFactoryTest.java new file mode 100644 index 0000000000..3ae1764cfb --- /dev/null +++ b/common/cache/src/test/java/org/thingsboard/server/cache/TbJedisClusterConnectionFactoryTest.java @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.cache; + +import org.junit.jupiter.api.Test; +import org.springframework.data.redis.connection.RedisClusterConfiguration; +import org.springframework.data.redis.connection.jedis.JedisClientConfiguration; +import redis.clients.jedis.JedisClientConfig; + +import javax.net.ssl.SSLSocketFactory; +import java.time.Duration; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +/** + * {@link TbJedisClusterConnectionFactory} builds the Jedis client config itself, because Spring keeps its own private. + * It must carry every setting ThingsBoard passes to Spring, or cluster connections lose auth, TLS or timeouts. + */ +class TbJedisClusterConnectionFactoryTest { + + @Test + void givenDefaultClientConfiguration_whenCreateClusterClientConfig_thenUsesSpringDefaults() { + RedisClusterConfiguration clusterConfig = new RedisClusterConfiguration(List.of("127.0.0.1:6379")); + var factory = new TbJedisClusterConnectionFactory(clusterConfig, JedisClientConfiguration.defaultConfiguration(), null); + + JedisClientConfig config = factory.createClusterClientConfig(clusterConfig); + + assertThat(config.getConnectionTimeoutMillis()).isEqualTo(2000); + assertThat(config.getSocketTimeoutMillis()).isEqualTo(2000); + assertThat(config.getDatabase()).isZero(); + assertThat(config.getUser()).isNull(); + assertThat(config.getPassword()).isNull(); + assertThat(config.isSsl()).isFalse(); + } + + @Test + void givenAuthTlsAndTimeouts_whenCreateClusterClientConfig_thenAllAreApplied() { + RedisClusterConfiguration clusterConfig = new RedisClusterConfiguration(List.of("127.0.0.1:6379")); + clusterConfig.setUsername("tb"); + clusterConfig.setPassword("secret"); + SSLSocketFactory sslSocketFactory = mock(SSLSocketFactory.class); + JedisClientConfiguration clientConfiguration = JedisClientConfiguration.builder() + .clientName("tb-node") + .connectTimeout(Duration.ofSeconds(3)) + .readTimeout(Duration.ofSeconds(4)) + .useSsl().sslSocketFactory(sslSocketFactory) + .and().build(); + var factory = new TbJedisClusterConnectionFactory(clusterConfig, clientConfiguration, Duration.ofSeconds(30)); + + JedisClientConfig config = factory.createClusterClientConfig(clusterConfig); + + assertThat(config.getClientName()).isEqualTo("tb-node"); + assertThat(config.getConnectionTimeoutMillis()).isEqualTo(3000); + assertThat(config.getSocketTimeoutMillis()).isEqualTo(4000); + assertThat(config.getUser()).isEqualTo("tb"); + assertThat(config.getPassword()).isEqualTo("secret"); + assertThat(config.isSsl()).isTrue(); + assertThat(config.getSslSocketFactory()).isSameAs(sslSocketFactory); + } + +} diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityHostSource.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityHostSource.java new file mode 100644 index 0000000000..4091794979 --- /dev/null +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityHostSource.java @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.dao.device; + +/** + * Where the host of a transport in the device connectivity info comes from. + */ +public enum DeviceConnectivityHostSource { + /** Set explicitly in the Device connectivity settings. */ + DEVICE_CONNECTIVITY, + /** Taken from the Base URL in General settings. */ + BASE_URL, + /** Taken from the address of the request. */ + REQUEST +} diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityService.java index 4bd0ab255d..48da435d32 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityService.java @@ -13,7 +13,19 @@ public interface DeviceConnectivityService { JsonNode findDevicePublishTelemetryCommands(String baseUrl, Device device) throws URISyntaxException; - JsonNode getConnectivityInfo(String baseUrl) throws URISyntaxException; + /** + * Resolved host and port of each enabled transport, with the source of the host. + * A blank port is replaced with the standard port of the protocol. + */ + JsonNode getConnectivityInfo(String baseUrl, DeviceConnectivityHostSource baseUrlSource) throws URISyntaxException; + + /** + * Same as {@link #getConnectivityInfo(String, DeviceConnectivityHostSource)}, with a base URL + * built from the request. + */ + default JsonNode getConnectivityInfo(String baseUrl) throws URISyntaxException { + return getConnectivityInfo(baseUrl, DeviceConnectivityHostSource.REQUEST); + } Resource getPemCertFile(String protocol); diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/user/UserService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/user/UserService.java index 8c11b05c06..7f144a8eb7 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/user/UserService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/user/UserService.java @@ -54,6 +54,8 @@ public interface UserService extends EntityDaoService { UserCredentials findUserCredentialsByUserId(TenantId tenantId, UserId userId); + UserCredentials findUserCredentialsById(TenantId tenantId, UserCredentialsId userCredentialsId); + UserCredentials findUserCredentialsByActivateToken(TenantId tenantId, String activateToken); UserCredentials findUserCredentialsByResetToken(TenantId tenantId, String resetToken); @@ -76,6 +78,8 @@ public interface UserService extends EntityDaoService { UserCredentials replaceUserCredentials(TenantId tenantId, UserCredentials userCredentials); + void updatePasswordHistory(UserCredentials userCredentials); + void deleteUserCredentials(TenantId tenantId, UserCredentials userCredentials); void deleteUser(TenantId tenantId, UserId userId); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ShortEntityView.java b/common/data/src/main/java/org/thingsboard/server/common/data/ShortEntityView.java index d77ef72e96..217e5b2f77 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ShortEntityView.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ShortEntityView.java @@ -47,7 +47,7 @@ public class ShortEntityView implements HasId, HasName { this.properties.put(name, value); } - @Schema(description = "Name of the entity", requiredMode = Schema.RequiredMode.REQUIRED, accessMode = Schema.AccessMode.READ_ONLY) + @Schema(description = "Name of the entity", requiredMode = Schema.RequiredMode.NOT_REQUIRED, accessMode = Schema.AccessMode.READ_ONLY) @Override @JsonProperty(access = JsonProperty.Access.READ_ONLY) public String getName() { diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/SystemVersionInfo.java b/common/data/src/main/java/org/thingsboard/server/common/data/SystemVersionInfo.java new file mode 100644 index 0000000000..c202c7c695 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/SystemVersionInfo.java @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.common.data; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "Version and edition of the platform build") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"version", "artifact", "name", "type"}) +public record SystemVersionInfo( + @Schema(requiredMode = Schema.RequiredMode.REQUIRED, example = "4.4.1", + description = "Platform version, or 'unknown' when the build information is not available") + String version, + @Schema(example = "application", description = "Build artifact; absent when the build information is not available") + String artifact, + @Schema(example = "ThingsBoard Server Application", description = "Build name; absent when the build information is not available") + String name, + @Schema(requiredMode = Schema.RequiredMode.REQUIRED, example = "PE", description = "Platform edition") + String type +) { +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/agent/AgentApplication.java b/common/data/src/main/java/org/thingsboard/server/common/data/agent/AgentApplication.java index 6e85bd55fa..abde33104d 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/agent/AgentApplication.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/agent/AgentApplication.java @@ -126,7 +126,7 @@ public class AgentApplication extends BaseData implements Ha return config; } - @Schema(description = "Template version this application is based on", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "Template version this application is based on", requiredMode = Schema.RequiredMode.NOT_REQUIRED) public String getTemplateVersion() { return templateVersion; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/AiModel.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/AiModel.java index 0438ee585b..4d8bbecd8f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/AiModel.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/AiModel.java @@ -61,6 +61,16 @@ public final class AiModel extends BaseData implements TenantEntity, ) private String name; + @Schema( + requiredMode = Schema.RequiredMode.NOT_REQUIRED, + accessMode = Schema.AccessMode.READ_WRITE, + description = "Whether customer users with the 'INVOKE' permission for AI models can send chat requests to the model, " + + "such as users with the default 'Customer Administrator' role, which grants all operations. " + + "Tenant administrators with the 'INVOKE' permission can use the model regardless of this flag", + defaultValue = "false" + ) + private boolean customerAccessEnabled; + @NotNull @Valid @Schema( @@ -84,6 +94,7 @@ public final class AiModel extends BaseData implements TenantEntity, tenantId = model.getTenantId(); version = model.getVersion(); name = model.getName(); + customerAccessEnabled = model.isCustomerAccessEnabled(); configuration = model.getConfiguration(); externalId = model.getExternalId() == null ? null : new AiModelId(model.getExternalId().getId()); } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/AiModelInfo.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/AiModelInfo.java new file mode 100644 index 0000000000..dcd546321a --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/AiModelInfo.java @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.common.data.ai; + +import io.swagger.v3.oas.annotations.media.Schema; +import org.thingsboard.server.common.data.ai.model.AiModelConfig; +import org.thingsboard.server.common.data.id.AiModelId; +import org.thingsboard.server.common.data.id.TenantId; + +@Schema(description = "AI model with the same JSON shape as an AI model, except that 'configuration.providerConfig' is always null, " + + "so provider credentials are never exposed") +public record AiModelInfo( + AiModelId id, + long createdTime, + TenantId tenantId, + Long version, + String name, + boolean customerAccessEnabled, + AiModelConfig configuration, + AiModelId externalId +) { + + public static AiModelInfo from(AiModel model) { + return new AiModelInfo(model.getId(), model.getCreatedTime(), model.getTenantId(), model.getVersion(), + model.getName(), model.isCustomerAccessEnabled(), model.getConfiguration().withoutProviderConfig(), + model.getExternalId()); + } + +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatPrompt.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatPrompt.java new file mode 100644 index 0000000000..2fc815e480 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatPrompt.java @@ -0,0 +1,58 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +package org.thingsboard.server.common.data.ai.dto; + +import dev.langchain4j.data.message.ChatMessage; +import dev.langchain4j.data.message.Content; +import dev.langchain4j.data.message.SystemMessage; +import dev.langchain4j.data.message.UserMessage; +import dev.langchain4j.model.chat.request.ChatRequest; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public record TbChatPrompt( + @Schema( + requiredMode = Schema.RequiredMode.NOT_REQUIRED, + accessMode = Schema.AccessMode.READ_WRITE, + description = "A system-level instruction that frames the user's input, setting the persona, tone, and constraints for the generated response", + example = "You are a helpful assistant. Only output valid JSON." + ) + String systemMessage, + + @Schema( + requiredMode = Schema.RequiredMode.REQUIRED, + accessMode = Schema.AccessMode.READ_WRITE, + description = "The actual user prompt that will be answered by the AI model" + ) + @NotNull @Valid + TbUserMessage userMessage +) { + + public ChatRequest toLangChainChatRequest() { + return ChatRequest.builder() + .messages(getLangChainMessages()) + .build(); + } + + private List getLangChainMessages() { + List messages = new ArrayList<>(2); + + if (systemMessage != null) { + messages.add(SystemMessage.from(systemMessage)); + } + + List langChainContents = userMessage.contents().stream() + .map(TbContent::toLangChainContent) + .toList(); + + messages.add(UserMessage.from(langChainContents)); + + return messages; + } + +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatRequest.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatRequest.java index e4bd9dd1c9..17afbce440 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatRequest.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatRequest.java @@ -1,20 +1,14 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.dto; -import dev.langchain4j.data.message.ChatMessage; -import dev.langchain4j.data.message.Content; -import dev.langchain4j.data.message.SystemMessage; -import dev.langchain4j.data.message.UserMessage; import dev.langchain4j.model.chat.request.ChatRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; import org.thingsboard.server.common.data.ai.model.chat.AiChatModelConfig; -import java.util.ArrayList; -import java.util.List; - public record TbChatRequest( @Schema( requiredMode = Schema.RequiredMode.NOT_REQUIRED, @@ -42,25 +36,7 @@ public record TbChatRequest( ) { public ChatRequest toLangChainChatRequest() { - return ChatRequest.builder() - .messages(getLangChainMessages()) - .build(); - } - - private List getLangChainMessages() { - List messages = new ArrayList<>(2); - - if (systemMessage != null) { - messages.add(SystemMessage.from(systemMessage)); - } - - List langChainContents = userMessage.contents().stream() - .map(TbContent::toLangChainContent) - .toList(); - - messages.add(UserMessage.from(langChainContents)); - - return messages; + return new TbChatPrompt(systemMessage, userMessage).toLangChainChatRequest(); } } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/AiModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/AiModelConfig.java index e3694cfad5..c3e238dba4 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/AiModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/AiModelConfig.java @@ -1,7 +1,9 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.v3.oas.annotations.media.DiscriminatorMapping; @@ -66,6 +68,8 @@ public interface AiModelConfig { description = "AI Provider", requiredMode = Schema.RequiredMode.REQUIRED ) + // Written as a regular property so it is kept when 'providerConfig' is null and carries no external type id + @JsonProperty("provider") AiProvider provider(); @Schema(hidden = true) @@ -87,6 +91,8 @@ public interface AiModelConfig { }) AiProviderConfig providerConfig(); + AiModelConfig withoutProviderConfig(); + AiModelType modelType(); } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AmazonBedrockChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AmazonBedrockChatModelConfig.java index 481e644073..5f798fe104 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AmazonBedrockChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AmazonBedrockChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.AmazonBedrockProviderConfi @Builder public record AmazonBedrockChatModelConfig( @Schema(ref = "#/components/schemas/AmazonBedrockProviderConfig") - @NotNull @Valid AmazonBedrockProviderConfig providerConfig, + @With @NotNull @Valid AmazonBedrockProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -33,6 +34,11 @@ public record AmazonBedrockChatModelConfig( return AiProvider.AMAZON_BEDROCK; } + @Override + public AmazonBedrockChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AnthropicChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AnthropicChatModelConfig.java index 6bae3c9280..ec64e80992 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AnthropicChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AnthropicChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.AnthropicProviderConfig; @Builder public record AnthropicChatModelConfig( @Schema(ref = "#/components/schemas/AnthropicProviderConfig") - @NotNull @Valid AnthropicProviderConfig providerConfig, + @With @NotNull @Valid AnthropicProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -34,6 +35,11 @@ public record AnthropicChatModelConfig( return AiProvider.ANTHROPIC; } + @Override + public AnthropicChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AzureOpenAiChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AzureOpenAiChatModelConfig.java index 0947b27472..8651921405 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AzureOpenAiChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/AzureOpenAiChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.AzureOpenAiProviderConfig; @Builder public record AzureOpenAiChatModelConfig( @Schema(ref = "#/components/schemas/AzureOpenAiProviderConfig") - @NotNull @Valid AzureOpenAiProviderConfig providerConfig, + @With @NotNull @Valid AzureOpenAiProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -35,6 +36,11 @@ public record AzureOpenAiChatModelConfig( return AiProvider.AZURE_OPENAI; } + @Override + public AzureOpenAiChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GitHubModelsChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GitHubModelsChatModelConfig.java index 9dc90401d3..37eb03a436 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GitHubModelsChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GitHubModelsChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.GitHubModelsProviderConfig @Builder public record GitHubModelsChatModelConfig( @Schema(ref = "#/components/schemas/GitHubModelsProviderConfig") - @NotNull @Valid GitHubModelsProviderConfig providerConfig, + @With @NotNull @Valid GitHubModelsProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -35,6 +36,11 @@ public record GitHubModelsChatModelConfig( return AiProvider.GITHUB_MODELS; } + @Override + public GitHubModelsChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleAiGeminiChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleAiGeminiChatModelConfig.java index d059e35180..e6fcd5a6d4 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleAiGeminiChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleAiGeminiChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.GoogleAiGeminiProviderConf @Builder public record GoogleAiGeminiChatModelConfig( @Schema(ref = "#/components/schemas/GoogleAiGeminiProviderConfig") - @NotNull @Valid GoogleAiGeminiProviderConfig providerConfig, + @With @NotNull @Valid GoogleAiGeminiProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -36,6 +37,11 @@ public record GoogleAiGeminiChatModelConfig( return AiProvider.GOOGLE_AI_GEMINI; } + @Override + public GoogleAiGeminiChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleVertexAiGeminiChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleVertexAiGeminiChatModelConfig.java index 5f1db7ebe6..9ef004ab07 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleVertexAiGeminiChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/GoogleVertexAiGeminiChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.GoogleVertexAiGeminiProvid @Builder public record GoogleVertexAiGeminiChatModelConfig( @Schema(ref = "#/components/schemas/GoogleVertexAiGeminiProviderConfig") - @NotNull @Valid GoogleVertexAiGeminiProviderConfig providerConfig, + @With @NotNull @Valid GoogleVertexAiGeminiProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -36,6 +37,11 @@ public record GoogleVertexAiGeminiChatModelConfig( return AiProvider.GOOGLE_VERTEX_AI_GEMINI; } + @Override + public GoogleVertexAiGeminiChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/MistralAiChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/MistralAiChatModelConfig.java index 0ca83c1a04..50054a5ea2 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/MistralAiChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/MistralAiChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.MistralAiProviderConfig; @Builder public record MistralAiChatModelConfig( @Schema(ref = "#/components/schemas/MistralAiProviderConfig") - @NotNull @Valid MistralAiProviderConfig providerConfig, + @With @NotNull @Valid MistralAiProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -35,6 +36,11 @@ public record MistralAiChatModelConfig( return AiProvider.MISTRAL_AI; } + @Override + public MistralAiChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OllamaChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OllamaChatModelConfig.java index 95ccfc5ddc..e137a618eb 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OllamaChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OllamaChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.OllamaProviderConfig; @Builder public record OllamaChatModelConfig( @Schema(ref = "#/components/schemas/OllamaProviderConfig") - @NotNull @Valid OllamaProviderConfig providerConfig, + @With @NotNull @Valid OllamaProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -35,6 +36,11 @@ public record OllamaChatModelConfig( return AiProvider.OLLAMA; } + @Override + public OllamaChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OpenAiChatModelConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OpenAiChatModelConfig.java index cc2e5d08d8..9302ee3897 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OpenAiChatModelConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ai/model/chat/OpenAiChatModelConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.ai.model.chat; import dev.langchain4j.model.chat.ChatModel; @@ -19,7 +20,7 @@ import org.thingsboard.server.common.data.ai.provider.OpenAiProviderConfig; @Builder public record OpenAiChatModelConfig( @Schema(ref = "#/components/schemas/OpenAiProviderConfig") - @NotNull @Valid OpenAiProviderConfig providerConfig, + @With @NotNull @Valid OpenAiProviderConfig providerConfig, @NotBlank String modelId, @PositiveOrZero Double temperature, @Positive @Max(1) Double topP, @@ -35,6 +36,11 @@ public record OpenAiChatModelConfig( return AiProvider.OPENAI; } + @Override + public OpenAiChatModelConfig withoutProviderConfig() { + return withProviderConfig(null); + } + @Override public ChatModel configure(Langchain4jChatModelConfigurer configurer) { return configurer.configureChatModel(this); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/dashboardreport/DashboardReportConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/dashboardreport/DashboardReportConfig.java index 7e558d04bc..baba266328 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/dashboardreport/DashboardReportConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/dashboardreport/DashboardReportConfig.java @@ -21,13 +21,13 @@ public class DashboardReportConfig { boolean useDashboardTimewindow; @Schema(description = "Specific dashboard timewindow that will be used during dashboard report generation.") JsonNode timewindow; - @Schema(description = "If set, timewindow configured in the target dashboard will be used during dashboard report generation.", example = "report-%d{yyyy-MM-dd_HH:mm:ss}", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "Pattern of the generated report file name. '%d{}' is replaced with the report generation time formatted in the report timezone. If not set, 'report-%d{yyyy-MM-dd_HH:mm:ss}' is used.", example = "report-%d{yyyy-MM-dd_HH:mm:ss}", requiredMode = Schema.RequiredMode.NOT_REQUIRED) String namePattern; @Schema(description = "Dashboard report file type, can be PDF | PNG | JPEG.", example = "pdf") String type; @Schema(description = "If set, credentials of user created this dashboard report configuration will be used to open dashboard UI during dashboard report generation.", example = "true") boolean useCurrentUserCredentials; - @Schema(description = "A string value representing the user id.", example = "784f394c-42b6-435a-983c-b7beff2784f9", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "A string value representing the user id.", example = "784f394c-42b6-435a-983c-b7beff2784f9", requiredMode = Schema.RequiredMode.NOT_REQUIRED) String userId; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java b/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java index 3105f6a881..6447aef178 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/edge/Edge.java @@ -155,7 +155,7 @@ public class Edge extends BaseDataWithAdditionalInfo return this.secret; } - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Edge license key obtained from license portal", example = "AgcnI24Z06XC&m6Sxsdgf") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "Edge license key obtained from license portal", example = "AgcnI24Z06XC&m6Sxsdgf") public String getEdgeLicenseKey() { return this.edgeLicenseKey; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/edge/EdgeEventType.java b/common/data/src/main/java/org/thingsboard/server/common/data/edge/EdgeEventType.java index 818fb0caa1..bcb2bb8631 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/edge/EdgeEventType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/edge/EdgeEventType.java @@ -8,59 +8,78 @@ import org.thingsboard.server.common.data.EntityType; @Getter public enum EdgeEventType { - DASHBOARD(false, EntityType.DASHBOARD), - ASSET(false, EntityType.ASSET), - DEVICE(false, EntityType.DEVICE), - DEVICE_PROFILE(true, EntityType.DEVICE_PROFILE), - ASSET_PROFILE(true, EntityType.ASSET_PROFILE), - ENTITY_VIEW(false, EntityType.ENTITY_VIEW), - ALARM(false, EntityType.ALARM), - ALARM_COMMENT(false, null), - RULE_CHAIN(false, EntityType.RULE_CHAIN), - RULE_CHAIN_METADATA(false, null), - EDGE(false, EntityType.EDGE), - USER(false, EntityType.USER), - CUSTOMER(true, EntityType.CUSTOMER), - RELATION(true, null), - TENANT(true, EntityType.TENANT), - TENANT_PROFILE(true, EntityType.TENANT_PROFILE), - WIDGETS_BUNDLE(true, EntityType.WIDGETS_BUNDLE), - WIDGET_TYPE(true, EntityType.WIDGET_TYPE), - ADMIN_SETTINGS(true, EntityType.ADMIN_SETTINGS), - OTA_PACKAGE(true, EntityType.OTA_PACKAGE), - QUEUE(true, EntityType.QUEUE), - ENTITY_GROUP(false, EntityType.ENTITY_GROUP), - SCHEDULER_EVENT(false, EntityType.SCHEDULER_EVENT), - WHITE_LABELING(true, null), - LOGIN_WHITE_LABELING(true, null), - MAIL_TEMPLATES(true, null), - CUSTOM_TRANSLATION(true, null), - CUSTOM_MENU(true, null), - ROLE(true, EntityType.ROLE), - GROUP_PERMISSION(true, EntityType.GROUP_PERMISSION), - CONVERTER(false, EntityType.CONVERTER), - INTEGRATION(false, EntityType.INTEGRATION), - NOTIFICATION_RULE(true, EntityType.NOTIFICATION_RULE), - NOTIFICATION_TARGET(true, EntityType.NOTIFICATION_TARGET), - NOTIFICATION_TEMPLATE(true, EntityType.NOTIFICATION_TEMPLATE), - TB_RESOURCE(true, EntityType.TB_RESOURCE), - DEVICE_GROUP_OTA(false, null), - OAUTH2_CLIENT(true, EntityType.OAUTH2_CLIENT), - DOMAIN(true, EntityType.DOMAIN), - CALCULATED_FIELD(false, EntityType.CALCULATED_FIELD), - ENCRYPTION_KEY(true, null), - SECRET(true, EntityType.SECRET), - REPORT_TEMPLATE(true, EntityType.REPORT_TEMPLATE), - AI_MODEL(true, EntityType.AI_MODEL), - API_KEY(true, EntityType.API_KEY); + DASHBOARD(EdgeEventScope.ASSIGNED_EDGES, EntityType.DASHBOARD), + ASSET(EdgeEventScope.ASSIGNED_EDGES, EntityType.ASSET), + DEVICE(EdgeEventScope.ASSIGNED_EDGES, EntityType.DEVICE), + DEVICE_PROFILE(EdgeEventScope.TENANT_EDGES, EntityType.DEVICE_PROFILE), + ASSET_PROFILE(EdgeEventScope.TENANT_EDGES, EntityType.ASSET_PROFILE), + ENTITY_VIEW(EdgeEventScope.ASSIGNED_EDGES, EntityType.ENTITY_VIEW), + ALARM(EdgeEventScope.ASSIGNED_EDGES, EntityType.ALARM), + ALARM_COMMENT(EdgeEventScope.ASSIGNED_EDGES, null), + RULE_CHAIN(EdgeEventScope.ASSIGNED_EDGES, EntityType.RULE_CHAIN), + RULE_CHAIN_METADATA(EdgeEventScope.ASSIGNED_EDGES, null), + EDGE(EdgeEventScope.ASSIGNED_EDGES, EntityType.EDGE), + USER(EdgeEventScope.ASSIGNED_EDGES, EntityType.USER), + CUSTOMER(EdgeEventScope.TENANT_EDGES, EntityType.CUSTOMER), + RELATION(EdgeEventScope.TENANT_EDGES, null), + TENANT(EdgeEventScope.TENANT_EDGES, EntityType.TENANT), + TENANT_PROFILE(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.TENANT_PROFILE), + WIDGETS_BUNDLE(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.WIDGETS_BUNDLE), + WIDGET_TYPE(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.WIDGET_TYPE), + ADMIN_SETTINGS(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.ADMIN_SETTINGS), + OTA_PACKAGE(EdgeEventScope.TENANT_EDGES, EntityType.OTA_PACKAGE), + QUEUE(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.QUEUE), + ENTITY_GROUP(EdgeEventScope.ASSIGNED_EDGES, EntityType.ENTITY_GROUP), + SCHEDULER_EVENT(EdgeEventScope.ASSIGNED_EDGES, EntityType.SCHEDULER_EVENT), + WHITE_LABELING(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, null), + LOGIN_WHITE_LABELING(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, null), + MAIL_TEMPLATES(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, null), + CUSTOM_TRANSLATION(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, null), + CUSTOM_MENU(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, null), + ROLE(EdgeEventScope.TENANT_EDGES, EntityType.ROLE), + GROUP_PERMISSION(EdgeEventScope.TENANT_EDGES, EntityType.GROUP_PERMISSION), + CONVERTER(EdgeEventScope.ASSIGNED_EDGES, EntityType.CONVERTER), + INTEGRATION(EdgeEventScope.ASSIGNED_EDGES, EntityType.INTEGRATION), + NOTIFICATION_RULE(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.NOTIFICATION_RULE), + NOTIFICATION_TARGET(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.NOTIFICATION_TARGET), + NOTIFICATION_TEMPLATE(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.NOTIFICATION_TEMPLATE), + TB_RESOURCE(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.TB_RESOURCE), + DEVICE_GROUP_OTA(EdgeEventScope.ASSIGNED_EDGES, null), + OAUTH2_CLIENT(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.OAUTH2_CLIENT), + DOMAIN(EdgeEventScope.SYSTEM_AND_TENANT_EDGES, EntityType.DOMAIN), + CALCULATED_FIELD(EdgeEventScope.ASSIGNED_EDGES, EntityType.CALCULATED_FIELD), + ENCRYPTION_KEY(EdgeEventScope.TENANT_EDGES, null), + SECRET(EdgeEventScope.TENANT_EDGES, EntityType.SECRET), + REPORT_TEMPLATE(EdgeEventScope.TENANT_EDGES, EntityType.REPORT_TEMPLATE), + AI_MODEL(EdgeEventScope.TENANT_EDGES, EntityType.AI_MODEL), + API_KEY(EdgeEventScope.TENANT_EDGES, EntityType.API_KEY); - private final boolean allEdgesRelated; + private final EdgeEventScope scope; private final EntityType entityType; - - EdgeEventType(boolean allEdgesRelated, EntityType entityType) { - this.allEdgesRelated = allEdgesRelated; + EdgeEventType(EdgeEventScope scope, EntityType entityType) { + this.scope = scope; this.entityType = entityType; } + + // entity is pushed to all edges of its tenant, otherwise only to edges it's assigned to + public boolean isAllTenantEdgesRelated() { + return scope != EdgeEventScope.ASSIGNED_EDGES; + } + + // entity can be owned by system tenant, so system level events are pushed to all edges + public boolean isSystemLevelSupported() { + return scope == EdgeEventScope.SYSTEM_AND_TENANT_EDGES; + } + + public enum EdgeEventScope { + // only edges the entity is assigned to + ASSIGNED_EDGES, + // all edges of the entity's tenant + TENANT_EDGES, + // all edges of the entity's tenant, or all edges if the entity is owned by system tenant + SYSTEM_AND_TENANT_EDGES + } + } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java b/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java index c7f5583291..269eafd106 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DeviceInstalledItemDescriptor.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.iot_hub; import com.fasterxml.jackson.databind.JsonNode; @@ -14,6 +15,8 @@ import java.util.Map; public class DeviceInstalledItemDescriptor implements IotHubInstalledItemDescriptor { private List createdEntityIds; + // Of createdEntityIds, the entities the user chose to use as they were: the package doesn't own them + private List usedExistingEntityIds; private DashboardId dashboardId; private String selectedInstallMethod; private Map installState; diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/notification/info/NotificationInfo.java b/common/data/src/main/java/org/thingsboard/server/common/data/notification/info/NotificationInfo.java index 54c8400c44..ad8b61402d 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/notification/info/NotificationInfo.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/notification/info/NotificationInfo.java @@ -5,14 +5,74 @@ package org.thingsboard.server.common.data.notification.info; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.v3.oas.annotations.media.DiscriminatorMapping; +import io.swagger.v3.oas.annotations.media.Schema; import org.thingsboard.server.common.data.id.DashboardId; import org.thingsboard.server.common.data.id.EntityId; import java.util.Map; +// The type id is the fully qualified class name (JsonTypeInfo.Id.CLASS). The subtypes and the mapping +// below only document it in the OpenAPI spec; they do not change how Jackson reads or writes the type. +@Schema( + discriminatorProperty = "type", + discriminatorMapping = { + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.AddonAccessErrorNotificationInfo", schema = AddonAccessErrorNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.AddonAccessRequestNotificationInfo", schema = AddonAccessRequestNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.AlarmAssignmentNotificationInfo", schema = AlarmAssignmentNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.AlarmCommentNotificationInfo", schema = AlarmCommentNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.AlarmNotificationInfo", schema = AlarmNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.ApiUsageLimitNotificationInfo", schema = ApiUsageLimitNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.DeviceActivityNotificationInfo", schema = DeviceActivityNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.EdgeCommunicationFailureNotificationInfo", schema = EdgeCommunicationFailureNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.EdgeConnectionNotificationInfo", schema = EdgeConnectionNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.EntitiesLimitIncreaseRequestNotificationInfo", schema = EntitiesLimitIncreaseRequestNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.EntitiesLimitNotificationInfo", schema = EntitiesLimitNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.EntityActionNotificationInfo", schema = EntityActionNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.GeneralNotificationInfo", schema = GeneralNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.IntegrationLifecycleEventNotificationInfo", schema = IntegrationLifecycleEventNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.NewPlatformVersionNotificationInfo", schema = NewPlatformVersionNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.PlanUpgradeRequestNotificationInfo", schema = PlanUpgradeRequestNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.RateLimitsNotificationInfo", schema = RateLimitsNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.ReportGeneratedNotificationInfo", schema = ReportGeneratedNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.ResourcesShortageNotificationInfo", schema = ResourcesShortageNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.RuleEngineComponentLifecycleEventNotificationInfo", schema = RuleEngineComponentLifecycleEventNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.RuleEngineOriginatedNotificationInfo", schema = RuleEngineOriginatedNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.TaskProcessingFailureNotificationInfo", schema = TaskProcessingFailureNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.UserActivatedNotificationInfo", schema = UserActivatedNotificationInfo.class), + @DiscriminatorMapping(value = "org.thingsboard.server.common.data.notification.info.UserRegisteredNotificationInfo", schema = UserRegisteredNotificationInfo.class) + } +) @JsonIgnoreProperties(ignoreUnknown = true) @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(AddonAccessErrorNotificationInfo.class), + @JsonSubTypes.Type(AddonAccessRequestNotificationInfo.class), + @JsonSubTypes.Type(AlarmAssignmentNotificationInfo.class), + @JsonSubTypes.Type(AlarmCommentNotificationInfo.class), + @JsonSubTypes.Type(AlarmNotificationInfo.class), + @JsonSubTypes.Type(ApiUsageLimitNotificationInfo.class), + @JsonSubTypes.Type(DeviceActivityNotificationInfo.class), + @JsonSubTypes.Type(EdgeCommunicationFailureNotificationInfo.class), + @JsonSubTypes.Type(EdgeConnectionNotificationInfo.class), + @JsonSubTypes.Type(EntitiesLimitIncreaseRequestNotificationInfo.class), + @JsonSubTypes.Type(EntitiesLimitNotificationInfo.class), + @JsonSubTypes.Type(EntityActionNotificationInfo.class), + @JsonSubTypes.Type(GeneralNotificationInfo.class), + @JsonSubTypes.Type(IntegrationLifecycleEventNotificationInfo.class), + @JsonSubTypes.Type(NewPlatformVersionNotificationInfo.class), + @JsonSubTypes.Type(PlanUpgradeRequestNotificationInfo.class), + @JsonSubTypes.Type(RateLimitsNotificationInfo.class), + @JsonSubTypes.Type(ReportGeneratedNotificationInfo.class), + @JsonSubTypes.Type(ResourcesShortageNotificationInfo.class), + @JsonSubTypes.Type(RuleEngineComponentLifecycleEventNotificationInfo.class), + @JsonSubTypes.Type(RuleEngineOriginatedNotificationInfo.class), + @JsonSubTypes.Type(TaskProcessingFailureNotificationInfo.class), + @JsonSubTypes.Type(UserActivatedNotificationInfo.class), + @JsonSubTypes.Type(UserRegisteredNotificationInfo.class) +}) public interface NotificationInfo { @JsonIgnore diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/objects/AttributesEntityView.java b/common/data/src/main/java/org/thingsboard/server/common/data/objects/AttributesEntityView.java index 207f2dc5d7..55299820e9 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/objects/AttributesEntityView.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/objects/AttributesEntityView.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.objects; import io.swagger.v3.oas.annotations.media.Schema; @@ -18,11 +19,11 @@ import java.util.List; @NoArgsConstructor public class AttributesEntityView implements Serializable { - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "List of client-side attribute keys to expose", example = "[\"currentConfiguration\"]") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "List of client-side attribute keys to expose", example = "[\"currentConfiguration\"]") private List cs = new ArrayList<>(); - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "List of server-side attribute keys to expose", example = "[\"model\"]") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "List of server-side attribute keys to expose", example = "[\"model\"]") private List ss = new ArrayList<>(); - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "List of shared attribute keys to expose", example = "[\"targetConfiguration\"]") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "List of shared attribute keys to expose", example = "[\"targetConfiguration\"]") private List sh = new ArrayList<>(); public AttributesEntityView(List cs, diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/objects/TelemetryEntityView.java b/common/data/src/main/java/org/thingsboard/server/common/data/objects/TelemetryEntityView.java index cebd335437..9ab923e18c 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/objects/TelemetryEntityView.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/objects/TelemetryEntityView.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.objects; import io.swagger.v3.oas.annotations.media.Schema; @@ -18,7 +19,7 @@ import java.util.List; @NoArgsConstructor public class TelemetryEntityView implements Serializable { - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "List of time-series data keys to expose", example = "[\"temperature\", \"humidity\"]") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "List of time-series data keys to expose", example = "[\"temperature\", \"humidity\"]") private List timeseries; @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "JSON object with attributes to expose") private AttributesEntityView attributes; diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/permission/GroupPermission.java b/common/data/src/main/java/org/thingsboard/server/common/data/permission/GroupPermission.java index 2968492322..332cc3024f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/permission/GroupPermission.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/permission/GroupPermission.java @@ -84,7 +84,7 @@ public class GroupPermission extends BaseData implements HasN private TenantId tenantId; @Schema(description = "JSON object with the User Group Id. Represents the user group that will have permissions to perform operations against the corresponding entity group.", - requiredMode = Schema.RequiredMode.REQUIRED) + requiredMode = Schema.RequiredMode.NOT_REQUIRED) private EntityGroupId userGroupId; @Schema(description = "JSON object with the Role Id. Represents the set of permissions. " + "The role type (GENERIC or GROUP) determines whether 'entityGroupId' is required.", diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/permission/Operation.java b/common/data/src/main/java/org/thingsboard/server/common/data/permission/Operation.java index 4998ae736a..a030e713d0 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/permission/Operation.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/permission/Operation.java @@ -31,7 +31,8 @@ public enum Operation { SHARE_GROUP(true), ASSIGN_TO_TENANT, READ_CALCULATED_FIELD(true), - WRITE_CALCULATED_FIELD(true); + WRITE_CALCULATED_FIELD(true), + INVOKE; public static Set defaultEntityOperations = new HashSet<>(Arrays.asList(ALL, READ, WRITE, CREATE, DELETE, READ_ATTRIBUTES, WRITE_ATTRIBUTES, READ_TELEMETRY, WRITE_TELEMETRY, CHANGE_OWNER)); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/permission/Resource.java b/common/data/src/main/java/org/thingsboard/server/common/data/permission/Resource.java index 9d4ca7f810..1d6c6480d4 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/permission/Resource.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/permission/Resource.java @@ -157,7 +157,8 @@ public enum Resource { operationsByResource.put(Resource.SECRET, Operation.crudOperations); operationsByResource.put(Resource.REPORT_TEMPLATE, Operation.crudOperations); operationsByResource.put(Resource.REPORT, Operation.crudOperations); - operationsByResource.put(Resource.AI_MODEL, Operation.crudOperations); + operationsByResource.put(Resource.AI_MODEL, Set.of(Operation.ALL, Operation.READ, Operation.WRITE, + Operation.CREATE, Operation.DELETE, Operation.INVOKE)); operationsByResource.put(Resource.AI, Set.of(Operation.ALL)); operationsByResource.put(Resource.CUSTOM_MENU, Set.of(Operation.ALL, Operation.READ, Operation.WRITE, Operation.DELETE)); operationsByResource.put(Resource.API_KEY, Operation.crudOperations); @@ -283,7 +284,8 @@ public enum Resource { Resource.REPORT_TEMPLATE, Resource.REPORT, Resource.JOB, - Resource.API_KEY + Resource.API_KEY, + Resource.AI_MODEL )); } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/query/AliasEntityId.java b/common/data/src/main/java/org/thingsboard/server/common/data/query/AliasEntityId.java index c49e4e8806..a0c480e0cc 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/query/AliasEntityId.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/query/AliasEntityId.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.query; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -11,11 +12,31 @@ import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; +import java.util.UUID; + @JsonDeserialize(using = AliasEntityIdDeserializer.class) @JsonSerialize(using = AliasEntityIdSerializer.class) @Schema public interface AliasEntityId extends EntityId { + // The schema follows AliasEntityIdSerializer/AliasEntityIdDeserializer rather + // than the getters: entityType carries either an EntityType or an + // AliasEntityType name, id is only required for an EntityType, and + // aliasEntityType is never written. + @Override + @Schema(implementation = String.class, requiredMode = Schema.RequiredMode.REQUIRED, + description = "Entity type: an EntityType value, or an AliasEntityType value resolved for the current user", + example = "DEVICE") + EntityType getEntityType(); + + @Override + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, + description = "ID of the entity, time-based UUID v1. Required for an entity type; for " + + "CURRENT_CUSTOMER, the customer used when the current user does not belong to one", + example = "784f394c-42b6-435a-983c-b7beff2784f9") + UUID getId(); + + @Schema(hidden = true) AliasEntityType getAliasEntityType(); EntityId defaultEntityId(); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/report/Report.java b/common/data/src/main/java/org/thingsboard/server/common/data/report/Report.java index 8d0d32e3ec..e84cb29d3b 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/report/Report.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/report/Report.java @@ -32,6 +32,7 @@ public class Report extends BaseData implements HasName, TenantEntity, @NotNull private TenantId tenantId; private CustomerId customerId; + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) @NotNull private ReportTemplateId templateId; @NotNull diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/ColumnSettings.java b/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/ColumnSettings.java index af5153b1f1..1c87efd548 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/ColumnSettings.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/ColumnSettings.java @@ -2,9 +2,14 @@ // SPDX-License-Identifier: BUSL-1.1 package org.thingsboard.server.common.data.report.configuration; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import org.thingsboard.server.common.data.report.configuration.style.DataKeySettingsType; +// allOf is explicit because ColumnSettings is also a field type +// (TimeseriesTableComponent.timestampColumnSettings): resolved there first, it +// lost the DataKeySettings parent and generated clients did not treat it as one. +@Schema(allOf = DataKeySettings.class) @Data public class ColumnSettings implements DataKeySettings { diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/components/ReportComponent.java b/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/components/ReportComponent.java index 824b5e2fb2..be2b97586a 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/components/ReportComponent.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/report/configuration/components/ReportComponent.java @@ -56,7 +56,7 @@ public interface ReportComponent extends Serializable { @Schema(requiredMode = Schema.RequiredMode.REQUIRED) ReportComponentType getType(); - @Schema(requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) ReportComponentSubType getSubType(); } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/rule/RuleChainMetaData.java b/common/data/src/main/java/org/thingsboard/server/common/data/rule/RuleChainMetaData.java index 7e4fb74839..c2f28cc69f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/rule/RuleChainMetaData.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/rule/RuleChainMetaData.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.rule; import com.fasterxml.jackson.annotation.JsonInclude; @@ -24,16 +25,16 @@ public class RuleChainMetaData implements HasVersion { @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "Version of the Rule Chain") private Long version; - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "Index of the first rule node in the 'nodes' list") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "Index of the first rule node in the 'nodes' list") private Integer firstNodeIndex; @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "List of rule node JSON objects") private List nodes; - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "List of JSON objects that represent connections between rule nodes") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "List of JSON objects that represent connections between rule nodes") private List connections; - @Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "List of JSON objects that represent connections between rule nodes and other rule chains.") + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "List of JSON objects that represent connections between rule nodes and other rule chains.") private List ruleChainConnections; @JsonInclude(JsonInclude.Include.NON_EMPTY) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/BackupCodeTwoFaAccountConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/BackupCodeTwoFaAccountConfig.java index 79d4c35428..a796b3c0ab 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/BackupCodeTwoFaAccountConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/BackupCodeTwoFaAccountConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.security.model.mfa.account; import com.fasterxml.jackson.annotation.JsonGetter; @@ -16,6 +17,7 @@ import java.util.Set; @EqualsAndHashCode(callSuper = true) public class BackupCodeTwoFaAccountConfig extends TwoFaAccountConfig { + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) @NotEmpty private Set codes; diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/SmsTwoFaAccountConfig.java b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/SmsTwoFaAccountConfig.java index 5ff3715fde..cf61745f30 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/SmsTwoFaAccountConfig.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/mfa/account/SmsTwoFaAccountConfig.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.data.security.model.mfa.account; import io.swagger.v3.oas.annotations.media.Schema; @@ -14,6 +15,7 @@ import org.thingsboard.server.common.data.security.model.mfa.provider.TwoFaProvi @Data public class SmsTwoFaAccountConfig extends OtpBasedTwoFaAccountConfig { + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED) @NotBlank @Pattern(regexp = "^\\+[1-9]\\d{1,14}$", message = "is not of E.164 format") private String phoneNumber; diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/importing/csv/BulkImportColumnType.java b/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/importing/csv/BulkImportColumnType.java index 69f581d272..919c9d7b09 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/importing/csv/BulkImportColumnType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/importing/csv/BulkImportColumnType.java @@ -36,6 +36,7 @@ public enum BulkImportColumnType { SNMP_VERSION, SNMP_COMMUNITY_STRING, IS_GATEWAY, + OVERWRITE_ACTIVITY_TIME, DESCRIPTION, EDGE_LICENSE_KEY, CLOUD_ENDPOINT, diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/wl/Palette.java b/common/data/src/main/java/org/thingsboard/server/common/data/wl/Palette.java index aedb2ed11c..357378685b 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/wl/Palette.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/wl/Palette.java @@ -13,7 +13,7 @@ import java.util.Map; @EqualsAndHashCode public class Palette { - @Schema(description = "Name of the pre-defined palette, or 'custom'", example = "custom", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "Name of the pre-defined palette, or 'custom'", example = "custom") private String type; @JsonProperty("extends") diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/wl/PaletteSettings.java b/common/data/src/main/java/org/thingsboard/server/common/data/wl/PaletteSettings.java index 1b1a854772..9b37eb3ef4 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/wl/PaletteSettings.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/wl/PaletteSettings.java @@ -11,9 +11,9 @@ import org.thingsboard.server.common.data.StringUtils; @Data @EqualsAndHashCode public class PaletteSettings { - @Schema(description = "Primary palette JSON", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "Primary palette JSON") private Palette primaryPalette; - @Schema(description = "Accent palette JSON", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "Accent palette JSON") private Palette accentPalette; public PaletteSettings merge(PaletteSettings otherPaletteSettings) { diff --git a/common/data/src/test/java/org/thingsboard/server/common/data/SystemVersionInfoTest.java b/common/data/src/test/java/org/thingsboard/server/common/data/SystemVersionInfoTest.java new file mode 100644 index 0000000000..0aad1e35b9 --- /dev/null +++ b/common/data/src/test/java/org/thingsboard/server/common/data/SystemVersionInfoTest.java @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.common.data; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +class SystemVersionInfoTest { + + private final ObjectMapper mapper = new ObjectMapper(); + + @Test + void serializesAllFieldsInFixedOrderWhenBuildInfoIsPresent() throws Exception { + SystemVersionInfo info = new SystemVersionInfo("4.4.1", "application", "ThingsBoard Server Application", "PE"); + + assertThat(mapper.writeValueAsString(info)) + .isEqualTo("{\"version\":\"4.4.1\",\"artifact\":\"application\",\"name\":\"ThingsBoard Server Application\",\"type\":\"PE\"}"); + } + + @Test + void omitsArtifactAndNameWhenBuildInfoIsMissing() throws Exception { + SystemVersionInfo info = new SystemVersionInfo("unknown", null, null, "PE"); + + assertThat(mapper.writeValueAsString(info)) + .isEqualTo("{\"version\":\"unknown\",\"type\":\"PE\"}"); + } + +} diff --git a/common/data/src/test/java/org/thingsboard/server/common/data/ai/AiModelTest.java b/common/data/src/test/java/org/thingsboard/server/common/data/ai/AiModelTest.java new file mode 100644 index 0000000000..63a13430d5 --- /dev/null +++ b/common/data/src/test/java/org/thingsboard/server/common/data/ai/AiModelTest.java @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.common.data.ai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.junit.jupiter.api.Test; +import org.thingsboard.server.common.data.ai.model.chat.OpenAiChatModelConfig; +import org.thingsboard.server.common.data.ai.provider.OpenAiProviderConfig; +import org.thingsboard.server.common.data.id.AiModelId; +import org.thingsboard.server.common.data.id.TenantId; + +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +class AiModelTest { + + private final ObjectMapper mapper = new ObjectMapper(); + + @Test + void infoJsonMatchesModelJsonExceptForNullProviderConfig() { + AiModel model = openAiModel(); + + JsonNode infoJson = mapper.valueToTree(AiModelInfo.from(model)); + ObjectNode expected = mapper.valueToTree(model); + ((ObjectNode) expected.get("configuration")).putNull("providerConfig"); + + assertThat(infoJson).isEqualTo(expected); + assertThat(infoJson.toString()).doesNotContain("test-api-key"); + } + + @Test + void modelJsonWritesProviderOnce() throws Exception { + String json = mapper.writeValueAsString(openAiModel()); + + assertThat(json.split("\"provider\"", -1)).hasSize(2); + assertThat(mapper.readValue(json, AiModel.class).getConfiguration()).isEqualTo(openAiModel().getConfiguration()); + } + + @Test + void infoJsonDeserializesAsInfoAndAsModel() throws Exception { + AiModel model = openAiModel(); + AiModelInfo info = AiModelInfo.from(model); + String json = mapper.writeValueAsString(info); + + assertThat(mapper.readValue(json, AiModelInfo.class)).isEqualTo(info); + + AiModel modelFromInfo = mapper.readValue(json, AiModel.class); + assertThat(modelFromInfo.getConfiguration().providerConfig()).isNull(); + assertThat(modelFromInfo.getConfiguration()).isEqualTo(info.configuration()); + assertThat(modelFromInfo.getName()).isEqualTo(model.getName()); + assertThat(modelFromInfo.isCustomerAccessEnabled()).isTrue(); + } + + private static AiModel openAiModel() { + AiModel model = AiModel.builder() + .tenantId(TenantId.fromUUID(UUID.randomUUID())) + .version(3L) + .name("Test model") + .customerAccessEnabled(true) + .configuration(OpenAiChatModelConfig.builder() + .providerConfig(OpenAiProviderConfig.builder() + .baseUrl(OpenAiProviderConfig.OPENAI_OFFICIAL_BASE_URL) + .apiKey("test-api-key") + .build()) + .modelId("gpt-4o") + .build()) + .build(); + model.setId(new AiModelId(UUID.randomUUID())); + model.setCreatedTime(1_700_000_000_000L); + return model; + } + +} diff --git a/common/data/src/test/java/org/thingsboard/server/common/data/notification/info/NotificationInfoSubTypesTest.java b/common/data/src/test/java/org/thingsboard/server/common/data/notification/info/NotificationInfoSubTypesTest.java new file mode 100644 index 0000000000..882753f465 --- /dev/null +++ b/common/data/src/test/java/org/thingsboard/server/common/data/notification/info/NotificationInfoSubTypesTest.java @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.common.data.notification.info; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import io.swagger.v3.oas.annotations.media.DiscriminatorMapping; +import io.swagger.v3.oas.annotations.media.Schema; +import org.junit.jupiter.api.Test; +import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; +import org.springframework.core.type.filter.AssignableTypeFilter; +import org.springframework.util.ClassUtils; + +import java.util.Arrays; +import java.util.Set; + +import static java.util.stream.Collectors.toSet; +import static org.assertj.core.api.Assertions.assertThat; + +/** + * {@link NotificationInfo} lists its implementations by hand in both {@code @JsonSubTypes} and the OpenAPI + * {@code discriminatorMapping}. These tests make sure both lists match the classes that actually implement it. + */ +class NotificationInfoSubTypesTest { + + private static final String BASE_PACKAGE = "org.thingsboard.server.common.data.notification"; + + @Test + void jsonSubTypesCoverEveryImplementation() { + Set> subTypes = Arrays.stream(NotificationInfo.class.getAnnotation(JsonSubTypes.class).value()) + .map(JsonSubTypes.Type::value) + .collect(toSet()); + + assertThat(subTypes) + .as("@JsonSubTypes on NotificationInfo must list exactly the concrete NotificationInfo implementations") + .isEqualTo(findImplementations()); + } + + @Test + void discriminatorMappingCoversEveryImplementation() { + Set> mappedSchemas = Arrays.stream(discriminatorMapping()) + .map(DiscriminatorMapping::schema) + .collect(toSet()); + + assertThat(mappedSchemas) + .as("@Schema(discriminatorMapping) on NotificationInfo must list exactly the concrete NotificationInfo implementations") + .isEqualTo(findImplementations()); + } + + @Test + void discriminatorMappingValueIsFullyQualifiedClassName() { + for (DiscriminatorMapping mapping : discriminatorMapping()) { + assertThat(mapping.value()) + .as("Discriminator value for %s must be its fully qualified class name (JsonTypeInfo.Id.CLASS)", + mapping.schema().getSimpleName()) + .isEqualTo(mapping.schema().getName()); + } + } + + private static DiscriminatorMapping[] discriminatorMapping() { + return NotificationInfo.class.getAnnotation(Schema.class).discriminatorMapping(); + } + + private static Set> findImplementations() { + var scanner = new ClassPathScanningCandidateComponentProvider(false); + scanner.addIncludeFilter(new AssignableTypeFilter(NotificationInfo.class)); + Set> implementations = scanner.findCandidateComponents(BASE_PACKAGE).stream() + .map(beanDefinition -> ClassUtils.resolveClassName(beanDefinition.getBeanClassName(), null)) + .collect(toSet()); + assertThat(implementations).as("No NotificationInfo implementations found in %s", BASE_PACKAGE).isNotEmpty(); + return implementations; + } +} diff --git a/common/data/src/test/java/org/thingsboard/server/common/data/query/AliasEntityIdTest.java b/common/data/src/test/java/org/thingsboard/server/common/data/query/AliasEntityIdTest.java new file mode 100644 index 0000000000..a675f44d22 --- /dev/null +++ b/common/data/src/test/java/org/thingsboard/server/common/data/query/AliasEntityIdTest.java @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.common.data.query; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.id.CustomerId; +import org.thingsboard.server.common.data.id.DeviceId; + +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +// The OpenAPI schema of AliasEntityId describes this wire format, not the getters: +// entityType holds an EntityType or an AliasEntityType name, and id is optional for an alias. +class AliasEntityIdTest { + + private static final ObjectMapper mapper = new ObjectMapper(); + private static final UUID ID = UUID.fromString("784f394c-42b6-435a-983c-b7beff2784f9"); + + @Test + void entityIdRoundTrip() throws Exception { + AliasEntityId entityId = AliasEntityId.fromEntityId(new DeviceId(ID)); + + String json = mapper.writeValueAsString(entityId); + + assertThat(mapper.readTree(json)).isEqualTo(mapper.readTree("{\"entityType\":\"DEVICE\",\"id\":\"" + ID + "\"}")); + AliasEntityId parsed = mapper.readValue(json, AliasEntityId.class); + assertThat(parsed.isAliasEntityId()).isFalse(); + assertThat(parsed.getEntityType()).isEqualTo(EntityType.DEVICE); + assertThat(parsed.getId()).isEqualTo(ID); + } + + @Test + void aliasWithoutIdRoundTrip() throws Exception { + String json = mapper.writeValueAsString(new AliasEntityIdImpl(AliasEntityType.CURRENT_USER, null)); + + assertThat(mapper.readTree(json)).isEqualTo(mapper.readTree("{\"entityType\":\"CURRENT_USER\"}")); + AliasEntityId parsed = mapper.readValue(json, AliasEntityId.class); + assertThat(parsed.getAliasEntityType()).isEqualTo(AliasEntityType.CURRENT_USER); + assertThat(parsed.getId()).isNull(); + } + + @Test + void currentCustomerAliasCarriesDefaultCustomerId() throws Exception { + String json = mapper.writeValueAsString(new AliasEntityIdImpl(AliasEntityType.CURRENT_CUSTOMER, ID)); + + assertThat(mapper.readTree(json)).isEqualTo(mapper.readTree("{\"entityType\":\"CURRENT_CUSTOMER\",\"id\":\"" + ID + "\"}")); + AliasEntityId parsed = mapper.readValue(json, AliasEntityId.class); + assertThat(parsed.getAliasEntityType()).isEqualTo(AliasEntityType.CURRENT_CUSTOMER); + assertThat(parsed.defaultEntityId()).isEqualTo(new CustomerId(ID)); + } + +} diff --git a/common/edge-api/src/main/proto/edge.proto b/common/edge-api/src/main/proto/edge.proto index 62bdb0250b..cf926e53bd 100644 --- a/common/edge-api/src/main/proto/edge.proto +++ b/common/edge-api/src/main/proto/edge.proto @@ -42,6 +42,7 @@ enum EdgeVersion { V_4_2_2_5 = 4225; V_4_2_2_6 = 4226; V_4_2_2_7 = 4227; + V_4_2_2_8 = 4228; V_4_3_0_1 = 15; V_4_3_1 = 4310; V_4_3_1_1 = 4311; @@ -51,8 +52,10 @@ enum EdgeVersion { V_4_3_1_5 = 4315; V_4_3_1_6 = 4316; V_4_3_1_7 = 4317; + V_4_3_1_8 = 4318; V_4_4_0 = 4400; V_4_4_0_1 = 4401; + V_4_4_0_2 = 4402; V_4_4_1 = 4410; V_LATEST = 99999; @@ -385,6 +388,28 @@ message CalculatedFieldRequestMsg { string entityType = 3; } +// Edge-delegated send requests (mail/sms/notification). The Cloud always resolves the tenant from the +// authenticated edge session (edge.getTenantId()) and ignores tenantIdMSB/tenantIdLSB below - they are kept +// only for symmetry with other uplink messages and must not be treated as authoritative by the receiver. +// 'request' is the JSON-serialized Edge{Mail,Sms,Notification}Request payload. +message SendEmailUplinkMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string request = 3; +} + +message SendSmsUplinkMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string request = 3; +} + +message SendNotificationUplinkMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string request = 3; +} + // DEPRECATED. FOR REMOVAL message UserCredentialsRequestMsg { option deprecated = true; @@ -585,6 +610,9 @@ message UplinkMsg { repeated ReportTemplateUpdateMsg reportTemplateUpdateMsg = 32; repeated SchedulerEventUpdateMsg schedulerEventUpdateMsg = 33; repeated ApiKeyUpdateMsg apiKeyUpdateMsg = 34; + repeated SendEmailUplinkMsg sendEmailUplinkMsg = 35; + repeated SendSmsUplinkMsg sendSmsUplinkMsg = 36; + repeated SendNotificationUplinkMsg sendNotificationUplinkMsg = 37; } message UplinkResponseMsg { diff --git a/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationService.java b/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationService.java index 68b1c01463..b9d2fe7e52 100644 --- a/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationService.java +++ b/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationService.java @@ -27,6 +27,7 @@ import org.thingsboard.server.gen.integration.ToIntegrationExecutorNotificationM import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.discovery.PartitionService; +import org.thingsboard.server.queue.discovery.QueueKey; import org.thingsboard.server.queue.discovery.TbApplicationEventListener; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; @@ -38,6 +39,7 @@ import org.thingsboard.server.queue.util.TbPackCallback; import org.thingsboard.server.queue.util.TbPackProcessingContext; import org.thingsboard.server.service.cache.IntegrationExecutorCacheStartupService; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Queue; @@ -131,39 +133,40 @@ public class DefaultClusterIntegrationService extends TbApplicationEventListener @Override protected void onTbApplicationEvent(PartitionChangeEvent event) { log.debug("Received partition change event: {}", event); + // Always enqueue first, then drain: the drain below must see this event. Enqueueing only while + // !started dropped every partition change that arrived after startup, so a node kept the partitions + // it drained at startup forever and singleton integrations ran twice (or nowhere) after a rollout. + pendingEvents.add(event); if (!started) { - // Add to queue FIRST, then check again - pendingEvents.add(event); - if (!started) { - log.debug("Integration Executor not started yet, event queued for later: {}", event); - return; // doStartup() will drain the queue - } - // started became true after we added - fall through to drain + log.debug("Integration Executor not started yet, event queued for later: {}", event); + return; // doStartup() will drain the queue } - // Either already started or just became started - drain and process the latest pending + // Either already started or just became started - drain and process the pending changes drainPendingEvents(); } - private void drainPendingEvents() { - // Each PartitionChangeEvent carries a full partition snapshot for TB_INTEGRATION_EXECUTOR, - // so earlier pending events are superseded — discard them and process only the latest. - PartitionChangeEvent latest = null; + // Synchronized so that the startup thread and an event thread cannot process two drains concurrently + // and push them to subscribeEventsMap in reverse order, which would leave older partitions applied. + private synchronized void drainPendingEvents() { + // A PartitionChangeEvent carries only the queue keys whose partitions changed (an empty set for a removed key), + // not a full snapshot: merge the pending events per queue key, the latest partitions of each key win. + Map> latestPartitions = new HashMap<>(); PartitionChangeEvent event; while ((event = pendingEvents.poll()) != null) { - latest = event; + latestPartitions.putAll(event.getNewPartitions()); } - if (latest == null) { + if (latestPartitions.isEmpty()) { return; } try { - processPartitionChangeEvent(latest); + processPartitionChanges(latestPartitions); } catch (Throwable t) { - log.error("Failed to handle partition change event: {}", latest, t); + log.error("Failed to handle partition changes: {}", latestPartitions, t); } } - private void processPartitionChangeEvent(PartitionChangeEvent event) { - event.getNewPartitions().forEach(((queueKey, partitions) -> { + private void processPartitionChanges(Map> newPartitions) { + newPartitions.forEach(((queueKey, partitions) -> { IntegrationType type = IntegrationType.valueOf(queueKey.getQueueName()); subscribeEventsMap.computeIfAbsent(type, t -> new ConcurrentLinkedQueue<>()).add(partitions); queueExecutor.submit(() -> refreshIntegrationsByType(type)); @@ -205,7 +208,7 @@ public class DefaultClusterIntegrationService extends TbApplicationEventListener } finally { // Mark as started and drain pending events even on failure, so that partition change events are not stuck in the queue forever. // After started=true, any new events will drain themselves in onTbApplicationEvent(). - // ConcurrentLinkedQueue.poll() is atomic, so each event is processed exactly once. + // drainPendingEvents() is synchronized, so partition changes are applied in the order they were queued. started = true; drainPendingEvents(); } diff --git a/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultIntegrationManagerService.java b/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultIntegrationManagerService.java index 892ea680a4..0e603d11b4 100644 --- a/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultIntegrationManagerService.java +++ b/common/integration/cluster-integration-api/src/main/java/org/thingsboard/server/service/integration/DefaultIntegrationManagerService.java @@ -447,9 +447,8 @@ public class DefaultIntegrationManagerService implements IntegrationManagerServi if (!supportedIntegrationTypes.contains(integrationType)) { return; } - if (newPartitions.isEmpty()) { - return; - } + // An empty set is a real snapshot (the node lost every partition of this type), not a no-op: + // the singleton integrations of this type must be stopped. Set ownedPartitions = newPartitions.stream() .map(tpi -> tpi.getPartition().orElse(-1)) .filter(p -> p >= 0) @@ -470,10 +469,15 @@ public class DefaultIntegrationManagerService implements IntegrationManagerServi ? state.getConfiguration() : configurationService.getIntegration(state.getTenantId(), state.getId()); } - if (integration != null && !isMineForPartitions(integration, ownedPartitions)) { + // ownedPartitions belong to integrationType only; other types are handled by their own refresh. + if (integration != null && integrationType.equals(integration.getType()) && !isMineForPartitions(integration, ownedPartitions)) { scheduleIntegrationEvent(integration.getTenantId(), integration.getId(), ComponentLifecycleEvent.STOPPED); } } + if (newPartitions.isEmpty()) { + // Nothing new to start; keep the previous behaviour for non-singleton integrations on an empty snapshot. + return; + } createIntegrations(configurationService.getActiveIntegrationList(integrationType, false), ownedPartitions); } @@ -583,13 +587,21 @@ public class DefaultIntegrationManagerService implements IntegrationManagerServi case UPDATED: case ACTIVATED: Integration configuration = configurationService.getIntegration(state.getTenantId(), state.getId()); - if (configuration != null) { + if (configuration != null && !isMine(configuration)) { + // The event was scheduled while this node owned the partition. Ownership may have moved + // since then, and the refresh that would stop it may already have run or not run yet. + log.info("[{}][{}] Skipping {}: the integration is not mine anymore, stopping it.", state.getTenantId(), state.getId(), pendingEvent); + persistCurrentStatistics(state); + processStop(state, STOPPED); + } else if (configuration != null) { processUpdateEvent(state, configuration); } else { processStop(state, DELETED); } break; case STOPPED: + processStopUnlessMine(state); + break; case SUSPENDED: case DELETED: persistCurrentStatistics(state); @@ -600,6 +612,42 @@ public class DefaultIntegrationManagerService implements IntegrationManagerServi } } + // A STOPPED scheduled because the partition moved away can be stale: the partition may come back before the event + // runs, and refresh() skips integrations that are still running. Ownership is checked again when the stop runs, and + // once more after it, because the partition may also come back while the integration is being stopped. + private void processStopUnlessMine(IntegrationState state) { + Integration configuration; + try { + configuration = configurationService.getIntegration(state.getTenantId(), state.getId()); + } catch (Exception e) { + // Without the configuration the ownership can't be checked: stop it, as before the check existed. + log.warn("[{}][{}] Failed to fetch the integration before stopping it: {}", state.getTenantId(), state.getId(), e.getMessage()); + configuration = null; + } + if (state.getIntegration() != null && shouldRunHere(configuration)) { + log.info("[{}][{}] Skipping STOPPED: the integration is mine again.", state.getTenantId(), state.getId()); + return; + } + persistCurrentStatistics(state); + processStop(state, STOPPED); + if (shouldRunHere(configuration)) { + log.info("[{}][{}] The integration is mine again after the stop, starting it.", state.getTenantId(), state.getId()); + scheduleIntegrationEvent(state.getTenantId(), state.getId(), ComponentLifecycleEvent.CREATED); + } + } + + private boolean shouldRunHere(Integration configuration) { + if (configuration == null || !configuration.isEnabled() || configuration.isRemote()) { + return false; + } + try { + return isMine(configuration); + } catch (Exception e) { + log.debug("[{}][{}] Failed to resolve integration ownership", configuration.getTenantId(), configuration.getId(), e); + return false; + } + } + private void processUpdateEvent(IntegrationState state, Integration configuration) throws Exception { state.setConfiguration(configuration); if (log.isDebugEnabled()) { @@ -762,6 +810,11 @@ public class DefaultIntegrationManagerService implements IntegrationManagerServi if (state.getConfiguration() != null && state.getCurrentState() != null && state.getCurrentState().equals(ComponentLifecycleEvent.FAILED)) { if (state.getUpdateLock().tryLock()) { try { + if (!isMine(state.getConfiguration())) { + log.info("[{}][{}] Skipping re-init: the integration is not mine anymore, stopping it.", state.getTenantId(), state.getId()); + processStop(state, STOPPED); + return; + } processUpdateEvent(state, state.getConfiguration()); } catch (Exception e) { log.trace("[{}][{}] Failed to re-initialize the integration:", state.getTenantId(), state.getId(), e); diff --git a/common/integration/cluster-integration-api/src/test/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationServiceTest.java b/common/integration/cluster-integration-api/src/test/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationServiceTest.java index 25c5ac14c1..0b0ad23b06 100644 --- a/common/integration/cluster-integration-api/src/test/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationServiceTest.java +++ b/common/integration/cluster-integration-api/src/test/java/org/thingsboard/server/service/integration/DefaultClusterIntegrationServiceTest.java @@ -2,45 +2,68 @@ // SPDX-License-Identifier: BUSL-1.1 package org.thingsboard.server.service.integration; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; +import org.springframework.boot.context.event.ApplicationReadyEvent; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.IntegrationId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.TenantProfileId; +import org.thingsboard.server.common.data.integration.IntegrationType; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; +import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.TbCallback; +import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.common.util.ProtoUtils; +import org.thingsboard.server.gen.integration.ToIntegrationExecutorDownlinkMsg; import org.thingsboard.server.gen.integration.ToIntegrationExecutorNotificationMsg; import org.thingsboard.server.gen.transport.TransportProtos.QueueDeleteMsg; import org.thingsboard.server.gen.transport.TransportProtos.QueueUpdateMsg; +import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.discovery.PartitionService; +import org.thingsboard.server.queue.discovery.QueueKey; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; +import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.provider.TbCoreIntegrationExecutorQueueFactory; import org.thingsboard.server.queue.settings.TbQueueIntegrationExecutorSettings; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) class DefaultClusterIntegrationServiceTest { + private static final long TIMEOUT_MS = 5000; + @Mock private TbServiceInfoProvider serviceInfoProvider; @Mock - private TbQueueIntegrationExecutorSettings integrationNotificationSettings; + private TbQueueIntegrationExecutorSettings settings; @Mock private TbCoreIntegrationExecutorQueueFactory queueFactory; @Mock @@ -49,15 +72,97 @@ class DefaultClusterIntegrationServiceTest { private PartitionService partitionService; @Mock private TbCallback callback; + @Mock + private TbQueueConsumer> mqttConsumer; + @Mock + private TbQueueConsumer> httpConsumer; private DefaultClusterIntegrationService service; private final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID()); @BeforeEach + @SuppressWarnings("unchecked") void setUp() { - service = new DefaultClusterIntegrationService(serviceInfoProvider, integrationNotificationSettings, queueFactory, - integrationManagerService, partitionService); + when(serviceInfoProvider.getSupportedIntegrationTypes()).thenReturn(List.of(IntegrationType.MQTT, IntegrationType.HTTP)); + when(queueFactory.createToIntegrationExecutorNotificationsMsgConsumer()) + .thenReturn(mock(TbQueueConsumer.class)); + when(queueFactory.createToIntegrationExecutorDownlinkMsgConsumer(IntegrationType.MQTT)).thenReturn(mqttConsumer); + when(queueFactory.createToIntegrationExecutorDownlinkMsgConsumer(IntegrationType.HTTP)).thenReturn(httpConsumer); + service = new DefaultClusterIntegrationService(serviceInfoProvider, settings, queueFactory, integrationManagerService, partitionService) { + @Override + protected void launchMainConsumers() { + } + + @Override + protected void launchNotificationsConsumer() { + } + }; + service.init(); + } + + @AfterEach + void tearDown() { + service.stop(); + } + + @Test + void givenStarted_whenPartitionsChange_thenEveryNewSnapshotIsApplied() { + // Rolling restart: [1] and [0, 2] arrive before startup completes, [1] arrives after it. + service.onApplicationEvent(partitionChangeEvent(1)); + service.onApplicationEvent(partitionChangeEvent(0, 2)); + service.onApplicationEvent((ApplicationReadyEvent) null); + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(IntegrationType.MQTT, tpis(0, 2)); + + service.onApplicationEvent(partitionChangeEvent(1)); + + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(IntegrationType.MQTT, tpis(1)); + verify(mqttConsumer, timeout(TIMEOUT_MS)).subscribe(tpis(1)); + InOrder inOrder = inOrder(integrationManagerService); + inOrder.verify(integrationManagerService).refresh(IntegrationType.MQTT, tpis(0, 2)); + inOrder.verify(integrationManagerService).refresh(IntegrationType.MQTT, tpis(1)); + } + + @Test + void givenLongRunningNode_whenPartitionsFlipFlop_thenLatestSnapshotIsApplied() { + // Long-running node: started long ago with [2], then a neighbour restarts -> [1] -> [2]. + service.onApplicationEvent(partitionChangeEvent(2)); + service.onApplicationEvent((ApplicationReadyEvent) null); + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(IntegrationType.MQTT, tpis(2)); + + service.onApplicationEvent(partitionChangeEvent(1)); + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(IntegrationType.MQTT, tpis(1)); + service.onApplicationEvent(partitionChangeEvent(2)); + + verify(integrationManagerService, timeout(TIMEOUT_MS).times(2)).refresh(IntegrationType.MQTT, tpis(2)); + InOrder inOrder = inOrder(integrationManagerService, mqttConsumer); + inOrder.verify(mqttConsumer).subscribe(tpis(1)); + inOrder.verify(mqttConsumer).subscribe(tpis(2)); + } + + @Test + void givenStarted_whenNodeLosesAllPartitions_thenEmptySnapshotIsApplied() { + service.onApplicationEvent(partitionChangeEvent(0)); + service.onApplicationEvent((ApplicationReadyEvent) null); + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(IntegrationType.MQTT, tpis(0)); + + service.onApplicationEvent(partitionChangeEvent()); + + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(eq(IntegrationType.MQTT), eq(Collections.emptySet())); + } + + @Test + void givenEventsForDifferentTypesPendingAtStartup_whenStarted_thenEveryTypeGetsItsLatestPartitions() { + // An event carries only the queue keys whose partitions changed: a later MQTT-only event must not hide HTTP. + service.onApplicationEvent(partitionChangeEvent(Map.of(IntegrationType.MQTT, tpis(0), IntegrationType.HTTP, tpis(1)))); + service.onApplicationEvent(partitionChangeEvent(Map.of(IntegrationType.MQTT, tpis(2)))); + service.onApplicationEvent((ApplicationReadyEvent) null); + + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(IntegrationType.HTTP, tpis(1)); + verify(httpConsumer, timeout(TIMEOUT_MS)).subscribe(tpis(1)); + verify(integrationManagerService, timeout(TIMEOUT_MS)).refresh(IntegrationType.MQTT, tpis(2)); + verify(mqttConsumer, timeout(TIMEOUT_MS)).subscribe(tpis(2)); + verify(integrationManagerService, never()).refresh(IntegrationType.MQTT, tpis(0)); } @Test @@ -134,4 +239,21 @@ class DefaultClusterIntegrationServiceTest { service.handleNotification(id, new TbProtoQueueMsg<>(id, nf), callback); } + private static PartitionChangeEvent partitionChangeEvent(Integer... partitions) { + return partitionChangeEvent(Map.of(IntegrationType.MQTT, tpis(partitions))); + } + + private static PartitionChangeEvent partitionChangeEvent(Map> partitionsByType) { + Map> newPartitions = partitionsByType.entrySet().stream().collect(Collectors.toMap( + e -> new QueueKey(ServiceType.TB_INTEGRATION_EXECUTOR, e.getKey().name()), Map.Entry::getValue)); + return new PartitionChangeEvent(DefaultClusterIntegrationServiceTest.class, ServiceType.TB_INTEGRATION_EXECUTOR, + newPartitions, Collections.emptyMap()); + } + + private static Set tpis(Integer... partitions) { + return Arrays.stream(partitions) + .map(p -> new TopicPartitionInfo("tb_ie.downlink.mqtt", null, p, true)) + .collect(Collectors.toSet()); + } + } diff --git a/common/integration/cluster-integration-api/src/test/java/org/thingsboard/server/service/integration/DefaultIntegrationManagerServiceTest.java b/common/integration/cluster-integration-api/src/test/java/org/thingsboard/server/service/integration/DefaultIntegrationManagerServiceTest.java new file mode 100644 index 0000000000..2fd8d6d93b --- /dev/null +++ b/common/integration/cluster-integration-api/src/test/java/org/thingsboard/server/service/integration/DefaultIntegrationManagerServiceTest.java @@ -0,0 +1,434 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.service.integration; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.MockedStatic; +import org.mockito.junit.jupiter.MockitoExtension; +import org.mockito.junit.jupiter.MockitoSettings; +import org.mockito.quality.Strictness; +import org.springframework.test.util.ReflectionTestUtils; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.integration.api.IntegrationContext; +import org.thingsboard.integration.api.IntegrationStatisticsService; +import org.thingsboard.integration.api.ThingsboardPlatformIntegration; +import org.thingsboard.integration.api.converter.TBUplinkDataConverter; +import org.thingsboard.integration.api.util.IntegrationUtil; +import org.thingsboard.server.common.data.id.ConverterId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.IntegrationId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; +import org.thingsboard.server.common.data.integration.IntegrationType; +import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; +import org.thingsboard.server.common.msg.notification.NotificationRuleProcessor; +import org.thingsboard.server.common.msg.queue.ServiceType; +import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; +import org.thingsboard.server.queue.discovery.PartitionService; +import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; +import org.thingsboard.server.queue.discovery.TopicService; +import org.thingsboard.server.queue.provider.TbQueueProducerProvider; +import org.thingsboard.server.queue.settings.TbQueueIntegrationExecutorSettings; +import org.thingsboard.server.service.converter.DataConverterService; +import org.thingsboard.server.service.integration.state.IntegrationState; + +import java.util.ArrayDeque; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Queue; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ScheduledExecutorService; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +@MockitoSettings(strictness = Strictness.LENIENT) +class DefaultIntegrationManagerServiceTest { + + private static final TenantId TENANT_ID = TenantId.fromUUID(UUID.randomUUID()); + + @Mock + private TbServiceInfoProvider serviceInfoProvider; + @Mock + private PartitionService partitionService; + @Mock + private TopicService topicService; + @Mock + private IntegrationContextProvider integrationContextProvider; + @Mock + private IntegrationConfigurationService configurationService; + @Mock + private DataConverterService dataConverterService; + @Mock + private EventStorageService eventStorageService; + @Mock + private TbQueueProducerProvider producerProvider; + @Mock + private NotificationRuleProcessor notificationRuleProcessor; + @Mock + private IntegrationStatisticsService integrationStatisticsService; + @Mock + private TbQueueIntegrationExecutorSettings integrationExecutorSettings; + + private DefaultIntegrationManagerService service; + private MockedStatic integrationUtil; + + // The partitions this node currently owns, as HashPartitionService.myPartitions would report them. + private final Set livePartitions = new HashSet<>(); + private final Map partitionByEntity = new HashMap<>(); + private final Map configurations = new HashMap<>(); + private final Map> platformIntegrations = new HashMap<>(); + // Tasks submitted to the lifecycle executor; they run only when the test calls runLifecycleTasks(). + private final Queue lifecycleTasks = new ArrayDeque<>(); + + @BeforeEach + void setUp() throws Exception { + service = new DefaultIntegrationManagerService(serviceInfoProvider, partitionService, topicService, integrationContextProvider, + configurationService, dataConverterService, eventStorageService, producerProvider, notificationRuleProcessor, + Optional.empty(), Optional.empty(), integrationStatisticsService, integrationExecutorSettings, + Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + ReflectionTestUtils.setField(service, "reInitEnabled", false); + ReflectionTestUtils.setField(service, "statisticsEnabled", false); + when(serviceInfoProvider.getSupportedIntegrationTypes()).thenReturn(List.of(IntegrationType.MQTT, IntegrationType.HTTP)); + service.init(); + ((ScheduledExecutorService) ReflectionTestUtils.getField(service, "lifecycleExecutorService")).shutdownNow(); + ScheduledExecutorService lifecycleExecutor = mock(ScheduledExecutorService.class); + doAnswer(inv -> { + lifecycleTasks.add(inv.getArgument(0)); + return null; + }).when(lifecycleExecutor).submit(any(Runnable.class)); + doAnswer(inv -> { + lifecycleTasks.add(inv.getArgument(0)); + return null; + }).when(lifecycleExecutor).schedule(any(Runnable.class), anyLong(), any()); + ReflectionTestUtils.setField(service, "lifecycleExecutorService", lifecycleExecutor); + + when(partitionService.resolve(eq(ServiceType.TB_INTEGRATION_EXECUTOR), anyString(), any(TenantId.class), any(EntityId.class))).thenAnswer(inv -> { + EntityId entityId = inv.getArgument(3); + int partition = partitionByEntity.get(entityId.getId()); + return new TopicPartitionInfo("tb_ie.downlink.mqtt", null, partition, livePartitions.contains(partition)); + }); + when(configurationService.getIntegration(any(TenantId.class), any(IntegrationId.class))) + .thenAnswer(inv -> configurations.get((IntegrationId) inv.getArgument(1))); + when(integrationContextProvider.buildIntegrationContext(any())).thenReturn(mock(IntegrationContext.class)); + when(dataConverterService.getUplinkConverterById(any(), any())).thenReturn(Optional.of(mock(TBUplinkDataConverter.class))); + when(dataConverterService.getDownlinkConverterById(any(), any())).thenReturn(Optional.empty()); + + integrationUtil = mockStatic(IntegrationUtil.class); + integrationUtil.when(() -> IntegrationUtil.createPlatformIntegration(any(), any(), anyBoolean(), any())).thenAnswer(inv -> { + Integration configuration = configurations.values().stream() + .filter(i -> i.getConfiguration() == inv.getArgument(1)).findFirst().orElseThrow(); + return platformIntegrations.get(configuration.getId()); + }); + } + + @AfterEach + void tearDown() { + integrationUtil.close(); + service.stop(); + } + + @Test + void givenCreatedScheduledWhileOwned_whenPartitionMovesAwayBeforeItRuns_thenIntegrationIsNotStarted() throws Exception { + Integration integration = mqttIntegration(0); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + + // Rolling restart: this node owns [1], then briefly [0, 2] - the refresh schedules CREATED for the partition 0 singleton. + ownPartitions(1); + service.refresh(IntegrationType.MQTT, tpis(1)); + ownPartitions(0, 2); + service.refresh(IntegrationType.MQTT, tpis(0, 2)); + assertThat(lifecycleTasks).isNotEmpty(); + + // Ownership moves back to [1] before the lifecycle executor gets to the CREATED event (it is busy with a + // backlog of slow inits, and the refresh for [1] has not stopped this one yet). + ownPartitions(1); + runLifecycleTasks(); + + verify(platformIntegration, never()).init(any()); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenCreatedScheduledWhileOwned_whenPartitionMovesAwayAndRefreshRuns_thenIntegrationIsNotStarted() throws Exception { + Integration integration = mqttIntegration(0); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + + ownPartitions(1); + service.refresh(IntegrationType.MQTT, tpis(1)); + ownPartitions(0, 2); + service.refresh(IntegrationType.MQTT, tpis(0, 2)); + ownPartitions(1); + service.refresh(IntegrationType.MQTT, tpis(1)); + runLifecycleTasks(); + + verify(platformIntegration, never()).init(any()); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenRunningIntegration_whenUpdateArrivesAfterPartitionMovedAway_thenIntegrationIsStopped() throws Exception { + Integration integration = mqttIntegration(0); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + + ownPartitions(0, 2); + service.refresh(IntegrationType.MQTT, tpis(0, 2)); + runLifecycleTasks(); + verify(platformIntegration).init(any()); + + // An UPDATED scheduled through a path that captured ownership earlier (e.g. createIntegrations of a stale snapshot) + ownPartitions(1); + ReflectionTestUtils.invokeMethod(service, "scheduleIntegrationEvent", TENANT_ID, integration.getId(), + ComponentLifecycleEvent.UPDATED); + runLifecycleTasks(); + + verify(platformIntegration, never()).update(any()); + verify(platformIntegration).destroy(); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenStopQueuedForLostPartition_whenPartitionComesBackBeforeItRuns_thenIntegrationKeepsRunning() throws Exception { + Integration integration = mqttIntegration(2); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + ownPartitions(2); + service.refresh(IntegrationType.MQTT, tpis(2)); + runLifecycleTasks(); + verify(platformIntegration).init(any()); + + // A neighbour restarts: [1] queues STOPPED, [2] arrives before the lifecycle executor runs it. + // refresh([2]) skips the integration because it is still running. + ownPartitions(1); + service.refresh(IntegrationType.MQTT, tpis(1)); + ownPartitions(2); + service.refresh(IntegrationType.MQTT, tpis(2)); + runLifecycleTasks(); + + verify(platformIntegration, never()).destroy(); + assertThat(integrationStates().get(integration.getId()).getCurrentState()).isEqualTo(ComponentLifecycleEvent.STARTED); + } + + @Test + void givenSingletonBeingStopped_whenPartitionComesBackDuringStop_thenIntegrationIsCreatedAgain() throws Exception { + Integration integration = mqttIntegration(2); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + ownPartitions(2); + service.refresh(IntegrationType.MQTT, tpis(2)); + runLifecycleTasks(); + + ownPartitions(1); + service.refresh(IntegrationType.MQTT, tpis(1)); + // The partition comes back while the stop is in progress, after its ownership check. + doAnswer(inv -> { + ownPartitions(2); + return null; + }).when(platformIntegration).destroy(); + runLifecycleTasks(); + + verify(platformIntegration).destroy(); + verify(platformIntegration, times(2)).init(any()); + assertThat(integrationStates().get(integration.getId()).getCurrentState()).isEqualTo(ComponentLifecycleEvent.STARTED); + } + + @Test + void givenStopQueued_whenConfigurationFetchFails_thenIntegrationIsStopped() throws Exception { + Integration integration = mqttIntegration(2); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + ownPartitions(2); + service.refresh(IntegrationType.MQTT, tpis(2)); + runLifecycleTasks(); + + ownPartitions(1); + service.refresh(IntegrationType.MQTT, tpis(1)); + ownPartitions(2); + when(configurationService.getIntegration(any(TenantId.class), any(IntegrationId.class))).thenThrow(new RuntimeException("timeout")); + runLifecycleTasks(); + + verify(platformIntegration).destroy(); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenRunningSingletonSwitchedToRemote_whenStopRuns_thenItIsStoppedAlthoughPartitionIsMine() throws Exception { + Integration integration = mqttIntegration(2); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + ownPartitions(2); + service.refresh(IntegrationType.MQTT, tpis(2)); + runLifecycleTasks(); + + integration.setRemote(true); + ReflectionTestUtils.invokeMethod(service, "scheduleIntegrationEvent", TENANT_ID, integration.getId(), + ComponentLifecycleEvent.STOPPED); + runLifecycleTasks(); + + verify(platformIntegration).destroy(); + verify(platformIntegration).init(any()); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenLongRunningSingleton_whenPartitionMovesAway_thenRefreshStopsIt() throws Exception { + Integration integration = mqttIntegration(1); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + + ownPartitions(1); + service.refresh(IntegrationType.MQTT, tpis(1)); + runLifecycleTasks(); + verify(platformIntegration).init(any()); + + // Hours later a neighbour restarts and partition 1 goes back to it. + ownPartitions(2); + service.refresh(IntegrationType.MQTT, tpis(2)); + runLifecycleTasks(); + + verify(platformIntegration).destroy(); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenRunningSingleton_whenRefreshedWithEmptyPartitions_thenIntegrationIsStopped() throws Exception { + Integration integration = mqttIntegration(0); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + + ownPartitions(0); + service.refresh(IntegrationType.MQTT, tpis(0)); + runLifecycleTasks(); + verify(platformIntegration).init(any()); + + ownPartitions(); + service.refresh(IntegrationType.MQTT, Collections.emptySet()); + runLifecycleTasks(); + + verify(platformIntegration).destroy(); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenEmptyPartitions_whenRefreshed_thenNonSingletonIntegrationsAreNotCreated() throws Exception { + Integration integration = mqttIntegration(0); + integration.setType(IntegrationType.HTTP); + when(configurationService.getActiveIntegrationList(IntegrationType.HTTP, false)).thenReturn(List.of(integration)); + + ownPartitions(); + service.refresh(IntegrationType.HTTP, Collections.emptySet()); + runLifecycleTasks(); + + verify(platformIntegrations.get(integration.getId()), never()).init(any()); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + @Test + void givenRunningSingletonOfAnotherType_whenRefreshedForOtherType_thenItIsNotStopped() throws Exception { + Integration integration = mqttIntegration(0); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + + ownPartitions(0); + service.refresh(IntegrationType.MQTT, tpis(0)); + runLifecycleTasks(); + verify(platformIntegration).init(any()); + + // HTTP partitions say nothing about MQTT ownership. + service.refresh(IntegrationType.HTTP, Collections.emptySet()); + runLifecycleTasks(); + + verify(platformIntegration, never()).destroy(); + assertThat(integrationStates()).containsKey(integration.getId()); + } + + @Test + void givenFailedIntegration_whenPartitionMovedAway_thenReInitStopsItInsteadOfStartingIt() throws Exception { + Integration integration = mqttIntegration(0); + ThingsboardPlatformIntegration platformIntegration = platformIntegrations.get(integration.getId()); + doThrow(new RuntimeException("Failed to connect to MQTT broker")).when(platformIntegration).init(any()); + when(configurationService.getActiveIntegrationList(IntegrationType.MQTT, false)).thenReturn(List.of(integration)); + + ownPartitions(0, 2); + service.refresh(IntegrationType.MQTT, tpis(0, 2)); + runLifecycleTasks(); + verify(platformIntegration, times(1)).init(any()); + assertThat(integrationStates()).containsKey(integration.getId()); + + ownPartitions(1); + ReflectionTestUtils.invokeMethod(service, "reInitIntegrations"); + + verify(platformIntegration, times(1)).init(any()); + assertThat(integrationStates()).doesNotContainKey(integration.getId()); + } + + private Integration mqttIntegration(int partition) { + IntegrationId id = new IntegrationId(UUID.randomUUID()); + Integration integration = new Integration(id); + integration.setTenantId(TENANT_ID); + integration.setName("MQTT " + id); + integration.setType(IntegrationType.MQTT); + integration.setRoutingKey(id.getId().toString()); + integration.setEnabled(true); + integration.setDefaultConverterId(new ConverterId(UUID.randomUUID())); + integration.setConfiguration(JacksonUtil.newObjectNode().put("id", id.getId().toString())); + partitionByEntity.put(id.getId(), partition); + configurations.put(id, integration); + ThingsboardPlatformIntegration platformIntegration = mock(ThingsboardPlatformIntegration.class); + when(platformIntegration.getConfiguration()).thenReturn(integration); + platformIntegrations.put(id, platformIntegration); + return integration; + } + + private void ownPartitions(Integer... partitions) { + livePartitions.clear(); + Collections.addAll(livePartitions, partitions); + } + + private Set tpis(Integer... partitions) { + return Arrays.stream(partitions) + .map(p -> new TopicPartitionInfo("tb_ie.downlink.mqtt", null, p, true)) + .collect(Collectors.toSet()); + } + + private void runLifecycleTasks() { + Runnable task; + while ((task = lifecycleTasks.poll()) != null) { + task.run(); + } + } + + @SuppressWarnings("unchecked") + private ConcurrentMap integrationStates() { + return (ConcurrentMap) ReflectionTestUtils.getField(service, "integrations"); + } + +} diff --git a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/AbstractUplinkDataConverter.java b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/AbstractUplinkDataConverter.java index 599c431468..b0f981f181 100644 --- a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/AbstractUplinkDataConverter.java +++ b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/AbstractUplinkDataConverter.java @@ -54,7 +54,7 @@ public abstract class AbstractUplinkDataConverter extends AbstractDataConverter protected final Map> currentUpdateOnlyTelemetryPerEntity = new ConcurrentHashMap<>(); protected final Map> currentUpdateOnlyAttributesPerEntity = new ConcurrentHashMap<>(); - private ConverterUnwrapper converterUnwrapper; + protected ConverterUnwrapper converterUnwrapper; public AbstractUplinkDataConverter(JsInvokeService jsInvokeService, TbelInvokeService tbelInvokeService, LogSettingsComponent logSettings) { super(jsInvokeService, tbelInvokeService, logSettings); diff --git a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedConverterUtil.java b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedConverterUtil.java index 0d270db56d..a944217d1d 100644 --- a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedConverterUtil.java +++ b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedConverterUtil.java @@ -3,15 +3,19 @@ package org.thingsboard.integration.api.converter; import com.google.gson.Gson; +import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.integration.api.data.UplinkMetaData; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.data.util.CollectionsUtil; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.function.Function; @@ -31,28 +35,36 @@ public final class DedicatedConverterUtil { } public static DedicatedUplinkData parseUplinkData(DedicatedConverterConfig config, JsonObject src, UplinkMetaData metadata) { + return parseUplinkData(config, src, metadata, Collections.emptySet()); + } + + // String values of unwrapperKeys skip the type cast, so devAddr "01020304" stays a string. + public static DedicatedUplinkData parseUplinkData(DedicatedConverterConfig config, JsonObject src, UplinkMetaData metadata, Set unwrapperKeys) { Map kvMap = new HashMap<>(metadata.getKvMap()); + Set telemetryNoCastKeys = new HashSet<>(); + Set attributesNoCastKeys = new HashSet<>(); JsonElement telemetry; if (src.has(TELEMETRY)) { telemetry = src.get(TELEMETRY); if (telemetry.isJsonArray()) { - JsonObject telemetryFromMetadata = addKvs(new JsonObject(), kvMap, config.getTelemetry()); - if (!telemetryFromMetadata.isEmpty()) { - telemetry.getAsJsonArray().add(telemetryFromMetadata); - } + JsonArray telemetryArray = telemetry.getAsJsonArray(); + Set decoderKeys = getTelemetryKeys(telemetryArray); + addMetadataTelemetry(telemetryArray, kvMap, config.getTelemetry(), unwrapperKeys, telemetryNoCastKeys); + // The no-cast keys apply to every array element, so a key the decoder also sends is cast as before. + telemetryNoCastKeys.removeAll(decoderKeys); } else if (telemetry.isJsonObject()) { var obj = telemetry.getAsJsonObject(); if (obj.has(VALUES)) { var values = obj.get(VALUES).getAsJsonObject(); - addKvs(values, kvMap, config.getTelemetry()); + addKvs(values, kvMap, config.getTelemetry(), unwrapperKeys, telemetryNoCastKeys); } else { - addKvs(obj, kvMap, config.getTelemetry()); + addKvs(obj, kvMap, config.getTelemetry(), unwrapperKeys, telemetryNoCastKeys); } } } else { - telemetry = addKvs(new JsonObject(), kvMap, config.getTelemetry()); + telemetry = addKvs(new JsonObject(), kvMap, config.getTelemetry(), unwrapperKeys, telemetryNoCastKeys); } JsonObject attributes; @@ -62,7 +74,7 @@ public final class DedicatedConverterUtil { attributes = new JsonObject(); } - addKvs(attributes, kvMap, config.getAttributes()); + addKvs(attributes, kvMap, config.getAttributes(), unwrapperKeys, attributesNoCastKeys); EntityType entityType = getProperty(src, "type", EntityType::valueOf, config::getType); String entityName = getProperty(src, "name", () -> processTemplate(config.getName(), kvMap)); @@ -83,6 +95,8 @@ public final class DedicatedConverterUtil { .group(group) .telemetry(telemetry) .attributes(attributes) + .telemetryNoCastKeys(telemetryNoCastKeys) + .attributesNoCastKeys(attributesNoCastKeys) .build(); } @@ -101,11 +115,76 @@ public final class DedicatedConverterUtil { return defaultValue.get(); } - private static JsonObject addKvs(JsonObject kvsObj, Map kvMap, Set keys) { + // The metadata keys join the script's element at the uplink ts, where the script's values win as in an object result. + // Without such an element they get their own one at the uplink ts: an element without ts is saved at the server time. + private static void addMetadataTelemetry(JsonArray telemetry, Map kvMap, Set keys, Set unwrapperKeys, Set noCastKeys) { + Long uplinkTs = getUplinkTs(kvMap); + if (uplinkTs != null) { + for (JsonElement element : telemetry) { + if (element.isJsonObject() && isValuesAtTs(element.getAsJsonObject(), uplinkTs)) { + addKvs(element.getAsJsonObject().getAsJsonObject(VALUES), kvMap, keys, unwrapperKeys, noCastKeys); + return; + } + } + } + JsonObject values = addKvs(new JsonObject(), kvMap, keys, unwrapperKeys, noCastKeys); + if (values.isEmpty()) { + return; + } + if (uplinkTs == null) { + telemetry.add(values); + return; + } + JsonObject element = new JsonObject(); + element.addProperty(TS, uplinkTs); + element.add(VALUES, values); + telemetry.add(element); + } + + private static boolean isValuesAtTs(JsonObject element, long ts) { + JsonElement elementTs = element.get(TS); + if (!element.has(VALUES) || !element.get(VALUES).isJsonObject() || elementTs == null || !elementTs.isJsonPrimitive()) { + return false; + } + JsonPrimitive primitive = elementTs.getAsJsonPrimitive(); + // A script passes a numeric-string metadata ts through unchanged, and the telemetry parser reads it as a long too + return (primitive.isNumber() || (primitive.isString() && StringUtils.isNumeric(primitive.getAsString()))) + && primitive.getAsLong() == ts; + } + + private static Long getUplinkTs(Map kvMap) { + Object ts = kvMap.get(TS); + if (ts instanceof Number number) { + return number.longValue(); + } + if (ts instanceof String str && StringUtils.isNumeric(str)) { + return Long.parseLong(str); + } + return null; + } + + private static Set getTelemetryKeys(JsonArray telemetry) { + Set keys = new HashSet<>(); + for (JsonElement element : telemetry) { + if (element.isJsonObject()) { + JsonObject obj = element.getAsJsonObject(); + JsonElement values = obj.get(VALUES); + keys.addAll(values != null && values.isJsonObject() ? values.getAsJsonObject().keySet() : obj.keySet()); + } + } + return keys; + } + + private static JsonObject addKvs(JsonObject kvsObj, Map kvMap, Set keys, Set unwrapperKeys, Set noCastKeys) { if (CollectionsUtil.isNotEmpty(keys) && !kvMap.isEmpty()) { kvMap.entrySet().stream() .filter(e -> keys.contains(e.getKey()) && !kvsObj.has(e.getKey())) - .forEach(e -> kvsObj.add(e.getKey(), GSON.toJsonTree(e.getValue()))); + .forEach(e -> { + kvsObj.add(e.getKey(), GSON.toJsonTree(e.getValue())); + if (e.getValue() instanceof String && unwrapperKeys.contains(e.getKey())) { + noCastKeys.add(e.getKey()); + } + }); } return kvsObj; } diff --git a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverter.java b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverter.java index 8098512b21..7f99ff891f 100644 --- a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverter.java +++ b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverter.java @@ -11,6 +11,7 @@ import org.thingsboard.integration.api.util.LogSettingsComponent; import org.thingsboard.script.api.ScriptInvokeService; import org.thingsboard.script.api.js.JsInvokeService; import org.thingsboard.script.api.tbel.TbelInvokeService; +import org.thingsboard.server.common.adaptor.JsonConverter; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.converter.Converter; import org.thingsboard.server.common.data.script.ScriptLanguage; @@ -58,7 +59,7 @@ public class DedicatedScriptUplinkDataConverter extends AbstractUplinkDataConver @Override protected UplinkData parseUplinkData(JsonObject src, UplinkMetaData metadata) { - DedicatedUplinkData uplinkData = DedicatedConverterUtil.parseUplinkData(config, src, metadata); + DedicatedUplinkData uplinkData = DedicatedConverterUtil.parseUplinkData(config, src, metadata, converterUnwrapper.getKeys()); boolean isAsset = uplinkData.getEntityType() == EntityType.ASSET; @@ -95,13 +96,13 @@ public class DedicatedScriptUplinkDataConverter extends AbstractUplinkDataConver Map currentOnValueTelemetryUpdate = this.currentUpdateOnlyTelemetryPerEntity.getOrDefault(name, new ConcurrentHashMap<>()); Map currentOnValueAttributesUpdate = this.currentUpdateOnlyAttributesPerEntity.getOrDefault(name, new ConcurrentHashMap<>()); - TransportProtos.PostTelemetryMsg parsedTelemetry = parseTelemetry(uplinkData.getTelemetryJson()); + TransportProtos.PostTelemetryMsg parsedTelemetry = JsonConverter.convertToTelemetryProto(uplinkData.getTelemetryJson(), uplinkData.getTelemetryNoCastKeys()); if (!this.updateOnlyKeys.isEmpty()) { parsedTelemetry = filterTelemetryOnKeyValueUpdateAndUpdateMap(parsedTelemetry, currentOnValueTelemetryUpdate); } builder.telemetry(parsedTelemetry); - TransportProtos.PostAttributeMsg parsedAttributes = parseAttributesUpdate(uplinkData.getAttributesJson()); + TransportProtos.PostAttributeMsg parsedAttributes = JsonConverter.convertToAttributesProto(uplinkData.getAttributesJson(), uplinkData.getAttributesNoCastKeys()); if (!this.updateOnlyKeys.isEmpty()) { parsedAttributes = filterAttributeOnKeyValueUpdateAndUpdateMap(parsedAttributes, currentOnValueAttributesUpdate); } diff --git a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedUplinkData.java b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedUplinkData.java index be46b58539..f0fe325bc6 100644 --- a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedUplinkData.java +++ b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/DedicatedUplinkData.java @@ -10,6 +10,8 @@ import lombok.Builder; import lombok.Data; import org.thingsboard.server.common.data.EntityType; +import java.util.Set; + @Builder @Data @JsonInclude(JsonInclude.Include.NON_NULL) @@ -22,6 +24,10 @@ public class DedicatedUplinkData { private final String group; private final JsonElement telemetry; private final JsonElement attributes; + @JsonIgnore + private final Set telemetryNoCastKeys; + @JsonIgnore + private final Set attributesNoCastKeys; @JsonRawValue public String getTelemetry() { diff --git a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/wrapper/ThingsStackConverterUnwrapper.java b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/wrapper/ThingsStackConverterUnwrapper.java index b7d0f67211..f9cf07a5bf 100644 --- a/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/wrapper/ThingsStackConverterUnwrapper.java +++ b/common/integration/integration-api/src/main/java/org/thingsboard/integration/api/converter/wrapper/ThingsStackConverterUnwrapper.java @@ -13,6 +13,12 @@ import java.util.Map; public class ThingsStackConverterUnwrapper extends AbstractConverterUnwrapper { + // Proto3 JSON writes 64-bit integers as strings, so these numeric fields arrive as "868100000" and are parsed back to numbers. + private static final ImmutableMap INT64_KEYS_MAPPING = ImmutableMap.of( + "frequency", "/uplink_message/settings/frequency" + ); + + // Map 64-bit integer (int64, uint64) fields in INT64_KEYS_MAPPING, not here. private static final ImmutableMap KEYS_MAPPING; static { @@ -34,7 +40,6 @@ public class ThingsStackConverterUnwrapper extends AbstractConverterUnwrapper { .put("spreadingFactor", "/uplink_message/settings/data_rate/lora/spreading_factor") .put("dataRateIndex", "/uplink_message/settings/data_rate_index") .put("codeRate", "/uplink_message/settings/coding_rate") - .put("frequency", "/uplink_message/settings/frequency") .put("timestamp", "/uplink_message/settings/timestamp") .put("time", "/uplink_message/settings/time") .put("consumedAirtime", "/uplink_message/consumed_airtime") @@ -58,9 +63,25 @@ public class ThingsStackConverterUnwrapper extends AbstractConverterUnwrapper { .put("simulated", "/simulated") .put("rssi", "") .put("snr", "") + .put("channel", "") + .putAll(INT64_KEYS_MAPPING) .build(); } + @Override + protected void addGatewayAdditionalInfo(Map kvMap, JsonNode payloadJson) { + super.addGatewayAdditionalInfo(kvMap, payloadJson); + JsonNode rxMetadata = findByMaxRssi(payloadJson.at(getGatewayInfoPath())); + if (rxMetadata != null && rxMetadata.has("channel_index")) { + kvMap.put("channel", rxMetadata.get("channel_index").asInt()); + } + // The Things Stack moved the coding rate from the settings into the LoRa data rate + JsonNode loraCodingRate = payloadJson.at("/uplink_message/settings/data_rate/lora/coding_rate"); + if (!kvMap.containsKey("codeRate") && loraCodingRate.isTextual()) { + kvMap.put("codeRate", loraCodingRate.asText()); + } + } + @Override protected String getGatewayInfoPath() { return "/uplink_message/rx_metadata"; @@ -82,6 +103,7 @@ public class ThingsStackConverterUnwrapper extends AbstractConverterUnwrapper { @Override protected void postMapping(Map kvMap) { + INT64_KEYS_MAPPING.keySet().forEach(key -> kvMap.computeIfPresent(key, (k, value) -> value instanceof String str ? parseLong(str, value) : value)); long ts = 0; if (kvMap.containsKey("uplinkMessageReceivedAt")) { var uplinkMessageReceivedAtTs = parseDateToTimestamp(kvMap.get("uplinkMessageReceivedAt").toString()); @@ -105,6 +127,14 @@ public class ThingsStackConverterUnwrapper extends AbstractConverterUnwrapper { kvMap.put("ts", ts); } + private static Object parseLong(String str, Object defaultValue) { + try { + return Long.parseLong(str); + } catch (NumberFormatException e) { + return defaultValue; + } + } + @Override protected ImmutableMap getKeysMapping() { return KEYS_MAPPING; diff --git a/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverterTest.java b/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverterTest.java index 155b9ac6c8..15ea42a432 100644 --- a/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverterTest.java +++ b/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/DedicatedScriptUplinkDataConverterTest.java @@ -2,33 +2,189 @@ // SPDX-License-Identifier: BUSL-1.1 package org.thingsboard.integration.api.converter; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.springframework.test.util.ReflectionTestUtils; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.integration.api.converter.wrapper.ChirpStackConverterUnwrapper; +import org.thingsboard.integration.api.converter.wrapper.ConverterUnwrapper; +import org.thingsboard.integration.api.converter.wrapper.LoriotConverterUnwrapper; +import org.thingsboard.integration.api.converter.wrapper.ThingParkConverterUnwrapper; +import org.thingsboard.integration.api.converter.wrapper.ThingsStackConverterUnwrapper; import org.thingsboard.integration.api.data.ContentType; import org.thingsboard.integration.api.data.UplinkData; import org.thingsboard.integration.api.data.UplinkMetaData; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.gen.transport.TransportProtos; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; +import static org.thingsboard.server.gen.transport.TransportProtos.KeyValueType.DOUBLE_V; +import static org.thingsboard.server.gen.transport.TransportProtos.KeyValueType.LONG_V; +import static org.thingsboard.server.gen.transport.TransportProtos.KeyValueType.STRING_V; public class DedicatedScriptUplinkDataConverterTest { private DedicatedScriptUplinkDataConverter uplinkDataConverter; + private final ConverterUnwrapper thingsStackUnwrapper = new ThingsStackConverterUnwrapper(); @BeforeEach public void startup() { uplinkDataConverter = new DedicatedScriptUplinkDataConverter(any(), any(), any()); + ReflectionTestUtils.setField(uplinkDataConverter, "converterUnwrapper", thingsStackUnwrapper); + } + + @ParameterizedTest + @ValueSource(strings = {"01020304", "01a44d4c"}) + public void parseUplinkDataKeepsStringIdentifiersInAttributesTest(String devAddr) throws Exception { + setConfig(Set.of("devAddr", "eui", "fCnt", "rssi", "snr", "frequency"), null); + + UplinkData uplink = uplinkDataConverter.parseUplinkData(new JsonObject(), unwrapThingsStack(devAddr)); + + Map attributes = toMap(uplink.getAttributesUpdate().getKvList()); + assertKv(attributes.get("devAddr"), STRING_V, devAddr); + assertKv(attributes.get("eui"), STRING_V, "1000000000000001"); + assertKv(attributes.get("fCnt"), LONG_V, 101L); + assertKv(attributes.get("rssi"), LONG_V, -22L); + assertKv(attributes.get("snr"), DOUBLE_V, 11.0); + assertKv(attributes.get("frequency"), LONG_V, 868100000L); + } + + @ParameterizedTest + @ValueSource(strings = {"01020304", "01a44d4c"}) + public void parseUplinkDataKeepsStringIdentifiersInTelemetryTest(String devAddr) throws Exception { + setConfig(Set.of("eui"), Set.of("devAddr", "fCnt", "rssi", "snr")); + + UplinkData uplink = uplinkDataConverter.parseUplinkData(new JsonObject(), unwrapThingsStack(devAddr)); + + Map telemetry = toMap(uplink.getTelemetry().getTsKvList(0).getKvList()); + assertKv(telemetry.get("devAddr"), STRING_V, devAddr); + assertKv(telemetry.get("fCnt"), LONG_V, 101L); + assertKv(telemetry.get("rssi"), LONG_V, -22L); + assertKv(telemetry.get("snr"), DOUBLE_V, 11.0); + assertKv(toMap(uplink.getAttributesUpdate().getKvList()).get("eui"), STRING_V, "1000000000000001"); + } + + @Test + public void parseUplinkDataKeepsChirpStackStringIdentifiersTest() throws Exception { + setConfig(Set.of("devAddr", "eui", "dr", "frequency"), Set.of("rssi", "snr")); + + ObjectNode payload = JacksonUtil.fromString(readPayloadFromFile("ChirpStackPayload.json"), ObjectNode.class); + payload.put("devAddr", "01020304"); + ((ObjectNode) payload.get("deviceInfo")).put("devEui", "1000000000000001"); + UplinkData uplink = uplinkDataConverter.parseUplinkData(new JsonObject(), unwrap(new ChirpStackConverterUnwrapper(), payload)); + + Map attributes = toMap(uplink.getAttributesUpdate().getKvList()); + assertKv(attributes.get("devAddr"), STRING_V, "01020304"); + assertKv(attributes.get("eui"), STRING_V, "1000000000000001"); + assertKv(attributes.get("dr"), LONG_V, 1L); + assertKv(attributes.get("frequency"), LONG_V, 867100000L); + Map telemetry = toMap(uplink.getTelemetry().getTsKvList(0).getKvList()); + assertKv(telemetry.get("rssi"), LONG_V, -22L); + assertKv(telemetry.get("snr"), DOUBLE_V, 10.5); + } + + @Test + public void parseUplinkDataKeepsLoriotStringIdentifiersTest() throws Exception { + setConfig(Set.of("eui", "fPort", "frequency", "dr"), Set.of("battery", "rssi")); + + ObjectNode payload = JacksonUtil.fromString(readPayloadFromFile("LoriotPayload.json"), ObjectNode.class); + payload.put("EUI", "1000000000000001"); + UplinkData uplink = uplinkDataConverter.parseUplinkData(new JsonObject(), unwrap(new LoriotConverterUnwrapper(), payload)); + + Map attributes = toMap(uplink.getAttributesUpdate().getKvList()); + assertKv(attributes.get("eui"), STRING_V, "1000000000000001"); + assertKv(attributes.get("fPort"), LONG_V, 80L); + assertKv(attributes.get("frequency"), LONG_V, 868100000L); + assertKv(attributes.get("dr"), STRING_V, "SF12 BW125 4/5"); + Map telemetry = toMap(uplink.getTelemetry().getTsKvList(0).getKvList()); + assertKv(telemetry.get("battery"), LONG_V, 143L); + assertKv(telemetry.get("rssi"), LONG_V, -49L); + } + + @Test + public void parseUplinkDataKeepsThingParkStringIdentifiersTest() throws Exception { + setConfig(Set.of("devAddr", "eui", "lrcid", "fPort", "spreadingFactor", "frequency"), Set.of("rssi", "snr")); + + ObjectNode payload = JacksonUtil.fromString(readPayloadFromFile("ThingsParkPayload.json"), ObjectNode.class); + ObjectNode uplinkNode = (ObjectNode) payload.get("DevEUI_uplink"); + uplinkNode.put("DevAddr", "01020304"); + uplinkNode.put("DevEUI", "1000000000000001"); + UplinkData uplink = uplinkDataConverter.parseUplinkData(new JsonObject(), unwrap(new ThingParkConverterUnwrapper(), payload)); + + Map attributes = toMap(uplink.getAttributesUpdate().getKvList()); + assertKv(attributes.get("devAddr"), STRING_V, "01020304"); + assertKv(attributes.get("eui"), STRING_V, "1000000000000001"); + assertKv(attributes.get("lrcid"), STRING_V, "00000211"); + assertKv(attributes.get("fPort"), LONG_V, 1L); + assertKv(attributes.get("spreadingFactor"), LONG_V, 9L); + assertKv(attributes.get("frequency"), DOUBLE_V, 902.5); + Map telemetry = toMap(uplink.getTelemetry().getTsKvList(0).getKvList()); + assertKv(telemetry.get("rssi"), DOUBLE_V, -114.0); + assertKv(telemetry.get("snr"), DOUBLE_V, 4.75); + } + + @Test + public void parseUplinkDataKeepsNumericIdentifierAsNumberTest() throws Exception { + setConfig(Set.of("devAddr"), null); + + ObjectNode payload = JacksonUtil.fromString(readPayloadFromFile("ThingsStackPayload.json"), ObjectNode.class); + UplinkMetaData unwrapped = thingsStackUnwrapper.unwrap(JacksonUtil.writeValueAsBytes(payload), new UplinkMetaData<>(ContentType.JSON, Map.of())).getSecond(); + UplinkData uplink = uplinkDataConverter.parseUplinkData(new JsonObject(), unwrapped); + + assertKv(toMap(uplink.getAttributesUpdate().getKvList()).get("devAddr"), LONG_V, 27000020L); + } + + @Test + public void parseUplinkDataCastsDecoderOutputTest() throws Exception { + setConfig(Set.of("devAddr"), null); + + JsonObject attributes = new JsonObject(); + attributes.addProperty("devAddr", "01020304"); + JsonObject uplinkJson = new JsonObject(); + uplinkJson.add("attributes", attributes); + + UplinkData uplink = uplinkDataConverter.parseUplinkData(uplinkJson, unwrapThingsStack("05060708")); + + assertKv(toMap(uplink.getAttributesUpdate().getKvList()).get("devAddr"), LONG_V, 1020304L); + } + + @Test + public void parseUplinkDataCastsDecoderTelemetryArrayTest() throws Exception { + setConfig(null, Set.of("devAddr")); + + JsonObject values = new JsonObject(); + values.addProperty("devAddr", "01020304"); + JsonObject decoded = new JsonObject(); + decoded.addProperty("ts", 1L); + decoded.add("values", values); + JsonArray telemetry = new JsonArray(); + telemetry.add(decoded); + JsonObject uplinkJson = new JsonObject(); + uplinkJson.add("telemetry", telemetry); + + UplinkData uplink = uplinkDataConverter.parseUplinkData(uplinkJson, unwrapThingsStack("05060708")); + + List tsKvList = uplink.getTelemetry().getTsKvListList(); + assertEquals(2, tsKvList.size()); + Map fromDecoder = toMap(tsKvList.stream().filter(tsKv -> tsKv.getTs() == 1L).findFirst().orElseThrow().getKvList()); + Map fromMetadata = toMap(tsKvList.stream().filter(tsKv -> tsKv.getTs() != 1L).findFirst().orElseThrow().getKvList()); + assertKv(fromDecoder.get("devAddr"), LONG_V, 1020304L); + assertKv(fromMetadata.get("devAddr"), LONG_V, 5060708L); } @Test @@ -179,6 +335,100 @@ public class DedicatedScriptUplinkDataConverterTest { }); } + @Test + public void parseUplinkDataWithTelemetryArraySavesMetadataAtUplinkTsTest() { + DedicatedConverterConfig config = new DedicatedConverterConfig(); + config.setType(EntityType.DEVICE); + config.setName("Device ${eui}"); + config.setTelemetry(Set.of("rssi")); + + ReflectionTestUtils.setField(uplinkDataConverter, "config", config); + + long historyTs = 1793170000000L; + long uplinkTs = 1793181600100L; + JsonObject historyValues = new JsonObject(); + historyValues.addProperty("temperature", 24.1); + JsonObject history = new JsonObject(); + history.addProperty("ts", historyTs); + history.add("values", historyValues); + + JsonArray telemetryArray = new JsonArray(); + telemetryArray.add(history); + + JsonObject uplinkJson = new JsonObject(); + uplinkJson.add("telemetry", telemetryArray); + + UplinkMetaData uplinkMetaData = new UplinkMetaData(ContentType.JSON, Map.of( + "rssi", "-60", + "eui", "24E124707C481005", + "ts", String.valueOf(uplinkTs))); + + UplinkData uplink = uplinkDataConverter.parseUplinkData(uplinkJson, uplinkMetaData); + + var tsKvLists = uplink.getTelemetry().getTsKvListList(); + assertEquals(2, tsKvLists.size()); + assertEquals(historyTs, tsKvLists.get(0).getTs()); + assertEquals(uplinkTs, tsKvLists.get(1).getTs()); + assertEquals("rssi", tsKvLists.get(1).getKv(0).getKey()); + } + + @Test + public void parseUplinkDataWithTelemetryArrayAddsMetadataToScriptElementAtUplinkTsTest() { + testMetadataJoinsScriptElementAtUplinkTs(false); + } + + @Test + public void parseUplinkDataWithTelemetryArrayAddsMetadataToScriptElementAtStringUplinkTsTest() { + testMetadataJoinsScriptElementAtUplinkTs(true); + } + + private void testMetadataJoinsScriptElementAtUplinkTs(boolean scriptTsAsString) { + DedicatedConverterConfig config = new DedicatedConverterConfig(); + config.setType(EntityType.DEVICE); + config.setName("Device ${eui}"); + config.setTelemetry(Set.of("rssi", "data")); + + ReflectionTestUtils.setField(uplinkDataConverter, "config", config); + + long uplinkTs = 1793181600100L; + JsonObject currentValues = new JsonObject(); + currentValues.addProperty("temperature", 24.5); + currentValues.addProperty("rssi", -50); + JsonObject current = new JsonObject(); + if (scriptTsAsString) { + current.addProperty("ts", String.valueOf(uplinkTs)); + } else { + current.addProperty("ts", uplinkTs); + } + current.add("values", currentValues); + + JsonArray telemetryArray = new JsonArray(); + telemetryArray.add(current); + + JsonObject uplinkJson = new JsonObject(); + uplinkJson.add("telemetry", telemetryArray); + + UplinkMetaData uplinkMetaData = new UplinkMetaData(ContentType.JSON, Map.of( + "rssi", "-60", + "data", "AXVk", + "eui", "24E124707C481005", + "ts", String.valueOf(uplinkTs))); + + Map expectedTelemetry = Map.of( + "temperature", 24.5, + "rssi", -50L, + "data", "AXVk" + ); + + UplinkData uplink = uplinkDataConverter.parseUplinkData(uplinkJson, uplinkMetaData); + + var tsKvLists = uplink.getTelemetry().getTsKvListList(); + assertEquals(1, tsKvLists.size()); + assertEquals(uplinkTs, tsKvLists.get(0).getTs()); + assertEquals(expectedTelemetry.size(), tsKvLists.get(0).getKvCount()); + tsKvLists.get(0).getKvList().forEach(kv -> assertEquals(expectedTelemetry.get(kv.getKey()), getValue(kv))); + } + @Test public void parseUplinkDataTest() { DedicatedConverterConfig config = new DedicatedConverterConfig(); @@ -206,6 +456,43 @@ public class DedicatedScriptUplinkDataConverterTest { assertEquals("BE7A123456789", uplink.getDeviceLabel()); } + private void setConfig(Set attributes, Set telemetry) { + DedicatedConverterConfig config = new DedicatedConverterConfig(); + config.setType(EntityType.DEVICE); + config.setName("Device $eui"); + config.setAttributes(attributes); + config.setTelemetry(telemetry); + ReflectionTestUtils.setField(uplinkDataConverter, "config", config); + } + + private UplinkMetaData unwrapThingsStack(String devAddr) throws Exception { + ObjectNode payload = JacksonUtil.fromString(readPayloadFromFile("ThingsStackPayload.json"), ObjectNode.class); + ObjectNode endDeviceIds = (ObjectNode) payload.get("end_device_ids"); + endDeviceIds.put("dev_addr", devAddr); + endDeviceIds.put("dev_eui", "1000000000000001"); + ((ObjectNode) payload.at("/uplink_message/settings")).put("frequency", "868100000"); + return thingsStackUnwrapper.unwrap(JacksonUtil.writeValueAsBytes(payload), new UplinkMetaData<>(ContentType.JSON, Map.of())).getSecond(); + } + + private UplinkMetaData unwrap(ConverterUnwrapper unwrapper, ObjectNode payload) throws Exception { + ReflectionTestUtils.setField(uplinkDataConverter, "converterUnwrapper", unwrapper); + return unwrapper.unwrap(JacksonUtil.writeValueAsBytes(payload), new UplinkMetaData<>(ContentType.JSON, Map.of())).getSecond(); + } + + private Map toMap(List kvList) { + return kvList.stream().collect(Collectors.toMap(TransportProtos.KeyValueProto::getKey, kv -> kv)); + } + + private void assertKv(TransportProtos.KeyValueProto kv, TransportProtos.KeyValueType type, Object value) { + assertEquals(type, kv.getType()); + assertEquals(value, getValue(kv)); + } + + private String readPayloadFromFile(String fileName) throws Exception { + var uri = this.getClass().getClassLoader().getResource(fileName).toURI(); + return Files.readString(Path.of(uri)); + } + private Object getValue(TransportProtos.KeyValueProto kv) { return switch (kv.getType()) { case STRING_V -> kv.getStringV(); diff --git a/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/wrapper/ConverterUnwrapperTest.java b/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/wrapper/ConverterUnwrapperTest.java index c3c154ad2f..7463b97003 100644 --- a/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/wrapper/ConverterUnwrapperTest.java +++ b/common/integration/integration-api/src/test/java/org/thingsboard/integration/api/converter/wrapper/ConverterUnwrapperTest.java @@ -196,6 +196,22 @@ public class ConverterUnwrapperTest { assertEquals(ContentType.JSON, result.getSecond().getContentType()); } + @Test + public void thingsStackConverterWrapperTakesCodingRateFromLoraDataRateAndChannelFromStrongestGateway() throws Exception { + ConverterUnwrapper wrapper = ConverterUnwrapperFactory.getUnwrapper(IntegrationType.TTN).get(); + ObjectNode payloadMsg = JacksonUtil.fromString(readPayloadFromFile("ThingsStackPayload.json"), ObjectNode.class); + ObjectNode settings = (ObjectNode) payloadMsg.at("/uplink_message/settings"); + settings.remove("coding_rate"); + ((ObjectNode) settings.at("/data_rate/lora")).put("coding_rate", "4/6"); + ((ObjectNode) payloadMsg.at("/uplink_message/rx_metadata/0")).put("channel_index", 3); + ((ObjectNode) payloadMsg.at("/uplink_message/rx_metadata/1")).put("channel_index", 5); + + Map kvMap = wrapper.unwrap(JacksonUtil.writeValueAsBytes(payloadMsg), + new UplinkMetaData<>(ContentType.JSON, Map.of())).getSecond().getKvMap(); + + assertThat(kvMap).containsEntry("codeRate", "4/6").containsEntry("channel", 3).containsEntry("rssi", -22); + } + @Test public void thingsParkConverterWrapperTest() throws Exception { ConverterUnwrapper wrapper = ConverterUnwrapperFactory.getUnwrapper(IntegrationType.THINGPARK).get(); diff --git a/common/integration/mqtt-integrations/pom.xml b/common/integration/mqtt-integrations/pom.xml index 89b3025891..b3d3a1dcb0 100644 --- a/common/integration/mqtt-integrations/pom.xml +++ b/common/integration/mqtt-integrations/pom.xml @@ -70,6 +70,11 @@ 4.13.2 test + + org.mockito + mockito-core + test + diff --git a/common/integration/mqtt-integrations/src/main/java/org/thingsboard/integration/mqtt/basic/BasicMqttIntegration.java b/common/integration/mqtt-integrations/src/main/java/org/thingsboard/integration/mqtt/basic/BasicMqttIntegration.java index f82aabcb56..33020d91cf 100644 --- a/common/integration/mqtt-integrations/src/main/java/org/thingsboard/integration/mqtt/basic/BasicMqttIntegration.java +++ b/common/integration/mqtt-integrations/src/main/java/org/thingsboard/integration/mqtt/basic/BasicMqttIntegration.java @@ -101,6 +101,8 @@ public class BasicMqttIntegration extends AbstractMqttIntegration ctx.getIntegrationConnectTimeoutSec() && ctx.getIntegrationConnectTimeoutSec() > 0) { log.debug("Reduce connection timeout sec down to the limit [{}]", mqttClientConfiguration.getConnectTimeoutSec()); mqttClientConfiguration.setConnectTimeoutSec(ctx.getIntegrationConnectTimeoutSec()); diff --git a/common/integration/mqtt-integrations/src/test/java/org/thingsboard/integration/mqtt/ttn/TtnIntegrationCheckConnectionTest.java b/common/integration/mqtt-integrations/src/test/java/org/thingsboard/integration/mqtt/ttn/TtnIntegrationCheckConnectionTest.java new file mode 100644 index 0000000000..2270fa22e6 --- /dev/null +++ b/common/integration/mqtt-integrations/src/test/java/org/thingsboard/integration/mqtt/ttn/TtnIntegrationCheckConnectionTest.java @@ -0,0 +1,62 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.integration.mqtt.ttn; + +import io.netty.channel.nio.NioEventLoopGroup; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.integration.api.IntegrationContext; +import org.thingsboard.server.common.data.exception.ThingsboardException; +import org.thingsboard.server.common.data.id.IntegrationId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.integration.Integration; +import org.thingsboard.server.common.data.integration.IntegrationType; + +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class TtnIntegrationCheckConnectionTest { + + private NioEventLoopGroup eventLoopGroup; + private ExecutorService executor; + private IntegrationContext context; + + @Before + public void setUp() { + eventLoopGroup = new NioEventLoopGroup(1); + executor = Executors.newSingleThreadExecutor(); + context = Mockito.mock(IntegrationContext.class); + Mockito.when(context.getEventLoopGroup()).thenReturn(eventLoopGroup); + Mockito.when(context.getExecutorService()).thenReturn(executor); + Mockito.when(context.getIntegrationConnectTimeoutSec()).thenReturn(1); + Mockito.when(context.getMqttClientRetransmissionMaxAttempts()).thenReturn(1); + Mockito.when(context.getMqttClientRetransmissionInitialDelayMillis()).thenReturn(1000L); + Mockito.when(context.getMqttClientRetransmissionJitterFactor()).thenReturn(0.1); + } + + @After + public void tearDown() { + eventLoopGroup.shutdownGracefully(); + executor.shutdownNow(); + } + + // The check runs the same TTN setup as a running integration, which refuses empty credentials + @Test + public void checkRefusesEmptyCredentialsBeforeConnecting() { + Integration integration = new Integration(); + integration.setId(new IntegrationId(UUID.randomUUID())); + integration.setTenantId(TenantId.fromUUID(UUID.randomUUID())); + integration.setType(IntegrationType.TTN); + integration.setConfiguration(JacksonUtil.toJsonNode("{\"clientConfiguration\":{\"host\":\"eu1\",\"port\":8883," + + "\"connectTimeoutSec\":1,\"ssl\":true,\"credentials\":{\"type\":\"basic\",\"username\":\"\",\"password\":\"\"}}}")); + + ThingsboardException e = Assert.assertThrows(ThingsboardException.class, + () -> new TtnIntegration().doCheckConnection(integration, context)); + Assert.assertTrue(e.getMessage(), e.getMessage().contains("Application Credentials")); + } +} diff --git a/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java b/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java index f70769dd80..cecb4fb4ed 100644 --- a/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java +++ b/common/proto/src/main/java/org/thingsboard/server/common/adaptor/JsonConverter.java @@ -51,10 +51,12 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.TreeMap; import java.util.function.Consumer; @@ -70,7 +72,7 @@ public class JsonConverter { public static PostTelemetryMsg convertToTelemetryProto(JsonElement jsonElement, long ts) throws JsonSyntaxException { PostTelemetryMsg.Builder builder = PostTelemetryMsg.newBuilder(); - convertToTelemetry(jsonElement, ts, null, builder); + convertToTelemetry(jsonElement, ts, null, builder, Collections.emptySet()); return builder.build(); } @@ -78,6 +80,13 @@ public class JsonConverter { return convertToTelemetryProto(jsonElement, System.currentTimeMillis()); } + // String values of noCastKeys stay strings even when type cast is enabled. + public static PostTelemetryMsg convertToTelemetryProto(JsonElement jsonElement, Set noCastKeys) throws JsonSyntaxException { + PostTelemetryMsg.Builder builder = PostTelemetryMsg.newBuilder(); + convertToTelemetry(jsonElement, System.currentTimeMillis(), null, builder, noCastKeys); + return builder.build(); + } + public static TbPair> convertToGatewayTelemetry(JsonElement jsonElement, long systemTs) { List metadataResult = null; PostTelemetryMsg.Builder builder = PostTelemetryMsg.newBuilder(); @@ -102,7 +111,7 @@ public class JsonConverter { throw new JsonSyntaxException("Can't parse gateway metadata: " + metadataElem); } } - parseObject(systemTs, null, builder, jo); + parseObject(systemTs, null, builder, jo, Collections.emptySet()); } else { throw new JsonSyntaxException(CAN_T_PARSE_VALUE + je); } @@ -121,13 +130,13 @@ public class JsonConverter { return element; } - private static void convertToTelemetry(JsonElement jsonElement, long systemTs, Map> result, PostTelemetryMsg.Builder builder) { + private static void convertToTelemetry(JsonElement jsonElement, long systemTs, Map> result, PostTelemetryMsg.Builder builder, Set noCastKeys) { if (jsonElement.isJsonObject()) { - parseObject(systemTs, result, builder, jsonElement.getAsJsonObject()); + parseObject(systemTs, result, builder, jsonElement.getAsJsonObject(), noCastKeys); } else if (jsonElement.isJsonArray()) { jsonElement.getAsJsonArray().forEach(je -> { if (je.isJsonObject()) { - parseObject(systemTs, result, builder, je.getAsJsonObject()); + parseObject(systemTs, result, builder, je.getAsJsonObject(), noCastKeys); } else { throw new JsonSyntaxException(CAN_T_PARSE_VALUE + je); } @@ -137,12 +146,12 @@ public class JsonConverter { } } - private static void parseObject(long systemTs, Map> result, PostTelemetryMsg.Builder builder, JsonObject jo) { + private static void parseObject(long systemTs, Map> result, PostTelemetryMsg.Builder builder, JsonObject jo, Set noCastKeys) { try { if (result != null) { parseObject(result, systemTs, jo); } else { - parseObject(builder, systemTs, jo); + parseObject(builder, systemTs, jo, noCastKeys); } } catch (Exception e) { throw new JsonSyntaxException(CAN_T_PARSE_VALUE + jo); @@ -185,9 +194,14 @@ public class JsonConverter { } public static PostAttributeMsg convertToAttributesProto(JsonElement jsonObject) throws JsonSyntaxException { + return convertToAttributesProto(jsonObject, Collections.emptySet()); + } + + // String values of noCastKeys stay strings even when type cast is enabled. + public static PostAttributeMsg convertToAttributesProto(JsonElement jsonObject, Set noCastKeys) throws JsonSyntaxException { if (jsonObject.isJsonObject()) { PostAttributeMsg.Builder result = PostAttributeMsg.newBuilder(); - List keyValueList = parseProtoValues(jsonObject.getAsJsonObject()); + List keyValueList = parseProtoValues(jsonObject.getAsJsonObject(), noCastKeys); result.addAllKv(keyValueList); return result.build(); } else { @@ -205,22 +219,22 @@ public class JsonConverter { return result; } - private static void parseObject(PostTelemetryMsg.Builder builder, long systemTs, JsonObject jo) { + private static void parseObject(PostTelemetryMsg.Builder builder, long systemTs, JsonObject jo, Set noCastKeys) { if (jo.has("ts") && jo.has("values")) { - parseWithTs(builder, jo); + parseWithTs(builder, jo, noCastKeys); } else { - parseWithoutTs(builder, systemTs, jo); + parseWithoutTs(builder, systemTs, jo, noCastKeys); } } - private static void parseWithoutTs(PostTelemetryMsg.Builder request, long systemTs, JsonObject jo) { + private static void parseWithoutTs(PostTelemetryMsg.Builder request, long systemTs, JsonObject jo, Set noCastKeys) { TsKvListProto.Builder builder = TsKvListProto.newBuilder(); builder.setTs(systemTs); - builder.addAllKv(parseProtoValues(jo)); + builder.addAllKv(parseProtoValues(jo, noCastKeys)); request.addTsKvList(builder.build()); } - private static void parseWithTs(PostTelemetryMsg.Builder request, JsonObject jo) { + private static void parseWithTs(PostTelemetryMsg.Builder request, JsonObject jo, Set noCastKeys) { JsonElement tsJsonElement = jo.get("ts"); if (tsJsonElement.isJsonNull()) { throw new JsonSyntaxException(CAN_T_PARSE_VALUE + "ts is null!"); @@ -229,12 +243,12 @@ public class JsonConverter { } else { TsKvListProto.Builder builder = TsKvListProto.newBuilder(); builder.setTs(tsJsonElement.getAsLong()); - builder.addAllKv(parseProtoValues(jo.get("values").getAsJsonObject())); + builder.addAllKv(parseProtoValues(jo.get("values").getAsJsonObject(), noCastKeys)); request.addTsKvList(builder.build()); } } - private static List parseProtoValues(JsonObject valuesObject) { + private static List parseProtoValues(JsonObject valuesObject, Set noCastKeys) { List result = new ArrayList<>(); for (Entry valueEntry : valuesObject.entrySet()) { JsonElement element = valueEntry.getValue(); @@ -245,7 +259,7 @@ public class JsonConverter { String message = String.format("String value length [%d] for key [%s] is greater than maximum allowed [%d]", value.getAsString().length(), valueEntry.getKey(), maxStringValueLength); throw new JsonSyntaxException(message); } - if (isTypeCastEnabled && NumberUtils.isParsable(value.getAsString())) { + if (isTypeCastEnabled && !noCastKeys.contains(valueEntry.getKey()) && NumberUtils.isParsable(value.getAsString())) { try { result.add(buildNumericKeyValueProto(value, valueEntry.getKey())); } catch (RuntimeException th) { @@ -669,7 +683,7 @@ public class JsonConverter { public static Map> convertToTelemetry(JsonElement jsonElement, long systemTs, boolean sorted) throws JsonSyntaxException { Map> result = sorted ? new TreeMap<>() : new HashMap<>(); - convertToTelemetry(jsonElement, systemTs, result, null); + convertToTelemetry(jsonElement, systemTs, result, null, Collections.emptySet()); return result; } diff --git a/common/proto/src/test/java/org/thingsboard/server/common/adaptor/JsonConverterTest.java b/common/proto/src/test/java/org/thingsboard/server/common/adaptor/JsonConverterTest.java index 3729ad3d39..a06f47494c 100644 --- a/common/proto/src/test/java/org/thingsboard/server/common/adaptor/JsonConverterTest.java +++ b/common/proto/src/test/java/org/thingsboard/server/common/adaptor/JsonConverterTest.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.common.adaptor; import com.google.gson.JsonParser; @@ -9,6 +10,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.Isolated; +import org.thingsboard.server.gen.transport.TransportProtos.KeyValueProto; +import org.thingsboard.server.gen.transport.TransportProtos.KeyValueType; + +import java.util.Set; @Isolated("JsonConverter static settings being modified") public class JsonConverterTest { @@ -94,4 +99,40 @@ public class JsonConverterTest { }); } + @Test + public void testParseAttributesProtoWithNoCastKeys() { + var json = JsonParser.parseString("{\"devAddr\": \"01020304\", \"fCnt\": \"42\", \"rssi\": -110}"); + var kvList = JsonConverter.convertToAttributesProto(json, Set.of("devAddr")).getKvList(); + assertKv(kvList.get(0), KeyValueType.STRING_V, "01020304"); + assertKv(kvList.get(1), KeyValueType.LONG_V, "42"); + assertKv(kvList.get(2), KeyValueType.LONG_V, "-110"); + } + + @Test + public void testParseTelemetryProtoWithNoCastKeys() { + var json = JsonParser.parseString("{\"ts\": 1000, \"values\": {\"eui\": \"1000000000000001\", \"fCnt\": \"42\", \"snr\": 9.5}}"); + var tsKvList = JsonConverter.convertToTelemetryProto(json, Set.of("eui")).getTsKvList(0); + Assertions.assertEquals(1000L, tsKvList.getTs()); + assertKv(tsKvList.getKv(0), KeyValueType.STRING_V, "1000000000000001"); + assertKv(tsKvList.getKv(1), KeyValueType.LONG_V, "42"); + assertKv(tsKvList.getKv(2), KeyValueType.DOUBLE_V, "9.5"); + } + + @Test + public void testParseAttributesProtoCastsNumericStrings() { + var kvList = JsonConverter.convertToAttributesProto(JsonParser.parseString("{\"devAddr\": \"01020304\"}")).getKvList(); + assertKv(kvList.get(0), KeyValueType.LONG_V, "1020304"); + } + + private static void assertKv(KeyValueProto kv, KeyValueType type, String value) { + Assertions.assertEquals(type, kv.getType()); + String actual = switch (type) { + case STRING_V -> kv.getStringV(); + case LONG_V -> String.valueOf(kv.getLongV()); + case DOUBLE_V -> String.valueOf(kv.getDoubleV()); + default -> throw new IllegalArgumentException("Unexpected type: " + type); + }; + Assertions.assertEquals(value, actual); + } + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityServiceImpl.java index 8cb6d64c00..50ae0fcd43 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/device/DeviceConnectivityServiceImpl.java @@ -63,6 +63,13 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService public static final String DEFAULT_DEVICE_TELEMETRY_TOPIC = "v1/devices/me/telemetry"; public static final String HTTP_DEFAULT_PORT = "80"; public static final String HTTPS_DEFAULT_PORT = "443"; + private static final Map STANDARD_PORTS = Map.of( + HTTP, HTTP_DEFAULT_PORT, + HTTPS, HTTPS_DEFAULT_PORT, + MQTT, "1883", + MQTTS, "8883", + COAP, "5683", + COAPS, "5684"); private final Map certs = new ConcurrentHashMap<>(); @@ -199,17 +206,16 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService } @Override - public JsonNode getConnectivityInfo(String baseUrl) throws URISyntaxException { + public JsonNode getConnectivityInfo(String baseUrl, DeviceConnectivityHostSource baseUrlSource) throws URISyntaxException { String[] protocols = {HTTP, HTTPS, MQTT, MQTTS, COAP, COAPS}; - Map result = new LinkedHashMap<>(); + Map result = new LinkedHashMap<>(); for (String protocol : protocols) { DeviceConnectivityInfo info = getConnectivity(protocol); if (info != null && info.isEnabled()) { - DeviceConnectivityInfo resolved = new DeviceConnectivityInfo(); - resolved.setEnabled(true); - resolved.setHost(getHost(baseUrl, info, protocol)); - resolved.setPort(getPort(info)); - result.put(protocol, resolved); + result.put(protocol, new ResolvedDeviceConnectivityInfo(true, + getHost(baseUrl, info, protocol), + StringUtils.isBlank(info.getPort()) ? STANDARD_PORTS.get(protocol) : info.getPort(), + StringUtils.isNotBlank(info.getHost()) ? DeviceConnectivityHostSource.DEVICE_CONNECTIVITY : baseUrlSource)); } } return JacksonUtil.valueToTree(result); diff --git a/dao/src/main/java/org/thingsboard/server/dao/device/ResolvedDeviceConnectivityInfo.java b/dao/src/main/java/org/thingsboard/server/dao/device/ResolvedDeviceConnectivityInfo.java new file mode 100644 index 0000000000..64325ce821 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/device/ResolvedDeviceConnectivityInfo.java @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.dao.device; + +/** + * Host and port of an enabled transport as returned by {@link DeviceConnectivityService#getConnectivityInfo}, + * with the source of the host. Kept apart from {@link DeviceConnectivityInfo}, which models the stored settings. + */ +public record ResolvedDeviceConnectivityInfo(boolean enabled, String host, String port, + DeviceConnectivityHostSource hostSource) { +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemDao.java b/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemDao.java index 236f5a7587..b99cf18981 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemDao.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.dao.iot_hub; import org.thingsboard.server.common.data.id.IotHubInstalledItemId; @@ -19,6 +20,9 @@ public interface IotHubInstalledItemDao extends Dao { Optional findByTenantIdAndId(TenantId tenantId, IotHubInstalledItemId installedItemId); + // Locks the row until the end of the current transaction + Optional findByTenantIdAndIdForUpdate(TenantId tenantId, IotHubInstalledItemId installedItemId); + PageData findByTenantId(TenantId tenantId, List itemTypes, UUID itemId, PageLink pageLink); List findInstalledItemIdsByTenantId(TenantId tenantId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemService.java b/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemService.java index 5067eac572..072506dfca 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemService.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.dao.iot_hub; import org.thingsboard.server.common.data.id.IotHubInstalledItemId; @@ -19,6 +20,9 @@ public interface IotHubInstalledItemService { IotHubInstalledItem findById(TenantId tenantId, IotHubInstalledItemId id); + // Locks the item until the end of the current transaction, so concurrent updates of it run one after another + IotHubInstalledItem findByIdForUpdate(TenantId tenantId, IotHubInstalledItemId id); + PageData findByTenantId(TenantId tenantId, List itemTypes, UUID itemId, PageLink pageLink); List findInstalledItemIdsByTenantId(TenantId tenantId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemServiceImpl.java index bf86162b86..d69060cd94 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/iot_hub/IotHubInstalledItemServiceImpl.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.dao.iot_hub; import lombok.RequiredArgsConstructor; @@ -37,6 +38,11 @@ class IotHubInstalledItemServiceImpl implements IotHubInstalledItemService { return iotHubInstalledItemDao.findByTenantIdAndId(tenantId, id).orElse(null); } + @Override + public IotHubInstalledItem findByIdForUpdate(TenantId tenantId, IotHubInstalledItemId id) { + return iotHubInstalledItemDao.findByTenantIdAndIdForUpdate(tenantId, id).orElse(null); + } + @Override public PageData findByTenantId(TenantId tenantId, List itemTypes, UUID itemId, PageLink pageLink) { validatePageLink(pageLink, IotHubInstalledItemEntity.ALLOWED_SORT_PROPERTIES); diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java index 08e4d29d8d..d69f97d11c 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java @@ -1085,6 +1085,7 @@ public class ModelConstants { public static final String AI_MODEL_TENANT_ID_COLUMN_NAME = TENANT_ID_COLUMN; public static final String AI_MODEL_NAME_COLUMN_NAME = NAME_PROPERTY; public static final String AI_MODEL_CONFIGURATION_COLUMN_NAME = "configuration"; + public static final String AI_MODEL_CUSTOMER_ACCESS_ENABLED_COLUMN_NAME = "customer_access_enabled"; /** * Api Key constants. diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/AiModelEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/AiModelEntity.java index eaed13c0a8..8393fdc485 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/sql/AiModelEntity.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/AiModelEntity.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.dao.model.sql; import io.hypersistence.utils.hibernate.type.json.JsonBinaryType; @@ -53,6 +54,9 @@ public class AiModelEntity extends BaseVersionedEntity { @Column(name = ModelConstants.AI_MODEL_CONFIGURATION_COLUMN_NAME, nullable = false, columnDefinition = "JSONB") private AiModelConfig configuration; + @Column(name = ModelConstants.AI_MODEL_CUSTOMER_ACCESS_ENABLED_COLUMN_NAME, nullable = false) + private boolean customerAccessEnabled; + @Column(name = ModelConstants.EXTERNAL_ID_PROPERTY, columnDefinition = "UUID") private UUID externalId; @@ -63,6 +67,7 @@ public class AiModelEntity extends BaseVersionedEntity { tenantId = getTenantUuid(aiModel.getTenantId()); name = aiModel.getName(); configuration = aiModel.getConfiguration(); + customerAccessEnabled = aiModel.isCustomerAccessEnabled(); externalId = getUuid(aiModel.getExternalId()); } @@ -74,6 +79,7 @@ public class AiModelEntity extends BaseVersionedEntity { model.setTenantId(TenantId.fromUUID(tenantId)); model.setName(name); model.setConfiguration(configuration); + model.setCustomerAccessEnabled(customerAccessEnabled); model.setExternalId(getEntityId(externalId, AiModelId::new)); return model; } diff --git a/dao/src/main/java/org/thingsboard/server/dao/pat/ApiKeyServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/pat/ApiKeyServiceImpl.java index d37126c0cf..32cd12823c 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/pat/ApiKeyServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/pat/ApiKeyServiceImpl.java @@ -112,7 +112,8 @@ public class ApiKeyServiceImpl extends AbstractCachedEntityService { @Override protected Edge validateUpdate(TenantId tenantId, Edge edge) { - return edgeDao.findById(edge.getTenantId(), edge.getId().getId()); + Edge old = edgeDao.findById(edge.getTenantId(), edge.getId().getId()); + if (old == null) { + throw new DataValidationException("Can't update non existing edge!"); + } + if (!old.getTenantId().equals(edge.getTenantId())) { + throw new DataValidationException("Can't update edge tenant id!"); + } + return old; } @Override diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/IotHubInstalledItemRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/IotHubInstalledItemRepository.java index 21d0dc89c9..693166b7e0 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/IotHubInstalledItemRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/IotHubInstalledItemRepository.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.dao.sql.iot_hub; import org.springframework.data.domain.Page; @@ -21,6 +22,9 @@ interface IotHubInstalledItemRepository extends JpaRepository findByTenantIdAndId(UUID tenantId, UUID id); + @Query(value = "SELECT * FROM iot_hub_installed_item i WHERE i.tenant_id = :tenantId AND i.id = :id FOR UPDATE", nativeQuery = true) + Optional findByTenantIdAndIdForUpdate(@Param("tenantId") UUID tenantId, @Param("id") UUID id); + @Query("SELECT DISTINCT item.itemId FROM IotHubInstalledItemEntity item WHERE item.tenantId = :tenantId") List findInstalledItemIdsByTenantId(@Param("tenantId") UUID tenantId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/JpaIotHubInstalledItemDao.java b/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/JpaIotHubInstalledItemDao.java index c1b0c5fbb3..d07d8f5dd4 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/JpaIotHubInstalledItemDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/iot_hub/JpaIotHubInstalledItemDao.java @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.dao.sql.iot_hub; import lombok.RequiredArgsConstructor; @@ -40,6 +41,11 @@ class JpaIotHubInstalledItemDao extends JpaAbstractDao findByTenantIdAndIdForUpdate(TenantId tenantId, IotHubInstalledItemId installedItemId) { + return repository.findByTenantIdAndIdForUpdate(tenantId.getId(), installedItemId.getId()).map(DaoUtil::getData); + } + @Override public PageData findByTenantId(TenantId tenantId, List itemTypes, UUID itemId, PageLink pageLink) { return DaoUtil.toPageData(repository.findByTenantId( diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java index 4330f855e7..bb15507be5 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/CachedRedisSqlTimeseriesLatestDao.java @@ -31,6 +31,8 @@ import org.thingsboard.server.dao.util.SqlTsLatestAnyDaoCachedRedis; import java.util.List; import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; @Slf4j @Component @@ -39,6 +41,7 @@ import java.util.Optional; @Primary public class CachedRedisSqlTimeseriesLatestDao extends BaseAbstractSqlTimeseriesDao implements TimeseriesLatestDao { public static final String STATS_NAME = "ts_latest.cache"; + private static final long FAILURE_LOG_INTERVAL_MS = TimeUnit.SECONDS.toMillis(30); final CacheExecutorService cacheExecutorService; final SqlTimeseriesLatestDao sqlDao; final StatsFactory statsFactory; @@ -46,6 +49,8 @@ public class CachedRedisSqlTimeseriesLatestDao extends BaseAbstractSqlTimeseries final CitusSettings citusSettings; DefaultCounter hitCounter; DefaultCounter missCounter; + private final AtomicLong lastFailureLogTime = new AtomicLong(); + private final AtomicLong suppressedFailures = new AtomicLong(); @PostConstruct public void init() { @@ -62,19 +67,17 @@ public class CachedRedisSqlTimeseriesLatestDao extends BaseAbstractSqlTimeseries return version; }, cacheExecutorService); - if (log.isTraceEnabled()) { - Futures.addCallback(future, new FutureCallback<>() { - @Override - public void onSuccess(Long result) { - log.trace("saveLatest onSuccess [{}][{}][{}]", entityId, tsKvEntry.getKey(), tsKvEntry); - } - - @Override - public void onFailure(Throwable t) { - log.info("saveLatest onFailure [{}][{}][{}]", entityId, tsKvEntry.getKey(), tsKvEntry, t); - } - }, MoreExecutors.directExecutor()); - } + Futures.addCallback(future, new FutureCallback<>() { + @Override + public void onSuccess(Long result) { + log.trace("saveLatest onSuccess [{}][{}][{}]", entityId, tsKvEntry.getKey(), tsKvEntry); + } + + @Override + public void onFailure(Throwable t) { + logFailure("saveLatest", entityId, tsKvEntry.getKey(), t); + } + }, MoreExecutors.directExecutor()); return future; } @@ -107,22 +110,35 @@ public class CachedRedisSqlTimeseriesLatestDao extends BaseAbstractSqlTimeseries return x; }, cacheExecutorService); - if (log.isTraceEnabled()) { - Futures.addCallback(future, new FutureCallback<>() { - @Override - public void onSuccess(TsKvLatestRemovingResult result) { - log.trace("removeLatest onSuccess [{}][{}][{}]", entityId, query.getKey(), query); - } - - @Override - public void onFailure(Throwable t) { - log.info("removeLatest onFailure [{}][{}][{}]", entityId, query.getKey(), query, t); - } - }, MoreExecutors.directExecutor()); - } + Futures.addCallback(future, new FutureCallback<>() { + @Override + public void onSuccess(TsKvLatestRemovingResult result) { + log.trace("removeLatest onSuccess [{}][{}][{}]", entityId, query.getKey(), query); + } + + @Override + public void onFailure(Throwable t) { + logFailure("removeLatest", entityId, query.getKey(), t); + } + }, MoreExecutors.directExecutor()); return future; } + /** + * A failed save or remove fails the returned future, so the caller does not publish the subscription update. + * Log it, at most once per {@link #FAILURE_LOG_INTERVAL_MS}: when Redis fails, every write fails. + */ + private void logFailure(String operation, EntityId entityId, String key, Throwable t) { + long now = System.currentTimeMillis(); + long lastLogTime = lastFailureLogTime.get(); + if (now - lastLogTime >= FAILURE_LOG_INTERVAL_MS && lastFailureLogTime.compareAndSet(lastLogTime, now)) { + log.warn("[{}][{}] {} failed ({} more latest-value write failures since the previous log)", + entityId, key, operation, suppressedFailures.getAndSet(0), t); + } else { + suppressedFailures.incrementAndGet(); + } + } + @Override public ListenableFuture> findLatestOpt(TenantId tenantId, EntityId entityId, String key) { log.trace("findLatestOpt"); diff --git a/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java index 176a4d4125..cc00b87c0e 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java @@ -260,6 +260,13 @@ public class UserServiceImpl extends AbstractCachedEntityService INCORRECT_USER_CREDENTIALS_ID + id); + return userCredentialsDao.findById(tenantId, userCredentialsId.getId()); + } + @Override public UserCredentials findUserCredentialsByUserId(TenantId tenantId, UserId userId) { log.trace("Executing findUserCredentialsByUserId [{}]", userId); @@ -788,7 +795,8 @@ public class UserServiceImpl extends AbstractCachedEntityService + * Each test first writes every key, so the Jedis slot map points at the current masters. Then it changes the + * topology and checks that plain writes (a versioned Lua script) and transactional writes (WATCH/MULTI on the slot + * owner) work again right away, with the background slot map refresh off. Two cases: + *

    + *
  • failover: the old master stays alive as a replica and answers MOVED;
  • + *
  • node gone: the old master's address no longer accepts connections, as when a Kubernetes pod gets a new IP.
  • + *
+ */ +@Slf4j +class RedisClusterTopologyChangeTest { + + private static final List PORTS = List.of(6381, 6382, 6383, 6384, 6385, 6386); + private static final String NODES = String.join(",", PORTS.stream().map(port -> "127.0.0.1:" + port).toList()); + private static final String IMAGE = "bitnamilegacy/valkey-cluster:8.0"; + private static final int KEY_COUNT = 64; // enough keys to cover the slots of every master + + private static final List> CONTAINERS = PORTS.stream() + .>map(port -> new GenericContainer<>(IMAGE) + .withEnv(Map.of( + "VALKEY_CLUSTER_ANNOUNCE_IP", "127.0.0.1", + "VALKEY_CLUSTER_DYNAMIC_IPS", "no", + "ALLOW_EMPTY_PASSWORD", "yes", + "VALKEY_NODES", NODES.replace(",", " "), + "VALKEY_PORT_NUMBER", String.valueOf(port))) + .withNetworkMode("host")) + .toList(); + + private static final List KEYS = IntStream.range(0, KEY_COUNT) + .mapToObj(i -> new TsLatestCacheKey(new DeviceId(UUID.randomUUID()), "temperature")) + .toList(); + private static final AtomicLong VERSION = new AtomicLong(); + + private static JedisConnectionFactory connectionFactory; + private static TsLatestRedisCache cache; + + @BeforeAll + static void beforeAll() throws Exception { + CONTAINERS.forEach(GenericContainer::start); + TimeUnit.SECONDS.sleep(5); // let every node start listening + var result = CONTAINERS.get(0).execInContainer("/bin/sh", "-c", + "valkey-cli --cluster create " + NODES.replace(",", " ") + " --cluster-replicas 1 --cluster-yes"); + assertThat(result.getExitCode()).as(result.getStdout() + result.getStderr()).isZero(); + // Detect a stopped master in 2 s instead of the default 15 s, so its replica takes over sooner. + PORTS.forEach(port -> exec(containerOf(port), port, "CONFIG", "SET", "cluster-node-timeout", "2000")); + await("cluster ready").atMost(60, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(RedisClusterTopologyChangeTest::isClusterStable); + + TBRedisClusterConfiguration configuration = new TBRedisClusterConfiguration(); + ReflectionTestUtils.setField(configuration, "clusterNodes", NODES); + ReflectionTestUtils.setField(configuration, "maxRedirects", 12); + ReflectionTestUtils.setField(configuration, "useDefaultPoolConfig", true); + ReflectionTestUtils.setField(configuration, "topologyRefreshPeriodSec", 0L); // test the recovery on the failed call alone + configuration.setEvictTtlInMs(60000); + connectionFactory = configuration.loadFactory(); + connectionFactory.afterPropertiesSet(); + + CacheSpecs specs = new CacheSpecs(); + specs.setMaxSize(10000); + specs.setTimeToLiveInMinutes(60); + CacheSpecsMap specsMap = new CacheSpecsMap(); + specsMap.setSpecs(Map.of(CacheConstants.TS_LATEST_CACHE, specs)); + cache = new TsLatestRedisCache(configuration, specsMap, connectionFactory); + ReflectionTestUtils.setField(cache, "fstStatsService", mock(FstStatsService.class)); + } + + @AfterAll + static void afterAll() { + if (connectionFactory != null) { + connectionFactory.destroy(); + } + CONTAINERS.forEach(GenericContainer::stop); + } + + @ParameterizedTest + @EnumSource(WritePath.class) + void givenWarmSlotMap_whenMasterFailsOver_thenWritesWorkWithoutRestart(WritePath firstWritePath) throws Exception { + await("cluster stable").atMost(60, TimeUnit.SECONDS).until(RedisClusterTopologyChangeTest::isClusterStable); + writeAndVerifyAllKeys(WritePath.SCRIPT); // point the Jedis slot map at the current masters + ClusterNode master = pickMasterWithLiveReplica(); + ClusterNode replica = liveReplicaOf(master); + log.info("Failing over master {} to replica {}", master.port(), replica.port()); + + var result = containerOf(replica.port()).execInContainer("valkey-cli", "-p", String.valueOf(replica.port()), "CLUSTER", "FAILOVER"); + assertThat(result.getStdout()).contains("OK"); + await("replica promoted").atMost(60, TimeUnit.SECONDS).pollInterval(500, TimeUnit.MILLISECONDS) + .until(() -> isMaster(replica.port()) && isClusterStable()); + + writeAndVerifyAfterTopologyChange(firstWritePath); + writeAndVerifyAfterTopologyChange(firstWritePath.other()); + } + + @ParameterizedTest + @EnumSource(WritePath.class) + void givenWarmSlotMap_whenMasterNodeIsGone_thenWritesWorkWithoutRestart(WritePath firstWritePath) throws Exception { + await("cluster stable").atMost(60, TimeUnit.SECONDS).until(RedisClusterTopologyChangeTest::isClusterStable); + writeAndVerifyAllKeys(WritePath.SCRIPT); // point the Jedis slot map at the current masters + ClusterNode master = pickMasterWithLiveReplica(); + ClusterNode replica = liveReplicaOf(master); + log.info("Stopping master {}, its replica {} takes over", master.port(), replica.port()); + + containerOf(master.port()).stop(); + await("replica promoted").atMost(60, TimeUnit.SECONDS).pollInterval(500, TimeUnit.MILLISECONDS) + .until(() -> isMaster(replica.port()) && isClusterStable()); + + writeAndVerifyAfterTopologyChange(firstWritePath); + writeAndVerifyAfterTopologyChange(firstWritePath.other()); + } + + /** + * The two ways the cache writes to a slot owner. The first one to run after a topology change meets the stale + * slot map; once it renews the map, the other one finds it already fresh. So each case runs once per path first. + */ + enum WritePath { + SCRIPT, // versioned put: Lua script sent through the cluster client + TRANSACTION; // WATCH/MULTI on a connection to the slot owner + + WritePath other() { + return this == SCRIPT ? TRANSACTION : SCRIPT; + } + } + + /** + * No write may throw. A transaction may still be not applied once per promoted node: that node does not have the + * versioned-put script yet, the transaction loads it and reports a miss. So the first pass only has to complete, + * and the second pass must store every key. + */ + private static void writeAndVerifyAfterTopologyChange(WritePath writePath) { + writeAllKeys(writePath, VERSION.incrementAndGet()); + writeAndVerifyAllKeys(writePath); + } + + private static void writeAndVerifyAllKeys(WritePath writePath) { + long version = VERSION.incrementAndGet(); + writeAllKeys(writePath, version); + verifyAllKeys(version); + } + + private static void writeAllKeys(WritePath writePath, long version) { + for (TsLatestCacheKey key : KEYS) { + if (writePath == WritePath.SCRIPT) { + cache.put(key, entry(version)); + } else { + TbCacheTransaction transaction = cache.newTransactionForKey(key); + transaction.put(key, entry(version)); + transaction.commit(); + } + } + } + + private static void verifyAllKeys(long version) { + for (TsLatestCacheKey key : KEYS) { + var cached = cache.get(key); + assertThat(cached).as("cached value of %s", key).isNotNull(); + assertThat(cached.get().getLongValue()).as("cached value of %s", key).contains(version); + } + } + + private static TsKvEntry entry(long version) { + return new BasicTsKvEntry(System.currentTimeMillis(), new LongDataEntry("temperature", version), version); + } + + private static ClusterNode pickMasterWithLiveReplica() { + List nodes = clusterNodes(); + return nodes.stream() + .filter(node -> node.master() && !node.failed()) + .filter(master -> nodes.stream().anyMatch(n -> master.id().equals(n.masterId()) && !n.failed())) + .findFirst() + .orElseThrow(() -> new IllegalStateException("No master with a live replica: " + nodes)); + } + + private static ClusterNode liveReplicaOf(ClusterNode master) { + return clusterNodes().stream() + .filter(node -> master.id().equals(node.masterId()) && !node.failed()) + .findFirst() + .orElseThrow(); + } + + private static boolean isMaster(int port) { + return clusterNodes(containerOf(port), port).stream().anyMatch(node -> node.port() == port && node.master()); + } + + /** + * Every running node reports {@code cluster_state:ok}, and every running replica has finished syncing with its + * master: Valkey does not promote a replica that never synced, so a failover test must wait for it. + */ + private static boolean isClusterStable() { + return runningPorts().stream().allMatch(port -> { + GenericContainer container = containerOf(port); + String replication = exec(container, port, "INFO", "replication"); + return exec(container, port, "CLUSTER", "INFO").contains("cluster_state:ok") + && (replication.contains("role:master") || replication.contains("master_link_status:up")); + }); + } + + private static List clusterNodes() { + int port = runningPorts().get(0); + return clusterNodes(containerOf(port), port); + } + + private static List clusterNodes(GenericContainer container, int port) { + return exec(container, port, "CLUSTER", "NODES").lines().filter(line -> !line.isBlank()).map(ClusterNode::parse).toList(); + } + + private static List runningPorts() { + return PORTS.stream().filter(port -> containerOf(port).isRunning()).toList(); + } + + private static GenericContainer containerOf(int port) { + return CONTAINERS.get(PORTS.indexOf(port)); + } + + @SneakyThrows + private static String exec(GenericContainer container, int port, String... command) { + String[] cli = new String[command.length + 3]; + cli[0] = "valkey-cli"; + cli[1] = "-p"; + cli[2] = String.valueOf(port); + System.arraycopy(command, 0, cli, 3, command.length); + return container.execInContainer(cli).getStdout(); + } + + /** + * One line of {@code CLUSTER NODES}: {@code ...}. + */ + private record ClusterNode(String id, int port, boolean master, boolean failed, String masterId) { + + static ClusterNode parse(String line) { + String[] fields = line.trim().split(" "); + String address = fields[1]; + int port = Integer.parseInt(address.substring(address.indexOf(':') + 1, address.indexOf('@'))); + List flags = Arrays.asList(fields[2].split(",")); + return new ClusterNode(fields[0], port, flags.contains("master"), + flags.contains("fail") || flags.contains("fail?"), fields[3]); + } + + } + +} diff --git a/dao/src/test/java/org/thingsboard/server/dao/device/DeviceConnectivityServiceImplTest.java b/dao/src/test/java/org/thingsboard/server/dao/device/DeviceConnectivityServiceImplTest.java new file mode 100644 index 0000000000..2a91a14654 --- /dev/null +++ b/dao/src/test/java/org/thingsboard/server/dao/device/DeviceConnectivityServiceImplTest.java @@ -0,0 +1,119 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +package org.thingsboard.server.dao.device; + +import com.fasterxml.jackson.databind.JsonNode; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.AdminSettings; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.dao.settings.AdminSettingsService; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class DeviceConnectivityServiceImplTest { + + private static final String BASE_URL = "http://192.168.1.10:8080"; + + @Mock + private AdminSettingsService adminSettingsService; + @Mock + private DeviceCredentialsService deviceCredentialsService; + @Mock + private DeviceProfileService deviceProfileService; + @InjectMocks + private DeviceConnectivityServiceImpl service; + + @Test + void configuredHostIsReportedAsDeviceConnectivity() throws Exception { + givenConnectivity(""" + {"mqtt": {"enabled": true, "host": "10.0.0.5", "port": "1884"}}"""); + + JsonNode mqtt = service.getConnectivityInfo(BASE_URL, DeviceConnectivityHostSource.REQUEST).get("mqtt"); + + assertThat(mqtt.get("host").asText()).isEqualTo("10.0.0.5"); + assertThat(mqtt.get("port").asText()).isEqualTo("1884"); + assertThat(mqtt.get("hostSource").asText()).isEqualTo("DEVICE_CONNECTIVITY"); + } + + @Test + void blankHostTakesBaseUrlAndItsSource() throws Exception { + givenConnectivity(""" + {"mqtt": {"enabled": true, "host": "", "port": "1883"}}"""); + + JsonNode fromRequest = service.getConnectivityInfo(BASE_URL, DeviceConnectivityHostSource.REQUEST).get("mqtt"); + JsonNode fromBaseUrl = service.getConnectivityInfo(BASE_URL, DeviceConnectivityHostSource.BASE_URL).get("mqtt"); + + assertThat(fromRequest.get("host").asText()).isEqualTo("192.168.1.10"); + assertThat(fromRequest.get("hostSource").asText()).isEqualTo("REQUEST"); + assertThat(fromBaseUrl.get("hostSource").asText()).isEqualTo("BASE_URL"); + } + + @Test + void blankPortIsReplacedWithStandardPort() throws Exception { + givenConnectivity(""" + {"http": {"enabled": true, "host": "", "port": ""}, + "https": {"enabled": true, "host": "", "port": ""}, + "mqtt": {"enabled": true, "host": "", "port": ""}, + "mqtts": {"enabled": true, "host": "", "port": ""}, + "coap": {"enabled": true, "host": "", "port": ""}, + "coaps": {"enabled": true, "host": "", "port": ""}}"""); + + JsonNode info = service.getConnectivityInfo(BASE_URL, DeviceConnectivityHostSource.REQUEST); + + assertThat(info.get("http").get("port").asText()).isEqualTo("80"); + assertThat(info.get("https").get("port").asText()).isEqualTo("443"); + assertThat(info.get("mqtt").get("port").asText()).isEqualTo("1883"); + assertThat(info.get("mqtts").get("port").asText()).isEqualTo("8883"); + assertThat(info.get("coap").get("port").asText()).isEqualTo("5683"); + assertThat(info.get("coaps").get("port").asText()).isEqualTo("5684"); + } + + @Test + void disabledProtocolIsLeftOut() throws Exception { + givenConnectivity(""" + {"mqtt": {"enabled": true, "host": "", "port": "1883"}, + "coap": {"enabled": false, "host": "", "port": "5683"}}"""); + + JsonNode info = service.getConnectivityInfo(BASE_URL, DeviceConnectivityHostSource.REQUEST); + + assertThat(info.has("mqtt")).isTrue(); + assertThat(info.has("coap")).isFalse(); + } + + @Test + void responseHasTheFieldsTheUiReads() throws Exception { + givenConnectivity(""" + {"mqtt": {"enabled": true, "host": "10.0.0.5", "port": "1884"}}"""); + + JsonNode mqtt = service.getConnectivityInfo(BASE_URL, DeviceConnectivityHostSource.REQUEST).get("mqtt"); + + assertThat(mqtt.fieldNames()).toIterable() + .containsExactlyInAnyOrder("enabled", "host", "port", "hostSource"); + assertThat(mqtt.get("enabled").asBoolean()).isTrue(); + } + + @Test + void overloadWithoutSourceReportsRequest() throws Exception { + givenConnectivity(""" + {"mqtt": {"enabled": true, "host": "", "port": "1883"}}"""); + + JsonNode mqtt = service.getConnectivityInfo(BASE_URL).get("mqtt"); + + assertThat(mqtt.get("host").asText()).isEqualTo("192.168.1.10"); + assertThat(mqtt.get("hostSource").asText()).isEqualTo("REQUEST"); + } + + private void givenConnectivity(String json) { + AdminSettings settings = new AdminSettings(); + settings.setJsonValue(JacksonUtil.toJsonNode(json)); + when(adminSettingsService.findAdminSettingsByKey(TenantId.SYS_TENANT_ID, "connectivity")).thenReturn(settings); + } + +} diff --git a/dao/src/test/java/org/thingsboard/server/dao/pat/ApiKeyCacheEvictionTest.java b/dao/src/test/java/org/thingsboard/server/dao/pat/ApiKeyCacheEvictionTest.java new file mode 100644 index 0000000000..70e95f31f6 --- /dev/null +++ b/dao/src/test/java/org/thingsboard/server/dao/pat/ApiKeyCacheEvictionTest.java @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +package org.thingsboard.server.dao.pat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; +import org.thingsboard.server.cache.TbTransactionalCache; +import org.thingsboard.server.common.data.User; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.id.UserId; +import org.thingsboard.server.common.data.pat.ApiKey; +import org.thingsboard.server.common.data.pat.ApiKeyInfo; +import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.dao.service.AbstractServiceTest; +import org.thingsboard.server.dao.service.DaoSqlTest; +import org.thingsboard.server.dao.user.UserService; + +/** + * Verifies the exact cache interactions of {@link ApiKeyService} rotation: which {@link ApiKeyCacheKey}s are evicted + * and how many times. Lives in this package because {@link ApiKeyCacheKey} is package-private. + */ +@DaoSqlTest +public class ApiKeyCacheEvictionTest extends AbstractServiceTest { + + @Autowired + ApiKeyService apiKeyService; + + @Autowired + UserService userService; + + @MockitoSpyBean + TbTransactionalCache apiKeyCache; + + private UserId userId; + + @Before + public void before() { + User tenantAdmin = new User(); + tenantAdmin.setAuthority(Authority.TENANT_ADMIN); + tenantAdmin.setTenantId(tenantId); + tenantAdmin.setEmail("tenant-api-key-cache@thingsboard.org"); + User user = userService.saveUser(TenantId.SYS_TENANT_ID, tenantAdmin); + userId = user.getId(); + } + + @After + public void after() { + apiKeyService.deleteByTenantId(tenantId); + User user = userService.findUserById(tenantId, userId); + userService.deleteUser(tenantId, user); + } + + @Test + public void testRotateInternalApiKey_evictsOldValueExactlyOnce() { + ApiKeyInfo apiKeyInfo = new ApiKeyInfo(); + apiKeyInfo.setTenantId(TenantId.SYS_TENANT_ID); + apiKeyInfo.setUserId(userId); + apiKeyInfo.setDescription("Internal key for rotation eviction counting"); + apiKeyInfo.setEnabled(true); + apiKeyInfo.setInternal(true); + ApiKey savedApiKey = apiKeyService.saveApiKey(TenantId.SYS_TENANT_ID, apiKeyInfo); + String originalValue = savedApiKey.getValue(); + Mockito.clearInvocations(apiKeyCache); + + apiKeyService.rotateInternalApiKey(TenantId.SYS_TENANT_ID, savedApiKey); + + Mockito.verify(apiKeyCache).evict(ApiKeyCacheKey.of(originalValue)); + Mockito.verify(apiKeyCache, Mockito.times(1)).evict(Mockito.any(ApiKeyCacheKey.class)); + } + +} diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/ApiKeyServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/ApiKeyServiceTest.java index f38913f6bf..287f5812b3 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/ApiKeyServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/ApiKeyServiceTest.java @@ -333,6 +333,22 @@ public class ApiKeyServiceTest extends AbstractServiceTest { Assert.assertEquals(savedApiKey.getDescription(), rotatedApiKey.getDescription()); } + @Test + public void testRotateInternalApiKey_oldValueEvictedFromCache() { + ApiKeyInfo apiKeyInfo = createInternalApiKeyInfo("Internal key for rotation cache eviction"); + ApiKey savedApiKey = apiKeyService.saveApiKey(TenantId.SYS_TENANT_ID, apiKeyInfo); + String originalValue = savedApiKey.getValue(); + // authentication resolves the key by value and caches the lookup + Assert.assertNotNull(apiKeyService.findApiKeyByValue(originalValue)); + + ApiKey rotatedApiKey = apiKeyService.rotateInternalApiKey(TenantId.SYS_TENANT_ID, savedApiKey); + + Assert.assertNull("Old API key value must not resolve after rotation", apiKeyService.findApiKeyByValue(originalValue)); + ApiKey foundByNewValue = apiKeyService.findApiKeyByValue(rotatedApiKey.getValue()); + Assert.assertNotNull(foundByNewValue); + Assert.assertEquals(savedApiKey.getId(), foundByNewValue.getId()); + } + @Test public void testRotateRegularApiKey_shouldFail() { ApiKeyInfo apiKeyInfo = createApiKeyInfo("Regular API key"); diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/validator/EdgeDataValidatorTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/validator/EdgeDataValidatorTest.java index 18d606734f..79cec45084 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/validator/EdgeDataValidatorTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/validator/EdgeDataValidatorTest.java @@ -9,14 +9,17 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.thingsboard.server.common.data.edge.Edge; +import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.customer.CustomerDao; import org.thingsboard.server.dao.edge.EdgeDao; import org.thingsboard.server.dao.subscription.SubscriptionService; import org.thingsboard.server.dao.tenant.TenantService; +import org.thingsboard.server.exception.DataValidationException; import java.util.UUID; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.BDDMockito.willReturn; import static org.mockito.Mockito.verify; @@ -56,4 +59,17 @@ class EdgeDataValidatorTest { verify(validator).validateString("Edge type", edge.getType()); } + @Test + void testValidateUpdateWithDifferentTenant() { + Edge old = new Edge(new EdgeId(UUID.randomUUID())); + old.setTenantId(TenantId.fromUUID(UUID.randomUUID())); + Edge edge = new Edge(old.getId()); + edge.setTenantId(tenantId); + willReturn(old).given(edgeDao).findById(tenantId, edge.getId().getId()); + + assertThatThrownBy(() -> validator.validateUpdate(tenantId, edge)) + .isInstanceOf(DataValidationException.class) + .hasMessage("Can't update edge tenant id!"); + } + } diff --git a/edge-tenant-isolation-summary.md b/edge-tenant-isolation-summary.md new file mode 100644 index 0000000000..f321b15160 --- /dev/null +++ b/edge-tenant-isolation-summary.md @@ -0,0 +1,173 @@ +# Edge tenant isolation: fixes summary + +Confidential: PROD-9075, PROD-9081. Keep out of public PRs, commits and changelogs. + +**Common cause:** messages from an edge were not consistently checked against the edge's own tenant. The cloud took the tenant id from the payload, looked entities up by id without a tenant filter, and didn't validate referenced ids. + +**Merge order:** CE lts-4.2 → PE lts-4.2 → CE lts-4.3 → PE lts-4.3 (merges CE 4.3 and PE 4.2) → CE lts-4.4. CE `lts-4.4` merges CE `lts-4.3` (CE history only); PE-only fixes reach CE 4.4 as separate hand-written CE commits, never through a PE merge. Fixes in 4.2 reach later branches through the regular merges. Later sections list only what is new on that branch. + +--- + +## PR matrix + +Merge in this order. Each PR already contains the previous one in its chain, and every PR and forward merge (CE 4.2 → CE 4.3 → CE 4.4, CE 4.2 → PE 4.2 → PE 4.3, CE 4.3 → PE 4.3) was checked to merge without conflicts against upstream as of 2026-10-27. + +| # | Repo | Version | PR | Branch → base | Head | Contains | After merge | +|---|---|---|---|---|---|---|---| +| 1 | CE | 4.2 | [#16451](https://github.com/thingsboard/thingsboard/pull/16451) | `fix/edge-uplink-msgs-processing-lts-4.2` → `lts-4.2` | `728e0016ad3` | CE 4.2 fixes | Merge CE `lts-4.2` into PE `lts-4.2` and CE `lts-4.3` | +| 2 | PE | 4.2 | [#5279](https://github.com/thingsboard/thingsboard-pe/pull/5279) | `pe-fix/edge-uplink-msgs-processing-lts-4.2` → `lts-4.2` | `4b08f3bdec3` | #1 + PE group/owner checks | Merge PE `lts-4.2` into PE `lts-4.3` | +| 3 | CE | 4.3 | [#16452](https://github.com/thingsboard/thingsboard/pull/16452) | `fix/edge-uplink-msgs-processing-lts-4.3` → `lts-4.3` | `92140de0792` | #1 + user, API key, AI model, delete paths | Merge CE `lts-4.3` into PE `lts-4.3` and CE `lts-4.4` | +| 4 | PE | 4.3 | [#5280](https://github.com/thingsboard/thingsboard-pe/pull/5280) | `pe-fix/edge-uplink-msgs-processing-lts-4.3` → `lts-4.3` | `15125d8909d` | #2 + #3 + user group removal, report templates, scheduler events | — (4.4 is CE only; never merge PE into CE) | +| 5 | CE | 4.4 | [#16453](https://github.com/thingsboard/thingsboard/pull/16453) | `fix/edge-uplink-msgs-processing-lts-4.4` → `lts-4.4` | `dcb9c6dada2` | #3 + group/owner, user group removal, report templates, scheduler events (written as CE commits) | — | + +--- + +## CE lts-4.2 + +Branch `fix/edge-uplink-msgs-processing-lts-4.2`. Edge test suite: 121/121 pass, and each new test fails without its fix. + +| # | Area | Processors / paths | Issue | Fix | Tests | Status | +|---|---|---|---|---|---|---| +| 1 | Request messages | `DefaultEdgeRequestsService`: user credentials, device credentials, attributes, relations, rule chain metadata, widget bundle types | Requested ids were not checked against the edge's tenant, so the response could contain another tenant's data | `isTenantEntity` check before queuing the response. Widget bundles: own tenant or system tenant only | `UserEdgeTest`, `DeviceEdgeTest`, `RelationEdgeTest`, `RuleChainEdgeTest` (`…RequestFor…OfDifferentTenant…`) | Fixed | +| 2 | Entities with a tenant | device, device profile, asset, asset profile, dashboard, entity view, resource, calculated field, rule chain | Tenant taken from the payload; an id from another tenant could be created or overwritten | `checkEntityTenant` rejects foreign ids; tenant forced; validator runs against the edge's tenant; rule chain id taken from the message | `DeviceEdgeTest`, `DashboardEdgeTest`, `ResourceEdgeTest` (`…OfDifferentTenant…`, `…WithSystemTenantId…`) | Fixed | +| 3 | References | entity view target; calculated field entity and arguments; rule chain metadata target | Referenced entities were not checked against the edge's tenant | Must belong to the edge's tenant (`isEntityExists`) | `EntityViewEdgeTest`, `CalculatedFieldEdgeTest`, `RuleChainEdgeTest` | Fixed | +| 4 | Telemetry | attributes update/post, telemetry post, attribute delete | Target entity was only checked to exist | Target must belong to the edge's tenant (shared `isEntityExists`) | `TelemetryEdgeTest` | Fixed | +| 5 | Alarms | alarm, alarm comment | Originator and tenant taken from the payload; comments matched by id only | Originator in the edge's tenant; tenant forced; alarm id checked; comment must belong to an alarm of the edge's tenant | `AlarmEdgeTest` | Fixed | +| 6 | Relations | create, delete | Delete had no tenant check; create used an unscoped check | Both ends must belong to the edge's tenant | `RelationEdgeTest` | Fixed | +| 7 | Device RPC | status, response, request | RPC/device ids not checked | RPC and device must belong to the edge's tenant | covered by the existing RPC tests | Fixed | +| 8 | Unassign on delete | asset, dashboard, entity view, rule chain, calculated field, device (device: explicit guard added for consistency; the tenant-scoped `findDeviceById` already returns null for a foreign device) | Entity tenant not checked | Tenant guard | covered by the existing delete tests | Fixed | +| 9 | System-context events | `BaseEdgeProcessor.processActionForAllEdges`, `EdgeEventType`, `UserEdgeProcessor` | Events about tenant users raised without a tenant (auth flows, sysadmin actions) were queued for every active edge | `EdgeEventType.systemLevelSupported` (11 system-ownable types) and `allEdgesRelated` renamed to `allTenantEdgesRelated`. In system context: system-level types are broadcast, other types go to the entity's own tenant or are skipped. A user is sent only to edges of its own tenant | `UserEdgeTest`: `testUserActivationInDifferentTenant`, `testSysAdminCredentialsUpdate`, `testTenantUserCredentialsUpdate` | Fixed | +| 9a | System-context events, edge-assigned types | `BaseEdgeProcessor.processEntityNotification` (edge-assigned branch) | Where users are edge-assigned (PE, CE 4.4), credentials updated in system context (activation, password reset completion) were saved under the system tenant and never delivered to the user's edges | The notification is re-processed under the entity's own tenant; skipped when the entity has no tenant | `UserEdgeTest.testTenantUserCredentialsUpdate` (fails on plain PE 4.2) | Fixed | +| 10 | Email / SMS / notifications | `processSendEmailMsg`, `processSendSmsMsg`, `processSendNotificationMsg` | Recipients and content aren't restricted | Left to the planned "smart send" work; tenant-profile limits apply on PaaS | — | Not changed | +| 11 | Alarm comment author | alarm comment | Author user id taken from the payload | No cross-tenant write; left as is | — | Not changed | +| 12 | Rule node configurations | rule chain metadata | Node configs saved as sent | They run in the edge's own tenant; left as is | — | Not changed | +| 13 | Widget bundle request | `processWidgetBundleTypesRequestMsg` | — | Fixed in #1 | No dedicated test | Test gap | + +--- + +## PE lts-4.2 (after merging CE 4.2) + +Branch `pe-fix/edge-uplink-msgs-processing-lts-4.2`. Edge suite after the merge: 140/141; the only failure (`testTenantUserCredentialsUpdate`) also failed on plain PE 4.2 and is fixed by CE 4.2 #9a. + +| # | Area | Processors / paths | Issue | Fix | Tests | Status | +|---|---|---|---|---|---|---| +| 1 | Entity groups | add to group (`safeAddEntityToGroup`); remove from group on delete (device, asset, dashboard, entity view) | Group id from the edge not checked | Group owner (tenant or its customer) must belong to the edge's tenant (`safeRemoveEntityFromGroup`) | `EntityGroupEdgeTest.testSendDeviceDeleteFromGroupOfDifferentTenantToCloud` | Fixed | +| 2 | Owner change | `changeOwnerIfRequired` | Target customer taken from the payload | Rejected unless the owner belongs to the edge's tenant | `DeviceEdgeTest.testSendDeviceUpdateWithCustomerOfDifferentTenantToCloud` | Fixed | +| 3 | Entity group entities request | `processEntityGroupEntitiesRequest` | Group looked up without tenant check (members already re-filtered) | Skipped unless the group owner belongs to the edge's tenant | `EntityGroupEdgeTest.testSendEntityGroupEntitiesRequestForGroupOfDifferentTenantToCloud` (regression only) | Fixed | +| 4 | Scheduler events, report templates | — | No uplink processors in PE 4.2 (they exist on PE 4.3, see CE 4.4 #6–#7) | — | — | N/A | + +--- + +## CE lts-4.3 (after merging 4.2) + +| # | Area | Processors / paths | Issue | Planned fix | Status | +|---|---|---|---|---|---| +| 1 | User uplink | `BaseUserProcessor`: user save/update/delete, credentials | Tenant and authority taken from the payload; user ids from other tenants accepted | Tenant forced; authorities limited to tenant admin and customer user; cross-tenant user ids rejected | Fixed (#16432/#16433) | +| 2 | User credentials id | `BaseUserProcessor.updateUserCredentials` | Credentials record id from the payload is not checked | New `UserService.findUserCredentialsById`; skipped if the record belongs to a different user. Test: `UserEdgeTest.testSendUserCredentialsWithIdOfDifferentTenantUserToCloud` | Fixed | +| 3 | Authority test | `UserEdgeTest` | Test covers only SYS_ADMIN, which the validator also rejects | `testSendUserWithTokenAuthorityFromEdgeToCloud` (REFRESH_TOKEN) | Fixed | +| 4 | API keys | `BaseApiKeyProcessor` | Tenant and user taken from the payload; lookup by id unscoped | Foreign id rejected; tenant forced; user must be in the edge's tenant; tenant guard on delete. `internal`/`permissions` don't exist on 4.3 (see 4.4). Test: `ApiKeyEdgeTest.testSendApiKeyForUserOfDifferentTenantToCloud` | Fixed | +| 5 | AI models | `BaseAiModelProcessor` | Tenant taken from the payload; lookup by id unscoped | Foreign id rejected; tenant forced. Test: `AiModelEdgeTest.testSendAiModelWithTenantIdOfDifferentTenantToCloud` | Fixed | +| 6 | User downlink with API keys | `UserEdgeProcessor` ADDED/UPDATED | Also carries API keys | Covered by CE 4.2 #9; verify after merge | Verify | +| 7 | Edge credentials visibility | `EdgeController.getEdgeById` | Edge credentials visible to customer users with access to the edge | Product decision | Open | +| 8 | New event types | `EdgeEventType` entries added in 4.3 | — | `AI_MODEL`, `API_KEY`: not system-level (system-owned internal keys are skipped) | Fixed | +| 9 | Delete paths | asset, dashboard, entity view deletes really delete on 4.3 | Tenant guard inside `deleteAsset`, `deleteDashboard`, `deleteEntityView` | Fixed | +| 10 | Device delete | `BaseDeviceProcessor.deleteDevice` | Looked like an unguarded real delete | Not a gap: `findDeviceById` with a tenant id uses `findDeviceByTenantIdAndId`, so a foreign device is not found. Regression test `DeviceEdgeTest.testSendDeviceDeleteForDeviceOfDifferentTenantToCloud` (from 4.2) | OK | + +--- + +## PE lts-4.3 (after merging CE 4.3) + +| # | Area | Planned fix | Status | +|---|---|---|---| +| 1 | PE-only items from PE 4.2 | Merged PE 4.2 (`077ea1f16e2`); group removal on delete uses `safeRemoveEntityFromGroup`, while the edge ≥ 4.3.0 branch still deletes | Done | +| 2 | CE 4.3 items on PE code paths | Merged CE 4.3 (`6b66b550fca`); `REPORT_TEMPLATE` is not system-level (tenant/customer owned only) | Done | +| 3 | Device delete | Not a gap (see CE 4.3 #10); merged CE 4.3 `73f1933c680` and PE 4.2 `10ce7c7a3d7`, pushed to nm-pe | Done | + +--- + +## CE lts-4.4 (after merging CE 4.3) + +Branch `fix/edge-uplink-msgs-processing-lts-4.4` from `tb-ce/lts-4.4`. CE 4.3 merged as usual (CE history only). PE-only changes are written by hand as a new CE commit; nothing is merged or cherry-picked from PE. + +| # | Area | Issue | Fix | Tests | Status | +|---|---|---|---|---|---| +| 0 | API keys | `internal`/`permissions` exist on 4.4 | No change needed: `ApiKeyServiceImpl.saveApiKey` clears both for keys not owned by the system tenant, and the tenant is forced; system-tenant (internal) keys are rejected by `checkEntityTenant` and skipped on delete | `ApiKeyEdgeTest.testSendInternalApiKeyWithPermissionsToCloud` | OK | +| 1 | Delete paths | Edge deletes really delete | Asset, dashboard, entity view, API key, calculated field, user: guarded. Device: tenant-scoped lookup. AI model: `deleteByTenantIdAndId` | — | OK | +| 2 | Tests | Message constructors take an extra entity group argument | `null` passed in the new tests | — | Done | +| 3 | New event types | — | None new on 4.4; white labeling, login white labeling, mail templates, custom translation and custom menu are system-level | — | Done | +| 4 | Entity groups / owner (PE features on 4.4) | Same as PE 4.2 #1–#3 | `safeAddEntityToGroup` and `safeRemoveEntityFromGroup` check the group owner; `changeOwnerIfRequired` rejects foreign owners; group entities request checks the group owner | `EntityGroupEdgeTest` (device and user group removal, group entities request), `DeviceEdgeTest.testSendDeviceUpdateWithCustomerOfDifferentTenantToCloud` | Fixed | +| 5 | User removal from group | `UserEdgeProcessor` removed users from any group by id (also on PE 4.3) | `safeRemoveEntityFromGroup` | `EntityGroupEdgeTest.testSendUserDeleteFromGroupOfDifferentTenantToCloud` | Fixed (4.4; PE 4.3 `95d3e3aed0e`, `bbd0eff9832`) | +| 6 | Report templates | Uplink processor (also on PE 4.3): tenant from payload, lookup by id only, delete unguarded | `checkEntityTenant`, tenant forced, delete guard; customer is checked by the validator once the tenant is forced | `ReportTemplateEdgeTest` (`…WithTenantIdOfDifferentTenant…`, `…UpdateAndDeleteOfDifferentTenant…`) | Fixed (4.4; PE 4.3 `95d3e3aed0e`, `bbd0eff9832`) | +| 7 | Scheduler events | Uplink processor (also on PE 4.3): tenant from payload, lookup by id only; `GENERATE_REPORT` config could name another tenant's report template or user (the controller checks both) | `checkEntityTenant`, tenant forced, report template and user must belong to the edge's tenant; unassign guarded | `SchedulerEventEdgeTest` (`…WithTenantIdOfDifferentTenant…`, `…GenerateReport…WithUserOfDifferentTenant…`) | Fixed (4.4; PE 4.3 `95d3e3aed0e`, `bbd0eff9832`) | +| 8 | Build | lts-4.4 compiled locally this time | — | — | Note | + +--- + +## Follow-up: external user uplink review (2026-10-28) + +The review read upstream CE `lts-4.3` / `lts-4.4` before our PRs and didn't know about the PE repo. Status against our branches: + +| Review # | Finding | Status | +|---|---|---| +| 1 | Edge creates a system admin / admin in another tenant | Fixed upstream (`98c3aad861a`) | +| 2 | Credentials record id of another user reused | Fixed (CE 4.3 #2) | +| 2 | Credentials overwrite across tenants | Fixed upstream | +| 3 | Edge requests any user's credentials | Fixed (CE 4.2 #1, `isTenantEntity` in `processUserCredentialsRequestMsg`) | +| 4, 5 | Delete / edit users across tenants | Fixed upstream | +| A, B | Owner change / group membership across tenants (4.4, PE 4.3) | Fixed (CE 4.4 #4–#5, PE 4.3 `95d3e3aed0e`) | + +Remaining items, in fix order (customer-level items are deferred, see below). All are pushed and merged forward: PE 4.2 `a900b576169`, PE 4.3 `864f0d82aa1`, CE 4.4 `78541941f9f` (on CE 4.4, #1 re-applied by hand in `rpc/session/EdgeGrpcSession` and `EdgeUplinkMessageDispatcher`, which replace the deleted `rpc/EdgeGrpcSession`): + +| # | Branch | Issue | Review # | Decision | Status | +|---|---|---|---|---|---| +| 1 | CE 4.2 | Edge secret, msg bodies and credentials in edge failure notifications and logs | 7 | Replace msg bodies with type/id/count summaries (`EdgeMsgSummaryUtils`); drop the secret; redact device credentials logs. TRACE logs and non-credential entity JSON in processor logs left as is | Pushed `46ea9dbd883`; `DeviceEdgeTest`, `UserEdgeTest` pass | +| 2 | CE 4.2 | Activation/reset tokens sent to edges with user credentials | 8 | Strip `activateToken`, `resetToken` and their expiry from the credentials downlink; keep the hash (needed for local login). Shared constructor, so it covers PE and 4.3+ after merges | Pushed `728e0016ad3` | +| 2a | CE 4.2 | `additionalInfo` (password history hashes) still sent to edges | 8 | Leave as is: the edge already has the current hash, old hashes add little and the edge uses them for its password-reuse check. The credentials uplink must not overwrite the cloud's history (see #3) | Won't fix | +| 3 | CE 4.3 | Credentials uplink accepts reset/activation tokens, `failedLoginAttempts`, `additionalInfo`; saved with validation off | 2 | Merge instead of replace: only `password` and `enabled` from the edge, the rest stays as on cloud; password history updated on change (`UserService.updatePasswordHistory` made public). Activation: edge `enabled=true` clears the cloud's activation token; edge pending activation (not enabled, has token) makes the cloud generate its own token if it has none. Also restored the `@Test` on `UserEdgeTest.testSendUserCredentialsRequestForUserOfDifferentTenantToCloud`, lost in the CE 4.2 → 4.3 merge (missing on PE 4.3 and CE 4.4 too) | Pushed `6af0dd38ce3`, `2b7830a03fc`; `UserEdgeTest` 15/15, new test fails without the fix | +| 4 | CE 4.3 | User, user credentials, API key and AI model msgs in logs and in exception texts (which reach the failure notification) | 7 | Same approach as #1: ids (user, API key, AI model) or `EdgeMsgSummaryUtils` summaries instead of msg bodies; no msg content in exceptions; TRACE left as is | Pushed `02e854f79b7`; `UserEdgeTest`, `ApiKeyEdgeTest`, `AiModelEdgeTest` pass | +| 5 | CE 4.3 | Duplicate email in another tenant blocks the edge's user uplink and reveals that the email exists | 9 | Check the email across the platform (`findUserByEmail`, same case handling as `saveUser`) and rename as for same-tenant duplicates. Same on Citus: `tb_user` is a reference table, uniqueness enforced cluster-wide. The "email exists" hint isn't new (user creation via REST gives the same error) | Pushed `0475763bba7`; `UserEdgeTest` 16/16, new test fails without the fix | + +### Deferred: customer-level isolation + +Tracked in [EDGE-122](https://thingsboard-portal.atlassian.net/browse/EDGE-122) (work scope, decisions and known gaps); linked to PROD-9081. + +All of these stay inside the edge's own tenant: a customer-owned/assigned edge acting on tenant-level or other customers' data. Put aside on 2026-10-29. + +**Customer-level isolation must be addressed separately**, as its own task and PR chain, not as part of this tenant isolation work: + +- **Different scope.** PROD-9075/9081 and these PRs cover tenant isolation: an edge of tenant A can't read or change tenant B's data. Customer-level isolation is the next level down: an edge assigned to (CE) or owned by (PE) customer X must not change tenant-level data (tenant admins, tenant groups) or data of customer Y in the same tenant. +- **Why it matters.** A customer edge often runs at the customer's site. A stolen edge or extracted credentials currently allow creating a `TENANT_ADMIN`, setting a tenant admin's password, editing or deleting other customers' users, adding a user to the Tenant Administrators group (PE), and offline cracking of tenant admin hashes. A compromise at one customer site can escalate to the whole tenant. +- **Needs product decisions first.** It is not a missing check but an undefined access model for customer edges: whether tenant admins may log in locally on customer edges (if not, their hashes stop being sent, which changes current behaviour), whether a customer edge may manage only its own customer's users and only with customer authorities, and whether PE should stop auto-assigning tenant groups to customer-owned edges. +- **Starting point.** The table below and the review leftovers list every known customer-level gap with the options discussed so far. + +| Branch | Issue | Review # | Notes | +|---|---|---|---| +| CE 4.2 | Every edge, including customer-assigned ones, gets all tenant admins with password hashes (`TenantAdminUsersEdgeEventFetcher`) | 8 | Option discussed: don't send tenant admin hashes to customer edges (breaks local login for tenant admins there) | +| PE 4.2 | `DefaultTbEdgeService` auto-assigns Tenant Administrators and Tenant Users groups to every new edge, customer-owned too; moving an edge to a customer keeps them. Customer edges get tenant admin hashes by default | 8 | Configurable in PE (groups can be unassigned). Option discussed: stop auto-assigning tenant groups to customer-owned edges | +| CE 4.3 | Customer edge can create `TENANT_ADMIN` users, and edit, delete or set passwords of tenant admins and other customers' users; customer id taken from the msg (`setCustomerId`) | 2, 4, 5, 6 | Needs "edge customer" checks on create/update/delete/credentials | +| PE 4.3 / CE 4.4 | Customer edge can move users between customers: `changeOwnerIfRequired` runs before `userValidator.validate` | A | Cross-tenant part fixed | +| PE 4.3 / CE 4.4 | Customer edge can add a user to any group of its tenant (e.g. Tenant Administrators); `addEntityToEntityGroup` doesn't check the owner | B | Cross-tenant part fixed; group membership carries permissions in PE | + +### Leftovers from the review (after all PRs) + +Everything from the review that is not fully closed on our branches, by review finding: + +| Review # | What is left | Why / decision | Status | +|---|---|---|---| +| 2 | A customer edge can set a tenant admin's (or another customer's user's) password | Customer-level isolation | Deferred: EDGE-122 | +| 4 | A customer edge can delete tenant admins and other customers' users; on 4.4 / PE 4.3 a delete with an entity group id removes the user from a group of its tenant | Customer-level isolation | Deferred: EDGE-122 | +| 5 | A customer edge can edit tenant admins, including email, then reset their password | Customer-level isolation | Deferred: EDGE-122 | +| 6 | Customer id taken from the msg (`setCustomerId`); a customer edge can create `TENANT_ADMIN` users or users under any customer of the tenant | Customer-level isolation | Deferred: EDGE-122 | +| 7 | TRACE logs still print whole msgs | Developer-only, off in production | Left as is | +| 7 | Non-credential entity JSON (device, asset, dashboard, entity view, relation, rule chain, profiles, calculated field, scheduler event, report template) still in processor ERROR/WARN logs and in "cannot be converted" exception texts, which reach the edge failure notification | No credentials or secrets; same tenant's data | Left as is | +| 8 | Password hashes are still sent to edges (local login needs them); every CE edge gets all tenant admins, PE auto-assigns tenant groups to customer-owned edges | Hash itself is by design; the customer-edge part is customer-level isolation | Deferred: EDGE-122 | +| 8 | Password history (`additionalInfo.userPasswordHistory`) sent to edges | Edge already has the current hash; edge uses the history for its reuse check | Won't fix | +| A | On 4.4 / PE 4.3 `changeOwnerIfRequired` runs before `userValidator.validate`, so a customer edge can move a user to another customer of its tenant | Cross-tenant owners are rejected; customer-level isolation | Deferred: EDGE-122 | +| B | On 4.4 / PE 4.3 a customer edge can add a user to any group of its tenant (e.g. Tenant Administrators); group membership carries permissions in PE | Cross-tenant groups are rejected; customer-level isolation | Deferred: EDGE-122 | +| — | If the edge builds its credentials uplink with the shared `constructUserCredentialsUpdatedMsg`, it no longer sends the activation token, so a user created on the edge and not yet activated shows as activated on the cloud | Display only; needs a check in the edge repo | Open question | +| Other | Upstream `lts-4.4` has 3,444 Java files under BUSL-1.1 (`upstream` = public `thingsboard/thingsboard`), `lts-4.3` has none | Not an edge issue; for product/legal to confirm | Not ours | + +--- + +## PaaS +Same code as PE; follows the PE merges. diff --git a/edqs/pom.xml b/edqs/pom.xml index 08ad8c6257..704ca7efc7 100644 --- a/edqs/pom.xml +++ b/edqs/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-edqs ${project.build.directory}/windows true @@ -156,6 +157,10 @@ org.apache.maven.plugins maven-jar-plugin
+ + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -168,6 +173,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.xolstice.maven.plugins protobuf-maven-plugin diff --git a/integration/apache-pulsar/pom.xml b/integration/apache-pulsar/pom.xml index 933f978139..3124532310 100644 --- a/integration/apache-pulsar/pom.xml +++ b/integration/apache-pulsar/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-apache-pulsar-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/aws/pom.xml b/integration/aws/pom.xml index 51ad65f933..eae85b500c 100644 --- a/integration/aws/pom.xml +++ b/integration/aws/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-aws-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/azure/pom.xml b/integration/azure/pom.xml index d568ac3c65..179359bbc0 100644 --- a/integration/azure/pom.xml +++ b/integration/azure/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-azure-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/coap/pom.xml b/integration/coap/pom.xml index 617763a02a..82dfd8a93c 100644 --- a/integration/coap/pom.xml +++ b/integration/coap/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-coap-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/executor/pom.xml b/integration/executor/pom.xml index 4854543122..50e8a56fce 100644 --- a/integration/executor/pom.xml +++ b/integration/executor/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-integration-executor false ${project.build.directory}/windows @@ -119,10 +120,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -131,6 +140,31 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + + + package-sbom + + + + cryptographic-asset + DigiCert Global Root G2 + Root CA certificate for Azure IoT Hub connections. + + DigiCert, Inc. + + https://www.digicert.com + + + ${project.build.directory}/data/certs/azure/DigiCertGlobalRootG2.crt.pem + + + + + + org.apache.maven.plugins diff --git a/integration/executor/src/main/resources/tb-integration-executor.yml b/integration/executor/src/main/resources/tb-integration-executor.yml index 7e2f6d107c..0e7978f9b1 100644 --- a/integration/executor/src/main/resources/tb-integration-executor.yml +++ b/integration/executor/src/main/resources/tb-integration-executor.yml @@ -498,6 +498,9 @@ redis: nodes: "${REDIS_NODES:}" # Maximum number of redirects to follow when executing commands across the cluster. max-redirects: "${REDIS_MAX_REDIRECTS:12}" + # Period in seconds of the background refresh of the cluster slot map. It finds slots that moved to another node + # (after a failover, or when a node gets a new IP) even before a command to the old node fails. Set 0 to disable. + topology-refresh-period-sec: "${REDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC:30}" # if set false will be used pool config build from values of the pool config section useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}" sentinel: diff --git a/integration/http/pom.xml b/integration/http/pom.xml index d83c8b52d1..5bc82f903d 100644 --- a/integration/http/pom.xml +++ b/integration/http/pom.xml @@ -26,6 +26,7 @@ java process-resources package + ${pkg.package.phase} tb-http-integration false ${project.build.directory}/windows @@ -64,10 +65,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -76,6 +85,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/kafka/pom.xml b/integration/kafka/pom.xml index 168c9f5a68..aa56ecf747 100644 --- a/integration/kafka/pom.xml +++ b/integration/kafka/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-kafka-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/mqtt/pom.xml b/integration/mqtt/pom.xml index 1ab8dec89e..83e180e2fa 100644 --- a/integration/mqtt/pom.xml +++ b/integration/mqtt/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-mqtt-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/opc-ua/pom.xml b/integration/opc-ua/pom.xml index 3332c6462d..4c49affe2f 100644 --- a/integration/opc-ua/pom.xml +++ b/integration/opc-ua/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-opc-ua-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/pubsub/pom.xml b/integration/pubsub/pom.xml index d571e3c5b3..f087359e49 100644 --- a/integration/pubsub/pom.xml +++ b/integration/pubsub/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-pubsub-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/rabbitmq/pom.xml b/integration/rabbitmq/pom.xml index 3b286f1c5d..0db3ccdaad 100644 --- a/integration/rabbitmq/pom.xml +++ b/integration/rabbitmq/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-rabbitmq-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/tcp-udp/pom.xml b/integration/tcp-udp/pom.xml index 4f0c360e97..ce13d16b3a 100644 --- a/integration/tcp-udp/pom.xml +++ b/integration/tcp-udp/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-tcp-udp-integration false ${project.build.directory}/windows @@ -67,10 +68,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -79,6 +88,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/integration/tuya/pom.xml b/integration/tuya/pom.xml index 3057a6df39..8e325d9c36 100644 --- a/integration/tuya/pom.xml +++ b/integration/tuya/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-tuya-integration false ${project.build.directory}/windows @@ -63,10 +64,18 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -75,6 +84,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.apache.maven.plugins diff --git a/migrator/pom.xml b/migrator/pom.xml index fcf5838720..41717c4671 100644 --- a/migrator/pom.xml +++ b/migrator/pom.xml @@ -101,6 +101,10 @@ org.springframework.boot spring-boot-maven-plugin + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin diff --git a/monitoring/pom.xml b/monitoring/pom.xml index 5225aea050..45fde8874c 100644 --- a/monitoring/pom.xml +++ b/monitoring/pom.xml @@ -25,6 +25,7 @@ java process-resources package + ${pkg.package.phase} tb-monitoring false ${project.build.directory}/windows @@ -139,6 +140,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -151,6 +156,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.codehaus.mojo build-helper-maven-plugin diff --git a/msa/edqs/pom.xml b/msa/edqs/pom.xml index 5fc1650d80..807df3b0b8 100644 --- a/msa/edqs/pom.xml +++ b/msa/edqs/pom.xml @@ -26,6 +26,8 @@ ${maven.multiModuleProjectDirectory} tb-edqs ${tb.docker.id}-edqs + true + ${main.dir}/edqs/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -141,6 +143,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/apache-pulsar/pom.xml b/msa/integration/apache-pulsar/pom.xml index c4e9cb8263..7dbe26541c 100644 --- a/msa/integration/apache-pulsar/pom.xml +++ b/msa/integration/apache-pulsar/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-apache-pulsar-integration ${tb.docker.id}-apache-pulsar-integration + true + ${main.dir}/integration/apache-pulsar/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/aws/pom.xml b/msa/integration/aws/pom.xml index 1afd9aad25..8b58f4737e 100644 --- a/msa/integration/aws/pom.xml +++ b/msa/integration/aws/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-aws-integration ${tb.docker.id}-aws-integration + true + ${main.dir}/integration/aws/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/azure/pom.xml b/msa/integration/azure/pom.xml index e306620b71..ea12b52480 100644 --- a/msa/integration/azure/pom.xml +++ b/msa/integration/azure/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-azure-integration ${tb.docker.id}-azure-integration + true + ${main.dir}/integration/azure/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/coap/pom.xml b/msa/integration/coap/pom.xml index 81155bc7e9..1739f56dad 100644 --- a/msa/integration/coap/pom.xml +++ b/msa/integration/coap/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-coap-integration ${tb.docker.id}-coap-integration + true + ${main.dir}/integration/coap/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/executor/pom.xml b/msa/integration/executor/pom.xml index 450271579c..35b2788aab 100644 --- a/msa/integration/executor/pom.xml +++ b/msa/integration/executor/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-integration-executor ${tb.docker.id}-integration-executor + true + ${main.dir}/integration/executor/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/http/pom.xml b/msa/integration/http/pom.xml index beb8d3fe31..2d65ebbc76 100644 --- a/msa/integration/http/pom.xml +++ b/msa/integration/http/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-http-integration ${tb.docker.id}-http-integration + true + ${main.dir}/integration/http/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/kafka/pom.xml b/msa/integration/kafka/pom.xml index 00c1f17501..f6d69ddd3b 100644 --- a/msa/integration/kafka/pom.xml +++ b/msa/integration/kafka/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-kafka-integration ${tb.docker.id}-kafka-integration + true + ${main.dir}/integration/kafka/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/mqtt/pom.xml b/msa/integration/mqtt/pom.xml index de56a62159..888396d188 100644 --- a/msa/integration/mqtt/pom.xml +++ b/msa/integration/mqtt/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-mqtt-integration ${tb.docker.id}-mqtt-integration + true + ${main.dir}/integration/mqtt/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/opc-ua/pom.xml b/msa/integration/opc-ua/pom.xml index 2f455d67fd..1389e7395d 100644 --- a/msa/integration/opc-ua/pom.xml +++ b/msa/integration/opc-ua/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-opc-ua-integration ${tb.docker.id}-opc-ua-integration + true + ${main.dir}/integration/opc-ua/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/pom.xml b/msa/integration/pom.xml index 4e5a22d2fe..4feae93369 100644 --- a/msa/integration/pom.xml +++ b/msa/integration/pom.xml @@ -23,6 +23,8 @@ ${basedir}/../.. none + + none @@ -49,6 +51,11 @@ push-integration-docker-amd-arm-images + + + ${docker.push-integration-arm-amd-image.phase} + latest,${project.version} + @@ -112,6 +119,9 @@ 4.4.1-latest false + + ${docker.push-integration-arm-amd-image.phase} + ${sbom.image.latestTag},${project.version},${docker.lts.tag} @@ -190,4 +200,35 @@ + + + + + org.thingsboard + sbom-maven-plugin + + + + integration-image-sbom + ${sbom.integration-image.phase} + + image + + + ${sbom.integration-image.tags} + + + ${sbom.image.package.dir}/${pkg.name}.deb.cdx.json + ${project.build.directory}/${pkg.name}.deb + + + + + + + + + + diff --git a/msa/integration/pubsub/pom.xml b/msa/integration/pubsub/pom.xml index e9b7bb3975..e00259414f 100644 --- a/msa/integration/pubsub/pom.xml +++ b/msa/integration/pubsub/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-pubsub-integration ${tb.docker.id}-pubsub-integration + true + ${main.dir}/integration/pubsub/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/rabbitmq/pom.xml b/msa/integration/rabbitmq/pom.xml index baa664bea2..c16bfb0ccd 100644 --- a/msa/integration/rabbitmq/pom.xml +++ b/msa/integration/rabbitmq/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-rabbitmq-integration ${tb.docker.id}-rabbitmq-integration + true + ${main.dir}/integration/rabbitmq/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/tcp-udp/pom.xml b/msa/integration/tcp-udp/pom.xml index 5b47b031eb..2ee453c6c4 100644 --- a/msa/integration/tcp-udp/pom.xml +++ b/msa/integration/tcp-udp/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-tcp-udp-integration ${tb.docker.id}-tcp-udp-integration + true + ${main.dir}/integration/tcp-udp/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/integration/tuya/pom.xml b/msa/integration/tuya/pom.xml index 22ca7ffa7e..831cadc812 100644 --- a/msa/integration/tuya/pom.xml +++ b/msa/integration/tuya/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-tuya-integration ${tb.docker.id}-tuya-integration + true + ${main.dir}/integration/tuya/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -144,6 +146,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/js-executor/api/jsExecutor.ts b/msa/js-executor/api/jsExecutor.ts index f977468d6f..6975fc5def 100644 --- a/msa/js-executor/api/jsExecutor.ts +++ b/msa/js-executor/api/jsExecutor.ts @@ -4,11 +4,164 @@ import vm, { Script } from 'vm'; import atob from 'atob'; import btoa from 'btoa'; -import {TextDecoder} from "util"; +import {TextDecoder, types} from "util"; import { _logger } from '../config/logger'; export type TbScript = Script | Function; +type SandboxErrors = { + Error: ErrorConstructor; + TypeError: TypeErrorConstructor; + RangeError: RangeErrorConstructor; +}; + +// The only values host helpers may return to the sandbox. +type SandboxPrimitive = string | boolean | undefined; + +const typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype); + +function intrinsicGetter(prototype: object, name: string): (this: unknown) => any { + return Object.getOwnPropertyDescriptor(prototype, name)!.get!; +} + +const typedArrayBuffer = intrinsicGetter(typedArrayPrototype, 'buffer'); +const typedArrayByteOffset = intrinsicGetter(typedArrayPrototype, 'byteOffset'); +const typedArrayByteLength = intrinsicGetter(typedArrayPrototype, 'byteLength'); +const dataViewBuffer = intrinsicGetter(DataView.prototype, 'buffer'); +const dataViewByteOffset = intrinsicGetter(DataView.prototype, 'byteOffset'); +const dataViewByteLength = intrinsicGetter(DataView.prototype, 'byteLength'); + +// Sandbox-realm btoa, atob and TextDecoder delegating to the host helpers of installSandboxGlobals. +// Arguments must be coerced here, with intrinsics captured before user code runs. +// invoke() rethrows sandbox-realm errors only; anything else becomes a sandbox RangeError. +const sandboxGlobalsShim = new vm.Script(`(function (h) { + 'use strict'; + var S = String; + var getPrototypeOf = Object.getPrototypeOf; + var errorPrototype = Error.prototype; + var SandboxRangeError = RangeError; + function isSandboxError(e) { + if (e === null || typeof e !== 'object') { + return false; + } + for (var p = getPrototypeOf(e); p !== null; p = getPrototypeOf(p)) { + if (p === errorPrototype) { + return true; + } + } + return false; + } + function invoke(fn, a, b, c, d) { + try { + return fn(a, b, c, d); + } catch (e) { + if (isSandboxError(e)) { + throw e; + } + throw new SandboxRangeError('Maximum call stack size exceeded'); + } + } + globalThis.btoa = function btoa(data) { return invoke(h.btoa, S(data)); }; + globalThis.atob = function atob(data) { return invoke(h.atob, S(data)); }; + class TextDecoder { + constructor(label, options) { invoke(h.create, this, label === undefined ? 'utf-8' : S(label), !!(options && options.fatal), !!(options && options.ignoreBOM)); } + get encoding() { return invoke(h.prop, this, 'encoding'); } + get fatal() { return invoke(h.prop, this, 'fatal'); } + get ignoreBOM() { return invoke(h.prop, this, 'ignoreBOM'); } + decode(input, options) { return invoke(h.decode, this, input, !!(options && options.stream)); } + } + Object.defineProperty(TextDecoder.prototype, Symbol.toStringTag, {value: 'TextDecoder', configurable: true}); + globalThis.TextDecoder = TextDecoder; +})`); + +function toSandboxError(errors: SandboxErrors, hostError: unknown): Error { + const source = hostError instanceof Error ? hostError : new Error(String(hostError)); + const errorType = source instanceof RangeError ? errors.RangeError : source instanceof TypeError ? errors.TypeError : errors.Error; + const err = new errorType(source.message); + const code = (source as NodeJS.ErrnoException).code; + if (typeof code === 'string') { + Object.defineProperty(err, 'code', {value: code, writable: true, enumerable: true, configurable: true}); + } + return err; +} + +function requireString(value: unknown, name: string): string { + if (typeof value !== 'string') { + throw new TypeError(`The "${name}" argument must be of type string`); + } + return value; +} + +// Reads the input through host intrinsics only; the value itself is never passed on or property-accessed. +function toHostBytes(input: unknown): Uint8Array | undefined { + if (input === undefined) { + return undefined; + } + if (types.isAnyArrayBuffer(input)) { + return new Uint8Array(input); + } + if (types.isTypedArray(input)) { + return new Uint8Array(typedArrayBuffer.call(input), typedArrayByteOffset.call(input), typedArrayByteLength.call(input)); + } + if (types.isDataView(input)) { + return new Uint8Array(dataViewBuffer.call(input), dataViewByteOffset.call(input), dataViewByteLength.call(input)); + } + throw new TypeError('The "input" argument must be an instance of ArrayBuffer or ArrayBufferView'); +} + +function installSandboxGlobals(sandbox: vm.Context): void { + // Captured before user code runs, so later monkeypatching inside the sandbox has no effect. + const errors: SandboxErrors = vm.runInContext('({Error: Error, TypeError: TypeError, RangeError: RangeError})', sandbox); + const decoders = new WeakMap(); // host realm: user code cannot patch it + const decoderOf = (self: unknown): TextDecoder => { + const decoder = typeof self === 'object' && self !== null ? decoders.get(self) : undefined; + if (!decoder) { + throw new TypeError('Illegal invocation'); + } + return decoder; + }; + // The one place host results and errors cross into the sandbox. + const guard = (fn: (...args: A) => R) => (...args: A): R => { + let result: R; + try { + result = fn(...args); + } catch (e) { + throw toSandboxError(errors, e); + } + if ((typeof result === 'object' && result !== null) || typeof result === 'function') { + throw new errors.Error('Host value must not be returned to the sandbox'); + } + return result; + }; + const host = Object.assign(Object.create(null), { + btoa: guard((data: unknown) => btoa(requireString(data, 'data'))), + atob: guard((data: unknown) => atob(requireString(data, 'data'))), + create: guard((self: unknown, label: unknown, fatal: unknown, ignoreBOM: unknown) => { + if (typeof self !== 'object' || self === null || decoders.has(self)) { + throw new TypeError('Illegal invocation'); + } + decoders.set(self, new TextDecoder(requireString(label, 'label'), {fatal: fatal === true, ignoreBOM: ignoreBOM === true})); + return undefined; + }), + prop: guard((self: unknown, name: unknown): SandboxPrimitive => { + const decoder = decoderOf(self); + switch (name) { + case 'encoding': + return decoder.encoding; + case 'fatal': + return decoder.fatal; + case 'ignoreBOM': + return decoder.ignoreBOM; + default: + return undefined; + } + }), + decode: guard((self: unknown, input: unknown, stream: unknown) => + decoderOf(self).decode(toHostBytes(input), {stream: stream === true})), + }); + sandboxGlobalsShim.runInContext(sandbox)(host); +} + export class JsExecutor { useSandbox: boolean; private logger = _logger('JsExecutor'); @@ -62,9 +215,7 @@ export class JsExecutor { ctxArgs[i] = String(args[i]); } sandbox.args = ctxArgs; - sandbox.btoa = btoa; - sandbox.atob = atob; - sandbox.TextDecoder = TextDecoder; + installSandboxGlobals(sandbox); const result = script.runInContext(sandbox, {timeout: timeout}); resolve(result); } catch (err) { diff --git a/msa/js-executor/config/logger.ts b/msa/js-executor/config/logger.ts index 211303aafb..441fb90b27 100644 --- a/msa/js-executor/config/logger.ts +++ b/msa/js-executor/config/logger.ts @@ -5,8 +5,7 @@ import path from 'path'; import DailyRotateFile from 'winston-daily-rotate-file'; import { LogEntry, logLevel } from 'kafkajs'; -import { createLogger, format, transports } from 'winston'; -import * as Transport from 'winston-transport'; +import { createLogger, format, transport as Transport, transports } from 'winston'; const { combine, timestamp, label, printf, splat } = format; diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json index d88291cf17..c9ddd554a5 100644 --- a/msa/js-executor/package.json +++ b/msa/js-executor/package.json @@ -8,49 +8,42 @@ "scripts": { "pkg": "tsc && pkg -t node22-linux-x64 --output ./target/thingsboard-js-executor-linux ./target/src && pkg -t node22-win-x64 --no-bytecode --public-packages \"*\" --public --output ./target/thingsboard-js-executor-win.exe ./target/src && node install.js", "test": "mkdir -p target/surefire-reports && node --require ts-node/register --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=target/surefire-reports/TEST-js-executor.xml test/jsExecutor.test.ts test/oAuthBearerProvider.test.ts", - "start": "nodemon --watch '.' --ext 'ts' --exec 'ts-node server.ts'", - "start-prod": "nodemon --watch '.' --ext 'ts' --exec 'NODE_ENV=production ts-node server.ts'", - "build": "tsc" + "start": "node --watch --watch-preserve-output -r ts-node/register server.ts", + "start-prod": "NODE_ENV=production node --watch --watch-preserve-output -r ts-node/register server.ts", + "build": "tsc", + "sbom": "node ../../tools/src/main/javascript/yarn-sbom.js target/sbom/tb-js-executor.cdx.json application --all-platforms" }, "dependencies": { "@2l/kafkajs-lz4": "^1.3.2", "atob": "^2.1.2", "btoa": "^1.2.1", - "config": "^4.1.1", - "express": "^5.1.0", - "js-yaml": "^4.1.1", + "config": "^4.4.2", + "express": "^5.3.0", + "js-yaml": "^4.3.2", "kafkajs": "^2.2.4", "long": "^5.3.2", "simple-oauth2": "^5.1.0", "uuid-parse": "^1.1.0", - "winston": "^3.17.0", + "winston": "^3.19.0", "winston-daily-rotate-file": "^5.0.0" }, - "nyc": { - "exclude": [ - "test", - "__tests__", - "node_modules", - "target" - ] - }, "devDependencies": { + "@cyclonedx/cyclonedx-library": "10.3.0", "@types/atob": "^2.1.2", "@types/btoa": "^1.2.3", - "@types/config": "^3.3.5", - "@types/express": "~5.0.3", - "@types/node": "~22.17.2", + "@types/express": "~5.0.6", + "@types/node": "~22.20.5", "@types/simple-oauth2": "^5.0.8", "@types/uuid-parse": "^1.0.2", - "@yao-pkg/pkg": "^6.6.0", - "fs-extra": "^11.3.1", - "nodemon": "^3.1.10", + "@yao-pkg/pkg": "^6.24.0", + "@yarnpkg/lockfile": "1.1.0", + "fs-extra": "^11.4.1", + "normalize-package-data": "8.0.0", + "packageurl-js": "2.0.1", + "spdx-expression-parse": "4.0.0", "ts-node": "^10.9.2", "typescript": "~5.9.3" }, - "resolutions": { - "@yao-pkg/pkg/tar": ">=7.5.8" - }, "pkg": { "assets": [ "node_modules/config/**/*.*", diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 1e407061a6..687d7fbc25 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -39,6 +39,7 @@ the command line. --> ${skip.yarn} pre-integration-test + @@ -91,7 +92,7 @@ install-node-and-yarn - v22.22.2 + v22.23.4 v1.22.22 @@ -104,6 +105,16 @@ install --non-interactive --check-files --network-concurrency 4 --network-timeout 100000 --mutex network + + generate sbom + + yarn + + + ${sbom.yarn.skip} + run sbom pkg:maven/${project.groupId}/${project.artifactId}@${project.version} + + yarn pkg @@ -168,6 +179,10 @@ + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -212,6 +227,31 @@ + + + org.thingsboard + sbom-maven-plugin + + + sbom-metadata + + ${project.build.directory}/sbom/${pkg.name}.cdx.json + ${skip.yarn} + + + + image-sbom + + + + ${project.build.directory}/sbom/${pkg.name}.cdx.json + ${pkg.installFolder} + + + + + + diff --git a/msa/js-executor/test/coldPathProbe.ts b/msa/js-executor/test/coldPathProbe.ts new file mode 100644 index 0000000000..44249382ae --- /dev/null +++ b/msa/js-executor/test/coldPathProbe.ts @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { JsExecutor } from '../api/jsExecutor'; + +// Runs one probe as the first sandbox execution of a fresh process and reports +// whether any error caught on stack overflow came from outside the sandbox realm. +const call = process.argv[2]; + +(async () => { + const exec = new JsExecutor(true); + const script = await exec.compileScript(`function(msg, metadata, msgType){ + var foreign; + function attempt() { + if (foreign) return; + try { ${call}; } catch (e) { + if (e === null || typeof e !== 'object' || (e.constructor !== RangeError && e.constructor !== TypeError && e.constructor !== Error)) { + foreign = String(e && e.name); + } + } + } + function recurse() { try { recurse(); } catch (e) {} attempt(); } + recurse(); + return foreign ? 'foreign error: ' + foreign : 'isolated'; + }`); + const out = await exec.executeScript(script, ['{}', '{}', 'X'], 20000); + process.stdout.write(String(out)); +})().catch((err) => { + process.stdout.write('probe failed: ' + String(err && err.message)); +}); diff --git a/msa/js-executor/test/jsExecutor.test.ts b/msa/js-executor/test/jsExecutor.test.ts index 061fd90623..1d74bf251a 100644 --- a/msa/js-executor/test/jsExecutor.test.ts +++ b/msa/js-executor/test/jsExecutor.test.ts @@ -3,6 +3,9 @@ // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { describe, test } from 'node:test'; import assert from 'node:assert/strict'; +import { execFile } from 'node:child_process'; +import path from 'node:path'; +import { promisify } from 'node:util'; import { JsExecutor } from '../api/jsExecutor'; import { oauthBearerProvider } from '../queue/oAuthBearerProvider'; @@ -39,6 +42,121 @@ test('sandbox passes string args through unchanged', async () => { assert.equal(out.first, 'hello'); }); +const sandboxRealmProbes: [string, string][] = [ + ['btoa', 'btoa.constructor'], + ['atob', 'atob.constructor'], + ['TextDecoder', 'TextDecoder.constructor'], + ['TextDecoder instance', 'new TextDecoder().constructor.constructor'], + ['TextDecoder.prototype.decode', 'TextDecoder.prototype.decode.constructor'], + ['TextDecoder getter', 'Object.getOwnPropertyDescriptor(TextDecoder.prototype, "encoding").get.constructor'], + ['TextDecoder constructor error', '(function(){ try { new TextDecoder("no-such-encoding"); } catch (e) { return e.constructor.constructor; } })()'], + ['TextDecoder decode error', '(function(){ try { new TextDecoder().decode("not a buffer"); } catch (e) { return e.constructor.constructor; } })()'], + ['TextDecoder fatal decode error', '(function(){ try { new TextDecoder("utf-8", {fatal: true}).decode(new Uint8Array([0xff])); } catch (e) { return e.constructor.constructor; } })()'], + ['getter on foreign receiver', '(function(){ try { Object.getOwnPropertyDescriptor(TextDecoder.prototype, "fatal").get.call({}); } catch (e) { return e.constructor.constructor; } })()'], + ['patched WeakMap/String', '(function(){ var leak; WeakMap.prototype.get = function(k){ leak = this; }; String = function(x){ return x; }; var d = new TextDecoder(); d.decode(new Uint8Array([104])); try { btoa("\\u0100"); } catch (e) {} return leak ? leak.constructor.constructor : Function; })()'], + ['Error.prepareStackTrace', '(function(){ var fr; Error.prepareStackTrace = function(e, s){ fr = s; return ""; }; try { new TextDecoder("nope"); } catch (e) { e.stack; } for (var i = 0; fr && i < fr.length; i++) { var f = fr[i].getFunction && fr[i].getFunction(); if (f) return f.constructor; var t = fr[i].getThis && fr[i].getThis(); if (t && t.constructor) return t.constructor.constructor; } return Function; })()'], + // Node formats some ERR_INVALID_ARG_TYPE messages with util.inspect, which calls a custom inspect hook. + ...['utf-8', 'latin1', 'utf-16le'].map((encoding): [string, string] => [`TextDecoder.decode inspect hook (${encoding})`, + `(function(){ var F; var o = Object.create(null); o[Symbol.for("nodejs.util.inspect.custom")] = function(d, opts, insp){ F = insp && insp.constructor; return "x"; }; + try { new TextDecoder("${encoding}").decode(o); } catch (e) {} + var p = {}; Object.setPrototypeOf(p, ArrayBuffer.prototype); Object.defineProperty(p, "constructor", {value: ArrayBuffer}); p[Symbol.for("nodejs.util.inspect.custom")] = o[Symbol.for("nodejs.util.inspect.custom")]; + try { new TextDecoder("${encoding}").decode(p); } catch (e) {} + return F || Function; })()`]), + ...['btoa', 'atob'].map((fn): [string, string] => [`${fn} with patched String returning an inspectable object`, + `(function(){ var F; String = function(x){ var o = Object.create(null); o[Symbol.for("nodejs.util.inspect.custom")] = function(d, opts, insp){ F = insp && insp.constructor; return "x"; }; return o; }; + try { ${fn}("a"); } catch (e) {} + return F || Function; })()`]), +]; + +for (const [name, functionCtor] of sandboxRealmProbes) { + test(`sandbox globals belong to the sandbox realm: ${name}`, async () => { + const exec = new JsExecutor(true); + const script = await exec.compileScript(`function(msg, metadata, msgType){ + var F = ${functionCtor}; + return F('return process')(); + }`); + await assert.rejects( + exec.executeScript(script, ['{}', '{}', 'X'], 5000), + /process is not defined/, + 'host process must not be reachable from inside the sandbox', + ); + }); +} + +test('sandbox globals belong to the sandbox realm: resolving functions of a returned thenable', async () => { + const exec = new JsExecutor(true); + const script = await exec.compileScript(`function(msg, metadata, msgType){ + return {then: function(resolve){ resolve(resolve.constructor.constructor('return process')()); }}; + }`); + await assert.rejects( + exec.executeScript(script, ['{}', '{}', 'X'], 5000), + /process is not defined/, + ); +}); + +// A stack overflow inside a helper reproduces only while its host code path is cold, +// so each probe runs as the first sandbox execution of a fresh process. +const coldPathCalls = [ + "btoa('a')", + "atob('YQ==')", + "new TextDecoder('nope')", + "new TextDecoder().decode(new Uint8Array([104]))", + "new TextDecoder().encoding", + "Object.getOwnPropertyDescriptor(TextDecoder.prototype, 'fatal').get.call({})", +]; + +test('sandbox helpers rethrow only sandbox-realm errors on stack overflow in cold host code', async () => { + const run = promisify(execFile); + const results = await Promise.all(coldPathCalls.map(async (call) => { + const {stdout} = await run(process.execPath, ['--require', 'ts-node/register', path.join(__dirname, 'coldPathProbe.ts'), call], + {cwd: path.join(__dirname, '..'), env: {...process.env, TS_NODE_TRANSPILE_ONLY: 'true'}, timeout: 60000}); + return [call, stdout]; + })); + assert.deepEqual(results, coldPathCalls.map((call) => [call, 'isolated'])); +}); + +test('sandbox btoa/atob encode, decode and coerce like the browser API', async () => { + const exec = new JsExecutor(true); + const script = await exec.compileScript(`function(msg, metadata, msgType){ + return JSON.stringify([btoa('hello'), atob('aGVsbG8='), atob(btoa('\\u00ff\\u0000x')) === '\\u00ff\\u0000x', btoa(123), + btoa.name, atob.name, Object.getPrototypeOf(btoa) === Function.prototype]); + }`); + const out = await exec.executeScript(script, ['{}', '{}', 'X'], 5000); + assert.equal(out, JSON.stringify(['aGVsbG8=', 'hello', true, 'MTIz', 'btoa', 'atob', true])); +}); + +test('sandbox TextDecoder decodes like the host TextDecoder', async () => { + const exec = new JsExecutor(true); + const script = await exec.compileScript(`function(msg, metadata, msgType){ + var bytes = new Uint8Array([0xEF, 0xBB, 0xBF, 0x68, 0xC3, 0xA9, 0xE2, 0x82, 0xAC]); + var d = new TextDecoder(); + var stream = new TextDecoder(); + var streamed = stream.decode(new Uint8Array([0xE2, 0x82]), {stream: true}) + stream.decode(new Uint8Array([0xAC])); + var latin = new TextDecoder('latin1'); + function errorType(fn) { try { fn(); return 'none'; } catch (e) { return e instanceof RangeError ? 'RangeError' : e instanceof TypeError ? 'TypeError' : 'other'; } } + return JSON.stringify([ + d.decode(bytes), d.decode(bytes.buffer), d.decode(new DataView(bytes.buffer, 3)), d.decode(), + d.decode(bytes.subarray(3)), d.decode(bytes.subarray(4, 6)), d.decode(new Uint16Array(bytes.buffer, 2, 2)), + new TextDecoder('utf-8', {ignoreBOM: true}).decode(bytes).length, streamed, + d.encoding, d.fatal, d.ignoreBOM, new TextDecoder('UTF8', {fatal: true}).fatal, + latin.encoding, latin.decode(new Uint8Array([0xE9])), + errorType(function(){ new TextDecoder('utf-8', {fatal: true}).decode(new Uint8Array([0xFF])); }), + errorType(function(){ new TextDecoder('no-such-encoding'); }), + errorType(function(){ TextDecoder.prototype.decode.call({}, bytes); }), + errorType(function(){ TextDecoder(); }), + d instanceof TextDecoder, Object.prototype.toString.call(d)]); + }`); + const out = await exec.executeScript(script, ['{}', '{}', 'X'], 5000); + assert.equal(out, JSON.stringify([ + 'hé€', 'hé€', 'hé€', '', + 'hé€', 'é', '\uFFFDhé', + 4, '€', + 'utf-8', false, false, true, + 'windows-1252', 'é', + 'TypeError', 'RangeError', 'TypeError', 'TypeError', + true, '[object TextDecoder]'])); +}); + // The use_sandbox=false path is intentionally non-isolating: scripts compile // and run in the host realm via vm.compileFunction. The two tests below codify // that documented contract so any future behavior change shows up as a test diff --git a/msa/js-executor/yarn.lock b/msa/js-executor/yarn.lock index 49a547d350..3c195e8c38 100644 --- a/msa/js-executor/yarn.lock +++ b/msa/js-executor/yarn.lock @@ -9,112 +9,173 @@ dependencies: lz4-napi "^2.8.0" -"@antoniomuso/lz4-napi-android-arm-eabi@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-android-arm-eabi/-/lz4-napi-android-arm-eabi-2.9.0.tgz#5ea67847f0a761c9aec22a31212d0e429ca01fb2" - integrity sha512-aeT/9SoWq7rnmzssWuCKUPaxVt3fzE9q+xq/ZHbnUSmrm8/EhLOACMvQeCOnL0IZsmPh8EpuwIE1TZyM9iQPRA== - -"@antoniomuso/lz4-napi-android-arm64@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-android-arm64/-/lz4-napi-android-arm64-2.9.0.tgz#64cb0aac70267bb071bba2d8e382301e058811ca" - integrity sha512-ibQ0qiEvmljXAM97IgOZfh+PeiSQ0Rqf2HErJlZPVm2v4GVJoB67v21v1TUydqNNV5L8bwufVoZ90nheL8X9ZA== - -"@antoniomuso/lz4-napi-darwin-arm64@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-darwin-arm64/-/lz4-napi-darwin-arm64-2.9.0.tgz#669e48b165af11cec20581acc2caa0d1c0f84472" - integrity sha512-1su4K1MWa4bcWoZlHajv+luGmFDV1JwIsvjtDF+0HhUveSDPP+8A4Z34zOZidURIr08Sl7M7ViPth6ZQ9SqnAA== - -"@antoniomuso/lz4-napi-darwin-x64@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-darwin-x64/-/lz4-napi-darwin-x64-2.9.0.tgz#a00ddf021772e26bd01b3ca5e3025f11d1667edf" - integrity sha512-8Lnbm2MkdJtiJ/nbcRS9zRyGp3G0sG6D+Y/x1vTP8nZs3/f8tBwYNsjxCQyyXNNyHcYWwVGbk68onP/pyDljOA== - -"@antoniomuso/lz4-napi-freebsd-x64@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-freebsd-x64/-/lz4-napi-freebsd-x64-2.9.0.tgz#fdc2b292489bd6d4e44eb7bb059fb9bd4b860f14" - integrity sha512-k04EMVOjntKDPrdR4Tf8WyNseuk9PTtSGw8WHyp4CTjoR1s+YJxtp9SMnThe5o2q0TATwk8WGYb/Howrp5OMxw== - -"@antoniomuso/lz4-napi-linux-arm-gnueabihf@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-arm-gnueabihf/-/lz4-napi-linux-arm-gnueabihf-2.9.0.tgz#9fcdf93b3ca5aa24469e4bf11dd7100df8c71975" - integrity sha512-H92F8zPZmgy2r8IhCWh3qIBfLp2BQ5cp18RoDXhtGFWwkh+5gVWrZp11IVznrsdgB0QeW0VR7dAMMHg3WLOPfA== - -"@antoniomuso/lz4-napi-linux-arm64-gnu@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-arm64-gnu/-/lz4-napi-linux-arm64-gnu-2.9.0.tgz#9d22e075a9cb60c3cb415428138618ae4a79f3c5" - integrity sha512-25crh0qs/3Rj3fMI8ulYD0DoaKsidUhMBki2aeO69ZK+F8bmQ/e2++FlgJ6f3EgMP5CNxJtnZXKhPOraQWjwAw== - -"@antoniomuso/lz4-napi-linux-arm64-musl@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-arm64-musl/-/lz4-napi-linux-arm64-musl-2.9.0.tgz#d957bce3accd49199bb6de522f5163efa2068fe4" - integrity sha512-eJtHp38zuLaYI0/cOV/BKcNQiXUBo4GPx53FTf0Y307yUjLsn48LNeN0vD28Ct9YrbUae3bQvMD5AD86She0ww== - -"@antoniomuso/lz4-napi-linux-x64-gnu@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-x64-gnu/-/lz4-napi-linux-x64-gnu-2.9.0.tgz#c86567d5aa23863059afbee829fb9f45895d3869" - integrity sha512-mDjS4dyjRKaZQcAP71SphkYH5r3kufB30ih/VETVu/br2toCfBk6Zr1xhL1r+L7FaVAFzF62B7h30CiqrN0Awg== - -"@antoniomuso/lz4-napi-linux-x64-musl@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-x64-musl/-/lz4-napi-linux-x64-musl-2.9.0.tgz#7d02612dec7d6247645aa321871b15247da0ce7d" - integrity sha512-pvU7Z7qjkjn17NkddBtBQ7C2iRqjtZ7WJ3Jqrjtj4XxolY3Q0HaYMvWjkWhzb9AKGZbj5y+EHYtbVoZJ2TSQhQ== - -"@antoniomuso/lz4-napi-win32-arm64-msvc@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-win32-arm64-msvc/-/lz4-napi-win32-arm64-msvc-2.9.0.tgz#c901bfec718303ed86867129ecc0371eaa883517" - integrity sha512-aioLlbpJl0QPEXLXhh2bzyitc3T7Jot3f1ap6WdKiRa+CIjMHXw1nxJXy07MLXif10r+qVZr86ic8dvwErgqEQ== - -"@antoniomuso/lz4-napi-win32-ia32-msvc@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-win32-ia32-msvc/-/lz4-napi-win32-ia32-msvc-2.9.0.tgz#11e48b18b7923c250735e0130998e5968ae91130" - integrity sha512-VaF4XMTdYb59TsPsiqnWwsNaWKHhgxF33z5p4zg4n0tp20eWozl76hn8B+aXthSs40W0W1N97QhxxV4oXGd8cg== - -"@antoniomuso/lz4-napi-win32-x64-msvc@2.9.0": - version "2.9.0" - resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-win32-x64-msvc/-/lz4-napi-win32-x64-msvc-2.9.0.tgz#20d9f71a638f3277cd0b7662e966f90e53d98af8" - integrity sha512-wfA8ShO3eGLxJ1LDwXJo87XL2D4NkMJV1pfHPvLZpD0MWb9u8VfgS+gKK5YhT7XKjzVdeIna9jgFdn2HBnZBxA== - -"@babel/generator@^7.23.0": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.3.tgz#9626c1741c650cbac39121694a0f2d7451b8ef3e" - integrity sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw== - dependencies: - "@babel/parser" "^7.28.3" - "@babel/types" "^7.28.2" +"@antoniomuso/lz4-napi-android-arm-eabi@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-android-arm-eabi/-/lz4-napi-android-arm-eabi-2.10.0.tgz#40b924454c818e1b6983dc6970f2164e11c9f6f1" + integrity sha512-BmVivZ5OwdM5IogpqHEKGoMEOJ98ZhIf35cBAKlt5axZR1nCy8X6O8B1noyQZETSXw0901Z/uAx0/23+ulyxuQ== + +"@antoniomuso/lz4-napi-android-arm64@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-android-arm64/-/lz4-napi-android-arm64-2.10.0.tgz#252938c535cdf634036f0515642fd96a2aa7c927" + integrity sha512-Oi2nIJvxG0ckK+lQYuuDtBI7mrQoj+glnNp4c19rhm0D0utkuRuI2bzqXOp5uth/IFNlP+W3pepfOCULeydKJw== + +"@antoniomuso/lz4-napi-darwin-arm64@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-darwin-arm64/-/lz4-napi-darwin-arm64-2.10.0.tgz#492a5305d01721351882c13170893c8cf4d30494" + integrity sha512-rrP5B4CJkSgHBAZ8jP/xGdXULDjDMF/DiUPxtBdo23CfkIOvf2VYGDF2vWO+1LDFMqlV4Mu4dZWwvOWklP4t4Q== + +"@antoniomuso/lz4-napi-darwin-x64@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-darwin-x64/-/lz4-napi-darwin-x64-2.10.0.tgz#84e20ce008868e464933d470588b3cc0e70d6bda" + integrity sha512-NytV3XbMC6JCX0uxiYgJV7cTUEWczT6e/rjfnIATsRuOOZLn1nNn1TIpGsAwLPcWoTgBsG0JcvLA1D+t3CLhAQ== + +"@antoniomuso/lz4-napi-freebsd-x64@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-freebsd-x64/-/lz4-napi-freebsd-x64-2.10.0.tgz#50b0b2d467555a577441b5ce9ebc723c7fc16ff7" + integrity sha512-CB7u672akKGZJr0MgH9qrBjcTRRf0yyPCBD0HjSChx+GfKJtQrMXEWLO68X+gTPjnlceywyqmzDA/t6zOavSYw== + +"@antoniomuso/lz4-napi-linux-arm-gnueabihf@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-arm-gnueabihf/-/lz4-napi-linux-arm-gnueabihf-2.10.0.tgz#668f6244a04aa6e22f02b814d736169b28a8e3cf" + integrity sha512-fjUVOWP0YYiaqXsrNAXa5pxdf+C6ql0sJFOZ/LZeID6fx8qle/+zjpJOYK/vE4dFOfxYFpMWXFYr+M/DfFhUdQ== + +"@antoniomuso/lz4-napi-linux-arm64-gnu@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-arm64-gnu/-/lz4-napi-linux-arm64-gnu-2.10.0.tgz#d55902bad3367429a7eb997cc0ab99f53fe7c90c" + integrity sha512-Ai0MfalUR4par5YI0AciKUUGCuMeshU3KLzaCavEgA3VHc//fU37VrbmzU/SgNjcJzdKFB9d3JZZAAe2wZ1tSQ== + +"@antoniomuso/lz4-napi-linux-arm64-musl@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-arm64-musl/-/lz4-napi-linux-arm64-musl-2.10.0.tgz#b20b501f92cc4fd3cffff913b6e69850718d8cfb" + integrity sha512-LNUlCFiTfYUstWcpNP2op9tf6RfxWlB1LmkdGfUvt/L4xgagktDnDy6Bii+ErZfocQ/M8hUDJnA57c4a/uax4A== + +"@antoniomuso/lz4-napi-linux-ppc64-gnu@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-ppc64-gnu/-/lz4-napi-linux-ppc64-gnu-2.10.0.tgz#93d2308a7133425882d1b034589b98eae176ac0a" + integrity sha512-gNTGuwI2aYp+yNvFZe60iKVv/whfhTK3d3n8kbP0WG8nLvfka+wIch67aQM3G4eqB/KlS7fLAJdCvVC5x4CQWw== + +"@antoniomuso/lz4-napi-linux-riscv64-gnu@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-riscv64-gnu/-/lz4-napi-linux-riscv64-gnu-2.10.0.tgz#f5015ea128358cd231cafbd71a5e594f6c23a48f" + integrity sha512-mHh5I55EtfFxS82Cm+HyGt6XezvBVDZV406qvS80FxEhHP4yNititbaGd/uGJ8Hr0+Fh4TDKPyiDZps19FJEoQ== + +"@antoniomuso/lz4-napi-linux-s390x-gnu@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-s390x-gnu/-/lz4-napi-linux-s390x-gnu-2.10.0.tgz#e066bbf5c36d5af824c6eab9f3110e1e7a7f6e8b" + integrity sha512-CVR4x8W5EqypGKsK2ffGxvtDz5NCUN6fx4jQPEMhL6LR66uc8TxKtYzlF+hvQnuVkN3Va+NwTGCurJS9CVPGFA== + +"@antoniomuso/lz4-napi-linux-x64-gnu@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-x64-gnu/-/lz4-napi-linux-x64-gnu-2.10.0.tgz#6246dcb86841fb9b7ee5a44e5754ee22bb165d96" + integrity sha512-UQQZephsIQrEbMM+Wp7SKYUqVR9DJLCMkZkOoLU9DDf2Ctvy6jXuqQoFF3ajh/mPh8gFp/s1WEcnUO8IRBiDpw== + +"@antoniomuso/lz4-napi-linux-x64-musl@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-linux-x64-musl/-/lz4-napi-linux-x64-musl-2.10.0.tgz#323c18db3bcd9e8b9479861a7fc4a26cab2ded3d" + integrity sha512-f30AGLcOsyiQU0EuWYmCZGID/6vcr/1scKaQ2G90QBJ/8aTWTwRDZGT7NPOE6mJ71ioI/ZLJGHiytjbiPjZfng== + +"@antoniomuso/lz4-napi-openharmony-arm64@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-openharmony-arm64/-/lz4-napi-openharmony-arm64-2.10.0.tgz#d2710fc6b48ab755826301d9b43fc10bfc704202" + integrity sha512-LUrHBJcnHqKsCyt0LvgsrRij5VWHXtwUQyJZT+kXSfkW+snIqKqVzucFpMHETFDKQNkMTsmHruVV/UEBbYuw/A== + +"@antoniomuso/lz4-napi-win32-arm64-msvc@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-win32-arm64-msvc/-/lz4-napi-win32-arm64-msvc-2.10.0.tgz#96e70b514f0dac368b6de768967abb05ca111e64" + integrity sha512-6k8Qu3V8fq4QbHS6vPQy8fggOvTUMQsVZP+WZBUMrG6A4ZPiMmPfFF+xJfLJCnOoijkBdRSiS1Y9oEv84lFPDw== + +"@antoniomuso/lz4-napi-win32-ia32-msvc@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-win32-ia32-msvc/-/lz4-napi-win32-ia32-msvc-2.10.0.tgz#96e81babd3f6e9b173b2fac4b8757cdbfea05aa2" + integrity sha512-5zKO7JdZXM/GL5XuTufwtIc3OVLhbRC/5PkcY4XmpU/IjUm4P9OkBAPNqBTgFfZbDc7eCigf92UcPLEk1PIShg== + +"@antoniomuso/lz4-napi-win32-x64-msvc@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@antoniomuso/lz4-napi-win32-x64-msvc/-/lz4-napi-win32-x64-msvc-2.10.0.tgz#8b635f0249813a9256ae0c783863bcad549b58aa" + integrity sha512-YC15uBJQdkXtPpu0JXozeEAO+b4LVjo2gOWKsPNmhNGhtkIAnKJZo+ueO6KNaFx4W6H2DQyAEiP1DsoBND26fw== + +"@babel/code-frame@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== + dependencies: + "@babel/helper-validator-identifier" "^7.29.7" + js-tokens "^4.0.0" + picocolors "^1.1.1" + +"@babel/generator@^7.23.0", "@babel/generator@^7.29.8": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.8.tgz#4b0b887885422643339e09022148a4c4ebaa4979" + integrity sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg== + dependencies: + "@babel/parser" "^7.29.8" + "@babel/types" "^7.29.8" "@jridgewell/gen-mapping" "^0.3.12" "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== - -"@babel/helper-validator-identifier@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" - integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== - -"@babel/parser@^7.23.0", "@babel/parser@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.3.tgz#d2d25b814621bca5fe9d172bc93792547e7a2a71" - integrity sha512-7+Ey1mAgYqFAx2h0RuoxcQT5+MlG3GTV0TQrgr7/ZliKsm/MNDxVVutlWaziMq7wJNAz8MTqz55XLpWvva6StA== - dependencies: - "@babel/types" "^7.28.2" - -"@babel/types@^7.23.0", "@babel/types@^7.28.2": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.2.tgz#da9db0856a9a88e0a13b019881d7513588cf712b" - integrity sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ== - dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - -"@colors/colors@1.6.0", "@colors/colors@^1.6.0": +"@babel/helper-globals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.29.7.tgz#f04a96fbd8473241b1079243f5b3f03a3010ab7b" + integrity sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA== + +"@babel/helper-string-parser@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz#7f0871d99824d23137d60f86fcf6130fd5a1b51f" + integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw== + +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== + +"@babel/parser@^7.23.0", "@babel/parser@^7.29.7", "@babel/parser@^7.29.8", "@babel/parser@^7.29.9": + version "7.29.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.9.tgz#e7ee0a24f752c5296c6455855ccb72662e67ea96" + integrity sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA== + dependencies: + "@babel/types" "^7.29.8" + +"@babel/template@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.29.7.tgz#4d9d4004f645cdd304de958c725162784ecac700" + integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/traverse@^7.23.0": + version "7.29.10" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.10.tgz#08ab387639b4a67304511259c7da6cf23a82e91c" + integrity sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.8" + "@babel/helper-globals" "^7.29.7" + "@babel/parser" "^7.29.9" + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.8" + debug "^4.3.1" + +"@babel/types@^7.23.0", "@babel/types@^7.29.7", "@babel/types@^7.29.8": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.8.tgz#1229eef31d85156d70fa3f4cd859376d0eaf6863" + integrity sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg== + dependencies: + "@babel/helper-string-parser" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + +"@colors/colors@1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.0.tgz#ec6cd237440700bc23ca23087f513c75508958b0" integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA== +"@colors/colors@^1.6.0": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.1.tgz#8e2827259ada76965b3a051c18a5927fbdac38c2" + integrity sha512-dTmUJzXSuayBK+hZydEaXd2mhx61qWQwkwaBBY6LyEOVx/L9aQU5ac8eFNEsd9nrD1+zb9zvDCphLSe8g1F4Qw== + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -122,15 +183,150 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@dabh/diagnostics@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a" - integrity sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA== +"@cyclonedx/cyclonedx-library@10.3.0": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@cyclonedx/cyclonedx-library/-/cyclonedx-library-10.3.0.tgz#92ccd1553d64d7c593b1adc31203cba01583d3df" + integrity sha512-RIT28sp1U0PCHaaeF3yNRwk6Jig/XJ8UsYAVOMYaHQ+0VVOvsjcp0PTWQFLUqJFF8XMud+Kdq6G+wtDAh+QJFA== + +"@dabh/diagnostics@^2.0.8": + version "2.0.9" + resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.9.tgz#0de9e8718e23ab60d1fb1ce0c004079f14f5ad36" + integrity sha512-R6siwR65Hm+3yfgP7o8DKhNvputQAwfoz9zTc3kyDudnomj2/BcLmD+uGQQPICjuFUp8ounPBU+jmKsocwVVAg== dependencies: - colorspace "1.1.x" + "@so-ric/colorspace" "^1.1.6" enabled "2.0.x" kuler "^2.0.0" +"@esbuild/aix-ppc64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz#bf6e10303bcf2e7c686975fa52f937ec2728d8bc" + integrity sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ== + +"@esbuild/android-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz#0c6246bc8d2c4d172aac2db3fb1190d72bd65504" + integrity sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A== + +"@esbuild/android-arm@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.28.2.tgz#2d84ece6a4e2684d92be26ee13d42757d831c381" + integrity sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg== + +"@esbuild/android-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.28.2.tgz#fc38d4d6358d8dc1cf53f09f7589fe436eb64801" + integrity sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q== + +"@esbuild/darwin-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz#f83afeeac1d7dac01c7a2fd012b3e451a0591fcc" + integrity sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw== + +"@esbuild/darwin-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz#510147c055a795588dbbe14fd6b1b8ad0a2f30de" + integrity sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw== + +"@esbuild/freebsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz#093b9200ecf0b115ba4e5e248a7485c9c5f8bd5e" + integrity sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw== + +"@esbuild/freebsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz#0be22b6df925d213e841ea87123af5df80b0faf7" + integrity sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg== + +"@esbuild/linux-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz#1bdbc651cda9ba9995c53ed9c71ceaa65094762d" + integrity sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug== + +"@esbuild/linux-arm@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz#beb12ad72b84f72d28488cc1b8ee9f7eb141d753" + integrity sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w== + +"@esbuild/linux-ia32@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz#b81f9d55529b45c206a46a138214b1aa6879696b" + integrity sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ== + +"@esbuild/linux-loong64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz#598667241a04c99b76ed6ef940ac50038c419f98" + integrity sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ== + +"@esbuild/linux-mips64el@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz#1c51eb9cea903f53d97b5af3b1841db70f5596ca" + integrity sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA== + +"@esbuild/linux-ppc64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz#63dd61f17ceb31a81227f413feac8a71bc2c51f2" + integrity sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ== + +"@esbuild/linux-riscv64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz#3763b08fde5cf25ab1facb8e7752edfe45fbfc27" + integrity sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA== + +"@esbuild/linux-s390x@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz#1a137ff293a82906eb3176385bd7e8e0e5cfb7cb" + integrity sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg== + +"@esbuild/linux-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz#268b36211c146ca54f8fe12c578a8d6ef8979485" + integrity sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ== + +"@esbuild/netbsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz#22571ad951d62bb6accc82d8d1fad5c8c1ac0ba1" + integrity sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw== + +"@esbuild/netbsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz#42fcc57297eb0a0ca3f5fc475291f4c1a3f7c0de" + integrity sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw== + +"@esbuild/openbsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz#9eb32af104ac3dacf4edca01f596664aab0c73ef" + integrity sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ== + +"@esbuild/openbsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz#febed2402d6088225e91f20fb4ce2522ad0a4efd" + integrity sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw== + +"@esbuild/openharmony-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz#85641c3d466428bfbccea5f21c26836663fef5ce" + integrity sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q== + +"@esbuild/sunos-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz#a736f9d8962481045fc4c3e54f5479f22c870fb4" + integrity sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g== + +"@esbuild/win32-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz#ee5ab40fad186201b652a33f8a5eb149e9e42532" + integrity sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ== + +"@esbuild/win32-ia32@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz#c40d28a6d99a127da6711f2afd74b11cb63b06a7" + integrity sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA== + +"@esbuild/win32-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz#b21affb804cc167c133d95f45b3a1dc1323b9a87" + integrity sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g== + "@hapi/boom@^10.0.1": version "10.0.1" resolved "https://registry.yarnpkg.com/@hapi/boom/-/boom-10.0.1.tgz#ebb14688275ae150aa6af788dbe482e6a6062685" @@ -190,9 +386,9 @@ integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": - version "1.5.5" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" - integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== + version "1.6.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz#f4c663e862f06dc98ca4d453862c46902789a18d" + integrity sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw== "@jridgewell/trace-mapping@0.3.9": version "0.3.9" @@ -203,24 +399,17 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.28": - version "0.3.30" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.30.tgz#4a76c4daeee5df09f5d3940e087442fb36ce2b99" - integrity sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q== + version "0.3.31" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" + integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@napi-rs/triples@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@napi-rs/triples/-/triples-1.2.0.tgz#bcd9c936acb93890e7015818e0181f3db421aafa" - integrity sha512-HAPjR3bnCsdXBsATpDIP5WCrw0JcACwhhrwIAQhiR46n+jm+a2F8kBsfseAuWtSyQ+H3Yebt2k43B5dy+04yMA== - -"@node-rs/helper@^1.3.3": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@node-rs/helper/-/helper-1.6.0.tgz#83e5381de6e898d0b8c92178bb8d897d619e3a3a" - integrity sha512-2OTh/tokcLA1qom1zuCJm2gQzaZljCCbtX1YCrwRVd/toz7KxaDRFeLTAPwhs8m9hWgzrBn5rShRm6IaZofCPw== - dependencies: - "@napi-rs/triples" "^1.2.0" +"@roberts_lando/vfs@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@roberts_lando/vfs/-/vfs-0.3.3.tgz#6359feed30e3773041279cb11be82ca60f4ff1f1" + integrity sha512-YjkxVSLw5WMZQoARaryRAjcxA+GbBzWMJdwYZX5oLUt9cC/gew9as4Dn7tcLzPp7BPoR221VpTZ+78TRPawnjg== "@sideway/address@^4.1.5": version "4.1.5" @@ -239,10 +428,18 @@ resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== +"@so-ric/colorspace@^1.1.6": + version "1.1.6" + resolved "https://registry.yarnpkg.com/@so-ric/colorspace/-/colorspace-1.1.6.tgz#62515d8b9f27746b76950a83bde1af812d91923b" + integrity sha512-/KiKkpHNOBgkFJwu9sh48LkHSMYGyuTcSFK/qMBdnOAlrRJzRSXAOFB5qwzaVQuDl8wAvHVMkaASQDReTahxuw== + dependencies: + color "^5.0.2" + text-hex "1.0.x" + "@tsconfig/node10@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" - integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== + version "1.0.13" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.13.tgz#56105a9a8c786e8f15e35746879cf2d52275485b" + integrity sha512-gcLdvR9HO1ZJBypsOGqaP6TFEzb6vIta0KSTLt9NAQ6pXQO3cRgSVyCN6pzYqI9DlJgY71XKO0dpDhCf08b3pg== "@tsconfig/node12@^1.0.7": version "1.0.11" @@ -279,11 +476,6 @@ dependencies: "@types/node" "*" -"@types/config@^3.3.5": - version "3.3.5" - resolved "https://registry.yarnpkg.com/@types/config/-/config-3.3.5.tgz#91f0a52b10212b9c4254fb0bbc4bedd77cd389b8" - integrity sha512-itq2HtXQBrNUKwMNZnb9mBRE3T99VYCdl1gjST9rq+9kFaB1iMMGuDeZnP88qid73DnpAMKH9ZolqDpS1Lz7+w== - "@types/connect@*": version "3.4.38" resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" @@ -292,52 +484,47 @@ "@types/node" "*" "@types/express-serve-static-core@^5.0.0": - version "5.0.7" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.7.tgz#2fa94879c9d46b11a5df4c74ac75befd6b283de6" - integrity sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ== + version "5.1.3" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.1.3.tgz#9d34c88c0c9ee62b9a6e4d9f8ab8d7e29688e6b4" + integrity sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw== dependencies: "@types/node" "*" "@types/qs" "*" "@types/range-parser" "*" "@types/send" "*" -"@types/express@~5.0.3": - version "5.0.3" - resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.3.tgz#6c4bc6acddc2e2a587142e1d8be0bce20757e956" - integrity sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw== +"@types/express@~5.0.6": + version "5.0.6" + resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.6.tgz#2d724b2c990dcb8c8444063f3580a903f6d500cc" + integrity sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA== dependencies: "@types/body-parser" "*" "@types/express-serve-static-core" "^5.0.0" - "@types/serve-static" "*" + "@types/serve-static" "^2" "@types/http-errors@*": version "2.0.5" resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.5.tgz#5b749ab2b16ba113423feb1a64a95dcd30398472" integrity sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg== -"@types/mime@^1": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" - integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== - "@types/node@*": - version "24.3.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.3.0.tgz#89b09f45cb9a8ee69466f18ee5864e4c3eb84dec" - integrity sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow== + version "26.6.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.6.5.tgz#cb35209e7767c503551b5fa42a48231c7441d979" + integrity sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg== dependencies: - undici-types "~7.10.0" + undici-types "~8.9.0" -"@types/node@~22.17.2": - version "22.17.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.17.2.tgz#47a93d6f4b79327da63af727e7c54e8cab8c4d33" - integrity sha512-gL6z5N9Jm9mhY+U2KXZpteb+09zyffliRkZyZOHODGATyC5B1Jt/7TzuuiLkFsSUMLbS1OLmlj/E+/3KF4Q/4w== +"@types/node@~22.20.5": + version "22.20.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.20.5.tgz#afa7bde6da81b8b83ea4e2f020487e9b148c11fd" + integrity sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA== dependencies: undici-types "~6.21.0" "@types/qs@*": - version "6.14.0" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" - integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== + version "6.15.1" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.15.1.tgz#8606884272c63f0db96986bd3548650d8a9388bf" + integrity sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw== "@types/range-parser@*": version "1.2.7" @@ -345,21 +532,19 @@ integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== "@types/send@*": - version "0.17.5" - resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.5.tgz#d991d4f2b16f2b1ef497131f00a9114290791e74" - integrity sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w== + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/send/-/send-1.2.1.tgz#6a784e45543c18c774c049bff6d3dbaf045c9c74" + integrity sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ== dependencies: - "@types/mime" "^1" "@types/node" "*" -"@types/serve-static@*": - version "1.15.8" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.8.tgz#8180c3fbe4a70e8f00b9f70b9ba7f08f35987877" - integrity sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg== +"@types/serve-static@^2": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-2.2.0.tgz#d4a447503ead0d1671132d1ab6bd58b805d8de6a" + integrity sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ== dependencies: "@types/http-errors" "*" "@types/node" "*" - "@types/send" "*" "@types/simple-oauth2@^5.0.8": version "5.0.8" @@ -378,40 +563,48 @@ dependencies: "@types/node" "*" -"@yao-pkg/pkg-fetch@3.5.24": - version "3.5.24" - resolved "https://registry.yarnpkg.com/@yao-pkg/pkg-fetch/-/pkg-fetch-3.5.24.tgz#37a671f077fe6446aec0758e6fc7961d183c3445" - integrity sha512-FPESCH1uXCYui6jeDp2aayWuFHR39w+uU1r88nI6JWRvPYOU64cHPUV/p6GSFoQdpna7ip92HnrZKbBC60l0gA== +"@yao-pkg/pkg-fetch@3.6.7": + version "3.6.7" + resolved "https://registry.yarnpkg.com/@yao-pkg/pkg-fetch/-/pkg-fetch-3.6.7.tgz#5fb8a55031846ef105efeaf4beae0d4f4ed47540" + integrity sha512-uEeU5druVgHffruTAXzW6nf0wHfREWlCq5LBtQ4hCdLBDbwTteuym5NrxREur3EgNcqFRenEi6Rivwo723PkHg== dependencies: - https-proxy-agent "^5.0.0" - node-fetch "^2.6.6" picocolors "^1.1.0" progress "^2.0.3" semver "^7.3.5" - tar-fs "^2.1.1" + tar-fs "^3.1.1" + undici "^7.28.0" yargs "^16.2.0" -"@yao-pkg/pkg@^6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@yao-pkg/pkg/-/pkg-6.6.0.tgz#e8c38ed5824381c676e6688f93e27f39e1752701" - integrity sha512-3/oiaSm7fS0Fc7dzp22r9B7vFaguGhO9vERgEReRYj2EUzdi5ssyYhe1uYJG4ec/dmo2GG6RRHOUAT8savl79Q== +"@yao-pkg/pkg@^6.24.0": + version "6.24.0" + resolved "https://registry.yarnpkg.com/@yao-pkg/pkg/-/pkg-6.24.0.tgz#c556d2e98e8ac437ac7f08065accec8595a13b98" + integrity sha512-SMwFLic12noHLbqxhhQVClVX6YZlQtzwwez6dq7Xj64rXX6OFgZTTQbPgw4wgec5IoUN+6rCRKgyW/cnVPOwkA== dependencies: "@babel/generator" "^7.23.0" "@babel/parser" "^7.23.0" + "@babel/traverse" "^7.23.0" "@babel/types" "^7.23.0" - "@yao-pkg/pkg-fetch" "3.5.24" - into-stream "^6.0.0" - minimist "^1.2.6" + "@roberts_lando/vfs" "^0.3.3" + "@yao-pkg/pkg-fetch" "3.6.7" + esbuild "^0.28.1" + into-stream "^9.1.0" multistream "^4.1.0" picocolors "^1.1.0" picomatch "^4.0.2" + postject "^1.0.0-alpha.6" prebuild-install "^7.1.1" resolve "^1.22.10" + resolve.exports "^2.0.3" stream-meter "^1.0.4" - tar "^7.4.3" + tar "^7.5.7" tinyglobby "^0.2.11" unzipper "^0.12.3" +"@yarnpkg/lockfile@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + accepts@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/accepts/-/accepts-2.0.0.tgz#bbcf4ba5075467f3f2131eab3cffc73c2f5d7895" @@ -421,23 +614,16 @@ accepts@^2.0.0: negotiator "^1.0.0" acorn-walk@^8.1.1: - version "8.3.4" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" - integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + version "8.3.5" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.5.tgz#8a6b8ca8fc5b34685af15dabb44118663c296496" + integrity sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw== dependencies: acorn "^8.11.0" acorn@^8.11.0, acorn@^8.4.1: - version "8.15.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" - integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" + version "8.19.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.19.0.tgz#6b26fd97ce1cc9dc50bdf7ad305e9f1384d4f28a" + integrity sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw== ansi-regex@^5.0.1: version "5.0.1" @@ -451,14 +637,6 @@ ansi-styles@^4.0.0: dependencies: color-convert "^2.0.1" -anymatch@~3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" @@ -479,21 +657,53 @@ atob@^2.1.2: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +b4a@^1.6.4, b4a@^1.8.1, b4a@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.9.0.tgz#6336313b6e76b299c397afa68676ec6ebc788845" + integrity sha512-dpfcF9fDNR6++cthXR67iyhgqWy9CBouAvIWhIntzBG6cvK/cnIPiZQjBwi/ZqjjBEDGfoNDtmB0kTjroOJ3pQ== + +bare-events@^2.5.4, bare-events@^2.7.0: + version "2.9.2" + resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.9.2.tgz#01d377b64c3c7167b28b52da7add3221aecf2d7f" + integrity sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA== + +bare-fs@^4.0.1, bare-fs@^4.8.2: + version "4.8.4" + resolved "https://registry.yarnpkg.com/bare-fs/-/bare-fs-4.8.4.tgz#f342288e7e5d9d8e79917078e1f45950507828c5" + integrity sha512-MPC2eyrpbk3A873sK4y6rk+Iv4o2enxTjHZ8zH3HO0mjrpm5XjnguY2XmfidIsDV6vnjpbMBKUAJpV0ISD2SsQ== + dependencies: + bare-events "^2.5.4" + bare-path "^3.0.0" + bare-stream "^2.6.4" + bare-url "^2.2.2" + fast-fifo "^1.3.2" + +bare-path@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-3.1.2.tgz#67261bc74a9ba0105ba139b8638f218c09e8d82e" + integrity sha512-ZyKbsuuqK6Ag0K8pX6V5Txq6XeJRvY+wXucnFGRjiyVYP9YWDpIQugk/b+enRYrEYBJaqLzghRQpXPMR7341Nw== + +bare-stream@^2.6.4: + version "2.13.4" + resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.13.4.tgz#61d448a268d1efd992103aae6bd729332f278ac0" + integrity sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA== + dependencies: + b4a "^1.8.1" + streamx "^2.25.0" + teex "^1.0.1" + +bare-url@^2.2.2: + version "2.5.5" + resolved "https://registry.yarnpkg.com/bare-url/-/bare-url-2.5.5.tgz#2e8c18db11393aa6cae6ff246fdcda34615aacd3" + integrity sha512-iM9qJCruvpt2rPaLsrumVDru9pogI7PHziHIa9kTNRFt8C8HuSa+kI9kFezK+NvHEFnnz71rKGZ1EAilq/3V/Q== + dependencies: + bare-path "^3.0.0" base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -binary-extensions@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" - integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== - bl@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -508,35 +718,20 @@ bluebird@~3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -body-parser@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-2.2.0.tgz#f7a9656de305249a715b549b7b8fd1ab9dfddcfa" - integrity sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg== +body-parser@^2.3.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-2.4.0.tgz#337a76249270f83e450ad385a9606ca3b4a75c06" + integrity sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ== dependencies: bytes "^3.1.2" - content-type "^1.0.5" - debug "^4.4.0" - http-errors "^2.0.0" - iconv-lite "^0.6.3" + content-type "^2.1.0" + debug "^4.4.3" + http-errors "^2.0.1" + iconv-lite "^0.7.3" on-finished "^2.4.1" - qs "^6.14.0" - raw-body "^3.0.0" - type-is "^2.0.0" - -brace-expansion@^1.1.7: - version "1.1.18" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.18.tgz#3ce74d89885136be1535341f8c3d4425c29a5cab" - integrity sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@~3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" - integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== - dependencies: - fill-range "^7.1.1" + qs "^6.16.1" + raw-body "^3.0.2" + type-is "^2.1.0" btoa@^1.2.1: version "1.2.1" @@ -551,7 +746,7 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" -bytes@3.1.2, bytes@^3.1.2: +bytes@^3.1.2, bytes@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== @@ -572,21 +767,6 @@ call-bound@^1.0.2: call-bind-apply-helpers "^1.0.2" get-intrinsic "^1.3.0" -chokidar@^3.5.2: - version "3.6.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" - integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -606,13 +786,6 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" -color-convert@^1.9.3: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - color-convert@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" @@ -620,63 +793,59 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-convert@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-3.1.3.tgz#db6627b97181cb8facdfce755ae26f97ab0711f1" + integrity sha512-fasDH2ont2GqF5HpyO4w0+BcewlhHEZOFn9c1ckZdHpJ56Qb7MHhH/IcJZbBGgvdtwdwNbLvxiBEdg336iA9Sg== + dependencies: + color-name "^2.0.0" -color-name@^1.0.0, color-name@~1.1.4: +color-name@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-2.1.1.tgz#86c00ec98db36705be5bd4428097f13af1175a6d" + integrity sha512-p2FdgwVx1a9yWBHP2wI0VgShkDpgN4kZISkxdNipGBJWpa5G6b04OINlVWCyJj0JmfvcPrgqt95E9k8yvaOJFg== + +color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -color-string@^1.6.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" - integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== - dependencies: - color-name "^1.0.0" - simple-swizzle "^0.2.2" - -color@^3.1.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/color/-/color-3.2.1.tgz#3544dc198caf4490c3ecc9a790b54fe9ff45e164" - integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA== +color-string@^2.1.3: + version "2.1.4" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-2.1.4.tgz#9dcf566ff976e23368c8bd673f5c35103ab41058" + integrity sha512-Bb6Cq8oq0IjDOe8wJmi4JeNn763Xs9cfrBcaylK1tPypWzyoy2G3l90v9k64kjphl/ZJjPIShFztenRomi8WTg== dependencies: - color-convert "^1.9.3" - color-string "^1.6.0" + color-name "^2.0.0" -colorspace@1.1.x: - version "1.1.4" - resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.4.tgz#8d442d1186152f60453bf8070cd66eb364e59243" - integrity sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w== +color@^5.0.2: + version "5.0.3" + resolved "https://registry.yarnpkg.com/color/-/color-5.0.3.tgz#f79390b1b778e222ffbb54304d3dbeaef633f97f" + integrity sha512-ezmVcLR3xAVp8kYOm4GS45ZLLgIE6SPAFoduLr6hTDajwb3KZ2F46gulK3XpcwRFb5KKGCSezCBAY4Dw4HsyXA== dependencies: - color "^3.1.3" - text-hex "1.0.x" + color-convert "^3.1.3" + color-string "^2.1.3" -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +commander@^9.4.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" + integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== -config@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/config/-/config-4.1.1.tgz#798f636e2a5b7baa7050280d1eb21f8e10abb8c9" - integrity sha512-jljfwqNZ7QHwAW9Z9NDZdJARFiu5pjLqQO0K4ooY22iY/bIY78n0afI4ANEawfgQOxri0K/3oTayX8XIauWcLA== +config@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/config/-/config-4.4.2.tgz#adab67a87fcb5f84edcacb3f159ccdb31ad8b901" + integrity sha512-5HJD7TX70gOG2dAd72eDjDeSTYn6D8nOiKgysQQS8mRUo9X1wDtlzb1JlmIWkP+sM9zKRVdYJxmj+qmCsYu6DQ== dependencies: json5 "^2.2.3" -content-disposition@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-1.0.0.tgz#844426cb398f934caefcbb172200126bc7ceace2" - integrity sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg== - dependencies: - safe-buffer "5.2.1" +content-disposition@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-2.0.1.tgz#88a75c7a52ef9c407c96035fe83a66939c2a4dc9" + integrity sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog== -content-type@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== +content-type@^2.0.0, content-type@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-2.1.0.tgz#d9389c43c0a8cf6a355db464d21e07092a40493a" + integrity sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag== cookie-signature@^1.2.1: version "1.2.2" @@ -698,14 +867,7 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -debug@4, debug@^4, debug@^4.3.5, debug@^4.4.0: - version "4.4.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" - integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== - dependencies: - ms "^2.1.3" - -debug@^4.3.4: +debug@^4.3.1, debug@^4.3.4, debug@^4.4.0, debug@^4.4.3: version "4.4.3" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== @@ -724,20 +886,20 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -depd@2.0.0, depd@^2.0.0: +depd@^2.0.0, depd@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== detect-libc@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.4.tgz#f04715b8ba815e53b4d8109655b6508a6865a7e8" - integrity sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA== + version "2.1.2" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad" + integrity sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ== diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + version "4.0.4" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.4.tgz#7a6dbfda325f25f07517e9b518f897c08332e07d" + integrity sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ== dunder-proto@^1.0.1: version "1.0.1" @@ -793,12 +955,44 @@ es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== dependencies: es-errors "^1.3.0" +esbuild@^0.28.1: + version "0.28.2" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.28.2.tgz#0f43bd1bad955b72d24e2261e3abe5957ccf0816" + integrity sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA== + optionalDependencies: + "@esbuild/aix-ppc64" "0.28.2" + "@esbuild/android-arm" "0.28.2" + "@esbuild/android-arm64" "0.28.2" + "@esbuild/android-x64" "0.28.2" + "@esbuild/darwin-arm64" "0.28.2" + "@esbuild/darwin-x64" "0.28.2" + "@esbuild/freebsd-arm64" "0.28.2" + "@esbuild/freebsd-x64" "0.28.2" + "@esbuild/linux-arm" "0.28.2" + "@esbuild/linux-arm64" "0.28.2" + "@esbuild/linux-ia32" "0.28.2" + "@esbuild/linux-loong64" "0.28.2" + "@esbuild/linux-mips64el" "0.28.2" + "@esbuild/linux-ppc64" "0.28.2" + "@esbuild/linux-riscv64" "0.28.2" + "@esbuild/linux-s390x" "0.28.2" + "@esbuild/linux-x64" "0.28.2" + "@esbuild/netbsd-arm64" "0.28.2" + "@esbuild/netbsd-x64" "0.28.2" + "@esbuild/openbsd-arm64" "0.28.2" + "@esbuild/openbsd-x64" "0.28.2" + "@esbuild/openharmony-arm64" "0.28.2" + "@esbuild/sunos-x64" "0.28.2" + "@esbuild/win32-arm64" "0.28.2" + "@esbuild/win32-ia32" "0.28.2" + "@esbuild/win32-x64" "0.28.2" + escalade@^3.1.1: version "3.2.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" @@ -814,23 +1008,31 @@ etag@^1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +events-universal@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/events-universal/-/events-universal-1.0.1.tgz#b56a84fd611b6610e0a2d0f09f80fdf931e2dfe6" + integrity sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw== + dependencies: + bare-events "^2.7.0" + expand-template@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== -express@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/express/-/express-5.1.0.tgz#d31beaf715a0016f0d53f47d3b4d7acf28c75cc9" - integrity sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA== +express@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/express/-/express-5.3.0.tgz#ab72dace89c50c8417bd3f865dad0b4fd1ca1c73" + integrity sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g== dependencies: accepts "^2.0.0" - body-parser "^2.2.0" - content-disposition "^1.0.0" - content-type "^1.0.5" + body-parser "^2.3.0" + content-disposition "^2.0.1" + content-type "^2.0.0" cookie "^0.7.1" cookie-signature "^1.2.1" debug "^4.4.0" + depd "^2.0.0" encodeurl "^2.0.0" escape-html "^1.0.3" etag "^1.8.1" @@ -842,17 +1044,22 @@ express@^5.1.0: on-finished "^2.4.1" once "^1.4.0" parseurl "^1.3.3" - proxy-addr "^2.0.7" - qs "^6.14.0" + proxy-addr "^2.0.8" + qs "^6.16.0" range-parser "^1.2.1" router "^2.2.0" send "^1.1.0" serve-static "^2.2.0" statuses "^2.0.1" - type-is "^2.0.1" + type-is "^2.1.0" vary "^1.1.2" -fdir@^6.4.4: +fast-fifo@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" + integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== + +fdir@^6.5.0: version "6.5.0" resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.5.0.tgz#ed2ab967a331ade62f18d077dae192684d50d350" integrity sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg== @@ -869,17 +1076,10 @@ file-stream-rotator@^0.6.1: dependencies: moment "^2.29.1" -fill-range@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" - integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== - dependencies: - to-regex-range "^5.0.1" - finalhandler@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-2.1.0.tgz#72306373aa89d05a8242ed569ed86a1bff7c561f" - integrity sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q== + version "2.1.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-2.1.1.tgz#a2c517a6559852bcdb06d1f8bd7f51b68fad8099" + integrity sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA== dependencies: debug "^4.4.0" encodeurl "^2.0.0" @@ -903,20 +1103,12 @@ fresh@^2.0.0: resolved "https://registry.yarnpkg.com/fresh/-/fresh-2.0.0.tgz#8dd7df6a1b3a1b3a5cf186c05a5dd267622635a4" integrity sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A== -from2@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - integrity sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g== - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.0" - fs-constants@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^11.2.0, fs-extra@^11.3.1: +fs-extra@11.3.1: version "11.3.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.3.1.tgz#ba7a1f97a85f94c6db2e52ff69570db3671d5a74" integrity sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g== @@ -925,10 +1117,14 @@ fs-extra@^11.2.0, fs-extra@^11.3.1: jsonfile "^6.0.1" universalify "^2.0.0" -fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== +fs-extra@^11.4.1: + version "11.4.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.4.1.tgz#6a01ca80008eacf3ca1ffde5ef79088f68203a5a" + integrity sha512-KYAb4c9BJQI6QqGKthV68OHe0badztdXJWKo0WtBA9IuCFPTKvE5ZdUBglP833aMjhaSPNO4A5j/EkzZtGlKjA== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" function-bind@^1.1.2: version "1.1.2" @@ -969,13 +1165,6 @@ github-from-package@0.0.0: resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== -glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" @@ -986,46 +1175,40 @@ graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - has-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== +hasown@^2.0.2, hasown@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== dependencies: function-bind "^1.1.2" -http-errors@2.0.0, http-errors@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== +hosted-git-info@^9.0.0: + version "9.0.3" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-9.0.3.tgz#637b511ce62a28e4261a92b8da0a4d6be3522cd4" + integrity sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg== dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" + lru-cache "^11.1.0" -https-proxy-agent@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== +http-errors@^2.0.0, http-errors@^2.0.1, http-errors@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.1.tgz#36d2f65bc909c8790018dd36fb4d93da6caae06b" + integrity sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ== dependencies: - agent-base "6" - debug "4" + depd "~2.0.0" + inherits "~2.0.4" + setprototypeof "~1.2.0" + statuses "~2.0.2" + toidentifier "~1.0.1" -iconv-lite@0.6.3, iconv-lite@^0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== +iconv-lite@^0.7.3, iconv-lite@~0.7.0: + version "0.7.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.7.3.tgz#84ee12f963e7de50bc01a13e160a078b3b0f415f" + integrity sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ== dependencies: safer-buffer ">= 2.1.2 < 3.0.0" @@ -1034,12 +1217,7 @@ ieee754@^1.1.13: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore-by-default@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" - integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA== - -inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -1049,60 +1227,28 @@ ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -into-stream@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-6.0.0.tgz#4bfc1244c0128224e18b8870e85b2de8e66c6702" - integrity sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA== - dependencies: - from2 "^2.3.0" - p-is-promise "^3.0.0" +into-stream@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-9.1.0.tgz#3d49f8dc3aa44c9d5e6007cc07831388542a1326" + integrity sha512-DRsRnQrbzdFjaQ1oe4C6/EIUymIOEix1qROEJTF9dbMq+M4Zrm6VaLp6SD/B9IsiEjPZuBSnWWFN+udajugdWA== ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== -is-arrayish@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" - integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-core-module@^2.16.0: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== +is-core-module@^2.17.0: + version "2.17.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.17.0.tgz#75c1c76236c9f7e38ddbfff292e127dc13b21027" + integrity sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA== dependencies: - hasown "^2.0.2" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + hasown "^2.0.4" is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - is-promise@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" @@ -1119,9 +1265,9 @@ isarray@~1.0.0: integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== joi@^17.6.4: - version "17.13.3" - resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec" - integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA== + version "17.13.9" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.9.tgz#d763ef4b1e992a5e39fb36f2018671e489ca53e8" + integrity sha512-llFCT2rVtfwgBCaIqxtjim+iHqrgss4ONiGSYiiGH9jnjWq90ppSRffqmqKvwpa8W+YfILyQV6XyGcegXX2T4g== dependencies: "@hapi/hoek" "^9.3.0" "@hapi/topo" "^5.1.0" @@ -1129,7 +1275,12 @@ joi@^17.6.4: "@sideway/formula" "^3.0.1" "@sideway/pinpoint" "^2.0.0" -js-yaml@^4.1.1: +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.3.2.tgz#8e44fb14a2643c59726bb15787b5f1512cb3d3fb" integrity sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA== @@ -1147,9 +1298,9 @@ json5@^2.2.3: integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonfile@^6.0.1: - version "6.2.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.0.tgz#7c265bd1b65de6977478300087c99f1c84383f62" - integrity sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg== + version "6.2.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.1.tgz#b6e31717f22cc37330b081ce0051ed5de53af2f6" + integrity sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q== dependencies: universalify "^2.0.0" optionalDependencies: @@ -1182,26 +1333,33 @@ long@^5.3.2: resolved "https://registry.yarnpkg.com/long/-/long-5.3.2.tgz#1d84463095999262d7d7b7f8bfd4a8cc55167f83" integrity sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA== +lru-cache@^11.1.0: + version "11.5.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.3.tgz#a7767b4034e35269562d2b9da2b185b5df70c421" + integrity sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg== + lz4-napi@^2.8.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/lz4-napi/-/lz4-napi-2.9.0.tgz#4a700974a1154f82b3c0e1b7030fe63140051e7d" - integrity sha512-ZOWqxBMIK5768aD20tYn5B6Pp9WPM9UG/LHk8neG9p0gC1DtjdzhTtlkxhAjvTRpmJvMtnnqLKlT+COlqAt9cQ== - dependencies: - "@node-rs/helper" "^1.3.3" + version "2.10.0" + resolved "https://registry.yarnpkg.com/lz4-napi/-/lz4-napi-2.10.0.tgz#3c281d303e5cdd392f4e8018f18266ce2e357b0a" + integrity sha512-NEW7rrcRA+6928P2X9IB4TCeHXT1VKTz63+lmiKkWBMORI2OtenveC+DsqtYfWMZZ52gULHcon5Z7QgXvDpRHg== optionalDependencies: - "@antoniomuso/lz4-napi-android-arm-eabi" "2.9.0" - "@antoniomuso/lz4-napi-android-arm64" "2.9.0" - "@antoniomuso/lz4-napi-darwin-arm64" "2.9.0" - "@antoniomuso/lz4-napi-darwin-x64" "2.9.0" - "@antoniomuso/lz4-napi-freebsd-x64" "2.9.0" - "@antoniomuso/lz4-napi-linux-arm-gnueabihf" "2.9.0" - "@antoniomuso/lz4-napi-linux-arm64-gnu" "2.9.0" - "@antoniomuso/lz4-napi-linux-arm64-musl" "2.9.0" - "@antoniomuso/lz4-napi-linux-x64-gnu" "2.9.0" - "@antoniomuso/lz4-napi-linux-x64-musl" "2.9.0" - "@antoniomuso/lz4-napi-win32-arm64-msvc" "2.9.0" - "@antoniomuso/lz4-napi-win32-ia32-msvc" "2.9.0" - "@antoniomuso/lz4-napi-win32-x64-msvc" "2.9.0" + "@antoniomuso/lz4-napi-android-arm-eabi" "2.10.0" + "@antoniomuso/lz4-napi-android-arm64" "2.10.0" + "@antoniomuso/lz4-napi-darwin-arm64" "2.10.0" + "@antoniomuso/lz4-napi-darwin-x64" "2.10.0" + "@antoniomuso/lz4-napi-freebsd-x64" "2.10.0" + "@antoniomuso/lz4-napi-linux-arm-gnueabihf" "2.10.0" + "@antoniomuso/lz4-napi-linux-arm64-gnu" "2.10.0" + "@antoniomuso/lz4-napi-linux-arm64-musl" "2.10.0" + "@antoniomuso/lz4-napi-linux-ppc64-gnu" "2.10.0" + "@antoniomuso/lz4-napi-linux-riscv64-gnu" "2.10.0" + "@antoniomuso/lz4-napi-linux-s390x-gnu" "2.10.0" + "@antoniomuso/lz4-napi-linux-x64-gnu" "2.10.0" + "@antoniomuso/lz4-napi-linux-x64-musl" "2.10.0" + "@antoniomuso/lz4-napi-openharmony-arm64" "2.10.0" + "@antoniomuso/lz4-napi-win32-arm64-msvc" "2.10.0" + "@antoniomuso/lz4-napi-win32-ia32-msvc" "2.10.0" + "@antoniomuso/lz4-napi-win32-x64-msvc" "2.10.0" make-error@^1.1.1: version "1.3.6" @@ -1214,9 +1372,9 @@ math-intrinsics@^1.1.0: integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== media-typer@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.0.tgz#6ab74b8f2d3320f2064b2a87a38e7931ff3a5561" - integrity sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw== + version "1.1.1" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.1.tgz#6f035400dfe3ab9d5607bc77546ce30cc2f9c6b8" + integrity sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ== merge-descriptors@^2.0.0: version "2.0.0" @@ -1228,10 +1386,10 @@ mime-db@^1.54.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== -mime-types@^3.0.0, mime-types@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.1.tgz#b1d94d6997a9b32fd69ebaed0db73de8acb519ce" - integrity sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA== +mime-types@^3.0.0, mime-types@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.2.tgz#39002d4182575d5af036ffa118100f2524b2e2ab" + integrity sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A== dependencies: mime-db "^1.54.0" @@ -1240,22 +1398,15 @@ mimic-response@^3.1.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== -minimatch@^3.1.2: - version "3.1.5" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" - integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6: +minimist@^1.2.0, minimist@^1.2.3: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minipass@^7.0.4, minipass@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" - integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== minizlib@^3.1.0: version "3.1.0" @@ -1293,64 +1444,47 @@ napi-build-utils@^2.0.0: integrity sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA== negotiator@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.0.0.tgz#b6c91bb47172d69f93cfd7c357bbb529019b5f6a" - integrity sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg== + version "1.1.0" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.1.0.tgz#16e003d0db4ac24fd9df168edf871625deeae3df" + integrity sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg== + dependencies: + content-type "^2.1.0" node-abi@^3.3.0: - version "3.75.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.75.0.tgz#2f929a91a90a0d02b325c43731314802357ed764" - integrity sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg== + version "3.100.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.100.0.tgz#31aa9623841051d14f52415557e18101bc0de7ca" + integrity sha512-KNU/E0VW9T1ndOAEWNlWtxhoBSF7hqe+dMSrRPK6+PfyL2s2AcfwnXCAOke4DNXOsweivNT6/7eFHwkxWblZew== dependencies: semver "^7.3.5" -node-fetch@^2.6.6: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -nodemon@^3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.1.10.tgz#5015c5eb4fffcb24d98cf9454df14f4fecec9bc1" - integrity sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw== - dependencies: - chokidar "^3.5.2" - debug "^4" - ignore-by-default "^1.0.1" - minimatch "^3.1.2" - pstree.remy "^1.1.8" - semver "^7.5.3" - simple-update-notifier "^2.0.0" - supports-color "^5.5.0" - touch "^3.1.0" - undefsafe "^2.0.5" - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +normalize-package-data@8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-8.0.0.tgz#bdce7ff2d6ba891b853e179e45a5337766e304a7" + integrity sha512-RWk+PI433eESQ7ounYxIp67CYuVsS1uYSonX3kA6ps/3LWfjVQa/ptEg6Y3T6uAMq1mWpX9PQ+qx+QaHpsc7gQ== + dependencies: + hosted-git-info "^9.0.0" + semver "^7.3.5" + validate-npm-package-license "^3.0.4" object-hash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== -object-inspect@^1.13.3: +object-inspect@^1.13.3, object-inspect@^1.13.4: version "1.13.4" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== on-finished@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + version "2.4.2" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.2.tgz#6932b04b95bf6a4828201db10af75fe5c9c38b73" + integrity sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ== dependencies: ee-first "1.1.1" @@ -1368,10 +1502,10 @@ one-time@^1.0.0: dependencies: fn.name "1.x.x" -p-is-promise@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-3.0.0.tgz#58e78c7dfe2e163cf2a04ff869e7c1dba64a5971" - integrity sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ== +packageurl-js@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/packageurl-js/-/packageurl-js-2.0.1.tgz#a8fa43a64971b5dd0dca5fb904b950a6cc317a6f" + integrity sha512-N5ixXjzTy4QDQH0Q9YFjqIWd6zH6936Djpl2m9QNFmDv5Fum8q8BjkpAcHNMzOFE0IwQrFhJWex3AN6kS0OSwg== parseurl@^1.3.3: version "1.3.3" @@ -1384,24 +1518,26 @@ path-parse@^1.0.7: integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-to-regexp@^8.0.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.0.tgz#8e98fcd94826aff01a90c544ef74ffbaca3a78ed" - integrity sha512-PuseHIvAnz3bjrM2rGJtSgo1zjgxapTLZ7x2pjhzWwlp4SJQgK3f3iZIQwkpEnBaKz6seKBADpM4B4ySkuYypg== + version "8.4.2" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz#795c420c4f7ca45c5b887366f622ee0c9852cccd" + integrity sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA== -picocolors@^1.1.0: +picocolors@^1.1.0, picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.0.4, picomatch@^2.2.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" - integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== +picomatch@^4.0.2, picomatch@^4.0.4: + version "4.0.7" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.7.tgz#6313360034ccb36b3dc61ecbdff78121f90fe21f" + integrity sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA== -picomatch@^4.0.2: - version "4.0.4" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.4.tgz#fd6f5e00a143086e074dffe4c924b8fb293b0589" - integrity sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A== +postject@^1.0.0-alpha.6: + version "1.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/postject/-/postject-1.0.0-alpha.6.tgz#9d022332272e2cfce8dea4cfce1ee6dd1b2ee135" + integrity sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A== + dependencies: + commander "^9.4.0" prebuild-install@^7.1.1: version "7.1.3" @@ -1431,7 +1567,7 @@ progress@^2.0.3: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -proxy-addr@^2.0.7: +proxy-addr@^2.0.8: version "2.0.8" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.8.tgz#624e760fd8ab06b1b8320c2f8506d4422cf8e932" integrity sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ== @@ -1439,40 +1575,36 @@ proxy-addr@^2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -pstree.remy@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a" - integrity sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w== - pump@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.3.tgz#151d979f1a29668dc0025ec589a455b53282268d" - integrity sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA== + version "3.0.4" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.4.tgz#1f313430527fa8b905622ebd22fe1444e757ab3c" + integrity sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA== dependencies: end-of-stream "^1.1.0" once "^1.3.1" -qs@^6.14.0: - version "6.14.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.2.tgz#b5634cf9d9ad9898e31fba3504e866e8efb6798c" - integrity sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q== +qs@^6.16.0, qs@^6.16.1: + version "6.16.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.16.1.tgz#0643e17993e551759c85078e1f0bc4b9fe908020" + integrity sha512-5Px6J7rfHBAGUhNQ3es4YzcOdBBw0SDcVtThJml4RdnKw4tKs2epA0kPZ+K8X+WiHktT93RHVcQ/3ym5aTCgtg== dependencies: - side-channel "^1.1.0" + es-define-property "^1.0.1" + side-channel "^1.1.1" range-parser@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + version "1.3.0" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.3.0.tgz#d7f19be812bb62721472b45d3be219ef09572b47" + integrity sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw== -raw-body@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.0.tgz#25b3476f07a51600619dae3fe82ddc28a36e5e0f" - integrity sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g== +raw-body@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.2.tgz#3e3ada5ae5568f9095d84376fd3a49b8fb000a51" + integrity sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA== dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.6.3" - unpipe "1.0.0" + bytes "~3.1.2" + http-errors "~2.0.1" + iconv-lite "~0.7.0" + unpipe "~1.0.0" rc@^1.2.7: version "1.2.8" @@ -1484,7 +1616,7 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.1.4: +readable-stream@^2.0.2, readable-stream@^2.1.4: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -1506,24 +1638,23 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0, readable string_decoder "^1.1.1" util-deprecate "^1.0.1" -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== +resolve.exports@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.4.tgz#49921cfd9cd266053a9699e3f43c8bcbdf964331" + integrity sha512-zepuGL0ulf+nt+XaFrlKeaiTJeyPFPLLY62+ncq1/VTHBdt3HsfXOH60priZ6tnXQozdGcDeIF5JVTanvIcYWQ== + resolve@^1.22.10: - version "1.22.10" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" - integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== + version "1.22.13" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.13.tgz#d542f97758d768f36091251a6b07540b4343f7b5" + integrity sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA== dependencies: - is-core-module "^2.16.0" + es-errors "^1.3.0" + is-core-module "^2.17.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -1538,7 +1669,7 @@ router@^2.2.0: parseurl "^1.3.3" path-to-regexp "^8.0.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -1558,50 +1689,50 @@ safe-stable-stringify@^2.3.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver@^7.3.5, semver@^7.5.3: - version "7.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" - integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== +semver@^7.3.5: + version "7.8.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69" + integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA== send@^1.1.0, send@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/send/-/send-1.2.0.tgz#32a7554fb777b831dfa828370f773a3808d37212" - integrity sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw== + version "1.2.1" + resolved "https://registry.yarnpkg.com/send/-/send-1.2.1.tgz#9eab743b874f3550f40a26867bf286ad60d3f3ed" + integrity sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ== dependencies: - debug "^4.3.5" + debug "^4.4.3" encodeurl "^2.0.0" escape-html "^1.0.3" etag "^1.8.1" fresh "^2.0.0" - http-errors "^2.0.0" - mime-types "^3.0.1" + http-errors "^2.0.1" + mime-types "^3.0.2" ms "^2.1.3" on-finished "^2.4.1" range-parser "^1.2.1" - statuses "^2.0.1" + statuses "^2.0.2" serve-static@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.0.tgz#9c02564ee259bdd2251b82d659a2e7e1938d66f9" - integrity sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ== + version "2.2.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.1.tgz#7f186a4a4e5f5b663ad7a4294ff1bf37cf0e98a9" + integrity sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw== dependencies: encodeurl "^2.0.0" escape-html "^1.0.3" parseurl "^1.3.3" send "^1.2.0" -setprototypeof@1.2.0: +setprototypeof@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== -side-channel-list@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" - integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== +side-channel-list@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.1.tgz#c2e0b5a14a540aebee3bbc6c3f8666cc9b509127" + integrity sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" + object-inspect "^1.13.4" side-channel-map@^1.0.1: version "1.0.1" @@ -1624,14 +1755,14 @@ side-channel-weakmap@^1.0.2: object-inspect "^1.13.3" side-channel-map "^1.0.1" -side-channel@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" - integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== +side-channel@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.1.tgz#ea02c62e05dc4bea67d4442f0fb71ee192f8e0ab" + integrity sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" - side-channel-list "^1.0.0" + object-inspect "^1.13.4" + side-channel-list "^1.0.1" side-channel-map "^1.0.1" side-channel-weakmap "^1.0.2" @@ -1659,31 +1790,46 @@ simple-oauth2@^5.1.0: debug "^4.3.4" joi "^17.6.4" -simple-swizzle@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" - integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== +spdx-correct@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== dependencies: - is-arrayish "^0.3.1" + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" -simple-update-notifier@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz#d70b92bdab7d6d90dfd73931195a30b6e3d7cebb" - integrity sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w== +spdx-exceptions@^2.1.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz#5d607d27fc806f66d7b64a766650fa890f04ed66" + integrity sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w== + +spdx-expression-parse@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz#a23af9f3132115465dac215c099303e4ceac5794" + integrity sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ== dependencies: - semver "^7.5.3" + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.24" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.24.tgz#550436df9dc7dcf5c29832ceda40256a9b00de3a" + integrity sha512-cLS9TtWkIQFyLkJ3/5aFQAOHOSKTlOs/7WDut/XPSdjom1fJhUdkepeJAKXa9Y05+FabHd0sti+Et559vDtkpQ== stack-trace@0.0.x: version "0.0.10" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg== -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -statuses@^2.0.1: +statuses@^2.0.1, statuses@^2.0.2, statuses@~2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== @@ -1695,6 +1841,15 @@ stream-meter@^1.0.4: dependencies: readable-stream "^2.1.4" +streamx@^2.12.5, streamx@^2.25.0, streamx@^2.28.1: + version "2.28.1" + resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.28.1.tgz#376cd42a089505a69bec0efdb5189aa45586141f" + integrity sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA== + dependencies: + events-universal "^1.0.0" + fast-fifo "^1.3.2" + text-decoder "^1.1.0" + string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -1730,28 +1885,32 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -supports-color@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -tar-fs@^2.0.0, tar-fs@^2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.4.tgz#800824dbf4ef06ded9afea4acafe71c67c76b930" - integrity sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ== +tar-fs@^2.0.0: + version "2.1.5" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.5.tgz#33e9c29413dce0c58ada7ff77db4e5a30afffe70" + integrity sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw== dependencies: chownr "^1.1.1" mkdirp-classic "^0.5.2" pump "^3.0.0" tar-stream "^2.1.4" +tar-fs@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.1.3.tgz#05668cc68a30741c3813f9c16593b8dec7dcbcd1" + integrity sha512-/hU4AXnIdZu+Gvl1pk0oI5f5HxWsCJRtY2aFaJdk9VvyL48DWU6iU5WAIPG+wIi1YvWA6eTJvIviP/tMAZZNwQ== + dependencies: + pump "^3.0.0" + tar-stream "^3.1.5" + optionalDependencies: + bare-fs "^4.0.1" + bare-path "^3.0.0" + tar-stream@^2.1.4: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" @@ -1763,7 +1922,17 @@ tar-stream@^2.1.4: inherits "^2.0.3" readable-stream "^3.1.1" -tar@>=7.5.8, tar@^7.4.3: +tar-stream@^3.1.5: + version "3.2.2" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.2.2.tgz#aec7f257e712192a177a93aa0450c2e76855c8be" + integrity sha512-+8NeqHRjQWH9nYlwo2gamAMImZCVzI4UoEgDpWorBt9OEfppiZn+uSkskzQKPWIZyji/C8fpWO7u69G0DX0tbg== + dependencies: + b4a "^1.9.0" + bare-fs "^4.8.2" + fast-fifo "^1.3.2" + streamx "^2.28.1" + +tar@^7.5.7: version "7.5.22" resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.22.tgz#a696f998136e71487dc3f869a85bba2c67971ba9" integrity sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA== @@ -1774,41 +1943,38 @@ tar@>=7.5.8, tar@^7.4.3: minizlib "^3.1.0" yallist "^5.0.0" +teex@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12" + integrity sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg== + dependencies: + streamx "^2.12.5" + +text-decoder@^1.1.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.7.tgz#5d073a9a74b9c0a9d28dfadcab96b604af57d8ba" + integrity sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ== + dependencies: + b4a "^1.6.4" + text-hex@1.0.x: version "1.0.0" resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== tinyglobby@^0.2.11: - version "0.2.14" - resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.14.tgz#5280b0cf3f972b050e74ae88406c0a6a58f4079d" - integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ== + version "0.2.17" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.17.tgz#562a9a6c9eb2b3b123d39719f9af5bb44fcd7631" + integrity sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g== dependencies: - fdir "^6.4.4" - picomatch "^4.0.2" - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" + fdir "^6.5.0" + picomatch "^4.0.4" -toidentifier@1.0.1: +toidentifier@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -touch@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.1.tgz#097a23d7b161476435e5c1344a95c0f75b4a5694" - integrity sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA== - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - triple-beam@^1.3.0, triple-beam@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" @@ -1840,12 +2006,12 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -type-is@^2.0.0, type-is@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.0.1.tgz#64f6cf03f92fce4015c2b224793f6bdd4b068c97" - integrity sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw== +type-is@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.1.0.tgz#71d1a7053293582e16ac9f3ebaf1ab9aa49e5570" + integrity sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA== dependencies: - content-type "^1.0.5" + content-type "^2.0.0" media-typer "^1.1.0" mime-types "^3.0.0" @@ -1854,39 +2020,39 @@ typescript@~5.9.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== -undefsafe@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" - integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== - undici-types@~6.21.0: version "6.21.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== -undici-types@~7.10.0: - version "7.10.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.10.0.tgz#4ac2e058ce56b462b056e629cc6a02393d3ff350" - integrity sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag== +undici-types@~8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.9.0.tgz#e240d97c8b5d85e5347ce73d25865c7906c1ec9f" + integrity sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg== + +undici@^7.28.0: + version "7.30.1" + resolved "https://registry.yarnpkg.com/undici/-/undici-7.30.1.tgz#360b3de104b94abc52729aa1a4a07e027aa71f73" + integrity sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg== universalify@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@1.0.0: +unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== unzipper@^0.12.3: - version "0.12.3" - resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.12.3.tgz#31958f5eed7368ed8f57deae547e5a673e984f87" - integrity sha512-PZ8hTS+AqcGxsaQntl3IRBw65QrBI6lxzqDEL7IAo/XCEqRTKGfOX56Vea5TH9SZczRVxuzk1re04z/YjuYCJA== + version "0.12.5" + resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.12.5.tgz#7fc6b4862f3832202d1f5cc3adbee2679deaaf6c" + integrity sha512-tXYOi9R57Uj/2Z25SOs5RRSzq886MBQj2gY8dPL+xl/kv6s6SvByoKfAtvfVeEuhntWDgjd2o9p2lb4TVPAz0A== dependencies: bluebird "~3.7.2" duplexer2 "~0.1.4" - fs-extra "^11.2.0" + fs-extra "11.3.1" graceful-fs "^4.2.2" node-int64 "^0.4.0" @@ -1905,24 +2071,19 @@ v8-compile-cache-lib@^3.0.1: resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== +validate-npm-package-license@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + vary@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - winston-daily-rotate-file@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/winston-daily-rotate-file/-/winston-daily-rotate-file-5.0.0.tgz#8cd94800025490e47c00ec892b655a5821f4266d" @@ -1942,13 +2103,13 @@ winston-transport@^4.7.0, winston-transport@^4.9.0: readable-stream "^3.6.2" triple-beam "^1.3.0" -winston@^3.17.0: - version "3.17.0" - resolved "https://registry.yarnpkg.com/winston/-/winston-3.17.0.tgz#74b8665ce9b4ea7b29d0922cfccf852a08a11423" - integrity sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw== +winston@^3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/winston/-/winston-3.19.0.tgz#cc1d1262f5f45946904085cfffe73efb4b7a581d" + integrity sha512-LZNJgPzfKR+/J3cHkxcpHKpKKvGfDZVPS4hfJCc4cCG0CgYzvlD6yE/S3CIL/Yt91ak327YCpiF/0MyeZHEHKA== dependencies: "@colors/colors" "^1.6.0" - "@dabh/diagnostics" "^2.0.2" + "@dabh/diagnostics" "^2.0.8" async "^3.2.3" is-stream "^2.0.0" logform "^2.7.0" @@ -1989,9 +2150,9 @@ yargs-parser@^20.2.2: integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + version "16.2.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.2.tgz#c56731dca0d2788ae0866dd3c83907d6bab85f7d" + integrity sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w== dependencies: cliui "^7.0.2" escalade "^3.1.1" diff --git a/msa/monitoring/pom.xml b/msa/monitoring/pom.xml index fb95e91b7d..8154decd5d 100644 --- a/msa/monitoring/pom.xml +++ b/msa/monitoring/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-monitoring ${tb.docker.id}-monitoring + true + ${main.dir}/monitoring/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -142,6 +144,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/pom.xml b/msa/pom.xml index 43cd606147..7dba66bcfd 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -33,6 +33,11 @@ true 3.5.1 none + ${docker.repo}/${docker.name} + + none + latest + ${pkg.installFolder}/** @@ -116,6 +121,20 @@ none + + + skip-latest-tag + + + docker.skip.latest.tag + true + + + + + + black-box-tests @@ -135,6 +154,11 @@ push-docker-amd-arm-images + + + ${docker.push-arm-amd-image.phase} + latest,${project.version} + @@ -198,6 +222,9 @@ 4.4.1-latest false + + ${docker.push-arm-amd-image.phase} + ${sbom.image.latestTag},${project.version},${docker.lts.tag} @@ -283,6 +310,27 @@ exec-maven-plugin ${exec-maven-plugin.version} + + org.thingsboard + sbom-maven-plugin + + + image-sbom + ${sbom.image.phase} + + image + + + + + ${sbom.image.package.dir}/${pkg.name}.deb.cdx.json + ${project.build.directory}/${pkg.name}.deb + + + + + + org.apache.maven.plugins maven-deploy-plugin diff --git a/msa/report/pom.xml b/msa/report/pom.xml index 6a782df30a..806d9f8e71 100644 --- a/msa/report/pom.xml +++ b/msa/report/pom.xml @@ -25,6 +25,8 @@ ${maven.multiModuleProjectDirectory} tb-report ${tb.docker.id}-report + true + ${main.dir}/report/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -142,6 +144,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index 0baf11cf45..0b25f1c314 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -26,6 +26,8 @@ ${maven.multiModuleProjectDirectory} thingsboard ${tb.docker.id}-node + true + ${main.dir}/application/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -141,6 +143,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index e06e589e5c..53d1b2aa30 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -26,6 +26,8 @@ ${maven.multiModuleProjectDirectory} tb-coap-transport ${tb.docker.id}-coap-transport + true + ${main.dir}/transport/coap/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -141,6 +143,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index 6127552381..5d0d7b30f2 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -26,6 +26,8 @@ ${maven.multiModuleProjectDirectory} tb-http-transport ${tb.docker.id}-http-transport + true + ${main.dir}/transport/http/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -141,6 +143,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/transport/lwm2m/pom.xml b/msa/transport/lwm2m/pom.xml index 3babb3256f..6a628aa6e7 100644 --- a/msa/transport/lwm2m/pom.xml +++ b/msa/transport/lwm2m/pom.xml @@ -26,6 +26,8 @@ ${maven.multiModuleProjectDirectory} tb-lwm2m-transport ${tb.docker.id}-lwm2m-transport + true + ${main.dir}/transport/lwm2m/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -141,6 +143,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index 66e483f62e..83e767470b 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -26,6 +26,8 @@ ${maven.multiModuleProjectDirectory} tb-mqtt-transport ${tb.docker.id}-mqtt-transport + true + ${main.dir}/transport/mqtt/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -141,6 +143,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/transport/snmp/pom.xml b/msa/transport/snmp/pom.xml index 08c7df6229..2c223f046f 100644 --- a/msa/transport/snmp/pom.xml +++ b/msa/transport/snmp/pom.xml @@ -27,6 +27,8 @@ ${maven.multiModuleProjectDirectory} tb-snmp-transport ${tb.docker.id}-snmp-transport + true + ${main.dir}/transport/snmp/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -142,6 +144,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/vc-executor-docker/pom.xml b/msa/vc-executor-docker/pom.xml index b401024448..22f42235ad 100644 --- a/msa/vc-executor-docker/pom.xml +++ b/msa/vc-executor-docker/pom.xml @@ -26,6 +26,8 @@ ${maven.multiModuleProjectDirectory} tb-vc-executor ${tb.docker.id}-vc-executor + true + ${main.dir}/msa/vc-executor/target /var/log/${pkg.name} /usr/share/${pkg.name} pre-integration-test @@ -141,6 +143,11 @@ + + + org.thingsboard + sbom-maven-plugin + diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml index 8a7b8e15ca..9b54d974a9 100644 --- a/msa/vc-executor/pom.xml +++ b/msa/vc-executor/pom.xml @@ -27,6 +27,7 @@ java process-resources package + ${pkg.package.phase} tb-vc-executor false ${project.build.directory}/windows @@ -91,6 +92,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -103,6 +108,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.codehaus.mojo build-helper-maven-plugin diff --git a/msa/web-report/config/logger.ts b/msa/web-report/config/logger.ts index 0091a920d3..17e543a528 100644 --- a/msa/web-report/config/logger.ts +++ b/msa/web-report/config/logger.ts @@ -3,11 +3,10 @@ import config from 'config'; import path from 'path'; import DailyRotateFile from 'winston-daily-rotate-file'; -import { createLogger, format, transports } from 'winston'; -import * as Transport from 'winston-transport'; +import { createLogger, format, transport, transports } from 'winston'; const { combine, timestamp, label, printf, splat } = format; -const loggerTransports: Array = []; +const loggerTransports: Array = []; if (process.env.NODE_ENV !== 'production' || process.env.DOCKER_MODE === 'true') { loggerTransports.push(new transports.Console({ diff --git a/msa/web-report/package.json b/msa/web-report/package.json index fe0ec7a8ff..169548ffc0 100644 --- a/msa/web-report/package.json +++ b/msa/web-report/package.json @@ -7,36 +7,33 @@ "bin": "server.js", "scripts": { "pkg": "tsc && pkg -t node22-linux-x64 --output ./target/thingsboard-web-report-linux ./target/src && pkg -t node22-win-x64 --no-bytecode --public-packages \"*\" --public --output ./target/thingsboard-web-report-win.exe ./target/src && node install.js", + "sbom": "node ../../tools/src/main/javascript/yarn-sbom.js target/sbom/tb-web-report.cdx.json application", + "sbom-check": "pkg --debug -t node22-linux-x64 --output ./target/pkg-debug/linux ./target/src > ./target/pkg-linux.log && pkg --debug -t node22-win-x64 --no-bytecode --public-packages \"*\" --public --output ./target/pkg-debug/win.exe ./target/src > ./target/pkg-win.log && node sbom-check.js", "test": "echo \"Error: no test specified\" && exit 1", - "start": "nodemon --watch '.' --ext 'ts' --exec 'ts-node server.ts'", - "start-prod": "nodemon --watch '.' --ext 'ts' --exec 'NODE_ENV=production ts-node server.ts'", + "start": "node --watch --watch-preserve-output -r ts-node/register server.ts", + "start-prod": "NODE_ENV=production node --watch --watch-preserve-output -r ts-node/register server.ts", "build": "tsc" }, "dependencies": { - "config": "~4.1.1", - "express": "~5.1.0", - "js-yaml": "^4.1.1", - "playwright-chromium": "~1.64.0", - "playwright-core": "~1.64.0", - "winston": "~3.17.0", + "config": "~4.4.2", + "express": "~5.3.0", + "js-yaml": "^4.3.2", + "playwright-chromium": "~1.64.1", + "playwright-core": "~1.64.1", + "winston": "~3.19.0", "winston-daily-rotate-file": "~5.0.0" }, - "nyc": { - "exclude": [ - "test", - "__tests__", - "node_modules", - "target" - ] - }, "devDependencies": { - "@types/config": "~3.3.5", - "@types/express": "~5.0.3", - "@types/node": "~22.17.2", - "@yao-pkg/pkg": "^6.6.0", - "fs-extra": "~11.3.1", - "nodemon": "~3.1.10", + "@cyclonedx/cyclonedx-library": "10.3.0", + "@types/express": "~5.0.6", + "@types/node": "~22.20.5", + "@yao-pkg/pkg": "^6.24.0", + "@yarnpkg/lockfile": "1.1.0", + "fs-extra": "~11.4.1", + "normalize-package-data": "8.0.0", + "packageurl-js": "2.0.1", "postinstall-postinstall": "^2.1.0", + "spdx-expression-parse": "4.0.0", "ts-node": "~10.9.2", "typescript": "~5.9.3" }, diff --git a/msa/web-report/pom.xml b/msa/web-report/pom.xml index 05f3813996..7bba753b18 100644 --- a/msa/web-report/pom.xml +++ b/msa/web-report/pom.xml @@ -28,9 +28,11 @@ js process-resources package + ${pkg.package.phase} ${project.build.directory}/package/linux ${project.build.directory}/package/windows pre-integration-test + @@ -86,7 +88,7 @@ install-node-and-yarn - v22.22.2 + v22.23.4 v1.22.22 @@ -99,6 +101,16 @@ install --non-interactive --check-files --network-concurrency 4 --network-timeout 100000 --mutex network + + generate sbom + + yarn + + + ${sbom.ui.skip} + run sbom pkg:maven/${project.groupId}/${project.artifactId}@${project.version} + + yarn pkg @@ -109,6 +121,17 @@ --mutex network run pkg + + sbom check + + yarn + + compile + + ${sbom.ui.skip} + run sbom-check + + @@ -152,6 +175,10 @@ + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -160,6 +187,27 @@ org.apache.maven.plugins maven-assembly-plugin + + org.codehaus.mojo + properties-maven-plugin + 1.2.1 + + + read-bundled-versions + ${sbom.package.phase} + + read-project-properties + + + + ${project.build.directory}/sbom/bundled-versions.properties + + + true + + + + org.codehaus.mojo exec-maven-plugin @@ -196,6 +244,176 @@ + + + org.thingsboard + sbom-maven-plugin + + + sbom-metadata + + ${project.build.directory}/sbom/tb-web-report.cdx.json + ${skip.ui.build} + + + + package-sbom + + ${project.build.directory}/sbom/tb-web-report.cdx.json + ${skip.ui.build} + + + deb + ${project.build.directory}/${pkg.name}.deb + pkg:deb/thingsboard/${pkg.name}@${pkg.version}-1?arch=amd64 + ${pkg.skip.deb} + + + rpm + ${project.build.directory}/${pkg.name}.rpm + pkg:rpm/thingsboard/${pkg.name}@${pkg.version}-1?arch=x86_64 + ${pkg.skip.rpm} + + + zip + ${project.build.directory}/${pkg.name}-windows.zip + pkg:generic/thingsboard/${pkg.name}-windows@${project.version} + ${pkg.skip.zip} + + + + + application + node + ${node.linux.version} + Node.js runtime embedded in the ${pkg.name} executable by pkg (base binary from yao-pkg/pkg-fetch). + pkg:github/nodejs/node@v${node.linux.version}?os=linux + cpe:2.3:a:nodejs:node.js:${node.linux.version}:*:*:*:*:*:*:* + MIT + + OpenJS Foundation + + https://nodejs.org + + + + deb + rpm + + + + application + node + ${node.windows.version} + Node.js runtime embedded in the ${pkg.name} executable by pkg (base binary from yao-pkg/pkg-fetch). + pkg:github/nodejs/node@v${node.windows.version}?os=windows + cpe:2.3:a:nodejs:node.js:${node.windows.version}:*:*:*:*:*:*:* + MIT + + OpenJS Foundation + + https://nodejs.org + + + + zip + + + + application + chrome-for-testing + ${chromium.version} + Chrome for Testing build downloaded by Playwright, used to render reports. + pkg:generic/google/chrome-for-testing@${chromium.version}?os=linux + cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:* + + Google LLC + + https://googlechromelabs.github.io/chrome-for-testing/ + + + ${pkg.linux.dist}/chromium/chrome + + deb + rpm + + + + application + chrome-for-testing + ${chromium.version} + Chrome for Testing build downloaded by Playwright, used to render reports. + pkg:generic/google/chrome-for-testing@${chromium.version}?os=windows + cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:* + + Google LLC + + https://googlechromelabs.github.io/chrome-for-testing/ + + + ${pkg.win.dist}/chromium/chrome.exe + + zip + + + + + + + image-sbom + + + + ${project.build.directory}/sbom/tb-web-report.cdx.json + ${pkg.installFolder} + + + application + chrome-for-testing + ${chromium.version} + Chrome for Testing build downloaded by Playwright to /ms-playwright, used to render reports. + pkg:generic/google/chrome-for-testing@${chromium.version}?os=linux&arch=@{architecture} + cpe:2.3:a:google:chrome:${chromium.version}:*:*:*:*:*:*:* + + Google LLC + + https://googlechromelabs.github.io/chrome-for-testing/ + + + + + application + chrome-headless-shell + ${chromium-headless-shell.version} + Chrome Headless Shell build downloaded by Playwright to /ms-playwright. + pkg:generic/google/chrome-headless-shell@${chromium-headless-shell.version}?os=linux&arch=@{architecture} + cpe:2.3:a:google:chrome:${chromium-headless-shell.version}:*:*:*:*:*:*:* + + Google LLC + + https://googlechromelabs.github.io/chrome-for-testing/ + + + + + application + playwright-ffmpeg + ${ffmpeg.revision} + FFmpeg build by Playwright (revision ${ffmpeg.revision}), downloaded to /ms-playwright. + pkg:generic/microsoft/playwright-ffmpeg@${ffmpeg.revision}?os=linux&arch=@{architecture} + LGPL-2.1-or-later + + Microsoft Corporation + + https://playwright.dev + + + + + + + + diff --git a/msa/web-report/sbom-check.js b/msa/web-report/sbom-check.js new file mode 100644 index 0000000000..cd4d3f76df --- /dev/null +++ b/msa/web-report/sbom-check.js @@ -0,0 +1,93 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +const fs = require('fs'); +const path = require('path'); + +const TARGET_DIR = path.join(__dirname, 'target'); +const SBOM_FILE = path.join(TARGET_DIR, 'sbom', 'tb-web-report.cdx.json'); +const VERSIONS_FILE = path.join(TARGET_DIR, 'sbom', 'bundled-versions.properties'); +const PKG_LOGS = { linux: 'pkg-linux.log', windows: 'pkg-win.log' }; +const ADDED_FILE = /(?:Content of|Bytecode of|Stat info of|Directory) (\S+) is added to queue/g; +const BASE_BINARY = /fetched-v(\d+\.\d+\.\d+)-/; + +(() => { + const listed = listedPackages(JSON.parse(fs.readFileSync(SBOM_FILE, 'utf8'))); + const versions = playwrightVersions(); + for (const [os, log] of Object.entries(PKG_LOGS)) { + const output = fs.readFileSync(path.join(TARGET_DIR, log), 'utf8').replace(/\x1b\[[0-9;]*m/g, ''); + const baseBinary = BASE_BINARY.exec(output); + if (!baseBinary) { + throw new Error(`Cannot find the Node.js base binary in ${log}`); + } + versions[`node.${os}.version`] = baseBinary[1]; + const bundled = bundledPackages(output); + if (bundled.size === 0) { + throw new Error(`No npm packages found in ${log}; was pkg run with --debug?`); + } + const missing = [...bundled].filter(id => !listed.has(id)).sort(); + if (missing.length > 0) { + throw new Error(`The ${os} binary contains npm packages that ${SBOM_FILE} does not list: ${missing.join(', ')}`); + } + console.log(`The ${os} binary contains ${bundled.size} npm packages, all listed in the SBOM (${listed.size} listed)`); + } + // The --debug executables were built only for their logs + fs.rmSync(path.join(TARGET_DIR, 'pkg-debug'), { recursive: true, force: true }); + fs.writeFileSync(VERSIONS_FILE, Object.entries(versions).map(([key, value]) => `${key}=${value}\n`).join('')); + console.log(`Wrote ${VERSIONS_FILE}: ${JSON.stringify(versions)}`); +})(); + +function listedPackages(bom) { + const ids = new Set(); + for (const component of bom.components || []) { + if ((component.purl || '').startsWith('pkg:npm/')) { + ids.add(`${component.group ? component.group + '/' : ''}${component.name}@${component.version}`); + } + } + return ids; +} + +function bundledPackages(output) { + const packageDirs = new Set(); + for (const match of output.matchAll(ADDED_FILE)) { + const dir = packageDir(match[1]); + if (dir) { + packageDirs.add(dir); + } + } + const ids = new Set(); + for (const dir of packageDirs) { + const manifest = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')); + ids.add(`${manifest.name}@${manifest.version}`); + } + return ids; +} + +function packageDir(file) { + const parts = file.split(/[\\/]/); + const index = parts.lastIndexOf('node_modules'); + if (index < 0 || index + 1 >= parts.length) { + return null; + } + const scoped = parts[index + 1].startsWith('@'); + if (scoped && index + 2 >= parts.length) { + return null; + } + return parts.slice(0, index + (scoped ? 3 : 2)).join(path.sep); +} + +function playwrightVersions() { + const browsers = JSON.parse(fs.readFileSync(path.join(path.dirname(require.resolve('playwright-core/package.json')), 'browsers.json'), 'utf8')).browsers; + const browser = name => { + const found = browsers.find(candidate => candidate.name === name); + if (!found) { + throw new Error(`playwright-core/browsers.json does not list ${name}`); + } + return found; + }; + return { + 'chromium.version': browser('chromium').browserVersion, + 'chromium-headless-shell.version': browser('chromium-headless-shell').browserVersion, + 'ffmpeg.revision': browser('ffmpeg').revision + }; +} + diff --git a/msa/web-report/yarn.lock b/msa/web-report/yarn.lock index d2ee63937d..82f160bb5d 100644 --- a/msa/web-report/yarn.lock +++ b/msa/web-report/yarn.lock @@ -2,47 +2,88 @@ # yarn lockfile v1 -"@babel/generator@^7.23.0": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.3.tgz#9626c1741c650cbac39121694a0f2d7451b8ef3e" - integrity sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw== - dependencies: - "@babel/parser" "^7.28.3" - "@babel/types" "^7.28.2" +"@babel/code-frame@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== + dependencies: + "@babel/helper-validator-identifier" "^7.29.7" + js-tokens "^4.0.0" + picocolors "^1.1.1" + +"@babel/generator@^7.23.0", "@babel/generator@^7.29.8": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.8.tgz#4b0b887885422643339e09022148a4c4ebaa4979" + integrity sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg== + dependencies: + "@babel/parser" "^7.29.8" + "@babel/types" "^7.29.8" "@jridgewell/gen-mapping" "^0.3.12" "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== - -"@babel/helper-validator-identifier@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" - integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== - -"@babel/parser@^7.23.0", "@babel/parser@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.3.tgz#d2d25b814621bca5fe9d172bc93792547e7a2a71" - integrity sha512-7+Ey1mAgYqFAx2h0RuoxcQT5+MlG3GTV0TQrgr7/ZliKsm/MNDxVVutlWaziMq7wJNAz8MTqz55XLpWvva6StA== - dependencies: - "@babel/types" "^7.28.2" - -"@babel/types@^7.23.0", "@babel/types@^7.28.2": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.2.tgz#da9db0856a9a88e0a13b019881d7513588cf712b" - integrity sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ== - dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - -"@colors/colors@1.6.0", "@colors/colors@^1.6.0": +"@babel/helper-globals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.29.7.tgz#f04a96fbd8473241b1079243f5b3f03a3010ab7b" + integrity sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA== + +"@babel/helper-string-parser@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz#7f0871d99824d23137d60f86fcf6130fd5a1b51f" + integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw== + +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== + +"@babel/parser@^7.23.0", "@babel/parser@^7.29.7", "@babel/parser@^7.29.8", "@babel/parser@^7.29.9": + version "7.29.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.9.tgz#e7ee0a24f752c5296c6455855ccb72662e67ea96" + integrity sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA== + dependencies: + "@babel/types" "^7.29.8" + +"@babel/template@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.29.7.tgz#4d9d4004f645cdd304de958c725162784ecac700" + integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/traverse@^7.23.0": + version "7.29.10" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.10.tgz#08ab387639b4a67304511259c7da6cf23a82e91c" + integrity sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.8" + "@babel/helper-globals" "^7.29.7" + "@babel/parser" "^7.29.9" + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.8" + debug "^4.3.1" + +"@babel/types@^7.23.0", "@babel/types@^7.29.7", "@babel/types@^7.29.8": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.8.tgz#1229eef31d85156d70fa3f4cd859376d0eaf6863" + integrity sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg== + dependencies: + "@babel/helper-string-parser" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + +"@colors/colors@1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.0.tgz#ec6cd237440700bc23ca23087f513c75508958b0" integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA== +"@colors/colors@^1.6.0": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.1.tgz#8e2827259ada76965b3a051c18a5927fbdac38c2" + integrity sha512-dTmUJzXSuayBK+hZydEaXd2mhx61qWQwkwaBBY6LyEOVx/L9aQU5ac8eFNEsd9nrD1+zb9zvDCphLSe8g1F4Qw== + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -50,15 +91,150 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@dabh/diagnostics@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a" - integrity sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA== +"@cyclonedx/cyclonedx-library@10.3.0": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@cyclonedx/cyclonedx-library/-/cyclonedx-library-10.3.0.tgz#92ccd1553d64d7c593b1adc31203cba01583d3df" + integrity sha512-RIT28sp1U0PCHaaeF3yNRwk6Jig/XJ8UsYAVOMYaHQ+0VVOvsjcp0PTWQFLUqJFF8XMud+Kdq6G+wtDAh+QJFA== + +"@dabh/diagnostics@^2.0.8": + version "2.0.9" + resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.9.tgz#0de9e8718e23ab60d1fb1ce0c004079f14f5ad36" + integrity sha512-R6siwR65Hm+3yfgP7o8DKhNvputQAwfoz9zTc3kyDudnomj2/BcLmD+uGQQPICjuFUp8ounPBU+jmKsocwVVAg== dependencies: - colorspace "1.1.x" + "@so-ric/colorspace" "^1.1.6" enabled "2.0.x" kuler "^2.0.0" +"@esbuild/aix-ppc64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz#bf6e10303bcf2e7c686975fa52f937ec2728d8bc" + integrity sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ== + +"@esbuild/android-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz#0c6246bc8d2c4d172aac2db3fb1190d72bd65504" + integrity sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A== + +"@esbuild/android-arm@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.28.2.tgz#2d84ece6a4e2684d92be26ee13d42757d831c381" + integrity sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg== + +"@esbuild/android-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.28.2.tgz#fc38d4d6358d8dc1cf53f09f7589fe436eb64801" + integrity sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q== + +"@esbuild/darwin-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz#f83afeeac1d7dac01c7a2fd012b3e451a0591fcc" + integrity sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw== + +"@esbuild/darwin-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz#510147c055a795588dbbe14fd6b1b8ad0a2f30de" + integrity sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw== + +"@esbuild/freebsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz#093b9200ecf0b115ba4e5e248a7485c9c5f8bd5e" + integrity sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw== + +"@esbuild/freebsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz#0be22b6df925d213e841ea87123af5df80b0faf7" + integrity sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg== + +"@esbuild/linux-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz#1bdbc651cda9ba9995c53ed9c71ceaa65094762d" + integrity sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug== + +"@esbuild/linux-arm@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz#beb12ad72b84f72d28488cc1b8ee9f7eb141d753" + integrity sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w== + +"@esbuild/linux-ia32@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz#b81f9d55529b45c206a46a138214b1aa6879696b" + integrity sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ== + +"@esbuild/linux-loong64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz#598667241a04c99b76ed6ef940ac50038c419f98" + integrity sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ== + +"@esbuild/linux-mips64el@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz#1c51eb9cea903f53d97b5af3b1841db70f5596ca" + integrity sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA== + +"@esbuild/linux-ppc64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz#63dd61f17ceb31a81227f413feac8a71bc2c51f2" + integrity sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ== + +"@esbuild/linux-riscv64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz#3763b08fde5cf25ab1facb8e7752edfe45fbfc27" + integrity sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA== + +"@esbuild/linux-s390x@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz#1a137ff293a82906eb3176385bd7e8e0e5cfb7cb" + integrity sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg== + +"@esbuild/linux-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz#268b36211c146ca54f8fe12c578a8d6ef8979485" + integrity sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ== + +"@esbuild/netbsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz#22571ad951d62bb6accc82d8d1fad5c8c1ac0ba1" + integrity sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw== + +"@esbuild/netbsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz#42fcc57297eb0a0ca3f5fc475291f4c1a3f7c0de" + integrity sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw== + +"@esbuild/openbsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz#9eb32af104ac3dacf4edca01f596664aab0c73ef" + integrity sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ== + +"@esbuild/openbsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz#febed2402d6088225e91f20fb4ce2522ad0a4efd" + integrity sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw== + +"@esbuild/openharmony-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz#85641c3d466428bfbccea5f21c26836663fef5ce" + integrity sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q== + +"@esbuild/sunos-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz#a736f9d8962481045fc4c3e54f5479f22c870fb4" + integrity sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g== + +"@esbuild/win32-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz#ee5ab40fad186201b652a33f8a5eb149e9e42532" + integrity sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ== + +"@esbuild/win32-ia32@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz#c40d28a6d99a127da6711f2afd74b11cb63b06a7" + integrity sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA== + +"@esbuild/win32-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz#b21affb804cc167c133d95f45b3a1dc1323b9a87" + integrity sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g== + "@isaacs/fs-minipass@^4.0.0": version "4.0.1" resolved "https://registry.yarnpkg.com/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz#2d59ae3ab4b38fb4270bfa23d30f8e2e86c7fe32" @@ -80,9 +256,9 @@ integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": - version "1.5.5" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" - integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== + version "1.6.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz#f4c663e862f06dc98ca4d453862c46902789a18d" + integrity sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw== "@jridgewell/trace-mapping@0.3.9": version "0.3.9" @@ -93,17 +269,30 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.28": - version "0.3.30" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.30.tgz#4a76c4daeee5df09f5d3940e087442fb36ce2b99" - integrity sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q== + version "0.3.31" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" + integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@roberts_lando/vfs@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@roberts_lando/vfs/-/vfs-0.3.3.tgz#6359feed30e3773041279cb11be82ca60f4ff1f1" + integrity sha512-YjkxVSLw5WMZQoARaryRAjcxA+GbBzWMJdwYZX5oLUt9cC/gew9as4Dn7tcLzPp7BPoR221VpTZ+78TRPawnjg== + +"@so-ric/colorspace@^1.1.6": + version "1.1.6" + resolved "https://registry.yarnpkg.com/@so-ric/colorspace/-/colorspace-1.1.6.tgz#62515d8b9f27746b76950a83bde1af812d91923b" + integrity sha512-/KiKkpHNOBgkFJwu9sh48LkHSMYGyuTcSFK/qMBdnOAlrRJzRSXAOFB5qwzaVQuDl8wAvHVMkaASQDReTahxuw== + dependencies: + color "^5.0.2" + text-hex "1.0.x" + "@tsconfig/node10@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" - integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== + version "1.0.13" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.13.tgz#56105a9a8c786e8f15e35746879cf2d52275485b" + integrity sha512-gcLdvR9HO1ZJBypsOGqaP6TFEzb6vIta0KSTLt9NAQ6pXQO3cRgSVyCN6pzYqI9DlJgY71XKO0dpDhCf08b3pg== "@tsconfig/node12@^1.0.7": version "1.0.11" @@ -128,11 +317,6 @@ "@types/connect" "*" "@types/node" "*" -"@types/config@~3.3.5": - version "3.3.5" - resolved "https://registry.yarnpkg.com/@types/config/-/config-3.3.5.tgz#91f0a52b10212b9c4254fb0bbc4bedd77cd389b8" - integrity sha512-itq2HtXQBrNUKwMNZnb9mBRE3T99VYCdl1gjST9rq+9kFaB1iMMGuDeZnP88qid73DnpAMKH9ZolqDpS1Lz7+w== - "@types/connect@*": version "3.4.38" resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" @@ -141,52 +325,47 @@ "@types/node" "*" "@types/express-serve-static-core@^5.0.0": - version "5.0.7" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.7.tgz#2fa94879c9d46b11a5df4c74ac75befd6b283de6" - integrity sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ== + version "5.1.3" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.1.3.tgz#9d34c88c0c9ee62b9a6e4d9f8ab8d7e29688e6b4" + integrity sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw== dependencies: "@types/node" "*" "@types/qs" "*" "@types/range-parser" "*" "@types/send" "*" -"@types/express@~5.0.3": - version "5.0.3" - resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.3.tgz#6c4bc6acddc2e2a587142e1d8be0bce20757e956" - integrity sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw== +"@types/express@~5.0.6": + version "5.0.6" + resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.6.tgz#2d724b2c990dcb8c8444063f3580a903f6d500cc" + integrity sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA== dependencies: "@types/body-parser" "*" "@types/express-serve-static-core" "^5.0.0" - "@types/serve-static" "*" + "@types/serve-static" "^2" "@types/http-errors@*": version "2.0.5" resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.5.tgz#5b749ab2b16ba113423feb1a64a95dcd30398472" integrity sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg== -"@types/mime@^1": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" - integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== - "@types/node@*": - version "24.3.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.3.0.tgz#89b09f45cb9a8ee69466f18ee5864e4c3eb84dec" - integrity sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow== + version "26.6.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.6.5.tgz#cb35209e7767c503551b5fa42a48231c7441d979" + integrity sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg== dependencies: - undici-types "~7.10.0" + undici-types "~8.9.0" -"@types/node@~22.17.2": - version "22.17.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.17.2.tgz#47a93d6f4b79327da63af727e7c54e8cab8c4d33" - integrity sha512-gL6z5N9Jm9mhY+U2KXZpteb+09zyffliRkZyZOHODGATyC5B1Jt/7TzuuiLkFsSUMLbS1OLmlj/E+/3KF4Q/4w== +"@types/node@~22.20.5": + version "22.20.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.20.5.tgz#afa7bde6da81b8b83ea4e2f020487e9b148c11fd" + integrity sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA== dependencies: undici-types "~6.21.0" "@types/qs@*": - version "6.14.0" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" - integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== + version "6.15.1" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.15.1.tgz#8606884272c63f0db96986bd3548650d8a9388bf" + integrity sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw== "@types/range-parser@*": version "1.2.7" @@ -194,61 +373,67 @@ integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== "@types/send@*": - version "0.17.5" - resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.5.tgz#d991d4f2b16f2b1ef497131f00a9114290791e74" - integrity sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w== + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/send/-/send-1.2.1.tgz#6a784e45543c18c774c049bff6d3dbaf045c9c74" + integrity sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ== dependencies: - "@types/mime" "^1" "@types/node" "*" -"@types/serve-static@*": - version "1.15.8" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.8.tgz#8180c3fbe4a70e8f00b9f70b9ba7f08f35987877" - integrity sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg== +"@types/serve-static@^2": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-2.2.0.tgz#d4a447503ead0d1671132d1ab6bd58b805d8de6a" + integrity sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ== dependencies: "@types/http-errors" "*" "@types/node" "*" - "@types/send" "*" "@types/triple-beam@^1.3.2": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c" integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw== -"@yao-pkg/pkg-fetch@3.5.24": - version "3.5.24" - resolved "https://registry.yarnpkg.com/@yao-pkg/pkg-fetch/-/pkg-fetch-3.5.24.tgz#37a671f077fe6446aec0758e6fc7961d183c3445" - integrity sha512-FPESCH1uXCYui6jeDp2aayWuFHR39w+uU1r88nI6JWRvPYOU64cHPUV/p6GSFoQdpna7ip92HnrZKbBC60l0gA== +"@yao-pkg/pkg-fetch@3.6.7": + version "3.6.7" + resolved "https://registry.yarnpkg.com/@yao-pkg/pkg-fetch/-/pkg-fetch-3.6.7.tgz#5fb8a55031846ef105efeaf4beae0d4f4ed47540" + integrity sha512-uEeU5druVgHffruTAXzW6nf0wHfREWlCq5LBtQ4hCdLBDbwTteuym5NrxREur3EgNcqFRenEi6Rivwo723PkHg== dependencies: - https-proxy-agent "^5.0.0" - node-fetch "^2.6.6" picocolors "^1.1.0" progress "^2.0.3" semver "^7.3.5" - tar-fs "^2.1.1" + tar-fs "^3.1.1" + undici "^7.28.0" yargs "^16.2.0" -"@yao-pkg/pkg@^6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@yao-pkg/pkg/-/pkg-6.6.0.tgz#e8c38ed5824381c676e6688f93e27f39e1752701" - integrity sha512-3/oiaSm7fS0Fc7dzp22r9B7vFaguGhO9vERgEReRYj2EUzdi5ssyYhe1uYJG4ec/dmo2GG6RRHOUAT8savl79Q== +"@yao-pkg/pkg@^6.24.0": + version "6.24.0" + resolved "https://registry.yarnpkg.com/@yao-pkg/pkg/-/pkg-6.24.0.tgz#c556d2e98e8ac437ac7f08065accec8595a13b98" + integrity sha512-SMwFLic12noHLbqxhhQVClVX6YZlQtzwwez6dq7Xj64rXX6OFgZTTQbPgw4wgec5IoUN+6rCRKgyW/cnVPOwkA== dependencies: "@babel/generator" "^7.23.0" "@babel/parser" "^7.23.0" + "@babel/traverse" "^7.23.0" "@babel/types" "^7.23.0" - "@yao-pkg/pkg-fetch" "3.5.24" - into-stream "^6.0.0" - minimist "^1.2.6" + "@roberts_lando/vfs" "^0.3.3" + "@yao-pkg/pkg-fetch" "3.6.7" + esbuild "^0.28.1" + into-stream "^9.1.0" multistream "^4.1.0" picocolors "^1.1.0" picomatch "^4.0.2" + postject "^1.0.0-alpha.6" prebuild-install "^7.1.1" resolve "^1.22.10" + resolve.exports "^2.0.3" stream-meter "^1.0.4" - tar "^7.4.3" + tar "^7.5.7" tinyglobby "^0.2.11" unzipper "^0.12.3" +"@yarnpkg/lockfile@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + accepts@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/accepts/-/accepts-2.0.0.tgz#bbcf4ba5075467f3f2131eab3cffc73c2f5d7895" @@ -258,23 +443,16 @@ accepts@^2.0.0: negotiator "^1.0.0" acorn-walk@^8.1.1: - version "8.3.4" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" - integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + version "8.3.5" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.5.tgz#8a6b8ca8fc5b34685af15dabb44118663c296496" + integrity sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw== dependencies: acorn "^8.11.0" acorn@^8.11.0, acorn@^8.4.1: - version "8.14.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" - integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" + version "8.19.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.19.0.tgz#6b26fd97ce1cc9dc50bdf7ad305e9f1384d4f28a" + integrity sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw== ansi-regex@^5.0.1: version "5.0.1" @@ -288,14 +466,6 @@ ansi-styles@^4.0.0: dependencies: color-convert "^2.0.1" -anymatch@~3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" @@ -311,21 +481,53 @@ async@^3.2.3: resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +b4a@^1.6.4, b4a@^1.8.1, b4a@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.9.0.tgz#6336313b6e76b299c397afa68676ec6ebc788845" + integrity sha512-dpfcF9fDNR6++cthXR67iyhgqWy9CBouAvIWhIntzBG6cvK/cnIPiZQjBwi/ZqjjBEDGfoNDtmB0kTjroOJ3pQ== + +bare-events@^2.5.4, bare-events@^2.7.0: + version "2.9.2" + resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.9.2.tgz#01d377b64c3c7167b28b52da7add3221aecf2d7f" + integrity sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA== + +bare-fs@^4.0.1, bare-fs@^4.8.2: + version "4.8.4" + resolved "https://registry.yarnpkg.com/bare-fs/-/bare-fs-4.8.4.tgz#f342288e7e5d9d8e79917078e1f45950507828c5" + integrity sha512-MPC2eyrpbk3A873sK4y6rk+Iv4o2enxTjHZ8zH3HO0mjrpm5XjnguY2XmfidIsDV6vnjpbMBKUAJpV0ISD2SsQ== + dependencies: + bare-events "^2.5.4" + bare-path "^3.0.0" + bare-stream "^2.6.4" + bare-url "^2.2.2" + fast-fifo "^1.3.2" + +bare-path@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-3.1.2.tgz#67261bc74a9ba0105ba139b8638f218c09e8d82e" + integrity sha512-ZyKbsuuqK6Ag0K8pX6V5Txq6XeJRvY+wXucnFGRjiyVYP9YWDpIQugk/b+enRYrEYBJaqLzghRQpXPMR7341Nw== + +bare-stream@^2.6.4: + version "2.13.4" + resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.13.4.tgz#61d448a268d1efd992103aae6bd729332f278ac0" + integrity sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA== + dependencies: + b4a "^1.8.1" + streamx "^2.25.0" + teex "^1.0.1" + +bare-url@^2.2.2: + version "2.5.5" + resolved "https://registry.yarnpkg.com/bare-url/-/bare-url-2.5.5.tgz#2e8c18db11393aa6cae6ff246fdcda34615aacd3" + integrity sha512-iM9qJCruvpt2rPaLsrumVDru9pogI7PHziHIa9kTNRFt8C8HuSa+kI9kFezK+NvHEFnnz71rKGZ1EAilq/3V/Q== + dependencies: + bare-path "^3.0.0" base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -binary-extensions@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" - integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== - bl@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -340,35 +542,20 @@ bluebird@~3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -body-parser@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-2.2.0.tgz#f7a9656de305249a715b549b7b8fd1ab9dfddcfa" - integrity sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg== +body-parser@^2.3.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-2.4.0.tgz#337a76249270f83e450ad385a9606ca3b4a75c06" + integrity sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ== dependencies: bytes "^3.1.2" - content-type "^1.0.5" - debug "^4.4.0" - http-errors "^2.0.0" - iconv-lite "^0.6.3" + content-type "^2.1.0" + debug "^4.4.3" + http-errors "^2.0.1" + iconv-lite "^0.7.3" on-finished "^2.4.1" - qs "^6.14.0" - raw-body "^3.0.0" - type-is "^2.0.0" - -brace-expansion@^1.1.7: - version "1.1.18" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.18.tgz#3ce74d89885136be1535341f8c3d4425c29a5cab" - integrity sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@~3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" - integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== - dependencies: - fill-range "^7.1.1" + qs "^6.16.1" + raw-body "^3.0.2" + type-is "^2.1.0" buffer@^5.5.0: version "5.7.1" @@ -378,7 +565,7 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" -bytes@3.1.2, bytes@^3.1.2: +bytes@^3.1.2, bytes@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== @@ -399,21 +586,6 @@ call-bound@^1.0.2: call-bind-apply-helpers "^1.0.2" get-intrinsic "^1.3.0" -chokidar@^3.5.2: - version "3.6.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" - integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -433,13 +605,6 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" -color-convert@^1.9.3: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - color-convert@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" @@ -447,63 +612,59 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-convert@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-3.1.3.tgz#db6627b97181cb8facdfce755ae26f97ab0711f1" + integrity sha512-fasDH2ont2GqF5HpyO4w0+BcewlhHEZOFn9c1ckZdHpJ56Qb7MHhH/IcJZbBGgvdtwdwNbLvxiBEdg336iA9Sg== + dependencies: + color-name "^2.0.0" + +color-name@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-2.1.1.tgz#86c00ec98db36705be5bd4428097f13af1175a6d" + integrity sha512-p2FdgwVx1a9yWBHP2wI0VgShkDpgN4kZISkxdNipGBJWpa5G6b04OINlVWCyJj0JmfvcPrgqt95E9k8yvaOJFg== -color-name@^1.0.0, color-name@~1.1.4: +color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -color-string@^1.6.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" - integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== - dependencies: - color-name "^1.0.0" - simple-swizzle "^0.2.2" - -color@^3.1.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/color/-/color-3.2.1.tgz#3544dc198caf4490c3ecc9a790b54fe9ff45e164" - integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA== +color-string@^2.1.3: + version "2.1.4" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-2.1.4.tgz#9dcf566ff976e23368c8bd673f5c35103ab41058" + integrity sha512-Bb6Cq8oq0IjDOe8wJmi4JeNn763Xs9cfrBcaylK1tPypWzyoy2G3l90v9k64kjphl/ZJjPIShFztenRomi8WTg== dependencies: - color-convert "^1.9.3" - color-string "^1.6.0" + color-name "^2.0.0" -colorspace@1.1.x: - version "1.1.4" - resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.4.tgz#8d442d1186152f60453bf8070cd66eb364e59243" - integrity sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w== +color@^5.0.2: + version "5.0.3" + resolved "https://registry.yarnpkg.com/color/-/color-5.0.3.tgz#f79390b1b778e222ffbb54304d3dbeaef633f97f" + integrity sha512-ezmVcLR3xAVp8kYOm4GS45ZLLgIE6SPAFoduLr6hTDajwb3KZ2F46gulK3XpcwRFb5KKGCSezCBAY4Dw4HsyXA== dependencies: - color "^3.1.3" - text-hex "1.0.x" + color-convert "^3.1.3" + color-string "^2.1.3" -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +commander@^9.4.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" + integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== -config@~4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/config/-/config-4.1.1.tgz#798f636e2a5b7baa7050280d1eb21f8e10abb8c9" - integrity sha512-jljfwqNZ7QHwAW9Z9NDZdJARFiu5pjLqQO0K4ooY22iY/bIY78n0afI4ANEawfgQOxri0K/3oTayX8XIauWcLA== +config@~4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/config/-/config-4.4.2.tgz#adab67a87fcb5f84edcacb3f159ccdb31ad8b901" + integrity sha512-5HJD7TX70gOG2dAd72eDjDeSTYn6D8nOiKgysQQS8mRUo9X1wDtlzb1JlmIWkP+sM9zKRVdYJxmj+qmCsYu6DQ== dependencies: json5 "^2.2.3" -content-disposition@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-1.0.0.tgz#844426cb398f934caefcbb172200126bc7ceace2" - integrity sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg== - dependencies: - safe-buffer "5.2.1" +content-disposition@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-2.0.1.tgz#88a75c7a52ef9c407c96035fe83a66939c2a4dc9" + integrity sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog== -content-type@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== +content-type@^2.0.0, content-type@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-2.1.0.tgz#d9389c43c0a8cf6a355db464d21e07092a40493a" + integrity sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag== cookie-signature@^1.2.1: version "1.2.2" @@ -525,10 +686,10 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -debug@4, debug@^4, debug@^4.3.5, debug@^4.4.0: - version "4.4.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" - integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== +debug@^4.3.1, debug@^4.4.0, debug@^4.4.3: + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== dependencies: ms "^2.1.3" @@ -544,20 +705,20 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -depd@2.0.0, depd@^2.0.0: +depd@^2.0.0, depd@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== detect-libc@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.4.tgz#f04715b8ba815e53b4d8109655b6508a6865a7e8" - integrity sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA== + version "2.1.2" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad" + integrity sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ== diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + version "4.0.4" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.4.tgz#7a6dbfda325f25f07517e9b518f897c08332e07d" + integrity sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ== dunder-proto@^1.0.1: version "1.0.1" @@ -613,12 +774,44 @@ es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== dependencies: es-errors "^1.3.0" +esbuild@^0.28.1: + version "0.28.2" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.28.2.tgz#0f43bd1bad955b72d24e2261e3abe5957ccf0816" + integrity sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA== + optionalDependencies: + "@esbuild/aix-ppc64" "0.28.2" + "@esbuild/android-arm" "0.28.2" + "@esbuild/android-arm64" "0.28.2" + "@esbuild/android-x64" "0.28.2" + "@esbuild/darwin-arm64" "0.28.2" + "@esbuild/darwin-x64" "0.28.2" + "@esbuild/freebsd-arm64" "0.28.2" + "@esbuild/freebsd-x64" "0.28.2" + "@esbuild/linux-arm" "0.28.2" + "@esbuild/linux-arm64" "0.28.2" + "@esbuild/linux-ia32" "0.28.2" + "@esbuild/linux-loong64" "0.28.2" + "@esbuild/linux-mips64el" "0.28.2" + "@esbuild/linux-ppc64" "0.28.2" + "@esbuild/linux-riscv64" "0.28.2" + "@esbuild/linux-s390x" "0.28.2" + "@esbuild/linux-x64" "0.28.2" + "@esbuild/netbsd-arm64" "0.28.2" + "@esbuild/netbsd-x64" "0.28.2" + "@esbuild/openbsd-arm64" "0.28.2" + "@esbuild/openbsd-x64" "0.28.2" + "@esbuild/openharmony-arm64" "0.28.2" + "@esbuild/sunos-x64" "0.28.2" + "@esbuild/win32-arm64" "0.28.2" + "@esbuild/win32-ia32" "0.28.2" + "@esbuild/win32-x64" "0.28.2" + escalade@^3.1.1: version "3.2.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" @@ -634,23 +827,31 @@ etag@^1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== +events-universal@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/events-universal/-/events-universal-1.0.1.tgz#b56a84fd611b6610e0a2d0f09f80fdf931e2dfe6" + integrity sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw== + dependencies: + bare-events "^2.7.0" + expand-template@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== -express@~5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/express/-/express-5.1.0.tgz#d31beaf715a0016f0d53f47d3b4d7acf28c75cc9" - integrity sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA== +express@~5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/express/-/express-5.3.0.tgz#ab72dace89c50c8417bd3f865dad0b4fd1ca1c73" + integrity sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g== dependencies: accepts "^2.0.0" - body-parser "^2.2.0" - content-disposition "^1.0.0" - content-type "^1.0.5" + body-parser "^2.3.0" + content-disposition "^2.0.1" + content-type "^2.0.0" cookie "^0.7.1" cookie-signature "^1.2.1" debug "^4.4.0" + depd "^2.0.0" encodeurl "^2.0.0" escape-html "^1.0.3" etag "^1.8.1" @@ -662,17 +863,22 @@ express@~5.1.0: on-finished "^2.4.1" once "^1.4.0" parseurl "^1.3.3" - proxy-addr "^2.0.7" - qs "^6.14.0" + proxy-addr "^2.0.8" + qs "^6.16.0" range-parser "^1.2.1" router "^2.2.0" send "^1.1.0" serve-static "^2.2.0" statuses "^2.0.1" - type-is "^2.0.1" + type-is "^2.1.0" vary "^1.1.2" -fdir@^6.4.4: +fast-fifo@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" + integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== + +fdir@^6.5.0: version "6.5.0" resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.5.0.tgz#ed2ab967a331ade62f18d077dae192684d50d350" integrity sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg== @@ -689,17 +895,10 @@ file-stream-rotator@^0.6.1: dependencies: moment "^2.29.1" -fill-range@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" - integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== - dependencies: - to-regex-range "^5.0.1" - finalhandler@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-2.1.0.tgz#72306373aa89d05a8242ed569ed86a1bff7c561f" - integrity sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q== + version "2.1.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-2.1.1.tgz#a2c517a6559852bcdb06d1f8bd7f51b68fad8099" + integrity sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA== dependencies: debug "^4.4.0" encodeurl "^2.0.0" @@ -723,20 +922,12 @@ fresh@^2.0.0: resolved "https://registry.yarnpkg.com/fresh/-/fresh-2.0.0.tgz#8dd7df6a1b3a1b3a5cf186c05a5dd267622635a4" integrity sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A== -from2@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - integrity sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g== - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.0" - fs-constants@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^11.2.0, fs-extra@~11.3.1: +fs-extra@11.3.1: version "11.3.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.3.1.tgz#ba7a1f97a85f94c6db2e52ff69570db3671d5a74" integrity sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g== @@ -745,10 +936,14 @@ fs-extra@^11.2.0, fs-extra@~11.3.1: jsonfile "^6.0.1" universalify "^2.0.0" -fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== +fs-extra@~11.4.1: + version "11.4.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.4.1.tgz#6a01ca80008eacf3ca1ffde5ef79088f68203a5a" + integrity sha512-KYAb4c9BJQI6QqGKthV68OHe0badztdXJWKo0WtBA9IuCFPTKvE5ZdUBglP833aMjhaSPNO4A5j/EkzZtGlKjA== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" function-bind@^1.1.2: version "1.1.2" @@ -789,13 +984,6 @@ github-from-package@0.0.0: resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== -glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" @@ -806,46 +994,40 @@ graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - has-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== +hasown@^2.0.2, hasown@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== dependencies: function-bind "^1.1.2" -http-errors@2.0.0, http-errors@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== +hosted-git-info@^9.0.0: + version "9.0.3" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-9.0.3.tgz#637b511ce62a28e4261a92b8da0a4d6be3522cd4" + integrity sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg== dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" + lru-cache "^11.1.0" -https-proxy-agent@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== +http-errors@^2.0.0, http-errors@^2.0.1, http-errors@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.1.tgz#36d2f65bc909c8790018dd36fb4d93da6caae06b" + integrity sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ== dependencies: - agent-base "6" - debug "4" + depd "~2.0.0" + inherits "~2.0.4" + setprototypeof "~1.2.0" + statuses "~2.0.2" + toidentifier "~1.0.1" -iconv-lite@0.6.3, iconv-lite@^0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== +iconv-lite@^0.7.3, iconv-lite@~0.7.0: + version "0.7.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.7.3.tgz#84ee12f963e7de50bc01a13e160a078b3b0f415f" + integrity sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ== dependencies: safer-buffer ">= 2.1.2 < 3.0.0" @@ -854,12 +1036,7 @@ ieee754@^1.1.13: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore-by-default@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" - integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA== - -inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -869,60 +1046,28 @@ ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -into-stream@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-6.0.0.tgz#4bfc1244c0128224e18b8870e85b2de8e66c6702" - integrity sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA== - dependencies: - from2 "^2.3.0" - p-is-promise "^3.0.0" +into-stream@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-9.1.0.tgz#3d49f8dc3aa44c9d5e6007cc07831388542a1326" + integrity sha512-DRsRnQrbzdFjaQ1oe4C6/EIUymIOEix1qROEJTF9dbMq+M4Zrm6VaLp6SD/B9IsiEjPZuBSnWWFN+udajugdWA== ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== -is-arrayish@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" - integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-core-module@^2.16.0: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== +is-core-module@^2.17.0: + version "2.17.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.17.0.tgz#75c1c76236c9f7e38ddbfff292e127dc13b21027" + integrity sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA== dependencies: - hasown "^2.0.2" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + hasown "^2.0.4" is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - is-promise@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" @@ -938,7 +1083,12 @@ isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== -js-yaml@^4.1.1: +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.3.2.tgz#8e44fb14a2643c59726bb15787b5f1512cb3d3fb" integrity sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA== @@ -956,9 +1106,9 @@ json5@^2.2.3: integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonfile@^6.0.1: - version "6.2.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.0.tgz#7c265bd1b65de6977478300087c99f1c84383f62" - integrity sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg== + version "6.2.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.1.tgz#b6e31717f22cc37330b081ce0051ed5de53af2f6" + integrity sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q== dependencies: universalify "^2.0.0" optionalDependencies: @@ -981,6 +1131,11 @@ logform@^2.7.0: safe-stable-stringify "^2.3.1" triple-beam "^1.3.0" +lru-cache@^11.1.0: + version "11.5.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.3.tgz#a7767b4034e35269562d2b9da2b185b5df70c421" + integrity sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg== + make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" @@ -992,9 +1147,9 @@ math-intrinsics@^1.1.0: integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== media-typer@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.0.tgz#6ab74b8f2d3320f2064b2a87a38e7931ff3a5561" - integrity sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw== + version "1.1.1" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.1.tgz#6f035400dfe3ab9d5607bc77546ce30cc2f9c6b8" + integrity sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ== merge-descriptors@^2.0.0: version "2.0.0" @@ -1006,10 +1161,10 @@ mime-db@^1.54.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== -mime-types@^3.0.0, mime-types@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.1.tgz#b1d94d6997a9b32fd69ebaed0db73de8acb519ce" - integrity sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA== +mime-types@^3.0.0, mime-types@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.2.tgz#39002d4182575d5af036ffa118100f2524b2e2ab" + integrity sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A== dependencies: mime-db "^1.54.0" @@ -1018,22 +1173,15 @@ mimic-response@^3.1.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== -minimatch@^3.1.2: - version "3.1.5" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" - integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6: +minimist@^1.2.0, minimist@^1.2.3: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minipass@^7.0.4, minipass@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" - integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== minizlib@^3.1.0: version "3.1.0" @@ -1071,64 +1219,47 @@ napi-build-utils@^2.0.0: integrity sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA== negotiator@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.0.0.tgz#b6c91bb47172d69f93cfd7c357bbb529019b5f6a" - integrity sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg== + version "1.1.0" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.1.0.tgz#16e003d0db4ac24fd9df168edf871625deeae3df" + integrity sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg== + dependencies: + content-type "^2.1.0" node-abi@^3.3.0: - version "3.75.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.75.0.tgz#2f929a91a90a0d02b325c43731314802357ed764" - integrity sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg== + version "3.100.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.100.0.tgz#31aa9623841051d14f52415557e18101bc0de7ca" + integrity sha512-KNU/E0VW9T1ndOAEWNlWtxhoBSF7hqe+dMSrRPK6+PfyL2s2AcfwnXCAOke4DNXOsweivNT6/7eFHwkxWblZew== dependencies: semver "^7.3.5" -node-fetch@^2.6.6: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -nodemon@~3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.1.10.tgz#5015c5eb4fffcb24d98cf9454df14f4fecec9bc1" - integrity sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw== - dependencies: - chokidar "^3.5.2" - debug "^4" - ignore-by-default "^1.0.1" - minimatch "^3.1.2" - pstree.remy "^1.1.8" - semver "^7.5.3" - simple-update-notifier "^2.0.0" - supports-color "^5.5.0" - touch "^3.1.0" - undefsafe "^2.0.5" - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +normalize-package-data@8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-8.0.0.tgz#bdce7ff2d6ba891b853e179e45a5337766e304a7" + integrity sha512-RWk+PI433eESQ7ounYxIp67CYuVsS1uYSonX3kA6ps/3LWfjVQa/ptEg6Y3T6uAMq1mWpX9PQ+qx+QaHpsc7gQ== + dependencies: + hosted-git-info "^9.0.0" + semver "^7.3.5" + validate-npm-package-license "^3.0.4" object-hash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== -object-inspect@^1.13.3: +object-inspect@^1.13.3, object-inspect@^1.13.4: version "1.13.4" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== on-finished@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + version "2.4.2" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.2.tgz#6932b04b95bf6a4828201db10af75fe5c9c38b73" + integrity sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ== dependencies: ee-first "1.1.1" @@ -1146,10 +1277,10 @@ one-time@^1.0.0: dependencies: fn.name "1.x.x" -p-is-promise@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-3.0.0.tgz#58e78c7dfe2e163cf2a04ff869e7c1dba64a5971" - integrity sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ== +packageurl-js@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/packageurl-js/-/packageurl-js-2.0.1.tgz#a8fa43a64971b5dd0dca5fb904b950a6cc317a6f" + integrity sha512-N5ixXjzTy4QDQH0Q9YFjqIWd6zH6936Djpl2m9QNFmDv5Fum8q8BjkpAcHNMzOFE0IwQrFhJWex3AN6kS0OSwg== parseurl@^1.3.3: version "1.3.3" @@ -1162,42 +1293,44 @@ path-parse@^1.0.7: integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-to-regexp@^8.0.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.0.tgz#8e98fcd94826aff01a90c544ef74ffbaca3a78ed" - integrity sha512-PuseHIvAnz3bjrM2rGJtSgo1zjgxapTLZ7x2pjhzWwlp4SJQgK3f3iZIQwkpEnBaKz6seKBADpM4B4ySkuYypg== + version "8.4.2" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz#795c420c4f7ca45c5b887366f622ee0c9852cccd" + integrity sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA== -picocolors@^1.1.0: +picocolors@^1.1.0, picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.0.4, picomatch@^2.2.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" - integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== - -picomatch@^4.0.2: - version "4.0.4" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.4.tgz#fd6f5e00a143086e074dffe4c924b8fb293b0589" - integrity sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A== +picomatch@^4.0.2, picomatch@^4.0.4: + version "4.0.7" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.7.tgz#6313360034ccb36b3dc61ecbdff78121f90fe21f" + integrity sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA== -playwright-chromium@~1.64.0: - version "1.64.0" - resolved "https://registry.yarnpkg.com/playwright-chromium/-/playwright-chromium-1.64.0.tgz#8280d7916bb7d8b758080e17935cebaaebb3b5aa" - integrity sha512-w56jKvqiCLa0/Nb6BltYER4r89EG0L9v1MI2g7PZV6gGKrRH7oSfwUqMlHBnZ7t6gd6WfFdAg2+rECSNRE43sQ== +playwright-chromium@~1.64.1: + version "1.64.1" + resolved "https://registry.yarnpkg.com/playwright-chromium/-/playwright-chromium-1.64.1.tgz#81aec8925514050c0ac5bc08fa231ed189ab0e86" + integrity sha512-lvAzvvIRtbHaeLwl7XoUkhSNuWHKshbrYv2sjqYgLQS4SsTTwgSTlg9BwU5LeGxYkHxBXTnKtNDEQdZSOj/01g== dependencies: - playwright-core "1.64.0" + playwright-core "1.64.1" -playwright-core@1.64.0, playwright-core@~1.64.0: - version "1.64.0" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.64.0.tgz#a765f91dabd2b2cadd67e87439842c1d6c72c652" - integrity sha512-T9r+MZkTECl2+oUcZ26YgZzTrYidTsIhYYkJix+6iDOymOb1FB2RLLSOxRGnZGv5DStt+aduIVbt+E8WygXYpg== +playwright-core@1.64.1, playwright-core@~1.64.1: + version "1.64.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.64.1.tgz#ca9ec82d7da6ced1b2326ec59ef097aaa9a29f94" + integrity sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ== postinstall-postinstall@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3" integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ== +postject@^1.0.0-alpha.6: + version "1.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/postject/-/postject-1.0.0-alpha.6.tgz#9d022332272e2cfce8dea4cfce1ee6dd1b2ee135" + integrity sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A== + dependencies: + commander "^9.4.0" + prebuild-install@^7.1.1: version "7.1.3" resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.3.tgz#d630abad2b147443f20a212917beae68b8092eec" @@ -1226,7 +1359,7 @@ progress@^2.0.3: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -proxy-addr@^2.0.7: +proxy-addr@^2.0.8: version "2.0.8" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.8.tgz#624e760fd8ab06b1b8320c2f8506d4422cf8e932" integrity sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ== @@ -1234,40 +1367,36 @@ proxy-addr@^2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -pstree.remy@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a" - integrity sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w== - pump@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.3.tgz#151d979f1a29668dc0025ec589a455b53282268d" - integrity sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA== + version "3.0.4" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.4.tgz#1f313430527fa8b905622ebd22fe1444e757ab3c" + integrity sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA== dependencies: end-of-stream "^1.1.0" once "^1.3.1" -qs@^6.14.0: - version "6.14.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.2.tgz#b5634cf9d9ad9898e31fba3504e866e8efb6798c" - integrity sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q== +qs@^6.16.0, qs@^6.16.1: + version "6.16.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.16.1.tgz#0643e17993e551759c85078e1f0bc4b9fe908020" + integrity sha512-5Px6J7rfHBAGUhNQ3es4YzcOdBBw0SDcVtThJml4RdnKw4tKs2epA0kPZ+K8X+WiHktT93RHVcQ/3ym5aTCgtg== dependencies: - side-channel "^1.1.0" + es-define-property "^1.0.1" + side-channel "^1.1.1" range-parser@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + version "1.3.0" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.3.0.tgz#d7f19be812bb62721472b45d3be219ef09572b47" + integrity sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw== -raw-body@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.0.tgz#25b3476f07a51600619dae3fe82ddc28a36e5e0f" - integrity sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g== +raw-body@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.2.tgz#3e3ada5ae5568f9095d84376fd3a49b8fb000a51" + integrity sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA== dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.6.3" - unpipe "1.0.0" + bytes "~3.1.2" + http-errors "~2.0.1" + iconv-lite "~0.7.0" + unpipe "~1.0.0" rc@^1.2.7: version "1.2.8" @@ -1279,7 +1408,7 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.1.4: +readable-stream@^2.0.2, readable-stream@^2.1.4: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -1301,24 +1430,23 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0, readable string_decoder "^1.1.1" util-deprecate "^1.0.1" -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== +resolve.exports@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.4.tgz#49921cfd9cd266053a9699e3f43c8bcbdf964331" + integrity sha512-zepuGL0ulf+nt+XaFrlKeaiTJeyPFPLLY62+ncq1/VTHBdt3HsfXOH60priZ6tnXQozdGcDeIF5JVTanvIcYWQ== + resolve@^1.22.10: - version "1.22.10" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" - integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== + version "1.22.13" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.13.tgz#d542f97758d768f36091251a6b07540b4343f7b5" + integrity sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA== dependencies: - is-core-module "^2.16.0" + es-errors "^1.3.0" + is-core-module "^2.17.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -1333,7 +1461,7 @@ router@^2.2.0: parseurl "^1.3.3" path-to-regexp "^8.0.0" -safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -1353,50 +1481,50 @@ safe-stable-stringify@^2.3.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver@^7.3.5, semver@^7.5.3: - version "7.7.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.4.tgz#28464e36060e991fa7a11d0279d2d3f3b57a7e8a" - integrity sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA== +semver@^7.3.5: + version "7.8.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69" + integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA== send@^1.1.0, send@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/send/-/send-1.2.0.tgz#32a7554fb777b831dfa828370f773a3808d37212" - integrity sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw== + version "1.2.1" + resolved "https://registry.yarnpkg.com/send/-/send-1.2.1.tgz#9eab743b874f3550f40a26867bf286ad60d3f3ed" + integrity sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ== dependencies: - debug "^4.3.5" + debug "^4.4.3" encodeurl "^2.0.0" escape-html "^1.0.3" etag "^1.8.1" fresh "^2.0.0" - http-errors "^2.0.0" - mime-types "^3.0.1" + http-errors "^2.0.1" + mime-types "^3.0.2" ms "^2.1.3" on-finished "^2.4.1" range-parser "^1.2.1" - statuses "^2.0.1" + statuses "^2.0.2" serve-static@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.0.tgz#9c02564ee259bdd2251b82d659a2e7e1938d66f9" - integrity sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ== + version "2.2.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.1.tgz#7f186a4a4e5f5b663ad7a4294ff1bf37cf0e98a9" + integrity sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw== dependencies: encodeurl "^2.0.0" escape-html "^1.0.3" parseurl "^1.3.3" send "^1.2.0" -setprototypeof@1.2.0: +setprototypeof@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== -side-channel-list@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" - integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== +side-channel-list@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.1.tgz#c2e0b5a14a540aebee3bbc6c3f8666cc9b509127" + integrity sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" + object-inspect "^1.13.4" side-channel-map@^1.0.1: version "1.0.1" @@ -1419,14 +1547,14 @@ side-channel-weakmap@^1.0.2: object-inspect "^1.13.3" side-channel-map "^1.0.1" -side-channel@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" - integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== +side-channel@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.1.tgz#ea02c62e05dc4bea67d4442f0fb71ee192f8e0ab" + integrity sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" - side-channel-list "^1.0.0" + object-inspect "^1.13.4" + side-channel-list "^1.0.1" side-channel-map "^1.0.1" side-channel-weakmap "^1.0.2" @@ -1444,31 +1572,46 @@ simple-get@^4.0.0: once "^1.3.1" simple-concat "^1.0.0" -simple-swizzle@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" - integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== +spdx-correct@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== dependencies: - is-arrayish "^0.3.1" + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" -simple-update-notifier@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz#d70b92bdab7d6d90dfd73931195a30b6e3d7cebb" - integrity sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w== +spdx-exceptions@^2.1.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz#5d607d27fc806f66d7b64a766650fa890f04ed66" + integrity sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w== + +spdx-expression-parse@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz#a23af9f3132115465dac215c099303e4ceac5794" + integrity sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== dependencies: - semver "^7.5.3" + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.24" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.24.tgz#550436df9dc7dcf5c29832ceda40256a9b00de3a" + integrity sha512-cLS9TtWkIQFyLkJ3/5aFQAOHOSKTlOs/7WDut/XPSdjom1fJhUdkepeJAKXa9Y05+FabHd0sti+Et559vDtkpQ== stack-trace@0.0.x: version "0.0.10" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg== -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -statuses@^2.0.1: +statuses@^2.0.1, statuses@^2.0.2, statuses@~2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== @@ -1480,6 +1623,15 @@ stream-meter@^1.0.4: dependencies: readable-stream "^2.1.4" +streamx@^2.12.5, streamx@^2.25.0, streamx@^2.28.1: + version "2.28.1" + resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.28.1.tgz#376cd42a089505a69bec0efdb5189aa45586141f" + integrity sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA== + dependencies: + events-universal "^1.0.0" + fast-fifo "^1.3.2" + text-decoder "^1.1.0" + string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -1515,28 +1667,32 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -supports-color@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -tar-fs@^2.0.0, tar-fs@^2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.4.tgz#800824dbf4ef06ded9afea4acafe71c67c76b930" - integrity sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ== +tar-fs@^2.0.0: + version "2.1.5" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.5.tgz#33e9c29413dce0c58ada7ff77db4e5a30afffe70" + integrity sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw== dependencies: chownr "^1.1.1" mkdirp-classic "^0.5.2" pump "^3.0.0" tar-stream "^2.1.4" +tar-fs@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.1.3.tgz#05668cc68a30741c3813f9c16593b8dec7dcbcd1" + integrity sha512-/hU4AXnIdZu+Gvl1pk0oI5f5HxWsCJRtY2aFaJdk9VvyL48DWU6iU5WAIPG+wIi1YvWA6eTJvIviP/tMAZZNwQ== + dependencies: + pump "^3.0.0" + tar-stream "^3.1.5" + optionalDependencies: + bare-fs "^4.0.1" + bare-path "^3.0.0" + tar-stream@^2.1.4: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" @@ -1548,7 +1704,17 @@ tar-stream@^2.1.4: inherits "^2.0.3" readable-stream "^3.1.1" -tar@^7.4.3: +tar-stream@^3.1.5: + version "3.2.2" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.2.2.tgz#aec7f257e712192a177a93aa0450c2e76855c8be" + integrity sha512-+8NeqHRjQWH9nYlwo2gamAMImZCVzI4UoEgDpWorBt9OEfppiZn+uSkskzQKPWIZyji/C8fpWO7u69G0DX0tbg== + dependencies: + b4a "^1.9.0" + bare-fs "^4.8.2" + fast-fifo "^1.3.2" + streamx "^2.28.1" + +tar@^7.5.7: version "7.5.22" resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.22.tgz#a696f998136e71487dc3f869a85bba2c67971ba9" integrity sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA== @@ -1559,41 +1725,38 @@ tar@^7.4.3: minizlib "^3.1.0" yallist "^5.0.0" +teex@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12" + integrity sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg== + dependencies: + streamx "^2.12.5" + +text-decoder@^1.1.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.7.tgz#5d073a9a74b9c0a9d28dfadcab96b604af57d8ba" + integrity sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ== + dependencies: + b4a "^1.6.4" + text-hex@1.0.x: version "1.0.0" resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== tinyglobby@^0.2.11: - version "0.2.14" - resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.14.tgz#5280b0cf3f972b050e74ae88406c0a6a58f4079d" - integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ== + version "0.2.17" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.17.tgz#562a9a6c9eb2b3b123d39719f9af5bb44fcd7631" + integrity sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g== dependencies: - fdir "^6.4.4" - picomatch "^4.0.2" - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" + fdir "^6.5.0" + picomatch "^4.0.4" -toidentifier@1.0.1: +toidentifier@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -touch@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.1.tgz#097a23d7b161476435e5c1344a95c0f75b4a5694" - integrity sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA== - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - triple-beam@^1.3.0, triple-beam@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" @@ -1625,12 +1788,12 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -type-is@^2.0.0, type-is@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.0.1.tgz#64f6cf03f92fce4015c2b224793f6bdd4b068c97" - integrity sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw== +type-is@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.1.0.tgz#71d1a7053293582e16ac9f3ebaf1ab9aa49e5570" + integrity sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA== dependencies: - content-type "^1.0.5" + content-type "^2.0.0" media-typer "^1.1.0" mime-types "^3.0.0" @@ -1639,39 +1802,39 @@ typescript@~5.9.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== -undefsafe@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" - integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== - undici-types@~6.21.0: version "6.21.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== -undici-types@~7.10.0: - version "7.10.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.10.0.tgz#4ac2e058ce56b462b056e629cc6a02393d3ff350" - integrity sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag== +undici-types@~8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.9.0.tgz#e240d97c8b5d85e5347ce73d25865c7906c1ec9f" + integrity sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg== + +undici@^7.28.0: + version "7.30.1" + resolved "https://registry.yarnpkg.com/undici/-/undici-7.30.1.tgz#360b3de104b94abc52729aa1a4a07e027aa71f73" + integrity sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg== universalify@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@1.0.0: +unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== unzipper@^0.12.3: - version "0.12.3" - resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.12.3.tgz#31958f5eed7368ed8f57deae547e5a673e984f87" - integrity sha512-PZ8hTS+AqcGxsaQntl3IRBw65QrBI6lxzqDEL7IAo/XCEqRTKGfOX56Vea5TH9SZczRVxuzk1re04z/YjuYCJA== + version "0.12.5" + resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.12.5.tgz#7fc6b4862f3832202d1f5cc3adbee2679deaaf6c" + integrity sha512-tXYOi9R57Uj/2Z25SOs5RRSzq886MBQj2gY8dPL+xl/kv6s6SvByoKfAtvfVeEuhntWDgjd2o9p2lb4TVPAz0A== dependencies: bluebird "~3.7.2" duplexer2 "~0.1.4" - fs-extra "^11.2.0" + fs-extra "11.3.1" graceful-fs "^4.2.2" node-int64 "^0.4.0" @@ -1685,24 +1848,19 @@ v8-compile-cache-lib@^3.0.1: resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== +validate-npm-package-license@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + vary@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - winston-daily-rotate-file@~5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/winston-daily-rotate-file/-/winston-daily-rotate-file-5.0.0.tgz#8cd94800025490e47c00ec892b655a5821f4266d" @@ -1722,13 +1880,13 @@ winston-transport@^4.7.0, winston-transport@^4.9.0: readable-stream "^3.6.2" triple-beam "^1.3.0" -winston@~3.17.0: - version "3.17.0" - resolved "https://registry.yarnpkg.com/winston/-/winston-3.17.0.tgz#74b8665ce9b4ea7b29d0922cfccf852a08a11423" - integrity sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw== +winston@~3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/winston/-/winston-3.19.0.tgz#cc1d1262f5f45946904085cfffe73efb4b7a581d" + integrity sha512-LZNJgPzfKR+/J3cHkxcpHKpKKvGfDZVPS4hfJCc4cCG0CgYzvlD6yE/S3CIL/Yt91ak327YCpiF/0MyeZHEHKA== dependencies: "@colors/colors" "^1.6.0" - "@dabh/diagnostics" "^2.0.2" + "@dabh/diagnostics" "^2.0.8" async "^3.2.3" is-stream "^2.0.0" logform "^2.7.0" @@ -1769,9 +1927,9 @@ yargs-parser@^20.2.2: integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + version "16.2.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.2.tgz#c56731dca0d2788ae0866dd3c83907d6bab85f7d" + integrity sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w== dependencies: cliui "^7.0.2" escalade "^3.1.1" diff --git a/msa/web-ui/config/logger.ts b/msa/web-ui/config/logger.ts index 65500f9111..3152c1727a 100644 --- a/msa/web-ui/config/logger.ts +++ b/msa/web-ui/config/logger.ts @@ -3,11 +3,10 @@ import config from 'config'; import path from 'path'; import DailyRotateFile from 'winston-daily-rotate-file'; -import { createLogger, format, transports } from 'winston'; -import * as Transport from 'winston-transport'; +import { createLogger, format, transport, transports } from 'winston'; const { combine, timestamp, label, printf, splat } = format; -const loggerTransports: Array = []; +const loggerTransports: Array = []; if (process.env.NODE_ENV !== 'production' || process.env.DOCKER_MODE === 'true') { loggerTransports.push(new transports.Console({ diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index b1f0b82c9e..3053dbe185 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -8,45 +8,37 @@ "scripts": { "pkg": "tsc && pkg -t node22-linux-x64 --output ./target/thingsboard-web-ui-linux ./target/src && pkg -t node22-win-x64 --no-bytecode --public-packages \"*\" --public --output ./target/thingsboard-web-ui-win.exe ./target/src && node install.js", "test": "echo \"Error: no test specified\" && exit 1", - "start": "nodemon --watch '.' --ext 'ts' --exec 'WEB_FOLDER=./target/web ts-node server.ts'", - "start-prod": "nodemon --watch '.' --ext 'ts' --exec 'WEB_FOLDER=./target/web NODE_ENV=production ts-node server.ts'", - "build": "tsc" + "start": "WEB_FOLDER=./target/web node --watch --watch-preserve-output -r ts-node/register server.ts", + "start-prod": "WEB_FOLDER=./target/web NODE_ENV=production node --watch --watch-preserve-output -r ts-node/register server.ts", + "build": "tsc", + "sbom": "node ../../tools/src/main/javascript/yarn-sbom.js target/sbom/tb-web-ui.cdx.json application --all-platforms" }, "dependencies": { "compression": "^1.8.2", - "config": "^3.3.12", - "connect-history-api-fallback": "1.6.0", - "express": "^5.1.0", - "http": "0.0.0", + "config": "^4.4.2", + "connect-history-api-fallback": "^2.0.0", + "express": "^5.3.0", "http-proxy": "^1.18.1", - "js-yaml": "^4.1.1", - "winston": "^3.17.0", + "js-yaml": "^4.3.2", + "winston": "^3.19.0", "winston-daily-rotate-file": "^5.0.0" }, - "nyc": { - "exclude": [ - "test", - "__tests__", - "node_modules", - "target" - ] - }, "devDependencies": { + "@cyclonedx/cyclonedx-library": "10.3.0", "@types/compression": "^1.8.1", - "@types/config": "^3.3.5", "@types/connect-history-api-fallback": "1.5.4", - "@types/express": "~5.0.3", - "@types/http-proxy": "^1.17.16", - "@types/node": "~22.17.2", - "@yao-pkg/pkg": "^6.6.0", - "fs-extra": "^11.3.1", - "nodemon": "^3.1.10", + "@types/express": "~5.0.6", + "@types/http-proxy": "^1.17.17", + "@types/node": "~22.20.5", + "@yao-pkg/pkg": "^6.24.0", + "@yarnpkg/lockfile": "1.1.0", + "fs-extra": "^11.4.1", + "normalize-package-data": "8.0.0", + "packageurl-js": "2.0.1", + "spdx-expression-parse": "4.0.0", "ts-node": "^10.9.2", "typescript": "~5.9.3" }, - "resolutions": { - "@yao-pkg/pkg/tar": ">=7.5.8" - }, "pkg": { "assets": [ "node_modules/config/**/*.*" diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index 5e3d67d99c..02c8d28238 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -32,6 +32,7 @@ ${project.build.directory}/package/linux ${project.build.directory}/package/windows pre-integration-test + @@ -70,7 +71,7 @@ install-node-and-yarn - v22.22.2 + v22.23.4 v1.22.22 @@ -83,6 +84,16 @@ install --non-interactive --check-files --network-concurrency 4 --network-timeout 100000 --mutex network + + generate sbom + + yarn + + + ${sbom.ui.skip} + run sbom pkg:maven/${project.groupId}/${project.artifactId}@${project.version} + + yarn pkg @@ -174,6 +185,10 @@ + + org.codehaus.mojo + build-helper-maven-plugin + org.thingsboard gradle-maven-plugin @@ -218,6 +233,35 @@ + + + org.thingsboard + sbom-maven-plugin + + + sbom-metadata + + ${project.build.directory}/sbom/${pkg.name}.cdx.json + ${skip.ui.build} + + + + image-sbom + + + + ${project.build.directory}/sbom/${pkg.name}.cdx.json + ${pkg.installFolder} + + + ${project.build.directory}/web/META-INF/sbom/ui-ngx.cdx.json + ${pkg.installFolder}/web + + + + + + diff --git a/msa/web-ui/server.ts b/msa/web-ui/server.ts index fcc609ad5a..9aa316e78f 100644 --- a/msa/web-ui/server.ts +++ b/msa/web-ui/server.ts @@ -9,7 +9,7 @@ import httpProxy from 'http-proxy'; import compression from 'compression'; import historyApiFallback from 'connect-history-api-fallback'; import { Socket } from 'net'; -import { RequestHandler } from 'serve-static'; +import { RequestHandler } from 'express'; const logger = _logger('main'); @@ -123,7 +123,7 @@ let connections: Socket[] = []; const staticServe = express.static(root); - const indexHtmlFallback: RequestHandler = (req, res, next) => { + const indexHtmlFallback: RequestHandler = (req, res, next) => { res.sendFile(path.join(root, 'index.html')); }; diff --git a/msa/web-ui/yarn.lock b/msa/web-ui/yarn.lock index ca2d727bf8..70dce9222f 100644 --- a/msa/web-ui/yarn.lock +++ b/msa/web-ui/yarn.lock @@ -2,47 +2,88 @@ # yarn lockfile v1 -"@babel/generator@^7.23.0": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.3.tgz#9626c1741c650cbac39121694a0f2d7451b8ef3e" - integrity sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw== - dependencies: - "@babel/parser" "^7.28.3" - "@babel/types" "^7.28.2" +"@babel/code-frame@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.7.tgz#f2fbbfea87c44a21590ec515b778b2c26d8866e7" + integrity sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw== + dependencies: + "@babel/helper-validator-identifier" "^7.29.7" + js-tokens "^4.0.0" + picocolors "^1.1.1" + +"@babel/generator@^7.23.0", "@babel/generator@^7.29.8": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.8.tgz#4b0b887885422643339e09022148a4c4ebaa4979" + integrity sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg== + dependencies: + "@babel/parser" "^7.29.8" + "@babel/types" "^7.29.8" "@jridgewell/gen-mapping" "^0.3.12" "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== - -"@babel/helper-validator-identifier@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" - integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== - -"@babel/parser@^7.23.0", "@babel/parser@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.3.tgz#d2d25b814621bca5fe9d172bc93792547e7a2a71" - integrity sha512-7+Ey1mAgYqFAx2h0RuoxcQT5+MlG3GTV0TQrgr7/ZliKsm/MNDxVVutlWaziMq7wJNAz8MTqz55XLpWvva6StA== - dependencies: - "@babel/types" "^7.28.2" - -"@babel/types@^7.23.0", "@babel/types@^7.28.2": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.2.tgz#da9db0856a9a88e0a13b019881d7513588cf712b" - integrity sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ== - dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - -"@colors/colors@1.6.0", "@colors/colors@^1.6.0": +"@babel/helper-globals@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.29.7.tgz#f04a96fbd8473241b1079243f5b3f03a3010ab7b" + integrity sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA== + +"@babel/helper-string-parser@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz#7f0871d99824d23137d60f86fcf6130fd5a1b51f" + integrity sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw== + +"@babel/helper-validator-identifier@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz#bd87084ced0c796ec46bda492de6e83d29e89fc2" + integrity sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg== + +"@babel/parser@^7.23.0", "@babel/parser@^7.29.7", "@babel/parser@^7.29.8", "@babel/parser@^7.29.9": + version "7.29.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.9.tgz#e7ee0a24f752c5296c6455855ccb72662e67ea96" + integrity sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA== + dependencies: + "@babel/types" "^7.29.8" + +"@babel/template@^7.29.7": + version "7.29.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.29.7.tgz#4d9d4004f645cdd304de958c725162784ecac700" + integrity sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/parser" "^7.29.7" + "@babel/types" "^7.29.7" + +"@babel/traverse@^7.23.0": + version "7.29.10" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.10.tgz#08ab387639b4a67304511259c7da6cf23a82e91c" + integrity sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ== + dependencies: + "@babel/code-frame" "^7.29.7" + "@babel/generator" "^7.29.8" + "@babel/helper-globals" "^7.29.7" + "@babel/parser" "^7.29.9" + "@babel/template" "^7.29.7" + "@babel/types" "^7.29.8" + debug "^4.3.1" + +"@babel/types@^7.23.0", "@babel/types@^7.29.7", "@babel/types@^7.29.8": + version "7.29.8" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.8.tgz#1229eef31d85156d70fa3f4cd859376d0eaf6863" + integrity sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg== + dependencies: + "@babel/helper-string-parser" "^7.29.7" + "@babel/helper-validator-identifier" "^7.29.7" + +"@colors/colors@1.6.0": version "1.6.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.0.tgz#ec6cd237440700bc23ca23087f513c75508958b0" integrity sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA== +"@colors/colors@^1.6.0": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.6.1.tgz#8e2827259ada76965b3a051c18a5927fbdac38c2" + integrity sha512-dTmUJzXSuayBK+hZydEaXd2mhx61qWQwkwaBBY6LyEOVx/L9aQU5ac8eFNEsd9nrD1+zb9zvDCphLSe8g1F4Qw== + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -50,15 +91,150 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@dabh/diagnostics@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a" - integrity sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA== +"@cyclonedx/cyclonedx-library@10.3.0": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@cyclonedx/cyclonedx-library/-/cyclonedx-library-10.3.0.tgz#92ccd1553d64d7c593b1adc31203cba01583d3df" + integrity sha512-RIT28sp1U0PCHaaeF3yNRwk6Jig/XJ8UsYAVOMYaHQ+0VVOvsjcp0PTWQFLUqJFF8XMud+Kdq6G+wtDAh+QJFA== + +"@dabh/diagnostics@^2.0.8": + version "2.0.9" + resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.9.tgz#0de9e8718e23ab60d1fb1ce0c004079f14f5ad36" + integrity sha512-R6siwR65Hm+3yfgP7o8DKhNvputQAwfoz9zTc3kyDudnomj2/BcLmD+uGQQPICjuFUp8ounPBU+jmKsocwVVAg== dependencies: - colorspace "1.1.x" + "@so-ric/colorspace" "^1.1.6" enabled "2.0.x" kuler "^2.0.0" +"@esbuild/aix-ppc64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz#bf6e10303bcf2e7c686975fa52f937ec2728d8bc" + integrity sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ== + +"@esbuild/android-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz#0c6246bc8d2c4d172aac2db3fb1190d72bd65504" + integrity sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A== + +"@esbuild/android-arm@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.28.2.tgz#2d84ece6a4e2684d92be26ee13d42757d831c381" + integrity sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg== + +"@esbuild/android-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.28.2.tgz#fc38d4d6358d8dc1cf53f09f7589fe436eb64801" + integrity sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q== + +"@esbuild/darwin-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz#f83afeeac1d7dac01c7a2fd012b3e451a0591fcc" + integrity sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw== + +"@esbuild/darwin-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz#510147c055a795588dbbe14fd6b1b8ad0a2f30de" + integrity sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw== + +"@esbuild/freebsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz#093b9200ecf0b115ba4e5e248a7485c9c5f8bd5e" + integrity sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw== + +"@esbuild/freebsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz#0be22b6df925d213e841ea87123af5df80b0faf7" + integrity sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg== + +"@esbuild/linux-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz#1bdbc651cda9ba9995c53ed9c71ceaa65094762d" + integrity sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug== + +"@esbuild/linux-arm@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz#beb12ad72b84f72d28488cc1b8ee9f7eb141d753" + integrity sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w== + +"@esbuild/linux-ia32@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz#b81f9d55529b45c206a46a138214b1aa6879696b" + integrity sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ== + +"@esbuild/linux-loong64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz#598667241a04c99b76ed6ef940ac50038c419f98" + integrity sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ== + +"@esbuild/linux-mips64el@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz#1c51eb9cea903f53d97b5af3b1841db70f5596ca" + integrity sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA== + +"@esbuild/linux-ppc64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz#63dd61f17ceb31a81227f413feac8a71bc2c51f2" + integrity sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ== + +"@esbuild/linux-riscv64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz#3763b08fde5cf25ab1facb8e7752edfe45fbfc27" + integrity sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA== + +"@esbuild/linux-s390x@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz#1a137ff293a82906eb3176385bd7e8e0e5cfb7cb" + integrity sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg== + +"@esbuild/linux-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz#268b36211c146ca54f8fe12c578a8d6ef8979485" + integrity sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ== + +"@esbuild/netbsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz#22571ad951d62bb6accc82d8d1fad5c8c1ac0ba1" + integrity sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw== + +"@esbuild/netbsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz#42fcc57297eb0a0ca3f5fc475291f4c1a3f7c0de" + integrity sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw== + +"@esbuild/openbsd-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz#9eb32af104ac3dacf4edca01f596664aab0c73ef" + integrity sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ== + +"@esbuild/openbsd-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz#febed2402d6088225e91f20fb4ce2522ad0a4efd" + integrity sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw== + +"@esbuild/openharmony-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz#85641c3d466428bfbccea5f21c26836663fef5ce" + integrity sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q== + +"@esbuild/sunos-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz#a736f9d8962481045fc4c3e54f5479f22c870fb4" + integrity sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g== + +"@esbuild/win32-arm64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz#ee5ab40fad186201b652a33f8a5eb149e9e42532" + integrity sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ== + +"@esbuild/win32-ia32@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz#c40d28a6d99a127da6711f2afd74b11cb63b06a7" + integrity sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA== + +"@esbuild/win32-x64@0.28.2": + version "0.28.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz#b21affb804cc167c133d95f45b3a1dc1323b9a87" + integrity sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g== + "@isaacs/fs-minipass@^4.0.0": version "4.0.1" resolved "https://registry.yarnpkg.com/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz#2d59ae3ab4b38fb4270bfa23d30f8e2e86c7fe32" @@ -80,9 +256,9 @@ integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": - version "1.5.5" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" - integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== + version "1.6.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz#f4c663e862f06dc98ca4d453862c46902789a18d" + integrity sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw== "@jridgewell/trace-mapping@0.3.9": version "0.3.9" @@ -93,17 +269,30 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.28": - version "0.3.30" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.30.tgz#4a76c4daeee5df09f5d3940e087442fb36ce2b99" - integrity sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q== + version "0.3.31" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" + integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@roberts_lando/vfs@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@roberts_lando/vfs/-/vfs-0.3.3.tgz#6359feed30e3773041279cb11be82ca60f4ff1f1" + integrity sha512-YjkxVSLw5WMZQoARaryRAjcxA+GbBzWMJdwYZX5oLUt9cC/gew9as4Dn7tcLzPp7BPoR221VpTZ+78TRPawnjg== + +"@so-ric/colorspace@^1.1.6": + version "1.1.6" + resolved "https://registry.yarnpkg.com/@so-ric/colorspace/-/colorspace-1.1.6.tgz#62515d8b9f27746b76950a83bde1af812d91923b" + integrity sha512-/KiKkpHNOBgkFJwu9sh48LkHSMYGyuTcSFK/qMBdnOAlrRJzRSXAOFB5qwzaVQuDl8wAvHVMkaASQDReTahxuw== + dependencies: + color "^5.0.2" + text-hex "1.0.x" + "@tsconfig/node10@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" - integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== + version "1.0.13" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.13.tgz#56105a9a8c786e8f15e35746879cf2d52275485b" + integrity sha512-gcLdvR9HO1ZJBypsOGqaP6TFEzb6vIta0KSTLt9NAQ6pXQO3cRgSVyCN6pzYqI9DlJgY71XKO0dpDhCf08b3pg== "@tsconfig/node12@^1.0.7": version "1.0.11" @@ -136,11 +325,6 @@ "@types/express" "*" "@types/node" "*" -"@types/config@^3.3.5": - version "3.3.5" - resolved "https://registry.yarnpkg.com/@types/config/-/config-3.3.5.tgz#91f0a52b10212b9c4254fb0bbc4bedd77cd389b8" - integrity sha512-itq2HtXQBrNUKwMNZnb9mBRE3T99VYCdl1gjST9rq+9kFaB1iMMGuDeZnP88qid73DnpAMKH9ZolqDpS1Lz7+w== - "@types/connect-history-api-fallback@1.5.4": version "1.5.4" resolved "https://registry.yarnpkg.com/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz#7de71645a103056b48ac3ce07b3520b819c1d5b3" @@ -157,59 +341,54 @@ "@types/node" "*" "@types/express-serve-static-core@*", "@types/express-serve-static-core@^5.0.0": - version "5.0.7" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.0.7.tgz#2fa94879c9d46b11a5df4c74ac75befd6b283de6" - integrity sha512-R+33OsgWw7rOhD1emjU7dzCDHucJrgJXMA5PYCzJxVil0dsyx5iBEPHqpPfiKNJQb7lZ1vxwoLR4Z87bBUpeGQ== + version "5.1.3" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-5.1.3.tgz#9d34c88c0c9ee62b9a6e4d9f8ab8d7e29688e6b4" + integrity sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw== dependencies: "@types/node" "*" "@types/qs" "*" "@types/range-parser" "*" "@types/send" "*" -"@types/express@*", "@types/express@~5.0.3": - version "5.0.3" - resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.3.tgz#6c4bc6acddc2e2a587142e1d8be0bce20757e956" - integrity sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw== +"@types/express@*", "@types/express@~5.0.6": + version "5.0.6" + resolved "https://registry.yarnpkg.com/@types/express/-/express-5.0.6.tgz#2d724b2c990dcb8c8444063f3580a903f6d500cc" + integrity sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA== dependencies: "@types/body-parser" "*" "@types/express-serve-static-core" "^5.0.0" - "@types/serve-static" "*" + "@types/serve-static" "^2" "@types/http-errors@*": version "2.0.5" resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.5.tgz#5b749ab2b16ba113423feb1a64a95dcd30398472" integrity sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg== -"@types/http-proxy@^1.17.16": - version "1.17.16" - resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.16.tgz#dee360707b35b3cc85afcde89ffeebff7d7f9240" - integrity sha512-sdWoUajOB1cd0A8cRRQ1cfyWNbmFKLAqBB89Y8x5iYyG/mkJHc0YUH8pdWBy2omi9qtCpiIgGjuwO0dQST2l5w== +"@types/http-proxy@^1.17.17": + version "1.17.17" + resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.17.tgz#d9e2c4571fe3507343cb210cd41790375e59a533" + integrity sha512-ED6LB+Z1AVylNTu7hdzuBqOgMnvG/ld6wGCG8wFnAzKX5uyW2K3WD52v0gnLCTK/VLpXtKckgWuyScYK6cSPaw== dependencies: "@types/node" "*" -"@types/mime@^1": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" - integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== - "@types/node@*": - version "24.3.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.3.0.tgz#89b09f45cb9a8ee69466f18ee5864e4c3eb84dec" - integrity sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow== + version "26.6.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.6.5.tgz#cb35209e7767c503551b5fa42a48231c7441d979" + integrity sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg== dependencies: - undici-types "~7.10.0" + undici-types "~8.9.0" -"@types/node@~22.17.2": - version "22.17.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.17.2.tgz#47a93d6f4b79327da63af727e7c54e8cab8c4d33" - integrity sha512-gL6z5N9Jm9mhY+U2KXZpteb+09zyffliRkZyZOHODGATyC5B1Jt/7TzuuiLkFsSUMLbS1OLmlj/E+/3KF4Q/4w== +"@types/node@~22.20.5": + version "22.20.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.20.5.tgz#afa7bde6da81b8b83ea4e2f020487e9b148c11fd" + integrity sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA== dependencies: undici-types "~6.21.0" "@types/qs@*": - version "6.14.0" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.14.0.tgz#d8b60cecf62f2db0fb68e5e006077b9178b85de5" - integrity sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ== + version "6.15.1" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.15.1.tgz#8606884272c63f0db96986bd3548650d8a9388bf" + integrity sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw== "@types/range-parser@*": version "1.2.7" @@ -217,61 +396,67 @@ integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== "@types/send@*": - version "0.17.5" - resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.5.tgz#d991d4f2b16f2b1ef497131f00a9114290791e74" - integrity sha512-z6F2D3cOStZvuk2SaP6YrwkNO65iTZcwA2ZkSABegdkAh/lf+Aa/YQndZVfmEXT5vgAp6zv06VQ3ejSVjAny4w== + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/send/-/send-1.2.1.tgz#6a784e45543c18c774c049bff6d3dbaf045c9c74" + integrity sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ== dependencies: - "@types/mime" "^1" "@types/node" "*" -"@types/serve-static@*": - version "1.15.8" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.8.tgz#8180c3fbe4a70e8f00b9f70b9ba7f08f35987877" - integrity sha512-roei0UY3LhpOJvjbIP6ZZFngyLKl5dskOtDhxY5THRSpO+ZI+nzJ+m5yUMzGrp89YRa7lvknKkMYjqQFGwA7Sg== +"@types/serve-static@^2": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-2.2.0.tgz#d4a447503ead0d1671132d1ab6bd58b805d8de6a" + integrity sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ== dependencies: "@types/http-errors" "*" "@types/node" "*" - "@types/send" "*" "@types/triple-beam@^1.3.2": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c" integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw== -"@yao-pkg/pkg-fetch@3.5.24": - version "3.5.24" - resolved "https://registry.yarnpkg.com/@yao-pkg/pkg-fetch/-/pkg-fetch-3.5.24.tgz#37a671f077fe6446aec0758e6fc7961d183c3445" - integrity sha512-FPESCH1uXCYui6jeDp2aayWuFHR39w+uU1r88nI6JWRvPYOU64cHPUV/p6GSFoQdpna7ip92HnrZKbBC60l0gA== +"@yao-pkg/pkg-fetch@3.6.7": + version "3.6.7" + resolved "https://registry.yarnpkg.com/@yao-pkg/pkg-fetch/-/pkg-fetch-3.6.7.tgz#5fb8a55031846ef105efeaf4beae0d4f4ed47540" + integrity sha512-uEeU5druVgHffruTAXzW6nf0wHfREWlCq5LBtQ4hCdLBDbwTteuym5NrxREur3EgNcqFRenEi6Rivwo723PkHg== dependencies: - https-proxy-agent "^5.0.0" - node-fetch "^2.6.6" picocolors "^1.1.0" progress "^2.0.3" semver "^7.3.5" - tar-fs "^2.1.1" + tar-fs "^3.1.1" + undici "^7.28.0" yargs "^16.2.0" -"@yao-pkg/pkg@^6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@yao-pkg/pkg/-/pkg-6.6.0.tgz#e8c38ed5824381c676e6688f93e27f39e1752701" - integrity sha512-3/oiaSm7fS0Fc7dzp22r9B7vFaguGhO9vERgEReRYj2EUzdi5ssyYhe1uYJG4ec/dmo2GG6RRHOUAT8savl79Q== +"@yao-pkg/pkg@^6.24.0": + version "6.24.0" + resolved "https://registry.yarnpkg.com/@yao-pkg/pkg/-/pkg-6.24.0.tgz#c556d2e98e8ac437ac7f08065accec8595a13b98" + integrity sha512-SMwFLic12noHLbqxhhQVClVX6YZlQtzwwez6dq7Xj64rXX6OFgZTTQbPgw4wgec5IoUN+6rCRKgyW/cnVPOwkA== dependencies: "@babel/generator" "^7.23.0" "@babel/parser" "^7.23.0" + "@babel/traverse" "^7.23.0" "@babel/types" "^7.23.0" - "@yao-pkg/pkg-fetch" "3.5.24" - into-stream "^6.0.0" - minimist "^1.2.6" + "@roberts_lando/vfs" "^0.3.3" + "@yao-pkg/pkg-fetch" "3.6.7" + esbuild "^0.28.1" + into-stream "^9.1.0" multistream "^4.1.0" picocolors "^1.1.0" picomatch "^4.0.2" + postject "^1.0.0-alpha.6" prebuild-install "^7.1.1" resolve "^1.22.10" + resolve.exports "^2.0.3" stream-meter "^1.0.4" - tar "^7.4.3" + tar "^7.5.7" tinyglobby "^0.2.11" unzipper "^0.12.3" +"@yarnpkg/lockfile@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" + integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== + accepts@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/accepts/-/accepts-2.0.0.tgz#bbcf4ba5075467f3f2131eab3cffc73c2f5d7895" @@ -281,23 +466,16 @@ accepts@^2.0.0: negotiator "^1.0.0" acorn-walk@^8.1.1: - version "8.3.4" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" - integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + version "8.3.5" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.5.tgz#8a6b8ca8fc5b34685af15dabb44118663c296496" + integrity sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw== dependencies: acorn "^8.11.0" acorn@^8.11.0, acorn@^8.4.1: - version "8.15.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" - integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" + version "8.19.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.19.0.tgz#6b26fd97ce1cc9dc50bdf7ad305e9f1384d4f28a" + integrity sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw== ansi-regex@^5.0.1: version "5.0.1" @@ -311,14 +489,6 @@ ansi-styles@^4.0.0: dependencies: color-convert "^2.0.1" -anymatch@~3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" @@ -334,21 +504,53 @@ async@^3.2.3: resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +b4a@^1.6.4, b4a@^1.8.1, b4a@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.9.0.tgz#6336313b6e76b299c397afa68676ec6ebc788845" + integrity sha512-dpfcF9fDNR6++cthXR67iyhgqWy9CBouAvIWhIntzBG6cvK/cnIPiZQjBwi/ZqjjBEDGfoNDtmB0kTjroOJ3pQ== + +bare-events@^2.5.4, bare-events@^2.7.0: + version "2.9.2" + resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.9.2.tgz#01d377b64c3c7167b28b52da7add3221aecf2d7f" + integrity sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA== + +bare-fs@^4.0.1, bare-fs@^4.8.2: + version "4.8.4" + resolved "https://registry.yarnpkg.com/bare-fs/-/bare-fs-4.8.4.tgz#f342288e7e5d9d8e79917078e1f45950507828c5" + integrity sha512-MPC2eyrpbk3A873sK4y6rk+Iv4o2enxTjHZ8zH3HO0mjrpm5XjnguY2XmfidIsDV6vnjpbMBKUAJpV0ISD2SsQ== + dependencies: + bare-events "^2.5.4" + bare-path "^3.0.0" + bare-stream "^2.6.4" + bare-url "^2.2.2" + fast-fifo "^1.3.2" + +bare-path@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-3.1.2.tgz#67261bc74a9ba0105ba139b8638f218c09e8d82e" + integrity sha512-ZyKbsuuqK6Ag0K8pX6V5Txq6XeJRvY+wXucnFGRjiyVYP9YWDpIQugk/b+enRYrEYBJaqLzghRQpXPMR7341Nw== + +bare-stream@^2.6.4: + version "2.13.4" + resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.13.4.tgz#61d448a268d1efd992103aae6bd729332f278ac0" + integrity sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA== + dependencies: + b4a "^1.8.1" + streamx "^2.25.0" + teex "^1.0.1" + +bare-url@^2.2.2: + version "2.5.5" + resolved "https://registry.yarnpkg.com/bare-url/-/bare-url-2.5.5.tgz#2e8c18db11393aa6cae6ff246fdcda34615aacd3" + integrity sha512-iM9qJCruvpt2rPaLsrumVDru9pogI7PHziHIa9kTNRFt8C8HuSa+kI9kFezK+NvHEFnnz71rKGZ1EAilq/3V/Q== + dependencies: + bare-path "^3.0.0" base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -binary-extensions@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" - integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== - bl@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -363,35 +565,20 @@ bluebird@~3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -body-parser@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-2.2.0.tgz#f7a9656de305249a715b549b7b8fd1ab9dfddcfa" - integrity sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg== +body-parser@^2.3.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-2.4.0.tgz#337a76249270f83e450ad385a9606ca3b4a75c06" + integrity sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ== dependencies: bytes "^3.1.2" - content-type "^1.0.5" - debug "^4.4.0" - http-errors "^2.0.0" - iconv-lite "^0.6.3" + content-type "^2.1.0" + debug "^4.4.3" + http-errors "^2.0.1" + iconv-lite "^0.7.3" on-finished "^2.4.1" - qs "^6.14.0" - raw-body "^3.0.0" - type-is "^2.0.0" - -brace-expansion@^1.1.7: - version "1.1.18" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.18.tgz#3ce74d89885136be1535341f8c3d4425c29a5cab" - integrity sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@~3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" - integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== - dependencies: - fill-range "^7.1.1" + qs "^6.16.1" + raw-body "^3.0.2" + type-is "^2.1.0" buffer@^5.5.0: version "5.7.1" @@ -401,7 +588,7 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" -bytes@3.1.2, bytes@^3.1.2: +bytes@3.1.2, bytes@^3.1.2, bytes@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== @@ -422,21 +609,6 @@ call-bound@^1.0.2: call-bind-apply-helpers "^1.0.2" get-intrinsic "^1.3.0" -chokidar@^3.5.2: - version "3.6.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" - integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -456,13 +628,6 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" -color-convert@^1.9.3: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - color-convert@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" @@ -470,39 +635,42 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-convert@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-3.1.3.tgz#db6627b97181cb8facdfce755ae26f97ab0711f1" + integrity sha512-fasDH2ont2GqF5HpyO4w0+BcewlhHEZOFn9c1ckZdHpJ56Qb7MHhH/IcJZbBGgvdtwdwNbLvxiBEdg336iA9Sg== + dependencies: + color-name "^2.0.0" -color-name@^1.0.0, color-name@~1.1.4: +color-name@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-2.1.1.tgz#86c00ec98db36705be5bd4428097f13af1175a6d" + integrity sha512-p2FdgwVx1a9yWBHP2wI0VgShkDpgN4kZISkxdNipGBJWpa5G6b04OINlVWCyJj0JmfvcPrgqt95E9k8yvaOJFg== + +color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -color-string@^1.6.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" - integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== +color-string@^2.1.3: + version "2.1.4" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-2.1.4.tgz#9dcf566ff976e23368c8bd673f5c35103ab41058" + integrity sha512-Bb6Cq8oq0IjDOe8wJmi4JeNn763Xs9cfrBcaylK1tPypWzyoy2G3l90v9k64kjphl/ZJjPIShFztenRomi8WTg== dependencies: - color-name "^1.0.0" - simple-swizzle "^0.2.2" + color-name "^2.0.0" -color@^3.1.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/color/-/color-3.2.1.tgz#3544dc198caf4490c3ecc9a790b54fe9ff45e164" - integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA== +color@^5.0.2: + version "5.0.3" + resolved "https://registry.yarnpkg.com/color/-/color-5.0.3.tgz#f79390b1b778e222ffbb54304d3dbeaef633f97f" + integrity sha512-ezmVcLR3xAVp8kYOm4GS45ZLLgIE6SPAFoduLr6hTDajwb3KZ2F46gulK3XpcwRFb5KKGCSezCBAY4Dw4HsyXA== dependencies: - color-convert "^1.9.3" - color-string "^1.6.0" + color-convert "^3.1.3" + color-string "^2.1.3" -colorspace@1.1.x: - version "1.1.4" - resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.4.tgz#8d442d1186152f60453bf8070cd66eb364e59243" - integrity sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w== - dependencies: - color "^3.1.3" - text-hex "1.0.x" +commander@^9.4.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" + integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== compressible@~2.0.18: version "2.0.18" @@ -525,34 +693,27 @@ compression@^1.8.2: safe-buffer "5.2.1" vary "~1.1.2" -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -config@^3.3.12: - version "3.3.12" - resolved "https://registry.yarnpkg.com/config/-/config-3.3.12.tgz#a10ae66efcc3e48c1879fbb657c86c4ef6c7b25e" - integrity sha512-Vmx389R/QVM3foxqBzXO8t2tUikYZP64Q6vQxGrsMpREeJc/aWRnPRERXWsYzOHAumx/AOoILWe6nU3ZJL+6Sw== +config@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/config/-/config-4.4.2.tgz#adab67a87fcb5f84edcacb3f159ccdb31ad8b901" + integrity sha512-5HJD7TX70gOG2dAd72eDjDeSTYn6D8nOiKgysQQS8mRUo9X1wDtlzb1JlmIWkP+sM9zKRVdYJxmj+qmCsYu6DQ== dependencies: json5 "^2.2.3" -connect-history-api-fallback@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" - integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== +connect-history-api-fallback@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz#647264845251a0daf25b97ce87834cace0f5f1c8" + integrity sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA== -content-disposition@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-1.0.0.tgz#844426cb398f934caefcbb172200126bc7ceace2" - integrity sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg== - dependencies: - safe-buffer "5.2.1" +content-disposition@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-2.0.1.tgz#88a75c7a52ef9c407c96035fe83a66939c2a4dc9" + integrity sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog== -content-type@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== +content-type@^2.0.0, content-type@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-2.1.0.tgz#d9389c43c0a8cf6a355db464d21e07092a40493a" + integrity sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag== cookie-signature@^1.2.1: version "1.2.2" @@ -581,10 +742,10 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4, debug@^4.3.5, debug@^4.4.0: - version "4.4.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" - integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== +debug@^4.3.1, debug@^4.4.0, debug@^4.4.3: + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== dependencies: ms "^2.1.3" @@ -600,7 +761,7 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -depd@2.0.0, depd@^2.0.0: +depd@^2.0.0, depd@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== @@ -611,14 +772,14 @@ destroy@1.2.0: integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== detect-libc@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.4.tgz#f04715b8ba815e53b4d8109655b6508a6865a7e8" - integrity sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA== + version "2.1.2" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad" + integrity sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ== diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + version "4.0.4" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.4.tgz#7a6dbfda325f25f07517e9b518f897c08332e07d" + integrity sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ== dunder-proto@^1.0.1: version "1.0.1" @@ -674,12 +835,44 @@ es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz#a2d0b373205724dfa525d23b0c3e1b1ca582c99b" + integrity sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw== dependencies: es-errors "^1.3.0" +esbuild@^0.28.1: + version "0.28.2" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.28.2.tgz#0f43bd1bad955b72d24e2261e3abe5957ccf0816" + integrity sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA== + optionalDependencies: + "@esbuild/aix-ppc64" "0.28.2" + "@esbuild/android-arm" "0.28.2" + "@esbuild/android-arm64" "0.28.2" + "@esbuild/android-x64" "0.28.2" + "@esbuild/darwin-arm64" "0.28.2" + "@esbuild/darwin-x64" "0.28.2" + "@esbuild/freebsd-arm64" "0.28.2" + "@esbuild/freebsd-x64" "0.28.2" + "@esbuild/linux-arm" "0.28.2" + "@esbuild/linux-arm64" "0.28.2" + "@esbuild/linux-ia32" "0.28.2" + "@esbuild/linux-loong64" "0.28.2" + "@esbuild/linux-mips64el" "0.28.2" + "@esbuild/linux-ppc64" "0.28.2" + "@esbuild/linux-riscv64" "0.28.2" + "@esbuild/linux-s390x" "0.28.2" + "@esbuild/linux-x64" "0.28.2" + "@esbuild/netbsd-arm64" "0.28.2" + "@esbuild/netbsd-x64" "0.28.2" + "@esbuild/openbsd-arm64" "0.28.2" + "@esbuild/openbsd-x64" "0.28.2" + "@esbuild/openharmony-arm64" "0.28.2" + "@esbuild/sunos-x64" "0.28.2" + "@esbuild/win32-arm64" "0.28.2" + "@esbuild/win32-ia32" "0.28.2" + "@esbuild/win32-x64" "0.28.2" + escalade@^3.1.1: version "3.2.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" @@ -700,23 +893,31 @@ eventemitter3@^4.0.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== +events-universal@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/events-universal/-/events-universal-1.0.1.tgz#b56a84fd611b6610e0a2d0f09f80fdf931e2dfe6" + integrity sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw== + dependencies: + bare-events "^2.7.0" + expand-template@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== -express@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/express/-/express-5.1.0.tgz#d31beaf715a0016f0d53f47d3b4d7acf28c75cc9" - integrity sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA== +express@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/express/-/express-5.3.0.tgz#ab72dace89c50c8417bd3f865dad0b4fd1ca1c73" + integrity sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g== dependencies: accepts "^2.0.0" - body-parser "^2.2.0" - content-disposition "^1.0.0" - content-type "^1.0.5" + body-parser "^2.3.0" + content-disposition "^2.0.1" + content-type "^2.0.0" cookie "^0.7.1" cookie-signature "^1.2.1" debug "^4.4.0" + depd "^2.0.0" encodeurl "^2.0.0" escape-html "^1.0.3" etag "^1.8.1" @@ -728,17 +929,22 @@ express@^5.1.0: on-finished "^2.4.1" once "^1.4.0" parseurl "^1.3.3" - proxy-addr "^2.0.7" - qs "^6.14.0" + proxy-addr "^2.0.8" + qs "^6.16.0" range-parser "^1.2.1" router "^2.2.0" send "^1.1.0" serve-static "^2.2.0" statuses "^2.0.1" - type-is "^2.0.1" + type-is "^2.1.0" vary "^1.1.2" -fdir@^6.4.4: +fast-fifo@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" + integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== + +fdir@^6.5.0: version "6.5.0" resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.5.0.tgz#ed2ab967a331ade62f18d077dae192684d50d350" integrity sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg== @@ -755,17 +961,10 @@ file-stream-rotator@^0.6.1: dependencies: moment "^2.29.1" -fill-range@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" - integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== - dependencies: - to-regex-range "^5.0.1" - finalhandler@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-2.1.0.tgz#72306373aa89d05a8242ed569ed86a1bff7c561f" - integrity sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q== + version "2.1.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-2.1.1.tgz#a2c517a6559852bcdb06d1f8bd7f51b68fad8099" + integrity sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA== dependencies: debug "^4.4.0" encodeurl "^2.0.0" @@ -780,9 +979,9 @@ fn.name@1.x.x: integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== follow-redirects@^1.0.0: - version "1.16.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.0.tgz#28474a159d3b9d11ef62050a14ed60e4df6d61bc" - integrity sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw== + version "1.16.3" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.3.tgz#62b60932427f616327014a5e401e8fc5e9027e9b" + integrity sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A== forwarded@0.2.0: version "0.2.0" @@ -794,20 +993,12 @@ fresh@^2.0.0: resolved "https://registry.yarnpkg.com/fresh/-/fresh-2.0.0.tgz#8dd7df6a1b3a1b3a5cf186c05a5dd267622635a4" integrity sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A== -from2@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - integrity sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g== - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.0" - fs-constants@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^11.2.0, fs-extra@^11.3.1: +fs-extra@11.3.1: version "11.3.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.3.1.tgz#ba7a1f97a85f94c6db2e52ff69570db3671d5a74" integrity sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g== @@ -816,10 +1007,14 @@ fs-extra@^11.2.0, fs-extra@^11.3.1: jsonfile "^6.0.1" universalify "^2.0.0" -fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== +fs-extra@^11.4.1: + version "11.4.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.4.1.tgz#6a01ca80008eacf3ca1ffde5ef79088f68203a5a" + integrity sha512-KYAb4c9BJQI6QqGKthV68OHe0badztdXJWKo0WtBA9IuCFPTKvE5ZdUBglP833aMjhaSPNO4A5j/EkzZtGlKjA== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" function-bind@^1.1.2: version "1.1.2" @@ -860,13 +1055,6 @@ github-from-package@0.0.0: resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== -glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" @@ -877,33 +1065,35 @@ graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - has-symbols@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== +hasown@^2.0.2, hasown@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.4.tgz#8c62d8cb90beb2aad5d0a5b67581ad9854c3f003" + integrity sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A== dependencies: function-bind "^1.1.2" -http-errors@2.0.0, http-errors@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" - integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== +hosted-git-info@^9.0.0: + version "9.0.3" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-9.0.3.tgz#637b511ce62a28e4261a92b8da0a4d6be3522cd4" + integrity sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg== dependencies: - depd "2.0.0" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses "2.0.1" - toidentifier "1.0.1" + lru-cache "^11.1.0" + +http-errors@^2.0.0, http-errors@^2.0.1, http-errors@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.1.tgz#36d2f65bc909c8790018dd36fb4d93da6caae06b" + integrity sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ== + dependencies: + depd "~2.0.0" + inherits "~2.0.4" + setprototypeof "~1.2.0" + statuses "~2.0.2" + toidentifier "~1.0.1" http-proxy@^1.18.1: version "1.18.1" @@ -914,23 +1104,10 @@ http-proxy@^1.18.1: follow-redirects "^1.0.0" requires-port "^1.0.0" -http@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/http/-/http-0.0.0.tgz#86e6326d29c5d039de9fac584a45689f929f4f72" - integrity sha512-epOGLlKUFT+yxfK9TqXRe7l6CbOk7mbLvzVqAyI05w0xIn+nXcYo0vR4ZBCVJYOyUglOFwtaIbD3d2TmG5ejJQ== - -https-proxy-agent@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== - dependencies: - agent-base "6" - debug "4" - -iconv-lite@0.6.3, iconv-lite@^0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== +iconv-lite@^0.7.3, iconv-lite@~0.7.0: + version "0.7.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.7.3.tgz#84ee12f963e7de50bc01a13e160a078b3b0f415f" + integrity sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ== dependencies: safer-buffer ">= 2.1.2 < 3.0.0" @@ -939,12 +1116,7 @@ ieee754@^1.1.13: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore-by-default@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" - integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA== - -inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -954,60 +1126,28 @@ ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -into-stream@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-6.0.0.tgz#4bfc1244c0128224e18b8870e85b2de8e66c6702" - integrity sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA== - dependencies: - from2 "^2.3.0" - p-is-promise "^3.0.0" +into-stream@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-9.1.0.tgz#3d49f8dc3aa44c9d5e6007cc07831388542a1326" + integrity sha512-DRsRnQrbzdFjaQ1oe4C6/EIUymIOEix1qROEJTF9dbMq+M4Zrm6VaLp6SD/B9IsiEjPZuBSnWWFN+udajugdWA== ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== -is-arrayish@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" - integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-core-module@^2.16.0: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== +is-core-module@^2.17.0: + version "2.17.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.17.0.tgz#75c1c76236c9f7e38ddbfff292e127dc13b21027" + integrity sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA== dependencies: - hasown "^2.0.2" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + hasown "^2.0.4" is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - is-promise@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" @@ -1023,7 +1163,12 @@ isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== -js-yaml@^4.1.1: +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.3.2.tgz#8e44fb14a2643c59726bb15787b5f1512cb3d3fb" integrity sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA== @@ -1041,9 +1186,9 @@ json5@^2.2.3: integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonfile@^6.0.1: - version "6.2.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.0.tgz#7c265bd1b65de6977478300087c99f1c84383f62" - integrity sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg== + version "6.2.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.1.tgz#b6e31717f22cc37330b081ce0051ed5de53af2f6" + integrity sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q== dependencies: universalify "^2.0.0" optionalDependencies: @@ -1066,6 +1211,11 @@ logform@^2.7.0: safe-stable-stringify "^2.3.1" triple-beam "^1.3.0" +lru-cache@^11.1.0: + version "11.5.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.3.tgz#a7767b4034e35269562d2b9da2b185b5df70c421" + integrity sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg== + make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" @@ -1077,9 +1227,9 @@ math-intrinsics@^1.1.0: integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== media-typer@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.0.tgz#6ab74b8f2d3320f2064b2a87a38e7931ff3a5561" - integrity sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw== + version "1.1.1" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.1.tgz#6f035400dfe3ab9d5607bc77546ce30cc2f9c6b8" + integrity sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ== merge-descriptors@^2.0.0: version "2.0.0" @@ -1091,10 +1241,10 @@ merge-descriptors@^2.0.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== -mime-types@^3.0.0, mime-types@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.1.tgz#b1d94d6997a9b32fd69ebaed0db73de8acb519ce" - integrity sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA== +mime-types@^3.0.0, mime-types@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.2.tgz#39002d4182575d5af036ffa118100f2524b2e2ab" + integrity sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A== dependencies: mime-db "^1.54.0" @@ -1103,22 +1253,15 @@ mimic-response@^3.1.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== -minimatch@^3.1.2: - version "3.1.5" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" - integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6: +minimist@^1.2.0, minimist@^1.2.3: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minipass@^7.0.4, minipass@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" - integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + version "7.1.3" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" + integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== minizlib@^3.1.0: version "3.1.0" @@ -1161,9 +1304,11 @@ napi-build-utils@^2.0.0: integrity sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA== negotiator@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.0.0.tgz#b6c91bb47172d69f93cfd7c357bbb529019b5f6a" - integrity sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg== + version "1.1.0" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.1.0.tgz#16e003d0db4ac24fd9df168edf871625deeae3df" + integrity sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg== + dependencies: + content-type "^2.1.0" negotiator@~0.6.4: version "0.6.4" @@ -1171,59 +1316,40 @@ negotiator@~0.6.4: integrity sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w== node-abi@^3.3.0: - version "3.75.0" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.75.0.tgz#2f929a91a90a0d02b325c43731314802357ed764" - integrity sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg== + version "3.100.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.100.0.tgz#31aa9623841051d14f52415557e18101bc0de7ca" + integrity sha512-KNU/E0VW9T1ndOAEWNlWtxhoBSF7hqe+dMSrRPK6+PfyL2s2AcfwnXCAOke4DNXOsweivNT6/7eFHwkxWblZew== dependencies: semver "^7.3.5" -node-fetch@^2.6.6: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -nodemon@^3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.1.10.tgz#5015c5eb4fffcb24d98cf9454df14f4fecec9bc1" - integrity sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw== - dependencies: - chokidar "^3.5.2" - debug "^4" - ignore-by-default "^1.0.1" - minimatch "^3.1.2" - pstree.remy "^1.1.8" - semver "^7.5.3" - simple-update-notifier "^2.0.0" - supports-color "^5.5.0" - touch "^3.1.0" - undefsafe "^2.0.5" - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +normalize-package-data@8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-8.0.0.tgz#bdce7ff2d6ba891b853e179e45a5337766e304a7" + integrity sha512-RWk+PI433eESQ7ounYxIp67CYuVsS1uYSonX3kA6ps/3LWfjVQa/ptEg6Y3T6uAMq1mWpX9PQ+qx+QaHpsc7gQ== + dependencies: + hosted-git-info "^9.0.0" + semver "^7.3.5" + validate-npm-package-license "^3.0.4" object-hash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== -object-inspect@^1.13.3: +object-inspect@^1.13.3, object-inspect@^1.13.4: version "1.13.4" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== on-finished@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + version "2.4.2" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.2.tgz#6932b04b95bf6a4828201db10af75fe5c9c38b73" + integrity sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ== dependencies: ee-first "1.1.1" @@ -1246,10 +1372,10 @@ one-time@^1.0.0: dependencies: fn.name "1.x.x" -p-is-promise@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-3.0.0.tgz#58e78c7dfe2e163cf2a04ff869e7c1dba64a5971" - integrity sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ== +packageurl-js@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/packageurl-js/-/packageurl-js-2.0.1.tgz#a8fa43a64971b5dd0dca5fb904b950a6cc317a6f" + integrity sha512-N5ixXjzTy4QDQH0Q9YFjqIWd6zH6936Djpl2m9QNFmDv5Fum8q8BjkpAcHNMzOFE0IwQrFhJWex3AN6kS0OSwg== parseurl@^1.3.3: version "1.3.3" @@ -1262,24 +1388,26 @@ path-parse@^1.0.7: integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-to-regexp@^8.0.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.0.tgz#8e98fcd94826aff01a90c544ef74ffbaca3a78ed" - integrity sha512-PuseHIvAnz3bjrM2rGJtSgo1zjgxapTLZ7x2pjhzWwlp4SJQgK3f3iZIQwkpEnBaKz6seKBADpM4B4ySkuYypg== + version "8.4.2" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz#795c420c4f7ca45c5b887366f622ee0c9852cccd" + integrity sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA== -picocolors@^1.1.0: +picocolors@^1.1.0, picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.0.4, picomatch@^2.2.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" - integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== +picomatch@^4.0.2, picomatch@^4.0.4: + version "4.0.7" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.7.tgz#6313360034ccb36b3dc61ecbdff78121f90fe21f" + integrity sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA== -picomatch@^4.0.2: - version "4.0.4" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.4.tgz#fd6f5e00a143086e074dffe4c924b8fb293b0589" - integrity sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A== +postject@^1.0.0-alpha.6: + version "1.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/postject/-/postject-1.0.0-alpha.6.tgz#9d022332272e2cfce8dea4cfce1ee6dd1b2ee135" + integrity sha512-b9Eb8h2eVqNE8edvKdwqkrY6O7kAwmI8kcnBv1NScolYJbo59XUF0noFq+lxbC1yN20bmC0WBEbDC5H/7ASb0A== + dependencies: + commander "^9.4.0" prebuild-install@^7.1.1: version "7.1.3" @@ -1309,7 +1437,7 @@ progress@^2.0.3: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -proxy-addr@^2.0.7: +proxy-addr@^2.0.8: version "2.0.8" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.8.tgz#624e760fd8ab06b1b8320c2f8506d4422cf8e932" integrity sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ== @@ -1317,40 +1445,36 @@ proxy-addr@^2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -pstree.remy@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.8.tgz#c242224f4a67c21f686839bbdb4ac282b8373d3a" - integrity sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w== - pump@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.3.tgz#151d979f1a29668dc0025ec589a455b53282268d" - integrity sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA== + version "3.0.4" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.4.tgz#1f313430527fa8b905622ebd22fe1444e757ab3c" + integrity sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA== dependencies: end-of-stream "^1.1.0" once "^1.3.1" -qs@^6.14.0: - version "6.14.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.2.tgz#b5634cf9d9ad9898e31fba3504e866e8efb6798c" - integrity sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q== +qs@^6.16.0, qs@^6.16.1: + version "6.16.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.16.1.tgz#0643e17993e551759c85078e1f0bc4b9fe908020" + integrity sha512-5Px6J7rfHBAGUhNQ3es4YzcOdBBw0SDcVtThJml4RdnKw4tKs2epA0kPZ+K8X+WiHktT93RHVcQ/3ym5aTCgtg== dependencies: - side-channel "^1.1.0" + es-define-property "^1.0.1" + side-channel "^1.1.1" range-parser@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + version "1.3.0" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.3.0.tgz#d7f19be812bb62721472b45d3be219ef09572b47" + integrity sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw== -raw-body@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.0.tgz#25b3476f07a51600619dae3fe82ddc28a36e5e0f" - integrity sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g== +raw-body@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.2.tgz#3e3ada5ae5568f9095d84376fd3a49b8fb000a51" + integrity sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA== dependencies: - bytes "3.1.2" - http-errors "2.0.0" - iconv-lite "0.6.3" - unpipe "1.0.0" + bytes "~3.1.2" + http-errors "~2.0.1" + iconv-lite "~0.7.0" + unpipe "~1.0.0" rc@^1.2.7: version "1.2.8" @@ -1362,7 +1486,7 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.1.4: +readable-stream@^2.0.2, readable-stream@^2.1.4: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -1384,13 +1508,6 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0, readable string_decoder "^1.1.1" util-deprecate "^1.0.1" -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -1401,12 +1518,18 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== +resolve.exports@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.4.tgz#49921cfd9cd266053a9699e3f43c8bcbdf964331" + integrity sha512-zepuGL0ulf+nt+XaFrlKeaiTJeyPFPLLY62+ncq1/VTHBdt3HsfXOH60priZ6tnXQozdGcDeIF5JVTanvIcYWQ== + resolve@^1.22.10: - version "1.22.10" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" - integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== + version "1.22.13" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.13.tgz#d542f97758d768f36091251a6b07540b4343f7b5" + integrity sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA== dependencies: - is-core-module "^2.16.0" + es-errors "^1.3.0" + is-core-module "^2.17.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -1441,50 +1564,50 @@ safe-stable-stringify@^2.3.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver@^7.3.5, semver@^7.5.3: - version "7.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" - integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== +semver@^7.3.5: + version "7.8.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.8.5.tgz#39b646037dd50c14fb451e7e4cac58ed8b863f69" + integrity sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA== send@^1.1.0, send@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/send/-/send-1.2.0.tgz#32a7554fb777b831dfa828370f773a3808d37212" - integrity sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw== + version "1.2.1" + resolved "https://registry.yarnpkg.com/send/-/send-1.2.1.tgz#9eab743b874f3550f40a26867bf286ad60d3f3ed" + integrity sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ== dependencies: - debug "^4.3.5" + debug "^4.4.3" encodeurl "^2.0.0" escape-html "^1.0.3" etag "^1.8.1" fresh "^2.0.0" - http-errors "^2.0.0" - mime-types "^3.0.1" + http-errors "^2.0.1" + mime-types "^3.0.2" ms "^2.1.3" on-finished "^2.4.1" range-parser "^1.2.1" - statuses "^2.0.1" + statuses "^2.0.2" serve-static@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.0.tgz#9c02564ee259bdd2251b82d659a2e7e1938d66f9" - integrity sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ== + version "2.2.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.1.tgz#7f186a4a4e5f5b663ad7a4294ff1bf37cf0e98a9" + integrity sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw== dependencies: encodeurl "^2.0.0" escape-html "^1.0.3" parseurl "^1.3.3" send "^1.2.0" -setprototypeof@1.2.0: +setprototypeof@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== -side-channel-list@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.0.tgz#10cb5984263115d3b7a0e336591e290a830af8ad" - integrity sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA== +side-channel-list@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.1.tgz#c2e0b5a14a540aebee3bbc6c3f8666cc9b509127" + integrity sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" + object-inspect "^1.13.4" side-channel-map@^1.0.1: version "1.0.1" @@ -1507,14 +1630,14 @@ side-channel-weakmap@^1.0.2: object-inspect "^1.13.3" side-channel-map "^1.0.1" -side-channel@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" - integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== +side-channel@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.1.tgz#ea02c62e05dc4bea67d4442f0fb71ee192f8e0ab" + integrity sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ== dependencies: es-errors "^1.3.0" - object-inspect "^1.13.3" - side-channel-list "^1.0.0" + object-inspect "^1.13.4" + side-channel-list "^1.0.1" side-channel-map "^1.0.1" side-channel-weakmap "^1.0.2" @@ -1532,31 +1655,46 @@ simple-get@^4.0.0: once "^1.3.1" simple-concat "^1.0.0" -simple-swizzle@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" - integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== +spdx-correct@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz#5d607d27fc806f66d7b64a766650fa890f04ed66" + integrity sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w== + +spdx-expression-parse@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz#a23af9f3132115465dac215c099303e4ceac5794" + integrity sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ== dependencies: - is-arrayish "^0.3.1" + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" -simple-update-notifier@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz#d70b92bdab7d6d90dfd73931195a30b6e3d7cebb" - integrity sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w== +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== dependencies: - semver "^7.5.3" + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.24" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.24.tgz#550436df9dc7dcf5c29832ceda40256a9b00de3a" + integrity sha512-cLS9TtWkIQFyLkJ3/5aFQAOHOSKTlOs/7WDut/XPSdjom1fJhUdkepeJAKXa9Y05+FabHd0sti+Et559vDtkpQ== stack-trace@0.0.x: version "0.0.10" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg== -statuses@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" - integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== - -statuses@^2.0.1: +statuses@^2.0.1, statuses@^2.0.2, statuses@~2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== @@ -1568,6 +1706,15 @@ stream-meter@^1.0.4: dependencies: readable-stream "^2.1.4" +streamx@^2.12.5, streamx@^2.25.0, streamx@^2.28.1: + version "2.28.1" + resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.28.1.tgz#376cd42a089505a69bec0efdb5189aa45586141f" + integrity sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA== + dependencies: + events-universal "^1.0.0" + fast-fifo "^1.3.2" + text-decoder "^1.1.0" + string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -1603,28 +1750,32 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -supports-color@^5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -tar-fs@^2.0.0, tar-fs@^2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.4.tgz#800824dbf4ef06ded9afea4acafe71c67c76b930" - integrity sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ== +tar-fs@^2.0.0: + version "2.1.5" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.5.tgz#33e9c29413dce0c58ada7ff77db4e5a30afffe70" + integrity sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw== dependencies: chownr "^1.1.1" mkdirp-classic "^0.5.2" pump "^3.0.0" tar-stream "^2.1.4" +tar-fs@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.1.3.tgz#05668cc68a30741c3813f9c16593b8dec7dcbcd1" + integrity sha512-/hU4AXnIdZu+Gvl1pk0oI5f5HxWsCJRtY2aFaJdk9VvyL48DWU6iU5WAIPG+wIi1YvWA6eTJvIviP/tMAZZNwQ== + dependencies: + pump "^3.0.0" + tar-stream "^3.1.5" + optionalDependencies: + bare-fs "^4.0.1" + bare-path "^3.0.0" + tar-stream@^2.1.4: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" @@ -1636,7 +1787,17 @@ tar-stream@^2.1.4: inherits "^2.0.3" readable-stream "^3.1.1" -tar@>=7.5.8, tar@^7.4.3: +tar-stream@^3.1.5: + version "3.2.2" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.2.2.tgz#aec7f257e712192a177a93aa0450c2e76855c8be" + integrity sha512-+8NeqHRjQWH9nYlwo2gamAMImZCVzI4UoEgDpWorBt9OEfppiZn+uSkskzQKPWIZyji/C8fpWO7u69G0DX0tbg== + dependencies: + b4a "^1.9.0" + bare-fs "^4.8.2" + fast-fifo "^1.3.2" + streamx "^2.28.1" + +tar@^7.5.7: version "7.5.22" resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.22.tgz#a696f998136e71487dc3f869a85bba2c67971ba9" integrity sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA== @@ -1647,41 +1808,38 @@ tar@>=7.5.8, tar@^7.4.3: minizlib "^3.1.0" yallist "^5.0.0" +teex@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12" + integrity sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg== + dependencies: + streamx "^2.12.5" + +text-decoder@^1.1.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.7.tgz#5d073a9a74b9c0a9d28dfadcab96b604af57d8ba" + integrity sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ== + dependencies: + b4a "^1.6.4" + text-hex@1.0.x: version "1.0.0" resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== tinyglobby@^0.2.11: - version "0.2.14" - resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.14.tgz#5280b0cf3f972b050e74ae88406c0a6a58f4079d" - integrity sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ== + version "0.2.17" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.17.tgz#562a9a6c9eb2b3b123d39719f9af5bb44fcd7631" + integrity sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g== dependencies: - fdir "^6.4.4" - picomatch "^4.0.2" + fdir "^6.5.0" + picomatch "^4.0.4" -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -toidentifier@1.0.1: +toidentifier@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -touch@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.1.tgz#097a23d7b161476435e5c1344a95c0f75b4a5694" - integrity sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA== - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - triple-beam@^1.3.0, triple-beam@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" @@ -1713,12 +1871,12 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -type-is@^2.0.0, type-is@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.0.1.tgz#64f6cf03f92fce4015c2b224793f6bdd4b068c97" - integrity sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw== +type-is@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.1.0.tgz#71d1a7053293582e16ac9f3ebaf1ab9aa49e5570" + integrity sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA== dependencies: - content-type "^1.0.5" + content-type "^2.0.0" media-typer "^1.1.0" mime-types "^3.0.0" @@ -1727,39 +1885,39 @@ typescript@~5.9.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== -undefsafe@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c" - integrity sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA== - undici-types@~6.21.0: version "6.21.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== -undici-types@~7.10.0: - version "7.10.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.10.0.tgz#4ac2e058ce56b462b056e629cc6a02393d3ff350" - integrity sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag== +undici-types@~8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.9.0.tgz#e240d97c8b5d85e5347ce73d25865c7906c1ec9f" + integrity sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg== + +undici@^7.28.0: + version "7.30.1" + resolved "https://registry.yarnpkg.com/undici/-/undici-7.30.1.tgz#360b3de104b94abc52729aa1a4a07e027aa71f73" + integrity sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg== universalify@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unpipe@1.0.0: +unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== unzipper@^0.12.3: - version "0.12.3" - resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.12.3.tgz#31958f5eed7368ed8f57deae547e5a673e984f87" - integrity sha512-PZ8hTS+AqcGxsaQntl3IRBw65QrBI6lxzqDEL7IAo/XCEqRTKGfOX56Vea5TH9SZczRVxuzk1re04z/YjuYCJA== + version "0.12.5" + resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.12.5.tgz#7fc6b4862f3832202d1f5cc3adbee2679deaaf6c" + integrity sha512-tXYOi9R57Uj/2Z25SOs5RRSzq886MBQj2gY8dPL+xl/kv6s6SvByoKfAtvfVeEuhntWDgjd2o9p2lb4TVPAz0A== dependencies: bluebird "~3.7.2" duplexer2 "~0.1.4" - fs-extra "^11.2.0" + fs-extra "11.3.1" graceful-fs "^4.2.2" node-int64 "^0.4.0" @@ -1773,24 +1931,19 @@ v8-compile-cache-lib@^3.0.1: resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== +validate-npm-package-license@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + vary@^1.1.2, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - winston-daily-rotate-file@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/winston-daily-rotate-file/-/winston-daily-rotate-file-5.0.0.tgz#8cd94800025490e47c00ec892b655a5821f4266d" @@ -1810,13 +1963,13 @@ winston-transport@^4.7.0, winston-transport@^4.9.0: readable-stream "^3.6.2" triple-beam "^1.3.0" -winston@^3.17.0: - version "3.17.0" - resolved "https://registry.yarnpkg.com/winston/-/winston-3.17.0.tgz#74b8665ce9b4ea7b29d0922cfccf852a08a11423" - integrity sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw== +winston@^3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/winston/-/winston-3.19.0.tgz#cc1d1262f5f45946904085cfffe73efb4b7a581d" + integrity sha512-LZNJgPzfKR+/J3cHkxcpHKpKKvGfDZVPS4hfJCc4cCG0CgYzvlD6yE/S3CIL/Yt91ak327YCpiF/0MyeZHEHKA== dependencies: "@colors/colors" "^1.6.0" - "@dabh/diagnostics" "^2.0.2" + "@dabh/diagnostics" "^2.0.8" async "^3.2.3" is-stream "^2.0.0" logform "^2.7.0" @@ -1857,9 +2010,9 @@ yargs-parser@^20.2.2: integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + version "16.2.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.2.tgz#c56731dca0d2788ae0866dd3c83907d6bab85f7d" + integrity sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w== dependencies: cliui "^7.0.2" escalade "^3.1.1" diff --git a/packaging/java/build.gradle b/packaging/java/build.gradle index b9c18c276f..348874b4b7 100644 --- a/packaging/java/build.gradle +++ b/packaging/java/build.gradle @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import org.apache.tools.ant.filters.ReplaceTokens plugins { @@ -15,7 +16,7 @@ base { // OS Package plugin configuration ospackage { packageName = pkgName - version = "${project.version}" + version = pkgVersion release = 1 os = LINUX type = BINARY @@ -88,7 +89,6 @@ buildRpm { arch = NOARCH - archiveVersion = projectVersion.replace('-', '') archiveFileName = "${pkgName}.rpm" // Support Java 25 (current), plus Java 21 and Java 17 (backward compatibility) for RPM-based distros diff --git a/packaging/js/build.gradle b/packaging/js/build.gradle index 3be3797e89..4c7d0765e4 100644 --- a/packaging/js/build.gradle +++ b/packaging/js/build.gradle @@ -14,7 +14,7 @@ base { // OS Package plugin configuration ospackage { packageName = pkgName - version = "${project.version}" + version = pkgVersion release = 1 os = LINUX type = BINARY @@ -69,7 +69,6 @@ buildRpm { arch = X86_64 - archiveVersion = projectVersion.replace('-', '') archiveFileName = "${pkgName}.rpm" preInstall file("${buildDir}/control/rpm/preinst") diff --git a/pom.xml b/pom.xml index 2ae97be002..eb8b354656 100755 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,21 @@ ${skip.yarn} none none + none + + 2026-11-10T11:40:00Z + + true + + ${sbom.skip} + + ${sbom.yarn.skip} 4.1.138.Final 1.62.0 - 10.1.60 + 10.1.61 5.4.3 1.5.38 2.21.7 @@ -117,6 +132,8 @@ 1.2.5 1.7.1 3.5.0 + 2.9.3 + 1.0.0 3.5.4 3.1.4 3.1.4 @@ -160,7 +177,7 @@ 1.6.1 1.11.0 4.4 - 1.0.4TB + 1.0.5TB 6.4.5 10.1.3 3.7.4 @@ -278,6 +295,7 @@ + true true true true @@ -293,6 +311,7 @@ + true true true true @@ -617,6 +636,14 @@ ZIP true true + + + + org.projectlombok + lombok + + ${pkg.installFolder}/conf ${pkg.unixLogFolder} @@ -646,6 +673,7 @@ -PpackagingDir=${main.dir}/packaging -PprojectBuildDir=${basedir}/target -PprojectVersion=${project.version} + -PpkgVersion=${pkg.version} -PmainJar=${project.build.directory}/${project.build.finalName}-boot.${project.packaging} @@ -765,6 +793,112 @@ maven-assembly-plugin 3.0.0 + + org.cyclonedx + cyclonedx-maven-plugin + ${cyclonedx-maven-plugin.version} + + + generate-sbom + generate-resources + + makeBom + + + + + application + ${project.build.outputDirectory}/META-INF/sbom + json + application.cdx + false + false + ${sbom.skip} + + + + org.thingsboard + sbom-maven-plugin + ${sbom-maven-plugin.version} + + + sbom-metadata + + metadata + + + + ThingsBoard, Inc. + + https://thingsboard.io + + + + security@thingsboard.io + + + + + ThingsBoard, Inc. + + https://thingsboard.io + + + + ThingsBoard, Inc. + + https://thingsboard.io + + + + + + package-sbom + ${sbom.package.phase} + + package + + + ${pkg.name} + + + deb + ${project.build.directory}/${pkg.name}.deb + pkg:deb/thingsboard/${pkg.name}@${pkg.version}-1?arch=all + ${pkg.skip.deb} + + + rpm + ${project.build.directory}/${pkg.name}.rpm + pkg:rpm/thingsboard/${pkg.name}@${pkg.version}-1?arch=noarch + ${pkg.skip.rpm} + + + zip + ${project.build.directory}/${pkg.name}-windows.zip + pkg:generic/thingsboard/${pkg.name}-windows@${project.version} + ${pkg.skip.zip} + + + + + application + com.sun.winsw + winsw + ${winsw.version} + Windows service wrapper, shipped as ${pkg.name}.exe. + pkg:maven/com.sun.winsw/winsw@${winsw.version}?classifier=bin&type=exe + MIT + ${pkg.win.dist}/service.exe + + zip + + + + + + + org.springframework.boot spring-boot-maven-plugin @@ -897,6 +1031,20 @@ + + pkg-version + ${pkg.process-resources.phase} + + regex-property + + + pkg.version + ${project.version} + - + ~ + false + + @@ -1029,7 +1177,7 @@ io.github.git-commit-id git-commit-id-maven-plugin - 5.0.0 + 10.0.1 get-the-git-infos diff --git a/report/pom.xml b/report/pom.xml index 5344f98b18..4e99e1b42f 100644 --- a/report/pom.xml +++ b/report/pom.xml @@ -24,6 +24,7 @@ java process-resources package + ${pkg.package.phase} tb-report ${project.build.directory}/windows true @@ -169,6 +170,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -181,6 +186,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.xolstice.maven.plugins protobuf-maven-plugin diff --git a/tools/src/main/javascript/yarn-sbom.js b/tools/src/main/javascript/yarn-sbom.js new file mode 100644 index 0000000000..486688d36a --- /dev/null +++ b/tools/src/main/javascript/yarn-sbom.js @@ -0,0 +1,281 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +const crypto = require('crypto'); +const fs = require('fs'); +const path = require('path'); +const zlib = require('zlib'); +const { createRequire } = require('module'); + +const ALL_PLATFORMS = '--all-platforms'; +const args = process.argv.slice(2); +const allPlatforms = args.includes(ALL_PLATFORMS); +const [output, rootType, rootPurl] = args.filter(arg => arg !== ALL_PLATFORMS); +if (!output || !['application', 'library'].includes(rootType) || !rootPurl) { + throw new Error(`Usage: node yarn-sbom.js [${ALL_PLATFORMS}]`); +} +const MODULE = process.cwd(); +const OUTPUT = path.resolve(MODULE, output); +const LOCKED = 'yarn.lock:'; + +const moduleRequire = createRequire(path.join(MODULE, 'package.json')); +const { Contrib, Enums, Models, Serialize, Spec } = moduleRequire('@cyclonedx/cyclonedx-library'); +const { PackageURL, PurlQualifierNames } = moduleRequire('packageurl-js'); +const spdxExpressionParse = moduleRequire('spdx-expression-parse'); +const lockfile = moduleRequire('@yarnpkg/lockfile'); +const normalizePackageData = moduleRequire('normalize-package-data'); + +const DEFAULT_REGISTRY = /^https?:\/\/registry\.(?:npmjs\.org|yarnpkg\.com)(?:\/|$)/; +const GIT_URL = /^git[+:]|\.git$/; + +const { Builders, Factories, Utils } = Contrib.FromNodePackageJson; +const componentBuilder = new Builders.ComponentBuilder( + new Factories.ExternalReferenceFactory(), new Contrib.License.Factories.LicenseFactory(spdxExpressionParse)); +const lock = parseLockfile(); +const locked = lockedPackages(); +const notInstalled = new Map(); + +main().catch(error => { + console.error(error); + process.exit(1); +}); + +async function main() { + const bom = new Models.Bom(); + bom.metadata.supplier = new Models.OrganizationalEntity({ name: 'ThingsBoard, Inc.', url: new Set([new URL('https://thingsboard.io')]) }); + bom.metadata.tools.components.add(componentBuilder.makeComponent(moduleRequire('@cyclonedx/cyclonedx-library/package.json'))); + bom.metadata.properties.add(new Models.Property('cdx:reproducible', 'true')); + + const rootManifest = readManifest(MODULE); + const rootId = PackageURL.fromString(rootPurl); + const root = new Models.Component(rootType, rootId.name, { + bomRef: rootPurl, + group: rootId.namespace, + version: rootId.version, + description: rootManifest.description, + supplier: bom.metadata.supplier, + purl: rootPurl + }); + bom.metadata.component = root; + + const edges = new Map(); + const queue = [MODULE]; + for (const node of queue) { + if (edges.has(node)) { + continue; + } + const dependencies = dependenciesOf(node); + edges.set(node, dependencies); + queue.push(...dependencies.map(dependency => dependency.target)); + } + + const byNode = new Map(); + const byPurl = new Map(); + for (const node of edges.keys()) { + if (node === MODULE) { + continue; + } + const component = node.startsWith(LOCKED) ? await lockedComponent(node) : makeComponent(readManifest(node), node); + const known = byPurl.get(component.purl); + if (known) { + if (!node.startsWith(LOCKED)) { + known.properties.add(new Models.Property('cdx:npm:package:path', packagePath(node))); + } + byNode.set(node, known); + } else { + byPurl.set(component.purl, component); + byNode.set(node, component); + bom.components.add(component); + } + } + for (const [node, dependencies] of edges) { + const from = node === MODULE ? root : byNode.get(node); + dependencies.forEach(dependency => from.dependencies.add(byNode.get(dependency.target).bomRef)); + } + if (allPlatforms) { + const required = new Set(); + const pending = [MODULE]; + while (pending.length > 0) { + const node = pending.pop(); + for (const dependency of edges.get(node)) { + const component = byNode.get(dependency.target); + if (!dependency.optional && !required.has(component)) { + required.add(component); + pending.push(dependency.target); + } + } + } + byPurl.forEach(component => { + if (!required.has(component)) { + component.scope = Enums.ComponentScope.Optional; + } + }); + } + + const serializer = new Serialize.JsonSerializer(new Serialize.JSON.Normalize.Factory(Spec.Spec1dot6)); + fs.mkdirSync(path.dirname(OUTPUT), { recursive: true }); + fs.writeFileSync(OUTPUT, `${serializer.serialize(bom, { sortLists: true, space: 2 })}\n`); + console.log(`Wrote ${OUTPUT} with ${byPurl.size} components${notInstalled.size > 0 ? `, ${notInstalled.size} of them optional packages for other platforms` : ''}`); +} + +function dependenciesOf(node) { + if (node.startsWith(LOCKED)) { + return []; + } + const manifest = readManifest(node); + const required = Object.keys(manifest.dependencies || {}).map(name => { + const target = resolvePackageDir(node, name); + if (!target) { + throw new Error(`${packagePath(node) || manifest.name} depends on ${name}, which is not installed`); + } + return { target, optional: false }; + }); + const optional = Object.entries(manifest.optionalDependencies || {}).flatMap(([name, range]) => { + const target = resolvePackageDir(node, name); + if (target) { + return [{ target, optional: true }]; + } + return allPlatforms ? [{ target: notInstalledNode(name, range), optional: true }] : []; + }); + const seen = new Set(); + return [...required, ...optional].filter(dependency => !seen.has(dependency.target) && seen.add(dependency.target)); +} + +function notInstalledNode(name, range) { + const entry = lock[`${name}@${range}`]; + if (!entry) { + throw new Error(`yarn.lock does not list the optional dependency ${name}@${range}`); + } + const node = `${LOCKED}${name}@${entry.version}`; + notInstalled.set(node, { name, entry }); + return node; +} + +async function lockedComponent(node) { + const { name, entry } = notInstalled.get(node); + const manifest = await manifestFromTarball(name, entry); + if (manifest.name !== name || manifest.version !== entry.version) { + throw new Error(`The tarball of ${name}@${entry.version} contains ${manifest.name}@${manifest.version}`); + } + const dependencies = Object.keys({ ...manifest.dependencies, ...manifest.optionalDependencies }); + if (dependencies.length > 0) { + throw new Error(`${name}@${entry.version} is not installed on this platform and has dependencies of its own (${dependencies.join(', ')}), which cannot be resolved without installing it`); + } + return makeComponent(manifest, null); +} + +async function manifestFromTarball(name, entry) { + const url = entry.resolved.split('#')[0]; + if (!entry.integrity) { + throw new Error(`yarn.lock gives no integrity for ${name}@${entry.version}, so its tarball cannot be verified`); + } + const response = await fetch(url); + if (!response.ok) { + throw new Error(`Cannot download ${url}: HTTP ${response.status}`); + } + const tarball = Buffer.from(await response.arrayBuffer()); + const verified = entry.integrity.split(/\s+/).some(integrity => { + const [algorithm, expected] = integrity.split(/-(.*)/s); + return crypto.getHashes().includes(algorithm) && crypto.createHash(algorithm).update(tarball).digest('base64') === expected; + }); + if (!verified) { + throw new Error(`The tarball ${url} does not match the integrity that yarn.lock gives for ${name}@${entry.version}`); + } + const tar = zlib.gunzipSync(tarball); + for (let offset = 0; offset + 512 <= tar.length;) { + const header = tar.subarray(offset, offset + 512); + if (header.every(byte => byte === 0)) { + break; + } + const prefix = field(header, 345, 155); + const fileName = prefix ? `${prefix}/${field(header, 0, 100)}` : field(header, 0, 100); + const size = parseInt(field(header, 124, 12).trim() || '0', 8); + const type = String.fromCharCode(header[156]); + offset += 512; + if ((type === '0' || type === '\0') && /^[^/]+\/package\.json$/.test(fileName)) { + return JSON.parse(tar.subarray(offset, offset + size).toString('utf8')); + } + offset += Math.ceil(size / 512) * 512; + } + throw new Error(`The tarball ${url} has no package.json`); +} + +function field(header, start, length) { + const bytes = header.subarray(start, start + length); + const end = bytes.indexOf(0); + return bytes.subarray(0, end < 0 ? bytes.length : end).toString('utf8'); +} + +function makeComponent(manifest, dir) { + const declaredVersion = manifest.version; + normalizePackageData(manifest); + manifest.version = declaredVersion; + const component = componentBuilder.makeComponent(manifest); + if (!component) { + throw new Error(`Cannot build an SBOM component from ${dir ? `${packagePath(dir)}/package.json` : `the package.json of ${manifest.name}@${manifest.version}`}`); + } + component.licenses.forEach(license => { + license.acknowledgement = Enums.LicenseAcknowledgement.Declared; + }); + if (dir) { + component.properties.add(new Models.Property('cdx:npm:package:path', packagePath(dir))); + } + const entry = locked.get(`${manifest.name}@${manifest.version}`); + if (!entry) { + throw new Error(`${readManifest(MODULE).name} depends on ${manifest.name}@${manifest.version}, which yarn.lock does not list`); + } + const [url, revision] = entry.resolved.split('#'); + const comment = 'as detected from yarn.lock property "resolved"'; + let qualifiers; + if (GIT_URL.test(url)) { + qualifiers = { [PurlQualifierNames.VcsUrl]: `${url.startsWith('git') ? url : `git+${url}`}@${revision}` }; + component.externalReferences.add(new Models.ExternalReference(entry.resolved, Enums.ExternalReferenceType.VCS, { comment })); + } else { + qualifiers = DEFAULT_REGISTRY.test(url) ? {} : { [PurlQualifierNames.DownloadUrl]: url }; + const dist = new Models.ExternalReference(url, Enums.ExternalReferenceType.Distribution, { comment }); + if (entry.integrity) { + dist.hashes.set(...Utils.parsePackageIntegrity(entry.integrity)); + } + component.externalReferences.add(dist); + } + component.purl = new PackageURL('npm', component.group, component.name, manifest.version, qualifiers, undefined).toString(); + component.bomRef.value = component.purl; + return component; +} + +function parseLockfile() { + const { type, object } = lockfile.parse(fs.readFileSync(path.join(MODULE, 'yarn.lock'), 'utf8')); + if (type !== 'success') { + throw new Error(`Cannot parse yarn.lock: ${type}`); + } + return object; +} + +function lockedPackages() { + const result = new Map(); + for (const [spec, entry] of Object.entries(lock)) { + const alias = /^(?:@[^/@]+\/)?[^/@]+@npm:((?:@[^/@]+\/)?[^/@]+)@/.exec(spec); + const name = alias ? alias[1] : spec.slice(0, spec.indexOf('@', 1)); + result.set(`${name}@${entry.version}`, entry); + } + return result; +} + +function resolvePackageDir(from, name) { + for (let dir = from; ; dir = path.dirname(dir)) { + const candidate = path.join(dir, 'node_modules', name); + if (fs.existsSync(path.join(candidate, 'package.json'))) { + return candidate; + } + if (dir === MODULE || dir === path.dirname(dir)) { + return undefined; + } + } +} + +function packagePath(dir) { + return path.relative(MODULE, dir).split(path.sep).join('/'); +} + +function readManifest(dir) { + return JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')); +} diff --git a/tools/src/main/python/license-headers/curations.json b/tools/src/main/python/license-headers/curations.json index ecc5bb95de..d2cc8e8281 100644 --- a/tools/src/main/python/license-headers/curations.json +++ b/tools/src/main/python/license-headers/curations.json @@ -271,6 +271,12 @@ "reason": "PE agent installation instructions model added in e0db7ac7154 as part of the PE agent feature introduced on lts-4.4, which has no counterpart in CE. The candidate CE common/data/src/main/java/org/thingsboard/server/common/data/edge/EdgeInstructions.java shares only the instructions model boilerplate. Reviewed candidate at a0aff29ef42d3636473b017115a9334b48d54d15 (blob 409985284c6).", "contentHash": "sha256:ce067f7aad61fb79c44ac80ceda3b26e9908a8a648380097754ff9ee097256b1" }, + { + "path": "common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatPrompt.java", + "header": "ce-modified", + "reason": "Prompt fields and LangChain conversion extracted from CE common/data/src/main/java/org/thingsboard/server/common/data/ai/dto/TbChatRequest.java at 5954190c32f; the conversion code is the CE implementation.", + "contentHash": "sha256:5fa64331c5c90df4ebd3ab0db1d62c995591dfa6a05b2316bdc6d9556359e205" + }, { "path": "common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/BlobEntityFields.java", "header": "busl", @@ -479,13 +485,13 @@ "path": "common/data/src/main/java/org/thingsboard/server/common/data/permission/Operation.java", "header": "ce-modified", "reason": "Reviewed relocation from application/src/main/java/org/thingsboard/server/service/security/permission/Operation.java in PE commit d97b2f71224e96c27fbdf287f592a08b6fa0407b. The source exists in shared CE ancestry 4c2aa4a60368318eafc2dea155b93721668654c4. The relocated CE permission enum has PE permission/group extensions. Compared with CE fa82445a7078506defbaadc5bea07227dc1b016d (blob b481176e53d5d4e1460882c578b4e4c00f895b3b); a move alone does not imply PE authorship.", - "contentHash": "sha256:d4bcb4e694df750984b311d786923a3a68291c5e1e45cb7715a0db9541d9dbe7" + "contentHash": "sha256:f57a3606b1303177721db29d33490e8a763f02a7a660c1358c55d4efff6f9e6b" }, { "path": "common/data/src/main/java/org/thingsboard/server/common/data/permission/Resource.java", "header": "ce-modified", "reason": "Reviewed relocation from application/src/main/java/org/thingsboard/server/service/security/permission/Resource.java in PE commit d97b2f71224e96c27fbdf287f592a08b6fa0407b. The source exists in shared CE ancestry 4c2aa4a60368318eafc2dea155b93721668654c4. The relocated CE permission enum has PE permission/group extensions. Compared with CE fa82445a7078506defbaadc5bea07227dc1b016d (blob d8b4dd8f4ef95df06ba22fd584813f437a8b453a); a move alone does not imply PE authorship.", - "contentHash": "sha256:635cb50f3945d1bca662a7100a6129bea1270755bf4fe7cd6bc9849f228a4f08" + "contentHash": "sha256:0f4157c5bea567a4fc31dfd45e793fe111a26e520a27442bf9f72b18348beb7d" }, { "path": "common/data/src/main/java/org/thingsboard/server/common/data/query/EntityGroupNameFilter.java", @@ -1181,7 +1187,7 @@ "path": "msa/web-report/config/logger.ts", "header": "busl", "reason": "New PE module for the PE web-report service. Its body is identical to CE msa/web-ui/config/logger.ts, which PE still carries and which is a week older; the PE file is a copy for a PE-only service, not the CE file. Maintainer rule (2026-09-09): a file that exists in CE and carries PE changes is modified CE; a file that does not exist in CE and implements a PE feature is PE-only, however closely it resembles a CE file.", - "contentHash": "sha256:aec71ee9557d9b8f0691e46617d923403e73b03cb204c3e8c837200487337398" + "contentHash": "sha256:611c34e6267c2f0511b2a830289dbc9effd5225e89d2498c8ac7bf0cfd8b03e8" }, { "path": "msa/web-report/config/tb-web-report.conf", @@ -1189,6 +1195,12 @@ "reason": "Launch, logging or runtime scaffolding for a PE service. Maintainer explicitly resolved this PE module scaffolding as PE-only; matching CE startup/logging conventions do not override that decision. Reviewed similarity candidate msa/js-executor/config/tb-js-executor.conf at 0d3b41e002f958887a317ca8366fdc4efa549058 (blob 95e43f9ea9875eaed7e06ef3559914a901727636).", "contentHash": "sha256:f4568fd8a8158238c9d60bf6fce8ea4c7a3d98959bcf1e9fb3ef91aced0a3c46" }, + { + "path": "msa/web-report/pom.xml", + "header": "busl", + "reason": "Build descriptor of the PE-only web-report module; CE has no web-report module. The only CE version is an empty file (blob e69de29bb2d) added by stray commit 2b1c5d92f3a, pushed to fix/maven-node-lts-4.3 after #16417 merged and carried into lts-4.4 via #16419; it never reached CE lts-4.3 and is not the origin of this file.", + "contentHash": "sha256:48ee3956937386c95ebb2b95a4981506203c00ce276aa6003fecfc0ddaf04218" + }, { "path": "report/src/main/conf/logback.xml", "header": "busl", diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index d8226cd117..ebc045575f 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -26,6 +26,7 @@ java process-resources package + ${pkg.package.phase} tb-coap-transport false ${project.build.directory}/windows @@ -85,6 +86,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -97,6 +102,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.codehaus.mojo build-helper-maven-plugin diff --git a/transport/coap/src/main/resources/tb-coap-transport.yml b/transport/coap/src/main/resources/tb-coap-transport.yml index 0f32b80a9e..ad0261714b 100644 --- a/transport/coap/src/main/resources/tb-coap-transport.yml +++ b/transport/coap/src/main/resources/tb-coap-transport.yml @@ -74,6 +74,9 @@ redis: nodes: "${REDIS_NODES:}" # Maximum number of redirects to follow when executing commands across the cluster. max-redirects: "${REDIS_MAX_REDIRECTS:12}" + # Period in seconds of the background refresh of the cluster slot map. It finds slots that moved to another node + # (after a failover, or when a node gets a new IP) even before a command to the old node fails. Set 0 to disable. + topology-refresh-period-sec: "${REDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC:30}" # if set false will be used pool config build from values of the pool config section useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}" sentinel: diff --git a/transport/http/pom.xml b/transport/http/pom.xml index a3257700b1..23832559e6 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -26,6 +26,7 @@ java process-resources package + ${pkg.package.phase} tb-http-transport false ${project.build.directory}/windows @@ -85,6 +86,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -97,6 +102,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.codehaus.mojo build-helper-maven-plugin diff --git a/transport/http/src/main/resources/tb-http-transport.yml b/transport/http/src/main/resources/tb-http-transport.yml index 258523825f..1583a47cd3 100644 --- a/transport/http/src/main/resources/tb-http-transport.yml +++ b/transport/http/src/main/resources/tb-http-transport.yml @@ -106,6 +106,9 @@ redis: nodes: "${REDIS_NODES:}" # Maximum number of redirects to follow when executing commands across the cluster. max-redirects: "${REDIS_MAX_REDIRECTS:12}" + # Period in seconds of the background refresh of the cluster slot map. It finds slots that moved to another node + # (after a failover, or when a node gets a new IP) even before a command to the old node fails. Set 0 to disable. + topology-refresh-period-sec: "${REDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC:30}" # if set false will be used pool config build from values of the pool config section useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}" sentinel: diff --git a/transport/lwm2m/pom.xml b/transport/lwm2m/pom.xml index c7ab8fca10..cc548fde1e 100644 --- a/transport/lwm2m/pom.xml +++ b/transport/lwm2m/pom.xml @@ -26,6 +26,7 @@ java process-resources package + ${pkg.package.phase} tb-lwm2m-transport false ${project.build.directory}/windows @@ -139,6 +140,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -151,6 +156,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.codehaus.mojo build-helper-maven-plugin diff --git a/transport/lwm2m/src/main/resources/tb-lwm2m-transport.yml b/transport/lwm2m/src/main/resources/tb-lwm2m-transport.yml index 74de592692..df0845d91e 100644 --- a/transport/lwm2m/src/main/resources/tb-lwm2m-transport.yml +++ b/transport/lwm2m/src/main/resources/tb-lwm2m-transport.yml @@ -73,6 +73,9 @@ redis: nodes: "${REDIS_NODES:}" # Maximum number of redirects to follow when executing commands across the cluster. max-redirects: "${REDIS_MAX_REDIRECTS:12}" + # Period in seconds of the background refresh of the cluster slot map. It finds slots that moved to another node + # (after a failover, or when a node gets a new IP) even before a command to the old node fails. Set 0 to disable. + topology-refresh-period-sec: "${REDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC:30}" # if set false will be used pool config build from values of the pool config section useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}" sentinel: diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index b651546129..cce55aead4 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -26,6 +26,7 @@ java process-resources package + ${pkg.package.phase} tb-mqtt-transport false ${project.build.directory}/windows @@ -85,6 +86,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -97,6 +102,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.codehaus.mojo build-helper-maven-plugin diff --git a/transport/mqtt/src/main/resources/tb-mqtt-transport.yml b/transport/mqtt/src/main/resources/tb-mqtt-transport.yml index bb5a6abfed..e67761b5e4 100644 --- a/transport/mqtt/src/main/resources/tb-mqtt-transport.yml +++ b/transport/mqtt/src/main/resources/tb-mqtt-transport.yml @@ -74,6 +74,9 @@ redis: nodes: "${REDIS_NODES:}" # Maximum number of redirects to follow when executing commands across the cluster. max-redirects: "${REDIS_MAX_REDIRECTS:12}" + # Period in seconds of the background refresh of the cluster slot map. It finds slots that moved to another node + # (after a failover, or when a node gets a new IP) even before a command to the old node fails. Set 0 to disable. + topology-refresh-period-sec: "${REDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC:30}" # if set false will be used pool config build from values of the pool config section useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}" sentinel: diff --git a/transport/snmp/pom.xml b/transport/snmp/pom.xml index 2ca38942f7..8d7cd799a2 100644 --- a/transport/snmp/pom.xml +++ b/transport/snmp/pom.xml @@ -28,6 +28,7 @@ java process-resources package + ${pkg.package.phase} tb-snmp-transport false ${project.build.directory}/windows @@ -70,6 +71,10 @@ org.apache.maven.plugins maven-jar-plugin + + org.cyclonedx + cyclonedx-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -82,6 +87,10 @@ org.apache.maven.plugins maven-assembly-plugin + + org.thingsboard + sbom-maven-plugin + org.codehaus.mojo build-helper-maven-plugin diff --git a/transport/snmp/src/main/resources/tb-snmp-transport.yml b/transport/snmp/src/main/resources/tb-snmp-transport.yml index 24001f7b9a..8e6bc126c3 100644 --- a/transport/snmp/src/main/resources/tb-snmp-transport.yml +++ b/transport/snmp/src/main/resources/tb-snmp-transport.yml @@ -73,6 +73,9 @@ redis: nodes: "${REDIS_NODES:}" # Maximum number of redirects to follow when executing commands across the cluster. max-redirects: "${REDIS_MAX_REDIRECTS:12}" + # Period in seconds of the background refresh of the cluster slot map. It finds slots that moved to another node + # (after a failover, or when a node gets a new IP) even before a command to the old node fails. Set 0 to disable. + topology-refresh-period-sec: "${REDIS_CLUSTER_TOPOLOGY_REFRESH_PERIOD_SEC:30}" # if set false will be used pool config build from values of the pool config section useDefaultPoolConfig: "${REDIS_USE_DEFAULT_POOL_CONFIG:true}" sentinel: diff --git a/ui-ngx/angular.json b/ui-ngx/angular.json index 41ed6bc62d..4228c68d80 100644 --- a/ui-ngx/angular.json +++ b/ui-ngx/angular.json @@ -37,6 +37,11 @@ "assets": [ "src/thingsboard.ico", "src/assets", + { + "glob": "**/*.raw", + "input": "../application/src/main/resources/converters/", + "output": "/assets/converters/" + }, { "glob": "*.svg", "input": "./node_modules/@mdi/svg/svg/", @@ -128,6 +133,7 @@ "node_modules/tooltipster/dist/css/plugins/tooltipster/sideTip/themes/tooltipster-sideTip-shadow.min.css", "node_modules/jstree-bootstrap-theme/dist/themes/proton/style.min.css", "node_modules/leaflet/dist/leaflet.css", + "node_modules/leaflet-gesture-handling/dist/leaflet-gesture-handling.css", "src/app/modules/home/components/widget/lib/maps/map.scss", "src/app/modules/home/components/widget/lib/maps-legacy/markers.scss", "src/app/modules/home/components/widget/lib/home-page/home-page.scss", diff --git a/ui-ngx/esbuild/tb-html-fallback-middleware.ts b/ui-ngx/esbuild/tb-html-fallback-middleware.ts index 6b7e2ab122..dc7d87f473 100644 --- a/ui-ngx/esbuild/tb-html-fallback-middleware.ts +++ b/ui-ngx/esbuild/tb-html-fallback-middleware.ts @@ -2,9 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import type { ServerResponse } from 'node:http'; import type { Connect } from 'vite'; -import type { NextHandleFunction } from 'connect'; -const tbHtmlFallbackMiddleware: NextHandleFunction = ( +const tbHtmlFallbackMiddleware: Connect.NextHandleFunction = ( req: Connect.IncomingMessage, _res: ServerResponse, next: Connect.NextFunction diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 05a25a5574..34c03b5167 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -8,21 +8,22 @@ "build:prod": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration production", "build:types": "node generate-types.js", "build:icon-metadata": "node generate-icon-metadata.js", + "sbom": "node ../tools/src/main/javascript/yarn-sbom.js target/generated-resources/META-INF/sbom/ui-ngx.cdx.json library", "lint": "ng lint", "prepare": "patch-package --error-on-fail" }, "private": true, "dependencies": { - "@angular/animations": "20.3.28", + "@angular/animations": "20.3.34", "@angular/cdk": "20.2.14", - "@angular/common": "20.3.28", - "@angular/compiler": "20.3.28", - "@angular/core": "20.3.28", - "@angular/forms": "20.3.28", + "@angular/common": "20.3.34", + "@angular/compiler": "20.3.34", + "@angular/core": "20.3.34", + "@angular/forms": "20.3.34", "@angular/material": "20.2.14", - "@angular/platform-browser": "20.3.28", - "@angular/platform-browser-dynamic": "20.3.28", - "@angular/router": "20.3.28", + "@angular/platform-browser": "20.3.34", + "@angular/platform-browser-dynamic": "20.3.34", + "@angular/router": "20.3.34", "@auth0/angular-jwt": "^5.2.0", "@flowjs/flow.js": "^2.14.1", "@flowjs/ngx-flow": "20.0.2", @@ -33,19 +34,19 @@ "@fullcalendar/list": "^6.1.20", "@fullcalendar/moment": "^6.1.20", "@fullcalendar/timegrid": "^6.1.20", - "@geoman-io/leaflet-geoman-free": "2.19.3", + "@geoman-io/leaflet-geoman-free": "2.20.4", "@hugerte/hugerte-angular": "~1.1.1", - "@iplab/ngx-color-picker": "^20.0.0", + "@iplab/ngx-color-picker": "^20.1.0", "@mat-datetimepicker/core": "~16.0.1", "@mdi/svg": "^7.4.47", - "@messageformat/core": "^3.4.0", + "@messageformat/core": "^3.4.1", "@ngrx/effects": "^20.1.0", "@ngrx/store": "^20.1.0", "@ngrx/store-devtools": "^20.1.0", "@ngx-translate/core": "^17.0.0", - "@svgdotjs/svg.filter.js": "^3.0.9", - "@svgdotjs/svg.js": "3.2.4", - "@svgdotjs/svg.panzoom.js": "^2.1.2", + "@svgdotjs/svg.filter.js": "^3.0.10", + "@svgdotjs/svg.js": "3.2.8", + "@svgdotjs/svg.panzoom.js": "^2.1.3", "@swimlane/ngx-graph": "^11.0.0", "ace-builds": "1.43.6", "ace-diff": "^3.3.0", @@ -53,31 +54,32 @@ "angular-gridster2": "~20.2.4", "angular2-hotkeys": "^16.0.1", "canvas-gauges": "^2.1.7", - "core-js": "^3.48.0", - "dayjs": "1.11.20", - "echarts": "https://github.com/thingsboard/echarts/archive/5.5.2-TB.tar.gz", - "exceljs-hardened": "~5.0.0", - "flag-icons": "7.2.3", + "core-js": "^3.51.0", + "dayjs": "1.11.23", + "echarts": "https://github.com/thingsboard/echarts/archive/5.5.4-TB.tar.gz", + "exceljs-hardened": "~5.1.0", + "flag-icons": "7.6.0", "flot": "https://github.com/thingsboard/flot.git#0.9-work", "flot.curvedlines": "https://github.com/MichaelZinsmaier/CurvedLines.git#master", "font-awesome": "^4.7.0", "html2canvas": "^1.4.1", - "hugerte": "~1.0.12", + "hugerte": "~1.0.14", "jquery": "^3.7.1", "jquery-sparkline": "^2.4.0", - "jquery.terminal": "^2.45.2", + "jquery.terminal": "^2.48.1", "js-beautify": "1.15.4", "json-schema-defaults": "^0.4.0", "jstree": "^3.3.17", "jstree-bootstrap-theme": "^1.0.1", - "jszip": "^3.10.1", + "jszip": "^3.10.2", "leaflet": "1.9.4", + "leaflet-gesture-handling": "1.2.2", "leaflet-polylinedecorator": "1.6.0", "leaflet-providers": "4.0.0", "leaflet.gridlayer.googlemutant": "0.15.0", "leaflet.markercluster": "1.5.3", - "libphonenumber-js": "^1.12.35", - "maplibre-gl": "6.11.2", + "libphonenumber-js": "^1.13.15", + "maplibre-gl": "6.15.0", "marked": "~16.4.2", "moment": "^2.31.0", "moment-timezone": "^0.6.5", @@ -89,7 +91,7 @@ "ngx-hm-carousel": "^19.0.0", "ngx-markdown": "^20.1.0", "ngx-sharebuttons": "^17.0.0", - "ngx-translate-messageformat-compiler": "^7.2.0", + "ngx-translate-messageformat-compiler": "^7.3.0", "objectpath": "^2.0.0", "photoswipe": "^5.4.4", "qrcode": "^1.5.4", @@ -110,52 +112,54 @@ }, "devDependencies": { "@angular-builders/custom-esbuild": "20.0.0", - "@angular-devkit/build-angular": "20.3.34", - "@angular-devkit/core": "20.3.34", - "@angular-devkit/schematics": "20.3.34", - "@angular/build": "20.3.34", - "@angular/cli": "20.3.34", - "@angular/compiler-cli": "20.3.28", - "@angular/language-service": "20.3.28", + "@angular-devkit/core": "20.3.41", + "@angular-devkit/schematics": "20.3.41", + "@angular/build": "20.3.41", + "@angular/cli": "20.3.41", + "@angular/compiler-cli": "20.3.34", + "@angular/language-service": "20.3.34", + "@cyclonedx/cyclonedx-library": "10.3.0", "@types/ace-diff": "^2.1.4", "@types/canvas-gauges": "^2.1.8", "@types/flot": "^0.0.36", "@types/flowjs": "^2.13.14", - "@types/jquery": "^3.5.33", + "@types/jquery": "^3.5.34", "@types/js-beautify": "^1.14.3", - "@types/leaflet": "1.9.14", - "@types/leaflet-polylinedecorator": "1.6.4", - "@types/leaflet-providers": "1.2.4", - "@types/leaflet.gridlayer.googlemutant": "0.4.9", - "@types/leaflet.markercluster": "1.5.5", - "@types/lodash": "^4.17.22", - "@types/node": "~22.18.13", - "@types/raphael": "^2.3.9", - "@types/systemjs": "6.15.3", + "@types/leaflet": "1.9.22", + "@types/leaflet-polylinedecorator": "1.6.5", + "@types/leaflet-providers": "1.2.5", + "@types/leaflet.gridlayer.googlemutant": "0.4.11", + "@types/leaflet.markercluster": "1.5.6", + "@types/lodash": "^4.17.27", + "@types/node": "~22.20.5", + "@types/raphael": "^2.3.10", + "@types/systemjs": "6.15.4", "@types/tinycolor2": "^1.4.6", "@types/tooltipster": "^0.0.35", + "@yarnpkg/lockfile": "1.1.0", "angular-eslint": "~20.7.0", - "autoprefixer": "^10.4.23", - "directory-tree": "^3.5.2", - "eslint": "9.39.4", + "autoprefixer": "^10.6.1", + "directory-tree": "^3.6.0", + "eslint": "9.39.5", "eslint-plugin-import": "^2.32.0", - "eslint-plugin-jsdoc": "^62.4.1", + "eslint-plugin-jsdoc": "^62.9.0", "eslint-plugin-prefer-arrow": "^1.2.3", - "eslint-plugin-tailwindcss": "^3.18.2", + "eslint-plugin-tailwindcss": "^3.18.3", "ngrx-store-freeze": "^0.2.4", + "normalize-package-data": "8.0.0", + "packageurl-js": "2.0.1", "patch-package": "^8.0.1", - "postcss": "^8.5.6", + "postcss": "^8.5.31", "postinstall-prepare": "^2.0.0", + "spdx-expression-parse": "4.0.0", "tailwindcss": "^3.4.19", "ts-node": "^10.9.2", "typescript": "~5.9.3", - "typescript-eslint": "^8.54.0" + "typescript-eslint": "^8.72.0" }, "resolutions": { - "@babel/core": "7.29.7", "esbuild": "0.28.1", "rollup": "4.59.0", - "less": ">=4.9.0", "js-beautify/**/minimatch": "^9.0.7" } } diff --git a/ui-ngx/patches/@angular+build+20.3.34.patch b/ui-ngx/patches/@angular+build+20.3.41.patch similarity index 100% rename from ui-ngx/patches/@angular+build+20.3.34.patch rename to ui-ngx/patches/@angular+build+20.3.41.patch diff --git a/ui-ngx/patches/@angular+core+20.3.28.patch b/ui-ngx/patches/@angular+core+20.3.34.patch similarity index 100% rename from ui-ngx/patches/@angular+core+20.3.28.patch rename to ui-ngx/patches/@angular+core+20.3.34.patch diff --git a/ui-ngx/patches/@iplab+ngx-color-picker+20.0.0.patch b/ui-ngx/patches/@iplab+ngx-color-picker+20.1.0.patch similarity index 100% rename from ui-ngx/patches/@iplab+ngx-color-picker+20.0.0.patch rename to ui-ngx/patches/@iplab+ngx-color-picker+20.1.0.patch diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index 5442028c2c..7758fa08fc 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -57,7 +57,7 @@ install-node-and-yarn - v22.22.2 + v22.23.4 v1.22.22 @@ -70,6 +70,16 @@ install --non-interactive --check-files --network-concurrency 4 --network-timeout 100000 --mutex network + + generate sbom + + yarn + + + ${sbom.ui.skip} + run sbom pkg:maven/${project.groupId}/${project.artifactId}@${project.version} + + @@ -79,30 +89,6 @@ true - - org.apache.maven.plugins - maven-resources-plugin - - - copy-resources - generate-resources - - copy-resources - - - ${project.build.outputDirectory}/converters - - - src/assets/converters - - **/*.raw - - - - - - - org.apache.maven.plugins maven-clean-plugin diff --git a/ui-ngx/src/app/app.component.ts b/ui-ngx/src/app/app.component.ts index 3b93872bb1..b811c7fc2c 100644 --- a/ui-ngx/src/app/app.component.ts +++ b/ui-ngx/src/app/app.component.ts @@ -14,7 +14,7 @@ import { LocalStorageService } from '@core/local-storage/local-storage.service'; import { DomSanitizer } from '@angular/platform-browser'; import { MatIconRegistry } from '@angular/material/icon'; import { getCurrentAuthState, selectUserReady } from '@core/auth/auth.selectors'; -import { filter, skip, tap } from 'rxjs/operators'; +import { filter, skip, switchMap, take, takeWhile, tap } from 'rxjs/operators'; import { AuthService } from '@core/auth/auth.service'; import { DashboardReportService } from '@core/http/dashboard-report.service'; import { DevelopmentService } from '@core/http/development.service'; @@ -25,6 +25,9 @@ import { initCustomJQueryEvents } from '@shared/models/jquery-event.models'; import { TranslateDefaultLoader } from '@core/translate/translate-default-loader'; import { SystemSetupService } from '@core/http/system-setup.service'; import { SystemSetupState } from '@shared/models/system-setup.models'; +import { NavigationEnd, NavigationError, Router } from '@angular/router'; +import { ToastNotificationService } from '@core/services/toast-notification.service'; +import { NotificationMessage } from '@core/notification/notification.models'; @Component({ selector: 'tb-root', @@ -43,7 +46,9 @@ export class AppComponent { private authService: AuthService, private reportService: DashboardReportService, private developmentService: DevelopmentService, - private systemSetupService: SystemSetupService) { + private systemSetupService: SystemSetupService, + private router: Router, + private toastNotificationService: ToastNotificationService) { if (!env.production) { console.log(`ThingsBoard Version: ${env.tbVersion}`); @@ -85,6 +90,29 @@ export class AppComponent { }); this.routeAuthenticationChangesWhileSetupIsIncomplete(); + this.gotoDefaultPlaceOnInitialNavigationError(); + } + + private gotoDefaultPlaceOnInitialNavigationError() { + const pendingNotifications: NotificationMessage[] = []; + this.toastNotificationService.getNotification().pipe( + takeWhile(() => !this.router.navigated) + ).subscribe((notification) => pendingNotifications.push(notification)); + this.router.events.pipe( + filter((event) => event instanceof NavigationError && !this.router.navigated), + take(1), + switchMap(() => { + this.authService.gotoDefaultPlace(getCurrentAuthState(this.store).isAuthenticated); + return this.router.events.pipe( + filter((event) => event instanceof NavigationEnd), + take(1) + ); + }) + ).subscribe(() => { + setTimeout(() => { + pendingNotifications.forEach((notification) => this.toastNotificationService.dispatchNotification(notification)); + }); + }); } /** diff --git a/ui-ngx/src/app/core/http/ai-chat.service.ts b/ui-ngx/src/app/core/http/ai-chat.service.ts index 1fa17f17f0..76b343c072 100644 --- a/ui-ngx/src/app/core/http/ai-chat.service.ts +++ b/ui-ngx/src/app/core/http/ai-chat.service.ts @@ -54,9 +54,21 @@ export class AiChatService { } public sendChatMessage(chatId: string, request: SendChatMessageRequest, config?: RequestConfig): Observable { + return this.streamEvents(`/api/ai/chats/${chatId}/messages`, request, config); + } + + /** + * Follows the reply still running in the chat: a 'turnResumed' event, every event of the reply so far, then the + * live ones. Completes with no events when nothing is running. + */ + public resumeChat(chatId: string, config?: RequestConfig): Observable { + return this.streamEvents(`/api/ai/chats/${chatId}/resume`, null, config); + } + + private streamEvents(url: string, body: any, config?: RequestConfig): Observable { let lastLength = 0; let buffer = ''; - return this.http.post(`/api/ai/chats/${chatId}/messages`, request, { + return this.http.post(url, body, { ...defaultHttpOptions(config?.ignoreLoading, config?.ignoreErrors), observe: 'events', reportProgress: true, diff --git a/ui-ngx/src/app/core/http/ai-resource.service.ts b/ui-ngx/src/app/core/http/ai-resource.service.ts new file mode 100644 index 0000000000..daa465f5d8 --- /dev/null +++ b/ui-ngx/src/app/core/http/ai-resource.service.ts @@ -0,0 +1,218 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { Injectable } from '@angular/core'; +import { HttpClient, HttpErrorResponse, HttpEvent, HttpEventType } from '@angular/common/http'; +import { defaultHttpOptions, defaultHttpUploadOptions } from '@core/http/http-utils'; +import { from, Observable, of, Subscription, throwError } from 'rxjs'; +import { catchError, filter, finalize, map, shareReplay, switchMap } from 'rxjs/operators'; +import { AiResourceConfig, AiResourceInfo } from '@shared/models/ai-chat.models'; + +export type AiResourceUploadEvent = + { type: 'progress'; progress: number } | + { type: 'done'; resource: AiResourceInfo }; + +interface CachedUrl { + url$: Observable; + url?: string; + size: number; + dropped?: boolean; +} + +const MAX_CONCURRENT_FETCHES = 3; +const MAX_CACHED_URLS = 40; +const MAX_CACHED_BYTES = 64 * 1024 * 1024; + +@Injectable({ + providedIn: 'root' +}) +export class AiResourceService { + + private config$: Observable; + + private readonly urls = new Map(); + + private readonly waitingFetches: Array<() => void> = []; + + private activeFetches = 0; + + constructor(private http: HttpClient) { + } + + getConfig(): Observable { + if (!this.config$) { + this.config$ = this.http.get('/api/ai/resources/config', defaultHttpOptions(true, true)).pipe( + catchError(() => { + this.config$ = null; + return of(null); + }), + shareReplay(1) + ); + } + return this.config$; + } + + upload(file: File): Observable { + const formData = new FormData(); + formData.append('file', file, file.name); + return this.http.post('/api/ai/resources', formData, { + ...defaultHttpUploadOptions(true, true), + observe: 'events', + reportProgress: true + }).pipe( + filter((event: HttpEvent) => event.type === HttpEventType.UploadProgress || event.type === HttpEventType.Response), + map((event: HttpEvent): AiResourceUploadEvent => { + if (event.type === HttpEventType.UploadProgress) { + return {type: 'progress', progress: event.total ? Math.round(100 * event.loaded / event.total) : 0}; + } + return {type: 'done', resource: (event as any).body as AiResourceInfo}; + }) + ); + } + + delete(resourceId: string): Observable { + this.forget(resourceId); + return this.http.delete(`/api/ai/resources/${resourceId}`, defaultHttpOptions(true, true)); + } + + rememberUrl(resourceId: string, url: string, size: number): void { + this.forget(resourceId); + this.urls.set(resourceId, {url$: of(url), url, size}); + this.evict(resourceId); + } + + getUrl(resourceId: string): Observable { + const cached = this.urls.get(resourceId); + if (cached) { + this.urls.delete(resourceId); + this.urls.set(resourceId, cached); + return cached.url$; + } + const entry: CachedUrl = {url$: null, size: 0}; + entry.url$ = this.fetch(resourceId).pipe( + map(blob => { + const url = URL.createObjectURL(blob); + if (entry.dropped) { + setTimeout(() => URL.revokeObjectURL(url)); + } else { + entry.url = url; + entry.size = blob.size; + this.evict(resourceId); + } + return url; + }), + catchError(error => { + if (this.urls.get(resourceId) === entry) { + this.urls.delete(resourceId); + } + throw error; + }), + shareReplay(1) + ); + this.urls.set(resourceId, entry); + return entry.url$; + } + + download(resource: AiResourceInfo): Observable { + const cachedUrl = this.urls.get(resource.id)?.url; + if (cachedUrl) { + this.save(cachedUrl, resource.name); + return of(undefined); + } + return this.fetch(resource.id).pipe( + map(blob => { + const url = URL.createObjectURL(blob); + this.save(url, resource.name); + setTimeout(() => URL.revokeObjectURL(url)); + }) + ); + } + + private save(url: string, name: string): void { + const link = document.createElement('a'); + link.href = url; + link.download = name; + document.body.appendChild(link); + link.click(); + link.remove(); + } + + private fetch(resourceId: string): Observable { + const request$ = this.http.get(`/api/ai/resources/${resourceId}`, {...defaultHttpOptions(true, true), responseType: 'blob'}).pipe( + catchError(error => this.readErrorBody(error)) + ); + return new Observable(subscriber => { + let subscription: Subscription; + let finished = false; + const finish = () => { + if (!finished) { + finished = true; + this.activeFetches--; + this.waitingFetches.shift()?.(); + } + }; + const start = () => { + this.activeFetches++; + subscription = request$.pipe(finalize(finish)).subscribe(subscriber); + }; + if (this.activeFetches < MAX_CONCURRENT_FETCHES) { + start(); + } else { + this.waitingFetches.push(start); + } + return () => { + const index = this.waitingFetches.indexOf(start); + if (index >= 0) { + this.waitingFetches.splice(index, 1); + } + subscription?.unsubscribe(); + }; + }); + } + + private readErrorBody(error: any): Observable { + if (!(error instanceof HttpErrorResponse) || !(error.error instanceof Blob)) { + return throwError(() => error); + } + return from(error.error.text()).pipe( + catchError(() => of('')), + switchMap(text => throwError(() => new HttpErrorResponse({ + error: text || null, + headers: error.headers, + status: error.status, + statusText: error.statusText, + url: error.url ?? undefined + }))) + ); + } + + private forget(resourceId: string): void { + const entry = this.urls.get(resourceId); + if (entry) { + this.urls.delete(resourceId); + this.release(entry); + } + } + + private release(entry: CachedUrl): void { + entry.dropped = true; + if (entry.url) { + URL.revokeObjectURL(entry.url); + } + } + + private evict(keep: string): void { + let bytes = 0; + this.urls.forEach(entry => bytes += entry.size); + for (const [resourceId, entry] of this.urls) { + if (this.urls.size <= MAX_CACHED_URLS && bytes <= MAX_CACHED_BYTES) { + break; + } + if (resourceId !== keep && entry.url) { + this.urls.delete(resourceId); + bytes -= entry.size; + this.release(entry); + } + } + } + +} diff --git a/ui-ngx/src/app/core/http/iot-hub-api.service.ts b/ui-ngx/src/app/core/http/iot-hub-api.service.ts index 439976d6c5..fa040e8632 100644 --- a/ui-ngx/src/app/core/http/iot-hub-api.service.ts +++ b/ui-ngx/src/app/core/http/iot-hub-api.service.ts @@ -13,13 +13,13 @@ import { MpItemVersionView } from '@shared/models/iot-hub/iot-hub-version.models'; import { CreatorView } from '@shared/models/iot-hub/iot-hub-creator.models'; -import { IotHubInstalledItem, InstallItemVersionResult, InstallPlan, InstallPlanResult, UpdateItemVersionResult, ItemPublishedVersionInfo } from '@shared/models/iot-hub/iot-hub-installed-item.models'; +import { DevicePackageEntityState, DeviceUpdateRequest, DeviceUpdateResult, IotHubInstalledItem, IotHubInstalledItemKeptEntities, InstallItemVersionResult, InstallPlan, InstallPlanResult, UpdateItemVersionResult, ItemPublishedVersionInfo } from '@shared/models/iot-hub/iot-hub-installed-item.models'; import { ItemType, ItemTypeFilterInfo, WidgetCategory } from '@shared/models/iot-hub/iot-hub-item.models'; import { InterceptorHttpParams } from '@core/interceptors/interceptor-http-params'; import { InterceptorConfig } from '@core/interceptors/interceptor-config'; import { AppState } from '@core/core.state'; import { getCurrentAuthState } from '@core/auth/auth.selectors'; -import { DeviceConnectivitySettings } from '@shared/models/settings.models'; +import { ResolvedDeviceConnectivitySettings } from '@shared/models/settings.models'; import { environment as env } from '@env/environment'; export function tbVersionToInt(version: string): number { @@ -170,8 +170,8 @@ export class IotHubApiService { }); } - public getConnectivitySettings(config?: IotHubRequestConfig): Observable { - return this.http.get( + public getConnectivitySettings(config?: IotHubRequestConfig): Observable { + return this.http.get( `/api/iot-hub/connectivity`, { params: this.buildParams(config) } ); @@ -179,7 +179,7 @@ export class IotHubApiService { public registerDeviceInstall( versionId: string, - descriptor: { type?: string; createdEntityIds: { entityType: string; id: string }[]; dashboardId?: { entityType: string; id: string }; selectedInstallMethod?: string; installState?: Record }, + descriptor: { type?: string; createdEntityIds: { entityType: string; id: string }[]; usedExistingEntityIds?: { entityType: string; id: string }[]; dashboardId?: { entityType: string; id: string }; selectedInstallMethod?: string; installState?: Record }, config?: IotHubRequestConfig ): Observable { return this.http.post( @@ -269,6 +269,30 @@ export class IotHubApiService { ); } + /** The entities of an installed device package as they are now: whether they exist, changed since, or are shared. */ + public checkDeviceUpdate(installedItemId: string, config?: IotHubRequestConfig): Observable { + return this.http.get( + `/api/iot-hub/installedItems/${installedItemId}/deviceUpdate/check`, + { params: this.buildParams(config) } + ); + } + + /** Applies a device package update in one transaction: all of it, or nothing. */ + public updateDevicePackage(installedItemId: string, request: DeviceUpdateRequest, config?: IotHubRequestConfig): Observable { + return this.http.post( + `/api/iot-hub/installedItems/${installedItemId}/deviceUpdate`, + request, + { params: this.buildParams(config) } + ); + } + + public getInstalledItemKeptEntities(installedItemId: string, config?: IotHubRequestConfig): Observable { + return this.http.get( + `/api/iot-hub/installedItems/${installedItemId}/keptEntities`, + { params: this.buildParams(config) } + ); + } + public getItemsPublishedVersions(itemIds: string[], config?: IotHubRequestConfig): Observable { return this.http.post( `${this.baseUrl}/api/versions/publishedVersions`, diff --git a/ui-ngx/src/app/core/http/solutions-creator.service.ts b/ui-ngx/src/app/core/http/solutions-creator.service.ts index bcf5655b7f..2cfc4b2bb2 100644 --- a/ui-ngx/src/app/core/http/solutions-creator.service.ts +++ b/ui-ngx/src/app/core/http/solutions-creator.service.ts @@ -39,8 +39,10 @@ export class SolutionsCreatorService { return this.http.post(`/api/ai/solution/${solutionId}/create`, '', defaultHttpOptionsFromConfig(config)); } - public chatSolution(solutionId: string, step: SolutionStep, msg: string, config?: RequestConfig): Observable { - return this.http.post(`/api/ai/solution/${solutionId}/${step}/chat`, msg, defaultHttpOptionsFromConfig(config)); + public chatSolution(solutionId: string, step: SolutionStep, msg: string, config?: RequestConfig, + resources: string[] = []): Observable { + return this.http.post(`/api/ai/solution/${solutionId}/${step}/messages`, + {message: msg, resources}, defaultHttpOptionsFromConfig(config)); } public updateSolutionData(solutionId: string, dataKey: SolutionDataKey, msg: SolutionDataValues, config?: RequestConfig): Observable { diff --git a/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss b/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss index 666741c3f4..c44b7923e8 100644 --- a/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss +++ b/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss @@ -8,7 +8,6 @@ $agent-text-hint: rgba(0, 0, 0, 0.38); $agent-divider: rgba(0, 0, 0, 0.12); $agent-divider-light: rgba(0, 0, 0, 0.08); -$agent-ink-76: rgba(0, 0, 0, 0.76); $agent-ink-60: rgba(0, 0, 0, 0.6); $agent-ink-42: rgba(0, 0, 0, 0.42); $agent-ink-24: rgba(0, 0, 0, 0.24); @@ -33,9 +32,7 @@ $agent-error-surface: #fdecea; $agent-error-surface-light: #ffebee; $agent-info-surface: #e3f2fd; $agent-warning-surface: #fff8e1; -$agent-warning-text: #6d4c00; $agent-warning-border: #ffe082; -$agent-warning-icon: #c79100; $agent-code-bg: #1e1e1e; $agent-code-fg: #d4d4d4; $agent-editor-fg: #1f2328; @@ -66,27 +63,6 @@ $agent-type-generic-fg: #6a1b9a; @include agent-type-palette; } -@mixin agent-info-box { - display: flex; - align-items: flex-start; - gap: 12px; - padding: 12px 16px; - border-radius: 4px; - font-size: 13px; - line-height: 1.5; - mat-icon { - flex-shrink: 0; - font-size: 20px; - width: 20px; - height: 20px; - } -} - -@mixin agent-info-box-tone { - background: $agent-info-surface; - color: $agent-color-info; -} - @mixin agent-command-block { position: relative; background: $agent-code-bg; diff --git a/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.html b/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.html index 4d07407836..3e7222143f 100644 --- a/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.html @@ -29,8 +29,8 @@
{{ dockerCommand }}
-
- info +
+ info_outline agent.install-instructions-replace-hint
diff --git a/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.scss b/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.scss index c498e8018f..4373feb38f 100644 --- a/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/agent-install-instructions.component.scss @@ -88,8 +88,3 @@ } } } - -.tb-info-box { - @include agent-info-box; - @include agent-info-box-tone; -} diff --git a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html index ba758ca850..88855e5893 100644 --- a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html @@ -20,11 +20,11 @@ -
- auto_awesome +
+ info_outline
-

{{ infoTitleKey | translate }}

-

{{ infoBodyKey | translate }}

+
{{ infoTitleKey | translate }}
+
{{ infoBodyKey | translate }}
@@ -135,19 +135,15 @@
{{ dockerCommand }}
-
- info -
-

{{ infoBodyKey | translate }}

-
+
+ info_outline + {{ infoBodyKey | translate }}
} @else { -
+
error_outline -
-

edge.auto-provision-no-script

-
+ edge.auto-provision-no-script
} diff --git a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss index 4204d78207..c3f58c4989 100644 --- a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss @@ -118,36 +118,6 @@ } } -.tb-info-box { - @include agent-info-box; - margin: 0 0 16px; - - p { - margin: 0 0 6px; - font-size: inherit; - line-height: inherit; - &:last-child { margin-bottom: 0; } - } - - .info-title { - font-weight: 500; - } - - &.info { - background: $agent-info-surface; - color: $agent-color-info; - - mat-icon { color: $agent-color-info; } - } - - &.invalid { - background: $agent-error-surface; - color: $agent-color-error; - - mat-icon { color: $agent-color-error; } - } -} - .success-banner { display: flex; align-items: center; diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss b/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss index 49a8d13fd7..689721caf0 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss @@ -128,24 +128,6 @@ @mixin wizard-step-basics { .hint { font-size: 13px; color: $agent-text-secondary; margin: 0 0 16px; } - .tb-app-compose-hint { - display: flex; - align-items: center; - gap: 6px; - margin-bottom: 16px; - padding: 6px 10px; - border-radius: 4px; - background: $agent-warning-surface; - color: $agent-warning-text; - font-size: 12px; - .tb-app-compose-hint-icon { - font-size: 16px; - width: 16px; - height: 16px; - color: $agent-warning-icon; - } - } - .loading-state, .error-state { display: flex; align-items: center; gap: 12px; padding: 12px; color: $agent-text-secondary; } @@ -162,27 +144,6 @@ .config-toggle { display: flex; justify-content: center; margin-bottom: 16px; } - - .tb-agent-deploy-note { - display: flex; - align-items: flex-start; - gap: 10px; - margin: 0 0 16px; - padding: 12px 16px; - border-radius: 8px; - background: color-mix(in srgb, var(--tb-primary-500) 6%, transparent); - font-size: 13px; - line-height: 1.5; - color: $agent-ink-76; - - mat-icon { - flex-shrink: 0; - color: var(--tb-primary-500); - font-size: 20px; - width: 20px; - height: 20px; - } - } } @mixin wizard-type-cards { @@ -496,10 +457,4 @@ .tb-type-badge { @include agent-type-badge; } - - .info-box { - @include agent-info-box; - @include agent-info-box-tone; - margin-bottom: 16px; - } } diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html index 9be619233e..8714ed94dc 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html @@ -55,9 +55,8 @@ } @if (selectAgent && !embedded && !checkingManaged && !managedApp) { -
- auto_awesome +
+ info_outline agent.deploy-via-agent-desc
} @@ -236,8 +235,8 @@ } @if (relatedEntityId) { -
- info_outline +
+ info_outline agent.app-compose-creds-overridden-hint
} @@ -300,8 +299,8 @@
}
-
- info +
+ info_outline agent.app-install-confirm-info
@if (relatedEntityId) { -
- info_outline +
+ info_outline agent.app-compose-creds-overridden-hint
} @@ -167,8 +167,8 @@ }
-
- info +
+ info_outline agent.app-install-confirm-info
diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html index d9a7ea8f85..aba02480fa 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html @@ -167,8 +167,8 @@
}
-
- info +
+ info_outline agent.app-upgrade-rollback-info
+ +
diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss index 50be2f008d..0e5550eb38 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.scss @@ -36,6 +36,7 @@ flex: 1; min-height: 0; width: 464px; + overflow: hidden; &.fill { margin: 0; @@ -47,6 +48,10 @@ } } + .ai-assistant-composer { + flex: none; + } + .ai-assistant-header { display: flex; align-items: center; @@ -70,7 +75,7 @@ display: flex; overflow: hidden; flex: 1; - padding: 0 24px 24px; + padding: 0 24px 16px; gap: 16px; flex-direction: column; diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts index 806f8bc4b8..fb7dadc790 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts @@ -10,15 +10,18 @@ import { OnInit, SecurityContext, signal, + untracked, ViewChild } from '@angular/core'; -import { ChatMessage } from '@shared/models/solution-creator.models'; -import { Observable, of, Subject } from 'rxjs'; -import { concatMap, finalize, switchMap, takeUntil, tap } from 'rxjs/operators'; +import { ApprovalChatMessage, ChatMessage } from '@shared/models/solution-creator.models'; +import { EMPTY, Observable, of, Subject, throwError, timer } from 'rxjs'; +import { catchError, concatMap, finalize, retry, switchMap, takeUntil, tap } from 'rxjs/operators'; +import { HttpErrorResponse } from '@angular/common/http'; import { AiChatService } from '@core/http/ai-chat.service'; import { AiAssistantPromptExample, AiChatClientContext, + AiPromptMessage, ApprovalResult, ChatEvent, ChatInfo, @@ -145,11 +148,20 @@ export class AiAssistantPanelComponent implements OnInit { private cancelMessage$ = new Subject(); private sessionAffectedEntities: EntityId[] = []; private messageCancelled = false; + private resumeOnOpen = false; + + private static readonly RESUME_ATTEMPTS = 4; + private static readonly RESUME_DELAY_MS = 2000; private openEffect = effect(() => { if (this.panelService.open()) { this.dropChatFromOtherContext(); this.loadChats(); + const chatId = untracked(() => this.chatId()); + if (this.resumeOnOpen && chatId) { + this.resumeOnOpen = false; + this.loadChat$.next(chatId); + } } else { this.slideDone.set(false); this.suspendOnClose(); @@ -172,12 +184,18 @@ export class AiAssistantPanelComponent implements OnInit { ngOnInit() { this.loadChat$.pipe( - switchMap(id => { - return this.aiChat.getChatMessages(id, {ignoreLoading: true, ignoreErrors: true}); - }), + switchMap(id => this.aiChat.getChatMessages(id, {ignoreLoading: true, ignoreErrors: true}).pipe( + catchError(err => { + this.messages.set([]); + this.completedExecutions.set({}); + setTimeout(() => this.showErrorMessage(err), 0); + return EMPTY; + }) + )), takeUntilDestroyed(this.destroyRef) ).subscribe(messages => { - this.messages.set(messages); + this.showHistory(messages); + this.resumeTurn(this.chatId()); }); } @@ -223,11 +241,19 @@ export class AiAssistantPanelComponent implements OnInit { this.promptInput?.setValue(example.message); } - sendMsgFromUser(msg: string): void { - this.messages.update(list => [...list, {from: 'USER', content: msg}]); - this.sendMessage(msg).subscribe({ + sendMsgFromUser(prompt: AiPromptMessage): void { + const userMessage: ChatMessage = prompt.resources.length + ? {from: 'USER', content: prompt.message, resources: prompt.resources} + : {from: 'USER', content: prompt.message}; + this.messages.update(list => [...list, userMessage]); + this.sendMessage(prompt).subscribe({ error: (err) => { - this.messages.update(list => list.slice(0, -1)); + if (this.isConnectionLost(err) && this.chatId()) { + this.showErrorToast(this.translate.instant('ai-assistant.connection-lost')); + this.resumeTurn(this.chatId(), true); + return; + } + this.messages.update(list => list.filter(message => message !== userMessage)); setTimeout(() => { this.showErrorMessage(err); }, 0); @@ -254,13 +280,11 @@ export class AiAssistantPanelComponent implements OnInit { this.promptInput?.reset(); } - // Keeps the open chat so reopening shows it right away, unless an interrupted reply left it stale. + // Keeps the open chat so reopening shows it right away. A reply interrupted by closing keeps running on the + // server, so reopening reloads the chat and follows that reply. private suspendOnClose(): void { - if (this.loading()) { - this.reset(); - } else { - this.cancelActiveMessage(); - } + this.resumeOnOpen = this.loading(); + this.cancelActiveMessage(); } private dropChatFromOtherContext(): void { @@ -335,7 +359,7 @@ export class AiAssistantPanelComponent implements OnInit { } } - private sendMessage(msg: string): Observable { + private sendMessage(prompt: AiPromptMessage): Observable { this.initLoadingState(); this.sessionAffectedEntities = []; this.messageCancelled = false; @@ -352,9 +376,12 @@ export class AiAssistantPanelComponent implements OnInit { ); const request: SendChatMessageRequest = { - message: msg, + message: prompt.message, clientContext: this.resolveClientContextToSend() }; + if (prompt.resources.length) { + request.resources = prompt.resources.map(resource => resource.id); + } return startOrContinue$.pipe( switchMap(() => this.aiChat.sendChatMessage(this.chatId(), request, {ignoreLoading: true, ignoreErrors: true})), @@ -379,6 +406,90 @@ export class AiAssistantPanelComponent implements OnInit { return (!chatId || !isEqual(currentContext, alreadySent)) ? currentContext : undefined; } + private showHistory(messages: ChatMessage[]): void { + const completed: Record = {}; + for (const message of messages) { + if (message.from === 'APPROVAL' && (message as ApprovalChatMessage).result) { + const result = (message as ApprovalChatMessage).result; + completed[result.executionId] = result; + } + } + this.completedExecutions.set(completed); + this.messages.set(messages); + } + + // Follows the reply still running in the chat, if any: after a reload, a reopened panel or a lost connection. + // The server replays the whole reply, so what the history already shows of it is dropped first. + private resumeTurn(chatId: string, afterConnectionLoss = false): void { + if (!chatId) { + return; + } + let resumed = false; + this.messageCancelled = false; + this.sessionAffectedEntities = []; + const attempt$ = timer(afterConnectionLoss ? AiAssistantPanelComponent.RESUME_DELAY_MS : 0).pipe( + tap(() => { + if (afterConnectionLoss) { + this.initLoadingState(); + } + }), + switchMap(() => this.aiChat.resumeChat(chatId, {ignoreLoading: true, ignoreErrors: true})) + ); + attempt$.pipe( + retry({ + count: afterConnectionLoss ? AiAssistantPanelComponent.RESUME_ATTEMPTS : 0, + delay: (error, attempt) => this.isConnectionLost(error) + ? timer(attempt * AiAssistantPanelComponent.RESUME_DELAY_MS) + : throwError(() => error) + }), + takeUntil(this.cancelMessage$), + concatMap(event => { + if (event.event === 'turnResumed') { + resumed = true; + this.initLoadingState(); + this.dropRunningReply(); + return of(event); + } + return this.handleChatEvent(event); + }), + finalize(() => { + if (resumed || afterConnectionLoss) { + this.stopLoadingState(); + } + }) + ).subscribe({ + error: () => { + if (afterConnectionLoss) { + this.showErrorToast(this.translate.instant('ai-assistant.reconnect-failed')); + } + }, + complete: () => { + if (this.messageCancelled || this.chatId() !== chatId) { + return; + } + if (this.sessionAffectedEntities.length) { + this.panelService.emitUpdatedData(this.sessionAffectedEntities); + } + if (resumed || afterConnectionLoss) { + this.aiChat.getChatMessages(chatId, {ignoreLoading: true, ignoreErrors: true}) + .pipe(takeUntil(this.cancelMessage$)) + .subscribe(messages => this.showHistory(messages)); + } + } + }); + } + + private dropRunningReply(): void { + this.messages.update(list => { + const lastUser = list.map(message => message.from).lastIndexOf('USER'); + return lastUser >= 0 ? list.slice(0, lastUser + 1) : list; + }); + } + + private isConnectionLost(error: any): boolean { + return error instanceof HttpErrorResponse && error.status === 0; + } + private handleChatEvent(chatMsg: ChatEvent): Observable { switch (chatMsg.event) { case 'assistantMessage': @@ -426,7 +537,7 @@ export class AiAssistantPanelComponent implements OnInit { this.loading.set(false); } - private showErrorMessage(error: any): void { + showErrorMessage(error: any): void { const responseType = isNotEmptyStr(error?.error) ? 'text' : undefined; const message = parseHttpErrorMessage(error, this.translate, responseType, this.sanitizer).message; this.showErrorToast(message); diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.html b/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.html new file mode 100644 index 0000000000..e81e8a2cf7 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.html @@ -0,0 +1,32 @@ + + +

{{ data.resource.name }}

+ + + +
+
+ @if (preview$ | async; as preview) { + @if (preview.url) { + + } @else { +
+ broken_image + {{ preview.error }} +
+ } + } @else { + + } +
diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.scss new file mode 100644 index 0000000000..a99a8a99b3 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.scss @@ -0,0 +1,50 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +:host { + display: flex; + flex-direction: column; + min-width: min(360px, 90vw); + max-height: 90vh; + + .preview-title { + margin: 0; + font-size: 16px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + + .preview-content { + display: flex; + align-items: center; + justify-content: center; + padding: 0 16px 16px; + max-height: calc(90vh - 64px); + overflow: auto; + + img { + max-width: 100%; + max-height: calc(90vh - 96px); + object-fit: contain; + border-radius: 8px; + } + + .preview-error { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; + padding: 32px 16px; + max-width: 360px; + color: rgba(0, 0, 0, 0.54); + text-align: center; + + mat-icon { + width: 40px; + height: 40px; + font-size: 40px; + color: rgba(0, 0, 0, 0.38); + } + } + } +} diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.ts new file mode 100644 index 0000000000..a456faf3b8 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-attachment-preview-dialog.component.ts @@ -0,0 +1,74 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { Component, Inject, SecurityContext } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { Router } from '@angular/router'; +import { Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { DomSanitizer } from '@angular/platform-browser'; +import { Observable, of } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import { AppState } from '@core/core.state'; +import { DialogComponent } from '@shared/components/dialog.component'; +import { ActionNotificationShow } from '@core/notification/notification.actions'; + +import { aiServerMessage } from '@home/components/ai/ai-attachment.models'; +import { AiResourceService } from '@core/http/ai-resource.service'; +import { AiResourceInfo } from '@shared/models/ai-chat.models'; + +export interface AiAttachmentPreviewDialogData { + resource: AiResourceInfo; +} + +interface AiAttachmentPreview { + url?: string; + error?: string; +} + +@Component({ + selector: 'tb-ai-attachment-preview-dialog', + templateUrl: './ai-attachment-preview-dialog.component.html', + styleUrls: ['./ai-attachment-preview-dialog.component.scss'], + standalone: false +}) +export class AiAttachmentPreviewDialogComponent extends DialogComponent { + + readonly preview$: Observable; + + constructor(protected store: Store, + protected router: Router, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: AiAttachmentPreviewDialogData, + private aiResourceService: AiResourceService, + private translate: TranslateService, + private sanitizer: DomSanitizer) { + super(store, router, dialogRef); + this.preview$ = this.aiResourceService.getUrl(data.resource.id).pipe( + map(url => ({url})), + catchError(error => of({error: this.errorMessage(error)})) + ); + } + + download(): void { + this.aiResourceService.download(this.data.resource).subscribe({ + error: error => this.store.dispatch(new ActionNotificationShow({ + message: this.errorMessage(error), + target: 'aiAttachmentPreview', + modern: true, + type: 'error', + verticalPosition: 'bottom', + horizontalPosition: 'center' + })) + }); + } + + close(): void { + this.dialogRef.close(); + } + + private errorMessage(error: unknown): string { + const message = aiServerMessage(error); + return message ? this.sanitizer.sanitize(SecurityContext.HTML, message) ?? message : this.translate.instant('ai-assistant.attachment-load-failed'); + } + +} diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-attachment.models.ts b/ui-ngx/src/app/modules/home/components/ai/ai-attachment.models.ts new file mode 100644 index 0000000000..ea7e35c04f --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-attachment.models.ts @@ -0,0 +1,189 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { HttpErrorResponse } from '@angular/common/http'; +import { AI_IMAGE_MEDIA_TYPES } from '@shared/models/ai-chat.models'; + +const MAX_IMAGE_SIDE = 2560; +const MIN_SVG_SIDE = 1024; +const SVG_MEDIA_TYPE = 'image/svg+xml'; +const SVG_UNITS: Record = {'': 1, px: 1, pt: 4 / 3, pc: 16, in: 96, cm: 96 / 2.54, mm: 96 / 25.4}; + +export const AI_SVG_EXTENSION = '.svg'; + +export interface AiAttachmentKind { + icon: string; + label: string; +} + +export const aiAttachmentKind = (mediaType: string, name: string): AiAttachmentKind => { + const extension = name.split('.').pop()?.toLowerCase(); + if (mediaType?.startsWith('image/')) { + return {icon: 'image', label: 'ai-assistant.file-kind.image'}; + } + if (mediaType === 'application/pdf' || extension === 'pdf') { + return {icon: 'picture_as_pdf', label: 'ai-assistant.file-kind.pdf'}; + } + if (extension === 'xlsx' || extension === 'csv') { + return {icon: 'table_chart', label: 'ai-assistant.file-kind.table'}; + } + if (extension === 'docx') { + return {icon: 'description', label: 'ai-assistant.file-kind.document'}; + } + if (extension === 'pptx') { + return {icon: 'slideshow', label: 'ai-assistant.file-kind.slides'}; + } + if (extension === 'json') { + return {icon: 'data_object', label: 'ai-assistant.file-kind.json'}; + } + if (['txt', 'log', 'md', 'xml', 'yaml', 'yml', 'html', 'htm'].includes(extension)) { + return {icon: 'description', label: 'ai-assistant.file-kind.text'}; + } + return {icon: 'attach_file', label: 'ai-assistant.file-kind.file'}; +}; + +export const formatAiFileSize = (bytes: number): string => bytes >= 1048576 + ? (bytes / 1048576).toFixed(1).replace(/\.0$/, '') + ' MB' + : Math.max(1, Math.round(bytes / 1024)) + ' KB'; + +export const aiAttachmentExtension = (name: string): string => { + const dot = name.lastIndexOf('.'); + return dot > 0 ? name.substring(dot + 1).toUpperCase() : ''; +}; + +export const isAiSvg = (file: File): boolean => file.type === SVG_MEDIA_TYPE || file.name.toLowerCase().endsWith(AI_SVG_EXTENSION); + +export const isAiAttachmentAccepted = (file: File, extensions: string[]): boolean => { + const name = file.name.toLowerCase(); + return isAiSvg(file) || extensions.some(extension => name.endsWith(extension.toLowerCase())); +}; + +export const namePastedImage = (file: File): File => { + if (!AI_IMAGE_MEDIA_TYPES.includes(file.type) || (file.name && file.name !== 'image.png')) { + return file; + } + const stamp = new Date().toISOString().replace(/[-:]/g, '').replace('T', '-').substring(0, 15); + const extension = file.type === 'image/jpeg' ? 'jpg' : file.type.split('/')[1]; + return new File([file], `screenshot-${stamp}.${extension}`, {type: file.type, lastModified: file.lastModified}); +}; + +const loadImage = (file: File): Promise => new Promise((resolve, reject) => { + const url = URL.createObjectURL(file); + const image = new Image(); + image.onload = () => { + URL.revokeObjectURL(url); + resolve(image); + }; + image.onerror = () => { + URL.revokeObjectURL(url); + reject(new Error('Image could not be decoded')); + }; + image.src = url; +}); + +const encode = (canvas: HTMLCanvasElement, type: string, quality?: number): Promise => new Promise((resolve, reject) => + canvas.toBlob(blob => blob ? resolve(blob) : reject(new Error('Image could not be encoded')), type, quality)); + +export const fitAiImage = async (file: File, maxSize: number): Promise => { + if (!AI_IMAGE_MEDIA_TYPES.includes(file.type)) { + return file; + } + let image: HTMLImageElement; + try { + image = await loadImage(file); + } catch { + return file; + } + const scale = Math.min(1, MAX_IMAGE_SIDE / Math.max(image.naturalWidth, image.naturalHeight)); + if (scale === 1 && file.size <= maxSize) { + return file; + } + const canvas = document.createElement('canvas'); + canvas.width = Math.max(1, Math.round(image.naturalWidth * scale)); + canvas.height = Math.max(1, Math.round(image.naturalHeight * scale)); + const context = canvas.getContext('2d'); + if (file.type === 'image/jpeg') { + context.fillStyle = '#fff'; + context.fillRect(0, 0, canvas.width, canvas.height); + } + context.drawImage(image, 0, 0, canvas.width, canvas.height); + let blob = await encode(canvas, file.type, 0.92); + let type = file.type; + if (blob.size > maxSize) { + context.globalCompositeOperation = 'destination-over'; + context.fillStyle = '#fff'; + context.fillRect(0, 0, canvas.width, canvas.height); + blob = await encode(canvas, 'image/jpeg', 0.85); + type = 'image/jpeg'; + } + if (blob.size >= file.size && scale === 1) { + return file; + } + const base = file.name.replace(/\.[^.]+$/, ''); + const name = type === file.type ? file.name : `${base}.jpg`; + return new File([blob], name, {type, lastModified: file.lastModified}); +}; + +const svgLength = (value: string | null): number | null => { + const match = value?.trim().match(/^([0-9]*\.?[0-9]+(?:e[-+]?[0-9]+)?)\s*(px|pt|pc|in|cm|mm)?$/i); + const length = match ? parseFloat(match[1]) * SVG_UNITS[(match[2] ?? '').toLowerCase()] : NaN; + return length > 0 ? length : null; +}; + +export const svgToAiImage = async (file: File, maxSize: number): Promise => { + const document = new DOMParser().parseFromString(await file.text(), SVG_MEDIA_TYPE); + const svg = document.documentElement; + if (svg.localName !== 'svg' || document.getElementsByTagName('parsererror').length) { + throw new Error('Not an SVG image'); + } + Array.from(document.getElementsByTagNameNS('*', 'foreignObject')).forEach(node => node.remove()); + const viewBox = (svg.getAttribute('viewBox') ?? '').trim().split(/[\s,]+/).map(Number); + const hasViewBox = viewBox.length === 4 && viewBox[2] > 0 && viewBox[3] > 0; + let width = svgLength(svg.getAttribute('width')) ?? (hasViewBox ? viewBox[2] : null); + let height = svgLength(svg.getAttribute('height')) ?? (hasViewBox ? viewBox[3] : null); + if (!width || !height) { + width = width ?? height ?? MIN_SVG_SIDE; + height = height ?? width; + } + if (!hasViewBox) { + svg.setAttribute('viewBox', `0 0 ${width} ${height}`); + } + const scale = Math.min(MAX_IMAGE_SIDE / Math.max(width, height), Math.max(1, MIN_SVG_SIDE / Math.max(width, height))); + const canvas = window.document.createElement('canvas'); + canvas.width = Math.max(1, Math.round(width * scale)); + canvas.height = Math.max(1, Math.round(height * scale)); + svg.setAttribute('width', String(canvas.width)); + svg.setAttribute('height', String(canvas.height)); + const image = await loadImage(new File([new XMLSerializer().serializeToString(document)], file.name, {type: SVG_MEDIA_TYPE})); + const context = canvas.getContext('2d'); + context.fillStyle = '#fff'; + context.fillRect(0, 0, canvas.width, canvas.height); + context.drawImage(image, 0, 0, canvas.width, canvas.height); + let blob = await encode(canvas, 'image/png'); + let type = 'image/png'; + if (blob.size > maxSize) { + blob = await encode(canvas, 'image/jpeg', 0.85); + type = 'image/jpeg'; + } + const base = file.name.replace(/\.[^.]+$/, ''); + return new File([blob], `${base}.${type === 'image/png' ? 'png' : 'jpg'}`, {type, lastModified: file.lastModified}); +}; + +export function aiServerMessage(error: unknown): string | undefined { + if (!(error instanceof HttpErrorResponse)) { + return undefined; + } + let body: unknown = error.error; + if (typeof body === 'string') { + const text = body.trim(); + if (!text || text.startsWith('<')) { + return undefined; + } + try { + body = JSON.parse(text); + } catch { + return text; + } + } + const message = body && typeof body === 'object' ? (body as {message?: unknown}).message : undefined; + return typeof message === 'string' && message.trim() ? message.trim() : undefined; +} diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.html b/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.html new file mode 100644 index 0000000000..db8c319e86 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.html @@ -0,0 +1,30 @@ + +
+ @for (item of shown; track item.resource.id) { +
+ @if (item.image) { + @if (item.url$ | async; as url) { + + } @else { + image + } + } @else { +
{{ item.icon }}
+
+ {{ item.resource.name }} + {{ item.extension }}@if (item.extension) { · }{{ item.resource.size | fileSize }} +
+ } +
+ } +
diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.scss new file mode 100644 index 0000000000..9da645eb8a --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.scss @@ -0,0 +1,101 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +:host { + display: block; + max-width: 100%; + + .attachments { + display: flex; + flex-wrap: wrap; + gap: 8px; + justify-content: inherit; + } + + .attachment { + position: relative; + display: flex; + align-items: center; + border-radius: 10px; + border: 1px solid rgba(0, 0, 0, 0.12); + background: #fff; + overflow: hidden; + flex: none; + cursor: pointer; + + &:hover { + border-color: var(--tb-primary-500); + } + + &.image { + width: 64px; + height: 64px; + justify-content: center; + background: rgba(0, 0, 0, 0.04); + + img { + width: 100%; + height: 100%; + object-fit: cover; + } + + .placeholder { + color: rgba(0, 0, 0, 0.38); + } + } + + &.file { + gap: 8px; + height: 48px; + max-width: 220px; + padding: 0 12px 0 8px; + + .file-icon { + display: flex; + align-items: center; + justify-content: center; + flex: none; + width: 32px; + height: 32px; + border-radius: 8px; + color: var(--tb-primary-500); + position: relative; + + &:before { + content: ""; + position: absolute; + inset: 0; + border-radius: inherit; + background: var(--tb-primary-500); + opacity: 0.1; + } + + mat-icon { + font-size: 20px; + width: 20px; + height: 20px; + } + } + + .file-meta { + display: flex; + flex-direction: column; + min-width: 0; + line-height: 16px; + + .file-name { + font-size: 13px; + color: rgba(0, 0, 0, 0.87); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .file-info { + font-size: 11px; + color: rgba(0, 0, 0, 0.54); + white-space: nowrap; + } + } + } + } +} diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.ts new file mode 100644 index 0000000000..86db1c6232 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-attachments.component.ts @@ -0,0 +1,70 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { Observable } from 'rxjs'; +import { catchError } from 'rxjs/operators'; +import { AiResourceInfo, isAiImageResource } from '@shared/models/ai-chat.models'; +import { AiResourceService } from '@core/http/ai-resource.service'; +import { aiAttachmentExtension, aiAttachmentKind } from '@home/components/ai/ai-attachment.models'; +import { + AiAttachmentPreviewDialogComponent, + AiAttachmentPreviewDialogData +} from '@home/components/ai/ai-attachment-preview-dialog.component'; + +interface AiAttachmentItem { + resource: AiResourceInfo; + image: boolean; + icon: string; + extension: string; + url$?: Observable; +} + +@Component({ + selector: 'tb-ai-attachments', + templateUrl: './ai-attachments.component.html', + styleUrls: ['./ai-attachments.component.scss'], + standalone: false +}) +export class AiAttachmentsComponent implements OnChanges { + + @Input() resources: AiResourceInfo[]; + + @Output() resourceError = new EventEmitter(); + + shown: AiAttachmentItem[] = []; + + constructor(private aiResourceService: AiResourceService, + private dialog: MatDialog) { + } + + ngOnChanges(changes: SimpleChanges): void { + if (changes.resources) { + this.shown = (this.resources ?? []).map(resource => { + const image = isAiImageResource(resource); + return { + resource, + image, + icon: aiAttachmentKind(resource.mediaType, resource.name).icon, + extension: aiAttachmentExtension(resource.name), + url$: image ? this.aiResourceService.getUrl(resource.id).pipe(catchError(() => [null])) : undefined + }; + }); + } + } + + open(item: AiAttachmentItem): void { + if (item.image) { + this.dialog.open(AiAttachmentPreviewDialogComponent, { + panelClass: ['tb-dialog', 'tb-ai-attachment-preview-dialog'], + maxWidth: '92vw', + data: {resource: item.resource} + }); + } else { + this.aiResourceService.download(item.resource).subscribe({ + error: error => this.resourceError.emit(error) + }); + } + } + +} diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html index fdab2fc333..7fd251f846 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html +++ b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.html @@ -7,7 +7,13 @@ @for (msg of messages; track $index) { @if (msg.from === 'USER') {
-
{{ msg.content }}
+ @if (msg.resources?.length) { + + } + @if (msg.content) { +
{{ msg.content }}
+ }
} @else {
@@ -18,6 +24,11 @@ [autoApprove]="autoApprove" (approvalAction)="approval($event)"> + } @else if (msg.status === 'INCOMPLETE') { +
+ warning_amber + {{ msg.content }} +
} @else { } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.scss index 098ee389ce..c9b42e734e 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.scss +++ b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.scss @@ -15,7 +15,22 @@ .user { display: flex; - justify-content: end; + flex-direction: column; + align-items: flex-end; + gap: 6px; + + .user-attachments { + max-width: 80%; + + ::ng-deep .attachments { + justify-content: flex-end; + + .attachment.image { + width: 120px; + height: 90px; + } + } + } .msg { max-width: 80%; @@ -41,6 +56,22 @@ } } + .incomplete { + padding: 10px 14px; + border-radius: 12px; + line-height: 20px; + color: rgba(0, 0, 0, 0.76); + background: rgba(255, 152, 0, 0.08); + + .incomplete-icon { + flex: none; + color: #FF9800; + font-size: 20px; + width: 20px; + height: 20px; + } + } + .generating { transition: all 0.3s ease-in-out; diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts index 914104bf65..7818491ccc 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-chat-messages.component.ts @@ -19,6 +19,7 @@ export class AiChatMessagesComponent implements OnChanges { @Input() completedExecutions: Record = {}; @Input() autoApprove = false; @Output() approvalAction = new EventEmitter(); + @Output() resourceError = new EventEmitter(); waitApproval = false; diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss index 52b4e60781..14313bb7c9 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss +++ b/ui-ngx/src/app/modules/home/components/ai/ai-credits.component.scss @@ -7,13 +7,13 @@ --_donut-track: rgba(0, 0, 0, 0.12); &.WARNING { - --_donut-color: #FAA405; - --_donut-track: rgba(250, 164, 5, 0.2); + --_donut-color: var(--tb-warning); + --_donut-track: color-mix(in srgb, var(--tb-warning) 20%, transparent); } &.DISABLED { - --_donut-color: #D12730; - --_donut-track: rgba(209, 39, 48, 0.2); + --_donut-color: var(--tb-crit); + --_donut-track: color-mix(in srgb, var(--tb-crit) 20%, transparent); } } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.html b/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.html index ad930b3c4b..082f2708b0 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.html +++ b/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.html @@ -4,27 +4,113 @@ SPDX-License-Identifier: BUSL-1.1 --> -
- - - - +
+ @if (attachEnabled()) { + + } +
+ @if (attachments().length) { +
+ @for (attachment of attachments(); track attachment.key) { + + @if (attachment.previewUrl && attachment.status !== 'error') { + + } @else { + {{ attachment.status === 'error' ? 'error_outline' : attachment.icon }} + } + + {{ attachment.name }} + {{ meta(attachment) }} + + @if (attachment.status === 'uploading') { + + } + + + } +
+ } +
+ + + + + +
+
+ @if (attachEnabled()) { + + } + + +
+
+ + +
+
+ {{ 'ai-assistant.send' | translate }} + Enter +
+
+
+ + +
+
{{ 'ai-assistant.add-files' | translate }}
+

{{ 'ai-assistant.add-files-text' | translate }}

+

{{ 'ai-assistant.add-files-hint' | translate: {count: maxPerMessage(), size: maxSize()} }}

+
+
+ + +
+
{{ 'ai-assistant.shortcuts' | translate }}
+
+ {{ 'ai-assistant.send' | translate }} + Enter +
+
+ {{ 'ai-assistant.new-line' | translate }} + ShiftEnter +
+
+ {{ 'ai-assistant.focus-composer' | translate }} + / +
+
+
diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.scss b/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.scss index 5eabeb4234..088c205465 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.scss +++ b/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.scss @@ -1,30 +1,454 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 +$ai-teal-300: #4db6ac; +$ai-teal-400: #26a69a; +$ai-action: #00695c; +$ai-action-hover: #004d40; +$ai-focus: #00695c; +$ai-teal-700: #00796b; +$ink: rgba(0, 0, 0, 0.87); +$ink-54: rgba(0, 0, 0, 0.54); +$ink-38: rgba(0, 0, 0, 0.38); +$faint: rgba(0, 0, 0, 0.56); +$line: rgba(0, 0, 0, 0.12); +$line-soft: rgba(0, 0, 0, 0.05); +$crit: #d12730; +$font: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif; +$chevron: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5l7 7-7 7'/%3E%3C/svg%3E"; + :host { + display: block; + width: 100%; +} + +.tb-ai-composer { width: 100%; + font-family: $font; + letter-spacing: 0.25px; + text-align: left; - .prompt-input { - border-radius: 12px; - border: 1px solid rgba(0, 0, 0, 0.2); - background-color: #fff; + .composer-field { position: relative; + display: flow-root; + background: #fff; + border: 1px solid transparent; + border-radius: 14px; + box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.04), 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.08); + transition: border-color .18s ease, box-shadow .18s ease; + + &:focus-within { + border-color: $ai-focus; + box-shadow: 0 0 0 1px $ai-focus, 0 8px 24px rgba(0, 105, 92, 0.12); + + .composer-chevron { + color: $ai-focus; + } + } + } + + &.drop .composer-field { + box-shadow: inset 0 0 0 2px $ai-teal-300; + background: color-mix(in srgb, $ai-action 4%, #fff); + } + + .composer-files { display: flex; - flex: 1; - --mat-form-field-outlined-outline-width: 0px; - --mat-form-field-outlined-focus-outline-width: 0px; + flex-wrap: wrap; + gap: 6px; + margin: 10px 12px 0 16px; + } + + .composer-file { + position: relative; + display: inline-flex; + align-items: center; + gap: 10px; + max-width: 100%; + overflow: hidden; + padding: 6px 10px 6px 8px; + border: 1px solid $line; + border-radius: 8px; + background: #fff; + font-size: 13.5px; + line-height: 20px; + animation: composer-file-in .12s ease-out; - .send-button { + .mat-icon { + flex: none; + color: $ink-54; + } + + .file-pic { + flex: none; + width: 32px; + height: 32px; + border-radius: 6px; + background: linear-gradient(135deg, #cfd8dc, #90a4ae) center / cover no-repeat; + box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); + } + + .file-text { + display: flex; + flex-direction: column; + min-width: 0; + overflow-wrap: anywhere; + + b { + max-width: 240px; + overflow: hidden; + font-size: 13.5px; + font-weight: 500; + line-height: 18px; + color: $ink; + text-overflow: ellipsis; + white-space: nowrap; + } + + small { + font-size: 12px; + line-height: 16px; + color: $faint; + } + } + + .file-bar { position: absolute; - right: 10px; - bottom: 10px; + left: 0; + bottom: 0; + height: 2px; + background: $ai-action; + transition: width .15s linear; + } + + .file-remove { + flex: none; + display: inline-flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + margin-right: -4px; + padding: 0; + border: 0; + border-radius: 50%; + background: none; + color: $ink-54; + cursor: pointer; + + &:hover { + background: rgba(0, 0, 0, 0.06); + color: $ink; + } + } + + &.up small { + color: $ai-teal-700; + } + + &.bad { + border-color: color-mix(in srgb, $crit 40%, transparent); + background: color-mix(in srgb, $crit 4%, #fff); + + .mat-icon, small { + color: $crit; + } } } + + .composer-row { + position: relative; + display: flex; + align-items: flex-start; + gap: 10px; + padding: 8px 0 8px 16px; + } + + .composer-chevron { + --chevron: 18px; + display: flex; + flex: none; + align-items: center; + height: 24px; + margin: 4px 0 0 -2px; + color: $ai-action; + transition: color .18s ease; + + &::before { + content: ''; + width: var(--chevron); + height: var(--chevron); + background: currentColor; + mask: url($chevron) center / contain no-repeat; + } + } + + textarea { + flex: 1; + min-width: 0; + min-height: 72px; + max-height: 240px; + margin: 4px 0 0; + padding: 0 58px 0 0; + border: 0; + outline: 0; + resize: none; + background: transparent; + font-family: $font; + font-size: 16px; + line-height: 24px; + letter-spacing: normal; + color: $ink; + caret-color: $ai-action; + tab-size: 2; + transition: height .12s ease; + + &::placeholder { + color: $faint; + } + } + + .composer-send-slot { + position: absolute; + right: 12px; + bottom: 12px; + display: inline-flex; + } + + .composer-send { + position: relative; + display: inline-flex; + flex: none; + align-items: center; + justify-content: center; + width: 36px; + height: 36px; + padding: 0; + border: 0; + border-radius: 10px; + background: $ai-action; + color: #fff; + cursor: pointer; + transition: background-color .2s ease, color .2s ease, box-shadow .2s ease, transform .16s cubic-bezier(.2, 0, 0, 1); + + &:hover:not(:disabled) { + background: $ai-action-hover; + + .return-glyph polyline { + transform: scale(1.12); + } + } + + &:active:not(:disabled) { + transform: scale(.92); + } + + &:focus-visible { + outline: 2px solid $ai-focus; + outline-offset: 2px; + } + + &:disabled { + background: rgba(0, 0, 0, 0.06); + color: $ink-38; + cursor: default; + } + + &.fly .return-glyph polyline { + animation: composer-grow .32s cubic-bezier(.2, 0, 0, 1); + } + } + + .return-glyph { + display: inline-flex; + width: 20px; + height: 20px; + + svg { + width: 100%; + height: 100%; + overflow: visible; + fill: none; + stroke: currentColor; + stroke-width: 2.2; + stroke-linecap: round; + stroke-linejoin: round; + } + + polyline { + transform-box: fill-box; + transform-origin: 0 50%; + transition: transform .16s ease-out; + } + } + + .composer-foot { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 2px; + padding: 2px 8px 6px 16px; + border-top: 1px solid $line-soft; + border-radius: 0 0 14px 14px; + font-size: 13px; + line-height: 18px; + color: rgba(0, 0, 0, 0.6); + } + + .composer-spacer { + flex: 1; + } + + .composer-tool { + display: inline-flex; + align-items: center; + justify-content: center; + width: 32px; + height: 32px; + margin: 0; + padding: 0; + border: 0; + border-radius: 8px; + background: none; + color: $ink-54; + cursor: pointer; + transition: background-color .12s ease, color .12s ease; + + &:hover, &[aria-describedby] { + background: $line-soft; + color: $ink; + } + + &:focus-visible { + outline: 2px solid $ai-focus; + outline-offset: 1px; + color: $ink; + } + } + + .composer-foot > .composer-add:first-child { + margin-left: -9px; + } + + &.docked { + border-top: 1px solid $line; + background: #fff; + font-size: 14px; + line-height: 20px; + transition: border-top-color .18s ease; + + &:focus-within { + border-top-color: $ai-focus; + } + + .composer-field { + border: 0; + border-radius: 0; + box-shadow: none; + transition: box-shadow .18s ease; + + &:focus-within { + box-shadow: inset 0 1px 0 $ai-focus; + } + } + + &.drop .composer-field { + box-shadow: inset 0 0 0 2px $ai-teal-300; + } + + .composer-files { + margin: 8px 8px 0 12px; + } + + .composer-row { + gap: 6px; + padding: 6px 0 6px 12px; + } + + .composer-chevron { + --chevron: 17px; + height: 22px; + } + + textarea { + min-height: 44px; + max-height: 160px; + padding-right: 44px; + font-size: 14px; + line-height: 20px; + } + + .composer-send-slot { + right: 8px; + bottom: 8px; + } + + .composer-send { + width: 28px; + height: 28px; + border-radius: 8px; + } + + .return-glyph { + width: 17px; + height: 17px; + + svg { + stroke-width: 2.4; + } + } + + .composer-foot { + flex-wrap: nowrap; + gap: 6px 8px; + padding: 2px 8px 6px 12px; + border-radius: 0; + font-size: 12px; + } + + .composer-tool { + width: 28px; + height: 28px; + } + + .composer-foot > .composer-add:first-child { + margin-left: -7.5px; + } + } +} + +@keyframes composer-grow { + 0% { + transform: none; + } + 40% { + transform: scale(1.2); + } + 100% { + transform: none; + } } -:host::ng-deep { - .prompt-input { - .mdc-text-field--outlined { - padding-right: 8px; +@keyframes composer-file-in { + from { + opacity: 0; + transform: translateY(2px); + } +} + +@media (prefers-reduced-motion: reduce) { + .tb-ai-composer { + .composer-file { + animation: none; + } + + .composer-send .return-glyph polyline { + animation: none; + transition: none; + transform: none !important; + } + + &.docked, .file-bar { + transition: none; } } } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.ts index 57efd86bcf..5297f99045 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-prompt-input.component.ts @@ -1,8 +1,59 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core'; +import { + AfterViewInit, + Component, + computed, + ElementRef, + EventEmitter, + HostListener, + inject, + Input, + OnChanges, + OnDestroy, + Output, + Renderer2, + signal, + SimpleChanges, + untracked, + ViewChild, + SecurityContext +} from '@angular/core'; import { FormControl } from '@angular/forms'; -import { CdkTextareaAutosize } from '@angular/cdk/text-field'; +import { toSignal } from '@angular/core/rxjs-interop'; +import { Subscription } from 'rxjs'; +import { TranslateService } from '@ngx-translate/core'; +import { DomSanitizer } from '@angular/platform-browser'; +import { guid } from '@core/utils'; +import { AiResourceService } from '@core/http/ai-resource.service'; +import { AI_IMAGE_MEDIA_TYPES, AiPromptMessage, AiResourceConfig, AiResourceInfo } from '@shared/models/ai-chat.models'; +import { + AI_SVG_EXTENSION, + aiAttachmentKind, + fitAiImage, + formatAiFileSize, + isAiAttachmentAccepted, + isAiSvg, + namePastedImage, + svgToAiImage, + aiServerMessage +} from '@home/components/ai/ai-attachment.models'; + +interface PendingAttachment { + key: string; + name: string; + size: number; + icon: string; + kind: string; + status: 'uploading' | 'ready' | 'error'; + progress: number; + reason?: string; + previewUrl?: string; + resource?: AiResourceInfo; + upload?: Subscription; +} + +const FLY_DURATION = 520; @Component({ selector: 'tb-ai-prompt-input', @@ -10,40 +61,127 @@ import { CdkTextareaAutosize } from '@angular/cdk/text-field'; styleUrls: ['./ai-prompt-input.component.scss'], standalone: false }) -export class AiPromptInputComponent { +export class AiPromptInputComponent implements OnChanges, AfterViewInit, OnDestroy { + + private aiResourceService = inject(AiResourceService); + private translate = inject(TranslateService); + private sanitizer = inject(DomSanitizer); + private renderer = inject(Renderer2); + private host = inject>(ElementRef); @Input() placeholder = ''; @Input() loading: boolean; - @Output() messageSent = new EventEmitter(); + @Input() docked = false; + + @Input() dropZone: HTMLElement; - @ViewChild('autosize') autosize!: CdkTextareaAutosize; + @Output() messageSent = new EventEmitter(); @ViewChild('textarea') textarea!: ElementRef; + @ViewChild('fileInput') fileInput!: ElementRef; + message = new FormControl(''); - onEnter(event: Event): void { - const ke = event as KeyboardEvent; - if (!ke.shiftKey) { - ke.preventDefault(); + config = toSignal(this.aiResourceService.getConfig(), {initialValue: null as AiResourceConfig | null}); + + attachments = signal([]); + + attachEnabled = computed(() => !!this.config()); + + accept = computed(() => this.config() ? [...this.config().extensions, AI_SVG_EXTENSION].join(',') : ''); + + maxPerMessage = computed(() => this.config()?.maxPerMessage ?? 0); + + maxSize = computed(() => formatAiFileSize(this.config()?.maxSize ?? 0)); + + uploading = computed(() => this.attachments().some(attachment => attachment.status === 'uploading')); + + hasText = signal(false); + + dragging = signal(false); + + flying = signal(false); + + private dropTarget: HTMLElement; + private dragDepth = 0; + private unlisten: Array<() => void> = []; + private flyTimer: ReturnType; + private destroyed = false; + + get canSend(): boolean { + const ready = this.attachments().some(attachment => attachment.status === 'ready'); + return !this.loading && !this.uploading() && (!!this.message.value?.trim() || ready); + } + + ngOnChanges(changes: SimpleChanges): void { + if (changes.dropZone) { + this.listenForDrops(this.dropZone ?? this.host.nativeElement); + } + } + + ngAfterViewInit(): void { + if (!this.dropTarget) { + this.listenForDrops(this.host.nativeElement); + } + setTimeout(() => this.resize()); + } + + ngOnDestroy(): void { + this.destroyed = true; + clearTimeout(this.flyTimer); + this.stopListening(); + this.clearAttachments(true); + } + + @HostListener('document:keydown', ['$event']) + onDocumentKeydown(event: KeyboardEvent): void { + if (event.key !== '/' || event.metaKey || event.ctrlKey || event.altKey) { + return; + } + const target = event.target as HTMLElement; + if (target?.closest?.('input, textarea, select, [contenteditable]')) { + return; + } + const visible = Array.from(document.querySelectorAll('.tb-ai-composer textarea')) + .filter(textarea => textarea.offsetParent); + const field = this.textarea?.nativeElement; + if (field && visible[visible.length - 1] === field) { + event.preventDefault(); + field.focus(); + field.selectionStart = field.selectionEnd = field.value.length; + } + } + + onKeydown(event: KeyboardEvent): void { + if (event.key === 'Enter' && (!event.shiftKey || event.metaKey || event.ctrlKey)) { + event.preventDefault(); this.send(); } } + onInput(): void { + this.hasText.set(!!this.message.value); + this.resize(); + } + send(): void { - const msg = this.message.value?.trim(); - if (msg && !this.loading) { - this.reset(); - this.messageSent.emit(msg); + const msg = this.message.value?.trim() ?? ''; + const ready = this.attachments().filter(attachment => attachment.status === 'ready'); + if (this.loading || this.uploading() || (!msg && !ready.length)) { + return; } + this.fly(); + this.clearText(); + this.clearAttachments(false); + this.messageSent.emit({message: msg, resources: ready.map(attachment => attachment.resource)}); } reset(): void { - this.message.reset(''); - // Not autosize.reset(): it restores a height captured before the placeholder was known. - this.autosize?.resizeToFitContent(true); + this.clearText(); + this.clearAttachments(true); } focus(): void { @@ -52,9 +190,233 @@ export class AiPromptInputComponent { setValue(value: string): void { this.message.setValue(value); + this.hasText.set(!!value); setTimeout(() => { this.textarea?.nativeElement.focus(); - this.autosize?.resizeToFitContent(true); + this.resize(); + }); + } + + openFilePicker(): void { + this.fileInput?.nativeElement.click(); + } + + onFilesPicked(event: Event): void { + const input = event.target as HTMLInputElement; + this.addFiles(Array.from(input.files ?? [])); + input.value = ''; + } + + onPaste(event: ClipboardEvent): void { + const clipboard = event.clipboardData; + const files = Array.from(clipboard?.files ?? []); + if (files.length && !clipboard.types.includes('text/plain') && this.attachEnabled()) { + event.preventDefault(); + this.addFiles(files.map(namePastedImage)); + } + } + + removeAttachment(attachment: PendingAttachment): void { + this.discard(attachment); + this.attachments.update(list => list.filter(candidate => candidate.key !== attachment.key)); + } + + meta(attachment: PendingAttachment): string { + if (attachment.status === 'error') { + return attachment.reason; + } + if (attachment.status === 'uploading') { + return this.translate.instant('ai-assistant.attachment-uploading', {progress: attachment.progress}); + } + return `${this.translate.instant(attachment.kind)} · ${formatAiFileSize(attachment.size)}`; + } + + addFiles(files: File[]): void { + const config = this.config(); + if (!config || !files.length) { + return; + } + for (const file of files) { + const accepted = this.attachments().filter(attachment => attachment.status !== 'error').length; + if (accepted >= config.maxPerMessage) { + this.refuse(file, this.translate.instant('ai-assistant.attachment-over-limit', {count: config.maxPerMessage})); + } else if (!isAiAttachmentAccepted(file, config.extensions)) { + this.refuse(file, this.translate.instant('ai-assistant.attachment-unsupported')); + } else { + this.prepare(file, config); + } + } + } + + private refuse(file: File, reason: string): void { + this.attachments.update(list => [...list, { + ...this.describe(file, file.type), + status: 'error', + progress: 0, + reason + }]); + } + + private describe(file: File, mediaType: string): Pick { + const kind = aiAttachmentKind(mediaType, file.name); + return {key: guid(), name: file.name, size: file.size, icon: kind.icon, kind: kind.label}; + } + + private async prepare(original: File, config: AiResourceConfig): Promise { + const attachment: PendingAttachment = { + ...this.describe(original, original.type || config.mediaTypes[0]), + status: 'uploading', + progress: 0 + }; + this.attachments.update(list => [...list, attachment]); + let file: File; + let failure: string; + if (isAiSvg(original)) { + try { + file = await svgToAiImage(original, config.maxSize); + } catch { + failure = this.translate.instant('ai-assistant.attachment-svg-failed'); + } + } else { + try { + file = await fitAiImage(original, config.maxSize); + } catch { + file = original; + } + } + if (this.destroyed || !this.attachments().some(candidate => candidate.key === attachment.key)) { + return; + } + if (failure) { + this.patch(attachment.key, {status: 'error', reason: failure}); + return; + } + if (file.size > config.maxSize) { + this.patch(attachment.key, { + status: 'error', + reason: this.translate.instant('ai-assistant.attachment-larger-than', {size: formatAiFileSize(config.maxSize)}) + }); + return; + } + this.startUpload(attachment.key, file, config); + } + + private startUpload(key: string, file: File, config: AiResourceConfig): void { + const previewUrl = AI_IMAGE_MEDIA_TYPES.includes(file.type) ? URL.createObjectURL(file) : undefined; + this.patch(key, {...this.describe(file, file.type || config.mediaTypes[0]), key, previewUrl}); + const upload = this.aiResourceService.upload(file).subscribe({ + next: event => { + if (event.type === 'progress') { + this.patch(key, {progress: event.progress}); + } else { + if (previewUrl) { + this.aiResourceService.rememberUrl(event.resource.id, previewUrl, file.size); + } + this.patch(key, {status: 'ready', resource: event.resource, progress: 100}); + } + }, + error: error => this.patch(key, {status: 'error', reason: this.errorMessage(error)}) }); + this.patch(key, {upload}); } + + private patch(key: string, changes: Partial): void { + this.attachments.update(list => list.map(attachment => attachment.key === key ? {...attachment, ...changes} : attachment)); + } + + private fly(): void { + this.flying.set(false); + clearTimeout(this.flyTimer); + requestAnimationFrame(() => { + this.flying.set(true); + this.flyTimer = setTimeout(() => this.flying.set(false), FLY_DURATION); + }); + } + + private resize(): void { + const field = this.textarea?.nativeElement; + if (!field) { + return; + } + const cap = this.docked ? Math.min(160, Math.round(innerHeight * 0.3)) : Math.min(220, Math.round(innerHeight * 0.4)); + field.style.height = 'auto'; + field.style.height = Math.min(field.scrollHeight, cap) + 'px'; + } + + private clearText(): void { + this.message.reset(''); + this.hasText.set(false); + setTimeout(() => this.resize()); + } + + private clearAttachments(discard: boolean): void { + const attachments = untracked(() => this.attachments()); + if (!attachments.length) { + return; + } + attachments + .filter(attachment => discard || attachment.status !== 'ready') + .forEach(attachment => this.discard(attachment)); + this.attachments.set([]); + } + + private discard(attachment: PendingAttachment): void { + attachment.upload?.unsubscribe(); + if (attachment.resource) { + this.aiResourceService.delete(attachment.resource.id).subscribe({error: () => {}}); + } + if (attachment.previewUrl) { + URL.revokeObjectURL(attachment.previewUrl); + } + } + + private errorMessage(error: unknown): string { + const message = aiServerMessage(error); + return message ? this.sanitizer.sanitize(SecurityContext.HTML, message) ?? message : this.translate.instant('ai-assistant.attachment-failed'); + } + + private listenForDrops(target: HTMLElement): void { + this.stopListening(); + this.dropTarget = target; + const hasFiles = (event: DragEvent) => Array.from(event.dataTransfer?.types ?? []).includes('Files'); + this.unlisten = [ + this.renderer.listen(target, 'dragenter', (event: DragEvent) => { + if (!hasFiles(event) || !this.attachEnabled()) { + return; + } + event.preventDefault(); + if (this.dragDepth++ === 0) { + this.dragging.set(true); + } + }), + this.renderer.listen(target, 'dragover', (event: DragEvent) => { + if (hasFiles(event) && this.attachEnabled()) { + event.preventDefault(); + event.dataTransfer.dropEffect = 'copy'; + } + }), + this.renderer.listen(target, 'dragleave', (event: DragEvent) => { + if (hasFiles(event) && this.dragDepth > 0 && --this.dragDepth === 0) { + this.dragging.set(false); + } + }), + this.renderer.listen(target, 'drop', (event: DragEvent) => { + if (!hasFiles(event) || !this.attachEnabled()) { + return; + } + event.preventDefault(); + this.dragDepth = 0; + this.dragging.set(false); + this.addFiles(Array.from(event.dataTransfer.files ?? [])); + }) + ]; + } + + private stopListening(): void { + this.unlisten.forEach(unlisten => unlisten()); + this.unlisten = []; + this.dragDepth = 0; + this.dragging.set(false); + } + } diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-tip.directive.ts b/ui-ngx/src/app/modules/home/components/ai/ai-tip.directive.ts new file mode 100644 index 0000000000..4c20bb7dfc --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/ai/ai-tip.directive.ts @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { Directive, ElementRef, HostListener, inject, Input, OnDestroy, OnInit, Renderer2, TemplateRef } from '@angular/core'; +import { Subscription } from 'rxjs'; +import { TbPopoverDirective } from '@shared/components/popover.component'; + +const SHOW_DELAY = 0.35; +const HIDE_DELAY = 0.08; +const TIP_ID = 'tb-ai-tip'; + +const openTip: { current: AiTipDirective | null } = {current: null}; + +@Directive({ + selector: '[tbAiTip]', + standalone: false +}) +export class AiTipDirective implements OnInit, OnDestroy { + + private popover = inject(TbPopoverDirective, {self: true}); + private elementRef = inject>(ElementRef); + private renderer = inject(Renderer2); + + @Input('tbAiTip') template: TemplateRef; + + @Input() tipToggle = false; + + private pointerType: string; + private visibleSubscription: Subscription; + private unlistenKeydown: () => void; + + private get trigger(): HTMLElement { + return this.elementRef.nativeElement; + } + + ngOnInit(): void { + this.popover.content = this.template; + this.popover.trigger = 'hover'; + this.popover.placement = ['top', 'topRight', 'topLeft', 'bottom', 'bottomRight', 'bottomLeft']; + this.popover.showCloseButton = false; + this.popover.mouseEnterDelay = SHOW_DELAY; + this.popover.mouseLeaveDelay = HIDE_DELAY; + this.popover.overlayClassName = 'tb-ai-tip'; + this.visibleSubscription = this.popover.visibleChange.subscribe(visible => visible ? this.onShown() : this.onHidden()); + } + + ngOnDestroy(): void { + this.visibleSubscription?.unsubscribe(); + this.onHidden(); + } + + @HostListener('pointerenter', ['$event']) + onPointerEnter(event: PointerEvent): void { + this.pointerType = event.pointerType; + const other = openTip.current !== this ? openTip.current : null; + this.popover.mouseEnterDelay = other ? 0 : SHOW_DELAY; + other?.popover.hide(); + } + + @HostListener('mouseenter', ['$event']) + onMouseEnter(event: MouseEvent): void { + if (this.pointerType === 'touch') { + event.stopImmediatePropagation(); + } + } + + @HostListener('focus') + onFocus(): void { + if (this.trigger.matches(':focus-visible')) { + this.popover.show(); + } + } + + @HostListener('blur') + onBlur(): void { + this.popover.hide(); + } + + @HostListener('click', ['$event']) + onClick(event: MouseEvent): void { + if (!this.tipToggle || this.popover.component?.visible) { + this.popover.hide(); + return; + } + event.preventDefault(); + this.popover.show(); + } + + private onShown(): void { + if (openTip.current !== this) { + openTip.current?.popover.hide(); + } + openTip.current = this; + this.unlistenKeydown?.(); + this.unlistenKeydown = this.renderer.listen('document', 'keydown', (event: KeyboardEvent) => { + if (event.key === 'Escape') { + this.popover.hide(); + } + }); + Promise.resolve().then(() => { + const pane = this.popover.component?.overlay?.overlayRef?.overlayElement; + const tip = pane?.querySelector('.tb-popover-inner'); + if (openTip.current === this && tip) { + this.renderer.setStyle(pane, 'pointer-events', 'none'); + tip.id = TIP_ID; + this.trigger.setAttribute('aria-describedby', TIP_ID); + } + }); + } + + private onHidden(): void { + if (openTip.current === this) { + openTip.current = null; + } + this.unlistenKeydown?.(); + this.unlistenKeydown = null; + this.trigger.removeAttribute('aria-describedby'); + } +} diff --git a/ui-ngx/src/app/modules/home/components/ai/ai.module.ts b/ui-ngx/src/app/modules/home/components/ai/ai.module.ts index 3d873e174f..d837940241 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai.module.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai.module.ts @@ -12,6 +12,9 @@ import { AiCreditsComponent } from '@home/components/ai/ai-credits.component'; import { AiCreditsPopupComponent } from '@home/components/ai/ai-credits-popup.component'; import { AiLoadingModalComponent } from '@home/components/ai/ai-loading-modal.component'; import { AiNoTelemetryModalComponent } from '@home/components/ai/ai-no-telemetry-modal.component'; +import { AiAttachmentsComponent } from '@home/components/ai/ai-attachments.component'; +import { AiAttachmentPreviewDialogComponent } from '@home/components/ai/ai-attachment-preview-dialog.component'; +import { AiTipDirective } from '@home/components/ai/ai-tip.directive'; @NgModule({ declarations: [ @@ -23,7 +26,10 @@ import { AiNoTelemetryModalComponent } from '@home/components/ai/ai-no-telemetry AiCreditsComponent, AiCreditsPopupComponent, AiLoadingModalComponent, - AiNoTelemetryModalComponent + AiNoTelemetryModalComponent, + AiAttachmentsComponent, + AiAttachmentPreviewDialogComponent, + AiTipDirective ], imports: [ CommonModule, @@ -37,7 +43,8 @@ import { AiNoTelemetryModalComponent } from '@home/components/ai/ai-no-telemetry AiRenameDialogComponent, AiCreditsComponent, AiLoadingModalComponent, - AiNoTelemetryModalComponent + AiNoTelemetryModalComponent, + AiAttachmentsComponent ] }) export class AiModule {} diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-details-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-details-dialog.component.html index b1898dae8f..73af0da628 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-details-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rule-details-dialog.component.html @@ -18,7 +18,8 @@ -
+
+ info_outline
diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html index 61fa880902..6b7c3ae238 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html @@ -124,7 +124,8 @@
@if (isNoData) { -
+
+ info_outline {{ 'alarm-rule.condition-type-hint' | translate }}
} diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.scss b/ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.scss index d5e65c439a..91f07bce91 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.scss +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.scss @@ -225,7 +225,7 @@ $border: 1px solid mat.m2-get-color-from-palette($tb-primary); } .red-button { - color: #D12730; + color: var(--tb-crit); } .mat-form-field { diff --git a/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.html b/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.html index 7f88ab5be1..36c8999fed 100644 --- a/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.html @@ -86,10 +86,12 @@
device.connectivity.execute-following-command
-
- warning - {{ 'api-key.generated-api-key-insecure-url' | translate }} -
+ @if (!secureUrl) { +
+ warning + {{ 'api-key.generated-api-key-insecure-url' | translate }} +
+ }
diff --git a/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.scss b/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.scss index 810077ed52..c3ce2e93ee 100644 --- a/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/api-key/api-key-generated-dialog.component.scss @@ -14,12 +14,6 @@ min-height: 42px; } - .insecure-url-warning { - .mat-icon { - color: #FAA405; - } - } - @media #{$mat-sm} { width: 470px; } diff --git a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html index be3791caa0..4312b71358 100644 --- a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html +++ b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html @@ -179,7 +179,7 @@ tooltipText="{{ 'attribute.copy-key' | translate }}" tooltipPosition="above" icon="content_copy" - [style]="{padding: '4px', 'font-size': '16px', color: 'rgba(0,0,0,.87)'}" + [style]="{padding: '4px', 'font-size': '16px'}" >
@@ -201,7 +201,7 @@ tooltipText="{{ 'attribute.copy-value' | translate }}" tooltipPosition="above" icon="content_copy" - [style]="{padding: '4px', 'font-size': '16px', color: 'rgba(0,0,0,.87)'}" + [style]="{padding: '4px', 'font-size': '16px'}" > } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html index 1be553205c..6f6c84cc2f 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-argument-panel.component.html @@ -1,15 +1,17 @@
{{ 'calculated-fields.argument-settings' | translate }}
@if (hint) { -
- {{ hint | translate }} +
+ info_outline + {{ hint | translate }}
}
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html index 0ea3c7c290..aa23c6871a 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.html @@ -147,7 +147,7 @@ } @if (maxArgumentsPerCF && argumentsFormArray.length >= maxArgumentsPerCF) { -
+
warning {{ 'calculated-fields.hint.max-args' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.scss b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.scss index e946e9b8df..0090390195 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.scss +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/calculated-field-arguments/calculated-field-arguments-table.component.scss @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 :host { .arguments-table { min-height: 108px; @@ -32,12 +33,6 @@ font-size: 16px; } - .max-args-warning { - .mat-icon { - color: #FAA405; - } - } - .tb-form-table-row-cell-buttons { --mat-badge-legacy-small-size-container-size: 8px; --mat-badge-small-size-container-overlap-offset: -5px; diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.html index 164d85cc75..f7ebf6cfd6 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/entity-aggregation-configuration/entity-aggregation-component.component.html @@ -10,8 +10,9 @@
{{ 'calculated-fields.arguments' | translate }}
-
- {{ 'calculated-fields.entity-aggregation.argument-hint' | translate }} +
+ info_outline + {{ 'calculated-fields.entity-aggregation.argument-hint' | translate }}
-
- {{ hint }} +
+ info_outline + {{ hint }}
}
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.html index 78b9bca5a1..e5e6c1fd7a 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.html @@ -156,7 +156,7 @@
@if (maxRelationLevelPerCfArgument && levelsFormArray().length >= maxRelationLevelPerCfArgument) { -
+
warning {{ 'calculated-fields.max-allowed-levels-error' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.scss b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.scss index 1993234b7d..8d397ac264 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-panel.component.scss @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 @import '../../../../../../../scss/constants'; :host { @@ -31,12 +32,6 @@ } } - .max-args-warning { - .mat-icon { - color: #FAA405; - } - } - .limit-field-row { @media screen and (max-width: 520px) { display: flex; diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html index 9eedfe33ba..df7e6e92ec 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.html @@ -146,7 +146,7 @@ } @if (maxArgumentsPerCF && zoneGroupsFormArray.length >= maxArgumentsPerCF) { -
+
warning {{ 'calculated-fields.hint.max-geofencing-zone' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html index c0beaec543..ca59af4c7c 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.html @@ -134,7 +134,7 @@ } @if (maxArgumentsPerCF && metricsFormArray.length >= maxArgumentsPerCF) { -
+
warning {{ 'calculated-fields.metrics.max-metrics' | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/reprocessing/calculated-field-reprocessing-panel.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/reprocessing/calculated-field-reprocessing-panel.component.html index 362a8da097..78b8a44074 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/reprocessing/calculated-field-reprocessing-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/reprocessing/calculated-field-reprocessing-panel.component.html @@ -15,8 +15,9 @@
} @case (ReprocessingState.CONFIG) { -
- {{ 'calculated-fields.hint.reprocessing' | translate }} +
+ info_outline + {{ 'calculated-fields.hint.reprocessing' | translate }}
; + let metadata: Record; let integrationMetadata: Record; if (debugIn) { if (debugIn.inContentType) { @@ -161,12 +161,7 @@ export class ConverterTestDialogComponent extends DialogComponent { this.converterTestFormGroup.patchValue({ payload: value, - metadata: value.metadata + metadata: this.stringifyMetadataValues(value.metadata) }, {emitEvent: false}); this.currentOriginalMsg.payload = msg.payload; this.currentOriginalMsg.metadata = msg.metadata; @@ -446,9 +441,20 @@ export class ConverterTestDialogComponent extends DialogComponent): Record { + if (!metadata) { + return metadata; + } + const result: Record = {}; + Object.keys(metadata).forEach((key) => { + result[key] = isObject(metadata[key]) ? JSON.stringify(metadata[key]) : metadata[key]; + }); + return result; + } + private testConverter(): Observable { if (this.checkInputParamErrors()) { - const metadata: Record = this.converterTestFormGroup.get('metadata').value; + const metadata: Record = {...this.converterTestFormGroup.get('metadata').value}; Object.keys(metadata).forEach(function (key) { try { metadata[key] = JSON.parse(metadata[key]); diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html index 2f68692ffc..bca5ce946b 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html @@ -1,15 +1,17 @@
debug-settings.label
@if (maxMessagesCount) {
-
- {{ 'debug-settings.hint.main-limited' | translate: { entity: (entityLabel | translate | lowercase), msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true) } }} +
+ info_outline + {{ 'debug-settings.hint.main-limited' | translate: { entity: (entityLabel | translate | lowercase), msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true) } }}
} diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.scss b/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.scss index c7cd4ec04d..5642681a4e 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.scss +++ b/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.scss @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 @import "../../../../../scss/constants"; :host { @@ -10,10 +11,13 @@ overflow: hidden; .settings-card { - margin: 8px; + margin: $tb-content-spacing; + @media #{$mat-gt-sm} { + margin: $tb-content-spacing-gt-sm; + } padding: 0; - width: 100%; - height: 100%; + flex: 1; + min-height: 0; display: flex; flex-direction: column; diff --git a/ui-ngx/src/app/modules/home/components/event/event-table-config.ts b/ui-ngx/src/app/modules/home/components/event/event-table-config.ts index 5cc8193ae0..a0d1067434 100644 --- a/ui-ngx/src/app/modules/home/components/event/event-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/event/event-table-config.ts @@ -344,8 +344,7 @@ export class EventTableConfig extends EntityTableConfig { icon: 'content_paste', style: { padding: '4px', - 'font-size': '16px', - color: 'rgba(0,0,0,.87)' + 'font-size': '16px' }, isEnabled: () => true, onAction: ($event, entity) => entity.body.entityId, @@ -362,8 +361,7 @@ export class EventTableConfig extends EntityTableConfig { icon: 'content_paste', style: { padding: '4px', - 'font-size': '16px', - color: 'rgba(0,0,0,.87)' + 'font-size': '16px' }, isEnabled: () => true, onAction: ($event, entity) => entity.body.msgId, @@ -449,8 +447,7 @@ export class EventTableConfig extends EntityTableConfig { icon: 'content_copy', style: { padding: '4px', - 'font-size': '16px', - color: 'rgba(0,0,0,.87)' + 'font-size': '16px' }, isEnabled: () => true, onAction: ($event, entity) => entity.body.entityId, @@ -469,8 +466,7 @@ export class EventTableConfig extends EntityTableConfig { icon: 'content_copy', style: { padding: '4px', - 'font-size': '16px', - color: 'rgba(0,0,0,.87)' + 'font-size': '16px' }, isEnabled: (entity) => !!entity.body.msgId, onAction: (_, entity) => entity.body.msgId, diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.html index e3af5977fa..6f891a232d 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.html @@ -24,7 +24,7 @@ integration.http-endpoint -
- - - - - {{ 'integration.allow-downlink' | translate }} - - - -
- - integration.application-server-url - - @if (chirpStackIntegrationConfigForm.get('applicationServerUrl').hasError('required')) { - - integration.application-server-url-required - - } - - - -
-
+ @if (isSetDownlink) { +
+ integration.downlink-credentials +
+ + integration.application-server-url + + @if (chirpStackIntegrationConfigForm.get('applicationServerUrl').hasError('required')) { + + integration.application-server-url-required + + } + + + +
+
+ } + {{ 'integration.use-api-four-plus' | translate }} diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.ts b/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.ts index 698d19b79e..1f151a01f3 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.ts +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/chirp-stack-integration-form/chirp-stack-integration-form.component.ts @@ -47,8 +47,23 @@ export class ChirpStackIntegrationFormComponent extends IntegrationForm implemen @Input() routingKey: string; + @Input() + set isSetDownlink(value: boolean) { + if (this.isSetDownlinkValue !== value) { + this.isSetDownlinkValue = value; + this.updateCredentialsValidators(); + } + } + + get isSetDownlink(): boolean { + return this.isSetDownlinkValue; + } + + private isSetDownlinkValue = false; + private propagateChange = (v: any) => { }; private propagateChangePending = false; + private validatorChange = () => { }; constructor(private fb: UntypedFormBuilder, private store: Store, @@ -66,8 +81,7 @@ export class ChirpStackIntegrationFormComponent extends IntegrationForm implemen httpEndpoint: [{value: this.endPointUrl(baseUrl()), disabled: true}], applicationServerUrl: [null], applicationServerAPIToken: [null], - useAPI4Plus: [true], - allowDownlink: [false] + useAPI4Plus: [true] }); this.chirpStackIntegrationConfigForm.get('baseUrl').valueChanges.pipe( takeUntil(this.destroy$) @@ -79,23 +93,12 @@ export class ChirpStackIntegrationFormComponent extends IntegrationForm implemen ).subscribe(() => { this.updateModels(this.chirpStackIntegrationConfigForm.getRawValue()); }); - - this.chirpStackIntegrationConfigForm.get('allowDownlink').valueChanges.pipe( - takeUntil(this.destroy$) - ).subscribe(() => this.updateDownlinkControlsState()); + this.updateCredentialsValidators(); } writeValue(value: ChipStackIntegration) { if (isDefinedAndNotNull(value?.clientConfiguration)) { - const config = value.clientConfiguration; - this.chirpStackIntegrationConfigForm.reset(config, {emitEvent: false}); - if (!isDefinedAndNotNull(config.allowDownlink) - && (isDefinedAndNotNull(config.applicationServerUrl) || isDefinedAndNotNull(config.applicationServerAPIToken))) { - this.chirpStackIntegrationConfigForm.get('allowDownlink').setValue(true, {emitEvent: false}); - } - if (!this.disabled) { - this.updateDownlinkControlsState(); - } + this.chirpStackIntegrationConfigForm.reset(value.clientConfiguration, {emitEvent: false}); } else { this.propagateChangePending = true; } @@ -113,6 +116,10 @@ export class ChirpStackIntegrationFormComponent extends IntegrationForm implemen registerOnTouched(fn: any) { } + registerOnValidatorChange(fn: () => void) { + this.validatorChange = fn; + } + setDisabledState(isDisabled: boolean) { this.disabled = isDisabled; if (isDisabled) { @@ -120,7 +127,6 @@ export class ChirpStackIntegrationFormComponent extends IntegrationForm implemen } else { this.chirpStackIntegrationConfigForm.enable({emitEvent: false}); this.chirpStackIntegrationConfigForm.get('httpEndpoint').disable({emitEvent: false}); - this.updateDownlinkControlsState(); } } @@ -129,9 +135,11 @@ export class ChirpStackIntegrationFormComponent extends IntegrationForm implemen } private updateModels(value) { - if (!value.allowDownlink) { - value = {...value, applicationServerUrl: null, applicationServerAPIToken: null}; - } + value = { + ...value, + applicationServerUrl: value.applicationServerUrl ?? '', + applicationServerAPIToken: value.applicationServerAPIToken ?? '' + }; this.propagateChange({clientConfiguration: value}); } @@ -162,20 +170,14 @@ export class ChirpStackIntegrationFormComponent extends IntegrationForm implemen this.chirpStackIntegrationConfigForm?.get('baseUrl').updateValueAndValidity({emitEvent: false}); } - updateDownlinkControlsState() { - const allowDownlink = this.chirpStackIntegrationConfigForm.get('allowDownlink').value; - if (allowDownlink) { - this.chirpStackIntegrationConfigForm.get('applicationServerAPIToken').enable({emitEvent: false}); - this.chirpStackIntegrationConfigForm.get('applicationServerUrl').enable({emitEvent: false}); - this.chirpStackIntegrationConfigForm.get('applicationServerAPIToken').setValidators(Validators.required); - this.chirpStackIntegrationConfigForm.get('applicationServerUrl').setValidators(Validators.required); - } else { - this.chirpStackIntegrationConfigForm.get('applicationServerAPIToken').disable({emitEvent: false}); - this.chirpStackIntegrationConfigForm.get('applicationServerUrl').disable({emitEvent: false}); - this.chirpStackIntegrationConfigForm.get('applicationServerAPIToken').clearValidators(); - this.chirpStackIntegrationConfigForm.get('applicationServerUrl').clearValidators(); + private updateCredentialsValidators() { + if (this.chirpStackIntegrationConfigForm) { + const validators = this.isSetDownlink ? [Validators.required] : []; + this.chirpStackIntegrationConfigForm.get('applicationServerUrl').setValidators(validators); + this.chirpStackIntegrationConfigForm.get('applicationServerAPIToken').setValidators(validators); + this.chirpStackIntegrationConfigForm.get('applicationServerUrl').updateValueAndValidity({emitEvent: false}); + this.chirpStackIntegrationConfigForm.get('applicationServerAPIToken').updateValueAndValidity({emitEvent: false}); + this.validatorChange(); } - this.chirpStackIntegrationConfigForm.get('applicationServerAPIToken').updateValueAndValidity({emitEvent: false}); - this.chirpStackIntegrationConfigForm.get('applicationServerUrl').updateValueAndValidity({emitEvent: false}); } } diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/coap-integration-form/coap-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/coap-integration-form/coap-integration-form.component.html index 9221599584..e9ff9a7333 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/coap-integration-form/coap-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/coap-integration-form/coap-integration-form.component.html @@ -51,7 +51,7 @@ integration.coap-endpoint -
- + + + @if (noSecurity) { +
+ warning + {{ 'integration.kpn-no-security-warning' | translate }} +
+ } + + - - - {{ 'integration.allow-downlink' | translate }} - - + integration.kpn-https-destination-settings -
-
- integration.credentials -
- - - - +
+ + +
+
+
integration.kpn-additional-headers-filter
+
integration.kpn-additional-headers-filter-hint
-
+ + + @if (kpnIntegrationConfigForm.get('additionalHeadersFilter').hasError('securityHeaderDuplicate')) { + {{ 'integration.kpn-security-header-duplicate' | translate }} + } +
- - - - - - {{ 'integration.enable-security' | translate }} ({{ 'integration.headers-filter' | translate }}) - - - - - - - - + @if (isSetDownlink) { +
+ integration.downlink-credentials +
+ + + + +
+
+ } diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.scss b/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.scss deleted file mode 100644 index d6a9dd27dc..0000000000 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.scss +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. -// SPDX-License-Identifier: BUSL-1.1 -:host { - .expansion-panel-setting { - box-shadow: none; - border: 1px groove rgba(0, 0, 0, .25); - border-radius: 4px; - margin-bottom: 8px; - - .mat-expansion-panel-header { - padding: 0 24px 0 16px; - - &.mat-expanded { - height: 48px; - } - } - } -} - -:host ::ng-deep { - .expansion-panel-setting { - .mat-content { - overflow: visible; - } - .mat-mdc-slide-toggle { - width: fit-content; - } - .mat-expansion-panel-body { - padding: 0; - .expansion-panel-setting-content { - display: block; - margin: 0 16px 12px; - } - } - } - - .toggle { - margin: 0 0 8px; - } -} diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.ts b/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.ts index 96c2777002..90cd4d7d0b 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.ts +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/kpn-integration-form/kpn-integration-form.component.ts @@ -2,6 +2,7 @@ // SPDX-License-Identifier: BUSL-1.1 import { Component, forwardRef, Input, OnInit } from '@angular/core'; import { + AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, @@ -11,7 +12,7 @@ import { Validator, Validators } from '@angular/forms'; -import { baseUrl, isDefinedAndNotNull } from '@core/utils'; +import { baseUrl, isDefinedAndNotNull, isNotEmptyStr } from '@core/utils'; import { takeUntil } from 'rxjs/operators'; import { IntegrationCredentialType, @@ -25,10 +26,15 @@ import { AppState } from '@core/core.state'; import { TranslateService } from '@ngx-translate/core'; import { IntegrationForm } from '@home/components/integration/configuration/integration-form'; +interface KpnIntegrationFormValue extends Omit { + securityHeader: string; + additionalHeadersFilter: {[key: string]: string}; +} + @Component({ selector: 'tb-kpn-integration-form', templateUrl: './kpn-integration-form.component.html', - styleUrls: ['./kpn-integration-form.component.scss'], + styleUrls: [], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => KpnIntegrationFormComponent), @@ -47,13 +53,32 @@ export class KpnIntegrationFormComponent extends IntegrationForm implements Cont IntegrationCredentialType = IntegrationCredentialType; + httpsDestinationSettingsExpanded = false; + + noSecurity = true; + @Input() routingKey: string; + @Input() + set isSetDownlink(value: boolean) { + if (this.isSetDownlinkValue !== value) { + this.isSetDownlinkValue = value; + this.updateCredentialsValidators(); + } + } + + get isSetDownlink(): boolean { + return this.isSetDownlinkValue; + } + private integrationType = IntegrationType.KPN; + private securityHeaderName = 'X-Things-Secret'; + private isSetDownlinkValue = false; private propagateChangePending = false; private propagateChange = (v: any) => { }; + private validatorChange = () => { }; constructor(private fb: UntypedFormBuilder, private store: Store, @@ -68,42 +93,39 @@ export class KpnIntegrationFormComponent extends IntegrationForm implements Cont } this.kpnIntegrationConfigForm = this.fb.group({ baseUrl: [baseUrl(), baseURLValidators], - destinationSharedSecret: [""], httpEndpoint: [{ value: integrationEndPointUrl(this.integrationType, baseUrl(), this.routingKey), disabled: true }], - enableSecurity: [false], - headersFilter: [{}], - allowDownlink: [false], - apiId:[], - apiKey:[] + securityHeader: [''], + destinationSharedSecret: [''], + additionalHeadersFilter: [{}, (control: AbstractControl) => this.additionalHeadersFilterValidator(control)], + apiId: [], + apiKey: [] }); this.kpnIntegrationConfigForm.get('baseUrl').valueChanges.pipe( takeUntil(this.destroy$) ).subscribe((value) => { const httpEndpoint = integrationEndPointUrl(this.integrationType, value, this.routingKey); this.kpnIntegrationConfigForm.get('httpEndpoint').patchValue(httpEndpoint); - }); - this.kpnIntegrationConfigForm.get('allowDownlink').valueChanges.pipe( - takeUntil(this.destroy$) - ).subscribe(() => { - this.updateEnableFields(); }); this.kpnIntegrationConfigForm.valueChanges.pipe( takeUntil(this.destroy$) ).subscribe(() => { - this.updateModels(this.kpnIntegrationConfigForm.getRawValue()); + const value = this.kpnIntegrationConfigForm.getRawValue(); + this.updateNoSecurity(value); + this.updateModels(value); }); - this.kpnIntegrationConfigForm.removeControl('replaceNoContentToOk', {emitEvent: false}); + this.updateCredentialsValidators(); } writeValue(value: KpnIntegration) { if (isDefinedAndNotNull(value)) { - this.kpnIntegrationConfigForm.reset(value, {emitEvent: false}); - if (!this.disabled) { - this.updateEnableFields(); - } + const formValue = this.configToFormValue(value); + this.httpsDestinationSettingsExpanded = isNotEmptyStr(formValue.destinationSharedSecret) || + Object.keys(formValue.additionalHeadersFilter).length > 0; + this.kpnIntegrationConfigForm.reset(formValue, {emitEvent: false}); + this.updateNoSecurity(this.kpnIntegrationConfigForm.getRawValue()); } else { this.propagateChangePending = true; } @@ -121,13 +143,16 @@ export class KpnIntegrationFormComponent extends IntegrationForm implements Cont registerOnTouched(fn: any) { } + registerOnValidatorChange(fn: () => void) { + this.validatorChange = fn; + } + setDisabledState(isDisabled: boolean) { this.disabled = isDisabled; if (isDisabled) { this.kpnIntegrationConfigForm.disable({emitEvent: false}); } else { this.kpnIntegrationConfigForm.enable({emitEvent: false}); - this.updateEnableFields(); this.kpnIntegrationConfigForm.get('httpEndpoint').disable({emitEvent: false}); } } @@ -150,26 +175,51 @@ export class KpnIntegrationFormComponent extends IntegrationForm implements Cont })); } - private updateModels(value) { - this.propagateChange(value); + private updateNoSecurity({securityHeader, destinationSharedSecret, additionalHeadersFilter}: KpnIntegrationFormValue) { + this.noSecurity = !isNotEmptyStr(securityHeader) && !isNotEmptyStr(destinationSharedSecret) && + !Object.keys(additionalHeadersFilter).length; } - private updateEnableFields() { - const allowDownlink = this.kpnIntegrationConfigForm.get('allowDownlink').value; - if (allowDownlink) { - this.kpnIntegrationConfigForm.get('apiId').enable({emitEvent: false}); - this.kpnIntegrationConfigForm.get('apiKey').enable({emitEvent: false}); - this.kpnIntegrationConfigForm.get('apiId').setValidators(Validators.required); - this.kpnIntegrationConfigForm.get('apiKey').setValidators(Validators.required); - } else { - this.kpnIntegrationConfigForm.get('apiId').disable({emitEvent: false}); - this.kpnIntegrationConfigForm.get('apiKey').disable({emitEvent: false}); - this.kpnIntegrationConfigForm.get('apiId').clearValidators(); - this.kpnIntegrationConfigForm.get('apiKey').clearValidators(); + private updateModels(value: KpnIntegrationFormValue) { + this.propagateChange(this.formValueToConfig(value)); + } + + private configToFormValue({enableSecurity, headersFilter, ...config}: KpnIntegration): KpnIntegrationFormValue { + const additionalHeadersFilter = enableSecurity ? {...headersFilter} : {}; + const securityHeaderKey = Object.keys(additionalHeadersFilter).find(key => this.isSecurityHeader(key)); + let securityHeader = ''; + if (securityHeaderKey) { + securityHeader = additionalHeadersFilter[securityHeaderKey]; + delete additionalHeadersFilter[securityHeaderKey]; + } + return {...config, securityHeader, additionalHeadersFilter}; + } + + private formValueToConfig({securityHeader, additionalHeadersFilter, ...config}: KpnIntegrationFormValue): KpnIntegration { + const headersFilter = {...additionalHeadersFilter}; + if (isNotEmptyStr(securityHeader)) { + headersFilter[this.securityHeaderName] = securityHeader.trim(); + } + const enableSecurity = Object.keys(headersFilter).length > 0; + return {...config, enableSecurity, headersFilter}; + } + + private additionalHeadersFilterValidator(control: AbstractControl): ValidationErrors | null { + return Object.keys(control.value ?? {}).some(key => this.isSecurityHeader(key)) ? {securityHeaderDuplicate: true} : null; + } + + private isSecurityHeader(key: string): boolean { + return key.toLowerCase() === this.securityHeaderName.toLowerCase(); + } + private updateCredentialsValidators() { + if (this.kpnIntegrationConfigForm) { + const validators = this.isSetDownlink ? [Validators.required] : []; + this.kpnIntegrationConfigForm.get('apiId').setValidators(validators); + this.kpnIntegrationConfigForm.get('apiKey').setValidators(validators); + this.kpnIntegrationConfigForm.get('apiId').updateValueAndValidity({emitEvent: false}); + this.kpnIntegrationConfigForm.get('apiKey').updateValueAndValidity({emitEvent: false}); + this.validatorChange(); } - this.kpnIntegrationConfigForm.get('apiId').updateValueAndValidity({emitEvent: false}); - this.kpnIntegrationConfigForm.get('apiKey').updateValueAndValidity({emitEvent: false}); - this.kpnIntegrationConfigForm.get('destinationSharedSecret').updateValueAndValidity({emitEvent: false}); } } diff --git a/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html b/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html index 47c6c7c565..19e59a1698 100644 --- a/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html +++ b/ui-ngx/src/app/modules/home/components/integration/configuration/loriot-integration-form/loriot-integration-form.component.html @@ -24,7 +24,7 @@ integration.http-endpoint - + } @else { + + } + + } @else { + + } +
+
+ } @else if (ep.status === 'error') { +
+
+ error +
+
+ {{ label }} + @if (ep.errorMessage) { + {{ ep.errorMessage }} + } +
+ {{ 'iot-hub.device-install-step-error' | translate }} +
+ } @else { +
+
+ @switch (ep.status) { + @case ('running') { + + } + @case ('success') { + check_circle + } + @default { +
{{ i + 1 }}
+ } + } +
+
+
+ {{ label }} + @if (plan?.action === 'create' && plan.resolution !== 'use-existing') { + {{ 'iot-hub.device-update-new' | translate }} + } +
+ + @if (ws.reviewing && plan?.confirmed) { + @if (plan.newDefaultConverter) { + {{ 'iot-hub.device-update-new-default-converter' | translate }} + } + @if (plan.existing) { + {{ 'iot-hub.device-update-existing-' + plan.resolution | translate }} + } + @if (plan.shared) { + {{ 'iot-hub.device-update-shared' | translate }} + } + @if (plan.modified) { + + + + } + } +
+ + @switch (ep.status) { + @case ('running') { + {{ 'iot-hub.in-progress' | translate }} + } + @case ('success') { + {{ updateOutcomeOf(plan) | translate }} + } + @case ('skipped') { + {{ 'iot-hub.device-update-skipped' | translate }} + } + @default { + @if (ws.reviewing && plan) { + {{ 'iot-hub.device-update-no-conflicts' | translate }} + } + } + } + +
} }
@@ -170,7 +317,14 @@
} @else {
-

{{ 'iot-hub.device-install-title' | translate:{ name: packageInfo?.name || data.item.name } }}

+

+ @if (data.update) { + {{ 'iot-hub.device-update-title' | translate:{ name: packageInfo?.name || data.item.name } }} + {{ data.update.fromVersion }} → {{ data.item.version }} + } @else { + {{ 'iot-hub.device-install-title' | translate:{ name: packageInfo?.name || data.item.name } }} + } +

@@ -207,7 +361,7 @@ @for (ws of wizardSteps; track ws.label) { {{ ws.label }} @@ -224,9 +378,24 @@ } + @if (data.update && currentWizardStep?.type === 'progress') { + @let step = currentWizardStep; + @if (hasUpdateError(step)) { +
+ error + {{ step.progressError }} +
+ } @else if (step.reviewing && !step.checking && unconfirmedUpdateWarnings(step) > 0) { +
+ warning + {{ 'iot-hub.device-update-confirm-warnings' | translate:{ count: unconfirmedUpdateWarnings(step) } }} +
+ } + } + @if (!isFirstWizardStep) { - + } @if (currentWizardStep; as step) { @@ -251,12 +420,38 @@ } @case ('form') { - } @case ('progress') { - @if (step.progressError) { + @if (data.update && (step.reviewing || step.updating || step.progressError)) { + @if (step.progressError && !step.updating) { + + + } @else if (step.updating) { + + + } @else { + + + } + } @else if (step.progressError) { } - @if (field.helpText) { - {{ field.helpText }} + @if (helpTextOf(field) && !(row.hasHintBox && field.helpPopupId)) { + {{ helpTextOf(field) }} } @if (formGroup.controls[field.key]?.hasError('required')) { {{ field.label + ' is required' }} @@ -90,14 +164,20 @@ @if (formGroup.controls[field.key]?.hasError('pattern')) { {{ getPatternErrorMessage(field) }} } + @if (field.errorMessage && hasFieldError(field)) { + {{ field.errorMessage }} + } } @case (FormFieldType.INTEGER) { - - {{ field.label }} - - @if (field.helpText) { - {{ field.helpText }} + + {{ field.label }}@if (isNewField(field)) { · {{ 'iot-hub.device-update-new' | translate }}} + + @if (helpTextOf(field) && !(row.hasHintBox && field.helpPopupId)) { + {{ helpTextOf(field) }} } @if (formGroup.controls[field.key]?.hasError('required')) { {{ field.label + ' is required' }} @@ -105,12 +185,18 @@ @if (formGroup.controls[field.key]?.hasError('pattern')) { {{ getPatternErrorMessage(field) }} } + @if (field.errorMessage && hasFieldError(field)) { + {{ field.errorMessage }} + } } @default { - - {{ field.label }} - + + {{ field.label }}@if (isNewField(field)) { · {{ 'iot-hub.device-update-new' | translate }}} + @if (field.randomGenerator) { } - @if (field.helpText) { - {{ field.helpText }} + @if (canResetToDefault(field)) { + + } + @if (helpTextOf(field) && !(row.hasHintBox && field.helpPopupId)) { + {{ helpTextOf(field) }} } @if (formGroup.controls[field.key]?.hasError('required')) { {{ field.label + ' is required' }} @@ -128,17 +222,17 @@ @if (formGroup.controls[field.key]?.hasError('pattern')) { {{ getPatternErrorMessage(field) }} } + @if (field.errorMessage && hasFieldError(field)) { + {{ field.errorMessage }} + } } } } - @if (field.type === FormFieldType.BOOLEAN && field.helpText) { -
{{ field.helpText }}
- } @if (field.helpImage) { } - } + } diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.scss b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.scss index 960c886f7b..492e9be76d 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.scss +++ b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.scss @@ -5,25 +5,31 @@ display: block; } -.tb-install-form-group-header { - margin: 16px 0 8px 0; - font-size: 14px; - font-weight: 600; - color: rgba(0, 0, 0, 0.6); -} - .tb-install-form-secret-toggle { margin-left: 4px; align-self: center; } -.tb-install-form-field-help { - font-size: 12px; - color: rgba(0, 0, 0, 0.6); - margin-top: 4px; -} - .tb-install-form-field-help-image { max-width: 100%; margin-top: 8px; } + +// Update: a field the installed version didn't have: a thicker outline, a tint and the label in the primary color +:host ::ng-deep .mat-mdc-form-field.tb-install-form-field-new { + .mdc-notched-outline__leading, + .mdc-notched-outline__notch, + .mdc-notched-outline__trailing { + border-color: var(--tb-primary-500); + border-width: 2px; + } + .mat-mdc-text-field-wrapper { + border-radius: 4px; + background: color-mix(in srgb, var(--tb-primary-500) 4%, transparent); + } + .mdc-floating-label, + .mat-mdc-floating-label { + color: var(--tb-primary-500); + font-weight: 500; + } +} diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.ts index 4e4c813ae7..5c2b03d162 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.ts @@ -2,12 +2,29 @@ // SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; -import { FormFieldDefinition, FormFieldType } from '@shared/models/iot-hub/device-package.models'; +import { AbstractControl, UntypedFormGroup } from '@angular/forms'; +import { ErrorStateMatcher } from '@angular/material/core'; +import { cleanFormFieldValue, FormFieldDefinition, FormFieldType, pastedPortOf } from '@shared/models/iot-hub/device-package.models'; import { generateSecret } from '@core/utils'; const DEFAULT_RANDOM_SIZE = 20; +/** + * Fields shown on one line. When one of them has a help popup (outside review mode), the row shows + * the field's hint in a box under it, next to the popup trigger, and its fields don't reserve space + * for a hint or an error, so the box sits right under them. + */ +interface FormRow { + fields: FormFieldDefinition[]; + hasHintBox: boolean; +} + +/** Consecutive rows of one group, shown in a panel with the group as its title; no title for ungrouped fields. */ +interface FormSection { + title?: string; + rows: FormRow[]; +} + /** * Reusable form renderer for the device install dialog's SHOW_FORM step. Consumes * the FormFieldDefinition[] parsed from the package's form.json directly — both @@ -32,21 +49,31 @@ export class InstallFormRendererComponent implements OnChanges { @Input() resolveImagePath?: (path: string) => string; /** When true, PASSWORD inputs render unmasked by default (used by review mode). */ @Input() reviewMode = false; + /** Update: the fields the installed version's form didn't have, highlighted as new. */ + @Input() newFieldKeys?: Set; passwordVisible: Record = {}; + // Fields in render order: consecutive fields of a group form a section, and consecutive fields + // with the same `row` share one line + sections: FormSection[] = []; + // The same for the fields of the collapsed Advanced settings panel + advancedSections: FormSection[] = []; + private focusedControl: AbstractControl | null = null; + private keepFocusedError = false; - ngOnChanges(changes: SimpleChanges): void { - if (changes.fields || changes.reviewMode) { - this.passwordVisible = {}; - if (this.reviewMode) { - for (const f of this.fields) { - if (f.type === FormFieldType.PASSWORD) { - this.passwordVisible[f.key] = true; - } - } + /** + * A new error shows only after the user leaves the field, so a value is not called wrong while it + * is typed. An error already shown when the user enters the field stays until the value is valid. + */ + readonly errorStateMatcher: ErrorStateMatcher = { + isErrorState: (control, form) => { + if (control && control === this.focusedControl) { + this.keepFocusedError = this.keepFocusedError && control.invalid; + return this.keepFocusedError; } + return !!control?.invalid && (control.touched || !!form?.submitted); } - } + }; readonly FormFieldType = FormFieldType; @@ -57,11 +84,47 @@ export class InstallFormRendererComponent implements OnChanges { return field.secretSupport === true; } - /** True when the previous field belonged to a different group (for header rendering). */ - shouldRenderGroupHeader(field: FormFieldDefinition, index: number): boolean { - if (!field.group) return false; - if (index === 0) return true; - return this.fields[index - 1].group !== field.group; + ngOnChanges(changes: SimpleChanges): void { + // The hint boxes and the unmasked passwords depend on reviewMode too + if (changes.fields || changes.reviewMode) { + const fields = this.fields ?? []; + this.sections = this.buildSections(fields.filter(field => field.section !== 'advanced')); + this.advancedSections = this.buildSections(fields.filter(field => field.section === 'advanced')); + this.passwordVisible = {}; + if (this.reviewMode) { + for (const field of fields) { + if (field.type === FormFieldType.PASSWORD) { + this.passwordVisible[field.key] = true; + } + } + } + } + } + + private buildSections(fields: FormFieldDefinition[]): FormSection[] { + const sections: FormSection[] = []; + let previous: FormFieldDefinition | undefined; + for (const field of fields) { + if (!previous || field.group !== previous.group) { + sections.push({ title: field.group, rows: [] }); + } + const rows = sections[sections.length - 1].rows; + const last = rows[rows.length - 1]; + const hasHintBox = !!field.helpPopupId && !this.reviewMode; + if (field.row && last?.fields[0].row === field.row) { + last.fields.push(field); + last.hasHintBox ||= hasHintBox; + } else { + rows.push({ fields: [field], hasHintBox }); + } + previous = field; + } + return sections; + } + + /** The hint of a field that a defaultValueTemplate fills describes the filled value. */ + helpTextOf(field: FormFieldDefinition): string | undefined { + return field.defaultValueTemplate && field.defaultValueTemplateHelpText ? field.defaultValueTemplateHelpText : field.helpText; } togglePasswordVisible(key: string): void { @@ -75,11 +138,54 @@ export class InstallFormRendererComponent implements OnChanges { control.markAsDirty(); } + /** A resettable field the user changed shows a button that puts its defaultValue back. */ + canResetToDefault(field: FormFieldDefinition): boolean { + const control = this.formGroup.controls[field.key]; + return !!field.resettable && !!control?.enabled && control.value !== (field.defaultValue ?? ''); + } + + resetToDefault(field: FormFieldDefinition): void { + const control = this.formGroup.controls[field.key]; + control.setValue(field.defaultValue ?? ''); + control.markAsDirty(); + } + + onFocus(field: FormFieldDefinition): void { + const control = this.formGroup.controls[field.key]; + this.focusedControl = control ?? null; + this.keepFocusedError = !!control?.invalid && control.touched; + } + + onBlur(field: FormFieldDefinition): void { + this.focusedControl = null; + const control = this.formGroup.controls[field.key]; + const port = pastedPortOf(field, control?.value); + const portControl = field.portField ? this.formGroup.controls[field.portField] : undefined; + if (port !== undefined && portControl) { + portControl.setValue(port); + portControl.markAsDirty(); + } + const cleaned = cleanFormFieldValue(field, control?.value); + if (control && cleaned !== control.value) { + control.setValue(cleaned); + } + } + getPatternErrorMessage(field: FormFieldDefinition): string { return field.validators?.[0]?.message || 'Invalid format'; } + /** True when the field fails a validator other than required and pattern (one the dialog added). */ + hasFieldError(field: FormFieldDefinition): boolean { + const errors = this.formGroup.controls[field.key]?.errors; + return !!errors && Object.keys(errors).some(key => key !== 'required' && key !== 'pattern'); + } + imagePath(path: string): string { return this.resolveImagePath ? this.resolveImagePath(path) : path; } + + isNewField(field: FormFieldDefinition): boolean { + return !!this.newFieldKeys?.has(field.key); + } } diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts index a3ad857308..46fed1fbae 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts @@ -3,23 +3,29 @@ // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { Injectable } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { Observable, of, EMPTY } from 'rxjs'; -import { map, switchMap } from 'rxjs/operators'; +import { Observable, of, EMPTY, firstValueFrom, from } from 'rxjs'; +import { catchError, map, switchMap } from 'rxjs/operators'; import { TranslateService } from '@ngx-translate/core'; import { DialogService } from '@core/services/dialog.service'; import { MpItemVersionView } from '@shared/models/iot-hub/iot-hub-version.models'; import { ItemType } from '@shared/models/iot-hub/iot-hub-item.models'; -import { DeviceInstalledItemDescriptor, IotHubInstalledItem } from '@shared/models/iot-hub/iot-hub-installed-item.models'; +import { DeviceInstalledItemDescriptor, IotHubInstalledItem, IotHubInstalledItemKeptEntities } from '@shared/models/iot-hub/iot-hub-installed-item.models'; +import { IotHubApiService } from '@core/http/iot-hub-api.service'; +import { ConverterService } from '@core/http/converter.service'; +import { Converter } from '@shared/models/converter.models'; +import { HasVersion } from '@shared/models/entity.models'; import { EntityId } from '@shared/models/id/entity-id'; import { TbIotHubAddItemDialogComponent, IotHubAddItemDialogData, IotHubAddItemDialogResult } from './iot-hub-add-item-dialog.component'; import { TbIotHubItemDetailDialogComponent, IotHubItemDetailDialogData, IotHubItemDetailDialogMode } from './iot-hub-item-detail-dialog.component'; import { TbIotHubInstallDialogComponent, IotHubInstallDialogData } from './iot-hub-install-dialog.component'; import { TbIotHubUpdateDialogComponent, IotHubUpdateDialogData } from './iot-hub-update-dialog.component'; import { TbIotHubDeleteDialogComponent, IotHubDeleteDialogData } from './iot-hub-delete-dialog.component'; -import { TbDeviceInstallDialogComponent, DeviceInstallDialogData } from './device-install-dialog/device-install-dialog.component'; +import { TbDeviceInstallDialogComponent, DeviceInstallDialogData, DeviceInstallUpdate } from './device-install-dialog/device-install-dialog.component'; import { TbIotHubInstalledItemsDialogComponent, IotHubInstalledItemsDialogData } from './iot-hub-installed-items-dialog.component'; import { IotHubBuiltInService } from './iot-hub-built-in.service'; import { isBuiltInItem } from './iot-hub-utils'; +import { TbIotHubConverterUpdateDialogComponent, IotHubConverterUpdateDialogData } from './iot-hub-converter-update-dialog.component'; +import { DefaultConverterUpdate, loadInstalledDevicePackages } from './iot-hub-default-converter'; /** * What `openBuiltInOrConfirmInstall` did with a built-in item: 'handled' means nothing is left to do @@ -35,7 +41,9 @@ export class IotHubActionsService { private dialog: MatDialog, private dialogService: DialogService, private translate: TranslateService, - private builtInService: IotHubBuiltInService + private builtInService: IotHubBuiltInService, + private iotHubApiService: IotHubApiService, + private converterService: ConverterService ) {} openItemDetail(item: MpItemVersionView, installedItem?: IotHubInstalledItem, installedItemsCount?: number, @@ -148,6 +156,9 @@ export class IotHubActionsService { if (!installedItem) { return of(false); } + if (installedItem.itemType === ItemType.DEVICE) { + return this.updateDevice(installedItem, versionId); + } return this.dialog.open(TbIotHubUpdateDialogComponent, { panelClass: ['tb-dialog'], disableClose: true, @@ -162,16 +173,57 @@ export class IotHubActionsService { }).afterClosed(); } + /** + * Brings a device package's default converter to ThingsBoard's default converter now, after the user confirms it. + * The dialog opens with what the update check found: whether someone changed the converter, and which other packages use it. + */ + updateDefaultConverter(update: DefaultConverterUpdate): Observable { + return from(this.converterUpdateDialogData(update)).pipe( + switchMap(data => this.dialog.open( + TbIotHubConverterUpdateDialogComponent, { + panelClass: ['tb-dialog'], + disableClose: true, + autoFocus: false, + data + }).afterClosed()), + catchError(() => of(false)) + ); + } + + private async converterUpdateDialogData(update: DefaultConverterUpdate): Promise { + const installedItemId = update.installedItem.id.id; + const converterId = update.converter.id.id; + // The converter as it is now, not the table's copy: the dialog downloads it, and the update overwrites only this version + const [states, packages, converter] = await Promise.all([ + firstValueFrom(this.iotHubApiService.checkDeviceUpdate(installedItemId)), + loadInstalledDevicePackages(this.iotHubApiService), + firstValueFrom(this.converterService.getConverter(converterId)) as Promise + ]); + const state = states.find(s => s.stepName === update.stateKey); + // As the server decides what is shared: the converter is one of the entities another package tracks + const usedBy = packages + .filter(item => item.id.id !== installedItemId && + (item.descriptor as DeviceInstalledItemDescriptor)?.createdEntityIds?.some(id => id.id === converterId)) + .map(item => item.itemName); + return { update: { ...update, converter }, version: converter.version ?? state?.version, modified: state?.modified === true, usedBy }; + } + deleteItem(installedItem: IotHubInstalledItem): Observable { if (!installedItem) { return of(false); } - return this.dialog.open(TbIotHubDeleteDialogComponent, { - panelClass: ['tb-dialog'], - disableClose: true, - autoFocus: false, - data: { installedItemId: installedItem.id.id, itemName: installedItem.itemName, itemType: installedItem.itemType } - }).afterClosed(); + // A device package keeps what other installed packages use: the dialog opens with that already known + const keptEntities$: Observable = installedItem.itemType === 'DEVICE' ? + this.iotHubApiService.getInstalledItemKeptEntities(installedItem.id.id, {ignoreErrors: true}).pipe(catchError(() => of(null))) : + of(null); + return keptEntities$.pipe( + switchMap(keptEntities => this.dialog.open(TbIotHubDeleteDialogComponent, { + panelClass: ['tb-dialog'], + disableClose: true, + autoFocus: false, + data: { installedItemId: installedItem.id.id, itemName: installedItem.itemName, itemType: installedItem.itemType, keptEntities } + }).afterClosed()) + ); } // Reached only for items whose action mode is 'connect', i.e. never for built-in content: @@ -191,9 +243,30 @@ export class IotHubActionsService { }); } + /** + * A device package is updated by the install wizard of the new version: its steps change what + * the package created in place, so the device and its history stay. When only texts changed, + * the wizard records the new version without opening. + */ + private updateDevice(installedItem: IotHubInstalledItem, versionId: string): Observable { + return this.iotHubApiService.getVersionInfo(versionId).pipe( + switchMap(item => this.openDeviceInstallDialog(item, { + update: { + installedItemId: installedItem.id.id, + descriptor: installedItem.descriptor as DeviceInstalledItemDescriptor, + fromVersionId: installedItem.itemVersionId, + fromVersion: installedItem.version + } + })), + map(result => result === 'installed' ? 'updated' : result), + // The request has already shown the error + catchError(() => of(false)) + ); + } + private openDeviceInstallDialog(item: MpItemVersionView, options?: { reviewMode?: boolean; selectedInstallMethod?: string; installState?: any; - entityGroupId?: string; customerId?: string}): Observable { + entityGroupId?: string; customerId?: string; update?: DeviceInstallUpdate}): Observable { return this.dialog.open(TbDeviceInstallDialogComponent, { panelClass: ['tb-dialog', 'tb-fullscreen-dialog-lt-md'], disableClose: true, diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-components.module.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-components.module.ts index ea754e42f9..99a2676c90 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-components.module.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-components.module.ts @@ -11,6 +11,7 @@ import { TbIotHubAddItemDialogComponent } from './iot-hub-add-item-dialog.compon import { TbIotHubInstallDialogComponent } from './iot-hub-install-dialog.component'; import { TbIotHubUpdateDialogComponent } from './iot-hub-update-dialog.component'; import { TbIotHubDeleteDialogComponent } from './iot-hub-delete-dialog.component'; +import { TbIotHubConverterUpdateDialogComponent } from './iot-hub-converter-update-dialog.component'; import { TbIotHubUnpublishedWarningDialogComponent } from './iot-hub-unpublished-warning-dialog.component'; import { TbDeviceInstallDialogComponent } from './device-install-dialog/device-install-dialog.component'; import { InstallFormRendererComponent } from './device-install-dialog/install-form-renderer/install-form-renderer.component'; @@ -27,6 +28,7 @@ import { IotHubItemLinkModule } from './iot-hub-item-link-card/iot-hub-item-link @NgModule({ declarations: [ + TbIotHubConverterUpdateDialogComponent, TbIotHubItemDetailDialogComponent, TbIotHubBrowseComponent, TbIotHubItemCardComponent, diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.html new file mode 100644 index 0000000000..936eaf624a --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.html @@ -0,0 +1,33 @@ + +
+
+ + +
diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.scss b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.scss new file mode 100644 index 0000000000..ae19cef879 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.scss @@ -0,0 +1,65 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +:host { + display: block; + max-width: 600px; +} + +.tb-converter-update-title { + font-size: 20px; + font-weight: 600; + line-height: 24px; + letter-spacing: 0.1px; + color: rgba(0, 0, 0, 0.87); + margin: 0; +} + +.tb-converter-update-text { + font-size: 14px; + line-height: 20px; + letter-spacing: 0.2px; + color: rgba(0, 0, 0, 0.54); + margin: 0; +} + +.tb-converter-update-box { + padding: 12px 16px; + border: 1px solid rgba(0, 0, 0, 0.12); + border-radius: 8px; +} + +.tb-converter-update-name { + font-size: 14px; + font-weight: 500; + line-height: 20px; + color: rgba(0, 0, 0, 0.87); +} + +.tb-converter-update-packages { + margin: 0; + padding-left: 20px; + font-size: 12px; + line-height: 16px; + color: rgba(0, 0, 0, 0.54); +} + +.tb-converter-update-link { + color: #305680; + text-decoration: underline; + cursor: pointer; +} + +.tb-progress-alert-msg { + font-size: 12px; + font-weight: 400; + line-height: 16px; + letter-spacing: 0.4px; + + &.tb-progress-alert-msg-warning { + color: #f66716; + } + + &.tb-progress-alert-msg-error { + color: #dd2c00; + } +} diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.ts new file mode 100644 index 0000000000..3db43abe6f --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-converter-update-dialog.component.ts @@ -0,0 +1,79 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { Component, Inject } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { Router } from '@angular/router'; +import { Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { AppState } from '@core/core.state'; +import { DialogComponent } from '@shared/components/dialog.component'; +import { IotHubApiService } from '@core/http/iot-hub-api.service'; +import { DefaultConverterUpdate, defaultConverterUpdateRequest } from '@home/components/iot-hub/iot-hub-default-converter'; +import { downloadEntityJson, readableMessage, requestFailureMessage, splitTextWithLink } from '@home/components/iot-hub/iot-hub-utils'; + +export interface IotHubConverterUpdateDialogData { + update: DefaultConverterUpdate; + // The version of the converter the dialog downloads: the server refuses the update if someone saved the converter since + version?: number; + // Someone changed the converter since a package installed or last updated it + modified: boolean; + // The names of the other installed packages that use the converter + usedBy: string[]; +} + +/** + * Brings an installed device package's default converter to ThingsBoard's default converter now, without a new version of + * the package. Closes with true once it is updated. + */ +@Component({ + selector: 'tb-iot-hub-converter-update-dialog', + standalone: false, + templateUrl: './iot-hub-converter-update-dialog.component.html', + styleUrls: ['./iot-hub-converter-update-dialog.component.scss'] +}) +export class TbIotHubConverterUpdateDialogComponent extends DialogComponent { + + readonly modifiedHint = splitTextWithLink(this.translate.instant('iot-hub.device-update-modified')); + updating = false; + errorMessage: string | null = null; + + constructor( + protected store: Store, + protected router: Router, + protected dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: IotHubConverterUpdateDialogData, + private iotHubApiService: IotHubApiService, + private translate: TranslateService + ) { + super(store, router, dialogRef); + } + + downloadCurrent(): void { + downloadEntityJson(this.data.update.converter, this.data.update.converter.name); + } + + update(): void { + this.updating = true; + this.errorMessage = null; + this.iotHubApiService.updateDevicePackage(this.data.update.installedItem.id.id, + defaultConverterUpdateRequest(this.data.update, this.data.version), { ignoreErrors: true }).subscribe({ + next: result => { + if (result.success) { + this.dialogRef.close(true); + return; + } + // Nothing was changed: the server rolled it back + this.updating = false; + this.errorMessage = readableMessage(result.errorMessage) ?? this.translate.instant('iot-hub.device-install-unexpected-error'); + }, + error: error => { + this.updating = false; + this.errorMessage = requestFailureMessage(error, this.translate); + } + }); + } + + cancel(): void { + this.dialogRef.close(false); + } +} diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-default-converter.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-default-converter.ts new file mode 100644 index 0000000000..0a6f970e21 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-default-converter.ts @@ -0,0 +1,128 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { firstValueFrom } from 'rxjs'; +import { ResourcesService } from '@core/services/resources.service'; +import { Converter, ConverterConfigV2, ConverterType, getTargetField, getTargetTemplateUrl } from '@shared/models/converter.models'; +import { IntegrationType } from '@shared/models/integration.models'; +import { ScriptLanguage } from '@shared/models/rule-node.models'; +import { isEqual } from '@core/utils'; +import { DeviceInstalledItemDescriptor, DeviceUpdateRequest, IotHubInstalledItem } from '@shared/models/iot-hub/iot-hub-installed-item.models'; +import { IotHubApiService } from '@core/http/iot-hub-api.service'; +import { PageLink } from '@shared/models/page/page-link'; +import { PageData } from '@shared/models/page/page-data'; + +/** An installed device package's default converter that differs from ThingsBoard's default converter now. */ +export interface DefaultConverterUpdate { + installedItem: IotHubInstalledItem; + // The key of the converter's step in the package's install state + stateKey: string; + converter: Converter; + defaultConverter: Partial; +} + +const DEFAULT_CONVERTERS_V2_CONFIGURATION_URL = '/assets/converters/default-converters-v2-configuration.json'; + +// The settings of a default converter that decide what it does: the script is compared on its own +const V2_CONFIGURATION_KEYS: (keyof ConverterConfigV2)[] = + ['type', 'name', 'profile', 'label', 'customer', 'group', 'attributes', 'telemetry', 'updateOnlyKeys']; + +/** + * The uplink converter ThingsBoard creates for a new integration of this type, as a device package step with + * "default": true installs it. Null when ThingsBoard has no default converter settings for the type. + */ +export const loadDefaultUplinkConverter = async (resourcesService: ResourcesService, integrationType: IntegrationType, + scriptLang: ScriptLanguage, name: string): Promise | null> => { + const configurations = await firstValueFrom( + resourcesService.loadJsonResource>(DEFAULT_CONVERTERS_V2_CONFIGURATION_URL)); + const configuration = configurations?.[integrationType]; + if (!configuration) { + return null; + } + const script = await firstValueFrom(resourcesService.loadJsonResource( + getTargetTemplateUrl(ConverterType.UPLINK, scriptLang, integrationType, 2))); + return { + name, + type: ConverterType.UPLINK, + integrationType, + converterVersion: 2, + edgeTemplate: false, + // As the device packages had it: the debug events help to find out why a LoRaWAN device sends nothing + debugSettings: { failuresEnabled: true, allEnabled: true, allEnabledUntil: 0 }, + configuration: { + ...configuration, + scriptLang, + decoder: null, + tbelDecoder: null, + encoder: null, + tbelEncoder: null, + [getTargetField(ConverterType.UPLINK, scriptLang)]: script + }, + additionalInfo: { description: '' } + }; +}; + +/** True when the converter does something else than the default one: another script or other settings. */ +export const differsFromDefaultConverter = (converter: Converter, defaultConverter: Partial): boolean => { + const field = getTargetField(ConverterType.UPLINK, converter.configuration.scriptLang); + const script = (value: string) => (value ?? '').trimEnd(); + return script(converter.configuration[field]) !== script(defaultConverter.configuration[field]) || + V2_CONFIGURATION_KEYS.some(key => !isEqual(converter.configuration[key] ?? null, defaultConverter.configuration[key] ?? null)); +}; + +/** All installed device packages of the tenant. */ +export const loadInstalledDevicePackages = async (iotHubApiService: IotHubApiService): Promise => { + const items: IotHubInstalledItem[] = []; + let pageLink = new PageLink(100); + let page: PageData; + do { + page = await firstValueFrom(iotHubApiService.getInstalledItems(pageLink, 'DEVICE', undefined, { ignoreLoading: true })); + items.push(...page.data); + pageLink = pageLink.nextPageLink(); + } while (page.hasNext); + return items; +}; + +/** + * The converters device packages installed themselves as their default converter, not ones they took as they were, of + * all installed device packages: only such a converter is ThingsBoard's default one, which a new ThingsBoard version + * may change. The installed items table and the update dialog both decide by it. + */ +export const loadOwnDefaultConverterIds = async (iotHubApiService: IotHubApiService): Promise> => { + const ids = new Set(); + for (const item of await loadInstalledDevicePackages(iotHubApiService)) { + for (const state of Object.values((item.descriptor as DeviceInstalledItemDescriptor)?.installState ?? {})) { + if (state?.defaultConverter && state.entityOutput?.id && state.resolution !== 'use-existing') { + ids.add(state.entityOutput.id); + } + } + } + return ids; +}; + +/** + * The update of the installed version itself that brings its default converter to ThingsBoard's default one. It sends only + * the converter step: the server keeps the other steps, the forms and the integration's metadata as they are. + * expectedVersion is the converter's version the user reviewed. + */ +export const defaultConverterUpdateRequest = (update: DefaultConverterUpdate, expectedVersion?: number): DeviceUpdateRequest => { + const descriptor = update.installedItem.descriptor as DeviceInstalledItemDescriptor; + return { + versionId: update.installedItem.itemVersionId, + fromVersionId: update.installedItem.itemVersionId, + selectedInstallMethod: descriptor.selectedInstallMethod, + installState: {}, + steps: [{ + name: update.converter.name, + id: update.stateKey, + type: 'UPLINK_CONVERTER', + action: 'OVERWRITE', + entityId: update.converter.id.id, + expectedVersion, + // The user confirmed it in the dialog, which names the other packages it affects + confirmed: true, + resolution: descriptor.installState?.[update.stateKey]?.resolution ?? 'created', + defaultConverter: true, + entity: update.defaultConverter + }] + }; +}; diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html index 3270cfd641..3de67878aa 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html @@ -1,12 +1,16 @@

{{ 'iot-hub.remove-confirm-title' | translate:{ name: data.itemName } }}

-

{{ (data.itemType === 'SOLUTION_TEMPLATE' ? 'iot-hub.remove-desc-solution-template' : 'iot-hub.remove-desc') | translate }}

+

{{ description }}

+ @if (keptReferences) { + + }
diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss index 86ad80c197..63fa684164 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss @@ -1,5 +1,11 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 +:host { + display: block; + max-width: 600px; +} + .tb-iot-hub-delete-title { font-size: 20px; font-weight: 600; diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts index 4447dc8a23..08ae924eb6 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts @@ -1,18 +1,23 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { Component, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Router } from '@angular/router'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { DialogComponent } from '@shared/components/dialog.component'; -import { IotHubInstalledItem } from 'src/app/shared/models/iot-hub/iot-hub-installed-item.models'; +import { IotHubInstalledItemKeptEntities } from 'src/app/shared/models/iot-hub/iot-hub-installed-item.models'; import { IotHubApiService } from '@core/http/iot-hub-api.service'; +import { TranslateService } from '@ngx-translate/core'; +import { ResourceReferences } from '@shared/models/resource.models'; +import { EntityId } from '@shared/models/id/entity-id'; export interface IotHubDeleteDialogData { installedItemId: string; itemName: string; itemType?: string; + keptEntities?: IotHubInstalledItemKeptEntities | null; } @Component({ @@ -23,14 +28,30 @@ export interface IotHubDeleteDialogData { }) export class TbIotHubDeleteDialogComponent extends DialogComponent { + description: string; + + // A device package keeps the entities other installed packages use, and the dialog lists them before the user confirms + keptReferences: ResourceReferences | null = null; + constructor( protected store: Store, protected router: Router, protected dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: IotHubDeleteDialogData, - private iotHubApiService: IotHubApiService + private iotHubApiService: IotHubApiService, + private translate: TranslateService ) { super(store, router, dialogRef); + const kept = data.keptEntities; + if (kept?.entities.length) { + this.keptReferences = kept.entities.map(entity => ({ id: entity.entityId as EntityId, name: entity.name })); + // Kept because other packages use them, because the user had them before the package, or both + const key = !kept.usedExistingCount ? 'iot-hub.remove-desc-kept' : + !kept.usedByItemsCount ? 'iot-hub.remove-desc-kept-own' : 'iot-hub.remove-desc-kept-own-or-used'; + this.description = this.translate.instant(key, { count: kept.usedByItemsCount, kept: kept.entities.length }); + } else { + this.description = this.translate.instant(data.itemType === 'SOLUTION_TEMPLATE' ? 'iot-hub.remove-desc-solution-template' : 'iot-hub.remove-desc'); + } } confirm(): void { diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html index bd5f7a6775..905db77aca 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html @@ -1,7 +1,8 @@
@@ -77,7 +78,10 @@ }

@if (planSummary.missing > 0) { -

{{ 'iot-hub.install-plan-missing-warning' | translate:{ count: planSummary.missing } }}

+
+ warning + {{ 'iot-hub.install-plan-missing-warning' | translate:{ count: planSummary.missing } }} +
}
@if (getTelemetryFromDatabaseConfigForm.get('fetchMode').value === fetchMode.ALL) { diff --git a/ui-ngx/src/app/modules/home/components/rule-node/enrichment/get-telemetry-from-database-config.component.scss b/ui-ngx/src/app/modules/home/components/rule-node/enrichment/get-telemetry-from-database-config.component.scss index 41f1d98916..0999a2d1d3 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/enrichment/get-telemetry-from-database-config.component.scss +++ b/ui-ngx/src/app/modules/home/components/rule-node/enrichment/get-telemetry-from-database-config.component.scss @@ -1,43 +1,12 @@ // SPDX-FileCopyrightText: Copyright The ThingsBoard Authors -// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 :host { .see-example { display: inline-block; } - .description-block { - display: flex; - align-items: center; - border-radius: 6px; - border: 1px solid #EAEAEA; - - .description-icon { - font-size: 24px; - height: 24px; - min-height: 24px; - width: 24px; - min-width: 24px; - line-height: 24px; - color: #D9D9D9; - margin: 4px; - } - - .description-text { - font-size: 12px; - line-height: 16px; - letter-spacing: 0.25px; - margin: 6px; - } - - &.error { - color: var(--mat-theme-error, #f44336); - - .description-icon { - color: var(--mat-theme-error, #f44336); - } - } - } .item-center { align-items: center; diff --git a/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html b/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html index ff0c88665c..16accc7980 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/external/rest-api-call-config.component.html @@ -51,7 +51,10 @@ {{ 'rule-node-config.headers' | translate }} -
+
+ info_outline + +
@if(!restApiCallConfigForm.get('ignoreRequestBody').value) { -
+
+ info_outline + +
rule-node-config.request-body-template