From 3d9df20d455e576f70b6f1d25b8262d63fc103d1 Mon Sep 17 00:00:00 2001 From: AndriiD Date: Sat, 7 Jan 2023 18:00:49 +0200 Subject: [PATCH 001/286] resetPassword in AuthController now returns nothing instead of token pair, just updates password. Button 'reset password' in reset password form now redirects to login page --- .../thingsboard/server/controller/AuthController.java | 3 +-- ui-ngx/src/app/core/auth/auth.service.ts | 10 ++++------ .../login/pages/login/reset-password.component.ts | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/AuthController.java b/application/src/main/java/org/thingsboard/server/controller/AuthController.java index 0cb3a3fc92..1d1410b05a 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AuthController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AuthController.java @@ -278,7 +278,7 @@ public class AuthController extends BaseController { @RequestMapping(value = "/noauth/resetPassword", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) @ResponseBody - public JwtPair resetPassword( + public void resetPassword( @ApiParam(value = "Reset password request.") @RequestBody ResetPasswordRequest resetPasswordRequest, HttpServletRequest request) throws ThingsboardException { @@ -305,7 +305,6 @@ public class AuthController extends BaseController { eventPublisher.publishEvent(new UserCredentialsInvalidationEvent(securityUser.getId())); - return tokenFactory.createTokenPair(securityUser); } else { throw new ThingsboardException("Invalid reset token!", ThingsboardErrorCode.BAD_REQUEST_PARAMS); } diff --git a/ui-ngx/src/app/core/auth/auth.service.ts b/ui-ngx/src/app/core/auth/auth.service.ts index a62623260f..3eb596381d 100644 --- a/ui-ngx/src/app/core/auth/auth.service.ts +++ b/ui-ngx/src/app/core/auth/auth.service.ts @@ -156,12 +156,10 @@ export class AuthService { )); } - public resetPassword(resetToken: string, password: string): Observable { - return this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()).pipe( - tap((loginResponse: LoginResponse) => { - this.setUserFromJwtToken(loginResponse.token, loginResponse.refreshToken, true); - } - )); + public resetPassword(resetToken: string, password: string) { + this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()).subscribe( + () => { this.router.navigateByUrl('login'); }, () => {} + ); } public changePassword(currentPassword: string, newPassword: string, config?: RequestConfig) { diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts index ab0928ec66..73d7da65d4 100644 --- a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts @@ -71,7 +71,7 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD } else { this.authService.resetPassword( this.resetToken, - this.resetPassword.get('newPassword').value).subscribe(); + this.resetPassword.get('newPassword').value); } } } From bd8129082655e93908adff8a2ad292776cd10694 Mon Sep 17 00:00:00 2001 From: AndriiD Date: Mon, 16 Jan 2023 14:03:17 +0200 Subject: [PATCH 002/286] fix test --- .../server/controller/BaseUserControllerTest.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java index 6429574e38..90d74a9117 100644 --- a/application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseUserControllerTest.java @@ -235,16 +235,8 @@ public abstract class BaseUserControllerTest extends AbstractControllerTest { .put("resetToken", TestMailService.currentResetPasswordToken) .put("password", "testPassword2"); - JsonNode tokenInfo = readResponse( - doPost("/api/noauth/resetPassword", resetPasswordRequest) - .andExpect(status().isOk()), JsonNode.class); - validateAndSetJwtToken(tokenInfo, email); - - doGet("/api/auth/user") - .andExpect(status().isOk()) - .andExpect(jsonPath("$.authority", is(Authority.TENANT_ADMIN.name()))) - .andExpect(jsonPath("$.email", is(email))); + doPost("/api/noauth/resetPassword", resetPasswordRequest); resetTokens(); login(email, "testPassword2"); From 533f08464818f403728f54fcd3f2bbd2387a94bc Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Tue, 18 Apr 2023 16:41:29 +0300 Subject: [PATCH 003/286] UI: Fixed reset password service --- ui-ngx/src/app/core/auth/auth.service.ts | 6 ++---- .../modules/login/pages/login/reset-password.component.ts | 7 +++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/core/auth/auth.service.ts b/ui-ngx/src/app/core/auth/auth.service.ts index 3eb596381d..7b5a997804 100644 --- a/ui-ngx/src/app/core/auth/auth.service.ts +++ b/ui-ngx/src/app/core/auth/auth.service.ts @@ -156,10 +156,8 @@ export class AuthService { )); } - public resetPassword(resetToken: string, password: string) { - this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()).subscribe( - () => { this.router.navigateByUrl('login'); }, () => {} - ); + public resetPassword(resetToken: string, password: string): Observable { + return this.http.post('/api/noauth/resetPassword', {resetToken, password}, defaultHttpOptions()); } public changePassword(currentPassword: string, newPassword: string, config?: RequestConfig) { diff --git a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts index 73d7da65d4..2857241c27 100644 --- a/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/reset-password.component.ts @@ -22,7 +22,7 @@ import { PageComponent } from '@shared/components/page.component'; import { FormBuilder } from '@angular/forms'; import { ActionNotificationShow } from '@core/notification/notification.actions'; import { TranslateService } from '@ngx-translate/core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { Subscription } from 'rxjs'; @Component({ @@ -44,6 +44,7 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD constructor(protected store: Store, private route: ActivatedRoute, + private router: Router, private authService: AuthService, private translate: TranslateService, public fb: FormBuilder) { @@ -71,7 +72,9 @@ export class ResetPasswordComponent extends PageComponent implements OnInit, OnD } else { this.authService.resetPassword( this.resetToken, - this.resetPassword.get('newPassword').value); + this.resetPassword.get('newPassword').value).subscribe( + () => this.router.navigateByUrl('login') + ); } } } From 6708f4f8f7c740f9c8a3c9551835655c28f884b6 Mon Sep 17 00:00:00 2001 From: KosukeFUKUMORI Date: Tue, 15 Aug 2023 13:09:58 +0900 Subject: [PATCH 004/286] Update locale.constant-ja_JP.json --- .../assets/locale/locale.constant-ja_JP.json | 198 +++++++++--------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/ui-ngx/src/assets/locale/locale.constant-ja_JP.json b/ui-ngx/src/assets/locale/locale.constant-ja_JP.json index f63a6681a2..329303745c 100644 --- a/ui-ngx/src/assets/locale/locale.constant-ja_JP.json +++ b/ui-ngx/src/assets/locale/locale.constant-ja_JP.json @@ -20,45 +20,45 @@ "yes": "はい", "no": "いいえ", "update": "更新", - "remove": "削除する", - "search": "サーチ", - "clear-search": "検索をクリアする", - "assign": "割り当てます", + "remove": "削除", + "search": " 検索", + "clear-search": "検索をクリア", + "assign": "割り当て", "unassign": "割り当て解除", "share": "シェア", "make-private": "プライベートにする", "apply": "適用", - "apply-changes": "変更を適用する", + "apply-changes": "変更を適用", "edit-mode": "編集モード", "enter-edit-mode": "編集モードに入る", - "decline-changes": "変更を拒否する", + "decline-changes": "変更を拒否", "close": "閉じる", - "back": "バック", - "run": "走る", + "back": "戻る", + "run": "実行", "sign-in": "サインイン!", "edit": "編集", "view": "ビュー", - "create": "作成する", + "create": "作成", "drag": "ドラッグ", "refresh": "リフレッシュ", "undo": "元に戻す", "copy": "コピー", "paste": "ペースト", - "copy-reference": "コピーリファレンス", + "copy-reference": "参照コピー", "paste-reference": "参照貼り付け", "import": "インポート", - "export": "輸出する", + "export": "エクスポート", "share-via": "{{provider}}" }, "aggregation": { "aggregation": "集約", "function": "データ集約機能", - "limit": "最大値", + "limit": "上限", "group-interval": "グループ化の間隔", - "min": "分", + "min": "最小", "max": "最大", "avg": "平均", - "sum": "和", + "sum": "総和", "count": "カウント", "none": "なし" }, @@ -77,17 +77,17 @@ "smtp-host": "SMTPホスト", "smtp-host-required": "SMTPホストが必要です。", "smtp-port": "SMTPポート", - "smtp-port-required": "smtpポートを指定する必要があります。", - "smtp-port-invalid": "それは有効なsmtpポートのようには見えません。", + "smtp-port-required": "SMTPポートを指定してください。", + "smtp-port-invalid": "有効なSMTPポートではありません。", "timeout-msec": "タイムアウト(ミリ秒)", - "timeout-required": "タイムアウトが必要です。", - "timeout-invalid": "それは有効なタイムアウトのようには見えません。", + "timeout-required": "タイムアウト設定が必要です。", + "timeout-invalid": "有効なタイムアウト設定ではありません。", "enable-tls": "TLSを有効にする", "tls-version": "TLSバージョン", "send-test-mail": "テストメールを送信する" }, "alarm": { - "alarm": "警報", + "alarm": "アラーム", "alarms": "アラーム", "select-alarm": "アラームを選択", "no-alarms-matching": "'{{entity}}'発見されました。", @@ -110,12 +110,12 @@ "created-time": "作成時刻", "type": "タイプ", "severity": "重大度", - "originator": "創始者", - "originator-type": "発信者タイプ", + "originator": "発信元", + "originator-type": "発信元タイプ", "details": "詳細", "status": "状態", "alarm-details": "アラームの詳細", - "start-time": "始まる時間", + "start-time": "開始時間", "end-time": "終了時間", "ack-time": "確認された時間", "clear-time": "クリアされた時間", @@ -124,7 +124,7 @@ "severity-minor": "マイナー", "severity-warning": "警告", "severity-indeterminate": "不確定", - "acknowledge": "認める", + "acknowledge": "承認", "clear": "クリア", "search": "アラームの検索", "selected-alarms": "{ count, plural, =1 {1 alarm} other {# alarms} }選択された", @@ -148,7 +148,7 @@ "filter-type-entity-name": "エンティティ名", "filter-type-state-entity": "ダッシュボード状態からのエンティティ", "filter-type-state-entity-description": "ダッシュボードの状態パラメータから取得されたエンティティ", - "filter-type-asset-type": "資産の種類", + "filter-type-asset-type": "アセットの種類", "filter-type-asset-type-description": "'{{assetTypes}}'", "filter-type-asset-type-and-name-description": "'{{assetTypes}}''{{prefix}}'", "filter-type-device-type": "デバイスタイプ", @@ -156,7 +156,7 @@ "filter-type-device-type-and-name-description": "'{{deviceTypes}}''{{prefix}}'", "filter-type-relations-query": "関係クエリ", "filter-type-relations-query-description": "{{entities}}{{relationType}}{{direction}}{{rootEntity}}", - "filter-type-asset-search-query": "資産検索クエリ", + "filter-type-asset-search-query": "アセット検索クエリ", "filter-type-asset-search-query-description": "{{assetTypes}}{{relationType}}{{direction}}{{rootEntity}}", "filter-type-device-search-query": "デバイス検索クエリ", "filter-type-device-search-query-description": "{{deviceTypes}}{{relationType}}{{direction}}{{rootEntity}}", @@ -178,31 +178,31 @@ "any-relation": "どれか" }, "asset": { - "asset": "資産", - "assets": "資産", - "management": "資産運用管理", + "asset": "アセット", + "assets": "アセット", + "management": "アセット管理", "view-assets": "アセットの表示", "add": "アセットを追加", "assign-to-customer": "顧客に割り当てる", - "assign-asset-to-customer": "顧客に資産を割り当てる", - "assign-asset-to-customer-text": "顧客に割り当てる資産を選択してください", + "assign-asset-to-customer": "顧客にアセットを割り当てる", + "assign-asset-to-customer-text": "顧客に割り当てるアセットを選択してください", "no-assets-text": "アセットが見つかりません", - "assign-to-customer-text": "資産を割り当てる顧客を選択してください", - "public": "パブリック", + "assign-to-customer-text": "アセットを割り当てる顧客を選択してください", + "public": "公開", "assignedToCustomer": "顧客に割り当てられた", "make-public": "アセットを公開する", "make-private": "アセットをプライベートにする", "unassign-from-customer": "顧客からの割り当て解除", "delete": "アセットを削除", - "asset-public": "資産は公開されています", - "asset-type": "資産の種類", - "asset-type-required": "資産の種類が必要です。", + "asset-public": "アセットは公開されています", + "asset-type": "アセットの種類", + "asset-type-required": "アセットの種類が必要です。", "select-asset-type": "アセットタイプを選択", "enter-asset-type": "アセットタイプを入力", "any-asset": "すべてのアセット", "no-asset-types-matching": "'{{entitySubtype}}'発見されました。", "asset-type-list-empty": "選択されたアセットタイプはありません。", - "asset-types": "資産タイプ", + "asset-types": "アセットタイプ", "name": "名", "name-required": "名前は必須です。", "description": "説明", @@ -211,7 +211,7 @@ "details": "詳細", "events": "イベント", "add-asset-text": "新しいアセットを追加する", - "asset-details": "資産の詳細", + "asset-details": "アセットの詳細", "assign-assets": "アセットの割り当て", "assign-assets-text": "{ count, plural, =1 {1 asset} other {# assets} }顧客に", "delete-assets": "アセットを削除する", @@ -219,25 +219,25 @@ "unassign-assets-action-title": "{ count, plural, =1 {1 asset} other {# assets} }顧客から", "assign-new-asset": "新しいアセットを割り当てる", "delete-asset-title": "'{{assetName}}'?", - "delete-asset-text": "確認後、資産と関連するすべてのデータが回復不能になることに注意してください。", + "delete-asset-text": "確認後、アセットと関連するすべてのデータが回復不能になることに注意してください。", "delete-assets-title": "{ count, plural, =1 {1 asset} other {# assets} }?", "delete-assets-action-title": "{ count, plural, =1 {1 asset} other {# assets} }", - "delete-assets-text": "確認後、選択したすべての資産が削除され、関連するすべてのデータは回復不能になりますので注意してください。", + "delete-assets-text": "確認後、選択したすべてのアセットが削除され、関連するすべてのデータは回復不能になりますので注意してください。", "make-public-asset-title": "'{{assetName}}'パブリック?", - "make-public-asset-text": "確認後、資産とそのすべてのデータは公開され、他の人がアクセスできるようになります。", + "make-public-asset-text": "確認後、アセットとそのすべてのデータは公開され、他の人がアクセスできるようになります。", "make-private-asset-title": "'{{assetName}}'プライベート?", - "make-private-asset-text": "確認後、資産とそのすべてのデータは非公開にされ、他の人がアクセスすることはできません。", + "make-private-asset-text": "確認後、アセットとそのすべてのデータは非公開にされ、他の人がアクセスすることはできません。", "unassign-asset-title": "'{{assetName}}'?", - "unassign-asset-text": "確認後、資産は割り当て解除され、顧客はアクセスできなくなります。", + "unassign-asset-text": "確認後、アセットは割り当て解除され、顧客はアクセスできなくなります。", "unassign-asset": "アセットの割り当てを解除する", "unassign-assets-title": "{ count, plural, =1 {1 asset} other {# assets} }?", - "unassign-assets-text": "確認後、選択されたすべての資産が割り当て解除され、顧客がアクセスできなくなります。", + "unassign-assets-text": "確認後、選択されたすべてのアセットが割り当て解除され、顧客がアクセスできなくなります。", "copyId": "アセットIDをコピーする", "idCopiedMessage": "アセットIDがクリップボードにコピーされました", "select-asset": "アセットを選択", "no-assets-matching": "'{{entity}}'発見されました。", - "asset-required": "資産が必要です", - "name-starts-with": "アセット名はで始まります", + "asset-required": "アセットが必要です", + "name-starts-with": "次で始まるアセット名", "label": "ラベル" }, "attribute": { @@ -311,12 +311,12 @@ }, "contact": { "country": "国", - "city": "シティ", - "state": "州/県", + "city": "市区町村", + "state": "都道府県", "postal-code": "郵便番号", "postal-code-invalid": "無効な郵便番号形式です。", "address": "住所", - "address2": "アドレス2", + "address2": "住所2", "phone": "電話", "email": "Eメール", "no-address": "住所がありません" @@ -324,8 +324,8 @@ "common": { "username": "ユーザー名", "password": "パスワード", - "enter-username": "ユーザーネームを入力してください", - "enter-password": "パスワードを入力する", + "enter-username": "ユーザー名を入力してください", + "enter-password": "パスワードを入力してください", "enter-search": "検索を入力", "created-time": "作成時刻" }, @@ -338,27 +338,27 @@ "customer": "顧客", "customers": "顧客", "management": "顧客管理", - "dashboard": "カスタマーダッシュボード", - "dashboards": "カスタマーダッシュボード", + "dashboard": "顧客ダッシュボード", + "dashboards": "顧客ダッシュボード", "devices": "顧客デバイス", - "assets": "顧客資産", + "assets": "顧客アセット", "public-dashboards": "パブリックダッシュボード", "public-devices": "パブリックデバイス", - "public-assets": "公的資産", + "public-assets": "パブリックアセット", "add": "顧客を追加", - "delete": "顧客を削除する", - "manage-customer-users": "顧客ユーザーを管理する", + "delete": "顧客を削除", + "manage-customer-users": "顧客を管理する", "manage-customer-devices": "顧客のデバイスを管理する", "manage-customer-dashboards": "顧客ダッシュボードの管理", "manage-public-devices": "パブリックデバイスを管理する", - "manage-public-dashboards": "公開ダッシュボードの管理", - "manage-customer-assets": "顧客資産の管理", - "manage-public-assets": "公的資産を管理する", + "manage-public-dashboards": "パブリックダッシュボードの管理", + "manage-customer-assets": "顧客アセットの管理", + "manage-public-assets": "パブリックアセットを管理する", "add-customer-text": "新規顧客を追加", "no-customers-text": "顧客が見つかりません", - "customer-details": "お客様情報", + "customer-details": "顧客情報", "delete-customer-title": "'{{customerTitle}}'?", - "delete-customer-text": "確認後、お客様および関連するすべてのデータが回復不能になるので注意してください。", + "delete-customer-text": "確認後、顧客および関連するすべてのデータが回復不能になるので注意してください。", "delete-customers-title": "{ count, plural, =1 {1 customer} other {# customers} }?", "delete-customers-action-title": "{ count, plural, =1 {1 customer} other {# customers} }", "delete-customers-text": "確認後、選択したすべての顧客は削除され、関連するすべてのデータは回復不能になります。", @@ -381,10 +381,10 @@ "default-customer-required": "テナントレベルのダッシュボードをデバッグするには、デフォルトの顧客が必要です" }, "datetime": { - "date-from": "デートから", - "time-from": "からの時間", - "date-to": "日付", - "time-to": "の時間" + "date-from": "開始日", + "time-from": "開始時刻", + "date-to": "終了日", + "time-to": "終了時刻" }, "dashboard": { "dashboard": "ダッシュボード", @@ -462,11 +462,11 @@ "max-columns-count-message": "最大1000の列カウントのみが許可されます。", "widgets-margins": "ウィジェット間のマージン", "horizontal-margin": "水平マージン", - "horizontal-margin-required": "水平余白値が必要です。", + "horizontal-margin-required": "水平マージン設定が必要です。", "min-horizontal-margin-message": "最小水平マージン値としては0だけが許容されます。", "max-horizontal-margin-message": "最大水平マージン値は50だけです。", "vertical-margin": "垂直マージン", - "vertical-margin-required": "垂直マージン値が必要です。", + "vertical-margin-required": "垂直マージン設定が必要です。", "min-vertical-margin-message": "最小の垂直マージン値として0のみが許可されます。", "max-vertical-margin-message": "最大垂直マージン値は50のみです。", "autofill-height": "自動レイアウトの高さ", @@ -482,8 +482,8 @@ "display-entities-selection": "エンティティの選択を表示する", "display-dashboard-timewindow": "タイムウィンドウを表示する", "display-dashboard-export": "エクスポートの表示", - "import": "インポートダッシュボード", - "export": "エクスポートダッシュボード", + "import": "ダッシュボードをインポート", + "export": "ダッシュボードをエクスポート", "export-failed-error": "{{error}}", "create-new-dashboard": "新しいダッシュボードを作成する", "dashboard-file": "ダッシュボードファイル", @@ -529,15 +529,15 @@ }, "datakey": { "settings": "設定", - "advanced": "上級", + "advanced": "カスタム", "label": "ラベル", "color": "色", - "units": "値の隣に表示する特別なシンボル", - "decimals": "浮動小数点の後の桁数", + "units": "単位", + "decimals": "小数点以下の桁数", "data-generation-func": "データ生成関数", "use-data-post-processing-func": "データ後処理機能を使用する", "configuration": "データキー設定", - "timeseries": "タイムズ", + "timeseries": "時系列", "attributes": "属性", "alarm": "アラームフィールド", "timeseries-required": "エンティティの時系列データが必要です。", @@ -703,8 +703,8 @@ "type-devices": "デバイス", "list-of-devices": "{ count, plural, =1 {One device} other {List of # devices} }", "device-name-starts-with": "'{{prefix}}'", - "type-asset": "資産", - "type-assets": "資産", + "type-asset": "アセット", + "type-assets": "アセット", "list-of-assets": "{ count, plural, =1 {One asset} other {List of # assets} }", "asset-name-starts-with": "'{{prefix}}'", "type-rule": "ルール", @@ -731,7 +731,7 @@ "type-dashboards": "ダッシュボード", "list-of-dashboards": "{ count, plural, =1 {One dashboard} other {List of # dashboards} }", "dashboard-name-starts-with": "'{{prefix}}'", - "type-alarm": "警報", + "type-alarm": "アラーム", "type-alarms": "アラーム", "list-of-alarms": "{ count, plural, =1 {One alarms} other {List of # alarms} }", "alarm-name-starts-with": "'{{prefix}}'", @@ -787,7 +787,7 @@ "type": "タイプ", "key": "キー", "value": "値", - "id": "イド", + "id": "ID", "extension-id": "内線番号", "extension-type": "拡張タイプ", "transformer-json": "JSON *", @@ -998,13 +998,13 @@ "select": "ターゲットレイアウトを選択" }, "legend": { - "position": "伝説の位置", + "position": "凡例の位置", "show-max": "最大値を表示", - "show-min": "最小値を表示する", + "show-min": "最小値を表示", "show-avg": "平均値を表示", "show-total": "合計値を表示", "settings": "凡例の設定", - "min": "分", + "min": "最小", "max": "最大", "avg": "平均", "total": "合計" @@ -1018,7 +1018,7 @@ "password-again": "パスワードをもう一度", "sign-in": "サインインしてください", "username": "ユーザー名(電子メール)", - "remember-me": "私を覚えてますか", + "remember-me": "ログイン情報を記憶", "forgot-password": "パスワードをお忘れですか?", "password-reset": "パスワードのリセット", "new-password": "新しいパスワード", @@ -1030,7 +1030,7 @@ }, "position": { "top": "上", - "bottom": "ボトム", + "bottom": "下", "left": "左", "right": "右" }, @@ -1213,11 +1213,11 @@ "minutes-interval": "{ minutes, plural, =1 {1 minute} other {# minutes} }", "hours-interval": "{ hours, plural, =1 {1 hour} other {# hours} }", "days-interval": "{ days, plural, =1 {1 day} other {# days} }", - "days": "日々", - "hours": "時間", + "days": "日", + "hours": "時", "minutes": "分", "seconds": "秒", - "advanced": "上級" + "advanced": "カスタム" }, "timewindow": { "days": "{ days, plural, =1 { day } other {# days } }", @@ -1225,12 +1225,12 @@ "minutes": "{ minutes, plural, =0 { minute } =1 {1 minute } other {# minutes } }", "seconds": "{ seconds, plural, =0 { second } =1 {1 second } other {# seconds } }", "realtime": "リアルタイム", - "history": "歴史", - "last-prefix": "最終", + "history": "履歴", + "last-prefix": "直近", "period": "{{ startTime }}{{ endTime }}", "edit": "タイムウィンドウを編集", "date-range": "期間", - "last": "最終", + "last": "直近", "time-period": "期間" }, "user": { @@ -1383,7 +1383,7 @@ "widget-config": { "data": "データ", "settings": "設定", - "advanced": "上級", + "advanced": "カスタム", "title": "タイトル", "general-settings": "一般設定", "display-title": "タイトルを表示", @@ -1396,13 +1396,13 @@ "widget-style": "ウィジェットスタイル", "title-style": "タイトルスタイル", "mobile-mode-settings": "モバイルモードの設定", - "order": "注文", + "order": "順番", "height": "高さ", - "units": "値の隣に表示する特別なシンボル", - "decimals": "浮動小数点の後の桁数", + "units": "単位", + "decimals": "小数点以下の桁数", "timewindow": "タイムウィンドウ", "use-dashboard-timewindow": "ダッシュボードのタイムウィンドウを使用する", - "display-legend": "伝説を表示", + "display-legend": "凡例を表示", "datasources": "データソース", "maximum-datasources": "{ count, plural, =1 {1 datasource is allowed.} other {# datasources are allowed} }", "datasource-type": "タイプ", @@ -1411,7 +1411,7 @@ "add-datasource": "データソースを追加", "target-device": "ターゲットデバイス", "alarm-source": "アラームソース", - "actions": "行動", + "actions": "アクション", "action": "アクション", "add-action": "アクションを追加", "search-actions": "検索アクション", @@ -1429,8 +1429,8 @@ "delete-action-text": "'{{actionName}}'?" }, "widget-type": { - "import": "インポートウィジェットタイプ", - "export": "ウィジェットのタイプをエクスポートする", + "import": "ウィジェットタイプをインポート", + "export": "ウィジェットのタイプをエクスポート", "export-failed-error": "{{error}}", "create-new-widget-type": "新しいウィジェットタイプを作成する", "widget-type-file": "ウィジェットタイプファイル", @@ -1460,9 +1460,9 @@ "Dec": "12月", "January": "1月", "February": "2月", - "March": "行進", + "March": "3月", "April": "4月", - "June": "六月", + "June": "6月", "July": "7月", "August": "8月", "September": "9月", @@ -1480,7 +1480,7 @@ "Year": "年", "This Year": "今年", "Last Year": "昨年", - "Date picker": "日付ピッカー", + "Date picker": "日付選択", "Hour": "時", "Day": "日", "Week": "週間", From 0cdba40a10bb1c6fb382c8c45b2f6e8fd76799cf Mon Sep 17 00:00:00 2001 From: fline <286665119@qq.com> Date: Sat, 28 Dec 2024 23:10:19 +0800 Subject: [PATCH 005/286] Update locale.constant-zh_CN.json --- .../assets/locale/locale.constant-zh_CN.json | 998 ++++++++++++++++-- 1 file changed, 887 insertions(+), 111 deletions(-) diff --git a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json index 54172aa1ac..9819c65dba 100644 --- a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json +++ b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json @@ -80,7 +80,8 @@ "clear": "清除", "upload": "上传", "delete-anyway": "仍要删除", - "delete-selected": "删除所选" + "delete-selected": "删除所选", + "set": "设置" }, "aggregation": { "aggregation": "聚合", @@ -110,6 +111,15 @@ "prohibit-different-url-hint": "应为生产环境启用此设置。禁用时可能会导致安全问题", "device-connectivity": { "device-connectivity": "设备连接", + "http-s": "HTTP(s)", + "mqtt-s": "MQTT(s)", + "coap-s": "COAP(s)", + "http": "HTTP", + "https": "HTTPs", + "mqtt": "MQTT", + "mqtts": "MQTTs", + "coap": "COAP", + "coaps": "COAPs", "hint": "如果主机或端口字段为空,将使用默认的协议值。", "host": "主机", "port": "端口", @@ -144,6 +154,8 @@ "sms-provider-type": "SMS 服务商类型", "sms-provider-type-required": "SMS 服务商类型必填。", "sms-provider-type-aws-sns": "亚马逊社交网站", + "sms-provider-type-twilio": "Twilio", + "sms-provider-type-smpp": "SMPP", "aws-access-key-id": "AWS访问密钥ID", "aws-access-key-id-required": "需要访问AWS密钥ID", "aws-secret-access-key": "AWS秘密访问密钥", @@ -187,6 +199,7 @@ "password-expiration-period-days-range": "密码过期期限(天)不能为负", "password-reuse-frequency-days": "密码重用频率(天)", "password-reuse-frequency-days-range": "天内密码重用频率不能为负", + "allow-whitespace": "允许空格", "force-reset-password-if-no-valid": "如果密码不可用则强制重置密码", "force-reset-password-if-no-valid-hint": "启用此功能时请小心:它会要求使用不可用密码的用户通过电子邮件重置其密码。", "general-policy": "基本策略", @@ -271,6 +284,7 @@ "login-provider": "登录提供商", "mapper": "映射", "new-domain": "新建", + "oauth2": "OAuth2.0", "password-max-length": "密码应该小于256个字符。", "redirect-uri-template": "重定向URI模板", "copy-redirect-uri": "复制重定向URI", @@ -295,8 +309,12 @@ "user-name-attribute-name": "用户名属性键", "user-name-attribute-name-required": "用户名属性密钥必填", "protocol": "协议", + "domain-schema-http": "HTTP", + "domain-schema-https": "HTTPS", + "domain-schema-mixed": "HTTP+HTTPS", "enable": "启用OAuth2.0设置", "disable": "禁用OAuth2.0设置", + "edge": "传播到Edge", "edge-enable": "启用Edge", "edge-disable": "禁用Edge", "domains": "域名", @@ -305,6 +323,7 @@ "mobile-package-placeholder": "例如: my.example.app", "mobile-package-hint": "Android:应用程序ID或iOS:产品标识符", "mobile-package-unique": "应用程序包必须是唯一的。", + "mobile-package-required": "应用程序包必填。", "mobile-package-max-length": "应用程序包应小于256。", "mobile-package-spaces": "应用程序包不应包含空间。", "mobile-app-secret": "应用程序密钥", @@ -316,6 +335,9 @@ "copy-mobile-app-secret": "复制应用程序密钥", "delete-mobile-app": "删除应用程序信息", "providers": "供应商", + "platform-web": "Web", + "platform-android": "Android", + "platform-ios": "iOS", "all-platforms": "所有平台", "smtp-provider": "SMTP提供商", "allowed-platforms": "允许的平台", @@ -332,6 +354,8 @@ "token-uri-required": "需要令牌URI", "redirect-uri": "重定向URI", "google-provider": "谷歌", + "microsoft-provider": "Office 365", + "sendgrid-provider": "Sendgrid", "custom-provider": "自定义", "generate-access-token": "生成访问令牌", "update-access-token": "更新访问令牌", @@ -388,6 +412,10 @@ "scheme-octet-unspecified-2": "2 - 八进制未指定 (8 位二进制)", "scheme-latin-1": "3 - Latin 1 (ISO-8859-1)", "scheme-octet-unspecified-4": "4 - 八进制未指定 (8 位二进制)", + "scheme-jis": "5 - JIS (X 0208-1990)", + "scheme-cyrillic": "6 - Cyrillic (ISO-8859-5)", + "scheme-latin-hebrew": "7 - Latin/Hebrew (ISO-8859-8)", + "scheme-ucs-utf": "8 - UCS2/UTF-16 (ISO/IEC-10646)", "scheme-pictogram-encoding": "9 - 图标编码", "scheme-music-codes": "10 - 音乐编码 (ISO-2022-JP)", "scheme-extended-kanji-jis": "13 - 扩展汉字 JIS (X 0212-1990)", @@ -436,15 +464,8 @@ "applications": "应用程序", "default": "默认", "custom": "自定义", - "app-package-name": "应用程序包名称", - "app-package-name-required": "应用程序包名称必填", - "sha256-certificate-fingerprints": "SHA256证书指纹", - "sha256-certificate-fingerprints-required": "SHA256证书指纹必填", - "app-id-required": "App ID必填", - "google-play-link": "Google Play链接", - "google-play-link-required": "Google Play链接必填", - "app-store-link": "App Store链接", - "app-store-link-required": "App Store链接", + "android": "Android", + "ios": "iOS", "appearance": "外观", "appearance-on-home-page": "外观显示在首页", "enabled": "启用", @@ -504,9 +525,11 @@ "signings-key-base64": "签名密钥必须是Base64格式。", "expiration-time": "令牌过期时间(秒)", "expiration-time-required": "令牌过期时间是必填。", + "expiration-time-max": "最大允许时间为2147483647秒(68年)。", "expiration-time-min": "最小时间为60秒(1分钟)。", "refresh-expiration-time": "刷新令牌过期时间(秒)", "refresh-expiration-time-required": "刷新令牌过期时间必填。", + "refresh-expiration-time-max": "最大允许时间为2147483647秒(68年)。", "refresh-expiration-time-min": "最小时间为900秒(15分钟)。", "refresh-expiration-time-less-token": "刷新令牌时间必须大于令牌过期时间。", "generate-key": "生成密钥", @@ -517,6 +540,7 @@ "notifications": "通知", "notifications-settings": "通知设置", "slack-api-token": "Slack API令牌", + "slack": "Slack", "slack-settings": "Slack设置", "mobile-settings": "移动设置", "firebase-service-account-file": "Firebase服务帐户JSON凭据文件", @@ -563,6 +587,7 @@ "assignee-last-name": "受托人名字", "assignee-email": "受托人邮箱", "unassigned": "未分配", + "user-deleted": "用户已删除", "assignee-not-set": "所有", "status": "状态", "alarm-details": "告警详细信息", @@ -572,7 +597,8 @@ "ack-time": "确认时间", "clear-time": "清除时间", "duration": "持续时间", - "alarm-severity-list": "警报严重性列表", + "alarm-severity": "警报严重程度", + "alarm-severity-list": "警报严重程度列表", "any-severity": "任何严重程度", "severity-critical": "危险", "severity-major": "重要", @@ -610,6 +636,7 @@ "fetch-size": "获取大小", "fetch-size-required": "获取大小必填。", "fetch-size-error-min": "最小值为10。", + "alarm-types": "告警类型", "alarm-type-list": "告警类型列表", "any-type": "任何类型", "assigned-to-current-user": "分配给当前用户", @@ -831,6 +858,9 @@ "api-usage": "Api 使用统计", "alarm": "告警", "alarms-created": "创建告警数", + "queue-stats": "队列统计信息", + "processing-failures-and-timeouts": "处理失败和超时", + "exceptions": "异常", "alarms-created-daily-activity": "每天产生的告警", "alarms-created-hourly-activity": "每小时产生的告警", "alarms-created-monthly-activity": "每月产生的告警", @@ -841,13 +871,15 @@ "email-messages": "邮件消息", "email-messages-daily-activity": "每天产生的邮件消息", "email-messages-monthly-activity": "每月产生的邮件消息", - "exceptions": "异常", "executions": "执行数", + "scripts": "脚本", "scripts-hourly-activity": "脚本每小时活动", "scripts-daily-activity": "脚本每日活动", "scripts-monthly-activity": "脚本每月活动", - "javascript-executions": "JavaScript 执行数", - "tbel-executions": "TBEL 执行数", + "javascript": "JavaScript", + "javascript-executions": "JavaScript执行数", + "tbel": "TBEL", + "tbel-executions": "TBEL执行数", "latest-error": "最新错误", "messages": "消息", "notifications": "通知", @@ -856,9 +888,7 @@ "permanent-failures": "${entityName}永久性故障", "permanent-timeouts": "${entityName}永久超时", "processing-failures": "${entityName}处理失败", - "processing-failures-and-timeouts": "处理失败和超时", "processing-timeouts": "${entityName}处理超时", - "queue-stats": "队列统计信息", "rule-chain": "规则链", "rule-engine": "规则引擎", "rule-engine-daily-activity": "每天的规则引擎活动", @@ -959,6 +989,20 @@ "type-timeseries-deleted": "遥测数据已删除", "type-sms-sent": "短信发送" }, + "debug-settings": { + "label": "调试配置", + "on-failure": "仅失败(24/7)", + "all-messages": "所有消息({{time}})", + "failures": "失败", + "entity": "实体", + "rule-node": "规则节点", + "hint": { + "main": "所有节点调试消息将被限速,限制为:", + "main-limited": "所有{{entity}}的调试消息将受到速率限制,每{{time}}允许最多{{msg}}条消息。", + "on-failure": "保存所有失败调试事件,无时间限制。", + "all-messages": "在时间限制内保存所有调试事件。" + } + }, "confirm-on-exit": { "message": "有未保存的更改,确定要离开此页吗?", "html-message": "有未保存的更改。
确定要离开此页面吗?", @@ -989,11 +1033,13 @@ "enter-password": "输入密码", "enter-search": "输入检索条件", "created-time": "创建时间", + "disabled": "已禁用", "loading": "正在加载中...", "proceed": "继续", "open-details-page": "打开详情页", "not-found": "未找到", - "documentation": "文档" + "documentation": "文档", + "time-left": "剩余{{time}}" }, "content-type": { "json": "Json", @@ -1226,6 +1272,7 @@ "import": "导入仪表板", "export": "导出仪表板", "export-failed-error": "无法导出仪表板: {{error}}", + "export-prompt": "嵌入仪表板图像和资源", "create-new-dashboard": "创建仪表板", "dashboard-file": "仪表板文件", "invalid-dashboard-file-error": "无法导入仪表板: 仪表板数据结构无效。", @@ -1478,6 +1525,10 @@ "client-public-key-tooltip": "X509 公钥必须采用 DER 编码的 X509v3 格式,并且仅支持 EC 算法,然后编码为 Base64 格式!", "mode": "安全配置模式", "client-tab": "客户端安全配置", + "client-certificate": "客户端证书", + "bootstrap-tab": "启动客户端", + "bootstrap-server": "启动服务器", + "lwm2m-server": "LwM2M服务器", "client-publicKey-or-id": "客户端公钥或ID", "client-publicKey-or-id-required": "客户端公钥或ID必填。", "client-publicKey-or-id-tooltip-psk": "SK标识符是最多128字节,如标准[RFC7925]所述。", @@ -1566,6 +1617,92 @@ "lwm2m-command": "使用以下文档通过 LWM2M 连接设备。" } }, + "dynamic-form": { + "property": { + "properties": "属性", + "property": "属性", + "id": "ID", + "name": "名称", + "type": "类型", + "type-text": "文本", + "type-password": "密码", + "type-textarea": "文本区域", + "type-number": "数字", + "type-switch": "开关", + "type-select": "选择框", + "type-radios": "单选按钮", + "type-datetime": "日期/时间", + "type-image": "图片", + "type-javascript": "JavaScript", + "type-json": "JSON", + "type-html": "HTML", + "type-css": "CSS", + "type-markdown": "Markdown", + "type-color": "颜色", + "type-color-settings": "颜色设置", + "type-font": "字体", + "type-units": "单位", + "type-icon": "图标", + "type-fieldset": "字段集", + "type-array": "数组", + "type-html-section": "HTML区域", + "group-title": "分组标题", + "no-properties": "没有配置属性", + "add-property": "添加属性", + "property-settings": "属性设置", + "remove-property": "移除属性", + "default-value": "默认值", + "value-required": "值是必需的", + "number-settings": "数字设置", + "min": "最小值", + "max": "最大值", + "step": "步长", + "selected-options-limit": "选项限制", + "advanced-ui-settings": "高级UI设置", + "disable-on-property": "基于属性禁用", + "display-condition-function": "显示条件函数", + "sub-label": "子标签", + "vertical-divider-after": "垂直分隔符后", + "input-field-suffix": "输入框后缀", + "property-row-classes": "属性行类", + "property-field-classes": "属性字段类", + "not-unique-property-ids-error": "属性ID必须唯一!", + "enable-multiple-select": "启用多选", + "allow-empty-select-option": "允许空选项", + "select-options": "选择项", + "not-unique-select-option-value-error": "选择项值必须唯一!", + "value": "值", + "label": "标签", + "add-option": "添加选项", + "no-options": "没有配置选项", + "remove-option": "移除选项", + "textarea-rows": "文本区行数", + "help-id": "帮助ID", + "buttons-direction": "按钮方向", + "direction-row": "行", + "direction-column": "列", + "radio-button-options": "单选按钮选项", + "datetime-type": "日期/时间字段类型", + "datetime-type-date": "日期", + "datetime-type-time": "时间", + "datetime-type-datetime": "日期/时间", + "enable-clear-button": "启用清除按钮", + "html-section-settings": "HTML区域设置", + "html-section-classes": "HTML区域类", + "html-section-content": "HTML区域内容", + "array-item": "数组项", + "item-type": "项类型", + "item-name": "项名称", + "no-items": "没有项" + }, + "clear-form": "清除表单", + "clear-form-prompt": "确定要移除所有表单属性吗?", + "import-form": "从JSON导入表单", + "export-form": "导出表单为JSON", + "json-file": "JSON文件", + "json-content": "JSON内容", + "invalid-form-json-file-error": "无法从JSON导入表单:无效的表单JSON数据结构。" + }, "asset-profile": { "asset-profile": "资产配置", "asset-profiles": "资产配置", @@ -1665,52 +1802,59 @@ "set-default-device-profile-text": "确认后,设备配置将被标记为默认,并将用于未指定配置的新设备。", "no-device-profiles-found": "未找到设备配置。", "create-new-device-profile": "创建设备配置", - "mqtt-device-topic-filters": "MQTT 设备 Topic 筛选器", - "mqtt-device-topic-filters-unique": "MQTT设备 Topic 筛选器必须唯一。", + "mqtt-device-topic-filters": "MQTT设备主题筛选器", + "mqtt-device-topic-filters-unique": "MQTT设备主题筛选器必须唯一。", "mqtt-device-topic-filters-spark-plug": "MQTT Sparkplug B边缘网络(EoN)节点", - "mqtt-device-topic-filters-spark-plug-hint": "允许来自具备Sparkplug B负载和Topic格式的边缘网络(EoN)节点的连接。", + "mqtt-device-topic-filters-spark-plug-hint": "允许来自具备Sparkplug B负载和主题格式的边缘网络(EoN)节点的连接。", "mqtt-device-topic-filters-spark-plug-attribute-metric-names": "将SparkPlug指标存储为属性。", "mqtt-device-topic-filters-spark-plug-attribute-metric-names-hint": "将作为设备属性存储的SparkPlug指标的名称。其他指标将作为设备遥测数据进行存储。", - "mqtt-device-payload-type": "MQTT 设备 Payload", - "mqtt-enable-compatibility-with-json-payload-format": "启用与其他payload格式兼容。", - "mqtt-enable-compatibility-with-json-payload-format-hint": "启用后平台将默认使用Protobuf的payload格式,如果解析失败平台将尝试使用JSON的payload格式。对于固件更新期间的向后兼容性很有用,例如固件的初始版本使用Json而新版本使用Protobuf在设备队列的固件更新过程中,需要同时支持Protobuf和JSON。兼容模式会导致一点的性能下降,因此建议在所有设备更新后禁用此模式。", - "mqtt-use-json-format-for-default-downlink-topics": "缺省下行主题采用json格式", - "mqtt-use-json-format-for-default-downlink-topics-hint": "启用后平台将使用Json的playload格式通过以下主题推送属性和RPC:v1/devices/me/attributes/response/$request_idv1/devices/me/attributes v1/devices/me/rpc/request/$request_idv1/devices/me/rpc/response/$request_id。此设置不会影响使用新(v2)主题发送的属性和rpc订阅:v2/a/res/$request_idv2/av2/r /req/$request_idv2/r/res/$request_id。其中$request_id是一个整数请求标识符。", + "mqtt-device-payload-type": "MQTT设备Payload", + "mqtt-device-payload-type-json": "JSON", + "mqtt-device-payload-type-proto": "Protobuf", + "mqtt-enable-compatibility-with-json-payload-format": "启用与其他Payload格式兼容。", + "mqtt-enable-compatibility-with-json-payload-format-hint": "启用后平台将默认使用Protobuf的Payload格式,如果解析失败平台将尝试使用JSON的Payload格式。对于固件更新期间的向后兼容性很有用,例如固件的初始版本使用Json而新版本使用Protobuf在设备队列的固件更新过程中,需要同时支持Protobuf和JSON。兼容模式会导致一点的性能下降,因此建议在所有设备更新后禁用此模式。", + "mqtt-use-json-format-for-default-downlink-topics": "缺省下行主题采用Json格式", + "mqtt-use-json-format-for-default-downlink-topics-hint": "启用后平台将使用Json的Playload格式通过以下主题推送属性和RPC:v1/devices/me/attributes/response/$request_idv1/devices/me/attributes v1/devices/me/rpc/request/$request_idv1/devices/me/rpc/response/$request_id。此设置不会影响使用新(v2)主题发送的属性和rpc订阅:v2/a/res/$request_idv2/av2/r /req/$request_idv2/r/res/$request_id。其中$request_id是一个整数请求标识符。", "mqtt-send-ack-on-validation-exception": "发布消息验证失败时发送PUBACK", "mqtt-send-ack-on-validation-exception-hint": "默认情况下平台将关闭相关消息验证失败的MQTT会话,启用后平台将发布确认而不是关闭会话。", "snmp-add-mapping": "添加SNMP映射", "snmp-mapping-not-configured": "OID到时间序列/遥测的映射未配置", "snmp-timseries-or-attribute-name": "用于映射的时间序列/属性名称", "snmp-timseries-or-attribute-type": "用于映射的时间序列/属性类型", - "mqtt-payload-type-required": "Payload 类型必填。", - "coap-device-type": "CoAP 设备类型", - "coap-device-payload-type": "CoAP 设备消息 Payload", - "coap-device-type-required": "CoAP 设备类型必填。", + "snmp-method-pdu-type-get-request": "GetRequest", + "snmp-method-pdu-type-get-next-request": "GetNextRequest", + "snmp-oid": "OID", + "transport-device-payload-type-json": "JSON", + "transport-device-payload-type-proto": "Protobuf", + "mqtt-payload-type-required": "Payload类型必填。", + "coap-device-type": "CoAP设备类型", + "coap-device-payload-type": "CoAP设备消息Payload", + "coap-device-type-required": "CoAP设备类型必填。", "coap-device-type-default": "默认", "coap-device-type-efento": "Efento NB-IoT", "support-level-wildcards": "支持单[+]和多级[#]通配符。", - "telemetry-topic-filter": "遥测数据Topic筛选器", - "telemetry-topic-filter-required": "遥测数据Topic筛选器必填。", - "attributes-topic-filter": "属性Topic筛选器", - "attributes-subscribe-topic-filter": "订阅属性的Topic筛选器", - "attributes-topic-filter-required": "属性的Topic筛选器必填。", - "attributes-subscribe-topic-filter-required": "订阅属性的Topic筛选器必填。", - "telemetry-proto-schema": "遥测数据 proto schema", - "telemetry-proto-schema-required": "遥测数据 proto schema 必填。", - "attributes-proto-schema": "属性 proto schema", - "attributes-proto-schema-required": "属性 proto schema 必填。", - "rpc-response-proto-schema": "RPC 响应 proto schema", - "rpc-response-proto-schema-required": "RPC 响应 proto schema 必填。", - "rpc-response-topic-filter": "RPC响应 Topic 筛选器", - "rpc-response-topic-filter-required": "RPC响应 Topic 筛选器必填。", - "rpc-request-proto-schema": "RPC 请求 proto schema", - "rpc-request-proto-schema-required": "RPC 请求 proto schema 必填。", + "telemetry-topic-filter": "遥测数据主题筛选器", + "telemetry-topic-filter-required": "遥测数据主题筛选器必填。", + "attributes-topic-filter": "属性主题筛选器", + "attributes-subscribe-topic-filter": "订阅属性的主题筛选器", + "attributes-topic-filter-required": "属性的主题筛选器必填。", + "attributes-subscribe-topic-filter-required": "订阅属性的主题筛选器必填。", + "telemetry-proto-schema": "遥测数据 Proto Schema", + "telemetry-proto-schema-required": "遥测数据 Proto Schema 必填。", + "attributes-proto-schema": "属性 Proto Schema", + "attributes-proto-schema-required": "属性 Proto Schema 必填。", + "rpc-response-proto-schema": "RPC 响应 Proto Schema", + "rpc-response-proto-schema-required": "RPC 响应 Proto Schema 必填。", + "rpc-response-topic-filter": "RPC响应主题筛选器", + "rpc-response-topic-filter-required": "RPC响应主题筛选器必填。", + "rpc-request-proto-schema": "RPC 请求 Proto Schema", + "rpc-request-proto-schema-required": "RPC 请求 Proto Schema 必填。", "rpc-request-proto-schema-hint": "RPC 请求消息应始终包含字段:string method = 1; int32 requestId = 2; 和params = 3的任何数据类型。", - "not-valid-pattern-topic-filter": "无效的 Topic 筛选器模式", + "not-valid-pattern-topic-filter": "无效的主题筛选器模式", "not-valid-single-character": "单级通配符的使用无效", "not-valid-multi-character": "多级通配符的使用无效", - "single-level-wildcards-hint": "[+] 适用于任何Topic过滤级别。例如:v1/devices/+/telemetry or +/devices/+/attributes。", - "multi-level-wildcards-hint": "[#]可以替换Topic筛选器本身,并且必须是Topic的最后一个符号。例如:# or v1/devices/me/#。", + "single-level-wildcards-hint": "[+] 适用于任何主题过滤级别。例如:v1/devices/+/telemetry or +/devices/+/attributes。", + "multi-level-wildcards-hint": "[#]可以替换主题筛选器本身,并且必须是主题的最后一个符号。例如:# or v1/devices/me/#。", "alarm-rules": "告警规则", "alarm-rules-with-count": "告警规则({{count}})", "no-alarm-rules": "未配置告警规则", @@ -2118,8 +2262,10 @@ "sync-process-started-successfully": "同步处理开始成功!", "missing-related-rule-chains-title": "边缘缺少关联规则链", "missing-related-rule-chains-text": "分配给边缘的规则链使用规则节点将消息转发给未分配给当前边缘的规则链。

缺少的规则链列表:
{{missingRuleChains}}", + "upgrade-instructions": "升级说明", "widget-datasource-error": "组件只支持边缘实体数据源", - "upgrade-instructions": "升级说明" + "connected": "已连接", + "disconnected": "已断开连接" }, "edge-event": { "type-dashboard": "仪表板", @@ -2326,15 +2472,18 @@ "type-notification-templates": "通知模板", "list-of-notification-templates": "{ count, plural, =1 {1 个通知模板} other {# 个通知模板} }", "link": "连接", - "type-oauth2-client": "OAuth 2.0客户端", - "type-oauth2-clients": "OAuth 2.0客户端", - "list-of-oauth2-clients": "{ count, plural, =1 {One OAuth 2.0 client} other {List of # OAuth 2.0 clients} }", + "type-oauth2-client": "OAuth2.0客户端", + "type-oauth2-clients": "OAuth2.0客户端", + "list-of-oauth2-clients": "{ count, plural, =1 {一个 OAuth2.0客户端} other {# 个 OAuth2.0客户端列表} }", "type-domain": "域名", "type-domains": "域名", - "list-of-domains": "{ count, plural, =1 {One Domain} other {List of # Domains} }", + "list-of-domains": "{ count, plural, =1 {一个域名} other {# 个域名列表} }", "type-mobile-app": "移劝端", "type-mobile-apps": "移动端", - "list-of-mobile-apps": "{ count, plural, =1 {One Mobile application} other {List of # Mobile applications} }" + "list-of-mobile-apps": "{ count, plural, =1 {一个移动应用} other {# 个移动应用列表} }", + "type-mobile-app-bundle": "移动应用包", + "type-mobile-app-bundles": "移动应用包", + "list-of-mobile-app-bundles": "{ count, plural, =1 {一个移动应用包} other {# 个移动应用包列表} }" }, "entity-field": { "created-time": "创建时间", @@ -2438,9 +2587,7 @@ "select-entity-view": "选择实体视图", "make-public": "实体视图设为公开", "make-private": "实体视图设为私有", - "start-date": "开始日期", "start-ts": "开始时间", - "end-date": "结束日期", "end-ts": "结束时间", "date-limits": "日期限制", "client-attributes": "客户端属性", @@ -2549,7 +2696,7 @@ "custom": "定制", "to-double": "加倍", "transformer": "转换器", - "json-required": "Transformer JSON 必填。", + "json-required": "转换器JSON必填。", "json-parse": "无法解析转换器JSON。", "attributes": "属性", "add-attribute": "添加属性", @@ -2576,7 +2723,7 @@ "no-file": "没有选择文件。", "drop-file": "删除文件或单击以选择要上载的文件。", "mapping": "映射", - "topic-filter": "Topic筛选器", + "topic-filter": "主题筛选器", "converter-type": "转换类型", "converter-json": "Json", "json-name-expression": "设备名称JSON表达式", @@ -2585,7 +2732,7 @@ "topic-type-expression": "设备类型主题表达式", "attribute-key-expression": "属性键名表达式", "attr-json-key-expression": "属性键JSON表达式", - "attr-topic-key-expression": "属性键名Topic表达式", + "attr-topic-key-expression": "属性键名主题表达式", "request-id-expression": "请求ID表达式", "request-id-json-expression": "请求ID JSON表达式", "request-id-topic-expression": "请求ID主题表达式", @@ -2788,16 +2935,14 @@ "function": "函数" }, "gateway": { - "gateway-exists": "同名设备已存在。", "gateway-name": "网关名称", "gateway-name-required": "网关名称必填。", - "gateway-saved": "已成功保存网关配置。", - "gateway": "网关", + "gateways": "网关", "create-new-gateway": "创建网关", "create-new-gateway-text": "确定要创建名为 '{{gatewayName}}' 的新网关?", + "launch-command": "启动命令", "no-gateway-found": "未找到网关。", - "no-gateway-matching": "未找到 '{{item}}' 。", - "launch-gateway": "启动网关" + "no-gateway-matching": "未找到 '{{item}}' 。" }, "grid": { "delete-item-title": "确定要删除此项吗?", @@ -3038,38 +3183,6 @@ "not-unique-behavior-ids-error": "行为ID必须是唯一的!", "default-settings": "默认设置" }, - "property": { - "property": "属性", - "id": "序号", - "name": "名称", - "type": "类型", - "type-text": "文本", - "type-number": "数字", - "type-switch": "开关", - "type-color": "颜色", - "type-color-settings": "颜色设置", - "type-font": "字体", - "type-units": "单位", - "type-icon": "图标", - "no-properties": "无任何属性配置", - "add-property": "添加属性", - "property-settings": "属性设置", - "remove-property": "删除属性", - "default-value": "默认数据", - "value-required": "值必填", - "number-settings": "数字设置", - "min": "最小值", - "max": "最大值", - "step": "步长", - "advanced-ui-settings": "UI高级设置", - "disable-on-property": "禁用属性", - "sub-label": "子级标签", - "vertical-divider-after": "垂直分隔线", - "input-field-suffix": "输入字段后缀", - "property-row-classes": "行类名称", - "property-field-classes": "字段类名称", - "not-unique-property-ids-error": "属性ID必须是唯一的!" - }, "symbol": { "symbol": "图形", "fluid-presence": "液体", @@ -3107,16 +3220,21 @@ "value": "数值", "units": "单位", "flow-meter-value-hint": "在流量计上显示数值", + "value-hint": "浮点数表示当前值", "running": "运行", "running-hint": "指示组件是否处于运行状态。", "warning-state": "警告状态", "warning": "警告", + "warning-click": "警告点击", "warning-state-hint": "指示组件是否处于警告状态。", "critical-state": "严重状态", "critical": "严重", + "critical-click": "严重状态点击", "critical-state-hint": "指示组件是否处于严重状态。", "critical-state-animation": "状态动画", "critical-state-animation-hint": "当组件处于严重状态时显示闪烁动画。", + "warning-critical-state-animation": "警告/严重状态动画", + "warning-critical-state-animation-hint": "当组件处于警告或严重状态时,是否启用闪烁动画。", "animation": "动画", "broken": "裂纹", "broken-hint": "指示组件是否存在裂纹。", @@ -3140,6 +3258,7 @@ "top-right-connector": "右左连接", "running-color": "运行颜色", "stopped-color": "停止颜色", + "stopped": "已停止", "warning-color": "警告颜色", "critical-color": "严重颜色", "opened": "已经打开", @@ -3192,7 +3311,7 @@ "recirculate-mode": "循环", "rinse-mode": "冲洗", "closed-mode": "关闭", - "stand-filter-color": "沙箱背景色", + "sand-filter-color": "沙滤器颜色", "mode-box-background": "按钮颜色", "border-color": "状态颜色", "label-color": "文本颜色", @@ -3202,7 +3321,47 @@ "full-value": "全部数值", "full-value-hint": "表示全部数值。", "label": "标签", - "icon": "图标" + "icon": "图标", + "button-color": "按钮颜色", + "on-label": "'开启' 标签文本", + "off-label": "'关闭' 标签文本", + "arrow-presence": "箭头存在", + "arrow-presence-hint": "指示连接器中是否存在箭头。", + "arrow-present": "箭头存在", + "arrow-direction": "箭头方向", + "arrow-direction-hint": "指示流动方向。", + "main-line": "主线", + "line": "线", + "line-color": "线颜色", + "arrow-color": "箭头颜色", + "target-value": "目标值", + "target-value-hint": "指示刻度上的目标点。", + "min-max-value": "最小值和最大值", + "min-value": "最小值", + "max-value": "最大值", + "warning-scale-color": "警告刻度颜色", + "critical-scale-color": "关键刻度颜色", + "scale-color": "刻度颜色", + "target": "目标", + "high-warning-state": "高警告状态", + "show-high-warning-scale": "显示高警告刻度", + "high-warning-scale": "高警告刻度", + "high-warning-state-hint": "双重值表示高警告范围,直到高关键或最大值。", + "low-warning-state": "低警告状态", + "show-low-warning-scale": "显示低警告刻度", + "low-warning-scale": "低警告刻度", + "low-warning-state-hint": "双重值表示低警告范围,直到低关键或最小值。", + "high-critical-state": "高关键状态", + "show-high-critical-scale": "显示高关键刻度", + "high-critical-scale": "高关键刻度", + "high-critical-state-hint": "双重值表示高关键范围,直到最大值刻度。", + "low-critical-state": "低关键状态", + "show-low-critical-scale": "显示低关键刻度", + "low-critical-scale": "低关键刻度", + "low-critical-state-hint": "双重值表示低关键范围,直到最小值刻度。", + "filter-color": "滤色器颜色", + "colors": "颜色", + "alarm-colors": "警报颜色" } }, "item": { @@ -3212,7 +3371,23 @@ "no-return-error": "函数必须返回值!", "return-type-mismatch": "函数必须返回'{{type}}'类型的值!", "tidy": "整理", - "mini": "迷你" + "mini": "迷你", + "modules": "模块", + "remove-module": "移除模块", + "no-modules": "未配置模块", + "add-module": "添加模块", + "module-alias": "别名", + "module-resource": "JS模块资源", + "not-unique-module-aliases-error": "模块别名必须是唯一的!", + "show-module-info": "显示模块信息", + "show-module-source-code": "显示模块源代码", + "module-members": "模块成员", + "module-no-members": "模块没有导出的成员", + "module-load-error": "模块加载错误", + "source-code": "源代码", + "source-code-load-error": "源代码加载错误", + "no-js-module-text": "未找到JS模块", + "no-js-module-matching": "未找到与 '{{module}}' 匹配的JS模块" }, "key-val": { "key": "键名", @@ -3337,6 +3512,137 @@ "copy-code": "点击复制", "copied": "复制完成" }, + "mobile": { + "add-application": "添加应用", + "app-id": "应用ID", + "app-id-required": "应用ID必填", + "app-id-pattern": "应用ID格式无效", + "app-store-link": "应用商店链接", + "app-store-link-required": "应用商店链接必填", + "application-details": "应用详情", + "application-package": "应用包", + "application-secret": "应用密钥", + "application-secret-required": "应用密钥必填", + "application": "应用", + "applications": "应用列表", + "copy-app-id": "复制应用ID", + "copy-app-store-link": "复制应用商店链接", + "copy-application-package": "复制应用包", + "copy-application-secret": "复制应用密钥", + "copy-google-play-link": "复制Google Play链接", + "copy-sha256-certificate-fingerprints": "复制SHA256证书指纹", + "delete-application": "删除应用", + "delete-application-button-text": "我理解后果,删除应用", + "delete-application-text": "此操作无法撤销。删除应用将永久删除应用及其所有相关数据。
如果不想永久删除,可以暂时挂起应用。
若要删除应用,请输入\"{{phrase}}\"进行确认。", + "delete-application-title-short": "确定要删除应用 '{{name}}' 吗?", + "delete-application-text-short": "请注意:确认后应用及所有相关数据将无法恢复。", + "delete-application-phrase": "删除应用", + "delete-applications-bundle-text": "请注意:确认后移动应用包及所有相关数据将无法恢复。", + "delete-applications-bundle-title": "确定要删除移动应用包 '{{bundleName}}' 吗?", + "generate-application-secret": "生成应用密钥", + "google-play-link": "Google Play链接", + "google-play-link-required": "Google Play链接必填", + "latest-version": "最新版本", + "min-version": "最低版本", + "invalid-version-pattern": "版本格式无效。请使用格式:major.minor.patch(例如:1.0.0)。", + "mobile-center": "移动中心", + "mobile-package": "应用包", + "mobile-package-max-length": "应用包长度应少于256个字符", + "mobile-package-required": "应用包是必需的", + "mobile-package-pattern": "应用包格式无效", + "no-application": "未找到应用", + "no-bundles": "未找到移动包", + "platform-type": "平台类型", + "search-application": "搜索应用", + "search-bundles": "搜索移动包", + "set": "设置", + "sha256-certificate-fingerprints": "SHA256证书指纹", + "sha256-certificate-fingerprints-required": "SHA256证书指纹是必需的", + "sha256-certificate-fingerprints-pattern": "SHA256证书指纹格式无效", + "show-hidden-pages": "显示隐藏页面", + "status": "状态", + "status-type": { + "deprecated": "已弃用", + "draft": "草稿", + "published": "已发布", + "suspended": "已暂停" + }, + "store-information": "商店信息", + "version-information": "版本信息", + "min-version-release-notes": "最低版本发布说明", + "latest-version-release-notes": "最新版本发布说明", + "bundle": "捆绑包", + "bundles": "捆绑包列表", + "add-bundle": "添加捆绑包", + "title": "标题", + "title-required": "标题必填", + "oauth-clients": "OAuth2.0客户端", + "android-app": "Android应用", + "android-application": "Android应用程序", + "ios-app": "iOS应用", + "ios-application": "iOS应用程序", + "invalid-store-link": "无效的商店链接", + "enable-oauth": "启用OAuth2.0", + "enable-self-registration": "启用自助注册", + "edit-bundle": "编辑捆绑包", + "description": "描述", + "basic-settings": "基本设置", + "no-application-matching": "未找到与 '{{entity}}' 匹配的应用程序。", + "no-bundle-matching": "未找到与 '{{entity}}' 匹配的捆绑包。", + "application-required": "应用程序必填。", + "bundle-required": "捆绑包必填。", + "no-application-text": "未找到应用程序", + "no-bundle-text": "未找到捆绑包", + "layout": "布局", + "pages": "页面", + "hide-all-pages": "隐藏所有页面", + "reset-to-default-pages": "重置为默认页面", + "add-specific-page": "添加特定页面", + "visible": "可见", + "hidden": "隐藏", + "reset-to-page-default": "重置页面为默认", + "mobile-599": "移动端(最大 599px)", + "tablet-959": "平板(最大 959px)", + "max-element-number": "最大元素数量", + "page-name": "页面名称", + "page-name-required": "页面名称必填。", + "page-name-cannot-contain-only-spaces": "页面名称不能仅包含空格。", + "page-type": "页面类型", + "pages-types": { + "dashboard": "仪表盘", + "web-view": "网页视图", + "custom": "自定义" + }, + "url": "URL", + "invalid-url-format": "URL格式无效", + "path": "路径", + "invalid-path-format": "路径格式无效", + "custom-page": "自定义页面", + "edit-page": "编辑页面", + "edit-custom-page": "编辑自定义页面", + "delete-page": "删除页面", + "qr-code-widget": "二维码小部件", + "type-here": "在此输入", + "configuration-dialog": "配置对话框", + "configuration-app": "配置应用程序", + "configuration-step": { + "prepare-environment-title": "准备开发环境", + "prepare-environment-text": "Flutter ThingsBoard 移动应用程序需要 Flutter SDK。按照说明设置 Flutter SDK。", + "get-source-code-title": "获取应用程序源代码", + "get-source-code-text": "您可以通过从 GitHub 仓库克隆来获取 Flutter ThingsBoard 移动应用程序源代码:", + "configure-api-title": "配置 ThingsBoard API 端点", + "configure-api-text": "在编辑器/IDE 中打开 flutter_thingsboard_app 项目。编辑:", + "configure-api-hint": "将 thingsBoardApiEndpoint 常量的值设置为与您的 ThingsBoard 服务器实例的 API 端点匹配。请勿使用“localhost”或“127.0.0.1”主机名。", + "run-app-title": "运行应用程序", + "run-app-text": "按您的 IDE 中的说明运行应用程序。\n如果使用终端,请使用以下命令运行应用程序:", + "more-information": "详细信息请参阅我们的入门文档。", + "getting-started": "入门", + "configure-package-title": "配置应用程序包", + "configure-package-text": "您可以手动更改应用程序包,也可以使用第三方 CLI 工具。", + "configure-package-text-install": "要安装 Rename CLI 工具,请执行以下命令:", + "configure-package-run-commands": "在您的项目根目录下运行以下命令:" + } + }, "notification": { "action-button": "操作按钮", "action-type": "操作类型", @@ -3457,6 +3763,8 @@ "no-notification-templates": "未找到通知模板", "no-notifications-yet": "目前还没有通知", "no-recipients-notification": "没有收件人的通知", + "no-recipients-matching": "未找到与 '{{entity}}' 匹配的收件人。", + "no-recipients-text": "未找到收件人", "no-rule": "未配置规则", "no-rules-notification": "没有规则通知", "no-severity-found": "未找到严重性级别", @@ -3501,6 +3809,8 @@ "users-entity-owner": "实体所有者的用户" }, "recipients": "收件人", + "notification-recipient": "通知接收者", + "notification-recipient-required": "通知接收者必填。", "notification-recipients": "通知/收件人", "recipients-count": "{ count, plural, =1 {1 个收件人} other {# 个收件人} }", "recipients-required": "收件人必填。", @@ -3831,7 +4141,8 @@ "relation-filters": "关联筛选器", "additional-info": "附加信息 (JSON)", "invalid-additional-info": "无法解析附加信息JSON。", - "no-relations-text": "未找到关联" + "no-relations-text": "未找到关联", + "not": "不是" }, "resource": { "add": "添加资源", @@ -3869,8 +4180,37 @@ "js-module": "JS 模块", "lwm2m-model": "LWM2M 模型", "pkcs-12": "PKCS #12" + }, + "resource-sub-type": "子类型", + "sub-type": { + "image": "图像", + "scada-symbol": "SCADA符号", + "extension": "扩展", + "module": "模块" } }, + "javascript": { + "add": "添加JavaScript资源", + "delete": "删除JavaScript资源", + "delete-javascript-resource-text": "请注意:确认后该JavaScript资源将不可恢复。", + "delete-javascript-resource-title": "确定要删除JavaScript资源 '{{resourceTitle}}' 吗?", + "delete-javascript-resources-action-title": "删除JavaScript { count, plural, =1 {1 个资源} other {# 个资源} }", + "delete-javascript-resources-text": "请注意,即使这些JavaScript资源已被JavaScript函数使用,它们也将被删除。", + "delete-javascript-resources-title": "确定要删除JavaScript { count, plural, =1 {1 个资源} other {# 个资源} } 吗?", + "download": "下载JavaScript资源", + "upload-from-file": "从文件上传JavaScript", + "resource-file": "JavaScript资源文件", + "drop-file": "拖放一个JavaScript文件,或点击选择要上传的文件。", + "drop-resource-file-or": "拖放一个JavaScript文件或", + "javascript-library": "JavaScript库", + "javascript-type": "JavaScript类型", + "javascript-resource-details": "JavaScript资源详情", + "search": "搜索JavaScript资源", + "selected-javascript-resources": "{ count, plural, =1 {1 个 JavaScript 资源} other {# 个 JavaScript 资源} } 已选择", + "no-javascript-resource-text": "未找到JavaScript资源", + "all-types": "全部", + "module-script": "模块脚本" + }, "rpc": { "error": { "target-device-is-not-set": "目标设备未设置!", @@ -3966,6 +4306,7 @@ "deselect-all": "取消选择", "rulenode-details": "规则节点详情", "debug-mode": "调试模式", + "singleton": "单例", "configuration": "配置", "link": "链接", "link-details": "规则节点链接详情", @@ -4012,6 +4353,7 @@ "output": "输出", "test": "测试", "help": "帮助", + "reset-debug-settings": "重置所有节点的调试设置", "test-with-this-message": "使用此消息进行{{test}}测试", "queue-hint": "选择一个队列将消息转发到另一个队列,默认情况下使用'Main'队列。", "queue-singleton-hint": "选择一个队列以在多实体中转发消息,默认情况下使用'Main'队列。" @@ -4175,6 +4517,7 @@ "tenant-profiles": "租户配置", "add": "添加租户配置", "add-profile": "添加配置", + "debug": "调试", "edit": "编辑租户配置", "tenant-profile-details": "租户配置详细信息", "no-tenant-profiles-text": "未找到租户配置", @@ -4245,6 +4588,8 @@ "maximum-ota-packages-sum-data-size": "OTA包文件总大小", "maximum-ota-package-sum-data-size-required": "OTA包文件总大小必填。", "maximum-ota-package-sum-data-size-range": "OTA包文件总大小不能为负数", + "maximum-debug-duration-min": "最大调试时长(分钟)", + "maximum-debug-duration-min-range": "最大调试时长不能为负", "rest-requests-for-tenant": "租户REST请求", "transport-tenant-telemetry-msg-rate-limit": "租户遥测消息", "transport-tenant-telemetry-data-points-rate-limit": "租户遥测数据点", @@ -4458,6 +4803,7 @@ "sec": "{{ sec }} 秒", "sec-short": "{{ sec }}s", "short": { + "years": "{ years, plural, =1 {1 年} other {# 年} }", "days": "{ days, plural, =1 {1 天 } other {# 天 } }", "hours": "{ hours, plural, =1 {1 小时 } other {# 小时 } }", "minutes": "{{minutes}}分 ", @@ -4496,7 +4842,16 @@ "hide-group-interval": "隐藏用户的分组间隔", "hide-max-values": "隐藏用户的最大值", "hide-timezone": "隐藏用户的时区", - "disable-custom-interval": "禁用自定义间隔选择" + "disable-custom-interval": "禁用自定义间隔选择", + "edit-aggregation-functions-list": "编辑聚合函数列表", + "edit-aggregation-functions-list-hint": "可以指定可用选项的列表。", + "allowed-aggregation-functions": "允许的聚合函数", + "edit-intervals-list": "编辑时间间隔列表", + "allowed-agg-intervals": "分组时间间隔", + "default-agg-interval": "默认分组时间间隔", + "edit-intervals-list-hint": "可以指定可用的时间间隔选项列表。", + "edit-grouping-intervals-list-hint": "可以配置分组时间间隔列表和默认分组时间间隔。", + "all": "全部" }, "tooltip": { "trigger": "触发", @@ -4570,7 +4925,365 @@ "quart": "夸脱", "gallon": "加仑", "oil-barrels": "油桶", - "cubic-meter-per-kilogram": "每公斤立方米" + "cubic-meter-per-kilogram": "每公斤立方米", + "gill": "吉尔", + "hogshead": "大桶", + "teaspoon": "茶匙", + "tablespoon": "汤匙", + "cup": "杯", + "celsius": "摄氏度", + "kelvin": "开尔文", + "rankine": "兰金", + "fahrenheit": "华氏度", + "percent": "百分比", + "meter-per-second": "米每秒", + "kilometer-per-hour": "千米每小时", + "foot-per-second": "英尺每秒", + "mile-per-hour": "英里每小时", + "knot": "节", + "millimeters-per-minute": "毫米每分钟", + "kilometer-per-hour-squared": "千米每小时平方", + "foot-per-second-squared": "英尺每秒平方", + "pascal": "帕斯卡", + "kilopascal": "千帕", + "megapascal": "兆帕", + "gigapascal": "吉帕", + "millibar": "毫巴", + "bar": "巴", + "kilobar": "千巴", + "newton": "牛顿", + "newton-meter": "牛顿·米", + "foot-pounds": "英尺磅", + "inch-pounds": "英寸磅", + "newton-per-meter": "牛顿每米", + "atmospheres": "大气压", + "pounds-per-square-inch": "磅每平方英寸", + "torr": "托", + "inches-of-mercury": "英寸汞柱", + "pascal-per-square-meter": "帕斯卡每平方米", + "pound-per-square-inch": "磅每平方英寸", + "newton-per-square-meter": "牛顿每平方米", + "kilogram-force-per-square-meter": "千克力每平方米", + "pascal-per-square-centimeter": "帕斯卡每平方厘米", + "ton-force-per-square-inch": "吨力每平方英寸", + "kilonewton-per-square-meter": "千牛顿每平方米", + "newton-per-square-millimeter": "牛顿每平方毫米", + "microjoule": "微焦耳", + "millijoule": "毫焦耳", + "joule": "焦耳", + "kilojoule": "千焦耳", + "megajoule": "兆焦耳", + "gigajoule": "吉焦耳", + "watt-hour": "瓦时", + "kilowatt-hour": "千瓦时", + "electron-volts": "电子伏特", + "joules-per-coulomb": "焦耳每库仑", + "british-thermal-unit": "英热单位", + "foot-pound": "英尺磅", + "calorie": "卡路里", + "small-calorie": "小卡路里", + "kilocalorie": "千卡路里", + "joule-per-kelvin": "焦耳每开尔文", + "joule-per-kilogram-kelvin": "焦耳每千克开尔文", + "joule-per-kilogram": "焦耳每千克", + "watt-per-meter-kelvin": "瓦特每米开尔文", + "joule-per-cubic-meter": "焦耳每立方米", + "therm": "热单位", + "electric-dipole-moment": "电偶极矩", + "magnetic-dipole-moment": "磁偶极矩", + "debye": "德拜", + "coulomb-per-square-meter-per-volt": "库仑每平方米每伏特", + "milliwatt": "毫瓦", + "microwatt": "微瓦", + "watt": "瓦特", + "kilowatt": "千瓦", + "megawatt": "兆瓦", + "gigawatt": "吉瓦", + "metric-horsepower": "公制马力", + "milliwatt-per-square-centimeter": "毫瓦每平方厘米", + "watt-per-square-centimeter": "瓦特每平方厘米", + "kilowatt-per-square-centimeter": "千瓦每平方厘米", + "milliwatt-per-square-meter": "毫瓦每平方米", + "watt-per-square-meter": "瓦特每平方米", + "kilowatt-per-square-meter": "千瓦每平方米", + "watt-per-square-inch": "瓦特每平方英寸", + "kilowatt-per-square-inch": "千瓦每平方英寸", + "horsepower": "马力", + "btu-per-hour": "英热单位/小时", + "coulomb": "库仑", + "millicoulomb": "毫库仑", + "microcoulomb": "微库仑", + "picocoulomb": "皮库仑", + "coulomb-per-meter": "库仑每米", + "coulomb-per-cubic-meter": "库仑每立方米", + "coulomb-per-square-meter": "库仑每平方米", + "square-millimeter": "平方毫米", + "square-centimeter": "平方厘米", + "square-meter": "平方米", + "hectare": "公顷", + "square-kilometer": "平方千米", + "square-inch": "平方英寸", + "square-foot": "平方英尺", + "square-yard": "平方码", + "acre": "英亩", + "square-mile": "平方英里", + "are": "亚尔", + "barn": "巴恩", + "circular-inch": "圆英寸", + "milliampere-hour": "毫安时", + "milliampere-hour-tags": "电流, 电流流动, 电荷, 电流容量, 电流流, 电流流动, 毫安时, 毫安小时, mAh", + "ampere-hours": "安时", + "ampere-hours-tags": "电流, 电流流动, 电荷, 电流容量, 电流流, 电流流动, 安培, 安时, Ah", + "kiloampere-hours": "千安时", + "kiloampere-hours-tags": "电流, 电流流动, 电荷, 电流容量, 电流流, 电流流动, 千安时, 千安小时, kAh", + "nanoampere": "纳安培", + "nanoampere-tags": "电流, 安培, 纳安培, nA", + "picoampere": "皮安培", + "picoampere-tags": "电流, 安培, 皮安培, pA", + "microampere": "微安培", + "microampere-tags": "电流, 微安培, 微安培, μA", + "milliampere": "毫安培", + "milliampere-tags": "电流, 毫安培, 毫安培, mA", + "ampere": "安培", + "ampere-tags": "电流, 电流流动, 电流流, 电流流动, 安培, 安培, 电流强度, A", + "kiloamperes": "千安培", + "kiloamperes-tags": "电流, 电流流动, 千安培, kA", + "microampere-per-square-centimeter": "每平方厘米微安培", + "microampere-per-square-centimeter-tags": "电流密度, 每平方厘米微安培, µA/cm²", + "ampere-per-square-meter": "每平方米安培", + "ampere-per-square-meter-tags": "电流密度, 单位面积电流, 每平方米安培, A/m²", + "ampere-per-meter": "每米安培", + "ampere-per-meter-tags": "磁场强度, 磁场强度, 每米安培, A/m", + "oersted": "奥斯特", + "oersted-tags": "磁场, 奥斯特, Oe", + "bohr-magneton": "玻尔磁子", + "bohr-magneton-tags": "原子物理学, 磁矩, 玻尔磁子, μB", + "ampere-meter-squared": "安培·米平方", + "ampere-meter-squared-tags": "磁矩, 偶极矩, 安培·米平方, A·m²", + "ampere-meter": "安培·米", + "ampere-meter-tags": "磁场, 电流环, 安培·米, A·m", + "nanovolt": "纳伏特", + "picovolt": "皮伏特", + "millivolts": "毫伏特", + "microvolts": "微伏特", + "volt": "伏特", + "kilovolts": "千伏特", + "dbmV": "dBmV", + "dbm": "dBm", + "volt-meter": "伏特·米", + "kilovolt-meter": "千伏特·米", + "megavolt-meter": "兆伏特·米", + "microvolt-meter": "微伏特·米", + "millivolt-meter": "毫伏特·米", + "nanovolt-meter": "纳伏特·米", + "ohm": "欧姆", + "microohm": "微欧姆", + "milliohm": "毫欧姆", + "kilohm": "千欧姆", + "megohm": "兆欧姆", + "gigohm": "吉欧姆", + "hertz": "赫兹", + "kilohertz": "千赫兹", + "megahertz": "兆赫兹", + "gigahertz": "吉赫兹", + "rpm": "每分钟转速", + "candela-per-square-meter": "每平方米坎德拉", + "candela": "坎德拉", + "lumen": "流明", + "lux": "勒克斯", + "foot-candle": "英尺烛光", + "lumen-per-square-meter": "每平方米流明", + "lux-second": "勒克斯秒", + "lumen-second": "流明秒", + "lumens-per-watt": "每瓦流明", + "absorbance": "吸光度", + "mole": "摩尔", + "nanomole": "纳摩尔", + "micromole": "微摩尔", + "millimole": "毫摩尔", + "kilomole": "千摩尔", + "mole-per-cubic-meter": "每立方米摩尔", + "rssi": "接收信号强度指示", + "ppm": "百万分之一", + "ppb": "十亿分之一", + "micrograms-per-cubic-meter": "每立方米微克", + "aqi": "空气质量指数", + "gram-per-cubic-meter": "每立方米克", + "gram-per-kilogram": "比湿", + "millimeters-per-second": "每秒毫米", + "neper": "奈普尔", + "bel": "贝尔", + "decibel": "分贝", + "meters-per-second-squared": "每秒平方米", + "becquerel": "贝克勒尔", + "curie": "居里", + "gray": "戈瑞", + "sievert": "希沃特", + "roentgen": "伦琴", + "cps": "每秒计数", + "rad": "辐射剂量", + "rem": "辐射当量剂量", + "dps": "每秒衰变次数", + "rutherford": "卢瑟福", + "coulombs-per-kilogram": "每千克库仑", + "becquerels-per-cubic-meter": "每立方米贝可勒尔", + "curies-per-liter": "每升居里", + "becquerels-per-second": "每秒贝可勒尔", + "curies-per-second": "每秒居里", + "gy-per-second": "每秒戈瑞", + "watt-per-steradian": "每斯特拉迪安瓦特", + "watt-per-square-metre-steradian": "每平方米斯特拉迪安瓦特", + "ph-level": "pH值", + "turbidity": "浑浊度", + "mg-per-liter": "每升毫克", + "microsiemens-per-centimeter": "每厘米微西门子", + "millisiemens-per-meter": "每米毫西门子", + "siemens-per-meter": "每米西门子", + "kilogram-per-cubic-meter": "每立方米千克", + "gram-per-cubic-centimeter": "每立方厘米克", + "kilogram-per-square-meter": "每平方米千克", + "milligram-per-milliliter": "每毫升毫克", + "milligram-per-cubic-meter": "每立方米毫克", + "pound-per-cubic-foot": "每立方英尺磅", + "ounces-per-cubic-inch": "每立方英寸盎司", + "tons-per-cubic-yard": "每立方码吨", + "particle-density": "粒子密度", + "kilometers-per-liter": "每升公里", + "miles-per-gallon": "每加仑英里", + "liters-per-100-km": "每百公里升数", + "gallons-per-mile": "每英里加仑", + "liters-per-hour": "每小时升数", + "gallons-per-hour": "每小时加仑", + "beats-per-minute": "每分钟节拍数", + "millimeters-of-mercury": "毫米汞柱", + "milligrams-per-deciliter": "每分升毫克", + "g-force": "重力加速度", + "kilonewton": "千牛顿", + "kilogram-force": "千克力", + "pound-force": "磅力", + "kilopound-force": "千磅力", + "dyne": "达因", + "poundal": "磅顿", + "kip": "千磅力", + "gal": "加尔", + "gravity": "重力", + "hectopascal": "百帕斯卡", + "atmosphere": "大气压", + "millibars": "毫巴", + "inch-of-mercury": "一英寸汞柱", + "richter-scale": "里氏震级", + "second": "秒", + "minute": "分", + "hour": "小时", + "day": "天", + "week": "周", + "month": "月", + "year": "年", + "cubic-foot-per-minute": "每分钟立方英尺", + "cubic-meters-per-hour": "每小时立方米", + "cubic-meters-per-second": "每秒立方米", + "liter-per-second": "每秒升", + "liter-per-minute": "每分钟升", + "gallons-per-minute": "每分钟加仑", + "cubic-foot-per-second": "每秒立方英尺", + "milliliters-per-minute": "每分钟毫升", + "bit": "比特", + "byte": "字节", + "kilobyte": "千字节", + "megabyte": "兆字节", + "gigabyte": "吉字节", + "terabyte": "太字节", + "petabyte": "拍字节", + "exabyte": "艾字节", + "zettabyte": "泽字节", + "yottabyte": "尧字节", + "bit-per-second": "每秒比特", + "kilobit-per-second": "每秒千比特", + "megabit-per-second": "每秒兆比特", + "gigabit-per-second": "每秒吉比特", + "terabit-per-second": "每秒太比特", + "byte-per-second": "每秒字节", + "kilobyte-per-second": "每秒千字节", + "megabyte-per-second": "每秒兆字节", + "gigabyte-per-second": "每秒吉字节", + "degree": "度", + "radian": "弧度", + "gradian": "梯度", + "mil": "千分之一英寸", + "revolution": "转", + "siemens": "西门子", + "millisiemens": "毫西门子", + "microsiemens": "微西门子", + "kilosiemens": "千西门子", + "megasiemens": "兆西门子", + "gigasiemens": "吉西门子", + "farad": "法拉", + "millifarad": "毫法拉", + "microfarad": "微法拉", + "nanofarad": "纳法拉", + "picofarad": "皮法拉", + "kilofarad": "千法拉", + "megafarad": "兆法拉", + "gigafarad": "吉法拉", + "terfarad": "太法拉", + "farad-per-meter": "每米法拉", + "tesla": "特斯拉", + "gauss": "高斯", + "kilogauss": "千高斯", + "millitesla": "毫特斯拉", + "microtesla": "微特斯拉", + "nanotesla": "纳特斯拉", + "kilotesla": "千特斯拉", + "megatesla": "兆特斯拉", + "millitesla-square-meters": "毫特斯拉平方米", + "gamma": "伽马", + "lambda": "波长", + "square-meter-per-second": "每秒平方米", + "square-centimeter-per-second": "每秒平方厘米", + "stoke": "斯托克", + "centistokes": "厘斯托克", + "square-foot-per-second": "每秒平方英尺", + "square-inch-per-second": "每秒平方英寸", + "pascal-second": "帕斯卡秒", + "centipoise": "厘泊", + "poise": "泊", + "reynolds": "雷诺数", + "pound-per-foot-hour": "每英尺每小时磅", + "newton-second-per-square-meter": "每平方米牛顿秒", + "dyne-second-per-square-centimeter": "每平方厘米达因秒", + "kilogram-per-meter-second": "千克每米秒", + "tesla-square-meters": "特斯拉平方米", + "maxwell": "麦克斯韦", + "tesla-per-meter": "每米特斯拉", + "gauss-per-centimeter": "每厘米高斯", + "weber": "韦伯", + "microweber": "微韦伯", + "milliweber": "毫韦伯", + "gauss-square-centimeter": "高斯平方厘米", + "kilogauss-square-centimeter": "千高斯平方厘米", + "henry": "亨利", + "millihenry": "毫亨利", + "microhenry": "微亨利", + "nanohenry": "纳亨利", + "henry-per-meter": "每米亨利", + "tesla-meter-per-ampere": "每安培米特斯拉", + "gauss-per-oersted": "每欧斯特高斯", + "kilogram-per-mole": "每摩尔千克", + "gram-per-mole": "每摩尔克", + "milligram-per-mole": "每摩尔毫克", + "joule-per-mole": "每摩尔焦耳", + "joule-per-mole-kelvin": "每摩尔每开尔文焦耳", + "millivolts-per-meter": "每米毫伏", + "volts-per-meter": "每米伏特", + "kilovolts-per-meter": "每米千伏", + "radian-per-second": "每秒弧度", + "radian-per-second-squared": "每秒平方弧度", + "revolutions-per-minute-per-second": "角加速度", + "revolutions-per-minute-per-second-squared": "角加速度", + "deg-per-second": "度/秒", + "degrees-brix": "布里克度", + "katal": "卡塔尔", + "katal-per-cubic-metre": "每立方米卡塔尔" }, "user": { "user": "用户", @@ -4771,14 +5484,15 @@ "type": "类型", "resources": "资源", "resource-url": "JavaScript/CSS", + "resource-is-extension": "是否扩展", "remove-resource": "删除资源", "add-resource": "添加资源", "html": "HTML", "tidy": "整理", "css": "CSS", - "settings-schema": "设置模式", - "datakey-settings-schema": "数据键设置", - "latest-datakey-settings-schema": "最新数据键设置", + "settings-form": "设置表单", + "data-key-settings-form": "数据键设置表单", + "latest-data-key-settings-form": "最新数据键设置表单", "widget-settings": "设置", "description": "描述", "tags": "标签", @@ -4811,7 +5525,9 @@ "selected-widgets": "已选择{ count, plural, =1 {1 个部件} other {# 个部件} }", "undo": "撤销", "export": "导出", + "export-prompt": "嵌入部件图片和资源", "export-widgets": "导出部件", + "export-widgets-prompt": "嵌入部件图片和资源", "import": "导入部件", "no-data": "部件上没有要显示的数据", "data-overflow": "部件显示{{count}}条实体中的{{total}}条。", @@ -4870,6 +5586,7 @@ "popover-style": "样式", "open-new-browser-tab": "在选项卡中打开", "open-URL": "打开URL", + "URL": "URL", "url-required": "URL必填。", "mobile": { "action-type": "移动端动作类型", @@ -5051,7 +5768,12 @@ "action-button": { "behavior": "行为", "on-click": "单击", - "on-click-hint": "单击按钮时触发动作" + "on-click-hint": "单击按钮时触发动作", + "first-button-click": "第一次按钮单击", + "first-button-click-hint": "按下第一个按钮时触发的动作", + "second-button-click": "第二次按钮单击", + "second-button-click-hint": "按下第二个按钮时触发的动作", + "button-click-hint": "按下部件时触发的动作" }, "command-button": { "behavior": "行为", @@ -5096,6 +5818,18 @@ "vertical-fill": "垂直填充", "button-appearance": "外观" }, + "segmented-button": { + "layout": "布局", + "layout-squared": "方形", + "layout-rounded": "圆角", + "card-border": "卡片边框", + "button-appearance": "按钮外观", + "first": "第一个", + "second": "第二个", + "color-styles": "颜色样式", + "selected": "已选中", + "unselected": "未选中" + }, "button": { "layout": "布局", "outlined": "默认", @@ -5109,6 +5843,7 @@ "color-palette": "调色板", "main": "前景色", "background": "背景色", + "border": "边框", "custom-styles": "自定义样式", "clear-style": "清除样式", "shadow": "阴影", @@ -5122,11 +5857,16 @@ "activated-state-hint": "按钮在激活状态的触发条件。", "disabled-state": "禁用状态", "disabled-state-hint": "按钮在禁用状态的触发条件。", + "selected-state": "选中状态", + "selected-state-hint": "配置按钮选中状态的触发条件。", "enabled": "启用", "hovered": "悬停", "pressed": "按压", "activated": "激活", - "disabled": "禁用" + "disabled": "禁用", + "initial": "初始状态", + "first": "第一个", + "second": "第二个" }, "background": { "background": "背景颜色", @@ -5378,7 +6118,7 @@ "border-radius": "边框圆角", "bar-width": "宽度", "label": "标签", - "label-hint": "在bar上显示标签。", + "label-hint": "在条形图上显示标签。", "series-label-hint": "显示具有数值的标签。", "label-background": "标签背景" } @@ -5715,6 +6455,10 @@ "no-gpio-leds": "未配置GPIO LED", "add-gpio-led": "添加GPIO LED" }, + "html-card": { + "html": "HTML", + "css": "CSS" + }, "input-widgets": { "attribute-not-allowed": "属性参数不能在此部件中使用", "blocked-location": "在浏览器中阻止地理位置", @@ -6780,11 +7524,13 @@ "get-attribute": "获取属性", "set-attribute": "设置属性", "get-time-series": "获取遥测", + "get-alarm-status": "获取告警状态", "get-dashboard-state": "获取仪表板状态", "add-time-series": "添加遥测", "execute-rpc-text": "执行RPC方法'{{methodName}}'", - "get-attribute-text": "使用属性'{{key}}'", "get-time-series-text": "使用遥测'{{key}}'", + "get-attribute-text": "使用属性'{{key}}'", + "get-alarm-status-text": "使用告警状态", "get-dashboard-state-text": "使用仪表板状态", "when-dashboard-state-is-text": "当仪表板状态为'{{state}}'", "when-dashboard-state-function-is-text": "当(仪表板状态)是'{{state}}'", @@ -7063,6 +7809,7 @@ "widget-action": { "action-cell-button": "动作单元格按钮", "row-click": "点击行时", + "cell-click": "点击单元格时", "polygon-click": "点击多边形时", "marker-click": "点击标记时", "circle-click": "点击圆圈时", @@ -7071,7 +7818,9 @@ "element-click": "点击HTML元素时", "pie-slice-click": "点击切片时", "row-double-click": "双击行时", - "card-click": "点击卡片时" + "cell-double-click": "双击单元格时", + "card-click": "点击卡片时", + "click": "点击时" } }, "paginator": { @@ -7083,6 +7832,33 @@ "items-per-page-separator": "至" }, "language": { - "language": "语言" + "language": "语言", + "locales": { + "ar_AE": "العربية (الإمارات العربية المتحدة)", + "ca_ES": "català (Espanya)", + "cs_CZ": "čeština (Česko)", + "da_DK": "dansk (Danmark)", + "de_DE": "Deutsch (Deutschland)", + "el_GR": "Ελληνικά (Ελλάδα)", + "en_US": "English (United States)", + "es_ES": "español (España)", + "fa_IR": "فارسی (ایران)", + "fr_FR": "français (France)", + "it_IT": "italiano (Italia)", + "ja_JP": "日本語 (日本)", + "ka_GE": "ქართული (საქართველო)", + "ko_KR": "한국어 (대한민국)", + "lt_LT": "lietuvių (Lietuva)", + "lv_LV": "latviešu (Latvija)", + "nl_BE": "Nederlands (België)", + "pl_PL": "polski (Polska)", + "pt_BR": "português (Brasil)", + "ro_RO": "română (România)", + "sl_SI": "slovenščina (Slovenija)", + "tr_TR": "Türkçe (Türkiye)", + "uk_UA": "українська (Україна)", + "zh_CN": "中文 (中国)", + "zh_TW": "中文 (台灣)" + } } } From 54afdaa07a9593d975577ac5e386505f274918f2 Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Thu, 6 Feb 2025 15:15:38 +0200 Subject: [PATCH 006/286] Do not copy latest to entity views when data was not saved on the main entity --- .../DefaultTelemetrySubscriptionService.java | 10 +++-- ...faultTelemetrySubscriptionServiceTest.java | 41 +++++++++++++++++++ .../server/common/data/EntityType.java | 12 ++++++ .../thingsboard/common/util/DonAsynchron.java | 6 +++ 4 files changed, 66 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java index cab2f18dc7..43e4b66c40 100644 --- a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java @@ -151,7 +151,7 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer addWsCallback(saveFuture, success -> onTimeSeriesUpdate(tenantId, entityId, request.getEntries())); } if (strategy.saveLatest()) { - copyLatestToEntityViews(tenantId, entityId, request.getEntries()); + addMainCallback(saveFuture, __ -> copyLatestToEntityViews(tenantId, entityId, request.getEntries())); } return saveFuture; } @@ -207,8 +207,8 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer } private void copyLatestToEntityViews(TenantId tenantId, EntityId entityId, List ts) { - if (EntityType.DEVICE.equals(entityId.getEntityType()) || EntityType.ASSET.equals(entityId.getEntityType())) { - Futures.addCallback(this.tbEntityViewService.findEntityViewsByTenantIdAndEntityIdAsync(tenantId, entityId), + if (entityId.getEntityType().isOneOf(EntityType.DEVICE, EntityType.ASSET)) { + Futures.addCallback(tbEntityViewService.findEntityViewsByTenantIdAndEntityIdAsync(tenantId, entityId), new FutureCallback<>() { @Override public void onSuccess(@Nullable List result) { @@ -312,6 +312,10 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer addMainCallback(saveFuture, result -> callback.onSuccess(null), callback::onFailure); } + private void addMainCallback(ListenableFuture saveFuture, Consumer onSuccess) { + DonAsynchron.withCallback(saveFuture, onSuccess, null, tsCallBackExecutor); + } + private void addMainCallback(ListenableFuture saveFuture, Consumer onSuccess, Consumer onFailure) { DonAsynchron.withCallback(saveFuture, onSuccess, onFailure, tsCallBackExecutor); } diff --git a/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java b/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java index 10fdd85504..4ded639c76 100644 --- a/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java @@ -71,6 +71,7 @@ import java.util.concurrent.ExecutorService; import java.util.stream.LongStream; import java.util.stream.Stream; +import static com.google.common.util.concurrent.Futures.immediateFailedFuture; import static com.google.common.util.concurrent.Futures.immediateFuture; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; @@ -318,6 +319,46 @@ class DefaultTelemetrySubscriptionServiceTest { then(subscriptionManagerService).shouldHaveNoInteractions(); } + @Test + void shouldNotCopyLatestToEntityViewWhenTimeseriesSaveFailedOnMainEntity() { + // GIVEN + var entityView = new EntityView(new EntityViewId(UUID.randomUUID())); + entityView.setTenantId(tenantId); + entityView.setCustomerId(customerId); + entityView.setEntityId(entityId); + entityView.setKeys(new TelemetryEntityView(sampleTelemetry.stream().map(KvEntry::getKey).toList(), new AttributesEntityView())); + + // mock that there is one entity view + lenient().when(tbEntityViewService.findEntityViewsByTenantIdAndEntityIdAsync(tenantId, entityId)).thenReturn(immediateFuture(List.of(entityView))); + // mock that save latest call for entity view is successful + lenient().when(tsService.saveLatest(tenantId, entityView.getId(), sampleTelemetry)).thenReturn(immediateFuture(listOfNNumbers(sampleTelemetry.size()))); + // mock TPI for entity view + lenient().when(partitionService.resolve(ServiceType.TB_CORE, tenantId, entityView.getId())).thenReturn(tpi); + + var request = TimeseriesSaveRequest.builder() + .tenantId(tenantId) + .customerId(customerId) + .entityId(entityId) + .entries(sampleTelemetry) + .ttl(sampleTtl) + .strategy(new TimeseriesSaveRequest.Strategy(true, true, false)) + .callback(emptyCallback) + .build(); + + given(tsService.save(tenantId, entityId, sampleTelemetry, sampleTtl)).willReturn(immediateFailedFuture(new RuntimeException("failed to save latest on main entity"))); + + // WHEN + telemetryService.saveTimeseries(request); + + // THEN + // should save only time series for the main entity + then(tsService).should().save(tenantId, entityId, sampleTelemetry, sampleTtl); + then(tsService).shouldHaveNoMoreInteractions(); + + // should not send any WS updates + then(subscriptionManagerService).shouldHaveNoInteractions(); + } + @ParameterizedTest @MethodSource("booleanCombinations") void shouldCallCorrectApiBasedOnBooleanFlagsInTheSaveRequest(boolean saveTimeseries, boolean saveLatest, boolean sendWsUpdate) { diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/EntityType.java b/common/data/src/main/java/org/thingsboard/server/common/data/EntityType.java index 579fa863ba..84fc59022b 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/EntityType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/EntityType.java @@ -84,4 +84,16 @@ public enum EntityType { this.tableName = tableName; } + public boolean isOneOf(EntityType... types) { + if (types == null) { + return false; + } + for (EntityType type : types) { + if (this == type) { + return true; + } + } + return false; + } + } diff --git a/common/util/src/main/java/org/thingsboard/common/util/DonAsynchron.java b/common/util/src/main/java/org/thingsboard/common/util/DonAsynchron.java index f538d04f15..0e1193ef99 100644 --- a/common/util/src/main/java/org/thingsboard/common/util/DonAsynchron.java +++ b/common/util/src/main/java/org/thingsboard/common/util/DonAsynchron.java @@ -36,6 +36,9 @@ public class DonAsynchron { FutureCallback callback = new FutureCallback() { @Override public void onSuccess(T result) { + if (onSuccess == null) { + return; + } try { onSuccess.accept(result); } catch (Throwable th) { @@ -45,6 +48,9 @@ public class DonAsynchron { @Override public void onFailure(Throwable t) { + if (onFailure == null) { + return; + } onFailure.accept(t); } }; From b2b33199fea5fcf6940a2aca642931f332942376 Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Thu, 6 Feb 2025 15:55:41 +0200 Subject: [PATCH 007/286] Corrections after code review --- .../DefaultTelemetrySubscriptionService.java | 96 +++++++++---------- ...faultTelemetrySubscriptionServiceTest.java | 2 +- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java index 43e4b66c40..5b5054ae38 100644 --- a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionService.java @@ -150,7 +150,7 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer if (strategy.sendWsUpdate()) { addWsCallback(saveFuture, success -> onTimeSeriesUpdate(tenantId, entityId, request.getEntries())); } - if (strategy.saveLatest()) { + if (strategy.saveLatest() && entityId.getEntityType().isOneOf(EntityType.DEVICE, EntityType.ASSET)) { addMainCallback(saveFuture, __ -> copyLatestToEntityViews(tenantId, entityId, request.getEntries())); } return saveFuture; @@ -207,58 +207,56 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer } private void copyLatestToEntityViews(TenantId tenantId, EntityId entityId, List ts) { - if (entityId.getEntityType().isOneOf(EntityType.DEVICE, EntityType.ASSET)) { - Futures.addCallback(tbEntityViewService.findEntityViewsByTenantIdAndEntityIdAsync(tenantId, entityId), - new FutureCallback<>() { - @Override - public void onSuccess(@Nullable List result) { - if (result != null && !result.isEmpty()) { - Map> tsMap = new HashMap<>(); - for (TsKvEntry entry : ts) { - tsMap.computeIfAbsent(entry.getKey(), s -> new ArrayList<>()).add(entry); - } - for (EntityView entityView : result) { - List keys = entityView.getKeys() != null && entityView.getKeys().getTimeseries() != null ? - entityView.getKeys().getTimeseries() : new ArrayList<>(tsMap.keySet()); - List entityViewLatest = new ArrayList<>(); - long startTs = entityView.getStartTimeMs(); - long endTs = entityView.getEndTimeMs() == 0 ? Long.MAX_VALUE : entityView.getEndTimeMs(); - for (String key : keys) { - List entries = tsMap.get(key); - if (entries != null) { - Optional tsKvEntry = entries.stream() - .filter(entry -> entry.getTs() > startTs && entry.getTs() <= endTs) - .max(Comparator.comparingLong(TsKvEntry::getTs)); - tsKvEntry.ifPresent(entityViewLatest::add); - } - } - if (!entityViewLatest.isEmpty()) { - saveTimeseries(TimeseriesSaveRequest.builder() - .tenantId(tenantId) - .entityId(entityView.getId()) - .entries(entityViewLatest) - .strategy(TimeseriesSaveRequest.Strategy.LATEST_AND_WS) - .callback(new FutureCallback<>() { - @Override - public void onSuccess(@Nullable Void tmp) {} - - @Override - public void onFailure(Throwable t) { - log.error("[{}][{}] Failed to save entity view latest timeseries: {}", tenantId, entityView.getId(), entityViewLatest, t); - } - }) - .build()); + Futures.addCallback(tbEntityViewService.findEntityViewsByTenantIdAndEntityIdAsync(tenantId, entityId), + new FutureCallback<>() { + @Override + public void onSuccess(@Nullable List result) { + if (result != null && !result.isEmpty()) { + Map> tsMap = new HashMap<>(); + for (TsKvEntry entry : ts) { + tsMap.computeIfAbsent(entry.getKey(), s -> new ArrayList<>()).add(entry); + } + for (EntityView entityView : result) { + List keys = entityView.getKeys() != null && entityView.getKeys().getTimeseries() != null ? + entityView.getKeys().getTimeseries() : new ArrayList<>(tsMap.keySet()); + List entityViewLatest = new ArrayList<>(); + long startTs = entityView.getStartTimeMs(); + long endTs = entityView.getEndTimeMs() == 0 ? Long.MAX_VALUE : entityView.getEndTimeMs(); + for (String key : keys) { + List entries = tsMap.get(key); + if (entries != null) { + Optional tsKvEntry = entries.stream() + .filter(entry -> entry.getTs() > startTs && entry.getTs() <= endTs) + .max(Comparator.comparingLong(TsKvEntry::getTs)); + tsKvEntry.ifPresent(entityViewLatest::add); } } + if (!entityViewLatest.isEmpty()) { + saveTimeseries(TimeseriesSaveRequest.builder() + .tenantId(tenantId) + .entityId(entityView.getId()) + .entries(entityViewLatest) + .strategy(TimeseriesSaveRequest.Strategy.LATEST_AND_WS) + .callback(new FutureCallback<>() { + @Override + public void onSuccess(@Nullable Void tmp) {} + + @Override + public void onFailure(Throwable t) { + log.error("[{}][{}] Failed to save entity view latest timeseries: {}", tenantId, entityView.getId(), entityViewLatest, t); + } + }) + .build()); + } } } + } - @Override - public void onFailure(Throwable t) { - log.error("Error while finding entity views by tenantId and entityId", t); - } - }, MoreExecutors.directExecutor()); - } + @Override + public void onFailure(Throwable t) { + log.error("Error while finding entity views by tenantId and entityId", t); + } + }, MoreExecutors.directExecutor()); } private void onAttributesUpdate(TenantId tenantId, EntityId entityId, String scope, List attributes, boolean notifyDevice) { @@ -313,7 +311,7 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer } private void addMainCallback(ListenableFuture saveFuture, Consumer onSuccess) { - DonAsynchron.withCallback(saveFuture, onSuccess, null, tsCallBackExecutor); + addMainCallback(saveFuture, onSuccess, null); } private void addMainCallback(ListenableFuture saveFuture, Consumer onSuccess, Consumer onFailure) { diff --git a/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java b/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java index 4ded639c76..60a16c16a4 100644 --- a/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/telemetry/DefaultTelemetrySubscriptionServiceTest.java @@ -345,7 +345,7 @@ class DefaultTelemetrySubscriptionServiceTest { .callback(emptyCallback) .build(); - given(tsService.save(tenantId, entityId, sampleTelemetry, sampleTtl)).willReturn(immediateFailedFuture(new RuntimeException("failed to save latest on main entity"))); + given(tsService.save(tenantId, entityId, sampleTelemetry, sampleTtl)).willReturn(immediateFailedFuture(new RuntimeException("failed to save data on main entity"))); // WHEN telemetryService.saveTimeseries(request); From 9f9319b791636651863f7c7b00d55c5c935f53c4 Mon Sep 17 00:00:00 2001 From: yevhenii Date: Thu, 6 Mar 2025 18:07:20 +0200 Subject: [PATCH 008/286] Fix RuleChainMetadata for older Edge versions - Check for Edge version and removal of data introduced in later versions. --- .../service/edge/EdgeMsgConstructorUtils.java | 38 +++++++++++++++++-- .../service/edge/rpc/EdgeGrpcSession.java | 2 +- .../edge/rpc/processor/EdgeProcessor.java | 3 +- .../processor/alarm/AlarmEdgeProcessor.java | 3 +- .../comment/AlarmCommentEdgeProcessor.java | 3 +- .../processor/asset/AssetEdgeProcessor.java | 3 +- .../profile/AssetProfileEdgeProcessor.java | 3 +- .../customer/CustomerEdgeProcessor.java | 3 +- .../dashboard/DashboardEdgeProcessor.java | 3 +- .../processor/device/DeviceEdgeProcessor.java | 3 +- .../profile/DeviceProfileEdgeProcessor.java | 3 +- .../processor/edge/EdgeEntityProcessor.java | 3 +- .../entityview/EntityViewEdgeProcessor.java | 3 +- .../NotificationRuleEdgeProcessor.java | 3 +- .../NotificationTargetEdgeProcessor.java | 3 +- .../NotificationTemplateEdgeProcessor.java | 3 +- .../processor/oauth2/DomainEdgeProcessor.java | 3 +- .../oauth2/OAuth2ClientEdgeProcessor.java | 3 +- .../ota/OtaPackageEdgeProcessor.java | 3 +- .../processor/queue/QueueEdgeProcessor.java | 3 +- .../relation/RelationEdgeProcessor.java | 4 +- .../resource/ResourceEdgeProcessor.java | 3 +- .../rule/RuleChainEdgeProcessor.java | 5 ++- .../rule/RuleChainMetadataEdgeProcessor.java | 5 ++- .../settings/AdminSettingsEdgeProcessor.java | 3 +- .../processor/tenant/TenantEdgeProcessor.java | 3 +- .../tenant/TenantProfileEdgeProcessor.java | 3 +- .../rpc/processor/user/UserEdgeProcessor.java | 3 +- .../widget/WidgetBundleEdgeProcessor.java | 3 +- .../widget/WidgetTypeEdgeProcessor.java | 3 +- 30 files changed, 94 insertions(+), 35 deletions(-) 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 b59dc096ee..703d42abf5 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 @@ -16,6 +16,7 @@ package org.thingsboard.server.service.edge; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -24,6 +25,7 @@ import com.google.gson.JsonPrimitive; import com.google.gson.reflect.TypeToken; import lombok.extern.slf4j.Slf4j; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode; import org.thingsboard.server.common.adaptor.JsonConverter; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.Dashboard; @@ -89,6 +91,7 @@ import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.DeviceRpcCallMsg; import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; import org.thingsboard.server.gen.edge.v1.EdgeConfiguration; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.EntityDataProto; import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; import org.thingsboard.server.gen.edge.v1.NotificationRuleUpdateMsg; @@ -417,8 +420,37 @@ public class EdgeMsgConstructorUtils { .setIdLSB(ruleChainId.getId().getLeastSignificantBits()).build(); } - public static RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(UpdateMsgType msgType, RuleChainMetaData ruleChainMetaData) { - return RuleChainMetadataUpdateMsg.newBuilder().setMsgType(msgType).setEntity(JacksonUtil.toString(ruleChainMetaData)).build(); + public static RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(UpdateMsgType msgType, RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { + String metaData = prepareMetaDataForEdgeVersion(ruleChainMetaData, edgeVersion); + + return RuleChainMetadataUpdateMsg.newBuilder() + .setMsgType(msgType) + .setEntity(metaData) + .build(); + } + + private static String prepareMetaDataForEdgeVersion(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { + if (edgeVersion == EdgeVersion.V_3_7_0 || edgeVersion == EdgeVersion.V_3_8_0) { + JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); + JsonNode nodes = jsonNode.get("nodes"); + + for (JsonNode node : nodes) { + if (node.isObject()) + prepareRuleNodeForOldEdgeVersion((ObjectNode) node); + } + return JacksonUtil.toString(jsonNode); + } else { + return JacksonUtil.toString(ruleChainMetaData); + } + } + + private static void prepareRuleNodeForOldEdgeVersion(ObjectNode node) { + if (TbMsgTimeseriesNode.class.getName().equals(node.get("type").asText())) { + JsonNode configurationNode = node.get("configuration"); + if (configurationNode != null && configurationNode.isObject()) { + ((ObjectNode) configurationNode).remove("processingSettings"); + } + } } public static EntityDataProto constructEntityDataMsg(TenantId tenantId, EntityId entityId, EdgeEventActionType actionType, JsonElement entityData) { @@ -467,7 +499,7 @@ public class EdgeMsgConstructorUtils { AttributeDeleteMsg.Builder attributeDeleteMsg = AttributeDeleteMsg.newBuilder(); attributeDeleteMsg.setScope(entityData.getAsJsonObject().getAsJsonPrimitive("scope").getAsString()); JsonArray jsonArray = entityData.getAsJsonObject().getAsJsonArray("keys"); - List keys = new Gson().fromJson(jsonArray.toString(), new TypeToken<>(){}.getType()); + List keys = new Gson().fromJson(jsonArray.toString(), new TypeToken<>() {}.getType()); attributeDeleteMsg.addAllAttributeNames(keys); attributeDeleteMsg.build(); builder.setAttributeDeleteMsg(attributeDeleteMsg); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index a970097548..ecd0c6d9f3 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -780,7 +780,7 @@ public abstract class EdgeGrpcSession implements Closeable { return null; } - return ctx.getProcessor(edgeEvent.getType()).convertEdgeEventToDownlink(edgeEvent); + return ctx.getProcessor(edgeEvent.getType()).convertEdgeEventToDownlink(edgeEvent, edgeVersion); } public void addEventToHighPriorityQueue(EdgeEvent edgeEvent) { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java index 0f17949437..dd6221c62b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/EdgeProcessor.java @@ -20,13 +20,14 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.transport.TransportProtos; public interface EdgeProcessor { ListenableFuture processEntityNotification(TenantId tenantId, TransportProtos.EdgeNotificationMsgProto msg); - default DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + default DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { return null; } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java index df9af20f84..6c4cbe7a94 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/AlarmEdgeProcessor.java @@ -30,6 +30,7 @@ import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.AlarmUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -55,7 +56,7 @@ public class AlarmEdgeProcessor extends BaseAlarmProcessor implements AlarmProce } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { AlarmUpdateMsg alarmUpdateMsg = convertAlarmEventToAlarmMsg(edgeEvent); if (alarmUpdateMsg != null) { return DownlinkMsg.newBuilder() diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java index 449f4867d1..4a76a3527b 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/alarm/comment/AlarmCommentEdgeProcessor.java @@ -31,6 +31,7 @@ import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.AlarmCommentUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -57,7 +58,7 @@ public class AlarmCommentEdgeProcessor extends BaseAlarmProcessor implements Ala } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); switch (edgeEvent.getAction()) { case ADDED_COMMENT: 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 e7a9720419..47f4c11362 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 @@ -36,6 +36,7 @@ import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.AssetUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; @@ -107,7 +108,7 @@ public class AssetEdgeProcessor extends BaseAssetProcessor implements AssetProce } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { AssetId assetId = new AssetId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED, ASSIGNED_TO_EDGE, ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java index 7a0ae0ccc6..e05b6f41c3 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/asset/profile/AssetProfileEdgeProcessor.java @@ -36,6 +36,7 @@ import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.AssetProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; @@ -94,7 +95,7 @@ public class AssetProfileEdgeProcessor extends BaseAssetProfileProcessor impleme } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { AssetProfileId assetProfileId = new AssetProfileId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java index 40cbe3985f..784d10b26c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/customer/CustomerEdgeProcessor.java @@ -32,6 +32,7 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageDataIterable; import org.thingsboard.server.gen.edge.v1.CustomerUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -48,7 +49,7 @@ import java.util.UUID; public class CustomerEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { CustomerId customerId = new CustomerId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { 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 f9a7311f31..e1259a7e0e 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 @@ -33,6 +33,7 @@ import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DashboardUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; @@ -100,7 +101,7 @@ public class DashboardEdgeProcessor extends BaseDashboardProcessor implements Da } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { DashboardId dashboardId = new DashboardId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED, ASSIGNED_TO_EDGE, ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { 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 08f6b294bf..ab01f83cd8 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 @@ -49,6 +49,7 @@ import org.thingsboard.server.gen.edge.v1.DeviceCredentialsUpdateMsg; import org.thingsboard.server.gen.edge.v1.DeviceRpcCallMsg; import org.thingsboard.server.gen.edge.v1.DeviceUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.TbQueueCallback; import org.thingsboard.server.queue.TbQueueMsgMetadata; @@ -222,7 +223,7 @@ public class DeviceEdgeProcessor extends BaseDeviceProcessor implements DevicePr } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { DeviceId deviceId = new DeviceId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED: diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java index 35857d8edb..3355bc819f 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/device/profile/DeviceProfileEdgeProcessor.java @@ -36,6 +36,7 @@ import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DeviceProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; @@ -94,7 +95,7 @@ public class DeviceProfileEdgeProcessor extends BaseDeviceProfileProcessor imple } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { DeviceProfileId deviceProfileId = new DeviceProfileId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java index 77fa31c028..5d4674ba1f 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/edge/EdgeEntityProcessor.java @@ -32,6 +32,7 @@ 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.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeMsgConstructorUtils; @@ -101,7 +102,7 @@ public class EdgeEntityProcessor extends BaseEdgeProcessor { } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { EdgeId edgeId = new EdgeId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { 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 a8844e7397..56785f9ac0 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 @@ -34,6 +34,7 @@ import org.thingsboard.server.common.data.msg.TbMsgType; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.EntityViewUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -106,7 +107,7 @@ public class EntityViewEdgeProcessor extends BaseEntityViewProcessor implements } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { EntityViewId entityViewId = new EntityViewId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED, ASSIGNED_TO_EDGE, ASSIGNED_TO_CUSTOMER, UNASSIGNED_FROM_CUSTOMER -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java index 77f97e0775..918ca024cd 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationRuleEdgeProcessor.java @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.id.NotificationRuleId; import org.thingsboard.server.common.data.notification.rule.NotificationRule; import org.thingsboard.server.dao.notification.NotificationRuleService; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.NotificationRuleUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -40,7 +41,7 @@ public class NotificationRuleEdgeProcessor extends BaseEdgeProcessor { private NotificationRuleService notificationRuleService; @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { NotificationRuleId notificationRuleId = new NotificationRuleId(edgeEvent.getEntityId()); DownlinkMsg downlinkMsg = null; switch (edgeEvent.getAction()) { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java index 5dfad971b0..0f95248c74 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTargetEdgeProcessor.java @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.id.NotificationTargetId; import org.thingsboard.server.common.data.notification.targets.NotificationTarget; import org.thingsboard.server.dao.notification.NotificationTargetService; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.NotificationTargetUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -40,7 +41,7 @@ public class NotificationTargetEdgeProcessor extends BaseEdgeProcessor { private NotificationTargetService notificationTargetService; @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { NotificationTargetId notificationTargetId = new NotificationTargetId(edgeEvent.getEntityId()); DownlinkMsg downlinkMsg = null; switch (edgeEvent.getAction()) { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java index b79f4ab4b8..f3ae939514 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/notification/NotificationTemplateEdgeProcessor.java @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.id.NotificationTemplateId; import org.thingsboard.server.common.data.notification.template.NotificationTemplate; import org.thingsboard.server.dao.notification.NotificationTemplateService; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.NotificationTemplateUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -40,7 +41,7 @@ public class NotificationTemplateEdgeProcessor extends BaseEdgeProcessor { private NotificationTemplateService notificationTemplateService; @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { NotificationTemplateId notificationTemplateId = new NotificationTemplateId(edgeEvent.getEntityId()); DownlinkMsg downlinkMsg = null; switch (edgeEvent.getAction()) { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java index 6b3d429a2f..07247d946c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/DomainEdgeProcessor.java @@ -26,6 +26,7 @@ import org.thingsboard.server.common.data.id.DomainId; import org.thingsboard.server.common.data.oauth2.OAuth2Client; import org.thingsboard.server.dao.domain.DomainService; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.OAuth2ClientUpdateMsg; import org.thingsboard.server.gen.edge.v1.OAuth2DomainUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; @@ -42,7 +43,7 @@ public class DomainEdgeProcessor extends BaseEdgeProcessor { private DomainService domainService; @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { DomainId domainId = new DomainId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java index 20bd5b3f7e..08b0405702 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/oauth2/OAuth2ClientEdgeProcessor.java @@ -23,6 +23,7 @@ import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.OAuth2ClientId; import org.thingsboard.server.common.data.oauth2.OAuth2Client; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.OAuth2ClientUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -35,7 +36,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class OAuth2ClientEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { OAuth2ClientId oAuth2ClientId = new OAuth2ClientId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java index b2080e8176..e22ed3bafa 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/ota/OtaPackageEdgeProcessor.java @@ -23,6 +23,7 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.OtaPackageId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.OtaPackageUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -35,7 +36,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class OtaPackageEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { OtaPackageId otaPackageId = new OtaPackageId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java index ebea0c8255..f5fcac3342 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/queue/QueueEdgeProcessor.java @@ -23,6 +23,7 @@ import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.QueueId; import org.thingsboard.server.common.data.queue.Queue; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.QueueUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -35,7 +36,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class QueueEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { QueueId queueId = new QueueId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java index da6f749269..70666e8b0e 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/relation/RelationEdgeProcessor.java @@ -21,7 +21,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.EdgeUtils; -import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.edge.Edge; import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventActionType; @@ -30,6 +29,7 @@ import org.thingsboard.server.common.data.id.EdgeId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.RelationUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.transport.TransportProtos; @@ -85,7 +85,7 @@ public class RelationEdgeProcessor extends BaseRelationProcessor implements Rela } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { EntityRelation entityRelation = JacksonUtil.convertValue(edgeEvent.getBody(), EntityRelation.class); UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); RelationUpdateMsg relationUpdateMsg = EdgeMsgConstructorUtils.constructRelationUpdatedMsg(msgType, entityRelation); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java index 8d2c06025a..de31bf6a9c 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/resource/ResourceEdgeProcessor.java @@ -29,6 +29,7 @@ import org.thingsboard.server.common.data.id.TbResourceId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.ResourceUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -73,7 +74,7 @@ public class ResourceEdgeProcessor extends BaseResourceProcessor implements Reso } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { TbResourceId tbResourceId = new TbResourceId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { 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 06fb4c37a2..b949660e70 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 @@ -33,6 +33,7 @@ import org.thingsboard.server.common.data.rule.RuleChainType; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.RuleChainUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; @@ -134,7 +135,7 @@ public class RuleChainEdgeProcessor extends BaseRuleChainProcessor { } @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { RuleChainId ruleChainId = new RuleChainId(edgeEvent.getEntityId()); DownlinkMsg downlinkMsg = null; switch (edgeEvent.getAction()) { @@ -161,7 +162,7 @@ public class RuleChainEdgeProcessor extends BaseRuleChainProcessor { RuleChainMetaData ruleChainMetaData = edgeCtx.getRuleChainService().loadRuleChainMetaData(edgeEvent.getTenantId(), ruleChainId); RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = EdgeMsgConstructorUtils - .constructRuleChainMetadataUpdatedMsg(msgType, ruleChainMetaData); + .constructRuleChainMetadataUpdatedMsg(msgType, ruleChainMetaData, edgeVersion); builder.addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg); downlinkMsg = builder.build(); } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java index fe9a66c456..845d2a7204 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/rule/RuleChainMetadataEdgeProcessor.java @@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -36,14 +37,14 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class RuleChainMetadataEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { RuleChainId ruleChainId = new RuleChainId(edgeEvent.getEntityId()); RuleChain ruleChain = edgeCtx.getRuleChainService().findRuleChainById(edgeEvent.getTenantId(), ruleChainId); if (ruleChain != null) { RuleChainMetaData ruleChainMetaData = edgeCtx.getRuleChainService().loadRuleChainMetaData(edgeEvent.getTenantId(), ruleChainId); UpdateMsgType msgType = getUpdateMsgType(edgeEvent.getAction()); RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = EdgeMsgConstructorUtils - .constructRuleChainMetadataUpdatedMsg(msgType, ruleChainMetaData); + .constructRuleChainMetadataUpdatedMsg(msgType, ruleChainMetaData, edgeVersion); return DownlinkMsg.newBuilder() .setDownlinkMsgId(EdgeUtils.nextPositiveInt()) .addRuleChainMetadataUpdateMsg(ruleChainMetadataUpdateMsg) 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 6028273dc2..f2f82fe9de 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 @@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.edge.EdgeEvent; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.gen.edge.v1.AdminSettingsUpdateMsg; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; @@ -33,7 +34,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class AdminSettingsEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { AdminSettings adminSettings = JacksonUtil.convertValue(edgeEvent.getBody(), AdminSettings.class); if (adminSettings == null) { return null; diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java index e21ed0b4ea..f0f41b5cc6 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/tenant/TenantEdgeProcessor.java @@ -25,6 +25,7 @@ import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.TenantUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; @@ -38,7 +39,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class TenantEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { TenantId tenantId = TenantId.fromUUID(edgeEvent.getEntityId()); if (EdgeEventActionType.UPDATED.equals(edgeEvent.getAction())) { Tenant tenant = edgeCtx.getTenantService().findTenantById(tenantId); 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 bcbeeb82b3..a0bb32503e 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 @@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.edge.EdgeEventActionType; import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.TenantProfileId; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.TenantProfileUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -36,7 +37,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class TenantProfileEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { TenantProfileId tenantProfileId = new TenantProfileId(edgeEvent.getEntityId()); if (EdgeEventActionType.UPDATED.equals(edgeEvent.getAction())) { TenantProfile tenantProfile = edgeCtx.getTenantProfileService().findTenantProfileById(edgeEvent.getTenantId(), tenantProfileId); 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 c8c0b49124..fdd03d63f3 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 @@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.security.UserCredentials; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +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 org.thingsboard.server.queue.util.TbCoreComponent; @@ -36,7 +37,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class UserEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { UserId userId = new UserId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java index 4c22ddf898..52d7370470 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetBundleEdgeProcessor.java @@ -23,6 +23,7 @@ import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.WidgetsBundleId; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -37,7 +38,7 @@ import java.util.List; public class WidgetBundleEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { WidgetsBundleId widgetsBundleId = new WidgetsBundleId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java index 4da508b22b..47f30afa93 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/processor/widget/WidgetTypeEdgeProcessor.java @@ -23,6 +23,7 @@ import org.thingsboard.server.common.data.edge.EdgeEventType; import org.thingsboard.server.common.data.id.WidgetTypeId; import org.thingsboard.server.common.data.widget.WidgetTypeDetails; import org.thingsboard.server.gen.edge.v1.DownlinkMsg; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -35,7 +36,7 @@ import org.thingsboard.server.service.edge.rpc.processor.BaseEdgeProcessor; public class WidgetTypeEdgeProcessor extends BaseEdgeProcessor { @Override - public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent) { + public DownlinkMsg convertEdgeEventToDownlink(EdgeEvent edgeEvent, EdgeVersion edgeVersion) { WidgetTypeId widgetTypeId = new WidgetTypeId(edgeEvent.getEntityId()); switch (edgeEvent.getAction()) { case ADDED, UPDATED -> { From ab4ed8fa7489c3225e18f6b5d56859b270fb7dbc Mon Sep 17 00:00:00 2001 From: yevhenii Date: Thu, 6 Mar 2025 18:14:15 +0200 Subject: [PATCH 009/286] Fix RuleChainMetadata for older Edge versions - refactoring --- .../server/service/edge/EdgeMsgConstructorUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 703d42abf5..e0974df8f8 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 @@ -115,6 +115,7 @@ import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; import org.thingsboard.server.gen.transport.TransportProtos; +import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; import java.util.List; import java.util.UUID; @@ -430,7 +431,7 @@ public class EdgeMsgConstructorUtils { } private static String prepareMetaDataForEdgeVersion(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { - if (edgeVersion == EdgeVersion.V_3_7_0 || edgeVersion == EdgeVersion.V_3_8_0) { + if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0)) { JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); JsonNode nodes = jsonNode.get("nodes"); From c4a629fc9b5c5227af17ee9bfdede0374c871673 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Fri, 7 Mar 2025 13:26:54 +0200 Subject: [PATCH 010/286] Fix RuleChainMetadata for older Edge versions - fixed EdgeVersion --- .../server/service/edge/EdgeMsgConstructorUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e0974df8f8..d3e8e3104e 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 @@ -431,7 +431,7 @@ public class EdgeMsgConstructorUtils { } private static String prepareMetaDataForEdgeVersion(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0)) { + if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0)) { JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); JsonNode nodes = jsonNode.get("nodes"); From 80a7edc8f784465765ba710d1ab201187133e5f4 Mon Sep 17 00:00:00 2001 From: yevhenii Date: Tue, 11 Mar 2025 17:58:27 +0200 Subject: [PATCH 011/286] Fix RuleChainMetadata for older Edge versions - added test - refactoring --- .../service/edge/EdgeMsgConstructorUtils.java | 16 ++-- .../edge/EdgeMsgConstructorUtilsTest.java | 91 +++++++++++++++++++ 2 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtilsTest.java 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 d3e8e3104e..11e3172168 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 @@ -422,7 +422,7 @@ public class EdgeMsgConstructorUtils { } public static RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(UpdateMsgType msgType, RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { - String metaData = prepareMetaDataForEdgeVersion(ruleChainMetaData, edgeVersion); + String metaData = filterMetadataForOldEdgeVersions(ruleChainMetaData, edgeVersion); return RuleChainMetadataUpdateMsg.newBuilder() .setMsgType(msgType) @@ -430,14 +430,15 @@ public class EdgeMsgConstructorUtils { .build(); } - private static String prepareMetaDataForEdgeVersion(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { + private static String filterMetadataForOldEdgeVersions(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0)) { JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); JsonNode nodes = jsonNode.get("nodes"); for (JsonNode node : nodes) { - if (node.isObject()) - prepareRuleNodeForOldEdgeVersion((ObjectNode) node); + if (node.isObject()) { + removeIncompatibleFields((ObjectNode) node); + } } return JacksonUtil.toString(jsonNode); } else { @@ -445,11 +446,10 @@ public class EdgeMsgConstructorUtils { } } - private static void prepareRuleNodeForOldEdgeVersion(ObjectNode node) { + private static void removeIncompatibleFields(ObjectNode node) { if (TbMsgTimeseriesNode.class.getName().equals(node.get("type").asText())) { - JsonNode configurationNode = node.get("configuration"); - if (configurationNode != null && configurationNode.isObject()) { - ((ObjectNode) configurationNode).remove("processingSettings"); + if (node.has("configuration") && node.get("configuration").isObject()) { + ((ObjectNode) node.get("configuration")).remove("processingSettings"); } } } 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 new file mode 100644 index 0000000000..5e7cfcfc28 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/edge/EdgeMsgConstructorUtilsTest.java @@ -0,0 +1,91 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.edge; + +import org.junit.Assert; +import org.junit.Test; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration; +import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.common.data.rule.RuleNode; +import org.thingsboard.server.gen.edge.v1.EdgeVersion; +import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; +import org.thingsboard.server.gen.edge.v1.UpdateMsgType; +import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; + +import java.util.Collections; + +public class EdgeMsgConstructorUtilsTest { + private static final int CONFIGURATION_VERSION = 5; + + @Test + public void testRuleChainMetadataUpdateMsgForAllEdgeVersions() { + // GIVEN + RuleChainMetaData metaData = createIncompatibleRuleNodesForOldEdge(); + + // WHEN + RuleNode ruleNode_V_4_0_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_4_0_0); + RuleNode ruleNode_V_3_9_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_3_9_0); + RuleNode ruleNode_V_3_8_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_3_8_0); + RuleNode ruleNode_V_3_7_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_3_7_0); + + // THEN + assertRuleNodeConfiguration(ruleNode_V_4_0_0, EdgeVersion.V_4_0_0); + assertRuleNodeConfiguration(ruleNode_V_3_9_0, EdgeVersion.V_3_9_0); + assertRuleNodeConfiguration(ruleNode_V_3_8_0, EdgeVersion.V_3_8_0); + assertRuleNodeConfiguration(ruleNode_V_3_7_0, EdgeVersion.V_3_7_0); + } + + private RuleChainMetaData createIncompatibleRuleNodesForOldEdge() { + RuleChainMetaData ruleChainMetaData = new RuleChainMetaData(); + + RuleNode ruleNode1 = new RuleNode(); + ruleNode1.setName("TbMsgTimeseriesNode"); + ruleNode1.setType(org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode.class.getName()); + ruleNode1.setConfigurationVersion(CONFIGURATION_VERSION); + ruleNode1.setConfiguration(JacksonUtil.valueToTree(new TbMsgTimeseriesNodeConfiguration().defaultConfiguration())); + + ruleChainMetaData.setFirstNodeIndex(0); + ruleChainMetaData.setNodes(Collections.singletonList(ruleNode1)); + + return ruleChainMetaData; + } + + + private RuleNode getRuleNodeFromMetadataUpdateMessage(RuleChainMetaData metaData, EdgeVersion edgeVersion) { + RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = + EdgeMsgConstructorUtils.constructRuleChainMetadataUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, metaData, edgeVersion); + + RuleChainMetaData ruleChainMetaData = JacksonUtil.fromString(ruleChainMetadataUpdateMsg.getEntity(), RuleChainMetaData.class, true); + Assert.assertNotNull("RuleChainMetaData is null", ruleChainMetaData); + + RuleNode ruleNode = ruleChainMetaData.getNodes().stream().findFirst().orElse(null); + Assert.assertNotNull("RuleNode is null for Edge version " + edgeVersion, ruleNode); + Assert.assertNotNull("Configuration is null for Edge version " + edgeVersion, ruleNode.getConfiguration()); + + return ruleNode; + } + + private void assertRuleNodeConfiguration(RuleNode ruleNode, EdgeVersion edgeVersion) { + if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0)) { + Assert.assertEquals("Unexpected config size", 2, ruleNode.getConfiguration().size()); + Assert.assertFalse("Unexpected field 'processingSettings'", ruleNode.getConfiguration().has("processingSettings")); + }else{ + Assert.assertEquals("Unexpected config size", 3, ruleNode.getConfiguration().size()); + Assert.assertTrue("Missing field 'processingSettings'", ruleNode.getConfiguration().has("processingSettings")); + } + } +} From 4e42f0a33fa8806e93393c19fbc5fe9838aed7ee Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 13 Mar 2025 17:53:21 +0200 Subject: [PATCH 012/286] Added md help files for REST connector --- .../en_US/widget/lib/gateway/rest-json_fn.md | 53 +++++++++++++++++++ .../en_US/widget/lib/gateway/rest-url_fn.md | 53 +++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md create mode 100644 ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md new file mode 100644 index 0000000000..9b3012c00d --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -0,0 +1,53 @@ +### JSON Path: + +The expression field is used to extract data from the HTTP response message. + +JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: + +- `$`: The root element of the JSON document; +- `.`: Child operator used to select child elements. For example, $.store.book ; +- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; + +### Examples: + +For example, if we want to extract the device name from the following message, we can use the expression below: + +HTTP response message: + +```json +{ + "sensorModelInfo": { + "sensorName": "AM-123", + "sensorType": "myDeviceType" + }, + "data": { + "temp": 12.2, + "hum": 56, + "status": "ok" + } +} +``` + +Expression: + +`${sensorModelInfo.sensorName}` + +Converted data: + +`AM-123` + +If we want to extract all data from the message above, we can use the following expression: + +`${data}` + +Converted data: + +`{"temp": 12.2, "hum": 56, "status": "ok"}` + +Or if we want to extract specific data (for example “temperature”), you can use the following expression: + +`${data.temp}` + +And as a converted data we will get: + +`12.2` diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md new file mode 100644 index 0000000000..eccb52b96e --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md @@ -0,0 +1,53 @@ +## Request URL expression + +JSONPath expression uses for creating url address to send a message. + +JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: + +- `$`: The root element of the JSON document; +- `.`: Child operator used to select child elements. For example, $.store.book ; +- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; + +### Examples: + +For example, if we want to extract the device name from the following message, we can use the expression below: + +HTTP response message: + +```json +{ + "sensorModelInfo": { + "sensorName": "AM-123", + "sensorType": "myDeviceType" + }, + "data": { + "temp": 12.2, + "hum": 56, + "status": "ok" + } +} +``` + +Expression: + +`${sensorModelInfo.sensorName}` + +Converted data: + +`AM-123` + +If we want to extract all data from the message above, we can use the following expression: + +`${data}` + +Converted data: + +`{"temp": 12.2, "hum": 56, "status": "ok"}` + +Or if we want to extract specific data (for example “temperature”), you can use the following expression: + +`${data.temp}` + +And as a converted data we will get: + +`12.2` From 52ea3712bc4e42da1e01114465fac90bbb7a1c11 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Mon, 17 Mar 2025 11:15:48 +0200 Subject: [PATCH 013/286] Hided alarms count on no alarms --- .../pages/device-profile/device-profile-tabs.component.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html index 46aa08ff9f..b9003c4c1c 100644 --- a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html +++ b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html @@ -45,9 +45,9 @@ + label="{{ this.detailsForm.get('profileData.alarms').value?.length + ? ('device-profile.alarm-rules-with-count' | translate: { count: this.detailsForm.get('profileData.alarms').value.length }) + : 'device-profile.alarm-rules' | translate }}">
From 91081d711c5e5f8647df12c706aa4d6bc0d4e15e Mon Sep 17 00:00:00 2001 From: mpetrov Date: Mon, 17 Mar 2025 17:01:46 +0200 Subject: [PATCH 014/286] Debug Configuration improvements --- ...entity-debug-settings-panel.component.html | 20 +++++++++---------- .../assets/locale/locale.constant-en_US.json | 9 ++++----- 2 files changed, 13 insertions(+), 16 deletions(-) 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 cf8c0ae14d..4a9bc57d8d 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 @@ -15,17 +15,15 @@ limitations under the License. --> -
+
debug-settings.label
-
-
- @if (debugLimitsConfiguration) { + @if (debugLimitsConfiguration) { +
+
{{ 'debug-settings.hint.main-limited' | translate: { entity: entityLabel ?? ('debug-settings.entity' | translate), msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true) } }} - } @else { - {{ 'debug-settings.hint.main' | translate }} - } +
-
+ }
@@ -33,12 +31,12 @@
- +
- {{ 'debug-settings.all-messages' | translate: { time: (isDebugAllActive$ | async) && !allEnabled ? (allEnabledUntil | durationLeft) : (maxDebugModeDuration | milliSecondsToTimeString: true : true) } }} + {{ 'debug-settings.all-messages' | translate: { time: (isDebugAllActive$ | async) && !allEnabled && debugAllControl.untouched ? (allEnabledUntil | durationLeft) : (maxDebugModeDuration | milliSecondsToTimeString: true : true) } }}
- } @case (widgetHeaderActionButtonType.basic) { @@ -123,46 +122,41 @@ (click)="action.onAction($event)" matTooltip="{{ action.displayName }}" matTooltipPosition="above"> - {{ action.icon }} - {{ action.displayName }} + {{ action.icon }} + {{ action.displayName }} } @case (widgetHeaderActionButtonType.raised) { } @case (widgetHeaderActionButtonType.stroked) { } @case (widgetHeaderActionButtonType.flat) { } @default { @@ -172,7 +166,7 @@ (click)="action.onAction($event)" matTooltip="{{ action.displayName }}" matTooltipPosition="above"> - {{ action.icon }} + {{ action.icon }} } } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index 404992e186..f8fa032c8c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -44,6 +44,7 @@ import { widgetActionSources, WidgetActionType, WidgetComparisonSettings, + WidgetHeaderActionButtonType, WidgetMobileActionDescriptor, WidgetMobileActionType, WidgetResource, @@ -301,10 +302,13 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, buttonType: descriptor.buttonType, showIcon: descriptor.showIcon, icon: descriptor.icon, - buttonColor: descriptor.buttonColor, - buttonFillColor: descriptor.buttonFillColor, - buttonBorderColor: descriptor.buttonBorderColor, - customButtonStyle: descriptor.customButtonStyle, + customButtonStyle: this.headerButtonStyle( + descriptor.buttonType, + descriptor.customButtonStyle, + descriptor.buttonColor, + descriptor.buttonFillColor, + descriptor.buttonBorderColor + ), descriptor, useShowWidgetHeaderActionFunction, showWidgetHeaderActionFunction, @@ -359,6 +363,39 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } } + headerButtonStyle(buttonType: WidgetHeaderActionButtonType = WidgetHeaderActionButtonType.icon, + customButtonStyle:{[key: string]: string}, + buttonColor: string = 'rgba(0,0,0,0.87)', + backgroundColor: string, + borderColor: string) { + const buttonStyle = {}; + switch (buttonType) { + case WidgetHeaderActionButtonType.basic: + buttonStyle['--mdc-text-button-label-text-color'] = buttonColor; + break; + case WidgetHeaderActionButtonType.raised: + buttonStyle['--mdc-protected-button-label-text-color'] = buttonColor; + buttonStyle['--mdc-protected-button-container-color'] = backgroundColor; + break; + case WidgetHeaderActionButtonType.stroked: + buttonStyle['--mdc-outlined-button-label-text-color'] = buttonColor; + buttonStyle['--mdc-outlined-button-outline-color'] = borderColor; + break; + case WidgetHeaderActionButtonType.flat: + buttonStyle['--mdc-filled-button-label-text-color'] = buttonColor; + buttonStyle['--mdc-filled-button-container-color'] = backgroundColor; + break; + case WidgetHeaderActionButtonType.miniFab: + buttonStyle['--mat-fab-small-foreground-color'] = buttonColor; + buttonStyle['--mdc-fab-small-container-color'] = backgroundColor; + break; + default: + buttonStyle['--mat-icon-color'] = buttonColor; + break; + } + return {...buttonStyle, ...customButtonStyle}; + } + ngOnChanges(changes: SimpleChanges): void { for (const propName of Object.keys(changes)) { const change = changes[propName]; diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts index 8a8724c116..11adb2f806 100644 --- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts @@ -132,7 +132,7 @@ export interface WidgetHeaderAction extends IWidgetAction { buttonColor?: string; buttonFillColor?: string; buttonBorderColor?: string; - customButtonStyle?: string; + customButtonStyle?: {[key: string]: string}; useShowWidgetHeaderActionFunction: boolean; showWidgetHeaderActionFunction: CompiledTbFunction; } diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts index 44e5ec9c1e..2300ae2341 100644 --- a/ui-ngx/src/app/shared/models/widget.models.ts +++ b/ui-ngx/src/app/shared/models/widget.models.ts @@ -780,7 +780,7 @@ export interface WidgetActionDescriptor extends WidgetAction { buttonColor?: string; buttonFillColor?: string; buttonBorderColor?: string; - customButtonStyle?: string; + customButtonStyle?: {[key: string]: string}; displayName?: string; useShowWidgetActionFunction?: boolean; showWidgetActionFunction?: TbFunction; From 4e51398cc401415619b084ee382465c61d85da80 Mon Sep 17 00:00:00 2001 From: yevhenii Date: Tue, 18 Mar 2025 12:24:14 +0200 Subject: [PATCH 016/286] Fix RuleChainMetadata for older Edge versions - added new problem node - added test - refactoring --- .../service/edge/EdgeMsgConstructorUtils.java | 49 ++++-- .../edge/EdgeMsgConstructorUtilsTest.java | 146 +++++++++++++----- 2 files changed, 149 insertions(+), 46 deletions(-) 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 11e3172168..61875f1277 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 @@ -25,6 +25,10 @@ import com.google.gson.JsonPrimitive; import com.google.gson.reflect.TypeToken; import lombok.extern.slf4j.Slf4j; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.action.TbSaveToCustomCassandraTableNode; +import org.thingsboard.rule.engine.aws.lambda.TbAwsLambdaNode; +import org.thingsboard.rule.engine.rest.TbSendRestApiCallReplyNode; +import org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode; import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode; import org.thingsboard.server.common.adaptor.JsonConverter; import org.thingsboard.server.common.data.Customer; @@ -117,11 +121,25 @@ import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.UUID; @Slf4j public class EdgeMsgConstructorUtils { + public static final Map NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION = Map.of( + TbMsgTimeseriesNode.class.getName(), "processingSettings", + TbMsgAttributesNode.class.getName(), "processingSettings", + TbSaveToCustomCassandraTableNode.class.getName(), "defaultTtl" + ); + + //added in edge version 3.8.0 + public static final Set MISSING_NODES_IN_VERSION_37 = Set.of( + TbSendRestApiCallReplyNode.class.getName(), + TbAwsLambdaNode.class.getName() + ); public static AlarmUpdateMsg constructAlarmUpdatedMsg(UpdateMsgType msgType, Alarm alarm) { return AlarmUpdateMsg.newBuilder().setMsgType(msgType) @@ -431,25 +449,36 @@ public class EdgeMsgConstructorUtils { } private static String filterMetadataForOldEdgeVersions(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0)) { - JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); - JsonNode nodes = jsonNode.get("nodes"); + JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); + JsonNode nodes = jsonNode.get("nodes"); + + if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0)) { + Iterator iterator = nodes.iterator(); + while (iterator.hasNext()) { + JsonNode node = iterator.next(); - for (JsonNode node : nodes) { - if (node.isObject()) { - removeIncompatibleFields((ObjectNode) node); + String type = node.get("type").asText(); + if (MISSING_NODES_IN_VERSION_37.contains(type)) { + iterator.remove(); } } + } + + if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0)) { + nodes.forEach(EdgeMsgConstructorUtils::changeRuleNodeConfigForOldEdgeVersion); + return JacksonUtil.toString(jsonNode); } else { return JacksonUtil.toString(ruleChainMetaData); } } - private static void removeIncompatibleFields(ObjectNode node) { - if (TbMsgTimeseriesNode.class.getName().equals(node.get("type").asText())) { - if (node.has("configuration") && node.get("configuration").isObject()) { - ((ObjectNode) node.get("configuration")).remove("processingSettings"); + private static void changeRuleNodeConfigForOldEdgeVersion(JsonNode node) { + if (node.isObject()) { + JsonNode configurationNode = node.get("configuration"); + if (configurationNode != null && configurationNode.isObject() && + NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION.containsKey(node.get("type").asText())) { + ((ObjectNode) configurationNode).remove(NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION.get(node.get("type").asText())); } } } 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 5e7cfcfc28..84ccfdb3ee 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 @@ -15,9 +15,20 @@ */ package org.thingsboard.server.service.edge; +import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.action.TbSaveToCustomCassandraTableNode; +import org.thingsboard.rule.engine.action.TbSaveToCustomCassandraTableNodeConfiguration; +import org.thingsboard.rule.engine.api.NodeConfiguration; +import org.thingsboard.rule.engine.aws.lambda.TbAwsLambdaNode; +import org.thingsboard.rule.engine.aws.lambda.TbAwsLambdaNodeConfiguration; +import org.thingsboard.rule.engine.rest.TbSendRestApiCallReplyNode; +import org.thingsboard.rule.engine.rest.TbSendRestApiCallReplyNodeConfiguration; +import org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode; +import org.thingsboard.rule.engine.telemetry.TbMsgAttributesNodeConfiguration; +import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode; import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration; import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.common.data.rule.RuleNode; @@ -26,66 +37,129 @@ import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; -import java.util.Collections; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.MISSING_NODES_IN_VERSION_37; +import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION; + +@Slf4j public class EdgeMsgConstructorUtilsTest { private static final int CONFIGURATION_VERSION = 5; + public static final List TEST_SUPPORTED_EDGE_VERSIONS = Arrays.asList( + EdgeVersion.V_4_0_0, EdgeVersion.V_3_9_0, EdgeVersion.V_3_8_0, EdgeVersion.V_3_7_0 + ); + + private static final Map CONFIG_TO_NODE_NAME = Map.of( + new TbMsgTimeseriesNodeConfiguration(), TbMsgTimeseriesNode.class.getName(), + new TbMsgAttributesNodeConfiguration(), TbMsgAttributesNode.class.getName(), + new TbSaveToCustomCassandraTableNodeConfiguration(), TbSaveToCustomCassandraTableNode.class.getName() + ); + + private static final Map NODE_TO_CONFIG_PARAMS_COUNT = Map.of( + TbMsgTimeseriesNode.class.getName(), 3, + TbMsgAttributesNode.class.getName(), 5, + TbSaveToCustomCassandraTableNode.class.getName(), 3 + ); + + private static final Map CONFIG_TO_MISS_NODE_FOR_OLD_EDGE = Map.of( + new TbSendRestApiCallReplyNodeConfiguration(), TbSendRestApiCallReplyNode.class.getName(), + new TbAwsLambdaNodeConfiguration(), TbAwsLambdaNode.class.getName() + ); + @Test - public void testRuleChainMetadataUpdateMsgForAllEdgeVersions() { + public void testRuleChainMetadataUpdateMsgForOldEdgeVersions() { // GIVEN - RuleChainMetaData metaData = createIncompatibleRuleNodesForOldEdge(); - - // WHEN - RuleNode ruleNode_V_4_0_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_4_0_0); - RuleNode ruleNode_V_3_9_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_3_9_0); - RuleNode ruleNode_V_3_8_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_3_8_0); - RuleNode ruleNode_V_3_7_0 = getRuleNodeFromMetadataUpdateMessage(metaData, EdgeVersion.V_3_7_0); - - // THEN - assertRuleNodeConfiguration(ruleNode_V_4_0_0, EdgeVersion.V_4_0_0); - assertRuleNodeConfiguration(ruleNode_V_3_9_0, EdgeVersion.V_3_9_0); - assertRuleNodeConfiguration(ruleNode_V_3_8_0, EdgeVersion.V_3_8_0); - assertRuleNodeConfiguration(ruleNode_V_3_7_0, EdgeVersion.V_3_7_0); + RuleChainMetaData metaData = createMetadataWithProblemNodes(CONFIG_TO_NODE_NAME); + + TEST_SUPPORTED_EDGE_VERSIONS.forEach(edgeVersion -> { + // WHEN + List ruleNodes = getRuleNodesFromUpdateMsg(metaData, edgeVersion); + + // THEN + validateRuleNodeConfig(ruleNodes, edgeVersion); + }); } - private RuleChainMetaData createIncompatibleRuleNodesForOldEdge() { + @Test + public void testRuleChainMetadataWithMissingNodeForOldEdgeVersions() { + // GIVEN + RuleChainMetaData metaData = createMetadataWithProblemNodes(CONFIG_TO_MISS_NODE_FOR_OLD_EDGE); + + TEST_SUPPORTED_EDGE_VERSIONS.forEach(edgeVersion -> { + // WHEN + List ruleNodes = getRuleNodesFromUpdateMsg(metaData, edgeVersion); + + // THEN + boolean isOldEdge = EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0); + + if (isOldEdge) { + Assert.assertTrue("Rule Node must be empty", ruleNodes.isEmpty()); + } else { + Assert.assertEquals(MISSING_NODES_IN_VERSION_37.size(), ruleNodes.size()); + } + }); + } + + private RuleChainMetaData createMetadataWithProblemNodes(Map nodeMap) { RuleChainMetaData ruleChainMetaData = new RuleChainMetaData(); + List ruleNodes = new ArrayList<>(); + + nodeMap.entrySet().forEach(configToNodeName -> { + RuleNode ruleNode = new RuleNode(); - RuleNode ruleNode1 = new RuleNode(); - ruleNode1.setName("TbMsgTimeseriesNode"); - ruleNode1.setType(org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode.class.getName()); - ruleNode1.setConfigurationVersion(CONFIGURATION_VERSION); - ruleNode1.setConfiguration(JacksonUtil.valueToTree(new TbMsgTimeseriesNodeConfiguration().defaultConfiguration())); + ruleNode.setName(configToNodeName.getValue()); + ruleNode.setType(configToNodeName.getValue()); + ruleNode.setConfigurationVersion(CONFIGURATION_VERSION); + ruleNode.setConfiguration(JacksonUtil.valueToTree(configToNodeName.getKey().defaultConfiguration())); + + ruleNodes.add(ruleNode); + }); ruleChainMetaData.setFirstNodeIndex(0); - ruleChainMetaData.setNodes(Collections.singletonList(ruleNode1)); + ruleChainMetaData.setNodes(ruleNodes); return ruleChainMetaData; } - - private RuleNode getRuleNodeFromMetadataUpdateMessage(RuleChainMetaData metaData, EdgeVersion edgeVersion) { + private List getRuleNodesFromUpdateMsg(RuleChainMetaData metaData, EdgeVersion edgeVersion) { RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = EdgeMsgConstructorUtils.constructRuleChainMetadataUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, metaData, edgeVersion); RuleChainMetaData ruleChainMetaData = JacksonUtil.fromString(ruleChainMetadataUpdateMsg.getEntity(), RuleChainMetaData.class, true); Assert.assertNotNull("RuleChainMetaData is null", ruleChainMetaData); - RuleNode ruleNode = ruleChainMetaData.getNodes().stream().findFirst().orElse(null); - Assert.assertNotNull("RuleNode is null for Edge version " + edgeVersion, ruleNode); - Assert.assertNotNull("Configuration is null for Edge version " + edgeVersion, ruleNode.getConfiguration()); + return ruleChainMetaData.getNodes(); + } - return ruleNode; + private void validateRuleNodeConfig(List ruleNodes, EdgeVersion edgeVersion) { + ruleNodes.forEach(ruleNode -> { + int ruleNodeConfigAmount = NODE_TO_CONFIG_PARAMS_COUNT.get(ruleNode.getName()); + + boolean isOldEdge = EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0); + int expectedConfigAmount = isOldEdge ? ruleNodeConfigAmount - 1 : ruleNodeConfigAmount; + boolean includeConfigParam = !isOldEdge; + + validateParams(ruleNode, expectedConfigAmount, includeConfigParam); + }); } - private void assertRuleNodeConfiguration(RuleNode ruleNode, EdgeVersion edgeVersion) { - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0)) { - Assert.assertEquals("Unexpected config size", 2, ruleNode.getConfiguration().size()); - Assert.assertFalse("Unexpected field 'processingSettings'", ruleNode.getConfiguration().has("processingSettings")); - }else{ - Assert.assertEquals("Unexpected config size", 3, ruleNode.getConfiguration().size()); - Assert.assertTrue("Missing field 'processingSettings'", ruleNode.getConfiguration().has("processingSettings")); - } + private void validateParams(RuleNode ruleNode, int expectedConfigAmount, boolean includeConfigParam) { + String ignoreConfigParam = NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION.get(ruleNode.getName()); + + Assert.assertEquals( + String.format("Expected %d config params for ruleNode '%s', but found %d", expectedConfigAmount, ruleNode.getName(), ruleNode.getConfiguration().size()), + expectedConfigAmount, ruleNode.getConfiguration().size() + ); + + boolean hasIgnoredField = ruleNode.getConfiguration().has(ignoreConfigParam); + Assert.assertEquals( + String.format("Field '%s' for ruleNode '%s' should %s be present", ignoreConfigParam, ruleNode.getName(), includeConfigParam ? "not" : ""), + includeConfigParam, hasIgnoredField + ); } + } From d6027bc5799a0f70081d73c45779cf84738a0915 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Tue, 18 Mar 2025 13:26:35 +0200 Subject: [PATCH 017/286] cf fixes --- .../CalculatedFieldManagerMessageProcessor.java | 9 +++++---- .../thingsboard/server/actors/tenant/TenantActor.java | 7 ++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index fc48e9ad3e..f8c17bf84b 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -56,7 +56,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import static org.thingsboard.server.utils.CalculatedFieldUtils.fromProto; - /** * @author Andrew Shvayka */ @@ -93,7 +92,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware } public void onFieldInitMsg(CalculatedFieldInitMsg msg) throws CalculatedFieldException { - log.info("[{}] Processing CF init message.", msg.getCf().getId()); + log.debug("[{}] Processing CF init message.", msg.getCf().getId()); var cf = msg.getCf(); var cfCtx = new CalculatedFieldCtx(cf, systemContext.getTbelInvokeService(), systemContext.getApiLimitService()); try { @@ -109,7 +108,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware } public void onLinkInitMsg(CalculatedFieldLinkInitMsg msg) { - log.info("[{}] Processing CF link init message for entity [{}].", msg.getLink().getCalculatedFieldId(), msg.getLink().getEntityId()); + log.debug("[{}] Processing CF link init message for entity [{}].", msg.getLink().getCalculatedFieldId(), msg.getLink().getEntityId()); var link = msg.getLink(); // We use copy on write lists to safely pass the reference to another actor for the iteration. // Alternative approach would be to use any list but avoid modifications to the list (change the complete map value instead) @@ -122,7 +121,9 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware var calculatedField = calculatedFields.get(cfId); if (calculatedField != null) { - msg.getState().setRequiredArguments(calculatedField.getArgNames()); + if (msg.getState() != null) { + msg.getState().setRequiredArguments(calculatedField.getArgNames()); + } log.debug("Pushing CF state restore msg to specific actor [{}]", msg.getId().entityId()); getOrCreateActor(msg.getId().entityId()).tell(msg); } else { diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index 846bde508d..49994eaa1f 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -28,6 +28,7 @@ import org.thingsboard.server.actors.TbEntityActorId; import org.thingsboard.server.actors.TbEntityTypeActorIdPredicate; import org.thingsboard.server.actors.TbStringActorId; import org.thingsboard.server.actors.calculatedField.CalculatedFieldManagerActorCreator; +import org.thingsboard.server.actors.calculatedField.CalculatedFieldStateRestoreMsg; import org.thingsboard.server.actors.device.DeviceActorCreator; import org.thingsboard.server.actors.ruleChain.RuleChainManagerActor; import org.thingsboard.server.actors.service.ContextBasedCreator; @@ -190,7 +191,11 @@ public class TenantActor extends RuleChainManagerActor { private void onToCalculatedFieldSystemActorMsg(ToCalculatedFieldSystemMsg msg, boolean priority) { if (cfActor == null) { - log.warn("[{}] CF Actor is not initialized.", tenantId); + if (msg instanceof CalculatedFieldStateRestoreMsg) { + log.warn("[{}] CF Actor is not initialized. ToCalculatedFieldSystemMsg: [{}]", tenantId, msg); + } else { + log.debug("[{}] CF Actor is not initialized. ToCalculatedFieldSystemMsg: [{}]", tenantId, msg); + } return; } if (priority) { From b758a1c7d02f0764df3f69321e67b7d5c72c17ed Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Tue, 18 Mar 2025 15:12:40 +0200 Subject: [PATCH 018/286] update coaps connectivity commands with downloading certificates --- .../src/main/resources/thingsboard.yml | 2 + .../DeviceConnectivityControllerTest.java | 91 +++++++++++-------- .../device/DeviceConnectivityServiceImpl.java | 39 +++++--- .../dao/util/DeviceConnectivityUtil.java | 30 +++++- 4 files changed, 107 insertions(+), 55 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 721d23b700..c61a993d56 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1419,6 +1419,8 @@ device: host: "${DEVICE_CONNECTIVITY_COAPS_HOST:}" # Port of coap transport service. If empty, the default port for coaps will be used. port: "${DEVICE_CONNECTIVITY_COAPS_PORT:5684}" + # Path to the COAP CA root certificate file + pem_cert_file: "${DEVICE_CONNECTIVITY_COAPS_CA_ROOT_CERT:cafile.pem}" # Edges parameters edges: diff --git a/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java index 04d71b890f..2a6c847591 100644 --- a/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java @@ -231,16 +231,19 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { credentials.getCredentialsId())); JsonNode linuxCoapCommands = commands.get(COAP); - assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST coap://localhost:5683/api/v1/%s/telemetry " + - "-t json -e \"{temperature:25}\"", credentials.getCredentialsId())); - assertThat(linuxCoapCommands.get(COAPS).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST coaps://localhost:5684/api/v1/%s/telemetry" + - " -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST " + + "-t \"application/json\" -e \"{temperature:25}\" coap://localhost:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); + + assertThat(linuxCoapCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST " + + "-R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://localhost:5684/api/v1/%s/telemetry", credentials.getCredentialsId())); JsonNode dockerCoapCommands = commands.get(COAP).get(DOCKER); assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway" + - " thingsboard/coap-clients coap-client -v 6 -m POST coap://host.docker.internal:5683/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://host.docker.internal:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); assertThat(dockerCoapCommands.get(COAPS).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway" + - " thingsboard/coap-clients coap-client-openssl -v 6 -m POST coaps://host.docker.internal:5684/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients " + + "/bin/sh -c \"curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download && " + + "coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://host.docker.internal:5684/api/v1/%s/telemetry\"", credentials.getCredentialsId())); } @Test @@ -376,16 +379,19 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { credentials.getCredentialsId())); JsonNode linuxCoapCommands = commands.get(COAP); - assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST coap://[::1]:5683/api/v1/%s/telemetry " + - "-t json -e \"{temperature:25}\"", credentials.getCredentialsId())); - assertThat(linuxCoapCommands.get(COAPS).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST coaps://[::1]:5684/api/v1/%s/telemetry" + - " -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST " + + "-t \"application/json\" -e \"{temperature:25}\" coap://[::1]:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAPS).get(0).asText()).isEqualTo("curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download"); + assertThat(linuxCoapCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST " + + "-R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://[::1]:5684/api/v1/%s/telemetry", credentials.getCredentialsId())); JsonNode dockerCoapCommands = commands.get(COAP).get(DOCKER); assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway" + - " thingsboard/coap-clients coap-client -v 6 -m POST coap://host.docker.internal:5683/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://host.docker.internal:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); assertThat(dockerCoapCommands.get(COAPS).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway" + - " thingsboard/coap-clients coap-client-openssl -v 6 -m POST coaps://host.docker.internal:5684/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients " + + "/bin/sh -c \"curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download && " + + "coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://host.docker.internal:5684/api/v1/%s/telemetry\"", credentials.getCredentialsId())); } @Test @@ -430,16 +436,19 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { credentials.getCredentialsId())); JsonNode linuxCoapCommands = commands.get(COAP); - assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST coap://[1:1:1:1:1:1:1:1]:5683/api/v1/%s/telemetry " + - "-t json -e \"{temperature:25}\"", credentials.getCredentialsId())); - assertThat(linuxCoapCommands.get(COAPS).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST coaps://[1:1:1:1:1:1:1:1]:5684/api/v1/%s/telemetry" + - " -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST " + + "-t \"application/json\" -e \"{temperature:25}\" coap://[1:1:1:1:1:1:1:1]:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAPS).get(0).asText()).isEqualTo("curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download"); + assertThat(linuxCoapCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + + " -t \"application/json\" -e \"{temperature:25}\" coaps://[1:1:1:1:1:1:1:1]:5684/api/v1/%s/telemetry", credentials.getCredentialsId())); JsonNode dockerCoapCommands = commands.get(COAP).get(DOCKER); assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it" + - " thingsboard/coap-clients coap-client -v 6 -m POST coap://[1:1:1:1:1:1:1:1]:5683/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://[1:1:1:1:1:1:1:1]:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); assertThat(dockerCoapCommands.get(COAPS).asText()).isEqualTo(String.format("docker run --rm -it" + - " thingsboard/coap-clients coap-client-openssl -v 6 -m POST coaps://[1:1:1:1:1:1:1:1]:5684/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients " + + "/bin/sh -c \"curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download && " + + "coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://[1:1:1:1:1:1:1:1]:5684/api/v1/%s/telemetry\"", credentials.getCredentialsId())); } @@ -552,9 +561,10 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { assertThat(commands).hasSize(1); JsonNode linuxCommands = commands.get(COAP); - assertThat(linuxCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST coap://localhost:5683/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", + assertThat(linuxCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://localhost:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); - assertThat(linuxCommands.get(COAPS).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST coaps://localhost:5684/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", + assertThat(linuxCommands.get(COAPS).get(0).asText()).isEqualTo("curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download"); + assertThat(linuxCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://localhost:5684/api/v1/%s/telemetry", credentials.getCredentialsId())); } @@ -772,16 +782,18 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { "mosquitto_pub -d -q 1 --cafile " + CA_ROOT_CERT_PEM + " -h host.docker.internal -t v1/devices/me/telemetry -u \"%s\" -m \"{temperature:25}\"\"", credentials.getCredentialsId())); JsonNode linuxCoapCommands = commands.get(COAP); - assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST coap://localhost/api/v1/%s/telemetry " + - "-t json -e \"{temperature:25}\"", credentials.getCredentialsId())); - assertThat(linuxCoapCommands.get(COAPS).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST coaps://localhost/api/v1/%s/telemetry" + - " -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST " + + "-t \"application/json\" -e \"{temperature:25}\" coap://localhost/api/v1/%s/telemetry", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAPS).get(0).asText()).isEqualTo("curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download"); + assertThat(linuxCoapCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST " + + "-R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://localhost/api/v1/%s/telemetry", credentials.getCredentialsId())); JsonNode dockerCoapCommands = commands.get(COAP).get(DOCKER); assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway" + - " thingsboard/coap-clients coap-client -v 6 -m POST coap://host.docker.internal/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://host.docker.internal/api/v1/%s/telemetry", credentials.getCredentialsId())); assertThat(dockerCoapCommands.get(COAPS).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway" + - " thingsboard/coap-clients coap-client-openssl -v 6 -m POST coaps://host.docker.internal/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + " thingsboard/coap-clients /bin/sh -c \"curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download && " + + "coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://host.docker.internal/api/v1/%s/telemetry\"", credentials.getCredentialsId())); } @Test @@ -831,16 +843,18 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { credentials.getCredentialsId())); JsonNode linuxCoapCommands = commands.get(COAP); - assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST coap://test.domain:5683/api/v1/%s/telemetry " + - "-t json -e \"{temperature:25}\"", credentials.getCredentialsId())); - assertThat(linuxCoapCommands.get(COAPS).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST coaps://test.domain:5684/api/v1/%s/telemetry" + - " -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST " + + "-t \"application/json\" -e \"{temperature:25}\" coap://test.domain:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); + assertThat(linuxCoapCommands.get(COAPS).get(0).asText()).isEqualTo("curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download"); + assertThat(linuxCoapCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST " + + "-R "+ CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://test.domain:5684/api/v1/%s/telemetry", credentials.getCredentialsId())); JsonNode dockerCoapCommands = commands.get(COAP).get(DOCKER); assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it " + - "thingsboard/coap-clients coap-client -v 6 -m POST coap://test.domain:5683/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + "thingsboard/coap-clients coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://test.domain:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); assertThat(dockerCoapCommands.get(COAPS).asText()).isEqualTo(String.format("docker run --rm -it " + - "thingsboard/coap-clients coap-client-openssl -v 6 -m POST coaps://test.domain:5684/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + "thingsboard/coap-clients /bin/sh -c \"curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download && " + + "coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://test.domain:5684/api/v1/%s/telemetry\"", credentials.getCredentialsId())); } @Test @@ -917,12 +931,17 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { assertThat(dockerMqttCommands.get(MQTTS).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway thingsboard/mosquitto-clients /bin/sh -c \"curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/mqtts/certificate/download && mosquitto_pub -d -q 1 --cafile " + CA_ROOT_CERT_PEM + " -h host.docker.internal -t v1/devices/me/telemetry -u \"%s\" -m \"{temperature:25}\"\"", credentials.getCredentialsId())); JsonNode coapCommands = commands.get(COAP); - assertThat(coapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST coap://localhost/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); - assertThat(coapCommands.get(COAPS).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST coaps://localhost/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + assertThat(coapCommands.get(COAP).asText()).isEqualTo(String.format("coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://localhost/api/v1/%s/telemetry", credentials.getCredentialsId())); + assertThat(coapCommands.get(COAPS).get(0).asText()).isEqualTo("curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download"); + assertThat(coapCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST " + + "-R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://localhost/api/v1/%s/telemetry", credentials.getCredentialsId())); JsonNode dockerCoapCommands = coapCommands.get(DOCKER); - assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway thingsboard/coap-clients coap-client -v 6 -m POST coap://host.docker.internal/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); - assertThat(dockerCoapCommands.get(COAPS).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway thingsboard/coap-clients coap-client-openssl -v 6 -m POST coaps://host.docker.internal/api/v1/%s/telemetry -t json -e \"{temperature:25}\"", credentials.getCredentialsId())); + assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway " + + "thingsboard/coap-clients coap-client -v 6 -m POST -t \"application/json\" -e \"{temperature:25}\" coap://host.docker.internal/api/v1/%s/telemetry", credentials.getCredentialsId())); + assertThat(dockerCoapCommands.get(COAPS).asText()).isEqualTo(String.format("docker run --rm -it --add-host=host.docker.internal:host-gateway " + + "thingsboard/coap-clients /bin/sh -c \"curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download && " + + "coap-client-openssl -v 6 -m POST -R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://host.docker.internal/api/v1/%s/telemetry\"", credentials.getCredentialsId())); } 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 b7f350ba72..d05d2fbb09 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 @@ -41,6 +41,7 @@ import org.thingsboard.server.common.data.security.DeviceCredentialsType; import org.thingsboard.server.dao.settings.AdminSettingsService; import org.thingsboard.server.dao.util.DeviceConnectivityUtil; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URISyntaxException; @@ -83,6 +84,8 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService @Value("${device.connectivity.mqtts.pem_cert_file:}") private String mqttsPemCertFile; + @Value("${device.connectivity.coaps.pem_cert_file:}") + private String coapsPemCertFile; @Override public JsonNode findDevicePublishTelemetryCommands(String baseUrl, Device device) throws URISyntaxException { @@ -133,22 +136,19 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService public Resource getPemCertFile(String protocol) { return certs.computeIfAbsent(protocol, key -> { DeviceConnectivityInfo connectivity = getConnectivity(protocol); - if (!MQTTS.equals(protocol) || connectivity == null) { + if (connectivity == null) { log.warn("Unknown connectivity protocol: {}", protocol); return null; } - if (StringUtils.isNotBlank(mqttsPemCertFile) && ResourceUtils.resourceExists(this, mqttsPemCertFile)) { - try { - return getCert(mqttsPemCertFile); - } catch (Exception e) { - String msg = String.format("Failed to read %s server certificate!", protocol); - log.warn(msg); - throw new RuntimeException(msg, e); + return switch (protocol) { + case COAPS -> getCert(coapsPemCertFile); + case MQTTS -> getCert(mqttsPemCertFile); + default -> { + log.warn("Unsupported secure protocol: {}", protocol); + yield null; } - } else { - return null; - } + }; }); } @@ -174,7 +174,11 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService return info != null && info.isEnabled(); } - private Resource getCert(String path) throws Exception { + private Resource getCert(String path) { + if (StringUtils.isBlank(path) || !ResourceUtils.resourceExists(this, path)) { + return null; + } + StringBuilder pemContentBuilder = new StringBuilder(); try (InputStream inStream = ResourceUtils.getInputStream(this, path); @@ -197,6 +201,10 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService pemContentBuilder.append("-----END CERTIFICATE-----\n"); } } + } catch (IOException e) { + String msg = String.format("Failed to read %s server certificate!", path); + log.warn(msg); + throw new RuntimeException(msg, e); } return new ByteArrayResource(pemContentBuilder.toString().getBytes(StandardCharsets.UTF_8)); @@ -311,8 +319,11 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService } if (isEnabled(COAPS)) { + ArrayNode coapsCommands = coapCommands.putArray(COAPS); + Optional.ofNullable(DeviceConnectivityUtil.getCurlPemCertCommand(baseUrl, COAPS)) + .ifPresent(coapsCommands::add); Optional.ofNullable(getCoapPublishCommand(COAPS, baseUrl, deviceCredentials)) - .ifPresent(v -> coapCommands.put(COAPS, v)); + .ifPresent(coapsCommands::add); Optional.ofNullable(getDockerCoapPublishCommand(COAPS, baseUrl, deviceCredentials)) .ifPresent(v -> dockerCoapCommands.put(COAPS, v)); @@ -336,7 +347,7 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService DeviceConnectivityInfo properties = getConnectivity(protocol); String host = getHost(baseUrl, properties, protocol); String port = StringUtils.isBlank(properties.getPort()) ? "" : ":" + properties.getPort(); - return DeviceConnectivityUtil.getDockerCoapPublishCommand(protocol, host, port, deviceCredentials); + return DeviceConnectivityUtil.getDockerCoapPublishCommand(protocol, baseUrl, host, port, deviceCredentials); } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java b/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java index 7a0c122186..b9b707f0d1 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java +++ b/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java @@ -199,19 +199,39 @@ public class DeviceConnectivityUtil { switch (deviceCredentials.getCredentialsType()) { case ACCESS_TOKEN: String client = COAPS.equals(protocol) ? "coap-client-openssl" : "coap-client"; - return String.format("%s -v 6 -m POST %s://%s%s/api/v1/%s/telemetry -t json -e %s", - client, protocol, host, port, deviceCredentials.getCredentialsId(), JSON_EXAMPLE_PAYLOAD); + String certificate = COAPS.equals(protocol) ? " -R " + CA_ROOT_CERT_PEM : ""; + return String.format("%s -v 6 -m POST%s -t \"application/json\" -e %s %s://%s%s/api/v1/%s/telemetry", + client, certificate, JSON_EXAMPLE_PAYLOAD, protocol, host, port, deviceCredentials.getCredentialsId()); default: return null; } } - public static String getDockerCoapPublishCommand(String protocol, String host, String port, DeviceCredentials deviceCredentials) { + public static String getDockerCoapPublishCommand(String protocol, String baseUrl, String host, String port, DeviceCredentials deviceCredentials) { String coapCommand = getCoapPublishCommand(protocol, host, port, deviceCredentials); - if (coapCommand != null && isLocalhost(host)) { + + if (coapCommand == null) { + return null; + } + + StringBuilder mqttDockerCommand = new StringBuilder(); + mqttDockerCommand.append(DOCKER_RUN).append(isLocalhost(host) ? ADD_DOCKER_INTERNAL_HOST : "").append(COAP_IMAGE); + + if (isLocalhost(host)) { coapCommand = coapCommand.replace(host, HOST_DOCKER_INTERNAL); } - return coapCommand != null ? String.format("%s%s%s", DOCKER_RUN + (isLocalhost(host) ? ADD_DOCKER_INTERNAL_HOST : ""), COAP_IMAGE, coapCommand) : null; + + if (COAPS.equals(protocol)) { + mqttDockerCommand.append("/bin/sh -c \"") + .append(getCurlPemCertCommand(baseUrl, protocol)) + .append(" && ") + .append(coapCommand) + .append("\""); + } else { + mqttDockerCommand.append(coapCommand); + } + + return mqttDockerCommand.toString(); } public static String getHost(String baseUrl, DeviceConnectivityInfo properties, String protocol) throws URISyntaxException { From 5a5d1e2710c4115e8be82ccf18d2dc979d6842c3 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Tue, 18 Mar 2025 15:43:14 +0200 Subject: [PATCH 019/286] added implementation for cf notification producer --- .../server/queue/provider/TbRuleEngineProducerProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java index dcadf02d02..d3b507910a 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java @@ -50,6 +50,7 @@ public class TbRuleEngineProducerProvider implements TbQueueProducerProvider { private TbQueueProducer> toEdgeNotifications; private TbQueueProducer> toEdgeEvents; private TbQueueProducer> toCalculatedFields; + private TbQueueProducer> toCalculatedFieldNotifications; public TbRuleEngineProducerProvider(TbRuleEngineQueueFactory tbQueueProvider) { this.tbQueueProvider = tbQueueProvider; @@ -132,7 +133,7 @@ public class TbRuleEngineProducerProvider implements TbQueueProducerProvider { @Override public TbQueueProducer> getCalculatedFieldsNotificationsMsgProducer() { - throw new RuntimeException("Not Implemented! Should not be used by Rule Engine Service!"); + return toCalculatedFieldNotifications; } } From 6ce095d3d762d812570abc568cb549971c7e0c69 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Tue, 18 Mar 2025 18:15:34 +0200 Subject: [PATCH 020/286] fixed edqs sync --- .../server/controller/EdqsControllerTest.java | 117 ++++++++++++++++++ .../server/edqs/util/VersionsStore.java | 8 +- 2 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java diff --git a/application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java new file mode 100644 index 0000000000..ff98fedf5b --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java @@ -0,0 +1,117 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.server.common.data.AttributeScope; +import org.thingsboard.server.common.data.Device; +import org.thingsboard.server.common.data.edqs.EdqsSyncRequest; +import org.thingsboard.server.common.data.edqs.ToCoreEdqsRequest; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.kv.AttributeKvEntry; +import org.thingsboard.server.common.data.query.DeviceTypeFilter; +import org.thingsboard.server.common.data.query.EntityDataPageLink; +import org.thingsboard.server.common.data.query.EntityDataQuery; +import org.thingsboard.server.common.data.query.EntityKey; +import org.thingsboard.server.common.data.query.EntityKeyType; +import org.thingsboard.server.common.data.query.EntityKeyValueType; +import org.thingsboard.server.common.data.query.FilterPredicateValue; +import org.thingsboard.server.common.data.query.KeyFilter; +import org.thingsboard.server.common.data.query.StringFilterPredicate; +import org.thingsboard.server.dao.service.DaoSqlTest; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + +import static org.awaitility.Awaitility.await; + +@DaoSqlTest +public class EdqsControllerTest extends EdqsEntityQueryControllerTest { + + @Autowired + private JdbcTemplate jdbcTemplate; + + @Before + public void beforeEdqsControllerTest() throws Exception { + loginTenantAdmin(); + } + + @Test + public void testEdqsSync() throws Exception { + List devices = new ArrayList<>(); + for (int i = 0; i < 3; i++) { + Device device = new Device(); + device.setName("Device" + i); + device.setType("default"); + device.setLabel("testLabel" + (int) (Math.random() * 1000)); + ObjectNode additionalInfo = JacksonUtil.newObjectNode(); + additionalInfo.put("gateway", true); + device.setAdditionalInfo(additionalInfo); + devices.add(doPost("/api/device", device, Device.class)); + Thread.sleep(1); + } + + DeviceTypeFilter filter = new DeviceTypeFilter(); + filter.setDeviceTypes(List.of("default")); + filter.setDeviceNameFilter(""); + + List entityFields = Collections.singletonList(new EntityKey(EntityKeyType.ENTITY_FIELD, "name")); + + EntityDataPageLink pageLink = new EntityDataPageLink(10, 0, null, null); + EntityDataQuery query = new EntityDataQuery(filter, pageLink, entityFields, null, Collections.singletonList(getGatewayFilter())); + findByQueryAndCheck(query, 3); + + // update db + Device device1 = devices.get(0); + device1.setAdditionalInfo(JacksonUtil.newObjectNode()); + jdbcTemplate.execute("update device set additional_info = '{}' where id = '" + device1.getId().getId().toString() + "'"); + + // do edqs sync + loginSysAdmin(); + ToCoreEdqsRequest syncRequest = new ToCoreEdqsRequest(new EdqsSyncRequest(), null); + doPost("/api/edqs/system/request", syncRequest); + + //check sync is finished + await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> { + Optional attribute = attributesService.find(TenantId.SYS_TENANT_ID, TenantId.SYS_TENANT_ID, AttributeScope.SERVER_SCOPE, "edqsSyncState").get(); + return attribute.isPresent() && attribute.get().getJsonValue().isPresent() && + attribute.get().getJsonValue().get().contains("\"status\":\"FINISHED\""); + }); + + // check if the count is updated + loginTenantAdmin(); + findByQueryAndCheck(query, 2); + } + + private KeyFilter getGatewayFilter() { + KeyFilter additionalInfoFilter = new KeyFilter(); + additionalInfoFilter.setKey(new EntityKey(EntityKeyType.ENTITY_FIELD, "additionalInfo")); + additionalInfoFilter.setValueType(EntityKeyValueType.STRING); + StringFilterPredicate predicate = new StringFilterPredicate(); + predicate.setValue(FilterPredicateValue.fromString("\"gateway\":true")); + predicate.setOperation(StringFilterPredicate.StringOperation.CONTAINS); + additionalInfoFilter.setPredicate(predicate); + return additionalInfoFilter; + } +} diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/VersionsStore.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/VersionsStore.java index e52b1bbac9..798ac0603d 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/VersionsStore.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/VersionsStore.java @@ -26,19 +26,17 @@ import java.util.concurrent.atomic.AtomicBoolean; public class VersionsStore { private final Cache versions = Caffeine.newBuilder() - .expireAfterWrite(1, TimeUnit.HOURS) + .expireAfterWrite(24, TimeUnit.HOURS) .build(); public boolean isNew(String key, Long version) { AtomicBoolean isNew = new AtomicBoolean(false); versions.asMap().compute(key, (k, prevVersion) -> { - if (prevVersion == null || prevVersion < version) { + if (prevVersion == null || prevVersion <= version) { isNew.set(true); return version; } else { - if (version < prevVersion) { - log.info("[{}] Version {} is outdated, the latest is {}", key, version, prevVersion); - } + log.info("[{}] Version {} is outdated, the latest is {}", key, version, prevVersion); return prevVersion; } }); From 3061cc17bb18e73746ece4959d0a12e1de402c6d Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 18 Mar 2025 18:21:12 +0200 Subject: [PATCH 021/286] Updated md files --- .../en_US/widget/lib/gateway/rest-json_fn.md | 15 ++++++++------- .../en_US/widget/lib/gateway/rest-url_fn.md | 17 +++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md index 9b3012c00d..14e0a86d6a 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -1,6 +1,7 @@ -### JSON Path: +### Expressions +#### JSON Path -The expression field is used to extract data from the HTTP response message. +The expression field is used to specify the path for extracting data from an HTTP response message. JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: @@ -8,7 +9,7 @@ JSONPath expressions specify the items within a JSON structure (which could be a - `.`: Child operator used to select child elements. For example, $.store.book ; - `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; -### Examples: +#### Examples For example, if we want to extract the device name from the following message, we can use the expression below: @@ -28,7 +29,7 @@ HTTP response message: } ``` -Expression: +JSON Path Expression `${sensorModelInfo.sensorName}` @@ -36,7 +37,7 @@ Converted data: `AM-123` -If we want to extract all data from the message above, we can use the following expression: +For extracting all data from the message above, use: `${data}` @@ -44,10 +45,10 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -Or if we want to extract specific data (for example “temperature”), you can use the following expression: +For extracting a specific value, such as the temperature, use: `${data.temp}` -And as a converted data we will get: +Converted data: `12.2` diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md index eccb52b96e..33ff4e6172 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md @@ -1,14 +1,15 @@ -## Request URL expression +### Expressions +#### Request URL -JSONPath expression uses for creating url address to send a message. +JSONPath expressions are used to construct URL addresses for sending messages. -JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: +JSONPath expressions specify items within a JSON structure (objects, arrays, or a nested combination) that you wish to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: - `$`: The root element of the JSON document; - `.`: Child operator used to select child elements. For example, $.store.book ; - `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; -### Examples: +#### Examples For example, if we want to extract the device name from the following message, we can use the expression below: @@ -28,7 +29,7 @@ HTTP response message: } ``` -Expression: +Url Expression: `${sensorModelInfo.sensorName}` @@ -36,7 +37,7 @@ Converted data: `AM-123` -If we want to extract all data from the message above, we can use the following expression: +For extracting all data from the message above, use: `${data}` @@ -44,10 +45,10 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -Or if we want to extract specific data (for example “temperature”), you can use the following expression: +For extracting specific data (e.g., "temperature"), use: `${data.temp}` -And as a converted data we will get: +Converted data: `12.2` From 9ff052e9c06bf3f33ad328382ec27a9838e259ea Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 18 Mar 2025 18:25:51 +0200 Subject: [PATCH 022/286] Updated md files --- .../src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md | 4 ++-- .../src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md index 14e0a86d6a..fe41a2c610 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -37,7 +37,7 @@ Converted data: `AM-123` -For extracting all data from the message above, use: +To extract all data from the message above, use: `${data}` @@ -45,7 +45,7 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -For extracting a specific value, such as the temperature, use: +To extract a specific value, such as the temperature, use: `${data.temp}` diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md index 33ff4e6172..a30deb6203 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md @@ -37,7 +37,7 @@ Converted data: `AM-123` -For extracting all data from the message above, use: +To extract all data from the message above, use: `${data}` @@ -45,7 +45,7 @@ Converted data: `{"temp": 12.2, "hum": 56, "status": "ok"}` -For extracting specific data (e.g., "temperature"), use: +To extract specific data (e.g., "temperature"), use: `${data.temp}` From 487d3849b4c07cc1f9e2eb9f2869ae9464b39a6e Mon Sep 17 00:00:00 2001 From: yevhenii Date: Tue, 18 Mar 2025 19:27:57 +0200 Subject: [PATCH 023/286] Fix RuleChainMetadata for older Edge versions - refactoring --- .../service/edge/EdgeMsgConstructorUtils.java | 14 +++--- .../edge/rpc/utils/EdgeVersionUtils.java | 9 ++++ .../edge/EdgeMsgConstructorUtilsTest.java | 45 +++++++++---------- 3 files changed, 38 insertions(+), 30 deletions(-) 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 61875f1277..85471f6211 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 @@ -129,7 +129,7 @@ import java.util.UUID; @Slf4j public class EdgeMsgConstructorUtils { - public static final Map NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION = Map.of( + public static final Map NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION = Map.of( TbMsgTimeseriesNode.class.getName(), "processingSettings", TbMsgAttributesNode.class.getName(), "processingSettings", TbSaveToCustomCassandraTableNode.class.getName(), "defaultTtl" @@ -452,7 +452,7 @@ public class EdgeMsgConstructorUtils { JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); JsonNode nodes = jsonNode.get("nodes"); - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0)) { + if (EdgeVersionUtils.isEdgeOlderThan_3_8_0(edgeVersion)) { Iterator iterator = nodes.iterator(); while (iterator.hasNext()) { JsonNode node = iterator.next(); @@ -464,7 +464,7 @@ public class EdgeMsgConstructorUtils { } } - if (EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0)) { + if (EdgeVersionUtils.isEdgeOlderThan_3_9_0(edgeVersion)) { nodes.forEach(EdgeMsgConstructorUtils::changeRuleNodeConfigForOldEdgeVersion); return JacksonUtil.toString(jsonNode); @@ -475,10 +475,10 @@ public class EdgeMsgConstructorUtils { private static void changeRuleNodeConfigForOldEdgeVersion(JsonNode node) { if (node.isObject()) { - JsonNode configurationNode = node.get("configuration"); - if (configurationNode != null && configurationNode.isObject() && - NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION.containsKey(node.get("type").asText())) { - ((ObjectNode) configurationNode).remove(NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION.get(node.get("type").asText())); + String nodeType = node.get("type").asText(); + + if (node.isObject() && node.has("configuration") && NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION.containsKey(nodeType)) { + ((ObjectNode) node.get("configuration")).remove(NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION.get(nodeType)); } } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java index 07e2024e1f..2ae6e91f34 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java @@ -24,4 +24,13 @@ public final class EdgeVersionUtils { public static boolean isEdgeVersionOlderThan(EdgeVersion currentVersion, EdgeVersion requiredVersion) { return currentVersion.ordinal() < requiredVersion.ordinal(); } + + public static boolean isEdgeOlderThan_3_9_0(EdgeVersion currentVersion) { + return isEdgeVersionOlderThan(currentVersion, EdgeVersion.V_3_9_0); + } + + public static boolean isEdgeOlderThan_3_8_0(EdgeVersion currentVersion) { + return isEdgeVersionOlderThan(currentVersion, EdgeVersion.V_3_8_0); + } + } 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 84ccfdb3ee..937a6709c5 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 @@ -33,7 +33,6 @@ import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNodeConfiguration; import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.common.data.rule.RuleNode; import org.thingsboard.server.gen.edge.v1.EdgeVersion; -import org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; @@ -43,13 +42,13 @@ import java.util.List; import java.util.Map; import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.MISSING_NODES_IN_VERSION_37; -import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION; +import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION; @Slf4j public class EdgeMsgConstructorUtilsTest { private static final int CONFIGURATION_VERSION = 5; - public static final List TEST_SUPPORTED_EDGE_VERSIONS = Arrays.asList( + public static final List SUPPORTED_EDGE_VERSIONS_FOR_TESTS = Arrays.asList( EdgeVersion.V_4_0_0, EdgeVersion.V_3_9_0, EdgeVersion.V_3_8_0, EdgeVersion.V_3_7_0 ); @@ -75,12 +74,12 @@ public class EdgeMsgConstructorUtilsTest { // GIVEN RuleChainMetaData metaData = createMetadataWithProblemNodes(CONFIG_TO_NODE_NAME); - TEST_SUPPORTED_EDGE_VERSIONS.forEach(edgeVersion -> { + SUPPORTED_EDGE_VERSIONS_FOR_TESTS.forEach(edgeVersion -> { // WHEN - List ruleNodes = getRuleNodesFromUpdateMsg(metaData, edgeVersion); + List ruleNodes = extractRuleNodesFromUpdateMsg(metaData, edgeVersion); // THEN - validateRuleNodeConfig(ruleNodes, edgeVersion); + assertRuleNodeConfig(ruleNodes, edgeVersion); }); } @@ -89,12 +88,12 @@ public class EdgeMsgConstructorUtilsTest { // GIVEN RuleChainMetaData metaData = createMetadataWithProblemNodes(CONFIG_TO_MISS_NODE_FOR_OLD_EDGE); - TEST_SUPPORTED_EDGE_VERSIONS.forEach(edgeVersion -> { + SUPPORTED_EDGE_VERSIONS_FOR_TESTS.forEach(edgeVersion -> { // WHEN - List ruleNodes = getRuleNodesFromUpdateMsg(metaData, edgeVersion); + List ruleNodes = extractRuleNodesFromUpdateMsg(metaData, edgeVersion); // THEN - boolean isOldEdge = EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_8_0); + boolean isOldEdge = EdgeVersionUtils.isEdgeOlderThan_3_8_0(edgeVersion); if (isOldEdge) { Assert.assertTrue("Rule Node must be empty", ruleNodes.isEmpty()); @@ -108,13 +107,13 @@ public class EdgeMsgConstructorUtilsTest { RuleChainMetaData ruleChainMetaData = new RuleChainMetaData(); List ruleNodes = new ArrayList<>(); - nodeMap.entrySet().forEach(configToNodeName -> { + nodeMap.forEach((key, value) -> { RuleNode ruleNode = new RuleNode(); - ruleNode.setName(configToNodeName.getValue()); - ruleNode.setType(configToNodeName.getValue()); + ruleNode.setName(value); + ruleNode.setType(value); ruleNode.setConfigurationVersion(CONFIGURATION_VERSION); - ruleNode.setConfiguration(JacksonUtil.valueToTree(configToNodeName.getKey().defaultConfiguration())); + ruleNode.setConfiguration(JacksonUtil.valueToTree(key.defaultConfiguration())); ruleNodes.add(ruleNode); }); @@ -125,30 +124,30 @@ public class EdgeMsgConstructorUtilsTest { return ruleChainMetaData; } - private List getRuleNodesFromUpdateMsg(RuleChainMetaData metaData, EdgeVersion edgeVersion) { - RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = - EdgeMsgConstructorUtils.constructRuleChainMetadataUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, metaData, edgeVersion); + private List extractRuleNodesFromUpdateMsg(RuleChainMetaData metaData, EdgeVersion edgeVersion) { + String ruleChainMetadataUpdateMsg = + EdgeMsgConstructorUtils.constructRuleChainMetadataUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, metaData, edgeVersion).getEntity(); - RuleChainMetaData ruleChainMetaData = JacksonUtil.fromString(ruleChainMetadataUpdateMsg.getEntity(), RuleChainMetaData.class, true); + RuleChainMetaData ruleChainMetaData = JacksonUtil.fromString(ruleChainMetadataUpdateMsg, RuleChainMetaData.class, true); Assert.assertNotNull("RuleChainMetaData is null", ruleChainMetaData); return ruleChainMetaData.getNodes(); } - private void validateRuleNodeConfig(List ruleNodes, EdgeVersion edgeVersion) { + private void assertRuleNodeConfig(List ruleNodes, EdgeVersion edgeVersion) { ruleNodes.forEach(ruleNode -> { - int ruleNodeConfigAmount = NODE_TO_CONFIG_PARAMS_COUNT.get(ruleNode.getName()); + int configParamCount = NODE_TO_CONFIG_PARAMS_COUNT.get(ruleNode.getName()); - boolean isOldEdge = EdgeVersionUtils.isEdgeVersionOlderThan(edgeVersion, EdgeVersion.V_3_9_0); - int expectedConfigAmount = isOldEdge ? ruleNodeConfigAmount - 1 : ruleNodeConfigAmount; - boolean includeConfigParam = !isOldEdge; + boolean isLegacyEdgeVersion = EdgeVersionUtils.isEdgeOlderThan_3_9_0(edgeVersion); + int expectedConfigAmount = isLegacyEdgeVersion ? configParamCount - 1 : configParamCount; + boolean includeConfigParam = !isLegacyEdgeVersion; validateParams(ruleNode, expectedConfigAmount, includeConfigParam); }); } private void validateParams(RuleNode ruleNode, int expectedConfigAmount, boolean includeConfigParam) { - String ignoreConfigParam = NODE_TO_IGNORE_PARAM_FOR_OLD_EDGE_VERSION.get(ruleNode.getName()); + String ignoreConfigParam = NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION.get(ruleNode.getName()); Assert.assertEquals( String.format("Expected %d config params for ruleNode '%s', but found %d", expectedConfigAmount, ruleNode.getName(), ruleNode.getConfiguration().size()), From 362e0322d21e8560e7de9eb63c710a669eed9e0a Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Thu, 13 Mar 2025 15:44:05 +0100 Subject: [PATCH 024/286] MQTT transport handler - log tenant on subscribe issue --- .../server/transport/mqtt/MqttTransportHandler.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java index a7c4cb8c6c..5aea93528a 100644 --- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java +++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/MqttTransportHandler.java @@ -762,7 +762,8 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement ctx.writeAndFlush(createSubAckMessage(mqttMsg.variableHeader().messageId(), Collections.singletonList(MqttReasonCodes.SubAck.NOT_AUTHORIZED.byteValue() & 0xFF))); return; } - log.trace("[{}] Processing subscription [{}]!", sessionId, mqttMsg.variableHeader().messageId()); + //TODO consume the rate limit + log.trace("[{}][{}] Processing subscription [{}]!", deviceSessionCtx.getTenantId(), sessionId, mqttMsg.variableHeader().messageId()); List grantedQoSList = new ArrayList<>(); boolean activityReported = false; for (MqttTopicSubscription subscription : mqttMsg.payload().topicSubscriptions()) { @@ -772,7 +773,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement if (MqttTopics.DEVICE_PROVISION_RESPONSE_TOPIC.equals(topic)) { registerSubQoS(topic, grantedQoSList, reqQoS); } else { - log.debug("[{}] Failed to subscribe to [{}][{}]", sessionId, topic, reqQoS); + log.debug("[{}][{}] Failed to subscribe because this session is provision only [{}][{}]", deviceSessionCtx.getTenantId(), sessionId, topic, reqQoS); grantedQoSList.add(ReturnCodeResolver.getSubscriptionReturnCode(deviceSessionCtx.getMqttVersion(), MqttReasonCodes.SubAck.TOPIC_FILTER_INVALID)); } activityReported = true; @@ -847,13 +848,14 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement registerSubQoS(topic, grantedQoSList, reqQoS); break; default: - log.warn("[{}] Failed to subscribe to [{}][{}]", sessionId, topic, reqQoS); + //TODO increment an error counter if any exists + log.warn("[{}][{}] Failed to subscribe because topic is not supported [{}][{}]", deviceSessionCtx.getTenantId(), sessionId, topic, reqQoS); grantedQoSList.add(ReturnCodeResolver.getSubscriptionReturnCode(deviceSessionCtx.getMqttVersion(), MqttReasonCodes.SubAck.TOPIC_FILTER_INVALID)); break; } } } catch (Exception e) { - log.warn("[{}] Failed to subscribe to [{}][{}]", sessionId, topic, reqQoS, e); + log.warn("[{}][{}] Failed to subscribe to [{}][{}]", deviceSessionCtx.getTenantId(), sessionId, topic, reqQoS, e); grantedQoSList.add(ReturnCodeResolver.getSubscriptionReturnCode(deviceSessionCtx.getMqttVersion(), MqttReasonCodes.SubAck.IMPLEMENTATION_SPECIFIC_ERROR)); } } From 46c9547f98b84a11c85bd6a94d037c2bb9e0b908 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 19 Mar 2025 09:40:37 +0200 Subject: [PATCH 025/286] UI: Fixed label for digits and add default value for major ticks --- .../config/basic/gauge/analog-gauge-basic-config.component.html | 2 +- .../settings/gauge/analogue-gauge-widget-settings.component.ts | 2 +- ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/analog-gauge-basic-config.component.html b/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/analog-gauge-basic-config.component.html index a08aefb103..d4246c51ca 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/analog-gauge-basic-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/analog-gauge-basic-config.component.html @@ -73,7 +73,7 @@
-
widget-config.decimals-suffix
+
widget-config.digits-suffix
Date: Wed, 19 Mar 2025 12:04:34 +0200 Subject: [PATCH 026/286] UI: Add new predefined example when created action place map item --- .../common/action/custom-action.models.ts | 12 +++ .../action/place-map-item-sample-html.raw | 82 +++++++++++++++++ .../action/place-map-item-sample-js.raw | 89 +++++++++++++++++++ .../common/action/widget-action.component.ts | 5 +- .../entity/entity-type-select.component.html | 4 +- .../entity/entity-type-select.component.ts | 4 + 6 files changed, 192 insertions(+), 4 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-html.raw create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-js.raw diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action.models.ts index 1b63e97ad6..40f1a6c819 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action.models.ts @@ -22,6 +22,8 @@ import { deepClone, isDefined, isUndefined } from '@core/utils'; import customSampleJs from './custom-sample-js.raw'; import customSampleCss from './custom-sample-css.raw'; import customSampleHtml from './custom-sample-html.raw'; +import placeMapItemSampleHtml from './place-map-item-sample-html.raw'; +import placeMapItemSampleJs from './place-map-item-sample-js.raw'; const customActionCompletions: TbEditorCompletions = { ...{ @@ -96,5 +98,15 @@ export const toCustomAction = (action: WidgetAction): CustomActionDescriptor => return result; }; +export const toPlaceMapItemAction = (action: WidgetAction): CustomActionDescriptor => { + const result: CustomActionDescriptor = { + customHtml: action?.customHtml ?? placeMapItemSampleHtml, + customCss: action?.customCss ?? '', + customFunction: action?.customFunction ?? placeMapItemSampleJs + }; + result.customResources = isDefined(action?.customResources) ? deepClone(action.customResources) : []; + return result; +}; + export const CustomActionEditorCompleter = new TbEditorCompleter(customActionCompletions); export const CustomPrettyActionEditorCompleter = new TbEditorCompleter(customPrettyActionCompletions); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-html.raw b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-html.raw new file mode 100644 index 0000000000..bb36a39986 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-html.raw @@ -0,0 +1,82 @@ + + + + +
+ +

Add entity

+ + +
+ + +
+
+
+ + Entity Name + + + Entity name is required. + + + + Entity Label + + +
+
+ + + +
+
+
+ + Address + + + + Owner + + +
+
+
+
+ + +
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-js.raw b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-js.raw new file mode 100644 index 0000000000..cb8c23faee --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/place-map-item-sample-js.raw @@ -0,0 +1,89 @@ +/*========================================================================*/ +/*========================= Add entity example =========================*/ +/*========================================================================*/ + +let $injector = widgetContext.$scope.$injector; +let customDialog = $injector.get(widgetContext.servicesMap.get('customDialog')); +let assetService = $injector.get(widgetContext.servicesMap.get('assetService')); +let deviceService = $injector.get(widgetContext.servicesMap.get('deviceService')); +let attributeService = $injector.get(widgetContext.servicesMap.get('attributeService')); + +openAddEntityDialog(); + +function openAddEntityDialog() { + customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe(); +} + +function AddEntityDialogController(instance) { + let vm = instance; + + vm.allowedEntityTypes = ['ASSET', 'DEVICE']; + + vm.addEntityFormGroup = vm.fb.group({ + entityName: ['', [vm.validators.required]], + entityType: ['DEVICE'], + entityLabel: [null], + type: ['', [vm.validators.required]], + attributes: vm.fb.group({ + address: [null], + owner: [null] + }) + }); + + vm.cancel = function() { + vm.dialogRef.close(null); + }; + + vm.save = function() { + vm.addEntityFormGroup.markAsPristine(); + saveEntityObservable().pipe( + widgetContext.rxjs.switchMap((entity) => saveAttributes(entity.id)) + ).subscribe(() => { + widgetContext.updateAliases(); + vm.dialogRef.close(null); + }); + }; + + function saveEntityObservable() { + const formValues = vm.addEntityFormGroup.value; + let entity = { + name: formValues.entityName, + type: formValues.type, + label: formValues.entityLabel + }; + if (formValues.entityType == 'ASSET') { + return assetService.saveAsset(entity); + } else if (formValues.entityType == 'DEVICE') { + return deviceService.saveDevice(entity); + } + } + + function saveAttributes(entityId) { + let attributes = vm.addEntityFormGroup.get('attributes').value; + let attributesArray = getMapItemLocationAttributes(); + for (let key in attributes) { + if(attributes[key] !== null) { + attributesArray.push({key: key, value: attributes[key]}); + } + } + if (attributesArray.length > 0) { + return attributeService.saveEntityAttributes(entityId, "SERVER_SCOPE", attributesArray); + } + return widgetContext.rxjs.of([]); + } + + function getMapItemLocationAttributes() { + const attributes = []; + const mapItemType = $event.shape; + if (mapItemType === 'Marker') { + const mapType = widgetContext.mapInstance.type(); + attributes.push({key: mapType === 'image' ? 'xPos' : 'latitude', value: additionalParams.coordinates.x}); + attributes.push({key: mapType === 'image' ? 'yPos' : 'longitude', value: additionalParams.coordinates.y}); + } else if (mapItemType === 'Rectangle' || mapItemType === 'Polygon') { + attributes.push({key: 'perimeter', value: additionalParams.coordinates}); + } else if (mapItemType === 'Circle') { + attributes.push({key: 'circle', value: additionalParams.coordinates}); + } + return attributes; + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts index 932c0e52c3..bd0fe36910 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.ts @@ -48,7 +48,8 @@ import { TranslateService } from '@ngx-translate/core'; import { PopoverPlacement, PopoverPlacements } from '@shared/components/popover.models'; import { CustomActionEditorCompleter, - toCustomAction + toCustomAction, + toPlaceMapItemAction } from '@home/components/widget/lib/settings/common/action/custom-action.models'; import { coerceBoolean } from '@shared/decorators/coercion'; @@ -336,7 +337,7 @@ export class WidgetActionComponent implements ControlValueAccessor, OnInit, Vali ); this.actionTypeFormGroup.addControl( 'customAction', - this.fb.control(toCustomAction(action), [Validators.required]) + this.fb.control(toPlaceMapItemAction(action), [Validators.required]) ); break; } diff --git a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.html b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.html index c85fc4eb21..b21734cfdd 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.html +++ b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.html @@ -15,9 +15,9 @@ limitations under the License. --> - + {{ 'entity.type' | translate }} - + {{ displayEntityTypeFn(type) }} diff --git a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts index 773222dcec..82b3fcf572 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts @@ -32,6 +32,7 @@ import { AliasEntityType, EntityType, entityTypeTranslations } from '@app/shared import { EntityService } from '@core/http/entity.service'; import { coerceBoolean } from '@shared/decorators/coercion'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { MatFormFieldAppearance } from '@angular/material/form-field'; @Component({ selector: 'tb-entity-type-select', @@ -69,6 +70,9 @@ export class EntityTypeSelectComponent implements ControlValueAccessor, OnInit, @Input() disabled: boolean; + @Input() + appearance: MatFormFieldAppearance = 'fill'; + @Input() additionEntityTypes: {[key in string]: string} = {}; From 3b925df445da22512171d29ee8ee4673acf92829 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Mar 2025 14:22:53 +0200 Subject: [PATCH 027/286] Updated md files --- .../en_US/widget/lib/gateway/rest-json_fn.md | 52 +++++++++--------- .../en_US/widget/lib/gateway/rest-url_fn.md | 54 ------------------- 2 files changed, 24 insertions(+), 82 deletions(-) delete mode 100644 ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md index fe41a2c610..32143694df 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-json_fn.md @@ -1,9 +1,11 @@ ### Expressions #### JSON Path -The expression field is used to specify the path for extracting data from an HTTP response message. +The expression field is used to specify the path for extracting data from an incoming HTTP request body. -JSONPath expressions specify the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: +JSONPath expressions specifies the items within a JSON structure (which could be an object, array, or nested combination of both) that you want to access. +These expressions can select elements from JSON data on specific criteria. +Basic overview of how JSONPath expressions are structured: - `$`: The root element of the JSON document; - `.`: Child operator used to select child elements. For example, $.store.book ; @@ -11,9 +13,7 @@ JSONPath expressions specify the items within a JSON structure (which could be a #### Examples -For example, if we want to extract the device name from the following message, we can use the expression below: - -HTTP response message: +Incoming request body: ```json { @@ -25,30 +25,26 @@ HTTP response message: "temp": 12.2, "hum": 56, "status": "ok" - } + }, + "rxInfo": [ + { + "rssi": 50, + "snr": 3 + }, + { + "rssi": 22, + "snr": 1 + } + ] } ``` +
-JSON Path Expression - -`${sensorModelInfo.sensorName}` - -Converted data: - -`AM-123` - -To extract all data from the message above, use: - -`${data}` - -Converted data: - -`{"temp": 12.2, "hum": 56, "status": "ok"}` - -To extract a specific value, such as the temperature, use: - -`${data.temp}` - -Converted data: +Examples below shows on how to extract values from incoming request body. -`12.2` +| JSON Path Expression | Extracted data | +|---------------------------------|---------------------------------------------| +| `${sensorModelInfo.sensorName}` | `AM-123` | +| `${data}` | `{"temp": 12.2, "hum": 56, "status": "ok"}` | +| `${$.data.temp}` | `12.2` | +| `${$.rxInfo[0].rssi}` | `50` | diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md deleted file mode 100644 index a30deb6203..0000000000 --- a/ui-ngx/src/assets/help/en_US/widget/lib/gateway/rest-url_fn.md +++ /dev/null @@ -1,54 +0,0 @@ -### Expressions -#### Request URL - -JSONPath expressions are used to construct URL addresses for sending messages. - -JSONPath expressions specify items within a JSON structure (objects, arrays, or a nested combination) that you wish to access. These expressions can select elements from JSON data on specific criteria. Here's a basic overview of how JSONPath expressions are structured: - -- `$`: The root element of the JSON document; -- `.`: Child operator used to select child elements. For example, $.store.book ; -- `[]`: Child operator used to select child elements. $['store']['book'] accesses the book array within a store object; - -#### Examples - -For example, if we want to extract the device name from the following message, we can use the expression below: - -HTTP response message: - -```json -{ - "sensorModelInfo": { - "sensorName": "AM-123", - "sensorType": "myDeviceType" - }, - "data": { - "temp": 12.2, - "hum": 56, - "status": "ok" - } -} -``` - -Url Expression: - -`${sensorModelInfo.sensorName}` - -Converted data: - -`AM-123` - -To extract all data from the message above, use: - -`${data}` - -Converted data: - -`{"temp": 12.2, "hum": 56, "status": "ok"}` - -To extract specific data (e.g., "temperature"), use: - -`${data.temp}` - -Converted data: - -`12.2` From f88be5b86355ef6d51789a27f1b0e275a1e4e913 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Wed, 19 Mar 2025 15:07:48 +0200 Subject: [PATCH 028/286] added impl for cf notification producer --- .../DefaultTbCalculatedFieldConsumerService.java | 2 +- .../queue/provider/InMemoryMonolithQueueFactory.java | 2 +- .../queue/provider/KafkaMonolithQueueFactory.java | 2 +- .../provider/KafkaTbRuleEngineQueueFactory.java | 12 +++++++++++- .../queue/provider/TbRuleEngineProducerProvider.java | 1 + .../queue/provider/TbRuleEngineQueueFactory.java | 4 +++- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index fe42684b2b..c91441347b 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -214,7 +214,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerSer @Override protected TbQueueConsumer> createNotificationsConsumer() { - return queueFactory.createToCalculatedFieldNotificationsMsgConsumer(); + return queueFactory.createToCalculatedFieldNotificationMsgConsumer(); } @Override diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java index e97af10ecc..b29a501c0e 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java @@ -144,7 +144,7 @@ public class InMemoryMonolithQueueFactory implements TbCoreQueueFactory, TbRuleE } @Override - public TbQueueConsumer> createToCalculatedFieldNotificationsMsgConsumer() { + public TbQueueConsumer> createToCalculatedFieldNotificationMsgConsumer() { return new InMemoryTbQueueConsumer<>(storage, topicService.getCalculatedFieldNotificationsTopic(serviceInfoProvider.getServiceId()).getFullTopicName()); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index f3d1e2d158..5d3d58cd46 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -537,7 +537,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi } @Override - public TbQueueConsumer> createToCalculatedFieldNotificationsMsgConsumer() { + public TbQueueConsumer> createToCalculatedFieldNotificationMsgConsumer() { TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.getCalculatedFieldNotificationsTopic(serviceInfoProvider.getServiceId()).getFullTopicName()); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index 43fbb5efeb..3bdbfd2851 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -332,7 +332,7 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { } @Override - public TbQueueConsumer> createToCalculatedFieldNotificationsMsgConsumer() { + public TbQueueConsumer> createToCalculatedFieldNotificationMsgConsumer() { TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.getCalculatedFieldNotificationsTopic(serviceInfoProvider.getServiceId()).getFullTopicName()); @@ -344,6 +344,16 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { return consumerBuilder.build(); } + @Override + public TbQueueProducer> createToCalculatedFieldNotificationMsgProducer() { + TbKafkaProducerTemplate.TbKafkaProducerTemplateBuilder> requestBuilder = TbKafkaProducerTemplate.builder(); + requestBuilder.settings(kafkaSettings); + requestBuilder.clientId("tb-calculated-field-notifications-producer-" + serviceInfoProvider.getServiceId()); + requestBuilder.defaultTopic(topicService.getCalculatedFieldNotificationsTopic(serviceInfoProvider.getServiceId()).getFullTopicName()); + requestBuilder.admin(notificationAdmin); + return requestBuilder.build(); + } + @Override public TbQueueConsumer> createCalculatedFieldStateConsumer() { return TbKafkaConsumerTemplate.>builder() diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java index d3b507910a..8e1952fc14 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineProducerProvider.java @@ -69,6 +69,7 @@ public class TbRuleEngineProducerProvider implements TbQueueProducerProvider { this.toEdgeNotifications = tbQueueProvider.createEdgeNotificationsMsgProducer(); this.toEdgeEvents = tbQueueProvider.createEdgeEventMsgProducer(); this.toCalculatedFields = tbQueueProvider.createToCalculatedFieldMsgProducer(); + this.toCalculatedFieldNotifications = tbQueueProvider.createToCalculatedFieldNotificationMsgProducer(); } @Override diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java index 767fea9f0c..ad8ace6b6c 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java @@ -124,7 +124,9 @@ public interface TbRuleEngineQueueFactory extends TbUsageStatsClientQueueFactory TbQueueProducer> createToCalculatedFieldMsgProducer(); - TbQueueConsumer> createToCalculatedFieldNotificationsMsgConsumer(); + TbQueueConsumer> createToCalculatedFieldNotificationMsgConsumer(); + + TbQueueProducer> createToCalculatedFieldNotificationMsgProducer(); TbQueueConsumer> createCalculatedFieldStateConsumer(); From 1e0bdc9032d55f5871caa3bb4b316b3131b4c38f Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Wed, 19 Mar 2025 15:35:48 +0200 Subject: [PATCH 029/286] fixed edqs sorting --- .../server/edqs/data/ApiUsageStateData.java | 6 ++--- .../server/edqs/data/BaseEntityData.java | 22 +++++++++++-------- .../server/edqs/data/EntityData.java | 4 +++- .../server/edqs/repo/TenantRepo.java | 9 +------- .../server/edqs/util/RepositoryUtils.java | 4 ++-- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/ApiUsageStateData.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/ApiUsageStateData.java index f7cd51fc38..8f0a865744 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/ApiUsageStateData.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/ApiUsageStateData.java @@ -35,12 +35,12 @@ public class ApiUsageStateData extends BaseEntityData { @Override public String getEntityName() { - return getEntityOwnerName(); + return getOwnerName(); } @Override - public String getEntityOwnerName() { - return repo.getOwnerName(fields.getEntityId()); + public String getOwnerName() { + return repo.getOwnerEntityName(fields.getEntityId()); } } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java index 10ee17fc75..33f32b9781 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java @@ -98,8 +98,13 @@ public abstract class BaseEntityData implements EntityDa } @Override - public EntityType getOwnerType() { - return customerId != null ? EntityType.CUSTOMER : EntityType.TENANT; + public String getOwnerName() { + return repo.getOwnerEntityName(isTenantEntity() ? repo.getTenantId() : new CustomerId(getCustomerId())); + } + + @Override + public String getOwnerType() { + return isTenantEntity() ? EntityType.TENANT.name() : EntityType.CUSTOMER.name(); } @Override @@ -132,22 +137,21 @@ public abstract class BaseEntityData implements EntityDa } return switch (name) { case "name" -> getEntityName(); - case "ownerName" -> getEntityOwnerName(); - case "ownerType" -> customerId != null ? EntityType.CUSTOMER.name() : EntityType.TENANT.name(); + case "ownerName" -> getOwnerName(); + case "ownerType" -> getOwnerType(); case "entityType" -> Optional.ofNullable(getEntityType()).map(EntityType::name).orElse(""); default -> fields.getAsString(name); }; } - public String getEntityOwnerName() { - return repo.getOwnerName(getCustomerId() == null || CustomerId.NULL_UUID.equals(getCustomerId()) ? null : - new CustomerId(getCustomerId())); - } - public String getEntityName() { return getFields().getName(); } + private boolean isTenantEntity() { + return getCustomerId() == null || CustomerId.NULL_UUID.equals(getCustomerId()); + } + private String getRelatedParentId(QueryContext ctx) { return Optional.ofNullable(ctx.getRelatedParentIdMap().get(getId())) .map(UUID::toString) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/EntityData.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/EntityData.java index 53ee73f638..31ba7b7134 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/EntityData.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/EntityData.java @@ -54,7 +54,9 @@ public interface EntityData { boolean removeTs(Integer keyId); - EntityType getOwnerType(); + String getOwnerName(); + + String getOwnerType(); DataPoint getDataPoint(DataKey key, QueryContext queryContext); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index ab7fb3acff..870574a786 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -421,14 +421,7 @@ public class TenantRepo { return relations.computeIfAbsent(relationTypeGroup, type -> new RelationsRepo()); } - public String getOwnerName(EntityId ownerId) { - if (ownerId == null || (ownerId.getEntityType() == EntityType.CUSTOMER && ownerId.isNullUid())) { - return getOwnerEntityName(tenantId); - } - return getOwnerEntityName(ownerId); - } - - private String getOwnerEntityName(EntityId entityId) { + public String getOwnerEntityName(EntityId entityId) { EntityType entityType = entityId.getEntityType(); return switch (entityType) { case CUSTOMER, TENANT -> { diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java index 970f8585dd..3bf12752a0 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java @@ -67,10 +67,10 @@ import static org.thingsboard.server.common.data.query.ComplexFilterPredicate.Co @Slf4j public class RepositoryUtils { - public static final Comparator SORT_ASC = Comparator.comparing((SortableEntityData sed) -> Optional.ofNullable(sed.getSortValue()).orElse("")) + public static final Comparator SORT_ASC = Comparator.comparing((SortableEntityData sed) -> Optional.ofNullable(sed.getSortValue()).orElse(""), String.CASE_INSENSITIVE_ORDER) .thenComparing(sp -> sp.getId().toString()); - public static final Comparator SORT_DESC = Comparator.comparing((SortableEntityData sed) -> Optional.ofNullable(sed.getSortValue()).orElse("")) + public static final Comparator SORT_DESC = Comparator.comparing((SortableEntityData sed) -> Optional.ofNullable(sed.getSortValue()).orElse(""), String.CASE_INSENSITIVE_ORDER) .thenComparing(sp -> sp.getId().toString()).reversed(); public static EntityType resolveEntityType(EntityFilter entityFilter) { From 82bb007aaf909a346142f657b0559e4868433f7a Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Mar 2025 15:43:20 +0200 Subject: [PATCH 030/286] Fixed import of current tenant shows error --- .../calculated-fields-table-config.ts | 21 +++++++++++++++++-- ...lated-field-arguments-table.component.html | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index 1cf44966fc..37dc5d69e7 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -37,6 +37,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CalculatedFieldsService } from '@core/http/calculated-fields.service'; import { catchError, filter, switchMap, tap } from 'rxjs/operators'; import { + ArgumentEntityType, ArgumentType, CalculatedField, CalculatedFieldEventArguments, @@ -60,7 +61,7 @@ import { DatePipe } from '@angular/common'; export class CalculatedFieldsTableConfig extends EntityTableConfig { readonly calculatedFieldsDebugPerTenantLimitsConfiguration = - getCurrentAuthState(this.store)['calculatedFieldsDebugPerTenantLimitsConfiguration'] || '1:1'; + getCurrentAuthState(this.store)['calculatedFieldsDebugPerTenantLimitsConfiguration']; readonly maxDebugModeDuration = getCurrentAuthState(this.store).maxDebugModeDurationMinutes * MINUTE; readonly tenantId = getCurrentAuthUser(this.store).tenantId; additionalDebugActionConfig = { @@ -252,7 +253,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig this.getCalculatedFieldDialog(calculatedField, 'action.add')), + switchMap(calculatedField => this.getCalculatedFieldDialog(this.updateImportedCalculatedField(calculatedField), 'action.add', true)), filter(Boolean), switchMap(calculatedField => this.calculatedFieldsService.saveCalculatedField(calculatedField)), filter(Boolean), @@ -261,6 +262,22 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig this.updateData()); } + private updateImportedCalculatedField(calculatedField: CalculatedField): CalculatedField { + return { + ...calculatedField, + configuration: { + ...calculatedField.configuration, + arguments: Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => { + const arg = calculatedField.configuration.arguments[key]; + acc[key] = arg.refEntityId?.entityType === ArgumentEntityType.Tenant + ? { ...arg, refEntityId: { id: this.tenantId, entityType: ArgumentEntityType.Tenant } } + : arg; + return acc; + }, {}) + } + } + } + private onDebugConfigChanged(id: string, debugSettings: EntityDebugSettings): void { this.calculatedFieldsService.getCalculatedFieldById(id).pipe( switchMap(field => this.calculatedFieldsService.saveCalculatedField({ ...field, debugSettings })), diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.html index abb34cb502..39cd4b757c 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.html @@ -58,7 +58,7 @@
- @if (argument.refEntityId?.id) { + @if (argument.refEntityId?.id && argument.refEntityId?.entityType !== ArgumentEntityType.Tenant) { {{ entityNameMap.get(argument.refEntityId.id) ?? '' }} From b4bdbc4993e93ee0ff2a8e7501a0c46f9afeeeed Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Wed, 19 Mar 2025 15:47:33 +0200 Subject: [PATCH 031/286] test refactoring --- .../server/controller/EdqsControllerTest.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java index ff98fedf5b..91be3f4744 100644 --- a/application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/EdqsControllerTest.java @@ -15,11 +15,13 @@ */ package org.thingsboard.server.controller; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.node.ObjectNode; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.test.context.TestPropertySource; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.AttributeScope; import org.thingsboard.server.common.data.Device; @@ -27,7 +29,9 @@ import org.thingsboard.server.common.data.edqs.EdqsSyncRequest; import org.thingsboard.server.common.data.edqs.ToCoreEdqsRequest; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; +import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.query.DeviceTypeFilter; +import org.thingsboard.server.common.data.query.EntityData; import org.thingsboard.server.common.data.query.EntityDataPageLink; import org.thingsboard.server.common.data.query.EntityDataQuery; import org.thingsboard.server.common.data.query.EntityKey; @@ -47,7 +51,13 @@ import java.util.concurrent.TimeUnit; import static org.awaitility.Awaitility.await; @DaoSqlTest -public class EdqsControllerTest extends EdqsEntityQueryControllerTest { +@TestPropertySource(properties = { + "queue.edqs.sync.enabled=true", + "queue.edqs.api.supported=true", + "queue.edqs.api.auto_enable=true", + "queue.edqs.mode=local" +}) +public class EdqsControllerTest extends AbstractControllerTest { @Autowired private JdbcTemplate jdbcTemplate; @@ -80,7 +90,9 @@ public class EdqsControllerTest extends EdqsEntityQueryControllerTest { EntityDataPageLink pageLink = new EntityDataPageLink(10, 0, null, null); EntityDataQuery query = new EntityDataQuery(filter, pageLink, entityFields, null, Collections.singletonList(getGatewayFilter())); - findByQueryAndCheck(query, 3); + await().atMost(TIMEOUT, TimeUnit.SECONDS) + .until(() -> doPostWithTypedResponse("/api/entitiesQuery/find", query, new TypeReference>() { + }), result -> result.getTotalElements() == 3); // update db Device device1 = devices.get(0); @@ -101,7 +113,8 @@ public class EdqsControllerTest extends EdqsEntityQueryControllerTest { // check if the count is updated loginTenantAdmin(); - findByQueryAndCheck(query, 2); + await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> doPostWithTypedResponse("/api/entitiesQuery/find", query, new TypeReference>() { + }), result -> result.getTotalElements() == 2); } private KeyFilter getGatewayFilter() { From 705265c3036455f9aecf829174d9cd0361ca7744 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Wed, 19 Mar 2025 17:09:01 +0200 Subject: [PATCH 032/286] added test --- .../server/msa/cf/CalculatedFieldTest.java | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/cf/CalculatedFieldTest.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/cf/CalculatedFieldTest.java index 63faed41ab..2593e18a55 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/cf/CalculatedFieldTest.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/cf/CalculatedFieldTest.java @@ -34,6 +34,7 @@ import org.thingsboard.server.common.data.cf.configuration.ArgumentType; import org.thingsboard.server.common.data.cf.configuration.Output; import org.thingsboard.server.common.data.cf.configuration.OutputType; import org.thingsboard.server.common.data.cf.configuration.ReferencedEntityKey; +import org.thingsboard.server.common.data.cf.configuration.ScriptCalculatedFieldConfiguration; import org.thingsboard.server.common.data.cf.configuration.SimpleCalculatedFieldConfiguration; import org.thingsboard.server.common.data.debug.DebugSettings; import org.thingsboard.server.common.data.device.data.DefaultDeviceConfiguration; @@ -73,7 +74,7 @@ public class CalculatedFieldTest extends AbstractContainerTest { " var airDensity = pressure / (287.05 * temperatureK);\n" + "\n" + " return {\n" + - " \"airDensity\": airDensity\n" + + " \"airDensity\": toFixed(airDensity, 2)\n" + " };"; private TenantId tenantId; @@ -280,6 +281,34 @@ public class CalculatedFieldTest extends AbstractContainerTest { testRestClient.deleteCalculatedFieldIfExists(savedCalculatedField.getId()); } + @Test + public void testEntityIdIsProfileAndRefEntityIsCommon() { + // login tenant admin + testRestClient.getAndSetUserToken(tenantAdminId); + + CalculatedField savedCalculatedField = createScriptCalculatedField(deviceProfileId); + + await().alias("create CF -> perform initial calculation for device by profile").atMost(TIMEOUT, TimeUnit.SECONDS) + .pollInterval(POLL_INTERVAL, TimeUnit.SECONDS) + .untilAsserted(() -> { + JsonNode airDensity = testRestClient.getLatestTelemetry(device.getId()); + assertThat(airDensity).isNotNull(); + assertThat(airDensity.get("airDensity").get(0).get("value").asText()).isEqualTo("1.05"); + }); + + testRestClient.postTelemetryAttribute(asset.getId(), DataConstants.SERVER_SCOPE, JacksonUtil.toJsonNode("{\"altitude\":1531}")); + + await().alias("create CF -> update telemetry for common entity").atMost(TIMEOUT, TimeUnit.SECONDS) + .pollInterval(POLL_INTERVAL, TimeUnit.SECONDS) + .untilAsserted(() -> { + JsonNode airDensity = testRestClient.getLatestTelemetry(device.getId()); + assertThat(airDensity).isNotNull(); + assertThat(airDensity.get("airDensity").get(0).get("value").asText()).isEqualTo("0.99"); + }); + + testRestClient.deleteCalculatedFieldIfExists(savedCalculatedField.getId()); + } + private CalculatedField createSimpleCalculatedField() { return createSimpleCalculatedField(device.getId()); } @@ -323,19 +352,21 @@ public class CalculatedFieldTest extends AbstractContainerTest { calculatedField.setName("Air density" + RandomStringUtils.randomAlphabetic(5)); calculatedField.setDebugSettings(DebugSettings.all()); - SimpleCalculatedFieldConfiguration config = new SimpleCalculatedFieldConfiguration(); + ScriptCalculatedFieldConfiguration config = new ScriptCalculatedFieldConfiguration(); Argument argument1 = new Argument(); argument1.setRefEntityId(asset.getId()); ReferencedEntityKey refEntityKey1 = new ReferencedEntityKey("altitude", ArgumentType.ATTRIBUTE, AttributeScope.SERVER_SCOPE); argument1.setRefEntityKey(refEntityKey1); - config.setArguments(Map.of("altitude", argument1)); Argument argument2 = new Argument(); ReferencedEntityKey refEntityKey2 = new ReferencedEntityKey("temperatureInF", ArgumentType.TS_ROLLING, null); + argument2.setTimeWindow(30000L); + argument2.setLimit(5); argument2.setRefEntityKey(refEntityKey2); - config.setArguments(Map.of("temperature", argument2)); - config.setExpression("return {\"airDensity\": 5};"); + config.setArguments(Map.of("altitude", argument1, "temperature", argument2)); + + config.setExpression(exampleScript); Output output = new Output(); output.setType(OutputType.TIME_SERIES); From 47232a629bf79ef1b7a47c80696bc7bd1ed81473 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Mar 2025 17:20:01 +0200 Subject: [PATCH 033/286] refactoring --- .../calculated-fields-table-config.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index 37dc5d69e7..cc4a100b2b 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -263,18 +263,17 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig { + const arg = calculatedField.configuration.arguments[key]; + acc[key] = arg.refEntityId?.entityType === ArgumentEntityType.Tenant + ? { ...arg, refEntityId: { id: this.tenantId, entityType: ArgumentEntityType.Tenant } } + : arg; + return acc; + }, {}); + return { ...calculatedField, - configuration: { - ...calculatedField.configuration, - arguments: Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => { - const arg = calculatedField.configuration.arguments[key]; - acc[key] = arg.refEntityId?.entityType === ArgumentEntityType.Tenant - ? { ...arg, refEntityId: { id: this.tenantId, entityType: ArgumentEntityType.Tenant } } - : arg; - return acc; - }, {}) - } + configuration: { ...calculatedField.configuration, arguments: updatedArguments } } } From 1cc03d63e2582938729bf0b7e47adfb48c0432ae Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 19 Mar 2025 17:33:11 +0200 Subject: [PATCH 034/286] refactoring --- .../calculated-fields/calculated-fields-table-config.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index cc4a100b2b..69c0a35fb5 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -263,7 +263,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig { + calculatedField.configuration.arguments = Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => { const arg = calculatedField.configuration.arguments[key]; acc[key] = arg.refEntityId?.entityType === ArgumentEntityType.Tenant ? { ...arg, refEntityId: { id: this.tenantId, entityType: ArgumentEntityType.Tenant } } @@ -271,10 +271,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig Date: Wed, 19 Mar 2025 18:33:55 +0200 Subject: [PATCH 035/286] refactoring --- .../dao/device/DeviceConnectivityServiceImpl.java | 2 +- .../server/dao/util/DeviceConnectivityUtil.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) 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 d05d2fbb09..606388e465 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 @@ -201,7 +201,7 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService pemContentBuilder.append("-----END CERTIFICATE-----\n"); } } - } catch (IOException e) { + } catch (Exception e) { String msg = String.format("Failed to read %s server certificate!", path); log.warn(msg); throw new RuntimeException(msg, e); diff --git a/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java b/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java index b9b707f0d1..56e0e44778 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java +++ b/dao/src/main/java/org/thingsboard/server/dao/util/DeviceConnectivityUtil.java @@ -214,24 +214,24 @@ public class DeviceConnectivityUtil { return null; } - StringBuilder mqttDockerCommand = new StringBuilder(); - mqttDockerCommand.append(DOCKER_RUN).append(isLocalhost(host) ? ADD_DOCKER_INTERNAL_HOST : "").append(COAP_IMAGE); + StringBuilder coapDockerCommand = new StringBuilder(); + coapDockerCommand.append(DOCKER_RUN).append(isLocalhost(host) ? ADD_DOCKER_INTERNAL_HOST : "").append(COAP_IMAGE); if (isLocalhost(host)) { coapCommand = coapCommand.replace(host, HOST_DOCKER_INTERNAL); } if (COAPS.equals(protocol)) { - mqttDockerCommand.append("/bin/sh -c \"") + coapDockerCommand.append("/bin/sh -c \"") .append(getCurlPemCertCommand(baseUrl, protocol)) .append(" && ") .append(coapCommand) .append("\""); } else { - mqttDockerCommand.append(coapCommand); + coapDockerCommand.append(coapCommand); } - return mqttDockerCommand.toString(); + return coapDockerCommand.toString(); } public static String getHost(String baseUrl, DeviceConnectivityInfo properties, String protocol) throws URISyntaxException { From d602333d98a7347410a9077adc5e876b358893a1 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Wed, 19 Mar 2025 19:30:01 +0200 Subject: [PATCH 036/286] Fix RuleChainMetadata for older Edge versions - refactoring --- .../service/edge/EdgeMsgConstructorUtils.java | 74 +++++++++++-------- .../edge/rpc/utils/EdgeVersionUtils.java | 8 -- .../edge/EdgeMsgConstructorUtilsTest.java | 45 ++++------- 3 files changed, 60 insertions(+), 67 deletions(-) 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 85471f6211..d9c9bee9df 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 @@ -119,7 +119,6 @@ import org.thingsboard.server.gen.edge.v1.UserUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetTypeUpdateMsg; import org.thingsboard.server.gen.edge.v1.WidgetsBundleUpdateMsg; import org.thingsboard.server.gen.transport.TransportProtos; -import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; import java.util.Iterator; import java.util.List; @@ -128,17 +127,30 @@ import java.util.Set; import java.util.UUID; @Slf4j + public class EdgeMsgConstructorUtils { - public static final Map NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION = Map.of( - TbMsgTimeseriesNode.class.getName(), "processingSettings", - TbMsgAttributesNode.class.getName(), "processingSettings", - TbSaveToCustomCassandraTableNode.class.getName(), "defaultTtl" + public static final Map> VERSION_TO_IGNORED_PARAM = Map.of( + EdgeVersion.V_3_8_0, + Map.of( + TbMsgTimeseriesNode.class.getName(), "processingSettings", + TbMsgAttributesNode.class.getName(), "processingSettings", + TbSaveToCustomCassandraTableNode.class.getName(), "defaultTtl" + ), + EdgeVersion.V_3_7_0, + Map.of( + TbMsgTimeseriesNode.class.getName(), "processingSettings", + TbMsgAttributesNode.class.getName(), "processingSettings", + TbSaveToCustomCassandraTableNode.class.getName(), "defaultTtl" + ) ); - //added in edge version 3.8.0 - public static final Set MISSING_NODES_IN_VERSION_37 = Set.of( - TbSendRestApiCallReplyNode.class.getName(), - TbAwsLambdaNode.class.getName() + //these nodes added in edge version 3.8.0 + public static final Map> VERSION_TO_MISSING_NODES = Map.of( + EdgeVersion.V_3_7_0, + Set.of( + TbSendRestApiCallReplyNode.class.getName(), + TbAwsLambdaNode.class.getName() + ) ); public static AlarmUpdateMsg constructAlarmUpdatedMsg(UpdateMsgType msgType, Alarm alarm) { @@ -452,33 +464,35 @@ public class EdgeMsgConstructorUtils { JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); JsonNode nodes = jsonNode.get("nodes"); - if (EdgeVersionUtils.isEdgeOlderThan_3_8_0(edgeVersion)) { - Iterator iterator = nodes.iterator(); - while (iterator.hasNext()) { - JsonNode node = iterator.next(); + changeConfigForOldEdgeVersions(nodes, edgeVersion); + removeMissingNodeOldForEdge(nodes, edgeVersion); - String type = node.get("type").asText(); - if (MISSING_NODES_IN_VERSION_37.contains(type)) { - iterator.remove(); - } - } - } + return JacksonUtil.toString(jsonNode); + } - if (EdgeVersionUtils.isEdgeOlderThan_3_9_0(edgeVersion)) { - nodes.forEach(EdgeMsgConstructorUtils::changeRuleNodeConfigForOldEdgeVersion); + private static void changeConfigForOldEdgeVersions(JsonNode nodes, EdgeVersion edgeVersion) { + nodes.forEach(node -> { + if (node.isObject() && node.has("configuration")) { + String nodeType = node.get("type").asText(); + Map ignoredParams = VERSION_TO_IGNORED_PARAM.get(edgeVersion); - return JacksonUtil.toString(jsonNode); - } else { - return JacksonUtil.toString(ruleChainMetaData); - } + if (ignoredParams != null && ignoredParams.containsKey(nodeType)) { + ((ObjectNode) node.get("configuration")).remove(ignoredParams.get(nodeType)); + } + } + }); } - private static void changeRuleNodeConfigForOldEdgeVersion(JsonNode node) { - if (node.isObject()) { - String nodeType = node.get("type").asText(); + private static void removeMissingNodeOldForEdge(JsonNode nodes, EdgeVersion edgeVersion) { + Iterator iterator = nodes.iterator(); + + while (iterator.hasNext()) { + JsonNode node = iterator.next(); + String type = node.get("type").asText(); + Set missNodes = VERSION_TO_MISSING_NODES.get(edgeVersion); - if (node.isObject() && node.has("configuration") && NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION.containsKey(nodeType)) { - ((ObjectNode) node.get("configuration")).remove(NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION.get(nodeType)); + if (missNodes != null && missNodes.contains(type)) { + iterator.remove(); } } } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java index 2ae6e91f34..9902118eb2 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/utils/EdgeVersionUtils.java @@ -25,12 +25,4 @@ public final class EdgeVersionUtils { return currentVersion.ordinal() < requiredVersion.ordinal(); } - public static boolean isEdgeOlderThan_3_9_0(EdgeVersion currentVersion) { - return isEdgeVersionOlderThan(currentVersion, EdgeVersion.V_3_9_0); - } - - public static boolean isEdgeOlderThan_3_8_0(EdgeVersion currentVersion) { - return isEdgeVersionOlderThan(currentVersion, EdgeVersion.V_3_8_0); - } - } 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 937a6709c5..690deac0ec 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 @@ -34,15 +34,14 @@ import org.thingsboard.server.common.data.rule.RuleChainMetaData; import org.thingsboard.server.common.data.rule.RuleNode; import org.thingsboard.server.gen.edge.v1.EdgeVersion; import org.thingsboard.server.gen.edge.v1.UpdateMsgType; -import org.thingsboard.server.service.edge.rpc.utils.EdgeVersionUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; -import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.MISSING_NODES_IN_VERSION_37; -import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION; +import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.VERSION_TO_IGNORED_PARAM; +import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.VERSION_TO_MISSING_NODES; @Slf4j public class EdgeMsgConstructorUtilsTest { @@ -93,13 +92,11 @@ public class EdgeMsgConstructorUtilsTest { List ruleNodes = extractRuleNodesFromUpdateMsg(metaData, edgeVersion); // THEN - boolean isOldEdge = EdgeVersionUtils.isEdgeOlderThan_3_8_0(edgeVersion); + int leftNode = VERSION_TO_MISSING_NODES.containsKey(edgeVersion) ? + CONFIG_TO_MISS_NODE_FOR_OLD_EDGE.size() - VERSION_TO_MISSING_NODES.get(edgeVersion).size() : + CONFIG_TO_MISS_NODE_FOR_OLD_EDGE.size(); - if (isOldEdge) { - Assert.assertTrue("Rule Node must be empty", ruleNodes.isEmpty()); - } else { - Assert.assertEquals(MISSING_NODES_IN_VERSION_37.size(), ruleNodes.size()); - } + Assert.assertEquals(leftNode, ruleNodes.size()); }); } @@ -129,6 +126,7 @@ public class EdgeMsgConstructorUtilsTest { EdgeMsgConstructorUtils.constructRuleChainMetadataUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, metaData, edgeVersion).getEntity(); RuleChainMetaData ruleChainMetaData = JacksonUtil.fromString(ruleChainMetadataUpdateMsg, RuleChainMetaData.class, true); + Assert.assertNotNull("RuleChainMetaData is null", ruleChainMetaData); return ruleChainMetaData.getNodes(); @@ -136,29 +134,18 @@ public class EdgeMsgConstructorUtilsTest { private void assertRuleNodeConfig(List ruleNodes, EdgeVersion edgeVersion) { ruleNodes.forEach(ruleNode -> { - int configParamCount = NODE_TO_CONFIG_PARAMS_COUNT.get(ruleNode.getName()); + int configParamCount = NODE_TO_CONFIG_PARAMS_COUNT.get(ruleNode.getType()); - boolean isLegacyEdgeVersion = EdgeVersionUtils.isEdgeOlderThan_3_9_0(edgeVersion); - int expectedConfigAmount = isLegacyEdgeVersion ? configParamCount - 1 : configParamCount; - boolean includeConfigParam = !isLegacyEdgeVersion; + boolean isOldEdgeVersion = VERSION_TO_IGNORED_PARAM.keySet().stream() + .anyMatch(version -> version.equals(edgeVersion)); + int expectedConfigAmount = isOldEdgeVersion ? configParamCount - 1 : configParamCount; - validateParams(ruleNode, expectedConfigAmount, includeConfigParam); + Assert.assertEquals( + String.format("Expected %d config params for ruleNode '%s', but found %d", + expectedConfigAmount, ruleNode.getName(), ruleNode.getConfiguration().size()), + expectedConfigAmount, ruleNode.getConfiguration().size() + ); }); } - private void validateParams(RuleNode ruleNode, int expectedConfigAmount, boolean includeConfigParam) { - String ignoreConfigParam = NODE_TO_IGNORED_PARAM_FOR_OLD_EDGE_VERSION.get(ruleNode.getName()); - - Assert.assertEquals( - String.format("Expected %d config params for ruleNode '%s', but found %d", expectedConfigAmount, ruleNode.getName(), ruleNode.getConfiguration().size()), - expectedConfigAmount, ruleNode.getConfiguration().size() - ); - - boolean hasIgnoredField = ruleNode.getConfiguration().has(ignoreConfigParam); - Assert.assertEquals( - String.format("Field '%s' for ruleNode '%s' should %s be present", ignoreConfigParam, ruleNode.getName(), includeConfigParam ? "not" : ""), - includeConfigParam, hasIgnoredField - ); - } - } From c7cfd92a7adf2ded8d01afa8e02f6bd772dc81fa Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 19 Mar 2025 21:33:39 +0100 Subject: [PATCH 037/286] fixed OOM if startTs and endTs in agg command are the same --- .../dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java index 4f7239cfb3..37fa159cf9 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java @@ -119,7 +119,7 @@ public abstract class AbstractChunkedAggregationTimeseriesDao extends AbstractSq @Override public ListenableFuture findAllAsync(TenantId tenantId, EntityId entityId, ReadTsKvQuery query) { var aggParams = query.getAggParameters(); - if (Aggregation.NONE.equals(aggParams.getAggregation())) { + if (Aggregation.NONE.equals(aggParams.getAggregation()) || aggParams.getInterval() == 0) { return Futures.immediateFuture(findAllAsyncWithLimit(entityId, query)); } else { List>> futures = new ArrayList<>(); From 3f936ef6fc4d9fedc77e37453a82b94383ce9806 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 19 Mar 2025 23:07:42 +0100 Subject: [PATCH 038/286] added fix for negative interval --- .../dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java index 37fa159cf9..e7351bbddd 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java @@ -119,7 +119,7 @@ public abstract class AbstractChunkedAggregationTimeseriesDao extends AbstractSq @Override public ListenableFuture findAllAsync(TenantId tenantId, EntityId entityId, ReadTsKvQuery query) { var aggParams = query.getAggParameters(); - if (Aggregation.NONE.equals(aggParams.getAggregation()) || aggParams.getInterval() == 0) { + if (Aggregation.NONE.equals(aggParams.getAggregation()) || aggParams.getInterval() < 1) { return Futures.immediateFuture(findAllAsyncWithLimit(entityId, query)); } else { List>> futures = new ArrayList<>(); From d4f7cb7df161df1a9834bea77e1e4838f698ea34 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Thu, 20 Mar 2025 09:38:10 +0200 Subject: [PATCH 039/286] added validation for arg name and implemented destroy methods --- .../calculatedField/CalculatedFieldEntityActor.java | 7 +++++++ .../CalculatedFieldEntityMessageProcessor.java | 6 ++++++ .../calculatedField/CalculatedFieldManagerActor.java | 7 +++++++ .../CalculatedFieldManagerMessageProcessor.java | 9 +++++++++ .../server/service/cf/ctx/state/CalculatedFieldCtx.java | 9 +++++++++ .../thingsboard/server/actors/DefaultTbActorSystem.java | 2 ++ .../service/validator/CalculatedFieldDataValidator.java | 8 ++++++++ 7 files changed, 48 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityActor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityActor.java index 350a5776cf..2959bfc8eb 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityActor.java @@ -21,6 +21,7 @@ import org.thingsboard.server.actors.TbActorCtx; import org.thingsboard.server.actors.TbActorException; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.msg.TbActorStopReason; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; @@ -47,6 +48,12 @@ public class CalculatedFieldEntityActor extends AbstractCalculatedFieldActor { } } + @Override + public void destroy(TbActorStopReason stopReason, Throwable cause) throws TbActorException { + log.debug("[{}] Stopping CF entity actor.", processor.tenantId); + processor.stop(); + } + @Override protected boolean doProcessCfMsg(ToCalculatedFieldSystemMsg msg) throws CalculatedFieldException { switch (msg.getMsgType()) { diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java index a185b71d56..4e15dba120 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java @@ -92,6 +92,12 @@ public class CalculatedFieldEntityMessageProcessor extends AbstractContextAwareM this.ctx = ctx; } + public void stop() { + log.info("[{}][{}] Stopping entity actor.", tenantId, entityId); + states.clear(); + ctx.stop(ctx.getSelf()); + } + public void process(CalculatedFieldPartitionChangeMsg msg) { if (!systemContext.getPartitionService().resolve(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, tenantId, entityId).isMyPartition()) { log.info("[{}] Stopping entity actor due to change partition event.", entityId); diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java index a5c935e83f..70ed2849e8 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java @@ -20,6 +20,7 @@ import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.actors.TbActorCtx; import org.thingsboard.server.actors.TbActorException; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.msg.TbActorStopReason; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; @@ -52,6 +53,12 @@ public class CalculatedFieldManagerActor extends AbstractCalculatedFieldActor { } } + @Override + public void destroy(TbActorStopReason stopReason, Throwable cause) throws TbActorException { + log.debug("[{}] Stopping CF manager actor.", processor.tenantId); + processor.stop(); + } + @Override protected boolean doProcessCfMsg(ToCalculatedFieldSystemMsg msg) throws CalculatedFieldException { switch (msg.getMsgType()) { diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index f8c17bf84b..1dd5b01401 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -91,6 +91,15 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware this.ctx = ctx; } + public void stop() { + log.info("[{}] Stopping CF manager actor.", tenantId); + calculatedFields.values().forEach(CalculatedFieldCtx::stop); + calculatedFields.clear(); + entityIdCalculatedFields.clear(); + entityIdCalculatedFieldLinks.clear(); + ctx.stop(ctx.getSelf()); + } + public void onFieldInitMsg(CalculatedFieldInitMsg msg) throws CalculatedFieldException { log.debug("[{}] Processing CF init message.", msg.getCf().getId()); var cf = msg.getCf(); diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/CalculatedFieldCtx.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/CalculatedFieldCtx.java index 0c4352dcea..fdbbb37568 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/CalculatedFieldCtx.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/CalculatedFieldCtx.java @@ -122,6 +122,15 @@ public class CalculatedFieldCtx { } } + public void stop() { + if (calculatedFieldScriptEngine != null) { + calculatedFieldScriptEngine.destroy(); + } + if (customExpression != null) { + customExpression.remove(); + } + } + private CalculatedFieldScriptEngine initEngine(TenantId tenantId, String expression, TbelInvokeService tbelInvokeService) { if (tbelInvokeService == null) { throw new IllegalArgumentException("TBEL script engine is disabled!"); diff --git a/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java b/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java index 85638763b2..1588f0d2b5 100644 --- a/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java +++ b/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java @@ -23,6 +23,7 @@ import org.thingsboard.server.common.msg.TbActorMsg; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -225,6 +226,7 @@ public class DefaultTbActorSystem implements TbActorSystem { if (scheduler != null) { scheduler.shutdownNow(); } + actors.values().forEach(mailbox -> Optional.ofNullable(mailbox).ifPresent(m -> m.destroy(null))); actors.clear(); } diff --git a/dao/src/main/java/org/thingsboard/server/dao/service/validator/CalculatedFieldDataValidator.java b/dao/src/main/java/org/thingsboard/server/dao/service/validator/CalculatedFieldDataValidator.java index 187de20667..c9c7af1a89 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/service/validator/CalculatedFieldDataValidator.java +++ b/dao/src/main/java/org/thingsboard/server/dao/service/validator/CalculatedFieldDataValidator.java @@ -39,6 +39,7 @@ public class CalculatedFieldDataValidator extends DataValidator protected void validateCreate(TenantId tenantId, CalculatedField calculatedField) { validateNumberOfCFsPerEntity(tenantId, calculatedField.getEntityId()); validateNumberOfArgumentsPerCF(tenantId, calculatedField); + validateArgumentNames(calculatedField); } @Override @@ -48,6 +49,7 @@ public class CalculatedFieldDataValidator extends DataValidator throw new DataValidationException("Can't update non existing calculated field!"); } validateNumberOfArgumentsPerCF(tenantId, calculatedField); + validateArgumentNames(calculatedField); return old; } @@ -71,4 +73,10 @@ public class CalculatedFieldDataValidator extends DataValidator } } + private void validateArgumentNames(CalculatedField calculatedField) { + if (calculatedField.getConfiguration().getArguments().containsKey("ctx")) { + throw new DataValidationException("Argument name 'ctx' is reserved and cannot be used."); + } + } + } From 65f5cd30936cc01fbd022e1a1ae8a65a50193fad Mon Sep 17 00:00:00 2001 From: yevhenii Date: Thu, 20 Mar 2025 11:43:34 +0200 Subject: [PATCH 040/286] Fix RuleChainMetadata for older Edge versions - refactoring --- .../server/service/edge/EdgeMsgConstructorUtils.java | 5 ++--- .../server/service/edge/EdgeMsgConstructorUtilsTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) 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 d9c9bee9df..fb6d8d7f92 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 @@ -144,7 +144,6 @@ public class EdgeMsgConstructorUtils { ) ); - //these nodes added in edge version 3.8.0 public static final Map> VERSION_TO_MISSING_NODES = Map.of( EdgeVersion.V_3_7_0, Set.of( @@ -465,7 +464,7 @@ public class EdgeMsgConstructorUtils { JsonNode nodes = jsonNode.get("nodes"); changeConfigForOldEdgeVersions(nodes, edgeVersion); - removeMissingNodeOldForEdge(nodes, edgeVersion); + removeMissingNodeForOldEdge(nodes, edgeVersion); return JacksonUtil.toString(jsonNode); } @@ -483,7 +482,7 @@ public class EdgeMsgConstructorUtils { }); } - private static void removeMissingNodeOldForEdge(JsonNode nodes, EdgeVersion edgeVersion) { + private static void removeMissingNodeForOldEdge(JsonNode nodes, EdgeVersion edgeVersion) { Iterator iterator = nodes.iterator(); while (iterator.hasNext()) { 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 690deac0ec..702eed26b5 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 @@ -136,13 +136,13 @@ public class EdgeMsgConstructorUtilsTest { ruleNodes.forEach(ruleNode -> { int configParamCount = NODE_TO_CONFIG_PARAMS_COUNT.get(ruleNode.getType()); - boolean isOldEdgeVersion = VERSION_TO_IGNORED_PARAM.keySet().stream() - .anyMatch(version -> version.equals(edgeVersion)); + boolean isOldEdgeVersion = VERSION_TO_IGNORED_PARAM.entrySet().stream() + .anyMatch(entry -> entry.getKey().equals(edgeVersion) && + entry.getValue().containsKey(ruleNode.getType())); int expectedConfigAmount = isOldEdgeVersion ? configParamCount - 1 : configParamCount; Assert.assertEquals( - String.format("Expected %d config params for ruleNode '%s', but found %d", - expectedConfigAmount, ruleNode.getName(), ruleNode.getConfiguration().size()), + String.format("For ruleNode '%s', edgeVersion '%s", ruleNode.getName(), edgeVersion), expectedConfigAmount, ruleNode.getConfiguration().size() ); }); From bf2f4c3151a3e0500a5c301e762b5ff8a8e7a83c Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Thu, 20 Mar 2025 11:54:34 +0200 Subject: [PATCH 041/286] renamed package to tb-edqs --- edqs/pom.xml | 2 +- edqs/src/main/conf/{edqs.conf => tb-edqs.conf} | 0 msa/edqs/pom.xml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename edqs/src/main/conf/{edqs.conf => tb-edqs.conf} (100%) diff --git a/edqs/pom.xml b/edqs/pom.xml index 9faf022d17..5a70f8d0b0 100644 --- a/edqs/pom.xml +++ b/edqs/pom.xml @@ -36,7 +36,7 @@ false process-resources package - edqs + tb-edqs ${project.build.directory}/windows true ThingsBoard Entity Data Query Service diff --git a/edqs/src/main/conf/edqs.conf b/edqs/src/main/conf/tb-edqs.conf similarity index 100% rename from edqs/src/main/conf/edqs.conf rename to edqs/src/main/conf/tb-edqs.conf diff --git a/msa/edqs/pom.xml b/msa/edqs/pom.xml index 49d6fa71c9..b790cc0802 100644 --- a/msa/edqs/pom.xml +++ b/msa/edqs/pom.xml @@ -34,7 +34,7 @@ UTF-8 ${basedir}/../.. - edqs + tb-edqs tb-edqs /var/log/${pkg.name} /usr/share/${pkg.name} From f5eabdca3c1ce13855b80987c7525e445ddcf7b4 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 20 Mar 2025 11:37:13 +0100 Subject: [PATCH 042/286] added tests --- ...stractChunkedAggregationTimeseriesDao.java | 2 +- ...ctChunkedAggregationTimeseriesDaoTest.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java index e7351bbddd..1c5d554350 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDao.java @@ -144,7 +144,7 @@ public abstract class AbstractChunkedAggregationTimeseriesDao extends AbstractSq } } - private ReadTsKvQueryResult findAllAsyncWithLimit(EntityId entityId, ReadTsKvQuery query) { + ReadTsKvQueryResult findAllAsyncWithLimit(EntityId entityId, ReadTsKvQuery query) { Integer keyId = keyDictionaryDao.getOrSaveKeyId(query.getKey()); List tsKvEntities = tsKvRepository.findAllWithLimit( entityId.getId(), diff --git a/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java b/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java index f9ea7d2a41..b1967ce218 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java @@ -51,6 +51,7 @@ public class AbstractChunkedAggregationTimeseriesDaoTest { Optional optionalListenableFuture = Optional.of(mock(TsKvEntry.class)); willReturn(Futures.immediateFuture(optionalListenableFuture)).given(tsDao).findAndAggregateAsync(any(), anyString(), anyLong(), anyLong(), anyLong(), any()); willReturn(Futures.immediateFuture(mock(ReadTsKvQueryResult.class))).given(tsDao).getReadTsKvQueryResultFuture(any(), any()); + willReturn(mock(ReadTsKvQueryResult.class)).given(tsDao).findAllAsyncWithLimit(any(), any()); } @Test @@ -146,6 +147,24 @@ public class AbstractChunkedAggregationTimeseriesDaoTest { } } + @Test + public void givenZeroInterval_whenAggregateCount_thenFindAllWithoutAggregation() { + ReadTsKvQuery query = new BaseReadTsKvQuery(TEMP, 1, 3000, 0, LIMIT, COUNT, DESC); + willCallRealMethod().given(tsDao).findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); + tsDao.findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); + verify(tsDao, times(1)).findAllAsyncWithLimit(any(), any()); + verify(tsDao, times(0)).findAndAggregateAsync(any(), any(), anyLong(), anyLong(), anyLong(), any()); + } + + @Test + public void givenNegativeInterval_whenAggregateCount_thenFindAllWithoutAggregation() { + ReadTsKvQuery query = new BaseReadTsKvQuery(TEMP, 1, 3000, 0, LIMIT, COUNT, DESC); + willCallRealMethod().given(tsDao).findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); + tsDao.findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); + verify(tsDao, times(1)).findAllAsyncWithLimit(any(), any()); + verify(tsDao, times(0)).findAndAggregateAsync(any(), any(), anyLong(), anyLong(), anyLong(), any()); + } + long getTsForReadTsKvQuery(long startTs, long endTs) { return startTs + (endTs - startTs) / 2L; } From c3b608492a160bf5031f66d3aa1a41c9c7d9b99b Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 20 Mar 2025 11:44:43 +0100 Subject: [PATCH 043/286] test improvements --- .../AbstractChunkedAggregationTimeseriesDaoTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java b/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java index b1967ce218..eb34e6dc4c 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/sqlts/AbstractChunkedAggregationTimeseriesDaoTest.java @@ -149,16 +149,16 @@ public class AbstractChunkedAggregationTimeseriesDaoTest { @Test public void givenZeroInterval_whenAggregateCount_thenFindAllWithoutAggregation() { - ReadTsKvQuery query = new BaseReadTsKvQuery(TEMP, 1, 3000, 0, LIMIT, COUNT, DESC); - willCallRealMethod().given(tsDao).findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); - tsDao.findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); - verify(tsDao, times(1)).findAllAsyncWithLimit(any(), any()); - verify(tsDao, times(0)).findAndAggregateAsync(any(), any(), anyLong(), anyLong(), anyLong(), any()); + givenInterval_whenAggregateCount_thenFindAllWithoutAggregation(0); } @Test public void givenNegativeInterval_whenAggregateCount_thenFindAllWithoutAggregation() { - ReadTsKvQuery query = new BaseReadTsKvQuery(TEMP, 1, 3000, 0, LIMIT, COUNT, DESC); + givenInterval_whenAggregateCount_thenFindAllWithoutAggregation(-1); + } + + public void givenInterval_whenAggregateCount_thenFindAllWithoutAggregation(int interval) { + ReadTsKvQuery query = new BaseReadTsKvQuery(TEMP, 1, 3000, interval, LIMIT, COUNT, DESC); willCallRealMethod().given(tsDao).findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); tsDao.findAllAsync(SYS_TENANT_ID, SYS_TENANT_ID, query); verify(tsDao, times(1)).findAllAsyncWithLimit(any(), any()); From e2fdc5a4ba5dc5e03dd6a1443194ef24e50ba816 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Thu, 20 Mar 2025 14:13:43 +0200 Subject: [PATCH 044/286] added methods for check if point in polygon to tbel --- .../server/actors/DefaultTbActorSystem.java | 2 +- common/script/script-api/pom.xml | 4 ++ .../thingsboard/script/api/tbel/TbUtils.java | 25 ++++++++++ .../shared/models/ace/tbel-utils.models.ts | 50 +++++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java b/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java index 1588f0d2b5..7fad1a329c 100644 --- a/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java +++ b/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java @@ -215,6 +215,7 @@ public class DefaultTbActorSystem implements TbActorSystem { @Override public void stop() { + actors.values().forEach(mailbox -> Optional.ofNullable(mailbox).ifPresent(m -> m.destroy(null))); dispatchers.values().forEach(dispatcher -> { dispatcher.getExecutor().shutdown(); try { @@ -226,7 +227,6 @@ public class DefaultTbActorSystem implements TbActorSystem { if (scheduler != null) { scheduler.shutdownNow(); } - actors.values().forEach(mailbox -> Optional.ofNullable(mailbox).ifPresent(m -> m.destroy(null))); actors.clear(); } diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index 3655692217..4b6c1ee21c 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -48,6 +48,10 @@ org.thingsboard.common util + + org.thingsboard.rule-engine + rule-engine-components + org.javadelight delight-nashorn-sandbox diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java index 95fff48883..ecb47668f3 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java @@ -15,6 +15,7 @@ */ package org.thingsboard.script.api.tbel; +import com.fasterxml.jackson.databind.JsonNode; import com.google.common.primitives.Bytes; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUtils; @@ -23,6 +24,10 @@ import org.mvel2.ParserConfiguration; import org.mvel2.execution.ExecutionArrayList; import org.mvel2.execution.ExecutionHashMap; import org.mvel2.util.MethodStub; +import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.geo.Coordinates; +import org.thingsboard.rule.engine.geo.GeoUtil; +import org.thingsboard.rule.engine.geo.RangeUnit; import org.thingsboard.server.common.data.StringUtils; import java.io.IOException; @@ -371,6 +376,10 @@ public class TbUtils { byte[].class, int.class))); parserConfig.addImport("parseBinaryArrayToInt", new MethodStub(TbUtils.class.getMethod("parseBinaryArrayToInt", byte[].class, int.class, int.class))); + parserConfig.addImport("isInsidePolygon", new MethodStub(TbUtils.class.getMethod("isInsidePolygon", + double.class, double.class, String.class))); + parserConfig.addImport("isInsideCircle", new MethodStub(TbUtils.class.getMethod("isInsideCircle", + double.class, double.class, String.class))); } public static String btoa(String input) { @@ -1437,6 +1446,22 @@ public class TbUtils { return result; } + public static boolean isInsidePolygon(double latitude, double longitude, String perimeter) { + return GeoUtil.contains(perimeter, new Coordinates(latitude, longitude)); + } + + public static boolean isInsideCircle(double latitude, double longitude, String perimeter) { + JsonNode perimeterJson = JacksonUtil.toJsonNode(perimeter); + double centerLatitude = Double.parseDouble(perimeterJson.get("latitude").asText()); + double centerLongitude = Double.parseDouble(perimeterJson.get("longitude").asText()); + double range = Double.parseDouble(perimeterJson.get("radius").asText()); + RangeUnit rangeUnit = perimeterJson.has("radiusUnit") ? RangeUnit.valueOf(perimeterJson.get("radiusUnit").asText()) : RangeUnit.METER; + + Coordinates entityCoordinates = new Coordinates(latitude, longitude); + Coordinates perimeterCoordinates = new Coordinates(centerLatitude, centerLongitude); + return range > GeoUtil.distance(entityCoordinates, perimeterCoordinates, rangeUnit); + } + private static byte isValidIntegerToByte(Integer val) { if (val > 255 || val < -128) { throw new NumberFormatException("The value '" + val + "' could not be correctly converted to a byte. " + diff --git a/ui-ngx/src/app/shared/models/ace/tbel-utils.models.ts b/ui-ngx/src/app/shared/models/ace/tbel-utils.models.ts index f29ae083be..c988f5ca0a 100644 --- a/ui-ngx/src/app/shared/models/ace/tbel-utils.models.ts +++ b/ui-ngx/src/app/shared/models/ace/tbel-utils.models.ts @@ -1245,6 +1245,56 @@ const tbelEditorCompletions:TbEditorCompletions = { type: 'boolean' } }, + isInsidePolygon: { + meta: 'function', + description: 'Checks if a given point is inside a polygon.', + args: [ + { + name: 'latitude', + description: 'The latitude of the point', + type: 'number' + }, + { + name: 'longitude', + description: 'The longitude of the point', + type: 'number' + }, + { + name: 'perimeter', + description: 'The polygon perimeter represented as a string', + type: 'string' + } + ], + return: { + description: 'True if the point is inside the polygon, false otherwise.', + type: 'boolean' + } + }, + isInsideCircle: { + meta: 'function', + description: 'Checks if a given point is inside a circular area.', + args: [ + { + name: 'latitude', + description: 'The latitude of the point', + type: 'number' + }, + { + name: 'longitude', + description: 'The longitude of the point', + type: 'number' + }, + { + name: 'perimeter', + description: 'A string representation of the circle, containing center coordinates and radius', + type: 'string' + } + ], + return: { + description: 'True if the point is inside the circle, false otherwise.', + type: 'boolean' + } + } } export const tbelUtilsAutocompletes = new TbEditorCompleter(tbelEditorCompletions); From 8eac8ea8c9b731640d0d07b5e88c50b97902a6e4 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 20 Mar 2025 15:16:35 +0200 Subject: [PATCH 045/286] UI: Add map widgets helps --- .../map/map-data-layer-dialog.component.html | 6 +++-- .../common/map/map-settings.component.html | 4 ++-- .../widget/action/custom_additional_params.md | 23 ++++++++++++++++++- .../assets/locale/locale.constant-en_US.json | 4 ++++ 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.html index 803cdd01f1..cc2d3ab031 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.html @@ -430,7 +430,7 @@ }
-
{{ 'widgets.maps.data-layer.groups' | translate }}
+
{{ 'widgets.maps.data-layer.groups' | translate }}
- {{ 'widgets.maps.data-layer.enable-snapping' | translate }} + + {{ 'widgets.maps.data-layer.enable-snapping' | translate }} +
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.html index 38a5d13922..b8d9515564 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.html @@ -36,7 +36,7 @@
-
+
{{ 'widgets.maps.overlays.overlays' | translate }}
-
+
{{ 'widgets.maps.data-layer.additional-datasources' | translate }}
formattedTs (a string value of formatted timestamp) and
timeseries values for each column declared in widget datasource configuration. - + +
  • Map widgets - additionalParams: FormattedData: +
      +
    • additionalParams: FormattedData - An object associated with a data layer (markers, polygons, circles) or with a specific data point of a route (for trips data layers).
      + It contains basic entity properties (ex. entityId, entityName) and provides access to additional attributes and timeseries defined in datasource of the data layer configuration. +
    • +
    +
  • +
  • Map widgets (Action type: Place map item) - additionalParams: {coordinates: Coordinates; layer: L.Layer}: +
      +
    • coordinates: Coordinates - Represents geographical coordinates of the placed map item. The actual format of this parameter depends on the type of the selected map item: +
        +
      • Marker: {x: number; y: number}, where x represents latitude, and y represents longitude.
      • +
      • Polygon, Rectangle: TbPolygonRawCoordinates contains an array of points defining the shape boundaries.
      • +
      • Circle: TbCircleData contains center coordinates and radius information.
      • +
      + Note: The coordinates will be automatically converted according to the selected map type. +
    • +
    • layer: L.Layer - The Leaflet map layer instance (e.g., marker, polygon, circle) associated with the placed map item. This object provides access to layer properties and methods defined in Leaflet's API. +
    • +
    +
  • Entities hierarchy widget (On node selected) - additionalParams: { nodeCtx: HierarchyNodeContext }:
    • nodeCtx: HierarchyNodeContext - An diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 61bdb48b7c..c294b0210a 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -7976,6 +7976,7 @@ }, "overlays": { "overlays": "Overlays", + "overlays-hint": "Configure datasources, appearance, behavior, editing options, and grouping for map entities", "trips": "Trips", "markers": "Markers", "polygons": "Polygons", @@ -7985,6 +7986,7 @@ "source": "Source", "additional-data-keys": "Additional data keys", "additional-datasources": "Additional datasources", + "additional-datasources-hint": "Datasource for accessing attributes or telemetry from entities not displayed on the map, usable in map overlay functions.", "data-keys": "Data keys", "add-datasource": "Add datasource", "no-datasources": "No datasources configured", @@ -7993,6 +7995,7 @@ "on-click": "On click", "on-click-hint": "Action invoked when user clicks on the map item.", "groups": "Groups", + "groups-hint": "List of group names assigned to this datasource. Used to toggle visibility of datasource items on the map.", "color": "Color", "fill-color": "Fill color", "stroke": "Stroke", @@ -8030,6 +8033,7 @@ "edit-instruments": "Instruments", "persist-location-attribute-scope": "Scope of the attribute to persist location", "enable-snapping": "Enable snapping to other vertices for precision drawing", + "enable-snapping-hint": "Automatically aligns new points with existing shapes to make drawing easier and more accurate.", "drag-drop-mode": "Drag-drop mode", "trip": { "no-trips": "No trips configured", From f0bfea12c0cf404741c44610f500eaf4407a5771 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Thu, 20 Mar 2025 16:06:56 +0200 Subject: [PATCH 046/286] moved geoutils to script api --- .../server/actors/tenant/TenantActor.java | 3 +++ .../server/actors/DefaultTbActorSystem.java | 2 -- common/script/script-api/pom.xml | 12 ++++++--- .../thingsboard/script/api}/Coordinates.java | 2 +- .../org/thingsboard/script/api}/GeoUtil.java | 2 +- .../thingsboard/script/api}/Perimeter.java | 2 +- .../script/api}/PerimeterType.java | 2 +- .../thingsboard/script/api}/RangeUnit.java | 2 +- .../thingsboard/script/api/tbel/TbUtils.java | 6 ++--- rule-engine/rule-engine-components/pom.xml | 12 +++------ .../engine/geo/AbstractGeofencingNode.java | 7 ++++- ...bGpsGeofencingActionNodeConfiguration.java | 1 + ...bGpsGeofencingFilterNodeConfiguration.java | 2 ++ .../rule/engine/geo/GeoUtilTest.java | 26 ++++++++++--------- .../geo/TbGpsGeofencingFilterNodeTest.java | 3 +++ 15 files changed, 49 insertions(+), 35 deletions(-) rename {rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo => common/script/script-api/src/main/java/org/thingsboard/script/api}/Coordinates.java (94%) rename {rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo => common/script/script-api/src/main/java/org/thingsboard/script/api}/GeoUtil.java (99%) rename {rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo => common/script/script-api/src/main/java/org/thingsboard/script/api}/Perimeter.java (95%) rename {rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo => common/script/script-api/src/main/java/org/thingsboard/script/api}/PerimeterType.java (94%) rename {rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo => common/script/script-api/src/main/java/org/thingsboard/script/api}/RangeUnit.java (95%) diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index 49994eaa1f..728f715af4 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -127,6 +127,9 @@ public class TenantActor extends RuleChainManagerActor { @Override public void destroy(TbActorStopReason stopReason, Throwable cause) { log.info("[{}] Stopping tenant actor.", tenantId); + if (cfActor != null) { + ctx.stop(cfActor.getActorId()); + } } @Override diff --git a/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java b/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java index 7fad1a329c..85638763b2 100644 --- a/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java +++ b/common/actor/src/main/java/org/thingsboard/server/actors/DefaultTbActorSystem.java @@ -23,7 +23,6 @@ import org.thingsboard.server.common.msg.TbActorMsg; import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -215,7 +214,6 @@ public class DefaultTbActorSystem implements TbActorSystem { @Override public void stop() { - actors.values().forEach(mailbox -> Optional.ofNullable(mailbox).ifPresent(m -> m.destroy(null))); dispatchers.values().forEach(dispatcher -> { dispatcher.getExecutor().shutdown(); try { diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index 4b6c1ee21c..da60567814 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -48,10 +48,6 @@ org.thingsboard.common util - - org.thingsboard.rule-engine - rule-engine-components - org.javadelight delight-nashorn-sandbox @@ -115,6 +111,14 @@ awaitility test + + org.locationtech.spatial4j + spatial4j + + + org.locationtech.jts + jts-core + diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/Coordinates.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/Coordinates.java similarity index 94% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/Coordinates.java rename to common/script/script-api/src/main/java/org/thingsboard/script/api/Coordinates.java index c3b91e39bb..671ab58d5c 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/Coordinates.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/Coordinates.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.rule.engine.geo; +package org.thingsboard.script.api; import lombok.Data; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/GeoUtil.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/GeoUtil.java similarity index 99% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/GeoUtil.java rename to common/script/script-api/src/main/java/org/thingsboard/script/api/GeoUtil.java index f92a345362..408b051303 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/GeoUtil.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/GeoUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.rule.engine.geo; +package org.thingsboard.script.api; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/Perimeter.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/Perimeter.java similarity index 95% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/Perimeter.java rename to common/script/script-api/src/main/java/org/thingsboard/script/api/Perimeter.java index 3474683c6c..e05486bee0 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/Perimeter.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/Perimeter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.rule.engine.geo; +package org.thingsboard.script.api; import lombok.Data; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/PerimeterType.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/PerimeterType.java similarity index 94% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/PerimeterType.java rename to common/script/script-api/src/main/java/org/thingsboard/script/api/PerimeterType.java index 2df6cf796c..f6a0eea77e 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/PerimeterType.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/PerimeterType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.rule.engine.geo; +package org.thingsboard.script.api; public enum PerimeterType { CIRCLE, POLYGON diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/RangeUnit.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/RangeUnit.java similarity index 95% rename from rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/RangeUnit.java rename to common/script/script-api/src/main/java/org/thingsboard/script/api/RangeUnit.java index 090d251b33..6a594d1668 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/RangeUnit.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/RangeUnit.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.rule.engine.geo; +package org.thingsboard.script.api; public enum RangeUnit { METER(1000.0), KILOMETER(1.0), FOOT(3280.84), MILE(0.62137), NAUTICAL_MILE(0.539957); diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java index ecb47668f3..12eb308fee 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java @@ -25,9 +25,9 @@ import org.mvel2.execution.ExecutionArrayList; import org.mvel2.execution.ExecutionHashMap; import org.mvel2.util.MethodStub; import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.rule.engine.geo.Coordinates; -import org.thingsboard.rule.engine.geo.GeoUtil; -import org.thingsboard.rule.engine.geo.RangeUnit; +import org.thingsboard.script.api.Coordinates; +import org.thingsboard.script.api.GeoUtil; +import org.thingsboard.script.api.RangeUnit; import org.thingsboard.server.common.data.StringUtils; import java.io.IOException; diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index eb568f9cc7..4eb76727ef 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -53,6 +53,10 @@ transport-api provided + + org.thingsboard.common.script + script-api + ch.qos.logback logback-core @@ -120,14 +124,6 @@ org.bouncycastle bcpkix-jdk18on - - org.locationtech.spatial4j - spatial4j - - - org.locationtech.jts - jts-core - com.sun.mail jakarta.mail diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java index 8025baeec7..ea0d62ebc0 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java @@ -26,6 +26,11 @@ import org.thingsboard.rule.engine.api.TbNode; import org.thingsboard.rule.engine.api.TbNodeConfiguration; import org.thingsboard.rule.engine.api.TbNodeException; import org.thingsboard.rule.engine.api.util.TbNodeUtils; +import org.thingsboard.script.api.Coordinates; +import org.thingsboard.script.api.GeoUtil; +import org.thingsboard.script.api.Perimeter; +import org.thingsboard.script.api.PerimeterType; +import org.thingsboard.script.api.RangeUnit; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.msg.TbMsg; @@ -74,7 +79,7 @@ public abstract class AbstractGeofencingNode Date: Thu, 20 Mar 2025 16:12:42 +0200 Subject: [PATCH 047/286] EDQS: don't use Kafka manual partitions assignment --- .../server/service/edqs/EdqsSyncService.java | 3 ++ .../service/edqs/KafkaEdqsSyncService.java | 10 +++++- .../src/main/resources/thingsboard.yml | 12 +++---- .../server/edqs/processor/EdqsProcessor.java | 7 ++-- .../server/edqs/processor/EdqsProducer.java | 12 +++---- .../edqs/state/KafkaEdqsStateService.java | 10 +++++- .../common/DefaultTbQueueRequestTemplate.java | 1 - .../server/queue/kafka/TbKafkaAdmin.java | 33 ++++++++++++++----- edqs/src/main/resources/edqs.yml | 12 +++---- 9 files changed, 63 insertions(+), 37 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java b/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java index 79e0e60983..6ea2f959b7 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java @@ -43,6 +43,7 @@ import org.thingsboard.server.dao.model.sqlts.dictionary.KeyDictionaryEntry; import org.thingsboard.server.dao.model.sqlts.latest.TsKvLatestEntity; import org.thingsboard.server.dao.sql.relation.RelationRepository; import org.thingsboard.server.dao.sqlts.latest.TsKvLatestRepository; +import org.thingsboard.server.queue.edqs.EdqsConfig; import java.util.List; import java.util.Map; @@ -75,6 +76,8 @@ public abstract class EdqsSyncService { @Autowired @Lazy private DefaultEdqsService edqsService; + @Autowired + protected EdqsConfig edqsConfig; private final ConcurrentHashMap entityInfoMap = new ConcurrentHashMap<>(); private final ConcurrentHashMap keys = new ConcurrentHashMap<>(); diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java b/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java index 4ef552521b..201964c955 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java @@ -17,11 +17,14 @@ package org.thingsboard.server.service.edqs; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; +import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.kafka.TbKafkaAdmin; import org.thingsboard.server.queue.kafka.TbKafkaSettings; import java.util.Collections; +import java.util.stream.Collectors; +import java.util.stream.IntStream; @Service @ConditionalOnExpression("'${queue.edqs.sync.enabled:true}' == 'true' && '${queue.type:null}' == 'kafka'") @@ -31,7 +34,12 @@ public class KafkaEdqsSyncService extends EdqsSyncService { public KafkaEdqsSyncService(TbKafkaSettings kafkaSettings) { TbKafkaAdmin kafkaAdmin = new TbKafkaAdmin(kafkaSettings, Collections.emptyMap()); - this.syncNeeded = kafkaAdmin.isTopicEmpty(EdqsQueue.EVENTS.getTopic()); + this.syncNeeded = kafkaAdmin.areAllTopicsEmpty(IntStream.range(0, edqsConfig.getPartitions()) + .mapToObj(partition -> TopicPartitionInfo.builder() + .topic(EdqsQueue.EVENTS.getTopic()) + .partition(partition) + .build().getFullTopicName()) + .collect(Collectors.toSet())); } @Override diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index c61a993d56..eac787d52b 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1645,12 +1645,12 @@ queue: calculated-field: "${TB_QUEUE_KAFKA_CF_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" # Kafka properties for Calculated Field State topics calculated-field-state: "${TB_QUEUE_KAFKA_CF_STATE_TOPIC_PROPERTIES:retention.ms:-1;segment.bytes:52428800;retention.bytes:104857600000;partitions:1;min.insync.replicas:1;cleanup.policy:compact}" - # Kafka properties for EDQS events topics. Partitions number must be the same as queue.edqs.partitions - edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:-1;partitions:12;min.insync.replicas:1}" - # Kafka properties for EDQS requests topic (default: 3 minutes retention). Partitions number must be the same as queue.edqs.partitions - edqs-requests: "${TB_QUEUE_KAFKA_EDQS_REQUESTS_TOPIC_PROPERTIES:retention.ms:180000;segment.bytes:52428800;retention.bytes:1048576000;partitions:12;min.insync.replicas:1}" - # Kafka properties for EDQS state topic (infinite retention, compaction). Partitions number must be the same as queue.edqs.partitions - edqs-state: "${TB_QUEUE_KAFKA_EDQS_STATE_TOPIC_PROPERTIES:retention.ms:-1;segment.bytes:52428800;retention.bytes:-1;partitions:12;min.insync.replicas:1;cleanup.policy:compact}" + # Kafka properties for EDQS events topics + edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1}" + # Kafka properties for EDQS requests topic (default: 3 minutes retention) + edqs-requests: "${TB_QUEUE_KAFKA_EDQS_REQUESTS_TOPIC_PROPERTIES:retention.ms:180000;segment.bytes:52428800;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" + # Kafka properties for EDQS state topic (infinite retention, compaction) + edqs-state: "${TB_QUEUE_KAFKA_EDQS_STATE_TOPIC_PROPERTIES:retention.ms:-1;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1;cleanup.policy:compact}" consumer-stats: # Prints lag between consumer group offset and last messages offset in Kafka topics enabled: "${TB_QUEUE_KAFKA_CONSUMER_STATS_ENABLED:true}" diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java index 7ddc9147df..f2360617ee 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java @@ -164,13 +164,10 @@ public class EdqsProcessor implements TbQueueHandler, } try { Set newPartitions = event.getNewPartitions().get(new QueueKey(ServiceType.EDQS)); - Set partitions = newPartitions.stream() - .map(tpi -> tpi.withUseInternalPartition(true)) - .collect(Collectors.toSet()); - stateService.process(withTopic(partitions, EdqsQueue.STATE.getTopic())); + stateService.process(withTopic(newPartitions, EdqsQueue.STATE.getTopic())); // eventsConsumer's partitions are updated by stateService - responseTemplate.subscribe(withTopic(partitions, config.getRequestsTopic())); // FIXME: we subscribe to partitions before we are ready. implement consumer-per-partition version for request template + responseTemplate.subscribe(withTopic(newPartitions, config.getRequestsTopic())); // TODO: we subscribe to partitions before we are ready. implement consumer-per-partition version for request template Set oldPartitions = event.getOldPartitions().get(new QueueKey(ServiceType.EDQS)); if (CollectionsUtil.isNotEmpty(oldPartitions)) { diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java index be1f0481be..970ee76381 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java @@ -70,17 +70,13 @@ public class EdqsProducer { log.warn("[{}][{}][{}] Failed to publish msg to {}: {}", tenantId, type, key, topic, msg, t); } }; + TopicPartitionInfo tpi = TopicPartitionInfo.builder() + .topic(topic) + .partition(partitionService.resolvePartition(tenantId)) + .build(); if (producer instanceof TbKafkaProducerTemplate> kafkaProducer) { - TopicPartitionInfo tpi = TopicPartitionInfo.builder() - .topic(topic) - .partition(partitionService.resolvePartition(tenantId)) - .useInternalPartition(true) - .build(); kafkaProducer.send(tpi, key, new TbProtoQueueMsg<>(null, msg), callback); // specifying custom key for compaction } else { - TopicPartitionInfo tpi = TopicPartitionInfo.builder() - .topic(topic) - .build(); producer.send(tpi, new TbProtoQueueMsg<>(null, msg), callback); } } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java index 85b8e92387..067c730bfe 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java @@ -45,6 +45,8 @@ import org.thingsboard.server.queue.edqs.KafkaEdqsComponent; import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; +import java.util.stream.IntStream; @Service @RequiredArgsConstructor @@ -151,7 +153,13 @@ public class KafkaEdqsStateService implements EdqsStateService { @Override public void process(Set partitions) { if (queueStateService.getPartitions().isEmpty()) { - eventsToBackupConsumer.subscribe(); + Set allPartitions = IntStream.range(0, config.getPartitions()) + .mapToObj(partition -> TopicPartitionInfo.builder() + .topic(EdqsQueue.EVENTS.getTopic()) + .partition(partition) + .build()) + .collect(Collectors.toSet()); + eventsToBackupConsumer.subscribe(allPartitions); eventsToBackupConsumer.launch(); } queueStateService.update(new QueueKey(ServiceType.EDQS), partitions); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/common/DefaultTbQueueRequestTemplate.java b/common/queue/src/main/java/org/thingsboard/server/queue/common/DefaultTbQueueRequestTemplate.java index 4efb297491..1beb505595 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/common/DefaultTbQueueRequestTemplate.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/common/DefaultTbQueueRequestTemplate.java @@ -263,7 +263,6 @@ public class DefaultTbQueueRequestTemplate topics) { try { - if (!getTopics().contains(topic)) { + List existingTopics = getTopics().stream().filter(topics::contains).toList(); + if (existingTopics.isEmpty()) { return true; } - TopicDescription topicDescription = settings.getAdminClient().describeTopics(Collections.singletonList(topic)).topicNameValues().get(topic).get(); - List partitions = topicDescription.partitions().stream().map(partitionInfo -> new TopicPartition(topic, partitionInfo.partition())).toList(); - Map beginningOffsets = settings.getAdminClient().listOffsets(partitions.stream() + List allPartitions = settings.getAdminClient().describeTopics(existingTopics).topicNameValues().entrySet().stream() + .flatMap(entry -> { + String topic = entry.getKey(); + TopicDescription topicDescription; + try { + topicDescription = entry.getValue().get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + return topicDescription.partitions().stream().map(partitionInfo -> new TopicPartition(topic, partitionInfo.partition())); + }) + .toList(); + + Map beginningOffsets = settings.getAdminClient().listOffsets(allPartitions.stream() .collect(Collectors.toMap(partition -> partition, partition -> OffsetSpec.earliest()))).all().get(); - - Map endOffsets = settings.getAdminClient().listOffsets(partitions.stream() + Map endOffsets = settings.getAdminClient().listOffsets(allPartitions.stream() .collect(Collectors.toMap(partition -> partition, partition -> OffsetSpec.latest()))).all().get(); - for (TopicPartition partition : partitions) { + for (TopicPartition partition : allPartitions) { long beginningOffset = beginningOffsets.get(partition).offset(); long endOffset = endOffsets.get(partition).offset(); if (beginningOffset != endOffset) { - log.debug("Partition [{}] of topic [{}] is not empty. Returning false.", partition.partition(), topic); + log.debug("Partition [{}] of topic [{}] is not empty. Returning false.", partition.partition(), partition.topic()); return false; } } return true; } catch (InterruptedException | ExecutionException e) { - log.error("Failed to check if topic [{}] is empty.", topic, e); + log.error("Failed to check if topics [{}] empty.", topics, e); return false; } } diff --git a/edqs/src/main/resources/edqs.yml b/edqs/src/main/resources/edqs.yml index f7d0eda841..c101eff68e 100644 --- a/edqs/src/main/resources/edqs.yml +++ b/edqs/src/main/resources/edqs.yml @@ -148,12 +148,12 @@ queue: # - key: "session.timeout.ms" # refer to https://docs.confluent.io/platform/current/installation/configuration/consumer-configs.html#consumerconfigs_session.timeout.ms # value: "${TB_QUEUE_KAFKA_SESSION_TIMEOUT_MS:10000}" # (10 seconds) topic-properties: - # Kafka properties for EDQS events topics. Partitions number must be the same as queue.edqs.partitions - edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:-1;partitions:12;min.insync.replicas:1}" - # Kafka properties for EDQS requests topic (default: 3 minutes retention). Partitions number must be the same as queue.edqs.partitions - edqs-requests: "${TB_QUEUE_KAFKA_EDQS_REQUESTS_TOPIC_PROPERTIES:retention.ms:180000;segment.bytes:52428800;retention.bytes:1048576000;partitions:12;min.insync.replicas:1}" - # Kafka properties for EDQS state topic (infinite retention, compaction). Partitions number must be the same as queue.edqs.partitions - edqs-state: "${TB_QUEUE_KAFKA_EDQS_STATE_TOPIC_PROPERTIES:retention.ms:-1;segment.bytes:52428800;retention.bytes:-1;partitions:12;min.insync.replicas:1;cleanup.policy:compact}" + # Kafka properties for EDQS events topics + edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1}" + # Kafka properties for EDQS requests topic (default: 3 minutes retention) + edqs-requests: "${TB_QUEUE_KAFKA_EDQS_REQUESTS_TOPIC_PROPERTIES:retention.ms:180000;segment.bytes:52428800;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" + # Kafka properties for EDQS state topic (infinite retention, compaction) + edqs-state: "${TB_QUEUE_KAFKA_EDQS_STATE_TOPIC_PROPERTIES:retention.ms:-1;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1;cleanup.policy:compact}" consumer-stats: # Prints lag between consumer group offset and last messages offset in Kafka topics enabled: "${TB_QUEUE_KAFKA_CONSUMER_STATS_ENABLED:true}" From 77c9628b14aef5e53bfc43c07085ee237fa2e13a Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 20 Mar 2025 15:48:44 +0100 Subject: [PATCH 048/286] added interval validation to the query validator --- .../dao/timeseries/BaseTimeseriesService.java | 7 ++++++- .../timeseries/BaseTimeseriesServiceTest.java | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java b/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java index a1137853ab..9eefcaae1e 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/timeseries/BaseTimeseriesService.java @@ -295,7 +295,12 @@ public class BaseTimeseriesService implements TimeseriesService { throw new IncorrectParameterException("Incorrect ReadTsKvQuery. Aggregation can't be empty"); } if (!Aggregation.NONE.equals(query.getAggregation())) { - long step = Math.max(query.getInterval(), 1000); + long interval = query.getInterval(); + if (interval < 1) { + throw new IncorrectParameterException("Invalid TsKvQuery: 'interval' must be greater than 0, but got " + interval + + ". Please check your query parameters and ensure 'endTs' is greater than 'startTs' or increase 'interval'."); + } + long step = Math.max(interval, 1000); long intervalCounts = (query.getEndTs() - query.getStartTs()) / step; if (intervalCounts > maxTsIntervals || intervalCounts < 0) { throw new IncorrectParameterException("Incorrect TsKvQuery. Number of intervals is to high - " + intervalCounts + ". " + diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java index a070de4d82..6a38159804 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java @@ -45,6 +45,7 @@ import org.thingsboard.server.common.data.kv.StringDataEntry; import org.thingsboard.server.common.data.kv.TsKvEntry; import org.thingsboard.server.common.data.objects.TelemetryEntityView; import org.thingsboard.server.dao.entityview.EntityViewService; +import org.thingsboard.server.dao.exception.IncorrectParameterException; import org.thingsboard.server.dao.service.AbstractServiceTest; import org.thingsboard.server.dao.timeseries.TimeseriesService; @@ -757,6 +758,21 @@ public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest { assertThat(fullList).containsOnlyOnceElementsOf(timeseries); } + @Test + public void testFindAllByQueriesWithAggregationAndZeroInterval() throws Exception { + testFindAllByQueriesWithAggregationAndInvalidInterval(0); + } + + @Test + public void testFindAllByQueriesWithAggregationAndNegativeInterval() throws Exception { + testFindAllByQueriesWithAggregationAndInvalidInterval(-1); + } + + private void testFindAllByQueriesWithAggregationAndInvalidInterval(long interval) { + BaseReadTsKvQuery query = new BaseReadTsKvQuery(STRING_KEY, TS, TS, interval, 1000, Aggregation.SUM, "DESC"); + Assert.assertThrows(IncorrectParameterException.class, () -> findAndVerifyQueryId(deviceId, query)); + } + private TsKvEntry save(DeviceId deviceId, long ts, long value) throws Exception { TsKvEntry entry = new BasicTsKvEntry(ts, new LongDataEntry(LONG_KEY, value)); tsService.save(tenantId, deviceId, entry).get(MAX_TIMEOUT, TimeUnit.SECONDS); From 0a14ce3f12399054eb22668e24903858bc8f823e Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Thu, 20 Mar 2025 16:53:28 +0200 Subject: [PATCH 049/286] Add EDQS monitoring --- .../monitoring/data/Latencies.java | 1 + .../monitoring/data/MonitoredServiceKey.java | 1 + .../service/BaseMonitoringService.java | 68 +++++++++++++++++++ .../src/main/resources/tb-monitoring.yml | 3 + 4 files changed, 73 insertions(+) diff --git a/monitoring/src/main/java/org/thingsboard/monitoring/data/Latencies.java b/monitoring/src/main/java/org/thingsboard/monitoring/data/Latencies.java index a190b7b791..b42e9138e4 100644 --- a/monitoring/src/main/java/org/thingsboard/monitoring/data/Latencies.java +++ b/monitoring/src/main/java/org/thingsboard/monitoring/data/Latencies.java @@ -20,6 +20,7 @@ public class Latencies { public static final String WS_CONNECT = "wsConnect"; public static final String WS_SUBSCRIBE = "wsSubscribe"; public static final String LOG_IN = "logIn"; + public static final String EDQS_QUERY = "edqsQuery"; public static String request(String key) { return String.format("%sRequest", key); diff --git a/monitoring/src/main/java/org/thingsboard/monitoring/data/MonitoredServiceKey.java b/monitoring/src/main/java/org/thingsboard/monitoring/data/MonitoredServiceKey.java index 342ee121ef..9c3ee5b786 100644 --- a/monitoring/src/main/java/org/thingsboard/monitoring/data/MonitoredServiceKey.java +++ b/monitoring/src/main/java/org/thingsboard/monitoring/data/MonitoredServiceKey.java @@ -18,5 +18,6 @@ package org.thingsboard.monitoring.data; public class MonitoredServiceKey { public static final String GENERAL = "Monitoring"; + public static final String EDQS = "*EDQS*"; } diff --git a/monitoring/src/main/java/org/thingsboard/monitoring/service/BaseMonitoringService.java b/monitoring/src/main/java/org/thingsboard/monitoring/service/BaseMonitoringService.java index 9157e9f31c..7219e4f9aa 100644 --- a/monitoring/src/main/java/org/thingsboard/monitoring/service/BaseMonitoringService.java +++ b/monitoring/src/main/java/org/thingsboard/monitoring/service/BaseMonitoringService.java @@ -15,10 +15,13 @@ */ package org.thingsboard.monitoring.service; +import com.google.common.collect.Sets; import jakarta.annotation.PostConstruct; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationContext; import org.thingsboard.monitoring.client.TbClient; import org.thingsboard.monitoring.client.WsClient; @@ -27,13 +30,26 @@ import org.thingsboard.monitoring.config.MonitoringConfig; import org.thingsboard.monitoring.config.MonitoringTarget; import org.thingsboard.monitoring.data.Latencies; import org.thingsboard.monitoring.data.MonitoredServiceKey; +import org.thingsboard.monitoring.data.ServiceFailureException; import org.thingsboard.monitoring.service.transport.TransportHealthChecker; import org.thingsboard.monitoring.util.TbStopWatch; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.query.EntityData; +import org.thingsboard.server.common.data.query.EntityDataPageLink; +import org.thingsboard.server.common.data.query.EntityDataQuery; +import org.thingsboard.server.common.data.query.EntityDataSortOrder; +import org.thingsboard.server.common.data.query.EntityKey; +import org.thingsboard.server.common.data.query.EntityKeyType; +import org.thingsboard.server.common.data.query.EntityTypeFilter; +import org.thingsboard.server.common.data.query.TsValue; import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -41,6 +57,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; +import java.util.stream.Stream; @Slf4j public abstract class BaseMonitoringService, T extends MonitoringTarget> { @@ -61,6 +78,9 @@ public abstract class BaseMonitoringService, T ext @Autowired protected ApplicationContext applicationContext; + @Value("${monitoring.edqs.enabled:false}") + private boolean edqsMonitoringEnabled; + @PostConstruct private void init() { if (configs == null || configs.isEmpty()) { @@ -108,6 +128,21 @@ public abstract class BaseMonitoringService, T ext check(healthChecker, wsClient); } } + + if (edqsMonitoringEnabled) { + try { + stopWatch.start(); + checkEdqs(); + reporter.reportLatency(Latencies.EDQS_QUERY, stopWatch.getTime()); + + reporter.serviceIsOk(MonitoredServiceKey.EDQS); + } catch (ServiceFailureException e) { + reporter.serviceFailure(MonitoredServiceKey.EDQS, e); + } catch (Exception e) { + reporter.serviceFailure(MonitoredServiceKey.GENERAL, e); + } + } + reporter.reportLatencies(tbClient); log.debug("Finished {}", getName()); } catch (Throwable error) { @@ -149,6 +184,39 @@ public abstract class BaseMonitoringService, T ext } } + private void checkEdqs() { + EntityTypeFilter entityTypeFilter = new EntityTypeFilter(); + entityTypeFilter.setEntityType(EntityType.DEVICE); + EntityDataPageLink pageLink = new EntityDataPageLink(100, 0, null, new EntityDataSortOrder(new EntityKey(EntityKeyType.ENTITY_FIELD, "name"))); + EntityDataQuery entityDataQuery = new EntityDataQuery(entityTypeFilter, pageLink, + List.of(new EntityKey(EntityKeyType.ENTITY_FIELD, "name"), new EntityKey(EntityKeyType.ENTITY_FIELD, "type")), + List.of(new EntityKey(EntityKeyType.TIME_SERIES, "testData")), + Collections.emptyList()); + + PageData result = tbClient.findEntityDataByQuery(entityDataQuery); + Set devices = result.getData().stream() + .map(entityData -> entityData.getEntityId().getId()) + .collect(Collectors.toSet()); + Set missing = Sets.difference(new HashSet<>(this.devices), devices); + if (!missing.isEmpty()) { + throw new ServiceFailureException("Missing devices in the response: " + missing); + } + + result.getData().stream() + .filter(entityData -> this.devices.contains(entityData.getEntityId().getId())) + .forEach(entityData -> { + Map values = new HashMap<>(entityData.getLatest().get(EntityKeyType.ENTITY_FIELD)); + values.putAll(entityData.getLatest().get(EntityKeyType.TIME_SERIES)); + + Stream.of("name", "type", "testData").forEach(key -> { + TsValue value = values.get(key); + if (value == null || StringUtils.isBlank(value.getValue())) { + throw new ServiceFailureException("Missing " + key + " for device " + entityData.getEntityId()); + } + }); + }); + } + @SneakyThrows private Set getAssociatedUrls(String baseUrl) { URI url = new URI(baseUrl); diff --git a/monitoring/src/main/resources/tb-monitoring.yml b/monitoring/src/main/resources/tb-monitoring.yml index ae0d265ed6..6cc2e79cb4 100644 --- a/monitoring/src/main/resources/tb-monitoring.yml +++ b/monitoring/src/main/resources/tb-monitoring.yml @@ -105,6 +105,9 @@ monitoring: # To add more targets, use following environment variables: # monitoring.transports.lwm2m.targets[1].base_url, monitoring.transports.lwm2m.targets[2].base_url, etc. + edqs: + enabled: "${EDQS_MONITORING_ENABLED:false}" + notifications: message_prefix: '${NOTIFICATION_MESSAGE_PREFIX:}' slack: From 6285bed838b942acf5c65a5757b09fcf8d1d20aa Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Thu, 20 Mar 2025 16:59:35 +0200 Subject: [PATCH 050/286] fixed edqs sorting for numeric values --- .../entitiy/EdqsEntityServiceTest.java | 2 +- .../service/entitiy/EntityServiceTest.java | 19 ++++++++++++--- .../server/common/data/edqs/DataPoint.java | 2 +- .../edqs/data/dp/AbstractDataPoint.java | 17 +++++++++++++ .../server/edqs/data/dp/DoubleDataPoint.java | 5 ++++ .../server/edqs/data/dp/LongDataPoint.java | 6 +++++ .../server/edqs/query/SortableEntityData.java | 3 ++- .../processor/AbstractQueryProcessor.java | 5 ++-- .../server/edqs/repo/TenantRepo.java | 23 +++++++++--------- .../server/edqs/util/RepositoryUtils.java | 24 ++----------------- 10 files changed, 65 insertions(+), 41 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/entitiy/EdqsEntityServiceTest.java b/application/src/test/java/org/thingsboard/server/service/entitiy/EdqsEntityServiceTest.java index 50c80d08c7..5264e69bd3 100644 --- a/application/src/test/java/org/thingsboard/server/service/entitiy/EdqsEntityServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/entitiy/EdqsEntityServiceTest.java @@ -110,7 +110,7 @@ public class EdqsEntityServiceTest extends EntityServiceTest { @Override protected List findByQueryAndCheckTelemetry(EntityDataQuery query, EntityKeyType entityKeyType, String key, List expectedTelemetries) { - return await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> findEntitiesTelemetry(query, entityKeyType, key, expectedTelemetries), + return await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> loadAllData(query, expectedTelemetries.size()), loadedEntities -> loadedEntities.stream().map(entityData -> entityData.getLatest().get(entityKeyType).get(key).getValue()).toList().containsAll(expectedTelemetries)); } diff --git a/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java b/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java index 1e7f5384b5..e5c4009715 100644 --- a/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java @@ -1698,6 +1698,19 @@ public class EntityServiceTest extends AbstractControllerTest { query = new EntityDataQuery(filter, pageLink, entityFields, latestValues, keyFilters); findByQueryAndCheckTelemetry(query, EntityKeyType.TIME_SERIES, "temperature", deviceHighTemperatures); + // change sort order to sort by temperature + temperatures.sort(Comparator.naturalOrder()); + List expectedSortedList = temperatures.stream().map(aDouble -> Double.toString(aDouble)).collect(Collectors.toList()); + + EntityDataSortOrder sortByTempOrder = new EntityDataSortOrder( + new EntityKey(EntityKeyType.TIME_SERIES, "temperature"), EntityDataSortOrder.Direction.ASC); + EntityDataPageLink sortByTempPageLink = new EntityDataPageLink(10, 0, null, sortByTempOrder); + EntityDataQuery querySortByTemp = new EntityDataQuery(filter, sortByTempPageLink, entityFields, latestValues, null); + + List loadedEntities = loadAllData(querySortByTemp, deviceTemperatures.size()); + List entitiesTelemetry = loadedEntities.stream().map(entityData -> entityData.getLatest().get(EntityKeyType.TIME_SERIES).get("temperature").getValue()).toList(); + assertThat(entitiesTelemetry).containsExactlyElementsOf(expectedSortedList); + deviceService.deleteDevicesByTenantId(tenantId); } @@ -2377,14 +2390,14 @@ public class EntityServiceTest extends AbstractControllerTest { } protected List findByQueryAndCheckTelemetry(EntityDataQuery query, EntityKeyType entityKeyType, String key, List expectedTelemetry) { - List loadedEntities = findEntitiesTelemetry(query, entityKeyType, key, expectedTelemetry); + List loadedEntities = loadAllData(query, expectedTelemetry.size()); List entitiesTelemetry = loadedEntities.stream().map(entityData -> entityData.getLatest().get(entityKeyType).get(key).getValue()).toList(); assertThat(entitiesTelemetry).containsExactlyInAnyOrderElementsOf(expectedTelemetry); return loadedEntities; } - protected List findEntitiesTelemetry(EntityDataQuery query, EntityKeyType entityKeyType, String key, List expectedTelemetries) { - PageData data = findByQueryAndCheck(query, expectedTelemetries.size()); + protected List loadAllData(EntityDataQuery query, int expectedSize) { + PageData data = findByQueryAndCheck(query, expectedSize); List loadedEntities = new ArrayList<>(data.getData()); while (data.hasNext()) { query = query.next(); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/edqs/DataPoint.java b/common/data/src/main/java/org/thingsboard/server/common/data/edqs/DataPoint.java index a6f30c8004..75829dfbbf 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/edqs/DataPoint.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/edqs/DataPoint.java @@ -17,7 +17,7 @@ package org.thingsboard.server.common.data.edqs; import org.thingsboard.server.common.data.kv.DataType; -public interface DataPoint { +public interface DataPoint extends Comparable { String NOT_SUPPORTED = "Not supported!"; diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java index fd2d099281..5cd2c562ca 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java @@ -54,4 +54,21 @@ public abstract class AbstractDataPoint implements DataPoint { return valueToString(); } + @Override + public int compareTo(DataPoint dataPoint) { + String str1 = this.valueToString(); + String str2 = dataPoint.valueToString(); + + if (str1 == null && str2 == null) { + return 0; + } + if (str1 == null) { + return -1; + } + if (str2 == null) { + return 1; + } + return str1.compareToIgnoreCase(str2); + } + } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/DoubleDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/DoubleDataPoint.java index 21b355bc46..2ca8f2c03a 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/DoubleDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/DoubleDataPoint.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edqs.data.dp; import lombok.Getter; +import org.thingsboard.server.common.data.edqs.DataPoint; import org.thingsboard.server.common.data.kv.DataType; public class DoubleDataPoint extends AbstractDataPoint { @@ -43,4 +44,8 @@ public class DoubleDataPoint extends AbstractDataPoint { return Double.toString(value); } + @Override + public int compareTo(DataPoint dataPoint) { + return Double.compare(value, dataPoint.getDouble()); + } } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/LongDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/LongDataPoint.java index 7fbe90e814..92c0a972e7 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/LongDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/LongDataPoint.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edqs.data.dp; import lombok.Getter; +import org.thingsboard.server.common.data.edqs.DataPoint; import org.thingsboard.server.common.data.kv.DataType; public class LongDataPoint extends AbstractDataPoint { @@ -47,4 +48,9 @@ public class LongDataPoint extends AbstractDataPoint { public String valueToString() { return Long.toString(value); } + + @Override + public int compareTo(DataPoint dataPoint) { + return Long.compare(value, dataPoint.getLong()); + } } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/SortableEntityData.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/SortableEntityData.java index 026c470ce6..18936a2696 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/SortableEntityData.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/SortableEntityData.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edqs.query; import lombok.Data; +import org.thingsboard.server.common.data.edqs.DataPoint; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.EntityIdFactory; import org.thingsboard.server.edqs.data.EntityData; @@ -26,7 +27,7 @@ import java.util.UUID; public class SortableEntityData { private final EntityData entityData; - private String sortValue; + private DataPoint sortValue; public UUID getId(){ return entityData.getId(); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java index e4cded3e3e..6dc7fa3f79 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edqs.query.processor; import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.edqs.DataPoint; import org.thingsboard.server.common.data.permission.QueryContext; import org.thingsboard.server.common.data.query.EntityFilter; import org.thingsboard.server.edqs.data.EntityData; @@ -30,7 +31,6 @@ import java.util.UUID; import java.util.function.Consumer; import static org.thingsboard.server.edqs.util.RepositoryUtils.checkFilters; -import static org.thingsboard.server.edqs.util.RepositoryUtils.getSortValue; public abstract class AbstractQueryProcessor implements EntityQueryProcessor { @@ -50,7 +50,8 @@ public abstract class AbstractQueryProcessor implements protected SortableEntityData toSortData(EntityData ed) { SortableEntityData sortData = new SortableEntityData(ed); - sortData.setSortValue(getSortValue(ed, sortKey)); + DataPoint sortValue = ed.getDataPoint(sortKey, ctx); + sortData.setSortValue(sortValue); return sortData; } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index 870574a786..f7fb884dc5 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -370,18 +370,19 @@ public class TenantRepo { // Collections.reverse(result); // result = result.subList(offset, requiredSize); // IMPLEMENTATION THAT IS BASED ON TREE SET (For offset + query.getPageSize() << totalSize) - var requiredSize = Math.min(offset + query.getPageSize(), totalSize); - TreeSet topNSet = new TreeSet<>(comparator); - for (SortableEntityData sp : data) { - topNSet.add(sp); - if (topNSet.size() > requiredSize) { - topNSet.pollLast(); - } - } - var result = topNSet.stream().skip(offset).limit(query.getPageSize()).collect(Collectors.toList()); +// var requiredSize = Math.min(offset + query.getPageSize(), totalSize); +// TreeSet topNSet = new TreeSet<>(comparator); +// for (SortableEntityData sp : data) { +// topNSet.add(sp); +// if (topNSet.size() > requiredSize) { +// topNSet.pollLast(); +// } +// } +// var result = topNSet.stream().skip(offset).limit(query.getPageSize()).collect(Collectors.toList()); // IMPLEMENTATION THAT IS BASED ON TIM SORT (For offset + query.getPageSize() > totalSize / 2) -// data.sort(comparator); -// var result = data.subList(offset, endIndex); + var requiredSize = Math.min(offset + query.getPageSize(), totalSize); + data.sort(comparator); + var result = data.subList(offset, requiredSize); log.trace("EDQ Sorted in {}", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTs)); return new PageData<>(toQueryResult(result, query, ctx), totalPages, totalSize, totalSize > requiredSize); } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java index 3bf12752a0..203505aea8 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java @@ -67,10 +67,10 @@ import static org.thingsboard.server.common.data.query.ComplexFilterPredicate.Co @Slf4j public class RepositoryUtils { - public static final Comparator SORT_ASC = Comparator.comparing((SortableEntityData sed) -> Optional.ofNullable(sed.getSortValue()).orElse(""), String.CASE_INSENSITIVE_ORDER) + public static final Comparator SORT_ASC = Comparator.comparing(SortableEntityData::getSortValue, Comparator.nullsFirst(Comparator.naturalOrder())) .thenComparing(sp -> sp.getId().toString()); - public static final Comparator SORT_DESC = Comparator.comparing((SortableEntityData sed) -> Optional.ofNullable(sed.getSortValue()).orElse(""), String.CASE_INSENSITIVE_ORDER) + public static final Comparator SORT_DESC = Comparator.comparing(SortableEntityData::getSortValue, Comparator.nullsFirst(Comparator.naturalOrder())) .thenComparing(sp -> sp.getId().toString()).reversed(); public static EntityType resolveEntityType(EntityFilter entityFilter) { @@ -348,26 +348,6 @@ public class RepositoryUtils { } } - public static String getSortValue(EntityData entity, DataKey sortKey) { - if (sortKey == null) { - return null; - } - switch (sortKey.type()) { - case ENTITY_FIELD -> { - return entity.getField(sortKey.key()); - } - case ATTRIBUTE, CLIENT_ATTRIBUTE, SHARED_ATTRIBUTE, SERVER_ATTRIBUTE -> { - var dp = entity.getAttr(sortKey.keyId(), sortKey.type()); - return dp != null ? dp.valueToString() : ""; - } - case TIME_SERIES -> { - var dp = entity.getTs(sortKey.keyId()); - return dp != null ? dp.valueToString() : ""; - } - default -> throw new IllegalStateException("toSortKey is not implemented for type: " + sortKey.type()); - } - } - public static boolean checkFilters(EdqsQuery query, EntityData entity) { if (entity == null || entity.getFields() == null) { return false; // Entity was already removed or not arrived yet; From a75415433b22027dd734d0fa420bb01f708b9be5 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Thu, 20 Mar 2025 17:13:57 +0200 Subject: [PATCH 051/286] fixed immutable list exception --- .../edqs/query/processor/AbstractRelationQueryProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractRelationQueryProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractRelationQueryProcessor.java index 8ee7338a4f..2842d57ff0 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractRelationQueryProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractRelationQueryProcessor.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.Queue; import java.util.Set; import java.util.UUID; +import java.util.stream.Collectors; public abstract class AbstractRelationQueryProcessor extends AbstractQueryProcessor { @@ -89,7 +90,7 @@ public abstract class AbstractRelationQueryProcessor ext private List processTenantQuery(Set> entities) { return entities.stream() .map(this::toSortData) - .toList(); + .collect(Collectors.toList()); } private List processCustomerQuery(Set> entities) { From b7604a8d0af67826d06af9e2b2cea78a9cfd624a Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Thu, 20 Mar 2025 17:17:08 +0200 Subject: [PATCH 052/286] Fix NONE partitioning strategy --- .../service/edqs/DefaultEdqsApiService.java | 5 +++-- .../server/edqs/processor/EdqsProcessor.java | 15 ++++++++++----- .../server/edqs/processor/EdqsProducer.java | 2 +- .../server/edqs/state/EdqsPartitionService.java | 7 +++++-- .../queue/discovery/HashPartitionService.java | 17 ++++++++++++++++- .../queue/discovery/PartitionService.java | 2 ++ 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsApiService.java b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsApiService.java index 51c963ed2f..c7e17b62ae 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsApiService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsApiService.java @@ -76,8 +76,9 @@ public class DefaultEdqsApiService implements EdqsApiService { requestMsg.setCustomerIdLSB(customerId.getId().getLeastSignificantBits()); } - Integer partition = edqsPartitionService.resolvePartition(tenantId); - ListenableFuture> resultFuture = requestTemplate.send(new TbProtoQueueMsg<>(UUID.randomUUID(), requestMsg.build()), partition); + UUID key = UUID.randomUUID(); + Integer partition = edqsPartitionService.resolvePartition(tenantId, key); + ListenableFuture> resultFuture = requestTemplate.send(new TbProtoQueueMsg<>(key, requestMsg.build()), partition); return Futures.transform(resultFuture, msg -> { TransportProtos.EdqsResponseMsg responseMsg = msg.getValue().getResponseMsg(); return JacksonUtil.fromString(responseMsg.getValue(), EdqsResponse.class); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java index f2360617ee..fb15c3fc73 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java @@ -173,13 +173,18 @@ public class EdqsProcessor implements TbQueueHandler, if (CollectionsUtil.isNotEmpty(oldPartitions)) { Set removedPartitions = Sets.difference(oldPartitions, newPartitions).stream() .map(tpi -> tpi.getPartition().orElse(-1)).collect(Collectors.toSet()); - if (config.getPartitioningStrategy() != EdqsPartitioningStrategy.TENANT && !removedPartitions.isEmpty()) { + if (removedPartitions.isEmpty()) { + return; + } + + if (config.getPartitioningStrategy() == EdqsPartitioningStrategy.TENANT) { + repository.clearIf(tenantId -> { + Integer partition = partitionService.resolvePartition(tenantId, null); + return removedPartitions.contains(partition); + }); + } else { log.warn("Partitions {} were removed but shouldn't be (due to NONE partitioning strategy)", removedPartitions); } - repository.clearIf(tenantId -> { - Integer partition = partitionService.resolvePartition(tenantId); - return partition != null && removedPartitions.contains(partition); - }); } } catch (Throwable t) { log.error("Failed to handle partition change event {}", event, t); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java index 970ee76381..a06836339f 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java @@ -72,7 +72,7 @@ public class EdqsProducer { }; TopicPartitionInfo tpi = TopicPartitionInfo.builder() .topic(topic) - .partition(partitionService.resolvePartition(tenantId)) + .partition(partitionService.resolvePartition(tenantId, key)) .build(); if (producer instanceof TbKafkaProducerTemplate> kafkaProducer) { kafkaProducer.send(tpi, key, new TbProtoQueueMsg<>(null, msg), callback); // specifying custom key for compaction diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/EdqsPartitionService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/EdqsPartitionService.java index 94e9437650..e2fbf9a981 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/EdqsPartitionService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/EdqsPartitionService.java @@ -29,11 +29,14 @@ public class EdqsPartitionService { private final HashPartitionService hashPartitionService; private final EdqsConfig edqsConfig; - public Integer resolvePartition(TenantId tenantId) { + public Integer resolvePartition(TenantId tenantId, Object key) { if (edqsConfig.getPartitioningStrategy() == EdqsPartitioningStrategy.TENANT) { return hashPartitionService.resolvePartitionIndex(tenantId.getId(), edqsConfig.getPartitions()); } else { - return null; + if (key == null) { + throw new IllegalArgumentException("Partitioning key is missing but partitioning strategy is not TENANT"); + } + return hashPartitionService.resolvePartitionIndex(key.toString(), edqsConfig.getPartitions()); } } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java index 3a76d50825..7186bf7055 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java @@ -39,6 +39,7 @@ import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.discovery.event.ServiceListChangedEvent; import org.thingsboard.server.queue.util.AfterStartUp; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -559,7 +560,15 @@ public class HashPartitionService implements PartitionService { @Override public int resolvePartitionIndex(UUID entityId, int partitions) { - int hash = hash(entityId); + return resolvePartitionIndex(hash(entityId), partitions); + } + + @Override + public int resolvePartitionIndex(String key, int partitions) { + return resolvePartitionIndex(hash(key), partitions); + } + + private int resolvePartitionIndex(int hash, int partitions) { return Math.abs(hash % partitions); } @@ -725,6 +734,12 @@ public class HashPartitionService implements PartitionService { .hash().asInt(); } + private int hash(String key) { + return hashFunction.newHasher() + .putString(key, StandardCharsets.UTF_8) + .hash().asInt(); + } + public static HashFunction forName(String name) { return switch (name) { case "murmur3_32" -> Hashing.murmur3_32(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/PartitionService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/PartitionService.java index 7abd68e25f..5dda413f17 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/PartitionService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/PartitionService.java @@ -79,4 +79,6 @@ public interface PartitionService { int resolvePartitionIndex(UUID entityId, int partitions); + int resolvePartitionIndex(String key, int partitions); + } From 3433dd0f5415db237713f634e14016dfbb9c7b8c Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Thu, 20 Mar 2025 17:22:03 +0200 Subject: [PATCH 053/286] reverted method needed for PE --- .../server/edqs/query/processor/AbstractQueryProcessor.java | 4 ++-- .../org/thingsboard/server/edqs/util/RepositoryUtils.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java index 6dc7fa3f79..0c83ae4e61 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java @@ -31,6 +31,7 @@ import java.util.UUID; import java.util.function.Consumer; import static org.thingsboard.server.edqs.util.RepositoryUtils.checkFilters; +import static org.thingsboard.server.edqs.util.RepositoryUtils.getSortValue; public abstract class AbstractQueryProcessor implements EntityQueryProcessor { @@ -50,8 +51,7 @@ public abstract class AbstractQueryProcessor implements protected SortableEntityData toSortData(EntityData ed) { SortableEntityData sortData = new SortableEntityData(ed); - DataPoint sortValue = ed.getDataPoint(sortKey, ctx); - sortData.setSortValue(sortValue); + sortData.setSortValue(getSortValue(ed, sortKey, ctx)); return sortData; } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java index 203505aea8..e2109a5535 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java @@ -348,6 +348,10 @@ public class RepositoryUtils { } } + public static DataPoint getSortValue(EntityData entity, DataKey sortKey, QueryContext queryContext) { + return entity.getDataPoint(sortKey, queryContext); + } + public static boolean checkFilters(EdqsQuery query, EntityData entity) { if (entity == null || entity.getFields() == null) { return false; // Entity was already removed or not arrived yet; From 6f61ab64a7572d5e9db8b574453a4ab3e52c884b Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Thu, 20 Mar 2025 17:46:58 +0200 Subject: [PATCH 054/286] reverted sort method --- .../server/edqs/repo/TenantRepo.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index f7fb884dc5..870574a786 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -370,19 +370,18 @@ public class TenantRepo { // Collections.reverse(result); // result = result.subList(offset, requiredSize); // IMPLEMENTATION THAT IS BASED ON TREE SET (For offset + query.getPageSize() << totalSize) -// var requiredSize = Math.min(offset + query.getPageSize(), totalSize); -// TreeSet topNSet = new TreeSet<>(comparator); -// for (SortableEntityData sp : data) { -// topNSet.add(sp); -// if (topNSet.size() > requiredSize) { -// topNSet.pollLast(); -// } -// } -// var result = topNSet.stream().skip(offset).limit(query.getPageSize()).collect(Collectors.toList()); -// IMPLEMENTATION THAT IS BASED ON TIM SORT (For offset + query.getPageSize() > totalSize / 2) var requiredSize = Math.min(offset + query.getPageSize(), totalSize); - data.sort(comparator); - var result = data.subList(offset, requiredSize); + TreeSet topNSet = new TreeSet<>(comparator); + for (SortableEntityData sp : data) { + topNSet.add(sp); + if (topNSet.size() > requiredSize) { + topNSet.pollLast(); + } + } + var result = topNSet.stream().skip(offset).limit(query.getPageSize()).collect(Collectors.toList()); +// IMPLEMENTATION THAT IS BASED ON TIM SORT (For offset + query.getPageSize() > totalSize / 2) +// data.sort(comparator); +// var result = data.subList(offset, endIndex); log.trace("EDQ Sorted in {}", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTs)); return new PageData<>(toQueryResult(result, query, ctx), totalPages, totalSize, totalSize > requiredSize); } From edcb89043449dfd693d5a8168c10bc5c52131f9a Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Thu, 20 Mar 2025 17:48:20 +0200 Subject: [PATCH 055/286] fixed getSortValue method --- .../java/org/thingsboard/server/edqs/util/RepositoryUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java index e2109a5535..71b58d759a 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/RepositoryUtils.java @@ -349,6 +349,9 @@ public class RepositoryUtils { } public static DataPoint getSortValue(EntityData entity, DataKey sortKey, QueryContext queryContext) { + if (sortKey == null) { + return null; + } return entity.getDataPoint(sortKey, queryContext); } From 73fc419537be2ba5df1adb7f7903612f98f9d9cc Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 20 Mar 2025 19:16:37 +0200 Subject: [PATCH 056/286] UI: Fix markdown widgets blur (set use transform to false for gridster). Fix markdown blinking (cache angular/compiler module on dynamic component service). Fix echarts tooltip. --- ui-ngx/package.json | 2 +- .../dynamic-component-factory.service.ts | 14 +++-- .../dashboard/dashboard.component.ts | 1 + .../widget/lib/chart/latest-chart.ts | 3 +- .../widget/lib/chart/time-series-chart.ts | 12 ++++ .../widget/lib/markdown-widget.component.html | 2 +- .../widget/lib/markdown-widget.component.ts | 14 +++-- .../shared/components/markdown.component.ts | 59 +++++++++++-------- ui-ngx/yarn.lock | 15 +++-- 9 files changed, 73 insertions(+), 49 deletions(-) diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 1a32c7d41c..6280fb94c2 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -46,7 +46,7 @@ "canvas-gauges": "^2.1.7", "core-js": "^3.39.0", "dayjs": "1.11.13", - "echarts": "https://github.com/thingsboard/echarts/archive/5.5.0-TB.tar.gz", + "echarts": "https://github.com/thingsboard/echarts/archive/5.5.1-TB.tar.gz", "flot": "https://github.com/thingsboard/flot.git#0.9-work", "flot.curvedlines": "https://github.com/MichaelZinsmaier/CurvedLines.git#master", "font-awesome": "^4.7.0", diff --git a/ui-ngx/src/app/core/services/dynamic-component-factory.service.ts b/ui-ngx/src/app/core/services/dynamic-component-factory.service.ts index 75bfa6b1e1..c062ac2e82 100644 --- a/ui-ngx/src/app/core/services/dynamic-component-factory.service.ts +++ b/ui-ngx/src/app/core/services/dynamic-component-factory.service.ts @@ -15,9 +15,9 @@ /// import { Component, Injectable, Type, ɵComponentDef, ɵNG_COMP_DEF } from '@angular/core'; -import { from, Observable, of } from 'rxjs'; +import { from, Observable, shareReplay } from 'rxjs'; import { CommonModule } from '@angular/common'; -import { mergeMap } from 'rxjs/operators'; +import { map } from 'rxjs/operators'; import { guid } from '@core/utils'; @Injectable({ @@ -25,6 +25,10 @@ import { guid } from '@core/utils'; }) export class DynamicComponentFactoryService { + private compiler$: Observable = from(import('@angular/compiler')).pipe( + shareReplay({refCount: true, bufferSize: 1}) + ); + constructor() { } @@ -34,14 +38,14 @@ export class DynamicComponentFactoryService { imports?: Type[], preserveWhitespaces?: boolean, styles?: string[]): Observable> { - return from(import('@angular/compiler')).pipe( - mergeMap(() => { + return this.compiler$.pipe( + map(() => { let componentImports: Type[] = [CommonModule]; if (imports) { componentImports = [...componentImports, ...imports]; } const comp = this.createAndCompileDynamicComponent(componentType, template, componentImports, preserveWhitespaces, styles); - return of(comp.type); + return comp.type; }) ); } diff --git a/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts b/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts index cc013fe34d..95f2095bad 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard/dashboard.component.ts @@ -247,6 +247,7 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo defaultItemCols: 8, defaultItemRows: 6, displayGrid: this.displayGrid, + useTransformPositioning: false, resizable: { enabled: this.isEdit && !this.isEditingWidget, delayStart: 50, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts index 5f17abc37d..13e9dd7d5e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts @@ -270,8 +270,7 @@ export abstract class TbLatestChart { this.latestChartOption = { tooltip: { trigger: this.settings.showTooltip ? 'item' : 'none', - confine: false, - appendTo: 'body', + confine: true, formatter: (params: CallbackDataParams) => this.settings.showTooltip ? latestChartTooltipFormatter(this.renderer, this.settings, params, this.units, this.total, this.dataItems) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts index 9086bb1896..ad121a1eb0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts @@ -161,6 +161,8 @@ export class TbTimeSeriesChart { private latestData: FormattedData[] = []; + private onParentScroll = this._onParentScroll.bind(this); + yMin$ = this.yMinSubject.asObservable(); yMax$ = this.yMaxSubject.asObservable(); @@ -358,6 +360,7 @@ export class TbTimeSeriesChart { this.yMinSubject.complete(); this.yMaxSubject.complete(); this.darkModeObserver?.disconnect(); + this.ctx.dashboard.gridster.el.removeEventListener('scroll', this.onParentScroll); } public resize(): void { @@ -611,6 +614,7 @@ export class TbTimeSeriesChart { this.timeSeriesChart = echarts.init(this.chartElement, null, { renderer: 'svg' }); + this.ctx.dashboard.gridster.el.addEventListener('scroll', this.onParentScroll); this.timeSeriesChartOptions = { darkMode: this.darkMode, backgroundColor: 'transparent', @@ -837,6 +841,14 @@ export class TbTimeSeriesChart { return this.settings.dataZoom ? 45 : 5; } + private _onParentScroll() { + if (this.timeSeriesChart) { + this.timeSeriesChart.dispatchAction({ + type: 'hideTip' + }); + } + } + private onResize() { const shapeWidth = this.chartElement.offsetWidth; const shapeHeight = this.chartElement.offsetHeight; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.html index 3ef8d6c023..ce1a1438aa 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.html @@ -19,4 +19,4 @@ [additionalStyles]="additionalStyles" [containerClass]="markdownClass" [applyDefaultMarkdownStyle]="applyDefaultMarkdownStyle" - [context]="{ ctx: ctx }" lineNumbers fallbackToPlainMarkdown (click)="markdownClick($event)"> + [context]="{ ctx: ctx, data: data }" lineNumbers fallbackToPlainMarkdown (click)="markdownClick($event)"> diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts index 1e80baddfa..61f5073953 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts @@ -63,6 +63,8 @@ export class MarkdownWidgetComponent extends PageComponent implements OnInit { @Input() ctx: WidgetContext; + data: FormattedData[]; + markdownText: string; additionalStyles: string[]; @@ -128,15 +130,15 @@ export class MarkdownWidgetComponent extends PageComponent implements OnInit { } else { initialData = []; } - const data = formattedDataFormDatasourceData(initialData); + this.data = formattedDataFormDatasourceData(initialData); - let markdownText = this.settings.useMarkdownTextFunction ? - this.markdownTextFunction.pipe(map(markdownTextFunction => safeExecuteTbFunction(markdownTextFunction, [data, this.ctx]))) : this.settings.markdownTextPattern; + const markdownText = this.settings.useMarkdownTextFunction ? + this.markdownTextFunction.pipe(map(markdownTextFunction => safeExecuteTbFunction(markdownTextFunction, [this.data, this.ctx]))) : this.settings.markdownTextPattern; if (typeof markdownText === 'string') { - this.updateMarkdownText(markdownText, data); + this.updateMarkdownText(markdownText, this.data); } else { markdownText.subscribe((text) => { - this.updateMarkdownText(text, data); + this.updateMarkdownText(text, this.data); }); } } @@ -146,8 +148,8 @@ export class MarkdownWidgetComponent extends PageComponent implements OnInit { markdownText = createLabelFromPattern(markdownText, allData); if (this.markdownText !== markdownText) { this.markdownText = this.utils.customTranslation(markdownText, markdownText); - this.cd.detectChanges(); } + this.cd.markForCheck(); } markdownClick($event: MouseEvent) { diff --git a/ui-ngx/src/app/shared/components/markdown.component.ts b/ui-ngx/src/app/shared/components/markdown.component.ts index bee7da0a51..0db86a9eef 100644 --- a/ui-ngx/src/app/shared/components/markdown.component.ts +++ b/ui-ngx/src/app/shared/components/markdown.component.ts @@ -32,16 +32,14 @@ import { ViewChild, ViewContainerRef } from '@angular/core'; -import { HelpService } from '@core/services/help.service'; import { MarkdownService, PrismPlugin } from 'ngx-markdown'; import { DynamicComponentFactoryService } from '@core/services/dynamic-component-factory.service'; -import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { SHARED_MODULE_TOKEN } from '@shared/components/tokens'; -import { deepClone, guid, isDefinedAndNotNull } from '@core/utils'; +import { guid, isDefinedAndNotNull } from '@core/utils'; import { Observable, of, ReplaySubject } from 'rxjs'; import { coerceBoolean } from '@shared/decorators/coercion'; -let defaultMarkdownStyle; +let defaultMarkdownStyle: string; @Component({ selector: 'tb-markdown', @@ -70,12 +68,12 @@ export class TbMarkdownComponent implements OnChanges { @Input() additionalStyles: string[]; @Input() - get lineNumbers(): boolean { return this.lineNumbersValue; } - set lineNumbers(value: boolean) { this.lineNumbersValue = coerceBooleanProperty(value); } + @coerceBoolean() + lineNumbers = false; @Input() - get fallbackToPlainMarkdown(): boolean { return this.fallbackToPlainMarkdownValue; } - set fallbackToPlainMarkdown(value: boolean) { this.fallbackToPlainMarkdownValue = coerceBooleanProperty(value); } + @coerceBoolean() + fallbackToPlainMarkdown = false; @Input() @coerceBoolean() @@ -83,9 +81,6 @@ export class TbMarkdownComponent implements OnChanges { @Output() ready = new EventEmitter(); - private lineNumbersValue = false; - private fallbackToPlainMarkdownValue = false; - isMarkdownReady = false; error = null; @@ -93,8 +88,7 @@ export class TbMarkdownComponent implements OnChanges { private tbMarkdownInstanceComponentRef: ComponentRef; private tbMarkdownInstanceComponentType: Type; - constructor(private help: HelpService, - private cd: ChangeDetectorRef, + constructor(private cd: ChangeDetectorRef, private zone: NgZone, public markdownService: MarkdownService, @Inject(SHARED_MODULE_TOKEN) private sharedModule: Type, @@ -102,8 +96,19 @@ export class TbMarkdownComponent implements OnChanges { private renderer: Renderer2) {} ngOnChanges(changes: SimpleChanges): void { - if (isDefinedAndNotNull(this.data)) { - this.zone.run(() => this.render(this.data)); + for (const propName of Object.keys(changes)) { + const change = changes[propName]; + if (propName === 'data' && change.currentValue !== change.previousValue) { + if (isDefinedAndNotNull(this.data)) { + this.zone.run(() => this.render(this.data)); + } + } else if (propName === 'context' && !change.firstChange) { + if (this.context && this.tbMarkdownInstanceComponentRef) { + for (const propName of Object.keys(this.context)) { + this.tbMarkdownInstanceComponentRef.instance[propName] = this.context[propName]; + } + } + } } } @@ -134,8 +139,8 @@ export class TbMarkdownComponent implements OnChanges { if (this.applyDefaultMarkdownStyle) { if (!defaultMarkdownStyle) { const compDef = this.dynamicComponentFactoryService.getComponentDef(TbMarkdownComponent); - defaultMarkdownStyle = deepClone(compDef.styles[0]).replace(/\[_nghost\-%COMP%\]/g, '') - .replace(/\[_ngcontent\-%COMP%\]/g, ''); + defaultMarkdownStyle = compDef.styles[0].replace(/\[_nghost-%COMP%]/g, '') + .replace(/\[_ngcontent-%COMP%]/g, ''); } styles.push(defaultMarkdownStyle); } @@ -149,7 +154,7 @@ export class TbMarkdownComponent implements OnChanges { this.ready.emit(); }); } else { - const parent = this; + const destroyMarkdownInstanceResources = this.destroyMarkdownInstanceResources.bind(this); let compileModules = [this.sharedModule]; if (this.additionalCompileModules) { compileModules = compileModules.concat(this.additionalCompileModules); @@ -157,13 +162,14 @@ export class TbMarkdownComponent implements OnChanges { this.dynamicComponentFactoryService.createDynamicComponent( class TbMarkdownInstance { ngOnDestroy(): void { - parent.destroyMarkdownInstanceResources(); + destroyMarkdownInstanceResources(); } }, template, compileModules, true, styles - ).subscribe((componentType) => { + ).subscribe({ + next: (componentType) => { this.tbMarkdownInstanceComponentType = componentType; const injector: Injector = Injector.create({providers: [], parent: this.markdownContainer.injector}); try { @@ -187,20 +193,21 @@ export class TbMarkdownComponent implements OnChanges { this.ready.emit(); }); }, - (error) => { + error: (error) => { readyObservable = this.handleError(template, error, styles); this.cd.detectChanges(); readyObservable.subscribe(() => { this.ready.emit(); }); - }); + } + }); } } - private handleError(template: string, error, styles?: string[]): Observable { + private handleError(template: string, error: any, styles?: string[]): Observable { this.error = (error ? error + '' : 'Failed to render markdown!').replace(/\n/g, '
      '); this.markdownContainer.clear(); - if (this.fallbackToPlainMarkdownValue) { + if (this.fallbackToPlainMarkdown) { return this.plainMarkdown(template, styles); } else { return of(null); @@ -209,7 +216,7 @@ export class TbMarkdownComponent implements OnChanges { private plainMarkdown(template: string, styles?: string[]): Observable { const element = this.fallbackElement.nativeElement; - let styleElement; + let styleElement: any; if (styles?.length) { const markdownClass = 'tb-markdown-view-' + guid(); let innerStyle = styles.join('\n'); @@ -244,7 +251,7 @@ export class TbMarkdownComponent implements OnChanges { if (imgs.length) { let totalImages = imgs.length; const imagesLoadedSubject = new ReplaySubject(); - imgs.each((index, img) => { + imgs.each((_index, img) => { $(img).one('load error', () => { totalImages--; if (totalImages === 0) { diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index 04e0c4f77a..602839b2da 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -4798,12 +4798,12 @@ eastasianwidth@^0.2.0: resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -"echarts@https://github.com/thingsboard/echarts/archive/5.5.0-TB.tar.gz": - version "5.5.0-TB" - resolved "https://github.com/thingsboard/echarts/archive/5.5.0-TB.tar.gz#0b707b5cd2ae4699e9ced8b07ca49cb70189ae2a" +"echarts@https://github.com/thingsboard/echarts/archive/5.5.1-TB.tar.gz": + version "5.5.1-TB" + resolved "https://github.com/thingsboard/echarts/archive/5.5.1-TB.tar.gz#8cf0cbb1b4c6161f0b587a1a649ff4f8eecbbf42" dependencies: tslib "2.3.0" - zrender "5.5.0" + zrender "https://github.com/thingsboard/zrender/archive/5.5.0-TB.tar.gz" editorconfig@^1.0.4: version "1.0.4" @@ -10102,9 +10102,8 @@ zone.js@~0.14.10: resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.14.10.tgz#23b8b29687c6bffece996e5ee5b854050e7775c8" integrity sha512-YGAhaO7J5ywOXW6InXNlLmfU194F8lVgu7bRntUF3TiG8Y3nBK0x1UJJuHUP/e8IyihkjCYqhCScpSwnlaSRkQ== -zrender@5.5.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/zrender/-/zrender-5.5.0.tgz#54d0d6c4eda81a96d9f60a9cd74dc48ea026bc1e" - integrity sha512-O3MilSi/9mwoovx77m6ROZM7sXShR/O/JIanvzTwjN3FORfLSr81PsUGd7jlaYOeds9d8tw82oP44+3YucVo+w== +"zrender@https://github.com/thingsboard/zrender/archive/5.5.0-TB.tar.gz": + version "5.5.0-TB" + resolved "https://github.com/thingsboard/zrender/archive/5.5.0-TB.tar.gz#9605f08284436a9be86085e27f1c01b29a9923bf" dependencies: tslib "2.3.0" From 71eaef8dbaa75b92e35b7ec2cf9690a0b4e0fc0d Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Fri, 21 Mar 2025 09:50:24 +0200 Subject: [PATCH 057/286] UI: Limit table content height in map layers with scroll on overflow --- .../widget/lib/settings/common/map/map-layers.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layers.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layers.component.html index 1f0c930802..9ce010c309 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layers.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layers.component.html @@ -23,7 +23,7 @@
      widgets.maps.layer.layer
  • -
    From 1675e3aa50610b2df7578d7dd209169cf419017d Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Fri, 21 Mar 2025 11:20:47 +0200 Subject: [PATCH 058/286] Fix RuleChainMetadata for older Edge versions - renaming --- .../service/edge/EdgeMsgConstructorUtils.java | 20 +++++++++---------- .../edge/EdgeMsgConstructorUtilsTest.java | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) 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 fb6d8d7f92..309c24d699 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 @@ -129,7 +129,7 @@ import java.util.UUID; @Slf4j public class EdgeMsgConstructorUtils { - public static final Map> VERSION_TO_IGNORED_PARAM = Map.of( + public static final Map> IGNORED_PARAMS_BY_EDGE_VERSION = Map.of( EdgeVersion.V_3_8_0, Map.of( TbMsgTimeseriesNode.class.getName(), "processingSettings", @@ -144,7 +144,7 @@ public class EdgeMsgConstructorUtils { ) ); - public static final Map> VERSION_TO_MISSING_NODES = Map.of( + public static final Map> EXCLUDED_NODES_BY_EDGE_VERSION = Map.of( EdgeVersion.V_3_7_0, Set.of( TbSendRestApiCallReplyNode.class.getName(), @@ -451,7 +451,7 @@ public class EdgeMsgConstructorUtils { } public static RuleChainMetadataUpdateMsg constructRuleChainMetadataUpdatedMsg(UpdateMsgType msgType, RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { - String metaData = filterMetadataForOldEdgeVersions(ruleChainMetaData, edgeVersion); + String metaData = sanitizeMetadataForLegacyEdgeVersion(ruleChainMetaData, edgeVersion); return RuleChainMetadataUpdateMsg.newBuilder() .setMsgType(msgType) @@ -459,21 +459,21 @@ public class EdgeMsgConstructorUtils { .build(); } - private static String filterMetadataForOldEdgeVersions(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { + private static String sanitizeMetadataForLegacyEdgeVersion(RuleChainMetaData ruleChainMetaData, EdgeVersion edgeVersion) { JsonNode jsonNode = JacksonUtil.valueToTree(ruleChainMetaData); JsonNode nodes = jsonNode.get("nodes"); - changeConfigForOldEdgeVersions(nodes, edgeVersion); - removeMissingNodeForOldEdge(nodes, edgeVersion); + updateNodeConfigurationsForLegacyEdge(nodes, edgeVersion); + removeExcludedNodesForLegacyEdge(nodes, edgeVersion); return JacksonUtil.toString(jsonNode); } - private static void changeConfigForOldEdgeVersions(JsonNode nodes, EdgeVersion edgeVersion) { + private static void updateNodeConfigurationsForLegacyEdge(JsonNode nodes, EdgeVersion edgeVersion) { nodes.forEach(node -> { if (node.isObject() && node.has("configuration")) { String nodeType = node.get("type").asText(); - Map ignoredParams = VERSION_TO_IGNORED_PARAM.get(edgeVersion); + Map ignoredParams = IGNORED_PARAMS_BY_EDGE_VERSION.get(edgeVersion); if (ignoredParams != null && ignoredParams.containsKey(nodeType)) { ((ObjectNode) node.get("configuration")).remove(ignoredParams.get(nodeType)); @@ -482,13 +482,13 @@ public class EdgeMsgConstructorUtils { }); } - private static void removeMissingNodeForOldEdge(JsonNode nodes, EdgeVersion edgeVersion) { + private static void removeExcludedNodesForLegacyEdge(JsonNode nodes, EdgeVersion edgeVersion) { Iterator iterator = nodes.iterator(); while (iterator.hasNext()) { JsonNode node = iterator.next(); String type = node.get("type").asText(); - Set missNodes = VERSION_TO_MISSING_NODES.get(edgeVersion); + Set missNodes = EXCLUDED_NODES_BY_EDGE_VERSION.get(edgeVersion); if (missNodes != null && missNodes.contains(type)) { iterator.remove(); 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 702eed26b5..ea1f99d41a 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 @@ -40,8 +40,8 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.VERSION_TO_IGNORED_PARAM; -import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.VERSION_TO_MISSING_NODES; +import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.EXCLUDED_NODES_BY_EDGE_VERSION; +import static org.thingsboard.server.service.edge.EdgeMsgConstructorUtils.IGNORED_PARAMS_BY_EDGE_VERSION; @Slf4j public class EdgeMsgConstructorUtilsTest { @@ -92,8 +92,8 @@ public class EdgeMsgConstructorUtilsTest { List ruleNodes = extractRuleNodesFromUpdateMsg(metaData, edgeVersion); // THEN - int leftNode = VERSION_TO_MISSING_NODES.containsKey(edgeVersion) ? - CONFIG_TO_MISS_NODE_FOR_OLD_EDGE.size() - VERSION_TO_MISSING_NODES.get(edgeVersion).size() : + int leftNode = EXCLUDED_NODES_BY_EDGE_VERSION.containsKey(edgeVersion) ? + CONFIG_TO_MISS_NODE_FOR_OLD_EDGE.size() - EXCLUDED_NODES_BY_EDGE_VERSION.get(edgeVersion).size() : CONFIG_TO_MISS_NODE_FOR_OLD_EDGE.size(); Assert.assertEquals(leftNode, ruleNodes.size()); @@ -136,7 +136,7 @@ public class EdgeMsgConstructorUtilsTest { ruleNodes.forEach(ruleNode -> { int configParamCount = NODE_TO_CONFIG_PARAMS_COUNT.get(ruleNode.getType()); - boolean isOldEdgeVersion = VERSION_TO_IGNORED_PARAM.entrySet().stream() + boolean isOldEdgeVersion = IGNORED_PARAMS_BY_EDGE_VERSION.entrySet().stream() .anyMatch(entry -> entry.getKey().equals(edgeVersion) && entry.getValue().containsKey(ruleNode.getType())); int expectedConfigAmount = isOldEdgeVersion ? configParamCount - 1 : configParamCount; From 6f11005095641fc7faaabefe54b09d0926f45623 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Fri, 21 Mar 2025 11:30:55 +0200 Subject: [PATCH 059/286] Fix RuleChainMetadata for older Edge versions - remove space --- .../thingsboard/server/service/edge/EdgeMsgConstructorUtils.java | 1 - 1 file changed, 1 deletion(-) 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 309c24d699..9bcd8fc373 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 @@ -127,7 +127,6 @@ import java.util.Set; import java.util.UUID; @Slf4j - public class EdgeMsgConstructorUtils { public static final Map> IGNORED_PARAMS_BY_EDGE_VERSION = Map.of( EdgeVersion.V_3_8_0, From c8cfed0966a3cf6209084e1b2c223dfb100378a4 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Fri, 21 Mar 2025 12:07:36 +0200 Subject: [PATCH 060/286] fixed security configuration for certificate/download endpoint --- .../server/config/ThingsboardSecurityConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java b/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java index 2ce4ade587..871798ccd1 100644 --- a/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java +++ b/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java @@ -82,7 +82,7 @@ public class ThingsboardSecurityConfiguration { public static final String TOKEN_BASED_AUTH_ENTRY_POINT = "/api/**"; public static final String WS_ENTRY_POINT = "/api/ws/**"; public static final String MAIL_OAUTH2_PROCESSING_ENTRY_POINT = "/api/admin/mail/oauth2/code"; - public static final String DEVICE_CONNECTIVITY_CERTIFICATE_DOWNLOAD_ENTRY_POINT = "/api/device-connectivity/mqtts/certificate/download"; + public static final String DEVICE_CONNECTIVITY_CERTIFICATE_DOWNLOAD_ENTRY_POINT = "/api/device-connectivity/*/certificate/download"; @Value("${server.http.max_payload_size:/api/image*/**=52428800;/api/resource/**=52428800;/api/**=16777216}") private String maxPayloadSizeConfig; From 4a5b836e02ebce2057801914cd0984c7ca38bd88 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 21 Mar 2025 12:26:02 +0200 Subject: [PATCH 061/286] Fix docker compose configuration for EDQS microservices. --- docker/docker-compose.edqs.volumes.yml | 4 ++-- docker/docker-compose.edqs.yml | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose.edqs.volumes.yml b/docker/docker-compose.edqs.volumes.yml index 89b4b3a59c..3a45542b99 100644 --- a/docker/docker-compose.edqs.volumes.yml +++ b/docker/docker-compose.edqs.volumes.yml @@ -17,10 +17,10 @@ version: '3.0' services: - tb-edqs-1: + tb-edqs1: volumes: - tb-edqs-log-volume:/var/log/tb-edqs - tb-edqs-2: + tb-edqs2: volumes: - tb-edqs-log-volume:/var/log/tb-edqs diff --git a/docker/docker-compose.edqs.yml b/docker/docker-compose.edqs.yml index 6dd9606ee6..21bace143a 100644 --- a/docker/docker-compose.edqs.yml +++ b/docker/docker-compose.edqs.yml @@ -29,9 +29,12 @@ services: tb-rule-engine2: env_file: - tb-rule-engine-edqs.env - tb-edqs-1: + tb-edqs1: restart: always image: "${DOCKER_REPO}/${EDQS_DOCKER_NAME}:${TB_VERSION}" + environment: + TB_SERVICE_ID: tb-edqs1 + JAVA_OPTS: "${JAVA_OPTS}" env_file: - tb-edqs.env volumes: @@ -42,9 +45,12 @@ services: depends_on: - zookeeper - kafka - tb-edqs-2: + tb-edqs2: restart: always image: "${DOCKER_REPO}/${EDQS_DOCKER_NAME}:${TB_VERSION}" + environment: + TB_SERVICE_ID: tb-edqs2 + JAVA_OPTS: "${JAVA_OPTS}" env_file: - tb-edqs.env volumes: From f86a72294bb5376e6dc8f33006bb88390c9896a9 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 21 Mar 2025 12:58:12 +0200 Subject: [PATCH 062/286] Fix EDQS logback config --- docker/tb-edqs/conf/logback.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/tb-edqs/conf/logback.xml b/docker/tb-edqs/conf/logback.xml index 14b5b0f04b..c8e97e48e4 100644 --- a/docker/tb-edqs/conf/logback.xml +++ b/docker/tb-edqs/conf/logback.xml @@ -24,7 +24,7 @@ /var/log/tb-edqs/${TB_SERVICE_ID}/tb-edqs.log - /var/log/tb-edqs/tb-edqs.%d{yyyy-MM-dd}.%i.log + /var/log/tb-edqs/${TB_SERVICE_ID}/tb-edqs.%d{yyyy-MM-dd}.%i.log 100MB 30 3GB @@ -41,7 +41,6 @@ - From 28019cc5ad4fa77a841b43f98859dde6c4a89b22 Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Fri, 21 Mar 2025 13:06:34 +0200 Subject: [PATCH 063/286] UI: Disable close on outside click for parameter popovers --- .../home/components/vc/entity-version-diff.component.ts | 2 +- .../home/components/vc/entity-versions-table.component.ts | 8 ++++---- .../common/action/get-value-action-settings.component.ts | 2 +- .../common/action/set-value-action-settings.component.ts | 2 +- .../common/action/widget-action-settings.component.ts | 2 +- .../common/auto-date-format-settings.component.ts | 2 +- .../lib/settings/common/background-settings.component.ts | 5 +++-- .../common/button/widget-button-custom-style.component.ts | 2 +- .../button/widget-button-toggle-custom-style.component.ts | 2 +- .../time-series-chart-axis-settings-button.component.ts | 2 +- .../time-series-chart-threshold-settings.component.ts | 2 +- .../chart/time-series-chart-y-axis-row.component.ts | 2 +- .../lib/settings/common/color-range-settings.component.ts | 2 +- .../lib/settings/common/color-settings.component.ts | 2 +- .../lib/settings/common/date-format-select.component.ts | 4 ++-- .../dynamic-form/dynamic-form-property-row.component.ts | 2 +- .../widget/lib/settings/common/font-settings.component.ts | 2 +- .../common/map/data-layer-color-settings.component.ts | 2 +- .../lib/settings/common/map/map-layer-row.component.ts | 2 +- .../common/map/map-tooltip-tag-actions.component.ts | 2 +- .../common/map/marker-image-settings.component.ts | 2 +- ui-ngx/src/app/shared/components/js-func.component.ts | 2 +- 22 files changed, 28 insertions(+), 27 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts index 88d4079916..1908b5e1fa 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts @@ -305,7 +305,7 @@ export class EntityVersionDiffComponent extends PageComponent implements OnInit, this.popoverService.hidePopover(trigger); } else { const restoreVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', true, null, + this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', false, null, { versionName: this.versionName, versionId: this.versionId, diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts index 5ccadcd4cb..2a6d5c5962 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts @@ -212,7 +212,7 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni this.popoverService.hidePopover(trigger); } else { const createVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityVersionCreateComponent, 'leftTop', true, null, + this.viewContainerRef, EntityVersionCreateComponent, 'leftTop', false, null, { branch: this.branch, entityId: this.entityId, @@ -244,7 +244,7 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni this.popoverService.hidePopover(trigger); } else { const complexCreateVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ComplexVersionCreateComponent, 'leftTop', true, null, + this.viewContainerRef, ComplexVersionCreateComponent, 'leftTop', false, null, { branch: this.branch, onClose: (result: VersionCreationResult | null, branch: string | null) => { @@ -296,7 +296,7 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni this.popoverService.hidePopover(trigger); } else { const restoreVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', true, null, + this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', false, null, { versionName: entityVersion.name, versionId: entityVersion.id, @@ -323,7 +323,7 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni this.popoverService.hidePopover(trigger); } else { const restoreEntitiesVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ComplexVersionLoadComponent, 'leftTop', true, null, + this.viewContainerRef, ComplexVersionLoadComponent, 'leftTop', false, null, { versionName: entityVersion.name, versionId: entityVersion.id, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts index 00cea43192..5b95ef5f13 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts @@ -142,7 +142,7 @@ export class GetValueActionSettingsComponent implements OnInit, ControlValueAcce }; const getValueSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, this.viewContainerRef, GetValueActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, + ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts index 08345bb148..e446e6f5b3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts @@ -125,7 +125,7 @@ export class SetValueActionSettingsComponent implements OnInit, ControlValueAcce }; const setValueSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, this.viewContainerRef, SetValueActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, + ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts index 7731df6407..51583f71fb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts @@ -123,7 +123,7 @@ export class WidgetActionSettingsComponent implements OnInit, ControlValueAccess }; const widgetActionSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, this.viewContainerRef, WidgetActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, + ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts index ae4158e3ed..1d776bcb70 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts @@ -83,7 +83,7 @@ export class AutoDateFormatSettingsComponent implements OnInit, ControlValueAcce defaultValues: this.defaultValues }; const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts index c25bd1c8fb..cadf5fb07a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts @@ -37,9 +37,10 @@ import { TbPopoverService } from '@shared/components/popover.service'; import { BackgroundSettingsPanelComponent } from '@home/components/widget/lib/settings/common/background-settings-panel.component'; -import { Observable, of } from 'rxjs'; +import { Observable, of, pipe } from 'rxjs'; import { ImagePipe } from '@shared/pipe/image.pipe'; import { DomSanitizer } from '@angular/platform-browser'; +import { tap } from 'rxjs/operators'; @Component({ selector: 'tb-background-settings', @@ -110,7 +111,7 @@ export class BackgroundSettingsComponent implements OnInit, ControlValueAccessor backgroundSettings: this.modelValue }; const backgroundSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, BackgroundSettingsPanelComponent, ['left'], true, null, + this.viewContainerRef, BackgroundSettingsPanelComponent, ['left'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts index 5e4e049055..5db91fb1bb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts @@ -133,7 +133,7 @@ export class WidgetButtonCustomStyleComponent implements OnInit, OnChanges, Cont }; const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, this.viewContainerRef, WidgetButtonCustomStylePanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, + ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts index 3e31420747..b2a78ff961 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts @@ -137,7 +137,7 @@ export class WidgetButtonToggleCustomStyleComponent implements OnInit, OnChanges }; const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, this.viewContainerRef, WidgetButtonToggleCustomStylePanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, + ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts index 25ce5238ef..2f2067f3a8 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts @@ -92,7 +92,7 @@ export class TimeSeriesChartAxisSettingsButtonComponent implements OnInit, Contr advanced: this.advanced }; const axisSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts index abb40594d6..e3ff513e0f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts @@ -108,7 +108,7 @@ export class TimeSeriesChartThresholdSettingsComponent implements OnInit, Contro yAxisIds: this.yAxisIds }; const thresholdSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimeSeriesChartThresholdSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, TimeSeriesChartThresholdSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts index 425e436102..69cbc29a25 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts @@ -158,7 +158,7 @@ export class TimeSeriesChartYAxisRowComponent implements ControlValueAccessor, O advanced: this.advanced }; const yAxisSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts index 10f574a9d4..431fac44da 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts @@ -126,7 +126,7 @@ export class ColorRangeSettingsComponent implements OnInit, ControlValueAccessor settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this) }; const colorRangeSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ColorRangePanelComponent, 'left', true, null, + this.viewContainerRef, ColorRangePanelComponent, 'left', false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts index 484d46fa38..133fa11bd4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts @@ -171,7 +171,7 @@ export class ColorSettingsComponent implements OnInit, ControlValueAccessor, OnD maxValue: this.maxValue }; const colorSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ColorSettingsPanelComponent, 'left', true, null, + this.viewContainerRef, ColorSettingsPanelComponent, 'left', false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts index 3a626b528b..92aef0ba29 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts @@ -166,7 +166,7 @@ export class DateFormatSelectComponent implements OnInit, ControlValueAccessor { dateFormat: deepClone(this.modelValue) }; const dateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, DateFormatSettingsPanelComponent, 'top', true, null, + this.viewContainerRef, DateFormatSettingsPanelComponent, 'top', false, null, ctx, {}, {}, {}, true); @@ -192,7 +192,7 @@ export class DateFormatSelectComponent implements OnInit, ControlValueAccessor { defaultAutoDateFormatSettings, this.modelValue.autoDateFormatSettings) }; const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts index 96526da502..79c2254a7d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts @@ -175,7 +175,7 @@ export class DynamicFormPropertyRowComponent implements ControlValueAccessor, On property: deepClone(this.modelValue) }; const dynamicFormPropertyPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, DynamicFormPropertyPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, DynamicFormPropertyPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts index 9534dd3a3b..25addab5ea 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts @@ -110,7 +110,7 @@ export class FontSettingsComponent implements OnInit, ControlValueAccessor { } } const fontSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, FontSettingsPanelComponent, 'left', true, null, + this.viewContainerRef, FontSettingsPanelComponent, 'left', false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts index 5f56bd85c3..8c94ed2c80 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts @@ -106,7 +106,7 @@ export class DataLayerColorSettingsComponent implements ControlValueAccessor { helpId: this.helpId }; const colorSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, DataLayerColorSettingsPanelComponent, 'left', true, null, + this.viewContainerRef, DataLayerColorSettingsPanelComponent, 'left', false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts index 392c9f9565..d7d4f78433 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts @@ -184,7 +184,7 @@ export class MapLayerRowComponent implements ControlValueAccessor, OnInit { mapLayerSettings: deepClone(this.modelValue) }; const mapLayerSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, MapLayerSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, MapLayerSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts index ba52e41b84..6cf5791406 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts @@ -162,7 +162,7 @@ export class MapTooltipTagActionsComponent implements ControlValueAccessor, OnIn }; const widgetActionSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, this.viewContainerRef, WidgetActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, + ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts index 21600392df..2d8feb817f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts @@ -80,7 +80,7 @@ export class MarkerImageSettingsComponent implements ControlValueAccessor { markerImageSettings: this.modelValue, }; const markerImageSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, MarkerImageSettingsPanelComponent, 'left', true, null, + this.viewContainerRef, MarkerImageSettingsPanelComponent, 'left', false, null, ctx, {}, {}, {}, true); diff --git a/ui-ngx/src/app/shared/components/js-func.component.ts b/ui-ngx/src/app/shared/components/js-func.component.ts index 5568e6779d..e436f79157 100644 --- a/ui-ngx/src/app/shared/components/js-func.component.ts +++ b/ui-ngx/src/app/shared/components/js-func.component.ts @@ -522,7 +522,7 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal modules: deepClone(this.modules) }; const modulesPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, JsFuncModulesComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, + this.viewContainerRef, JsFuncModulesComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, ctx, {}, {}, {}, true); From 56598a5247fad6e52f3bc2fda6a52f44906ebf20 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 21 Mar 2025 13:17:03 +0200 Subject: [PATCH 064/286] added tests and moved to common util --- ...alculatedFieldManagerMessageProcessor.java | 2 +- common/script/script-api/pom.xml | 8 -------- .../thingsboard/script/api/tbel/TbUtils.java | 6 +++--- .../script/api/tbel/TbUtilsTest.java | 20 +++++++++++++++++++ common/util/pom.xml | 8 ++++++++ .../common/util/geo}/Coordinates.java | 2 +- .../thingsboard/common/util/geo}/GeoUtil.java | 2 +- .../common/util/geo}/Perimeter.java | 2 +- .../common/util/geo}/PerimeterType.java | 2 +- .../common/util/geo}/RangeUnit.java | 2 +- .../engine/geo/AbstractGeofencingNode.java | 10 +++++----- ...bGpsGeofencingActionNodeConfiguration.java | 2 +- ...bGpsGeofencingFilterNodeConfiguration.java | 4 ++-- .../rule/engine/geo/GeoUtilTest.java | 4 ++-- .../geo/TbGpsGeofencingFilterNodeTest.java | 6 +++--- 15 files changed, 50 insertions(+), 30 deletions(-) rename common/{script/script-api/src/main/java/org/thingsboard/script/api => util/src/main/java/org/thingsboard/common/util/geo}/Coordinates.java (94%) rename common/{script/script-api/src/main/java/org/thingsboard/script/api => util/src/main/java/org/thingsboard/common/util/geo}/GeoUtil.java (99%) rename common/{script/script-api/src/main/java/org/thingsboard/script/api => util/src/main/java/org/thingsboard/common/util/geo}/Perimeter.java (95%) rename common/{script/script-api/src/main/java/org/thingsboard/script/api => util/src/main/java/org/thingsboard/common/util/geo}/PerimeterType.java (94%) rename common/{script/script-api/src/main/java/org/thingsboard/script/api => util/src/main/java/org/thingsboard/common/util/geo}/RangeUnit.java (95%) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index 1dd5b01401..0990365748 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -141,7 +141,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware } public void onEntityLifecycleMsg(CalculatedFieldEntityLifecycleMsg msg) throws CalculatedFieldException { - log.info("Processing entity lifecycle event: [{}] for entity: [{}]", msg.getData().getEvent(), msg.getData().getEntityId()); + log.debug("Processing entity lifecycle event: [{}] for entity: [{}]", msg.getData().getEvent(), msg.getData().getEntityId()); var entityType = msg.getData().getEntityId().getEntityType(); var event = msg.getData().getEvent(); switch (entityType) { diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index da60567814..3655692217 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -111,14 +111,6 @@ awaitility test - - org.locationtech.spatial4j - spatial4j - - - org.locationtech.jts - jts-core - diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java index 12eb308fee..72792c1093 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java +++ b/common/script/script-api/src/main/java/org/thingsboard/script/api/tbel/TbUtils.java @@ -25,9 +25,9 @@ import org.mvel2.execution.ExecutionArrayList; import org.mvel2.execution.ExecutionHashMap; import org.mvel2.util.MethodStub; import org.thingsboard.common.util.JacksonUtil; -import org.thingsboard.script.api.Coordinates; -import org.thingsboard.script.api.GeoUtil; -import org.thingsboard.script.api.RangeUnit; +import org.thingsboard.common.util.geo.Coordinates; +import org.thingsboard.common.util.geo.GeoUtil; +import org.thingsboard.common.util.geo.RangeUnit; import org.thingsboard.server.common.data.StringUtils; import java.io.IOException; diff --git a/common/script/script-api/src/test/java/org/thingsboard/script/api/tbel/TbUtilsTest.java b/common/script/script-api/src/test/java/org/thingsboard/script/api/tbel/TbUtilsTest.java index e3860ed89a..1063a8e8de 100644 --- a/common/script/script-api/src/test/java/org/thingsboard/script/api/tbel/TbUtilsTest.java +++ b/common/script/script-api/src/test/java/org/thingsboard/script/api/tbel/TbUtilsTest.java @@ -1150,6 +1150,26 @@ public class TbUtilsTest { Assertions.assertTrue(TbUtils.isNaN(Double.NaN)); } + @Test + public void isInsidePolygon() { + // outside the polygon + String perimeter = "[[[50.75581142688204,29.097910166341073],[50.16785158177623,29.35066098977171],[50.164329922384674,29.773743889862114],[50.16785158177623,30.801230932938843],[50.459245308833495,30.92760634465418],[50.486522489629564,30.68548421850448],[50.703612031034005,30.872660513473573]],[[50.606017492632766,29.36165015600782],[50.54317104075835,29.762754723626013],[50.41021974600505,29.455058069014804]]]"; + Assertions.assertFalse(TbUtils.isInsidePolygon(50.50869555168039, 30.80123093293884, perimeter)); + // inside the polygon + Assertions.assertTrue(TbUtils.isInsidePolygon(50.50520628167696, 30.339685951022016, perimeter)); + // inside the hole + Assertions.assertFalse(TbUtils.isInsidePolygon(50.52265651287081, 29.488025567723156, perimeter)); + } + + @Test + public void isInsideCircle() { + // outside the circle + String perimeter = "{\"latitude\":50.32254778825905,\"longitude\":28.207787701215757,\"radius\":47477.33130420423}"; + Assertions.assertFalse(TbUtils.isInsideCircle(50.81490715736681, 28.05943395702824, perimeter)); + // inside the circle + Assertions.assertTrue(TbUtils.isInsideCircle(50.599397971892444, 28.086906872618542, perimeter)); + } + private static List toList(byte[] data) { List result = new ArrayList<>(data.length); for (Byte b : data) { diff --git a/common/util/pom.xml b/common/util/pom.xml index 430a6e7df9..82768cdb68 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -103,6 +103,14 @@ com.fasterxml.jackson.datatype jackson-datatype-jdk8 + + org.locationtech.spatial4j + spatial4j + + + org.locationtech.jts + jts-core + diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/Coordinates.java b/common/util/src/main/java/org/thingsboard/common/util/geo/Coordinates.java similarity index 94% rename from common/script/script-api/src/main/java/org/thingsboard/script/api/Coordinates.java rename to common/util/src/main/java/org/thingsboard/common/util/geo/Coordinates.java index 671ab58d5c..dc1998bff1 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/Coordinates.java +++ b/common/util/src/main/java/org/thingsboard/common/util/geo/Coordinates.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.script.api; +package org.thingsboard.common.util.geo; import lombok.Data; diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/GeoUtil.java b/common/util/src/main/java/org/thingsboard/common/util/geo/GeoUtil.java similarity index 99% rename from common/script/script-api/src/main/java/org/thingsboard/script/api/GeoUtil.java rename to common/util/src/main/java/org/thingsboard/common/util/geo/GeoUtil.java index 408b051303..11a6799348 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/GeoUtil.java +++ b/common/util/src/main/java/org/thingsboard/common/util/geo/GeoUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.script.api; +package org.thingsboard.common.util.geo; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/Perimeter.java b/common/util/src/main/java/org/thingsboard/common/util/geo/Perimeter.java similarity index 95% rename from common/script/script-api/src/main/java/org/thingsboard/script/api/Perimeter.java rename to common/util/src/main/java/org/thingsboard/common/util/geo/Perimeter.java index e05486bee0..238fa19af5 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/Perimeter.java +++ b/common/util/src/main/java/org/thingsboard/common/util/geo/Perimeter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.script.api; +package org.thingsboard.common.util.geo; import lombok.Data; diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/PerimeterType.java b/common/util/src/main/java/org/thingsboard/common/util/geo/PerimeterType.java similarity index 94% rename from common/script/script-api/src/main/java/org/thingsboard/script/api/PerimeterType.java rename to common/util/src/main/java/org/thingsboard/common/util/geo/PerimeterType.java index f6a0eea77e..c3b334abd7 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/PerimeterType.java +++ b/common/util/src/main/java/org/thingsboard/common/util/geo/PerimeterType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.script.api; +package org.thingsboard.common.util.geo; public enum PerimeterType { CIRCLE, POLYGON diff --git a/common/script/script-api/src/main/java/org/thingsboard/script/api/RangeUnit.java b/common/util/src/main/java/org/thingsboard/common/util/geo/RangeUnit.java similarity index 95% rename from common/script/script-api/src/main/java/org/thingsboard/script/api/RangeUnit.java rename to common/util/src/main/java/org/thingsboard/common/util/geo/RangeUnit.java index 6a594d1668..56883ca43f 100644 --- a/common/script/script-api/src/main/java/org/thingsboard/script/api/RangeUnit.java +++ b/common/util/src/main/java/org/thingsboard/common/util/geo/RangeUnit.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.script.api; +package org.thingsboard.common.util.geo; public enum RangeUnit { METER(1000.0), KILOMETER(1.0), FOOT(3280.84), MILE(0.62137), NAUTICAL_MILE(0.539957); diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java index ea0d62ebc0..ff6b3acb88 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/AbstractGeofencingNode.java @@ -21,16 +21,16 @@ import com.google.gson.JsonParser; import org.locationtech.spatial4j.context.jts.JtsSpatialContext; import org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.common.util.geo.Coordinates; +import org.thingsboard.common.util.geo.GeoUtil; +import org.thingsboard.common.util.geo.Perimeter; +import org.thingsboard.common.util.geo.PerimeterType; +import org.thingsboard.common.util.geo.RangeUnit; import org.thingsboard.rule.engine.api.TbContext; import org.thingsboard.rule.engine.api.TbNode; import org.thingsboard.rule.engine.api.TbNodeConfiguration; import org.thingsboard.rule.engine.api.TbNodeException; import org.thingsboard.rule.engine.api.util.TbNodeUtils; -import org.thingsboard.script.api.Coordinates; -import org.thingsboard.script.api.GeoUtil; -import org.thingsboard.script.api.Perimeter; -import org.thingsboard.script.api.PerimeterType; -import org.thingsboard.script.api.RangeUnit; import org.thingsboard.server.common.data.StringUtils; import org.thingsboard.server.common.msg.TbMsg; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingActionNodeConfiguration.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingActionNodeConfiguration.java index edd60d422b..bf195b44cc 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingActionNodeConfiguration.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingActionNodeConfiguration.java @@ -16,7 +16,7 @@ package org.thingsboard.rule.engine.geo; import lombok.Data; -import org.thingsboard.script.api.PerimeterType; +import org.thingsboard.common.util.geo.PerimeterType; import java.util.concurrent.TimeUnit; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeConfiguration.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeConfiguration.java index 68a1299fc4..32a161635f 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeConfiguration.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeConfiguration.java @@ -16,9 +16,9 @@ package org.thingsboard.rule.engine.geo; import lombok.Data; +import org.thingsboard.common.util.geo.PerimeterType; +import org.thingsboard.common.util.geo.RangeUnit; import org.thingsboard.rule.engine.api.NodeConfiguration; -import org.thingsboard.script.api.PerimeterType; -import org.thingsboard.script.api.RangeUnit; /** * Created by ashvayka on 19.01.18. diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/GeoUtilTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/GeoUtilTest.java index 2fb5523c1e..b5438fe529 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/GeoUtilTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/GeoUtilTest.java @@ -19,8 +19,8 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; -import org.thingsboard.script.api.Coordinates; -import org.thingsboard.script.api.GeoUtil; +import org.thingsboard.common.util.geo.Coordinates; +import org.thingsboard.common.util.geo.GeoUtil; @ExtendWith(MockitoExtension.class) public class GeoUtilTest { diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeTest.java index 54f1384d10..71c35d27f4 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/geo/TbGpsGeofencingFilterNodeTest.java @@ -21,12 +21,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.common.util.geo.Coordinates; +import org.thingsboard.common.util.geo.PerimeterType; +import org.thingsboard.common.util.geo.RangeUnit; import org.thingsboard.rule.engine.api.TbContext; import org.thingsboard.rule.engine.api.TbNodeConfiguration; import org.thingsboard.rule.engine.api.TbNodeException; -import org.thingsboard.script.api.Coordinates; -import org.thingsboard.script.api.PerimeterType; -import org.thingsboard.script.api.RangeUnit; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.msg.TbMsgType; From 0920eede513e022d6cc87e880a5df51d7e8de272 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 21 Mar 2025 13:36:36 +0200 Subject: [PATCH 065/286] removed unnecessary dependency --- rule-engine/rule-engine-components/pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 4eb76727ef..7ee5ab1496 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -53,10 +53,6 @@ transport-api provided - - org.thingsboard.common.script - script-api - ch.qos.logback logback-core From 0caa6ad86e506c40d235bb778010a734e8dfb93d Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Fri, 21 Mar 2025 14:25:54 +0200 Subject: [PATCH 066/286] Refactoring for EDQS --- .../service/edqs/DefaultEdqsService.java | 4 +-- .../server/service/edqs/EdqsSyncService.java | 3 -- .../service/edqs/KafkaEdqsSyncService.java | 3 +- .../server/edqs/processor/EdqsProducer.java | 36 ++++++------------- .../edqs/state/KafkaEdqsStateService.java | 4 +-- .../queue/edqs/KafkaEdqsQueueFactory.java | 1 + .../provider/KafkaMonolithQueueFactory.java | 1 + .../provider/KafkaTbCoreQueueFactory.java | 1 + .../KafkaTbRuleEngineQueueFactory.java | 1 + 9 files changed, 19 insertions(+), 35 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java index e823dee4e7..7d5a0cb0fd 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java @@ -96,10 +96,8 @@ public class DefaultEdqsService implements EdqsService { private void init() { executor = ThingsBoardExecutors.newWorkStealingPool(12, getClass()); eventsProducer = EdqsProducer.builder() - .queue(EdqsQueue.EVENTS) - .partitionService(edqsPartitionService) - .topicService(topicService) .producer(queueFactory.createEdqsMsgProducer(EdqsQueue.EVENTS)) + .partitionService(edqsPartitionService) .build(); syncLock = distributedLockService.getLock("edqs_sync"); } diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java b/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java index 6ea2f959b7..79e0e60983 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/EdqsSyncService.java @@ -43,7 +43,6 @@ import org.thingsboard.server.dao.model.sqlts.dictionary.KeyDictionaryEntry; import org.thingsboard.server.dao.model.sqlts.latest.TsKvLatestEntity; import org.thingsboard.server.dao.sql.relation.RelationRepository; import org.thingsboard.server.dao.sqlts.latest.TsKvLatestRepository; -import org.thingsboard.server.queue.edqs.EdqsConfig; import java.util.List; import java.util.Map; @@ -76,8 +75,6 @@ public abstract class EdqsSyncService { @Autowired @Lazy private DefaultEdqsService edqsService; - @Autowired - protected EdqsConfig edqsConfig; private final ConcurrentHashMap entityInfoMap = new ConcurrentHashMap<>(); private final ConcurrentHashMap keys = new ConcurrentHashMap<>(); diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java b/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java index 201964c955..ad7b7b970d 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java @@ -18,6 +18,7 @@ package org.thingsboard.server.service.edqs; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; +import org.thingsboard.server.queue.edqs.EdqsConfig; import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.kafka.TbKafkaAdmin; import org.thingsboard.server.queue.kafka.TbKafkaSettings; @@ -32,7 +33,7 @@ public class KafkaEdqsSyncService extends EdqsSyncService { private final boolean syncNeeded; - public KafkaEdqsSyncService(TbKafkaSettings kafkaSettings) { + public KafkaEdqsSyncService(TbKafkaSettings kafkaSettings, EdqsConfig edqsConfig) { TbKafkaAdmin kafkaAdmin = new TbKafkaAdmin(kafkaSettings, Collections.emptyMap()); this.syncNeeded = kafkaAdmin.areAllTopicsEmpty(IntStream.range(0, edqsConfig.getPartitions()) .mapToObj(partition -> TopicPartitionInfo.builder() diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java index a06836339f..cc4f913d38 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProducer.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edqs.processor; import lombok.Builder; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.common.errors.RecordTooLargeException; import org.thingsboard.server.common.data.ObjectType; @@ -27,53 +28,38 @@ import org.thingsboard.server.queue.TbQueueCallback; import org.thingsboard.server.queue.TbQueueMsgMetadata; import org.thingsboard.server.queue.TbQueueProducer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; -import org.thingsboard.server.queue.discovery.TopicService; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.kafka.TbKafkaProducerTemplate; @Slf4j +@Builder +@RequiredArgsConstructor public class EdqsProducer { - private final EdqsQueue queue; - private final EdqsPartitionService partitionService; - private final TopicService topicService; - private final TbQueueProducer> producer; - - @Builder - public EdqsProducer(EdqsQueue queue, - EdqsPartitionService partitionService, - TopicService topicService, - TbQueueProducer> producer) { - this.queue = queue; - this.partitionService = partitionService; - this.topicService = topicService; - this.producer = producer; - } + private final EdqsPartitionService partitionService; public void send(TenantId tenantId, ObjectType type, String key, ToEdqsMsg msg) { - String topic = topicService.buildTopicName(queue.getTopic()); + TopicPartitionInfo tpi = TopicPartitionInfo.builder() + .topic(producer.getDefaultTopic()) + .partition(partitionService.resolvePartition(tenantId, key)) + .build(); TbQueueCallback callback = new TbQueueCallback() { @Override public void onSuccess(TbQueueMsgMetadata metadata) { - log.trace("[{}][{}][{}] Published msg to {}: {}", tenantId, type, key, topic, msg); + log.trace("[{}][{}][{}] Published msg to {}: {}", tenantId, type, key, tpi, msg); } @Override public void onFailure(Throwable t) { if (t instanceof RecordTooLargeException) { if (!log.isDebugEnabled()) { - log.warn("[{}][{}][{}] Failed to publish msg to {}", tenantId, type, key, topic, t); // not logging the whole message + log.warn("[{}][{}][{}] Failed to publish msg to {}", tenantId, type, key, tpi, t); // not logging the whole message return; } } - log.warn("[{}][{}][{}] Failed to publish msg to {}: {}", tenantId, type, key, topic, msg, t); + log.warn("[{}][{}][{}] Failed to publish msg to {}: {}", tenantId, type, key, tpi, msg, t); } }; - TopicPartitionInfo tpi = TopicPartitionInfo.builder() - .topic(topic) - .partition(partitionService.resolvePartition(tenantId, key)) - .build(); if (producer instanceof TbKafkaProducerTemplate> kafkaProducer) { kafkaProducer.send(tpi, key, new TbProtoQueueMsg<>(null, msg), callback); // specifying custom key for compaction } else { diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java index 067c730bfe..c59707c9c3 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java @@ -143,10 +143,8 @@ public class KafkaEdqsStateService implements EdqsStateService { .build(); stateProducer = EdqsProducer.builder() - .queue(EdqsQueue.STATE) - .partitionService(partitionService) - .topicService(topicService) .producer(queueFactory.createEdqsMsgProducer(EdqsQueue.STATE)) + .partitionService(partitionService) .build(); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java index e985696040..a322cc5434 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java @@ -95,6 +95,7 @@ public class KafkaEdqsQueueFactory implements EdqsQueueFactory { public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { return TbKafkaProducerTemplate.>builder() .clientId("edqs-" + queue.name().toLowerCase() + "-producer-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(queue.getTopic())) .settings(kafkaSettings) .admin(queue == EdqsQueue.STATE ? edqsStateAdmin : edqsEventsAdmin) .build(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index f07bd9dcbb..1a8ee1dcee 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -593,6 +593,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { return TbKafkaProducerTemplate.>builder() .clientId("edqs-producer-" + queue.name().toLowerCase() + "-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(queue.getTopic())) .settings(kafkaSettings) .admin(edqsEventsAdmin) .build(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java index 3c6d144a0c..2a1dc4171f 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java @@ -483,6 +483,7 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { return TbKafkaProducerTemplate.>builder() .clientId("edqs-producer-" + queue.name().toLowerCase() + "-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(queue.getTopic())) .settings(kafkaSettings) .admin(edqsEventsAdmin) .build(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index d0e6c2f123..f5300badbe 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -378,6 +378,7 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { return TbKafkaProducerTemplate.>builder() .clientId("edqs-producer-" + queue.name().toLowerCase() + "-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(queue.getTopic())) .settings(kafkaSettings) .admin(edqsEventsAdmin) .build(); From 8f1fff61dfd55fc5e757f61e968f14f79da15363 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 21 Mar 2025 16:31:30 +0200 Subject: [PATCH 067/286] Fix equals method for CF --- .../cf/DefaultCalculatedFieldCache.java | 3 + .../DefaultEntitiesExportImportService.java | 2 - .../service/sync/vc/VersionControlTest.java | 2 + .../common/data/cf/CalculatedField.java | 57 ++++++++++++++----- .../ScriptCalculatedFieldConfiguration.java | 3 + .../SimpleCalculatedFieldConfiguration.java | 2 + 6 files changed, 53 insertions(+), 16 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java index 64487d9b3e..219a261183 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java @@ -144,6 +144,9 @@ public class DefaultCalculatedFieldCache implements CalculatedFieldCache { calculatedFieldFetchLock.lock(); try { CalculatedField calculatedField = calculatedFieldService.findById(tenantId, calculatedFieldId); + if (calculatedField == null) { + return; + } EntityId cfEntityId = calculatedField.getEntityId(); calculatedFields.put(calculatedFieldId, calculatedField); diff --git a/application/src/main/java/org/thingsboard/server/service/sync/ie/DefaultEntitiesExportImportService.java b/application/src/main/java/org/thingsboard/server/service/sync/ie/DefaultEntitiesExportImportService.java index 06fe7f4036..db7e37b368 100644 --- a/application/src/main/java/org/thingsboard/server/service/sync/ie/DefaultEntitiesExportImportService.java +++ b/application/src/main/java/org/thingsboard/server/service/sync/ie/DefaultEntitiesExportImportService.java @@ -31,7 +31,6 @@ import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.sync.ie.EntityExportData; import org.thingsboard.server.common.data.sync.ie.EntityImportResult; import org.thingsboard.server.common.data.util.ThrowingRunnable; -import org.thingsboard.server.dao.cf.CalculatedFieldService; import org.thingsboard.server.dao.exception.DataValidationException; import org.thingsboard.server.dao.relation.RelationService; import org.thingsboard.server.queue.util.TbCoreComponent; @@ -62,7 +61,6 @@ public class DefaultEntitiesExportImportService implements EntitiesExportImportS private final Map> importServices = new HashMap<>(); private final RelationService relationService; - private final CalculatedFieldService calculatedFieldService; private final RateLimitService rateLimitService; private final TbLogEntityActionService logEntityActionService; diff --git a/application/src/test/java/org/thingsboard/server/service/sync/vc/VersionControlTest.java b/application/src/test/java/org/thingsboard/server/service/sync/vc/VersionControlTest.java index 06f61ca4e5..29c3af5387 100644 --- a/application/src/test/java/org/thingsboard/server/service/sync/vc/VersionControlTest.java +++ b/application/src/test/java/org/thingsboard/server/service/sync/vc/VersionControlTest.java @@ -621,6 +621,7 @@ public class VersionControlTest extends AbstractControllerTest { assertThat(importedField.getName()).isEqualTo(deviceCalculatedField.getName()); assertThat(importedField.getType()).isEqualTo(deviceCalculatedField.getType()); assertThat(importedField.getId()).isNotEqualTo(deviceCalculatedField.getId()); + assertThat(importedField.getConfiguration().getArguments().get("T").getRefEntityId()).isEqualTo(importedAsset.getId()); }); List importedAssetCalculatedFields = findCalculatedFieldsByEntityId(importedAsset.getId()); @@ -629,6 +630,7 @@ public class VersionControlTest extends AbstractControllerTest { assertThat(importedField.getName()).isEqualTo(assetCalculatedField.getName()); assertThat(importedField.getType()).isEqualTo(assetCalculatedField.getType()); assertThat(importedField.getId()).isNotEqualTo(assetCalculatedField.getId()); + assertThat(importedField.getConfiguration().getArguments().get("T").getRefEntityId()).isEqualTo(importedDevice.getId()); }); } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java b/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java index b86f30ca78..ea7f81f216 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java @@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonSetter; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import org.thingsboard.server.common.data.BaseData; @@ -37,10 +36,10 @@ import org.thingsboard.server.common.data.validation.Length; import org.thingsboard.server.common.data.validation.NoXss; import java.io.Serial; +import java.util.Objects; @Schema @Data -@EqualsAndHashCode(callSuper = true) public class CalculatedField extends BaseData implements HasName, HasTenantId, HasVersion, HasDebugSettings { @Serial @@ -112,6 +111,48 @@ public class CalculatedField extends BaseData implements HasN return super.getCreatedTime(); } + // Getter is ignored for serialization + @JsonIgnore + public boolean isDebugMode() { + return debugMode; + } + + // Setter is annotated for deserialization + @JsonSetter + public void setDebugMode(boolean debugMode) { + this.debugMode = debugMode; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof CalculatedField that)) return false; + if (!super.equals(o)) return false; + return Objects.equals(tenantId, that.tenantId) && + Objects.equals(entityId, that.entityId) && + Objects.equals(name, that.name) && + Objects.equals(debugSettings, that.debugSettings) && + Objects.equals(configuration, that.configuration) && + type == that.type && debugMode == that.debugMode && + configurationVersion == that.configurationVersion && + Objects.equals(version, that.version); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(tenantId); + result = 31 * result + Objects.hashCode(entityId); + result = 31 * result + Objects.hashCode(type); + result = 31 * result + Objects.hashCode(name); + result = 31 * result + Boolean.hashCode(debugMode); + result = 31 * result + Objects.hashCode(debugSettings); + result = 31 * result + Integer.hashCode(configurationVersion); + result = 31 * result + Objects.hashCode(configuration); + result = 31 * result + Objects.hashCode(version); + return result; + } + @Override public String toString() { return new StringBuilder() @@ -128,16 +169,4 @@ public class CalculatedField extends BaseData implements HasN .toString(); } - // Getter is ignored for serialization - @JsonIgnore - public boolean isDebugMode() { - return debugMode; - } - - // Setter is annotated for deserialization - @JsonSetter - public void setDebugMode(boolean debugMode) { - this.debugMode = debugMode; - } - } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/ScriptCalculatedFieldConfiguration.java b/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/ScriptCalculatedFieldConfiguration.java index 0971217fdf..c2dde43b8e 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/ScriptCalculatedFieldConfiguration.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/ScriptCalculatedFieldConfiguration.java @@ -16,13 +16,16 @@ package org.thingsboard.server.common.data.cf.configuration; import lombok.Data; +import lombok.EqualsAndHashCode; import org.thingsboard.server.common.data.cf.CalculatedFieldType; @Data +@EqualsAndHashCode(callSuper = true) public class ScriptCalculatedFieldConfiguration extends BaseCalculatedFieldConfiguration implements CalculatedFieldConfiguration { @Override public CalculatedFieldType getType() { return CalculatedFieldType.SCRIPT; } + } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java b/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java index 79a0518ba0..0a422de175 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java @@ -16,9 +16,11 @@ package org.thingsboard.server.common.data.cf.configuration; import lombok.Data; +import lombok.EqualsAndHashCode; import org.thingsboard.server.common.data.cf.CalculatedFieldType; @Data +@EqualsAndHashCode(callSuper = true) public class SimpleCalculatedFieldConfiguration extends BaseCalculatedFieldConfiguration implements CalculatedFieldConfiguration { @Override From e97b1d2c2b293a8d9b4a47c5b7279ec14cb99a5c Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 21 Mar 2025 17:35:14 +0200 Subject: [PATCH 068/286] UI: Fixed init js-func component --- ui-ngx/src/app/shared/components/js-func.component.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/shared/components/js-func.component.ts b/ui-ngx/src/app/shared/components/js-func.component.ts index 5568e6779d..4026b54984 100644 --- a/ui-ngx/src/app/shared/components/js-func.component.ts +++ b/ui-ngx/src/app/shared/components/js-func.component.ts @@ -336,7 +336,7 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal } private updatedScriptLanguage() { - this.jsEditor.session.setMode(`ace/mode/${ScriptLanguage.TBEL === this.scriptLanguage ? 'tbel' : 'javascript'}`); + this.jsEditor?.session?.setMode(`ace/mode/${ScriptLanguage.TBEL === this.scriptLanguage ? 'tbel' : 'javascript'}`); } validateOnSubmit(): Observable { @@ -582,7 +582,7 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal private updateHighlightRules(): void { // @ts-ignore - if (!!this.jsEditor.session.$mode) { + if (!!this.jsEditor?.session?.$mode) { // @ts-ignore const newMode = new this.jsEditor.session.$mode.constructor(); newMode.$highlightRules = new newMode.HighlightRules(); @@ -598,7 +598,7 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal if (this.scriptLanguage === ScriptLanguage.TBEL) { newMode.$highlightRules.$rules.start = [...tbelUtilsFuncHighlightRules, ...newMode.$highlightRules.$rules.start]; } - const identifierRule = newMode.$highlightRules.$rules.no_regex.find(rule => rule.token?.includes('identifier')); + const identifierRule = newMode.$highlightRules.$rules.no_regex.find(rule => Array.isArray(rule.token) && rule.token.includes('identifier')); if (identifierRule && identifierRule.next === 'no_regex') { identifierRule.next = 'start'; } @@ -609,7 +609,7 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal private updateJsWorkerGlobals() { // @ts-ignore - if (!!this.jsEditor.session.$worker) { + if (!!this.jsEditor?.session?.$worker) { const jsWorkerOptions = { undef: !this.disableUndefinedCheck, unused: true, @@ -638,6 +638,9 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal } updateCompleters() { + if (!this.jsEditor) { + return; + } let modulesCompleterObservable: Observable; if (this.withModules) { modulesCompleterObservable = loadModulesCompleter(this.http, this.modules); From 22d584317bfefdedd94781906c1d4c26f4146618 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 21 Mar 2025 18:43:48 +0200 Subject: [PATCH 069/286] UI: Fix analoque gauges bug on resize. --- .../home/components/widget/lib/analogue-gauge.models.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts index 93b2a6b6e5..110d6b34a0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts @@ -107,7 +107,9 @@ export abstract class TbBaseGauge { } resize() { - this.gauge.update({width: this.ctx.width, height: this.ctx.height} as GenericOptions); + if (this.ctx.width > 0 && this.ctx.height > 0) { + this.gauge.update({width: this.ctx.width, height: this.ctx.height} as GenericOptions); + } } destroy() { From 77721d5684968e9e72c487a72659423106e1e57d Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 24 Mar 2025 09:49:40 +0200 Subject: [PATCH 070/286] Fix CFControllerTest --- .../server/controller/CalculatedFieldControllerTest.java | 9 ++++----- .../SimpleCalculatedFieldConfiguration.java | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/CalculatedFieldControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/CalculatedFieldControllerTest.java index ee66f664cc..af43b34558 100644 --- a/application/src/test/java/org/thingsboard/server/controller/CalculatedFieldControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/CalculatedFieldControllerTest.java @@ -31,7 +31,6 @@ import org.thingsboard.server.common.data.cf.configuration.OutputType; import org.thingsboard.server.common.data.cf.configuration.ReferencedEntityKey; import org.thingsboard.server.common.data.cf.configuration.SimpleCalculatedFieldConfiguration; import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.dao.service.DaoSqlTest; @@ -85,7 +84,7 @@ public class CalculatedFieldControllerTest extends AbstractControllerTest { assertThat(savedCalculatedField.getEntityId()).isEqualTo(calculatedField.getEntityId()); assertThat(savedCalculatedField.getType()).isEqualTo(calculatedField.getType()); assertThat(savedCalculatedField.getName()).isEqualTo(calculatedField.getName()); - assertThat(savedCalculatedField.getConfiguration()).isEqualTo(getCalculatedFieldConfig(testDevice.getId())); + assertThat(savedCalculatedField.getConfiguration()).isEqualTo(getCalculatedFieldConfig()); assertThat(savedCalculatedField.getVersion()).isEqualTo(1L); savedCalculatedField.setName("Test CF"); @@ -134,16 +133,16 @@ public class CalculatedFieldControllerTest extends AbstractControllerTest { calculatedField.setType(CalculatedFieldType.SIMPLE); calculatedField.setName("Test Calculated Field"); calculatedField.setConfigurationVersion(1); - calculatedField.setConfiguration(getCalculatedFieldConfig(null)); + calculatedField.setConfiguration(getCalculatedFieldConfig()); calculatedField.setVersion(1L); return calculatedField; } - private CalculatedFieldConfiguration getCalculatedFieldConfig(EntityId referencedEntityId) { + private CalculatedFieldConfiguration getCalculatedFieldConfig() { SimpleCalculatedFieldConfiguration config = new SimpleCalculatedFieldConfiguration(); Argument argument = new Argument(); - argument.setRefEntityId(referencedEntityId); + argument.setRefEntityId(null); ReferencedEntityKey refEntityKey = new ReferencedEntityKey("temperature", ArgumentType.TS_LATEST, null); argument.setRefEntityKey(refEntityKey); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java b/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java index 0a422de175..5c0ce71e86 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/cf/configuration/SimpleCalculatedFieldConfiguration.java @@ -27,4 +27,5 @@ public class SimpleCalculatedFieldConfiguration extends BaseCalculatedFieldConfi public CalculatedFieldType getType() { return CalculatedFieldType.SIMPLE; } + } From b0758135777634a99438be470077f6b80ea17f24 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 24 Mar 2025 10:17:48 +0200 Subject: [PATCH 071/286] UI: Fixed click area for SCADA symbols --- .../src/main/data/json/system/scada_symbols/apartments-hp.svg | 2 +- .../data/json/system/scada_symbols/bottom-light-bulb-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/conical-tank.svg | 2 +- .../src/main/data/json/system/scada_symbols/consumers-hp.svg | 2 +- .../json/system/scada_symbols/dynamic-horizontal-scale-hp.svg | 2 +- .../json/system/scada_symbols/dynamic-vertical-scale-hp.svg | 2 +- .../system/scada_symbols/electrical-distribution-board-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/filter-hp.svg | 2 +- .../json/system/scada_symbols/four-rate-energy-meter-hp.svg | 2 +- .../main/data/json/system/scada_symbols/gas-preventer-hp.svg | 2 +- .../main/data/json/system/scada_symbols/heat-exchanger-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/heat-pump-hp.svg | 2 +- .../main/data/json/system/scada_symbols/horizontal-tank-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/house-hp.svg | 2 +- .../json/system/scada_symbols/industrial-fuel-generator-hp.svg | 2 +- .../json/system/scada_symbols/large-horizontal-separator-hp.svg | 2 +- .../main/data/json/system/scada_symbols/large-inverter-hp.svg | 2 +- .../json/system/scada_symbols/large-stand-cylindrical-tank.svg | 2 +- .../json/system/scada_symbols/large-stand-vertical-tank.svg | 2 +- .../json/system/scada_symbols/large-vertical-separator-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/leak-sensor.svg | 2 +- .../data/json/system/scada_symbols/low-voltage-tower-hp.svg | 2 +- application/src/main/data/json/system/scada_symbols/meter.svg | 2 +- .../src/main/data/json/system/scada_symbols/oil-pump-hp.svg | 2 +- application/src/main/data/json/system/scada_symbols/pool-hp.svg | 2 +- application/src/main/data/json/system/scada_symbols/pool.svg | 2 +- .../src/main/data/json/system/scada_symbols/power-socket-hp.svg | 2 +- .../data/json/system/scada_symbols/short-vertical-tank-hp.svg | 2 +- .../json/system/scada_symbols/simple-horizontal-scale-hp.svg | 2 +- .../data/json/system/scada_symbols/simple-vertical-scale-hp.svg | 2 +- .../data/json/system/scada_symbols/small-cylindrical-tank.svg | 2 +- .../scada_symbols/small-horizontal-separator-connector-hp.svg | 2 +- .../main/data/json/system/scada_symbols/small-left-meter.svg | 2 +- .../scada_symbols/small-vertical-separator-connector-hp.svg | 2 +- .../json/system/scada_symbols/small-vertical-separator-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/spherical-tank.svg | 2 +- .../data/json/system/scada_symbols/stand-cylindrical-tank.svg | 2 +- .../json/system/scada_symbols/stand-vertical-short-tank.svg | 2 +- .../main/data/json/system/scada_symbols/top-light-bulb-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/turbine-hp.svg | 2 +- .../scada_symbols/vertical-energy-system-controller-hp.svg | 2 +- .../main/data/json/system/scada_symbols/vertical-tank-hp.svg | 2 +- .../data/json/system/scada_symbols/voltage-stabilizer-hp.svg | 2 +- .../data/json/system/scada_symbols/wind-turbine-cluster-hp.svg | 2 +- .../src/main/data/json/system/scada_symbols/wind-turbine-hp.svg | 2 +- 45 files changed, 45 insertions(+), 45 deletions(-) diff --git a/application/src/main/data/json/system/scada_symbols/apartments-hp.svg b/application/src/main/data/json/system/scada_symbols/apartments-hp.svg index 9e2c965f79..97ac492626 100644 --- a/application/src/main/data/json/system/scada_symbols/apartments-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/apartments-hp.svg @@ -330,7 +330,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/bottom-light-bulb-hp.svg b/application/src/main/data/json/system/scada_symbols/bottom-light-bulb-hp.svg index 4f0603b904..db107240a0 100644 --- a/application/src/main/data/json/system/scada_symbols/bottom-light-bulb-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/bottom-light-bulb-hp.svg @@ -332,7 +332,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/conical-tank.svg b/application/src/main/data/json/system/scada_symbols/conical-tank.svg index 7ae8f41934..6b37adc52e 100644 --- a/application/src/main/data/json/system/scada_symbols/conical-tank.svg +++ b/application/src/main/data/json/system/scada_symbols/conical-tank.svg @@ -371,7 +371,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/consumers-hp.svg b/application/src/main/data/json/system/scada_symbols/consumers-hp.svg index e4005d7ae2..8333d6bf55 100644 --- a/application/src/main/data/json/system/scada_symbols/consumers-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/consumers-hp.svg @@ -332,7 +332,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/dynamic-horizontal-scale-hp.svg b/application/src/main/data/json/system/scada_symbols/dynamic-horizontal-scale-hp.svg index e782b07609..b3506ae54f 100644 --- a/application/src/main/data/json/system/scada_symbols/dynamic-horizontal-scale-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/dynamic-horizontal-scale-hp.svg @@ -791,5 +791,5 @@ - + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg b/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg index 960abed340..3c52dae1c3 100644 --- a/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/dynamic-vertical-scale-hp.svg @@ -791,5 +791,5 @@ 26 - + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/electrical-distribution-board-hp.svg b/application/src/main/data/json/system/scada_symbols/electrical-distribution-board-hp.svg index 0fcfe4dde0..6e4175c6d7 100644 --- a/application/src/main/data/json/system/scada_symbols/electrical-distribution-board-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/electrical-distribution-board-hp.svg @@ -318,7 +318,7 @@ }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/filter-hp.svg b/application/src/main/data/json/system/scada_symbols/filter-hp.svg index 58ff3951e5..1f4516723e 100644 --- a/application/src/main/data/json/system/scada_symbols/filter-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/filter-hp.svg @@ -273,7 +273,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/four-rate-energy-meter-hp.svg b/application/src/main/data/json/system/scada_symbols/four-rate-energy-meter-hp.svg index de4fb13836..bba67e5fe3 100644 --- a/application/src/main/data/json/system/scada_symbols/four-rate-energy-meter-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/four-rate-energy-meter-hp.svg @@ -862,7 +862,7 @@ } ] }]]> -T1T2T3Export000223000223000223000223kWh +T1T2T3Export000223000223000223000223kWh diff --git a/application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg b/application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg index ea5a479eda..487b5e54d9 100644 --- a/application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/gas-preventer-hp.svg @@ -347,7 +347,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg b/application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg index 797220ea96..c1c3d4647e 100644 --- a/application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/heat-exchanger-hp.svg @@ -349,7 +349,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/heat-pump-hp.svg b/application/src/main/data/json/system/scada_symbols/heat-pump-hp.svg index 1d7babc3b0..eed54682cd 100644 --- a/application/src/main/data/json/system/scada_symbols/heat-pump-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/heat-pump-hp.svg @@ -587,7 +587,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/horizontal-tank-hp.svg b/application/src/main/data/json/system/scada_symbols/horizontal-tank-hp.svg index 18f194684b..bb6f5e55a9 100644 --- a/application/src/main/data/json/system/scada_symbols/horizontal-tank-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/horizontal-tank-hp.svg @@ -502,7 +502,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/house-hp.svg b/application/src/main/data/json/system/scada_symbols/house-hp.svg index d95c47bb8b..e3556d4d9a 100644 --- a/application/src/main/data/json/system/scada_symbols/house-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/house-hp.svg @@ -335,7 +335,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/industrial-fuel-generator-hp.svg b/application/src/main/data/json/system/scada_symbols/industrial-fuel-generator-hp.svg index 2b7a476a92..e0ee85b8cf 100644 --- a/application/src/main/data/json/system/scada_symbols/industrial-fuel-generator-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/industrial-fuel-generator-hp.svg @@ -344,7 +344,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg b/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg index 79f6745a73..8179549c54 100644 --- a/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/large-horizontal-separator-hp.svg @@ -336,7 +336,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/large-inverter-hp.svg b/application/src/main/data/json/system/scada_symbols/large-inverter-hp.svg index 11bc5da0a6..bf18d64040 100644 --- a/application/src/main/data/json/system/scada_symbols/large-inverter-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/large-inverter-hp.svg @@ -564,7 +564,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/large-stand-cylindrical-tank.svg b/application/src/main/data/json/system/scada_symbols/large-stand-cylindrical-tank.svg index 11bd47916f..09c0e2a9e1 100644 --- a/application/src/main/data/json/system/scada_symbols/large-stand-cylindrical-tank.svg +++ b/application/src/main/data/json/system/scada_symbols/large-stand-cylindrical-tank.svg @@ -565,7 +565,7 @@ 1660 gal - + diff --git a/application/src/main/data/json/system/scada_symbols/large-stand-vertical-tank.svg b/application/src/main/data/json/system/scada_symbols/large-stand-vertical-tank.svg index d9c05bde40..be8b1207a0 100644 --- a/application/src/main/data/json/system/scada_symbols/large-stand-vertical-tank.svg +++ b/application/src/main/data/json/system/scada_symbols/large-stand-vertical-tank.svg @@ -569,7 +569,7 @@ 1660 gal - + diff --git a/application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg b/application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg index 99ff420530..1951b741bf 100644 --- a/application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/large-vertical-separator-hp.svg @@ -336,7 +336,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/leak-sensor.svg b/application/src/main/data/json/system/scada_symbols/leak-sensor.svg index 0fce8be608..813116a1f5 100644 --- a/application/src/main/data/json/system/scada_symbols/leak-sensor.svg +++ b/application/src/main/data/json/system/scada_symbols/leak-sensor.svg @@ -135,7 +135,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/low-voltage-tower-hp.svg b/application/src/main/data/json/system/scada_symbols/low-voltage-tower-hp.svg index 812e616433..002bd9cfae 100644 --- a/application/src/main/data/json/system/scada_symbols/low-voltage-tower-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/low-voltage-tower-hp.svg @@ -264,7 +264,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/meter.svg b/application/src/main/data/json/system/scada_symbols/meter.svg index 02b2833133..d5fa9f7cd7 100644 --- a/application/src/main/data/json/system/scada_symbols/meter.svg +++ b/application/src/main/data/json/system/scada_symbols/meter.svg @@ -713,7 +713,7 @@ 37% - + diff --git a/application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg b/application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg index e7dfa8f0c8..b1ff6ea2c0 100644 --- a/application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/oil-pump-hp.svg @@ -343,7 +343,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/pool-hp.svg b/application/src/main/data/json/system/scada_symbols/pool-hp.svg index 925ea8906a..0ce78af7d9 100644 --- a/application/src/main/data/json/system/scada_symbols/pool-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/pool-hp.svg @@ -501,7 +501,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/pool.svg b/application/src/main/data/json/system/scada_symbols/pool.svg index f5d0bd7ad7..6f8b12737c 100644 --- a/application/src/main/data/json/system/scada_symbols/pool.svg +++ b/application/src/main/data/json/system/scada_symbols/pool.svg @@ -292,7 +292,7 @@ 1660 gal - + diff --git a/application/src/main/data/json/system/scada_symbols/power-socket-hp.svg b/application/src/main/data/json/system/scada_symbols/power-socket-hp.svg index 5524b3bb14..2331242475 100644 --- a/application/src/main/data/json/system/scada_symbols/power-socket-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/power-socket-hp.svg @@ -357,7 +357,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/short-vertical-tank-hp.svg b/application/src/main/data/json/system/scada_symbols/short-vertical-tank-hp.svg index 046c5c5802..cd15a16577 100644 --- a/application/src/main/data/json/system/scada_symbols/short-vertical-tank-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/short-vertical-tank-hp.svg @@ -502,7 +502,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/simple-horizontal-scale-hp.svg b/application/src/main/data/json/system/scada_symbols/simple-horizontal-scale-hp.svg index 26cee5cd30..1b91a0cd4a 100644 --- a/application/src/main/data/json/system/scada_symbols/simple-horizontal-scale-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/simple-horizontal-scale-hp.svg @@ -719,5 +719,5 @@ - + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg b/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg index fa0c0fc4d1..7b8e7299b8 100644 --- a/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/simple-vertical-scale-hp.svg @@ -719,5 +719,5 @@ 26 - + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/small-cylindrical-tank.svg b/application/src/main/data/json/system/scada_symbols/small-cylindrical-tank.svg index d4ddda1895..1d6785d0c1 100644 --- a/application/src/main/data/json/system/scada_symbols/small-cylindrical-tank.svg +++ b/application/src/main/data/json/system/scada_symbols/small-cylindrical-tank.svg @@ -537,7 +537,7 @@ 1660 gal - + diff --git a/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg index dedc4dc81e..abb6d9b4ab 100644 --- a/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/small-horizontal-separator-connector-hp.svg @@ -328,7 +328,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/small-left-meter.svg b/application/src/main/data/json/system/scada_symbols/small-left-meter.svg index a480412366..129006ffd7 100644 --- a/application/src/main/data/json/system/scada_symbols/small-left-meter.svg +++ b/application/src/main/data/json/system/scada_symbols/small-left-meter.svg @@ -713,5 +713,5 @@ 37% - + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg index b248996612..e9cc074cb6 100644 --- a/application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-connector-hp.svg @@ -328,7 +328,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg index 25aec080b3..0c7455e534 100644 --- a/application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/small-vertical-separator-hp.svg @@ -328,7 +328,7 @@ } ] }]]> - + diff --git a/application/src/main/data/json/system/scada_symbols/spherical-tank.svg b/application/src/main/data/json/system/scada_symbols/spherical-tank.svg index cba49c63e0..f5d679fa96 100644 --- a/application/src/main/data/json/system/scada_symbols/spherical-tank.svg +++ b/application/src/main/data/json/system/scada_symbols/spherical-tank.svg @@ -572,7 +572,7 @@ 1660 gal - + diff --git a/application/src/main/data/json/system/scada_symbols/stand-cylindrical-tank.svg b/application/src/main/data/json/system/scada_symbols/stand-cylindrical-tank.svg index a78060dfaf..f5b8e8a892 100644 --- a/application/src/main/data/json/system/scada_symbols/stand-cylindrical-tank.svg +++ b/application/src/main/data/json/system/scada_symbols/stand-cylindrical-tank.svg @@ -567,7 +567,7 @@ 1660 gal - + diff --git a/application/src/main/data/json/system/scada_symbols/stand-vertical-short-tank.svg b/application/src/main/data/json/system/scada_symbols/stand-vertical-short-tank.svg index 96df175589..0d56901bfe 100644 --- a/application/src/main/data/json/system/scada_symbols/stand-vertical-short-tank.svg +++ b/application/src/main/data/json/system/scada_symbols/stand-vertical-short-tank.svg @@ -1364,5 +1364,5 @@ - + \ No newline at end of file diff --git a/application/src/main/data/json/system/scada_symbols/top-light-bulb-hp.svg b/application/src/main/data/json/system/scada_symbols/top-light-bulb-hp.svg index ed6855884a..fb419bac2a 100644 --- a/application/src/main/data/json/system/scada_symbols/top-light-bulb-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/top-light-bulb-hp.svg @@ -332,7 +332,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/turbine-hp.svg b/application/src/main/data/json/system/scada_symbols/turbine-hp.svg index d798b09477..2e0e176cfd 100644 --- a/application/src/main/data/json/system/scada_symbols/turbine-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/turbine-hp.svg @@ -363,7 +363,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/vertical-energy-system-controller-hp.svg b/application/src/main/data/json/system/scada_symbols/vertical-energy-system-controller-hp.svg index cebe949c36..6da68556a2 100644 --- a/application/src/main/data/json/system/scada_symbols/vertical-energy-system-controller-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/vertical-energy-system-controller-hp.svg @@ -364,7 +364,7 @@ } ] }]]> -Connected +Connected diff --git a/application/src/main/data/json/system/scada_symbols/vertical-tank-hp.svg b/application/src/main/data/json/system/scada_symbols/vertical-tank-hp.svg index 491fb4477e..9dee6cc2af 100644 --- a/application/src/main/data/json/system/scada_symbols/vertical-tank-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/vertical-tank-hp.svg @@ -502,7 +502,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/voltage-stabilizer-hp.svg b/application/src/main/data/json/system/scada_symbols/voltage-stabilizer-hp.svg index aafc2af5a0..2ccad581d4 100644 --- a/application/src/main/data/json/system/scada_symbols/voltage-stabilizer-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/voltage-stabilizer-hp.svg @@ -570,7 +570,7 @@ } ] }]]> -220230inout +220230inout diff --git a/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg b/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg index 74855dd35a..dc8af28f59 100644 --- a/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg @@ -356,7 +356,7 @@ - + diff --git a/application/src/main/data/json/system/scada_symbols/wind-turbine-hp.svg b/application/src/main/data/json/system/scada_symbols/wind-turbine-hp.svg index a4282c16e7..b2c65988da 100644 --- a/application/src/main/data/json/system/scada_symbols/wind-turbine-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/wind-turbine-hp.svg @@ -346,7 +346,7 @@ - + From 4d18579daf06fe50c2a1636de71ac91ba547164f Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 24 Mar 2025 11:11:14 +0200 Subject: [PATCH 072/286] UI: Add new help place map item; improved map hint and additionalParams map description --- ...custom-action-pretty-editor.component.html | 4 +- .../custom-action-pretty-editor.component.ts | 40 ++++---- ...ction-pretty-resources-tabs.component.html | 2 +- ...-action-pretty-resources-tabs.component.ts | 18 ++-- .../action/widget-action.component.html | 3 +- .../entity/entity-type-select.component.ts | 25 +---- .../widget/action/custom_additional_params.md | 16 +--- .../place_map_item/create_dialog_html.md | 87 +++++++++++++++++ .../action/place_map_item/create_dialog_js.md | 94 +++++++++++++++++++ .../place_map_item/place_map_item_action.md | 66 +++++++++++++ .../assets/locale/locale.constant-en_US.json | 2 +- 11 files changed, 288 insertions(+), 69 deletions(-) create mode 100644 ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_html.md create mode 100644 ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_js.md create mode 100644 ui-ngx/src/assets/help/en_US/widget/action/place_map_item/place_map_item_action.md diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html index 0d53bc6c44..abcc4ad7af 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html @@ -37,6 +37,7 @@
    @@ -44,6 +45,7 @@
    @@ -58,7 +60,7 @@ [validationArgs]="[]" [editorCompleter]="customPrettyActionEditorCompleter" functionTitle="{{ 'widget-action.custom-pretty-function' | translate }}" - helpId="widget/action/custom_pretty_action_fn"> + [helpId]="helpId">
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.ts index 2e177eb918..77f835a668 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.ts @@ -14,28 +14,22 @@ /// limitations under the License. /// -// eslint-disable-next-line @typescript-eslint/triple-slash-reference -/// - import { AfterViewInit, Component, ElementRef, forwardRef, Input, - OnDestroy, - OnInit, QueryList, ViewChildren, ViewEncapsulation } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; -import { PageComponent } from '@shared/components/page.component'; -import { Store } from '@ngrx/store'; -import { AppState } from '@core/core.state'; import { combineLatest } from 'rxjs'; -import { CustomActionDescriptor } from '@shared/models/widget.models'; -import { CustomPrettyActionEditorCompleter } from '@home/components/widget/lib/settings/common/action/custom-action.models'; +import { CustomActionDescriptor, WidgetActionType } from '@shared/models/widget.models'; +import { + CustomPrettyActionEditorCompleter +} from '@home/components/widget/lib/settings/common/action/custom-action.models'; @Component({ selector: 'tb-custom-action-pretty-editor', @@ -50,7 +44,7 @@ import { CustomPrettyActionEditorCompleter } from '@home/components/widget/lib/s ], encapsulation: ViewEncapsulation.None }) -export class CustomActionPrettyEditorComponent extends PageComponent implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor { +export class CustomActionPrettyEditorComponent implements AfterViewInit, ControlValueAccessor { @Input() disabled: boolean; @@ -58,6 +52,17 @@ export class CustomActionPrettyEditorComponent extends PageComponent implements fullscreen = false; + helpId= 'widget/action/custom_pretty_action_fn'; + + @Input() + set widgetActionType(type: WidgetActionType) { + if (type === WidgetActionType.placeMapItem) { + this.helpId = 'widget/action/place_map_item/place_map_item_action'; + } else { + this.helpId = 'widget/action/custom_pretty_action_fn'; + } + } + @ViewChildren('leftPanel') leftPanelElmRef: QueryList>; @@ -68,15 +73,11 @@ export class CustomActionPrettyEditorComponent extends PageComponent implements private propagateChange = (_: any) => {}; - constructor(protected store: Store) { - super(store); - } - - ngOnInit(): void { + constructor() { } ngAfterViewInit(): void { - combineLatest(this.leftPanelElmRef.changes, this.rightPanelElmRef.changes).subscribe(() => { + combineLatest([this.leftPanelElmRef.changes, this.rightPanelElmRef.changes]).subscribe(() => { if (this.leftPanelElmRef.length && this.rightPanelElmRef.length) { this.initSplitLayout(this.leftPanelElmRef.first.nativeElement, this.rightPanelElmRef.first.nativeElement); @@ -92,14 +93,11 @@ export class CustomActionPrettyEditorComponent extends PageComponent implements }); } - ngOnDestroy(): void { - } - registerOnChange(fn: any): void { this.propagateChange = fn; } - registerOnTouched(fn: any): void { + registerOnTouched(_fn: any): void { } setDisabledState(isDisabled: boolean): void { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html index 9f351345c1..0852e7cc0d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html @@ -101,7 +101,7 @@ [validationArgs]="[]" [editorCompleter]="customPrettyActionEditorCompleter" functionTitle="{{ 'widget-action.custom-pretty-function' | translate }}" - helpId="widget/action/custom_pretty_action_fn"> + [helpId]="helpId"> diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.ts index 5c65e23b58..367f90d160 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.ts @@ -27,16 +27,15 @@ import { ViewChild, ViewEncapsulation } from '@angular/core'; -import { TranslateService } from '@ngx-translate/core'; import { PageComponent } from '@shared/components/page.component'; -import { Store } from '@ngrx/store'; -import { AppState } from '@core/core.state'; import { CustomActionDescriptor } from '@shared/models/widget.models'; import { Ace } from 'ace-builds'; import { CancelAnimationFrame, RafService } from '@core/services/raf.service'; -import { CustomPrettyActionEditorCompleter } from '@home/components/widget/lib/settings/common/action/custom-action.models'; +import { + CustomPrettyActionEditorCompleter +} from '@home/components/widget/lib/settings/common/action/custom-action.models'; import { Observable } from 'rxjs/internal/Observable'; -import { forkJoin, from } from 'rxjs'; +import { forkJoin } from 'rxjs'; import { map, tap } from 'rxjs/operators'; import { getAce } from '@shared/models/ace/ace.models'; import { beautifyCss, beautifyHtml } from '@shared/models/beautify.models'; @@ -55,6 +54,9 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl @Input() hasCustomFunction: boolean; + @Input() + helpId: string; + @Output() actionUpdated: EventEmitter = new EventEmitter(); @@ -76,10 +78,8 @@ export class CustomActionPrettyResourcesTabsComponent extends PageComponent impl customPrettyActionEditorCompleter = CustomPrettyActionEditorCompleter; - constructor(protected store: Store, - private translate: TranslateService, - private raf: RafService) { - super(store); + constructor(private raf: RafService) { + super(); } ngOnInit(): void { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html index ca2405b8b4..c4c90067dd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html @@ -274,7 +274,8 @@ || widgetActionFormGroup.get('type').value === widgetActionType.placeMapItem ? widgetActionFormGroup.get('type').value : ''"> + [widgetActionType]="widgetActionFormGroup.get('type').value" + formControlName="customAction"> diff --git a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts index 82b3fcf572..ce599a0c08 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-type-select.component.ts @@ -14,19 +14,8 @@ /// limitations under the License. /// -import { - AfterViewInit, - Component, - DestroyRef, - forwardRef, - Input, - OnChanges, - OnInit, - SimpleChanges -} from '@angular/core'; +import { Component, DestroyRef, forwardRef, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; -import { Store } from '@ngrx/store'; -import { AppState } from '@app/core/core.state'; import { TranslateService } from '@ngx-translate/core'; import { AliasEntityType, EntityType, entityTypeTranslations } from '@app/shared/models/entity-type.models'; import { EntityService } from '@core/http/entity.service'; @@ -44,7 +33,7 @@ import { MatFormFieldAppearance } from '@angular/material/form-field'; multi: true }] }) -export class EntityTypeSelectComponent implements ControlValueAccessor, OnInit, AfterViewInit, OnChanges { +export class EntityTypeSelectComponent implements ControlValueAccessor, OnInit, OnChanges { entityTypeFormGroup: UntypedFormGroup; @@ -71,17 +60,16 @@ export class EntityTypeSelectComponent implements ControlValueAccessor, OnInit, disabled: boolean; @Input() - appearance: MatFormFieldAppearance = 'fill'; + additionEntityTypes: {[key in string]: string} = {}; @Input() - additionEntityTypes: {[key in string]: string} = {}; + appearance: MatFormFieldAppearance = 'fill'; entityTypes: Array; private propagateChange = (v: any) => { }; - constructor(private store: Store, - private entityService: EntityService, + constructor(private entityService: EntityService, public translate: TranslateService, private fb: UntypedFormBuilder, private destroyRef: DestroyRef) { @@ -140,9 +128,6 @@ export class EntityTypeSelectComponent implements ControlValueAccessor, OnInit, } } - ngAfterViewInit(): void { - } - setDisabledState(isDisabled: boolean): void { this.disabled = isDisabled; if (this.disabled) { diff --git a/ui-ngx/src/assets/help/en_US/widget/action/custom_additional_params.md b/ui-ngx/src/assets/help/en_US/widget/action/custom_additional_params.md index 35e5992b9f..704e25b7f1 100644 --- a/ui-ngx/src/assets/help/en_US/widget/action/custom_additional_params.md +++ b/ui-ngx/src/assets/help/en_US/widget/action/custom_additional_params.md @@ -32,27 +32,13 @@ An optional key/value object holding additional entity parameters depending on w -
  • Map widgets - additionalParams: FormattedData: +
  • Map widgets (On marker/polygon/circle click or Tag action) - additionalParams: FormattedData:
    • additionalParams: FormattedData - An object associated with a data layer (markers, polygons, circles) or with a specific data point of a route (for trips data layers).
      It contains basic entity properties (ex. entityId, entityName) and provides access to additional attributes and timeseries defined in datasource of the data layer configuration.
  • -
  • Map widgets (Action type: Place map item) - additionalParams: {coordinates: Coordinates; layer: L.Layer}: -
      -
    • coordinates: Coordinates - Represents geographical coordinates of the placed map item. The actual format of this parameter depends on the type of the selected map item: -
        -
      • Marker: {x: number; y: number}, where x represents latitude, and y represents longitude.
      • -
      • Polygon, Rectangle: TbPolygonRawCoordinates contains an array of points defining the shape boundaries.
      • -
      • Circle: TbCircleData contains center coordinates and radius information.
      • -
      - Note: The coordinates will be automatically converted according to the selected map type. -
    • -
    • layer: L.Layer - The Leaflet map layer instance (e.g., marker, polygon, circle) associated with the placed map item. This object provides access to layer properties and methods defined in Leaflet's API. -
    • -
    -
  • Entities hierarchy widget (On node selected) - additionalParams: { nodeCtx: HierarchyNodeContext }:
    • nodeCtx: HierarchyNodeContext - An diff --git a/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_html.md b/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_html.md new file mode 100644 index 0000000000..c3a58747e8 --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_html.md @@ -0,0 +1,87 @@ +#### HTML template of dialog to create a device or an asset + +```html +{:code-style="max-height: 400px;"} +
      + +

      Add entity

      + + +
      + + +
      +
      +
      + + Entity Name + + + Entity name is required. + + + + Entity Label + + +
      +
      + + + +
      +
      +
      + + Address + + + + Owner + + +
      +
      +
      +
      + + +
      +
      +{:copy-code} +``` + +
      +
      diff --git a/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_js.md b/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_js.md new file mode 100644 index 0000000000..bc8823c777 --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/create_dialog_js.md @@ -0,0 +1,94 @@ +#### Function displaying dialog to create a device or an asset + +```javascript +{:code-style="max-height: 400px;"} +let $injector = widgetContext.$scope.$injector; +let customDialog = $injector.get(widgetContext.servicesMap.get('customDialog')); +let assetService = $injector.get(widgetContext.servicesMap.get('assetService')); +let deviceService = $injector.get(widgetContext.servicesMap.get('deviceService')); +let attributeService = $injector.get(widgetContext.servicesMap.get('attributeService')); + +openAddEntityDialog(); + +function openAddEntityDialog() { + customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe(); +} + +function AddEntityDialogController(instance) { + let vm = instance; + + vm.allowedEntityTypes = ['ASSET', 'DEVICE']; + + vm.addEntityFormGroup = vm.fb.group({ + entityName: ['', [vm.validators.required]], + entityType: ['DEVICE'], + entityLabel: [null], + type: ['', [vm.validators.required]], + attributes: vm.fb.group({ + address: [null], + owner: [null] + }) + }); + + vm.cancel = function() { + vm.dialogRef.close(null); + }; + + vm.save = function() { + vm.addEntityFormGroup.markAsPristine(); + saveEntityObservable().pipe( + widgetContext.rxjs.switchMap((entity) => saveAttributes(entity.id)) + ).subscribe(() => { + widgetContext.updateAliases(); + vm.dialogRef.close(null); + }); + }; + + function saveEntityObservable() { + const formValues = vm.addEntityFormGroup.value; + let entity = { + name: formValues.entityName, + type: formValues.type, + label: formValues.entityLabel + }; + if (formValues.entityType == 'ASSET') { + return assetService.saveAsset(entity); + } else if (formValues.entityType == 'DEVICE') { + return deviceService.saveDevice(entity); + } + } + + function saveAttributes(entityId) { + let attributes = vm.addEntityFormGroup.get('attributes').value; + let attributesArray = getMapItemLocationAttributes(); + for (let key in attributes) { + if(attributes[key] !== null) { + attributesArray.push({key: key, value: attributes[key]}); + } + } + if (attributesArray.length > 0) { + return attributeService.saveEntityAttributes(entityId, "SERVER_SCOPE", attributesArray); + } + return widgetContext.rxjs.of([]); + } + + function getMapItemLocationAttributes() { + const attributes = []; + const mapItemType = $event.shape; + if (mapItemType === 'Marker') { + const mapType = widgetContext.mapInstance.type(); + attributes.push({key: mapType === 'image' ? 'xPos' : 'latitude', value: additionalParams.coordinates.x}); + attributes.push({key: mapType === 'image' ? 'yPos' : 'longitude', value: additionalParams.coordinates.y}); + } else if (mapItemType === 'Rectangle' || mapItemType === 'Polygon') { + attributes.push({key: 'perimeter', value: additionalParams.coordinates}); + } else if (mapItemType === 'Circle') { + attributes.push({key: 'circle', value: additionalParams.coordinates}); + } + return attributes; + } +} +{:copy-code} +``` + +
      +
      diff --git a/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/place_map_item_action.md b/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/place_map_item_action.md new file mode 100644 index 0000000000..131a674099 --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/action/place_map_item/place_map_item_action.md @@ -0,0 +1,66 @@ +#### Place map item function + +
      +
      + +*function ($event, widgetContext, entityId, entityName, htmlTemplate, additionalParams, entityLabel): void* + +A JavaScript function triggered after a map item is placed. Optionally uses an HTML template to render dialog. + +**Parameters:** + +
        +
      • $event: {shape: PM.SUPPORTED_SHAPES; layer: L.Layer} - Event payload containing the created shape type and its associated map layer. +
      • +
      • widgetContext: WidgetContext - A reference to WidgetContext that has all necessary API + and data used by widget instance. +
      • +
      • entityId: string - An optional string id of the target entity. +
      • +
      • entityName: string - An optional string name of the target entity. +
      • +
      • htmlTemplate: string - An optional HTML template string defined in HTML tab.
        Used to render custom dialog (see Examples for more details). +
      • +
      • additionalParams: {coordinates: Coordinates; layer: L.Layer}: +
          +
        • coordinates: Coordinates - Represents geographical coordinates of the placed map item. The actual format of this parameter depends on the type of the selected map item: +
            +
          • Marker: {x: number; y: number}, where x represents latitude, and y represents longitude.
          • +
          • Polygon, Rectangle: TbPolygonRawCoordinates contains an array of points defining the shape boundaries.
          • +
          • Circle: TbCircleData contains center coordinates and radius information.
          • +
          + Note: The coordinates will be automatically converted according to the selected map type. +
        • +
        • layer: L.Layer - The Leaflet map layer instance (e.g., marker, polygon, circle) associated with the placed map item. This object provides access to layer properties and methods defined in Leaflet's API. +
        • +
        +
      • +
      • entityLabel: string - An optional string label of the target entity. +
      • +
      + +
      + +##### Examples + +###### Display dialog to create a device or an asset + +
      + +
      +
      + +
      + +
      +
      diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index c294b0210a..9cb2070cd2 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -7995,7 +7995,7 @@ "on-click": "On click", "on-click-hint": "Action invoked when user clicks on the map item.", "groups": "Groups", - "groups-hint": "List of group names assigned to this datasource. Used to toggle visibility of datasource items on the map.", + "groups-hint": "List of group names assigned to the overlay, used to toggle its visibility on the map.", "color": "Color", "fill-color": "Fill color", "stroke": "Stroke", From 55e6cddb9faef21c116d713355bd97aa1758a771 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Mon, 24 Mar 2025 11:32:45 +0200 Subject: [PATCH 073/286] fixed timeouts when linked telemetry list is empty --- .../CalculatedFieldManagerMessageProcessor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index 0990365748..bf441f1a35 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -367,6 +367,10 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware log.debug("Received linked telemetry msg from entity [{}]", sourceEntityId); var proto = msg.getProto(); var linksList = proto.getLinksList(); + if (linksList.isEmpty()) { + log.debug("[{}] No new linked telemetry to process for CF.", msg.getTenantId()); + msg.getCallback().onSuccess(); + } for (var linkProto : linksList) { var link = fromProto(linkProto); var targetEntityId = link.entityId(); From 3f089da378ec5debdf44d3f777222aac56415f5e Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Mon, 24 Mar 2025 11:57:46 +0200 Subject: [PATCH 074/286] Fix tbCalculatedFieldNotificationsTopic --- .../org/thingsboard/server/queue/discovery/TopicService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java index 5992083d85..cfd796e361 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java @@ -47,7 +47,7 @@ public class TopicService { @Value("${queue.edge.event-notifications-topic:tb_edge_event.notifications}") private String tbEdgeEventNotificationsTopic; - @Value("${queue.calculated_fields.notifications-topic:calculated_field.notifications}") + @Value("${queue.calculated-fields.notifications-topic:calculated_field.notifications}") private String tbCalculatedFieldNotificationsTopic; private final ConcurrentMap tbCoreNotificationTopics = new ConcurrentHashMap<>(); From 5ecbae229a378b828d58e37b590546cd2c56c612 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Mon, 24 Mar 2025 12:03:14 +0200 Subject: [PATCH 075/286] updated log msg --- .../calculatedField/CalculatedFieldManagerMessageProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index bf441f1a35..e109e83e4d 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -368,7 +368,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware var proto = msg.getProto(); var linksList = proto.getLinksList(); if (linksList.isEmpty()) { - log.debug("[{}] No new linked telemetry to process for CF.", msg.getTenantId()); + log.debug("[{}] No CF links to process new telemetry.", msg.getTenantId()); msg.getCallback().onSuccess(); } for (var linkProto : linksList) { From 64b85e67715a59ecd7f1b3e1fa3f35cd2c9e9800 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Mon, 24 Mar 2025 12:32:17 +0200 Subject: [PATCH 076/286] fix for calback when ctx is not initialized --- .../calculatedField/CalculatedFieldEntityMessageProcessor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java index 4e15dba120..93214e4403 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java @@ -302,6 +302,8 @@ public class CalculatedFieldEntityMessageProcessor extends AbstractContextAwareM systemContext.persistCalculatedFieldDebugEvent(tenantId, ctx.getCfId(), entityId, state.getArguments(), tbMsgId, tbMsgType, JacksonUtil.writeValueAsString(calculationResult.getResult()), null); } } + } else { + callback.onSuccess(); } } catch (Exception e) { throw CalculatedFieldException.builder().ctx(ctx).eventEntity(entityId).msgId(tbMsgId).msgType(tbMsgType).arguments(state.getArguments()).cause(e).build(); From 9d25db32c68a58dc331524989750af002419104a Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Mon, 24 Mar 2025 15:33:03 +0100 Subject: [PATCH 077/286] Refactored initialization chain, PartitionChangeEvent should be processed after actors startup --- ...faultTbCalculatedFieldConsumerService.java | 18 ++-- .../DefaultTbRuleEngineConsumerService.java | 17 ++-- .../AbstractConsumerPartitionedService.java | 94 +++++++++++++++++++ 3 files changed, 114 insertions(+), 15 deletions(-) create mode 100644 application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerPartitionedService.java diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index 9ae06309c3..bce1992932 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -15,7 +15,6 @@ */ package org.thingsboard.server.service.queue; -import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -55,7 +54,7 @@ import org.thingsboard.server.service.cf.CalculatedFieldCache; import org.thingsboard.server.service.cf.CalculatedFieldStateService; import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; -import org.thingsboard.server.service.queue.processing.AbstractConsumerService; +import org.thingsboard.server.service.queue.processing.AbstractConsumerPartitionedService; import org.thingsboard.server.service.queue.processing.IdMsgPair; import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService; @@ -72,7 +71,7 @@ import java.util.stream.Collectors; @Service @TbRuleEngineComponent @Slf4j -public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerService implements TbCalculatedFieldConsumerService { +public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPartitionedService implements TbCalculatedFieldConsumerService { @Value("${queue.calculated_fields.poll_interval:25}") private long pollInterval; @@ -99,10 +98,8 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerSer this.stateService = stateService; } - @PostConstruct - public void init() { - super.init("tb-cf"); - + @Override + protected void doAfterStartUp() { var queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME); PartitionedQueueConsumerManager> eventConsumer = PartitionedQueueConsumerManager.>create() .queueKey(queueKey) @@ -129,7 +126,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerSer } @Override - protected void onTbApplicationEvent(PartitionChangeEvent event) { + protected void processPartitionChangeEvent(PartitionChangeEvent event) { try { event.getNewPartitions().forEach((queueKey, partitions) -> { if (queueKey.getQueueName().equals(DataConstants.CF_QUEUE_NAME)) { @@ -146,6 +143,11 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerSer } } + @Override + protected String getPrefix() { + return "tb-cf"; + } + private void processMsgs(List> msgs, TbQueueConsumer> consumer, QueueConfig config) throws Exception { List> orderedMsgList = msgs.stream().map(msg -> new IdMsgPair<>(UUID.randomUUID(), msg)).toList(); ConcurrentMap> pendingMap = orderedMsgList.stream().collect( diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java index 9cc743e510..3a9be3874a 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java @@ -15,7 +15,6 @@ */ package org.thingsboard.server.service.queue; -import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.event.EventListener; @@ -50,7 +49,7 @@ import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.cf.CalculatedFieldCache; import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; -import org.thingsboard.server.service.queue.processing.AbstractConsumerService; +import org.thingsboard.server.service.queue.processing.AbstractConsumerPartitionedService; import org.thingsboard.server.service.queue.ruleengine.TbRuleEngineConsumerContext; import org.thingsboard.server.service.queue.ruleengine.TbRuleEngineQueueConsumerManager; import org.thingsboard.server.service.rpc.TbRuleEngineDeviceRpcService; @@ -67,7 +66,7 @@ import java.util.stream.Collectors; @Service @TbRuleEngineComponent @Slf4j -public class DefaultTbRuleEngineConsumerService extends AbstractConsumerService implements TbRuleEngineConsumerService { +public class DefaultTbRuleEngineConsumerService extends AbstractConsumerPartitionedService implements TbRuleEngineConsumerService { private final TbRuleEngineConsumerContext ctx; private final QueueService queueService; @@ -93,9 +92,8 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerService< this.queueService = queueService; } - @PostConstruct - public void init() { - super.init("tb-rule-engine"); + @Override + protected void doAfterStartUp() { List queues = queueService.findAllQueues(); for (Queue configuration : queues) { if (partitionService.isManagedByCurrentService(configuration.getTenantId())) { @@ -106,7 +104,7 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerService< } @Override - protected void onTbApplicationEvent(PartitionChangeEvent event) { + protected void processPartitionChangeEvent(PartitionChangeEvent event) { event.getNewPartitions().forEach((queueKey, partitions) -> { if (DataConstants.CF_QUEUE_NAME.equals(queueKey.getQueueName()) || DataConstants.CF_STATES_QUEUE_NAME.equals(queueKey.getQueueName())) { return; @@ -138,6 +136,11 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerService< }); } + @Override + protected String getPrefix() { + return "tb-rule-engine"; + } + @Override protected void stopConsumers() { super.stopConsumers(); diff --git a/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerPartitionedService.java b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerPartitionedService.java new file mode 100644 index 0000000000..94b5390be1 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerPartitionedService.java @@ -0,0 +1,94 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.queue.processing; + +import jakarta.annotation.PostConstruct; +import org.springframework.context.ApplicationEventPublisher; +import org.thingsboard.server.actors.ActorSystemContext; +import org.thingsboard.server.dao.tenant.TbTenantProfileCache; +import org.thingsboard.server.queue.discovery.PartitionService; +import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; +import org.thingsboard.server.queue.util.AfterStartUp; +import org.thingsboard.server.service.apiusage.TbApiUsageStateService; +import org.thingsboard.server.service.cf.CalculatedFieldCache; +import org.thingsboard.server.service.profile.TbAssetProfileCache; +import org.thingsboard.server.service.profile.TbDeviceProfileCache; +import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService; + +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +public abstract class AbstractConsumerPartitionedService extends AbstractConsumerService { + + private final Lock startupLock; + private volatile boolean consumersInitialized; + private PartitionChangeEvent lastPartitionChangeEvent; + + public AbstractConsumerPartitionedService(ActorSystemContext actorContext, + TbTenantProfileCache tenantProfileCache, + TbDeviceProfileCache deviceProfileCache, + TbAssetProfileCache assetProfileCache, + CalculatedFieldCache calculatedFieldCache, + TbApiUsageStateService apiUsageStateService, + PartitionService partitionService, + ApplicationEventPublisher eventPublisher, + JwtSettingsService jwtSettingsService) { + super(actorContext, tenantProfileCache, deviceProfileCache, assetProfileCache, calculatedFieldCache, apiUsageStateService, partitionService, eventPublisher, jwtSettingsService); + this.startupLock = new ReentrantLock(); + this.consumersInitialized = false; + } + + @PostConstruct + public void init() { + super.init(getPrefix()); + } + + @AfterStartUp(order = AfterStartUp.REGULAR_SERVICE) + public void afterStartUp() { + super.afterStartUp(); + doAfterStartUp(); + startupLock.lock(); + try { + processPartitionChangeEvent(lastPartitionChangeEvent); + consumersInitialized = true; + } finally { + startupLock.unlock(); + } + } + + @Override + protected void onTbApplicationEvent(PartitionChangeEvent event) { + if (!consumersInitialized) { + startupLock.lock(); + try { + if (!consumersInitialized) { + lastPartitionChangeEvent = event; + return; + } + } finally { + startupLock.unlock(); + } + } + processPartitionChangeEvent(event); + } + + protected abstract void doAfterStartUp(); + + protected abstract void processPartitionChangeEvent(PartitionChangeEvent event); + + protected abstract String getPrefix(); + +} From a5404c2b4576021a2b5b061347216256a2b23188 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Mon, 24 Mar 2025 17:26:01 +0200 Subject: [PATCH 078/286] EDQS: don't use consumer group management for state topics; single consumer group for requests topic; reduce events topic retention to 24 hours --- .../src/main/resources/thingsboard.yml | 2 +- .../edqs/state/KafkaEdqsStateService.java | 4 +-- .../server/queue/discovery/TopicService.java | 9 ++++-- .../queue/discovery/ZkDiscoveryService.java | 2 +- .../queue/edqs/KafkaEdqsQueueFactory.java | 3 +- .../server/queue/kafka/TbKafkaAdmin.java | 2 ++ .../queue/kafka/TbKafkaConsumerTemplate.java | 28 ++++++++++++------- edqs/src/main/resources/edqs.yml | 2 +- 8 files changed, 31 insertions(+), 21 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index eac787d52b..7737f9d027 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1646,7 +1646,7 @@ queue: # Kafka properties for Calculated Field State topics calculated-field-state: "${TB_QUEUE_KAFKA_CF_STATE_TOPIC_PROPERTIES:retention.ms:-1;segment.bytes:52428800;retention.bytes:104857600000;partitions:1;min.insync.replicas:1;cleanup.policy:compact}" # Kafka properties for EDQS events topics - edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1}" + edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:86400000;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1}" # Kafka properties for EDQS requests topic (default: 3 minutes retention) edqs-requests: "${TB_QUEUE_KAFKA_EDQS_REQUESTS_TOPIC_PROPERTIES:retention.ms:180000;segment.bytes:52428800;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" # Kafka properties for EDQS state topic (infinite retention, compaction) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java index c59707c9c3..21515f1ad8 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java @@ -36,7 +36,6 @@ import org.thingsboard.server.queue.common.consumer.QueueConsumerManager; import org.thingsboard.server.queue.common.state.KafkaQueueStateService; import org.thingsboard.server.queue.common.state.QueueStateService; import org.thingsboard.server.queue.discovery.QueueKey; -import org.thingsboard.server.queue.discovery.TopicService; import org.thingsboard.server.queue.edqs.EdqsConfig; import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.edqs.EdqsQueueFactory; @@ -57,7 +56,6 @@ public class KafkaEdqsStateService implements EdqsStateService { private final EdqsConfig config; private final EdqsPartitionService partitionService; private final EdqsQueueFactory queueFactory; - private final TopicService topicService; @Autowired @Lazy private EdqsProcessor edqsProcessor; @@ -91,7 +89,7 @@ public class KafkaEdqsStateService implements EdqsStateService { } consumer.commit(); }) - .consumerCreator((config, partitionId) -> queueFactory.createEdqsMsgConsumer(EdqsQueue.STATE)) + .consumerCreator((config, partitionId) -> queueFactory.createEdqsMsgConsumer(EdqsQueue.STATE, null)) // not using consumer group management .queueAdmin(queueFactory.getEdqsQueueAdmin()) .consumerExecutor(eventConsumer.getConsumerExecutor()) .taskExecutor(eventConsumer.getTaskExecutor()) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java index 5992083d85..2a0fad0643 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java @@ -103,6 +103,9 @@ public class TopicService { } public String buildTopicName(String topic) { + if (topic == null) { + return null; + } return prefix.isBlank() ? topic : prefix + "." + topic; } @@ -113,9 +116,9 @@ public class TopicService { public String buildConsumerGroupId(String servicePrefix, TenantId tenantId, String queueName, Integer partitionId) { return this.buildTopicName( servicePrefix + queueName - + (tenantId.isSysTenantId() ? "" : ("-isolated-" + tenantId)) - + "-consumer" - + suffix(partitionId)); + + (tenantId.isSysTenantId() ? "" : ("-isolated-" + tenantId)) + + "-consumer" + + suffix(partitionId)); } String suffix(Integer partitionId) { diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/ZkDiscoveryService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/ZkDiscoveryService.java index f7a4d2abf6..cf9f27ee39 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/ZkDiscoveryService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/ZkDiscoveryService.java @@ -315,7 +315,7 @@ public class ZkDiscoveryService implements DiscoveryService, PathChildrenCacheLi ScheduledFuture task = delayedTasks.remove(serviceId); if (task != null) { if (task.cancel(false)) { - log.debug("[{}] Recalculate partitions ignored. Service was restarted in time [{}].", + log.info("[{}] Recalculate partitions ignored. Service was restarted in time [{}].", serviceId, serviceTypesList); } else { log.debug("[{}] Going to recalculate partitions. Service was not restarted in time [{}]!", diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java index a322cc5434..6fdab28133 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java @@ -103,12 +103,11 @@ public class KafkaEdqsQueueFactory implements EdqsQueueFactory { @Override public TbQueueResponseTemplate, TbProtoQueueMsg> createEdqsResponseTemplate() { - String requestsConsumerGroup = "edqs-requests-consumer-group-" + edqsConfig.getLabel(); var requestConsumer = TbKafkaConsumerTemplate.>builder() .settings(kafkaSettings) .topic(topicService.buildTopicName(edqsConfig.getRequestsTopic())) .clientId("edqs-requests-consumer-" + serviceInfoProvider.getServiceId()) - .groupId(topicService.buildTopicName(requestsConsumerGroup)) + .groupId(topicService.buildTopicName("edqs-requests-consumer-group")) .decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), TransportProtos.ToEdqsMsg.parseFrom(msg.getData()), msg.getHeaders())) .admin(edqsRequestsAdmin) .statsService(consumerStatsService); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java index 3496aac76a..6835b44da7 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java @@ -15,6 +15,7 @@ */ package org.thingsboard.server.queue.kafka; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.admin.CreateTopicsResult; import org.apache.kafka.clients.admin.ListOffsetsResult; @@ -45,6 +46,7 @@ public class TbKafkaAdmin implements TbQueueAdmin { private final TbKafkaSettings settings; private final Map topicConfigs; + @Getter private final int numPartitions; private volatile Set topics; diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java index 4bd3bf0fe6..8c4ea788c6 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java @@ -40,6 +40,7 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.IntStream; /** * Created by ashvayka on 24.09.18. @@ -47,7 +48,7 @@ import java.util.stream.Collectors; @Slf4j public class TbKafkaConsumerTemplate extends AbstractTbQueueConsumerTemplate, T> { - private final TbQueueAdmin admin; + private final TbKafkaAdmin admin; private final KafkaConsumer consumer; private final TbKafkaDecoder decoder; @@ -78,7 +79,7 @@ public class TbKafkaConsumerTemplate extends AbstractTbQue statsService.registerClientGroup(groupId); } - this.admin = admin; + this.admin = (TbKafkaAdmin) admin; this.consumer = new KafkaConsumer<>(props); this.decoder = decoder; this.readFromBeginning = readFromBeginning; @@ -105,14 +106,19 @@ public class TbKafkaConsumerTemplate extends AbstractTbQue List toSubscribe = new ArrayList<>(); topics.forEach((topic, kafkaPartitions) -> { if (kafkaPartitions == null) { - toSubscribe.add(topic); - } else { - List topicPartitions = kafkaPartitions.stream() - .map(partition -> new TopicPartition(topic, partition)) - .toList(); - consumer.assign(topicPartitions); - onPartitionsAssigned(topicPartitions); + if (groupId != null) { + toSubscribe.add(topic); + return; + } else { // if no consumer group management - manually assigning all topic partitions + kafkaPartitions = IntStream.range(0, admin.getNumPartitions()).boxed().toList(); + } } + + List topicPartitions = kafkaPartitions.stream() + .map(partition -> new TopicPartition(topic, partition)) + .toList(); + consumer.assign(topicPartitions); + onPartitionsAssigned(topicPartitions); }); if (!toSubscribe.isEmpty()) { if (readFromBeginning || stopWhenRead) { @@ -195,7 +201,9 @@ public class TbKafkaConsumerTemplate extends AbstractTbQue @Override protected void doCommit() { - consumer.commitSync(); + if (groupId != null) { + consumer.commitSync(); + } } @Override diff --git a/edqs/src/main/resources/edqs.yml b/edqs/src/main/resources/edqs.yml index c101eff68e..05d942ff23 100644 --- a/edqs/src/main/resources/edqs.yml +++ b/edqs/src/main/resources/edqs.yml @@ -149,7 +149,7 @@ queue: # value: "${TB_QUEUE_KAFKA_SESSION_TIMEOUT_MS:10000}" # (10 seconds) topic-properties: # Kafka properties for EDQS events topics - edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:604800000;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1}" + edqs-events: "${TB_QUEUE_KAFKA_EDQS_EVENTS_TOPIC_PROPERTIES:retention.ms:86400000;segment.bytes:52428800;retention.bytes:-1;partitions:1;min.insync.replicas:1}" # Kafka properties for EDQS requests topic (default: 3 minutes retention) edqs-requests: "${TB_QUEUE_KAFKA_EDQS_REQUESTS_TOPIC_PROPERTIES:retention.ms:180000;segment.bytes:52428800;retention.bytes:1048576000;partitions:1;min.insync.replicas:1}" # Kafka properties for EDQS state topic (infinite retention, compaction) From df9f61c1af3b0c220c543102b3b3570f314d6a87 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 24 Mar 2025 17:15:52 +0200 Subject: [PATCH 079/286] UI: Refactoring popover service. Add single config --- .../components/color-input.component.ts | 23 ++-- .../shared/components/popover.component.ts | 10 +- .../app/shared/components/popover.models.ts | 38 ++++++ .../app/shared/components/popover.service.ts | 122 +++++++++++++----- 4 files changed, 151 insertions(+), 42 deletions(-) diff --git a/ui-ngx/src/app/shared/components/color-input.component.ts b/ui-ngx/src/app/shared/components/color-input.component.ts index 00ef7059d7..d0dc7235f7 100644 --- a/ui-ngx/src/app/shared/components/color-input.component.ts +++ b/ui-ngx/src/app/shared/components/color-input.component.ts @@ -196,14 +196,21 @@ export class ColorInputComponent extends PageComponent implements OnInit, Contro if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const colorPickerPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ColorPickerPanelComponent, ['left'], true, null, - { - color: this.colorFormGroup.get('color').value, - colorClearButton: this.colorClearButton, - colorCancelButton: true - }, - {}, {}, {}, false, () => {}, {padding: '12px 4px 12px 12px'}); + const colorPickerPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + hostView: this.viewContainerRef, + componentType: ColorPickerPanelComponent, + preferredPlacement: ['left'], + context: { + color: this.colorFormGroup.get('color').value, + colorClearButton: this.colorClearButton, + colorCancelButton: true + }, + showCloseButton: false, + popoverContentStyle: {padding: '12px 4px 12px 12px'}, + isModal: true + }) colorPickerPopover.tbComponentRef.instance.popover = colorPickerPopover; colorPickerPopover.tbComponentRef.instance.colorSelected.subscribe((color) => { colorPickerPopover.hide(); diff --git a/ui-ngx/src/app/shared/components/popover.component.ts b/ui-ngx/src/app/shared/components/popover.component.ts index 21cf4a83c5..4344b32fd7 100644 --- a/ui-ngx/src/app/shared/components/popover.component.ts +++ b/ui-ngx/src/app/shared/components/popover.component.ts @@ -311,6 +311,7 @@ export class TbPopoverDirective implements OnChanges, OnDestroy, AfterViewInit { #overlay="cdkConnectedOverlay" cdkConnectedOverlay [cdkConnectedOverlayHasBackdrop]="hasBackdrop" + [cdkConnectedOverlayBackdropClass]="backdropClass" [cdkConnectedOverlayOrigin]="origin" [cdkConnectedOverlayPositions]="positions" [cdkConnectedOverlayScrollStrategy]="scrollStrategy" @@ -382,6 +383,7 @@ export class TbPopoverComponent implements OnDestroy, OnInit { tbMouseLeaveDelay?: number; tbHideOnClickOutside = true; tbShowCloseButton = true; + tbModal = false; tbAnimationState = 'active'; @@ -461,7 +463,11 @@ export class TbPopoverComponent implements OnDestroy, OnInit { } get hasBackdrop(): boolean { - return this.tbTrigger === 'click' ? this.tbBackdrop : false; + return this.tbModal || (this.tbTrigger === 'click' && this.tbBackdrop); + } + + get backdropClass(): string { + return this.tbModal ? 'tb-popover-overlay-backdrop' : ''; } preferredPlacement: PopoverPlacement = 'top'; @@ -634,7 +640,7 @@ export class TbPopoverComponent implements OnDestroy, OnInit { } onClickOutside(event: MouseEvent): void { - if (this.tbHideOnClickOutside && !this.origin.elementRef.nativeElement.contains(event.target) && this.tbTrigger !== null) { + if (!this.tbModal && this.tbHideOnClickOutside && !this.origin.elementRef.nativeElement.contains(event.target) && this.tbTrigger !== null) { if (!this.isTopOverlay(event.target as Element)) { this.hide(); } diff --git a/ui-ngx/src/app/shared/components/popover.models.ts b/ui-ngx/src/app/shared/components/popover.models.ts index 15db9b1f93..9fb01d1f3d 100644 --- a/ui-ngx/src/app/shared/components/popover.models.ts +++ b/ui-ngx/src/app/shared/components/popover.models.ts @@ -18,6 +18,7 @@ import { animate, AnimationTriggerMetadata, style, transition, trigger } from '@ import { ConnectedOverlayPositionChange } from '@angular/cdk/overlay'; import { TbPopoverComponent } from '@shared/components/popover.component'; import { POSITION_MAP } from '@shared/models/overlay.models'; +import { ComponentRef, Injector, Renderer2, Type, ViewContainerRef } from '@angular/core'; export const popoverMotion: AnimationTriggerMetadata = trigger('popoverMotion', [ transition('void => active', [ @@ -88,3 +89,40 @@ export interface PopoverWithTrigger { trigger: Element; popoverComponent: TbPopoverComponent; } + +export interface DisplayPopoverConfig extends Omit, 'componentRef'>{ + hostView: ViewContainerRef; +} + +export interface DisplayPopoverWithComponentRefConfig { + componentRef: ComponentRef + trigger: Element; + renderer: Renderer2; + componentType: Type; + preferredPlacement?: PopoverPreferredPlacement; + hideOnClickOutside?: boolean; + injector?: Injector; + context?: any; + overlayStyle?: any; + popoverStyle?: any; + style?: any, + showCloseButton?: boolean; + visibleFn?: (visible: boolean) => void; + popoverContentStyle?: any; + isModal?: boolean; +} + +export const defaultPopoverConfig: DisplayPopoverWithComponentRefConfig = { + componentRef: undefined, + trigger: undefined, + renderer: undefined, + componentType: undefined, + preferredPlacement: 'top', + hideOnClickOutside: true, + overlayStyle: {}, + popoverStyle: {}, + showCloseButton: true, + visibleFn: () => {}, + popoverContentStyle: {}, + isModal: false +}; diff --git a/ui-ngx/src/app/shared/components/popover.service.ts b/ui-ngx/src/app/shared/components/popover.service.ts index ce1288651c..15a18fb2fc 100644 --- a/ui-ngx/src/app/shared/components/popover.service.ts +++ b/ui-ngx/src/app/shared/components/popover.service.ts @@ -24,12 +24,19 @@ import { Type, ViewContainerRef } from '@angular/core'; -import { PopoverPreferredPlacement, PopoverWithTrigger } from '@shared/components/popover.models'; +import { + defaultPopoverConfig, + DisplayPopoverConfig, + DisplayPopoverWithComponentRefConfig, + PopoverPreferredPlacement, + PopoverWithTrigger +} from '@shared/components/popover.models'; import { TbPopoverComponent } from '@shared/components/popover.component'; import { ComponentType } from '@angular/cdk/portal'; import { HELP_MARKDOWN_COMPONENT_TOKEN } from '@shared/components/tokens'; import { CdkOverlayOrigin } from '@angular/cdk/overlay'; import { Observable } from 'rxjs'; +import { mergeDeep } from '@core/utils'; @Injectable() export class TbPopoverService { @@ -58,57 +65,108 @@ export class TbPopoverService { return hostView.createComponent(TbPopoverComponent); } + displayPopover(config: DisplayPopoverConfig): TbPopoverComponent; displayPopover(trigger: Element, renderer: Renderer2, hostView: ViewContainerRef, - componentType: Type, preferredPlacement: PopoverPreferredPlacement = 'top', - hideOnClickOutside = true, injector?: Injector, context?: any, overlayStyle: any = {}, - popoverStyle: any = {}, style?: any, - showCloseButton = true, visibleFn: (visible: boolean) => void = () => {}, - popoverContentStyle: any = {}): TbPopoverComponent { - const componentRef = this.createPopoverRef(hostView); - return this.displayPopoverWithComponentRef(componentRef, trigger, renderer, componentType, preferredPlacement, hideOnClickOutside, - injector, context, overlayStyle, popoverStyle, style, showCloseButton, visibleFn, popoverContentStyle); + componentType: Type, preferredPlacement: PopoverPreferredPlacement, + hideOnClickOutside: boolean, injector?: Injector, context?: any, overlayStyle?: any, + popoverStyle?: any, style?: any, + showCloseButton?: boolean, visibleFn?: (visible: boolean) => void, + popoverContentStyle?: any): TbPopoverComponent; + displayPopover(config: Element | DisplayPopoverConfig, renderer?: Renderer2, hostView?: ViewContainerRef, + componentType?: Type, preferredPlacement?: PopoverPreferredPlacement, + hideOnClickOutside?: boolean, injector?: Injector, context?: any, overlayStyle?: any, + popoverStyle?: any, style?: any, + showCloseButton?: boolean, visibleFn?: (visible: boolean) => void, + popoverContentStyle?: any): TbPopoverComponent { + if (!(config instanceof Element) && 'trigger' in config && 'renderer' in config && 'componentType' in config) { + const componentRef = this.createPopoverRef(config.hostView); + return this.displayPopoverWithComponentRef({ ...config, componentRef }) + } else if (config instanceof Element) { + const componentRef = this.createPopoverRef(hostView); + return this.displayPopoverWithComponentRef(componentRef, config, renderer, componentType, preferredPlacement, hideOnClickOutside, + injector, context, overlayStyle, popoverStyle, style, showCloseButton, visibleFn, popoverContentStyle); + } else { + throw new Error("Invalid configuration provided for displayPopover"); + } } + displayPopoverWithComponentRef(config: DisplayPopoverWithComponentRefConfig): TbPopoverComponent; displayPopoverWithComponentRef(componentRef: ComponentRef, trigger: Element, renderer: Renderer2, - componentType: Type, preferredPlacement: PopoverPreferredPlacement = 'top', - hideOnClickOutside = true, injector?: Injector, context?: any, overlayStyle: any = {}, - popoverStyle: any = {}, style?: any, showCloseButton = true, - visibleFn: (visible: boolean) => void = () => {}, + componentType: Type, preferredPlacement: PopoverPreferredPlacement, + hideOnClickOutside: boolean, injector?: Injector, context?: any, overlayStyle?: any, + popoverStyle?: any, style?: any, showCloseButton?: boolean, + visibleFn?: (visible: boolean) => void, popoverContentStyle?: any): TbPopoverComponent; + displayPopoverWithComponentRef(config: ComponentRef | DisplayPopoverWithComponentRefConfig, + trigger?: Element, renderer?: Renderer2, componentType?: Type, + preferredPlacement?: PopoverPreferredPlacement, hideOnClickOutside?: boolean, + injector?: Injector, context?: any, overlayStyle?: any, + popoverStyle?: any, style?: any, showCloseButton?: boolean, + visibleFn?: (visible: boolean) => void, popoverContentStyle: any = {}): TbPopoverComponent { - const component = componentRef.instance; + let popoverConfig: DisplayPopoverWithComponentRefConfig; + if (!(config instanceof ComponentRef) && 'trigger' in config && 'renderer' in config && 'componentType' in config) { + popoverConfig = config; + } else if(config instanceof ComponentRef) { + popoverConfig = { + componentRef: config, + trigger, + renderer, + componentType, + preferredPlacement, + hideOnClickOutside, + injector, + context, + overlayStyle, + popoverStyle, + style, + showCloseButton, + visibleFn, + popoverContentStyle + } + } else { + throw new Error("Invalid configuration provided for displayPopoverWithComponentRef"); + } + popoverConfig = mergeDeep({} as any, defaultPopoverConfig, popoverConfig); + return this._displayPopoverWithComponentRef(popoverConfig); + } + + + private _displayPopoverWithComponentRef(conf: DisplayPopoverWithComponentRefConfig): TbPopoverComponent { + const component = conf.componentRef.instance; this.popoverWithTriggers.push({ - trigger, + trigger: conf.trigger, popoverComponent: component }); - renderer.removeChild( - renderer.parentNode(trigger), - componentRef.location.nativeElement + conf.renderer.removeChild( + conf.renderer.parentNode(conf.trigger), + conf.componentRef.location.nativeElement ); - const originElementRef = new ElementRef(trigger); + const originElementRef = new ElementRef(conf.trigger); component.setOverlayOrigin(new CdkOverlayOrigin(originElementRef)); - component.tbPlacement = preferredPlacement; - component.tbComponent = componentType; - component.tbComponentInjector = injector; - component.tbComponentContext = context; - component.tbOverlayStyle = overlayStyle; - component.tbPopoverInnerStyle = popoverStyle; - component.tbPopoverInnerContentStyle = popoverContentStyle; - component.tbComponentStyle = style; - component.tbHideOnClickOutside = hideOnClickOutside; - component.tbShowCloseButton = showCloseButton; + component.tbPlacement = conf.preferredPlacement; + component.tbComponent = conf.componentType; + component.tbComponentInjector = conf.injector; + component.tbComponentContext = conf.context; + component.tbOverlayStyle = conf.overlayStyle; + component.tbModal = conf.isModal; + component.tbPopoverInnerStyle = conf.popoverStyle; + component.tbPopoverInnerContentStyle = conf.popoverContentStyle; + component.tbComponentStyle = conf.style; + component.tbHideOnClickOutside = conf.hideOnClickOutside; + component.tbShowCloseButton = conf.showCloseButton; component.tbVisibleChange.subscribe((visible: boolean) => { if (!visible) { - componentRef.destroy(); + conf.componentRef.destroy(); } }); component.tbDestroy.subscribe(() => { this.removePopoverByComponent(component); }); component.tbHideStart.subscribe(() => { - visibleFn(false); + conf.visibleFn(false); }); component.show(); - visibleFn(true); + conf.visibleFn(true); return component; } From 70a9679bc848feba69e481945aef9a7ee9d20cbb Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Mon, 24 Mar 2025 18:14:49 +0200 Subject: [PATCH 080/286] fixed sending empty timeseries update --- .../DefaultTbEntityDataSubscriptionService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java index 9e9ca42e83..38303a2cf9 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java @@ -725,7 +725,11 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc update = new EntityDataUpdate(ctx.getCmdId(), ctx.getData(), null, ctx.getMaxEntitiesPerDataSubscription()); ctx.setInitialDataSent(true); } else { - update = new EntityDataUpdate(ctx.getCmdId(), null, ctx.getData().getData(), ctx.getMaxEntitiesPerDataSubscription()); + // to avoid updating timeseries with empty values + List data = ctx.getData().getData().stream() + .peek(entityData -> entityData.setTimeseries(null)) + .toList(); + update = new EntityDataUpdate(ctx.getCmdId(), null, data, ctx.getMaxEntitiesPerDataSubscription()); } ctx.sendWsMsg(update); } finally { From d6739538854ac9e029560c1687320870b183f06b Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 24 Mar 2025 17:59:53 +0200 Subject: [PATCH 081/286] UI: Refactoring popover to use isModal setting --- .../debug/entity-debug-settings.service.ts | 14 ++-- .../vc/entity-types-version-load.component.ts | 15 +++- .../vc/entity-version-diff.component.ts | 15 +++- .../vc/entity-versions-table.component.ts | 81 +++++++++++++------ .../config/timewindow-style.component.ts | 14 ++-- .../get-value-action-settings.component.ts | 36 +++++---- .../set-value-action-settings.component.ts | 30 +++---- .../widget-action-settings.component.ts | 28 ++++--- .../auto-date-format-settings.component.ts | 21 ++--- .../common/background-settings.component.ts | 19 +++-- .../widget-button-custom-style.component.ts | 28 ++++--- ...et-button-toggle-custom-style.component.ts | 30 +++---- ...es-chart-axis-settings-button.component.ts | 25 +++--- ...ries-chart-threshold-settings.component.ts | 20 +++-- .../time-series-chart-y-axis-row.component.ts | 25 +++--- .../common/color-range-settings.component.ts | 21 ++--- .../common/color-settings.component.ts | 35 ++++---- .../common/date-format-select.component.ts | 39 +++++---- .../dynamic-form-property-row.component.ts | 25 +++--- .../common/font-settings.component.ts | 14 ++-- .../common/key/data-keys.component.ts | 16 ++-- .../data-layer-color-settings.component.ts | 29 ++++--- .../common/map/map-layer-row.component.ts | 19 +++-- .../map/map-tooltip-tag-actions.component.ts | 32 ++++---- .../map/marker-image-settings.component.ts | 19 +++-- .../map/marker-shape-settings.component.ts | 25 +++--- .../applications/mobile-app.component.ts | 16 ++-- .../layout/mobile-page-item-row.component.ts | 31 ++++--- .../scada-symbol-behavior-row.component.ts | 27 ++++--- .../scada-symbol-metadata-tag.component.ts | 28 ++++--- .../pages/widget/widget-editor.component.ts | 14 ++-- .../shared/components/js-func.component.ts | 19 +++-- .../timewindow-config-dialog.component.ts | 32 +++++--- .../components/time/timezone.component.ts | 15 ++-- 34 files changed, 511 insertions(+), 346 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.service.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.service.ts index 873d8f0f3f..cb982b9650 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.service.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.service.ts @@ -37,14 +37,18 @@ export class EntityDebugSettingsService { if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const debugStrategyPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityDebugSettingsPanelComponent, 'bottom', true, null, - { + const debugStrategyPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: EntityDebugSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'bottom', + context: { ...panelConfig.debugSettings, ...panelConfig.debugConfig, }, - {}, - {}, {}, true); + isModal: true, + }); debugStrategyPopover.tbComponentRef.instance.onSettingsApplied.subscribe(settings => { panelConfig.onSettingsAppliedFn(settings); debugStrategyPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts index f06abaf3a8..903712aac8 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-types-version-load.component.ts @@ -232,16 +232,23 @@ export class EntityTypesVersionLoadComponent extends PageComponent implements On if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const removeOtherEntitiesConfirmPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, RemoveOtherEntitiesConfirmComponent, 'bottom', true, null, - { + const removeOtherEntitiesConfirmPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: RemoveOtherEntitiesConfirmComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'bottom', + context: { onClose: (result: boolean | null) => { removeOtherEntitiesConfirmPopover.hide(); if (result) { entityTypeControl.get('config').get('removeOtherEntities').patchValue(true, {emitEvent: true}); } } - }, {}, {}, {}, false); + }, + showCloseButton: false, + isModal: true + }); } } } diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts index 1908b5e1fa..19dc945d65 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-version-diff.component.ts @@ -304,9 +304,13 @@ export class EntityVersionDiffComponent extends PageComponent implements OnInit, if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const restoreVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', false, null, - { + const restoreVersionPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: EntityVersionRestoreComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'leftTop', + context: { versionName: this.versionName, versionId: this.versionId, externalEntityId: this.externalEntityId, @@ -317,7 +321,10 @@ export class EntityVersionDiffComponent extends PageComponent implements OnInit, this.versionRestored.emit(); } } - }, {}, {}, {}, false); + }, + showCloseButton: false, + isModal: true + }); restoreVersionPopover.tbComponentRef.instance.popoverComponent = restoreVersionPopover; } } diff --git a/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts b/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts index 2a6d5c5962..fe9af56e4b 100644 --- a/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/vc/entity-versions-table.component.ts @@ -211,9 +211,13 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const createVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityVersionCreateComponent, 'leftTop', false, null, - { + const createVersionPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: EntityVersionCreateComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'leftTop', + context: { branch: this.branch, entityId: this.entityId, entityName: this.entityName, @@ -229,8 +233,11 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni } } }, - {maxHeight: '100vh', height: '100%', padding: '10px'}, - {width: '400px', minWidth: '100%', maxWidth: '100%'}, {}, false); + showCloseButton: false, + overlayStyle: {maxHeight: '100vh', height: '100%', padding: '10px'}, + popoverStyle: {width: '400px', minWidth: '100%', maxWidth: '100%'}, + isModal: true + }); createVersionPopover.tbComponentRef.instance.popoverComponent = createVersionPopover; } } @@ -243,9 +250,13 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const complexCreateVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ComplexVersionCreateComponent, 'leftTop', false, null, - { + const complexCreateVersionPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ComplexVersionCreateComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'leftTop', + context: { branch: this.branch, onClose: (result: VersionCreationResult | null, branch: string | null) => { complexCreateVersionPopover.hide(); @@ -258,8 +269,10 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni } } }, - {maxHeight: '90vh', height: '100%', padding: '10px'}, - {}, {}, false); + showCloseButton: false, + overlayStyle: {maxHeight: '90vh', height: '100%', padding: '10px'}, + isModal: true + }); complexCreateVersionPopover.tbComponentRef.instance.popoverComponent = complexCreateVersionPopover; } } @@ -272,14 +285,21 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const diffVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityVersionDiffComponent, 'leftTop', true, null, - { + const diffVersionPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: EntityVersionDiffComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'leftTop', + context: { versionName: entityVersion.name, versionId: entityVersion.id, entityId: this.entityId, externalEntityId: this.externalEntityIdValue - }, {}, {}, {}, false); + }, + showCloseButton: false, + isModal: true + }); diffVersionPopover.tbComponentRef.instance.popoverComponent = diffVersionPopover; diffVersionPopover.tbComponentRef.instance.versionRestored.subscribe(() => { this.versionRestored.emit(); @@ -295,9 +315,13 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const restoreVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EntityVersionRestoreComponent, 'leftTop', false, null, - { + const restoreVersionPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: EntityVersionRestoreComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'leftTop', + context: { versionName: entityVersion.name, versionId: entityVersion.id, externalEntityId: this.externalEntityIdValue, @@ -308,8 +332,11 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni } } }, - {maxHeight: '100vh', height: '100%', padding: '10px'}, - {width: '400px', minWidth: '100%', maxWidth: '100%'}, {}, false); + showCloseButton: false, + overlayStyle: {maxHeight: '100vh', height: '100%', padding: '10px'}, + popoverStyle: {width: '400px', minWidth: '100%', maxWidth: '100%'}, + isModal: true + }); restoreVersionPopover.tbComponentRef.instance.popoverComponent = restoreVersionPopover; } } @@ -322,17 +349,23 @@ export class EntityVersionsTableComponent extends PageComponent implements OnIni if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const restoreEntitiesVersionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ComplexVersionLoadComponent, 'leftTop', false, null, - { + const restoreEntitiesVersionPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ComplexVersionLoadComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'leftTop', + context: { versionName: entityVersion.name, versionId: entityVersion.id, onClose: (result: VersionLoadResult | null) => { restoreEntitiesVersionPopover.hide(); } }, - {maxHeight: '80vh', height: '100%', padding: '10px'}, - {}, {}, false); + showCloseButton: false, + overlayStyle: {maxHeight: '80vh', height: '100%', padding: '10px'}, + isModal: true + }); restoreEntitiesVersionPopover.tbComponentRef.instance.popoverComponent = restoreEntitiesVersionPopover; } } diff --git a/ui-ngx/src/app/modules/home/components/widget/config/timewindow-style.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-style.component.ts index 790535acbc..c9675caefa 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/timewindow-style.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-style.component.ts @@ -80,11 +80,15 @@ export class TimewindowStyleComponent implements OnInit, ControlValueAccessor { timewindowStyle: this.modelValue, previewValue: this.previewValue }; - const timewindowStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimewindowStylePanelComponent, 'left', true, null, - ctx, - {}, - {}, {}, true); + const timewindowStylePanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + hostView: this.viewContainerRef, + componentType: TimewindowStylePanelComponent, + preferredPlacement: 'left', + context: ctx, + isModal: true + }); timewindowStylePanelPopover.tbComponentRef.instance.popover = timewindowStylePanelPopover; timewindowStylePanelPopover.tbComponentRef.instance.timewindowStyleApplied.subscribe((timewindowStyle) => { timewindowStylePanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts index 5b95ef5f13..7bdb17c06a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/get-value-action-settings.component.ts @@ -129,23 +129,25 @@ export class GetValueActionSettingsComponent implements OnInit, ControlValueAcce if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - getValueSettings: this.modelValue, - panelTitle: this.panelTitle, - valueType: this.valueType, - trueLabel: this.trueLabel, - falseLabel: this.falseLabel, - stateLabel: this.stateLabel, - aliasController: this.aliasController, - targetDevice: this.targetDevice, - widgetType: this.widgetType - }; - const getValueSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, GetValueActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const getValueSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: GetValueActionSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], + context: { + getValueSettings: this.modelValue, + panelTitle: this.panelTitle, + valueType: this.valueType, + trueLabel: this.trueLabel, + falseLabel: this.falseLabel, + stateLabel: this.stateLabel, + aliasController: this.aliasController, + targetDevice: this.targetDevice, + widgetType: this.widgetType + }, + isModal: true + }); getValueSettingsPanelPopover.tbComponentRef.instance.popover = getValueSettingsPanelPopover; getValueSettingsPanelPopover.tbComponentRef.instance.getValueSettingsApplied.subscribe((getValueSettings) => { getValueSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts index e446e6f5b3..cf90db33ed 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/set-value-action-settings.component.ts @@ -115,20 +115,22 @@ export class SetValueActionSettingsComponent implements OnInit, ControlValueAcce if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - setValueSettings: this.modelValue, - panelTitle: this.panelTitle, - valueType: this.valueType, - aliasController: this.aliasController, - targetDevice: this.targetDevice, - widgetType: this.widgetType - }; - const setValueSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, SetValueActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const setValueSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: SetValueActionSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], + context: { + setValueSettings: this.modelValue, + panelTitle: this.panelTitle, + valueType: this.valueType, + aliasController: this.aliasController, + targetDevice: this.targetDevice, + widgetType: this.widgetType + }, + isModal: true + }); setValueSettingsPanelPopover.tbComponentRef.instance.popover = setValueSettingsPanelPopover; setValueSettingsPanelPopover.tbComponentRef.instance.setValueSettingsApplied.subscribe((setValueSettings) => { setValueSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts index 51583f71fb..de29366846 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action-settings.component.ts @@ -114,19 +114,21 @@ export class WidgetActionSettingsComponent implements OnInit, ControlValueAccess if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - widgetAction: this.modelValue, - panelTitle: this.panelTitle, - widgetType: this.widgetType, - callbacks: this.callbacks, - additionalWidgetActionTypes: this.additionalWidgetActionTypes - }; - const widgetActionSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, WidgetActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const widgetActionSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: WidgetActionSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], + context: { + widgetAction: this.modelValue, + panelTitle: this.panelTitle, + widgetType: this.widgetType, + callbacks: this.callbacks, + additionalWidgetActionTypes: this.additionalWidgetActionTypes + }, + isModal: true + }); widgetActionSettingsPanelPopover.tbComponentRef.instance.widgetActionApplied.subscribe((widgetAction) => { widgetActionSettingsPanelPopover.hide(); this.modelValue = widgetAction; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts index 1d776bcb70..f46bce6dd6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/auto-date-format-settings.component.ts @@ -78,15 +78,18 @@ export class AutoDateFormatSettingsComponent implements OnInit, ControlValueAcce if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - autoDateFormatSettings: deepClone(this.modelValue), - defaultValues: this.defaultValues - }; - const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: AutoDateFormatSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + autoDateFormatSettings: deepClone(this.modelValue), + defaultValues: this.defaultValues + }, + isModal: true + }); autoDateFormatSettingsPanelPopover.tbComponentRef.instance.popover = autoDateFormatSettingsPanelPopover; autoDateFormatSettingsPanelPopover.tbComponentRef.instance.autoDateFormatSettingsApplied.subscribe((autoDateFormatSettings) => { autoDateFormatSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts index cadf5fb07a..a5ed2cf96a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/background-settings.component.ts @@ -107,14 +107,17 @@ export class BackgroundSettingsComponent implements OnInit, ControlValueAccessor if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - backgroundSettings: this.modelValue - }; - const backgroundSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, BackgroundSettingsPanelComponent, ['left'], false, null, - ctx, - {}, - {}, {}, true); + const backgroundSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: BackgroundSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + backgroundSettings: this.modelValue + }, + isModal: true + }); backgroundSettingsPanelPopover.tbComponentRef.instance.popover = backgroundSettingsPanelPopover; backgroundSettingsPanelPopover.tbComponentRef.instance.backgroundSettingsApplied.subscribe((backgroundSettings) => { backgroundSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts index 5db91fb1bb..1cfc7a77cf 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-custom-style.component.ts @@ -124,19 +124,21 @@ export class WidgetButtonCustomStyleComponent implements OnInit, OnChanges, Cont if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - appearance: this.appearance, - borderRadius: this.borderRadius, - autoScale: this.autoScale, - state: this.state, - customStyle: this.modelValue - }; - const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, WidgetButtonCustomStylePanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: WidgetButtonCustomStylePanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], + context: { + appearance: this.appearance, + borderRadius: this.borderRadius, + autoScale: this.autoScale, + state: this.state, + customStyle: this.modelValue + }, + isModal: true + }); widgetButtonCustomStylePanelPopover.tbComponentRef.instance.popover = widgetButtonCustomStylePanelPopover; widgetButtonCustomStylePanelPopover.tbComponentRef.instance.customStyleApplied.subscribe((customStyle) => { widgetButtonCustomStylePanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts index b2a78ff961..1e0f19ea58 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/button/widget-button-toggle-custom-style.component.ts @@ -127,20 +127,22 @@ export class WidgetButtonToggleCustomStyleComponent implements OnInit, OnChanges if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - appearance: this.appearance, - borderRadius: this.borderRadius, - autoScale: this.autoScale, - state: this.state, - value: this.value, - customStyle: this.modelValue - }; - const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, WidgetButtonToggleCustomStylePanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const widgetButtonCustomStylePanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: WidgetButtonToggleCustomStylePanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], + context: { + appearance: this.appearance, + borderRadius: this.borderRadius, + autoScale: this.autoScale, + state: this.state, + value: this.value, + customStyle: this.modelValue + }, + isModal: true + }); widgetButtonCustomStylePanelPopover.tbComponentRef.instance.popover = widgetButtonCustomStylePanelPopover; widgetButtonCustomStylePanelPopover.tbComponentRef.instance.customStyleApplied.subscribe((customStyle) => { widgetButtonCustomStylePanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts index 2f2067f3a8..016f213c0b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-axis-settings-button.component.ts @@ -85,17 +85,20 @@ export class TimeSeriesChartAxisSettingsButtonComponent implements OnInit, Contr if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - axisSettings: this.modelValue, - axisType: this.axisType, - panelTitle: this.panelTitle, - advanced: this.advanced - }; - const axisSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const axisSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: TimeSeriesChartAxisSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + axisSettings: this.modelValue, + axisType: this.axisType, + panelTitle: this.panelTitle, + advanced: this.advanced + }, + isModal: true + }); axisSettingsPanelPopover.tbComponentRef.instance.popover = axisSettingsPanelPopover; axisSettingsPanelPopover.tbComponentRef.instance.axisSettingsApplied.subscribe((axisSettings) => { axisSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts index e3ff513e0f..d39e4b48dd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-threshold-settings.component.ts @@ -107,11 +107,21 @@ export class TimeSeriesChartThresholdSettingsComponent implements OnInit, Contro hideYAxis: this.hideYAxis, yAxisIds: this.yAxisIds }; - const thresholdSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimeSeriesChartThresholdSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const thresholdSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: TimeSeriesChartThresholdSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + thresholdSettings: deepClone(this.modelValue), + panelTitle: this.title, + widgetConfig: this.widgetConfig, + hideYAxis: this.hideYAxis, + yAxisIds: this.yAxisIds + }, + isModal: true + }); thresholdSettingsPanelPopover.tbComponentRef.instance.popover = thresholdSettingsPanelPopover; thresholdSettingsPanelPopover.tbComponentRef.instance.thresholdSettingsApplied.subscribe((thresholdSettings) => { thresholdSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts index 69cbc29a25..dec7148b30 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/chart/time-series-chart-y-axis-row.component.ts @@ -151,17 +151,20 @@ export class TimeSeriesChartYAxisRowComponent implements ControlValueAccessor, O if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - axisType: 'yAxis', - panelTitle: this.translate.instant('widgets.time-series-chart.axis.y-axis-settings'), - axisSettings: deepClone(this.modelValue), - advanced: this.advanced - }; - const yAxisSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimeSeriesChartAxisSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const yAxisSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: TimeSeriesChartAxisSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + axisType: 'yAxis', + panelTitle: this.translate.instant('widgets.time-series-chart.axis.y-axis-settings'), + axisSettings: deepClone(this.modelValue), + advanced: this.advanced + }, + isModal: true + }); yAxisSettingsPanelPopover.tbComponentRef.instance.popover = yAxisSettingsPanelPopover; yAxisSettingsPanelPopover.tbComponentRef.instance.axisSettingsApplied.subscribe((yAxisSettings) => { yAxisSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts index 431fac44da..23b1efbce9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-settings.component.ts @@ -121,15 +121,18 @@ export class ColorRangeSettingsComponent implements OnInit, ControlValueAccessor if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - colorRangeSettings: this.modelValue, - settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this) - }; - const colorRangeSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ColorRangePanelComponent, 'left', false, null, - ctx, - {}, - {}, {}, true); + const colorRangeSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ColorRangePanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + colorRangeSettings: this.modelValue, + settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this) + }, + isModal: true + }); colorRangeSettingsPanelPopover.tbComponentRef.instance.popover = colorRangeSettingsPanelPopover; colorRangeSettingsPanelPopover.tbComponentRef.instance.colorRangeApplied.subscribe((colorRangeSettings: Array) => { colorRangeSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts index 133fa11bd4..05c069cbf3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts @@ -159,22 +159,25 @@ export class ColorSettingsComponent implements OnInit, ControlValueAccessor, OnD if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - colorSettings: this.modelValue, - settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this), - aliasController: this.aliasController, - dataKeyCallbacks: this.dataKeyCallbacks, - datasource: this.datasource, - rangeAdvancedMode: this.rangeAdvancedMode, - gradientAdvancedMode: this.gradientAdvancedMode, - minValue: this.minValue, - maxValue: this.maxValue - }; - const colorSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ColorSettingsPanelComponent, 'left', false, null, - ctx, - {}, - {}, {}, true); + const colorSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ColorSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + colorSettings: this.modelValue, + settingsComponents: this.colorSettingsComponentService.getOtherColorSettingsComponents(this), + aliasController: this.aliasController, + dataKeyCallbacks: this.dataKeyCallbacks, + datasource: this.datasource, + rangeAdvancedMode: this.rangeAdvancedMode, + gradientAdvancedMode: this.gradientAdvancedMode, + minValue: this.minValue, + maxValue: this.maxValue + }, + isModal: true + }); colorSettingsPanelPopover.tbComponentRef.instance.popover = colorSettingsPanelPopover; colorSettingsPanelPopover.tbComponentRef.instance.colorSettingsApplied.subscribe((colorSettings) => { colorSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts index 92aef0ba29..847e869fe6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/date-format-select.component.ts @@ -162,14 +162,16 @@ export class DateFormatSelectComponent implements OnInit, ControlValueAccessor { if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - dateFormat: deepClone(this.modelValue) - }; - const dateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, DateFormatSettingsPanelComponent, 'top', false, null, - ctx, - {}, - {}, {}, true); + const dateFormatSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: DateFormatSettingsPanelComponent, + hostView: this.viewContainerRef, + context: { + dateFormat: deepClone(this.modelValue) + }, + isModal: true + }); dateFormatSettingsPanelPopover.tbComponentRef.instance.popover = dateFormatSettingsPanelPopover; dateFormatSettingsPanelPopover.tbComponentRef.instance.dateFormatApplied.subscribe((dateFormat) => { dateFormatSettingsPanelPopover.hide(); @@ -187,15 +189,18 @@ export class DateFormatSelectComponent implements OnInit, ControlValueAccessor { if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - autoDateFormatSettings: mergeDeep({} as AutoDateFormatSettings, - defaultAutoDateFormatSettings, this.modelValue.autoDateFormatSettings) - }; - const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, AutoDateFormatSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const autoDateFormatSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: AutoDateFormatSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + autoDateFormatSettings: mergeDeep({} as AutoDateFormatSettings, + defaultAutoDateFormatSettings, this.modelValue.autoDateFormatSettings) + }, + isModal: true + }); autoDateFormatSettingsPanelPopover.tbComponentRef.instance.popover = autoDateFormatSettingsPanelPopover; autoDateFormatSettingsPanelPopover.tbComponentRef.instance.autoDateFormatSettingsApplied.subscribe((autoDateFormatSettings) => { autoDateFormatSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts index 79c2254a7d..58d879ba79 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/dynamic-form/dynamic-form-property-row.component.ts @@ -168,17 +168,20 @@ export class DynamicFormPropertyRowComponent implements ControlValueAccessor, On if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - isAdd: add, - disabled: this.disabled, - booleanPropertyIds: this.booleanPropertyIds, - property: deepClone(this.modelValue) - }; - const dynamicFormPropertyPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, DynamicFormPropertyPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const dynamicFormPropertyPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: DynamicFormPropertyPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + isAdd: add, + disabled: this.disabled, + booleanPropertyIds: this.booleanPropertyIds, + property: deepClone(this.modelValue) + }, + isModal: true + }); dynamicFormPropertyPanelPopover.tbComponentRef.instance.popover = dynamicFormPropertyPanelPopover; dynamicFormPropertyPanelPopover.tbComponentRef.instance.propertySettingsApplied.subscribe((property) => { dynamicFormPropertyPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts index 25addab5ea..2675f9d1e6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/font-settings.component.ts @@ -109,11 +109,15 @@ export class FontSettingsComponent implements OnInit, ControlValueAccessor { ctx.previewText = previewText; } } - const fontSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, FontSettingsPanelComponent, 'left', false, null, - ctx, - {}, - {}, {}, true); + const fontSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: FontSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: ctx, + isModal: true + }); fontSettingsPanelPopover.tbComponentRef.instance.popover = fontSettingsPanelPopover; fontSettingsPanelPopover.tbComponentRef.instance.fontApplied.subscribe((font) => { fontSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts index e60d0298d9..a9be1fd352 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/key/data-keys.component.ts @@ -565,14 +565,20 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, OnChange if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const colorPickerPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ColorPickerPanelComponent, ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], true, null, - { + const colorPickerPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ColorPickerPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], + context: { color: key.color, colorCancelButton: true }, - {}, - {}, {}, false, () => {}, {padding: '12px 4px 12px 12px'}); + showCloseButton: false, + popoverContentStyle: {padding: '12px 4px 12px 12px'}, + isModal: true + }); colorPickerPopover.tbComponentRef.instance.popover = colorPickerPopover; colorPickerPopover.tbComponentRef.instance.colorSelected.subscribe((color) => { colorPickerPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts index 8c94ed2c80..ea5da11890 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings.component.ts @@ -97,19 +97,22 @@ export class DataLayerColorSettingsComponent implements ControlValueAccessor { if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - colorSettings: this.modelValue, - context: this.context, - dsType: this.dsType, - dsEntityAliasId: this.dsEntityAliasId, - dsDeviceId: this.dsDeviceId, - helpId: this.helpId - }; - const colorSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, DataLayerColorSettingsPanelComponent, 'left', false, null, - ctx, - {}, - {}, {}, true); + const colorSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: DataLayerColorSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + colorSettings: this.modelValue, + context: this.context, + dsType: this.dsType, + dsEntityAliasId: this.dsEntityAliasId, + dsDeviceId: this.dsDeviceId, + helpId: this.helpId + }, + isModal: true + }); colorSettingsPanelPopover.tbComponentRef.instance.popover = colorSettingsPanelPopover; colorSettingsPanelPopover.tbComponentRef.instance.colorSettingsApplied.subscribe((colorSettings) => { colorSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts index d7d4f78433..40a98b54cc 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-layer-row.component.ts @@ -180,14 +180,17 @@ export class MapLayerRowComponent implements ControlValueAccessor, OnInit { if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - mapLayerSettings: deepClone(this.modelValue) - }; - const mapLayerSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, MapLayerSettingsPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const mapLayerSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: MapLayerSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + mapLayerSettings: deepClone(this.modelValue) + }, + isModal: true + }); mapLayerSettingsPanelPopover.tbComponentRef.instance.popover = mapLayerSettingsPanelPopover; mapLayerSettingsPanelPopover.tbComponentRef.instance.mapLayerSettingsApplied.subscribe((layer) => { mapLayerSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts index 6cf5791406..26f17055b6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-tooltip-tag-actions.component.ts @@ -151,21 +151,23 @@ export class MapTooltipTagActionsComponent implements ControlValueAccessor, OnIn } else { const title = this.translate.instant(isAdd ? 'widgets.maps.data-layer.add-tooltip-tag-action' : 'widgets.maps.data-layer.edit-tooltip-tag-action'); const applyTitle = this.translate.instant(isAdd ? 'action.add' : 'action.apply'); - const ctx: any = { - widgetAction: action, - withName: true, - actionNames, - panelTitle: title, - applyTitle, - widgetType: widgetType.latest, - callbacks: this.context.callbacks - }; - const widgetActionSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, WidgetActionSettingsPanelComponent, - ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const widgetActionSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: WidgetActionSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftTopOnly', 'leftOnly', 'leftBottomOnly'], + context: { + widgetAction: action, + withName: true, + actionNames, + panelTitle: title, + applyTitle, + widgetType: widgetType.latest, + callbacks: this.context.callbacks + }, + isModal: true + }); widgetActionSettingsPanelPopover.tbComponentRef.instance.widgetActionApplied.subscribe((widgetAction) => { widgetActionSettingsPanelPopover.hide(); callback(widgetAction); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts index 2d8feb817f..eac0dc9121 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings.component.ts @@ -76,14 +76,17 @@ export class MarkerImageSettingsComponent implements ControlValueAccessor { if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - markerImageSettings: this.modelValue, - }; - const markerImageSettingsPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, MarkerImageSettingsPanelComponent, 'left', false, null, - ctx, - {}, - {}, {}, true); + const markerImageSettingsPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: MarkerImageSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + markerImageSettings: this.modelValue, + }, + isModal: true + }); markerImageSettingsPanelPopover.tbComponentRef.instance.popover = markerImageSettingsPanelPopover; markerImageSettingsPanelPopover.tbComponentRef.instance.markerImageSettingsApplied.subscribe((markerImageSettings) => { markerImageSettingsPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-shape-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-shape-settings.component.ts index 4400c5a151..bfb6c0c76d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-shape-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-shape-settings.component.ts @@ -177,17 +177,20 @@ export class MarkerShapeSettingsComponent implements ControlValueAccessor, OnIni ); }); } else if (this.markerType === MarkerType.icon) { - const ctx: any = { - iconContainer: (this.modelValue as MarkerIconSettings).iconContainer, - icon: (this.modelValue as MarkerIconSettings).icon, - color: this.modelValue.color.color, - trip: this.trip - }; - const markerIconShapesPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, MarkerIconShapesComponent, 'left', true, null, - ctx, - {}, - {}, {}, true); + const markerIconShapesPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: MarkerIconShapesComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + iconContainer: (this.modelValue as MarkerIconSettings).iconContainer, + icon: (this.modelValue as MarkerIconSettings).icon, + color: this.modelValue.color.color, + trip: this.trip + }, + isModal: true + }); markerIconShapesPopover.tbComponentRef.instance.popover = markerIconShapesPopover; markerIconShapesPopover.tbComponentRef.instance.markerIconSelected.subscribe((iconInfo) => { markerIconShapesPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts index bbd096bbaf..eceda5ac9a 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts +++ b/ui-ngx/src/app/modules/home/pages/mobile/applications/mobile-app.component.ts @@ -166,11 +166,17 @@ export class MobileAppComponent extends EntityComponent { ? this.entityForm.get('versionInfo.latestVersionReleaseNotes').value : this.entityForm.get('versionInfo.minVersionReleaseNotes').value }; - const releaseNotesPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, EditorPanelComponent, ['leftOnly', 'leftBottomOnly', 'leftTopOnly'], true, null, - ctx, - {}, - {}, {}, false, () => {}, {padding: '16px 24px'}); + const releaseNotesPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + hostView: this.viewContainerRef, + componentType: EditorPanelComponent, + preferredPlacement: ['leftOnly', 'leftBottomOnly', 'leftTopOnly'], + context: ctx, + showCloseButton: false, + popoverContentStyle: {padding: '16px 24px'}, + isModal: false + }); releaseNotesPanelPopover.tbComponentRef.instance.popover = releaseNotesPanelPopover; releaseNotesPanelPopover.tbComponentRef.instance.editorContentApplied.subscribe((releaseNotes) => { releaseNotesPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/mobile-page-item-row.component.ts b/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/mobile-page-item-row.component.ts index 33be223815..9f4add3195 100644 --- a/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/mobile-page-item-row.component.ts +++ b/ui-ngx/src/app/modules/home/pages/mobile/bundes/layout/mobile-page-item-row.component.ts @@ -55,6 +55,7 @@ import { TbPopoverService } from '@shared/components/popover.service'; import { CustomMobilePagePanelComponent } from '@home/pages/mobile/bundes/layout/custom-mobile-page-panel.component'; import { DefaultMobilePagePanelComponent } from '@home/pages/mobile/bundes/layout/default-mobile-page-panel.component'; import { TranslateService } from '@ngx-translate/core'; +import { DisplayPopoverConfig } from '@shared/components/popover.models'; @Component({ selector: 'tb-mobile-menu-item-row', @@ -222,27 +223,31 @@ export class MobilePageItemRowComponent implements ControlValueAccessor, OnInit, if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - disabled: this.disabled, - pageItem: deepClone(this.modelValue) + const config: DisplayPopoverConfig = { + trigger, + renderer: this.renderer, + componentType: undefined, + hostView: this.viewContainerRef, + preferredPlacement: ['right', 'bottom', 'top'], + context: { + disabled: this.disabled, + pageItem: deepClone(this.modelValue) + }, + showCloseButton: false, + popoverContentStyle: {padding: '16px 24px'}, + isModal: true }; if (this.isDefaultMenuItem) { - const defaultMobilePagePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, DefaultMobilePagePanelComponent, ['right', 'bottom', 'top'], true, null, - ctx, - {}, - {}, {}, false, () => {}, {padding: '16px 24px'}); + config.componentType = DefaultMobilePagePanelComponent; + const defaultMobilePagePanelPopover = this.popoverService.displayPopover(config); defaultMobilePagePanelPopover.tbComponentRef.instance.popover = defaultMobilePagePanelPopover; defaultMobilePagePanelPopover.tbComponentRef.instance.defaultMobilePageApplied.subscribe((menuItem) => { defaultMobilePagePanelPopover.hide(); this.afterPageEdit(menuItem); }); } else { - const customMobilePagePanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, CustomMobilePagePanelComponent, ['right', 'bottom', 'top'], true, null, - ctx, - {}, - {}, {}, false, () => {}, {padding: '16px 24px'}); + config.componentType = CustomMobilePagePanelComponent; + const customMobilePagePanelPopover = this.popoverService.displayPopover(config); customMobilePagePanelPopover.tbComponentRef.instance.popover = customMobilePagePanelPopover; customMobilePagePanelPopover.tbComponentRef.instance.customMobilePageApplied.subscribe((page) => { customMobilePagePanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-behavior-row.component.ts b/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-behavior-row.component.ts index 3b1db9a595..7cde50ef29 100644 --- a/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-behavior-row.component.ts +++ b/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-behavior-row.component.ts @@ -203,18 +203,21 @@ export class ScadaSymbolBehaviorRowComponent implements ControlValueAccessor, On if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - isAdd: add, - disabled: this.disabled, - aliasController: this.aliasController, - callbacks: this.callbacks, - behavior: deepClone(this.modelValue) - }; - const scadaSymbolBehaviorPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ScadaSymbolBehaviorPanelComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, - ctx, - {}, - {}, {}, true); + const scadaSymbolBehaviorPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ScadaSymbolBehaviorPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + isAdd: add, + disabled: this.disabled, + aliasController: this.aliasController, + callbacks: this.callbacks, + behavior: deepClone(this.modelValue) + }, + isModal: true + }); scadaSymbolBehaviorPanelPopover.tbComponentRef.instance.popover = scadaSymbolBehaviorPanelPopover; scadaSymbolBehaviorPanelPopover.tbComponentRef.instance.behaviorSettingsApplied.subscribe((behavior) => { scadaSymbolBehaviorPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-metadata-tag.component.ts b/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-metadata-tag.component.ts index 95b49d47c2..339ac3a358 100644 --- a/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-metadata-tag.component.ts +++ b/ui-ngx/src/app/modules/home/pages/scada-symbol/metadata-components/scada-symbol-metadata-tag.component.ts @@ -158,19 +158,21 @@ export class ScadaSymbolMetadataTagComponent implements ControlValueAccessor, On tagFunctionControl = this.tagFormGroup.get('clickAction'); completer = this.clickActionFunctionCompleter; } - const ctx: any = { - tagFunction: tagFunctionControl.value, - tagFunctionType, - tag: this.tagFormGroup.get('tag').value, - completer, - disabled: this.disabled - }; - const scadaSymbolTagFunctionPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, ScadaSymbolMetadataTagFunctionPanelComponent, - ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, - ctx, - {}, - {}, {}, true); + const scadaSymbolTagFunctionPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ScadaSymbolMetadataTagFunctionPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: { + tagFunction: tagFunctionControl.value, + tagFunctionType, + tag: this.tagFormGroup.get('tag').value, + completer, + disabled: this.disabled + }, + isModal: true + }); scadaSymbolTagFunctionPanelPopover.tbComponentRef.instance.popover = scadaSymbolTagFunctionPanelPopover; scadaSymbolTagFunctionPanelPopover.tbComponentRef.instance.tagFunctionApplied.subscribe((tagFunction) => { scadaSymbolTagFunctionPanelPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts b/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts index 6675425f32..93c411aabe 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts +++ b/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts @@ -816,11 +816,15 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe const ctx: any = { modules: deepClone(this.controllerScriptModules) }; - const modulesPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, JsFuncModulesComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], true, null, - ctx, - {}, - {}, {}, true); + const modulesPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + hostView: this.viewContainerRef, + componentType: JsFuncModulesComponent, + preferredPlacement: ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], + context: ctx, + isModal: true + }); modulesPanelPopover.tbComponentRef.instance.popover = modulesPanelPopover; modulesPanelPopover.tbComponentRef.instance.modulesApplied.subscribe((modules) => { modulesPanelPopover.hide(); diff --git a/ui-ngx/src/app/shared/components/js-func.component.ts b/ui-ngx/src/app/shared/components/js-func.component.ts index c424df8242..435b0495ec 100644 --- a/ui-ngx/src/app/shared/components/js-func.component.ts +++ b/ui-ngx/src/app/shared/components/js-func.component.ts @@ -518,14 +518,17 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const ctx: any = { - modules: deepClone(this.modules) - }; - const modulesPanelPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, JsFuncModulesComponent, ['leftOnly', 'leftTopOnly', 'leftBottomOnly'], false, null, - ctx, - {}, - {}, {}, true); + const modulesPanelPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: JsFuncModulesComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'leftTop', + context: { + modules: deepClone(this.modules) + }, + isModal: true + }); modulesPanelPopover.tbComponentRef.instance.popover = modulesPanelPopover; modulesPanelPopover.tbComponentRef.instance.modulesApplied.subscribe((modules) => { modulesPanelPopover.hide(); diff --git a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts index 68ec6bcdd9..1ad4dab88c 100644 --- a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts +++ b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts @@ -558,9 +558,13 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const aggregationConfigPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, AggregationOptionsConfigPanelComponent, ['left', 'leftTop', 'leftBottom'], true, null, - { + const aggregationConfigPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + hostView: this.viewContainerRef, + componentType: AggregationOptionsConfigPanelComponent, + preferredPlacement: ['left', 'leftTop', 'leftBottom'], + context: { allowedAggregationTypes: deepClone(this.timewindowForm.get('allowedAggTypes').value), onClose: (result: Array | null) => { aggregationConfigPopover.hide(); @@ -570,8 +574,10 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On } } }, - {maxHeight: '500px', height: '100%'}, - {}, {}, true, () => {}, {padding: 0}); + overlayStyle: {maxHeight: '500px', height: '100%'}, + popoverContentStyle: {padding: 0}, + isModal: true + }); aggregationConfigPopover.tbComponentRef.instance.popoverComponent = aggregationConfigPopover; } this.cd.detectChanges(); @@ -612,9 +618,13 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const intervalsConfigPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, IntervalOptionsConfigPanelComponent, ['left', 'leftTop', 'leftBottom'], true, null, - { + const intervalsConfigPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + hostView: this.viewContainerRef, + componentType: IntervalOptionsConfigPanelComponent, + preferredPlacement: ['left', 'leftTop', 'leftBottom'], + context: { aggregation: this.aggregation, allowedIntervals: deepClone(this.timewindowForm.get(allowedIntervalsControlName).value), aggIntervalsConfig: deepClone(this.timewindowForm.get(aggIntervalsConfigControlName).value), @@ -629,8 +639,10 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On } } }, - {maxHeight: '500px', height: '100%'}, - {}, {}, true, () => {}, {padding: 0}); + overlayStyle: {maxHeight: '500px', height: '100%'}, + popoverContentStyle: {padding: 0}, + isModal: true + }); intervalsConfigPopover.tbComponentRef.instance.popoverComponent = intervalsConfigPopover; } this.cd.detectChanges(); diff --git a/ui-ngx/src/app/shared/components/time/timezone.component.ts b/ui-ngx/src/app/shared/components/time/timezone.component.ts index 78a938f53f..34e2486106 100644 --- a/ui-ngx/src/app/shared/components/time/timezone.component.ts +++ b/ui-ngx/src/app/shared/components/time/timezone.component.ts @@ -155,9 +155,13 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit { if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { - const timezoneSelectionPopover = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, TimezonePanelComponent, ['bottomRight', 'leftBottom'], true, null, - { + const timezoneSelectionPopover = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + hostView: this.viewContainerRef, + componentType: TimezonePanelComponent, + preferredPlacement: ['bottomRight', 'leftBottom'], + context: { timezone: this.modelValue, userTimezoneByDefault: this.userTimezoneByDefaultValue, localBrowserTimezonePlaceholderOnEmpty: this.localBrowserTimezonePlaceholderOnEmptyValue, @@ -173,8 +177,9 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit { } } }, - {}, - {}, {}, false); + showCloseButton: false, + isModal: true + }); timezoneSelectionPopover.tbComponentRef.instance.popoverComponent = timezoneSelectionPopover; } this.cd.detectChanges(); From 336d60268b818f5ecd5359a5fbb9afdd6ba6d93a Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 25 Mar 2025 10:56:32 +0200 Subject: [PATCH 082/286] UI: Refactoring popover model --- ui-ngx/src/app/shared/components/popover.models.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ui-ngx/src/app/shared/components/popover.models.ts b/ui-ngx/src/app/shared/components/popover.models.ts index 9fb01d1f3d..dc7e1f9ba7 100644 --- a/ui-ngx/src/app/shared/components/popover.models.ts +++ b/ui-ngx/src/app/shared/components/popover.models.ts @@ -112,11 +112,7 @@ export interface DisplayPopoverWithComponentRefConfig { isModal?: boolean; } -export const defaultPopoverConfig: DisplayPopoverWithComponentRefConfig = { - componentRef: undefined, - trigger: undefined, - renderer: undefined, - componentType: undefined, +export const defaultPopoverConfig: Partial> = { preferredPlacement: 'top', hideOnClickOutside: true, overlayStyle: {}, From 887c291deb71e26d8c743ed106afd626f3e34c84 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 25 Mar 2025 11:14:44 +0200 Subject: [PATCH 083/286] UI: Refactoring popover to use isModal setting --- .../calculated-field-arguments-table.component.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts index 945fc67ad4..512480279b 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts @@ -174,11 +174,15 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces entityHasError: this.entityNameErrorSet.has(argument.refEntityId?.id), usedArgumentNames: this.argumentsFormArray.value.map(({ argumentName }) => argumentName).filter(name => name !== argument.argumentName), }; - this.popoverComponent = this.popoverService.displayPopover(trigger, this.renderer, - this.viewContainerRef, CalculatedFieldArgumentPanelComponent, isDefined(index) ? 'left' : 'right', false, null, - ctx, - {}, - {}, {}, true); + this.popoverComponent = this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: CalculatedFieldArgumentPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: isDefined(index) ? 'left' : 'right', + context: ctx, + isModal: true + }); this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(({ value, index }) => { this.popoverComponent.hide(); const formGroup = this.fb.group(value); From f432ccc182c9fb7b1cbaac8e3b04db631bb51c7f Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 25 Mar 2025 11:49:50 +0200 Subject: [PATCH 084/286] UI: Fixed not work decline settings in advanced map settings --- .../lib/settings/map/map-widget-settings.component.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts index 221f820d68..3dc10f34cf 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts @@ -54,9 +54,17 @@ export class MapWidgetSettingsComponent extends WidgetSettingsComponent { return mergeDeepIgnoreArray({} as MapWidgetSettings, mapWidgetDefaultSettings); } + protected prepareInputSettings(settings: WidgetSettings): WidgetSettings { + return { + mapSettings: settings, + background: settings.background, + padding: settings.padding + }; + } + protected onSettingsSet(settings: WidgetSettings) { this.mapWidgetSettingsForm = this.fb.group({ - mapSettings: [settings, []], + mapSettings: [settings.mapSettings, []], background: [settings.background, []], padding: [settings.padding, []] }); From 7af6199cfc7588e8fb44b7fb275f2280f82d1f2e Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Tue, 25 Mar 2025 11:51:11 +0200 Subject: [PATCH 085/286] UI: Fixed decimals value for analogue charts --- .../home/components/widget/lib/analogue-gauge.models.ts | 5 ++--- .../gauge/analogue-gauge-widget-settings.component.ts | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts index 110d6b34a0..4b4ccce7c2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts @@ -17,7 +17,7 @@ import * as CanvasGauges from 'canvas-gauges'; import { FontSettings, getFontFamily } from '@home/components/widget/lib/settings.models'; import { WidgetContext } from '@home/models/widget-component.models'; -import { isDefined } from '@core/utils'; +import { isDefined, isDefinedAndNotNull } from '@core/utils'; import tinycolor from 'tinycolor2'; import Highlight = CanvasGauges.Highlight; import BaseGauge = CanvasGauges.BaseGauge; @@ -264,8 +264,7 @@ function getValueDec(ctx: WidgetContext, settings: AnalogueGaugeSettings): numbe if (dataKey && isDefined(dataKey.decimals)) { return dataKey.decimals; } else { - return (isDefined(settings.valueDec) && settings.valueDec !== null) - ? settings.valueDec : ctx.decimals; + return isDefinedAndNotNull(ctx.decimals) ? ctx.decimals : (settings.valueDec || 0); } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts index e30c75fe18..8836228fac 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts @@ -49,6 +49,7 @@ export class AnalogueGaugeWidgetSettingsComponent extends WidgetSettingsComponen minorTicks: 2, valueBox: true, valueInt: 3, + valueDec: 0, defaultColor: null, colorPlate: '#fff', colorMajorTicks: '#444', From 9d2c309d04a46ac3ca200718faef24239445e295 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Tue, 25 Mar 2025 11:53:53 +0200 Subject: [PATCH 086/286] Fix msa tests after docker service renaming --- .../java/org/thingsboard/server/msa/ContainerTestSuite.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ContainerTestSuite.java b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ContainerTestSuite.java index 65def6a964..f2e721bdcb 100644 --- a/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ContainerTestSuite.java +++ b/msa/black-box-tests/src/test/java/org/thingsboard/server/msa/ContainerTestSuite.java @@ -188,8 +188,8 @@ public class ContainerTestSuite { .waitingFor("tb-vc-executor1", Wait.forLogMessage(TB_VC_LOG_REGEXP, 1).withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)) .waitingFor("tb-vc-executor2", Wait.forLogMessage(TB_VC_LOG_REGEXP, 1).withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)) .waitingFor("tb-js-executor", Wait.forLogMessage(TB_JS_EXECUTOR_LOG_REGEXP, 1).withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)) - .waitingFor("tb-edqs-1", Wait.forLogMessage(TB_EDQS_LOG_REGEXP, 1).withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)) - .waitingFor("tb-edqs-2", Wait.forLogMessage(TB_EDQS_LOG_REGEXP, 1).withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)); + .waitingFor("tb-edqs1", Wait.forLogMessage(TB_EDQS_LOG_REGEXP, 1).withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)) + .waitingFor("tb-edqs2", Wait.forLogMessage(TB_EDQS_LOG_REGEXP, 1).withStartupTimeout(CONTAINER_STARTUP_TIMEOUT)); testContainer.start(); setActive(true); } catch (Exception e) { From f6ad9fed48144080082b198462bb77bbf486460c Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Tue, 25 Mar 2025 12:23:31 +0200 Subject: [PATCH 087/286] updated comment, fixed ctx data changing --- .../DefaultTbEntityDataSubscriptionService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java index 38303a2cf9..0f308d85ea 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbEntityDataSubscriptionService.java @@ -725,11 +725,12 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc update = new EntityDataUpdate(ctx.getCmdId(), ctx.getData(), null, ctx.getMaxEntitiesPerDataSubscription()); ctx.setInitialDataSent(true); } else { - // to avoid updating timeseries with empty values - List data = ctx.getData().getData().stream() - .peek(entityData -> entityData.setTimeseries(null)) + // if ctx has timeseries subscription, timeseries values are cleared after each update and is empty in ctx data, + // so to avoid sending timeseries update with empty map we set it to null + List preparedData = ctx.getData().getData().stream() + .map(entityData -> new EntityData(entityData.getEntityId(), entityData.getLatest(), null)) .toList(); - update = new EntityDataUpdate(ctx.getCmdId(), null, data, ctx.getMaxEntitiesPerDataSubscription()); + update = new EntityDataUpdate(ctx.getCmdId(), null, preparedData, ctx.getMaxEntitiesPerDataSubscription()); } ctx.sendWsMsg(update); } finally { From 16ff4e1e97cdca3068fed703b3405d1c7f246049 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Tue, 25 Mar 2025 11:51:20 +0100 Subject: [PATCH 088/286] added default debugDuration to the profileData --- .../src/main/data/upgrade/basic/schema_update.sql | 10 ++++++++++ .../install/DefaultSystemDataLoaderService.java | 4 +++- .../server/dao/tenant/TenantProfileServiceImpl.java | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/application/src/main/data/upgrade/basic/schema_update.sql b/application/src/main/data/upgrade/basic/schema_update.sql index 29c7a084f4..e91fbb823c 100644 --- a/application/src/main/data/upgrade/basic/schema_update.sql +++ b/application/src/main/data/upgrade/basic/schema_update.sql @@ -83,3 +83,13 @@ SET profile_data = profile_data WHERE profile_data->'configuration'->>'maxCalculatedFieldsPerEntity' IS NULL; -- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS END + +-- UPDATE TENANT PROFILE DEBUG DURATION START + +UPDATE tenant_profile +SET profile_data = jsonb_set(profile_data, '{configuration,maxDebugModeDurationMinutes}', '15', true) +WHERE + profile_data->'configuration' ? 'maxDebugModeDurationMinutes' = false + OR (profile_data->'configuration'->>'maxDebugModeDurationMinutes')::int = 0; + +-- UPDATE TENANT PROFILE DEBUG DURATION END diff --git a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java index 870ce3838b..49811942af 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java @@ -199,7 +199,9 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { tenantProfileService.findOrCreateDefaultTenantProfile(TenantId.SYS_TENANT_ID); TenantProfileData isolatedRuleEngineTenantProfileData = new TenantProfileData(); - isolatedRuleEngineTenantProfileData.setConfiguration(new DefaultTenantProfileConfiguration()); + DefaultTenantProfileConfiguration configuration = new DefaultTenantProfileConfiguration(); + configuration.setMaxDebugModeDurationMinutes(15); + isolatedRuleEngineTenantProfileData.setConfiguration(configuration); TenantProfileQueueConfiguration mainQueueConfiguration = new TenantProfileQueueConfiguration(); mainQueueConfiguration.setName(DataConstants.MAIN_QUEUE_NAME); diff --git a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java index 04a57c3fea..a4d613f850 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java @@ -160,7 +160,9 @@ public class TenantProfileServiceImpl extends AbstractCachedEntityService Date: Tue, 25 Mar 2025 13:01:15 +0200 Subject: [PATCH 089/286] UI: Fixed close autocomplete in LWM2M list model; Minor refactoring --- .../lwm2m/lwm2m-object-list.component.html | 2 +- .../device/lwm2m/lwm2m-object-list.component.ts | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html index 706076e3ff..d05097bd5b 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html @@ -48,7 +48,7 @@
  • - {{ 'device-profile.lwm2m.no-objects-matching' | translate:{object: truncate.transform(searchText, true, 6, '...')} }} + {{ 'device-profile.lwm2m.no-objects-matching' | translate:{object: (searchText | truncate: true: 6: '...')} }} diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts index 7ea253cd9d..01e79fcadf 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts @@ -33,8 +33,8 @@ import { DeviceProfileService } from '@core/http/device-profile.service'; import { Direction } from '@shared/models/page/sort-order'; import { isDefined, isDefinedAndNotNull, isObject, isString } from '@core/utils'; import { PageLink } from '@shared/models/page/page-link'; -import { TruncatePipe } from '@shared/pipe/truncate.pipe'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { MatAutocompleteTrigger } from '@angular/material/autocomplete'; @Component({ selector: 'tb-profile-lwm2m-object-list', @@ -79,13 +79,12 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V @Output() removeList = new EventEmitter(); - @ViewChild('objectInput') objectInput: ElementRef; + @ViewChild('objectInput', {static: true}) objectInput: ElementRef; + @ViewChild('objectInput', {static: true, read: MatAutocompleteTrigger}) matAutocompleteTrigger: MatAutocompleteTrigger; - private propagateChange = (v: any) => { - } + private propagateChange: (value: any) => void = () => {}; - constructor(public truncate: TruncatePipe, - private deviceProfileService: DeviceProfileService, + constructor(private deviceProfileService: DeviceProfileService, private fb: UntypedFormBuilder) { this.lwm2mListFormGroup = this.fb.group({ objectsList: [this.objectsList], @@ -113,7 +112,7 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V this.propagateChange = fn; } - registerOnTouched(fn: any): void { + registerOnTouched(_fn: any): void { } ngOnInit() { @@ -140,6 +139,9 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V if (isDefined(this.objectInput)) { this.clear('', false); } + if (this.matAutocompleteTrigger.panelOpen) { + this.matAutocompleteTrigger.closePanel(); + } } else { this.lwm2mListFormGroup.enable({emitEvent: false}); } From dedf3db9287dcc2a4bf1c7e0ebb0b110eb7c5ab3 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 25 Mar 2025 13:55:11 +0200 Subject: [PATCH 090/286] UI: Minor fixes. --- .../widget/lib/chart/latest-chart.ts | 60 +++++++------- .../widget/lib/chart/time-series-chart.ts | 12 +-- .../home/models/dashboard-component.models.ts | 78 ++++++++++--------- 3 files changed, 78 insertions(+), 72 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts index 13e9dd7d5e..fad0d84632 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.ts @@ -223,40 +223,42 @@ export abstract class TbLatestChart { } protected updateSeriesData(initial = false) { - this.total = 0; - this.totalText = 'N/A'; - let hasValue = false; - for (const dataItem of this.dataItems) { - if (dataItem.enabled && dataItem.hasValue) { - hasValue = true; - this.total += dataItem.value; - } - if (this.settings.showLegend) { - const legendItem = this.legendItems.find(item => item.dataKey === dataItem.dataKey); - if (dataItem.hasValue) { - legendItem.hasValue = true; - legendItem.value = formatValue(dataItem.value, this.decimals, this.units, false); - } else { - legendItem.hasValue = false; - legendItem.value = '--'; + if (!this.latestChart.isDisposed()) { + this.total = 0; + this.totalText = 'N/A'; + let hasValue = false; + for (const dataItem of this.dataItems) { + if (dataItem.enabled && dataItem.hasValue) { + hasValue = true; + this.total += dataItem.value; + } + if (this.settings.showLegend) { + const legendItem = this.legendItems.find(item => item.dataKey === dataItem.dataKey); + if (dataItem.hasValue) { + legendItem.hasValue = true; + legendItem.value = formatValue(dataItem.value, this.decimals, this.units, false); + } else { + legendItem.hasValue = false; + legendItem.value = '--'; + } } } - } - if (this.settings.showTotal || this.settings.showLegend) { - if (hasValue) { - this.totalText = formatValue(this.total, this.decimals, this.units, false); - if (this.settings.showLegend && !this.settings.showTotal) { - this.legendItems[this.legendItems.length - 1].hasValue = true; - this.legendItems[this.legendItems.length - 1].value = this.totalText; + if (this.settings.showTotal || this.settings.showLegend) { + if (hasValue) { + this.totalText = formatValue(this.total, this.decimals, this.units, false); + if (this.settings.showLegend && !this.settings.showTotal) { + this.legendItems[this.legendItems.length - 1].hasValue = true; + this.legendItems[this.legendItems.length - 1].value = this.totalText; + } + } else if (this.settings.showLegend && !this.settings.showTotal) { + this.legendItems[this.legendItems.length - 1].hasValue = false; + this.legendItems[this.legendItems.length - 1].value = '--'; } - } else if (this.settings.showLegend && !this.settings.showTotal) { - this.legendItems[this.legendItems.length - 1].hasValue = false; - this.legendItems[this.legendItems.length - 1].value = '--'; } + this.doUpdateSeriesData(); + this.latestChart.setOption(this.latestChartOption); + this.afterUpdateSeriesData(initial); } - this.doUpdateSeriesData(); - this.latestChart.setOption(this.latestChartOption); - this.afterUpdateSeriesData(initial); } private drawChart() { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts index ad121a1eb0..2b4b52ccfb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts @@ -690,12 +690,14 @@ export class TbTimeSeriesChart { } private updateSeriesData(updateScale = false): void { - this.updateSeries(); - if (updateScale && this.updateYAxisScale(this.yAxisList)) { - this.timeSeriesChartOptions.yAxis = this.yAxisList.map(axis => axis.option); + if (!this.timeSeriesChart.isDisposed()) { + this.updateSeries(); + if (updateScale && this.updateYAxisScale(this.yAxisList)) { + this.timeSeriesChartOptions.yAxis = this.yAxisList.map(axis => axis.option); + } + this.timeSeriesChart.setOption(this.timeSeriesChartOptions); + this.updateAxes(); } - this.timeSeriesChart.setOption(this.timeSeriesChartOptions); - this.updateAxes(); } private updateSeries(): void { diff --git a/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts b/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts index 458a1d1eeb..facb159af4 100644 --- a/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/dashboard-component.models.ts @@ -468,49 +468,51 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget { const resizable = item.resize; - this.heightValue = resizable.height; - this.widthValue = resizable.width; - - const setItemHeight = resizable.setItemHeight.bind(resizable); - const setItemWidth = resizable.setItemWidth.bind(resizable); - resizable.setItemHeight = (height) => { - setItemHeight(height); - this.heightValue = height; - if (this.preserveAspectRatio) { - setItemWidth(height * this.aspectRatio); - } - }; - resizable.setItemWidth = (width) => { - setItemWidth(width); - this.widthValue = width; - if (this.preserveAspectRatio) { - setItemHeight(width / this.aspectRatio); - } - }; - - Object.defineProperty(resizable, 'height', { - get: () => this.heightValue, - set: v => { - if (this.heightValue !== v) { - if (this.preserveAspectRatio) { - this.widthValue = v * this.aspectRatio; + if (resizable) { + this.heightValue = resizable.height; + this.widthValue = resizable.width; + + const setItemHeight = resizable.setItemHeight.bind(resizable); + const setItemWidth = resizable.setItemWidth.bind(resizable); + resizable.setItemHeight = (height) => { + setItemHeight(height); + this.heightValue = height; + if (this.preserveAspectRatio) { + setItemWidth(height * this.aspectRatio); + } + }; + resizable.setItemWidth = (width) => { + setItemWidth(width); + this.widthValue = width; + if (this.preserveAspectRatio) { + setItemHeight(width / this.aspectRatio); + } + }; + + Object.defineProperty(resizable, 'height', { + get: () => this.heightValue, + set: v => { + if (this.heightValue !== v) { + if (this.preserveAspectRatio) { + this.widthValue = v * this.aspectRatio; + } + this.heightValue = v; } - this.heightValue = v; } - } - }); + }); - Object.defineProperty(resizable, 'width', { - get: () => this.widthValue, - set: v => { - if (this.widthValue !== v) { - if (this.preserveAspectRatio) { - this.heightValue = v / this.aspectRatio; + Object.defineProperty(resizable, 'width', { + get: () => this.widthValue, + set: v => { + if (this.widthValue !== v) { + if (this.preserveAspectRatio) { + this.heightValue = v / this.aspectRatio; + } + this.widthValue = v; } - this.widthValue = v; } - } - }); + }); + } this.preserveAspectRatioApplied = true; } } From ace521da5b04334bb8945b5e95b891f01236e0d0 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 25 Mar 2025 16:03:19 +0200 Subject: [PATCH 091/286] UI: New maps - prevent click event on marker drag. --- .../widget/lib/maps/data-layer/markers-data-layer.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts index 99cb5a9b7d..146ace1120 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts @@ -480,10 +480,14 @@ class TbMarkerDataLayerItem extends TbLatestDataLayerItem { + (this.marker.dragging as any)._draggable = { _moved: true }; + (this.marker.dragging as any)._enabled = true; this.moving = true; }); this.marker.on('pm:dragend', () => { this.saveMarkerLocation(); + delete (this.marker.dragging as any)._draggable; + delete (this.marker.dragging as any)._enabled; this.moving = false; }); } From 4b63d929c0ec4af7756a27c267112abfc24a11b8 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 25 Mar 2025 16:24:11 +0200 Subject: [PATCH 092/286] UI: Fix markdown widget change detection. --- .../home/components/widget/lib/markdown-widget.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts index 61f5073953..10d5f9b1a0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/markdown-widget.component.ts @@ -149,7 +149,7 @@ export class MarkdownWidgetComponent extends PageComponent implements OnInit { if (this.markdownText !== markdownText) { this.markdownText = this.utils.customTranslation(markdownText, markdownText); } - this.cd.markForCheck(); + this.cd.detectChanges(); } markdownClick($event: MouseEvent) { From c50d7a3988eab8d226e0715ebc7cc0a8f47de14a Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Tue, 25 Mar 2025 16:30:21 +0200 Subject: [PATCH 093/286] EDQS consumer management refactoring --- .../KafkaCalculatedFieldStateService.java | 5 +- .../service/edqs/DefaultEdqsService.java | 3 +- .../service/edqs/KafkaEdqsSyncService.java | 3 +- .../src/main/resources/thingsboard.yml | 4 ++ .../controller/EntityQueryControllerTest.java | 3 - .../server/edqs/processor/EdqsProcessor.java | 15 ++--- .../server/edqs/repo/TenantRepo.java | 30 ++++++--- .../edqs/state/KafkaEdqsStateService.java | 48 +++++++++---- .../edqs/state/LocalEdqsStateService.java | 5 +- .../common/msg/queue/TopicPartitionInfo.java | 4 +- .../consumer/MainQueueConsumerManager.java | 14 +++- .../PartitionedQueueConsumerManager.java | 9 +-- .../consumer/TbQueueConsumerManagerTask.java | 5 +- .../common/state/KafkaQueueStateService.java | 16 ++++- .../server/queue/edqs/EdqsConfig.java | 4 ++ .../server/queue/edqs/EdqsQueue.java | 36 ---------- .../server/queue/edqs/EdqsQueueFactory.java | 8 ++- .../queue/edqs/InMemoryEdqsQueueFactory.java | 23 +++---- .../queue/edqs/KafkaEdqsQueueFactory.java | 67 +++++++++++-------- .../server/queue/kafka/TbKafkaAdmin.java | 12 ++-- .../queue/kafka/TbKafkaConsumerTemplate.java | 18 +++++ .../provider/EdqsClientQueueFactory.java | 3 +- .../InMemoryMonolithQueueFactory.java | 5 +- .../provider/KafkaMonolithQueueFactory.java | 7 +- .../provider/KafkaTbCoreQueueFactory.java | 7 +- .../KafkaTbRuleEngineQueueFactory.java | 14 ++-- edqs/src/main/resources/edqs.yml | 4 ++ 27 files changed, 216 insertions(+), 156 deletions(-) delete mode 100644 common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueue.java diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java index 90d4056afc..3620ad3639 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java @@ -97,7 +97,10 @@ public class KafkaCalculatedFieldStateService extends AbstractCalculatedFieldSta .scheduler(eventConsumer.getScheduler()) .taskExecutor(eventConsumer.getTaskExecutor()) .build(); - super.stateService = new KafkaQueueStateService<>(eventConsumer, stateConsumer); + super.stateService = KafkaQueueStateService., TbProtoQueueMsg>builder() + .eventConsumer(eventConsumer) + .stateConsumer(stateConsumer) + .build(); this.stateProducer = (TbKafkaProducerTemplate>) queueFactory.createCalculatedFieldStateProducer(); } diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java index 7d5a0cb0fd..44ca548a68 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java @@ -59,7 +59,6 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToEdqsMsg; import org.thingsboard.server.queue.discovery.HashPartitionService; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.discovery.TopicService; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.environment.DistributedLock; import org.thingsboard.server.queue.environment.DistributedLockService; import org.thingsboard.server.queue.provider.EdqsClientQueueFactory; @@ -96,7 +95,7 @@ public class DefaultEdqsService implements EdqsService { private void init() { executor = ThingsBoardExecutors.newWorkStealingPool(12, getClass()); eventsProducer = EdqsProducer.builder() - .producer(queueFactory.createEdqsMsgProducer(EdqsQueue.EVENTS)) + .producer(queueFactory.createEdqsEventsProducer()) .partitionService(edqsPartitionService) .build(); syncLock = distributedLockService.getLock("edqs_sync"); diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java b/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java index ad7b7b970d..239fd9dc42 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/KafkaEdqsSyncService.java @@ -19,7 +19,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.queue.edqs.EdqsConfig; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.kafka.TbKafkaAdmin; import org.thingsboard.server.queue.kafka.TbKafkaSettings; @@ -37,7 +36,7 @@ public class KafkaEdqsSyncService extends EdqsSyncService { TbKafkaAdmin kafkaAdmin = new TbKafkaAdmin(kafkaSettings, Collections.emptyMap()); this.syncNeeded = kafkaAdmin.areAllTopicsEmpty(IntStream.range(0, edqsConfig.getPartitions()) .mapToObj(partition -> TopicPartitionInfo.builder() - .topic(EdqsQueue.EVENTS.getTopic()) + .topic(edqsConfig.getEventsTopic()) .partition(partition) .build().getFullTopicName()) .collect(Collectors.toSet())); diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 7737f9d027..7ede65e375 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1748,6 +1748,10 @@ queue: partitions: "${TB_EDQS_PARTITIONS:12}" # EDQS partitioning strategy: tenant (partition is resolved by tenant id) or none (no specific strategy, resolving by message key) partitioning_strategy: "${TB_EDQS_PARTITIONING_STRATEGY:tenant}" + # EDQS events topic + events_topic: "${TB_EDQS_EVENTS_TOPIC:edqs.events}" + # EDQS state topic + state_topic: "${TB_EDQS_STATE_TOPIC:edqs.state}" # EDQS requests topic requests_topic: "${TB_EDQS_REQUESTS_TOPIC:edqs.requests}" # EDQS responses topic diff --git a/application/src/test/java/org/thingsboard/server/controller/EntityQueryControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/EntityQueryControllerTest.java index 011399e883..90b7ea7c7b 100644 --- a/application/src/test/java/org/thingsboard/server/controller/EntityQueryControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/EntityQueryControllerTest.java @@ -17,8 +17,6 @@ package org.thingsboard.server.controller; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; -import org.awaitility.Awaitility; -import com.fasterxml.jackson.databind.node.ObjectNode; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -73,7 +71,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; -import java.util.function.BiPredicate; import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java index fb15c3fc73..07575220eb 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java @@ -62,7 +62,6 @@ import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.edqs.EdqsComponent; import org.thingsboard.server.queue.edqs.EdqsConfig; import org.thingsboard.server.queue.edqs.EdqsConfig.EdqsPartitioningStrategy; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.edqs.EdqsQueueFactory; import org.thingsboard.server.queue.util.AfterStartUp; @@ -123,8 +122,8 @@ public class EdqsProcessor implements TbQueueHandler, }; eventConsumer = PartitionedQueueConsumerManager.>create() - .queueKey(new QueueKey(ServiceType.EDQS, EdqsQueue.EVENTS.getTopic())) - .topic(EdqsQueue.EVENTS.getTopic()) + .queueKey(new QueueKey(ServiceType.EDQS, config.getEventsTopic())) + .topic(config.getEventsTopic()) .pollInterval(config.getPollInterval()) .msgPackProcessor((msgs, consumer, config) -> { for (TbProtoQueueMsg queueMsg : msgs) { @@ -133,14 +132,14 @@ public class EdqsProcessor implements TbQueueHandler, } try { ToEdqsMsg msg = queueMsg.getValue(); - process(msg, EdqsQueue.EVENTS); + process(msg, true); } catch (Exception t) { log.error("Failed to process message: {}", queueMsg, t); } } consumer.commit(); }) - .consumerCreator((config, partitionId) -> queueFactory.createEdqsMsgConsumer(EdqsQueue.EVENTS)) + .consumerCreator((config, partitionId) -> queueFactory.createEdqsEventsConsumer()) .queueAdmin(queueFactory.getEdqsQueueAdmin()) .consumerExecutor(consumersExecutor) .taskExecutor(taskExecutor) @@ -165,7 +164,7 @@ public class EdqsProcessor implements TbQueueHandler, try { Set newPartitions = event.getNewPartitions().get(new QueueKey(ServiceType.EDQS)); - stateService.process(withTopic(newPartitions, EdqsQueue.STATE.getTopic())); + stateService.process(withTopic(newPartitions, config.getStateTopic())); // eventsConsumer's partitions are updated by stateService responseTemplate.subscribe(withTopic(newPartitions, config.getRequestsTopic())); // TODO: we subscribe to partitions before we are ready. implement consumer-per-partition version for request template @@ -235,7 +234,7 @@ public class EdqsProcessor implements TbQueueHandler, return response; } - public void process(ToEdqsMsg edqsMsg, EdqsQueue queue) { + public void process(ToEdqsMsg edqsMsg, boolean backup) { log.trace("Processing message: {}", edqsMsg); if (edqsMsg.hasEventMsg()) { EdqsEventMsg eventMsg = edqsMsg.getEventMsg(); @@ -252,7 +251,7 @@ public class EdqsProcessor implements TbQueueHandler, } else if (!ObjectType.unversionedTypes.contains(objectType)) { log.warn("[{}] {} {} doesn't have version", tenantId, objectType, key); } - if (queue != EdqsQueue.STATE) { + if (backup) { stateService.save(tenantId, objectType, key, eventType, edqsMsg); } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index 870574a786..9ef34ce129 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -150,8 +150,9 @@ public class TenantRepo { } } else if (RelationTypeGroup.DASHBOARD.equals(entity.getTypeGroup())) { if (EntityRelation.CONTAINS_TYPE.equals(entity.getType()) && entity.getFrom().getEntityType() == EntityType.CUSTOMER) { - ((CustomerData) getEntityMap(EntityType.CUSTOMER).computeIfAbsent(entity.getFrom().getId(), CustomerData::new)) - .addOrUpdate(getEntityMap(EntityType.DASHBOARD).get(entity.getTo().getId())); + CustomerData customerData = (CustomerData) getOrCreate(entity.getFrom()); + EntityData dashboardData = getOrCreate(entity.getTo()); + customerData.addOrUpdate(dashboardData); } } } finally { @@ -170,8 +171,13 @@ public class TenantRepo { } } else if (RelationTypeGroup.DASHBOARD.equals(entityRelation.getTypeGroup())) { if (EntityRelation.CONTAINS_TYPE.equals(entityRelation.getType()) && entityRelation.getFrom().getEntityType() == EntityType.CUSTOMER) { - ((CustomerData) getEntityMap(EntityType.CUSTOMER).computeIfAbsent(entityRelation.getFrom().getId(), CustomerData::new)) - .remove(getEntityMap(EntityType.DASHBOARD).get(entityRelation.getTo().getId())); + CustomerData customerData = (CustomerData) get(entityRelation.getFrom()); + if (customerData != null) { + EntityData dashboardData = get(entityRelation.getTo()); + if (dashboardData != null) { + customerData.remove(dashboardData); + } + } } } } @@ -197,13 +203,13 @@ public class TenantRepo { entityData.setCustomerId(newCustomerId); if (entityIdMismatch(oldCustomerId, newCustomerId)) { if (oldCustomerId != null) { - CustomerData old = (CustomerData) getEntityMap(EntityType.CUSTOMER).get(oldCustomerId); + CustomerData old = (CustomerData) get(EntityType.CUSTOMER, oldCustomerId); if (old != null) { old.remove(entityData); } } if (newCustomerId != null) { - CustomerData newData = (CustomerData) getEntityMap(EntityType.CUSTOMER).computeIfAbsent(newCustomerId, CustomerData::new); + CustomerData newData = (CustomerData) getOrCreate(EntityType.CUSTOMER, newCustomerId); newData.addOrUpdate(entityData); } } @@ -217,7 +223,7 @@ public class TenantRepo { try { UUID entityId = entity.getFields().getId(); EntityType entityType = entity.getType(); - EntityData removed = getEntityMap(entityType).remove(entityId); + EntityData removed = get(entityType, entityId); if (removed != null) { if (removed.getFields() != null) { getEntitySet(entityType).remove(removed); @@ -225,7 +231,7 @@ public class TenantRepo { edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.fromEntityType(entityType), EdqsEventType.DELETED)); UUID customerId = removed.getCustomerId(); if (customerId != null) { - CustomerData customerData = (CustomerData) getEntityMap(EntityType.CUSTOMER).get(customerId); + CustomerData customerData = (CustomerData) get(EntityType.CUSTOMER, customerId); if (customerData != null) { customerData.remove(removed); } @@ -303,7 +309,11 @@ public class TenantRepo { } private EntityData get(EntityId entityId) { - return getEntityMap(entityId.getEntityType()).get(entityId.getId()); + return get(entityId.getEntityType(), entityId.getId()); + } + + private EntityData get(EntityType entityType, UUID entityId) { + return getEntityMap(entityType).get(entityId); } private EntityData constructEntityData(EntityType entityType, UUID id) { @@ -425,7 +435,7 @@ public class TenantRepo { EntityType entityType = entityId.getEntityType(); return switch (entityType) { case CUSTOMER, TENANT -> { - EntityFields fields = getEntityMap(entityType).get(entityId.getId()).getFields(); + EntityFields fields = get(entityId).getFields(); yield fields != null ? fields.getName() : ""; } default -> throw new RuntimeException("Unsupported entity type: " + entityType); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java index 21515f1ad8..efdb1ead1c 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java @@ -37,10 +37,13 @@ import org.thingsboard.server.queue.common.state.KafkaQueueStateService; import org.thingsboard.server.queue.common.state.QueueStateService; import org.thingsboard.server.queue.discovery.QueueKey; import org.thingsboard.server.queue.edqs.EdqsConfig; -import org.thingsboard.server.queue.edqs.EdqsQueue; -import org.thingsboard.server.queue.edqs.EdqsQueueFactory; import org.thingsboard.server.queue.edqs.KafkaEdqsComponent; +import org.thingsboard.server.queue.edqs.KafkaEdqsQueueFactory; +import org.thingsboard.server.queue.kafka.TbKafkaAdmin; +import org.thingsboard.server.queue.kafka.TbKafkaConsumerTemplate; +import java.util.HashMap; +import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; @@ -55,7 +58,7 @@ public class KafkaEdqsStateService implements EdqsStateService { private final EdqsConfig config; private final EdqsPartitionService partitionService; - private final EdqsQueueFactory queueFactory; + private final KafkaEdqsQueueFactory queueFactory; @Autowired @Lazy private EdqsProcessor edqsProcessor; @@ -71,15 +74,16 @@ public class KafkaEdqsStateService implements EdqsStateService { @Override public void init(PartitionedQueueConsumerManager> eventConsumer) { + TbKafkaAdmin queueAdmin = queueFactory.getEdqsQueueAdmin(); stateConsumer = PartitionedQueueConsumerManager.>create() - .queueKey(new QueueKey(ServiceType.EDQS, EdqsQueue.STATE.getTopic())) - .topic(EdqsQueue.STATE.getTopic()) + .queueKey(new QueueKey(ServiceType.EDQS, config.getStateTopic())) + .topic(config.getStateTopic()) .pollInterval(config.getPollInterval()) .msgPackProcessor((msgs, consumer, config) -> { for (TbProtoQueueMsg queueMsg : msgs) { try { ToEdqsMsg msg = queueMsg.getValue(); - edqsProcessor.process(msg, EdqsQueue.STATE); + edqsProcessor.process(msg, false); if (stateReadCount.incrementAndGet() % 100000 == 0) { log.info("[state] Processed {} msgs", stateReadCount.get()); } @@ -89,15 +93,15 @@ public class KafkaEdqsStateService implements EdqsStateService { } consumer.commit(); }) - .consumerCreator((config, partitionId) -> queueFactory.createEdqsMsgConsumer(EdqsQueue.STATE, null)) // not using consumer group management - .queueAdmin(queueFactory.getEdqsQueueAdmin()) + .consumerCreator((config, partitionId) -> queueFactory.createEdqsStateConsumer()) + .queueAdmin(queueAdmin) .consumerExecutor(eventConsumer.getConsumerExecutor()) .taskExecutor(eventConsumer.getTaskExecutor()) .scheduler(eventConsumer.getScheduler()) .uncaughtErrorHandler(edqsProcessor.getErrorHandler()) .build(); - queueStateService = new KafkaQueueStateService<>(eventConsumer, stateConsumer); + TbKafkaConsumerTemplate> eventsToBackupKafkaConsumer = queueFactory.createEdqsEventsToBackupConsumer(); eventsToBackupConsumer = QueueConsumerManager.>builder() .name("edqs-events-to-backup-consumer") .pollInterval(config.getPollInterval()) @@ -135,15 +139,35 @@ public class KafkaEdqsStateService implements EdqsStateService { } consumer.commit(); }) - .consumerCreator(() -> queueFactory.createEdqsMsgConsumer(EdqsQueue.EVENTS, "events-to-backup-consumer-group")) // shared by all instances consumer group + .consumerCreator(() -> eventsToBackupKafkaConsumer) .consumerExecutor(eventConsumer.getConsumerExecutor()) .threadPrefix("edqs-events-to-backup") .build(); stateProducer = EdqsProducer.builder() - .producer(queueFactory.createEdqsMsgProducer(EdqsQueue.STATE)) + .producer(queueFactory.createEdqsStateProducer()) .partitionService(partitionService) .build(); + + queueStateService = KafkaQueueStateService., TbProtoQueueMsg>builder() + .eventConsumer(eventConsumer) + .stateConsumer(stateConsumer) + .eventsStartOffsetsProvider(() -> { + // taking start offsets for events topics from the events-to-backup consumer group, + // since eventConsumer doesn't use consumer group management and thus offset tracking + // (because we need to be able to consume the same topic-partition by multiple instances) + Map offsets = new HashMap<>(); + try { + queueAdmin.getConsumerGroupOffsets(eventsToBackupKafkaConsumer.getGroupId()) + .forEach((topicPartition, offsetAndMetadata) -> { + offsets.put(topicPartition.topic(), offsetAndMetadata.offset()); + }); + } catch (Exception e) { + log.error("Failed to get consumer group offsets for {}", eventsToBackupKafkaConsumer.getGroupId(), e); + } + return offsets; + }) + .build(); } @Override @@ -151,7 +175,7 @@ public class KafkaEdqsStateService implements EdqsStateService { if (queueStateService.getPartitions().isEmpty()) { Set allPartitions = IntStream.range(0, config.getPartitions()) .mapToObj(partition -> TopicPartitionInfo.builder() - .topic(EdqsQueue.EVENTS.getTopic()) + .topic(config.getEventsTopic()) .partition(partition) .build()) .collect(Collectors.toSet()); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/LocalEdqsStateService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/LocalEdqsStateService.java index 383115ddf1..cde21edfaf 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/LocalEdqsStateService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/LocalEdqsStateService.java @@ -29,7 +29,6 @@ import org.thingsboard.server.edqs.util.EdqsRocksDb; import org.thingsboard.server.gen.transport.TransportProtos.ToEdqsMsg; import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.common.consumer.PartitionedQueueConsumerManager; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.edqs.InMemoryEdqsComponent; import java.util.Set; @@ -61,14 +60,14 @@ public class LocalEdqsStateService implements EdqsStateService { try { ToEdqsMsg edqsMsg = ToEdqsMsg.parseFrom(value); log.trace("[{}] Restored msg from RocksDB: {}", key, edqsMsg); - processor.process(edqsMsg, EdqsQueue.STATE); + processor.process(edqsMsg, false); } catch (Exception e) { log.error("[{}] Failed to restore value", key, e); } }); log.info("Restore completed"); } - eventConsumer.update(withTopic(partitions, EdqsQueue.EVENTS.getTopic())); + eventConsumer.update(withTopic(partitions, eventConsumer.getTopic())); this.partitions = partitions; } diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfo.java b/common/message/src/main/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfo.java index f09826e9b6..b18debaf49 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfo.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfo.java @@ -90,9 +90,7 @@ public class TopicPartitionInfo { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TopicPartitionInfo that = (TopicPartitionInfo) o; - return topic.equals(that.topic) && - Objects.equals(tenantId, that.tenantId) && - Objects.equals(partition, that.partition) && + return Objects.equals(partition, that.partition) && fullTopicName.equals(that.fullTopicName); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java index 14394bbbe9..ef9728344c 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java @@ -26,6 +26,7 @@ import org.thingsboard.server.queue.TbQueueMsg; import org.thingsboard.server.queue.common.consumer.TbQueueConsumerManagerTask.UpdateConfigTask; import org.thingsboard.server.queue.common.consumer.TbQueueConsumerManagerTask.UpdatePartitionsTask; import org.thingsboard.server.queue.discovery.QueueKey; +import org.thingsboard.server.queue.kafka.TbKafkaConsumerTemplate; import java.util.Collection; import java.util.Collections; @@ -43,6 +44,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.function.BiFunction; import java.util.function.Consumer; +import java.util.function.Function; @Slf4j public class MainQueueConsumerManager { @@ -296,7 +298,7 @@ public class MainQueueConsumerManager removedPartitions) { @@ -304,13 +306,19 @@ public class MainQueueConsumerManager Optional.ofNullable(consumers.remove(tpi)).ifPresent(TbQueueConsumerTask::awaitCompletion)); } - protected void addPartitions(Set partitions, Consumer onStop) { + protected void addPartitions(Set partitions, Consumer onStop, Function startOffsetProvider) { partitions.forEach(tpi -> { Integer partitionId = tpi.getPartition().orElse(-1); String key = queueKey + "-" + partitionId; Runnable callback = onStop != null ? () -> onStop.accept(tpi) : null; - TbQueueConsumerTask consumer = new TbQueueConsumerTask<>(key, () -> consumerCreator.apply(config, partitionId), callback); + TbQueueConsumerTask consumer = new TbQueueConsumerTask<>(key, () -> { + TbQueueConsumer queueConsumer = consumerCreator.apply(config, partitionId); + if (startOffsetProvider != null && queueConsumer instanceof TbKafkaConsumerTemplate kafkaConsumer) { + kafkaConsumer.setStartOffsetProvider(startOffsetProvider); + } + return queueConsumer; + }, callback); consumers.put(tpi, consumer); consumer.subscribe(Set.of(tpi)); launchConsumer(consumer); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java index f25a98adf4..0de1e53753 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java @@ -33,6 +33,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.ScheduledExecutorService; import java.util.function.BiFunction; import java.util.function.Consumer; +import java.util.function.Function; @Slf4j public class PartitionedQueueConsumerManager extends MainQueueConsumerManager { @@ -57,7 +58,7 @@ public class PartitionedQueueConsumerManager extends MainQ protected void processTask(TbQueueConsumerManagerTask task) { if (task instanceof AddPartitionsTask addPartitionsTask) { log.info("[{}] Added partitions: {}", queueKey, addPartitionsTask.partitions()); - consumerWrapper.addPartitions(addPartitionsTask.partitions(), addPartitionsTask.onStop()); + consumerWrapper.addPartitions(addPartitionsTask.partitions(), addPartitionsTask.onStop(), addPartitionsTask.startOffsetProvider()); } else if (task instanceof RemovePartitionsTask removePartitionsTask) { log.info("[{}] Removed partitions: {}", queueKey, removePartitionsTask.partitions()); consumerWrapper.removePartitions(removePartitionsTask.partitions()); @@ -76,11 +77,11 @@ public class PartitionedQueueConsumerManager extends MainQ } public void addPartitions(Set partitions) { - addPartitions(partitions, null); + addPartitions(partitions, null, null); } - public void addPartitions(Set partitions, Consumer onStop) { - addTask(new AddPartitionsTask(partitions, onStop)); + public void addPartitions(Set partitions, Consumer onStop, Function startOffsetProvider) { + addTask(new AddPartitionsTask(partitions, onStop, startOffsetProvider)); } public void removePartitions(Set partitions) { diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/TbQueueConsumerManagerTask.java b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/TbQueueConsumerManagerTask.java index e0dd9b808b..a287a391af 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/TbQueueConsumerManagerTask.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/TbQueueConsumerManagerTask.java @@ -20,6 +20,7 @@ import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import java.util.Set; import java.util.function.Consumer; +import java.util.function.Function; public interface TbQueueConsumerManagerTask { @@ -46,7 +47,9 @@ public interface TbQueueConsumerManagerTask { } } - record AddPartitionsTask(Set partitions, Consumer onStop) implements TbQueueConsumerManagerTask { + record AddPartitionsTask(Set partitions, + Consumer onStop, + Function startOffsetProvider) implements TbQueueConsumerManagerTask { @Override public QueueTaskType getType() { return QueueTaskType.ADD_PARTITIONS; diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/common/state/KafkaQueueStateService.java b/common/queue/src/main/java/org/thingsboard/server/queue/common/state/KafkaQueueStateService.java index 9adc6bb996..bf02afe86c 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/common/state/KafkaQueueStateService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/common/state/KafkaQueueStateService.java @@ -15,13 +15,16 @@ */ package org.thingsboard.server.queue.common.state; +import lombok.Builder; import lombok.extern.slf4j.Slf4j; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.queue.TbQueueMsg; import org.thingsboard.server.queue.common.consumer.PartitionedQueueConsumerManager; import org.thingsboard.server.queue.discovery.QueueKey; +import java.util.Map; import java.util.Set; +import java.util.function.Supplier; import static org.thingsboard.server.common.msg.queue.TopicPartitionInfo.withTopic; @@ -29,14 +32,21 @@ import static org.thingsboard.server.common.msg.queue.TopicPartitionInfo.withTop public class KafkaQueueStateService extends QueueStateService { private final PartitionedQueueConsumerManager stateConsumer; + private final Supplier> eventsStartOffsetsProvider; - public KafkaQueueStateService(PartitionedQueueConsumerManager eventConsumer, PartitionedQueueConsumerManager stateConsumer) { + @Builder + public KafkaQueueStateService(PartitionedQueueConsumerManager eventConsumer, + PartitionedQueueConsumerManager stateConsumer, + Supplier> eventsStartOffsetsProvider) { super(eventConsumer); this.stateConsumer = stateConsumer; + this.eventsStartOffsetsProvider = eventsStartOffsetsProvider; } @Override protected void addPartitions(QueueKey queueKey, Set partitions) { + Map eventsStartOffsets = eventsStartOffsetsProvider != null ? eventsStartOffsetsProvider.get() : null; // remembering the offsets before subscribing to states + Set statePartitions = withTopic(partitions, stateConsumer.getTopic()); partitionsInProgress.addAll(statePartitions); stateConsumer.addPartitions(statePartitions, statePartition -> { @@ -51,12 +61,12 @@ public class KafkaQueueStateService TopicPartitionInfo eventPartition = statePartition.withTopic(eventConsumer.getTopic()); if (this.partitions.get(queueKey).contains(eventPartition)) { - eventConsumer.addPartitions(Set.of(eventPartition)); + eventConsumer.addPartitions(Set.of(eventPartition), null, eventsStartOffsets != null ? eventsStartOffsets::get : null); } } finally { readLock.unlock(); } - }); + }, null); } @Override diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java index e4e1e81815..401b451f59 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java @@ -30,6 +30,10 @@ public class EdqsConfig { @Value("#{'${queue.edqs.partitioning_strategy:tenant}'.toUpperCase()}") private EdqsPartitioningStrategy partitioningStrategy; + @Value("${queue.edqs.events_topic:edqs.events}") + private String eventsTopic; + @Value("${queue.edqs.state_topic:edqs.state}") + private String stateTopic; @Value("${queue.edqs.requests_topic:edqs.requests}") private String requestsTopic; @Value("${queue.edqs.responses_topic:edqs.responses}") diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueue.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueue.java deleted file mode 100644 index d859b50994..0000000000 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueue.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright © 2016-2025 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.queue.edqs; - -import lombok.Getter; - -@Getter -public enum EdqsQueue { - - EVENTS("edqs.events", false, false), - STATE("edqs.state", true, true); - - private final String topic; - private final boolean readFromBeginning; - private final boolean stopWhenRead; - - EdqsQueue(String topic, boolean readFromBeginning, boolean stopWhenRead) { - this.topic = topic; - this.readFromBeginning = readFromBeginning; - this.stopWhenRead = stopWhenRead; - } - -} diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueueFactory.java index b5541c740b..5c0d68779a 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsQueueFactory.java @@ -25,11 +25,13 @@ import org.thingsboard.server.queue.common.TbProtoQueueMsg; public interface EdqsQueueFactory { - TbQueueConsumer> createEdqsMsgConsumer(EdqsQueue queue); + TbQueueConsumer> createEdqsEventsConsumer(); - TbQueueConsumer> createEdqsMsgConsumer(EdqsQueue queue, String group); + TbQueueConsumer> createEdqsEventsToBackupConsumer(); - TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue); + TbQueueConsumer> createEdqsStateConsumer(); + + TbQueueProducer> createEdqsStateProducer(); TbQueueResponseTemplate, TbProtoQueueMsg> createEdqsResponseTemplate(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/InMemoryEdqsQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/InMemoryEdqsQueueFactory.java index 0801399c14..8c670e66c0 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/InMemoryEdqsQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/InMemoryEdqsQueueFactory.java @@ -43,24 +43,23 @@ public class InMemoryEdqsQueueFactory implements EdqsQueueFactory { private final TbQueueAdmin queueAdmin; @Override - public TbQueueConsumer> createEdqsMsgConsumer(EdqsQueue queue) { - if (queue == EdqsQueue.STATE) { - throw new UnsupportedOperationException(); - } - return new InMemoryTbQueueConsumer<>(storage, queue.getTopic()); + public TbQueueConsumer> createEdqsEventsConsumer() { + return new InMemoryTbQueueConsumer<>(storage, edqsConfig.getEventsTopic()); } @Override - public TbQueueConsumer> createEdqsMsgConsumer(EdqsQueue queue, String group) { - return createEdqsMsgConsumer(queue); + public TbQueueConsumer> createEdqsEventsToBackupConsumer() { + throw new UnsupportedOperationException(); } @Override - public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { - if (queue == EdqsQueue.STATE) { - throw new UnsupportedOperationException(); - } - return new InMemoryTbQueueProducer<>(storage, queue.getTopic()); + public TbQueueConsumer> createEdqsStateConsumer() { + throw new UnsupportedOperationException(); + } + + @Override + public TbQueueProducer> createEdqsStateProducer() { + throw new UnsupportedOperationException(); } @Override diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java index 6fdab28133..ab88943b10 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/KafkaEdqsQueueFactory.java @@ -19,11 +19,8 @@ import org.springframework.stereotype.Component; import org.thingsboard.common.util.ThingsBoardExecutors; import org.thingsboard.server.common.stats.StatsFactory; import org.thingsboard.server.common.stats.StatsType; -import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos.FromEdqsMsg; import org.thingsboard.server.gen.transport.TransportProtos.ToEdqsMsg; -import org.thingsboard.server.queue.TbQueueAdmin; -import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.TbQueueProducer; import org.thingsboard.server.queue.TbQueueResponseTemplate; import org.thingsboard.server.queue.common.DefaultTbQueueResponseTemplate; @@ -71,54 +68,68 @@ public class KafkaEdqsQueueFactory implements EdqsQueueFactory { } @Override - public TbQueueConsumer> createEdqsMsgConsumer(EdqsQueue queue) { - String consumerGroup = "edqs-" + queue.name().toLowerCase() + "-consumer-group-" + serviceInfoProvider.getServiceId(); - return createEdqsMsgConsumer(queue, consumerGroup); + public TbKafkaConsumerTemplate> createEdqsEventsConsumer() { + return createEdqsMsgConsumer(edqsConfig.getEventsTopic(), + "edqs-events-" + consumerCounter.getAndIncrement() + "-consumer-" + serviceInfoProvider.getServiceId(), + null, // not using consumer group management, offsets from the edqs-events-to-backup-consumer-group are used (see KafkaEdqsStateService) + false, edqsEventsAdmin); } @Override - public TbQueueConsumer> createEdqsMsgConsumer(EdqsQueue queue, String group) { + public TbKafkaConsumerTemplate> createEdqsEventsToBackupConsumer() { + return createEdqsMsgConsumer(edqsConfig.getEventsTopic(), + "edqs-events-to-backup-consumer-" + serviceInfoProvider.getServiceId(), + "edqs-events-to-backup-consumer-group", + false, edqsEventsAdmin); + } + + @Override + public TbKafkaConsumerTemplate> createEdqsStateConsumer() { + return createEdqsMsgConsumer(edqsConfig.getStateTopic(), + "edqs-state-" + consumerCounter.getAndIncrement() + "-consumer-" + serviceInfoProvider.getServiceId(), + null, // not using consumer group management + true, edqsStateAdmin); + } + + public TbKafkaConsumerTemplate> createEdqsMsgConsumer(String topic, String clientId, String group, boolean readFullAndStop, TbKafkaAdmin admin) { return TbKafkaConsumerTemplate.>builder() .settings(kafkaSettings) - .topic(topicService.buildTopicName(queue.getTopic())) - .readFromBeginning(queue.isReadFromBeginning()) - .stopWhenRead(queue.isStopWhenRead()) - .clientId("edqs-" + queue.name().toLowerCase() + "-" + consumerCounter.getAndIncrement() + "-consumer-" + serviceInfoProvider.getServiceId()) + .topic(topicService.buildTopicName(topic)) + .readFromBeginning(readFullAndStop) + .stopWhenRead(readFullAndStop) + .clientId(clientId) .groupId(topicService.buildTopicName(group)) .decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToEdqsMsg.parseFrom(msg.getData()), msg.getHeaders())) - .admin(queue == EdqsQueue.STATE ? edqsStateAdmin : edqsEventsAdmin) + .admin(admin) .statsService(consumerStatsService) .build(); } @Override - public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { + public TbQueueProducer> createEdqsStateProducer() { return TbKafkaProducerTemplate.>builder() - .clientId("edqs-" + queue.name().toLowerCase() + "-producer-" + serviceInfoProvider.getServiceId()) - .defaultTopic(topicService.buildTopicName(queue.getTopic())) + .clientId("edqs-state-producer-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(edqsConfig.getStateTopic())) .settings(kafkaSettings) - .admin(queue == EdqsQueue.STATE ? edqsStateAdmin : edqsEventsAdmin) + .admin(edqsStateAdmin) .build(); } @Override public TbQueueResponseTemplate, TbProtoQueueMsg> createEdqsResponseTemplate() { - var requestConsumer = TbKafkaConsumerTemplate.>builder() - .settings(kafkaSettings) - .topic(topicService.buildTopicName(edqsConfig.getRequestsTopic())) - .clientId("edqs-requests-consumer-" + serviceInfoProvider.getServiceId()) - .groupId(topicService.buildTopicName("edqs-requests-consumer-group")) - .decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), TransportProtos.ToEdqsMsg.parseFrom(msg.getData()), msg.getHeaders())) - .admin(edqsRequestsAdmin) - .statsService(consumerStatsService); + var requestConsumer = createEdqsMsgConsumer(edqsConfig.getRequestsTopic(), + "edqs-requests-consumer-" + serviceInfoProvider.getServiceId(), + "edqs-requests-consumer-group", + false, edqsRequestsAdmin); var responseProducer = TbKafkaProducerTemplate.>builder() .settings(kafkaSettings) .clientId("edqs-response-producer-" + serviceInfoProvider.getServiceId()) .defaultTopic(topicService.buildTopicName(edqsConfig.getResponsesTopic())) - .admin(edqsRequestsAdmin); + .admin(edqsRequestsAdmin) + .build(); return DefaultTbQueueResponseTemplate., TbProtoQueueMsg>builder() - .requestTemplate(requestConsumer.build()) - .responseTemplate(responseProducer.build()) + .requestTemplate(requestConsumer) + .responseTemplate(responseProducer) .maxPendingRequests(edqsConfig.getMaxPendingRequests()) .requestTimeout(edqsConfig.getMaxRequestTimeout()) .pollInterval(edqsConfig.getPollInterval()) @@ -128,7 +139,7 @@ public class KafkaEdqsQueueFactory implements EdqsQueueFactory { } @Override - public TbQueueAdmin getEdqsQueueAdmin() { + public TbKafkaAdmin getEdqsQueueAdmin() { return edqsEventsAdmin; } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java index 6835b44da7..37f881b49c 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java @@ -16,6 +16,7 @@ package org.thingsboard.server.queue.kafka; import lombok.Getter; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.admin.CreateTopicsResult; import org.apache.kafka.clients.admin.ListOffsetsResult; @@ -159,8 +160,7 @@ public class TbKafkaAdmin implements TbQueueAdmin { if (partitionId == null) { return; } - Map oldOffsets = - settings.getAdminClient().listConsumerGroupOffsets(fatGroupId).partitionsToOffsetAndMetadata().get(10, TimeUnit.SECONDS); + Map oldOffsets = getConsumerGroupOffsets(fatGroupId); if (oldOffsets.isEmpty()) { return; } @@ -171,8 +171,7 @@ public class TbKafkaAdmin implements TbQueueAdmin { continue; } var om = consumerOffset.getValue(); - Map newOffsets = - settings.getAdminClient().listConsumerGroupOffsets(newGroupId).partitionsToOffsetAndMetadata().get(10, TimeUnit.SECONDS); + Map newOffsets = getConsumerGroupOffsets(newGroupId); var existingOffset = newOffsets.get(tp); if (existingOffset == null) { @@ -189,6 +188,11 @@ public class TbKafkaAdmin implements TbQueueAdmin { } } + @SneakyThrows + public Map getConsumerGroupOffsets(String groupId) { + return settings.getAdminClient().listConsumerGroupOffsets(groupId).partitionsToOffsetAndMetadata().get(10, TimeUnit.SECONDS); + } + public boolean isTopicEmpty(String topic) { return areAllTopicsEmpty(Set.of(topic)); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java index 8c4ea788c6..3abed8475a 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaConsumerTemplate.java @@ -16,6 +16,8 @@ package org.thingsboard.server.queue.kafka; import lombok.Builder; +import lombok.Getter; +import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.ConsumerRebalanceListener; @@ -39,6 +41,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -53,8 +56,11 @@ public class TbKafkaConsumerTemplate extends AbstractTbQue private final TbKafkaDecoder decoder; private final TbKafkaConsumerStatsService statsService; + @Getter private final String groupId; + @Setter + private Function startOffsetProvider; private final boolean readFromBeginning; // reset offset to beginning private final boolean stopWhenRead; // stop consuming when reached end offset remembered on start private int readCount; @@ -185,9 +191,21 @@ public class TbKafkaConsumerTemplate extends AbstractTbQue private void onPartitionsAssigned(Collection partitions) { if (readFromBeginning) { + log.debug("Seeking to beginning for {}", partitions); consumer.seekToBeginning(partitions); + } else if (startOffsetProvider != null) { + partitions.forEach(topicPartition -> { + Long offset = startOffsetProvider.apply(topicPartition.topic()); + if (offset != null) { + log.debug("Seeking to offset {} for {}", offset, topicPartition); + consumer.seek(topicPartition, offset); + } else { + log.info("No start offset provided for {}", topicPartition); + } + }); } if (stopWhenRead) { + log.debug("Getting end offsets for {}", partitions); endOffsets = consumer.endOffsets(partitions).entrySet().stream() .filter(entry -> entry.getValue() > 0) .collect(Collectors.toMap(entry -> entry.getKey().partition(), Map.Entry::getValue)); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/EdqsClientQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/EdqsClientQueueFactory.java index 95be49f82b..f2309f7224 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/EdqsClientQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/EdqsClientQueueFactory.java @@ -20,11 +20,10 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToEdqsMsg; import org.thingsboard.server.queue.TbQueueProducer; import org.thingsboard.server.queue.TbQueueRequestTemplate; import org.thingsboard.server.queue.common.TbProtoQueueMsg; -import org.thingsboard.server.queue.edqs.EdqsQueue; public interface EdqsClientQueueFactory { - TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue); + TbQueueProducer> createEdqsEventsProducer(); TbQueueRequestTemplate, TbProtoQueueMsg> createEdqsRequestTemplate(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java index bd8b4bd4f8..89d83af826 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java @@ -37,7 +37,6 @@ import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.discovery.TopicService; import org.thingsboard.server.queue.edqs.EdqsConfig; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.memory.InMemoryStorage; import org.thingsboard.server.queue.memory.InMemoryTbQueueConsumer; import org.thingsboard.server.queue.memory.InMemoryTbQueueProducer; @@ -239,8 +238,8 @@ public class InMemoryMonolithQueueFactory implements TbCoreQueueFactory, TbRuleE } @Override - public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { - return new InMemoryTbQueueProducer<>(storage, queue.getTopic()); + public TbQueueProducer> createEdqsEventsProducer() { + return new InMemoryTbQueueProducer<>(storage, edqsConfig.getEventsTopic()); } @Override diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index c50344a23f..dcebe085b3 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -54,7 +54,6 @@ import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.discovery.TopicService; import org.thingsboard.server.queue.edqs.EdqsConfig; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.kafka.TbKafkaAdmin; import org.thingsboard.server.queue.kafka.TbKafkaConsumerStatsService; import org.thingsboard.server.queue.kafka.TbKafkaConsumerTemplate; @@ -590,10 +589,10 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi } @Override - public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { + public TbQueueProducer> createEdqsEventsProducer() { return TbKafkaProducerTemplate.>builder() - .clientId("edqs-producer-" + queue.name().toLowerCase() + "-" + serviceInfoProvider.getServiceId()) - .defaultTopic(topicService.buildTopicName(queue.getTopic())) + .clientId("edqs-events-producer-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(edqsConfig.getEventsTopic())) .settings(kafkaSettings) .admin(edqsEventsAdmin) .build(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java index 2a1dc4171f..e9c42b0022 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java @@ -52,7 +52,6 @@ import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.discovery.TopicService; import org.thingsboard.server.queue.edqs.EdqsConfig; -import org.thingsboard.server.queue.edqs.EdqsQueue; import org.thingsboard.server.queue.kafka.TbKafkaAdmin; import org.thingsboard.server.queue.kafka.TbKafkaConsumerStatsService; import org.thingsboard.server.queue.kafka.TbKafkaConsumerTemplate; @@ -480,10 +479,10 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { } @Override - public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { + public TbQueueProducer> createEdqsEventsProducer() { return TbKafkaProducerTemplate.>builder() - .clientId("edqs-producer-" + queue.name().toLowerCase() + "-" + serviceInfoProvider.getServiceId()) - .defaultTopic(topicService.buildTopicName(queue.getTopic())) + .clientId("edqs-events-producer-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(edqsConfig.getEventsTopic())) .settings(kafkaSettings) .admin(edqsEventsAdmin) .build(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index 2e342b0dd2..d43ef5c9ac 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -48,7 +48,7 @@ import org.thingsboard.server.queue.common.TbProtoJsQueueMsg; import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; import org.thingsboard.server.queue.discovery.TopicService; -import org.thingsboard.server.queue.edqs.EdqsQueue; +import org.thingsboard.server.queue.edqs.EdqsConfig; import org.thingsboard.server.queue.kafka.TbKafkaAdmin; import org.thingsboard.server.queue.kafka.TbKafkaConsumerStatsService; import org.thingsboard.server.queue.kafka.TbKafkaConsumerTemplate; @@ -79,6 +79,7 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { private final TbQueueTransportNotificationSettings transportNotificationSettings; private final TbQueueEdgeSettings edgeSettings; private final TbQueueCalculatedFieldSettings calculatedFieldSettings; + private final EdqsConfig edqsConfig; private final TbQueueAdmin coreAdmin; private final TbKafkaAdmin ruleEngineAdmin; @@ -101,7 +102,9 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { TbQueueRemoteJsInvokeSettings jsInvokeSettings, TbKafkaConsumerStatsService consumerStatsService, TbQueueTransportNotificationSettings transportNotificationSettings, - TbQueueEdgeSettings edgeSettings, TbQueueCalculatedFieldSettings calculatedFieldSettings, + TbQueueEdgeSettings edgeSettings, + TbQueueCalculatedFieldSettings calculatedFieldSettings, + EdqsConfig edqsConfig, TbKafkaTopicConfigs kafkaTopicConfigs) { this.topicService = topicService; this.kafkaSettings = kafkaSettings; @@ -113,6 +116,7 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { this.transportNotificationSettings = transportNotificationSettings; this.edgeSettings = edgeSettings; this.calculatedFieldSettings = calculatedFieldSettings; + this.edqsConfig = edqsConfig; this.coreAdmin = new TbKafkaAdmin(kafkaSettings, kafkaTopicConfigs.getCoreConfigs()); this.ruleEngineAdmin = new TbKafkaAdmin(kafkaSettings, kafkaTopicConfigs.getRuleEngineConfigs()); @@ -385,10 +389,10 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { } @Override - public TbQueueProducer> createEdqsMsgProducer(EdqsQueue queue) { + public TbQueueProducer> createEdqsEventsProducer() { return TbKafkaProducerTemplate.>builder() - .clientId("edqs-producer-" + queue.name().toLowerCase() + "-" + serviceInfoProvider.getServiceId()) - .defaultTopic(topicService.buildTopicName(queue.getTopic())) + .clientId("edqs-events-producer-" + serviceInfoProvider.getServiceId()) + .defaultTopic(topicService.buildTopicName(edqsConfig.getEventsTopic())) .settings(kafkaSettings) .admin(edqsEventsAdmin) .build(); diff --git a/edqs/src/main/resources/edqs.yml b/edqs/src/main/resources/edqs.yml index 05d942ff23..353d76391b 100644 --- a/edqs/src/main/resources/edqs.yml +++ b/edqs/src/main/resources/edqs.yml @@ -57,6 +57,10 @@ queue: partitions: "${TB_EDQS_PARTITIONS:12}" # EDQS partitioning strategy: tenant (partitions are resolved and distributed by tenant id) or none (partitions are resolved by message key; each instance has all the partitions) partitioning_strategy: "${TB_EDQS_PARTITIONING_STRATEGY:tenant}" + # EDQS events topic + events_topic: "${TB_EDQS_EVENTS_TOPIC:edqs.events}" + # EDQS state topic + state_topic: "${TB_EDQS_STATE_TOPIC:edqs.state}" # EDQS requests topic requests_topic: "${TB_EDQS_REQUESTS_TOPIC:edqs.requests}" # EDQS responses topic From 92466630b143cf95f2b8ed67d9e67ea147b3ddb1 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Tue, 25 Mar 2025 17:01:05 +0200 Subject: [PATCH 094/286] Refactoring for CustomerData --- .../org/thingsboard/server/edqs/data/CustomerData.java | 6 +++--- .../org/thingsboard/server/edqs/repo/TenantRepo.java | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/CustomerData.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/CustomerData.java index bf2a3f6da7..9ce300df6a 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/CustomerData.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/CustomerData.java @@ -50,10 +50,10 @@ public class CustomerData extends BaseEntityData { entitiesById.computeIfAbsent(ed.getEntityType(), et -> new ConcurrentHashMap<>()).put(ed.getId(), ed); } - public boolean remove(EntityData ed) { - var map = entitiesById.get(ed.getEntityType()); + public boolean remove(EntityType entityType, UUID entityId) { + var map = entitiesById.get(entityType); if (map != null) { - return map.remove(ed.getId()) != null; + return map.remove(entityId) != null; } else { return false; } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index 9ef34ce129..d8dec9fc4e 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -173,10 +173,7 @@ public class TenantRepo { if (EntityRelation.CONTAINS_TYPE.equals(entityRelation.getType()) && entityRelation.getFrom().getEntityType() == EntityType.CUSTOMER) { CustomerData customerData = (CustomerData) get(entityRelation.getFrom()); if (customerData != null) { - EntityData dashboardData = get(entityRelation.getTo()); - if (dashboardData != null) { - customerData.remove(dashboardData); - } + customerData.remove(EntityType.DASHBOARD, entityRelation.getTo().getId()); } } } @@ -205,7 +202,7 @@ public class TenantRepo { if (oldCustomerId != null) { CustomerData old = (CustomerData) get(EntityType.CUSTOMER, oldCustomerId); if (old != null) { - old.remove(entityData); + old.remove(entityType, entityId); } } if (newCustomerId != null) { @@ -233,7 +230,7 @@ public class TenantRepo { if (customerId != null) { CustomerData customerData = (CustomerData) get(EntityType.CUSTOMER, customerId); if (customerData != null) { - customerData.remove(removed); + customerData.remove(entityType, entityId); } } } From f0f2b30269cd1c126c99025eb668e88a2b8a1bae Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 25 Mar 2025 17:16:26 +0200 Subject: [PATCH 095/286] UI: New maps - improve markers draggable mode. --- .../widget/lib/maps/data-layer/latest-map-data-layer.ts | 2 ++ .../components/widget/lib/maps/data-layer/markers-data-layer.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/latest-map-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/latest-map-data-layer.ts index 3a537ba8e7..fb79611d71 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/latest-map-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/latest-map-data-layer.ts @@ -117,6 +117,7 @@ export abstract class TbLatestDataLayerItem { - (this.marker.dragging as any)._draggable = { _moved: true }; + (this.marker.dragging as any)._draggable = { _moved: true, off: (_args: any) => { return { disable: () => {}} } }; (this.marker.dragging as any)._enabled = true; this.moving = true; }); From 6678ec2e06652190f194a3ff403f43e83fa7a0d4 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Tue, 25 Mar 2025 17:54:20 +0200 Subject: [PATCH 096/286] Fix TopicPartitionInfoTest --- .../common/msg/queue/TopicPartitionInfoTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/message/src/test/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfoTest.java b/common/message/src/test/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfoTest.java index ec1e106dd8..f222a5a094 100644 --- a/common/message/src/test/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfoTest.java +++ b/common/message/src/test/java/org/thingsboard/server/common/msg/queue/TopicPartitionInfoTest.java @@ -18,12 +18,16 @@ package org.thingsboard.server.common.msg.queue; import org.junit.jupiter.api.Test; import org.thingsboard.server.common.data.id.TenantId; +import java.util.UUID; + import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; public class TopicPartitionInfoTest { + private final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID()); + @Test public void givenTopicPartitionInfo_whenEquals_thenTrue() { @@ -52,13 +56,13 @@ public class TopicPartitionInfoTest { assertThat(TopicPartitionInfo.builder() .topic("tb_core") - .tenantId(TenantId.SYS_TENANT_ID) + .tenantId(tenantId) .partition(4) .myPartition(true) //will ignored on equals .build() , is(TopicPartitionInfo.builder() .topic("tb_core") - .tenantId(TenantId.SYS_TENANT_ID) + .tenantId(tenantId) .partition(4) .myPartition(true) //will ignored on equals .build())); @@ -109,7 +113,7 @@ public class TopicPartitionInfoTest { assertThat(TopicPartitionInfo.builder() .topic("tb_core") - .tenantId(TenantId.SYS_TENANT_ID) + .tenantId(tenantId) .partition(4) .myPartition(true) //will ignored on equals .build() @@ -117,7 +121,7 @@ public class TopicPartitionInfoTest { assertThat(TopicPartitionInfo.builder() .topic("tb_core") - .tenantId(TenantId.SYS_TENANT_ID) + .tenantId(tenantId) .partition(4) .myPartition(false) //will ignored on equals .build() From fabf6f32351193343c20a331f344a147ef56ccc1 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Tue, 25 Mar 2025 18:28:30 +0200 Subject: [PATCH 097/286] fixed telemetry update handling for timeseries subscription --- .../DefaultTbLocalSubscriptionService.java | 8 ++--- .../service/ws/DefaultWebSocketService.java | 3 ++ .../sub/TelemetrySubscriptionUpdate.java | 1 + .../controller/TbTestWebSocketClient.java | 14 +++++++++ .../server/controller/WebsocketApiTest.java | 29 +++++++++++++++++++ 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java index 59681d3daa..165b0824f5 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java @@ -343,11 +343,9 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer s -> { TbTimeSeriesSubscription sub = (TbTimeSeriesSubscription) s; List updateData = null; - if (sub.isAllKeys()) { - updateData = data; - } else { - for (TsKvEntry kv : data) { - if (sub.getKeyStates().containsKey((kv.getKey()))) { + for (TsKvEntry kv : data) { + if (sub.getKeyStates().containsKey((kv.getKey()))) { + if (!sub.isLatestValues() || kv.getTs() > sub.getKeyStates().get(kv.getKey())) { if (updateData == null) { updateData = new ArrayList<>(); } diff --git a/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java b/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java index 7288a8bac9..c52a20754d 100644 --- a/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java +++ b/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java @@ -123,6 +123,7 @@ public class DefaultWebSocketService implements WebSocketService { private static final String FAILED_TO_FETCH_DATA = "Failed to fetch data!"; private static final String FAILED_TO_FETCH_ATTRIBUTES = "Failed to fetch attributes!"; private static final String SESSION_META_DATA_NOT_FOUND = "Session meta-data not found!"; + private static final String LATEST_TELEMETRY_SCOPE = "LATEST_TELEMETRY"; private final ConcurrentMap wsSessionsMap = new ConcurrentHashMap<>(); @@ -684,6 +685,7 @@ public class DefaultWebSocketService implements WebSocketService { .queryTs(queryTs) .allKeys(true) .keyStates(subState) + .latestValues(LATEST_TELEMETRY_SCOPE.equals(cmd.getScope())) .build(); subLock.lock(); @@ -739,6 +741,7 @@ public class DefaultWebSocketService implements WebSocketService { .queryTs(queryTs) .allKeys(false) .keyStates(subState) + .latestValues(LATEST_TELEMETRY_SCOPE.equals(cmd.getScope())) .build(); subLock.lock(); diff --git a/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java b/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java index b22b021a03..1a3046e301 100644 --- a/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java +++ b/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java @@ -16,6 +16,7 @@ package org.thingsboard.server.service.ws.telemetry.sub; import lombok.AllArgsConstructor; +import net.minidev.json.annotate.JsonIgnore; import org.thingsboard.server.common.data.kv.TsKvEntry; import org.thingsboard.server.service.subscription.SubscriptionErrorCode; diff --git a/application/src/test/java/org/thingsboard/server/controller/TbTestWebSocketClient.java b/application/src/test/java/org/thingsboard/server/controller/TbTestWebSocketClient.java index 959db43125..1c5b1dd154 100644 --- a/application/src/test/java/org/thingsboard/server/controller/TbTestWebSocketClient.java +++ b/application/src/test/java/org/thingsboard/server/controller/TbTestWebSocketClient.java @@ -31,6 +31,7 @@ import org.thingsboard.server.service.ws.AuthCmd; import org.thingsboard.server.service.ws.WsCmd; import org.thingsboard.server.service.ws.WsCommandsWrapper; import org.thingsboard.server.service.ws.telemetry.cmd.v1.AttributesSubscriptionCmd; +import org.thingsboard.server.service.ws.telemetry.cmd.v1.TimeseriesSubscriptionCmd; import org.thingsboard.server.service.ws.telemetry.cmd.v2.AlarmCountUpdate; import org.thingsboard.server.service.ws.telemetry.cmd.v2.EntityCountUpdate; import org.thingsboard.server.service.ws.telemetry.cmd.v2.EntityDataCmd; @@ -38,6 +39,7 @@ import org.thingsboard.server.service.ws.telemetry.cmd.v2.EntityDataUpdate; import org.thingsboard.server.service.ws.telemetry.cmd.v2.EntityHistoryCmd; import org.thingsboard.server.service.ws.telemetry.cmd.v2.LatestValueCmd; import org.thingsboard.server.service.ws.telemetry.cmd.v2.TimeSeriesCmd; +import org.thingsboard.server.service.ws.telemetry.sub.TelemetrySubscriptionUpdate; import java.net.URI; import java.nio.channels.NotYetConnectedException; @@ -271,6 +273,18 @@ public class TbTestWebSocketClient extends WebSocketClient { return sendEntityDataQuery(edq); } + public JsonNode sendTimeseriesCmd(EntityId entityId, String scope) { + log.warn("sendTimeseriesCmd entityId: {}, scope: {}", entityId, scope); + TimeseriesSubscriptionCmd cmd = new TimeseriesSubscriptionCmd(0, 0, 0, 10, null); + cmd.setEntityId(entityId.getId().toString()); + cmd.setEntityType(entityId.getEntityType().toString()); + cmd.setCmdId(1); + cmd.setScope(scope); + send(cmd); + String msg = this.waitForReply(); + return JacksonUtil.fromString(msg, JsonNode.class); + } + public void send(WsCmd... cmds) { WsCommandsWrapper cmdsWrapper = new WsCommandsWrapper(); cmdsWrapper.setCmds(List.of(cmds)); diff --git a/application/src/test/java/org/thingsboard/server/controller/WebsocketApiTest.java b/application/src/test/java/org/thingsboard/server/controller/WebsocketApiTest.java index 9801907d3b..3842cf917b 100644 --- a/application/src/test/java/org/thingsboard/server/controller/WebsocketApiTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/WebsocketApiTest.java @@ -68,11 +68,13 @@ import org.thingsboard.server.service.ws.telemetry.cmd.v2.AlarmStatusUpdate; import org.thingsboard.server.service.ws.telemetry.cmd.v2.EntityCountCmd; import org.thingsboard.server.service.ws.telemetry.cmd.v2.EntityCountUpdate; import org.thingsboard.server.service.ws.telemetry.cmd.v2.EntityDataUpdate; +import org.thingsboard.server.service.ws.telemetry.sub.TelemetrySubscriptionUpdate; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -584,6 +586,33 @@ public class WebsocketApiTest extends AbstractControllerTest { Assert.assertNull(msg); } + @Test + public void testTimeseriesSubscriptionCmd() throws Exception { + long now = System.currentTimeMillis() - 100; + + long lastTs = now - TimeUnit.MINUTES.toMillis(1); + TsKvEntry dataPoint1 = new BasicTsKvEntry(lastTs, new LongDataEntry("temperature", 42L)); + sendTelemetry(device, List.of(dataPoint1)); + + JsonNode update = getWsClient().sendTimeseriesCmd(device.getId(), "LATEST_TELEMETRY"); + JsonNode data = update.get("data"); + Assert.assertEquals(1, data.size()); + Assert.assertEquals(JacksonUtil.newArrayNode().add(lastTs).add("42"), data.get("temperature").get(0)); + + //Sending update from the past, while latest value has new timestamp; + TsKvEntry dataPoint4 = new BasicTsKvEntry(now - TimeUnit.MINUTES.toMillis(5), new LongDataEntry("temperature", 45L)); + getWsClient().registerWaitForUpdate(); + sendTelemetry(device, List.of(dataPoint4)); + String msg = getWsClient().waitForUpdate(TimeUnit.SECONDS.toMillis(1)); + Assert.assertNull(msg); + + //Sending duplicate update again + getWsClient().registerWaitForUpdate(); + sendTelemetry(device, List.of(dataPoint4)); + msg = getWsClient().waitForUpdate(TimeUnit.SECONDS.toMillis(1)); + Assert.assertNull(msg); + } + @Test public void testEntityDataLatestTsWsCmd() throws Exception { long now = System.currentTimeMillis(); From 7e55523465eb77e2772d578aba0a4056f08a4aaa Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 26 Mar 2025 10:29:15 +0200 Subject: [PATCH 098/286] UI: Clear getting start widget style --- .../widget/lib/home-page/getting-started-widget.component.scss | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss index 43ff26793a..a1959c74e8 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss @@ -38,9 +38,6 @@ .tb-get-started-container { flex: 1; overflow: auto; - mat-stepper { - transform: scale(1); //fixed blur content - } } } From 66fd0fc4e94f33b2d9254c2343d96d8d21d20b69 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 26 Mar 2025 11:32:26 +0200 Subject: [PATCH 099/286] Minor refactoring for Rule Engine consumers --- .../service/edqs/DefaultEdqsService.java | 9 ++-- ...faultTbCalculatedFieldConsumerService.java | 18 ++++---- .../DefaultTbRuleEngineConsumerService.java | 18 ++++---- ...bstractPartitionBasedConsumerService.java} | 43 +++++++++---------- 4 files changed, 45 insertions(+), 43 deletions(-) rename application/src/main/java/org/thingsboard/server/service/queue/processing/{AbstractConsumerPartitionedService.java => AbstractPartitionBasedConsumerService.java} (62%) diff --git a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java index 44ca548a68..cd46c4ba96 100644 --- a/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java +++ b/application/src/main/java/org/thingsboard/server/service/edqs/DefaultEdqsService.java @@ -147,9 +147,12 @@ public class DefaultEdqsService implements EdqsService { syncLock.lock(); try { EdqsSyncState syncState = getSyncState(); - if (syncState != null && syncState.getStatus() == EdqsSyncStatus.FINISHED) { - log.info("EDQS sync is already finished"); - return; + if (syncState != null) { + EdqsSyncStatus status = syncState.getStatus(); + if (status == EdqsSyncStatus.FINISHED || status == EdqsSyncStatus.FAILED) { + log.info("EDQS sync is already " + status + ", ignoring the msg"); + return; + } } saveSyncState(EdqsSyncStatus.STARTED); diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index bce1992932..125a06299d 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -54,7 +54,7 @@ import org.thingsboard.server.service.cf.CalculatedFieldCache; import org.thingsboard.server.service.cf.CalculatedFieldStateService; import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; -import org.thingsboard.server.service.queue.processing.AbstractConsumerPartitionedService; +import org.thingsboard.server.service.queue.processing.AbstractPartitionBasedConsumerService; import org.thingsboard.server.service.queue.processing.IdMsgPair; import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService; @@ -71,7 +71,7 @@ import java.util.stream.Collectors; @Service @TbRuleEngineComponent @Slf4j -public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPartitionedService implements TbCalculatedFieldConsumerService { +public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBasedConsumerService implements TbCalculatedFieldConsumerService { @Value("${queue.calculated_fields.poll_interval:25}") private long pollInterval; @@ -99,7 +99,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar } @Override - protected void doAfterStartUp() { + protected void onStartUp() { var queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME); PartitionedQueueConsumerManager> eventConsumer = PartitionedQueueConsumerManager.>create() .queueKey(queueKey) @@ -126,7 +126,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar } @Override - protected void processPartitionChangeEvent(PartitionChangeEvent event) { + protected void onPartitionChangeEvent(PartitionChangeEvent event) { try { event.getNewPartitions().forEach((queueKey, partitions) -> { if (queueKey.getQueueName().equals(DataConstants.CF_QUEUE_NAME)) { @@ -143,11 +143,6 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar } } - @Override - protected String getPrefix() { - return "tb-cf"; - } - private void processMsgs(List> msgs, TbQueueConsumer> consumer, QueueConfig config) throws Exception { List> orderedMsgList = msgs.stream().map(msg -> new IdMsgPair<>(UUID.randomUUID(), msg)).toList(); ConcurrentMap> pendingMap = orderedMsgList.stream().collect( @@ -195,6 +190,11 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar return ServiceType.TB_RULE_ENGINE; } + @Override + protected String getPrefix() { + return "tb-cf"; + } + @Override protected long getNotificationPollDuration() { return pollInterval; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java index 3a9be3874a..98f857750a 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java @@ -49,7 +49,7 @@ import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.cf.CalculatedFieldCache; import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; -import org.thingsboard.server.service.queue.processing.AbstractConsumerPartitionedService; +import org.thingsboard.server.service.queue.processing.AbstractPartitionBasedConsumerService; import org.thingsboard.server.service.queue.ruleengine.TbRuleEngineConsumerContext; import org.thingsboard.server.service.queue.ruleengine.TbRuleEngineQueueConsumerManager; import org.thingsboard.server.service.rpc.TbRuleEngineDeviceRpcService; @@ -66,7 +66,7 @@ import java.util.stream.Collectors; @Service @TbRuleEngineComponent @Slf4j -public class DefaultTbRuleEngineConsumerService extends AbstractConsumerPartitionedService implements TbRuleEngineConsumerService { +public class DefaultTbRuleEngineConsumerService extends AbstractPartitionBasedConsumerService implements TbRuleEngineConsumerService { private final TbRuleEngineConsumerContext ctx; private final QueueService queueService; @@ -93,7 +93,7 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerPartitio } @Override - protected void doAfterStartUp() { + protected void onStartUp() { List queues = queueService.findAllQueues(); for (Queue configuration : queues) { if (partitionService.isManagedByCurrentService(configuration.getTenantId())) { @@ -104,7 +104,7 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerPartitio } @Override - protected void processPartitionChangeEvent(PartitionChangeEvent event) { + protected void onPartitionChangeEvent(PartitionChangeEvent event) { event.getNewPartitions().forEach((queueKey, partitions) -> { if (DataConstants.CF_QUEUE_NAME.equals(queueKey.getQueueName()) || DataConstants.CF_STATES_QUEUE_NAME.equals(queueKey.getQueueName())) { return; @@ -136,11 +136,6 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerPartitio }); } - @Override - protected String getPrefix() { - return "tb-rule-engine"; - } - @Override protected void stopConsumers() { super.stopConsumers(); @@ -153,6 +148,11 @@ public class DefaultTbRuleEngineConsumerService extends AbstractConsumerPartitio return ServiceType.TB_RULE_ENGINE; } + @Override + protected String getPrefix() { + return "tb-rule-engine"; + } + @Override protected long getNotificationPollDuration() { return ctx.getPollDuration(); diff --git a/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerPartitionedService.java b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractPartitionBasedConsumerService.java similarity index 62% rename from application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerPartitionedService.java rename to application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractPartitionBasedConsumerService.java index 94b5390be1..97aa81d41c 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerPartitionedService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractPartitionBasedConsumerService.java @@ -31,24 +31,22 @@ import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsServ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -public abstract class AbstractConsumerPartitionedService extends AbstractConsumerService { +public abstract class AbstractPartitionBasedConsumerService extends AbstractConsumerService { - private final Lock startupLock; - private volatile boolean consumersInitialized; + private final Lock startupLock = new ReentrantLock(); + private volatile boolean started = false; private PartitionChangeEvent lastPartitionChangeEvent; - public AbstractConsumerPartitionedService(ActorSystemContext actorContext, - TbTenantProfileCache tenantProfileCache, - TbDeviceProfileCache deviceProfileCache, - TbAssetProfileCache assetProfileCache, - CalculatedFieldCache calculatedFieldCache, - TbApiUsageStateService apiUsageStateService, - PartitionService partitionService, - ApplicationEventPublisher eventPublisher, - JwtSettingsService jwtSettingsService) { + public AbstractPartitionBasedConsumerService(ActorSystemContext actorContext, + TbTenantProfileCache tenantProfileCache, + TbDeviceProfileCache deviceProfileCache, + TbAssetProfileCache assetProfileCache, + CalculatedFieldCache calculatedFieldCache, + TbApiUsageStateService apiUsageStateService, + PartitionService partitionService, + ApplicationEventPublisher eventPublisher, + JwtSettingsService jwtSettingsService) { super(actorContext, tenantProfileCache, deviceProfileCache, assetProfileCache, calculatedFieldCache, apiUsageStateService, partitionService, eventPublisher, jwtSettingsService); - this.startupLock = new ReentrantLock(); - this.consumersInitialized = false; } @PostConstruct @@ -57,13 +55,14 @@ public abstract class AbstractConsumerPartitionedService Date: Wed, 26 Mar 2025 13:24:49 +0200 Subject: [PATCH 100/286] fixed telemetry update handling for all keys --- .../DefaultTbLocalSubscriptionService.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java index 165b0824f5..627b7f8b63 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java @@ -343,13 +343,28 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer s -> { TbTimeSeriesSubscription sub = (TbTimeSeriesSubscription) s; List updateData = null; - for (TsKvEntry kv : data) { - if (sub.getKeyStates().containsKey((kv.getKey()))) { - if (!sub.isLatestValues() || kv.getTs() > sub.getKeyStates().get(kv.getKey())) { - if (updateData == null) { - updateData = new ArrayList<>(); + if (sub.isAllKeys()) { + if (sub.isLatestValues()) { + for (TsKvEntry kv : data) { + if (!sub.getKeyStates().containsKey((kv.getKey())) || kv.getTs() > sub.getKeyStates().get(kv.getKey())) { + if (updateData == null) { + updateData = new ArrayList<>(); + } + updateData.add(kv); + } + } + } else { + updateData = data; + } + } else { + for (TsKvEntry kv : data) { + if (sub.getKeyStates().containsKey((kv.getKey()))) { + if (!sub.isLatestValues() || kv.getTs() > sub.getKeyStates().get(kv.getKey())) { + if (updateData == null) { + updateData = new ArrayList<>(); + } + updateData.add(kv); } - updateData.add(kv); } } } From 2f18c8e3c985aeef590d3013cdae48c5f573a5bd Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 26 Mar 2025 12:31:48 +0100 Subject: [PATCH 101/286] minor refactoring --- .../server/service/install/DefaultSystemDataLoaderService.java | 3 ++- .../main/java/org/thingsboard/common/util/DebugModeUtil.java | 2 +- .../server/dao/tenant/TenantProfileServiceImpl.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java index 49811942af..e9ef8c5ace 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java @@ -122,6 +122,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import static org.thingsboard.common.util.DebugModeUtil.DEBUG_MODE_DEFAULT_DURATION_MINUTES; import static org.thingsboard.server.common.data.DataConstants.DEFAULT_DEVICE_TYPE; import static org.thingsboard.server.service.security.auth.jwt.settings.DefaultJwtSettingsService.isSigningKeyDefault; import static org.thingsboard.server.service.security.auth.jwt.settings.DefaultJwtSettingsService.validateKeyLength; @@ -200,7 +201,7 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { TenantProfileData isolatedRuleEngineTenantProfileData = new TenantProfileData(); DefaultTenantProfileConfiguration configuration = new DefaultTenantProfileConfiguration(); - configuration.setMaxDebugModeDurationMinutes(15); + configuration.setMaxDebugModeDurationMinutes(DEBUG_MODE_DEFAULT_DURATION_MINUTES); isolatedRuleEngineTenantProfileData.setConfiguration(configuration); TenantProfileQueueConfiguration mainQueueConfiguration = new TenantProfileQueueConfiguration(); diff --git a/common/util/src/main/java/org/thingsboard/common/util/DebugModeUtil.java b/common/util/src/main/java/org/thingsboard/common/util/DebugModeUtil.java index c4b062a0d8..1b035f61f1 100644 --- a/common/util/src/main/java/org/thingsboard/common/util/DebugModeUtil.java +++ b/common/util/src/main/java/org/thingsboard/common/util/DebugModeUtil.java @@ -22,7 +22,7 @@ import java.util.Set; public final class DebugModeUtil { - private static final int DEBUG_MODE_DEFAULT_DURATION_MINUTES = 15; + public static final int DEBUG_MODE_DEFAULT_DURATION_MINUTES = 15; private DebugModeUtil() { } diff --git a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java index a4d613f850..e165d6cfe6 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantProfileServiceImpl.java @@ -44,6 +44,7 @@ import java.util.List; import java.util.Optional; import java.util.UUID; +import static org.thingsboard.common.util.DebugModeUtil.DEBUG_MODE_DEFAULT_DURATION_MINUTES; import static org.thingsboard.server.dao.service.Validator.validateId; @Service("TenantProfileDaoService") @@ -161,7 +162,7 @@ public class TenantProfileServiceImpl extends AbstractCachedEntityService Date: Wed, 26 Mar 2025 14:42:32 +0200 Subject: [PATCH 102/286] UI: Remove unused setting --- .../src/main/data/json/system/widget_types/radial_gauge.json | 2 +- .../modules/home/components/widget/lib/analogue-gauge.models.ts | 2 +- .../settings/gauge/analogue-gauge-widget-settings.component.ts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/application/src/main/data/json/system/widget_types/radial_gauge.json b/application/src/main/data/json/system/widget_types/radial_gauge.json index ce09d31988..b463994347 100644 --- a/application/src/main/data/json/system/widget_types/radial_gauge.json +++ b/application/src/main/data/json/system/widget_types/radial_gauge.json @@ -17,7 +17,7 @@ "settingsDirective": "tb-analogue-radial-gauge-widget-settings", "hasBasicMode": true, "basicModeDirective": "tb-radial-gauge-basic-config", - "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Temp\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.7282710489093589,\"funcBody\":\"var value = prevValue + Math.random() * 50 - 25;\\nif (value < -100) {\\n\\tvalue = -100;\\n} else if (value > 100) {\\n\\tvalue = 100;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"maxValue\":100,\"startAngle\":45,\"ticksAngle\":270,\"showBorder\":true,\"defaultColor\":\"#e65100\",\"needleCircleSize\":10,\"highlights\":[],\"showUnitTitle\":true,\"colorPlate\":\"#fff\",\"colorMajorTicks\":\"#444\",\"colorMinorTicks\":\"#666\",\"minorTicks\":10,\"valueInt\":3,\"valueDec\":0,\"highlightsWidth\":15,\"valueBox\":true,\"animation\":true,\"animationDuration\":500,\"animationRule\":\"cycle\",\"colorNeedleShadowUp\":\"rgba(2, 255, 255, 0)\",\"numbersFont\":{\"family\":\"Roboto\",\"size\":18,\"style\":\"normal\",\"weight\":\"500\",\"color\":\"#616161\"},\"titleFont\":{\"family\":\"Roboto\",\"size\":24,\"style\":\"normal\",\"weight\":\"500\",\"color\":\"#888\"},\"unitsFont\":{\"family\":\"Roboto\",\"size\":22,\"style\":\"normal\",\"weight\":\"500\",\"color\":\"#616161\"},\"valueFont\":{\"family\":\"Segment7Standard\",\"size\":36,\"style\":\"normal\",\"weight\":\"normal\",\"shadowColor\":\"rgba(0, 0, 0, 0.49)\",\"color\":\"#444\"},\"minValue\":-100,\"colorNeedleShadowDown\":\"rgba(188,143,143,0.45)\",\"colorValueBoxRect\":\"#888\",\"colorValueBoxRectEnd\":\"#666\",\"colorValueBoxBackground\":\"#babab2\",\"colorValueBoxShadow\":\"rgba(0,0,0,1)\"},\"title\":\"Radial gauge\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"widgetStyle\":{},\"widgetCss\":\"\",\"pageSize\":1024,\"decimals\":0,\"noDataDisplayMessage\":\"\",\"configMode\":\"basic\"}" + "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Temp\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.7282710489093589,\"funcBody\":\"var value = prevValue + Math.random() * 50 - 25;\\nif (value < -100) {\\n\\tvalue = -100;\\n} else if (value > 100) {\\n\\tvalue = 100;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"maxValue\":100,\"startAngle\":45,\"ticksAngle\":270,\"showBorder\":true,\"defaultColor\":\"#e65100\",\"needleCircleSize\":10,\"highlights\":[],\"showUnitTitle\":true,\"colorPlate\":\"#fff\",\"colorMajorTicks\":\"#444\",\"colorMinorTicks\":\"#666\",\"minorTicks\":10,\"valueInt\":3,\"highlightsWidth\":15,\"valueBox\":true,\"animation\":true,\"animationDuration\":500,\"animationRule\":\"cycle\",\"colorNeedleShadowUp\":\"rgba(2, 255, 255, 0)\",\"numbersFont\":{\"family\":\"Roboto\",\"size\":18,\"style\":\"normal\",\"weight\":\"500\",\"color\":\"#616161\"},\"titleFont\":{\"family\":\"Roboto\",\"size\":24,\"style\":\"normal\",\"weight\":\"500\",\"color\":\"#888\"},\"unitsFont\":{\"family\":\"Roboto\",\"size\":22,\"style\":\"normal\",\"weight\":\"500\",\"color\":\"#616161\"},\"valueFont\":{\"family\":\"Segment7Standard\",\"size\":36,\"style\":\"normal\",\"weight\":\"normal\",\"shadowColor\":\"rgba(0, 0, 0, 0.49)\",\"color\":\"#444\"},\"minValue\":-100,\"colorNeedleShadowDown\":\"rgba(188,143,143,0.45)\",\"colorValueBoxRect\":\"#888\",\"colorValueBoxRectEnd\":\"#666\",\"colorValueBoxBackground\":\"#babab2\",\"colorValueBoxShadow\":\"rgba(0,0,0,1)\"},\"title\":\"Radial gauge\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"widgetStyle\":{},\"widgetCss\":\"\",\"pageSize\":1024,\"decimals\":0,\"noDataDisplayMessage\":\"\",\"configMode\":\"basic\"}" }, "resources": [ { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts index 4b4ccce7c2..1cbc41c368 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts @@ -264,7 +264,7 @@ function getValueDec(ctx: WidgetContext, settings: AnalogueGaugeSettings): numbe if (dataKey && isDefined(dataKey.decimals)) { return dataKey.decimals; } else { - return isDefinedAndNotNull(ctx.decimals) ? ctx.decimals : (settings.valueDec || 0); + return isDefinedAndNotNull(ctx.decimals) ? ctx.decimals : 0; } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts index 8836228fac..e30c75fe18 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/analogue-gauge-widget-settings.component.ts @@ -49,7 +49,6 @@ export class AnalogueGaugeWidgetSettingsComponent extends WidgetSettingsComponen minorTicks: 2, valueBox: true, valueInt: 3, - valueDec: 0, defaultColor: null, colorPlate: '#fff', colorMajorTicks: '#444', From 1ae9b01bd95164b8dd282e734c367cef24c5ccda Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 26 Mar 2025 15:46:51 +0200 Subject: [PATCH 103/286] UI: New map widgets - improve update bounds. --- .../app/modules/home/components/widget/lib/maps/map.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts index 6672941045..2b8d20c93d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts @@ -937,7 +937,13 @@ export abstract class TbMap { bounds = new L.LatLngBounds(null, null); dataLayersBounds.forEach(b => bounds.extend(b)); const mapBounds = this.map.getBounds(); - if (bounds.isValid() && (!this.bounds || !this.bounds.isValid() || (!this.bounds.equals(bounds) || force) && this.settings.fitMapBounds && !mapBounds.contains(bounds))) { + if (bounds.isValid() && + ( + (!this.bounds || !this.bounds.isValid() || (!this.bounds.equals(bounds) || force) && this.settings.fitMapBounds) + && !mapBounds.contains(bounds) + ) + ) + { this.bounds = bounds; if (!this.ignoreUpdateBounds && !this.isPlacingItem) { this.fitBounds(bounds); From 82db1ceaef3e0a8a30d6bb682d9649de86a07816 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 26 Mar 2025 15:48:18 +0200 Subject: [PATCH 104/286] UI: Fixed incorrect update date in widgets action table when switching widgets; Refactoring --- .../manage-widget-actions.component.models.ts | 11 ++-- .../action/manage-widget-actions.component.ts | 51 +++++++++---------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.models.ts b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.models.ts index 621bfd523f..c108d673d3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.models.ts @@ -21,11 +21,11 @@ import { widgetActionTypeTranslationMap } from '@app/shared/models/widget.models'; import { CollectionViewer, DataSource } from '@angular/cdk/collections'; -import { BehaviorSubject, Observable, of, ReplaySubject } from 'rxjs'; +import { BehaviorSubject, Observable, of, ReplaySubject, shareReplay } from 'rxjs'; import { emptyPageData, PageData } from '@shared/models/page/page-data'; import { TranslateService } from '@ngx-translate/core'; import { PageLink } from '@shared/models/page/page-link'; -import { catchError, map, publishReplay, refCount } from 'rxjs/operators'; +import { catchError, map } from 'rxjs/operators'; import { UtilsService } from '@core/services/utils.service'; import { deepClone } from '@core/utils'; @@ -68,11 +68,11 @@ export class WidgetActionsDatasource implements DataSource> { + connect(_collectionViewer: CollectionViewer): Observable> { return this.actionsSubject.asObservable(); } - disconnect(collectionViewer: CollectionViewer): void { + disconnect(_collectionViewer: CollectionViewer): void { this.actionsSubject.complete(); this.pageDataSubject.complete(); } @@ -115,8 +115,7 @@ export class WidgetActionsDatasource implements DataSource}; + private viewsInited = false; + private dirtyValue = false; private widgetResize$: ResizeObserver; private destroyed = false; @@ -101,15 +98,14 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni private propagateChange = (_: any) => {}; - constructor(protected store: Store, - private translate: TranslateService, + constructor(private translate: TranslateService, private utils: UtilsService, private dialog: MatDialog, private dialogs: DialogService, private cd: ChangeDetectorRef, private elementRef: ElementRef, private zone: NgZone) { - super(store); + super(); const sortOrder: SortOrder = { property: 'actionSourceName', direction: Direction.ASC }; this.pageLink = new PageLink(10, 0, null, sortOrder); this.dataSource = new WidgetActionsDatasource(this.translate, this.utils); @@ -137,7 +133,6 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni } ngAfterViewInit() { - fromEvent(this.searchInputField.nativeElement, 'keyup') .pipe( debounceTime(150), @@ -162,10 +157,9 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni this.dirtyValue = false; this.updateData(true); } - } - updateData(reload: boolean = false) { + private updateData(reload: boolean = false) { this.pageLink.page = this.paginator.pageIndex; this.pageLink.pageSize = this.paginator.pageSize; this.pageLink.sortOrder.property = this.sort.active; @@ -198,7 +192,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni this.openWidgetActionDialog($event, action); } - openWidgetActionDialog($event: Event, action: WidgetActionDescriptorInfo = null) { + private openWidgetActionDialog($event: Event, action: WidgetActionDescriptorInfo = null) { if ($event) { $event.stopPropagation(); } @@ -208,15 +202,15 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni prevActionSourceId = action.actionSourceId; } const availableActionSources: {[actionSourceId: string]: WidgetActionSource} = {}; - for (const id of Object.keys(this.innerValue.actionSources)) { - const actionSource = this.innerValue.actionSources[id]; + for (const id of Object.keys(this.actionSources)) { + const actionSource = this.actionSources[id]; if (actionSource.multiple) { availableActionSources[id] = actionSource; } else { if (!isAdd && action.actionSourceId === id) { availableActionSources[id] = actionSource; } else { - const existing = this.innerValue.actionsMap[id]; + const existing = this.actionsMap[id]; if (!existing || !existing.length) { availableActionSources[id] = actionSource; } @@ -225,7 +219,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni } const actionsData: WidgetActionsData = { - actionsMap: this.innerValue.actionsMap, + actionsMap: this.actionsMap, actionSources: availableActionSources }; @@ -277,7 +271,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni } private getOrCreateTargetActions(actionSourceId: string): Array { - const actionsMap = this.innerValue.actionsMap; + const actionsMap = this.actionsMap; let targetActions = actionsMap[actionSourceId]; if (!targetActions) { targetActions = []; @@ -323,7 +317,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni this.updateData(); } - resetSortAndFilter(update: boolean = true) { + private resetSortAndFilter(update: boolean = true) { this.pageLink.textSearch = null; this.paginator.pageIndex = 0; const sortable = this.sort.sortables.get('actionSourceName'); @@ -338,7 +332,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni this.propagateChange = fn; } - registerOnTouched(fn: any): void { + registerOnTouched(_fn: any): void { } setDisabledState(isDisabled: boolean): void { @@ -346,13 +340,14 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni } writeValue(actions?: {[actionSourceId: string]: Array}): void { - this.innerValue = { - actionsMap: actions || {}, - actionSources: this.actionSources || {} - }; + this.actionsMap = actions ?? {}; setTimeout(() => { if (!this.destroyed) { - this.dataSource.setActions(this.innerValue); + const actionData: WidgetActionsData = { + actionsMap: this.actionsMap, + actionSources: this.actionSources + }; + this.dataSource.setActions(actionData); if (this.viewsInited) { this.resetSortAndFilter(true); } else { @@ -364,6 +359,6 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni private onActionsUpdated() { this.updateData(true); - this.propagateChange(this.innerValue.actionsMap); + this.propagateChange(this.actionsMap); } } From 39e0e323e9f55080c0e9cd8bad514170e50b195a Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 26 Mar 2025 14:57:26 +0100 Subject: [PATCH 105/286] fixed vulnerabilities --- pom.xml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 72195b1e4f..eacac42e3c 100755 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ 4.0.2 2.4.0-b180830.0359 4.0.5 + 10.1.39 3.2.12 3.2.12 3.2.12 @@ -52,7 +53,7 @@ 0.12.5 2.0.13 2.23.1 - 1.5.5 + 1.5.18 0.10 4.17.0 4.2.25 @@ -88,7 +89,7 @@ 1.18.32 1.2.5 1.2.5 - 4.1.115.Final + 4.1.119.Final 2.0.65.Final 1.1.18 1.7.1 @@ -1147,6 +1148,21 @@ jaxb-runtime ${jaxb-runtime.version} + + org.apache.tomcat.embed + tomcat-embed-core + ${tomcat.version} + + + org.apache.tomcat.embed + tomcat-embed-el + ${tomcat.version} + + + org.apache.tomcat.embed + tomcat-embed-websocket + ${tomcat.version} + org.springframework.boot spring-boot-starter From b5c4ec8baa1b3110ba63af6d0e1b0194bebf9422 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 26 Mar 2025 15:31:53 +0100 Subject: [PATCH 106/286] revert logback version update --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index eacac42e3c..b25c355934 100755 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 0.12.5 2.0.13 2.23.1 - 1.5.18 + 1.5.5 0.10 4.17.0 4.2.25 From 27e54c3ae07d355299ec082967e72e338f59b953 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Wed, 26 Mar 2025 16:36:03 +0200 Subject: [PATCH 107/286] fixed tenant cache computing when partition change event --- ...aultCalculatedFieldEntityProfileCache.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java index 2f5772ae50..8a0c67ce29 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java @@ -24,14 +24,11 @@ import org.thingsboard.server.common.data.id.TenantId; 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.QueueKey; import org.thingsboard.server.queue.discovery.TbApplicationEventListener; import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.util.TbRuleEngineComponent; import java.util.Collection; -import java.util.Collections; -import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; @@ -46,15 +43,21 @@ public class DefaultCalculatedFieldEntityProfileCache extends TbApplicationEvent private static final Integer UNKNOWN = 0; private final ConcurrentMap tenantCache = new ConcurrentHashMap<>(); private final PartitionService partitionService; - private volatile List myPartitions = Collections.emptyList(); @Override protected void onTbApplicationEvent(PartitionChangeEvent event) { - myPartitions = event.getCfPartitions().stream() + var tenantPartitions = event.getCfPartitions().stream() .filter(TopicPartitionInfo::isMyPartition) - .map(tpi -> tpi.getPartition().orElse(UNKNOWN)).collect(Collectors.toList()); - //Naive approach that need to be improved. - tenantCache.values().forEach(cache -> cache.setMyPartitions(myPartitions)); + .filter(tpi -> tpi.getTenantId().isPresent()) + .collect(Collectors.groupingBy( + tpi -> tpi.getTenantId().get(), + Collectors.mapping(tpi -> tpi.getPartition().orElse(UNKNOWN), Collectors.toList()) + )); + + tenantPartitions.forEach((tenantId, partitions) -> { + var cache = tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()); + cache.setMyPartitions(partitions); + }); } @Override From 29eec5d13aff82543090c870eedbdb44b46128bf Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 26 Mar 2025 17:02:10 +0200 Subject: [PATCH 108/286] UI: New map widgets - change scale control position to bottom-right in order to avoid overlap with attribution control. --- ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts index 2b8d20c93d..c4df07336b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts @@ -176,6 +176,7 @@ export abstract class TbMap { private setupControls(): Observable { if (this.settings.scales?.length) { L.control.scale({ + position: 'bottomright', metric: this.settings.scales.includes(MapScale.metric), imperial: this.settings.scales.includes(MapScale.imperial) }).addTo(this.map); From 609ba690f5f0d53ea8a803b54dddb1860886f7dc Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 26 Mar 2025 17:06:45 +0200 Subject: [PATCH 109/286] Fixed Calculated fields creation of arguments with same name and adjustments --- .../calculated-fields-table-config.ts | 2 +- ...lated-field-arguments-table.component.html | 6 ++-- ...culated-field-arguments-table.component.ts | 36 +++++++++---------- ...lculated-field-argument-panel.component.ts | 11 +++--- ...entity-debug-settings-panel.component.html | 2 +- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index 69c0a35fb5..c5b256ea89 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -160,7 +160,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig - +
    }
    From 6888f9ed5b3f58d905538e7b22a6d57e6904b15b Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 26 Mar 2025 17:20:16 +0200 Subject: [PATCH 110/286] refactoring --- .../calculated-field-arguments-table.component.ts | 2 +- .../panel/calculated-field-argument-panel.component.ts | 2 +- ui-ngx/src/assets/locale/locale.constant-en_US.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts index faca709b17..8f7e3b9893 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts @@ -180,7 +180,7 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces ctx, {}, {}, {}, true); - this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe((value ) => { + this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(value=> { this.popoverComponent.hide(); if (isExists) { this.argumentsFormArray.at(index).setValue(value); diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts index 70cf529348..c5a7407d58 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts @@ -140,7 +140,7 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI } ngAfterViewInit(): void { - if (this.argument.refEntityId.id === NULL_UUID) { + if (this.argument.refEntityId?.id === NULL_UUID) { this.entityAutocomplete.selectEntityFormGroup.get('entity').markAsTouched(); } } diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index aa1c6dd6fb..4fd86ea533 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1000,8 +1000,8 @@ "calculated-field": "calculated field", "hint": { "main-limited": "No more than {{msg}} {{entity}} debug messages per {{time}} will be recorded.", - "on-failure": "Log all debug messages.", - "all-messages": "Log error messages only. " + "on-failure": "Log error messages only.", + "all-messages": "Log all debug messages." } }, "calculated-fields": { From 2d95b7ad5827738fdcdf299c85a1b0d7bf1bdc90 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Wed, 26 Mar 2025 17:27:58 +0200 Subject: [PATCH 111/286] added system partitons handling --- ...aultCalculatedFieldEntityProfileCache.java | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java index 8a0c67ce29..080907587e 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java @@ -28,10 +28,14 @@ import org.thingsboard.server.queue.discovery.TbApplicationEventListener; import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.util.TbRuleEngineComponent; +import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.stream.Collectors; @TbRuleEngineComponent @Service @@ -46,18 +50,32 @@ public class DefaultCalculatedFieldEntityProfileCache extends TbApplicationEvent @Override protected void onTbApplicationEvent(PartitionChangeEvent event) { - var tenantPartitions = event.getCfPartitions().stream() + Map> tenantPartitions = new HashMap<>(); + List systemPartitions = new ArrayList<>(); + + event.getCfPartitions().stream() .filter(TopicPartitionInfo::isMyPartition) - .filter(tpi -> tpi.getTenantId().isPresent()) - .collect(Collectors.groupingBy( - tpi -> tpi.getTenantId().get(), - Collectors.mapping(tpi -> tpi.getPartition().orElse(UNKNOWN), Collectors.toList()) - )); + .forEach(tpi -> { + Integer partition = tpi.getPartition().orElse(UNKNOWN); + Optional tenantIdOpt = tpi.getTenantId(); + if (tenantIdOpt.isPresent()) { + tenantPartitions.computeIfAbsent(tenantIdOpt.get(), id -> new ArrayList<>()).add(partition); + } else { + systemPartitions.add(partition); + } + }); tenantPartitions.forEach((tenantId, partitions) -> { var cache = tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()); cache.setMyPartitions(partitions); }); + + tenantCache.keySet().stream() + .filter(tenantId -> !tenantPartitions.containsKey(tenantId)) + .forEach(tenantId -> { + var cache = tenantCache.get(tenantId); + cache.setMyPartitions(systemPartitions); + }); } @Override From 8441a6bca28acc9157b456adf7ee391b445d0121 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Wed, 26 Mar 2025 17:29:06 +0200 Subject: [PATCH 112/286] code refactoring --- .../DefaultTbLocalSubscriptionService.java | 7 +- .../service/ws/DefaultWebSocketService.java | 65 ++++++++----------- .../sub/TelemetrySubscriptionUpdate.java | 1 - .../server/common/data/DataConstants.java | 2 + 4 files changed, 32 insertions(+), 43 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java index 627b7f8b63..d39c5fcb12 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java @@ -343,10 +343,11 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer s -> { TbTimeSeriesSubscription sub = (TbTimeSeriesSubscription) s; List updateData = null; + Map keyStates = sub.getKeyStates(); if (sub.isAllKeys()) { if (sub.isLatestValues()) { for (TsKvEntry kv : data) { - if (!sub.getKeyStates().containsKey((kv.getKey())) || kv.getTs() > sub.getKeyStates().get(kv.getKey())) { + if (!keyStates.containsKey((kv.getKey())) || kv.getTs() > keyStates.get(kv.getKey())) { if (updateData == null) { updateData = new ArrayList<>(); } @@ -358,8 +359,8 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer } } else { for (TsKvEntry kv : data) { - if (sub.getKeyStates().containsKey((kv.getKey()))) { - if (!sub.isLatestValues() || kv.getTs() > sub.getKeyStates().get(kv.getKey())) { + if (keyStates.containsKey((kv.getKey()))) { + if (!sub.isLatestValues() || kv.getTs() > keyStates.get(kv.getKey())) { if (updateData == null) { updateData = new ArrayList<>(); } diff --git a/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java b/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java index c52a20754d..11d962eb7c 100644 --- a/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java +++ b/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java @@ -105,6 +105,8 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.stream.Collectors; +import static org.thingsboard.server.common.data.DataConstants.LATEST_TELEMETRY_SCOPE; + /** * Created by ashvayka on 27.03.18. */ @@ -123,7 +125,6 @@ public class DefaultWebSocketService implements WebSocketService { private static final String FAILED_TO_FETCH_DATA = "Failed to fetch data!"; private static final String FAILED_TO_FETCH_ATTRIBUTES = "Failed to fetch attributes!"; private static final String SESSION_META_DATA_NOT_FOUND = "Session meta-data not found!"; - private static final String LATEST_TELEMETRY_SCOPE = "LATEST_TELEMETRY"; private final ConcurrentMap wsSessionsMap = new ConcurrentHashMap<>(); @@ -668,25 +669,7 @@ public class DefaultWebSocketService implements WebSocketService { data.forEach(v -> subState.put(v.getKey(), v.getTs())); Lock subLock = new ReentrantLock(); - TbTimeSeriesSubscription sub = TbTimeSeriesSubscription.builder() - .serviceId(serviceId) - .sessionId(sessionId) - .subscriptionId(registerNewSessionSubId(sessionId, sessionRef, cmd.getCmdId())) - .tenantId(sessionRef.getSecurityCtx().getTenantId()) - .entityId(entityId) - .updateProcessor((subscription, update) -> { - subLock.lock(); - try { - sendUpdate(subscription.getSessionId(), cmd.getCmdId(), update); - } finally { - subLock.unlock(); - } - }) - .queryTs(queryTs) - .allKeys(true) - .keyStates(subState) - .latestValues(LATEST_TELEMETRY_SCOPE.equals(cmd.getScope())) - .build(); + TbTimeSeriesSubscription sub = createTbTimeSeriesSubscription(subState, subLock, sessionId, sessionRef, cmd, entityId, queryTs, true); subLock.lock(); try { @@ -714,6 +697,28 @@ public class DefaultWebSocketService implements WebSocketService { on(r -> Futures.addCallback(tsService.findAllLatest(sessionRef.getSecurityCtx().getTenantId(), entityId), callback, executor), callback::onFailure)); } + private TbTimeSeriesSubscription createTbTimeSeriesSubscription(Map subState, Lock subLock, String sessionId, WebSocketSessionRef sessionRef, TimeseriesSubscriptionCmd cmd, EntityId entityId, long queryTs, boolean allKeys) { + return TbTimeSeriesSubscription.builder() + .serviceId(serviceId) + .sessionId(sessionId) + .subscriptionId(registerNewSessionSubId(sessionId, sessionRef, cmd.getCmdId())) + .tenantId(sessionRef.getSecurityCtx().getTenantId()) + .entityId(entityId) + .updateProcessor((subscription, update) -> { + subLock.lock(); + try { + sendUpdate(subscription.getSessionId(), cmd.getCmdId(), update); + } finally { + subLock.unlock(); + } + }) + .queryTs(queryTs) + .allKeys(allKeys) + .keyStates(subState) + .latestValues(LATEST_TELEMETRY_SCOPE.equals(cmd.getScope())) + .build(); + } + private FutureCallback> getSubscriptionCallback(final WebSocketSessionRef sessionRef, final TimeseriesSubscriptionCmd cmd, final String sessionId, final EntityId entityId, final long queryTs, final long startTs, final List keys) { return new FutureCallback<>() { @@ -724,25 +729,7 @@ public class DefaultWebSocketService implements WebSocketService { data.forEach(v -> subState.put(v.getKey(), v.getTs())); Lock subLock = new ReentrantLock(); - TbTimeSeriesSubscription sub = TbTimeSeriesSubscription.builder() - .serviceId(serviceId) - .sessionId(sessionId) - .subscriptionId(registerNewSessionSubId(sessionId, sessionRef, cmd.getCmdId())) - .tenantId(sessionRef.getSecurityCtx().getTenantId()) - .entityId(entityId) - .updateProcessor((subscription, update) -> { - subLock.lock(); - try { - sendUpdate(subscription.getSessionId(), cmd.getCmdId(), update); - } finally { - subLock.unlock(); - } - }) - .queryTs(queryTs) - .allKeys(false) - .keyStates(subState) - .latestValues(LATEST_TELEMETRY_SCOPE.equals(cmd.getScope())) - .build(); + TbTimeSeriesSubscription sub = createTbTimeSeriesSubscription(subState, subLock, sessionId, sessionRef, cmd, entityId, queryTs, false); subLock.lock(); try { diff --git a/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java b/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java index 1a3046e301..b22b021a03 100644 --- a/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java +++ b/application/src/main/java/org/thingsboard/server/service/ws/telemetry/sub/TelemetrySubscriptionUpdate.java @@ -16,7 +16,6 @@ package org.thingsboard.server.service.ws.telemetry.sub; import lombok.AllArgsConstructor; -import net.minidev.json.annotate.JsonIgnore; import org.thingsboard.server.common.data.kv.TsKvEntry; import org.thingsboard.server.service.subscription.SubscriptionErrorCode; diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java b/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java index b53d6daec2..b2d9d59cca 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java @@ -148,4 +148,6 @@ public class DataConstants { public static final String CF_QUEUE_NAME = "CalculatedFields"; public static final String CF_STATES_QUEUE_NAME = "CalculatedFieldStates"; + public static final String LATEST_TELEMETRY_SCOPE = "LATEST_TELEMETRY"; + } From 78d59a99355554ff24ce1409a724f5445689c2d5 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Wed, 26 Mar 2025 17:35:36 +0200 Subject: [PATCH 113/286] method renamed --- .../server/service/ws/DefaultWebSocketService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java b/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java index 11d962eb7c..2e4fe9730a 100644 --- a/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java +++ b/application/src/main/java/org/thingsboard/server/service/ws/DefaultWebSocketService.java @@ -669,7 +669,7 @@ public class DefaultWebSocketService implements WebSocketService { data.forEach(v -> subState.put(v.getKey(), v.getTs())); Lock subLock = new ReentrantLock(); - TbTimeSeriesSubscription sub = createTbTimeSeriesSubscription(subState, subLock, sessionId, sessionRef, cmd, entityId, queryTs, true); + TbTimeSeriesSubscription sub = getTsSubscription(subState, subLock, sessionId, sessionRef, cmd, entityId, queryTs, true); subLock.lock(); try { @@ -697,7 +697,7 @@ public class DefaultWebSocketService implements WebSocketService { on(r -> Futures.addCallback(tsService.findAllLatest(sessionRef.getSecurityCtx().getTenantId(), entityId), callback, executor), callback::onFailure)); } - private TbTimeSeriesSubscription createTbTimeSeriesSubscription(Map subState, Lock subLock, String sessionId, WebSocketSessionRef sessionRef, TimeseriesSubscriptionCmd cmd, EntityId entityId, long queryTs, boolean allKeys) { + private TbTimeSeriesSubscription getTsSubscription(Map subState, Lock subLock, String sessionId, WebSocketSessionRef sessionRef, TimeseriesSubscriptionCmd cmd, EntityId entityId, long queryTs, boolean allKeys) { return TbTimeSeriesSubscription.builder() .serviceId(serviceId) .sessionId(sessionId) @@ -729,7 +729,7 @@ public class DefaultWebSocketService implements WebSocketService { data.forEach(v -> subState.put(v.getKey(), v.getTs())); Lock subLock = new ReentrantLock(); - TbTimeSeriesSubscription sub = createTbTimeSeriesSubscription(subState, subLock, sessionId, sessionRef, cmd, entityId, queryTs, false); + TbTimeSeriesSubscription sub = getTsSubscription(subState, subLock, sessionId, sessionRef, cmd, entityId, queryTs, false); subLock.lock(); try { From ef27e33d03aea4924e487e52408ecb87ef7f8e2a Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Wed, 26 Mar 2025 17:41:31 +0200 Subject: [PATCH 114/286] implemented compare for BoolDataPoint --- .../server/edqs/data/dp/AbstractDataPoint.java | 15 ++------------- .../server/edqs/data/dp/BoolDataPoint.java | 5 +++++ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java index 5cd2c562ca..1fdb731af6 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/AbstractDataPoint.java @@ -17,6 +17,7 @@ package org.thingsboard.server.edqs.data.dp; import lombok.Getter; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.thingsboard.server.common.data.edqs.DataPoint; @RequiredArgsConstructor @@ -56,19 +57,7 @@ public abstract class AbstractDataPoint implements DataPoint { @Override public int compareTo(DataPoint dataPoint) { - String str1 = this.valueToString(); - String str2 = dataPoint.valueToString(); - - if (str1 == null && str2 == null) { - return 0; - } - if (str1 == null) { - return -1; - } - if (str2 == null) { - return 1; - } - return str1.compareToIgnoreCase(str2); + return StringUtils.compareIgnoreCase(valueToString(), dataPoint.valueToString()); } } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/BoolDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/BoolDataPoint.java index 83d91d8f75..70a14917ba 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/BoolDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/BoolDataPoint.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edqs.data.dp; import lombok.Getter; +import org.thingsboard.server.common.data.edqs.DataPoint; import org.thingsboard.server.common.data.kv.DataType; public class BoolDataPoint extends AbstractDataPoint { @@ -43,4 +44,8 @@ public class BoolDataPoint extends AbstractDataPoint { return Boolean.toString(value); } + @Override + public int compareTo(DataPoint dataPoint) { + return Boolean.compare(value, dataPoint.getBool()); + } } From 6a5e57566ef4503c4112d5594c8bab851406b634 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Wed, 26 Mar 2025 18:47:56 +0200 Subject: [PATCH 115/286] fixed telemetry deletion --- .../calculatedField/CalculatedFieldEntityMessageProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java index 93214e4403..db65248a8f 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldEntityMessageProcessor.java @@ -422,7 +422,7 @@ public class CalculatedFieldEntityMessageProcessor extends AbstractContextAwareM private Map mapToArgumentsWithFetchedValue(CalculatedFieldCtx ctx, List removedTelemetryKeys) { Map deletedArguments = ctx.getArguments().entrySet().stream() - .filter(entry -> removedTelemetryKeys.contains(entry.getKey())) + .filter(entry -> removedTelemetryKeys.contains(entry.getValue().getRefEntityKey().getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); Map fetchedArgs = cfService.fetchArgsFromDb(tenantId, entityId, deletedArguments); From 3005b5bf8fc576fa6e4cb9832373eb063f98690b Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 27 Mar 2025 07:31:42 +0200 Subject: [PATCH 116/286] UI: Backward compatibility for header icon button action --- .../action/manage-widget-actions-dialog.component.html | 1 + .../widget/action/manage-widget-actions-dialog.component.ts | 1 + .../widget/action/manage-widget-actions.component.ts | 3 +++ .../widget/action/widget-action-dialog.component.ts | 6 +++++- .../config/basic/common/widget-actions-panel.component.ts | 1 + .../home/components/widget/widget-config.component.html | 1 + .../app/modules/home/components/widget/widget.component.ts | 2 +- 7 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.html index 3d88f08c8d..2376e52a64 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.html @@ -33,6 +33,7 @@ [callbacks]="data.callbacks" [widgetType] = "data.widgetType" [actionSources]="actionSources" + [defaultIconColor]="data.defaultIconColor" [additionalWidgetActionTypes]="data.additionalWidgetActionTypes" formControlName="actions"> diff --git a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.ts index bc3de16c69..067eb74166 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions-dialog.component.ts @@ -32,6 +32,7 @@ export interface ManageWidgetActionsDialogData { actionsData: WidgetActionsData; callbacks: WidgetActionCallbacks; widgetType: widgetType; + defaultIconColor?: string; additionalWidgetActionTypes?: WidgetActionType[]; } diff --git a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts index 730be78656..f555aeb2b2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.ts @@ -73,6 +73,8 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni @Input() widgetType: widgetType; + @Input() defaultIconColor: string; + @Input() callbacks: WidgetActionCallbacks; @Input() actionSources: {[actionSourceId: string]: WidgetActionSource}; @@ -239,6 +241,7 @@ export class ManageWidgetActionsComponent extends PageComponent implements OnIni actionsData, action: deepClone(action), widgetType: this.widgetType, + defaultIconColor: this.defaultIconColor, additionalWidgetActionTypes: this.additionalWidgetActionTypes } }).afterClosed().subscribe( diff --git a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts index b77b5c860f..7a74624774 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.ts @@ -61,6 +61,7 @@ export interface WidgetActionDialogData { actionsData: WidgetActionsData; action?: WidgetActionDescriptorInfo; widgetType: widgetType; + defaultIconColor?: string; additionalWidgetActionTypes?: WidgetActionType[]; } @@ -78,6 +79,8 @@ export class WidgetActionDialogComponent extends DialogComponent diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index f8fa032c8c..a15da83a28 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -365,7 +365,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, headerButtonStyle(buttonType: WidgetHeaderActionButtonType = WidgetHeaderActionButtonType.icon, customButtonStyle:{[key: string]: string}, - buttonColor: string = 'rgba(0,0,0,0.87)', + buttonColor: string = this.widget.config.color, backgroundColor: string, borderColor: string) { const buttonStyle = {}; From eccebac5cf3de14eb27629137fd03f5feec7a0b5 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 27 Mar 2025 09:05:08 +0200 Subject: [PATCH 117/286] UI: Fixed wind turbine cluster scada symbol --- .../data/json/system/scada_symbols/wind-turbine-cluster-hp.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg b/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg index 74855dd35a..746ca9f1aa 100644 --- a/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg +++ b/application/src/main/data/json/system/scada_symbols/wind-turbine-cluster-hp.svg @@ -349,7 +349,7 @@ - + From de10a97fabe0fbf2db6f26d93e089afa6ef96062 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 26 Mar 2025 16:20:54 +0200 Subject: [PATCH 118/286] UI: Fixed place map item action on multiple header button clicks --- ui-ngx/src/app/core/api/widget-api.models.ts | 2 +- .../home/components/widget/lib/maps/map.ts | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/core/api/widget-api.models.ts b/ui-ngx/src/app/core/api/widget-api.models.ts index 7d0f091739..d5f1b45a82 100644 --- a/ui-ngx/src/app/core/api/widget-api.models.ts +++ b/ui-ngx/src/app/core/api/widget-api.models.ts @@ -91,7 +91,7 @@ export interface IWidgetUtils { } export interface PlaceMapItemActionData { - action: WidgetAction; + action: WidgetAction | WidgetActionDescriptor; additionalParams?: any; afterPlaceItemCallback: ($event: Event, descriptor: WidgetAction, entityId?: EntityId, entityName?: string, additionalParams?: any, entityLabel?: string) => void; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts index 6672941045..70433f7999 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts @@ -133,6 +133,7 @@ export abstract class TbMap { private currentEditButton: L.TB.ToolbarButton; private dragMode = true; + private createMapItemActionId: string; private get isPlacingItem(): boolean { return !!this.currentEditButton; @@ -685,9 +686,14 @@ export abstract class TbMap { } private createItem(actionData: PlaceMapItemActionData, prepareDrawMode: () => void) { - if (this.isPlacingItem) { + const actionId = 'id' in actionData.action ? actionData.action.id : 'map-button'; + if (this.createMapItemActionId === actionId) { + this.finishCreatedItem(); return; } + if (isDefined(this.createMapItemActionId)) { + this.finishCreatedItem(); + } this.updatePlaceItemState(actionData.additionalParams?.button, true); this.map.once('pm:create', (e) => { @@ -700,7 +706,7 @@ export abstract class TbMap { // @ts-ignore e.layer._pmTempLayer = true; e.layer.remove(); - this.finishAdd(); + this.finishCreatedItem(); }); prepareDrawMode(); @@ -713,10 +719,12 @@ export abstract class TbMap { iconClass: 'tb-close', title: this.ctx.translate.instant('action.cancel'), showText: true, - click: this.finishAdd + click: this.finishCreatedItem } ], false); + this.createMapItemActionId = actionId; + const convertLayerToCoordinates = (type: MapItemType, layer: L.Layer): {x: number; y: number} | TbPolygonRawCoordinates | TbCircleData => { switch (type) { case MapItemType.marker: @@ -748,6 +756,11 @@ export abstract class TbMap { } } + private finishCreatedItem = () => { + delete this.createMapItemActionId; + this.finishAdd(); + } + private finishAdd = () => { if (this.currentPopover) { this.currentPopover.hide(); From f74ca2fb971a3213dd6805dfd766c61dafc0c5f2 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 27 Mar 2025 11:16:06 +0200 Subject: [PATCH 119/286] Optimized entities map --- ...culated-field-arguments-table.component.ts | 65 +++++++++++++------ ...ulated-field-argument-panel.component.html | 1 + ...lculated-field-argument-panel.component.ts | 14 +++- .../shared/models/calculated-field.models.ts | 1 + 4 files changed, 57 insertions(+), 24 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts index 8f7e3b9893..02b258b90e 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts @@ -49,7 +49,7 @@ import { TbPopoverService } from '@shared/components/popover.service'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { EntityId } from '@shared/models/id/entity-id'; import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; -import { getEntityDetailsPageURL, isDefined, isDefinedAndNotNull, isEqual } from '@core/utils'; +import { getEntityDetailsPageURL, isEqual } from '@core/utils'; import { TbPopoverComponent } from '@shared/components/popover.component'; import { TbTableDatasource } from '@shared/components/table/table-datasource.abstract'; import { EntityService } from '@core/http/entity.service'; @@ -57,9 +57,9 @@ import { MatSort } from '@angular/material/sort'; import { getCurrentAuthState } from '@core/auth/auth.selectors'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; -import { catchError } from 'rxjs/operators'; -import { NEVER } from 'rxjs'; +import { forkJoin, Observable } from 'rxjs'; import { NULL_UUID } from '@shared/models/id/has-uuid'; +import { BaseData } from '@shared/models/base-data'; @Component({ selector: 'tb-calculated-field-arguments-table', @@ -115,7 +115,6 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces private store: Store ) { this.argumentsFormArray.valueChanges.pipe(takeUntilDestroyed()).subscribe(value => { - this.updateEntityNameMap(value); this.updateDataSource(value); this.propagateChange(this.getArgumentsObject(value)); }); @@ -180,8 +179,11 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces ctx, {}, {}, {}, true); - this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(value=> { + this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(({ entityName, ...value }) => { this.popoverComponent.hide(); + if (entityName) { + this.entityNameMap.set(value.refEntityId.id, entityName); + } if (isExists) { this.argumentsFormArray.at(index).setValue(value); } else { @@ -220,7 +222,8 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces writeValue(argumentsObj: Record): void { this.argumentsFormArray.clear(); - this.populateArgumentsFormArray(argumentsObj) + this.populateArgumentsFormArray(argumentsObj); + this.updateEntityNameMap(this.argumentsFormArray.value); } getEntityDetailsPageURL(id: string, type: EntityType): string { @@ -238,23 +241,43 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces this.argumentsFormArray.updateValueAndValidity(); } - private updateEntityNameMap(value: CalculatedFieldArgumentValue[]): void { - value.forEach(({ refEntityId = {}}) => { - if (refEntityId.id && !this.entityNameMap.has(refEntityId.id)) { + private updateEntityNameMap(values: CalculatedFieldArgumentValue[]): void { + const entitiesByType = values.reduce((acc, { refEntityId = {}}) => { + if (refEntityId.id && refEntityId.entityType !== ArgumentEntityType.Tenant) { const { id, entityType } = refEntityId as EntityId; - this.entityService.getEntity(entityType as EntityType, id, { ignoreLoading: true, ignoreErrors: true }) - .pipe( - catchError(() => { - const control = this.argumentsFormArray.controls.find(control => control.value.refEntityId?.id === id); - control.setValue({ ...control.value, refEntityId: { ...control.value.refEntityId, id: NULL_UUID } }); - - return NEVER; - }), - takeUntilDestroyed(this.destroyRef) - ) - .subscribe(entity => this.entityNameMap.set(id, entity.name)); + acc[entityType] = acc[entityType] ?? []; + acc[entityType].push(id); } - }); + return acc; + }, {} as Record); + const tasks = Object.entries(entitiesByType).map(([entityType, ids]) => + this.entityService.getEntities(entityType as EntityType, ids) + ); + if (!tasks.length) { + return; + } + this.fetchEntityNames(tasks, values); + } + + private fetchEntityNames(tasks: Observable[]>[], values: CalculatedFieldArgumentValue[]): void { + forkJoin(tasks as Observable[]>[]) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((result: Array>[]) => { + result.forEach((entities: BaseData[]) => entities.forEach((entity: BaseData) => this.entityNameMap.set(entity.id.id, entity.name))); + let updateTable = false; + values.forEach(({ refEntityId }) => { + if (refEntityId?.id && !this.entityNameMap.has(refEntityId.id) && refEntityId.entityType !== ArgumentEntityType.Tenant) { + updateTable = true; + const control = this.argumentsFormArray.controls.find(control => control.value.refEntityId?.id === refEntityId.id); + const value = control.value; + value.refEntityId.id = NULL_UUID; + control.setValue(value, { emitEvent: false }); + } + }); + if (updateTable) { + this.argumentsFormArray.updateValueAndValidity(); + } + }); } private getSortValue(argument: CalculatedFieldArgumentValue, column: string): string { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html index 15286af377..7521395cb4 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html @@ -88,6 +88,7 @@ [placeholder]="'action.set' | translate" [required]="true" [entityType]="ArgumentEntityTypeParamsMap.get(entityType).entityType" + (entityChanged)="entityNameSubject.next($event?.name)" />
    } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts index c5a7407d58..2a64c90f20 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts @@ -36,7 +36,7 @@ import { EntityId } from '@shared/models/id/entity-id'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { EntityFilter } from '@shared/models/query/query.models'; import { AliasFilterType } from '@shared/models/alias.models'; -import { merge } from 'rxjs'; +import { BehaviorSubject, merge } from 'rxjs'; import { MINUTE } from '@shared/models/time/time.models'; import { getCurrentAuthState } from '@core/auth/auth.selectors'; import { AppState } from '@core/core.state'; @@ -84,6 +84,7 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI argumentTypes: ArgumentType[]; entityFilter: EntityFilter; + entityNameSubject = new BehaviorSubject(null); readonly argumentEntityTypes = Object.values(ArgumentEntityType) as ArgumentEntityType[]; readonly ArgumentEntityTypeTranslations = ArgumentEntityTypeTranslations; @@ -151,6 +152,9 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI if (refEntityId.entityType === ArgumentEntityType.Tenant) { refEntityId.id = this.tenantId; } + if (refEntityId.entityType !== ArgumentEntityType.Current && refEntityId.entityType !== ArgumentEntityType.Tenant) { + value.entityName = this.entityNameSubject.value; + } if (value.defaultValue) { value.defaultValue = value.defaultValue.trim(); } @@ -211,12 +215,16 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI } private observeEntityTypeChanges(): void { - this.argumentFormGroup.get('refEntityId').get('entityType').valueChanges + this.refEntityIdFormGroup.get('entityType').valueChanges .pipe(distinctUntilChanged(), takeUntilDestroyed()) .subscribe(type => { this.argumentFormGroup.get('refEntityId').get('id').setValue(''); + const isEntityWithId = type !== ArgumentEntityType.Tenant && type !== ArgumentEntityType.Current; this.argumentFormGroup.get('refEntityId') - .get('id')[type === ArgumentEntityType.Tenant || type === ArgumentEntityType.Current ? 'disable' : 'enable'](); + .get('id')[isEntityWithId ? 'enable' : 'disable'](); + if (!isEntityWithId) { + this.entityNameSubject.next(null); + } if (!this.enableAttributeScopeSelection) { this.refEntityKeyFormGroup.get('scope').setValue(AttributeScope.SERVER_SCOPE); } diff --git a/ui-ngx/src/app/shared/models/calculated-field.models.ts b/ui-ngx/src/app/shared/models/calculated-field.models.ts index 383f7c7f72..9cc9a62da8 100644 --- a/ui-ngx/src/app/shared/models/calculated-field.models.ts +++ b/ui-ngx/src/app/shared/models/calculated-field.models.ts @@ -144,6 +144,7 @@ export interface RefEntityId { export interface CalculatedFieldArgumentValue extends CalculatedFieldArgument { argumentName: string; + entityName?: string; } export type CalculatedFieldTestScriptFn = (calculatedField: CalculatedField, argumentsObj?: Record, closeAllOnSave?: boolean) => Observable; From 131e96a575951f1d38baf8b16547f2fd451cc458 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 27 Mar 2025 11:22:59 +0200 Subject: [PATCH 120/286] refatoring --- .../calculated-field-arguments-table.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts index 02b258b90e..0e3d175f5e 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts @@ -89,7 +89,7 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces errorText = ''; argumentsFormArray = this.fb.array([]); - entityNameMap = new Map([[NULL_UUID, '']]); + entityNameMap = new Map(); sortOrder = { direction: 'asc', property: '' }; dataSource = new CalculatedFieldArgumentDatasource(); From 515eaa6d597d775508af1b0e7d9820d5e6861023 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 27 Mar 2025 12:10:09 +0200 Subject: [PATCH 121/286] refactoring --- .../calculated-field-arguments-table.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts index ecf59aa7dd..7763fd6f03 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/arguments-table/calculated-field-arguments-table.component.ts @@ -183,7 +183,7 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces context: ctx, isModal: true }); - this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(({ value, index }) => { + this.popoverComponent.tbComponentRef.instance.argumentsDataApplied.subscribe(({ entityName, ...value }) => { this.popoverComponent.hide(); if (entityName) { this.entityNameMap.set(value.refEntityId.id, entityName); From 908680dd3d09bfc75eb6fd863e1d687d7d72a1a1 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 27 Mar 2025 12:24:36 +0200 Subject: [PATCH 122/286] UI: Dynamic title height for widget title --- .../widget/dynamic-widget.component.ts | 3 +- .../widget/lib/maps/map-widget.component.html | 7 ++- .../widget/lib/maps/map-widget.component.scss | 3 + .../widget/lib/maps/map-widget.component.ts | 14 ++++- .../widget/widget-container.component.html | 63 ++++++++++--------- .../components/widget/widget.component.ts | 8 +++ .../home/models/widget-component.models.ts | 1 + 7 files changed, 66 insertions(+), 33 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts index b6919ec670..a0b6f07647 100644 --- a/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts @@ -19,7 +19,7 @@ import { Directive, inject, Injector, OnDestroy, OnInit } from '@angular/core'; import { IDynamicWidgetComponent, widgetContextToken, - widgetErrorMessagesToken, + widgetErrorMessagesToken, widgetHeaderButtonActionToken, widgetTitlePanelToken } from '@home/models/widget-component.models'; import { HttpClient, HttpErrorResponse } from '@angular/common/http'; @@ -72,6 +72,7 @@ export class DynamicWidgetComponent extends PageComponent implements IDynamicWid public readonly ctx = inject(widgetContextToken); public readonly errorMessages = inject(widgetErrorMessagesToken); public readonly widgetTitlePanel = inject(widgetTitlePanelToken); + public readonly widgetHeaderButtonAction = inject(widgetHeaderButtonActionToken); constructor() { super(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html index b45869addf..9a200ef88c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html @@ -17,9 +17,10 @@ -->
    - - - + + + +
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss index 88157426f3..b8167ff06e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss @@ -34,4 +34,7 @@ div.tb-widget-title { padding: 0; } + .tb-widget-actions.tb-widget-actions-absolute { + z-index: 2; + } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts index 013a6c88a9..4bb2b11dd3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts @@ -15,6 +15,7 @@ /// import { + AfterViewInit, ChangeDetectorRef, Component, ElementRef, @@ -45,7 +46,7 @@ import { DomSanitizer } from '@angular/platform-browser'; styleUrls: ['./map-widget.component.scss'], encapsulation: ViewEncapsulation.None }) -export class MapWidgetComponent implements OnInit, OnDestroy { +export class MapWidgetComponent implements OnInit, OnDestroy, AfterViewInit { @ViewChild('mapElement', {static: false}) mapElement: ElementRef; @@ -58,6 +59,9 @@ export class MapWidgetComponent implements OnInit, OnDestroy { @Input() widgetTitlePanel: TemplateRef; + @Input() + widgetHeaderButtonAction: TemplateRef; + backgroundStyle$: Observable; overlayStyle: ComponentStyle = {}; padding: string; @@ -79,6 +83,14 @@ export class MapWidgetComponent implements OnInit, OnDestroy { this.padding = this.settings.background.overlay.enabled ? undefined : this.settings.padding; } + ngAfterViewInit() { + if (this.widgetComponent.dashboardWidget.showWidgetTitlePanel && !!this.widgetHeaderButtonAction) { + const tbWidgetTitle = $(".tb-widget-title")[0]; + if (getComputedStyle(tbWidgetTitle).getPropertyValue('min-height') === 'auto') + tbWidgetTitle.style.minHeight = $(".tb-widget-actions")[0].offsetHeight + 'px'; + } + } + ngOnDestroy() { if (this.map) { this.map.destroy(); diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html index 24658a8ad7..55182a8a01 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html @@ -33,33 +33,9 @@ -
    -
    - @for (action of widget.customHeaderActions; track action.name; let last = $last) { - - } -
    - - - -
    + + +
    + [widgetTitlePanel]="widgetTitlePanel" + [widgetHeaderButtonAction]="widgetHeaderButtonAction">
    @@ -102,6 +79,36 @@
    + +
    +
    + @for (action of widget.customHeaderActions; track action.name; let last = $last) { + + } +
    + + + +
    +
    + @switch (action.buttonType) { @case (widgetHeaderActionButtonType.miniFab) { diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index f8fa032c8c..5b5bb2fe57 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -75,6 +75,7 @@ import { widgetContextToken, widgetErrorMessagesToken, WidgetHeaderAction, + widgetHeaderButtonActionToken, WidgetInfo, widgetTitlePanelToken, WidgetTypeInstance @@ -139,6 +140,9 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, @Input() widgetTitlePanel: TemplateRef; + @Input() + widgetHeaderButtonAction: TemplateRef; + @Input() isEdit: boolean; @@ -817,6 +821,10 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, { provide: widgetTitlePanelToken, useValue: this.widgetTitlePanel + }, + { + provide: widgetHeaderButtonActionToken, + useValue: this.widgetHeaderButtonAction } ], parent: this.injector diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts index 11adb2f806..a27f1727c5 100644 --- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts @@ -559,6 +559,7 @@ export class LabelVariablePattern { export const widgetContextToken = new InjectionToken('widgetContext'); export const widgetErrorMessagesToken = new InjectionToken('errorMessages'); export const widgetTitlePanelToken = new InjectionToken>('widgetTitlePanel'); +export const widgetHeaderButtonActionToken = new InjectionToken>('widgetHeaderButtonAction'); export interface IDynamicWidgetComponent { readonly ctx: WidgetContext; From 896a7f0b454a71bca3c9f0568c6121a50076725e Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 27 Mar 2025 12:30:10 +0200 Subject: [PATCH 123/286] UI[Map]: Fix help popover styles in settings; make popover body scrollable --- .../common/action/custom-action-pretty-editor.component.html | 3 ++- .../action/custom-action-pretty-resources-tabs.component.html | 3 ++- .../lib/settings/common/action/widget-action.component.html | 1 + .../common/map/data-layer-color-settings-panel.component.html | 3 ++- .../common/map/data-layer-color-settings-panel.component.scss | 1 + .../common/map/data-layer-pattern-settings.component.html | 3 ++- .../common/map/marker-clustering-settings.component.html | 3 ++- .../common/map/marker-image-settings-panel.component.scss | 1 + .../settings/common/map/trip-timeline-settings.component.html | 3 ++- ui-ngx/src/assets/locale/locale.constant-en_US.json | 2 +- 10 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html index abcc4ad7af..3d2e69e210 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-editor.component.html @@ -60,7 +60,8 @@ [validationArgs]="[]" [editorCompleter]="customPrettyActionEditorCompleter" functionTitle="{{ 'widget-action.custom-pretty-function' | translate }}" - [helpId]="helpId"> + [helpId]="helpId" + [helpPopupStyle]="{width: '900px'}">
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html index 0852e7cc0d..00c5f86dd3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-action-pretty-resources-tabs.component.html @@ -101,7 +101,8 @@ [validationArgs]="[]" [editorCompleter]="customPrettyActionEditorCompleter" functionTitle="{{ 'widget-action.custom-pretty-function' | translate }}" - [helpId]="helpId"> + [helpId]="helpId" + [helpPopupStyle]="{width: '900px'}"> diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html index c4c90067dd..a2a0e8c8fa 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/widget-action.component.html @@ -256,6 +256,7 @@ [editorCompleter]="customActionEditorCompleter" withModules helpId="widget/action/custom_action_fn" + [helpPopupStyle]="{width: '900px'}" > diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html index 51cbc572a5..281f20ccd4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html @@ -95,7 +95,8 @@ [functionArgs]="['data', 'dsData']" [globalVariables]="functionScopeVariables" functionTitle="{{ 'widgets.maps.data-layer.color-function' | translate }}" - [helpId]="helpId"> + [helpId]="helpId" + [helpPopupStyle]="{width: '900px'}">
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.scss index 47ab07639b..4d5a14283d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.scss @@ -43,6 +43,7 @@ display: flex; flex-direction: column; min-height: 0; + overflow: auto; } .tb-data-layer-color-settings-panel-buttons { height: 40px; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-pattern-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-pattern-settings.component.html index 93ec63c128..451d3f7282 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-pattern-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-pattern-settings.component.html @@ -46,7 +46,8 @@ [globalVariables]="functionScopeVariables" [functionArgs]="['data', 'dsData']" functionTitle="{{ (patternType === 'label' ? 'widgets.maps.data-layer.label-function' : 'widgets.maps.data-layer.tooltip-function') | translate }}" - [helpId]="helpId"> + [helpId]="helpId" + [helpPopupStyle]="{width: '900px'}">
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-clustering-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-clustering-settings.component.html index 2a85f8d514..346e5feed6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-clustering-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-clustering-settings.component.html @@ -88,7 +88,8 @@ [globalVariables]="functionScopeVariables" [functionArgs]="['data', 'childCount']" functionTitle="{{ 'widgets.maps.data-layer.marker.clustering.marker-color-function' | translate }}" - helpId="widget/lib/map/clustering_color_fn"> + helpId="widget/lib/map/clustering_color_fn" + [helpPopupStyle]="{width: '900px'}"> diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.scss index 9a53a50729..3d93bf7ad7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.scss @@ -41,6 +41,7 @@ display: flex; flex-direction: column; min-height: 0; + overflow: auto; } .tb-marker-image-settings-panel-buttons { height: 40px; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/trip-timeline-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/trip-timeline-settings.component.html index 9729c3559d..55b17fce93 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/trip-timeline-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/trip-timeline-settings.component.html @@ -70,7 +70,8 @@ [globalVariables]="functionScopeVariables" [functionArgs]="['data', 'dsData']" functionTitle="{{ 'widgets.maps.timeline.location-snap-filter-function' | translate }}" - helpId="widget/lib/map/trip_point_as_anchor_fn"> + helpId="widget/lib/map/trip_point_as_anchor_fn" + [helpPopupStyle]="{width: '900px'}"> diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 1c972fe1c0..1b986b1be2 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -8013,7 +8013,7 @@ "pattern-type-function": "Function", "label-pattern": "Label (pattern examples: '${entityName}', '${entityName}: (Text ${keyName} units.)' )", "label-function": "Label function", - "tooltip-pattern": "Tooltip (for ex. 'Text ${keyName} units.' or Link text')", + "tooltip-pattern": "Tooltip (for ex. 'Text ${keyName} units.' or Link text)", "tooltip-function": "Tooltip function", "tooltip-trigger": "Tooltip trigger", "tooltip-trigger-click": "Show tooltip on click", From d527213dc63b5e89ca01a944d077988330e6913c Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 27 Mar 2025 12:48:54 +0200 Subject: [PATCH 124/286] Fixed minor change detection bug --- .../entity/debug/entity-debug-settings-button.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts index 85a90aef63..90beed2f7e 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts @@ -153,5 +153,6 @@ export class EntityDebugSettingsButtonComponent implements ControlValueAccessor } else { this.debugSettingsFormGroup.enable({emitEvent: false}); } + this.cd.markForCheck(); } } From b715ce2e4366c63b466bfcd954a77f890f06fd3f Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Thu, 27 Mar 2025 13:08:47 +0200 Subject: [PATCH 125/286] removed myEntityIds map and handled tenant and asset/device profile deletion --- ...alculatedFieldManagerMessageProcessor.java | 41 +++++++++----- .../CalculatedFieldEntityProfileCache.java | 6 +- ...aultCalculatedFieldEntityProfileCache.java | 56 ++++++------------- .../cf/cache/TenantEntityProfileCache.java | 45 ++++----------- ...faultTbCalculatedFieldConsumerService.java | 15 ++++- 5 files changed, 73 insertions(+), 90 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index e109e83e4d..27d3ce315a 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -322,11 +322,15 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware EntityId entityId = cfCtx.getEntityId(); EntityType entityType = cfCtx.getEntityId().getEntityType(); if (isProfileEntity(entityType)) { - var entityIds = cfEntityCache.getMyEntityIdsByProfileId(tenantId, entityId); + var entityIds = cfEntityCache.getEntityIdsByProfileId(tenantId, entityId); if (!entityIds.isEmpty()) { //TODO: no need to do this if we cache all created actors and know which one belong to us; var multiCallback = new MultipleTbCallback(entityIds.size(), callback); - entityIds.forEach(id -> deleteCfForEntity(id, cfId, multiCallback)); + entityIds.forEach(id -> { + if (isMyPartition(id, multiCallback)) { + deleteCfForEntity(id, cfId, multiCallback); + } + }); } else { callback.onSuccess(); } @@ -366,10 +370,11 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware EntityId sourceEntityId = msg.getEntityId(); log.debug("Received linked telemetry msg from entity [{}]", sourceEntityId); var proto = msg.getProto(); + var callback = msg.getCallback(); var linksList = proto.getLinksList(); if (linksList.isEmpty()) { log.debug("[{}] No CF links to process new telemetry.", msg.getTenantId()); - msg.getCallback().onSuccess(); + callback.onSuccess(); } for (var linkProto : linksList) { var link = fromProto(linkProto); @@ -378,21 +383,25 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware var cf = calculatedFields.get(link.cfId()); if (EntityType.DEVICE_PROFILE.equals(targetEntityType) || EntityType.ASSET_PROFILE.equals(targetEntityType)) { // iterate over all entities that belong to profile and push the message for corresponding CF - var entityIds = cfEntityCache.getMyEntityIdsByProfileId(tenantId, targetEntityId); + var entityIds = cfEntityCache.getEntityIdsByProfileId(tenantId, targetEntityId); if (!entityIds.isEmpty()) { - MultipleTbCallback callback = new MultipleTbCallback(entityIds.size(), msg.getCallback()); - var newMsg = new EntityCalculatedFieldLinkedTelemetryMsg(tenantId, sourceEntityId, proto.getMsg(), cf, callback); + MultipleTbCallback multipleCallback = new MultipleTbCallback(entityIds.size(), callback); + var newMsg = new EntityCalculatedFieldLinkedTelemetryMsg(tenantId, sourceEntityId, proto.getMsg(), cf, multipleCallback); entityIds.forEach(entityId -> { - log.debug("Pushing linked telemetry msg to specific actor [{}]", entityId); - getOrCreateActor(entityId).tell(newMsg); + if (isMyPartition(entityId, multipleCallback)) { + log.debug("Pushing linked telemetry msg to specific actor [{}]", entityId); + getOrCreateActor(entityId).tell(newMsg); + } }); } else { - msg.getCallback().onSuccess(); + callback.onSuccess(); } } else { - log.debug("Pushing linked telemetry msg to specific actor [{}]", targetEntityId); - var newMsg = new EntityCalculatedFieldLinkedTelemetryMsg(tenantId, sourceEntityId, proto.getMsg(), cf, msg.getCallback()); - getOrCreateActor(targetEntityId).tell(newMsg); + if (isMyPartition(targetEntityId, callback)) { + log.debug("Pushing linked telemetry msg to specific actor [{}]", targetEntityId); + var newMsg = new EntityCalculatedFieldLinkedTelemetryMsg(tenantId, sourceEntityId, proto.getMsg(), cf, callback); + getOrCreateActor(targetEntityId).tell(newMsg); + } } } } @@ -436,10 +445,14 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware EntityId entityId = cfCtx.getEntityId(); EntityType entityType = cfCtx.getEntityId().getEntityType(); if (isProfileEntity(entityType)) { - var entityIds = cfEntityCache.getMyEntityIdsByProfileId(tenantId, entityId); + var entityIds = cfEntityCache.getEntityIdsByProfileId(tenantId, entityId); if (!entityIds.isEmpty()) { var multiCallback = new MultipleTbCallback(entityIds.size(), callback); - entityIds.forEach(id -> initCfForEntity(id, cfCtx, forceStateReinit, multiCallback)); + entityIds.forEach(id -> { + if (isMyPartition(id, multiCallback)) { + initCfForEntity(id, cfCtx, forceStateReinit, multiCallback); + } + }); } else { callback.onSuccess(); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java index bb5ef91974..df2dc88f6b 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java @@ -30,7 +30,11 @@ public interface CalculatedFieldEntityProfileCache extends ApplicationListener

    getMyEntityIdsByProfileId(TenantId tenantId, EntityId profileId); + void evictProfile(TenantId tenantId, EntityId profileId); + + void removeTenant(TenantId tenantId); + + Collection getEntityIdsByProfileId(TenantId tenantId, EntityId profileId); int getEntityIdPartition(TenantId tenantId, EntityId entityId); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java index 080907587e..8059b3a825 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java @@ -22,17 +22,12 @@ import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; 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.TbApplicationEventListener; import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.util.TbRuleEngineComponent; -import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -50,50 +45,23 @@ public class DefaultCalculatedFieldEntityProfileCache extends TbApplicationEvent @Override protected void onTbApplicationEvent(PartitionChangeEvent event) { - Map> tenantPartitions = new HashMap<>(); - List systemPartitions = new ArrayList<>(); - - event.getCfPartitions().stream() - .filter(TopicPartitionInfo::isMyPartition) - .forEach(tpi -> { - Integer partition = tpi.getPartition().orElse(UNKNOWN); - Optional tenantIdOpt = tpi.getTenantId(); - if (tenantIdOpt.isPresent()) { - tenantPartitions.computeIfAbsent(tenantIdOpt.get(), id -> new ArrayList<>()).add(partition); - } else { - systemPartitions.add(partition); - } - }); - - tenantPartitions.forEach((tenantId, partitions) -> { - var cache = tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()); - cache.setMyPartitions(partitions); + event.getCfPartitions().forEach(tpi -> { + Optional tenantIdOpt = tpi.getTenantId(); + tenantIdOpt.ifPresent(tenantId -> tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache())); }); - - tenantCache.keySet().stream() - .filter(tenantId -> !tenantPartitions.containsKey(tenantId)) - .forEach(tenantId -> { - var cache = tenantCache.get(tenantId); - cache.setMyPartitions(systemPartitions); - }); } @Override public void add(TenantId tenantId, EntityId profileId, EntityId entityId) { - var tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, tenantId, entityId); - var partition = tpi.getPartition().orElse(UNKNOWN); - tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()) - .add(profileId, entityId, partition, tpi.isMyPartition()); + tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()).add(profileId, entityId); } @Override public void update(TenantId tenantId, EntityId oldProfileId, EntityId newProfileId, EntityId entityId) { - var tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, tenantId, entityId); - var partition = tpi.getPartition().orElse(UNKNOWN); var cache = tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()); //TODO: make this method atomic; cache.remove(oldProfileId, entityId); - cache.add(newProfileId, entityId, partition, tpi.isMyPartition()); + cache.add(newProfileId, entityId); } @Override @@ -103,8 +71,18 @@ public class DefaultCalculatedFieldEntityProfileCache extends TbApplicationEvent } @Override - public Collection getMyEntityIdsByProfileId(TenantId tenantId, EntityId profileId) { - return tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()).getMyEntityIdsByProfileId(profileId); + public void evictProfile(TenantId tenantId, EntityId profileId) { + tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()).removeProfileId(profileId); + } + + @Override + public void removeTenant(TenantId tenantId) { + tenantCache.remove(tenantId); + } + + @Override + public Collection getEntityIdsByProfileId(TenantId tenantId, EntityId profileId) { + return tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()).getEntityIdsByProfileId(profileId); } @Override diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java index 1a17b9b8be..27c2bdd6d5 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java @@ -32,31 +32,13 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; public class TenantEntityProfileCache { private final ReadWriteLock lock = new ReentrantReadWriteLock(); - private final Map>> allEntities = new HashMap<>(); - private final Map> myEntities = new HashMap<>(); - - public void setMyPartitions(List myPartitions) { - lock.writeLock().lock(); - try { - myEntities.clear(); - myPartitions.forEach(partitionId -> { - var map = allEntities.get(partitionId); - if (map != null) { - map.forEach((profileId, entityIds) -> myEntities.computeIfAbsent(profileId, k -> new HashSet<>()).addAll(entityIds)); - } - }); - } finally { - lock.writeLock().unlock(); - } - } + private final Map> allEntities = new HashMap<>(); public void removeProfileId(EntityId profileId) { lock.writeLock().lock(); try { // Remove from allEntities - allEntities.values().forEach(map -> map.remove(profileId)); - // Remove from myEntities - myEntities.remove(profileId); + allEntities.remove(profileId); } finally { lock.writeLock().unlock(); } @@ -66,9 +48,7 @@ public class TenantEntityProfileCache { lock.writeLock().lock(); try { // Remove from allEntities - allEntities.values().forEach(map -> map.values().forEach(set -> set.remove(entityId))); - // Remove from myEntities - myEntities.values().forEach(set -> set.remove(entityId)); + allEntities.values().forEach(set -> set.remove(entityId)); } finally { lock.writeLock().unlock(); } @@ -78,33 +58,28 @@ public class TenantEntityProfileCache { lock.writeLock().lock(); try { // Remove from allEntities - allEntities.values().forEach(map -> removeSafely(map, profileId, entityId)); - // Remove from myEntities - removeSafely(myEntities, profileId, entityId); + removeSafely(allEntities, profileId, entityId); } finally { lock.writeLock().unlock(); } } - public void add(EntityId profileId, EntityId entityId, Integer partition, boolean mine) { + public void add(EntityId profileId, EntityId entityId) { lock.writeLock().lock(); try { - if(EntityType.DEVICE.equals(profileId.getEntityType())){ - throw new RuntimeException("WTF?"); - } - if (mine) { - myEntities.computeIfAbsent(profileId, k -> new HashSet<>()).add(entityId); + if (EntityType.DEVICE.equals(profileId.getEntityType()) || EntityType.ASSET.equals(profileId.getEntityType())) { + throw new RuntimeException("Entity type '" + profileId.getEntityType() + "' is not a profileId."); } - allEntities.computeIfAbsent(partition, k -> new HashMap<>()).computeIfAbsent(profileId, p -> new HashSet<>()).add(entityId); + allEntities.computeIfAbsent(profileId, k -> new HashSet<>()).add(entityId); } finally { lock.writeLock().unlock(); } } - public Collection getMyEntityIdsByProfileId(EntityId profileId) { + public Collection getEntityIdsByProfileId(EntityId profileId) { lock.readLock().lock(); try { - var entities = myEntities.getOrDefault(profileId, Collections.emptySet()); + var entities = allEntities.getOrDefault(profileId, Collections.emptySet()); List result = new ArrayList<>(entities.size()); result.addAll(entities); return result; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index bce1992932..b543e860f3 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -52,6 +52,7 @@ import org.thingsboard.server.queue.util.TbRuleEngineComponent; import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.cf.CalculatedFieldCache; import org.thingsboard.server.service.cf.CalculatedFieldStateService; +import org.thingsboard.server.service.cf.cache.CalculatedFieldEntityProfileCache; import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; import org.thingsboard.server.service.queue.processing.AbstractConsumerPartitionedService; @@ -80,6 +81,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar private final TbRuleEngineQueueFactory queueFactory; private final CalculatedFieldStateService stateService; + private final CalculatedFieldEntityProfileCache entityProfileCache; public DefaultTbCalculatedFieldConsumerService(TbRuleEngineQueueFactory tbQueueFactory, ActorSystemContext actorContext, @@ -91,11 +93,13 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar ApplicationEventPublisher eventPublisher, JwtSettingsService jwtSettingsService, CalculatedFieldCache calculatedFieldCache, - CalculatedFieldStateService stateService) { + CalculatedFieldStateService stateService, + CalculatedFieldEntityProfileCache entityProfileCache) { super(actorContext, tenantProfileCache, deviceProfileCache, assetProfileCache, calculatedFieldCache, apiUsageStateService, partitionService, eventPublisher, jwtSettingsService); this.queueFactory = tbQueueFactory; this.stateService = stateService; + this.entityProfileCache = entityProfileCache; } @Override @@ -227,6 +231,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar public void handleComponentLifecycleEvent(ComponentLifecycleMsg event) { if (event.getEntityId().getEntityType() == EntityType.TENANT) { if (event.getEvent() == ComponentLifecycleEvent.DELETED) { + entityProfileCache.removeTenant(event.getTenantId()); Set partitions = stateService.getPartitions(); if (CollectionUtils.isEmpty(partitions)) { return; @@ -235,6 +240,14 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar .filter(tpi -> tpi.getTenantId().isPresent() && tpi.getTenantId().get().equals(event.getTenantId())) .collect(Collectors.toSet())); } + } else if (event.getEntityId().getEntityType() == EntityType.ASSET_PROFILE) { + if (event.getEvent() == ComponentLifecycleEvent.DELETED) { + entityProfileCache.evictProfile(event.getTenantId(), event.getEntityId()); + } + } else if (event.getEntityId().getEntityType() == EntityType.DEVICE_PROFILE) { + if (event.getEvent() == ComponentLifecycleEvent.DELETED) { + entityProfileCache.evictProfile(event.getTenantId(), event.getEntityId()); + } } } From 0dfef548816632fd54a0daffa4173f5085191ce2 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 27 Mar 2025 14:41:01 +0100 Subject: [PATCH 126/286] Added ability to use query timeout for JdbcTemplates --- ...medParameterJdbcTemplateConfiguration.java | 43 +++++++++++++++++++ .../server/dao/sql/JdbcTemplateTest.java | 39 +++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 dao/src/main/java/org/thingsboard/server/dao/sql/NamedParameterJdbcTemplateConfiguration.java create mode 100644 dao/src/test/java/org/thingsboard/server/dao/sql/JdbcTemplateTest.java diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/NamedParameterJdbcTemplateConfiguration.java b/dao/src/main/java/org/thingsboard/server/dao/sql/NamedParameterJdbcTemplateConfiguration.java new file mode 100644 index 0000000000..ef8d0ed064 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/NamedParameterJdbcTemplateConfiguration.java @@ -0,0 +1,43 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.sql; + +import jakarta.annotation.PostConstruct; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +@Component +@RequiredArgsConstructor +@Slf4j +public class NamedParameterJdbcTemplateConfiguration { + + @Value("${spring.jpa.properties.javax.persistence.query.timeout:30000}") + private int queryTimeout; + + private final NamedParameterJdbcTemplate namedParameterJdbcTemplate; + + @PostConstruct + private void init() { + int timeout = Math.max(1, (int) TimeUnit.MILLISECONDS.toSeconds(queryTimeout)); + log.info("Set jdbcTemplate query timeout [{}] second(s)", timeout); + namedParameterJdbcTemplate.getJdbcTemplate().setQueryTimeout(timeout); + } +} diff --git a/dao/src/test/java/org/thingsboard/server/dao/sql/JdbcTemplateTest.java b/dao/src/test/java/org/thingsboard/server/dao/sql/JdbcTemplateTest.java new file mode 100644 index 0000000000..d0af99021a --- /dev/null +++ b/dao/src/test/java/org/thingsboard/server/dao/sql/JdbcTemplateTest.java @@ -0,0 +1,39 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.sql; + +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessResourceFailureException; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.test.context.TestPropertySource; +import org.thingsboard.server.dao.AbstractJpaDaoTest; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +@TestPropertySource(properties = { + "spring.jpa.properties.javax.persistence.query.timeout=500" +}) +public class JdbcTemplateTest extends AbstractJpaDaoTest { + + @Autowired + private NamedParameterJdbcTemplate jdbcTemplate; + + @Test + public void queryTimeoutTest() { + assertThrows(DataAccessResourceFailureException.class, () -> jdbcTemplate.query("SELECT pg_sleep(10)", rs -> {})); + } +} From 1e7e1a28548d46bec824dc6dc5130472b2f335de Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 27 Mar 2025 15:49:39 +0200 Subject: [PATCH 127/286] UI: New Map widgets - introduce new marker icon containers. --- .../models/widget/maps/marker-shape.models.ts | 32 +++++++++++++++---- ui-ngx/src/assets/markers/iconContainer4.svg | 14 ++++++++ ui-ngx/src/assets/markers/iconContainer5.svg | 15 +++++++++ ui-ngx/src/assets/markers/iconContainer6.svg | 27 ++++++++++++++++ ui-ngx/src/assets/markers/iconContainer7.svg | 27 ++++++++++++++++ 5 files changed, 108 insertions(+), 7 deletions(-) create mode 100644 ui-ngx/src/assets/markers/iconContainer4.svg create mode 100644 ui-ngx/src/assets/markers/iconContainer5.svg create mode 100644 ui-ngx/src/assets/markers/iconContainer6.svg create mode 100644 ui-ngx/src/assets/markers/iconContainer7.svg diff --git a/ui-ngx/src/app/shared/models/widget/maps/marker-shape.models.ts b/ui-ngx/src/app/shared/models/widget/maps/marker-shape.models.ts index f0783a4ac9..76fe239264 100644 --- a/ui-ngx/src/app/shared/models/widget/maps/marker-shape.models.ts +++ b/ui-ngx/src/app/shared/models/widget/maps/marker-shape.models.ts @@ -50,6 +50,10 @@ export enum MarkerIconContainer { iconContainer1 = 'iconContainer1', iconContainer2 = 'iconContainer2', iconContainer3 = 'iconContainer3', + iconContainer4 = 'iconContainer4', + iconContainer5 = 'iconContainer5', + iconContainer6 = 'iconContainer6', + iconContainer7 = 'iconContainer7', tripIconContainer1 = 'tripIconContainer1', tripIconContainer2 = 'tripIconContainer2', tripIconContainer3 = 'tripIconContainer3' @@ -85,6 +89,10 @@ const markerIconContainerMap = new Map( [MarkerIconContainer.iconContainer1, '/assets/markers/iconContainer1.svg'], [MarkerIconContainer.iconContainer2, '/assets/markers/iconContainer2.svg'], [MarkerIconContainer.iconContainer3, '/assets/markers/iconContainer3.svg'], + [MarkerIconContainer.iconContainer4, '/assets/markers/iconContainer4.svg'], + [MarkerIconContainer.iconContainer5, '/assets/markers/iconContainer5.svg'], + [MarkerIconContainer.iconContainer6, '/assets/markers/iconContainer6.svg'], + [MarkerIconContainer.iconContainer7, '/assets/markers/iconContainer7.svg'], [MarkerIconContainer.tripIconContainer1, '/assets/markers/tripIconContainer1.svg'], [MarkerIconContainer.tripIconContainer2, '/assets/markers/tripIconContainer2.svg'], [MarkerIconContainer.tripIconContainer3, '/assets/markers/tripIconContainer3.svg'] @@ -106,11 +114,11 @@ const emptyIconContainerDefinition: MarkerIconContainerDefinition = { const defaultIconContainerDefinition: MarkerIconContainerDefinition = { iconSize: 12, - iconColor: (color) => tinycolor.mix(color.clone().setAlpha(1), tinycolor('rgba(0,0,0,0.38)')), + iconColor: (color) => color, iconAlpha: color => color.getAlpha() } -const defaultTripIconContainerDefinition: MarkerIconContainerDefinition = { +const defaultMaskIconContainerDefinition: MarkerIconContainerDefinition = { iconSize: 24, iconColor: () => tinycolor('#000'), iconAlpha: () => 1, @@ -142,9 +150,13 @@ const markerIconContainerDefinitionMap = new Map { diff --git a/ui-ngx/src/assets/markers/iconContainer4.svg b/ui-ngx/src/assets/markers/iconContainer4.svg new file mode 100644 index 0000000000..15a0f3b219 --- /dev/null +++ b/ui-ngx/src/assets/markers/iconContainer4.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/ui-ngx/src/assets/markers/iconContainer5.svg b/ui-ngx/src/assets/markers/iconContainer5.svg new file mode 100644 index 0000000000..62d8a9b363 --- /dev/null +++ b/ui-ngx/src/assets/markers/iconContainer5.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/ui-ngx/src/assets/markers/iconContainer6.svg b/ui-ngx/src/assets/markers/iconContainer6.svg new file mode 100644 index 0000000000..749ee54963 --- /dev/null +++ b/ui-ngx/src/assets/markers/iconContainer6.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui-ngx/src/assets/markers/iconContainer7.svg b/ui-ngx/src/assets/markers/iconContainer7.svg new file mode 100644 index 0000000000..a383907203 --- /dev/null +++ b/ui-ngx/src/assets/markers/iconContainer7.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1901808b26ab5660712fd41a1798065925780e2a Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 27 Mar 2025 18:04:16 +0200 Subject: [PATCH 128/286] UI: Ref after review --- .../json/system/widget_types/image_map.json | 4 ++-- .../data/json/system/widget_types/map.json | 4 ++-- .../json/system/widget_types/route_map.json | 4 ++-- .../json/system/widget_types/trip_map.json | 4 ++-- .../widget/dynamic-widget.component.ts | 3 +-- .../widget/lib/maps/map-widget.component.html | 12 ++++++++---- .../widget/lib/maps/map-widget.component.scss | 3 +++ .../widget/lib/maps/map-widget.component.ts | 18 +----------------- .../widget/widget-component.service.ts | 3 +++ .../widget/widget-container.component.html | 10 +++++----- .../widget/widget-container.component.ts | 7 +++++++ .../home/components/widget/widget.component.ts | 8 ++------ .../home/models/widget-component.models.ts | 2 +- ui-ngx/src/app/shared/models/widget.models.ts | 1 + 14 files changed, 40 insertions(+), 43 deletions(-) diff --git a/application/src/main/data/json/system/widget_types/image_map.json b/application/src/main/data/json/system/widget_types/image_map.json index 2a4fe71696..991c0b463f 100644 --- a/application/src/main/data/json/system/widget_types/image_map.json +++ b/application/src/main/data/json/system/widget_types/image_map.json @@ -9,9 +9,9 @@ "sizeX": 8.5, "sizeY": 6, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}\n", "settingsForm": [], "dataKeySettingsForm": [], "settingsDirective": "tb-map-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/map.json b/application/src/main/data/json/system/widget_types/map.json index b9069d8af6..e498922d36 100644 --- a/application/src/main/data/json/system/widget_types/map.json +++ b/application/src/main/data/json/system/widget_types/map.json @@ -9,9 +9,9 @@ "sizeX": 8.5, "sizeY": 6, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}\n", "settingsForm": [], "dataKeySettingsForm": [], "settingsDirective": "tb-map-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/route_map.json b/application/src/main/data/json/system/widget_types/route_map.json index f1d2cd571c..37346f1157 100644 --- a/application/src/main/data/json/system/widget_types/route_map.json +++ b/application/src/main/data/json/system/widget_types/route_map.json @@ -9,9 +9,9 @@ "sizeX": 8.5, "sizeY": 6, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n trip: true,\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n trip: true,\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}", "settingsForm": [], "dataKeySettingsForm": [], "latestDataKeySettingsForm": [], diff --git a/application/src/main/data/json/system/widget_types/trip_map.json b/application/src/main/data/json/system/widget_types/trip_map.json index a596e74c1f..8f54f64b6b 100644 --- a/application/src/main/data/json/system/widget_types/trip_map.json +++ b/application/src/main/data/json/system/widget_types/trip_map.json @@ -9,9 +9,9 @@ "sizeX": 8.5, "sizeY": 6, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n trip: true,\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.mapWidget.onInit();\n};\n\nself.typeParameters = function() {\n return {\n trip: true,\n hideDataTab: true,\n hideDataSettings: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n datasourcesOptional: true,\n additionalWidgetActionTypes: ['placeMapItem']\n };\n}", "settingsForm": [], "dataKeySettingsForm": [], "latestDataKeySettingsForm": [], diff --git a/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts index a0b6f07647..b6919ec670 100644 --- a/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/dynamic-widget.component.ts @@ -19,7 +19,7 @@ import { Directive, inject, Injector, OnDestroy, OnInit } from '@angular/core'; import { IDynamicWidgetComponent, widgetContextToken, - widgetErrorMessagesToken, widgetHeaderButtonActionToken, + widgetErrorMessagesToken, widgetTitlePanelToken } from '@home/models/widget-component.models'; import { HttpClient, HttpErrorResponse } from '@angular/common/http'; @@ -72,7 +72,6 @@ export class DynamicWidgetComponent extends PageComponent implements IDynamicWid public readonly ctx = inject(widgetContextToken); public readonly errorMessages = inject(widgetErrorMessagesToken); public readonly widgetTitlePanel = inject(widgetTitlePanelToken); - public readonly widgetHeaderButtonAction = inject(widgetHeaderButtonActionToken); constructor() { super(); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html index 9a200ef88c..e64ee71170 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.html @@ -17,10 +17,14 @@ -->

    - - - - + @if (widgetComponent.dashboardWidget.showWidgetTitlePanel) { +
    + + +
    + } @else { + + }
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss index b8167ff06e..eab92a664f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.scss @@ -34,6 +34,9 @@ div.tb-widget-title { padding: 0; } + .tb-widget-title-row .tb-widget-actions { + margin: 0; + } .tb-widget-actions.tb-widget-actions-absolute { z-index: 2; } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts index 4bb2b11dd3..4ef3c3cd45 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.component.ts @@ -15,14 +15,12 @@ /// import { - AfterViewInit, ChangeDetectorRef, Component, ElementRef, Input, OnDestroy, OnInit, - TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; @@ -46,7 +44,7 @@ import { DomSanitizer } from '@angular/platform-browser'; styleUrls: ['./map-widget.component.scss'], encapsulation: ViewEncapsulation.None }) -export class MapWidgetComponent implements OnInit, OnDestroy, AfterViewInit { +export class MapWidgetComponent implements OnInit, OnDestroy { @ViewChild('mapElement', {static: false}) mapElement: ElementRef; @@ -56,12 +54,6 @@ export class MapWidgetComponent implements OnInit, OnDestroy, AfterViewInit { @Input() ctx: WidgetContext; - @Input() - widgetTitlePanel: TemplateRef; - - @Input() - widgetHeaderButtonAction: TemplateRef; - backgroundStyle$: Observable; overlayStyle: ComponentStyle = {}; padding: string; @@ -83,14 +75,6 @@ export class MapWidgetComponent implements OnInit, OnDestroy, AfterViewInit { this.padding = this.settings.background.overlay.enabled ? undefined : this.settings.padding; } - ngAfterViewInit() { - if (this.widgetComponent.dashboardWidget.showWidgetTitlePanel && !!this.widgetHeaderButtonAction) { - const tbWidgetTitle = $(".tb-widget-title")[0]; - if (getComputedStyle(tbWidgetTitle).getPropertyValue('min-height') === 'auto') - tbWidgetTitle.style.minHeight = $(".tb-widget-actions")[0].offsetHeight + 'px'; - } - } - ngOnDestroy() { if (this.map) { this.map.destroy(); diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts index 1a397d3a1f..f4e69c954c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts @@ -631,6 +631,9 @@ export class WidgetComponentService { if (isUndefined(result.typeParameters.embedTitlePanel)) { result.typeParameters.embedTitlePanel = false; } + if (isUndefined(result.typeParameters.embedActionsPanel)) { + result.typeParameters.embedActionsPanel = false; + } if (isUndefined(result.typeParameters.overflowVisible)) { result.typeParameters.overflowVisible = false; } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html index 55182a8a01..531d0e3529 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.html @@ -33,8 +33,8 @@ - - + +
    @@ -45,7 +45,7 @@ [isPreview]="isPreview" [isMobile]="isMobile" [widgetTitlePanel]="widgetTitlePanel" - [widgetHeaderButtonAction]="widgetHeaderButtonAction"> + [widgetHeaderActionsPanel]="widgetHeaderActionsPanel">
    @@ -79,10 +79,10 @@
    - +
    @for (action of widget.customHeaderActions; track action.name; let last = $last) { diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts index 430cce40b1..51ed592e7e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-container.component.ts @@ -48,6 +48,7 @@ import { TbContextMenuEvent } from '@shared/models/jquery-event.models'; import { WidgetHeaderActionButtonType } from '@shared/models/widget.models'; import ITooltipsterInstance = JQueryTooltipster.ITooltipsterInstance; import ITooltipsterGeoHelper = JQueryTooltipster.ITooltipsterGeoHelper; +import { WidgetComponent } from '@home/components/widget/widget.component'; export enum WidgetComponentActionType { MOUSE_DOWN, @@ -216,6 +217,12 @@ export class WidgetContainerComponent extends PageComponent implements OnInit, O }); } + widgetActionAbsolute(widgetComponent: WidgetComponent, absolute = false) { + return absolute ? true : + !(this.widget.showWidgetTitlePanel && !widgetComponent.widgetContext?.embedTitlePanel && + (this.widget.showTitle||this.widget.hasAggregation)) && !widgetComponent.widgetContext?.embedActionsPanel; + } + onClicked(event: MouseEvent): void { if (event && this.isEdit) { event.stopPropagation(); diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index 5b5bb2fe57..73f90d9665 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -75,7 +75,6 @@ import { widgetContextToken, widgetErrorMessagesToken, WidgetHeaderAction, - widgetHeaderButtonActionToken, WidgetInfo, widgetTitlePanelToken, WidgetTypeInstance @@ -141,7 +140,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, widgetTitlePanel: TemplateRef; @Input() - widgetHeaderButtonAction: TemplateRef; + widgetHeaderActionsPanel: TemplateRef; @Input() isEdit: boolean; @@ -487,6 +486,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.widgetType = this.widgetInfo.widgetTypeFunction; this.typeParameters = this.widgetInfo.typeParameters; this.widgetContext.embedTitlePanel = this.typeParameters.embedTitlePanel; + this.widgetContext.embedActionsPanel = this.typeParameters.embedActionsPanel; this.widgetContext.overflowVisible = this.typeParameters.overflowVisible; if (!this.widgetType) { @@ -821,10 +821,6 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, { provide: widgetTitlePanelToken, useValue: this.widgetTitlePanel - }, - { - provide: widgetHeaderButtonActionToken, - useValue: this.widgetHeaderButtonAction } ], parent: this.injector diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts index a27f1727c5..00afa2b68d 100644 --- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts @@ -312,6 +312,7 @@ export class WidgetContext { timeWindow?: WidgetTimewindow; embedTitlePanel?: boolean; + embedActionsPanel?: boolean; overflowVisible?: boolean; hideTitlePanel = false; @@ -559,7 +560,6 @@ export class LabelVariablePattern { export const widgetContextToken = new InjectionToken('widgetContext'); export const widgetErrorMessagesToken = new InjectionToken('errorMessages'); export const widgetTitlePanelToken = new InjectionToken>('widgetTitlePanel'); -export const widgetHeaderButtonActionToken = new InjectionToken>('widgetHeaderButtonAction'); export interface IDynamicWidgetComponent { readonly ctx: WidgetContext; diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts index 2300ae2341..038c738bb0 100644 --- a/ui-ngx/src/app/shared/models/widget.models.ts +++ b/ui-ngx/src/app/shared/models/widget.models.ts @@ -185,6 +185,7 @@ export interface WidgetTypeParameters { previewWidth?: string; previewHeight?: string; embedTitlePanel?: boolean; + embedActionsPanel?: boolean; overflowVisible?: boolean; hideDataTab?: boolean; hideDataSettings?: boolean; From eb114227aa4352d54e1119df25cb5738bb66e38c Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Fri, 28 Mar 2025 11:08:54 +0200 Subject: [PATCH 129/286] Fix removeEntity in TenantRepo --- .../main/java/org/thingsboard/server/edqs/repo/TenantRepo.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index d8dec9fc4e..b9f3589280 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -220,12 +220,13 @@ public class TenantRepo { try { UUID entityId = entity.getFields().getId(); EntityType entityType = entity.getType(); - EntityData removed = get(entityType, entityId); + EntityData removed = getEntityMap(entityType).remove(entityId); if (removed != null) { if (removed.getFields() != null) { getEntitySet(entityType).remove(removed); } edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.fromEntityType(entityType), EdqsEventType.DELETED)); + UUID customerId = removed.getCustomerId(); if (customerId != null) { CustomerData customerData = (CustomerData) get(EntityType.CUSTOMER, customerId); From 7f438da69b1c6251b90e8cd7307961ef168708c4 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 28 Mar 2025 11:23:00 +0200 Subject: [PATCH 130/286] UI: Embed action for chart widgets --- .../main/data/json/system/widget_types/bar_chart.json | 4 ++-- .../system/widget_types/bar_chart_with_labels.json | 4 ++-- .../src/main/data/json/system/widget_types/bars.json | 4 ++-- .../main/data/json/system/widget_types/doughnut.json | 4 ++-- .../json/system/widget_types/horizontal_doughnut.json | 4 ++-- .../data/json/system/widget_types/line_chart.json | 4 ++-- .../src/main/data/json/system/widget_types/pie.json | 4 ++-- .../data/json/system/widget_types/point_chart.json | 4 ++-- .../data/json/system/widget_types/polar_area.json | 4 ++-- .../src/main/data/json/system/widget_types/radar.json | 4 ++-- .../data/json/system/widget_types/range_chart.json | 4 ++-- .../data/json/system/widget_types/state_chart.json | 4 ++-- .../json/system/widget_types/time_series_chart.json | 4 ++-- .../chart/bar-chart-with-labels-widget.component.html | 9 ++++++++- .../chart/bar-chart-with-labels-widget.component.scss | 7 +++++++ .../chart/bar-chart-with-labels-widget.component.ts | 7 +++---- .../lib/chart/latest-chart-widget.component.html | 1 - .../widget/lib/chart/latest-chart.component.html | 9 ++++++++- .../widget/lib/chart/latest-chart.component.scss | 7 +++++++ .../widget/lib/chart/latest-chart.component.ts | 7 ++----- .../lib/chart/range-chart-widget.component.html | 9 ++++++++- .../lib/chart/range-chart-widget.component.scss | 6 ++++++ .../widget/lib/chart/range-chart-widget.component.ts | 7 +++---- .../lib/chart/time-series-chart-widget.component.html | 11 ++++++++--- .../lib/chart/time-series-chart-widget.component.scss | 6 ++++++ .../lib/chart/time-series-chart-widget.component.ts | 3 --- 26 files changed, 92 insertions(+), 49 deletions(-) diff --git a/application/src/main/data/json/system/widget_types/bar_chart.json b/application/src/main/data/json/system/widget_types/bar_chart.json index 01f16d96b5..58f6244fd3 100644 --- a/application/src/main/data/json/system/widget_types/bar_chart.json +++ b/application/src/main/data/json/system/widget_types/bar_chart.json @@ -9,9 +9,9 @@ "sizeX": 8, "sizeY": 5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n chartType: 'bar',\n previewWidth: '80%',\n embedTitlePanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('bar'),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n chartType: 'bar',\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('bar'),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", "settingsSchema": "{}", "dataKeySettingsSchema": "{}", "latestDataKeySettingsSchema": "{}", diff --git a/application/src/main/data/json/system/widget_types/bar_chart_with_labels.json b/application/src/main/data/json/system/widget_types/bar_chart_with_labels.json index a2fc5f5c9d..6972e859b0 100644 --- a/application/src/main/data/json/system/widget_types/bar_chart_with_labels.json +++ b/application/src/main/data/json/system/widget_types/bar_chart_with_labels.json @@ -9,9 +9,9 @@ "sizeX": 8, "sizeY": 5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": ".legend {\n font-size: 13px;\n line-height: 10px;\n}\n\n.legend table { \n border-spacing: 0px;\n border-collapse: separate;\n}\n\n.mouse-events .flot-overlay {\n cursor: crosshair; \n}\n\n", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.barChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.barChartWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n previewWidth: '80%',\n embedTitlePanel: true,\n hasAdditionalLatestDataKeys: false,\n defaultDataKeysFunction: function() {\n return [{ name: 'humidity', label: 'Humidity', type: 'timeseries' }];\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.barChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.barChartWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n hasAdditionalLatestDataKeys: false,\n defaultDataKeysFunction: function() {\n return [{ name: 'humidity', label: 'Humidity', type: 'timeseries' }];\n }\n };\n}\n", "settingsSchema": "{}", "dataKeySettingsSchema": "{}", "latestDataKeySettingsSchema": "{}", diff --git a/application/src/main/data/json/system/widget_types/bars.json b/application/src/main/data/json/system/widget_types/bars.json index 481288da9b..ce640c95b1 100644 --- a/application/src/main/data/json/system/widget_types/bars.json +++ b/application/src/main/data/json/system/widget_types/bars.json @@ -9,9 +9,9 @@ "sizeX": 5, "sizeY": 4, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.barChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.barChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.barChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.barChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n embedActionsPanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\n", "settingsSchema": "", "dataKeySettingsSchema": "", "settingsDirective": "tb-bar-chart-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/doughnut.json b/application/src/main/data/json/system/widget_types/doughnut.json index 5065100a91..bf03a75b09 100644 --- a/application/src/main/data/json/system/widget_types/doughnut.json +++ b/application/src/main/data/json/system/widget_types/doughnut.json @@ -9,9 +9,9 @@ "sizeX": 4, "sizeY": 3, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.doughnutWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.doughnutWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '380px',\n previewHeight: '300px',\n embedTitlePanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind power', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar power', type: 'timeseries', color: '#FF4D5A' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.doughnutWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.doughnutWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '380px',\n previewHeight: '300px',\n embedTitlePanel: true,\n embedActionsPanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind power', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar power', type: 'timeseries', color: '#FF4D5A' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n", "settingsSchema": "", "dataKeySettingsSchema": "", "settingsDirective": "tb-doughnut-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/horizontal_doughnut.json b/application/src/main/data/json/system/widget_types/horizontal_doughnut.json index a6e7f4d3bd..050984268c 100644 --- a/application/src/main/data/json/system/widget_types/horizontal_doughnut.json +++ b/application/src/main/data/json/system/widget_types/horizontal_doughnut.json @@ -9,9 +9,9 @@ "sizeX": 4, "sizeY": 2.5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.doughnutWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.doughnutWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '380px',\n previewHeight: '220px',\n embedTitlePanel: true,\n horizontal: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind power', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar power', type: 'timeseries', color: '#FF4D5A' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.doughnutWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.doughnutWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '380px',\n previewHeight: '220px',\n embedTitlePanel: true,\n embedActionsPanel: true,\n horizontal: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind power', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar power', type: 'timeseries', color: '#FF4D5A' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n", "settingsSchema": "", "dataKeySettingsSchema": "", "settingsDirective": "tb-doughnut-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/line_chart.json b/application/src/main/data/json/system/widget_types/line_chart.json index 3ef1b83c03..0468c42f8e 100644 --- a/application/src/main/data/json/system/widget_types/line_chart.json +++ b/application/src/main/data/json/system/widget_types/line_chart.json @@ -9,9 +9,9 @@ "sizeX": 8, "sizeY": 5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n chartType: 'line',\n previewWidth: '80%',\n embedTitlePanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('line'),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n chartType: 'line',\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('line'),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", "settingsSchema": "{}", "dataKeySettingsSchema": "{}", "latestDataKeySettingsSchema": "{}", diff --git a/application/src/main/data/json/system/widget_types/pie.json b/application/src/main/data/json/system/widget_types/pie.json index 01c96a5077..94e02d06ef 100644 --- a/application/src/main/data/json/system/widget_types/pie.json +++ b/application/src/main/data/json/system/widget_types/pie.json @@ -9,9 +9,9 @@ "sizeX": 5, "sizeY": 4, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.pieChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.pieChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\nself.actionSources = function() {\n return {\n 'sliceClick': {\n name: 'widget-action.pie-slice-click',\n multiple: false\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.pieChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.pieChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n embedActionsPanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\nself.actionSources = function() {\n return {\n 'sliceClick': {\n name: 'widget-action.pie-slice-click',\n multiple: false\n }\n };\n}\n", "settingsSchema": "", "dataKeySettingsSchema": "", "settingsDirective": "tb-pie-chart-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/point_chart.json b/application/src/main/data/json/system/widget_types/point_chart.json index a3f1ed5f60..74cd137665 100644 --- a/application/src/main/data/json/system/widget_types/point_chart.json +++ b/application/src/main/data/json/system/widget_types/point_chart.json @@ -9,9 +9,9 @@ "sizeX": 8, "sizeY": 5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n chartType: 'point',\n previewWidth: '80%',\n embedTitlePanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('point'),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n chartType: 'point',\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('point'),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", "settingsSchema": "{}", "dataKeySettingsSchema": "{}", "latestDataKeySettingsSchema": "{}", diff --git a/application/src/main/data/json/system/widget_types/polar_area.json b/application/src/main/data/json/system/widget_types/polar_area.json index 2bdce5d9ad..36fcaee465 100644 --- a/application/src/main/data/json/system/widget_types/polar_area.json +++ b/application/src/main/data/json/system/widget_types/polar_area.json @@ -9,9 +9,9 @@ "sizeX": 5, "sizeY": 4, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.polarAreaChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.polarAreaChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.polarAreaChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.polarAreaChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n embedActionsPanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\n", "settingsSchema": "", "dataKeySettingsSchema": "", "settingsDirective": "tb-polar-area-chart-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/radar.json b/application/src/main/data/json/system/widget_types/radar.json index 07b0fa6981..a6961feb6d 100644 --- a/application/src/main/data/json/system/widget_types/radar.json +++ b/application/src/main/data/json/system/widget_types/radar.json @@ -9,9 +9,9 @@ "sizeX": 5, "sizeY": 4, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.radarChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.radarChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.radarChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.radarChartWidget.onDataUpdated();\n};\n\nself.typeParameters = function() {\n return {\n previewWidth: '500px',\n previewHeight: '380px',\n embedTitlePanel: true,\n embedActionsPanel: true,\n defaultDataKeysFunction: function() {\n return [{ name: 'windPower', label: 'Wind', type: 'timeseries', color: '#08872B' },\n { name: 'solarPower', label: 'Solar', type: 'timeseries', color: '#FF4D5A' },\n { name: 'hydroelectricPower', label: 'Hydroelectric', type: 'timeseries', color: '#FFDE30' }];\n }\n };\n};\n\nself.onDestroy = function() {\n};\n\n", "settingsSchema": "", "dataKeySettingsSchema": "", "settingsDirective": "tb-radar-chart-widget-settings", diff --git a/application/src/main/data/json/system/widget_types/range_chart.json b/application/src/main/data/json/system/widget_types/range_chart.json index ea5109873b..911d91876f 100644 --- a/application/src/main/data/json/system/widget_types/range_chart.json +++ b/application/src/main/data/json/system/widget_types/range_chart.json @@ -9,9 +9,9 @@ "sizeX": 8, "sizeY": 5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": ".legend {\n font-size: 13px;\n line-height: 10px;\n}\n\n.legend table { \n border-spacing: 0px;\n border-collapse: separate;\n}\n\n.mouse-events .flot-overlay {\n cursor: crosshair; \n}\n\n", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.rangeChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.rangeChartWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n maxDatasources: 1,\n maxDataKeys: 1,\n singleEntity: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n hasAdditionalLatestDataKeys: false,\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries' }];\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.rangeChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.rangeChartWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n maxDatasources: 1,\n maxDataKeys: 1,\n singleEntity: true,\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n hasAdditionalLatestDataKeys: false,\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries' }];\n }\n };\n}\n", "settingsSchema": "{}", "dataKeySettingsSchema": "{}", "latestDataKeySettingsSchema": "{}", diff --git a/application/src/main/data/json/system/widget_types/state_chart.json b/application/src/main/data/json/system/widget_types/state_chart.json index ea65f55b43..d2a3031318 100644 --- a/application/src/main/data/json/system/widget_types/state_chart.json +++ b/application/src/main/data/json/system/widget_types/state_chart.json @@ -9,9 +9,9 @@ "sizeX": 8, "sizeY": 5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n stateData: true,\n chartType: 'state',\n previewWidth: '80%',\n embedTitlePanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('state'),\n defaultDataKeysFunction: function() {\n return [{ name: 'state', label: 'State', type: 'timeseries', units: '', decimals: 0 }];\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n stateData: true,\n chartType: 'state',\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings('state'),\n defaultDataKeysFunction: function() {\n return [{ name: 'state', label: 'State', type: 'timeseries', units: '', decimals: 0 }];\n }\n };\n}\n", "settingsSchema": "{}", "dataKeySettingsSchema": "{}", "latestDataKeySettingsSchema": "{}", diff --git a/application/src/main/data/json/system/widget_types/time_series_chart.json b/application/src/main/data/json/system/widget_types/time_series_chart.json index 449fffd11b..d61472b6f9 100644 --- a/application/src/main/data/json/system/widget_types/time_series_chart.json +++ b/application/src/main/data/json/system/widget_types/time_series_chart.json @@ -9,9 +9,9 @@ "sizeX": 8, "sizeY": 5, "resources": [], - "templateHtml": "\n", + "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n previewWidth: '80%',\n embedTitlePanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings(),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", + "controllerScript": "self.onInit = function() {\n self.ctx.$scope.timeSeriesChartWidget.onInit();\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onDataUpdated();\n}\n\nself.onLatestDataUpdated = function() {\n self.ctx.$scope.timeSeriesChartWidget.onLatestDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n previewWidth: '80%',\n embedTitlePanel: true,\n embedActionsPanel: true,\n hasAdditionalLatestDataKeys: true,\n dataKeySettingsFunction: TbTimeSeriesChart.dataKeySettings(),\n defaultDataKeysFunction: function() {\n return [{ name: 'temperature', label: 'Temperature', type: 'timeseries', units: '°C', decimals: 0 }];\n }\n };\n}\n", "settingsSchema": "{}", "dataKeySettingsSchema": "{}", "latestDataKeySettingsSchema": "{}", diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.html index 8833b60cfe..0e0170c603 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.html @@ -17,7 +17,14 @@ -->
    - + @if (widgetComponent.dashboardWidget.showWidgetTitlePanel) { +
    + + +
    + } @else { + + }
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.scss index 3c584b7fb8..76cae3cf24 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.scss @@ -104,4 +104,11 @@ } } } + + .tb-widget-title-row .tb-widget-actions { + margin: 0; + } + .tb-widget-actions.tb-widget-actions-absolute { + z-index: 2; + } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.ts index 51be4a70bf..746daf43b3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/bar-chart-with-labels-widget.component.ts @@ -40,6 +40,7 @@ import { } from '@home/components/widget/lib/chart/bar-chart-with-labels-widget.models'; import { TbTimeSeriesChart } from '@home/components/widget/lib/chart/time-series-chart'; import { DataKey } from '@shared/models/widget.models'; +import { WidgetComponent } from '@home/components/widget/widget.component'; @Component({ selector: 'tb-bar-chart-with-labels-widget', @@ -57,9 +58,6 @@ export class BarChartWithLabelsWidgetComponent implements OnInit, OnDestroy, Aft @Input() ctx: WidgetContext; - @Input() - widgetTitlePanel: TemplateRef; - showLegend: boolean; legendClass: string; @@ -73,7 +71,8 @@ export class BarChartWithLabelsWidgetComponent implements OnInit, OnDestroy, Aft private timeSeriesChart: TbTimeSeriesChart; - constructor(private imagePipe: ImagePipe, + constructor(public widgetComponent: WidgetComponent, + private imagePipe: ImagePipe, private sanitizer: DomSanitizer, private renderer: Renderer2, private cd: ChangeDetectorRef) { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart-widget.component.html index 7f7fb47389..8e90ab8fb6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart-widget.component.html @@ -19,6 +19,5 @@ #latestChart [ctx]="ctx" [settings]="settings" - [widgetTitlePanel]="widgetTitlePanel" [callbacks]="callbacks" > diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.html index 578f7fdf4b..20cfdf4623 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.html @@ -17,7 +17,14 @@ -->
    - + @if (widgetComponent.dashboardWidget.showWidgetTitlePanel) { +
    + + +
    + } @else { + + }
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.scss index 3566820c8d..2eb0ceb940 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.scss @@ -106,4 +106,11 @@ } } } + + .tb-widget-title-row .tb-widget-actions { + margin: 0; + } + .tb-widget-actions.tb-widget-actions-absolute { + z-index: 2; + } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.ts index 651240342c..85905dfd3e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/latest-chart.component.ts @@ -68,9 +68,6 @@ export class LatestChartComponent implements OnInit, OnDestroy, AfterViewInit { @Input() ctx: WidgetContext; - @Input() - widgetTitlePanel: TemplateRef; - @Input() callbacks: LatestChartComponentCallbacks; @@ -98,9 +95,9 @@ export class LatestChartComponent implements OnInit, OnDestroy, AfterViewInit { private latestChart: TbLatestChart; - constructor(private imagePipe: ImagePipe, + constructor(public widgetComponent: WidgetComponent, + private imagePipe: ImagePipe, private sanitizer: DomSanitizer, - private widgetComponent: WidgetComponent, private renderer: Renderer2, private translate: TranslateService, private cd: ChangeDetectorRef) { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.html index 8880503eb5..39112c484b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.html @@ -17,7 +17,14 @@ -->
    - + @if (widgetComponent.dashboardWidget.showWidgetTitlePanel) { +
    + + +
    + } @else { + + }
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.scss index 6f4b21a78d..ff339362a1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.scss @@ -104,4 +104,10 @@ } } } + .tb-widget-title-row .tb-widget-actions { + margin: 0; + } + .tb-widget-actions.tb-widget-actions-absolute { + z-index: 2; + } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.ts index eacbb883a4..0201ec7d5f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/range-chart-widget.component.ts @@ -48,6 +48,7 @@ import { Observable } from 'rxjs'; import { ImagePipe } from '@shared/pipe/image.pipe'; import { DomSanitizer } from '@angular/platform-browser'; import { TbTimeSeriesChart } from '@home/components/widget/lib/chart/time-series-chart'; +import { WidgetComponent } from '@home/components/widget/widget.component'; @Component({ selector: 'tb-range-chart-widget', @@ -65,9 +66,6 @@ export class RangeChartWidgetComponent implements OnInit, OnDestroy, AfterViewIn @Input() ctx: WidgetContext; - @Input() - widgetTitlePanel: TemplateRef; - showLegend: boolean; legendClass: string; @@ -86,7 +84,8 @@ export class RangeChartWidgetComponent implements OnInit, OnDestroy, AfterViewIn private timeSeriesChart: TbTimeSeriesChart; - constructor(private imagePipe: ImagePipe, + constructor(public widgetComponent: WidgetComponent, + private imagePipe: ImagePipe, private sanitizer: DomSanitizer, private renderer: Renderer2, private cd: ChangeDetectorRef) { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.html index 1ba501674e..1efcf30781 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.html @@ -17,9 +17,14 @@ -->
    - - - + @if (widgetComponent.dashboardWidget.showWidgetTitlePanel) { +
    + + +
    + } @else { + + }
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.scss index f500d3009b..37067ef935 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.scss @@ -156,4 +156,10 @@ $maxLegendHeight: 35%; } } } + .tb-widget-title-row .tb-widget-actions { + margin: 0; + } + .tb-widget-actions.tb-widget-actions-absolute { + z-index: 2; + } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.ts index 2e9f297b4a..2fd12b1b98 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart-widget.component.ts @@ -61,9 +61,6 @@ export class TimeSeriesChartWidgetComponent implements OnInit, OnDestroy, AfterV @Input() ctx: WidgetContext; - @Input() - widgetTitlePanel: TemplateRef; - horizontalLegendPosition = false; showLegend: boolean; From ae41cca700d16ac6e5e8c7a23dc6c204c807bb3c Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 28 Mar 2025 12:26:17 +0200 Subject: [PATCH 131/286] UI: New map widgets - calculate rotation angle for last timestamp. --- .../widget/lib/maps/data-layer/trips-data-layer.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts index e598685786..61585cf610 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts @@ -351,10 +351,10 @@ class TbTripDataItem extends TbDataLayerItem 1) { + result[timeStamp[timeStamp.length - 1]].rotationAngle = result[timeStamp[timeStamp.length - 2]].rotationAngle; + } + } else if (this.settings.rotateMarker && timeStamp.length > 1) { + const startPoint = this.dataLayer.dataProcessor.extractLocation(result[timeStamp[timeStamp.length - 2]], dsData); + const endPoint = this.dataLayer.dataProcessor.extractLocation(result[timeStamp[timeStamp.length - 1]], dsData); + result[timeStamp[timeStamp.length - 1]].rotationAngle += findRotationAngle(startPoint, endPoint); } return result; } From 665871c1d09ec03a465aeeb4f2798d82c36574c5 Mon Sep 17 00:00:00 2001 From: Tarnavskiy Date: Fri, 28 Mar 2025 16:20:29 +0200 Subject: [PATCH 132/286] PROD-5908: Fixed bug with empty step-increment field. Fixed adaptation for small screen view --- .../alarm/alarms-table-widget-settings.component.html | 4 ++-- .../alarm/alarms-table-widget-settings.component.ts | 11 +++++++---- .../timeseries-table-widget-settings.component.html | 4 ++-- .../timeseries-table-widget-settings.component.ts | 11 +++++++---- .../persistent-table-widget-settings.component.html | 4 ++-- .../persistent-table-widget-settings.component.ts | 11 +++++++---- .../entities-table-widget-settings.component.html | 4 ++-- .../entities-table-widget-settings.component.ts | 11 +++++++---- ui-ngx/src/form.scss | 3 ++- 9 files changed, 38 insertions(+), 25 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html index ba613ddbfe..eec36b90fa 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html @@ -95,7 +95,7 @@ {{ 'widgets.table.display-pagination' | translate }}
    -
    {{ 'widgets.table.page-step-settings' | translate }}
    +
    {{ 'widgets.table.page-step-settings' | translate }}
    widgets.table.page-step-increment
    @@ -113,7 +113,7 @@ warning - +
    widgets.table.page-step-count
    -
    {{ 'widgets.table.page-step-settings' | translate }}
    +
    {{ 'widgets.table.page-step-settings' | translate }}
    widgets.table.page-step-increment
    @@ -80,7 +80,7 @@ warning - +
    widgets.table.page-step-count
    -
    {{ 'widgets.table.page-step-settings' | translate }}
    +
    {{ 'widgets.table.page-step-settings' | translate }}
    widgets.table.page-step-increment
    @@ -67,7 +67,7 @@ warning - +
    widgets.table.page-step-count
    -
    {{ 'widgets.table.page-step-settings' | translate }}
    +
    {{ 'widgets.table.page-step-settings' | translate }}
    widgets.table.page-step-increment
    @@ -110,7 +110,7 @@ warning - +
    widgets.table.page-step-count
    Date: Fri, 28 Mar 2025 16:49:04 +0200 Subject: [PATCH 133/286] UI: Fix custom translation not working for Y-axis label in chart widget --- .../home/components/widget/lib/chart/time-series-chart.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts index 2b4b52ccfb..7bea76d325 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/chart/time-series-chart.ts @@ -793,7 +793,7 @@ export class TbTimeSeriesChart { } } else { if (!axis.option.name) { - axis.option.name = axis.settings.label; + axis.option.name = this.ctx.utilsService.customTranslation(axis.settings.label, axis.settings.label); result.changed = true; } const nameGap = size; From fbcfe9281d715130525d6eeaf306918bf7735af7 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 28 Mar 2025 17:02:41 +0200 Subject: [PATCH 134/286] wip cf consumer groups --- .../AbstractCalculatedFieldStateService.java | 18 +++---- .../cf/CalculatedFieldStateService.java | 6 +-- .../KafkaCalculatedFieldStateService.java | 6 +-- .../RocksDBCalculatedFieldStateService.java | 8 ++-- ...faultTbCalculatedFieldConsumerService.java | 48 ++++++++++++++----- .../InMemoryMonolithQueueFactory.java | 2 +- .../provider/KafkaMonolithQueueFactory.java | 15 ++++-- .../KafkaTbRuleEngineQueueFactory.java | 14 ++++-- .../provider/TbRuleEngineQueueFactory.java | 2 +- 9 files changed, 80 insertions(+), 39 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/AbstractCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/AbstractCalculatedFieldStateService.java index 91c08ab6e0..1347705a23 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/AbstractCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/AbstractCalculatedFieldStateService.java @@ -30,7 +30,9 @@ import org.thingsboard.server.service.cf.ctx.CalculatedFieldEntityCtxId; import org.thingsboard.server.service.cf.ctx.state.CalculatedFieldState; import java.util.Collection; +import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import static org.thingsboard.server.utils.CalculatedFieldUtils.fromProto; @@ -41,7 +43,7 @@ public abstract class AbstractCalculatedFieldStateService implements CalculatedF @Autowired private ActorSystemContext actorSystemContext; - protected QueueStateService, TbProtoQueueMsg> stateService; + protected Map, TbProtoQueueMsg>> stateServices = new ConcurrentHashMap<>(); @Override public final void persistState(CalculatedFieldEntityCtxId stateId, CalculatedFieldState state, TbCallback callback) { @@ -72,22 +74,22 @@ public abstract class AbstractCalculatedFieldStateService implements CalculatedF @Override public void restore(QueueKey queueKey, Set partitions) { - stateService.update(queueKey, partitions); + stateServices.get(queueKey).update(queueKey, partitions); } @Override - public void delete(Set partitions) { - stateService.delete(partitions); + public void delete(QueueKey queueKey, Set partitions) { + stateServices.get(queueKey).delete(partitions); } @Override - public Set getPartitions() { - return stateService.getPartitions().values().stream().flatMap(Collection::stream).collect(Collectors.toSet()); + public Set getPartitions(QueueKey queueKey) { + return stateServices.get(queueKey).getPartitions().values().stream().flatMap(Collection::stream).collect(Collectors.toSet()); } @Override - public void stop() { - stateService.stop(); + public void stop(QueueKey queueKey) { + stateServices.get(queueKey).stop(); } } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java index d0b34f18e8..a8b0ccf30e 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java @@ -37,10 +37,10 @@ public interface CalculatedFieldStateService { void restore(QueueKey queueKey, Set partitions); - void delete(Set partitions); + void delete(QueueKey queueKey, Set partitions); - Set getPartitions(); + Set getPartitions(QueueKey queueKey); - void stop(); + void stop(QueueKey queueKey); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java index 90d4056afc..9d59cbce95 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java @@ -97,7 +97,7 @@ public class KafkaCalculatedFieldStateService extends AbstractCalculatedFieldSta .scheduler(eventConsumer.getScheduler()) .taskExecutor(eventConsumer.getTaskExecutor()) .build(); - super.stateService = new KafkaQueueStateService<>(eventConsumer, stateConsumer); + super.stateServices.put(queueKey, new KafkaQueueStateService<>(eventConsumer, stateConsumer)); this.stateProducer = (TbKafkaProducerTemplate>) queueFactory.createCalculatedFieldStateProducer(); } @@ -145,8 +145,8 @@ public class KafkaCalculatedFieldStateService extends AbstractCalculatedFieldSta } @Override - public void stop() { - super.stop(); + public void stop(QueueKey queueKey) { + super.stop(queueKey); stateProducer.stop(); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java index 0eaa506dfd..889d8fcc01 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java @@ -20,13 +20,15 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.DataConstants; +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.queue.common.state.DefaultQueueStateService; import org.thingsboard.server.gen.transport.TransportProtos.CalculatedFieldStateProto; import org.thingsboard.server.gen.transport.TransportProtos.ToCalculatedFieldMsg; import org.thingsboard.server.queue.common.TbProtoQueueMsg; import org.thingsboard.server.queue.common.consumer.PartitionedQueueConsumerManager; +import org.thingsboard.server.queue.common.state.DefaultQueueStateService; import org.thingsboard.server.queue.discovery.QueueKey; import org.thingsboard.server.service.cf.AbstractCalculatedFieldStateService; import org.thingsboard.server.service.cf.CfRocksDb; @@ -44,7 +46,7 @@ public class RocksDBCalculatedFieldStateService extends AbstractCalculatedFieldS @Override public void init(PartitionedQueueConsumerManager> eventConsumer) { - super.stateService = new DefaultQueueStateService<>(eventConsumer); + super.stateServices.put(new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_STATES_QUEUE_NAME), new DefaultQueueStateService<>(eventConsumer)); } @Override @@ -61,7 +63,7 @@ public class RocksDBCalculatedFieldStateService extends AbstractCalculatedFieldS @Override public void restore(QueueKey queueKey, Set partitions) { - if (stateService.getPartitions().isEmpty()) { + if (stateServices.get(queueKey).getPartitions().isEmpty()) { cfRocksDb.forEach((key, value) -> { try { processRestoredState(CalculatedFieldStateProto.parseFrom(value)); diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index bce1992932..7149b58c57 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -30,12 +30,14 @@ import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.id.EntityIdFactory; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; +import org.thingsboard.server.common.data.queue.Queue; import org.thingsboard.server.common.data.queue.QueueConfig; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; 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.dao.queue.QueueService; import org.thingsboard.server.dao.tenant.TbTenantProfileCache; import org.thingsboard.server.gen.transport.TransportProtos.CalculatedFieldLinkedTelemetryMsgProto; import org.thingsboard.server.gen.transport.TransportProtos.CalculatedFieldTelemetryMsgProto; @@ -79,7 +81,10 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar private long packProcessingTimeout; private final TbRuleEngineQueueFactory queueFactory; + private final QueueService queueService; + private final CalculatedFieldStateService stateService; + private final ConcurrentMap>> consumers = new ConcurrentHashMap<>(); public DefaultTbCalculatedFieldConsumerService(TbRuleEngineQueueFactory tbQueueFactory, ActorSystemContext actorContext, @@ -91,28 +96,40 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar ApplicationEventPublisher eventPublisher, JwtSettingsService jwtSettingsService, CalculatedFieldCache calculatedFieldCache, + QueueService queueService, CalculatedFieldStateService stateService) { super(actorContext, tenantProfileCache, deviceProfileCache, assetProfileCache, calculatedFieldCache, apiUsageStateService, partitionService, eventPublisher, jwtSettingsService); this.queueFactory = tbQueueFactory; + this.queueService = queueService; this.stateService = stateService; } @Override protected void doAfterStartUp() { - var queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME); - PartitionedQueueConsumerManager> eventConsumer = PartitionedQueueConsumerManager.>create() + List queues = queueService.findAllQueues(); + for (Queue configuration : queues) { + if (partitionService.isManagedByCurrentService(configuration.getTenantId())) { + stateService.init(createConsumer(configuration)); + } + } + } + + private PartitionedQueueConsumerManager> createConsumer(Queue queue) { + QueueKey queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, queue.getTenantId()); + var eventConsumer = PartitionedQueueConsumerManager.>create() .queueKey(queueKey) .topic(partitionService.getTopic(queueKey)) .pollInterval(pollInterval) .msgPackProcessor(this::processMsgs) - .consumerCreator((config, partitionId) -> queueFactory.createToCalculatedFieldMsgConsumer()) + .consumerCreator((config, partitionId) -> queueFactory.createToCalculatedFieldMsgConsumer(queue, partitionId)) .queueAdmin(queueFactory.getCalculatedFieldQueueAdmin()) .consumerExecutor(consumersExecutor) .scheduler(scheduler) .taskExecutor(mgmtExecutor) .build(); - stateService.init(eventConsumer); + consumers.put(queueKey, eventConsumer); + return eventConsumer; } @PreDestroy @@ -227,13 +244,20 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar public void handleComponentLifecycleEvent(ComponentLifecycleMsg event) { if (event.getEntityId().getEntityType() == EntityType.TENANT) { if (event.getEvent() == ComponentLifecycleEvent.DELETED) { - Set partitions = stateService.getPartitions(); - if (CollectionUtils.isEmpty(partitions)) { - return; - } - stateService.delete(partitions.stream() - .filter(tpi -> tpi.getTenantId().isPresent() && tpi.getTenantId().get().equals(event.getTenantId())) - .collect(Collectors.toSet())); + consumers.keySet().removeIf(queueKey -> { + boolean toRemove = queueKey.getTenantId().equals(event.getTenantId()); + if (toRemove) { + Set partitions = stateService.getPartitions(queueKey); + if (!CollectionUtils.isEmpty(partitions)) { + stateService.delete(queueKey, partitions); + } + var consumer = consumers.remove(queueKey); + if (consumer != null) { + consumer.stop(); + } + } + return toRemove; + }); } } } @@ -258,7 +282,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractConsumerPar @Override protected void stopConsumers() { super.stopConsumers(); - stateService.stop(); // eventConsumer will be stopped by stateService + consumers.keySet().forEach(stateService::stop); // eventConsumer will be stopped by stateService } } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java index bd8b4bd4f8..8e724b9145 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java @@ -134,7 +134,7 @@ public class InMemoryMonolithQueueFactory implements TbCoreQueueFactory, TbRuleE } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer() { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(Queue configuration, Integer partitionId) { return new InMemoryTbQueueConsumer<>(storage, topicService.buildTopicName(calculatedFieldSettings.getEventTopic())); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index c50344a23f..841a5b29d8 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -104,7 +104,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi private final TbQueueAdmin housekeeperReprocessingAdmin; private final TbQueueAdmin edgeAdmin; private final TbQueueAdmin edgeEventAdmin; - private final TbQueueAdmin cfAdmin; + private final TbKafkaAdmin cfAdmin; private final TbQueueAdmin cfStateAdmin; private final TbQueueAdmin edqsEventsAdmin; private final TbKafkaAdmin edqsRequestsAdmin; @@ -514,15 +514,22 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer() { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(Queue configuration, Integer partitionId) { + String queueName = configuration.getName(); + String groupId = topicService.buildConsumerGroupId("cf-", configuration.getTenantId(), queueName, partitionId); + + cfAdmin.syncOffsets(topicService.buildConsumerGroupId("cf-", configuration.getTenantId(), queueName, null), // the fat groupId + groupId, partitionId); + TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.buildTopicName(calculatedFieldSettings.getEventTopic())); - consumerBuilder.clientId("monolith-calculated-field-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); - consumerBuilder.groupId(topicService.buildTopicName("monolith-calculated-field-consumer")); + consumerBuilder.clientId("cf-" + queueName + "-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); + consumerBuilder.groupId(groupId); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToCalculatedFieldMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(cfAdmin); consumerBuilder.statsService(consumerStatsService); + return consumerBuilder.build(); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index 2e342b0dd2..e0f7348d9f 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -89,7 +89,7 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { private final TbQueueAdmin housekeeperAdmin; private final TbQueueAdmin edgeAdmin; private final TbQueueAdmin edgeEventAdmin; - private final TbQueueAdmin cfAdmin; + private final TbKafkaAdmin cfAdmin; private final TbQueueAdmin cfStateAdmin; private final TbQueueAdmin edqsEventsAdmin; private final AtomicLong consumerCount = new AtomicLong(); @@ -309,12 +309,18 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer() { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(Queue configuration, Integer partitionId) { + String queueName = configuration.getName(); + String groupId = topicService.buildConsumerGroupId("cf-", configuration.getTenantId(), queueName, partitionId); + + cfAdmin.syncOffsets(topicService.buildConsumerGroupId("cf-", configuration.getTenantId(), queueName, null), // the fat groupId + groupId, partitionId); + TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.buildTopicName(calculatedFieldSettings.getEventTopic())); - consumerBuilder.clientId("tb-rule-engine-calculated-field-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); - consumerBuilder.groupId(topicService.buildTopicName("tb-rule-engine-calculated-field-consumer")); + consumerBuilder.clientId("cf-" + queueName + "-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); + consumerBuilder.groupId(groupId); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToCalculatedFieldMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(cfAdmin); consumerBuilder.statsService(consumerStatsService); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java index 329e3e346a..4a4b36b6ae 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java @@ -121,7 +121,7 @@ public interface TbRuleEngineQueueFactory extends TbUsageStatsClientQueueFactory TbQueueRequestTemplate, TbProtoQueueMsg> createRemoteJsRequestTemplate(); - TbQueueConsumer> createToCalculatedFieldMsgConsumer(); + TbQueueConsumer> createToCalculatedFieldMsgConsumer(Queue configuration, Integer partitionId); TbQueueAdmin getCalculatedFieldQueueAdmin(); From 4a811e978edd94525bb923584af3c7736d8b308e Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 28 Mar 2025 18:35:06 +0200 Subject: [PATCH 135/286] UI: Fix map settings not updating when switching between different map type widgets --- .../common/map/map-settings.component.ts | 21 +++++++++++++++++-- .../map/map-widget-settings.component.ts | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts index f38f2a042c..5b949bae75 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-settings.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, DestroyRef, forwardRef, Input, OnInit } from '@angular/core'; +import { Component, DestroyRef, forwardRef, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { ControlValueAccessor, NG_VALIDATORS, @@ -70,7 +70,7 @@ import { MatDialog } from '@angular/material/dialog'; } ] }) -export class MapSettingsComponent implements OnInit, ControlValueAccessor, Validator { +export class MapSettingsComponent implements OnInit, ControlValueAccessor, Validator, OnChanges { mapControlPositions = mapControlPositions; @@ -205,6 +205,23 @@ export class MapSettingsComponent implements OnInit, ControlValueAccessor, Valid } } + ngOnChanges(changes: SimpleChanges) { + if (changes.trip) { + const tripChange = changes.trip; + if (!tripChange.firstChange && tripChange.currentValue !== tripChange.previousValue) { + if (this.trip) { + this.dataLayerMode = 'trips' + this.mapSettingsFormGroup.addControl('trips', this.fb.control(this.modelValue.trips), {emitEvent: false}); + this.mapSettingsFormGroup.addControl('tripTimeline', this.fb.control(this.modelValue.tripTimeline), {emitEvent: false}); + } else { + this.dataLayerMode = 'markers'; + this.mapSettingsFormGroup.removeControl('trips', {emitEvent: false}); + this.mapSettingsFormGroup.removeControl('tripTimeline', {emitEvent: false}); + } + } + } + } + writeValue(value: MapSetting): void { this.modelValue = value; this.mapSettingsFormGroup.patchValue( diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts index 3dc10f34cf..f301219045 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/map/map-widget-settings.component.ts @@ -47,6 +47,8 @@ export class MapWidgetSettingsComponent extends WidgetSettingsComponent { const params = widgetConfig.typeParameters as any; if (isDefinedAndNotNull(params.trip)) { this.trip = params.trip === true; + } else { + this.trip = false; } } From 252e6da744543fbd8f9f81027c2fa88d67702265 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 31 Mar 2025 11:32:23 +0300 Subject: [PATCH 136/286] UI: Fixed scrolling markdown source code module --- ui-ngx/src/app/shared/models/js-function.models.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/models/js-function.models.ts b/ui-ngx/src/app/shared/models/js-function.models.ts index 94c04efc8a..40b9175e10 100644 --- a/ui-ngx/src/app/shared/models/js-function.models.ts +++ b/ui-ngx/src/app/shared/models/js-function.models.ts @@ -141,7 +141,7 @@ export const loadModuleMarkdownSourceCode = (http: HttpClient, translate: Transl let sourceCode = `
    ${resource.title}
    ${translate.instant('js-func.source-code')}
    \n\n`; return loadFunctionModuleSource(http, resource.link).pipe( map((source) => { - sourceCode += '```javascript\n{:code-style="margin-left: -16px; margin-right: -16px;"}\n' + source + '\n```'; + sourceCode += '```javascript\n{:code-style="margin-left: -16px; margin-right: -16px; max-height: 65vh;"}\n' + source + '\n```'; return sourceCode; }), catchError(err => { From 4746ef53670003de884182cee3ac4e731098c158 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 31 Mar 2025 12:21:57 +0300 Subject: [PATCH 137/286] UI: Fix chart settings not updating when switching between different chart type widgets in advanced mode --- .../time-series-chart-widget-settings.component.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts index dc56c2a328..68d849fd0c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/chart/time-series-chart-widget-settings.component.ts @@ -105,6 +105,17 @@ export class TimeSeriesChartWidgetSettingsComponent extends WidgetSettingsCompon const params = widgetConfig.typeParameters as any; if (isDefinedAndNotNull(params.chartType)) { this.chartType = params.chartType; + } else { + this.chartType = TimeSeriesChartType.default; + } + if (this.timeSeriesChartWidgetSettingsForm) { + const isStateChartType = this.chartType === TimeSeriesChartType.state; + const hasStatesControl = this.timeSeriesChartWidgetSettingsForm.contains('states'); + if (isStateChartType && !hasStatesControl) { + this.timeSeriesChartWidgetSettingsForm.addControl('states', this.fb.control(widgetConfig.config.settings.states), { emitEvent: false }); + } else if (!isStateChartType && hasStatesControl) { + this.timeSeriesChartWidgetSettingsForm.removeControl('states', { emitEvent: false }); + } } } From 606c9719732615dabec8ec6e71e9499fb2709930 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Mon, 31 Mar 2025 12:25:32 +0300 Subject: [PATCH 138/286] UI: New map widgets - introduce additional datasources for map data layer. --- .../lib/maps/data-layer/circles-data-layer.ts | 7 +- .../lib/maps/data-layer/map-data-layer.ts | 45 ++-- .../lib/maps/data-layer/markers-data-layer.ts | 7 +- .../maps/data-layer/polygons-data-layer.ts | 7 +- .../lib/maps/data-layer/trips-data-layer.ts | 23 +- .../home/components/widget/lib/maps/map.ts | 7 +- .../panels/map-timeline-panel.component.ts | 10 +- .../filter/filter-select.component.html | 37 +++- .../common/filter/filter-select.component.ts | 4 + ...itional-map-data-source-row.component.html | 80 +++++++ ...itional-map-data-source-row.component.scss | 56 +++++ ...dditional-map-data-source-row.component.ts | 207 ++++++++++++++++++ ...additional-map-data-sources.component.html | 43 ++++ ...additional-map-data-sources.component.scss | 53 +++++ .../additional-map-data-sources.component.ts | 147 +++++++++++++ ...-layer-color-settings-panel.component.html | 2 +- .../map/map-data-layer-dialog.component.html | 12 + .../map/map-data-layer-dialog.component.ts | 4 + .../map/map-data-layer-row.component.ts | 3 + .../map/map-data-source-row.component.html | 26 +-- .../map/map-data-source-row.component.scss | 24 +- .../map/map-data-source-row.component.ts | 74 +------ .../map/map-data-sources.component.html | 8 +- .../map/map-data-sources.component.scss | 23 +- .../common/map/map-data-sources.component.ts | 26 +-- .../common/map/map-settings.component.html | 4 +- .../common/widget-settings-common.module.ts | 12 +- .../models/widget/maps/map-export.models.ts | 94 +++++--- .../shared/models/widget/maps/map.models.ts | 37 +++- .../assets/locale/locale.constant-en_US.json | 2 + 30 files changed, 862 insertions(+), 222 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.scss create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.scss create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.ts diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/circles-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/circles-data-layer.ts index 9e25ddb486..2d3fc6b2fe 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/circles-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/circles-data-layer.ts @@ -22,7 +22,7 @@ import { TbMapDatasource } from '@shared/models/widget/maps/map.models'; import L from 'leaflet'; -import { FormattedData } from '@shared/models/widget.models'; +import { DataKey, FormattedData } from '@shared/models/widget.models'; import { TbShapesDataLayer } from '@home/components/widget/lib/maps/data-layer/shapes-data-layer'; import { TbMap } from '@home/components/widget/lib/maps/map'; import { Observable } from 'rxjs'; @@ -213,9 +213,8 @@ export class TbCirclesDataLayer extends TbShapesDataLayer): Partial { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/map-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/map-data-layer.ts index 63d77c48b2..5dcb80ec41 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/map-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/map-data-layer.ts @@ -41,7 +41,7 @@ import L from 'leaflet'; import { CompiledTbFunction } from '@shared/models/js-function.models'; import { forkJoin, Observable, of } from 'rxjs'; import { map } from 'rxjs/operators'; -import { DataKey, FormattedData } from '@shared/models/widget.models'; +import { DataKey, DatasourceType, FormattedData } from '@shared/models/widget.models'; import { CustomTranslatePipe } from '@shared/pipe/custom-translate.pipe'; import { TbMap } from '@home/components/widget/lib/maps/map'; import { WidgetContext } from '@home/models/widget-component.models'; @@ -170,7 +170,7 @@ export abstract class TbMapDataLayer { - this.datasource = mapDataSourceSettingsToDatasource(this.settings); - this.datasource.dataKeys = this.settings.additionalDataKeys ? [...this.settings.additionalDataKeys] : []; - const colorRangeKeys = this.allColorSettings().filter(settings => settings.type === DataLayerColorType.range && settings.rangeKey) - .map(settings => settings.rangeKey); - this.datasource.dataKeys.push(...colorRangeKeys); - this.mapDataId = this.datasource.mapDataIds[0]; - this.datasource = this.setupDatasource(this.datasource); + this.dataSources = []; + const datasource = mapDataSourceSettingsToDatasource(this.settings); + this.mapDataId = datasource.mapDataIds[0]; + this.dataSources.push(datasource); + if (this.settings.additionalDataSources?.length && datasource.type !== DatasourceType.function) { + this.dataSources.push(...this.settings.additionalDataSources.map(ds => mapDataSourceSettingsToDatasource(ds, this.mapDataId))); + } + const dataKeys = this.calculateDataKeys(); + const latestDataKeys = this.calculateLatestDataKeys(); + this.dataSources.forEach(ds => ds.dataKeys.push(...dataKeys)); + if (latestDataKeys?.length) { + this.dataSources.forEach(ds => ds.latestDataKeys.push(...latestDataKeys)); + } return forkJoin( [ this.dataLayerLabelProcessor ? this.dataLayerLabelProcessor.setup() : of(null), @@ -241,8 +247,8 @@ export abstract class TbMapDataLayer settings.type === DataLayerColorType.range && settings.rangeKey) + .map(settings => settings.rangeKey); + dataKeys.push(...colorRangeKeys); + dataKeys.push(...this.getDataKeys()); + return dataKeys; + } + + protected calculateLatestDataKeys(): DataKey[] { + return []; + } + + protected getDataKeys(): DataKey[] { + return []; } protected allColorSettings(): DataLayerColorSettings[] { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts index 3696435683..093cc265bb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/markers-data-layer.ts @@ -37,7 +37,7 @@ import { TbMapDatasource } from '@shared/models/widget/maps/map.models'; import L, { FeatureGroup } from 'leaflet'; -import { FormattedData } from '@shared/models/widget.models'; +import { DataKey, FormattedData } from '@shared/models/widget.models'; import { forkJoin, Observable, of } from 'rxjs'; import { CompiledTbFunction } from '@shared/models/js-function.models'; import { @@ -628,9 +628,8 @@ export class TbMarkersDataLayer extends TbLatestMapDataLayer): Partial { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts index 61585cf610..ae2f62853e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/trips-data-layer.ts @@ -535,22 +535,33 @@ export class TbTripsDataLayer extends TbMapDataLayer settings.type === DataLayerColorType.range && settings.rangeKey) - .map(settings => settings.rangeKey); + .map(settings => settings.rangeKey); if (this.settings.additionalDataKeys?.length) { additionalKeys.push(...this.settings.additionalDataKeys); } if (additionalKeys.length) { const tsKeys = additionalKeys.filter(key => key.type === DataKeyType.timeseries); + dataKeys.push(...tsKeys); + } + return dataKeys; + } + + protected calculateLatestDataKeys(): DataKey[] { + const additionalKeys = this.allColorSettings().filter(settings => settings.type === DataLayerColorType.range && settings.rangeKey) + .map(settings => settings.rangeKey); + if (this.settings.additionalDataKeys?.length) { + additionalKeys.push(...this.settings.additionalDataKeys); + } + if (additionalKeys.length) { const latestKeys = additionalKeys.filter(key => key.type !== DataKeyType.timeseries); - datasource.dataKeys.push(...tsKeys); if (latestKeys.length) { - datasource.latestDataKeys = latestKeys; + return latestKeys; } } - return datasource; + return []; } protected allColorSettings(): DataLayerColorSettings[] { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts index 72f075e8f1..f1bb414878 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map.ts @@ -308,7 +308,8 @@ export abstract class TbMap { () => { let datasources: TbMapDatasource[]; for (const layerType of mapDataLayerTypes) { - const typeDatasources = this.latestDataLayers.filter(dl => dl.dataLayerType() === layerType).map(dl => dl.getDatasource()); + const typeDatasources = this.latestDataLayers.filter(dl => dl.dataLayerType() === layerType) + .map(dl => dl.getDataSources()).flat(); if (!datasources) { datasources = typeDatasources; } else { @@ -349,7 +350,7 @@ export abstract class TbMap { ); } if (this.tripDataLayers.length) { - const tripDatasources = this.tripDataLayers.map(dl => dl.getDatasource()); + const tripDatasources = this.tripDataLayers.map(dl => dl.getDataSources()).flat(); const tripDataLayersSubscriptionOptions: WidgetSubscriptionOptions = { datasources: tripDatasources, hasDataPageLink: true, @@ -926,7 +927,7 @@ export abstract class TbMap { private calculateCurrentTime(minTime: number, maxTime: number): number { if (minTime !== this.minTime || maxTime !== this.maxTime) { - if (this.minTime >= this.currentTime || isUndefined(this.currentTime)) { + if (this.minTime >= this.currentTime || isUndefined(this.currentTime) || this.currentTime === Infinity) { return this.minTime; } else if (this.maxTime <= this.currentTime) { return this.maxTime; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/panels/map-timeline-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/panels/map-timeline-panel.component.ts index 7044ffa5fe..f9d0fa6d07 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/panels/map-timeline-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/panels/map-timeline-panel.component.ts @@ -202,7 +202,10 @@ export class MapTimelinePanelComponent implements OnInit, OnDestroy { public moveNext() { if (this.index < this.maxTimeIndex) { if (this.settings.snapToRealLocation) { - const anchorIndex = this.findIndex(this.currentTime, this.anchors) + 1; + let anchorIndex = this.findIndex(this.currentTime, this.anchors) + 1; + if (anchorIndex >= this.anchors.length) { + anchorIndex = this.anchors.length - 1; + } this.index = Math.floor((this.anchors[anchorIndex] - this.minValue) / this.settings.timeStep); } else { this.index++; @@ -214,7 +217,10 @@ export class MapTimelinePanelComponent implements OnInit, OnDestroy { public movePrev() { if (this.index > this.minTimeIndex) { if (this.settings.snapToRealLocation) { - const anchorIndex = this.findIndex(this.currentTime, this.anchors) - 1; + let anchorIndex = this.findIndex(this.currentTime, this.anchors) - 1; + if (anchorIndex < 0) { + anchorIndex = 0; + } this.index = Math.floor((this.anchors[anchorIndex] - this.minValue) / this.settings.timeStep); } else { this.index--; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/filter/filter-select.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/filter/filter-select.component.html index 5e67638092..ff1bcb06a4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/filter/filter-select.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/filter/filter-select.component.html @@ -15,9 +15,14 @@ limitations under the License. --> - - {{ 'filter.filter' | translate }} - + {{ 'filter.filter' | translate }} + - - + + warning + +
    + +
    +
    +
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.scss new file mode 100644 index 0000000000..3d5db8d73a --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.scss @@ -0,0 +1,56 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@import '../../../../../../../../../scss/constants'; + +.tb-form-table-row.tb-additional-map-data-source-row { + + .tb-source-field { + flex: 1 1 50%; + display: flex; + gap: 12px; + .tb-ds-type-field, .tb-label-field, .tb-device-field, .tb-entity-alias-field { + flex: 1; + } + } + + .tb-data-keys-field { + flex: 1 1 50%; + min-width: 0; + } + + .tb-remove-button { + width: 40px; + min-width: 40px; + } + + @media #{$mat-lt-lg} { + .tb-source-field { + flex-direction: column; + flex: 1 1 30%; + } + .tb-data-keys-field { + flex: 1 1 70%; + } + @media #{$mat-lt-md} { + .tb-source-field { + flex: 1 1 50%; + } + .tb-data-keys-field { + flex: 1 1 50%; + } + } + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts new file mode 100644 index 0000000000..0957d991f5 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-source-row.component.ts @@ -0,0 +1,207 @@ +/// +/// Copyright © 2016-2025 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { + ChangeDetectorRef, + Component, + DestroyRef, + EventEmitter, + forwardRef, + Input, + OnInit, + Output, + ViewEncapsulation +} from '@angular/core'; +import { + ControlValueAccessor, + NG_VALUE_ACCESSOR, + UntypedFormBuilder, + UntypedFormGroup, + Validators +} from '@angular/forms'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { AdditionalMapDataSourceSettings } from '@shared/models/widget/maps/map.models'; +import { DataKey, DatasourceType, datasourceTypeTranslationMap, widgetType } from '@shared/models/widget.models'; +import { EntityType } from '@shared/models/entity-type.models'; +import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; +import { genNextLabelForDataKeys } from '@core/utils'; +import { MapSettingsContext } from '@home/components/widget/lib/settings/common/map/map-settings.component.models'; + +@Component({ + selector: 'tb-additional-map-data-source-row', + templateUrl: './additional-map-data-source-row.component.html', + styleUrls: ['./additional-map-data-source-row.component.scss'], + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => AdditionalMapDataSourceRowComponent), + multi: true + } + ], + encapsulation: ViewEncapsulation.None +}) +export class AdditionalMapDataSourceRowComponent implements ControlValueAccessor, OnInit { + + DatasourceType = DatasourceType; + DataKeyType = DataKeyType; + + EntityType = EntityType; + + widgetType = widgetType; + + datasourceTypes: Array = []; + datasourceTypesTranslations = datasourceTypeTranslationMap; + + @Input() + disabled: boolean; + + @Input() + context: MapSettingsContext; + + @Output() + dataSourceRemoved = new EventEmitter(); + + dataSourceFormGroup: UntypedFormGroup; + + generateAdditionalDataKey = this.generateDataKey.bind(this); + + modelValue: AdditionalMapDataSourceSettings; + + private propagateChange = (_val: any) => {}; + + constructor(private fb: UntypedFormBuilder, + private cd: ChangeDetectorRef, + private destroyRef: DestroyRef) { + } + + ngOnInit() { + if (this.context.functionsOnly) { + this.datasourceTypes = [DatasourceType.function]; + } else { + this.datasourceTypes = [DatasourceType.function, DatasourceType.device, DatasourceType.entity]; + } + this.dataSourceFormGroup = this.fb.group({ + dsType: [null, [Validators.required]], + dsLabel: [null, []], + dsDeviceId: [null, [Validators.required]], + dsEntityAliasId: [null, [Validators.required]], + dataKeys: [null, [Validators.required]] + }); + this.dataSourceFormGroup.valueChanges.pipe( + takeUntilDestroyed(this.destroyRef) + ).subscribe( + () => this.updateModel() + ); + this.dataSourceFormGroup.get('dsType').valueChanges.pipe( + takeUntilDestroyed(this.destroyRef) + ).subscribe( + (newDsType: DatasourceType) => this.onDsTypeChanged(newDsType) + ); + } + + registerOnChange(fn: any): void { + this.propagateChange = fn; + } + + registerOnTouched(_fn: any): void { + } + + setDisabledState(isDisabled: boolean): void { + this.disabled = isDisabled; + if (isDisabled) { + this.dataSourceFormGroup.disable({emitEvent: false}); + } else { + this.dataSourceFormGroup.enable({emitEvent: false}); + this.updateValidators(); + } + } + + writeValue(value: AdditionalMapDataSourceSettings): void { + this.modelValue = value; + this.dataSourceFormGroup.patchValue( + { + dsType: value?.dsType, + dsLabel: value?.dsLabel, + dsDeviceId: value?.dsDeviceId, + dsEntityAliasId: value?.dsEntityAliasId, + dataKeys: value?.dataKeys + }, {emitEvent: false} + ); + this.updateValidators(); + this.cd.markForCheck(); + } + + private generateDataKey(key: DataKey): DataKey { + const dataKey = this.context.callbacks.generateDataKey(key.name, key.type, null, false, null); + const dataKeys: DataKey[] = this.dataSourceFormGroup.get('dataKeys').value || []; + dataKey.label = genNextLabelForDataKeys(dataKey.label, dataKeys); + return dataKey; + } + + private onDsTypeChanged(newDsType: DatasourceType) { + let updateModel = false; + const dataKeys: DataKey[] = this.dataSourceFormGroup.get('dataKeys').value; + if (dataKeys?.length) { + for (const key of dataKeys) { + updateModel = this.updateDataKeyToNewDsType(key, newDsType) || updateModel; + } + if (updateModel) { + this.dataSourceFormGroup.get('dataKeys').patchValue(dataKeys, {emitEvent: false}); + } + } + this.updateValidators(); + if (updateModel) { + this.updateModel(); + } + } + + private updateDataKeyToNewDsType(dataKey: DataKey, newDsType: DatasourceType): boolean { + if (newDsType === DatasourceType.function) { + if (dataKey.type !== DataKeyType.function) { + dataKey.type = DataKeyType.function; + return true; + } + } else { + if (dataKey.type === DataKeyType.function) { + dataKey.type = DataKeyType.attribute; + return true; + } + } + return false; + } + + private updateValidators() { + const dsType: DatasourceType = this.dataSourceFormGroup.get('dsType').value; + if (dsType === DatasourceType.function) { + this.dataSourceFormGroup.get('dsLabel').enable({emitEvent: false}); + this.dataSourceFormGroup.get('dsDeviceId').disable({emitEvent: false}); + this.dataSourceFormGroup.get('dsEntityAliasId').disable({emitEvent: false}); + } else if (dsType === DatasourceType.device) { + this.dataSourceFormGroup.get('dsLabel').disable({emitEvent: false}); + this.dataSourceFormGroup.get('dsDeviceId').enable({emitEvent: false}); + this.dataSourceFormGroup.get('dsEntityAliasId').disable({emitEvent: false}); + } else { + this.dataSourceFormGroup.get('dsLabel').disable({emitEvent: false}); + this.dataSourceFormGroup.get('dsDeviceId').disable({emitEvent: false}); + this.dataSourceFormGroup.get('dsEntityAliasId').enable({emitEvent: false}); + } + } + + private updateModel() { + this.modelValue = {...this.modelValue, ...this.dataSourceFormGroup.value}; + this.propagateChange(this.modelValue); + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.html new file mode 100644 index 0000000000..7492dd90ff --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.html @@ -0,0 +1,43 @@ + +
    +
    +
    +
    widgets.maps.data-layer.source
    +
    widgets.maps.data-layer.data-keys
    +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +
    + + {{ 'widgets.maps.data-layer.no-datasources' | translate }} + diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.scss new file mode 100644 index 0000000000..de4e639051 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.scss @@ -0,0 +1,53 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@import '../../../../../../../../../scss/constants'; + +.tb-additional-map-data-sources { + .tb-form-table-header-cell { + &.tb-source-header { + flex: 1 1 50%; + } + &.tb-data-keys-header { + flex: 1 1 50%; + } + &.tb-actions-header { + width: 40px; + min-width: 40px; + } + @media #{$mat-lt-lg} { + &.tb-source-header { + flex: 1 1 30%; + } + &.tb-data-keys-header { + flex: 1 1 70%; + } + @media #{$mat-lt-md} { + &.tb-source-header { + flex: 1 1 50%; + } + &.tb-data-keys-header { + flex: 1 1 50%; + } + } + } + } + + .tb-form-table-body { + tb-additional-map-data-source-row { + overflow: hidden; + } + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.ts new file mode 100644 index 0000000000..5cb2ade353 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/additional-map-data-sources.component.ts @@ -0,0 +1,147 @@ +/// +/// Copyright © 2016-2025 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { Component, DestroyRef, forwardRef, Input, OnInit, ViewEncapsulation } from '@angular/core'; +import { + AbstractControl, + ControlValueAccessor, + NG_VALIDATORS, + NG_VALUE_ACCESSOR, + UntypedFormArray, + UntypedFormBuilder, + UntypedFormControl, + UntypedFormGroup, + Validator +} from '@angular/forms'; +import { mergeDeep } from '@core/utils'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { + AdditionalMapDataSourceSettings, + additionalMapDataSourceValid, + additionalMapDataSourceValidator, + defaultAdditionalMapDataSourceSettings +} from '@shared/models/widget/maps/map.models'; +import { MapSettingsContext } from '@home/components/widget/lib/settings/common/map/map-settings.component.models'; + +@Component({ + selector: 'tb-additional-map-data-sources', + templateUrl: './additional-map-data-sources.component.html', + styleUrls: ['./additional-map-data-sources.component.scss'], + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => AdditionalMapDataSourcesComponent), + multi: true + }, + { + provide: NG_VALIDATORS, + useExisting: forwardRef(() => AdditionalMapDataSourcesComponent), + multi: true + } + ], + encapsulation: ViewEncapsulation.None +}) +export class AdditionalMapDataSourcesComponent implements ControlValueAccessor, OnInit, Validator { + + @Input() + disabled: boolean; + + @Input() + context: MapSettingsContext; + + dataSourcesFormGroup: UntypedFormGroup; + + private propagateChange = (_val: any) => {}; + + constructor(private fb: UntypedFormBuilder, + private destroyRef: DestroyRef) { + } + + ngOnInit() { + this.dataSourcesFormGroup = this.fb.group({ + dataSources: [this.fb.array([]), []] + }); + this.dataSourcesFormGroup.valueChanges.pipe( + takeUntilDestroyed(this.destroyRef) + ).subscribe( + () => { + let dataSources: AdditionalMapDataSourceSettings[] = this.dataSourcesFormGroup.get('dataSources').value; + if (dataSources) { + dataSources = dataSources.filter(dataSource => additionalMapDataSourceValid(dataSource)); + } + this.propagateChange(dataSources); + } + ); + } + + registerOnChange(fn: any): void { + this.propagateChange = fn; + } + + registerOnTouched(fn: any): void { + } + + setDisabledState(isDisabled: boolean): void { + this.disabled = isDisabled; + if (isDisabled) { + this.dataSourcesFormGroup.disable({emitEvent: false}); + } else { + this.dataSourcesFormGroup.enable({emitEvent: false}); + } + } + + writeValue(value: AdditionalMapDataSourceSettings[] | undefined): void { + const dataSources: AdditionalMapDataSourceSettings[] = value || []; + this.dataSourcesFormGroup.setControl('dataSources', this.prepareDataSourcesFormArray(dataSources), {emitEvent: false}); + } + + public validate(c: UntypedFormControl) { + const valid = this.dataSourcesFormGroup.valid; + return valid ? null : { + dataSources: { + valid: false, + }, + }; + } + + dataSourcesFormArray(): UntypedFormArray { + return this.dataSourcesFormGroup.get('dataSources') as UntypedFormArray; + } + + trackByDataSource(index: number, dataSourceControl: AbstractControl): any { + return dataSourceControl; + } + + removeDataSource(index: number) { + (this.dataSourcesFormGroup.get('dataSources') as UntypedFormArray).removeAt(index); + } + + addDataSource() { + const dataSource = mergeDeep({} as AdditionalMapDataSourceSettings, + defaultAdditionalMapDataSourceSettings(this.context.functionsOnly)); + const dataSourcesArray = this.dataSourcesFormGroup.get('dataSources') as UntypedFormArray; + const dataSourceControl = this.fb.control(dataSource, [additionalMapDataSourceValidator]); + dataSourcesArray.push(dataSourceControl); + } + + private prepareDataSourcesFormArray(dataSources: AdditionalMapDataSourceSettings[]): UntypedFormArray { + const dataSourcesControls: Array = []; + dataSources.forEach((dataSource) => { + dataSourcesControls.push(this.fb.control(dataSource, [additionalMapDataSourceValidator])); + }); + return this.fb.array(dataSourcesControls); + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html index 281f20ccd4..3501559523 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.html @@ -39,7 +39,7 @@
    -
    + + + + widgets.maps.data-layer.more-datasources + + + + + + +
    {{ 'datakey.keys' | translate }}
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts index dc0123406a..87c2650b82 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts @@ -179,6 +179,7 @@ export class MapDataLayerDialogComponent extends DialogComponent - - -
    - - + formControlName="dsFilterId" + [callbacks]="context.callbacks"> +
    - {{ 'widgets.maps.overlays.trips' | translate }} - {{ 'widgets.maps.overlays.markers' | translate }} - {{ 'widgets.maps.overlays.polygons' | translate }} - {{ 'widgets.maps.overlays.circles' | translate }} + {{ 'widgets.maps.overlays.trips' | translate }} + {{ 'widgets.maps.overlays.markers' | translate }} + {{ 'widgets.maps.overlays.polygons' | translate }} + {{ 'widgets.maps.overlays.circles' | translate }}
    warning diff --git a/ui-ngx/src/app/shared/components/toggle-header.component.ts b/ui-ngx/src/app/shared/components/toggle-header.component.ts index 4d3e56bd0f..3058ad285d 100644 --- a/ui-ngx/src/app/shared/components/toggle-header.component.ts +++ b/ui-ngx/src/app/shared/components/toggle-header.component.ts @@ -46,13 +46,12 @@ import { coerceBoolean } from '@shared/decorators/coercion'; import { startWith, takeUntil } from 'rxjs/operators'; import { Platform } from '@angular/cdk/platform'; import { MatButtonToggle, MatButtonToggleGroup } from '@angular/material/button-toggle'; -import { isDefinedAndNotNull } from '@core/utils'; +import { isDefined } from '@core/utils'; export interface ToggleHeaderOption { name: string; value: any; - error?: boolean; - errorText?: any; + error?: string; } export type ToggleHeaderAppearance = 'fill' | 'fill-invert' | 'stroked'; @@ -70,11 +69,9 @@ export class ToggleOption implements OnChanges { @Input() value: any; - @Input() error: boolean; + @Input() error: string; - @Input() errorText: any; - - @Output() errorChange = new EventEmitter(); + @Output() errorChange = new EventEmitter(); get viewValue(): string { return (this._element?.nativeElement.textContent || '').trim(); @@ -85,8 +82,8 @@ export class ToggleOption implements OnChanges { ) {} ngOnChanges(changes: SimpleChanges) { - if (changes['error']) { - if (!changes['error'].firstChange && changes['error'].currentValue !== changes['error'].previousValue) { + if (changes?.error) { + if (!changes.error.firstChange && changes.error.currentValue !== changes.error.previousValue) { this.errorChange.emit(this.error); } } @@ -121,7 +118,7 @@ export abstract class _ToggleBase extends PageComponent implements AfterContentI private subscribeToToggleOptions() { this.toggleOptions.forEach(option => { - if (isDefinedAndNotNull(option.error) || isDefinedAndNotNull(option.errorText)) { + if (isDefined(option.error)) { option.errorChange.pipe(takeUntil(this._destroyed)).subscribe(() => { this.syncToggleHeaderOptions(); }); @@ -137,8 +134,7 @@ export abstract class _ToggleBase extends PageComponent implements AfterContentI { name: option.viewValue, value: option.value, - error: option.error, - errorText: option.errorText + error: option.error } ); }); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 7c5eae3f75..608bb0917a 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1137,7 +1137,8 @@ "key-required": "Key is required.", "key-pattern": "Key is invalid.", "key-max-length": "Key should be less than 256 characters." - } + }, + "required-fields": "Missing required fields" }, "content-type": { "json": "Json", @@ -7980,8 +7981,7 @@ "trips": "Trips", "markers": "Markers", "polygons": "Polygons", - "circles": "Circles", - "required-fields": "Required fields are not filled in." + "circles": "Circles" }, "data-layer": { "source": "Source", From 40179f0010935c483e76092629f29025aad257b0 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 2 Apr 2025 15:59:04 +0300 Subject: [PATCH 167/286] UI: Border error for toggle button --- .../src/app/shared/components/toggle-header.component.html | 2 +- .../src/app/shared/components/toggle-header.component.scss | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/toggle-header.component.html b/ui-ngx/src/app/shared/components/toggle-header.component.html index 1340ad7782..253749d7b9 100644 --- a/ui-ngx/src/app/shared/components/toggle-header.component.html +++ b/ui-ngx/src/app/shared/components/toggle-header.component.html @@ -41,7 +41,7 @@ [name]="name" [(ngModel)]="value" (ngModelChange)="valueChange.emit(value)"> - + {{ option.name }} Date: Wed, 2 Apr 2025 16:25:26 +0300 Subject: [PATCH 168/286] UI: Refactoring --- .../components/toggle-header.component.html | 6 ++-- .../components/toggle-header.component.ts | 30 +++++++------------ 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/ui-ngx/src/app/shared/components/toggle-header.component.html b/ui-ngx/src/app/shared/components/toggle-header.component.html index 253749d7b9..fdfabd08b5 100644 --- a/ui-ngx/src/app/shared/components/toggle-header.component.html +++ b/ui-ngx/src/app/shared/components/toggle-header.component.html @@ -41,12 +41,12 @@ [name]="name" [(ngModel)]="value" (ngModelChange)="valueChange.emit(value)"> - + {{ option.name }} warning diff --git a/ui-ngx/src/app/shared/components/toggle-header.component.ts b/ui-ngx/src/app/shared/components/toggle-header.component.ts index 3058ad285d..9add580a73 100644 --- a/ui-ngx/src/app/shared/components/toggle-header.component.ts +++ b/ui-ngx/src/app/shared/components/toggle-header.component.ts @@ -39,19 +39,18 @@ import { import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; -import { BehaviorSubject, Subject, Subscription } from 'rxjs'; +import { BehaviorSubject, Observable, ReplaySubject, Subject, Subscription } from 'rxjs'; import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout'; import { MediaBreakpoints } from '@shared/models/constants'; import { coerceBoolean } from '@shared/decorators/coercion'; import { startWith, takeUntil } from 'rxjs/operators'; import { Platform } from '@angular/cdk/platform'; import { MatButtonToggle, MatButtonToggleGroup } from '@angular/material/button-toggle'; -import { isDefined } from '@core/utils'; export interface ToggleHeaderOption { name: string; value: any; - error?: string; + error$?: Observable; } export type ToggleHeaderAppearance = 'fill' | 'fill-invert' | 'stroked'; @@ -65,13 +64,13 @@ export type ScrollDirection = 'after' | 'before'; } ) // eslint-disable-next-line @angular-eslint/directive-class-suffix -export class ToggleOption implements OnChanges { +export class ToggleOption implements OnChanges, OnDestroy { @Input() value: any; @Input() error: string; - @Output() errorChange = new EventEmitter(); + currentError = new ReplaySubject(1); get viewValue(): string { return (this._element?.nativeElement.textContent || '').trim(); @@ -83,11 +82,15 @@ export class ToggleOption implements OnChanges { ngOnChanges(changes: SimpleChanges) { if (changes?.error) { - if (!changes.error.firstChange && changes.error.currentValue !== changes.error.previousValue) { - this.errorChange.emit(this.error); + if (changes.error.currentValue !== changes.error.previousValue) { + this.currentError.next(this.error); } } } + + ngOnDestroy() { + this.currentError.complete(); + } } @Directive() @@ -106,7 +109,6 @@ export abstract class _ToggleBase extends PageComponent implements AfterContentI ngAfterContentInit(): void { this.toggleOptions.changes.pipe(startWith(null), takeUntil(this._destroyed)).subscribe(() => { - this.subscribeToToggleOptions(); this.syncToggleHeaderOptions(); }); } @@ -116,16 +118,6 @@ export abstract class _ToggleBase extends PageComponent implements AfterContentI this._destroyed.complete(); } - private subscribeToToggleOptions() { - this.toggleOptions.forEach(option => { - if (isDefined(option.error)) { - option.errorChange.pipe(takeUntil(this._destroyed)).subscribe(() => { - this.syncToggleHeaderOptions(); - }); - } - }); - } - private syncToggleHeaderOptions() { if (this.toggleOptions?.length) { this.options.length = 0; @@ -134,7 +126,7 @@ export abstract class _ToggleBase extends PageComponent implements AfterContentI { name: option.viewValue, value: option.value, - error: option.error + error$: option.currentError.asObservable() } ); }); From 5097d7276aea992e7b3b2e437d9cdb79efe41301 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 3 Apr 2025 09:12:22 +0300 Subject: [PATCH 169/286] UI: Fixed powered by typo on the dashboard footer --- .../components/dashboard-page/dashboard-page.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html index 5fd247e072..77f882d191 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html @@ -365,7 +365,7 @@ close Date: Thu, 3 Apr 2025 14:25:42 +0300 Subject: [PATCH 170/286] improved performance --- .../subscription/DefaultTbLocalSubscriptionService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java index d39c5fcb12..5716976b6f 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/DefaultTbLocalSubscriptionService.java @@ -347,7 +347,8 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer if (sub.isAllKeys()) { if (sub.isLatestValues()) { for (TsKvEntry kv : data) { - if (!keyStates.containsKey((kv.getKey())) || kv.getTs() > keyStates.get(kv.getKey())) { + Long stateTs = keyStates.get(kv.getKey()); + if (stateTs == null || kv.getTs() > stateTs) { if (updateData == null) { updateData = new ArrayList<>(); } @@ -359,8 +360,9 @@ public class DefaultTbLocalSubscriptionService implements TbLocalSubscriptionSer } } else { for (TsKvEntry kv : data) { - if (keyStates.containsKey((kv.getKey()))) { - if (!sub.isLatestValues() || kv.getTs() > keyStates.get(kv.getKey())) { + Long stateTs = keyStates.get(kv.getKey()); + if (stateTs != null) { + if (!sub.isLatestValues() || kv.getTs() > stateTs) { if (updateData == null) { updateData = new ArrayList<>(); } From b4c7521f70e6a4663cbc2e0f6438ba392006d538 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Thu, 3 Apr 2025 17:08:49 +0300 Subject: [PATCH 171/286] fixed tests --- .../cf/CalculatedFieldStateService.java | 3 +- .../KafkaCalculatedFieldStateService.java | 4 +- .../RocksDBCalculatedFieldStateService.java | 5 +- ...faultTbCalculatedFieldConsumerService.java | 56 +++++++++++++------ .../discovery/event/PartitionChangeEvent.java | 1 + .../InMemoryMonolithQueueFactory.java | 4 +- .../provider/KafkaMonolithQueueFactory.java | 37 +++++++----- .../KafkaTbRuleEngineQueueFactory.java | 38 +++++++------ .../provider/TbRuleEngineQueueFactory.java | 4 +- 9 files changed, 94 insertions(+), 58 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java index a8b0ccf30e..7cb9e718f6 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/CalculatedFieldStateService.java @@ -15,6 +15,7 @@ */ package org.thingsboard.server.service.cf; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.msg.queue.TbCallback; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.exception.CalculatedFieldStateException; @@ -29,7 +30,7 @@ import java.util.Set; public interface CalculatedFieldStateService { - void init(PartitionedQueueConsumerManager> eventConsumer); + void init(TenantId tenantId, PartitionedQueueConsumerManager> eventConsumer); void persistState(CalculatedFieldEntityCtxId stateId, CalculatedFieldState state, TbCallback callback) throws CalculatedFieldStateException; diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java index 37f79edf6e..1eb8d0acaa 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java @@ -67,7 +67,7 @@ public class KafkaCalculatedFieldStateService extends AbstractCalculatedFieldSta private final AtomicInteger counter = new AtomicInteger(); @Override - public void init(PartitionedQueueConsumerManager> eventConsumer) { + public void init(TenantId tenantId, PartitionedQueueConsumerManager> eventConsumer) { var queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME); PartitionedQueueConsumerManager> stateConsumer = PartitionedQueueConsumerManager.>create() .queueKey(queueKey) @@ -91,7 +91,7 @@ public class KafkaCalculatedFieldStateService extends AbstractCalculatedFieldSta } } }) - .consumerCreator((config, partitionId) -> queueFactory.createCalculatedFieldStateConsumer()) + .consumerCreator((config, partitionId) -> queueFactory.createCalculatedFieldStateConsumer(tenantId)) .queueAdmin(queueFactory.getCalculatedFieldQueueAdmin()) .consumerExecutor(eventConsumer.getConsumerExecutor()) .scheduler(eventConsumer.getScheduler()) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java index 3d2f522440..fc30822b85 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/RocksDBCalculatedFieldStateService.java @@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.DataConstants; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.TbCallback; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; @@ -45,8 +46,8 @@ public class RocksDBCalculatedFieldStateService extends AbstractCalculatedFieldS private final CfRocksDb cfRocksDb; @Override - public void init(PartitionedQueueConsumerManager> eventConsumer) { - super.stateServices.put(new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME), new DefaultQueueStateService<>(eventConsumer)); + public void init(TenantId tenantId, PartitionedQueueConsumerManager> eventConsumer) { + super.stateServices.put(new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, tenantId), new DefaultQueueStateService<>(eventConsumer)); } @Override diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index d4a88c2fe6..9e0376b483 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -45,6 +45,7 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToCalculatedFieldMsg import org.thingsboard.server.gen.transport.TransportProtos.ToCalculatedFieldNotificationMsg; import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; +import org.thingsboard.server.queue.common.consumer.MainQueueConsumerManager; import org.thingsboard.server.queue.common.consumer.PartitionedQueueConsumerManager; import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.queue.discovery.QueueKey; @@ -62,6 +63,7 @@ import org.thingsboard.server.service.queue.processing.IdMsgPair; import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -88,7 +90,6 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa private final ConcurrentMap>> consumers = new ConcurrentHashMap<>(); - public DefaultTbCalculatedFieldConsumerService(TbRuleEngineQueueFactory tbQueueFactory, ActorSystemContext actorContext, TbDeviceProfileCache deviceProfileCache, @@ -115,19 +116,19 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa PageDataIterable iterator = new PageDataIterable<>(tenantService::findTenantsIds, 1024); for (TenantId tenantId : iterator) { if (partitionService.isManagedByCurrentService(tenantId)) { - stateService.init(createConsumer(tenantId)); + stateService.init(tenantId, createConsumer(tenantId)); } } } private PartitionedQueueConsumerManager> createConsumer(TenantId tenantId) { - QueueKey queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME); + QueueKey queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, tenantId); var eventConsumer = PartitionedQueueConsumerManager.>create() .queueKey(queueKey) - .topic(partitionService.getTopic(queueKey)) + .topic(partitionService.getTopic(new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME))) .pollInterval(pollInterval) .msgPackProcessor(this::processMsgs) - .consumerCreator((config, partitionId) -> queueFactory.createToCalculatedFieldMsgConsumer(tenantId, partitionId)) + .consumerCreator((config, partitionId) -> queueFactory.createToCalculatedFieldMsgConsumer(tenantId)) .queueAdmin(queueFactory.getCalculatedFieldQueueAdmin()) .consumerExecutor(consumersExecutor) .scheduler(scheduler) @@ -151,11 +152,30 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa protected void onPartitionChangeEvent(PartitionChangeEvent event) { try { event.getNewPartitions().forEach((queueKey, partitions) -> { - if (queueKey.getQueueName().equals(DataConstants.CF_QUEUE_NAME)) { - stateService.restore(queueKey, partitions); + if (!queueKey.getQueueName().equals(DataConstants.CF_QUEUE_NAME)) { + return; + } + if (partitionService.isManagedByCurrentService(queueKey.getTenantId())) { + var consumer = Optional.ofNullable(consumers.get(queueKey)).orElseGet(() -> { + var newConsumer = createConsumer(queueKey.getTenantId()); + stateService.init(queueKey.getTenantId(), newConsumer); + return newConsumer; + }); + if (consumer != null) { + stateService.restore(queueKey, partitions); + // eventConsumer's partitions will be updated by stateService + } } }); - // eventConsumer's partitions will be updated by stateService + consumers.keySet().stream() + .collect(Collectors.groupingBy(QueueKey::getTenantId)) + .forEach((tenantId, queueKeys) -> { + if (!partitionService.isManagedByCurrentService(tenantId)) { + queueKeys.forEach(queueKey -> { + Optional.ofNullable(consumers.remove(queueKey)).ifPresent(MainQueueConsumerManager::stop); + }); + } + }); // Cleanup old entities after corresponding consumers are stopped. // Any periodic tasks need to check that the entity is still managed by the current server before processing. @@ -250,23 +270,23 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa if (event.getEntityId().getEntityType() == EntityType.TENANT) { if (event.getEvent() == ComponentLifecycleEvent.DELETED) { entityProfileCache.removeTenant(event.getTenantId()); - consumers.keySet().removeIf(queueKey -> { - boolean toRemove = queueKey.getTenantId().equals(event.getTenantId()); - if (toRemove) { + + List toRemove = consumers.keySet().stream() + .filter(queueKey -> queueKey.getTenantId().equals(event.getTenantId())) + .toList(); + + toRemove.forEach(queueKey -> { + Optional.ofNullable(consumers.remove(queueKey)).ifPresent(consumer -> { Set partitions = stateService.getPartitions(queueKey); if (!CollectionUtils.isEmpty(partitions)) { stateService.delete(queueKey, partitions); } - var consumer = consumers.get(queueKey); - if (consumer != null) { - consumer.stop(); - } - } - return toRemove; + consumer.stop(); + }); }); } else if (event.getEvent() == ComponentLifecycleEvent.CREATED) { if (partitionService.isManagedByCurrentService(event.getTenantId())) { - stateService.init(createConsumer(event.getTenantId())); + stateService.init(event.getTenantId(), createConsumer(event.getTenantId())); } } } else if (event.getEntityId().getEntityType() == EntityType.ASSET_PROFILE) { diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java index 32537edba5..7c2d0b0240 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java @@ -18,6 +18,7 @@ package org.thingsboard.server.queue.discovery.event; import lombok.Getter; import lombok.ToString; import org.thingsboard.server.common.data.DataConstants; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.queue.discovery.QueueKey; diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java index 94d53e4864..e825a1424d 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java @@ -134,7 +134,7 @@ public class InMemoryMonolithQueueFactory implements TbCoreQueueFactory, TbRuleE } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId, Integer partitionId) { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId) { return new InMemoryTbQueueConsumer<>(storage, topicService.buildTopicName(calculatedFieldSettings.getEventTopic())); } @@ -154,7 +154,7 @@ public class InMemoryMonolithQueueFactory implements TbCoreQueueFactory, TbRuleE } @Override - public TbQueueConsumer> createCalculatedFieldStateConsumer() { + public TbQueueConsumer> createCalculatedFieldStateConsumer(TenantId tenantId) { return new InMemoryTbQueueConsumer<>(storage, topicService.buildTopicName(calculatedFieldSettings.getStateTopic())); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index 4cb8fc5793..ca41ee221d 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -514,12 +514,12 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId, Integer partitionId) { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId) { String queueName = DataConstants.CF_QUEUE_NAME; - String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, partitionId); + String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, null); cfAdmin.syncOffsets(topicService.buildConsumerGroupId("cf-", tenantId, queueName, null), // the fat groupId - groupId, partitionId); + groupId, null); TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); @@ -572,18 +572,25 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi } @Override - public TbQueueConsumer> createCalculatedFieldStateConsumer() { - return TbKafkaConsumerTemplate.>builder() - .settings(kafkaSettings) - .topic(topicService.buildTopicName(calculatedFieldSettings.getStateTopic())) - .readFromBeginning(true) - .stopWhenRead(true) - .clientId("monolith-calculated-field-state-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()) - .groupId(topicService.buildTopicName("monolith-calculated-field-state-consumer")) - .decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), msg.getData() != null ? CalculatedFieldStateProto.parseFrom(msg.getData()) : null, msg.getHeaders())) - .admin(cfStateAdmin) - .statsService(consumerStatsService) - .build(); + public TbQueueConsumer> createCalculatedFieldStateConsumer(TenantId tenantId) { + String queueName = DataConstants.CF_STATES_QUEUE_NAME; + String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, null); + + cfAdmin.syncOffsets(topicService.buildConsumerGroupId("cf-", tenantId, queueName, null), // the fat groupId + groupId, null); + + TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); + consumerBuilder.settings(kafkaSettings); + consumerBuilder.topic(topicService.buildTopicName(calculatedFieldSettings.getStateTopic())); + consumerBuilder.readFromBeginning(true); + consumerBuilder.stopWhenRead(true); + consumerBuilder.clientId("cf-" + queueName + "-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); + consumerBuilder.groupId(groupId); + consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), msg.getData() != null ? CalculatedFieldStateProto.parseFrom(msg.getData()) : null, msg.getHeaders())); + consumerBuilder.admin(cfStateAdmin); + consumerBuilder.statsService(consumerStatsService); + + return consumerBuilder.build(); } @Override diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index ae565a0827..84ad126ff2 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -315,17 +315,17 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId, Integer partitionId) { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId) { String queueName = DataConstants.CF_QUEUE_NAME; - String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, partitionId); + String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, null); cfAdmin.syncOffsets(topicService.buildConsumerGroupId("cf-", tenantId, queueName, null), // the fat groupId - groupId, partitionId); + groupId, null); TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); consumerBuilder.topic(topicService.buildTopicName(calculatedFieldSettings.getEventTopic())); - consumerBuilder.clientId("cf-" + queueName + "-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); + consumerBuilder.clientId("cf-" + queueName + "-consumer-" + tenantId + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); consumerBuilder.groupId(groupId); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToCalculatedFieldMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(cfAdmin); @@ -372,18 +372,24 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { } @Override - public TbQueueConsumer> createCalculatedFieldStateConsumer() { - return TbKafkaConsumerTemplate.>builder() - .settings(kafkaSettings) - .topic(topicService.buildTopicName(calculatedFieldSettings.getStateTopic())) - .readFromBeginning(true) - .stopWhenRead(true) - .clientId("tb-rule-engine-calculated-field-state-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()) - .groupId(topicService.buildTopicName("tb-rule-engine-calculated-field-state-consumer")) - .decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), msg.getData() != null ? CalculatedFieldStateProto.parseFrom(msg.getData()) : null, msg.getHeaders())) - .admin(cfStateAdmin) - .statsService(consumerStatsService) - .build(); + public TbQueueConsumer> createCalculatedFieldStateConsumer(TenantId tenantId) { + String queueName = DataConstants.CF_STATES_QUEUE_NAME; + String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, null); + + cfAdmin.syncOffsets(topicService.buildConsumerGroupId("cf-", tenantId, queueName, null), // the fat groupId + groupId, null); + + TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); + consumerBuilder.settings(kafkaSettings); + consumerBuilder.topic(topicService.buildTopicName(calculatedFieldSettings.getStateTopic())); + consumerBuilder.readFromBeginning(true); + consumerBuilder.stopWhenRead(true); + consumerBuilder.clientId("cf-" + queueName + "-consumer-" + tenantId + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()); + consumerBuilder.groupId(groupId); + consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), msg.getData() != null ? CalculatedFieldStateProto.parseFrom(msg.getData()) : null, msg.getHeaders())); + consumerBuilder.admin(cfStateAdmin); + consumerBuilder.statsService(consumerStatsService); + return consumerBuilder.build(); } @Override diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java index b71f6a0471..7076ceb0b0 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java @@ -122,7 +122,7 @@ public interface TbRuleEngineQueueFactory extends TbUsageStatsClientQueueFactory TbQueueRequestTemplate, TbProtoQueueMsg> createRemoteJsRequestTemplate(); - TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId, Integer partitionId); + TbQueueConsumer> createToCalculatedFieldMsgConsumer(TenantId tenantId); TbQueueAdmin getCalculatedFieldQueueAdmin(); @@ -132,7 +132,7 @@ public interface TbRuleEngineQueueFactory extends TbUsageStatsClientQueueFactory TbQueueProducer> createToCalculatedFieldNotificationMsgProducer(); - TbQueueConsumer> createCalculatedFieldStateConsumer(); + TbQueueConsumer> createCalculatedFieldStateConsumer(TenantId tenantId); TbQueueProducer> createCalculatedFieldStateProducer(); From 27352b7b7e977911604941986ea2c93e8be60bac Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Fri, 4 Apr 2025 09:19:17 +0300 Subject: [PATCH 172/286] Improve after review --- .../common/data/cf/CalculatedField.java | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java b/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java index ea7f81f216..3b2ddf0627 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/cf/CalculatedField.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonSetter; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import org.thingsboard.server.common.data.BaseData; @@ -36,10 +37,10 @@ import org.thingsboard.server.common.data.validation.Length; import org.thingsboard.server.common.data.validation.NoXss; import java.io.Serial; -import java.util.Objects; @Schema @Data +@EqualsAndHashCode(callSuper = true) public class CalculatedField extends BaseData implements HasName, HasTenantId, HasVersion, HasDebugSettings { @Serial @@ -63,7 +64,7 @@ public class CalculatedField extends BaseData implements HasN @Schema(description = "Version of calculated field configuration.", example = "0") private int configurationVersion; @Schema(implementation = SimpleCalculatedFieldConfiguration.class) - private transient CalculatedFieldConfiguration configuration; + private CalculatedFieldConfiguration configuration; @Getter @Setter private Long version; @@ -123,36 +124,6 @@ public class CalculatedField extends BaseData implements HasN this.debugMode = debugMode; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof CalculatedField that)) return false; - if (!super.equals(o)) return false; - return Objects.equals(tenantId, that.tenantId) && - Objects.equals(entityId, that.entityId) && - Objects.equals(name, that.name) && - Objects.equals(debugSettings, that.debugSettings) && - Objects.equals(configuration, that.configuration) && - type == that.type && debugMode == that.debugMode && - configurationVersion == that.configurationVersion && - Objects.equals(version, that.version); - } - - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + Objects.hashCode(tenantId); - result = 31 * result + Objects.hashCode(entityId); - result = 31 * result + Objects.hashCode(type); - result = 31 * result + Objects.hashCode(name); - result = 31 * result + Boolean.hashCode(debugMode); - result = 31 * result + Objects.hashCode(debugSettings); - result = 31 * result + Integer.hashCode(configurationVersion); - result = 31 * result + Objects.hashCode(configuration); - result = 31 * result + Objects.hashCode(version); - return result; - } - @Override public String toString() { return new StringBuilder() From 9d40dd1931722082604b72979218cec1a05eeb70 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 4 Apr 2025 09:19:20 +0300 Subject: [PATCH 173/286] UI: Color settings panel tab validation --- .../common/color-settings-panel.component.ts | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts index 2cba44d334..13fe9b42b9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts @@ -102,14 +102,28 @@ export class ColorSettingsPanelComponent extends PageComponent implements OnInit { type: [this.colorSettings?.type || ColorType.constant, []], color: [this.colorSettings?.color, []], - gradient: [this.colorSettings?.gradient || defaultGradient(this.minValue, this.maxValue), []], - rangeList: [this.colorSettings?.rangeList || defaultRange(), []], - colorFunction: [this.colorSettings?.colorFunction, []] + gradient: [{value: this.colorSettings?.gradient || defaultGradient(this.minValue, this.maxValue), disabled: this.colorSettings?.type !== ColorType.gradient}, []], + rangeList: [{value: this.colorSettings?.rangeList || defaultRange(), disabled: this.colorSettings?.type !== ColorType.range}, []], + colorFunction: [{value: this.colorSettings?.colorFunction, disabled: this.colorSettings?.type !== ColorType.function}, []] } ); this.colorSettingsFormGroup.get('type').valueChanges.pipe( takeUntilDestroyed(this.destroyRef) - ).subscribe(() => { + ).subscribe((type: ColorType) => { + this.colorSettingsFormGroup.get('gradient').disable({emitEvent: false}); + this.colorSettingsFormGroup.get('rangeList').disable({emitEvent: false}); + this.colorSettingsFormGroup.get('colorFunction').disable({emitEvent: false}); + switch (type) { + case ColorType.gradient: + this.colorSettingsFormGroup.get('gradient').enable({emitEvent: false}); + break; + case ColorType.range: + this.colorSettingsFormGroup.get('rangeList').enable({emitEvent: false}); + break; + case ColorType.function: + this.colorSettingsFormGroup.get('colorFunction').enable({emitEvent: false}); + break; + } setTimeout(() => {this.popover?.updatePosition();}, 0); }); } @@ -131,7 +145,7 @@ export class ColorSettingsPanelComponent extends PageComponent implements OnInit } applyColorSettings() { - const colorSettings = this.colorSettingsFormGroup.value; + const colorSettings: ColorSettings = {...this.colorSettings, ...this.colorSettingsFormGroup.value}; this.colorSettingsApplied.emit(colorSettings); } From 8c8485d7a70e8057c52e929ad80f7981f9e13004 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 4 Apr 2025 10:38:42 +0300 Subject: [PATCH 174/286] UI: tab validation for data layer colors panel --- .../data-layer-color-settings-panel.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts index 895fb3e782..dfb049af19 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts @@ -82,9 +82,9 @@ export class DataLayerColorSettingsPanelComponent extends PageComponent implemen { type: [this.colorSettings?.type || DataLayerColorType.constant, []], color: [this.colorSettings?.color, []], - rangeKey: [this.colorSettings?.rangeKey, [Validators.required]], - range: [this.colorSettings?.range, []], - colorFunction: [this.colorSettings?.colorFunction, []] + rangeKey: [{value: this.colorSettings?.rangeKey, disabled: this.colorSettings.type !== DataLayerColorType.range}, [Validators.required]], + range: [{value: this.colorSettings?.range, disabled: this.colorSettings.type !== DataLayerColorType.range}, []], + colorFunction: [{value: this.colorSettings?.colorFunction, disabled: this.colorSettings.type !== DataLayerColorType.function}, []] } ); this.colorSettingsFormGroup.get('type').valueChanges.pipe( @@ -101,7 +101,7 @@ export class DataLayerColorSettingsPanelComponent extends PageComponent implemen } applyColorSettings() { - const colorSettings: DataLayerColorSettings = this.colorSettingsFormGroup.value; + const colorSettings: DataLayerColorSettings = {...this.colorSettings ,...this.colorSettingsFormGroup.value}; this.colorSettingsApplied.emit(colorSettings); } @@ -122,8 +122,15 @@ export class DataLayerColorSettingsPanelComponent extends PageComponent implemen const type: DataLayerColorType = this.colorSettingsFormGroup.get('type').value; if (type === DataLayerColorType.range) { this.colorSettingsFormGroup.get('rangeKey').enable({emitEvent: false}); + this.colorSettingsFormGroup.get('range').enable({emitEvent: false}); } else { this.colorSettingsFormGroup.get('rangeKey').disable({emitEvent: false}); + this.colorSettingsFormGroup.get('range').disable({emitEvent: false}); + } + if (type === DataLayerColorType.function) { + this.colorSettingsFormGroup.get('colorFunction').enable({emitEvent: false}); + } else { + this.colorSettingsFormGroup.get('colorFunction').disable({emitEvent: false}); } } } From 3c50ab1d5e263286ad9ad4a7a726fc41c97edb4c Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 4 Apr 2025 11:16:36 +0300 Subject: [PATCH 175/286] UI: Refactoring --- .../common/color-settings-panel.component.ts | 44 +++++++++++-------- ...ta-layer-color-settings-panel.component.ts | 8 ++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts index 13fe9b42b9..63d73bf578 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings-panel.component.ts @@ -102,30 +102,36 @@ export class ColorSettingsPanelComponent extends PageComponent implements OnInit { type: [this.colorSettings?.type || ColorType.constant, []], color: [this.colorSettings?.color, []], - gradient: [{value: this.colorSettings?.gradient || defaultGradient(this.minValue, this.maxValue), disabled: this.colorSettings?.type !== ColorType.gradient}, []], - rangeList: [{value: this.colorSettings?.rangeList || defaultRange(), disabled: this.colorSettings?.type !== ColorType.range}, []], - colorFunction: [{value: this.colorSettings?.colorFunction, disabled: this.colorSettings?.type !== ColorType.function}, []] + gradient: [this.colorSettings?.gradient || defaultGradient(this.minValue, this.maxValue), []], + rangeList: [this.colorSettings?.rangeList || defaultRange(), []], + colorFunction: [this.colorSettings?.colorFunction, []] } ); this.colorSettingsFormGroup.get('type').valueChanges.pipe( takeUntilDestroyed(this.destroyRef) - ).subscribe((type: ColorType) => { - this.colorSettingsFormGroup.get('gradient').disable({emitEvent: false}); - this.colorSettingsFormGroup.get('rangeList').disable({emitEvent: false}); - this.colorSettingsFormGroup.get('colorFunction').disable({emitEvent: false}); - switch (type) { - case ColorType.gradient: - this.colorSettingsFormGroup.get('gradient').enable({emitEvent: false}); - break; - case ColorType.range: - this.colorSettingsFormGroup.get('rangeList').enable({emitEvent: false}); - break; - case ColorType.function: - this.colorSettingsFormGroup.get('colorFunction').enable({emitEvent: false}); - break; - } + ).subscribe(() => { + this.updateValidators(); setTimeout(() => {this.popover?.updatePosition();}, 0); }); + this.updateValidators(); + } + + updateValidators() { + const type: ColorType = this.colorSettingsFormGroup.get('type').value; + this.colorSettingsFormGroup.get('gradient').disable({emitEvent: false}); + this.colorSettingsFormGroup.get('rangeList').disable({emitEvent: false}); + this.colorSettingsFormGroup.get('colorFunction').disable({emitEvent: false}); + switch (type) { + case ColorType.gradient: + this.colorSettingsFormGroup.get('gradient').enable({emitEvent: false}); + break; + case ColorType.range: + this.colorSettingsFormGroup.get('rangeList').enable({emitEvent: false}); + break; + case ColorType.function: + this.colorSettingsFormGroup.get('colorFunction').enable({emitEvent: false}); + break; + } } copyColorSettings(comp: ColorSettingsComponent) { @@ -145,7 +151,7 @@ export class ColorSettingsPanelComponent extends PageComponent implements OnInit } applyColorSettings() { - const colorSettings: ColorSettings = {...this.colorSettings, ...this.colorSettingsFormGroup.value}; + const colorSettings: ColorSettings = this.colorSettingsFormGroup.getRawValue(); this.colorSettingsApplied.emit(colorSettings); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts index dfb049af19..f083b00723 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/data-layer-color-settings-panel.component.ts @@ -82,9 +82,9 @@ export class DataLayerColorSettingsPanelComponent extends PageComponent implemen { type: [this.colorSettings?.type || DataLayerColorType.constant, []], color: [this.colorSettings?.color, []], - rangeKey: [{value: this.colorSettings?.rangeKey, disabled: this.colorSettings.type !== DataLayerColorType.range}, [Validators.required]], - range: [{value: this.colorSettings?.range, disabled: this.colorSettings.type !== DataLayerColorType.range}, []], - colorFunction: [{value: this.colorSettings?.colorFunction, disabled: this.colorSettings.type !== DataLayerColorType.function}, []] + rangeKey: [this.colorSettings?.rangeKey, [Validators.required]], + range: [this.colorSettings?.range, []], + colorFunction: [this.colorSettings?.colorFunction, []] } ); this.colorSettingsFormGroup.get('type').valueChanges.pipe( @@ -101,7 +101,7 @@ export class DataLayerColorSettingsPanelComponent extends PageComponent implemen } applyColorSettings() { - const colorSettings: DataLayerColorSettings = {...this.colorSettings ,...this.colorSettingsFormGroup.value}; + const colorSettings: DataLayerColorSettings = this.colorSettingsFormGroup.getRawValue(); this.colorSettingsApplied.emit(colorSettings); } From d293887c58fb59594375a468c5ddea7fc730301c Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 4 Apr 2025 12:24:23 +0300 Subject: [PATCH 176/286] UI: Fixed enter press trigger click handler in integration dialig --- .../entity/debug/entity-debug-settings-button.component.html | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.html b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.html index 4243044fc8..f79abfe904 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.html @@ -16,6 +16,7 @@ -->
    diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/debug-dialog/calculated-field-debug-dialog.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/debug-dialog/calculated-field-debug-dialog.component.ts index 0fcac393f0..478447d1d9 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/debug-dialog/calculated-field-debug-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/debug-dialog/calculated-field-debug-dialog.component.ts @@ -55,8 +55,8 @@ export class CalculatedFieldDebugDialogComponent extends DialogComponent this.data.value.type === CalculatedFieldType.SCRIPT && !!(event as Event).body.arguments); this.eventsTable.entitiesTable.updateData(); - this.eventsTable.entitiesTable.cellActionDescriptors[0].isEnabled = (event => this.data.value.type === CalculatedFieldType.SCRIPT && !!(event as Event).body.arguments) } cancel(): void { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html index 1688685523..8ef923d3f5 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.html @@ -110,7 +110,7 @@
    {{ 'api-usage.tbel' | translate }}
    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 5d770fed3b..a00d07122e 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 @@ -462,7 +462,7 @@ export class EventTableConfig extends EntityTableConfig { break; case DebugEventType.DEBUG_CALCULATED_FIELD: this.cellActionDescriptors.push({ - name: this.translate.instant('common.test-with-this-message', {test: this.translate.instant(this.testButtonLabel)}), + name: this.translate.instant('calculated-fields.test-with-this-message'), icon: 'bug_report', isEnabled: () => true, onAction: (_, entity) => this.debugEventSelected.next(entity.body) diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index ec047f91ae..be8b95e6c3 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1059,6 +1059,7 @@ "delete-text": "Be careful, after the confirmation the calculated field and all related data will become unrecoverable.", "delete-multiple-title": "Are you sure you want to delete { count, plural, =1 {1 calculated field} other {# calculated fields} }?", "delete-multiple-text": "Be careful, after the confirmation all selected calculated fields will be removed and all related data will become unrecoverable.", + "test-with-this-message": "Test with this message", "hint": { "arguments-simple-with-rolling": "Simple type calculated field should not contain keys with time series rolling type.", "arguments-empty": "Arguments should not be empty.", @@ -1121,8 +1122,6 @@ "documentation": "Documentation", "time-left": "{{time}} left", "output": "Output", - "test-function": "Test function", - "test-with-this-message": "{{test}} with this message", "suffix": { "s": "s", "ms": "ms" From 19e9145183f72e3fd17c4d5c522e95506bcba2be Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Mon, 7 Apr 2025 09:55:23 +0300 Subject: [PATCH 181/286] added test --- .../timeseries/BaseTimeseriesServiceTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java index 6a38159804..07df14ce03 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/timeseries/BaseTimeseriesServiceTest.java @@ -60,6 +60,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -768,6 +769,27 @@ public abstract class BaseTimeseriesServiceTest extends AbstractServiceTest { testFindAllByQueriesWithAggregationAndInvalidInterval(-1); } + @Test + public void testRemoveLatestAndNoValuePresentInDB() throws ExecutionException, InterruptedException, TimeoutException { + TsKvEntry tsKvEntry = toTsEntry(TS, stringKvEntry); + tsService.save(tenantId, deviceId, tsKvEntry).get(MAX_TIMEOUT, TimeUnit.SECONDS); + + Optional tsKvEntryOpt = tsService.findLatest(tenantId, deviceId, STRING_KEY).get(MAX_TIMEOUT, TimeUnit.SECONDS); + + assertThat(tsKvEntryOpt).isPresent(); + equalsIgnoreVersion(tsKvEntry, tsKvEntryOpt.get()); + assertThat(tsKvEntryOpt.get().getVersion()).isNotNull(); + + tsService.removeLatest(tenantId, deviceId, List.of(STRING_KEY)); + + await().alias("Wait until ts last is removed from the cache").atMost(MAX_TIMEOUT, TimeUnit.SECONDS) + .pollInterval(1, TimeUnit.SECONDS) + .untilAsserted(() -> { + Optional tsKvEntryAfterRemoval = tsService.findLatest(tenantId, deviceId, STRING_KEY).get(MAX_TIMEOUT, TimeUnit.SECONDS); + assertThat(tsKvEntryAfterRemoval).isNotPresent(); + }); + } + private void testFindAllByQueriesWithAggregationAndInvalidInterval(long interval) { BaseReadTsKvQuery query = new BaseReadTsKvQuery(STRING_KEY, TS, TS, interval, 1000, Aggregation.SUM, "DESC"); Assert.assertThrows(IncorrectParameterException.class, () -> findAndVerifyQueryId(deviceId, query)); From 76ed955f427efd6badeabe40d77e8ea0fce10e20 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 7 Apr 2025 11:47:57 +0300 Subject: [PATCH 182/286] UI: Fixed debug settings panel; Improved model data entity debug settings --- ui-ngx/src/app/core/auth/auth.models.ts | 1 + .../calculated-fields-table-config.ts | 14 +++-------- .../calculated-field-dialog.component.html | 3 +-- .../calculated-field-dialog.component.ts | 1 - .../entity-debug-settings-button.component.ts | 7 +++--- ...entity-debug-settings-panel.component.html | 4 +-- .../entity-debug-settings-panel.component.ts | 25 ++++++++++++++----- .../debug/entity-debug-settings.model.ts | 6 ++--- .../rule-node-details.component.html | 5 ++-- .../rulechain/rule-node-details.component.ts | 13 +++------- .../assets/locale/locale.constant-en_US.json | 2 -- 11 files changed, 38 insertions(+), 43 deletions(-) diff --git a/ui-ngx/src/app/core/auth/auth.models.ts b/ui-ngx/src/app/core/auth/auth.models.ts index 1944c693ac..e5cc1424ab 100644 --- a/ui-ngx/src/app/core/auth/auth.models.ts +++ b/ui-ngx/src/app/core/auth/auth.models.ts @@ -31,6 +31,7 @@ export interface SysParamsState { maxDataPointsPerRollingArg: number; maxArgumentsPerCF: number; ruleChainDebugPerTenantLimitsConfiguration?: string; + calculatedFieldDebugPerTenantLimitsConfiguration?: string; } export interface SysParams extends SysParamsState { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index c5b256ea89..07f8f0293c 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -27,10 +27,9 @@ import { PageLink } from '@shared/models/page/page-link'; import { Observable, of } from 'rxjs'; import { PageData } from '@shared/models/page/page-data'; import { EntityId } from '@shared/models/id/entity-id'; -import { MINUTE } from '@shared/models/time/time.models'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; -import { getCurrentAuthState, getCurrentAuthUser } from '@core/auth/auth.selectors'; +import { getCurrentAuthUser } from '@core/auth/auth.selectors'; import { DestroyRef, Renderer2 } from '@angular/core'; import { EntityDebugSettings } from '@shared/models/entity.models'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @@ -47,7 +46,8 @@ import { getCalculatedFieldArgumentsHighlights, } from '@shared/models/calculated-field.models'; import { - CalculatedFieldDebugDialogComponent, CalculatedFieldDebugDialogData, + CalculatedFieldDebugDialogComponent, + CalculatedFieldDebugDialogData, CalculatedFieldDialogComponent, CalculatedFieldDialogData, CalculatedFieldScriptTestDialogComponent, @@ -60,9 +60,6 @@ import { DatePipe } from '@angular/common'; export class CalculatedFieldsTableConfig extends EntityTableConfig { - readonly calculatedFieldsDebugPerTenantLimitsConfiguration = - getCurrentAuthState(this.store)['calculatedFieldsDebugPerTenantLimitsConfiguration']; - readonly maxDebugModeDuration = getCurrentAuthState(this.store).maxDebugModeDurationMinutes * MINUTE; readonly tenantId = getCurrentAuthUser(this.store).tenantId; additionalDebugActionConfig = { title: this.translate.instant('calculated-fields.see-debug-events'), @@ -189,9 +186,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig this.onDebugConfigChanged(id.id, settings) @@ -215,7 +210,6 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig
    diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts index 169d6dff50..52051aa6f7 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts @@ -48,7 +48,6 @@ export interface CalculatedFieldDialogData { value?: CalculatedField; buttonTitle: string; entityId: EntityId; - debugLimitsConfiguration: string; tenantId: string; entityName?: string; additionalDebugActionConfig: AdditionalDebugActionConfig<(calculatedField: CalculatedField) => void>; diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts index 90beed2f7e..7cb0ac7f58 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts @@ -36,6 +36,7 @@ import { Store } from '@ngrx/store'; import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms'; import { EntityDebugSettingsService } from '@home/components/entity/debug/entity-debug-settings.service'; import { AdditionalDebugActionConfig } from '@home/components/entity/debug/entity-debug-settings.model'; +import { EntityType } from '@shared/models/entity-type.models'; @Component({ selector: 'tb-entity-debug-settings-button', @@ -58,9 +59,8 @@ import { AdditionalDebugActionConfig } from '@home/components/entity/debug/entit }) export class EntityDebugSettingsButtonComponent implements ControlValueAccessor { - @Input() debugLimitsConfiguration: string; - @Input() entityLabel: string; @Input() additionalActionConfig: AdditionalDebugActionConfig; + @Input({required: true}) entityType: EntityType; debugSettingsFormGroup = this.fb.group({ failuresEnabled: [false], @@ -123,8 +123,7 @@ export class EntityDebugSettingsButtonComponent implements ControlValueAccessor debugSettings: this.debugSettingsFormGroup.value, debugConfig: { maxDebugModeDuration: this.maxDebugModeDuration, - debugLimitsConfiguration: this.debugLimitsConfiguration, - entityLabel: this.entityLabel, + entityType: this.entityType, additionalActionConfig: this.additionalActionConfig, }, onSettingsAppliedFn: settings => { 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 5863a295d6..337a452757 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 @@ -17,10 +17,10 @@ -->
    debug-settings.label
    - @if (debugLimitsConfiguration) { + @if (maxMessagesCount) {
    - {{ 'debug-settings.hint.main-limited' | translate: { entity: entityLabel ?? ('debug-settings.entity' | translate), msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true) } }} + {{ '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/debug/entity-debug-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.ts index 1f95a93084..e19407a687 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.ts @@ -28,13 +28,15 @@ import { TbPopoverComponent } from '@shared/components/popover.component'; import { FormBuilder } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { SharedModule } from '@shared/shared.module'; -import { SECOND } from '@shared/models/time/time.models'; +import { MINUTE, SECOND } from '@shared/models/time/time.models'; import { DurationLeftPipe } from '@shared/pipe/duration-left.pipe'; import { of, shareReplay, timer } from 'rxjs'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { EntityDebugSettings } from '@shared/models/entity.models'; import { distinctUntilChanged, map, startWith, switchMap, takeWhile } from 'rxjs/operators'; import { AdditionalDebugActionConfig } from '@home/components/entity/debug/entity-debug-settings.model'; +import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; +import { getCurrentAuthState } from '@core/auth/auth.selectors'; @Component({ selector: 'tb-entity-debug-settings-panel', @@ -51,10 +53,9 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements @Input({ transform: booleanAttribute }) failuresEnabled = false; @Input({ transform: booleanAttribute }) allEnabled = false; - @Input() entityLabel: string; + @Input() entityType: EntityType; @Input() allEnabledUntil = 0; - @Input() maxDebugModeDuration: number; - @Input() debugLimitsConfiguration: string; + @Input() maxDebugModeDuration = getCurrentAuthState(this.store).maxDebugModeDurationMinutes * MINUTE; @Input() additionalActionConfig: AdditionalDebugActionConfig; onFailuresControl = this.fb.control(false); @@ -63,6 +64,7 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements maxMessagesCount: string; maxTimeFrameDuration: number; initialAllEnabled: boolean; + entityLabel: string; isDebugAllActive$ = this.debugAllControl.valueChanges.pipe( startWith(this.debugAllControl.value), @@ -101,11 +103,13 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements } ngOnInit(): void { - this.maxMessagesCount = this.debugLimitsConfiguration?.split(':')[0]; - this.maxTimeFrameDuration = parseInt(this.debugLimitsConfiguration?.split(':')[1]) * SECOND; + const debugLimitsConfiguration = this.getByEntityTypeDebugLimit(this.entityType); + this.maxMessagesCount = debugLimitsConfiguration?.split(':')[0]; + this.maxTimeFrameDuration = parseInt(debugLimitsConfiguration?.split(':')[1]) * SECOND; this.onFailuresControl.patchValue(this.failuresEnabled); this.debugAllControl.patchValue(this.allEnabled); this.initialAllEnabled = this.allEnabled || this.allEnabledUntil > new Date().getTime(); + this.entityLabel = entityTypeTranslations.has(this.entityType) ? entityTypeTranslations.get(this.entityType).type : 'debug-settings.entity'; } onCancel(): void { @@ -135,4 +139,13 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements this.allEnabledUntil = 0; this.cd.markForCheck(); } + + private getByEntityTypeDebugLimit(entityType: EntityType): string { + switch (entityType) { + case EntityType.RULE_NODE: + return getCurrentAuthState(this.store).ruleChainDebugPerTenantLimitsConfiguration; + case EntityType.CALCULATED_FIELD: + return getCurrentAuthState(this.store).calculatedFieldDebugPerTenantLimitsConfiguration; + } + } } diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts index 6560580502..0af9da52f2 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts @@ -15,6 +15,7 @@ /// import { EntityDebugSettings } from '@shared/models/entity.models'; +import { EntityType } from '@shared/models/entity-type.models'; export interface AdditionalDebugActionConfig void> { action: Action; @@ -24,10 +25,9 @@ export interface AdditionalDebugActionConfig vo export interface EntityDebugSettingPanelConfig { debugSettings: EntityDebugSettings; debugConfig: { - maxDebugModeDuration: number; - debugLimitsConfiguration: string; - entityLabel?: string; + maxDebugModeDuration?: number; additionalActionConfig?: AdditionalDebugActionConfig; + entityType: EntityType; } onSettingsAppliedFn: (settings: EntityDebugSettings) => void; } diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html index 1923d3ef91..b55dcdaa73 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html @@ -22,7 +22,7 @@
    -
    +
    rulenode.name @@ -38,8 +38,7 @@
    -
    -
    widgets.maps.data-layer.fill-color
    - +
    +
    +
    {{ 'widgets.maps.data-layer.shape.fill' | translate }}
    + + {{ 'widgets.maps.data-layer.shape.fill-type-color' | translate }} + {{ 'widgets.maps.data-layer.shape.fill-type-stripe' | translate }} + {{ 'widgets.maps.data-layer.shape.fill-type-image' | translate }} + +
    +
    +
    widgets.maps.data-layer.shape.color
    + +
    +
    +
    widgets.maps.data-layer.shape.stripe-pattern
    + + +
    +
    +
    widgets.maps.data-layer.shape.image
    + +
    -
    widgets.maps.data-layer.stroke
    +
    widgets.maps.data-layer.shape.stroke
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts index e7e11284eb..48854adc44 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/map-data-layer-dialog.component.ts @@ -30,7 +30,7 @@ import { pathDecoratorSymbols, pathDecoratorSymbolTranslationMap, PolygonsDataLayerSettings, - ShapeDataLayerSettings, + ShapeDataLayerSettings, ShapeFillType, TripsDataLayerSettings, updateDataKeyToNewDsType } from '@shared/models/widget/maps/map.models'; @@ -78,6 +78,8 @@ export class MapDataLayerDialogComponent extends DialogComponent = []; datasourceTypesTranslations = datasourceTypeTranslationMap; @@ -266,7 +268,10 @@ export class MapDataLayerDialogComponent extends DialogComponent + this.updateValidators() + ); break; } this.dataLayerFormGroup.get('dsType').valueChanges.pipe( @@ -349,8 +359,9 @@ export class MapDataLayerDialogComponent extends DialogComponent +
    +
    widgets.maps.data-layer.shape.fill-image
    +
    + + + {{ 'widgets.maps.data-layer.shape.fill-image-type-image' | translate }} + + + {{ 'widgets.maps.data-layer.shape.fill-image-type-function' | translate }} + + +
    +
    +
    + +
    +
    widgets.maps.data-layer.shape.opacity
    + + + +
    +
    +
    widgets.maps.data-layer.shape.angle
    + + +
    deg
    +
    +
    +
    +
    widgets.maps.data-layer.shape.scale
    + + + +
    +
    +
    +
    +
    + + + + +
    +
    +
    + + + +
    +
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.scss new file mode 100644 index 0000000000..5c127549db --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.scss @@ -0,0 +1,54 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@import '../../../../../../../../../scss/constants'; + +.tb-shape-fill-image-settings-panel { + width: 700px; + max-width: 90vw; + min-height: 300px; + max-height: 90vh; + display: flex; + flex-direction: column; + gap: 16px; + @media #{$mat-xs} { + width: 90vw; + } + .tb-shape-fill-image-settings-title { + font-size: 16px; + font-weight: 500; + line-height: 24px; + letter-spacing: 0.25px; + color: rgba(0, 0, 0, 0.87); + } + .tb-form-row { + height: auto; + } + .tb-shape-fill-image-settings-panel-body { + flex: 1; + display: flex; + flex-direction: column; + min-height: 0; + overflow: auto; + } + .tb-shape-fill-image-settings-panel-buttons { + height: 40px; + display: flex; + flex-direction: row; + gap: 16px; + justify-content: flex-end; + align-items: flex-end; + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.ts new file mode 100644 index 0000000000..0d14c5f81c --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.ts @@ -0,0 +1,101 @@ +/// +/// Copyright © 2016-2025 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { Component, DestroyRef, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core'; +import { TbPopoverComponent } from '@shared/components/popover.component'; +import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; +import { WidgetService } from '@core/http/widget.service'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { ShapeFillImageSettings, ShapeFillImageType } from '@shared/models/widget/maps/map.models'; + +@Component({ + selector: 'tb-shape-fill-image-settings-panel', + templateUrl: './shape-fill-image-settings-panel.component.html', + providers: [], + styleUrls: ['./shape-fill-image-settings-panel.component.scss'], + encapsulation: ViewEncapsulation.None +}) +export class ShapeFillImageSettingsPanelComponent implements OnInit { + + @Input() + shapeFillImageSettings: ShapeFillImageSettings; + + @Output() + shapeFillImageSettingsApplied = new EventEmitter(); + + ShapeFillImageType = ShapeFillImageType; + + shapeFillImageSettingsFormGroup: UntypedFormGroup; + + functionScopeVariables = this.widgetService.getWidgetScopeVariables(); + + constructor(private fb: UntypedFormBuilder, + private popover: TbPopoverComponent, + private widgetService: WidgetService, + private destroyRef: DestroyRef) { + } + + ngOnInit(): void { + this.shapeFillImageSettingsFormGroup = this.fb.group( + { + type: [this.shapeFillImageSettings?.type || ShapeFillImageType.image, []], + image: [this.shapeFillImageSettings?.image, [Validators.required]], + opacity: [this.shapeFillImageSettings?.opacity, [Validators.min(0), Validators.max(1)]], + angle: [this.shapeFillImageSettings?.angle, [Validators.min(0), Validators.max(360)]], + scale: [this.shapeFillImageSettings?.scale, [Validators.min(0)]], + imageFunction: [this.shapeFillImageSettings?.imageFunction, [Validators.required]], + images: [this.shapeFillImageSettings?.images, []] + } + ); + this.shapeFillImageSettingsFormGroup.get('type').valueChanges.pipe( + takeUntilDestroyed(this.destroyRef) + ).subscribe(() => { + this.updateValidators(); + setTimeout(() => {this.popover?.updatePosition();}, 0); + }); + this.updateValidators(); + } + + cancel() { + this.popover?.hide(); + } + + applyShapeFillImageSettings() { + const shapeFillImageSettings: ShapeFillImageSettings = this.shapeFillImageSettingsFormGroup.value; + this.shapeFillImageSettingsApplied.emit(shapeFillImageSettings); + this.popover?.hide(); + } + + private updateValidators() { + const type: ShapeFillImageType = this.shapeFillImageSettingsFormGroup.get('type').value; + if (type === ShapeFillImageType.image) { + this.shapeFillImageSettingsFormGroup.get('image').enable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('opacity').enable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('angle').enable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('scale').enable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('imageFunction').disable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('images').disable({emitEvent: false}); + } else { + this.shapeFillImageSettingsFormGroup.get('image').disable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('opacity').disable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('angle').disable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('scale').disable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('imageFunction').enable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('images').enable({emitEvent: false}); + } + } + +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings.component.html new file mode 100644 index 0000000000..da4feaccf2 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings.component.html @@ -0,0 +1,29 @@ + + + + + diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings.component.ts new file mode 100644 index 0000000000..5f707abced --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings.component.ts @@ -0,0 +1,96 @@ +/// +/// Copyright © 2016-2025 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { ChangeDetectorRef, Component, forwardRef, Input, Renderer2, ViewContainerRef } from '@angular/core'; +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { MatButton } from '@angular/material/button'; +import { TbPopoverService } from '@shared/components/popover.service'; +import { ShapeFillImageSettings, ShapeFillImageType } from '@shared/models/widget/maps/map.models'; +import { + ShapeFillImageSettingsPanelComponent +} from '@home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component'; + +@Component({ + selector: 'tb-shape-fill-image-settings', + templateUrl: './shape-fill-image-settings.component.html', + styleUrls: [], + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => ShapeFillImageSettingsComponent), + multi: true + } + ] +}) +export class ShapeFillImageSettingsComponent implements ControlValueAccessor { + + @Input() + disabled: boolean; + + ShapeFillImageType = ShapeFillImageType; + + modelValue: ShapeFillImageSettings; + + private propagateChange: (v: any) => void = () => { }; + + constructor(private popoverService: TbPopoverService, + private renderer: Renderer2, + private cd: ChangeDetectorRef, + private viewContainerRef: ViewContainerRef) {} + + registerOnChange(fn: any): void { + this.propagateChange = fn; + } + + registerOnTouched(_fn: any): void { + } + + setDisabledState(isDisabled: boolean): void { + this.disabled = isDisabled; + } + + writeValue(value: ShapeFillImageSettings): void { + if (value) { + this.modelValue = value; + } + } + + openImageSettingsPopup($event: Event, matButton: MatButton) { + if ($event) { + $event.stopPropagation(); + } + const trigger = matButton._elementRef.nativeElement; + if (this.popoverService.hasPopover(trigger)) { + this.popoverService.hidePopover(trigger); + } else { + this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ShapeFillImageSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + shapeFillImageSettings: this.modelValue, + }, + isModal: true + }).tbComponentRef.instance.shapeFillImageSettingsApplied.subscribe((shapeFillImageSettings) => { + this.modelValue = shapeFillImageSettings; + this.propagateChange(this.modelValue); + this.cd.detectChanges(); + }); + } + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.html new file mode 100644 index 0000000000..c4b931dafd --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.html @@ -0,0 +1,84 @@ + +
    +
    widgets.maps.data-layer.shape.stripe-pattern
    +
    +
    +
    +
    widgets.maps.data-layer.shape.first-stripe
    +
    + + + px + + +
    +
    +
    +
    widgets.maps.data-layer.shape.second-stripe
    +
    + + + px + + +
    +
    +
    +
    widgets.maps.data-layer.shape.angle
    + + +
    deg
    +
    +
    +
    +
    + widgets.background.preview +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.scss new file mode 100644 index 0000000000..5f3af9894b --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.scss @@ -0,0 +1,80 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@import '../../../../../../../../../scss/constants'; + +.tb-shape-fill-stripe-settings-panel { + width: 700px; + max-width: 90vw; + min-height: 300px; + max-height: 90vh; + display: flex; + flex-direction: column; + gap: 16px; + @media #{$mat-xs} { + width: 90vw; + } + .tb-shape-fill-stripe-settings-title { + font-size: 16px; + font-weight: 500; + line-height: 24px; + letter-spacing: 0.25px; + color: rgba(0, 0, 0, 0.87); + } + .tb-form-row { + height: auto; + } + .tb-shape-fill-stripe-settings-panel-body { + flex: 1; + display: flex; + flex-direction: column; + min-height: 0; + overflow: auto; + } + .tb-shape-fill-stripe-settings-preview { + flex: 1; + background: #fff; + border-radius: 4px; + border: 1px solid rgba(0, 0, 0, 0.12); + display: flex; + flex-direction: column; + padding: 12px 16px 24px 16px; + align-items: center; + gap: 12px; + } + .tb-shape-fill-stripe-settings-preview-title { + align-self: stretch; + font-size: 16px; + font-style: normal; + font-weight: 500; + line-height: 24px; + color: rgba(0, 0, 0, 0.38); + } + .tb-shape-fill-stripe-settings-preview-box { + position: relative; + width: 136px; + height: 118px; + border-radius: 2.666px; + } + + .tb-shape-fill-stripe-settings-panel-buttons { + height: 40px; + display: flex; + flex-direction: row; + gap: 16px; + justify-content: flex-end; + align-items: flex-end; + } +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.ts new file mode 100644 index 0000000000..c9df56338b --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.ts @@ -0,0 +1,106 @@ +/// +/// Copyright © 2016-2025 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { Component, DestroyRef, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core'; +import { TbPopoverComponent } from '@shared/components/popover.component'; +import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { MapDataLayerType, ShapeFillStripeSettings } from '@shared/models/widget/maps/map.models'; +import { DomSanitizer } from '@angular/platform-browser'; +import { + generateStripePreviewUrl +} from '@home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component'; +import { ComponentStyle } from '@shared/models/widget-settings.models'; +import { MapSettingsContext } from '@home/components/widget/lib/settings/common/map/map-settings.component.models'; +import { DatasourceType } from '@shared/models/widget.models'; + +@Component({ + selector: 'tb-shape-fill-stripe-settings-panel', + templateUrl: './shape-fill-stripe-settings-panel.component.html', + providers: [], + styleUrls: ['./shape-fill-stripe-settings-panel.component.scss'], + encapsulation: ViewEncapsulation.None +}) +export class ShapeFillStripeSettingsPanelComponent implements OnInit { + + @Input() + shapeFillStripeSettings: ShapeFillStripeSettings; + + @Input() + context: MapSettingsContext; + + @Input() + dsType: DatasourceType; + + @Input() + dsEntityAliasId: string; + + @Input() + dsDeviceId: string; + + @Input() + dataLayerType: MapDataLayerType; + + @Output() + shapeFillStripeSettingsApplied = new EventEmitter(); + + stripePreviewStyle: ComponentStyle; + + shapeFillStripeSettingsFormGroup: UntypedFormGroup; + + constructor(private fb: UntypedFormBuilder, + private sanitizer: DomSanitizer, + private popover: TbPopoverComponent, + private destroyRef: DestroyRef) { + } + + ngOnInit(): void { + this.shapeFillStripeSettingsFormGroup = this.fb.group( + { + weight: [this.shapeFillStripeSettings?.weight, [Validators.min(0)]], + color: [this.shapeFillStripeSettings?.color, []], + spaceWeight: [this.shapeFillStripeSettings?.spaceWeight, [Validators.min(0)]], + spaceColor: [this.shapeFillStripeSettings?.spaceColor, []], + angle: [this.shapeFillStripeSettings?.angle, [Validators.min(0), Validators.max(180)]] + } + ); + this.shapeFillStripeSettingsFormGroup.valueChanges.pipe( + takeUntilDestroyed(this.destroyRef) + ).subscribe(() => { + this.updatePreview(); + }); + this.updatePreview(); + } + + cancel() { + this.popover?.hide(); + } + + applyShapeFillStripeSettings() { + const shapeFillStripeSettings: ShapeFillStripeSettings = this.shapeFillStripeSettingsFormGroup.value; + this.shapeFillStripeSettingsApplied.emit(shapeFillStripeSettings); + this.popover?.hide(); + } + + private updatePreview() { + const shapeFillStripeSettings: ShapeFillStripeSettings = this.shapeFillStripeSettingsFormGroup.value; + const previewUrl = generateStripePreviewUrl(shapeFillStripeSettings); + this.stripePreviewStyle = { + background: this.sanitizer.bypassSecurityTrustStyle(`url(${previewUrl}) no-repeat 50% 50% / cover`) + }; + } + +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.html new file mode 100644 index 0000000000..2188e97ae6 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.html @@ -0,0 +1,27 @@ + + diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.ts new file mode 100644 index 0000000000..63b2b4b212 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.ts @@ -0,0 +1,148 @@ +/// +/// Copyright © 2016-2025 The Thingsboard Authors +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// + +import { ChangeDetectorRef, Component, forwardRef, Input, Renderer2, ViewContainerRef } from '@angular/core'; +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { MatButton } from '@angular/material/button'; +import { TbPopoverService } from '@shared/components/popover.service'; +import { MapDataLayerType, ShapeFillStripeSettings } from '@shared/models/widget/maps/map.models'; +import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; +import { isDefinedAndNotNull, stringToBase64 } from '@core/utils'; +import { MapSettingsContext } from '@home/components/widget/lib/settings/common/map/map-settings.component.models'; +import { DatasourceType } from '@shared/models/widget.models'; +import { + ShapeFillStripeSettingsPanelComponent +} from '@home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component'; + +@Component({ + selector: 'tb-shape-fill-stripe-settings', + templateUrl: './shape-fill-stripe-settings.component.html', + styleUrls: [], + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => ShapeFillStripeSettingsComponent), + multi: true + } + ] +}) +export class ShapeFillStripeSettingsComponent implements ControlValueAccessor { + + @Input() + disabled: boolean; + + @Input() + context: MapSettingsContext; + + @Input() + dsType: DatasourceType; + + @Input() + dsEntityAliasId: string; + + @Input() + dsDeviceId: string; + + @Input() + dataLayerType: MapDataLayerType; + + modelValue: ShapeFillStripeSettings; + + stripePreviewUrl: SafeUrl; + + private propagateChange: (v: any) => void = () => { }; + + constructor(private popoverService: TbPopoverService, + private sanitizer: DomSanitizer, + private renderer: Renderer2, + private cd: ChangeDetectorRef, + private viewContainerRef: ViewContainerRef) {} + + registerOnChange(fn: any): void { + this.propagateChange = fn; + } + + registerOnTouched(_fn: any): void { + } + + setDisabledState(isDisabled: boolean): void { + this.disabled = isDisabled; + } + + writeValue(value: ShapeFillStripeSettings): void { + if (value) { + this.modelValue = value; + } + this.updatePreview(); + } + + openStripeSettingsPopup($event: Event, matButton: MatButton) { + if ($event) { + $event.stopPropagation(); + } + const trigger = matButton._elementRef.nativeElement; + if (this.popoverService.hasPopover(trigger)) { + this.popoverService.hidePopover(trigger); + } else { + this.popoverService.displayPopover({ + trigger, + renderer: this.renderer, + componentType: ShapeFillStripeSettingsPanelComponent, + hostView: this.viewContainerRef, + preferredPlacement: 'left', + context: { + shapeFillStripeSettings: this.modelValue, + context: this.context, + dsType: this.dsType, + dsEntityAliasId: this.dsEntityAliasId, + dsDeviceId: this.dsDeviceId, + dataLayerType: this.dataLayerType + }, + isModal: true + }).tbComponentRef.instance.shapeFillStripeSettingsApplied.subscribe((shapeFillStripeSettings) => { + this.modelValue = shapeFillStripeSettings; + this.updatePreview(); + this.propagateChange(this.modelValue); + this.cd.detectChanges(); + }); + } + } + + private updatePreview() { + this.stripePreviewUrl = this.sanitizer.bypassSecurityTrustUrl(generateStripePreviewUrl(this.modelValue)); + } +} + +export const generateStripePreviewUrl = (settings: ShapeFillStripeSettings): string => { + const weight = isDefinedAndNotNull(settings?.weight) ? settings.weight : 3; + const spaceWeight = isDefinedAndNotNull(settings?.spaceWeight) ? settings.spaceWeight : 9; + const angle = isDefinedAndNotNull(settings?.angle) ? settings.angle : 45; + const height = weight + spaceWeight; + const color = settings?.color?.color || '#8f8f8f'; + const spaceColor = settings?.spaceColor?.color || 'rgba(143,143,143,0)'; + const svgStr = ` + + + + + + + + `; + const encodedSvg = stringToBase64(svgStr); + return `data:image/svg+xml;base64,${encodedSvg}`; +} diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-settings-common.module.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-settings-common.module.ts index c00c816073..233b202684 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-settings-common.module.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/widget-settings-common.module.ts @@ -255,6 +255,18 @@ import { MapDataSourcesComponent } from '@home/components/widget/lib/settings/co import { MapDataSourceRowComponent } from '@home/components/widget/lib/settings/common/map/map-data-source-row.component'; +import { + ShapeFillImageSettingsComponent +} from '@home/components/widget/lib/settings/common/map/shape-fill-image-settings.component'; +import { + ShapeFillImageSettingsPanelComponent +} from '@home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component'; +import { + ShapeFillStripeSettingsComponent +} from '@home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component'; +import { + ShapeFillStripeSettingsPanelComponent +} from '@home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component'; @NgModule({ declarations: [ @@ -342,6 +354,10 @@ import { MarkerImageSettingsComponent, MarkerImageSettingsPanelComponent, MarkerClusteringSettingsComponent, + ShapeFillStripeSettingsComponent, + ShapeFillStripeSettingsPanelComponent, + ShapeFillImageSettingsComponent, + ShapeFillImageSettingsPanelComponent, MapDataLayerDialogComponent, MapDataLayerRowComponent, MapDataLayersComponent, diff --git a/ui-ngx/src/app/shared/models/widget/maps/map.models.ts b/ui-ngx/src/app/shared/models/widget/maps/map.models.ts index bac8c8fb75..e09d5e5756 100644 --- a/ui-ngx/src/app/shared/models/widget/maps/map.models.ts +++ b/ui-ngx/src/app/shared/models/widget/maps/map.models.ts @@ -487,8 +487,40 @@ export const defaultBaseTripsDataLayerSettings = (mapType: MapType): Partial => mergeDeep({ + fillType: ShapeFillType.color, fillColor: { type: DataLayerColorType.constant, color: 'rgba(51,136,255,0.2)', }, + fillImage: { + type: ShapeFillImageType.image, + image: '/assets/widget-preview-empty.svg', + opacity: 1, + angle: 0, + scale: 1 + }, + fillStripe: { + weight: 3, + color: { + type: DataLayerColorType.constant, + color: '#8f8f8f' + }, + spaceWeight: 9, + spaceColor: { + type: DataLayerColorType.constant, + color: 'rgba(143,143,143,0)', + }, + angle: 45 + }, strokeColor: { type: DataLayerColorType.constant, color: '#3388ff', @@ -539,10 +592,31 @@ export const defaultCirclesDataLayerSettings = (mapType: MapType, functionsOnly } as CirclesDataLayerSettings, defaultBaseCirclesDataLayerSettings(mapType) as CirclesDataLayerSettings); export const defaultBaseCirclesDataLayerSettings = (mapType: MapType): Partial => mergeDeep({ + fillType: ShapeFillType.color, fillColor: { type: DataLayerColorType.constant, color: 'rgba(51,136,255,0.2)', }, + fillImage: { + type: ShapeFillImageType.image, + image: '/assets/widget-preview-empty.svg', + opacity: 1, + angle: 0, + scale: 1 + }, + fillStripe: { + weight: 3, + color: { + type: DataLayerColorType.constant, + color: '#8f8f8f' + }, + spaceWeight: 9, + spaceColor: { + type: DataLayerColorType.constant, + color: 'rgba(143,143,143,0)', + }, + angle: 45 + }, strokeColor: { type: DataLayerColorType.constant, color: '#3388ff', @@ -596,10 +670,8 @@ export const mapDataSourceValid = (dataSource: MapDataSourceSettings): boolean = if (dataSource.dsType === DatasourceType.device && !dataSource.dsDeviceId) { return false; } - if (dataSource.dsType === DatasourceType.entity && !dataSource.dsEntityAliasId) { - return false; - } - return true; + return !(dataSource.dsType === DatasourceType.entity && !dataSource.dsEntityAliasId); + }; export const mapDataSourceValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => { @@ -1112,6 +1184,13 @@ export interface MarkerIconInfo { size: [number, number]; } +export interface ShapeFillImageInfo { + url: string; + opacity?: number; + angle?: number; + scale?: number; +} + export type MapStringFunction = (data: FormattedData, dsData: FormattedData[]) => string; @@ -1126,6 +1205,9 @@ export type ClusterMarkerColorFunction = (data: FormattedData[] export type MarkerPositionFunction = (origXPos: number, origYPos: number, data: FormattedData, dsData: FormattedData[], aspect: number) => { x: number, y: number }; +export type ShapeFillImageFunction = (data: FormattedData, images: string[], + dsData: FormattedData[]) => ShapeFillImageInfo; + export type TbPolygonRawCoordinate = L.LatLngTuple | L.LatLngTuple[] | L.LatLngTuple[][]; export type TbPolygonRawCoordinates = TbPolygonRawCoordinate[]; export type TbPolyData = L.LatLngTuple[] | L.LatLngTuple[][] | L.LatLngTuple[][][]; @@ -1271,11 +1353,13 @@ const imageLoader = (imageUrl: string): Observable => new Obse image.src = imageUrl; }); -const loadImageAspect = (imageUrl: string): Observable => - imageLoader(imageUrl).pipe(map(image => image.width / image.height)); +const loadImageSize = (imageUrl: string): Observable<[number, number]> => + imageLoader(imageUrl).pipe(map(image => [image.width, image.height])); export interface ImageWithAspect { url: string; + width: number; + height: number; aspect: number; } @@ -1289,9 +1373,14 @@ export const loadImageWithAspect = (imagePipe: ImagePipe, imageUrl: string): Obs return imagePipe.transform(imageUrl, {asString: true, ignoreLoadingImage: true}).pipe( switchMap((res) => { const url = res as string; - return loadImageAspect(url).pipe( - map((aspect) => { - imageWithAspect = {url, aspect}; + return loadImageSize(url).pipe( + map((size) => { + imageWithAspect = { + url, + width: size[0], + height: size[1], + aspect: size[0]/size[1] + }; imageAspectMap[hash] = imageWithAspect; return imageWithAspect; }) diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md new file mode 100644 index 0000000000..b13d612c8e --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md @@ -0,0 +1,52 @@ +#### Shape fill image function + +
    +
    + +*function (data, images, dsData): {url: string}* + +A JavaScript function used to compute shape fill image. + +**Parameters:** + +
      + {% include widget/lib/map/shape_fill_image_fn_args %} +
    + +**Returns:** + +Should return shape fill image data having the following structure: + +```typescript +{ + url: string; + opacity?: number; + angle?: number; + scale?: number; +} +``` + +- *url* - fill image url; +- *opacity* - optional image opacity, number value from 0 to 1; +- *angle* - optional image rotation angle, number value from 0 to 360; +- *scale* - optional image scale, number value (1 - original size, smaller value - scale down, bigger value - scale up); + +In case no data is returned, default fill image will be used. + +
    + +##### Examples + +
      +
    • +TODO: +
    • +
    + +```javascript +TODO: +{:copy-code} +``` + +
    +
    diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn_args.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn_args.md new file mode 100644 index 0000000000..07b60f72ae --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn_args.md @@ -0,0 +1,9 @@ +
  • data: FormattedData object associated with data layer (markers/polygons/circles) or data point of the route (trips data layer).
    + Represents basic entity properties (ex. entityId, entityName)
    and provides access to other entity attributes/timeseries declared in datasource of the data layer configuration. +
  • +
  • images: string[] - array of image urls configured in the Shape fill images section. +
  • +
  • dsData: FormattedData[] - All available data associated with data layers including additional datasources as array of FormattedData objects
    + resolved from configured datasources. Each object represents basic entity properties (ex. entityId, entityName)
    + and provides access to other entity attributes/timeseries declared in datasources of data layers configuration including additional datasources of the map configuration. +
  • diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index ec047f91ae..e4f4721f3c 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -8011,8 +8011,6 @@ "groups": "Groups", "groups-hint": "List of group names assigned to the overlay, used to toggle its visibility on the map.", "color": "Color", - "fill-color": "Fill color", - "stroke": "Stroke", "color-settings": "Color settings", "color-type-constant": "Constant", "color-type-range": "Range", @@ -8127,6 +8125,27 @@ "points": "Points", "point-tooltip": "Point tooltip" }, + "shape": { + "fill": "Fill", + "fill-type-color": "Color", + "fill-type-stripe": "Stripe", + "fill-type-image": "Image", + "color": "Color", + "stripe": "Stripe", + "image": "Image", + "stroke": "Stroke", + "fill-image": "Fill image", + "fill-image-type-image": "Image", + "fill-image-type-function": "Function", + "opacity": "Opacity", + "angle": "Rotation angle", + "scale": "Scale", + "fill-image-function": "Shape fill image function", + "fill-images": "Shape fill images", + "stripe-pattern": "Stripe pattern", + "first-stripe": "First stripe", + "second-stripe": "Second stripe" + }, "polygon": { "polygon-key": "Polygon key", "polygon-key-required": "Polygon key required", diff --git a/ui-ngx/src/typings/leaflet-extend-tb.d.ts b/ui-ngx/src/typings/leaflet-extend-tb.d.ts index 1ea249b478..3b982a527e 100644 --- a/ui-ngx/src/typings/leaflet-extend-tb.d.ts +++ b/ui-ngx/src/typings/leaflet-extend-tb.d.ts @@ -25,6 +25,18 @@ declare module 'leaflet' { interface MarkerOptions { tbMarkerData?: FormattedData; } + interface Map { + _patterns: {[id: number]: L.TB.Pattern}; + _defRoot: SVGDefsElement; + addPattern(pattern: L.TB.Pattern): Map; + removePattern(pattern: L.TB.Pattern): Map; + hasPattern(pattern: L.TB.Pattern): boolean; + _initDefRoot(): void; + } + + interface PathOptions { + fillPattern?: L.TB.Pattern | undefined; + } interface TileLayer { _url: string; @@ -152,6 +164,109 @@ declare module 'leaflet' { container: HTMLElement; } + interface PathOptions { + fillPattern?: Pattern | undefined; + } + + interface PatternOptions { + x?: number | undefined; + y?: number | undefined; + width?: number | undefined; + height?: number | undefined; + patternUnits?: "userSpaceOnUse" | "objectBoundingBox" | undefined; + patternContentUnits?: "userSpaceOnUse" | "objectBoundingBox" | undefined; + patternTransform?: string | null | undefined; + preserveAspectRatioAlign?: "none" | "xMinYMin" | "xMidYMin" | "xMaxYMin" | "xMinYMid" | "xMidYMid" | "xMaxYMid" | "xMinYMax" | "xMidYMax" | "xMaxYMax" | undefined; + preserveAspectRatioMeetOrSlice?: "meet" | "slice" | undefined; + viewBox?: [number, number, number, number] | undefined; + angle?: number | null | undefined; + className?: string | undefined; + } + + interface PatternElementOptions { + className?: string | undefined; + } + + interface PatternShapeOptions extends PatternElementOptions { + stroke?: boolean | undefined; + color?: string | undefined; + weight?: number | undefined; + opacity?: number | undefined; + lineCap?: "butt" | "round" | "square" | "inherit" | undefined; + lineJoin?: "butt" | "round" | "square" | "inherit" | undefined; + dashArray?: number[] | null | undefined; + dashOffset?: number | null | undefined; + fill?: boolean | undefined; + fillColor?: string | undefined; + fillOpacity?: number | undefined; + fillRule?: "nonzero" | "evenodd" | "inherit" | undefined; + fillPattern?: Pattern | null | undefined; + pointerEvents?: string | undefined; + interactive?: boolean | undefined; + } + + interface PatternRectOptions extends PatternShapeOptions { + x?: number | undefined; + y?: number | undefined; + width?: number | undefined; + height?: number | undefined; + rx?: number | null | undefined; + ry?: number | null | undefined; + } + + interface PatternPathOptions extends PatternShapeOptions { + d?: string | null | undefined; + } + + interface PatternImageOptions extends PatternElementOptions { + imageUrl: string; + width: number; + height: number; + opacity?: number; + angle?: number; + scale?: number; + } + + class Pattern extends L.Evented { + constructor(options?: PatternOptions); + onAdd(map: L.Map): void; + onRemove(map: L.Map): void; + redraw(): this; + setStyle(style: PatternOptions): this; + addTo(map: L.Map): this; + remove(): this; + removeFrom(map: L.Map): this; + addElement(element: PatternElement): PatternElement | undefined; + } + + abstract class PatternElement extends L.Class { + protected constructor(options?: PatternElementOptions); + onAdd(pattern: Pattern): void; + addTo(pattern: Pattern): this; + redraw(): this; + setStyle(style: PatternElementOptions): this; + } + + abstract class PatternShape extends PatternElement { + protected constructor(options?: PatternShapeOptions); + setStyle(style: PatternShapeOptions): this; + } + + class PatternRect extends PatternShape { + constructor(options?: PatternRectOptions); + setStyle(style: PatternRectOptions): this; + } + + class PatternPath extends PatternShape { + constructor(options?: PatternPathOptions); + setStyle(style: PatternPathOptions): this; + } + + class PatternImage extends PatternElement { + constructor(options: PatternImageOptions); + setStyle(style: PatternImageOptions): this; + } + function sidebar(options: SidebarControlOptions): SidebarControl; function sidebarPane(options: O): SidebarPaneControl; diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index 602839b2da..6e86f3c2b0 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -1581,10 +1581,10 @@ dependencies: tslib "^2.3.0" -"@geoman-io/leaflet-geoman-free@2.17.0": - version "2.17.0" - resolved "https://registry.yarnpkg.com/@geoman-io/leaflet-geoman-free/-/leaflet-geoman-free-2.17.0.tgz#9c8fce5c7a85e5d7ece3a7e5d0b82dbf2329bd81" - integrity sha512-vAY9tKB2I/Ui8d3QUBuebWnunI2sGjsfAUTXMMcf5UpISvPz67io4hpbKXid9GNsW6P4LGv1+ZzrmkpM78GzHA== +"@geoman-io/leaflet-geoman-free@2.18.3": + version "2.18.3" + resolved "https://registry.yarnpkg.com/@geoman-io/leaflet-geoman-free/-/leaflet-geoman-free-2.18.3.tgz#a41489920b175931fba2a1e8e81347f9e3be5481" + integrity sha512-XzxSKRk2UJUVeGiOt1jU2hyo412Qee1Q0Xsfw4A2r8EoUIo48XKSWfusYe7E53fSPr0aYgZxPevnFdcUXimpdA== dependencies: "@turf/boolean-contains" "^6.5.0" "@turf/kinks" "^6.5.0" From 2a3562ef2905ca942404192150a54eab6caf15b4 Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Mon, 7 Apr 2025 20:33:48 +0300 Subject: [PATCH 194/286] UI: Updated default value maxDebugModeDurationMinutes in tenant profile --- ui-ngx/src/app/shared/models/tenant.model.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/models/tenant.model.ts b/ui-ngx/src/app/shared/models/tenant.model.ts index 23896141db..8866b54574 100644 --- a/ui-ngx/src/app/shared/models/tenant.model.ts +++ b/ui-ngx/src/app/shared/models/tenant.model.ts @@ -137,7 +137,7 @@ export function createTenantProfileConfiguration(type: TenantProfileType): Tenan maxSms: 0, smsEnabled: true, maxCreatedAlarms: 0, - maxDebugModeDurationMinutes: 0, + maxDebugModeDurationMinutes: 15, tenantServerRestLimitsConfiguration: '', customerServerRestLimitsConfiguration: '', maxWsSessionsPerTenant: 0, From 703cec8066c9585bef5a13e823df13b160296757 Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Mon, 7 Apr 2025 20:59:46 +0300 Subject: [PATCH 195/286] UI: Fixed import file dialog when long file name --- .../import-dialog.component.html | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/ui-ngx/src/app/shared/import-export/import-dialog.component.html b/ui-ngx/src/app/shared/import-export/import-dialog.component.html index ff775fc555..5d354abae8 100644 --- a/ui-ngx/src/app/shared/import-export/import-dialog.component.html +++ b/ui-ngx/src/app/shared/import-export/import-dialog.component.html @@ -28,32 +28,30 @@
    -
    -
    - - {{ importFileLabel | translate }} - {{ importContentLabel | translate }} - - - - - -
    -
    +
    + + {{ importFileLabel | translate }} + {{ importContentLabel | translate }} + + + + + +
    +
    +
    @if (configFormGroup.get('expressionSIMPLE').errors && configFormGroup.get('expressionSIMPLE').touched) { @if (configFormGroup.get('expressionSIMPLE').hasError('required')) { diff --git a/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html b/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html index 6d8ac56fc1..3b91c56acf 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html @@ -32,6 +32,12 @@ {{'rule-node-config.custom-expression-field-input' | translate }} * +
    +
    rule-node-config.custom-expression-field-input-required @@ -73,7 +79,7 @@ help + matTooltip="{{ 'rule-node-config.math-templatization-tooltip' | translate }}">info rule-node-config.key-field-input-required diff --git a/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html b/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html index b98854d0e5..aa61beb32a 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html @@ -67,7 +67,7 @@ - help + info rule-node-config.argument-key-field-input-required diff --git a/ui-ngx/src/assets/help/en_US/math/math-methods_fn.md b/ui-ngx/src/assets/help/en_US/math/math-methods_fn.md new file mode 100644 index 0000000000..e9cb7bb13e --- /dev/null +++ b/ui-ngx/src/assets/help/en_US/math/math-methods_fn.md @@ -0,0 +1,31 @@ +## Built-in mathematical functions +The following expression field provides support for built-in mathematical functions that you can utilize for various calculations. + +| Function | Description | Example | +|---------------|---------------------------------------------------------------------|-------------------| +| `abs(x)` | Absolute value of `x`. | `abs(-7) = 7` | +| `acos(x)` | Arc cosine of `x`, result in radians. Requires `-1 ≤ x ≤ 1`. | `acos(1) = 0` | +| `asin(x)` | Arc sine of `x`, result in radians. Requires `-1 ≤ x ≤ 1`. | `asin(0) = 0` | +| `atan(x)` | Arc tangent of `x`, result in radians. | `atan(0) = 0` | +| `cbrt(x)` | Cube root of `x`. | `cbrt(8) = 2` | +| `ceil(x)` | Rounds `x` up to the nearest integer. | `ceil(3.1) = 4` | +| `cos(x)` | Cosine of `x`, where `x` is in radians. | `cos(0) = 1` | +| `cosh(x)` | Hyperbolic cosine of `x`. | `cosh(0) = 1` | +| `cot(x)` | Cotangent of `x` (1 / tan(`x`)), where `x` is in radians. | `cot(0.7854) ≈ 1` | +| `exp(x)` | Computes `e^x`. | `exp(0) = 1` | +| `expm1(x)` | Computes `e^x - 1` accurately for small `x`. | `expm1(0) = 0` | +| `floor(x)` | Rounds `x` down to the nearest integer. | `floor(3.9) = 3` | +| `ln(x)` | Natural logarithm (base *e*) of `x`. Requires `x > 0`. | `ln(1) = 0` | +| `log(x)` | Natural logarithm (base *e*) of `x`. Requires `x > 0`. | `log(1) = 0` | +| `lg(x)` | Natural logarithm (base 10) of `x`. Requires `x > 0`. | `lg(10) = 1` | +| `log10(x)` | Logarithm base 10 of `x`. Requires `x > 0`. | `log10(100) = 2` | +| `log2(x)` | Logarithm base 2 of `x`. Requires `x > 0`. | `log2(8) = 3` | +| `logab(a, b)` | Logarithm of `b` with base `a`. Requires `a > 0`, `b > 0`, `a ≠ 1`. | `logab(2, 8) = 3` | +| `log1p(x)` | Computes `ln(1 + x)` accurately for small `x`. Requires `x > -1`. | `log1p(0) = 0` | +| `pow(x, y)` | Raises `x` to the power of `y` (`x^y`). | `pow(2, 3) = 8` | +| `signum(x)` | Returns the sign of `x`: -1 if `x < 0`, 0 if `x = 0`, 1 if `x > 0`. | `signum(-5) = -1` | +| `sin(x)` | Sine of `x`, where `x` is in radians. | `sin(0) = 0` | +| `sinh(x)` | Hyperbolic sine of `x`. | `sinh(0) = 0` | +| `sqrt(x)` | Square root of `x`. Requires `x ≥ 0`. | `sqrt(4) = 2` | +| `tan(x)` | Tangent of `x`, where `x` is in radians. | `tan(0) = 0` | +| `tanh(x)` | Hyperbolic tangent of `x`. | `tanh(0) = 0` | From a38831cc017641155d7e349afe16a50dcc7ddfb6 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Tue, 8 Apr 2025 17:20:27 +0300 Subject: [PATCH 203/286] Fix repo open catch --- .../org/thingsboard/server/service/sync/vc/GitRepository.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/GitRepository.java b/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/GitRepository.java index 3500e48a79..df0f79171f 100644 --- a/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/GitRepository.java +++ b/common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/GitRepository.java @@ -42,7 +42,6 @@ import org.eclipse.jgit.diff.RawText; import org.eclipse.jgit.diff.RawTextComparator; import org.eclipse.jgit.errors.LargeObjectException; import org.eclipse.jgit.errors.RepositoryNotFoundException; -import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; @@ -158,7 +157,7 @@ public class GitRepository { return repository; } catch (RepositoryNotFoundException e) { log.warn("{} not a git repository, reinitializing", directory); - } catch (TransportException e) { + } catch (org.eclipse.jgit.errors.TransportException | org.eclipse.jgit.api.errors.TransportException e) { if (StringUtils.containsIgnoreCase(e.getMessage(), "missing commit")) { log.warn("Couldn't fetch {} due to {}, reinitializing", directory, e.getMessage()); } else { From 10666295edc935f30a9284f54dbea50a83d96d0c Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 8 Apr 2025 17:31:04 +0300 Subject: [PATCH 204/286] UI: Fixed incorrect js library calculate delete enabled status --- .../admin/resource/js-library-table-config.resolver.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts index 9c5dba6dbb..8525983a36 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts @@ -97,7 +97,7 @@ export class JsLibraryTableConfigResolver { entity => checkBoxCell(entity.tenantId.id === NULL_UUID)), ); - this.config.cellActionDescriptors = this.configureCellActions(getCurrentAuthUser(this.store)); + this.config.cellActionDescriptors = this.configureCellActions(); this.config.groupActionDescriptors = [{ name: this.translate.instant('action.delete'), @@ -137,6 +137,7 @@ export class JsLibraryTableConfigResolver { resourceSubType: '' }; const authUser = getCurrentAuthUser(this.store); + this.config.deleteEnabled = (resource) => this.isResourceEditable(resource, authUser.authority); this.config.entitySelectionEnabled = (resource) => this.isResourceEditable(resource, authUser.authority); this.config.detailsReadonly = (resource) => this.detailsReadonly(resource, authUser.authority); return this.config; @@ -309,7 +310,7 @@ export class JsLibraryTableConfigResolver { } } - private configureCellActions(authUser: AuthUser): Array> { + private configureCellActions(): Array> { const actions: Array> = []; actions.push( { @@ -321,7 +322,7 @@ export class JsLibraryTableConfigResolver { { name: this.translate.instant('javascript.delete'), icon: 'delete', - isEnabled: (resource) => this.isResourceEditable(resource, authUser.authority), + isEnabled: (resource) => this.config.deleteEnabled(resource), onAction: ($event, entity) => this.deleteResource($event, entity) }, ); From a38d39fda9a452216356d0857d928ca2905c9dbb Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Tue, 8 Apr 2025 18:23:19 +0300 Subject: [PATCH 205/286] TenantProfileEdgeTest - revert tenant profile update --- .../server/edge/TenantProfileEdgeTest.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 e58126737d..51cfa44ff9 100644 --- a/application/src/test/java/org/thingsboard/server/edge/TenantProfileEdgeTest.java +++ b/application/src/test/java/org/thingsboard/server/edge/TenantProfileEdgeTest.java @@ -44,9 +44,8 @@ public class TenantProfileEdgeTest extends AbstractEdgeTest { @Test public void testTenantProfiles() throws Exception { loginSysAdmin(); - - // save current values into tmp to revert after test - TenantProfile edgeTenantProfile = doGet("/api/tenantProfile/" + tenantProfileId.getId(), TenantProfile.class); + TenantProfile originalTenantProfile = doGet("/api/tenantProfile/" + tenantProfileId.getId(), TenantProfile.class); + TenantProfile edgeTenantProfile = new TenantProfile(originalTenantProfile); // updated edge tenant profile edgeTenantProfile.setName("Tenant Profile Edge Test"); @@ -64,14 +63,15 @@ public class TenantProfileEdgeTest extends AbstractEdgeTest { Assert.assertEquals("Updated tenant profile Edge Test", tenantProfileMsg.getDescription()); Assert.assertEquals("Tenant Profile Edge Test", tenantProfileMsg.getName()); + doPost("/api/tenantProfile", originalTenantProfile, TenantProfile.class); loginTenantAdmin(); } @Test public void testIsolatedTenantProfile() throws Exception { loginSysAdmin(); - - TenantProfile edgeTenantProfile = doGet("/api/tenantProfile/" + tenantProfileId.getId(), TenantProfile.class); + TenantProfile originalTenantProfile = doGet("/api/tenantProfile/" + tenantProfileId.getId(), TenantProfile.class); + TenantProfile edgeTenantProfile = new TenantProfile(originalTenantProfile); // set tenant profile isolated and add 2 queues - main and isolated edgeTenantProfile.setIsolatedTbRuleEngine(true); @@ -110,6 +110,10 @@ public class TenantProfileEdgeTest extends AbstractEdgeTest { Assert.assertNotNull(queue); Assert.assertEquals(tenantId, queue.getTenantId()); } + + loginSysAdmin(); + doPost("/api/tenantProfile", originalTenantProfile, TenantProfile.class); + loginTenantAdmin(); } private TenantProfileQueueConfiguration createQueueConfig(String queueName, String queueTopic) { From 72ddc1bb485b37fcb7826fc1453c99cab78a4846 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 3 Apr 2025 18:23:22 +0300 Subject: [PATCH 206/286] UI: Fixed twice call registerOnChanges (first call when cleanUControl from default function noop) --- .../widget/config/datasources.component.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts index dd9873e4b9..f8d5064860 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/config/datasources.component.ts @@ -150,7 +150,8 @@ export class DatasourcesComponent implements ControlValueAccessor, OnInit, Valid datasourcesMode: DatasourceType; - private propagateChange = (_val: any) => {}; + private propagateChange: (value: any) => void; + private propagateChangePending = false; constructor(private fb: UntypedFormBuilder, private utils: UtilsService, @@ -161,7 +162,7 @@ export class DatasourcesComponent implements ControlValueAccessor, OnInit, Valid registerOnChange(fn: any): void { this.propagateChange = fn; - if (this.validate(null)) { + if (this.propagateChangePending) { setTimeout(() => { this.datasourcesUpdated(this.datasourcesFormGroup.get('datasources').value); }, 0); @@ -227,7 +228,7 @@ export class DatasourcesComponent implements ControlValueAccessor, OnInit, Valid if (this.singleDatasource && !this.datasourcesFormArray.length) { this.addDatasource(false); } - if (changed) { + if (changed || this.validate(null)) { setTimeout(() => { this.datasourcesUpdated(this.datasourcesFormGroup.get('datasources').value); }, 0); @@ -329,7 +330,12 @@ export class DatasourcesComponent implements ControlValueAccessor, OnInit, Valid if (this.datasourcesOptional) { datasources = datasources ? datasources.filter(d => datasourceValid(d)) : []; } - this.propagateChange(datasources); + if (this.propagateChange) { + this.propagateChange(datasources); + this.propagateChangePending = false; + } else { + this.propagateChangePending = true; + } } public onDatasourceDrop(event: CdkDragDrop) { From a83a88f8babd0d3759a8815391804d5e19737cf2 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 8 Apr 2025 18:33:26 +0300 Subject: [PATCH 207/286] UI: Add to file input truncate text with tooltip --- .../src/app/shared/components/file-input.component.html | 8 ++++---- .../src/app/shared/components/file-input.component.scss | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ui-ngx/src/app/shared/components/file-input.component.html b/ui-ngx/src/app/shared/components/file-input.component.html index ff008bf630..105257dd24 100644 --- a/ui-ngx/src/app/shared/components/file-input.component.html +++ b/ui-ngx/src/app/shared/components/file-input.component.html @@ -51,9 +51,9 @@
    - -
    {{ noFileText }}
    -
    {{ fileName }}
    -
    dashboard.maximum-upload-file-size
    + +
    {{ noFileText }}
    +
    {{ fileName }}
    +
    dashboard.maximum-upload-file-size
    diff --git a/ui-ngx/src/app/shared/components/file-input.component.scss b/ui-ngx/src/app/shared/components/file-input.component.scss index 00598adc3b..1c21eb1798 100644 --- a/ui-ngx/src/app/shared/components/file-input.component.scss +++ b/ui-ngx/src/app/shared/components/file-input.component.scss @@ -131,15 +131,11 @@ $previewSize: 100px !default; .tb-file-name { color: rgba(0, 0, 0, 0.54); font-weight: 500; - overflow: hidden; - text-overflow: ellipsis; } .tb-file-hint { color: rgba(0, 0, 0, 0.38); font-weight: 400; - overflow: hidden; - text-overflow: ellipsis; } } From 1f8fa241d639464bc36c79b22cab8f968800d140 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 8 Apr 2025 19:05:05 +0300 Subject: [PATCH 208/286] Adjusted doc file --- .../assets/help/en_US/math/math-methods_fn.md | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/assets/help/en_US/math/math-methods_fn.md b/ui-ngx/src/assets/help/en_US/math/math-methods_fn.md index e9cb7bb13e..9a5ddf3530 100644 --- a/ui-ngx/src/assets/help/en_US/math/math-methods_fn.md +++ b/ui-ngx/src/assets/help/en_US/math/math-methods_fn.md @@ -1,5 +1,30 @@ +## Built-in operators +The following operators can be used in expressions: + +| Operator | Description | Example | +|----------|-------------------------------|-----------------| +| `+` | Addition or unary plus | `2 + 3` or `+3` | +| `-` | Subtraction or unary minus | `5 - 2` or `-3` | +| `*` | Multiplication | `4 * 2` | +| `/` | Division | `10 / 2` | +| `^` | Exponentiation | `2 ^ 3` | +| `%` | Modulo | `10 % 3` | + + +## Implicit multiplication +Expressions supports implicit multiplication, allowing you to omit the multiplication operator in certain cases. For example, the expression `2cos(yx)` is interpreted as `2*cos(y*x)`. Similarly, `3x` is interpreted as `3*x`, and `xy` as `x*y`. This feature makes writing expressions more concise and natural. + +## Built-in constants +Available constants for calculations: + +| Constant | Description | Value | +|-------------|-----------------------------|-------------------| +| `π` or `pi` | The mathematical constant π | 3.141592653589793 | +| `e` | Euler's number | 2.718281828459045 | +| `φ` | The golden ratio | 1.618033988749895 | + ## Built-in mathematical functions -The following expression field provides support for built-in mathematical functions that you can utilize for various calculations. +The following built-in mathematical functions can be used to perform various calculations: | Function | Description | Example | |---------------|---------------------------------------------------------------------|-------------------| From 1b2ce0c74a579d055d4c0ad0e8a24d30f00aad28 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 8 Apr 2025 20:12:13 +0300 Subject: [PATCH 209/286] UI: Fix add/edit for invalid widget (not loaded due to errors). Minor style improvements. --- .../components/alarm/alarm-table-config.ts | 2 +- .../attribute/attribute-table.component.ts | 4 +- .../dashboard-page.component.ts | 11 ++- .../components/event/event-table-config.ts | 2 +- .../alarm/alarms-table-widget.component.ts | 6 +- .../unread-notification-widget.component.ts | 2 +- .../date-range-navigator.component.ts | 2 +- .../entity/entities-table-widget.component.ts | 2 +- .../lib/rpc/persistent-table.component.ts | 2 +- .../lib/timeseries-table-widget.component.ts | 2 +- .../widget/widget-component.service.ts | 6 +- .../widget/widget-config.component.html | 2 +- .../components/widget/widget.component.ts | 94 +++++++++---------- .../timewindow-config-dialog.component.ts | 4 +- .../components/time/timezone.component.ts | 2 +- 15 files changed, 75 insertions(+), 68 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-table-config.ts b/ui-ngx/src/app/modules/home/components/alarm/alarm-table-config.ts index fb0ff6de90..b450940ca1 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-table-config.ts @@ -243,7 +243,7 @@ export class AlarmTableConfig extends EntityTableConfig if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig(); config.backdropClass = 'cdk-overlay-transparent-backdrop'; config.hasBackdrop = true; diff --git a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts index 538afa3a06..d4ff2dc041 100644 --- a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts @@ -338,7 +338,7 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI if (this.isClientSideTelemetryTypeMap.get(this.attributeScope)) { return; } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig(); config.backdropClass = 'cdk-overlay-transparent-backdrop'; config.hasBackdrop = true; @@ -389,7 +389,7 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig({ panelClass: 'tb-filter-panel', backdropClass: 'cdk-overlay-transparent-backdrop', diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index 5fad94601d..9490db52a4 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -1335,8 +1335,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC addWidgetFromType(widget: WidgetInfo) { this.onAddWidgetClosed(); - this.widgetComponentService.getWidgetInfo(widget.typeFullFqn).subscribe( - (widgetTypeInfo) => { + this.widgetComponentService.getWidgetInfo(widget.typeFullFqn).subscribe({ + next: (widgetTypeInfo) => { const config: WidgetConfig = this.dashboardUtils.widgetConfigFromWidgetType(widgetTypeInfo); if (!config.title) { config.title = 'New ' + widgetTypeInfo.widgetName; @@ -1389,8 +1389,13 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC } }); } + }, + error: (errorData) => { + const errorMessages: string[] = errorData.errorMessages; + this.dialogService.alert(this.translate.instant('widget.widget-type-load-error'), + errorMessages.join('
    ').replace(/\n/g, '
    ')); } - ); + }); } onRevertWidgetEdit() { 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 5d770fed3b..5578f2417a 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 @@ -571,7 +571,7 @@ export class EventTableConfig extends EntityTableConfig { if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig({ panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts index 4aa8e52391..7384f76b62 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.ts @@ -550,7 +550,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig({ panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', @@ -621,7 +621,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig({ panelClass: 'tb-filter-panel', backdropClass: 'cdk-overlay-transparent-backdrop', @@ -1189,7 +1189,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig(); config.backdropClass = 'cdk-overlay-transparent-backdrop'; config.hasBackdrop = true; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts index dc0fc8b2d8..ce13fe227e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/cards/unread-notification-widget.component.ts @@ -237,7 +237,7 @@ export class UnreadNotificationWidgetComponent implements OnInit, OnDestroy { if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig({ panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator.component.ts index 551ffe4ba1..a1c987e29a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator.component.ts @@ -126,7 +126,7 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements $event.stopPropagation(); } this.datePickerSelect.close(); - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig(); config.backdropClass = 'cdk-overlay-transparent-backdrop'; config.hasBackdrop = true; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts index c395192a60..653c388364 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entity/entities-table-widget.component.ts @@ -513,7 +513,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig({ panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/persistent-table.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/persistent-table.component.ts index dfda3d243c..586f425b13 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/persistent-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/persistent-table.component.ts @@ -418,7 +418,7 @@ export class PersistentTableComponent extends PageComponent implements OnInit, O if ($event) { $event.stopPropagation(); } - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig(); config.backdropClass = 'cdk-overlay-transparent-backdrop'; config.hasBackdrop = true; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 9544947060..2653b79059 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -455,7 +455,7 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI $event.stopPropagation(); } if (this.sources.length) { - const target = $event.target || $event.srcElement || $event.currentTarget; + const target = $event.target || $event.currentTarget; const config = new OverlayConfig({ panelClass: 'tb-panel-container', backdropClass: 'cdk-overlay-transparent-backdrop', diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts index f4e69c954c..c0f37b3a37 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts @@ -243,7 +243,11 @@ export class WidgetComponentService { if (widgetInfo) { return widgetInfo; } else { - return {} as WidgetInfo; + return { + typeParameters: { + hideDataTab: true + } + } as WidgetInfo; } } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html index 2b187ab0b2..efa1dffe0b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html @@ -165,7 +165,7 @@ [widgetType] = "modelValue.widgetType" [defaultIconColor]="widgetSettings.get('color').value" [actionSources]="modelValue.actionSources" - [additionalWidgetActionTypes]="modelValue.typeParameters.additionalWidgetActionTypes" + [additionalWidgetActionTypes]="modelValue.typeParameters?.additionalWidgetActionTypes" formControlName="actions">
    diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index fc996fb2c6..9287b92d57 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -54,7 +54,6 @@ import { import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; -import { WidgetService } from '@core/http/widget.service'; import { UtilsService } from '@core/services/utils.service'; import { forkJoin, Observable, of, ReplaySubject, Subscription, throwError } from 'rxjs'; import { @@ -205,7 +204,6 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, @Inject(EMBED_DASHBOARD_DIALOG_TOKEN) private embedDashboardDialogComponent: ComponentType, @Inject(DASHBOARD_PAGE_COMPONENT_TOKEN) private dashboardPageComponent: ComponentType, @Optional() @Inject(MODULES_MAP) private modulesMap: IModulesMap, - private widgetService: WidgetService, private resources: ResourcesService, private timeService: TimeService, private deviceService: DeviceService, @@ -346,17 +344,17 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.subscriptionContext.widgetUtils = this.widgetContext.utils; this.subscriptionContext.getServerTimeDiff = this.dashboardService.getServerTimeDiff.bind(this.dashboardService); - this.widgetComponentService.getWidgetInfo(this.widget.typeFullFqn).subscribe( - (widgetInfo) => { + this.widgetComponentService.getWidgetInfo(this.widget.typeFullFqn).subscribe({ + next: (widgetInfo) => { this.widgetInfo = widgetInfo; this.loadFromWidgetInfo(); }, - (errorData) => { + error: (errorData) => { this.widgetInfo = errorData.widgetInfo; this.errorMessages = errorData.errorMessages; this.loadFromWidgetInfo(); } - ); + }); const noDataDisplayMessage = this.widget.config.noDataDisplayMessage; if (isNotEmptyStr(noDataDisplayMessage)) { @@ -521,15 +519,15 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.widgetTypeInstance.onDestroy = () => {}; } - this.initialize().subscribe( - () => { + this.initialize().subscribe({ + next: () => { this.onInit(); }, - (err) => { + error: () => { this.widgetContext.inited = true; // console.log(err); } - ); + }); } private detectChanges(detectContainerChanges = false) { @@ -681,8 +679,8 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, private reInitImpl() { this.onDestroy(); if (!this.typeParameters.useCustomDatasources) { - this.createDefaultSubscription().subscribe( - () => { + this.createDefaultSubscription().subscribe({ + next: () => { if (this.destroyed) { this.onDestroy(); } else { @@ -692,7 +690,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.onInit(); } }, - () => { + error: () => { if (this.destroyed) { this.onDestroy(); } else { @@ -701,7 +699,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.onInit(); } } - ); + }); } else { this.widgetContext.reset(); this.subscriptionInited = true; @@ -751,8 +749,8 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } )); if (!this.typeParameters.useCustomDatasources) { - this.createDefaultSubscription().subscribe( - () => { + this.createDefaultSubscription().subscribe({ + next: () => { this.subscriptionInited = true; try { this.configureDynamicWidgetComponent(); @@ -762,11 +760,11 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, initSubject.error(err); } }, - (err) => { + error: (err) => { this.subscriptionInited = true; initSubject.error(err); } - ); + }); } else { this.loadingData = false; this.subscriptionInited = true; @@ -791,7 +789,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } } - private handleWidgetException(e) { + private handleWidgetException(e: any) { console.error(e); this.widgetErrorData = this.utils.processWidgetException(e); this.detectChanges(); @@ -866,8 +864,8 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, const createSubscriptionSubject = new ReplaySubject(); options.dashboardTimewindow = this.widgetContext.dashboardTimewindow; const subscription: IWidgetSubscription = new WidgetSubscription(this.subscriptionContext, options); - subscription.init$.subscribe( - () => { + subscription.init$.subscribe({ + next: () => { this.widgetContext.subscriptions[subscription.id] = subscription; if (subscribe) { subscription.subscribe(); @@ -875,10 +873,10 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, createSubscriptionSubject.next(subscription); createSubscriptionSubject.complete(); }, - (err) => { + error: (err) => { createSubscriptionSubject.error(err); } - ); + }); return createSubscriptionSubject.asObservable(); } @@ -900,15 +898,15 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } else { options.datasources = this.entityService.createDatasourcesFromSubscriptionsInfo(subscriptionsInfo); } - this.createSubscription(options, subscribe).subscribe( - (subscription) => { + this.createSubscription(options, subscribe).subscribe({ + next: (subscription) => { createSubscriptionSubject.next(subscription); createSubscriptionSubject.complete(); }, - (err) => { + error: (err) => { createSubscriptionSubject.error(err); } - ); + }); return createSubscriptionSubject.asObservable(); } @@ -937,7 +935,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.dataUpdatePending = true; } } - } catch (e){} + } catch (e){/**/} }, onLatestDataUpdated: () => { try { @@ -948,15 +946,15 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.latestDataUpdatePending = true; } } - } catch (e){} + } catch (e){/**/} }, - onDataUpdateError: (subscription, e) => { + onDataUpdateError: (_subscription, e) => { this.handleWidgetException(e); }, - onLatestDataUpdateError: (subscription, e) => { + onLatestDataUpdateError: (_subscription, e) => { this.handleWidgetException(e); }, - onSubscriptionMessage: (subscription, message) => { + onSubscriptionMessage: (_subscription, message) => { if (this.displayWidgetInstance()) { if (this.widgetInstanceInited) { this.displayMessage(message.severity, message.message); @@ -965,7 +963,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } } }, - onInitialPageDataChanged: (subscription, nextPageData) => { + onInitialPageDataChanged: (_subscription, _nextPageData) => { this.reInit(); }, forceReInit: () => { @@ -977,12 +975,12 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.detectChanges(); } }, - legendDataUpdated: (subscription, detectChanges) => { + legendDataUpdated: (_subscription, detectChanges) => { if (detectChanges) { this.detectChanges(); } }, - timeWindowUpdated: (subscription, timeWindowConfig) => { + timeWindowUpdated: (_subscription, timeWindowConfig) => { this.ngZone.run(() => { this.widget.config.timewindow = timeWindowConfig; this.detectChanges(true); @@ -1017,8 +1015,8 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.defaultComponentsOptions(options); - this.createSubscription(options).subscribe( - (subscription) => { + this.createSubscription(options).subscribe({ + next: (subscription) => { // backward compatibility this.widgetContext.datasources = subscription.datasources; @@ -1032,12 +1030,12 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, createSubscriptionSubject.complete(); }); }, - (err) => { + error: (err) => { this.ngZone.run(() => { createSubscriptionSubject.error(err); }); } - ); + }); } else if (this.widget.type === widgetType.rpc) { this.loadingData = false; options = { @@ -1074,7 +1072,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, this.detectChanges(); } }, - onRpcErrorCleared: (subscription) => { + onRpcErrorCleared: (_subscription) => { if (this.dynamicWidgetComponent) { this.dynamicWidgetComponent.rpcErrorText = null; this.dynamicWidgetComponent.rpcRejection = null; @@ -1085,20 +1083,20 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } } }; - this.createSubscription(options).subscribe( - (subscription) => { + this.createSubscription(options).subscribe({ + next: (subscription) => { this.widgetContext.defaultSubscription = subscription; this.ngZone.run(() => { createSubscriptionSubject.next(); createSubscriptionSubject.complete(); }); }, - (err) => { + error: (err) => { this.ngZone.run(() => { createSubscriptionSubject.error(err); }); } - ); + }); this.detectChanges(); } else if (this.widget.type === widgetType.static) { this.loadingData = false; @@ -1159,7 +1157,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } const state = objToBase64URI([ stateObject ]); const isSinglePage = this.route.snapshot.data.singlePageMode; - let url; + let url: string; if (isSinglePage) { url = `/dashboard/${targetDashboardId}?state=${state}`; } else { @@ -1168,7 +1166,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, if (descriptor.openNewBrowserTab) { window.open(url, '_blank'); } else { - this.router.navigateByUrl(url); + this.router.navigateByUrl(url).then(() => {}); } break; case WidgetActionType.openURL: @@ -1467,7 +1465,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, popoverWidth = '25vw', popoverHeight = '25vh', popoverStyle: { [klass: string]: any } = {}) { - const trigger = ($event.target || $event.srcElement || $event.currentTarget) as Element; + const trigger = ($event.target || $event.currentTarget) as Element; if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { @@ -1560,7 +1558,7 @@ export class WidgetComponent extends PageComponent implements OnInit, OnChanges, } private elementClick($event: Event) { - const elementClicked = ($event.target || $event.srcElement) as Element; + const elementClicked = ($event.target) as Element; const descriptors = this.getActionDescriptors('elementClick'); if (descriptors.length) { const idsList = descriptors.map(descriptor => `#${descriptor.name}`).join(','); diff --git a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts index 1ad4dab88c..1e1f831c4f 100644 --- a/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts +++ b/ui-ngx/src/app/shared/components/time/timewindow-config-dialog.component.ts @@ -554,7 +554,7 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On if ($event) { $event.stopPropagation(); } - const trigger = ($event.target || $event.srcElement || $event.currentTarget) as Element; + const trigger = ($event.target || $event.currentTarget) as Element; if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { @@ -614,7 +614,7 @@ export class TimewindowConfigDialogComponent extends PageComponent implements On if ($event) { $event.stopPropagation(); } - const trigger = ($event.target || $event.srcElement || $event.currentTarget) as Element; + const trigger = ($event.target || $event.currentTarget) as Element; if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { diff --git a/ui-ngx/src/app/shared/components/time/timezone.component.ts b/ui-ngx/src/app/shared/components/time/timezone.component.ts index 34e2486106..19affc2aab 100644 --- a/ui-ngx/src/app/shared/components/time/timezone.component.ts +++ b/ui-ngx/src/app/shared/components/time/timezone.component.ts @@ -151,7 +151,7 @@ export class TimezoneComponent implements ControlValueAccessor, OnInit { if (this.disablePanel) { return; } - const trigger = ($event.target || $event.srcElement || $event.currentTarget) as Element; + const trigger = ($event.target || $event.currentTarget) as Element; if (this.popoverService.hasPopover(trigger)) { this.popoverService.hidePopover(trigger); } else { From b128650ef9415730cc55c527114df90494142fd5 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 9 Apr 2025 11:01:28 +0300 Subject: [PATCH 210/286] UI: Updated shape image fill image function example. Improved this example popover style --- ...marker-image-settings-panel.component.html | 3 ++- ...e-fill-image-settings-panel.component.html | 3 ++- .../widget/lib/map/shape_fill_image_fn.md | 25 +++++++++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.html index ff06899a8b..d889f96ee7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/marker-image-settings-panel.component.html @@ -46,7 +46,8 @@ [functionArgs]="['data', 'images', 'dsData']" [globalVariables]="functionScopeVariables" functionTitle="{{ 'widgets.maps.data-layer.marker.marker-image-function' | translate }}" - helpId="widget/lib/map/marker_image_fn"> + helpId="widget/lib/map/marker_image_fn" + [helpPopupStyle]="{width: '900px'}"> diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html index 19c83d1270..660f43a75d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html @@ -58,7 +58,8 @@ [functionArgs]="['data', 'images', 'dsData']" [globalVariables]="functionScopeVariables" functionTitle="{{ 'widgets.maps.data-layer.shape.fill-image-function' | translate }}" - helpId="widget/lib/map/shape_fill_image_fn"> + helpId="widget/lib/map/shape_fill_image_fn" + [helpPopupStyle]="{width: '900px'}"> diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md index b13d612c8e..c6ea2e1ae6 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md @@ -39,12 +39,33 @@ In case no data is returned, default fill image will be used.
    • -TODO: +Calculate image URL and rotation angle depending on windSpeed and windDirection telemetry values for a weather station device type.
      +Let's assume 3 images are defined in the Shape fill images section. Each image corresponds to a particular wind speed level: low (e.g., <5 m/s), medium (e.g., 5-15 m/s), and high (e.g., >15 m/s).
    ```javascript -TODO: +const type = data.Type; +if (type === 'weather station') { + const result = { + url: images[0], + opacity: 0.8, + angle: 0 + }; + const windSpeed = data.windSpeed; + const windDirection = data.windDirection; + if (typeof windSpeed !== 'undefined' && typeof windDirection !== 'undefined') { + if (windSpeed < 5) { + result.url = images[0]; + } else if (windSpeed < 15) { + result.url = images[1]; + } else { + result.url = images[2]; + } + result.angle = windDirection; + } + return result; +} {:copy-code} ``` From 19b18a596f2279e81e36ff998560d0309bd538d1 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 9 Apr 2025 11:07:02 +0300 Subject: [PATCH 211/286] Changed back icons to helps --- .../rule-node/action/math-function-config.component.html | 2 +- .../rule-node/common/arguments-map-config.component.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html b/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html index 3b91c56acf..3147162f06 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/action/math-function-config.component.html @@ -79,7 +79,7 @@ info + matTooltip="{{ 'rule-node-config.math-templatization-tooltip' | translate }}">help rule-node-config.key-field-input-required diff --git a/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html b/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html index aa61beb32a..b98854d0e5 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html +++ b/ui-ngx/src/app/modules/home/components/rule-node/common/arguments-map-config.component.html @@ -67,7 +67,7 @@ - info + help rule-node-config.argument-key-field-input-required From d72de7e1751f6c6038ebcdf4910108e17b191e05 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 9 Apr 2025 11:37:21 +0300 Subject: [PATCH 212/286] UI: Fixed customer home dashboard not correct work active/inactive device link --- ui-ngx/src/assets/dashboard/customer_user_home_page.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/assets/dashboard/customer_user_home_page.json b/ui-ngx/src/assets/dashboard/customer_user_home_page.json index 6e381a9ab2..17d7262f23 100644 --- a/ui-ngx/src/assets/dashboard/customer_user_home_page.json +++ b/ui-ngx/src/assets/dashboard/customer_user_home_page.json @@ -193,7 +193,7 @@ "padding": "16px", "settings": { "useMarkdownTextFunction": false, - "markdownTextPattern": "", + "markdownTextPattern": "", "applyDefaultMarkdownStyle": false, "markdownCss": ".tb-card-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: row;\n}\n\n.tb-content-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n gap: 12px;\n}\n\n.tb-card-header {\n height: 36px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n.tb-item-cards {\n flex: 1;\n display: flex;\n flex-direction: row;\n gap: 12px;\n}\n\na.tb-item-card {\n flex: 1;\n display: flex;\n flex-direction: column;\n padding: 8px 12px;\n border: 1px solid;\n border-radius: 10px;\n margin-bottom: 12px;\n}\n\na.tb-item-card.tb-inactive {\n background: rgba(209, 39, 48, 0.04);\n border-color: rgba(209, 39, 48, 0.06);\n}\n\na.tb-item-card.tb-active {\n background: rgba(48, 86, 128, 0.04);\n border-color: rgba(48, 86, 128, 0.12);\n}\n\na.tb-item-card.tb-total {\n background: rgba(0, 0, 0, 0.01);\n border-color: rgba(0, 0, 0, 0.05);\n}\n\n.tb-item-title-container {\n display: grid;\n}\n\n.tb-item-title {\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n letter-spacing: 0.2px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis; \n color: rgba(0, 0, 0, 0.76);\n}\n\n.tb-item-title.tb-home-widget-link:after {\n position: absolute;\n right: 0;\n}\n\na.tb-item-card:hover .tb-item-title.tb-home-widget-link:after { \n color: rgba(0, 0, 0, 0.38);\n}\n\na.tb-item-card:hover {\n box-shadow: 0px 4px 10px rgba(23, 33, 90, 0.08);\n}\n\n.tb-count-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n}\n\n.tb-count {\n font-style: normal;\n font-weight: 500;\n font-size: 24px;\n line-height: 36px;\n white-space: nowrap;\n color: rgba(0, 0, 0, 0.87);\n}\n\n@media screen and (max-width: 959px) {\n .tb-item-cards {\n flex-direction: column;\n }\n a.tb-item-card {\n margin-bottom: 0;\n }\n}\n\n@media screen and (max-width: 1279px) {\n a.tb-item-card {\n flex-direction: row;\n align-items: center;\n }\n .tb-item-title.tb-home-widget-link:after {\n position: relative;\n }\n .tb-count-container {\n align-items: flex-end;\n }\n}\n\n@media screen and (min-width: 960px) and (max-width: 1819px) {\n .tb-item-title {\n font-size: 11px;\n line-height: 16px;\n }\n .tb-count {\n font-size: 16px;\n line-height: 24px;\n }\n a.tb-item-card {\n padding: 4px 8px;\n margin-bottom: 6px;\n }\n a.tb-item-card:hover {\n box-shadow: 0px 2px 5px rgba(23, 33, 90, 0.08);\n }\n}\n" }, From 79381092b2a4acfb8fef8a8244eb87b76433edcc Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 9 Apr 2025 12:07:50 +0300 Subject: [PATCH 213/286] Do not push edge notifications in case edges disabled. Check if edges enabled before processing msg by edge consumer --- .../queue/DefaultTbClusterService.java | 14 ++++++++----- .../queue/DefaultTbEdgeConsumerService.java | 21 ++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java index 92c48a5fed..561dc7122a 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java @@ -551,11 +551,15 @@ public class DefaultTbClusterService implements TbClusterService { } private void processEdgeNotification(EdgeId edgeId, ToEdgeNotificationMsg toEdgeNotificationMsg) { - var serviceIdOpt = Optional.ofNullable(edgeIdServiceIdCache.get(edgeId)); - serviceIdOpt.ifPresentOrElse( - serviceId -> pushMsgToEdgeNotification(toEdgeNotificationMsg, serviceId.get()), - () -> broadcastEdgeNotification(edgeId, toEdgeNotificationMsg) - ); + if (edgesEnabled) { + var serviceIdOpt = Optional.ofNullable(edgeIdServiceIdCache.get(edgeId)); + serviceIdOpt.ifPresentOrElse( + serviceId -> pushMsgToEdgeNotification(toEdgeNotificationMsg, serviceId.get()), + () -> broadcastEdgeNotification(edgeId, toEdgeNotificationMsg) + ); + } else { + log.trace("Edges disabled. Ignoring edge notification {} for edgeId: {}", toEdgeNotificationMsg, edgeId); + } } private void pushMsgToEdgeNotification(ToEdgeNotificationMsg toEdgeNotificationMsg, String serviceId) { diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java index fdaa2103e2..2e4c15f8e8 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java @@ -51,6 +51,7 @@ import org.thingsboard.server.queue.provider.TbCoreQueueFactory; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeContextComponent; import org.thingsboard.server.queue.common.consumer.MainQueueConsumerManager; +import org.thingsboard.server.service.edge.rpc.EdgeRpcService; import org.thingsboard.server.service.queue.processing.AbstractConsumerService; import org.thingsboard.server.service.queue.processing.IdMsgPair; @@ -195,36 +196,42 @@ public class DefaultTbEdgeConsumerService extends AbstractConsumerService msg, TbCallback callback) { ToEdgeNotificationMsg toEdgeNotificationMsg = msg.getValue(); try { + EdgeRpcService edgeRpcService = edgeCtx.getEdgeRpcService(); + if (edgeRpcService == null) { + log.debug("No EdgeRpcService available (edge functionality disabled), ignoring msg: {}", toEdgeNotificationMsg); + callback.onSuccess(); + return; + } if (toEdgeNotificationMsg.hasEdgeHighPriority()) { EdgeSessionMsg edgeSessionMsg = ProtoUtils.fromProto(toEdgeNotificationMsg.getEdgeHighPriority()); - edgeCtx.getEdgeRpcService().onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); + edgeRpcService.onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); callback.onSuccess(); } else if (toEdgeNotificationMsg.hasEdgeEventUpdate()) { EdgeSessionMsg edgeSessionMsg = ProtoUtils.fromProto(toEdgeNotificationMsg.getEdgeEventUpdate()); - edgeCtx.getEdgeRpcService().onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); + edgeRpcService.onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); callback.onSuccess(); } else if (toEdgeNotificationMsg.hasToEdgeSyncRequest()) { EdgeSessionMsg edgeSessionMsg = ProtoUtils.fromProto(toEdgeNotificationMsg.getToEdgeSyncRequest()); - edgeCtx.getEdgeRpcService().onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); + edgeRpcService.onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); callback.onSuccess(); } else if (toEdgeNotificationMsg.hasFromEdgeSyncResponse()) { EdgeSessionMsg edgeSessionMsg = ProtoUtils.fromProto(toEdgeNotificationMsg.getFromEdgeSyncResponse()); - edgeCtx.getEdgeRpcService().onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); + edgeRpcService.onToEdgeSessionMsg(edgeSessionMsg.getTenantId(), edgeSessionMsg); callback.onSuccess(); } else if (toEdgeNotificationMsg.hasComponentLifecycle()) { ComponentLifecycleMsg componentLifecycle = ProtoUtils.fromProto(toEdgeNotificationMsg.getComponentLifecycle()); TenantId tenantId = componentLifecycle.getTenantId(); EdgeId edgeId = new EdgeId(componentLifecycle.getEntityId().getId()); if (ComponentLifecycleEvent.DELETED.equals(componentLifecycle.getEvent())) { - edgeCtx.getEdgeRpcService().deleteEdge(tenantId, edgeId); + edgeRpcService.deleteEdge(tenantId, edgeId); } else if (ComponentLifecycleEvent.UPDATED.equals(componentLifecycle.getEvent())) { Edge edge = edgeCtx.getEdgeService().findEdgeById(tenantId, edgeId); - edgeCtx.getEdgeRpcService().updateEdge(tenantId, edge); + edgeRpcService.updateEdge(tenantId, edge); } callback.onSuccess(); } } catch (Exception e) { - log.error("Error processing edge notification message", e); + log.error("Error processing edge notification message {}", toEdgeNotificationMsg, e); callback.onFailure(e); } From 33fd8af17e6ac3aeb13ff24a3d97c12a81d7bead Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 9 Apr 2025 12:29:35 +0300 Subject: [PATCH 214/286] Add EDQS query stats; improvements --- .../src/main/resources/thingsboard.yml | 2 + .../server/common/data/JavaSerDesUtil.java | 4 +- .../edqs/repo/DefaultEdqsRepository.java | 5 +- .../server/edqs/repo/TenantRepo.java | 23 +++-- .../edqs/stats/DefaultEdqsStatsService.java | 94 +++++++++++++++++++ .../server/edqs/stats/EdqsStatsService.java | 81 ---------------- .../common/stats/DummyEdqsStatsService.java | 41 ++++++++ .../server/common/stats/EdqsStatsService.java | 33 +++++++ .../server/common/stats/StatsTimer.java | 12 ++- .../server/dao/entity/BaseEntityService.java | 48 ++++++---- 10 files changed, 224 insertions(+), 119 deletions(-) create mode 100644 common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java delete mode 100644 common/edqs/src/main/java/org/thingsboard/server/edqs/stats/EdqsStatsService.java create mode 100644 common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java create mode 100644 common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 37f2bcd5a7..d8a22e478d 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1768,6 +1768,8 @@ queue: stats: # Enable/disable statistics for EDQS enabled: "${TB_EDQS_STATS_ENABLED:true}" + # Threshold for slow queries to log, in milliseconds + slow_query_threshold: "${TB_EDQS_SLOW_QUERY_THRESHOLD_MS:3000}" vc: # Default topic name topic: "${TB_QUEUE_VC_TOPIC:tb_version_control}" diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/JavaSerDesUtil.java b/common/data/src/main/java/org/thingsboard/server/common/data/JavaSerDesUtil.java index e14e2d5fa1..55a0cd90aa 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/JavaSerDesUtil.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/JavaSerDesUtil.java @@ -36,7 +36,7 @@ public class JavaSerDesUtil { try (ObjectInputStream ois = new ObjectInputStream(is)) { return (T) ois.readObject(); } catch (IOException | ClassNotFoundException e) { - log.error("Error during deserialization message, [{}]", e.getMessage()); + log.error("Error during deserialization", e); return null; } } @@ -50,7 +50,7 @@ public class JavaSerDesUtil { ois.writeObject(msq); return boas.toByteArray(); } catch (IOException e) { - log.error("Error during serialization message, [{}]", e.getMessage()); + log.error("Error during serialization", e); throw new RuntimeException(e); } } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java index 1deaca83a7..d8be25a206 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java @@ -27,10 +27,9 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.query.EntityCountQuery; import org.thingsboard.server.common.data.query.EntityDataQuery; -import org.thingsboard.server.edqs.stats.EdqsStatsService; +import org.thingsboard.server.edqs.stats.DefaultEdqsStatsService; import org.thingsboard.server.queue.edqs.EdqsComponent; -import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.Predicate; @@ -42,7 +41,7 @@ import java.util.function.Predicate; public class DefaultEdqsRepository implements EdqsRepository { private final static ConcurrentMap repos = new ConcurrentHashMap<>(); - private final Optional statsService; + private final DefaultEdqsStatsService statsService; public TenantRepo get(TenantId tenantId) { return repos.computeIfAbsent(tenantId, id -> new TenantRepo(id, statsService)); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index 5fdc820ecc..a47559d6d8 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -40,6 +40,7 @@ import org.thingsboard.server.common.data.query.EntityKeyType; import org.thingsboard.server.common.data.query.TsValue; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.RelationTypeGroup; +import org.thingsboard.server.common.stats.EdqsStatsService; import org.thingsboard.server.edqs.data.ApiUsageStateData; import org.thingsboard.server.edqs.data.AssetData; import org.thingsboard.server.edqs.data.CustomerData; @@ -54,7 +55,6 @@ import org.thingsboard.server.edqs.query.EdqsQuery; import org.thingsboard.server.edqs.query.SortableEntityData; import org.thingsboard.server.edqs.query.processor.EntityQueryProcessor; import org.thingsboard.server.edqs.query.processor.EntityQueryProcessorFactory; -import org.thingsboard.server.edqs.stats.EdqsStatsService; import org.thingsboard.server.edqs.util.RepositoryUtils; import java.util.ArrayList; @@ -63,7 +63,6 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.TreeSet; import java.util.UUID; @@ -94,9 +93,9 @@ public class TenantRepo { private final Lock entityUpdateLock = new ReentrantLock(); private final TenantId tenantId; - private final Optional edqsStatsService; + private final EdqsStatsService edqsStatsService; - public TenantRepo(TenantId tenantId, Optional edqsStatsService) { + public TenantRepo(TenantId tenantId, EdqsStatsService edqsStatsService) { this.tenantId = tenantId; this.edqsStatsService = edqsStatsService; } @@ -144,7 +143,7 @@ public class TenantRepo { EntityData to = getOrCreate(entity.getTo()); boolean added = repo.add(from, to, entity.getType()); if (added) { - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.RELATION, EdqsEventType.UPDATED)); + edqsStatsService.reportAdded(ObjectType.RELATION); } } else if (RelationTypeGroup.DASHBOARD.equals(entity.getTypeGroup())) { if (EntityRelation.CONTAINS_TYPE.equals(entity.getType()) && entity.getFrom().getEntityType() == EntityType.CUSTOMER) { @@ -164,7 +163,7 @@ public class TenantRepo { if (relationsRepo != null) { boolean removed = relationsRepo.remove(entityRelation.getFrom().getId(), entityRelation.getTo().getId(), entityRelation.getType()); if (removed) { - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.RELATION, EdqsEventType.DELETED)); + edqsStatsService.reportRemoved(ObjectType.RELATION); } } } else if (RelationTypeGroup.DASHBOARD.equals(entityRelation.getTypeGroup())) { @@ -222,7 +221,7 @@ public class TenantRepo { if (removed.getFields() != null) { getEntitySet(entityType).remove(removed); } - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.fromEntityType(entityType), EdqsEventType.DELETED)); + edqsStatsService.reportRemoved(entity.type()); UUID customerId = removed.getCustomerId(); if (customerId != null) { @@ -243,7 +242,7 @@ public class TenantRepo { Integer keyId = KeyDictionary.get(attributeKv.getKey()); boolean added = entityData.putAttr(keyId, attributeKv.getScope(), attributeKv.getDataPoint()); if (added) { - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.ATTRIBUTE_KV, EdqsEventType.UPDATED)); + edqsStatsService.reportAdded(ObjectType.ATTRIBUTE_KV); } } } @@ -253,7 +252,7 @@ public class TenantRepo { if (entityData != null) { boolean removed = entityData.removeAttr(KeyDictionary.get(attributeKv.getKey()), attributeKv.getScope()); if (removed) { - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.ATTRIBUTE_KV, EdqsEventType.DELETED)); + edqsStatsService.reportRemoved(ObjectType.ATTRIBUTE_KV); } } } @@ -264,7 +263,7 @@ public class TenantRepo { Integer keyId = KeyDictionary.get(latestTsKv.getKey()); boolean added = entityData.putTs(keyId, latestTsKv.getDataPoint()); if (added) { - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.LATEST_TS_KV, EdqsEventType.UPDATED)); + edqsStatsService.reportAdded(ObjectType.LATEST_TS_KV); } } } @@ -274,7 +273,7 @@ public class TenantRepo { if (entityData != null) { boolean removed = entityData.removeTs(KeyDictionary.get(latestTsKv.getKey())); if (removed) { - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.LATEST_TS_KV, EdqsEventType.DELETED)); + edqsStatsService.reportRemoved(ObjectType.LATEST_TS_KV); } } } @@ -292,7 +291,7 @@ public class TenantRepo { return getEntityMap(entityType).computeIfAbsent(entityId, id -> { log.debug("[{}] Adding {} {}", tenantId, entityType, id); EntityData entityData = constructEntityData(entityType, entityId); - edqsStatsService.ifPresent(statService -> statService.reportEvent(tenantId, ObjectType.fromEntityType(entityType), EdqsEventType.UPDATED)); + edqsStatsService.reportAdded(ObjectType.fromEntityType(entityType)); return entityData; }); } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java new file mode 100644 index 0000000000..f490f25de3 --- /dev/null +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java @@ -0,0 +1,94 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.edqs.stats; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.ObjectType; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.query.EntityCountQuery; +import org.thingsboard.server.common.data.query.EntityDataQuery; +import org.thingsboard.server.common.stats.EdqsStatsService; +import org.thingsboard.server.common.stats.StatsFactory; +import org.thingsboard.server.common.stats.StatsTimer; +import org.thingsboard.server.common.stats.StatsType; +import org.thingsboard.server.queue.edqs.EdqsComponent; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +@EdqsComponent +@Service +@Slf4j +@ConditionalOnProperty(name = "queue.edqs.stats.enabled", havingValue = "true", matchIfMissing = true) +public class DefaultEdqsStatsService implements EdqsStatsService { + + private final StatsFactory statsFactory; + + @Value("${queue.edqs.stats.slow_query_threshold:3000}") + private int slowQueryThreshold; + + private final ConcurrentHashMap objectCounters = new ConcurrentHashMap<>(); + private final StatsTimer dataQueryTimer; + private final StatsTimer countQueryTimer; + + private DefaultEdqsStatsService(StatsFactory statsFactory) { + this.statsFactory = statsFactory; + dataQueryTimer = statsFactory.createTimer(StatsType.EDQS, "entityDataQueryTimer"); + countQueryTimer = statsFactory.createTimer(StatsType.EDQS, "entityCountQueryTimer"); + } + + @Override + public void reportAdded(ObjectType objectType) { + getObjectCounter(objectType).incrementAndGet(); + } + + @Override + public void reportRemoved(ObjectType objectType) { + getObjectCounter(objectType).decrementAndGet(); + } + + @Override + public void reportDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) { + double timingMs = timingNanos / 1000_000.0; + if (timingMs < slowQueryThreshold) { + log.info("[{}] Executed data query in {} ms: {}", tenantId, timingMs, query); + } else { + log.warn("[{}] Executed slow data query in {} ms: {}", tenantId, timingMs, query); + } + dataQueryTimer.record(timingNanos, TimeUnit.NANOSECONDS); + } + + @Override + public void reportCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) { + double timingMs = timingNanos / 1000_000.0; + if (timingMs < slowQueryThreshold) { + log.info("[{}] Executed count query in {} ms: {}", tenantId, timingMs, query); + } else { + log.warn("[{}] Executed slow count query in {} ms: {}", tenantId, timingMs, query); + } + countQueryTimer.record(timingNanos, TimeUnit.NANOSECONDS); + } + + private AtomicInteger getObjectCounter(ObjectType objectType) { + return objectCounters.computeIfAbsent(objectType, type -> + statsFactory.createGauge("edqsObjectsCount", new AtomicInteger(), "objectType", type.name())); + } + +} diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/EdqsStatsService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/EdqsStatsService.java deleted file mode 100644 index 442453fc93..0000000000 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/EdqsStatsService.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright © 2016-2025 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.edqs.stats; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.stereotype.Service; -import org.thingsboard.server.common.data.ObjectType; -import org.thingsboard.server.common.data.edqs.EdqsEventType; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.stats.StatsFactory; -import org.thingsboard.server.common.stats.StatsType; -import org.thingsboard.server.queue.edqs.EdqsComponent; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -@EdqsComponent -@Service -@Slf4j -@RequiredArgsConstructor -@ConditionalOnProperty(name = "queue.edqs.stats.enabled", havingValue = "true", matchIfMissing = true) -public class EdqsStatsService { - - private final ConcurrentHashMap statsMap = new ConcurrentHashMap<>(); - private final StatsFactory statsFactory; - - public void reportEvent(TenantId tenantId, ObjectType objectType, EdqsEventType eventType) { - statsMap.computeIfAbsent(tenantId, id -> new EdqsStats(tenantId, statsFactory)) - .reportEvent(objectType, eventType); - } - - @Getter - @AllArgsConstructor - static class EdqsStats { - - private final TenantId tenantId; - private final ConcurrentHashMap entityCounters = new ConcurrentHashMap<>(); - private final StatsFactory statsFactory; - - private AtomicInteger getOrCreateObjectCounter(ObjectType objectType) { - return entityCounters.computeIfAbsent(objectType, - type -> statsFactory.createGauge(StatsType.EDQS.getName() + "_object_count", new AtomicInteger(), - "tenantId", tenantId.toString(), "objectType", type.name())); - } - - @Override - public String toString() { - return entityCounters.entrySet().stream() - .map(counters -> counters.getKey().name()+ " total = [" + counters.getValue() + "]") - .collect(Collectors.joining(", ")); - } - - public void reportEvent(ObjectType objectType, EdqsEventType eventType) { - AtomicInteger objectCounter = getOrCreateObjectCounter(objectType); - if (eventType == EdqsEventType.UPDATED){ - objectCounter.incrementAndGet(); - } else if (eventType == EdqsEventType.DELETED) { - objectCounter.decrementAndGet(); - } - } - } - -} diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java new file mode 100644 index 0000000000..df78e5fc89 --- /dev/null +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java @@ -0,0 +1,41 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.stats; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.ObjectType; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.query.EntityCountQuery; +import org.thingsboard.server.common.data.query.EntityDataQuery; + +@Service +@ConditionalOnMissingBean(value = EdqsStatsService.class, ignored = DummyEdqsStatsService.class) +public class DummyEdqsStatsService implements EdqsStatsService { + + @Override + public void reportAdded(ObjectType objectType) {} + + @Override + public void reportRemoved(ObjectType objectType) {} + + @Override + public void reportDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) {} + + @Override + public void reportCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) {} + +} diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java new file mode 100644 index 0000000000..106e43e913 --- /dev/null +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java @@ -0,0 +1,33 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.stats; + +import org.thingsboard.server.common.data.ObjectType; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.query.EntityCountQuery; +import org.thingsboard.server.common.data.query.EntityDataQuery; + +public interface EdqsStatsService { + + void reportAdded(ObjectType objectType); + + void reportRemoved(ObjectType objectType); + + void reportDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos); + + void reportCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos); + +} diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsTimer.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsTimer.java index 89f33ac922..b9f3533b92 100644 --- a/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsTimer.java +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsTimer.java @@ -34,10 +34,14 @@ public class StatsTimer { this.timer = micrometerTimer; } - public void record(long timeMs) { + public void record(long timeMs) { + record(timeMs, TimeUnit.MILLISECONDS); + } + + public void record(long timing, TimeUnit timeUnit) { count++; - totalTime += timeMs; - timer.record(timeMs, TimeUnit.MILLISECONDS); + totalTime += timeUnit.toMillis(timing); + timer.record(timing, timeUnit); } public double getAvg() { @@ -47,7 +51,7 @@ public class StatsTimer { return (double) totalTime / count; } - public void reset() { + public void reset() { count = 0; totalTime = 0; } diff --git a/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java b/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java index a762aabf38..4df33779ee 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java @@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.thingsboard.common.util.TbStopWatch; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.HasCustomerId; import org.thingsboard.server.common.data.HasEmail; @@ -46,6 +47,7 @@ import org.thingsboard.server.common.data.query.EntityTypeFilter; import org.thingsboard.server.common.data.query.KeyFilter; import org.thingsboard.server.common.data.query.RelationsQueryFilter; import org.thingsboard.server.common.msg.edqs.EdqsApiService; +import org.thingsboard.server.common.stats.EdqsStatsService; import org.thingsboard.server.dao.exception.IncorrectParameterException; import java.util.ArrayList; @@ -89,6 +91,9 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe @Lazy private EdqsApiService edqsApiService; + @Autowired + private EdqsStatsService edqsStatsService; + @Override public long countEntitiesByQuery(TenantId tenantId, CustomerId customerId, EntityCountQuery query) { log.trace("Executing countEntitiesByQuery, tenantId [{}], customerId [{}], query [{}]", tenantId, customerId, query); @@ -96,14 +101,19 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe validateId(customerId, id -> INCORRECT_CUSTOMER_ID + id); validateEntityCountQuery(query); + TbStopWatch stopWatch = TbStopWatch.create(); + Long result; if (edqsApiService.isEnabled() && validForEdqs(query) && !tenantId.isSysTenantId()) { EdqsRequest request = EdqsRequest.builder() .entityCountQuery(query) .build(); EdqsResponse response = processEdqsRequest(tenantId, customerId, request); - return response.getEntityCountQueryResult(); + result = response.getEntityCountQueryResult(); + } else { + result = entityQueryDao.countEntitiesByQuery(tenantId, customerId, query); } - return this.entityQueryDao.countEntitiesByQuery(tenantId, customerId, query); + edqsStatsService.reportCountQuery(tenantId, query, stopWatch.stopAndGetTotalTimeNanos()); + return result; } @Override @@ -113,27 +123,31 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe validateId(customerId, id -> INCORRECT_CUSTOMER_ID + id); validateEntityDataQuery(query); + TbStopWatch stopWatch = TbStopWatch.create(); + PageData result; if (edqsApiService.isEnabled() && validForEdqs(query)) { EdqsRequest request = EdqsRequest.builder() .entityDataQuery(query) .build(); EdqsResponse response = processEdqsRequest(tenantId, customerId, request); - return response.getEntityDataQueryResult(); - } - - if (!isValidForOptimization(query)) { - return this.entityQueryDao.findEntityDataByQuery(tenantId, customerId, query); - } - - // 1 step - find entity data by filter and sort columns - PageData entityDataByQuery = findEntityIdsByFilterAndSorterColumns(tenantId, customerId, query); - if (entityDataByQuery == null || entityDataByQuery.getData().isEmpty()) { - return entityDataByQuery; + result = response.getEntityDataQueryResult(); + } else { + if (!isValidForOptimization(query)) { + result = entityQueryDao.findEntityDataByQuery(tenantId, customerId, query); + } else { + // 1 step - find entity data by filter and sort columns + PageData entityDataByQuery = findEntityIdsByFilterAndSorterColumns(tenantId, customerId, query); + if (entityDataByQuery == null || entityDataByQuery.getData().isEmpty()) { + result = entityDataByQuery; + } else { + // 2 step - find entity data by entity ids from the 1st step + List entities = fetchEntityDataByIdsFromInitialQuery(tenantId, customerId, query, entityDataByQuery.getData()); + result = new PageData<>(entities, entityDataByQuery.getTotalPages(), entityDataByQuery.getTotalElements(), entityDataByQuery.hasNext()); + } + } } - - // 2 step - find entity data by entity ids from the 1st step - List result = fetchEntityDataByIdsFromInitialQuery(tenantId, customerId, query, entityDataByQuery.getData()); - return new PageData<>(result, entityDataByQuery.getTotalPages(), entityDataByQuery.getTotalElements(), entityDataByQuery.hasNext()); + edqsStatsService.reportDataQuery(tenantId, query, stopWatch.stopAndGetTotalTimeNanos()); + return result; } private boolean validForEdqs(EntityCountQuery query) { // for compatibility with PE From e967a994309dd38d864629983aadeffa6755fbfe Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 9 Apr 2025 12:36:28 +0300 Subject: [PATCH 215/286] Change log levels in DefaultEdqsStatsService --- .../server/edqs/stats/DefaultEdqsStatsService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java index f490f25de3..7769d2bfb8 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java @@ -68,7 +68,7 @@ public class DefaultEdqsStatsService implements EdqsStatsService { public void reportDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) { double timingMs = timingNanos / 1000_000.0; if (timingMs < slowQueryThreshold) { - log.info("[{}] Executed data query in {} ms: {}", tenantId, timingMs, query); + log.debug("[{}] Executed data query in {} ms: {}", tenantId, timingMs, query); } else { log.warn("[{}] Executed slow data query in {} ms: {}", tenantId, timingMs, query); } @@ -79,7 +79,7 @@ public class DefaultEdqsStatsService implements EdqsStatsService { public void reportCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) { double timingMs = timingNanos / 1000_000.0; if (timingMs < slowQueryThreshold) { - log.info("[{}] Executed count query in {} ms: {}", tenantId, timingMs, query); + log.debug("[{}] Executed count query in {} ms: {}", tenantId, timingMs, query); } else { log.warn("[{}] Executed slow count query in {} ms: {}", tenantId, timingMs, query); } From a91d9faad9eb1c9a00ec02b0d842f06140d2acfc Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 9 Apr 2025 12:43:35 +0300 Subject: [PATCH 216/286] Fix EDQS tests init --- .../thingsboard/server/edqs/repo/DefaultEdqsRepository.java | 4 ++-- .../org/thingsboard/server/edqs/repo/AbstractEDQTest.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java index d8be25a206..215c64194f 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java @@ -27,7 +27,7 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.query.EntityCountQuery; import org.thingsboard.server.common.data.query.EntityDataQuery; -import org.thingsboard.server.edqs.stats.DefaultEdqsStatsService; +import org.thingsboard.server.common.stats.EdqsStatsService; import org.thingsboard.server.queue.edqs.EdqsComponent; import java.util.concurrent.ConcurrentHashMap; @@ -41,7 +41,7 @@ import java.util.function.Predicate; public class DefaultEdqsRepository implements EdqsRepository { private final static ConcurrentMap repos = new ConcurrentHashMap<>(); - private final DefaultEdqsStatsService statsService; + private final EdqsStatsService statsService; public TenantRepo get(TenantId tenantId) { return repos.computeIfAbsent(tenantId, id -> new TenantRepo(id, statsService)); diff --git a/edqs/src/test/java/org/thingsboard/server/edqs/repo/AbstractEDQTest.java b/edqs/src/test/java/org/thingsboard/server/edqs/repo/AbstractEDQTest.java index 01a7495148..330d22a3c6 100644 --- a/edqs/src/test/java/org/thingsboard/server/edqs/repo/AbstractEDQTest.java +++ b/edqs/src/test/java/org/thingsboard/server/edqs/repo/AbstractEDQTest.java @@ -20,6 +20,7 @@ import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.TestExecutionListeners; @@ -58,6 +59,7 @@ import org.thingsboard.server.common.data.query.KeyFilter; import org.thingsboard.server.common.data.query.StringFilterPredicate; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.RelationTypeGroup; +import org.thingsboard.server.common.stats.DummyEdqsStatsService; import org.thingsboard.server.edqs.util.EdqsConverter; import java.util.Collections; @@ -78,6 +80,8 @@ public abstract class AbstractEDQTest { protected DefaultEdqsRepository repository; @Autowired protected EdqsConverter edqsConverter; + @MockBean + private DummyEdqsStatsService edqsStatsService; protected final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID()); protected final CustomerId customerId = new CustomerId(UUID.randomUUID()); From 4e392a956bfcb92fa0ccc547621e703e3d4931fa Mon Sep 17 00:00:00 2001 From: mpetrov Date: Wed, 9 Apr 2025 13:49:02 +0300 Subject: [PATCH 217/286] Added forbidden argument names in accordance with constants --- .../panel/calculated-field-argument-panel.component.html | 4 ++-- .../panel/calculated-field-argument-panel.component.ts | 7 ++++--- ui-ngx/src/assets/locale/locale.constant-en_US.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html index 7521395cb4..92855d882f 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.html @@ -55,11 +55,11 @@ class="tb-error"> warning - } @else if (argumentFormGroup.get('argumentName').touched && argumentFormGroup.get('argumentName').hasError('equalCtx')) { + } @else if (argumentFormGroup.get('argumentName').touched && argumentFormGroup.get('argumentName').hasError('forbiddenName')) { warning diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts index 2a64c90f20..6f46e47af9 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/panel/calculated-field-argument-panel.component.ts @@ -67,7 +67,7 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI readonly defaultLimit = Math.floor(this.maxDataPointsPerRollingArg / 10); argumentFormGroup = this.fb.group({ - argumentName: ['', [Validators.required, this.uniqNameRequired(), this.notEqualCtxValidator(), Validators.pattern(charsWithNumRegex), Validators.maxLength(255)]], + argumentName: ['', [Validators.required, this.uniqNameRequired(), this.forbiddenArgumentNameValidator(), Validators.pattern(charsWithNumRegex), Validators.maxLength(255)]], refEntityId: this.fb.group({ entityType: [ArgumentEntityType.Current], id: [''] @@ -254,10 +254,11 @@ export class CalculatedFieldArgumentPanelComponent implements OnInit, AfterViewI } } - private notEqualCtxValidator(): ValidatorFn { + private forbiddenArgumentNameValidator(): ValidatorFn { return (control: FormControl) => { const trimmedValue = control.value.trim().toLowerCase(); - return trimmedValue === 'ctx' ? { equalCtx: true } : null; + const forbiddenArgumentNames = ['ctx', 'e', 'pi']; + return forbiddenArgumentNames.includes(trimmedValue) ? { forbiddenName: true } : null; }; } diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index e4f4721f3c..133e333dbe 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1069,7 +1069,7 @@ "argument-name-pattern": "Argument name is invalid.", "argument-name-duplicate": "Argument with such name already exists.", "argument-name-max-length": "Argument name should be less than 256 characters.", - "argument-name-ctx": "Argument name 'ctx' is reserved and cannot be used.", + "argument-name-forbidden": "Argument name is reserved and cannot be used.", "argument-type-required": "Argument type is required.", "max-args": "Maximum number of arguments reached.", "decimals-range": "Decimals by default should be a number between 0 and 15.", From 16eb027956ffef4657a3e529e170d0e2067d17c2 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Wed, 9 Apr 2025 14:52:11 +0300 Subject: [PATCH 218/286] EDQS: configurable string compression threshold; fix stats service condition --- application/src/main/resources/thingsboard.yml | 2 ++ .../edqs/data/dp/CompressedStringDataPoint.java | 3 +-- .../server/edqs/stats/DefaultEdqsStatsService.java | 6 ++---- .../thingsboard/server/edqs/util/EdqsConverter.java | 12 ++++++++---- edqs/src/main/resources/edqs.yml | 2 ++ 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index d8a22e478d..ecd4ddebb7 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1765,6 +1765,8 @@ queue: max_pending_requests: "${TB_EDQS_MAX_PENDING_REQUESTS:10000}" # Maximum timeout for requests to EDQS max_request_timeout: "${TB_EDQS_MAX_REQUEST_TIMEOUT:20000}" + # Strings longer than this threshold will be compressed + string_compression_length_threshold: "${TB_EDQS_STRING_COMPRESSION_LENGTH_THRESHOLD:512}" stats: # Enable/disable statistics for EDQS enabled: "${TB_EDQS_STATS_ENABLED:true}" diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java index f63abbbeb7..cf4267e443 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java @@ -17,13 +17,12 @@ package org.thingsboard.server.edqs.data.dp; import lombok.Getter; import lombok.SneakyThrows; -import org.thingsboard.server.common.data.kv.DataType; import org.thingsboard.common.util.TbBytePool; +import org.thingsboard.server.common.data.kv.DataType; import org.xerial.snappy.Snappy; public class CompressedStringDataPoint extends AbstractDataPoint { - public static final int MIN_STR_SIZE_TO_COMPRESS = 512; @Getter private final byte[] compressedValue; diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java index 7769d2bfb8..3767d0f60b 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java @@ -17,7 +17,7 @@ package org.thingsboard.server.edqs.stats; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.ObjectType; import org.thingsboard.server.common.data.id.TenantId; @@ -27,16 +27,14 @@ import org.thingsboard.server.common.stats.EdqsStatsService; import org.thingsboard.server.common.stats.StatsFactory; import org.thingsboard.server.common.stats.StatsTimer; import org.thingsboard.server.common.stats.StatsType; -import org.thingsboard.server.queue.edqs.EdqsComponent; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -@EdqsComponent @Service @Slf4j -@ConditionalOnProperty(name = "queue.edqs.stats.enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnExpression("'${queue.edqs.api.supported:true}' == 'true' && '${queue.edqs.stats.enabled:true}' == 'true'") public class DefaultEdqsStatsService implements EdqsStatsService { private final StatsFactory statsFactory; diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java index bb79e0b8df..167037b889 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java @@ -27,6 +27,7 @@ import com.google.protobuf.ByteString; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.thingsboard.common.util.TbStringPool; import org.thingsboard.server.common.data.AttributeScope; @@ -63,6 +64,9 @@ import java.util.UUID; @Slf4j public class EdqsConverter { + @Value("${queue.edqs.string_compression_length_threshold:512}") + private int stringCompressionLengthThreshold; + private final Map> converters = new HashMap<>(); private final Converter defaultConverter = new JsonConverter<>(Entity.class); @@ -131,7 +135,7 @@ public class EdqsConverter { }); } - public static DataPointProto toDataPointProto(long ts, KvEntry kvEntry) { + public DataPointProto toDataPointProto(long ts, KvEntry kvEntry) { DataPointProto.Builder proto = DataPointProto.newBuilder(); proto.setTs(ts); switch (kvEntry.getDataType()) { @@ -140,7 +144,7 @@ public class EdqsConverter { case DOUBLE -> proto.setDoubleV(kvEntry.getDoubleValue().get()); case STRING -> { String strValue = kvEntry.getStrValue().get(); - if (strValue.length() < CompressedStringDataPoint.MIN_STR_SIZE_TO_COMPRESS) { + if (strValue.length() < stringCompressionLengthThreshold) { proto.setStringV(strValue); } else { proto.setCompressedStringV(ByteString.copyFrom(compress(strValue))); @@ -148,7 +152,7 @@ public class EdqsConverter { } case JSON -> { String jsonValue = kvEntry.getJsonValue().get(); - if (jsonValue.length() < CompressedStringDataPoint.MIN_STR_SIZE_TO_COMPRESS) { + if (jsonValue.length() < stringCompressionLengthThreshold) { proto.setJsonV(jsonValue); } else { proto.setCompressedJsonV(ByteString.copyFrom(compress(jsonValue))); @@ -158,7 +162,7 @@ public class EdqsConverter { return proto.build(); } - public static DataPoint fromDataPointProto(DataPointProto proto) { + public DataPoint fromDataPointProto(DataPointProto proto) { long ts = proto.getTs(); if (proto.hasBoolV()) { return new BoolDataPoint(ts, proto.getBoolV()); diff --git a/edqs/src/main/resources/edqs.yml b/edqs/src/main/resources/edqs.yml index 353d76391b..2c0e0b8c5d 100644 --- a/edqs/src/main/resources/edqs.yml +++ b/edqs/src/main/resources/edqs.yml @@ -71,6 +71,8 @@ queue: max_pending_requests: "${TB_EDQS_MAX_PENDING_REQUESTS:10000}" # Maximum timeout for requests to EDQS max_request_timeout: "${TB_EDQS_MAX_REQUEST_TIMEOUT:20000}" + # Strings longer than this threshold will be compressed + string_compression_length_threshold: "${TB_EDQS_STRING_COMPRESSION_LENGTH_THRESHOLD:512}" stats: # Enable/disable statistics for EDQS enabled: "${TB_EDQS_STATS_ENABLED:true}" From acc278f563d28e451de82ff78b98b1b3e9b6d52e Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 9 Apr 2025 16:27:03 +0300 Subject: [PATCH 219/286] UI: Fixed show popover some time not showing occasionally on first interaction --- .../src/app/shared/components/popover.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/popover.component.ts b/ui-ngx/src/app/shared/components/popover.component.ts index 4344b32fd7..2ccbb615d5 100644 --- a/ui-ngx/src/app/shared/components/popover.component.ts +++ b/ui-ngx/src/app/shared/components/popover.component.ts @@ -375,7 +375,6 @@ export class TbPopoverComponent implements OnDestroy, OnInit { tbComponentInjector: Injector | null = null; tbComponentStyle: { [klass: string]: any } = {}; tbOverlayClassName!: string; - tbOverlayStyle: { [klass: string]: any } = {}; tbPopoverInnerStyle: { [klass: string]: any } = {}; tbPopoverInnerContentStyle: { [klass: string]: any } = {}; tbBackdrop = false; @@ -470,6 +469,16 @@ export class TbPopoverComponent implements OnDestroy, OnInit { return this.tbModal ? 'tb-popover-overlay-backdrop' : ''; } + + set tbOverlayStyle(value: { [klass: string]: any }) { + this._tbOverlayStyle = value; + this.cdr.markForCheck(); + } + + get tbOverlayStyle(): { [klass: string]: any } { + return this._tbOverlayStyle; + } + preferredPlacement: PopoverPlacement = 'top'; strictPosition = false; origin!: CdkOverlayOrigin; @@ -485,6 +494,7 @@ export class TbPopoverComponent implements OnDestroy, OnInit { this.cdr.markForCheck(); } }, {threshold: [0.5]}); + private _tbOverlayStyle: { [klass: string]: any } = {}; constructor( public cdr: ChangeDetectorRef, From 580c0074d3f586e4e08f0cfca888a619c6db1edb Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Wed, 9 Apr 2025 16:59:17 +0300 Subject: [PATCH 220/286] used tpi in main consumer manager --- .../KafkaCalculatedFieldStateService.java | 2 +- ...faultTbCalculatedFieldConsumerService.java | 63 ++++--------------- .../queue/DefaultTbCoreConsumerService.java | 2 +- .../queue/DefaultTbEdgeConsumerService.java | 5 +- .../TbRuleEngineQueueConsumerManager.java | 7 ++- .../server/edqs/processor/EdqsProcessor.java | 2 +- .../edqs/state/KafkaEdqsStateService.java | 5 +- .../consumer/MainQueueConsumerManager.java | 6 +- .../PartitionedQueueConsumerManager.java | 2 +- .../InMemoryMonolithQueueFactory.java | 2 +- .../provider/KafkaMonolithQueueFactory.java | 5 +- .../KafkaTbRuleEngineQueueFactory.java | 5 +- .../provider/TbRuleEngineQueueFactory.java | 2 +- 13 files changed, 38 insertions(+), 70 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java index 825b68dec2..19d2b74bb5 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java @@ -91,7 +91,7 @@ public class KafkaCalculatedFieldStateService extends AbstractCalculatedFieldSta } } }) - .consumerCreator((queueConfig, partitionId) -> queueFactory.createCalculatedFieldStateConsumer()) + .consumerCreator((queueConfig, tpi) -> queueFactory.createCalculatedFieldStateConsumer()) .queueAdmin(queueFactory.getCalculatedFieldQueueAdmin()) .consumerExecutor(eventConsumer.getConsumerExecutor()) .scheduler(eventConsumer.getScheduler()) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index 6adae15fe6..f108949efa 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -17,6 +17,7 @@ package org.thingsboard.server.service.queue; import jakarta.annotation.PreDestroy; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.event.EventListener; @@ -35,7 +36,6 @@ 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.dao.queue.QueueService; import org.thingsboard.server.dao.tenant.TbTenantProfileCache; import org.thingsboard.server.gen.transport.TransportProtos.CalculatedFieldLinkedTelemetryMsgProto; import org.thingsboard.server.gen.transport.TransportProtos.CalculatedFieldTelemetryMsgProto; @@ -43,7 +43,6 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToCalculatedFieldMsg import org.thingsboard.server.gen.transport.TransportProtos.ToCalculatedFieldNotificationMsg; import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; -import org.thingsboard.server.queue.common.consumer.MainQueueConsumerManager; import org.thingsboard.server.queue.common.consumer.PartitionedQueueConsumerManager; import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.queue.discovery.QueueKey; @@ -61,7 +60,6 @@ import org.thingsboard.server.service.queue.processing.IdMsgPair; import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService; import java.util.List; -import java.util.Optional; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -85,8 +83,6 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa private final CalculatedFieldStateService stateService; private final CalculatedFieldEntityProfileCache entityProfileCache; - private final ConcurrentMap>> consumers = new ConcurrentHashMap<>(); - public DefaultTbCalculatedFieldConsumerService(TbRuleEngineQueueFactory tbQueueFactory, ActorSystemContext actorContext, TbDeviceProfileCache deviceProfileCache, @@ -109,32 +105,18 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa @Override protected void onStartUp() { var queueKey = new QueueKey(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME); - createConsumer(queueKey); - } - - private PartitionedQueueConsumerManager> createConsumer(QueueKey queueKey) { - String topic = partitionService.getTopic(queueKey); var eventConsumer = PartitionedQueueConsumerManager.>create() .queueKey(queueKey) - .topic(topic) + .topic(partitionService.getTopic(queueKey)) .pollInterval(pollInterval) .msgPackProcessor(this::processMsgs) - .consumerCreator((queueConfig, partitionId) -> { - TopicPartitionInfo tpi = TopicPartitionInfo.builder() - .tenantId(queueKey.getTenantId()) - .topic(partitionService.getTopic(queueKey)) - .partition(partitionId) - .build(); - return queueFactory.createToCalculatedFieldMsgConsumer(tpi, partitionId); - }) + .consumerCreator((queueConfig, tpi) -> queueFactory.createToCalculatedFieldMsgConsumer(tpi)) .queueAdmin(queueFactory.getCalculatedFieldQueueAdmin()) .consumerExecutor(consumersExecutor) .scheduler(scheduler) .taskExecutor(mgmtExecutor) .build(); stateService.init(eventConsumer); - consumers.put(queueKey, eventConsumer); - return eventConsumer; } @PreDestroy @@ -151,26 +133,11 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa protected void onPartitionChangeEvent(PartitionChangeEvent event) { try { event.getNewPartitions().forEach((queueKey, partitions) -> { - if (DataConstants.CF_QUEUE_NAME.equals(queueKey.getQueueName()) || DataConstants.CF_STATES_QUEUE_NAME.equals(queueKey.getQueueName())) { - if (partitionService.isManagedByCurrentService(queueKey.getTenantId())) { - var consumer = Optional.ofNullable(consumers.get(queueKey)).orElseGet(() -> createConsumer(queueKey)); - if (consumer != null) { - stateService.restore(queueKey, partitions); - } - } + if (DataConstants.CF_QUEUE_NAME.equals(queueKey.getQueueName())) { + stateService.restore(queueKey, partitions); } }); - consumers.keySet().stream() - .collect(Collectors.groupingBy(QueueKey::getTenantId)) - .forEach((tenantId, queueKeys) -> { - if (!partitionService.isManagedByCurrentService(tenantId)) { - queueKeys.forEach(queueKey -> { - Optional.ofNullable(consumers.remove(queueKey)).ifPresent(MainQueueConsumerManager::stop); - }); - } - }); - // Cleanup old entities after corresponding consumers are stopped. // Any periodic tasks need to check that the entity is still managed by the current server before processing. actorContext.tell(new CalculatedFieldPartitionChangeMsg()); @@ -265,19 +232,13 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa if (event.getEvent() == ComponentLifecycleEvent.DELETED) { entityProfileCache.removeTenant(event.getTenantId()); - List toRemove = consumers.keySet().stream() - .filter(queueKey -> queueKey.getTenantId().equals(event.getTenantId())) - .toList(); - toRemove.forEach(queueKey -> { - Optional.ofNullable(consumers.remove(queueKey)).ifPresent(consumer -> { - Set partitions = stateService.getPartitions().stream() - .filter(tpi -> tpi.getTenantId().isPresent() && tpi.getTenantId().get().equals(event.getTenantId())) - .collect(Collectors.toSet()); - if (!partitions.isEmpty()) { - consumer.delete(partitions); - } - }); - }); + Set partitions = stateService.getPartitions(); + if (CollectionUtils.isEmpty(partitions)) { + return; + } + stateService.delete(partitions.stream() + .filter(tpi -> tpi.getTenantId().isPresent() && tpi.getTenantId().get().equals(event.getTenantId())) + .collect(Collectors.toSet())); } } else if (event.getEntityId().getEntityType() == EntityType.ASSET_PROFILE) { if (event.getEvent() == ComponentLifecycleEvent.DELETED) { diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java index a3003ba6ff..17decae3a0 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java @@ -206,7 +206,7 @@ public class DefaultTbCoreConsumerService extends AbstractConsumerService queueFactory.createToCoreMsgConsumer()) + .consumerCreator((config, tpi) -> queueFactory.createToCoreMsgConsumer()) .consumerExecutor(consumersExecutor) .scheduler(scheduler) .taskExecutor(mgmtExecutor) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java index fdaa2103e2..7415b0bdad 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java @@ -19,7 +19,6 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; -import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.checkerframework.checker.nullness.qual.Nullable; import org.jetbrains.annotations.NotNull; @@ -45,12 +44,12 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToEdgeMsg; import org.thingsboard.server.gen.transport.TransportProtos.ToEdgeNotificationMsg; import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; +import org.thingsboard.server.queue.common.consumer.MainQueueConsumerManager; import org.thingsboard.server.queue.discovery.QueueKey; import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.provider.TbCoreQueueFactory; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeContextComponent; -import org.thingsboard.server.queue.common.consumer.MainQueueConsumerManager; import org.thingsboard.server.service.queue.processing.AbstractConsumerService; import org.thingsboard.server.service.queue.processing.IdMsgPair; @@ -104,7 +103,7 @@ public class DefaultTbEdgeConsumerService extends AbstractConsumerService queueFactory.createEdgeMsgConsumer()) + .consumerCreator((config, tpi) -> queueFactory.createEdgeMsgConsumer()) .consumerExecutor(consumersExecutor) .scheduler(scheduler) .taskExecutor(mgmtExecutor) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java b/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java index c7f7f600a7..c147836dab 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java @@ -72,7 +72,12 @@ public class TbRuleEngineQueueConsumerManager extends MainQueueConsumerManager { + Integer partitionId = topicPartitionInfo.getPartition().orElse(-1); + return ctx.getQueueFactory().createToRuleEngineMsgConsumer(queueConfig, partitionId); + }, + consumerExecutor, scheduler, taskExecutor, null); this.ctx = ctx; this.stats = new TbRuleEngineConsumerStats(queueKey, ctx.getStatsFactory()); } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java index 07575220eb..78d17ef368 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/processor/EdqsProcessor.java @@ -139,7 +139,7 @@ public class EdqsProcessor implements TbQueueHandler, } consumer.commit(); }) - .consumerCreator((config, partitionId) -> queueFactory.createEdqsEventsConsumer()) + .consumerCreator((config, tpi) -> queueFactory.createEdqsEventsConsumer()) .queueAdmin(queueFactory.getEdqsQueueAdmin()) .consumerExecutor(consumersExecutor) .taskExecutor(taskExecutor) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java index efdb1ead1c..0efe6e7d3b 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/state/KafkaEdqsStateService.java @@ -59,7 +59,8 @@ public class KafkaEdqsStateService implements EdqsStateService { private final EdqsConfig config; private final EdqsPartitionService partitionService; private final KafkaEdqsQueueFactory queueFactory; - @Autowired @Lazy + @Autowired + @Lazy private EdqsProcessor edqsProcessor; private PartitionedQueueConsumerManager> stateConsumer; @@ -93,7 +94,7 @@ public class KafkaEdqsStateService implements EdqsStateService { } consumer.commit(); }) - .consumerCreator((config, partitionId) -> queueFactory.createEdqsStateConsumer()) + .consumerCreator((config, tpi) -> queueFactory.createEdqsStateConsumer()) .queueAdmin(queueAdmin) .consumerExecutor(eventConsumer.getConsumerExecutor()) .taskExecutor(eventConsumer.getTaskExecutor()) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java index ef9728344c..2233855a37 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/MainQueueConsumerManager.java @@ -54,7 +54,7 @@ public class MainQueueConsumerManager msgPackProcessor; - protected final BiFunction> consumerCreator; + protected final BiFunction> consumerCreator; @Getter protected final ExecutorService consumerExecutor; @Getter @@ -74,7 +74,7 @@ public class MainQueueConsumerManager msgPackProcessor, - BiFunction> consumerCreator, + BiFunction> consumerCreator, ExecutorService consumerExecutor, ScheduledExecutorService scheduler, ExecutorService taskExecutor, @@ -313,7 +313,7 @@ public class MainQueueConsumerManager onStop.accept(tpi) : null; TbQueueConsumerTask consumer = new TbQueueConsumerTask<>(key, () -> { - TbQueueConsumer queueConsumer = consumerCreator.apply(config, partitionId); + TbQueueConsumer queueConsumer = consumerCreator.apply(config, tpi); if (startOffsetProvider != null && queueConsumer instanceof TbKafkaConsumerTemplate kafkaConsumer) { kafkaConsumer.setStartOffsetProvider(startOffsetProvider); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java index 0de1e53753..1b19fcab0e 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/common/consumer/PartitionedQueueConsumerManager.java @@ -45,7 +45,7 @@ public class PartitionedQueueConsumerManager extends MainQ @Builder(builderMethodName = "create") // not to conflict with super.builder() public PartitionedQueueConsumerManager(QueueKey queueKey, String topic, long pollInterval, MsgPackProcessor msgPackProcessor, - BiFunction> consumerCreator, TbQueueAdmin queueAdmin, + BiFunction> consumerCreator, TbQueueAdmin queueAdmin, ExecutorService consumerExecutor, ScheduledExecutorService scheduler, ExecutorService taskExecutor, Consumer uncaughtErrorHandler) { super(queueKey, QueueConfig.of(true, pollInterval), msgPackProcessor, consumerCreator, consumerExecutor, scheduler, taskExecutor, uncaughtErrorHandler); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java index 9fbd75d347..085d04f28c 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/InMemoryMonolithQueueFactory.java @@ -134,7 +134,7 @@ public class InMemoryMonolithQueueFactory implements TbCoreQueueFactory, TbRuleE } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi, Integer partitionId) { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi) { return new InMemoryTbQueueConsumer<>(storage, topicService.buildTopicName(calculatedFieldSettings.getEventTopic())); } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index 198e2f7a83..1c46a624c3 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -105,7 +105,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi private final TbQueueAdmin housekeeperReprocessingAdmin; private final TbQueueAdmin edgeAdmin; private final TbQueueAdmin edgeEventAdmin; - private final TbKafkaAdmin cfAdmin; + private final TbQueueAdmin cfAdmin; private final TbQueueAdmin cfStateAdmin; private final TbQueueAdmin edqsEventsAdmin; private final TbKafkaAdmin edqsRequestsAdmin; @@ -515,9 +515,10 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi, Integer partitionId) { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi) { String queueName = DataConstants.CF_QUEUE_NAME; TenantId tenantId = tpi.getTenantId().orElse(TenantId.SYS_TENANT_ID); + Integer partitionId = tpi.getPartition().orElseThrow(() -> new IllegalArgumentException("PartitionId is required.")); String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, partitionId); TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index f387d1af11..112af9f646 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -93,7 +93,7 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { private final TbQueueAdmin housekeeperAdmin; private final TbQueueAdmin edgeAdmin; private final TbQueueAdmin edgeEventAdmin; - private final TbKafkaAdmin cfAdmin; + private final TbQueueAdmin cfAdmin; private final TbQueueAdmin cfStateAdmin; private final TbQueueAdmin edqsEventsAdmin; private final AtomicLong consumerCount = new AtomicLong(); @@ -316,9 +316,10 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { } @Override - public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi, Integer partitionId) { + public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi) { String queueName = DataConstants.CF_QUEUE_NAME; TenantId tenantId = tpi.getTenantId().orElse(TenantId.SYS_TENANT_ID); + Integer partitionId = tpi.getPartition().orElseThrow(() -> new IllegalArgumentException("PartitionId is required.")); String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, partitionId); TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java index 3980aaa632..18bb6db14a 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbRuleEngineQueueFactory.java @@ -122,7 +122,7 @@ public interface TbRuleEngineQueueFactory extends TbUsageStatsClientQueueFactory TbQueueRequestTemplate, TbProtoQueueMsg> createRemoteJsRequestTemplate(); - TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi, Integer partitionId); + TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi); TbQueueAdmin getCalculatedFieldQueueAdmin(); From c443b5e8c689b4b1be13a3a29c5d9efcf029f933 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 9 Apr 2025 16:59:37 +0300 Subject: [PATCH 221/286] Add max poll records for edge consumers. silent errors in case of processing edge events --- .../service/edge/EdgeMsgConstructorUtils.java | 8 +++--- .../service/edge/rpc/EdgeGrpcSession.java | 10 +++---- .../ttl/KafkaEdgeTopicsCleanUpService.java | 2 +- .../src/main/resources/thingsboard.yml | 27 ++++++++++++++----- .../server/queue/discovery/TopicService.java | 12 ++++----- .../server/queue/kafka/TbKafkaSettings.java | 2 +- .../provider/TbCoreQueueProducerProvider.java | 1 - 7 files changed, 38 insertions(+), 24 deletions(-) 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 9bcd8fc373..d996a1dbc9 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 @@ -507,7 +507,7 @@ public class EdgeMsgConstructorUtils { JsonObject data = entityData.getAsJsonObject(); builder.setPostTelemetryMsg(JsonConverter.convertToTelemetryProto(data.getAsJsonObject("data"), ts)); } catch (Exception e) { - log.warn("[{}][{}] Can't convert to telemetry proto, entityData [{}]", tenantId, entityId, entityData, e); + log.trace("[{}][{}] Can't convert to telemetry proto, entityData [{}]", tenantId, entityId, entityData, e); } break; case ATTRIBUTES_UPDATED: @@ -522,7 +522,7 @@ public class EdgeMsgConstructorUtils { builder.setPostAttributeScope(getScopeOfDefault(data)); builder.setAttributeTs(ts); } catch (Exception e) { - log.warn("[{}][{}] Can't convert to AttributesUpdatedMsg proto, entityData [{}]", tenantId, entityId, entityData, e); + log.trace("[{}][{}] Can't convert to AttributesUpdatedMsg proto, entityData [{}]", tenantId, entityId, entityData, e); } break; case POST_ATTRIBUTES: @@ -533,7 +533,7 @@ public class EdgeMsgConstructorUtils { builder.setPostAttributeScope(getScopeOfDefault(data)); builder.setAttributeTs(ts); } catch (Exception e) { - log.warn("[{}][{}] Can't convert to PostAttributesMsg, entityData [{}]", tenantId, entityId, entityData, e); + log.trace("[{}][{}] Can't convert to PostAttributesMsg, entityData [{}]", tenantId, entityId, entityData, e); } break; case ATTRIBUTES_DELETED: @@ -546,7 +546,7 @@ public class EdgeMsgConstructorUtils { attributeDeleteMsg.build(); builder.setAttributeDeleteMsg(attributeDeleteMsg); } catch (Exception e) { - log.warn("[{}][{}] Can't convert to AttributeDeleteMsg proto, entityData [{}]", tenantId, entityId, entityData, e); + log.trace("[{}][{}] Can't convert to AttributeDeleteMsg proto, entityData [{}]", tenantId, entityId, entityData, e); } break; } diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index ecd0c6d9f3..9ce5973639 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -203,7 +203,7 @@ public abstract class EdgeGrpcSession implements Closeable { @Override public void onError(Throwable t) { - log.error("[{}][{}] Stream was terminated due to error:", tenantId, sessionId, t); + log.trace("[{}][{}] Stream was terminated due to error:", tenantId, sessionId, t); closeSession(); } @@ -255,7 +255,7 @@ public abstract class EdgeGrpcSession implements Closeable { private void doSync(EdgeSyncCursor cursor) { if (cursor.hasNext()) { EdgeEventFetcher next = cursor.getNext(); - log.info("[{}][{}] starting sync process, cursor current idx = {}, class = {}", + log.debug("[{}][{}] starting sync process, cursor current idx = {}, class = {}", tenantId, edge.getId(), cursor.getCurrentIdx(), next.getClass().getSimpleName()); ListenableFuture> future = startProcessingEdgeEvents(next); Futures.addCallback(future, new FutureCallback<>() { @@ -651,7 +651,7 @@ public abstract class EdgeGrpcSession implements Closeable { default -> log.warn("[{}][{}] Unsupported action type [{}]", tenantId, sessionId, edgeEvent.getAction()); } } catch (Exception e) { - log.error("[{}][{}] Exception during converting edge event to downlink msg", tenantId, sessionId, e); + log.trace("[{}][{}] Exception during converting edge event to downlink msg", tenantId, sessionId, e); } if (downlinkMsg != null) { result.add(downlinkMsg); @@ -763,7 +763,7 @@ public abstract class EdgeGrpcSession implements Closeable { try { outputStream.onNext(responseMsg); } catch (Exception e) { - log.error("[{}][{}] Failed to send downlink message [{}]", tenantId, sessionId, downlinkMsgStr, e); + log.trace("[{}][{}] Failed to send downlink message [{}]", tenantId, sessionId, downlinkMsgStr, e); connected = false; sessionCloseListener.accept(edge, sessionId); } finally { @@ -909,7 +909,7 @@ public abstract class EdgeGrpcSession implements Closeable { } } catch (Exception e) { String failureMsg = String.format("Can't process uplink msg [%s] from edge", uplinkMsg); - log.error("[{}][{}] Can't process uplink msg [{}]", edge.getTenantId(), sessionId, uplinkMsg, e); + log.trace("[{}][{}] Can't process uplink msg [{}]", edge.getTenantId(), sessionId, 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()); return Futures.immediateFailedFuture(e); diff --git a/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java b/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java index 73712542fd..c32ed92e31 100644 --- a/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java +++ b/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java @@ -62,7 +62,7 @@ public class KafkaEdgeTopicsCleanUpService extends AbstractCleanUpService { @Value("${sql.ttl.edge_events.edge_events_ttl:2628000}") private long ttlSeconds; - @Value("${queue.edge.event-notifications-topic:tb_edge_event.notifications}") + @Value("${queue.edge.event_notifications_topic:tb_edge_event.notifications}") private String tbEdgeEventNotificationsTopic; public KafkaEdgeTopicsCleanUpService(PartitionService partitionService, EdgeService edgeService, diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index ecd4ddebb7..b4d178a737 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1590,11 +1590,24 @@ queue: # tb_rule_engine.sq: # - key: max.poll.records # value: "${TB_QUEUE_KAFKA_SQ_MAX_POLL_RECORDS:1024}" + tb_edge: + # Properties for consumers targeting edge service update topics. + - key: max.poll.records + # Define the maximum number of records that can be polled from tb_edge topics per request. + value: "${TB_QUEUE_KAFKA_EDGE_EVENTS_MAX_POLL_RECORDS:10}" + tb_edge.notifications: + # Properties for consumers targeting high-priority edge notifications. + # These notifications include RPC calls, lifecycle events, and new queue messages, + # requiring minimal latency and swift processing. + - key: max.poll.records + # Define the maximum number of records that can be polled from tb_edge.notifications. topics. + value: "${TB_QUEUE_KAFKA_EDGE_HP_EVENTS_MAX_POLL_RECORDS:10}" tb_edge_event.notifications: - # Example of specific consumer properties value per topic for edge event + # Properties for consumers targeting downlinks meant for specific edge topics. + # Topic names are dynamically constructed using tenant and edge identifiers. - key: max.poll.records - # Example of specific consumer properties value per topic for edge event - value: "${TB_QUEUE_KAFKA_EDGE_EVENT_MAX_POLL_RECORDS:50}" + # Define the maximum number of records that can be polled from tb_edge_event.notifications.. topics. + value: "${TB_QUEUE_KAFKA_EDGE_NOTIFICATIONS_MAX_POLL_RECORDS:10}" tb_housekeeper: # Consumer properties for Housekeeper tasks topic - key: max.poll.records @@ -1841,11 +1854,13 @@ queue: # Interval in milliseconds to poll messages poll_interval: "${TB_QUEUE_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}" edge: - # Default topic name + # Topic name to notify edge service on entity updates, assignment, etc. topic: "${TB_QUEUE_EDGE_TOPIC:tb_edge}" - # For high-priority notifications that require minimum latency and processing time + # Topic prefix for high-priority edge notifications (rpc, lifecycle, new messages in queue) that require minimum latency and processing time. + # Each tb-core has its own topic: . notifications_topic: "${TB_QUEUE_EDGE_NOTIFICATIONS_TOPIC:tb_edge.notifications}" - # For edge events messages + # Topic prefix for downlinks to be pushed to specific edge. + # Every edge has its own unique topic: .. event_notifications_topic: "${TB_QUEUE_EDGE_EVENT_NOTIFICATIONS_TOPIC:tb_edge_event.notifications}" # Amount of partitions used by Edge services partitions: "${TB_QUEUE_EDGE_PARTITIONS:10}" diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java index 42263138c1..4b6c0aa139 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java @@ -32,22 +32,22 @@ public class TopicService { @Value("${queue.prefix:}") private String prefix; - @Value("${queue.core.notifications-topic:tb_core.notifications}") + @Value("${queue.core.notifications_topic:tb_core.notifications}") private String tbCoreNotificationsTopic; - @Value("${queue.rule-engine.notifications-topic:tb_rule_engine.notifications}") + @Value("${queue.rule-engine.notifications_topic:tb_rule_engine.notifications}") private String tbRuleEngineNotificationsTopic; - @Value("${queue.transport.notifications-topics:tb_transport.notifications}") + @Value("${queue.transport.notifications_topics:tb_transport.notifications}") private String tbTransportNotificationsTopic; - @Value("${queue.edge.notifications-topic:tb_edge.notifications}") + @Value("${queue.edge.notifications_topic:tb_edge.notifications}") private String tbEdgeNotificationsTopic; - @Value("${queue.edge.event-notifications-topic:tb_edge_event.notifications}") + @Value("${queue.edge.event_notifications_topic:tb_edge_event.notifications}") private String tbEdgeEventNotificationsTopic; - @Value("${queue.calculated-fields.notifications-topic:calculated_field.notifications}") + @Value("${queue.calculated-fields.notifications_topic:calculated_field.notifications}") private String tbCalculatedFieldNotificationsTopic; private final ConcurrentMap tbCoreNotificationTopics = new ConcurrentHashMap<>(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java index 181d422f16..d447d92cb3 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java @@ -50,7 +50,7 @@ import java.util.Properties; @Component public class TbKafkaSettings { - private static final List DYNAMIC_TOPICS = List.of("tb_edge_event.notifications"); + private static final List DYNAMIC_TOPICS = List.of("tb_edge.notifications", "tb_edge_event.notifications"); @Value("${queue.kafka.bootstrap.servers}") private String servers; diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbCoreQueueProducerProvider.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbCoreQueueProducerProvider.java index 7c3e415e9f..98a3d78304 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbCoreQueueProducerProvider.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/TbCoreQueueProducerProvider.java @@ -115,7 +115,6 @@ public class TbCoreQueueProducerProvider implements TbQueueProducerProvider { return toHousekeeper; } - @Override public TbQueueProducer> getTbEdgeMsgProducer() { return toEdge; From 68289044c578f05596abceda500625c06e6af545 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Wed, 9 Apr 2025 17:56:47 +0300 Subject: [PATCH 222/286] TbKafkaSettings - use startswith strategy for consumer props in case direct .get return null --- .../ttl/KafkaEdgeTopicsCleanUpService.java | 2 +- .../server/queue/discovery/TopicService.java | 12 +++++----- .../server/queue/kafka/TbKafkaSettings.java | 24 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java b/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java index c32ed92e31..73712542fd 100644 --- a/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java +++ b/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java @@ -62,7 +62,7 @@ public class KafkaEdgeTopicsCleanUpService extends AbstractCleanUpService { @Value("${sql.ttl.edge_events.edge_events_ttl:2628000}") private long ttlSeconds; - @Value("${queue.edge.event_notifications_topic:tb_edge_event.notifications}") + @Value("${queue.edge.event-notifications-topic:tb_edge_event.notifications}") private String tbEdgeEventNotificationsTopic; public KafkaEdgeTopicsCleanUpService(PartitionService partitionService, EdgeService edgeService, diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java index 4b6c0aa139..7271e1cb10 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java @@ -32,22 +32,22 @@ public class TopicService { @Value("${queue.prefix:}") private String prefix; - @Value("${queue.core.notifications_topic:tb_core.notifications}") + @Value("${queue.core.notifications-topic:tb_core.notifications}") private String tbCoreNotificationsTopic; - @Value("${queue.rule-engine.notifications_topic:tb_rule_engine.notifications}") + @Value("${queue.rule-engine.notifications-topic:tb_rule_engine.notifications}") private String tbRuleEngineNotificationsTopic; - @Value("${queue.transport.notifications_topics:tb_transport.notifications}") + @Value("${queue.transport.notifications-topic:tb_transport.notifications}") private String tbTransportNotificationsTopic; - @Value("${queue.edge.notifications_topic:tb_edge.notifications}") + @Value("${queue.edge.notifications-topic:tb_edge.notifications}") private String tbEdgeNotificationsTopic; - @Value("${queue.edge.event_notifications_topic:tb_edge_event.notifications}") + @Value("${queue.edge.event-notifications-topic:tb_edge_event.notifications}") private String tbEdgeEventNotificationsTopic; - @Value("${queue.calculated-fields.notifications_topic:calculated_field.notifications}") + @Value("${queue.calculated-fields.notifications-topic:calculated_field.notifications}") private String tbCalculatedFieldNotificationsTopic; private final ConcurrentMap tbCoreNotificationTopics = new ConcurrentHashMap<>(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java index d447d92cb3..82b5af179f 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaSettings.java @@ -50,8 +50,6 @@ import java.util.Properties; @Component public class TbKafkaSettings { - private static final List DYNAMIC_TOPICS = List.of("tb_edge.notifications", "tb_edge_event.notifications"); - @Value("${queue.kafka.bootstrap.servers}") private String servers; @@ -163,18 +161,20 @@ public class TbKafkaSettings { props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class); - consumerPropertiesPerTopic - .getOrDefault(topic, Collections.emptyList()) - .forEach(kv -> props.put(kv.getKey(), kv.getValue())); - if (topic != null) { - DYNAMIC_TOPICS.stream() - .filter(topic::startsWith) - .findFirst() - .ifPresent(prefix -> consumerPropertiesPerTopic.getOrDefault(prefix, Collections.emptyList()) - .forEach(kv -> props.put(kv.getKey(), kv.getValue()))); + List properties = consumerPropertiesPerTopic.get(topic); + if (properties == null) { + for (Map.Entry> entry : consumerPropertiesPerTopic.entrySet()) { + if (topic.startsWith(entry.getKey())) { + properties = entry.getValue(); + break; + } + } + } + if (properties != null) { + properties.forEach(kv -> props.put(kv.getKey(), kv.getValue())); + } } - return props; } From 570a1e31c3746d951ecaf0d572f943ca9bb629c5 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 9 Apr 2025 18:43:05 +0300 Subject: [PATCH 223/286] UI: Remove duplicate locales in zh_CN locale --- .../assets/locale/locale.constant-zh_CN.json | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json index 9819c65dba..aaf69bb984 100644 --- a/ui-ngx/src/assets/locale/locale.constant-zh_CN.json +++ b/ui-ngx/src/assets/locale/locale.constant-zh_CN.json @@ -7832,33 +7832,6 @@ "items-per-page-separator": "至" }, "language": { - "language": "语言", - "locales": { - "ar_AE": "العربية (الإمارات العربية المتحدة)", - "ca_ES": "català (Espanya)", - "cs_CZ": "čeština (Česko)", - "da_DK": "dansk (Danmark)", - "de_DE": "Deutsch (Deutschland)", - "el_GR": "Ελληνικά (Ελλάδα)", - "en_US": "English (United States)", - "es_ES": "español (España)", - "fa_IR": "فارسی (ایران)", - "fr_FR": "français (France)", - "it_IT": "italiano (Italia)", - "ja_JP": "日本語 (日本)", - "ka_GE": "ქართული (საქართველო)", - "ko_KR": "한국어 (대한민국)", - "lt_LT": "lietuvių (Lietuva)", - "lv_LV": "latviešu (Latvija)", - "nl_BE": "Nederlands (België)", - "pl_PL": "polski (Polska)", - "pt_BR": "português (Brasil)", - "ro_RO": "română (România)", - "sl_SI": "slovenščina (Slovenija)", - "tr_TR": "Türkçe (Türkiye)", - "uk_UA": "українська (Україна)", - "zh_CN": "中文 (中国)", - "zh_TW": "中文 (台灣)" - } + "language": "语言" } } From 7b57316b5f53b58ed938e03ff274b41cb321f403 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Tue, 1 Apr 2025 13:22:12 +0300 Subject: [PATCH 224/286] UI: Fix erase of externalId on save widget. --- .../src/app/modules/home/models/widget-component.models.ts | 5 ++++- ui-ngx/src/app/shared/models/widget.models.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts index 00afa2b68d..aee890a5b2 100644 --- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts @@ -115,6 +115,7 @@ import { DataKeySettingsFunction } from '@home/components/widget/lib/settings/co import { UtilsService } from '@core/services/utils.service'; import { CompiledTbFunction } from '@shared/models/js-function.models'; import { FormProperty } from '@shared/models/dynamic-form.models'; +import { ExportableEntity } from '@shared/models/base-data'; export interface IWidgetAction { name: string; @@ -573,7 +574,7 @@ export interface IDynamicWidgetComponent { [key: string]: any; } -export interface WidgetInfo extends WidgetTypeDescriptor, WidgetControllerDescriptor { +export interface WidgetInfo extends WidgetTypeDescriptor, WidgetControllerDescriptor, ExportableEntity { widgetName: string; fullFqn: string; deprecated: boolean; @@ -681,6 +682,7 @@ export const toWidgetInfo = (widgetTypeEntity: WidgetType): WidgetInfo => ({ fullFqn: fullWidgetTypeFqn(widgetTypeEntity), deprecated: widgetTypeEntity.deprecated, scada: widgetTypeEntity.scada, + externalId: widgetTypeEntity.externalId, type: widgetTypeEntity.descriptor.type, sizeX: widgetTypeEntity.descriptor.sizeX, sizeY: widgetTypeEntity.descriptor.sizeY, @@ -736,6 +738,7 @@ export const toWidgetType = (widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId: name: widgetInfo.widgetName, deprecated: widgetInfo.deprecated, scada: widgetInfo.scada, + externalId: widgetInfo.externalId, descriptor }; }; diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts index ec55d4e8a3..c55dcdee37 100644 --- a/ui-ngx/src/app/shared/models/widget.models.ts +++ b/ui-ngx/src/app/shared/models/widget.models.ts @@ -206,7 +206,7 @@ export interface WidgetControllerDescriptor { actionSources?: {[actionSourceId: string]: WidgetActionSource}; } -export interface BaseWidgetType extends BaseData, HasTenantId, HasVersion { +export interface BaseWidgetType extends BaseData, HasTenantId, HasVersion, ExportableEntity { tenantId: TenantId; fqn: string; name: string; From ac3b389203abfeafbbb2959dcd8e8de71a13fc0c Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 10 Apr 2025 10:51:11 +0300 Subject: [PATCH 225/286] UI: Add Echart in modules map --- ui-ngx/src/app/modules/common/modules-map.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui-ngx/src/app/modules/common/modules-map.ts b/ui-ngx/src/app/modules/common/modules-map.ts index 70432e8cdf..530a41f006 100644 --- a/ui-ngx/src/app/modules/common/modules-map.ts +++ b/ui-ngx/src/app/modules/common/modules-map.ts @@ -76,6 +76,8 @@ import * as TranslateCore from '@ngx-translate/core'; import * as MatDateTimePicker from '@mat-datetimepicker/core'; import _moment from 'moment'; import * as tslib from 'tslib'; +import * as Echarts from 'echarts'; +import * as EchartsCore from 'echarts/core'; import * as TbCore from '@core/public-api'; import * as TbShared from '@shared/public-api'; @@ -405,6 +407,8 @@ class ModulesMap implements IModulesMap { '@mat-datetimepicker/core': MatDateTimePicker, moment: _moment, tslib, + 'echarts': Echarts, + 'echarts/core': EchartsCore, '@core/public-api': TbCore, '@shared/public-api': TbShared, From ced71331efa6e3e840b557a0b555e1d786ac724c Mon Sep 17 00:00:00 2001 From: deaflynx Date: Tue, 1 Apr 2025 12:04:26 +0300 Subject: [PATCH 226/286] UI: JavaScript library (Module type) minor style enhancement: remove redundant space before required symbol, decrease help popover width (prod-5636). --- .../home/pages/admin/resource/js-resource.component.html | 3 +-- ui-ngx/src/app/shared/components/js-func.component.scss | 4 ++++ .../src/assets/help/en_US/resource/js-resource-module_fn.md | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html index 6287d27f2c..15d899df6b 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html @@ -91,8 +91,7 @@ + {{ 'javascript.module-script' | translate }} +that are exported for use in other parts of the application. ##### Examples You can declare variables: From 713050937c50151eb5c87bb65426f2071326835f Mon Sep 17 00:00:00 2001 From: deaflynx Date: Thu, 10 Apr 2025 10:53:09 +0300 Subject: [PATCH 227/286] UI: JavaScript resource help popup too wide width issue: use [helpPopupStyle]. --- .../home/pages/admin/resource/js-resource.component.html | 1 + ui-ngx/src/assets/help/en_US/resource/js-resource-module_fn.md | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html index 15d899df6b..62036a8ea1 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html @@ -80,6 +80,7 @@ (fileNameChanged)="entityForm?.get('fileName').patchValue($event)"> -that are exported for use in other parts of the application. +These modules can contain any JavaScript code, facilitating the reuse of specific logic. This includes variables or functions that are exported for use in other parts of the application. ##### Examples You can declare variables: From 59fa19d1c861d10aca3a44073a1786c10aab0d9c Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Thu, 10 Apr 2025 11:40:19 +0300 Subject: [PATCH 228/286] Change EDQS consumers poll interval from 125 ms to 25 ms --- application/src/main/resources/thingsboard.yml | 2 +- .../main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java | 2 +- edqs/src/main/resources/edqs.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index b4d178a737..42f5331e21 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1773,7 +1773,7 @@ queue: # EDQS responses topic responses_topic: "${TB_EDQS_RESPONSES_TOPIC:edqs.responses}" # Poll interval for EDQS topics - poll_interval: "${TB_EDQS_POLL_INTERVAL_MS:125}" + poll_interval: "${TB_EDQS_POLL_INTERVAL_MS:25}" # Maximum amount of pending requests to EDQS max_pending_requests: "${TB_EDQS_MAX_PENDING_REQUESTS:10000}" # Maximum timeout for requests to EDQS diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java index 401b451f59..3c927f135b 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/edqs/EdqsConfig.java @@ -38,7 +38,7 @@ public class EdqsConfig { private String requestsTopic; @Value("${queue.edqs.responses_topic:edqs.responses}") private String responsesTopic; - @Value("${queue.edqs.poll_interval:125}") + @Value("${queue.edqs.poll_interval:25}") private long pollInterval; @Value("${queue.edqs.max_pending_requests:10000}") private int maxPendingRequests; diff --git a/edqs/src/main/resources/edqs.yml b/edqs/src/main/resources/edqs.yml index 2c0e0b8c5d..8ea40c03c8 100644 --- a/edqs/src/main/resources/edqs.yml +++ b/edqs/src/main/resources/edqs.yml @@ -66,7 +66,7 @@ queue: # EDQS responses topic responses_topic: "${TB_EDQS_RESPONSES_TOPIC:edqs.responses}" # Poll interval for EDQS topics - poll_interval: "${TB_EDQS_POLL_INTERVAL_MS:125}" + poll_interval: "${TB_EDQS_POLL_INTERVAL_MS:25}" # Maximum amount of pending requests to EDQS max_pending_requests: "${TB_EDQS_MAX_PENDING_REQUESTS:10000}" # Maximum timeout for requests to EDQS From d1f0ec5033774f02b9cf094d3eb42cb5f8bd1e79 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Thu, 10 Apr 2025 11:41:19 +0300 Subject: [PATCH 229/286] Additionally check for string compression threshold on EDQS side --- .../server/edqs/util/EdqsConverter.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java index 167037b889..18e2f521e3 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java @@ -171,11 +171,21 @@ public class EdqsConverter { } else if (proto.hasDoubleV()) { return new DoubleDataPoint(ts, proto.getDoubleV()); } else if (proto.hasStringV()) { - return new StringDataPoint(ts, proto.getStringV()); + String stringV = proto.getStringV(); + if (stringV.length() < stringCompressionLengthThreshold) { + return new StringDataPoint(ts, stringV); + } else { + return new CompressedStringDataPoint(ts, compress(stringV)); + } } else if (proto.hasCompressedStringV()) { return new CompressedStringDataPoint(ts, proto.getCompressedStringV().toByteArray()); } else if (proto.hasJsonV()) { - return new JsonDataPoint(ts, proto.getJsonV()); + String jsonV = proto.getJsonV(); + if (jsonV.length() < stringCompressionLengthThreshold) { + return new JsonDataPoint(ts, jsonV); + } else { + return new CompressedJsonDataPoint(ts, compress(jsonV)); + } } else if (proto.hasCompressedJsonV()) { return new CompressedJsonDataPoint(ts, proto.getCompressedJsonV().toByteArray()); } else { From 661e7eaa415ce5ad9c65bffeb1d5d3c44b0a55b0 Mon Sep 17 00:00:00 2001 From: Andrii Landiak Date: Thu, 10 Apr 2025 12:04:47 +0300 Subject: [PATCH 230/286] Fix cf check --- .../server/common/data/sync/ie/EntityExportData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/EntityExportData.java b/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/EntityExportData.java index 072be6acf2..a1692aef04 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/EntityExportData.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/sync/ie/EntityExportData.java @@ -107,7 +107,7 @@ public class EntityExportData> { @JsonIgnore public boolean hasCalculatedFields() { - return calculatedFields != null; + return calculatedFields != null && !calculatedFields.isEmpty(); } } From 1ee635ddd8ca11286fb20018e1248464af2c0a2d Mon Sep 17 00:00:00 2001 From: Dmytro Skarzhynets Date: Thu, 10 Apr 2025 12:19:37 +0300 Subject: [PATCH 231/286] Improve hint for processing settings block in save nodes --- ui-ngx/src/assets/locale/locale.constant-en_US.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 2f93a48aa4..27e2e319d7 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -5258,7 +5258,7 @@ "advanced-mode": "Advanced", "save-time-series": { "processing-settings": "Processing settings", - "processing-settings-hint": "Define how incoming messages are processed. In Basic mode, select a preconfigured processing strategy or enable only WebSocket updates. Advanced mode allows you to select individual processing strategies for each action.", + "processing-settings-hint": "Define how incoming messages are processed. Basic processing settings allow you to select preconfigured strategies, while Advanced settings allow you to select individual processing strategies for each action.", "advanced-settings-hint": "Be cautious when configuring processing strategies. Certain combinations can lead to unexpected behavior.", "strategy": "Strategy", "deduplication-interval": "Deduplication interval", @@ -5277,7 +5277,7 @@ }, "save-attribute": { "processing-settings": "Processing settings", - "processing-settings-hint": "Define how incoming messages are processed. In Basic mode, select a preconfigured processing strategy or enable only WebSocket updates. Advanced mode allows you to select individual processing strategies for each action.", + "processing-settings-hint": "Define how incoming messages are processed. Basic processing settings allow you to select preconfigured strategies, while Advanced settings allow you to select individual processing strategies for each action.", "advanced-settings-hint": "Be cautious when configuring processing strategies. Certain combinations can lead to unexpected behavior.", "strategy": "Strategy", "deduplication-interval": "Deduplication interval", From 7d4ccad788a46e388c91306cb0d43392e8860787 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 10 Apr 2025 13:20:33 +0300 Subject: [PATCH 232/286] UI: New map widgets - introduce preserveAspectRatio option for shape image fill settings. --- .../lib/maps/data-layer/shapes-data-layer.ts | 34 ++++++++++++++----- .../widget/lib/maps/leaflet/leaflet-tb.ts | 10 +++++- ...e-fill-image-settings-panel.component.html | 5 +++ ...ape-fill-image-settings-panel.component.ts | 3 ++ ...pe-fill-stripe-settings-panel.component.ts | 2 +- .../shape-fill-stripe-settings.component.ts | 6 ++-- .../shared/models/widget/maps/map.models.ts | 4 +++ .../widget/lib/map/shape_fill_image_fn.md | 2 ++ .../assets/locale/locale.constant-en_US.json | 1 + ui-ngx/src/typings/leaflet-extend-tb.d.ts | 9 +++-- 10 files changed, 60 insertions(+), 16 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/shapes-data-layer.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/shapes-data-layer.ts index c742f152d4..93502588b1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/shapes-data-layer.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/data-layer/shapes-data-layer.ts @@ -49,9 +49,10 @@ interface ShapePatternInfo { image: string; width: number; height: number; - opacity?: number; - angle?: number; - scale?: number; + preserveAspectRatio: boolean; + opacity: number; + angle: number; + scale: number; }; fillStripe?: { weight: number; @@ -122,23 +123,35 @@ abstract class ShapePatternProcessor { fillOpacity: 1, stroke: false, fill: true, fillColor: patternInfo.fillColor}); pattern.addElement(fillRect); } else if (patternInfo.type === ShapeFillType.image) { - pattern = new L.TB.Pattern({ + const patternOptions: L.TB.PatternOptions = { width: 1, height: 1, patternUnits: 'objectBoundingBox', patternContentUnits: 'objectBoundingBox', - preserveAspectRatioAlign: 'xMidYMid', - preserveAspectRatioMeetOrSlice: 'slice', viewBox: [0,0,patternInfo.fillImage.width,patternInfo.fillImage.height] - }); - const imagePatternShape = new L.TB.PatternImage({ + }; + if (patternInfo.fillImage.preserveAspectRatio) { + patternOptions.preserveAspectRatioAlign = 'xMidYMid'; + patternOptions.preserveAspectRatioMeetOrSlice = 'slice'; + } else { + patternOptions.preserveAspectRatioAlign = 'none'; + } + pattern = new L.TB.Pattern(patternOptions); + const imagePatternOptions: L.TB.PatternImageOptions = { imageUrl: patternInfo.fillImage.image, width: patternInfo.fillImage.width, height: patternInfo.fillImage.height, opacity: patternInfo.fillImage.opacity, angle: patternInfo.fillImage.angle, scale: patternInfo.fillImage.scale - }); + }; + if (patternInfo.fillImage.preserveAspectRatio) { + imagePatternOptions.preserveAspectRatioAlign = 'xMidYMid'; + imagePatternOptions.preserveAspectRatioMeetOrSlice = 'slice'; + } else { + imagePatternOptions.preserveAspectRatioAlign = 'none'; + } + const imagePatternShape = new L.TB.PatternImage(imagePatternOptions); pattern.addElement(imagePatternShape); } else if (patternInfo.type === ShapeFillType.stripe) { const stripeInfo = patternInfo.fillStripe; @@ -221,6 +234,7 @@ class ShapeImagePatternProcessor extends ShapePatternProcessor { const imageUrl = image?.url || '/assets/widget-preview-empty.svg'; + const preserveAspectRatio = isDefinedAndNotNull(image?.preserveAspectRatio) ? image.preserveAspectRatio : true; const opacity = isDefinedAndNotNull(image?.opacity) ? image.opacity : 1; const imagePipe = this.dataLayer.getCtx().$injector.get(ImagePipe); return loadImageWithAspect(imagePipe, imageUrl).pipe( @@ -241,6 +256,7 @@ class ShapeImagePatternProcessor extends ShapePatternProcessor implements L this._dom.setAttribute('y', '0'); this._dom.setAttribute('width', `${options.width}`); this._dom.setAttribute('height', `${options.height}`); - this._dom.setAttribute('preserveAspectRatio', 'xMidYMid slice'); + if (options.preserveAspectRatioAlign) { + let preserveAspectRatioValue = options.preserveAspectRatioAlign; + if (preserveAspectRatioValue !== 'none' && options.preserveAspectRatioMeetOrSlice) { + preserveAspectRatioValue += (' ' + options.preserveAspectRatioMeetOrSlice); + } + dom.setAttribute('preserveAspectRatio', preserveAspectRatioValue); + } else { + dom.removeAttribute('preserveAspectRatio'); + } const transforms: string[] = []; if (options.angle) { transforms.push(`rotate(${options.angle})`); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html index 660f43a75d..d2782d67cb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.html @@ -30,6 +30,11 @@
    +
    + + {{ 'widgets.maps.data-layer.shape.preserve-aspect-ratio' | translate }} + +
    widgets.maps.data-layer.shape.opacity
    diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.ts index 0d14c5f81c..fef64d2e44 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-image-settings-panel.component.ts @@ -53,6 +53,7 @@ export class ShapeFillImageSettingsPanelComponent implements OnInit { { type: [this.shapeFillImageSettings?.type || ShapeFillImageType.image, []], image: [this.shapeFillImageSettings?.image, [Validators.required]], + preserveAspectRatio: [this.shapeFillImageSettings?.preserveAspectRatio, []], opacity: [this.shapeFillImageSettings?.opacity, [Validators.min(0), Validators.max(1)]], angle: [this.shapeFillImageSettings?.angle, [Validators.min(0), Validators.max(360)]], scale: [this.shapeFillImageSettings?.scale, [Validators.min(0)]], @@ -83,6 +84,7 @@ export class ShapeFillImageSettingsPanelComponent implements OnInit { const type: ShapeFillImageType = this.shapeFillImageSettingsFormGroup.get('type').value; if (type === ShapeFillImageType.image) { this.shapeFillImageSettingsFormGroup.get('image').enable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('preserveAspectRatio').enable({emitEvent: false}); this.shapeFillImageSettingsFormGroup.get('opacity').enable({emitEvent: false}); this.shapeFillImageSettingsFormGroup.get('angle').enable({emitEvent: false}); this.shapeFillImageSettingsFormGroup.get('scale').enable({emitEvent: false}); @@ -90,6 +92,7 @@ export class ShapeFillImageSettingsPanelComponent implements OnInit { this.shapeFillImageSettingsFormGroup.get('images').disable({emitEvent: false}); } else { this.shapeFillImageSettingsFormGroup.get('image').disable({emitEvent: false}); + this.shapeFillImageSettingsFormGroup.get('preserveAspectRatio').disable({emitEvent: false}); this.shapeFillImageSettingsFormGroup.get('opacity').disable({emitEvent: false}); this.shapeFillImageSettingsFormGroup.get('angle').disable({emitEvent: false}); this.shapeFillImageSettingsFormGroup.get('scale').disable({emitEvent: false}); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.ts index c9df56338b..86d1ae67fd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings-panel.component.ts @@ -97,7 +97,7 @@ export class ShapeFillStripeSettingsPanelComponent implements OnInit { private updatePreview() { const shapeFillStripeSettings: ShapeFillStripeSettings = this.shapeFillStripeSettingsFormGroup.value; - const previewUrl = generateStripePreviewUrl(shapeFillStripeSettings); + const previewUrl = generateStripePreviewUrl(shapeFillStripeSettings, 136, 118); this.stripePreviewStyle = { background: this.sanitizer.bypassSecurityTrustStyle(`url(${previewUrl}) no-repeat 50% 50% / cover`) }; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.ts index 63b2b4b212..678d57b1e3 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/common/map/shape-fill-stripe-settings.component.ts @@ -126,15 +126,15 @@ export class ShapeFillStripeSettingsComponent implements ControlValueAccessor { } } -export const generateStripePreviewUrl = (settings: ShapeFillStripeSettings): string => { +export const generateStripePreviewUrl = (settings: ShapeFillStripeSettings, previewWidth = 48, previewHeight = 48): string => { const weight = isDefinedAndNotNull(settings?.weight) ? settings.weight : 3; const spaceWeight = isDefinedAndNotNull(settings?.spaceWeight) ? settings.spaceWeight : 9; const angle = isDefinedAndNotNull(settings?.angle) ? settings.angle : 45; const height = weight + spaceWeight; const color = settings?.color?.color || '#8f8f8f'; const spaceColor = settings?.spaceColor?.color || 'rgba(143,143,143,0)'; - const svgStr = ` - + const svgStr = ` + diff --git a/ui-ngx/src/app/shared/models/widget/maps/map.models.ts b/ui-ngx/src/app/shared/models/widget/maps/map.models.ts index e09d5e5756..0468fe1fab 100644 --- a/ui-ngx/src/app/shared/models/widget/maps/map.models.ts +++ b/ui-ngx/src/app/shared/models/widget/maps/map.models.ts @@ -501,6 +501,7 @@ export enum ShapeFillImageType { export interface ShapeFillImageSettings { type: ShapeFillImageType; image?: string; + preserveAspectRatio?: boolean; opacity?: number; // (0-1) angle?: number; // (0-360) scale?: number; // (0-...) @@ -550,6 +551,7 @@ export const defaultBasePolygonsDataLayerSettings = (mapType: MapType): Partial< fillImage: { type: ShapeFillImageType.image, image: '/assets/widget-preview-empty.svg', + preserveAspectRatio: true, opacity: 1, angle: 0, scale: 1 @@ -600,6 +602,7 @@ export const defaultBaseCirclesDataLayerSettings = (mapType: MapType): Partial Date: Thu, 10 Apr 2025 13:37:30 +0300 Subject: [PATCH 233/286] Updated gateway image version to stable (#13157) --- application/src/main/resources/thingsboard.yml | 2 +- .../controller/DeviceConnectivityControllerTest.java | 8 ++++++-- .../server/dao/device/DeviceConnectivityServiceImpl.java | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index b4d178a737..716797c2d2 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1423,7 +1423,7 @@ device: pem_cert_file: "${DEVICE_CONNECTIVITY_COAPS_CA_ROOT_CERT:cafile.pem}" gateway: # The docker tag for thingsboard/tb-gateway image used in docker-compose file for gateway launch - image_version: "${DEVICE_CONNECTIVITY_GATEWAY_IMAGE_VERSION:latest}" + image_version: "${DEVICE_CONNECTIVITY_GATEWAY_IMAGE_VERSION:3.7-stable}" # Edges parameters edges: diff --git a/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java index cb475d7f16..4ccf40415d 100644 --- a/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/DeviceConnectivityControllerTest.java @@ -23,6 +23,7 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.springframework.beans.factory.annotation.Value; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.TestPropertySource; import org.thingsboard.common.util.JacksonUtil; @@ -94,6 +95,9 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { private DeviceProfileId mqttDeviceProfileId; private DeviceProfileId coapDeviceProfileId; + @Value("${device.connectivity.gateway.image_version:3.7-stable}") + private String gatewayImageVersion; + @Before public void beforeTest() throws Exception { loginSysAdmin(); @@ -298,7 +302,7 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { "services:\n" + " # ThingsBoard IoT Gateway Service Configuration\n" + " tb-gateway:\n" + - " image: thingsboard/tb-gateway:latest\n" + + " image: thingsboard/tb-gateway:" + gatewayImageVersion + "\n" + " container_name: tb-gateway\n" + " restart: always\n" + "\n" + @@ -847,7 +851,7 @@ public class DeviceConnectivityControllerTest extends AbstractControllerTest { "-t \"application/json\" -e \"{temperature:25}\" coap://test.domain:5683/api/v1/%s/telemetry", credentials.getCredentialsId())); assertThat(linuxCoapCommands.get(COAPS).get(0).asText()).isEqualTo("curl -f -S -o " + CA_ROOT_CERT_PEM + " http://localhost:80/api/device-connectivity/coaps/certificate/download"); assertThat(linuxCoapCommands.get(COAPS).get(1).asText()).isEqualTo(String.format("coap-client-openssl -v 6 -m POST " + - "-R "+ CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://test.domain:5684/api/v1/%s/telemetry", credentials.getCredentialsId())); + "-R " + CA_ROOT_CERT_PEM + " -t \"application/json\" -e \"{temperature:25}\" coaps://test.domain:5684/api/v1/%s/telemetry", credentials.getCredentialsId())); JsonNode dockerCoapCommands = commands.get(COAP).get(DOCKER); assertThat(dockerCoapCommands.get(COAP).asText()).isEqualTo(String.format("docker run --rm -it " + 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 eb7ce56b9f..6f22e95c87 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 @@ -85,7 +85,7 @@ public class DeviceConnectivityServiceImpl implements DeviceConnectivityService private String mqttsPemCertFile; @Value("${device.connectivity.coaps.pem_cert_file:}") private String coapsPemCertFile; - @Value("${device.connectivity.gateway.image_version:latest}") + @Value("${device.connectivity.gateway.image_version:3.7-stable}") private String gatewayImageVersion; @Override From b806a41e62d473df72a1e2c04b1536d29690a717 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Thu, 10 Apr 2025 14:02:56 +0300 Subject: [PATCH 234/286] More stats for EDQS --- .../server/edqs/data/BaseEntityData.java | 2 +- .../edqs/data/dp/CompressedJsonDataPoint.java | 6 +- .../data/dp/CompressedStringDataPoint.java | 10 +- .../edqs/repo/DefaultEdqsRepository.java | 9 +- .../server/edqs/repo/TenantRepo.java | 2 - .../edqs/stats/DefaultEdqsStatsService.java | 93 ++++++++++++++----- .../server/edqs/util/EdqsConverter.java | 29 ++++-- .../common/stats/DefaultStatsFactory.java | 11 +++ .../common/stats/DummyEdqsStatsService.java | 16 +++- .../server/common/stats/EdqsStatsService.java | 12 ++- .../server/common/stats/StatsFactory.java | 6 ++ .../thingsboard/common/util/TbBytePool.java | 6 +- .../thingsboard/common/util/TbStringPool.java | 6 +- .../server/dao/entity/BaseEntityService.java | 9 +- edqs/src/main/resources/edqs.yml | 2 + 15 files changed, 158 insertions(+), 61 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java index 33f32b9781..21b9ff0c4f 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/BaseEntityData.java @@ -125,7 +125,7 @@ public abstract class BaseEntityData implements EntityDa return switch (key) { case "createdTime" -> new LongDataPoint(System.currentTimeMillis(), fields.getCreatedTime()); case "edgeTemplate" -> new BoolDataPoint(System.currentTimeMillis(), fields.isEdgeTemplate()); - case "parentId" -> new StringDataPoint(System.currentTimeMillis(), getRelatedParentId(ctx)); + case "parentId" -> new StringDataPoint(System.currentTimeMillis(), getRelatedParentId(ctx), false); default -> new StringDataPoint(System.currentTimeMillis(), getField(key), false); }; } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedJsonDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedJsonDataPoint.java index bce9d86875..c05a724e79 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedJsonDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedJsonDataPoint.java @@ -17,10 +17,12 @@ package org.thingsboard.server.edqs.data.dp; import org.thingsboard.server.common.data.kv.DataType; +import java.util.function.Function; + public class CompressedJsonDataPoint extends CompressedStringDataPoint { - public CompressedJsonDataPoint(long ts, byte[] compressedValue) { - super(ts, compressedValue); + public CompressedJsonDataPoint(long ts, byte[] compressedValue, Function uncompressor) { + super(ts, compressedValue, uncompressor); } @Override diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java index cf4267e443..45db6bf72a 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/data/dp/CompressedStringDataPoint.java @@ -19,17 +19,21 @@ import lombok.Getter; import lombok.SneakyThrows; import org.thingsboard.common.util.TbBytePool; import org.thingsboard.server.common.data.kv.DataType; -import org.xerial.snappy.Snappy; + +import java.util.function.Function; public class CompressedStringDataPoint extends AbstractDataPoint { @Getter private final byte[] compressedValue; + protected final Function uncompressor; + @SneakyThrows - public CompressedStringDataPoint(long ts, byte[] compressedValue) { + public CompressedStringDataPoint(long ts, byte[] compressedValue, Function uncompressor) { super(ts); this.compressedValue = TbBytePool.intern(compressedValue); + this.uncompressor = uncompressor; } @Override @@ -40,7 +44,7 @@ public class CompressedStringDataPoint extends AbstractDataPoint { @SneakyThrows @Override public String getStr() { - return Snappy.uncompressString(compressedValue); + return uncompressor.apply(compressedValue); } @Override diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java index 215c64194f..88e4cc63d2 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/DefaultEdqsRepository.java @@ -16,6 +16,7 @@ package org.thingsboard.server.edqs.repo; import lombok.AllArgsConstructor; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.ObjectType; @@ -40,6 +41,7 @@ import java.util.function.Predicate; @Slf4j public class DefaultEdqsRepository implements EdqsRepository { + @Getter private final static ConcurrentMap repos = new ConcurrentHashMap<>(); private final EdqsStatsService statsService; @@ -52,6 +54,7 @@ public class DefaultEdqsRepository implements EdqsRepository { if (event.getEventType() == EdqsEventType.DELETED && event.getObjectType() == ObjectType.TENANT) { log.info("Tenant {} deleted", event.getTenantId()); repos.remove(event.getTenantId()); + statsService.reportRemoved(ObjectType.TENANT); } else { get(event.getTenantId()).processEvent(event); } @@ -61,8 +64,7 @@ public class DefaultEdqsRepository implements EdqsRepository { public long countEntitiesByQuery(TenantId tenantId, CustomerId customerId, EntityCountQuery query, boolean ignorePermissionCheck) { long startNs = System.nanoTime(); long result = get(tenantId).countEntitiesByQuery(customerId, query, ignorePermissionCheck); - double timingMs = (double) (System.nanoTime() - startNs) / 1000_000; - log.info("countEntitiesByQuery done in {} ms", timingMs); + statsService.reportEdqsCountQuery(tenantId, query, System.nanoTime() - startNs); return result; } @@ -71,8 +73,7 @@ public class DefaultEdqsRepository implements EdqsRepository { EntityDataQuery query, boolean ignorePermissionCheck) { long startNs = System.nanoTime(); var result = get(tenantId).findEntityDataByQuery(customerId, query, ignorePermissionCheck); - double timingMs = (double) (System.nanoTime() - startNs) / 1000_000; - log.info("findEntityDataByQuery done in {} ms", timingMs); + statsService.reportEdqsDataQuery(tenantId, query, System.nanoTime() - startNs); return result; } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java index a47559d6d8..ffba7583c9 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/repo/TenantRepo.java @@ -332,7 +332,6 @@ public class TenantRepo { public PageData findEntityDataByQuery(CustomerId customerId, EntityDataQuery oldQuery, boolean ignorePermissionCheck) { EdqsDataQuery query = RepositoryUtils.toNewQuery(oldQuery); - log.info("[{}][{}] findEntityDataByQuery: {}", tenantId, customerId, query); QueryContext ctx = buildContext(customerId, query.getEntityFilter(), ignorePermissionCheck); EntityQueryProcessor queryProcessor = EntityQueryProcessorFactory.create(this, ctx, query); return sortAndConvert(query, queryProcessor.processQuery(), ctx); @@ -340,7 +339,6 @@ public class TenantRepo { public long countEntitiesByQuery(CustomerId customerId, EntityCountQuery oldQuery, boolean ignorePermissionCheck) { EdqsQuery query = RepositoryUtils.toNewQuery(oldQuery); - log.info("[{}][{}] countEntitiesByQuery: {}", tenantId, customerId, query); QueryContext ctx = buildContext(customerId, query.getEntityFilter(), ignorePermissionCheck); EntityQueryProcessor queryProcessor = EntityQueryProcessorFactory.create(this, ctx, query); return queryProcessor.count(); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java index 3767d0f60b..46fb153771 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java @@ -15,78 +15,123 @@ */ package org.thingsboard.server.edqs.stats; +import jakarta.annotation.PostConstruct; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; +import org.thingsboard.common.util.TbBytePool; +import org.thingsboard.common.util.TbStringPool; import org.thingsboard.server.common.data.ObjectType; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.query.EntityCountQuery; import org.thingsboard.server.common.data.query.EntityDataQuery; import org.thingsboard.server.common.stats.EdqsStatsService; +import org.thingsboard.server.common.stats.StatsCounter; import org.thingsboard.server.common.stats.StatsFactory; import org.thingsboard.server.common.stats.StatsTimer; import org.thingsboard.server.common.stats.StatsType; +import org.thingsboard.server.edqs.repo.DefaultEdqsRepository; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @Service @Slf4j +@RequiredArgsConstructor @ConditionalOnExpression("'${queue.edqs.api.supported:true}' == 'true' && '${queue.edqs.stats.enabled:true}' == 'true'") public class DefaultEdqsStatsService implements EdqsStatsService { private final StatsFactory statsFactory; - @Value("${queue.edqs.stats.slow_query_threshold:3000}") + @Value("${queue.edqs.stats.slow_query_threshold}") private int slowQueryThreshold; - private final ConcurrentHashMap objectCounters = new ConcurrentHashMap<>(); - private final StatsTimer dataQueryTimer; - private final StatsTimer countQueryTimer; + private final ConcurrentMap objectCounters = new ConcurrentHashMap<>(); + private final ConcurrentMap timers = new ConcurrentHashMap<>(); + private final ConcurrentMap counters = new ConcurrentHashMap<>(); + private final ConcurrentMap gauges = new ConcurrentHashMap<>(); - private DefaultEdqsStatsService(StatsFactory statsFactory) { - this.statsFactory = statsFactory; - dataQueryTimer = statsFactory.createTimer(StatsType.EDQS, "entityDataQueryTimer"); - countQueryTimer = statsFactory.createTimer(StatsType.EDQS, "entityCountQueryTimer"); + @PostConstruct + private void init() { + statsFactory.createGauge(StatsType.EDQS, "stringPoolSize", TbStringPool.getPool(), Map::size); + statsFactory.createGauge(StatsType.EDQS, "bytePoolSize", TbBytePool.getPool(), Map::size); + statsFactory.createGauge(StatsType.EDQS, "tenantReposSize", DefaultEdqsRepository.getRepos(), Map::size); } @Override public void reportAdded(ObjectType objectType) { - getObjectCounter(objectType).incrementAndGet(); + getObjectGauge(objectType).incrementAndGet(); } @Override public void reportRemoved(ObjectType objectType) { - getObjectCounter(objectType).decrementAndGet(); + getObjectGauge(objectType).decrementAndGet(); } @Override - public void reportDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) { - double timingMs = timingNanos / 1000_000.0; - if (timingMs < slowQueryThreshold) { - log.debug("[{}] Executed data query in {} ms: {}", tenantId, timingMs, query); - } else { - log.warn("[{}] Executed slow data query in {} ms: {}", tenantId, timingMs, query); - } - dataQueryTimer.record(timingNanos, TimeUnit.NANOSECONDS); + public void reportEntityDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) { + checkTiming(tenantId, query, timingNanos); + getTimer("entityDataQueryTimer").record(timingNanos, TimeUnit.NANOSECONDS); + } + + @Override + public void reportEntityCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) { + checkTiming(tenantId, query, timingNanos); + getTimer("entityCountQueryTimer").record(timingNanos, TimeUnit.NANOSECONDS); + } + + @Override + public void reportEdqsDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) { + checkTiming(tenantId, query, timingNanos); + getTimer("edqsDataQueryTimer").record(timingNanos, TimeUnit.NANOSECONDS); + } + + @Override + public void reportEdqsCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) { + checkTiming(tenantId, query, timingNanos); + getTimer("edqsCountQueryTimer").record(timingNanos, TimeUnit.NANOSECONDS); + } + + @Override + public void reportStringCompressed() { + getCounter("stringsCompressed").increment(); } @Override - public void reportCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) { + public void reportStringUncompressed() { + getCounter("stringsUncompressed").increment(); + } + + private void checkTiming(TenantId tenantId, EntityCountQuery query, long timingNanos) { double timingMs = timingNanos / 1000_000.0; + String queryType = query instanceof EntityDataQuery ? "data" : "count"; if (timingMs < slowQueryThreshold) { - log.debug("[{}] Executed count query in {} ms: {}", tenantId, timingMs, query); + log.debug("[{}] Executed " + queryType + " query in {} ms: {}", tenantId, timingMs, query); } else { - log.warn("[{}] Executed slow count query in {} ms: {}", tenantId, timingMs, query); + log.warn("[{}] Executed slow " + queryType + " query in {} ms: {}", tenantId, timingMs, query); } - countQueryTimer.record(timingNanos, TimeUnit.NANOSECONDS); } - private AtomicInteger getObjectCounter(ObjectType objectType) { + private StatsTimer getTimer(String name) { + return timers.computeIfAbsent(name, __ -> statsFactory.createTimer(StatsType.EDQS, name)); + } + + private StatsCounter getCounter(String name) { + return counters.computeIfAbsent(name, __ -> statsFactory.createStatsCounter(StatsType.EDQS.getName(), name)); + } + + private AtomicInteger getGauge(String name) { + return gauges.computeIfAbsent(name, __ -> statsFactory.createGauge(StatsType.EDQS, name, new AtomicInteger())); + } + + private AtomicInteger getObjectGauge(ObjectType objectType) { return objectCounters.computeIfAbsent(objectType, type -> - statsFactory.createGauge("edqsObjectsCount", new AtomicInteger(), "objectType", type.name())); + statsFactory.createGauge(StatsType.EDQS, "objectsCount", new AtomicInteger(), "objectType", type.name())); } } diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java index 18e2f521e3..9a84436f36 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/util/EdqsConverter.java @@ -43,6 +43,7 @@ import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.EntityIdFactory; import org.thingsboard.server.common.data.kv.KvEntry; import org.thingsboard.server.common.data.relation.EntityRelation; +import org.thingsboard.server.common.stats.EdqsStatsService; import org.thingsboard.server.common.util.ProtoUtils; import org.thingsboard.server.edqs.data.dp.BoolDataPoint; import org.thingsboard.server.edqs.data.dp.CompressedJsonDataPoint; @@ -56,14 +57,18 @@ import org.thingsboard.server.gen.transport.TransportProtos.DataPointProto; import org.xerial.snappy.Snappy; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.UUID; @Service +@RequiredArgsConstructor @Slf4j public class EdqsConverter { + private final EdqsStatsService edqsStatsService; + @Value("${queue.edqs.string_compression_length_threshold:512}") private int stringCompressionLengthThreshold; @@ -175,32 +180,40 @@ public class EdqsConverter { if (stringV.length() < stringCompressionLengthThreshold) { return new StringDataPoint(ts, stringV); } else { - return new CompressedStringDataPoint(ts, compress(stringV)); + return new CompressedStringDataPoint(ts, compress(stringV), this::uncompress); } } else if (proto.hasCompressedStringV()) { - return new CompressedStringDataPoint(ts, proto.getCompressedStringV().toByteArray()); + return new CompressedStringDataPoint(ts, proto.getCompressedStringV().toByteArray(), this::uncompress); } else if (proto.hasJsonV()) { String jsonV = proto.getJsonV(); if (jsonV.length() < stringCompressionLengthThreshold) { return new JsonDataPoint(ts, jsonV); } else { - return new CompressedJsonDataPoint(ts, compress(jsonV)); + return new CompressedJsonDataPoint(ts, compress(jsonV), this::uncompress); } } else if (proto.hasCompressedJsonV()) { - return new CompressedJsonDataPoint(ts, proto.getCompressedJsonV().toByteArray()); + return new CompressedJsonDataPoint(ts, proto.getCompressedJsonV().toByteArray(), this::uncompress); } else { throw new IllegalArgumentException("Unsupported data point proto: " + proto); } } @SneakyThrows - private static byte[] compress(String value) { - byte[] compressed = Snappy.compress(value); - // TODO: limit the size - log.debug("Compressed {} bytes to {} bytes", value.length(), compressed.length); + private byte[] compress(String value) { + byte[] compressed = Snappy.compress(value, StandardCharsets.UTF_8); + log.debug("Compressed {} chars to {} bytes", value.length(), compressed.length); + edqsStatsService.reportStringCompressed(); return compressed; } + @SneakyThrows + private String uncompress(byte[] compressed) { + String value = Snappy.uncompressString(compressed, StandardCharsets.UTF_8); + log.debug("Uncompressed {} bytes to {} chars", compressed.length, value.length()); + edqsStatsService.reportStringUncompressed(); + return value; + } + public static Entity toEntity(EntityType entityType, Object entity) { Entity edqsEntity = new Entity(); edqsEntity.setType(entityType); diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java index 8e2291270d..15c155ecfd 100644 --- a/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java @@ -27,6 +27,7 @@ import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.StringUtils; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.ToDoubleFunction; @Service public class DefaultStatsFactory implements StatsFactory { @@ -86,6 +87,16 @@ public class DefaultStatsFactory implements StatsFactory { return meterRegistry.gauge(key, Tags.of(tags), number); } + @Override + public T createGauge(StatsType statsType, String name, T number, String... tags) { + return createGauge(statsType.getName(), number, getTags(name, tags)); + } + + @Override + public void createGauge(StatsType statsType, String name, S stateObject, ToDoubleFunction numberProvider, String... tags) { + meterRegistry.gauge(statsType.getName(), Tags.of(getTags(name, tags)), stateObject, numberProvider); + } + @Override public MessagesStats createMessagesStats(String key) { StatsCounter totalCounter = createStatsCounter(key, TOTAL_MSGS); diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java index df78e5fc89..3db1c6c790 100644 --- a/common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/DummyEdqsStatsService.java @@ -33,9 +33,21 @@ public class DummyEdqsStatsService implements EdqsStatsService { public void reportRemoved(ObjectType objectType) {} @Override - public void reportDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) {} + public void reportEntityDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) {} @Override - public void reportCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) {} + public void reportEntityCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) {} + + @Override + public void reportEdqsDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos) {} + + @Override + public void reportEdqsCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos) {} + + @Override + public void reportStringCompressed() {} + + @Override + public void reportStringUncompressed() {} } diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java index 106e43e913..3a6eeb26b8 100644 --- a/common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/EdqsStatsService.java @@ -26,8 +26,16 @@ public interface EdqsStatsService { void reportRemoved(ObjectType objectType); - void reportDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos); + void reportEntityDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos); - void reportCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos); + void reportEntityCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos); + + void reportEdqsDataQuery(TenantId tenantId, EntityDataQuery query, long timingNanos); + + void reportEdqsCountQuery(TenantId tenantId, EntityCountQuery query, long timingNanos); + + void reportStringCompressed(); + + void reportStringUncompressed(); } diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java index bd46c09285..e438af3ad7 100644 --- a/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java @@ -17,6 +17,8 @@ package org.thingsboard.server.common.stats; import io.micrometer.core.instrument.Timer; +import java.util.function.ToDoubleFunction; + public interface StatsFactory { StatsCounter createStatsCounter(String key, String statsName, String... otherTags); @@ -25,6 +27,10 @@ public interface StatsFactory { T createGauge(String key, T number, String... tags); + T createGauge(StatsType statsType, String name, T number, String... tags); + + void createGauge(StatsType statsType, String name, S stateObject, ToDoubleFunction numberProvider, String... tags); + MessagesStats createMessagesStats(String key); Timer createTimer(String key, String... tags); diff --git a/common/util/src/main/java/org/thingsboard/common/util/TbBytePool.java b/common/util/src/main/java/org/thingsboard/common/util/TbBytePool.java index fe16a14e7c..1aadb49129 100644 --- a/common/util/src/main/java/org/thingsboard/common/util/TbBytePool.java +++ b/common/util/src/main/java/org/thingsboard/common/util/TbBytePool.java @@ -16,12 +16,14 @@ package org.thingsboard.common.util; import com.google.common.hash.Hashing; +import lombok.Getter; import org.springframework.util.ConcurrentReferenceHashMap; import java.util.concurrent.ConcurrentMap; public class TbBytePool { + @Getter private static final ConcurrentMap pool = new ConcurrentReferenceHashMap<>(); public static byte[] intern(byte[] data) { @@ -32,8 +34,4 @@ public class TbBytePool { return pool.computeIfAbsent(checksum, c -> data); } - public static int size(){ - return pool.size(); - } - } diff --git a/common/util/src/main/java/org/thingsboard/common/util/TbStringPool.java b/common/util/src/main/java/org/thingsboard/common/util/TbStringPool.java index 38c010fbd3..167bf1bbed 100644 --- a/common/util/src/main/java/org/thingsboard/common/util/TbStringPool.java +++ b/common/util/src/main/java/org/thingsboard/common/util/TbStringPool.java @@ -15,12 +15,14 @@ */ package org.thingsboard.common.util; +import lombok.Getter; import org.springframework.util.ConcurrentReferenceHashMap; import java.util.concurrent.ConcurrentMap; public class TbStringPool { + @Getter private static final ConcurrentMap pool = new ConcurrentReferenceHashMap<>(); public static String intern(String data) { @@ -30,8 +32,4 @@ public class TbStringPool { return pool.computeIfAbsent(data, str -> str); } - public static int size(){ - return pool.size(); - } - } diff --git a/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java b/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java index 4df33779ee..ee9320cce3 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java @@ -20,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import org.thingsboard.common.util.TbStopWatch; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.HasCustomerId; import org.thingsboard.server.common.data.HasEmail; @@ -101,7 +100,7 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe validateId(customerId, id -> INCORRECT_CUSTOMER_ID + id); validateEntityCountQuery(query); - TbStopWatch stopWatch = TbStopWatch.create(); + long startNs = System.nanoTime(); Long result; if (edqsApiService.isEnabled() && validForEdqs(query) && !tenantId.isSysTenantId()) { EdqsRequest request = EdqsRequest.builder() @@ -112,7 +111,7 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe } else { result = entityQueryDao.countEntitiesByQuery(tenantId, customerId, query); } - edqsStatsService.reportCountQuery(tenantId, query, stopWatch.stopAndGetTotalTimeNanos()); + edqsStatsService.reportEntityCountQuery(tenantId, query, System.nanoTime() - startNs); return result; } @@ -123,7 +122,7 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe validateId(customerId, id -> INCORRECT_CUSTOMER_ID + id); validateEntityDataQuery(query); - TbStopWatch stopWatch = TbStopWatch.create(); + long startNs = System.nanoTime(); PageData result; if (edqsApiService.isEnabled() && validForEdqs(query)) { EdqsRequest request = EdqsRequest.builder() @@ -146,7 +145,7 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe } } } - edqsStatsService.reportDataQuery(tenantId, query, stopWatch.stopAndGetTotalTimeNanos()); + edqsStatsService.reportEntityDataQuery(tenantId, query, System.nanoTime() - startNs); return result; } diff --git a/edqs/src/main/resources/edqs.yml b/edqs/src/main/resources/edqs.yml index 8ea40c03c8..1cc32a4230 100644 --- a/edqs/src/main/resources/edqs.yml +++ b/edqs/src/main/resources/edqs.yml @@ -76,6 +76,8 @@ queue: stats: # Enable/disable statistics for EDQS enabled: "${TB_EDQS_STATS_ENABLED:true}" + # Threshold for slow queries to log, in milliseconds + slow_query_threshold: "${TB_EDQS_SLOW_QUERY_THRESHOLD_MS:200}" kafka: # Kafka Bootstrap nodes in "host:port" format From d175a11c07d8d77b479984370662cb1520a8cdc7 Mon Sep 17 00:00:00 2001 From: yevhenii Date: Thu, 10 Apr 2025 14:44:33 +0300 Subject: [PATCH 235/286] Fix RuleChainMetadata for older Edge versions - added ignored params for edge with version 3.9 - excluded TbCalculatedFieldsNode for edge with version 3.9, 3.8, 3.7 --- .../service/edge/EdgeMsgConstructorUtils.java | 15 +++++++++++++++ .../service/edge/EdgeMsgConstructorUtilsTest.java | 2 ++ 2 files changed, 17 insertions(+) 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 d996a1dbc9..5f5fd771cf 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 @@ -28,6 +28,7 @@ import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.rule.engine.action.TbSaveToCustomCassandraTableNode; import org.thingsboard.rule.engine.aws.lambda.TbAwsLambdaNode; import org.thingsboard.rule.engine.rest.TbSendRestApiCallReplyNode; +import org.thingsboard.rule.engine.telemetry.TbCalculatedFieldsNode; import org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode; import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode; import org.thingsboard.server.common.adaptor.JsonConverter; @@ -129,6 +130,11 @@ import java.util.UUID; @Slf4j public class EdgeMsgConstructorUtils { public static final Map> IGNORED_PARAMS_BY_EDGE_VERSION = Map.of( + EdgeVersion.V_3_9_0, + Map.of( + TbMsgTimeseriesNode.class.getName(), "processingSettings", + TbMsgAttributesNode.class.getName(), "processingSettings" + ), EdgeVersion.V_3_8_0, Map.of( TbMsgTimeseriesNode.class.getName(), "processingSettings", @@ -144,8 +150,17 @@ public class EdgeMsgConstructorUtils { ); public static final Map> EXCLUDED_NODES_BY_EDGE_VERSION = Map.of( + EdgeVersion.V_3_9_0, + Set.of( + TbCalculatedFieldsNode.class.getName() + ), + EdgeVersion.V_3_8_0, + Set.of( + TbCalculatedFieldsNode.class.getName() + ), EdgeVersion.V_3_7_0, Set.of( + TbCalculatedFieldsNode.class.getName(), TbSendRestApiCallReplyNode.class.getName(), TbAwsLambdaNode.class.getName() ) 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 a4c2133f1c..1ee6e31372 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 @@ -33,6 +33,7 @@ import org.thingsboard.rule.engine.math.TbMathNode; import org.thingsboard.rule.engine.metadata.CalculateDeltaNode; import org.thingsboard.rule.engine.metadata.TbGetTelemetryNode; import org.thingsboard.rule.engine.rest.TbSendRestApiCallReplyNode; +import org.thingsboard.rule.engine.telemetry.TbCalculatedFieldsNode; import org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode; import org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode; import org.thingsboard.server.common.data.rule.RuleChainMetaData; @@ -71,6 +72,7 @@ public class EdgeMsgConstructorUtilsTest { new TbMsgTimeseriesNode(), new TbSendRestApiCallReplyNode(), new TbAwsLambdaNode(), + new TbCalculatedFieldsNode(), new TbMathNode(), new CalculateDeltaNode(), From 70906101683eddb1afa178cbde0c17c543b657a9 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Thu, 10 Apr 2025 14:54:42 +0300 Subject: [PATCH 236/286] Fix EDQS stats collector names --- .../stats/HousekeeperStatsService.java | 2 +- .../edqs/stats/DefaultEdqsStatsService.java | 15 +++++++-------- .../server/common/stats/DefaultStatsFactory.java | 12 ++++++------ .../server/common/stats/StatsFactory.java | 6 +++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/housekeeper/stats/HousekeeperStatsService.java b/application/src/main/java/org/thingsboard/server/service/housekeeper/stats/HousekeeperStatsService.java index 5da5fa2be0..5946b84d09 100644 --- a/application/src/main/java/org/thingsboard/server/service/housekeeper/stats/HousekeeperStatsService.java +++ b/application/src/main/java/org/thingsboard/server/service/housekeeper/stats/HousekeeperStatsService.java @@ -106,7 +106,7 @@ public class HousekeeperStatsService { this.failedProcessingCounter = register("failedProcessing", statsFactory); this.reprocessedCounter = register("reprocessed", statsFactory); this.failedReprocessingCounter = register("failedReprocessing", statsFactory); - this.processingTimer = statsFactory.createTimer(StatsType.HOUSEKEEPER, "processingTime", "taskType", taskType.name()); + this.processingTimer = statsFactory.createStatsTimer(StatsType.HOUSEKEEPER.getName(), "processingTime", "taskType", taskType.name()); } private StatsCounter register(String statsName, StatsFactory statsFactory) { diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java index 46fb153771..4853920c44 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java @@ -31,7 +31,6 @@ import org.thingsboard.server.common.stats.EdqsStatsService; import org.thingsboard.server.common.stats.StatsCounter; import org.thingsboard.server.common.stats.StatsFactory; import org.thingsboard.server.common.stats.StatsTimer; -import org.thingsboard.server.common.stats.StatsType; import org.thingsboard.server.edqs.repo.DefaultEdqsRepository; import java.util.Map; @@ -58,9 +57,9 @@ public class DefaultEdqsStatsService implements EdqsStatsService { @PostConstruct private void init() { - statsFactory.createGauge(StatsType.EDQS, "stringPoolSize", TbStringPool.getPool(), Map::size); - statsFactory.createGauge(StatsType.EDQS, "bytePoolSize", TbBytePool.getPool(), Map::size); - statsFactory.createGauge(StatsType.EDQS, "tenantReposSize", DefaultEdqsRepository.getRepos(), Map::size); + statsFactory.createGauge("edqsGauges", "stringPoolSize", TbStringPool.getPool(), Map::size); + statsFactory.createGauge("edqsGauges", "bytePoolSize", TbBytePool.getPool(), Map::size); + statsFactory.createGauge("edqsGauges", "tenantReposSize", DefaultEdqsRepository.getRepos(), Map::size); } @Override @@ -118,20 +117,20 @@ public class DefaultEdqsStatsService implements EdqsStatsService { } private StatsTimer getTimer(String name) { - return timers.computeIfAbsent(name, __ -> statsFactory.createTimer(StatsType.EDQS, name)); + return timers.computeIfAbsent(name, __ -> statsFactory.createStatsTimer("edqsTimers", name)); } private StatsCounter getCounter(String name) { - return counters.computeIfAbsent(name, __ -> statsFactory.createStatsCounter(StatsType.EDQS.getName(), name)); + return counters.computeIfAbsent(name, __ -> statsFactory.createStatsCounter("edqsCounters", name)); } private AtomicInteger getGauge(String name) { - return gauges.computeIfAbsent(name, __ -> statsFactory.createGauge(StatsType.EDQS, name, new AtomicInteger())); + return gauges.computeIfAbsent(name, __ -> statsFactory.createGauge("edqsGauges", name, new AtomicInteger())); } private AtomicInteger getObjectGauge(ObjectType objectType) { return objectCounters.computeIfAbsent(objectType, type -> - statsFactory.createGauge(StatsType.EDQS, "objectsCount", new AtomicInteger(), "objectType", type.name())); + statsFactory.createGauge("edqsGauges", "objectsCount", new AtomicInteger(), "objectType", type.name())); } } diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java index 15c155ecfd..4d858be4bb 100644 --- a/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/DefaultStatsFactory.java @@ -88,13 +88,13 @@ public class DefaultStatsFactory implements StatsFactory { } @Override - public T createGauge(StatsType statsType, String name, T number, String... tags) { - return createGauge(statsType.getName(), number, getTags(name, tags)); + public T createGauge(String type, String name, T number, String... tags) { + return createGauge(type, number, getTags(name, tags)); } @Override - public void createGauge(StatsType statsType, String name, S stateObject, ToDoubleFunction numberProvider, String... tags) { - meterRegistry.gauge(statsType.getName(), Tags.of(getTags(name, tags)), stateObject, numberProvider); + public void createGauge(String type, String name, S stateObject, ToDoubleFunction numberProvider, String... tags) { + meterRegistry.gauge(type, Tags.of(getTags(name, tags)), stateObject, numberProvider); } @Override @@ -117,8 +117,8 @@ public class DefaultStatsFactory implements StatsFactory { } @Override - public StatsTimer createTimer(StatsType type, String name, String... tags) { - return new StatsTimer(name, Timer.builder(type.getName()) + public StatsTimer createStatsTimer(String type, String name, String... tags) { + return new StatsTimer(name, Timer.builder(type) .tags(getTags(name, tags)) .register(meterRegistry)); } diff --git a/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java b/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java index e438af3ad7..291b95e25a 100644 --- a/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java +++ b/common/stats/src/main/java/org/thingsboard/server/common/stats/StatsFactory.java @@ -27,14 +27,14 @@ public interface StatsFactory { T createGauge(String key, T number, String... tags); - T createGauge(StatsType statsType, String name, T number, String... tags); + T createGauge(String type, String name, T number, String... tags); - void createGauge(StatsType statsType, String name, S stateObject, ToDoubleFunction numberProvider, String... tags); + void createGauge(String type, String name, S stateObject, ToDoubleFunction numberProvider, String... tags); MessagesStats createMessagesStats(String key); Timer createTimer(String key, String... tags); - StatsTimer createTimer(StatsType type, String name, String... tags); + StatsTimer createStatsTimer(String type, String name, String... tags); } From b854dcf0c7242560bbb87d50f3ef6ea6e12e5df1 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 10 Apr 2025 14:59:11 +0300 Subject: [PATCH 237/286] UI: Refactoring error msg --- .../components/widget/lib/scada/scada-symbol.models.ts | 2 +- .../home/pages/scada-symbol/scada-symbol.component.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/scada/scada-symbol.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/scada/scada-symbol.models.ts index e52c6f9f54..abe570fa3c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/scada/scada-symbol.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/scada/scada-symbol.models.ts @@ -271,7 +271,7 @@ export const updateScadaSymbolMetadataInContent = (svgContent: string, metadata: const svgDoc = new DOMParser().parseFromString(svgContent, 'image/svg+xml'); const parsererror = svgDoc.getElementsByTagName('parsererror'); if (parsererror?.length) { - return parsererror[0].outerHTML; + throw Error(parsererror[0].textContent) } updateScadaSymbolMetadataInDom(svgDoc, metadata); return svgDoc.documentElement.outerHTML; diff --git a/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts b/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts index caaf0edc01..c618380565 100644 --- a/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts +++ b/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts @@ -214,10 +214,8 @@ export class ScadaSymbolComponent extends PageComponent this.editObjectCallbacks.tagsUpdated(tags); } const metadata: ScadaSymbolMetadata = this.scadaSymbolFormGroup.get('metadata').value; - const scadaSymbolContent = this.prepareScadaSymbolContent(metadata); - if (scadaSymbolContent.includes('parsererror')) { - this.store.dispatch(new ActionNotificationShow({ message: scadaSymbolContent, type: 'error' })); - } else { + try { + const scadaSymbolContent = this.prepareScadaSymbolContent(metadata); const file = createFileFromContent(scadaSymbolContent, this.symbolData.imageResource.fileName, this.symbolData.imageResource.descriptor.mediaType); const type = imageResourceType(this.symbolData.imageResource); @@ -243,6 +241,8 @@ export class ScadaSymbolComponent extends PageComponent this.init(data); this.updateBreadcrumbs.emit(); }); + } catch (e) { + this.store.dispatch(new ActionNotificationShow({ message: e.message, type: 'error' })); } } } From 6af342090e577016145a3023c04f0dd9782a6e1f Mon Sep 17 00:00:00 2001 From: Ekaterina Chantsova Date: Thu, 10 Apr 2025 15:30:20 +0300 Subject: [PATCH 238/286] Timewindow: added timezone selection in widget settings --- .../widget/config/timewindow-config-panel.component.html | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.html index ff0acd5fca..138dde324e 100644 --- a/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/config/timewindow-config-panel.component.html @@ -33,6 +33,7 @@ noMargin isEdit="true" alwaysDisplayTypePrefix + timezone="true" [historyOnly]="onlyHistoryTimewindow" quickIntervalOnly="{{ widgetType === widgetTypes.latest }}" aggregation="{{ widgetType === widgetTypes.timeseries }}" From 2abebbd352f6354d3920e207d84c21a40563ad2f Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 10 Apr 2025 15:35:25 +0300 Subject: [PATCH 239/286] UI: Improved CSS styles for copy-code button in markdown --- .../device-check-connectivity-dialog.component.scss | 1 - .../src/app/shared/components/markdown.component.scss | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/device/device-check-connectivity-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/device/device-check-connectivity-dialog.component.scss index 123bcfb708..eca728893c 100644 --- a/ui-ngx/src/app/modules/home/pages/device/device-check-connectivity-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/pages/device/device-check-connectivity-dialog.component.scss @@ -124,7 +124,6 @@ background: #F3F6FA; border-color: #305680; padding-right: 38px; - overflow: scroll; padding-bottom: 4px; min-height: 42px; scrollbar-width: thin; diff --git a/ui-ngx/src/app/shared/components/markdown.component.scss b/ui-ngx/src/app/shared/components/markdown.component.scss index 4989a77021..65ad64b189 100644 --- a/ui-ngx/src/app/shared/components/markdown.component.scss +++ b/ui-ngx/src/app/shared/components/markdown.component.scss @@ -270,7 +270,7 @@ outline: none; position: absolute; width: 206px; - height: 42px; + height: 32px; top: 0; right: 32px; background: 0 0; @@ -281,11 +281,11 @@ user-select: none; &.multiline { - right: 44px; + right: 38px; } p { - padding: 8px; + padding: 8px 8px 0; top: 1px; transition: .2s; color: #2a7dec; @@ -301,10 +301,10 @@ background-color: #fff; position: absolute; width: 38px; - height: 38px; + height: 28px; top: 3px; right: 3px; - padding: 10px; + padding: 10px 10px 0; img { position: initial; From 4882bf26ebc300a0dd4f02fb54ca20739a95b0ab Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Thu, 10 Apr 2025 16:45:24 +0300 Subject: [PATCH 240/286] removed entity profile cache --- .../server/actors/ActorSystemContext.java | 8 +- .../CalculatedFieldManagerActor.java | 8 ++ ...alculatedFieldManagerMessageProcessor.java | 99 +++++++++++-- .../server/actors/tenant/TenantActor.java | 5 +- .../cf/DefaultCalculatedFieldInitService.java | 15 +- .../CalculatedFieldEntityProfileCache.java | 40 ------ ...aultCalculatedFieldEntityProfileCache.java | 132 ------------------ .../cf/cache/TenantEntityProfileCache.java | 5 + ...faultTbCalculatedFieldConsumerService.java | 16 +-- .../server/dao/asset/AssetService.java | 2 + .../server/dao/cf/CalculatedFieldService.java | 4 +- .../server/dao/device/DeviceService.java | 2 + .../server/common/msg/MsgType.java | 2 + .../msg/cf/CalculatedFieldActorInitMsg.java | 33 +++++ .../common/msg/cf/ProfileEntityMsg.java | 36 +++++ .../provider/KafkaMonolithQueueFactory.java | 2 +- .../KafkaTbRuleEngineQueueFactory.java | 2 +- .../server/queue/util/AfterStartUp.java | 5 +- .../server/dao/asset/AssetDao.java | 2 + .../server/dao/asset/BaseAssetService.java | 8 ++ .../dao/cf/BaseCalculatedFieldService.java | 15 +- .../server/dao/cf/CalculatedFieldDao.java | 2 + .../server/dao/cf/CalculatedFieldLinkDao.java | 2 + .../server/dao/device/DeviceDao.java | 4 +- .../server/dao/device/DeviceServiceImpl.java | 8 ++ .../server/dao/sql/asset/JpaAssetDao.java | 10 +- .../sql/cf/CalculatedFieldLinkRepository.java | 4 + .../dao/sql/cf/CalculatedFieldRepository.java | 2 + .../dao/sql/cf/JpaCalculatedFieldDao.java | 6 + .../dao/sql/cf/JpaCalculatedFieldLinkDao.java | 6 + .../device/DefaultNativeAssetRepository.java | 17 ++- .../device/DefaultNativeDeviceRepository.java | 11 ++ .../server/dao/sql/device/JpaDeviceDao.java | 16 ++- .../device/NativeProfileEntityRepository.java | 4 + 34 files changed, 292 insertions(+), 241 deletions(-) delete mode 100644 application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java delete mode 100644 application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java create mode 100644 common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldActorInitMsg.java create mode 100644 common/message/src/main/java/org/thingsboard/server/common/msg/cf/ProfileEntityMsg.java diff --git a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java index 1ed919e922..b5fa1e6fbd 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java @@ -30,9 +30,9 @@ import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import org.thingsboard.common.util.JacksonUtil; +import org.thingsboard.rule.engine.api.DeviceStateManager; import org.thingsboard.rule.engine.api.MailService; import org.thingsboard.rule.engine.api.NotificationCenter; -import org.thingsboard.rule.engine.api.DeviceStateManager; import org.thingsboard.rule.engine.api.SmsService; import org.thingsboard.rule.engine.api.notification.SlackService; import org.thingsboard.rule.engine.api.sms.SmsSenderFactory; @@ -110,7 +110,6 @@ import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.cf.CalculatedFieldProcessingService; import org.thingsboard.server.service.cf.CalculatedFieldQueueService; import org.thingsboard.server.service.cf.CalculatedFieldStateService; -import org.thingsboard.server.service.cf.cache.CalculatedFieldEntityProfileCache; import org.thingsboard.server.service.cf.ctx.state.ArgumentEntry; import org.thingsboard.server.service.component.ComponentDiscoveryService; import org.thingsboard.server.service.edge.rpc.EdgeRpcService; @@ -546,11 +545,6 @@ public class ActorSystemContext { @Getter private CalculatedFieldQueueService calculatedFieldQueueService; - @Lazy - @Autowired(required = false) - @Getter - private CalculatedFieldEntityProfileCache calculatedFieldEntityProfileCache; - @Value("${actors.session.max_concurrent_sessions_per_device:1}") @Getter private int maxConcurrentSessionsPerDevice; diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java index 70ed2849e8..511449c2a9 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java @@ -22,10 +22,12 @@ import org.thingsboard.server.actors.TbActorException; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.msg.TbActorStopReason; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; +import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; /** * Created by ashvayka on 15.03.18. @@ -65,6 +67,12 @@ public class CalculatedFieldManagerActor extends AbstractCalculatedFieldActor { case CF_PARTITIONS_CHANGE_MSG: processor.onPartitionChange((CalculatedFieldPartitionChangeMsg) msg); break; + case CF_ACTOR_INIT_MSG: + processor.onActorInitMsg((CalculatedFieldActorInitMsg) msg); + break; + case CF_PROFILE_ENTITY_MSG: + processor.onProfileEntityMsg((ProfileEntityMsg) msg); + break; case CF_INIT_MSG: processor.onFieldInitMsg((CalculatedFieldInitMsg) msg); break; diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index 060893ec8d..9dad4e820e 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -15,7 +15,9 @@ */ package org.thingsboard.server.actors.calculatedField; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.actors.TbActorCtx; import org.thingsboard.server.actors.TbActorRef; @@ -24,6 +26,7 @@ import org.thingsboard.server.actors.service.DefaultActorService; import org.thingsboard.server.actors.shared.AbstractContextAwareMsgProcessor; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.ProfileEntityIdInfo; import org.thingsboard.server.common.data.cf.CalculatedField; import org.thingsboard.server.common.data.cf.CalculatedFieldLink; import org.thingsboard.server.common.data.id.AssetId; @@ -31,17 +34,22 @@ import org.thingsboard.server.common.data.id.CalculatedFieldId; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageDataIterable; +import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; +import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; 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.dao.asset.AssetService; import org.thingsboard.server.dao.cf.CalculatedFieldService; +import org.thingsboard.server.dao.device.DeviceService; import org.thingsboard.server.service.cf.CalculatedFieldProcessingService; import org.thingsboard.server.service.cf.CalculatedFieldStateService; -import org.thingsboard.server.service.cf.cache.CalculatedFieldEntityProfileCache; +import org.thingsboard.server.service.cf.cache.TenantEntityProfileCache; import org.thingsboard.server.service.cf.ctx.CalculatedFieldEntityCtxId; import org.thingsboard.server.service.cf.ctx.state.CalculatedFieldCtx; import org.thingsboard.server.service.profile.TbAssetProfileCache; @@ -68,22 +76,30 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware private final CalculatedFieldProcessingService cfExecService; private final CalculatedFieldStateService cfStateService; - private final CalculatedFieldEntityProfileCache cfEntityCache; private final CalculatedFieldService cfDaoService; + private final DeviceService deviceService; + private final AssetService assetService; private final TbAssetProfileCache assetProfileCache; private final TbDeviceProfileCache deviceProfileCache; + private final TenantEntityProfileCache entityProfileCache; protected final TenantId tenantId; protected TbActorCtx ctx; + @Value("${calculated_fields.init_fetch_pack_size:50000}") + @Getter + private int initFetchPackSize; + CalculatedFieldManagerMessageProcessor(ActorSystemContext systemContext, TenantId tenantId) { super(systemContext); - this.cfEntityCache = systemContext.getCalculatedFieldEntityProfileCache(); this.cfExecService = systemContext.getCalculatedFieldProcessingService(); this.cfStateService = systemContext.getCalculatedFieldStateService(); this.cfDaoService = systemContext.getCalculatedFieldService(); + this.deviceService = systemContext.getDeviceService(); + this.assetService = systemContext.getAssetService(); this.assetProfileCache = systemContext.getAssetProfileCache(); this.deviceProfileCache = systemContext.getDeviceProfileCache(); + this.entityProfileCache = new TenantEntityProfileCache(); this.tenantId = tenantId; } @@ -100,6 +116,19 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware ctx.stop(ctx.getSelf()); } + public void onActorInitMsg(CalculatedFieldActorInitMsg msg) { + log.debug("[{}] Processing CF actor init message.", msg.getTenantId().getId()); + initEntityProfileCache(); + initCalculatedFields(); + msg.getCallback().onSuccess(); + } + + public void onProfileEntityMsg(ProfileEntityMsg msg) { + log.debug("[{}] Processing profile entity message.", msg.getTenantId().getId()); + entityProfileCache.add(msg.getProfileEntityId(), msg.getEntityId()); + msg.getCallback().onSuccess(); + } + public void onFieldInitMsg(CalculatedFieldInitMsg msg) throws CalculatedFieldException { log.debug("[{}] Processing CF init message.", msg.getCf().getId()); var cf = msg.getCf(); @@ -180,16 +209,35 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware } break; } + case DEVICE_PROFILE: + case ASSET_PROFILE: { + switch (event) { + case DELETED: + onProfileDeleted(msg.getData(), msg.getCallback()); + break; + default: + msg.getCallback().onSuccess(); + break; + } + break; + } default: { msg.getCallback().onSuccess(); } } } + private void onProfileDeleted(ComponentLifecycleMsg msg, TbCallback callback) { + entityProfileCache.removeProfileId(msg.getEntityId()); + callback.onSuccess(); + } + private void onEntityCreated(ComponentLifecycleMsg msg, TbCallback callback) { EntityId entityId = msg.getEntityId(); EntityId profileId = getProfileId(tenantId, entityId); - cfEntityCache.add(tenantId, profileId, entityId); + if (profileId != null) { + entityProfileCache.add(profileId, entityId); + } if (!isMyPartition(entityId, callback)) { return; } @@ -207,7 +255,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware private void onEntityUpdated(ComponentLifecycleMsg msg, TbCallback callback) { if (msg.getOldProfileId() != null && !msg.getOldProfileId().equals(msg.getProfileId())) { - cfEntityCache.update(tenantId, msg.getOldProfileId(), msg.getProfileId(), msg.getEntityId()); + entityProfileCache.update(msg.getOldProfileId(), msg.getProfileId(), msg.getEntityId()); if (!isMyPartition(msg.getEntityId(), callback)) { return; } @@ -226,7 +274,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware } private void onEntityDeleted(ComponentLifecycleMsg msg, TbCallback callback) { - cfEntityCache.evict(tenantId, msg.getEntityId()); + entityProfileCache.removeEntityId(msg.getEntityId()); if (isMyPartition(msg.getEntityId(), callback)) { log.debug("Pushing entity lifecycle msg to specific actor [{}]", msg.getEntityId()); getOrCreateActor(msg.getEntityId()).tell(new CalculatedFieldEntityDeleteMsg(tenantId, msg.getEntityId(), callback)); @@ -322,7 +370,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware EntityId entityId = cfCtx.getEntityId(); EntityType entityType = cfCtx.getEntityId().getEntityType(); if (isProfileEntity(entityType)) { - var entityIds = cfEntityCache.getEntityIdsByProfileId(tenantId, entityId); + var entityIds = entityProfileCache.getEntityIdsByProfileId(entityId); if (!entityIds.isEmpty()) { //TODO: no need to do this if we cache all created actors and know which one belong to us; var multiCallback = new MultipleTbCallback(entityIds.size(), callback); @@ -383,7 +431,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware var cf = calculatedFields.get(link.cfId()); if (EntityType.DEVICE_PROFILE.equals(targetEntityType) || EntityType.ASSET_PROFILE.equals(targetEntityType)) { // iterate over all entities that belong to profile and push the message for corresponding CF - var entityIds = cfEntityCache.getEntityIdsByProfileId(tenantId, targetEntityId); + var entityIds = entityProfileCache.getEntityIdsByProfileId(targetEntityId); if (!entityIds.isEmpty()) { MultipleTbCallback multipleCallback = new MultipleTbCallback(entityIds.size(), callback); var newMsg = new EntityCalculatedFieldLinkedTelemetryMsg(tenantId, sourceEntityId, proto.getMsg(), cf, multipleCallback); @@ -445,7 +493,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware EntityId entityId = cfCtx.getEntityId(); EntityType entityType = cfCtx.getEntityId().getEntityType(); if (isProfileEntity(entityType)) { - var entityIds = cfEntityCache.getEntityIdsByProfileId(tenantId, entityId); + var entityIds = entityProfileCache.getEntityIdsByProfileId(entityId); if (!entityIds.isEmpty()) { var multiCallback = new MultipleTbCallback(entityIds.size(), callback); entityIds.forEach(id -> { @@ -513,21 +561,46 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware } public void onPartitionChange(CalculatedFieldPartitionChangeMsg msg) { - initCalculatedFields(); ctx.broadcastToChildren(msg, true); } public void initCalculatedFields() { - cfDaoService.findCalculatedFieldsByTenantId(tenantId).forEach(cf -> { + PageDataIterable cfs = new PageDataIterable<>(pageLink -> cfDaoService.findCalculatedFieldsByTenantId(tenantId, pageLink), initFetchPackSize); + cfs.forEach(cf -> { try { onFieldInitMsg(new CalculatedFieldInitMsg(cf.getTenantId(), cf)); } catch (CalculatedFieldException e) { throw new RuntimeException(e); } }); - cfDaoService.findAllCalculatedFieldLinksByTenantId(tenantId).forEach(cfLink -> { - onLinkInitMsg(new CalculatedFieldLinkInitMsg(cfLink.getTenantId(), cfLink)); + calculatedFields.values().forEach(cf -> { + entityIdCalculatedFields.computeIfAbsent(cf.getEntityId(), id -> new CopyOnWriteArrayList<>()).add(cf); }); + PageDataIterable cfls = new PageDataIterable<>(pageLink -> cfDaoService.findAllCalculatedFieldLinksByTenantId(tenantId, pageLink), initFetchPackSize); + cfls.forEach(link -> { + onLinkInitMsg(new CalculatedFieldLinkInitMsg(link.getTenantId(), link)); + }); + } + + private void initEntityProfileCache() { + PageDataIterable deviceIdInfos = new PageDataIterable<>(pageLink -> deviceService.findProfileEntityIdInfosByTenantId(tenantId, pageLink), initFetchPackSize); + for (ProfileEntityIdInfo idInfo : deviceIdInfos) { + log.trace("Processing device record: {}", idInfo); + try { + entityProfileCache.add(idInfo.getProfileId(), idInfo.getEntityId()); + } catch (Exception e) { + log.error("Failed to process device record: {}", idInfo, e); + } + } + PageDataIterable assetIdInfos = new PageDataIterable<>(pageLink -> assetService.findProfileEntityIdInfosByTenantId(tenantId, pageLink), initFetchPackSize); + for (ProfileEntityIdInfo idInfo : assetIdInfos) { + log.trace("Processing asset record: {}", idInfo); + try { + entityProfileCache.add(idInfo.getProfileId(), idInfo.getEntityId()); + } catch (Exception e) { + log.error("Failed to process asset record: {}", idInfo, e); + } + } } } diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index b42d91a4de..4e04962dcb 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -50,6 +50,7 @@ import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.aware.DeviceAwareMsg; import org.thingsboard.server.common.msg.aware.RuleChainAwareMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.queue.PartitionChangeMsg; @@ -176,6 +177,8 @@ public class TenantActor extends RuleChainManagerActor { case RULE_CHAIN_TO_RULE_CHAIN_MSG: onRuleChainMsg((RuleChainAwareMsg) msg); break; + case CF_ACTOR_INIT_MSG: + case CF_PROFILE_ENTITY_MSG: case CF_INIT_MSG: case CF_LINK_INIT_MSG: case CF_STATE_RESTORE_MSG: @@ -274,7 +277,7 @@ public class TenantActor extends RuleChainManagerActor { () -> DefaultActorService.CF_MANAGER_DISPATCHER_NAME, () -> new CalculatedFieldManagerActorCreator(systemContext, tenantId), () -> true); - cfActor.tellWithHighPriority(msg); + cfActor.tellWithHighPriority(new CalculatedFieldActorInitMsg(tenantId)); } catch (Exception e) { log.info("[{}] Failed to init CF Actor.", tenantId, e); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java index 5f02be0cde..be27b5318b 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java @@ -20,14 +20,14 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.common.data.ProfileEntityIdInfo; import org.thingsboard.server.common.data.page.PageDataIterable; +import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; import org.thingsboard.server.dao.asset.AssetService; import org.thingsboard.server.dao.device.DeviceService; -import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.queue.util.AfterStartUp; import org.thingsboard.server.queue.util.TbRuleEngineComponent; -import org.thingsboard.server.service.cf.cache.CalculatedFieldEntityProfileCache; @Slf4j @Service @@ -35,10 +35,9 @@ import org.thingsboard.server.service.cf.cache.CalculatedFieldEntityProfileCache @RequiredArgsConstructor public class DefaultCalculatedFieldInitService implements CalculatedFieldInitService { - private final CalculatedFieldEntityProfileCache entityProfileCache; private final AssetService assetService; private final DeviceService deviceService; - private final PartitionService partitionService; + private final ActorSystemContext actorSystemContext; @Value("${calculated_fields.init_fetch_pack_size:50000}") @Getter @@ -50,9 +49,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer for (ProfileEntityIdInfo idInfo : deviceIdInfos) { log.trace("Processing device record: {}", idInfo); try { - if (partitionService.isManagedByCurrentService(idInfo.getTenantId())) { - entityProfileCache.add(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId()); - } + actorSystemContext.tell(new ProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); } catch (Exception e) { log.error("Failed to process device record: {}", idInfo, e); } @@ -61,9 +58,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer for (ProfileEntityIdInfo idInfo : assetIdInfos) { log.trace("Processing asset record: {}", idInfo); try { - if (partitionService.isManagedByCurrentService(idInfo.getTenantId())) { - entityProfileCache.add(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId()); - } + actorSystemContext.tell(new ProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); } catch (Exception e) { log.error("Failed to process asset record: {}", idInfo, e); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java deleted file mode 100644 index df2dc88f6b..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/CalculatedFieldEntityProfileCache.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright © 2016-2025 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.cf.cache; - -import org.springframework.context.ApplicationListener; -import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; - -import java.util.Collection; - -public interface CalculatedFieldEntityProfileCache extends ApplicationListener { - - void add(TenantId tenantId, EntityId profileId, EntityId entityId); - - void update(TenantId tenantId, EntityId oldProfileId, EntityId newProfileId, EntityId entityId); - - void evict(TenantId tenantId, EntityId entityId); - - void evictProfile(TenantId tenantId, EntityId profileId); - - void removeTenant(TenantId tenantId); - - Collection getEntityIdsByProfileId(TenantId tenantId, EntityId profileId); - - int getEntityIdPartition(TenantId tenantId, EntityId entityId); -} diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java deleted file mode 100644 index cefdd012d8..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/DefaultCalculatedFieldEntityProfileCache.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright © 2016-2025 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.cf.cache; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.thingsboard.server.common.data.DataConstants; -import org.thingsboard.server.common.data.Device; -import org.thingsboard.server.common.data.asset.Asset; -import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.page.PageDataIterable; -import org.thingsboard.server.common.msg.queue.ServiceType; -import org.thingsboard.server.dao.asset.AssetService; -import org.thingsboard.server.dao.device.DeviceService; -import org.thingsboard.server.queue.discovery.PartitionService; -import org.thingsboard.server.queue.discovery.TbApplicationEventListener; -import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; -import org.thingsboard.server.queue.util.TbRuleEngineComponent; - -import java.util.Collection; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -@TbRuleEngineComponent -@Service -@Slf4j -@RequiredArgsConstructor -//TODO ashvayka: remove and use TenantEntityProfileCache in each CalculatedFieldManagerMessageProcessor; -public class DefaultCalculatedFieldEntityProfileCache extends TbApplicationEventListener implements CalculatedFieldEntityProfileCache { - - private static final Integer UNKNOWN = 0; - private final ConcurrentMap tenantCache = new ConcurrentHashMap<>(); - private final PartitionService partitionService; - private final AssetService assetService; - private final DeviceService deviceService; - - @Value("${calculated_fields.init_fetch_pack_size:50000}") - @Getter - private int initFetchPackSize; - - @Override - protected void onTbApplicationEvent(PartitionChangeEvent event) { - event.getCfPartitions().forEach(tpi -> tpi.getTenantId().ifPresent(this::initCacheForNewTenant)); - } - - @Override - public void add(TenantId tenantId, EntityId profileId, EntityId entityId) { - tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()).add(profileId, entityId); - } - - @Override - public void update(TenantId tenantId, EntityId oldProfileId, EntityId newProfileId, EntityId entityId) { - tenantCache.compute(tenantId, (id, cache) -> { - if (cache == null) { - cache = new TenantEntityProfileCache(); - } - cache.remove(oldProfileId, entityId); - cache.add(newProfileId, entityId); - return cache; - }); - } - - @Override - public void evict(TenantId tenantId, EntityId entityId) { - var cache = tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()); - cache.removeEntityId(entityId); - } - - @Override - public void evictProfile(TenantId tenantId, EntityId profileId) { - tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()).removeProfileId(profileId); - } - - @Override - public void removeTenant(TenantId tenantId) { - tenantCache.remove(tenantId); - } - - @Override - public Collection getEntityIdsByProfileId(TenantId tenantId, EntityId profileId) { - return tenantCache.computeIfAbsent(tenantId, id -> new TenantEntityProfileCache()).getEntityIdsByProfileId(profileId); - } - - @Override - public int getEntityIdPartition(TenantId tenantId, EntityId entityId) { - var tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, tenantId, entityId); - return tpi.getPartition().orElse(UNKNOWN); - } - - private void initCacheForNewTenant(TenantId tenantId) { - PageDataIterable devices = new PageDataIterable<>(pageLink -> deviceService.findDevicesByTenantId(tenantId, pageLink), initFetchPackSize); - for (Device device : devices) { - log.trace("Processing device record: {}", device); - try { - if (partitionService.isManagedByCurrentService(device.getTenantId())) { - add(device.getTenantId(), device.getDeviceProfileId(), device.getId()); - } - } catch (Exception e) { - log.error("Failed to process device record: {}", device, e); - } - } - PageDataIterable assets = new PageDataIterable<>(pageLink -> assetService.findAssetsByTenantId(tenantId, pageLink), initFetchPackSize); - for (Asset asset : assets) { - log.trace("Processing asset record: {}", asset); - try { - if (partitionService.isManagedByCurrentService(asset.getTenantId())) { - add(asset.getTenantId(), asset.getAssetProfileId(), asset.getId()); - } - } catch (Exception e) { - log.error("Failed to process asset record: {}", asset, e); - } - } - } - -} diff --git a/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java b/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java index 27c2bdd6d5..6435ffb14c 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/cache/TenantEntityProfileCache.java @@ -76,6 +76,11 @@ public class TenantEntityProfileCache { } } + public void update(EntityId oldProfileId, EntityId newProfileId, EntityId entityId) { + remove(oldProfileId, entityId); + add(newProfileId, entityId); + } + public Collection getEntityIdsByProfileId(EntityId profileId) { lock.readLock().lock(); try { diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index f108949efa..ab03a56225 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -52,7 +52,6 @@ import org.thingsboard.server.queue.util.TbRuleEngineComponent; import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.cf.CalculatedFieldCache; import org.thingsboard.server.service.cf.CalculatedFieldStateService; -import org.thingsboard.server.service.cf.cache.CalculatedFieldEntityProfileCache; import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; import org.thingsboard.server.service.queue.processing.AbstractPartitionBasedConsumerService; @@ -81,7 +80,6 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa private final TbRuleEngineQueueFactory queueFactory; private final CalculatedFieldStateService stateService; - private final CalculatedFieldEntityProfileCache entityProfileCache; public DefaultTbCalculatedFieldConsumerService(TbRuleEngineQueueFactory tbQueueFactory, ActorSystemContext actorContext, @@ -93,13 +91,11 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa ApplicationEventPublisher eventPublisher, JwtSettingsService jwtSettingsService, CalculatedFieldCache calculatedFieldCache, - CalculatedFieldStateService stateService, - CalculatedFieldEntityProfileCache entityProfileCache) { + CalculatedFieldStateService stateService) { super(actorContext, tenantProfileCache, deviceProfileCache, assetProfileCache, calculatedFieldCache, apiUsageStateService, partitionService, eventPublisher, jwtSettingsService); this.queueFactory = tbQueueFactory; this.stateService = stateService; - this.entityProfileCache = entityProfileCache; } @Override @@ -230,8 +226,6 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa public void handleComponentLifecycleEvent(ComponentLifecycleMsg event) { if (event.getEntityId().getEntityType() == EntityType.TENANT) { if (event.getEvent() == ComponentLifecycleEvent.DELETED) { - entityProfileCache.removeTenant(event.getTenantId()); - Set partitions = stateService.getPartitions(); if (CollectionUtils.isEmpty(partitions)) { return; @@ -240,14 +234,6 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa .filter(tpi -> tpi.getTenantId().isPresent() && tpi.getTenantId().get().equals(event.getTenantId())) .collect(Collectors.toSet())); } - } else if (event.getEntityId().getEntityType() == EntityType.ASSET_PROFILE) { - if (event.getEvent() == ComponentLifecycleEvent.DELETED) { - entityProfileCache.evictProfile(event.getTenantId(), event.getEntityId()); - } - } else if (event.getEntityId().getEntityType() == EntityType.DEVICE_PROFILE) { - if (event.getEvent() == ComponentLifecycleEvent.DELETED) { - entityProfileCache.evictProfile(event.getTenantId(), event.getEntityId()); - } } } diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetService.java index 09bc8f1f93..c22c9c4140 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/asset/AssetService.java @@ -66,6 +66,8 @@ public interface AssetService extends EntityDaoService { PageData findProfileEntityIdInfos(PageLink pageLink); + PageData findProfileEntityIdInfosByTenantId(TenantId tenantId, PageLink pageLink); + PageData findAssetIdsByTenantIdAndAssetProfileId(TenantId tenantId, AssetProfileId assetProfileId, PageLink pageLink); ListenableFuture> findAssetsByTenantIdAndIdsAsync(TenantId tenantId, List assetIds); diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java index 8507ebbd42..b6f43cda67 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java @@ -39,7 +39,7 @@ public interface CalculatedFieldService extends EntityDaoService { PageData findAllCalculatedFields(PageLink pageLink); - List findCalculatedFieldsByTenantId(TenantId tenantId); + PageData findCalculatedFieldsByTenantId(TenantId tenantId, PageLink pageLink); PageData findAllCalculatedFieldsByEntityId(TenantId tenantId, EntityId entityId, PageLink pageLink); @@ -57,6 +57,8 @@ public interface CalculatedFieldService extends EntityDaoService { List findAllCalculatedFieldLinksByTenantId(TenantId tenantId); + PageData findAllCalculatedFieldLinksByTenantId(TenantId tenantId, PageLink pageLink); + PageData findAllCalculatedFieldLinks(PageLink pageLink); boolean referencedInAnyCalculatedField(TenantId tenantId, EntityId referencedEntityId); diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceService.java index 4ef653855d..9eb258f182 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/device/DeviceService.java @@ -76,6 +76,8 @@ public interface DeviceService extends EntityDaoService { PageData findProfileEntityIdInfos(PageLink pageLink); + PageData findProfileEntityIdInfosByTenantId(TenantId tenantId, PageLink pageLink); + PageData findDevicesByTenantIdAndType(TenantId tenantId, String type, PageLink pageLink); PageData findDeviceIdsByTenantIdAndDeviceProfileId(TenantId tenantId, DeviceProfileId deviceProfileId, PageLink pageLink); diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java b/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java index 178caf7961..bfbd5fb0d6 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java @@ -136,6 +136,8 @@ public enum MsgType { EDGE_SYNC_RESPONSE_FROM_EDGE_SESSION_MSG, + CF_ACTOR_INIT_MSG, // Sent to init caches for CF actor; + CF_PROFILE_ENTITY_MSG, // Sent to init profile entities cache; CF_INIT_MSG, // Sent to init particular calculated field; CF_LINK_INIT_MSG, // Sent to init particular calculated field; CF_STATE_RESTORE_MSG, // Sent to restore particular calculated field entity state; diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldActorInitMsg.java b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldActorInitMsg.java new file mode 100644 index 0000000000..851c7709bb --- /dev/null +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldActorInitMsg.java @@ -0,0 +1,33 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.msg.cf; + +import lombok.Data; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.msg.MsgType; +import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; + +@Data +public class CalculatedFieldActorInitMsg implements ToCalculatedFieldSystemMsg { + + private final TenantId tenantId; + + @Override + public MsgType getMsgType() { + return MsgType.CF_ACTOR_INIT_MSG; + } + +} diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/ProfileEntityMsg.java b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/ProfileEntityMsg.java new file mode 100644 index 0000000000..81196c150e --- /dev/null +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/ProfileEntityMsg.java @@ -0,0 +1,36 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.msg.cf; + +import lombok.Data; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.msg.MsgType; +import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; + +@Data +public class ProfileEntityMsg implements ToCalculatedFieldSystemMsg { + + private final TenantId tenantId; + private final EntityId profileEntityId; + private final EntityId entityId; + + @Override + public MsgType getMsgType() { + return MsgType.CF_PROFILE_ENTITY_MSG; + } + +} diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index 1c46a624c3..87a9d6a697 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -579,7 +579,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi .readFromBeginning(true) .stopWhenRead(true) .clientId("monolith-calculated-field-state-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()) - .groupId(topicService.buildTopicName("monolith-calculated-field-state-consumer")) + .groupId(null) // not using consumer group management .decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), msg.getData() != null ? CalculatedFieldStateProto.parseFrom(msg.getData()) : null, msg.getHeaders())) .admin(cfStateAdmin) .statsService(consumerStatsService) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index 112af9f646..fdf2b2f3f7 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -379,7 +379,7 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { .readFromBeginning(true) .stopWhenRead(true) .clientId("tb-rule-engine-calculated-field-state-consumer-" + serviceInfoProvider.getServiceId() + "-" + consumerCount.incrementAndGet()) - .groupId(topicService.buildTopicName("tb-rule-engine-calculated-field-state-consumer")) + .groupId(null) // not using consumer group management .decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), msg.getData() != null ? CalculatedFieldStateProto.parseFrom(msg.getData()) : null, msg.getHeaders())) .admin(cfStateAdmin) .statsService(consumerStatsService) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java b/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java index 46c29b867b..6a3aaa4a7f 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java @@ -36,10 +36,11 @@ public @interface AfterStartUp { int STARTUP_SERVICE = 8; int ACTOR_SYSTEM = 9; - int REGULAR_SERVICE = 10; int CF_READ_PROFILE_ENTITIES_SERVICE = 10; - int CF_READ_CF_SERVICE = 11; + int CF_READ_CF_SERVICE = 10; + + int REGULAR_SERVICE = 11; int BEFORE_TRANSPORT_SERVICE = Integer.MAX_VALUE - 1001; int TRANSPORT_SERVICE = Integer.MAX_VALUE - 1000; diff --git a/dao/src/main/java/org/thingsboard/server/dao/asset/AssetDao.java b/dao/src/main/java/org/thingsboard/server/dao/asset/AssetDao.java index 36700ff59f..098dc4e83d 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/asset/AssetDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/asset/AssetDao.java @@ -240,4 +240,6 @@ public interface AssetDao extends Dao, TenantEntityDao, Exportable PageData findProfileEntityIdInfos(PageLink pageLink); + PageData findProfileEntityIdInfosByTenantId(UUID tenantId, PageLink pageLink); + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/asset/BaseAssetService.java b/dao/src/main/java/org/thingsboard/server/dao/asset/BaseAssetService.java index 21d5ea7f4e..fed201d403 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/asset/BaseAssetService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/asset/BaseAssetService.java @@ -293,6 +293,14 @@ public class BaseAssetService extends AbstractCachedEntityService findProfileEntityIdInfosByTenantId(TenantId tenantId, PageLink pageLink) { + log.trace("Executing findProfileEntityIdInfosByTenantId, tenantId[{}], pageLink [{}]", tenantId, pageLink); + validateId(tenantId, id -> INCORRECT_TENANT_ID + id); + validatePageLink(pageLink); + return assetDao.findProfileEntityIdInfosByTenantId(tenantId.getId(), pageLink); + } + @Override public PageData findAssetIdsByTenantIdAndAssetProfileId(TenantId tenantId, AssetProfileId assetProfileId, PageLink pageLink) { log.trace("Executing findAssetIdsByTenantIdAndAssetProfileId, tenantId [{}], assetProfileId [{}]", tenantId, assetProfileId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java b/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java index 464041869e..d3fea73849 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java @@ -105,10 +105,11 @@ public class BaseCalculatedFieldService extends AbstractEntityService implements } @Override - public List findCalculatedFieldsByTenantId(TenantId tenantId) { - log.trace("Executing findAllByTenantId, tenantId [{}]", tenantId); + public PageData findCalculatedFieldsByTenantId(TenantId tenantId, PageLink pageLink) { + log.trace("Executing findAllByTenantId, tenantId [{}], pageLink [{}]", tenantId, pageLink); validateId(tenantId, id -> INCORRECT_TENANT_ID + id); - return calculatedFieldDao.findAllByTenantId(tenantId); + validatePageLink(pageLink); + return calculatedFieldDao.findAllByTenantId(tenantId, pageLink); } @Override @@ -187,6 +188,14 @@ public class BaseCalculatedFieldService extends AbstractEntityService implements return calculatedFieldLinkDao.findCalculatedFieldLinksByTenantId(tenantId); } + @Override + public PageData findAllCalculatedFieldLinksByTenantId(TenantId tenantId, PageLink pageLink) { + log.trace("Executing findAllCalculatedFieldLinksByTenantId, tenantId[{}] pageLink [{}]", tenantId, pageLink); + validateId(tenantId, id -> INCORRECT_TENANT_ID + id); + validatePageLink(pageLink); + return calculatedFieldLinkDao.findAllByTenantId(tenantId, pageLink); + } + @Override public PageData findAllCalculatedFieldLinks(PageLink pageLink) { log.trace("Executing findAllCalculatedFieldLinks, pageLink [{}]", pageLink); diff --git a/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldDao.java b/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldDao.java index a966977968..aadae93893 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldDao.java @@ -37,6 +37,8 @@ public interface CalculatedFieldDao extends Dao { PageData findAll(PageLink pageLink); + PageData findAllByTenantId(TenantId tenantId, PageLink pageLink); + PageData findAllByEntityId(TenantId tenantId, EntityId entityId, PageLink pageLink); List removeAllByEntityId(TenantId tenantId, EntityId entityId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldLinkDao.java b/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldLinkDao.java index cf168a9b3d..dd184289ed 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldLinkDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldLinkDao.java @@ -37,4 +37,6 @@ public interface CalculatedFieldLinkDao extends Dao { PageData findAll(PageLink pageLink); + PageData findAllByTenantId(TenantId tenantId, PageLink pageLink); + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/device/DeviceDao.java b/dao/src/main/java/org/thingsboard/server/dao/device/DeviceDao.java index efc57119eb..6bc8903d20 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/device/DeviceDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/device/DeviceDao.java @@ -23,9 +23,7 @@ import org.thingsboard.server.common.data.DeviceInfoFilter; import org.thingsboard.server.common.data.DeviceTransportType; import org.thingsboard.server.common.data.EntitySubtype; import org.thingsboard.server.common.data.ProfileEntityIdInfo; -import org.thingsboard.server.common.data.id.AssetId; import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.ota.OtaPackageType; import org.thingsboard.server.common.data.page.PageData; @@ -233,6 +231,8 @@ public interface DeviceDao extends Dao, TenantEntityDao, Exporta PageData findProfileEntityIdInfos(PageLink pageLink); + PageData findProfileEntityIdInfosByTenantId(UUID tenantId, PageLink pageLink); + PageData findDeviceInfosByFilter(DeviceInfoFilter filter, PageLink pageLink); } diff --git a/dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java index 2c890082a0..6d993f3e3d 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/device/DeviceServiceImpl.java @@ -394,6 +394,14 @@ public class DeviceServiceImpl extends CachedVersionedEntityService findProfileEntityIdInfosByTenantId(TenantId tenantId, PageLink pageLink) { + log.trace("Executing findProfileEntityIdInfosByTenantId, tenantId[{}], pageLink [{}]", tenantId, pageLink); + validateId(tenantId, id -> INCORRECT_TENANT_ID + id); + validatePageLink(pageLink); + return deviceDao.findProfileEntityIdInfosByTenantId(tenantId.getId(), pageLink); + } + @Override public PageData findDevicesByTenantIdAndType(TenantId tenantId, String type, PageLink pageLink) { log.trace("Executing findDevicesByTenantIdAndType, tenantId [{}], type [{}], pageLink [{}]", tenantId, type, pageLink); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/asset/JpaAssetDao.java b/dao/src/main/java/org/thingsboard/server/dao/sql/asset/JpaAssetDao.java index c61d894de5..4e99fb57e4 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/asset/JpaAssetDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/asset/JpaAssetDao.java @@ -39,14 +39,12 @@ import org.thingsboard.server.dao.model.sql.AssetEntity; import org.thingsboard.server.dao.model.sql.AssetInfoEntity; import org.thingsboard.server.dao.sql.JpaAbstractDao; import org.thingsboard.server.dao.sql.device.NativeAssetRepository; -import org.thingsboard.server.dao.sql.device.NativeDeviceRepository; import org.thingsboard.server.dao.util.SqlDao; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.UUID; -import java.util.stream.Collectors; import static org.thingsboard.server.dao.DaoUtil.convertTenantEntityInfosToDto; @@ -262,10 +260,16 @@ public class JpaAssetDao extends JpaAbstractDao implements A @Override public PageData findProfileEntityIdInfos(PageLink pageLink) { - log.debug("Find profile device id infos by pageLink [{}]", pageLink); + log.debug("Find profile asset id infos by pageLink [{}]", pageLink); return nativeAssetRepository.findProfileEntityIdInfos(DaoUtil.toPageable(pageLink)); } + @Override + public PageData findProfileEntityIdInfosByTenantId(UUID tenantId, PageLink pageLink) { + log.debug("Find profile asset id infos by pageLink [{}]", pageLink); + return nativeAssetRepository.findProfileEntityIdInfosByTenantId(tenantId, DaoUtil.toPageable(pageLink)); + } + @Override public Long countByTenantId(TenantId tenantId) { return assetRepository.countByTenantId(tenantId.getId()); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldLinkRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldLinkRepository.java index aeb8e1b04c..6f6a0775f3 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldLinkRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldLinkRepository.java @@ -15,6 +15,8 @@ */ package org.thingsboard.server.dao.sql.cf; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.thingsboard.server.dao.model.sql.CalculatedFieldLinkEntity; @@ -29,4 +31,6 @@ public interface CalculatedFieldLinkRepository extends JpaRepository findAllByTenantId(UUID tenantId); + Page findAllByTenantId(UUID tenantId, Pageable pageable); + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldRepository.java index 0f48f3b00d..be122816ba 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/CalculatedFieldRepository.java @@ -32,6 +32,8 @@ public interface CalculatedFieldRepository extends JpaRepository findAllByTenantIdAndEntityId(UUID tenantId, UUID entityId); + Page findAllByTenantId(UUID tenantId, Pageable pageable); + Page findAllByTenantIdAndEntityId(UUID tenantId, UUID entityId, Pageable pageable); List findAllByTenantId(UUID tenantId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldDao.java b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldDao.java index 8922eaca4e..4bb52c29db 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldDao.java @@ -71,6 +71,12 @@ public class JpaCalculatedFieldDao extends JpaAbstractDao findAllByTenantId(TenantId tenantId, PageLink pageLink) { + log.debug("Try to find calculated fields by tenantId[{}] and pageLink [{}]", tenantId, pageLink); + return DaoUtil.toPageData(calculatedFieldRepository.findAllByTenantId(tenantId.getId(), DaoUtil.toPageable(pageLink))); + } + @Override public PageData findAllByEntityId(TenantId tenantId, EntityId entityId, PageLink pageLink) { log.debug("Try to find calculated fields by entityId[{}] and pageLink [{}]", entityId, pageLink); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldLinkDao.java b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldLinkDao.java index 39b6e6b890..38871f2fb8 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldLinkDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/cf/JpaCalculatedFieldLinkDao.java @@ -70,6 +70,12 @@ public class JpaCalculatedFieldLinkDao extends JpaAbstractDao findAllByTenantId(TenantId tenantId, PageLink pageLink) { + log.debug("Try to find calculated field links by tenantId [{}], pageLink [{}]", tenantId, pageLink); + return DaoUtil.toPageData(calculatedFieldLinkRepository.findAllByTenantId(tenantId.getId(), DaoUtil.toPageable(pageLink))); + } + @Override protected Class getEntityClass() { return CalculatedFieldLinkEntity.class; diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java index 43d66e2ff0..6c2a8dc506 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java @@ -20,12 +20,9 @@ import org.springframework.data.domain.Pageable; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.stereotype.Repository; import org.springframework.transaction.support.TransactionTemplate; -import org.thingsboard.server.common.data.DeviceIdInfo; import org.thingsboard.server.common.data.ProfileEntityIdInfo; import org.thingsboard.server.common.data.id.AssetId; import org.thingsboard.server.common.data.id.AssetProfileId; -import org.thingsboard.server.common.data.id.DeviceId; -import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; @@ -43,8 +40,8 @@ public class DefaultNativeAssetRepository extends AbstractNativeRepository imple @Override public PageData findProfileEntityIdInfos(Pageable pageable) { - String PROFILE_DEVICE_ID_INFO_QUERY = "SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset ORDER BY created_time ASC LIMIT %s OFFSET %s"; - return find(COUNT_QUERY, PROFILE_DEVICE_ID_INFO_QUERY, pageable, row -> { + String PROFILE_ASSET_ID_INFO_QUERY = "SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset ORDER BY created_time ASC LIMIT %s OFFSET %s"; + return find(COUNT_QUERY, PROFILE_ASSET_ID_INFO_QUERY, pageable, row -> { AssetId id = new AssetId((UUID) row.get("id")); AssetProfileId profileId = new AssetProfileId((UUID) row.get("profileId")); var tenantIdObj = row.get("tenantId"); @@ -52,4 +49,14 @@ public class DefaultNativeAssetRepository extends AbstractNativeRepository imple }); } + @Override + public PageData findProfileEntityIdInfosByTenantId(UUID tenantId, Pageable pageable) { + String PROFILE_ASSET_ID_INFO_QUERY = String.format("SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset WHERE tenant_id = %s ORDER BY created_time ASC LIMIT %%s OFFSET %%s", tenantId); + return find(COUNT_QUERY, PROFILE_ASSET_ID_INFO_QUERY, pageable, row -> { + AssetId id = new AssetId((UUID) row.get("id")); + AssetProfileId profileId = new AssetProfileId((UUID) row.get("profileId")); + var tenantIdObj = row.get("tenantId"); + return ProfileEntityIdInfo.create(tenantIdObj != null ? (UUID) tenantIdObj : TenantId.SYS_TENANT_ID.getId(), profileId, id); + }); + } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java index 776dedc2d5..1648bb2255 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java @@ -61,4 +61,15 @@ public class DefaultNativeDeviceRepository extends AbstractNativeRepository impl }); } + @Override + public PageData findProfileEntityIdInfosByTenantId(UUID tenantId, Pageable pageable) { + String PROFILE_DEVICE_ID_INFO_QUERY = String.format("SELECT tenant_id as tenantId, device_profile_id as profileId, id as id FROM device WHERE tenant_id = %s ORDER BY created_time ASC LIMIT %%s OFFSET %%s", tenantId); + return find(COUNT_QUERY, PROFILE_DEVICE_ID_INFO_QUERY, pageable, row -> { + DeviceId id = new DeviceId((UUID) row.get("id")); + DeviceProfileId profileId = new DeviceProfileId((UUID) row.get("profileId")); + var tenantIdObj = row.get("tenantId"); + return ProfileEntityIdInfo.create(tenantIdObj != null ? (UUID) tenantIdObj : TenantId.SYS_TENANT_ID.getId(), profileId, id); + }); + } + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/device/JpaDeviceDao.java b/dao/src/main/java/org/thingsboard/server/dao/sql/device/JpaDeviceDao.java index 34835f52f1..9c79637e39 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/device/JpaDeviceDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/device/JpaDeviceDao.java @@ -179,11 +179,11 @@ public class JpaDeviceDao extends JpaAbstractDao implement @Override public PageData findDeviceIdsByTenantIdAndDeviceProfileId(UUID tenantId, UUID deviceProfileId, PageLink pageLink) { return DaoUtil.pageToPageData( - deviceRepository.findIdsByTenantIdAndDeviceProfileId( - tenantId, - deviceProfileId, - pageLink.getTextSearch(), - DaoUtil.toPageable(pageLink))) + deviceRepository.findIdsByTenantIdAndDeviceProfileId( + tenantId, + deviceProfileId, + pageLink.getTextSearch(), + DaoUtil.toPageable(pageLink))) .mapData(DeviceId::new); } @@ -281,6 +281,12 @@ public class JpaDeviceDao extends JpaAbstractDao implement return nativeDeviceRepository.findProfileEntityIdInfos(DaoUtil.toPageable(pageLink)); } + @Override + public PageData findProfileEntityIdInfosByTenantId(UUID tenantId, PageLink pageLink) { + log.debug("Find profile device id infos by tenantId[{}], pageLink [{}]", tenantId, pageLink); + return nativeDeviceRepository.findProfileEntityIdInfosByTenantId(tenantId, DaoUtil.toPageable(pageLink)); + } + @Override public Device findByTenantIdAndExternalId(UUID tenantId, UUID externalId) { return DaoUtil.getData(deviceRepository.findByTenantIdAndExternalId(tenantId, externalId)); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/device/NativeProfileEntityRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/device/NativeProfileEntityRepository.java index 750f0c8787..3568f01851 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/device/NativeProfileEntityRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/device/NativeProfileEntityRepository.java @@ -19,8 +19,12 @@ import org.springframework.data.domain.Pageable; import org.thingsboard.server.common.data.ProfileEntityIdInfo; import org.thingsboard.server.common.data.page.PageData; +import java.util.UUID; + public interface NativeProfileEntityRepository { PageData findProfileEntityIdInfos(Pageable pageable); + PageData findProfileEntityIdInfosByTenantId(UUID tenantId, Pageable pageable); + } From ec657df3cb3653ca49ea24b63dde155d02482e22 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Thu, 10 Apr 2025 17:03:41 +0300 Subject: [PATCH 241/286] returned queue name --- .../service/cf/ctx/state/KafkaCalculatedFieldStateService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java index 19d2b74bb5..533b487d38 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/ctx/state/KafkaCalculatedFieldStateService.java @@ -106,7 +106,7 @@ public class KafkaCalculatedFieldStateService extends AbstractCalculatedFieldSta @Override protected void doPersist(CalculatedFieldEntityCtxId stateId, CalculatedFieldStateProto stateMsgProto, TbCallback callback) { - TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, DataConstants.CF_QUEUE_NAME, stateId.tenantId(), stateId.entityId()); + TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, DataConstants.CF_STATES_QUEUE_NAME, stateId.tenantId(), stateId.entityId()); TbProtoQueueMsg msg = new TbProtoQueueMsg<>(stateId.entityId().getId(), stateMsgProto); if (stateMsgProto == null) { putStateId(msg.getHeaders(), stateId); From 8567dd0bd24d2535f80211a53a01e8848698888d Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Thu, 10 Apr 2025 17:41:19 +0300 Subject: [PATCH 242/286] Fix partition change events handling by consumer services --- ...faultTbCalculatedFieldConsumerService.java | 2 -- .../queue/DefaultTbCoreConsumerService.java | 2 -- .../queue/DefaultTbEdgeConsumerService.java | 5 +---- .../DefaultTbRuleEngineConsumerService.java | 2 -- .../processing/AbstractConsumerService.java | 6 ++++-- ...AbstractPartitionBasedConsumerService.java | 19 ++++++++++++++++--- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index 125a06299d..e3bc3be90d 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -16,7 +16,6 @@ package org.thingsboard.server.service.queue; import jakarta.annotation.PreDestroy; -import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEventPublisher; @@ -70,7 +69,6 @@ import java.util.stream.Collectors; @Service @TbRuleEngineComponent -@Slf4j public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBasedConsumerService implements TbCalculatedFieldConsumerService { @Value("${queue.calculated_fields.poll_interval:25}") diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java index a3003ba6ff..e115e4f7b5 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java @@ -20,7 +20,6 @@ import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; -import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEventPublisher; @@ -118,7 +117,6 @@ import java.util.stream.Collectors; @Service @TbCoreComponent -@Slf4j public class DefaultTbCoreConsumerService extends AbstractConsumerService implements TbCoreConsumerService { @Value("${queue.core.poll-interval}") diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java index 2e4c15f8e8..d3dc2932f0 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbEdgeConsumerService.java @@ -19,8 +19,6 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; import org.checkerframework.checker.nullness.qual.Nullable; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Value; @@ -45,12 +43,12 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToEdgeMsg; import org.thingsboard.server.gen.transport.TransportProtos.ToEdgeNotificationMsg; import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.common.TbProtoQueueMsg; +import org.thingsboard.server.queue.common.consumer.MainQueueConsumerManager; import org.thingsboard.server.queue.discovery.QueueKey; import org.thingsboard.server.queue.discovery.event.PartitionChangeEvent; import org.thingsboard.server.queue.provider.TbCoreQueueFactory; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.edge.EdgeContextComponent; -import org.thingsboard.server.queue.common.consumer.MainQueueConsumerManager; import org.thingsboard.server.service.edge.rpc.EdgeRpcService; import org.thingsboard.server.service.queue.processing.AbstractConsumerService; import org.thingsboard.server.service.queue.processing.IdMsgPair; @@ -66,7 +64,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -@Slf4j @Service @TbCoreComponent public class DefaultTbEdgeConsumerService extends AbstractConsumerService implements TbEdgeConsumerService { diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java index 98f857750a..f51678310e 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbRuleEngineConsumerService.java @@ -15,7 +15,6 @@ */ package org.thingsboard.server.service.queue; -import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Scheduled; @@ -65,7 +64,6 @@ import java.util.stream.Collectors; @Service @TbRuleEngineComponent -@Slf4j public class DefaultTbRuleEngineConsumerService extends AbstractPartitionBasedConsumerService implements TbRuleEngineConsumerService { private final TbRuleEngineConsumerContext ctx; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerService.java index d12bd896ff..26b689df9d 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractConsumerService.java @@ -17,7 +17,8 @@ package org.thingsboard.server.service.queue.processing; import jakarta.annotation.PreDestroy; import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationEventPublisher; import org.thingsboard.common.util.ThingsBoardExecutors; import org.thingsboard.common.util.ThingsBoardThreadFactory; @@ -62,10 +63,11 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -@Slf4j @RequiredArgsConstructor public abstract class AbstractConsumerService extends TbApplicationEventListener { + protected final Logger log = LoggerFactory.getLogger(getClass()); + protected final ActorSystemContext actorContext; protected final TbTenantProfileCache tenantProfileCache; protected final TbDeviceProfileCache deviceProfileCache; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractPartitionBasedConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractPartitionBasedConsumerService.java index 97aa81d41c..f42908bcb5 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractPartitionBasedConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/processing/AbstractPartitionBasedConsumerService.java @@ -28,6 +28,8 @@ import org.thingsboard.server.service.profile.TbAssetProfileCache; import org.thingsboard.server.service.profile.TbDeviceProfileCache; import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -35,7 +37,7 @@ public abstract class AbstractPartitionBasedConsumerService pendingEvents = new ArrayList<>(); public AbstractPartitionBasedConsumerService(ActorSystemContext actorContext, TbTenantProfileCache tenantProfileCache, @@ -61,8 +63,16 @@ public abstract class AbstractPartitionBasedConsumerService Date: Thu, 10 Apr 2025 18:00:22 +0300 Subject: [PATCH 243/286] UI: Add change detection when updating dashboard state to prevent rare cases when compiled template in markdown widget is not updated. --- .../home/components/dashboard-page/dashboard-page.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index 9490db52a4..60d05d4c86 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -1118,6 +1118,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC this.dashboardCtx.aliasController.dashboardStateChanged(); this.isRightLayoutOpened = openRightLayout ? true : false; this.updateLayouts(layoutsData); + this.cd.markForCheck(); } setTimeout(() => { this.mobileService.onDashboardLoaded(this.layouts.right.show, this.isRightLayoutOpened); From 9bf528eee584a1c2fc9bd835318983a981ed41fd Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Thu, 10 Apr 2025 18:05:21 +0300 Subject: [PATCH 244/286] Edge notification unique topic per edge must have the same group as topic name to avoid rebalance in case other edge disconnects --- .../server/queue/provider/KafkaMonolithQueueFactory.java | 5 +++-- .../server/queue/provider/KafkaTbCoreQueueFactory.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index dcebe085b3..508cdff2a9 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -493,9 +493,10 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi public TbQueueConsumer> createEdgeEventMsgConsumer(TenantId tenantId, EdgeId edgeId) { TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); - consumerBuilder.topic(topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic()); + String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic(); + consumerBuilder.topic(topic); consumerBuilder.clientId("monolith-to-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + edgeConsumerCount.incrementAndGet()); - consumerBuilder.groupId(topicService.buildTopicName("monolith-edge-event-consumer")); + consumerBuilder.groupId(topic); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToEdgeEventNotificationMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(edgeEventAdmin); consumerBuilder.statsService(consumerStatsService); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java index e9c42b0022..14766ecbdb 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java @@ -439,9 +439,10 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { public TbQueueConsumer> createEdgeEventMsgConsumer(TenantId tenantId, EdgeId edgeId) { TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); - consumerBuilder.topic(topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic()); + String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic(); + consumerBuilder.topic(topic); consumerBuilder.clientId("tb-core-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + edgeConsumerCount.incrementAndGet()); - consumerBuilder.groupId(topicService.buildTopicName("tb-core-edge-event-consumer")); + consumerBuilder.groupId(topic); consumerBuilder.decoder(msg -> new TbProtoQueueMsg<>(msg.getKey(), ToEdgeEventNotificationMsg.parseFrom(msg.getData()), msg.getHeaders())); consumerBuilder.admin(edgeEventAdmin); consumerBuilder.statsService(consumerStatsService); From 2cfa9a0103fbe44a0e75ca5cac871722e9533b86 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 09:33:46 +0300 Subject: [PATCH 245/286] added handling of new messages to app actor --- .../main/java/org/thingsboard/server/actors/app/AppActor.java | 2 ++ .../java/org/thingsboard/server/actors/tenant/TenantActor.java | 1 + 2 files changed, 3 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java b/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java index 904547a2b6..d3f8f0d3ca 100644 --- a/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java @@ -113,6 +113,8 @@ public class AppActor extends ContextAwareActor { case SESSION_TIMEOUT_MSG: ctx.broadcastToChildrenByType(msg, EntityType.TENANT); break; + case CF_ACTOR_INIT_MSG: + case CF_PROFILE_ENTITY_MSG: case CF_INIT_MSG: case CF_LINK_INIT_MSG: case CF_STATE_RESTORE_MSG: diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index 4e04962dcb..68d4082f7f 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -282,6 +282,7 @@ public class TenantActor extends RuleChainManagerActor { log.info("[{}] Failed to init CF Actor.", tenantId, e); } } + cfActor.tellWithHighPriority(msg); if (!ruleChainsInitialized) { log.info("Tenant {} is now managed by this service, initializing rule chains", tenantId); initRuleChains(); From 413cc12126796aea78fb6d98d6a7a2ff1113a6db Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 11 Apr 2025 09:34:44 +0300 Subject: [PATCH 246/286] UI: Handle error on apply preview upload and download --- .../scada-symbol/scada-symbol.component.ts | 96 ++++++++++--------- .../image/upload-image-dialog.component.html | 2 +- .../image/upload-image-dialog.component.ts | 63 +++++++----- 3 files changed, 90 insertions(+), 71 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts b/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts index c618380565..a2b47ee811 100644 --- a/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts +++ b/ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol.component.ts @@ -253,43 +253,47 @@ export class ScadaSymbolComponent extends PageComponent enterPreviewMode() { this.previewMetadata = this.scadaSymbolFormGroup.get('metadata').value; - this.symbolData.scadaSymbolContent = this.prepareScadaSymbolContent(this.previewMetadata); - this.previewScadaSymbolObjectSettings = { - behavior: {}, - properties: {} - }; - this.scadaPreviewFormGroup.patchValue({ - scadaSymbolObjectSettings: this.previewScadaSymbolObjectSettings - }, {emitEvent: false}); - this.scadaPreviewFormGroup.markAsPristine(); - const settings: ScadaSymbolWidgetSettings = {...scadaSymbolWidgetDefaultSettings, - ...{ + try { + this.symbolData.scadaSymbolContent = this.prepareScadaSymbolContent(this.previewMetadata); + this.previewScadaSymbolObjectSettings = { + behavior: {}, + properties: {} + }; + this.scadaPreviewFormGroup.patchValue({ + scadaSymbolObjectSettings: this.previewScadaSymbolObjectSettings + }, {emitEvent: false}); + this.scadaPreviewFormGroup.markAsPristine(); + const settings: ScadaSymbolWidgetSettings = {...scadaSymbolWidgetDefaultSettings, + ...{ simulated: true, scadaSymbolUrl: null, scadaSymbolContent: this.symbolData.scadaSymbolContent, scadaSymbolObjectSettings: this.previewScadaSymbolObjectSettings, padding: '0', background: colorBackground('rgba(0,0,0,0)') - } - }; - this.previewWidget = { - typeFullFqn: 'system.scada_symbol', - type: widgetType.rpc, - sizeX: this.previewMetadata.widgetSizeX || 3, - sizeY: this.previewMetadata.widgetSizeY || 3, - row: 0, - col: 0, - config: { - settings, - showTitle: false, - dropShadow: false, - padding: '0', - margin: '0', - backgroundColor: 'rgba(0,0,0,0)' - } - }; - this.previewWidgets = [this.previewWidget]; - this.previewMode = true; + } + }; + this.previewWidget = { + typeFullFqn: 'system.scada_symbol', + type: widgetType.rpc, + sizeX: this.previewMetadata.widgetSizeX || 3, + sizeY: this.previewMetadata.widgetSizeY || 3, + row: 0, + col: 0, + config: { + settings, + showTitle: false, + dropShadow: false, + padding: '0', + margin: '0', + backgroundColor: 'rgba(0,0,0,0)' + } + }; + this.previewWidgets = [this.previewWidget]; + this.previewMode = true; + } catch (e) { + this.store.dispatch(new ActionNotificationShow({ message: e.message, type: 'error' })); + } } exitPreviewMode() { @@ -379,19 +383,23 @@ export class ScadaSymbolComponent extends PageComponent metadata = parseScadaSymbolMetadataFromContent(this.origSymbolData.scadaSymbolContent); } const linkElement = document.createElement('a'); - const scadaSymbolContent = this.prepareScadaSymbolContent(metadata); - const blob = new Blob([scadaSymbolContent], { type: this.symbolData.imageResource.descriptor.mediaType }); - const url = URL.createObjectURL(blob); - linkElement.setAttribute('href', url); - linkElement.setAttribute('download', this.symbolData.imageResource.fileName); - const clickEvent = new MouseEvent('click', - { - view: window, - bubbles: true, - cancelable: false - } - ); - linkElement.dispatchEvent(clickEvent); + try { + const scadaSymbolContent = this.prepareScadaSymbolContent(metadata); + const blob = new Blob([scadaSymbolContent], { type: this.symbolData.imageResource.descriptor.mediaType }); + const url = URL.createObjectURL(blob); + linkElement.setAttribute('href', url); + linkElement.setAttribute('download', this.symbolData.imageResource.fileName); + const clickEvent = new MouseEvent('click', + { + view: window, + bubbles: true, + cancelable: false + } + ); + linkElement.dispatchEvent(clickEvent); + } catch (e) { + this.store.dispatch(new ActionNotificationShow({ message: e.message, type: 'error' })); + } } createWidget() { diff --git a/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html b/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html index bbaf7d88ae..11dffb1b25 100644 --- a/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html +++ b/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html @@ -15,7 +15,7 @@ limitations under the License. --> - +

    {{ ( uploadImage ? (isScada ? 'scada.upload-symbol' : 'image.upload-image') : (isScada ? 'scada.update-symbol' : 'image.update-image') ) | translate }}

    diff --git a/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.ts b/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.ts index 86bf9c4cd8..779cc021d4 100644 --- a/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.ts +++ b/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.ts @@ -41,6 +41,7 @@ import { updateScadaSymbolMetadataInContent } from '@home/components/widget/lib/scada/scada-symbol.models'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { ActionNotificationShow } from '@core/notification/notification.actions'; export interface UploadImageDialogData { imageSubType: ResourceSubType; @@ -135,38 +136,48 @@ export class UploadImageDialogComponent extends upload(): void { this.submitted = true; let file: File = this.uploadImageFormGroup.get('file').value; - if (this.uploadImage) { - const title: string = this.uploadImageFormGroup.get('title').value; - if (this.isScada) { - if (!this.scadaSymbolMetadata) { - this.scadaSymbolMetadata = emptyMetadata(); - } - if (this.scadaSymbolMetadata.title !== title) { - this.scadaSymbolMetadata.title = title; + try { + if (this.uploadImage) { + const title: string = this.uploadImageFormGroup.get('title').value; + if (this.isScada) { + if (!this.scadaSymbolMetadata) { + this.scadaSymbolMetadata = emptyMetadata(); + } + if (this.scadaSymbolMetadata.title !== title) { + this.scadaSymbolMetadata.title = title; + } + const newContent = updateScadaSymbolMetadataInContent(this.scadaSymbolContent, this.scadaSymbolMetadata); + file = updateFileContent(file, newContent); } - const newContent = updateScadaSymbolMetadataInContent(this.scadaSymbolContent, this.scadaSymbolMetadata); - file = updateFileContent(file, newContent); - } - forkJoin([ - this.imageService.uploadImage(file, title, this.data.imageSubType), - blobToBase64(file) - ]).subscribe(([imageInfo, base64]) => { - this.dialogRef.close({image: Object.assign(imageInfo, {base64})}); - }); - } else { - if (this.isScada) { - blobToText(file).subscribe(scadaSymbolContent => { - this.dialogRef.close({scadaSymbolContent}); - }); - } else { - const image = this.data.image; forkJoin([ - this.imageService.updateImage(imageResourceType(image), image.resourceKey, file), + this.imageService.uploadImage(file, title, this.data.imageSubType), blobToBase64(file) ]).subscribe(([imageInfo, base64]) => { - this.dialogRef.close({image:Object.assign(imageInfo, {base64})}); + this.dialogRef.close({image: Object.assign(imageInfo, {base64})}); }); + } else { + if (this.isScada) { + blobToText(file).subscribe(scadaSymbolContent => { + this.dialogRef.close({scadaSymbolContent}); + }); + } else { + const image = this.data.image; + forkJoin([ + this.imageService.updateImage(imageResourceType(image), image.resourceKey, file), + blobToBase64(file) + ]).subscribe(([imageInfo, base64]) => { + this.dialogRef.close({image:Object.assign(imageInfo, {base64})}); + }); + } } + } catch (e) { + this.store.dispatch(new ActionNotificationShow({ + message: e.message, + type: 'error', + verticalPosition: 'bottom', + horizontalPosition: 'right', + target: 'uploadRoot' + })); } } } From a6cdc170cb9d45c94e22031de0c325f648f912e8 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 09:49:58 +0300 Subject: [PATCH 247/286] renamed new msgs --- .../org/thingsboard/server/actors/app/AppActor.java | 2 +- .../calculatedField/CalculatedFieldManagerActor.java | 10 +++++----- .../CalculatedFieldManagerMessageProcessor.java | 8 ++++---- .../thingsboard/server/actors/tenant/TenantActor.java | 6 +++--- .../service/cf/DefaultCalculatedFieldInitService.java | 6 +++--- .../org/thingsboard/server/common/msg/MsgType.java | 2 +- ...orInitMsg.java => CalculatedFieldCacheInitMsg.java} | 4 ++-- ...tyMsg.java => CalculatedFieldProfileEntityMsg.java} | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) rename common/message/src/main/java/org/thingsboard/server/common/msg/cf/{CalculatedFieldActorInitMsg.java => CalculatedFieldCacheInitMsg.java} (90%) rename common/message/src/main/java/org/thingsboard/server/common/msg/cf/{ProfileEntityMsg.java => CalculatedFieldProfileEntityMsg.java} (93%) diff --git a/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java b/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java index d3f8f0d3ca..fc9f344563 100644 --- a/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java @@ -113,7 +113,7 @@ public class AppActor extends ContextAwareActor { case SESSION_TIMEOUT_MSG: ctx.broadcastToChildrenByType(msg, EntityType.TENANT); break; - case CF_ACTOR_INIT_MSG: + case CF_CACHE_INIT_MSG: case CF_PROFILE_ENTITY_MSG: case CF_INIT_MSG: case CF_LINK_INIT_MSG: diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java index 511449c2a9..d5a3da03e4 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java @@ -22,12 +22,12 @@ import org.thingsboard.server.actors.TbActorException; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.msg.TbActorStopReason; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; -import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; -import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg; /** * Created by ashvayka on 15.03.18. @@ -67,11 +67,11 @@ public class CalculatedFieldManagerActor extends AbstractCalculatedFieldActor { case CF_PARTITIONS_CHANGE_MSG: processor.onPartitionChange((CalculatedFieldPartitionChangeMsg) msg); break; - case CF_ACTOR_INIT_MSG: - processor.onActorInitMsg((CalculatedFieldActorInitMsg) msg); + case CF_CACHE_INIT_MSG: + processor.onCacheInitMsg((CalculatedFieldCacheInitMsg) msg); break; case CF_PROFILE_ENTITY_MSG: - processor.onProfileEntityMsg((ProfileEntityMsg) msg); + processor.onProfileEntityMsg((CalculatedFieldProfileEntityMsg) msg); break; case CF_INIT_MSG: processor.onFieldInitMsg((CalculatedFieldInitMsg) msg); diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index 9dad4e820e..e62c531b16 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -35,12 +35,12 @@ import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageDataIterable; -import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; -import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.TbCallback; @@ -116,14 +116,14 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware ctx.stop(ctx.getSelf()); } - public void onActorInitMsg(CalculatedFieldActorInitMsg msg) { + public void onCacheInitMsg(CalculatedFieldCacheInitMsg msg) { log.debug("[{}] Processing CF actor init message.", msg.getTenantId().getId()); initEntityProfileCache(); initCalculatedFields(); msg.getCallback().onSuccess(); } - public void onProfileEntityMsg(ProfileEntityMsg msg) { + public void onProfileEntityMsg(CalculatedFieldProfileEntityMsg msg) { log.debug("[{}] Processing profile entity message.", msg.getTenantId().getId()); entityProfileCache.add(msg.getProfileEntityId(), msg.getEntityId()); msg.getCallback().onSuccess(); diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index 68d4082f7f..a5be701d38 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -50,7 +50,7 @@ import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.aware.DeviceAwareMsg; import org.thingsboard.server.common.msg.aware.RuleChainAwareMsg; -import org.thingsboard.server.common.msg.cf.CalculatedFieldActorInitMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.queue.PartitionChangeMsg; @@ -177,7 +177,7 @@ public class TenantActor extends RuleChainManagerActor { case RULE_CHAIN_TO_RULE_CHAIN_MSG: onRuleChainMsg((RuleChainAwareMsg) msg); break; - case CF_ACTOR_INIT_MSG: + case CF_CACHE_INIT_MSG: case CF_PROFILE_ENTITY_MSG: case CF_INIT_MSG: case CF_LINK_INIT_MSG: @@ -277,7 +277,7 @@ public class TenantActor extends RuleChainManagerActor { () -> DefaultActorService.CF_MANAGER_DISPATCHER_NAME, () -> new CalculatedFieldManagerActorCreator(systemContext, tenantId), () -> true); - cfActor.tellWithHighPriority(new CalculatedFieldActorInitMsg(tenantId)); + cfActor.tellWithHighPriority(new CalculatedFieldCacheInitMsg(tenantId)); } catch (Exception e) { log.info("[{}] Failed to init CF Actor.", tenantId, e); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java index be27b5318b..826a5243cf 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java @@ -23,7 +23,7 @@ import org.springframework.stereotype.Service; import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.common.data.ProfileEntityIdInfo; import org.thingsboard.server.common.data.page.PageDataIterable; -import org.thingsboard.server.common.msg.cf.ProfileEntityMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg; import org.thingsboard.server.dao.asset.AssetService; import org.thingsboard.server.dao.device.DeviceService; import org.thingsboard.server.queue.util.AfterStartUp; @@ -49,7 +49,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer for (ProfileEntityIdInfo idInfo : deviceIdInfos) { log.trace("Processing device record: {}", idInfo); try { - actorSystemContext.tell(new ProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); + actorSystemContext.tell(new CalculatedFieldProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); } catch (Exception e) { log.error("Failed to process device record: {}", idInfo, e); } @@ -58,7 +58,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer for (ProfileEntityIdInfo idInfo : assetIdInfos) { log.trace("Processing asset record: {}", idInfo); try { - actorSystemContext.tell(new ProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); + actorSystemContext.tell(new CalculatedFieldProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); } catch (Exception e) { log.error("Failed to process asset record: {}", idInfo, e); } diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java b/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java index bfbd5fb0d6..5bada73c8c 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java @@ -136,7 +136,7 @@ public enum MsgType { EDGE_SYNC_RESPONSE_FROM_EDGE_SESSION_MSG, - CF_ACTOR_INIT_MSG, // Sent to init caches for CF actor; + CF_CACHE_INIT_MSG, // Sent to init caches for CF actor; CF_PROFILE_ENTITY_MSG, // Sent to init profile entities cache; CF_INIT_MSG, // Sent to init particular calculated field; CF_LINK_INIT_MSG, // Sent to init particular calculated field; diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldActorInitMsg.java b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldCacheInitMsg.java similarity index 90% rename from common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldActorInitMsg.java rename to common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldCacheInitMsg.java index 851c7709bb..bf2054dfcf 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldActorInitMsg.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldCacheInitMsg.java @@ -21,13 +21,13 @@ import org.thingsboard.server.common.msg.MsgType; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; @Data -public class CalculatedFieldActorInitMsg implements ToCalculatedFieldSystemMsg { +public class CalculatedFieldCacheInitMsg implements ToCalculatedFieldSystemMsg { private final TenantId tenantId; @Override public MsgType getMsgType() { - return MsgType.CF_ACTOR_INIT_MSG; + return MsgType.CF_CACHE_INIT_MSG; } } diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/ProfileEntityMsg.java b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldProfileEntityMsg.java similarity index 93% rename from common/message/src/main/java/org/thingsboard/server/common/msg/cf/ProfileEntityMsg.java rename to common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldProfileEntityMsg.java index 81196c150e..72447af677 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/ProfileEntityMsg.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldProfileEntityMsg.java @@ -22,7 +22,7 @@ import org.thingsboard.server.common.msg.MsgType; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; @Data -public class ProfileEntityMsg implements ToCalculatedFieldSystemMsg { +public class CalculatedFieldProfileEntityMsg implements ToCalculatedFieldSystemMsg { private final TenantId tenantId; private final EntityId profileEntityId; From 45cd9af1637167155125789cbe7bfefbc957d8ad Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 10:02:39 +0300 Subject: [PATCH 248/286] fixed ruel engine consumer --- .../queue/ruleengine/TbRuleEngineQueueConsumerManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java b/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java index c147836dab..879da5afc6 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/ruleengine/TbRuleEngineQueueConsumerManager.java @@ -73,8 +73,8 @@ public class TbRuleEngineQueueConsumerManager extends MainQueueConsumerManager { - Integer partitionId = topicPartitionInfo.getPartition().orElse(-1); + (queueConfig, tpi) -> { + Integer partitionId = tpi != null ? tpi.getPartition().orElse(-1) : null; return ctx.getQueueFactory().createToRuleEngineMsgConsumer(queueConfig, partitionId); }, consumerExecutor, scheduler, taskExecutor, null); From 84778afc0d8ffe4f4ec9524759600516d97ba1f6 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 11 Apr 2025 10:12:46 +0300 Subject: [PATCH 249/286] UI: Change error position for upload dialog --- .../components/image/upload-image-dialog.component.html | 6 +++--- .../components/image/upload-image-dialog.component.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html b/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html index 11dffb1b25..47950e53b7 100644 --- a/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html +++ b/ui-ngx/src/app/shared/components/image/upload-image-dialog.component.html @@ -15,7 +15,7 @@ limitations under the License. --> - +

    {{ ( uploadImage ? (isScada ? 'scada.upload-symbol' : 'image.upload-image') : (isScada ? 'scada.update-symbol' : 'image.update-image') ) | translate }}

    @@ -28,8 +28,8 @@
    -
    -
    +
    +
    Date: Fri, 11 Apr 2025 12:02:00 +0300 Subject: [PATCH 250/286] Minor refactoring for EdqsStatsService --- .../server/edqs/stats/DefaultEdqsStatsService.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java index 4853920c44..435c7f0884 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/stats/DefaultEdqsStatsService.java @@ -53,13 +53,12 @@ public class DefaultEdqsStatsService implements EdqsStatsService { private final ConcurrentMap objectCounters = new ConcurrentHashMap<>(); private final ConcurrentMap timers = new ConcurrentHashMap<>(); private final ConcurrentMap counters = new ConcurrentHashMap<>(); - private final ConcurrentMap gauges = new ConcurrentHashMap<>(); @PostConstruct private void init() { - statsFactory.createGauge("edqsGauges", "stringPoolSize", TbStringPool.getPool(), Map::size); - statsFactory.createGauge("edqsGauges", "bytePoolSize", TbBytePool.getPool(), Map::size); - statsFactory.createGauge("edqsGauges", "tenantReposSize", DefaultEdqsRepository.getRepos(), Map::size); + statsFactory.createGauge("edqsMapGauges", "stringPoolSize", TbStringPool.getPool(), Map::size); + statsFactory.createGauge("edqsMapGauges", "bytePoolSize", TbBytePool.getPool(), Map::size); + statsFactory.createGauge("edqsMapGauges", "tenantReposSize", DefaultEdqsRepository.getRepos(), Map::size); } @Override @@ -124,10 +123,6 @@ public class DefaultEdqsStatsService implements EdqsStatsService { return counters.computeIfAbsent(name, __ -> statsFactory.createStatsCounter("edqsCounters", name)); } - private AtomicInteger getGauge(String name) { - return gauges.computeIfAbsent(name, __ -> statsFactory.createGauge("edqsGauges", name, new AtomicInteger())); - } - private AtomicInteger getObjectGauge(ObjectType objectType) { return objectCounters.computeIfAbsent(objectType, type -> statsFactory.createGauge("edqsGauges", "objectsCount", new AtomicInteger(), "objectType", type.name())); From 54c2af2d6820a6c53f9a28d20600c72b285638e8 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 11 Apr 2025 12:10:54 +0300 Subject: [PATCH 251/286] UI: Fixed visability of table header in preview mode --- .../widget/action/manage-widget-actions.component.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.scss b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.scss index 66cbe675b2..e122794bb0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/action/manage-widget-actions.component.scss @@ -33,6 +33,7 @@ .table-container { overflow: auto; + z-index: 1; } } } From ad54a3b9c3673c01d90cd5ee237d401f1e97d3e0 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 11 Apr 2025 12:23:48 +0300 Subject: [PATCH 252/286] Gateway release 4.0 update --- .../widget_bundles/gateway_widgets.json | 4 +- .../gateway_general_configuration.json | 2 +- .../system/widget_types/gateway_status.json | 1 - .../dashboards/gateways_dashboard.json | 2090 +++++++++-------- .../gateway-management-extension.js | 4 +- .../src/main/resources/thingsboard.yml | 2 +- 6 files changed, 1055 insertions(+), 1048 deletions(-) diff --git a/application/src/main/data/json/system/widget_bundles/gateway_widgets.json b/application/src/main/data/json/system/widget_bundles/gateway_widgets.json index bf48fd1c4f..5cf929e3ce 100644 --- a/application/src/main/data/json/system/widget_bundles/gateway_widgets.json +++ b/application/src/main/data/json/system/widget_bundles/gateway_widgets.json @@ -5,7 +5,6 @@ "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACgCAMAAAB+IdObAAAC7lBMVEUwVX8wVn8wVoAxV4AyV4EzWYI1WYI1WoM4XYU7X4Y8YIc+YYg/YolDZYtGaI1HR0dIaY1IaY5Ja49LbJBQcZRScpVUVFRUc5ZVVVVWVlZWdZdXV1dXdphYWFhYdphZWVlaeJpcXFxceptdXV1eXl5fX19gYGBhfp5jY2NkZGRkgKBlZWVmZmZmgqFnZ2dng6JoaGhpaWlqampqhaNqhqRra2tsbGxtbW1ubm5vb29wcHBwiqdxcXFycnJyi6hzc3N0dHR0jqp1dXV2dnZ3d3d3kKt4eHh5eXl6enp7e3t7lK58fHx9fX1+fn5/f3+AgICBgYGCgoKCmbKDg4OEhISFhYWGhoaGnLWHh4eHnbWIiIiInraJiYmJn7eKioqKoLeLi4uMjIyMobiNjY2Ojo6Pj4+QkJCQpLuRkZGRpbuSkpKSpryTk5OUlJSVlZWVqL6Vqb6WlpaWqr+Xl5eXqr+YmJiZmZmZq8Campqbm5ubrcKcnJydnZ2dr8Oenp6er8OesMSfn5+goKChoaGioqKjo6OkpKSlpaWltcimpqanp6eoqKipqamqqqqrq6urususrKytra2tvMyurq6uvc2vr6+vvc6vvs6wsLCxsbGysrKzs7O0tLS1tbW2tra3t7e4uLi5ubm6urq7u7u8vLy9vb2+vr6+yte/v7/AwMDAy9jBwcHCwsLCzdrDw8PDztrExMTFxcXFz9vGxsbG0dzHx8fIyMjI0t3JycnKysrLy8vMzMzM1eDNzc3N1uDOzs7Pz8/Q0NDR0dHR2ePS0tLT09PU1NTV1dXW1tbW3ebW3ubX19fY2NjZ2dnZ4Oja2trb29vc3Nzd3d3e3t7f39/g4ODh4eHi4uLj4+Pk5OTl5eXm5ubn5+fo6Ojp6enq6urr6+vs7Ozt7e3u7u7v7+/w8PDw8PHw8vbx8fHy8vLz8/Pz8/T09PT19fX29vb39/f3+Pn4+Pj5+fn5+vz6+vr7+/v8/Pz9/f3+/v7///9UXY26AAAAAWJLR0T5TGRX8AAAC3dJREFUeNrtnXtYW2cdx2Onzrtu3q9TN6tzF0cnXaggsWAgUmiQFI+IeDAUsWtVROqqEbU35Cq11lFoYbR0gxVrEams2SStoaClLuW6pFySnIMmMTnHxHP7/ucfCbSda0lXYJw85/s88PDw8LzJh/O+b973c35vogJPxUA4qHhKguwjUbwqzCHJOGESFRXGEGWbMAqlogFJEgWB5zkZhucFQZQkgFbRkCSR50JBlmVkF5YNhjhelKQwiMiHONmOeIkL8aIEWkVLksCxQfnOWEGWEySJVtGSKIS8cp57vSFBDIPwQVrOIHSQj4BwLCVnEIrlFkDccgZxxyAII28Q5hVA9pB68njLFFCBClRfAluFiYLcHjiLCjuxiySs8BRtbgFQFMRsDrmDnjDkHRJXIQiQAGyzAWqokRHH+3Wiek7YSOeNSIRLDf865FyUCvsx9PBxjBlhJQd2SYf3rujz5ha+LQ7SZDavgxoZByr8ulkDABwkJoHHzM1FUAMXymGczJgHAdQrClLeA/SURwdiamqKgxoZnowB3WQ+TCkjGMrPEdZ3NOklNfDi9mCCY9PU2H35a5mVB6HzTp/Jdd9a1/LMxum4dSJ2XtgrYvslNbCR2RBA09FjmeVkxZgRW0YHdmHEsMKvGwRB3eIY8aBZh47UkrS5Hn3xpmA8aSjHYDKh51P8kNSjRjjSBz6Tq1/pl1OKimaw/3+EEACwC8tNRg7Tb8y8jiggCogCooAoICsK8s9lyr9XIErXUkAUEAVEAVFAlhwkWFZYz5J5BnJ4itD3oJfIrxbBGyWgPY+cQTFJHpAHSMNTqDoLqwlImhLSHPWdqOhAx8NWXNoiTelW2Jfcjtfq3zgAwGrCXAZwvCkMkmXPR00vADxiNr/m4j5Kr/VS2UYaVhNms4GT9fVJqXnSbLojkdl9dobMwP1NTY7XGiQ6r9XsQutRWE0Q4gWUv1DfGVJz+/PL9UdPVQAJq6JrRee1RrNKNk7DagJObczZivpOtNaoBTAbxcK8vDKsJcnaVUASldda8FfCy26QhkSszigviArI8oMoN0NXHUiM3Gfng3RAvhyBq5UPQshzSrYkgS7PfC2KJHC+huqqyv0yTGVVdYMvUh0ESeQDo8NDg7LM0PBoIFKvBUkSOSbg83o9sovX6wsw3HwFXczUNK72KtP/fPGNqhvnHX+QJMyDrO6639+87qZ5V3i7pVr9xXM/WnPzKCAKiAISyd0/+OobYgLkb5//2Q/v+Phdb757zfvX3P0eGYM8+eR713zr53//yF/e9vyjv3/2C/IFueOh57/yuV//9bPPfPvrv332mV/IFuT1//j0d3/150f/9NCX//X2x3/8yY/I94q8+/vfecuHfvK1j73pm2vu/Mbjb1WmXwVEAYkxkN/dnOMu2YD890t33ozjjxEQWbu5ayydKhZOuAISpeJi46yuoAJPUR6Zh6IEqBAjiSEQ5WD+qhrsfOxMvzF0MD/ssLmQLMNFLHb4/ojABdmA3yfD+ANskBMi59lFIcTIeXwwC8fAOUbe59nnCwaEoE/e99l9QUGiVbTIs3PTcgaZnmN5kVbRIhegHHIGcVABLgzid03KGWTS5Q+DhHzOCTmDTDh9oXmQ8flf2k45vwccs58mSJIdNWRbb/dRAnZUXLsIOk8Yx2ZagAo4SeJpBMuJfVI3QZKeHqJ4GtXkrtAtP8T4VZDZBZAzlePvfArlQ1U9gLB+jt0Q5cT8kkWA3+KDw2kR/S6LG+KwA5gYwolc7wTE4Qn4XBYKQDzHZIyWAGpsdEiZjtJu7Ouo6Qa4eJHOObcDfbdeMzk++8og+Ruo8qGqIw7KVgJU9UTV1gDRuIVKb9f4tRXbq3rVzQ9iR7Nh+OgTP91fmz6rQXGjseNkYnMcgMxqL0ZLAHUoCfCx64Ggt2aPeVhKamQwE9/9KgonbwRifFFfPlRFVHYNlgENJ6Nqq3gK9pYONHdo+Vmitx5pzNpK4540SbLbyqHhdOC0Jw9DIwFCh7ZutARQs6lA5Ch8zdam0+DaktpAVakvLx0InrhvqKoH8CUDhujmsx2jON/WitqzWt5J9NZDxyR4vayWEy/YyqARNfBkh0HYWuCxmRxI66EWUD2un8aZjppuwHkEotp8AbbiJQTh7h2q6gHQnL55d5RDREfWBDNLcvl5kGBd7pbL5ix9N/3gixo05KfbIlfEVEiYsKMgqw19acYi6SVtcaa/RkOSzm1bsxvo7O1a69KAXB+ei7o1DteUDAMAJwGiECkX5q52fYEDwAkApBAALFQX88LLm1g6EHlEAVnFIE55g1yzRImNtVbMrH65gNsuZx1kd8/vRxjKMTLY39fTLbv09PUPjjgohhNpFS3xzNz0+CWrxXz2OZnlrNlivTQ+Pcfw83v2GTmPkZn5PXusgEg8I3eLEulaHCN3i8JcnX7lDHJ1+lV00O1GnOGWoJVX1EEDuXnH4M8hyd62PKIVtQyGu9GSZ3QtIh9yC3Zf/5xM1/w8UgoA2MQAgP+a8Zjdo+WXdNF4dRl/olE0tVKbAZRd5LXOTA9O1VqMmNDfvK32Rhw6iJkBCS4zi9D5OUz4KTgZzkqDt5hLAVy5kMEI1nG0Fvh56yTcASCoxbbRZdqPnGgEm0KpzeZg2cEOHZfpwanaX55btK32RjQetBgbnpjJaE3is9pT/BragM3eze0pfqKhsBQYTW15H1N8JG1wX6arsCXF9sIYMENgr2X5QIRE6oGmpkDZ/mM6d6YHp2rLLtjJ7EVA4jPTxNxdleuaunHlYkJlqlkDPUXY1JXavmSMlAL7+rGJmTBlHxmswJgpqw0AEs7Cca+4bCB9OyNdC3v68u042nKsBkhY7IqIiX5ixOs9egIDF4u9Hl6Dp7N6bEVeD58IWylQ3w0dk+hpbx40IcHX0gYAo0bUnl6uKxK/hQhQHyXJrjJdfhZ7ObV4U0AgCgjTol3rTPmItqQ+sGlrsVSw1eDXIHQPD7LI4K/O2VwKUElb72EMW5L3Ox8eycpNrGsfAlgdymwrtWdnASAY5b14LvJ1VUSHMP/+DBIXcT8hCUFAAgDNRDK7UiDLmrn+pVjkKTpI0UGKDlJ0kKKDFB2k6CBFByk6SNFBig5a4YRuu+74BjqIJO07yQILSsiCi5gi9L3oJQpqxMV0EFnqie5hm673Jm3JJeF/66t/t8Eb6CAAarBxghr+OCRO81pHXRdMnTdv60QjBvNgtwj8lQGMnRfhP8cA4KwU7KP0FStcFg72S/4poH2WPUdDvDgJj8sy50k8T3sxctnh6FziPXuJ2Qo12HWcGv44KhNoa44OxK63FNYWOT94yGyoKqYy29MlSNnHtVTcLtsHDlzMbs2Q7t3taAfApbcl0sbDZFd7cnP89IOdhztPGw58asnlQ3ZTOx4hP2HBWvLDthkD0HGgLjm1YJGOfOJ+fcFU6MDuBCcBW0ob+5S+8gE37HGVGSc1oAzYZkexXRP+28E9cFObENS1tyAZOvZwZ64TycuggwA1+nZCjfYqIV5EmaWuK6TmFr0iwN6TYpKTwIirS992yOsRYc/1ejgNKANKbTDQEZBLOzHmSgGV294CDXTs4c6iSSQuvQ4iyTE1kDqjhrjB05ViKEZdF1rqogA5nZj7gJPAkJbYz+pKiiSgxJhDa0AZMJVu3AUN3JUApIKt+mBNQdrwAsjlJON9y71nF2/ls9MiHxgnhRaMUOh6rRSWQGFrdM08aHe4tTEhH/ymYntMgCg6SNFBig5aKR0UI6cVeHZuenzY2i87ifLcc2f7rcPj8+dHJCHoc18Ztw0PDV6QWQaHhm3jVyIneihJ5Bive9oxOTEuu0xMOqbdXoYTJUpFiaIQYnxzlMs5K7s4XdScjwkJokipOEqU/zlEkRJU4N1umqLcLqcs43JTFO12C/gf9yt5MBYZj1cAAAAASUVORK5CYII=", "description": "Widgets to manage ThingsBoard IoT Gateway instances.", "order": 15000, - "externalId": null, "name": "Gateway widgets" }, "widgetTypeFqns": [ @@ -17,6 +16,7 @@ "gateway_widgets.gateway_logs", "gateway_widgets.gateway_custom_statistics", "gateway_widgets.gateway_general_chart_statistics", - "gateway_widgets.service_rpc" + "gateway_widgets.service_rpc", + "gateway_widgets.gateway_status" ] } diff --git a/application/src/main/data/json/system/widget_types/gateway_general_configuration.json b/application/src/main/data/json/system/widget_types/gateway_general_configuration.json index 600f689786..bffeedac36 100644 --- a/application/src/main/data/json/system/widget_types/gateway_general_configuration.json +++ b/application/src/main/data/json/system/widget_types/gateway_general_configuration.json @@ -16,7 +16,7 @@ ], "templateHtml": "", "templateCss": "", - "controllerScript": "self.onInit = function() {\n if (self.ctx.datasources && self.ctx.datasources.length) {\n self.ctx.$scope.entityId = self.ctx.datasources[0].entity.id;\n self.ctx.$scope.defaultTab = self.ctx.stateController\n .getStateParams()?.defaultTab;\n }\n};\n\nself.typeParameters = function() {\n return {\n dataKeysOptional: true,\n singleEntity: true\n };\n}", "settingsSchema": "{}", + "controllerScript": "self.onInit = function() {\n if (self.ctx.datasources && self.ctx.datasources.length) {\n self.ctx.$scope.entityId = self.ctx.datasources[0].entity.id;\n self.ctx.$scope.defaultTab = self.ctx.stateController?.getStateParams()?.defaultTab;\n }\n};\n\nself.typeParameters = function() {\n return {\n dataKeysOptional: true,\n singleEntity: true\n };\n}", "dataKeySettingsSchema": "{}\n", "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"var value = prevValue + Math.random() * 100 - 50;\\nvar multiplier = Math.pow(10, 2 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -1000) {\\n\\tvalue = -1000;\\n} else if (value > 1000) {\\n\\tvalue = 1000;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{},\"title\":\"Gateway configuration\",\"showTitleIcon\":false,\"titleTooltip\":\"\",\"dropShadow\":true,\"enableFullscreen\":false,\"enableDataExport\":false,\"widgetStyle\":{},\"widgetCss\":\"\",\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":500},\"pageSize\":1024,\"noDataDisplayMessage\":\"\",\"showLegend\":false}" }, diff --git a/application/src/main/data/json/system/widget_types/gateway_status.json b/application/src/main/data/json/system/widget_types/gateway_status.json index 122afa51eb..b695d5bbfd 100644 --- a/application/src/main/data/json/system/widget_types/gateway_status.json +++ b/application/src/main/data/json/system/widget_types/gateway_status.json @@ -19,7 +19,6 @@ "controllerScript": "self.onInit = function() {\n if (self.ctx.datasources && self.ctx.datasources.length) {\n self.ctx.$scope.entityId = self.ctx.datasources[0].entity.id;\n }\n};\n\nself.onDataUpdated = function() {\n self.ctx.$scope.gatewayStatus?.onDataUpdated();\n};", "settingsSchema": "", "dataKeySettingsSchema": "", - "settingsDirective": "tb-gateway-status", "defaultConfig": "{\"datasources\":[{\"type\":\"static\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"var value = prevValue + Math.random() * 100 - 50;\\nvar multiplier = Math.pow(10, 2 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -1000) {\\n\\tvalue = -1000;\\n} else if (value > 1000) {\\n\\tvalue = 1000;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"cardHtml\":\"
    HTML code here
    \",\"cardCss\":\".card {\\n font-weight: bold;\\n font-size: 32px;\\n color: #999;\\n width: 100%;\\n height: 100%;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n}\"},\"title\":\"HTML Card\",\"dropShadow\":true}" }, "tags": [ diff --git a/application/src/main/data/resources/dashboards/gateways_dashboard.json b/application/src/main/data/resources/dashboards/gateways_dashboard.json index 71bcad3b66..381c9f6de0 100644 --- a/application/src/main/data/resources/dashboards/gateways_dashboard.json +++ b/application/src/main/data/resources/dashboards/gateways_dashboard.json @@ -213,7 +213,6 @@ "showWidgetActionFunction": "return true;", "type": "customPretty", "customHtml": "\n\n\n", - "customCss": ".gateway-config {\n width: 800px !important;\n padding: 0 !important;\n min-height: 75vh;\n max-width: 100%;\n display: grid !important;\n}\n\n@media screen and (max-width: 599px) {\n .mat-mdc-dialog-content {\n max-height: calc(100% - 60px) !important;\n }\n}", "customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\n\nopenAddEntityDialog();\n\nfunction openAddEntityDialog() {\n customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe();\n}\n\nfunction AddEntityDialogController(instance) {\n let vm = instance;\n \n vm.device = additionalParams.entity.id;\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n}\n", "customResources": [ { @@ -270,13 +269,15 @@ "headerButton": [ { "name": "Add Gateway", + "buttonType": "icon", "icon": "add", + "buttonColor": "rgba(0, 0, 0, 0.87)", "useShowWidgetActionFunction": null, "showWidgetActionFunction": "return true;", "type": "customPretty", "customHtml": "\r\n \r\n

    Add gateway

    \r\n \r\n \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n Name\r\n \r\n \r\n Gateway name is required.\r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n\r\n", "customCss": ".add-entity-form {\r\n min-width: 400px !important;\r\n}\r\n\r\n.add-entity-form .boolean-value-input {\r\n padding-left: 5px;\r\n}\r\n\r\n.add-entity-form .boolean-value-input .checkbox-label {\r\n margin-bottom: 8px;\r\n color: rgba(0,0,0,0.54);\r\n font-size: 12px;\r\n}\r\n\r\n.relations-list .header {\r\n padding-right: 5px;\r\n padding-bottom: 5px;\r\n padding-left: 5px;\r\n}\r\n\r\n.relations-list .header .cell {\r\n padding-right: 5px;\r\n padding-left: 5px;\r\n font-size: 12px;\r\n font-weight: 700;\r\n color: rgba(0, 0, 0, .54);\r\n white-space: nowrap;\r\n}\r\n\r\n.relations-list .mat-form-field-infix {\r\n width: auto !important;\r\n}\r\n\r\n.relations-list .body {\r\n padding-right: 5px;\r\n padding-bottom: 15px;\r\n padding-left: 5px;\r\n}\r\n\r\n.relations-list .body .row {\r\n padding-top: 5px;\r\n}\r\n\r\n.relations-list .body .cell {\r\n padding-right: 5px;\r\n padding-left: 5px;\r\n}\r\n\r\n.relations-list .body .md-button {\r\n margin: 0;\r\n}\r\n\r\n", - "customFunction": "let $injector = widgetContext.$scope.$injector;\r\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\r\nlet assetService = $injector.get(widgetContext.servicesMap.get('assetService'));\r\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\r\nlet attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));\r\nlet entityRelationService = $injector.get(widgetContext.servicesMap.get('entityRelationService'));\r\nlet userSettingsService = $injector.get(widgetContext.servicesMap.get('userSettingsService'));\r\n\r\nopenAddEntityDialog();\r\n\r\nfunction openAddEntityDialog() {\r\n customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe();\r\n}\r\n\r\nfunction AddEntityDialogController(instance) {\r\n let vm = instance;\r\n let userSettings;\r\n userSettingsService.loadUserSettings().subscribe(settings=> {\r\n userSettings = settings;\r\n if (!userSettings.createdGatewaysCount) userSettings.createdGatewaysCount = 0;\r\n });\r\n \r\n\r\n vm.addEntityFormGroup = vm.fb.group({\r\n entityName: ['', [vm.validators.required]],\r\n entityType: ['DEVICE'],\r\n entityLabel: [''],\r\n type: ['', [vm.validators.required]],\r\n });\r\n\r\n vm.cancel = function() {\r\n vm.dialogRef.close(null);\r\n };\r\n\r\n\r\n vm.save = function($event) {\r\n vm.addEntityFormGroup.markAsPristine();\r\n saveEntityObservable().subscribe(\r\n function (device) {\r\n widgetContext.updateAliases();\r\n userSettingsService.putUserSettings({ createdGatewaysCount: ++userSettings.createdGatewaysCount }).subscribe(_=>{\r\n });\r\n vm.dialogRef.close(null);\r\n openCommandDialog(device, $event);\r\n }\r\n );\r\n };\r\n \r\n function openCommandDialog(device, $event) {\r\n vm.device = device;\r\n let openCommandAction = widgetContext.actionsApi.getActionDescriptors(\"actionCellButton\").find(action => action.name == \"Launch command\");\r\n widgetContext.actionsApi.handleWidgetAction($event, openCommandAction, device.id, device.name, {newDevice: true});\r\n goToConfigState();\r\n }\r\n\r\n \r\n function goToConfigState() {\r\n const stateParams = {};\r\n stateParams.entityId = vm.device.id;\r\n stateParams.entityName = vm.device.name;\r\n const newStateParams = {\r\n targetEntityParamName: 'default',\r\n new_gateway: {\r\n entityId: vm.device.id,\r\n entityName: vm.device.name\r\n }\r\n }\r\n const params = {...stateParams, ...newStateParams};\r\n widgetContext.stateController.openState('gateway_details', params, false);\r\n }\r\n\r\n function saveEntityObservable() {\r\n const formValues = vm.addEntityFormGroup.value;\r\n let entity = {\r\n name: formValues.entityName,\r\n type: formValues.type,\r\n label: formValues.entityLabel,\r\n additionalInfo: {\r\n gateway: true\r\n }\r\n };\r\n return deviceService.saveDevice(entity);\r\n }\r\n}\r\n", + "customFunction": "let $injector = widgetContext.$scope.$injector;\r\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\r\nlet assetService = $injector.get(widgetContext.servicesMap.get('assetService'));\r\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\r\nlet attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));\r\nlet entityRelationService = $injector.get(widgetContext.servicesMap.get('entityRelationService'));\r\nlet userSettingsService = $injector.get(widgetContext.servicesMap.get('userSettingsService'));\r\n\r\nopenAddEntityDialog();\r\n\r\nfunction openAddEntityDialog() {\r\n customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe();\r\n}\r\n\r\nfunction AddEntityDialogController(instance) {\r\n let vm = instance;\r\n let userSettings;\r\n userSettingsService.loadUserSettings().subscribe(settings=> {\r\n userSettings = settings;\r\n if (!userSettings.createdGatewaysCount) userSettings.createdGatewaysCount = 0;\r\n });\r\n \r\n\r\n vm.addEntityFormGroup = vm.fb.group({\r\n entityName: ['', [vm.validators.required]],\r\n entityType: ['DEVICE'],\r\n entityLabel: [''],\r\n type: ['', [vm.validators.required]],\r\n });\r\n\r\n vm.cancel = function() {\r\n vm.dialogRef.close(null);\r\n };\r\n\r\n\r\n vm.save = function($event) {\r\n vm.addEntityFormGroup.markAsPristine();\r\n saveEntityObservable().subscribe(\r\n function (device) {\r\n widgetContext.updateAliases();\r\n userSettingsService.putUserSettings({ createdGatewaysCount: ++userSettings.createdGatewaysCount }).subscribe(_=>{\r\n });\r\n vm.dialogRef.close(null);\r\n openCommandDialog(device, $event);\r\n }\r\n );\r\n };\r\n \r\n function openCommandDialog(device, $event) {\r\n vm.device = device;\r\n let openCommandAction = widgetContext.actionsApi.getActionDescriptors(\"actionCellButton\").find(action => action.name == \"Launch command\");\r\n setTimeout(() => {\r\n widgetContext.actionsApi.handleWidgetAction($event, openCommandAction, device.id, device.name, {newDevice: true});\r\n });\r\n goToConfigState();\r\n }\r\n\r\n \r\n function goToConfigState() {\r\n const stateParams = {};\r\n stateParams.entityId = vm.device.id;\r\n stateParams.entityName = vm.device.name;\r\n const newStateParams = {\r\n targetEntityParamName: 'default',\r\n new_gateway: {\r\n entityId: vm.device.id,\r\n entityName: vm.device.name\r\n }\r\n }\r\n const params = {...stateParams, ...newStateParams};\r\n widgetContext.stateController.openState('gateway_details', params, false);\r\n }\r\n\r\n function saveEntityObservable() {\r\n const formValues = vm.addEntityFormGroup.value;\r\n let entity = {\r\n name: formValues.entityName,\r\n type: formValues.type,\r\n label: formValues.entityLabel,\r\n additionalInfo: {\r\n gateway: true\r\n }\r\n };\r\n return deviceService.saveDevice(entity);\r\n }\r\n}\r\n", "customResources": [], "openInSeparateDialog": false, "openInPopover": false, @@ -562,6 +563,14 @@ "color": "#ffeb3b", "settings": {}, "_hash": 0.2770587478725004 + }, + { + "name": "Version", + "type": "attribute", + "label": "Version", + "color": "#03a9f4", + "settings": {}, + "_hash": 0.007837366355011532 } ], "alarmFilterConfig": { @@ -641,7 +650,7 @@ "settings": { "useMarkdownTextFunction": true, "markdownTextPattern": "# Markdown/HTML card \\n - **Current entity**: **${entityName}**. \\n - **Current value**: **${Random}**.", - "markdownTextFunction": "var blockData = '';\nvar connectorsIndex = ctx.actionsApi.getActionDescriptors('elementClick').findIndex(action => action.name == \"Connectors\");\nvar logsIndex = ctx.actionsApi.getActionDescriptors('elementClick').findIndex(action => action.name == \"Logs\");\nfunction generateMatHeader(index) {\n if (index !== undefined && index > -1) {\n return ``\n } else {\n return \"\"\n }\n}\nfunction createDataBlock(value, label, dividerStyle, mobile, index) {\n blockData += `\n \n
    \n \n ${generateMatHeader(index)}\n ${label}\n
    \n ${value}\n `;\n}\ncreateDataBlock(data[0].Status, \"Status\", data[0].Status === \"Active\" ? 'divider-green' : 'divider-red');\ncreateDataBlock(data[0].Name, \"Gateway Name\", '', ctx.isMobile);\ncreateDataBlock(data[0].Type, \"Gateway Type\", '');\ncreateDataBlock(\n `${(data[1] ? data[1].count : 0)} `\n + \" | \" +\n `${(data[2] ? data[2][\"count 2\"] : 0)} `\n , \"Devices (Active | Inactive)\", '');\ncreateDataBlock(\n `${(data[0].active_connectors ? JSON.parse(data[0].active_connectors).length : 0)} `\n + \" | \" +\n `${(data[0].inactive_connectors ? JSON.parse(data[0].inactive_connectors).length : 0)} `\n , \"Connectors (Enabled | Disabled)\", '', '', connectorsIndex);\ncreateDataBlock(data[0].ALL_ERRORS_COUNT || 0, \"Errors\", (data[0].ALL_ERRORS_COUNT || 0) === 0 ? 'divider-green' : 'divider-red', '', logsIndex);\nreturn `
    ${blockData}
    `;", + "markdownTextFunction": "var blockData = '';\nvar connectorsIndex = ctx.actionsApi.getActionDescriptors('elementClick').findIndex(action => action.name == \"Connectors\");\nvar logsIndex = ctx.actionsApi.getActionDescriptors('elementClick').findIndex(action => action.name == \"Logs\");\nfunction generateMatHeader(index) {\n if (index !== undefined && index > -1) {\n return ``\n } else {\n return \"\"\n }\n}\nfunction createDataBlock(value, label, dividerStyle, mobile, index) {\n blockData += `\n \n
    \n \n ${generateMatHeader(index)}\n ${label}\n
    \n ${value}\n `;\n}\ncreateDataBlock(data[0].Status, \"Status\", data[0].Status === \"Active\" ? 'divider-green' : 'divider-red');\ncreateDataBlock(data[0].Name, \"Gateway Name\", '', ctx.isMobile);\nif (data[0].Version) {\n createDataBlock(data[0].Version, \"Gateway Version\", '');\n}\ncreateDataBlock(data[0].Type, \"Gateway Type\", '');\ncreateDataBlock(\n `${(data[1] ? data[1].count : 0)} `\n + \" | \" +\n `${(data[2] ? data[2][\"count 2\"] : 0)} `\n , \"Devices (Active | Inactive)\", '');\ncreateDataBlock(\n `${(data[0].active_connectors ? JSON.parse(data[0].active_connectors).length : 0)} `\n + \" | \" +\n `${(data[0].inactive_connectors ? JSON.parse(data[0].inactive_connectors).length : 0)} `\n , \"Connectors (Enabled | Disabled)\", '', '', connectorsIndex);\ncreateDataBlock(data[0].ALL_ERRORS_COUNT || 0, \"Errors\", (data[0].ALL_ERRORS_COUNT || 0) === 0 ? 'divider-green' : 'divider-red', '', logsIndex);\nreturn `
    ${blockData}
    `;", "applyDefaultMarkdownStyle": false, "markdownCss": ".divider {\n position: absolute;\n width: 3px;\n top: 8px;\n border-radius: 2px;\n bottom: 8px;\n border: 1px solid rgba(31, 70, 144, 1);\n background-color: rgba(31, 70, 144, 1);\n left: 10px;\n}\n.divider-green .divider {\n border: 1px solid rgb(25,128,56);\n background-color: rgb(25,128,56);\n}\n\n.divider-green .mat-mdc-card-content {\n color: rgb(25,128,56);\n}\n\n.divider-red .divider {\n border: 1px solid rgb(203,37,48);\n background-color: rgb(203,37,48);\n}\n\n.divider-red .mat-mdc-card-content {\n color: rgb(203,37,48);\n}\n\n.mdc-card {\n position: relative;\n padding-left: 10px;\n margin-bottom: 1px;\n}\n\n.mat-mdc-card-subtitle {\n font-weight: 400;\n font-size: 12px;\n}\n\n.mat-mdc-card-header {\n padding: 8px 16px 0;\n}\n\n.mat-mdc-card-content:last-child {\n padding-bottom: 8px;\n font-size: 16px;\n}\n\n.cards-container {\n height: calc(100% - 1px);\n justify-content: stretch;\n align-items: center;\n margin-bottom: 1px;\n}\n\n::ng-deep.tb-home-widget-link > div {\n flex-grow: 1;\n cursor: pointer;\n}\n\n .tb-home-widget-link {\n width: 100%;\n }\n\n .tb-home-widget-link:hover::after{\n color: inherit;\n }\n \n .tb-home-widget-link::after{\n content: 'arrow_forward';\n display: inline-block;\n transform: rotate(315deg);\n font-family: 'Material Icons';\n font-weight: normal;\n font-style: normal;\n font-size: 18px;\n color: rgba(0, 0, 0, 0.12);\n vertical-align: bottom;\n margin-left: 6px;\n}" }, @@ -1066,7 +1075,7 @@ { "name": "SERVICE_LOGS", "type": "timeseries", - "label": "Status", + "label": "{i18n:widgets.gateway.level}", "color": "#4caf50", "settings": { "useCellStyleFunction": false, @@ -1084,7 +1093,7 @@ { "name": "SERVICE_LOGS", "type": "timeseries", - "label": "Details", + "label": "{i18n:widgets.gateway.message}", "color": "#2196f3", "settings": { "useCellStyleFunction": false, @@ -1104,13 +1113,11 @@ "statusList": [ "ACTIVE" ] - } + }, + "latestDataKeys": [] } ], "timewindow": { - "hideInterval": false, - "hideLastInterval": false, - "hideQuickInterval": false, "hideAggregation": false, "hideAggInterval": false, "hideTimezone": false, @@ -1167,7 +1174,11 @@ "pageSize": 1024, "noDataDisplayMessage": "", "enableDataExport": false, - "borderRadius": "4px" + "borderRadius": "4px", + "configMode": "basic", + "titleFont": null, + "titleColor": null, + "titleIcon": null }, "row": 0, "col": 0, @@ -1730,7 +1741,8 @@ "padding": "8px", "settings": { "useMarkdownTextFunction": true, - "markdownTextFunction": "let buttonsHtml = \"\" \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n let disabled = false;\n if (index == 2) {\n disabled = data[0] && data[0].RemoteLoggingLevel ? data[0].RemoteLoggingLevel == \"NONE\" : true;\n } else if (index == 4) {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = !conf.remoteShell;\n }\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", + "markdownTextPattern": "# Markdown/HTML card \\n - **Current entity**: **${entityName}**. \\n - **Current value**: **${Random}**.", + "markdownTextFunction": "let buttonsHtml = \"\" \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n let disabled = false;\n if (index == 2) {\n disabled = data[0] && data[0].RemoteLoggingLevel ? data[0].RemoteLoggingLevel == \"NONE\" : true;\n } else if (index == 3) {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = typeof conf.statistics?.enable === 'boolean' && !conf.statistics.enable;\n } else if (index == 4) {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = !conf.remoteShell;\n }\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", "applyDefaultMarkdownStyle": false, "markdownCss": ".action-buttons-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n align-content: start;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n line-height: 36px;\n}" }, @@ -1862,31 +1874,14 @@ "type": "entity", "name": "function", "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "dataKeys": [], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "bd9176e1-9e04-3e9b-d5a5-07b72bb9ae90", "dataKeys": [ { - "name": "count", - "type": "count", - "label": "mqttCount", - "color": "#4caf50", + "name": "connectorType", + "type": "attribute", + "label": "connectorType", + "color": "#9e9e9e", "settings": {}, - "_hash": 0.9590451878027946, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null + "_hash": 0.9675646714923356 } ], "alarmFilterConfig": { @@ -1894,620 +1889,205 @@ "ACTIVE" ] } + } + ], + "timewindow": { + "displayValue": "", + "selectedTab": 0, + "realtime": { + "realtimeType": 1, + "interval": 1000, + "timewindowMs": 60000, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideQuickInterval": false + }, + "history": { + "historyType": 0, + "interval": 1000, + "timewindowMs": 60000, + "fixedTimewindow": { + "startTimeMs": 1686652103417, + "endTimeMs": 1686738503417 + }, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideFixedInterval": false, + "hideQuickInterval": false + }, + "aggregation": { + "type": "AVG", + "limit": 25000 + } + }, + "showTitle": false, + "backgroundColor": "#fff", + "color": "rgba(0, 0, 0, 0.87)", + "padding": "0px", + "settings": { + "useMarkdownTextFunction": true, + "markdownTextPattern": "", + "markdownTextFunction": "const count = {\n mqtt: 0,\n modbus: 0,\n grpc: 0,\n opcua: 0,\n ble: 0,\n request: 0,\n can: 0,\n bacnet: 0,\n odbc: 0,\n rest: 0,\n snmp: 0,\n ftp: 0,\n socket: 0,\n xmpp: 0,\n ocpp: 0,\n knx: 0,\n custom: 0\n};\n\ndata.forEach(entity => count[entity.connectorType] = count[entity.connectorType]+1);\n\nlet result = `
    \n \n \n \n `;\n\nObject.keys(count).forEach(key => {\n if (count[key]) {\n result = result + \n `\n \n `\n } \n});\n\nresult = result + '
    ';\n\nreturn result;", + "applyDefaultMarkdownStyle": false, + "markdownCss": ".mat-mdc-form-field-subscript-wrapper {\n display: none !important;\n}\n\n.devices-tabs {\n height: 100%;\n}\n\n::ng-deep .mat-mdc-tab-body-wrapper {\n height: 100%;\n}" + }, + "title": "Gateway devices", + "showTitleIcon": false, + "iconColor": "rgba(0, 0, 0, 0.87)", + "iconSize": "24px", + "titleTooltip": "", + "dropShadow": true, + "enableFullscreen": false, + "widgetStyle": {}, + "titleStyle": { + "fontSize": "16px", + "fontWeight": 400 + }, + "showLegend": false, + "useDashboardTimewindow": true, + "displayTimewindow": true, + "widgetCss": "", + "pageSize": 1024, + "noDataDisplayMessage": "", + "enableDataExport": false, + "borderRadius": "4px" + }, + "row": 0, + "col": 0, + "id": "3d661190-7463-ba61-6793-503c85af67ec", + "typeFullFqn": "system.cards.markdown_card" + }, + "1615bd4e-c0a4-c32c-3706-3c83214cb8d7": { + "type": "latest", + "sizeX": 7.5, + "sizeY": 6.5, + "config": { + "timewindow": { + "displayValue": "", + "selectedTab": 0, + "realtime": { + "realtimeType": 1, + "interval": 1000, + "timewindowMs": 86400000, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideQuickInterval": false + }, + "history": { + "historyType": 0, + "interval": 1000, + "timewindowMs": 60000, + "fixedTimewindow": { + "startTimeMs": 1684327643501, + "endTimeMs": 1684414043501 + }, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideFixedInterval": false, + "hideQuickInterval": false }, + "aggregation": { + "type": "NONE", + "limit": 200 + } + }, + "showTitle": true, + "backgroundColor": "rgb(255, 255, 255)", + "color": "rgba(0, 0, 0, 0.87)", + "padding": "4px", + "settings": { + "entitiesTitle": "Devices", + "enableSearch": true, + "enableSelectColumnDisplay": true, + "enableStickyHeader": true, + "enableStickyAction": true, + "reserveSpaceForHiddenAction": "true", + "displayEntityName": true, + "entityNameColumnTitle": "Device Name", + "displayEntityLabel": false, + "displayEntityType": false, + "displayPagination": true, + "defaultPageSize": 10, + "defaultSortOrder": "entityName", + "useRowStyleFunction": false + }, + "title": "Devices", + "dropShadow": true, + "enableFullscreen": true, + "titleStyle": { + "fontSize": "16px", + "fontWeight": 400, + "padding": "5px 10px 5px 10px" + }, + "useDashboardTimewindow": false, + "showLegend": false, + "datasources": [ { - "type": "entityCount", + "type": "entity", + "name": null, "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "44038462-1bae-e075-7b31-283341cb2295", + "filterId": null, "dataKeys": [ { - "name": "count", - "type": "count", - "label": "modbusCount", - "color": "#ff5722", + "name": "type", + "type": "entityField", + "label": "Device Type", + "color": "#2196f3", "settings": {}, - "_hash": 0.46402083951505624, + "_hash": 0.3129929097366162, "aggregationType": null, "units": null, "decimals": null, "funcBody": null, "usePostProcessing": null, "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "884e9c34-7534-a483-99be-81b56cd91185", - "dataKeys": [ + }, { - "name": "count", - "type": "count", - "label": "grpcCount", + "name": "active", + "type": "attribute", + "label": "Status", + "color": "#4caf50", + "settings": { + "columnWidth": "0px", + "useCellStyleFunction": false, + "useCellContentFunction": true, + "cellContentFunction": "let cssClass;\r\nswitch (value) {\r\n case \"Active\":\r\n cssClass = \"status status-active\";\r\n break;\r\n case \"Inactive\":\r\n default:\r\n cssClass = \"status status-inactive\";\r\n break;\r\n }\r\n \r\n return `${value}`;", + "defaultColumnVisibility": "visible", + "columnSelectionToDisplay": "enabled" + }, + "_hash": 0.5969880627410065, + "aggregationType": null, + "units": null, + "decimals": null, + "funcBody": null, + "usePostProcessing": true, + "postFuncBody": "return value == 'true' ? \"Active\": \"Inactive\";" + }, + { + "name": "connectorName", + "type": "attribute", + "label": "Connector Name", "color": "#f44336", "settings": {}, - "_hash": 0.16110429492126088, + "_hash": 0.012483045440007778, "aggregationType": null, "units": null, "decimals": null, "funcBody": null, "usePostProcessing": null, "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "e91ca0e9-1653-4fbc-5f3d-3da021b1b415", - "dataKeys": [ + }, { - "name": "count", - "type": "count", - "label": "opcuaCount", + "name": "connectorType", + "type": "attribute", + "label": "Connector Type", "color": "#ffc107", "settings": {}, - "_hash": 0.13973521146913304, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "3f74cbaa-6353-5e88-a7e8-708fc0e18039", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "bleCount", - "color": "#607d8b", - "settings": {}, - "_hash": 0.7205723252294653, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "c08eee84-64ee-73c4-8d96-c0df813a92cd", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "requestCount", - "color": "#9c27b0", - "settings": {}, - "_hash": 0.6993292961463216, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "2f0af7f5-22ea-c0d5-3aef-7f2bb1b534ec", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "canCount", - "color": "#8bc34a", - "settings": {}, - "_hash": 0.4850065031079176, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "92a7d208-c143-ea20-5162-1da584532830", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "bacnetCount", - "color": "#3f51b5", - "settings": {}, - "_hash": 0.36987531665233075, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "498f090c-b1e5-df74-35d1-3ecf89d33f1c", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "odbcCount", - "color": "#e91e63", - "settings": {}, - "_hash": 0.8279345016611896, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "9175179d-a8db-848b-0762-e78da150e768", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "restCount", - "color": "#ffeb3b", - "settings": {}, - "_hash": 0.07245826389852739, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "9175179d-a8db-848b-0762-e78da150e768", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "restCount", - "color": "#03a9f4", - "settings": {}, - "_hash": 0.4321492578560704, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "1b70460b-428b-2aed-f23a-65927d3e67bb", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "snmpCount", - "color": "#ff9800", - "settings": {}, - "_hash": 0.7395574625078822, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "ae357478-b4c2-eee8-dde6-a6942fe6202f", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "ftpCount", - "color": "#673ab7", - "settings": {}, - "_hash": 0.9999791065203374, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "6eef4979-369f-c2cc-4894-96a84b6a668a", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "socketCount", - "color": "#cddc39", - "settings": {}, - "_hash": 0.47563823619478685, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "9c8e3a63-01a1-64b5-fe44-4f58f8350340", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "xmppCount", - "color": "#009688", - "settings": {}, - "_hash": 0.5679285702280172, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "c6501413-d823-29c4-992f-9ae6e8e25549", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "ocppCount", - "color": "#795548", - "settings": {}, - "_hash": 0.38390880166484287, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - }, - { - "type": "entityCount", - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": "2f04d6e5-8438-857a-ca78-ae78cc8b0c03", - "dataKeys": [ - { - "name": "count", - "type": "count", - "label": "customCount", - "color": "#00bcd4", - "settings": {}, - "_hash": 0.9282529984749979, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - } - ], - "alarmFilterConfig": { - "statusList": [ - "ACTIVE" - ] - } - } - ], - "timewindow": { - "displayValue": "", - "selectedTab": 0, - "realtime": { - "realtimeType": 1, - "interval": 1000, - "timewindowMs": 60000, - "quickInterval": "CURRENT_DAY", - "hideInterval": false, - "hideLastInterval": false, - "hideQuickInterval": false - }, - "history": { - "historyType": 0, - "interval": 1000, - "timewindowMs": 60000, - "fixedTimewindow": { - "startTimeMs": 1686652103417, - "endTimeMs": 1686738503417 - }, - "quickInterval": "CURRENT_DAY", - "hideInterval": false, - "hideLastInterval": false, - "hideFixedInterval": false, - "hideQuickInterval": false - }, - "aggregation": { - "type": "AVG", - "limit": 25000 - } - }, - "showTitle": false, - "backgroundColor": "#fff", - "color": "rgba(0, 0, 0, 0.87)", - "padding": "0px", - "settings": { - "useMarkdownTextFunction": false, - "markdownTextPattern": "
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n", - "applyDefaultMarkdownStyle": false, - "markdownCss": ".mat-mdc-form-field-subscript-wrapper {\n display: none !important;\n}\n\n.devices-tabs {\n height: 100%;\n}\n\n::ng-deep .mat-mdc-tab-body-wrapper {\n height: 100%;\n}" - }, - "title": "Gateway devices", - "showTitleIcon": false, - "iconColor": "rgba(0, 0, 0, 0.87)", - "iconSize": "24px", - "titleTooltip": "", - "dropShadow": true, - "enableFullscreen": false, - "widgetStyle": {}, - "titleStyle": { - "fontSize": "16px", - "fontWeight": 400 - }, - "showLegend": false, - "useDashboardTimewindow": true, - "displayTimewindow": true, - "widgetCss": "", - "pageSize": 1024, - "noDataDisplayMessage": "", - "enableDataExport": false, - "borderRadius": "4px" - }, - "row": 0, - "col": 0, - "id": "3d661190-7463-ba61-6793-503c85af67ec", - "typeFullFqn": "system.cards.markdown_card" - }, - "1615bd4e-c0a4-c32c-3706-3c83214cb8d7": { - "type": "latest", - "sizeX": 7.5, - "sizeY": 6.5, - "config": { - "timewindow": { - "displayValue": "", - "selectedTab": 0, - "realtime": { - "realtimeType": 1, - "interval": 1000, - "timewindowMs": 86400000, - "quickInterval": "CURRENT_DAY", - "hideInterval": false, - "hideLastInterval": false, - "hideQuickInterval": false - }, - "history": { - "historyType": 0, - "interval": 1000, - "timewindowMs": 60000, - "fixedTimewindow": { - "startTimeMs": 1684327643501, - "endTimeMs": 1684414043501 - }, - "quickInterval": "CURRENT_DAY", - "hideInterval": false, - "hideLastInterval": false, - "hideFixedInterval": false, - "hideQuickInterval": false - }, - "aggregation": { - "type": "NONE", - "limit": 200 - } - }, - "showTitle": true, - "backgroundColor": "rgb(255, 255, 255)", - "color": "rgba(0, 0, 0, 0.87)", - "padding": "4px", - "settings": { - "entitiesTitle": "Devices", - "enableSearch": true, - "enableSelectColumnDisplay": true, - "enableStickyHeader": true, - "enableStickyAction": true, - "reserveSpaceForHiddenAction": "true", - "displayEntityName": true, - "entityNameColumnTitle": "Device Name", - "displayEntityLabel": false, - "displayEntityType": false, - "displayPagination": true, - "defaultPageSize": 10, - "defaultSortOrder": "entityName", - "useRowStyleFunction": false - }, - "title": "Devices", - "dropShadow": true, - "enableFullscreen": true, - "titleStyle": { - "fontSize": "16px", - "fontWeight": 400, - "padding": "5px 10px 5px 10px" - }, - "useDashboardTimewindow": false, - "showLegend": false, - "datasources": [ - { - "type": "entity", - "name": null, - "entityAliasId": "a75d9031-ba51-8da4-81be-de65061b72f4", - "filterId": null, - "dataKeys": [ - { - "name": "type", - "type": "entityField", - "label": "Device Type", - "color": "#2196f3", - "settings": {}, - "_hash": 0.3129929097366162, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - }, - { - "name": "active", - "type": "attribute", - "label": "Status", - "color": "#4caf50", - "settings": { - "columnWidth": "0px", - "useCellStyleFunction": false, - "useCellContentFunction": true, - "cellContentFunction": "let cssClass;\r\nswitch (value) {\r\n case \"Active\":\r\n cssClass = \"status status-active\";\r\n break;\r\n case \"Inactive\":\r\n default:\r\n cssClass = \"status status-inactive\";\r\n break;\r\n }\r\n \r\n return `${value}`;", - "defaultColumnVisibility": "visible", - "columnSelectionToDisplay": "enabled" - }, - "_hash": 0.5969880627410065, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": true, - "postFuncBody": "return value == 'true' ? \"Active\": \"Inactive\";" - }, - { - "name": "connectorName", - "type": "attribute", - "label": "Connector Name", - "color": "#f44336", - "settings": {}, - "_hash": 0.012483045440007778, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": null, - "postFuncBody": null - }, - { - "name": "connectorType", - "type": "attribute", - "label": "Connector Type", - "color": "#ffc107", - "settings": {}, - "_hash": 0.6004192233378134, + "_hash": 0.6004192233378134, "aggregationType": null, "units": null, "decimals": null, @@ -5333,7 +4913,16 @@ "type": "entity", "name": "", "entityAliasId": "a2f01c66-96cf-49c5-303f-e6f21c559ee8", - "dataKeys": [], + "dataKeys": [ + { + "name": "general_configuration", + "type": "attribute", + "label": "general_configuration", + "color": "#2196f3", + "settings": {}, + "_hash": 0.3480165322736335 + } + ], "alarmFilterConfig": { "statusList": [ "ACTIVE" @@ -5379,7 +4968,7 @@ "settings": { "useMarkdownTextFunction": true, "markdownTextPattern": "let buttonsHtml = \"\" \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n let disabled = false;\n if (index == 2) {\n disabled = data[0] && data[0].RemoteLoggingLevel ? data[0].RemoteLoggingLevel == \"NONE\" : true;\n } else if (index == 4) {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = !conf.remoteShell;\n }\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", - "markdownTextFunction": "const states = ['storage_statistics', 'machine_statistics'];\nconst currentState = ctx.stateController.getStateId();\nlet buttonsHtml = \"\";\nconst buttonName = \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", + "markdownTextFunction": "const states = ['storage_statistics', 'machine_statistics', 'custom_statistics'];\nconst currentState = ctx.stateController.getStateId();\nlet buttonsHtml = \"\";\nlet disabled = false;\nconst buttonName = \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n if (states[index] === 'custom_statistics') {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = !conf.statistics?.enableCustom;\n }\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", "applyDefaultMarkdownStyle": false, "markdownCss": ".action-buttons-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n align-content: start;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n line-height: 36px;\r\n}" }, @@ -5427,6 +5016,20 @@ "openInSeparateDialog": false, "openInPopover": false, "id": "b35fc758-b21a-f5d3-e968-3572f1bb9ad4" + }, + { + "name": "Custom", + "icon": "more_horiz", + "useShowWidgetActionFunction": null, + "showWidgetActionFunction": "return true;", + "type": "updateDashboardState", + "targetDashboardStateId": "custom_statistics", + "setEntityId": true, + "stateEntityParamName": null, + "openRightLayout": false, + "openInSeparateDialog": false, + "openInPopover": false, + "id": "fcff099d-8164-08fd-7ffa-e1565772f368" } ] }, @@ -5835,7 +5438,7 @@ "aggregationType": "NONE", "funcBody": null, "usePostProcessing": true, - "postFuncBody": "return value ? (JSON.parse(value)?.storageMsgPulled ?? 0) : 0;" + "postFuncBody": "return value ? (JSON.parse(value)?.msgsReceivedFromPlatform ?? 0) : 0;" } ] } @@ -7838,16 +7441,145 @@ "color": "rgba(0, 0, 0, 0.38)", "displayTypePrefix": true }, - "margin": "0px", + "margin": "0px", + "borderRadius": "5px", + "iconSize": "0px", + "enableDataExport": false + }, + "row": 0, + "col": 0, + "id": "7543e668-35b7-bb97-2f14-163399f8d038" + }, + "7f3ebf9f-d967-44fe-fbe4-4667a2abcf88": { + "typeFullFqn": "system.cards.markdown_card", + "type": "latest", + "sizeX": 5, + "sizeY": 3.5, + "config": { + "datasources": [ + { + "type": "entity", + "name": "", + "entityAliasId": "a2f01c66-96cf-49c5-303f-e6f21c559ee8", + "dataKeys": [ + { + "name": "machineStats", + "type": "timeseries", + "label": "gwProcessCpuUsage", + "color": "#4caf50", + "settings": {}, + "_hash": 0.635089967416214, + "aggregationType": "NONE", + "units": null, + "decimals": null, + "funcBody": null, + "usePostProcessing": true, + "postFuncBody": "return value ? (JSON.parse(value)?.gwProcessCpuUsage ?? 0) : 0;" + }, + { + "name": "machineStats", + "type": "timeseries", + "label": "status", + "color": "#f44336", + "settings": {}, + "_hash": 0.07814671673811158, + "aggregationType": "NONE", + "units": null, + "decimals": null, + "funcBody": null, + "usePostProcessing": true, + "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwProcessCpuUsage ?? 0) : 0;\nlet status = 'status-ok';\nif (usage > 85) {\n status = 'status-critical';\n} else if (usage > 75) {\n status = 'status-warn';\n}\nreturn status;" + }, + { + "name": "machineStats", + "type": "timeseries", + "label": "statusTooltip", + "color": "#ffc107", + "settings": {}, + "_hash": 0.9557245489511306, + "aggregationType": "NONE", + "units": null, + "decimals": null, + "funcBody": null, + "usePostProcessing": true, + "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwProcessCpuUsage ?? 0) : 0;\nlet text = '';\nif (usage > 85) {\n text = '{{ \\'widgets.system-info.cpu-critical-text\\' | translate }}';\n} else if (usage > 75) {\n text = '{{ \\'widgets.system-info.cpu-warning-text\\' | translate }}';\n}\nreturn text;" + } + ], + "alarmFilterConfig": { + "statusList": [ + "ACTIVE" + ] + } + } + ], + "timewindow": { + "displayValue": "", + "selectedTab": 0, + "realtime": { + "realtimeType": 1, + "interval": 1000, + "timewindowMs": 60000, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideQuickInterval": false + }, + "history": { + "historyType": 0, + "interval": 1000, + "timewindowMs": 60000, + "fixedTimewindow": { + "startTimeMs": 1733155841882, + "endTimeMs": 1733242241882 + }, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideFixedInterval": false, + "hideQuickInterval": false + }, + "aggregation": { + "type": "AVG", + "limit": 25000 + } + }, + "showTitle": false, + "backgroundColor": "#fff", + "color": "rgba(0, 0, 0, 0.87)", + "padding": "16px", + "settings": { + "useMarkdownTextFunction": false, + "markdownTextPattern": "
    \n
    \n
    widgets.system-info.cpu
    \n
    \n
    \n
    \n ${gwProcessCpuUsage:1}%\n | 1 core\n
    \n
    ", + "markdownTextFunction": "return '# Some title\\n - Entity name: ' + data[0]['entityName'];", + "applyDefaultMarkdownStyle": false, + "markdownCss": ".tb-card-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: flex-start;\n}\n\n.tb-card-title {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-size: 1.5rem;\n}\n\n.tb-status {\n width: 24px;\n height: 24px;\n position: relative;\n}\n\n.tb-status.status-ok {\n background: #F3F6FA;\n border-radius: 4px;\n}\n\n.tb-status:after {\n position: absolute;\n top: 2px;\n left: 2px;\n font-family: 'Material Icons Round';\n font-size: 20px;\n line-height: 1;\n}\n\n.tb-status.status-ok:after {\n content: \"check\";\n color: #198038;\n font-weight: 600;\n}\n\n.tb-status.status-warn:after {\n content: \"warning\";\n color: #FAA405;\n}\n\n.tb-status.status-critical:after {\n content: \"warning\";\n color: #D12730;\n}\n\n.tb-value-container {\n user-select: none;\n}\n\n.tb-count {\n font-style: normal;\n font-weight: 500;\n font-size: 26px;\n line-height: 36px;\n}\n\n.tb-total {\n padding-left: 4px;\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n color: rgba(0, 0, 0, 0.54);\n}\n\n@media screen and (min-width: 960px) and (max-width: 1819px) {\n .tb-status {\n width: 1.25rem;\n height: 1.25rem;\n }\n .tb-status:after {\n font-size: 1rem;\n }\n .tb-count {\n font-size: 1.25rem;\n line-height: 24px;\n }\n .tb-total {\n font-size: 11px;\n line-height: 16px;\n }\n}" + }, + "title": "Markdown/HTML Card", + "showTitleIcon": false, + "iconColor": "rgba(0, 0, 0, 0.87)", + "iconSize": "24px", + "titleTooltip": "", + "dropShadow": true, + "enableFullscreen": false, + "widgetStyle": {}, + "titleStyle": { + "fontSize": "16px", + "fontWeight": 400 + }, + "showLegend": false, + "useDashboardTimewindow": true, + "displayTimewindow": true, "borderRadius": "5px", - "iconSize": "0px", + "widgetCss": "", + "pageSize": 1024, + "noDataDisplayMessage": "", "enableDataExport": false }, "row": 0, "col": 0, - "id": "7543e668-35b7-bb97-2f14-163399f8d038" + "id": "7f3ebf9f-d967-44fe-fbe4-4667a2abcf88" }, - "7f3ebf9f-d967-44fe-fbe4-4667a2abcf88": { + "ea75a492-d149-9a53-b45f-840a0ce42a40": { "typeFullFqn": "system.cards.markdown_card", "type": "latest", "sizeX": 5, @@ -7862,7 +7594,7 @@ { "name": "machineStats", "type": "timeseries", - "label": "gwProcessCpuUsage", + "label": "gwMemory", "color": "#4caf50", "settings": {}, "_hash": 0.635089967416214, @@ -7871,7 +7603,7 @@ "decimals": null, "funcBody": null, "usePostProcessing": true, - "postFuncBody": "return value ? (JSON.parse(value)?.gwProcessCpuUsage ?? 0) : 0;" + "postFuncBody": "return value ? (JSON.parse(value)?.gwMemory ?? 0) : 0;" }, { "name": "machineStats", @@ -7885,7 +7617,7 @@ "decimals": null, "funcBody": null, "usePostProcessing": true, - "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwProcessCpuUsage ?? 0) : 0;\nlet status = 'status-ok';\nif (usage > 85) {\n status = 'status-critical';\n} else if (usage > 75) {\n status = 'status-warn';\n}\nreturn status;" + "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwMemory ?? 0) : 0;\nlet status = 'status-ok';\nif (usage > 85) {\n status = 'status-critical';\n} else if (usage > 75) {\n status = 'status-warn';\n}\nreturn status;" }, { "name": "machineStats", @@ -7899,7 +7631,21 @@ "decimals": null, "funcBody": null, "usePostProcessing": true, - "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwProcessCpuUsage ?? 0) : 0;\nlet text = '';\nif (usage > 85) {\n text = '{{ \\'widgets.system-info.cpu-critical-text\\' | translate }}';\n} else if (usage > 75) {\n text = '{{ \\'widgets.system-info.cpu-warning-text\\' | translate }}';\n}\nreturn text;" + "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwMemory ?? 0) : 0;\nlet text = '';\nif (usage > 85) {\n text = '{{ \\'widgets.system-info.ram-critical-text\\' | translate }}';\n} else if (usage > 75) {\n text = '{{ \\'widgets.system-info.ram-warning-text\\' | translate }}';\n}\nreturn text;" + }, + { + "name": "totalMemory", + "type": "attribute", + "label": "totalMemory", + "color": "#ffc107", + "settings": {}, + "_hash": 0.4893025210001585, + "aggregationType": null, + "units": null, + "decimals": null, + "funcBody": null, + "usePostProcessing": true, + "postFuncBody": "return value || '0G';" } ], "alarmFilterConfig": { @@ -7946,7 +7692,7 @@ "padding": "16px", "settings": { "useMarkdownTextFunction": false, - "markdownTextPattern": "
    \n
    \n
    widgets.system-info.cpu
    \n
    \n
    \n
    \n ${gwProcessCpuUsage:1}%\n | 1 core\n
    \n
    ", + "markdownTextPattern": "
    \n
    \n
    widgets.system-info.ram
    \n
    \n
    \n
    \n ${gwMemory:1}%\n | ${totalMemory}\n
    \n
    ", "markdownTextFunction": "return '# Some title\\n - Entity name: ' + data[0]['entityName'];", "applyDefaultMarkdownStyle": false, "markdownCss": ".tb-card-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: flex-start;\n}\n\n.tb-card-title {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-size: 1.5rem;\n}\n\n.tb-status {\n width: 24px;\n height: 24px;\n position: relative;\n}\n\n.tb-status.status-ok {\n background: #F3F6FA;\n border-radius: 4px;\n}\n\n.tb-status:after {\n position: absolute;\n top: 2px;\n left: 2px;\n font-family: 'Material Icons Round';\n font-size: 20px;\n line-height: 1;\n}\n\n.tb-status.status-ok:after {\n content: \"check\";\n color: #198038;\n font-weight: 600;\n}\n\n.tb-status.status-warn:after {\n content: \"warning\";\n color: #FAA405;\n}\n\n.tb-status.status-critical:after {\n content: \"warning\";\n color: #D12730;\n}\n\n.tb-value-container {\n user-select: none;\n}\n\n.tb-count {\n font-style: normal;\n font-weight: 500;\n font-size: 26px;\n line-height: 36px;\n}\n\n.tb-total {\n padding-left: 4px;\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n color: rgba(0, 0, 0, 0.54);\n}\n\n@media screen and (min-width: 960px) and (max-width: 1819px) {\n .tb-status {\n width: 1.25rem;\n height: 1.25rem;\n }\n .tb-status:after {\n font-size: 1rem;\n }\n .tb-count {\n font-size: 1.25rem;\n line-height: 24px;\n }\n .tb-total {\n font-size: 11px;\n line-height: 16px;\n }\n}" @@ -7974,9 +7720,9 @@ }, "row": 0, "col": 0, - "id": "7f3ebf9f-d967-44fe-fbe4-4667a2abcf88" + "id": "ea75a492-d149-9a53-b45f-840a0ce42a40" }, - "ea75a492-d149-9a53-b45f-840a0ce42a40": { + "13b57ab5-e5ed-701c-4c67-5bb1198e9a53": { "typeFullFqn": "system.cards.markdown_card", "type": "latest", "sizeX": 5, @@ -7991,7 +7737,7 @@ { "name": "machineStats", "type": "timeseries", - "label": "gwMemory", + "label": "diskUsage", "color": "#4caf50", "settings": {}, "_hash": 0.635089967416214, @@ -8000,7 +7746,7 @@ "decimals": null, "funcBody": null, "usePostProcessing": true, - "postFuncBody": "return value ? (JSON.parse(value)?.gwMemory ?? 0) : 0;" + "postFuncBody": "return value ? (JSON.parse(value)?.diskUsage ?? 0) : 0;" }, { "name": "machineStats", @@ -8014,7 +7760,7 @@ "decimals": null, "funcBody": null, "usePostProcessing": true, - "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwMemory ?? 0) : 0;\nlet status = 'status-ok';\nif (usage > 85) {\n status = 'status-critical';\n} else if (usage > 75) {\n status = 'status-warn';\n}\nreturn status;" + "postFuncBody": "const usage = value ? (JSON.parse(value)?.diskUsage ?? 0) : 0;\nlet status = 'status-ok';\nif (usage > 85) {\n status = 'status-critical';\n} else if (usage > 75) {\n status = 'status-warn';\n}\nreturn status;" }, { "name": "machineStats", @@ -8028,15 +7774,15 @@ "decimals": null, "funcBody": null, "usePostProcessing": true, - "postFuncBody": "const usage = value ? (JSON.parse(value)?.gwMemory ?? 0) : 0;\nlet text = '';\nif (usage > 85) {\n text = '{{ \\'widgets.system-info.ram-critical-text\\' | translate }}';\n} else if (usage > 75) {\n text = '{{ \\'widgets.system-info.ram-warning-text\\' | translate }}';\n}\nreturn text;" + "postFuncBody": "const usage = value ? (JSON.parse(value)?.diskUsage ?? 0) : 0;\nlet text = '';\nif (usage > 85) {\n text = '{{ \\'widgets.system-info.disk-critical-text\\' | translate }}';\n} else if (usage > 75) {\n text = '{{ \\'widgets.system-info.disk-warning-text\\' | translate }}';\n}\nreturn text;" }, { - "name": "totalMemory", + "name": "totalDisk", "type": "attribute", - "label": "totalMemory", + "label": "totalDisk", "color": "#ffc107", "settings": {}, - "_hash": 0.4893025210001585, + "_hash": 0.6337011250870808, "aggregationType": null, "units": null, "decimals": null, @@ -8089,7 +7835,7 @@ "padding": "16px", "settings": { "useMarkdownTextFunction": false, - "markdownTextPattern": "
    \n
    \n
    widgets.system-info.ram
    \n
    \n
    \n
    \n ${gwMemory:1}%\n | ${totalMemory}\n
    \n
    ", + "markdownTextPattern": "
    \n
    \n
    widgets.system-info.disk
    \n
    \n
    \n
    \n ${diskUsage:1}%\n | ${totalDisk}\n
    \n
    ", "markdownTextFunction": "return '# Some title\\n - Entity name: ' + data[0]['entityName'];", "applyDefaultMarkdownStyle": false, "markdownCss": ".tb-card-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: flex-start;\n}\n\n.tb-card-title {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-size: 1.5rem;\n}\n\n.tb-status {\n width: 24px;\n height: 24px;\n position: relative;\n}\n\n.tb-status.status-ok {\n background: #F3F6FA;\n border-radius: 4px;\n}\n\n.tb-status:after {\n position: absolute;\n top: 2px;\n left: 2px;\n font-family: 'Material Icons Round';\n font-size: 20px;\n line-height: 1;\n}\n\n.tb-status.status-ok:after {\n content: \"check\";\n color: #198038;\n font-weight: 600;\n}\n\n.tb-status.status-warn:after {\n content: \"warning\";\n color: #FAA405;\n}\n\n.tb-status.status-critical:after {\n content: \"warning\";\n color: #D12730;\n}\n\n.tb-value-container {\n user-select: none;\n}\n\n.tb-count {\n font-style: normal;\n font-weight: 500;\n font-size: 26px;\n line-height: 36px;\n}\n\n.tb-total {\n padding-left: 4px;\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n color: rgba(0, 0, 0, 0.54);\n}\n\n@media screen and (min-width: 960px) and (max-width: 1819px) {\n .tb-status {\n width: 1.25rem;\n height: 1.25rem;\n }\n .tb-status:after {\n font-size: 1rem;\n }\n .tb-count {\n font-size: 1.25rem;\n line-height: 24px;\n }\n .tb-total {\n font-size: 11px;\n line-height: 16px;\n }\n}" @@ -8106,86 +7852,273 @@ "fontSize": "16px", "fontWeight": 400 }, - "showLegend": false, - "useDashboardTimewindow": true, - "displayTimewindow": true, + "showLegend": false, + "useDashboardTimewindow": true, + "displayTimewindow": true, + "borderRadius": "5px", + "widgetCss": "", + "pageSize": 1024, + "noDataDisplayMessage": "", + "enableDataExport": false + }, + "row": 0, + "col": 0, + "id": "13b57ab5-e5ed-701c-4c67-5bb1198e9a53" + }, + "867613d5-9440-fac1-9156-cd8773df5c97": { + "typeFullFqn": "system.cards.markdown_card", + "type": "latest", + "sizeX": 5, + "sizeY": 3.5, + "config": { + "datasources": [ + { + "type": "entity", + "name": "", + "dataKeys": [] + } + ], + "timewindow": { + "displayValue": "", + "selectedTab": 0, + "realtime": { + "realtimeType": 1, + "interval": 1000, + "timewindowMs": 60000, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideQuickInterval": false + }, + "history": { + "historyType": 0, + "interval": 1000, + "timewindowMs": 60000, + "fixedTimewindow": { + "startTimeMs": 1733234218432, + "endTimeMs": 1733320618432 + }, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideFixedInterval": false, + "hideQuickInterval": false + }, + "aggregation": { + "type": "AVG", + "limit": 25000 + } + }, + "showTitle": false, + "backgroundColor": "#fff", + "color": "rgba(0, 0, 0, 0.87)", + "padding": "0", + "settings": { + "useMarkdownTextFunction": false, + "markdownTextPattern": "
    \n \n
    ", + "markdownTextFunction": "return '# Some title\\n - Entity name: ' + data[0]['entityName'];", + "applyDefaultMarkdownStyle": false, + "markdownCss": ".tb-card-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n}" + }, + "title": "Markdown/HTML Card", + "showTitleIcon": false, + "iconColor": "rgba(0, 0, 0, 0.87)", + "iconSize": "24px", + "titleTooltip": "", + "dropShadow": false, + "enableFullscreen": false, + "widgetStyle": {}, + "titleStyle": { + "fontSize": "16px", + "fontWeight": 400 + }, + "showLegend": false, + "widgetCss": "", + "pageSize": 1024, + "noDataDisplayMessage": "", + "enableDataExport": false + }, + "row": 0, + "col": 0, + "id": "867613d5-9440-fac1-9156-cd8773df5c97" + }, + "56274c38-33fc-fe9d-aa39-ff3e1215276b": { + "typeFullFqn": "system.cards.markdown_card", + "type": "latest", + "sizeX": 5, + "sizeY": 3.5, + "config": { + "datasources": [ + { + "type": "entity", + "name": "", + "entityAliasId": "a2f01c66-96cf-49c5-303f-e6f21c559ee8", + "dataKeys": [ + { + "name": "general_configuration", + "type": "attribute", + "label": "general_configuration", + "color": "#2196f3", + "settings": {}, + "_hash": 0.5374662835906896 + } + ], + "alarmFilterConfig": { + "statusList": [ + "ACTIVE" + ] + } + } + ], + "timewindow": { + "displayValue": "", + "selectedTab": 0, + "realtime": { + "realtimeType": 1, + "interval": 1000, + "timewindowMs": 60000, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideQuickInterval": false + }, + "history": { + "historyType": 0, + "interval": 1000, + "timewindowMs": 60000, + "fixedTimewindow": { + "startTimeMs": 1732109250067, + "endTimeMs": 1732195650067 + }, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideFixedInterval": false, + "hideQuickInterval": false + }, + "aggregation": { + "type": "AVG", + "limit": 25000 + } + }, + "showTitle": false, + "backgroundColor": "#fff", + "color": "rgba(0, 0, 0, 0.87)", + "padding": "8px", + "settings": { + "useMarkdownTextFunction": true, + "markdownTextPattern": "let buttonsHtml = \"\" \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n let disabled = false;\n if (index == 2) {\n disabled = data[0] && data[0].RemoteLoggingLevel ? data[0].RemoteLoggingLevel == \"NONE\" : true;\n } else if (index == 4) {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = !conf.remoteShell;\n }\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", + "markdownTextFunction": "const states = ['storage_statistics', 'machine_statistics', 'custom_statistics'];\nconst currentState = ctx.stateController.getStateId();\nlet buttonsHtml = \"\";\nlet disabled = false;\nconst buttonName = \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n if (states[index] === 'custom_statistics') {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = !conf.statistics?.enableCustom;\n }\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", + "applyDefaultMarkdownStyle": false, + "markdownCss": ".action-buttons-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n align-content: start;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n line-height: 36px;\r\n}" + }, + "title": "Markdown/HTML Card", + "showTitleIcon": false, + "iconColor": "rgba(0, 0, 0, 0.87)", + "iconSize": "24px", + "titleTooltip": "", + "dropShadow": true, + "enableFullscreen": false, + "widgetStyle": {}, + "titleStyle": { + "fontSize": "16px", + "fontWeight": 400 + }, + "showLegend": false, + "useDashboardTimewindow": true, + "displayTimewindow": true, + "actions": { + "elementClick": [ + { + "name": "Storage", + "icon": "more_horiz", + "useShowWidgetActionFunction": null, + "showWidgetActionFunction": "return true;", + "type": "updateDashboardState", + "targetDashboardStateId": "storage_statistics", + "setEntityId": true, + "stateEntityParamName": null, + "openRightLayout": false, + "openInSeparateDialog": false, + "openInPopover": false, + "id": "fc4c338d-5799-f7dc-9ecb-448e65f8045d" + }, + { + "name": "Machine", + "icon": "more_horiz", + "useShowWidgetActionFunction": null, + "showWidgetActionFunction": "return true;", + "type": "updateDashboardState", + "targetDashboardStateId": "machine_statistics", + "setEntityId": true, + "stateEntityParamName": null, + "openRightLayout": false, + "openInSeparateDialog": false, + "openInPopover": false, + "id": "b35fc758-b21a-f5d3-e968-3572f1bb9ad4" + }, + { + "name": "Custom", + "icon": "more_horiz", + "useShowWidgetActionFunction": null, + "showWidgetActionFunction": "return true;", + "type": "updateDashboardState", + "targetDashboardStateId": "custom_statistics", + "setEntityId": true, + "stateEntityParamName": null, + "openRightLayout": false, + "openInSeparateDialog": false, + "openInPopover": false, + "id": "10a5a4b6-71fb-f51c-2836-bb360938127f" + } + ] + }, "borderRadius": "5px", "widgetCss": "", "pageSize": 1024, "noDataDisplayMessage": "", + "margin": "16px 16px 0 0", "enableDataExport": false }, "row": 0, "col": 0, - "id": "ea75a492-d149-9a53-b45f-840a0ce42a40" + "id": "56274c38-33fc-fe9d-aa39-ff3e1215276b" }, - "13b57ab5-e5ed-701c-4c67-5bb1198e9a53": { - "typeFullFqn": "system.cards.markdown_card", + "38063fe5-1bd8-695b-a40b-92c1aed19831": { + "typeFullFqn": "system.gateway_widgets.gateway_status", "type": "latest", - "sizeX": 5, - "sizeY": 3.5, + "sizeX": 7.5, + "sizeY": 3, "config": { "datasources": [ { "type": "entity", - "name": "", + "name": "function", "entityAliasId": "a2f01c66-96cf-49c5-303f-e6f21c559ee8", "dataKeys": [ { - "name": "machineStats", - "type": "timeseries", - "label": "diskUsage", - "color": "#4caf50", - "settings": {}, - "_hash": 0.635089967416214, - "aggregationType": "NONE", - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": true, - "postFuncBody": "return value ? (JSON.parse(value)?.diskUsage ?? 0) : 0;" - }, - { - "name": "machineStats", - "type": "timeseries", - "label": "status", - "color": "#f44336", + "name": "active", + "type": "attribute", + "label": "active", + "color": "#2196f3", "settings": {}, - "_hash": 0.07814671673811158, - "aggregationType": "NONE", - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": true, - "postFuncBody": "const usage = value ? (JSON.parse(value)?.diskUsage ?? 0) : 0;\nlet status = 'status-ok';\nif (usage > 85) {\n status = 'status-critical';\n} else if (usage > 75) {\n status = 'status-warn';\n}\nreturn status;" + "_hash": 0.07932656697286933 }, { - "name": "machineStats", - "type": "timeseries", - "label": "statusTooltip", - "color": "#ffc107", + "name": "lastDisconnectTime", + "type": "attribute", + "label": "lastDisconnectTime", + "color": "#4caf50", "settings": {}, - "_hash": 0.9557245489511306, - "aggregationType": "NONE", - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": true, - "postFuncBody": "const usage = value ? (JSON.parse(value)?.diskUsage ?? 0) : 0;\nlet text = '';\nif (usage > 85) {\n text = '{{ \\'widgets.system-info.disk-critical-text\\' | translate }}';\n} else if (usage > 75) {\n text = '{{ \\'widgets.system-info.disk-warning-text\\' | translate }}';\n}\nreturn text;" + "_hash": 0.06662431625551446 }, { - "name": "totalDisk", + "name": "lastConnectTime", "type": "attribute", - "label": "totalDisk", - "color": "#ffc107", + "label": "lastConnectTime", + "color": "#f44336", "settings": {}, - "_hash": 0.6337011250870808, - "aggregationType": null, - "units": null, - "decimals": null, - "funcBody": null, - "usePostProcessing": true, - "postFuncBody": "return value || '0G';" + "_hash": 0.28485659401606434 } ], "alarmFilterConfig": { @@ -8212,8 +8145,8 @@ "interval": 1000, "timewindowMs": 60000, "fixedTimewindow": { - "startTimeMs": 1733155841882, - "endTimeMs": 1733242241882 + "startTimeMs": 1733240126084, + "endTimeMs": 1733326526084 }, "quickInterval": "CURRENT_DAY", "hideInterval": false, @@ -8227,32 +8160,21 @@ } }, "showTitle": false, - "backgroundColor": "#fff", + "backgroundColor": "rgb(255, 255, 255)", "color": "rgba(0, 0, 0, 0.87)", - "padding": "16px", + "padding": "", "settings": { - "useMarkdownTextFunction": false, - "markdownTextPattern": "
    \n
    \n
    widgets.system-info.disk
    \n
    \n
    \n
    \n ${diskUsage:1}%\n | ${totalDisk}\n
    \n
    ", - "markdownTextFunction": "return '# Some title\\n - Entity name: ' + data[0]['entityName'];", - "applyDefaultMarkdownStyle": false, - "markdownCss": ".tb-card-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n align-items: flex-start;\n}\n\n.tb-card-title {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-size: 1.5rem;\n}\n\n.tb-status {\n width: 24px;\n height: 24px;\n position: relative;\n}\n\n.tb-status.status-ok {\n background: #F3F6FA;\n border-radius: 4px;\n}\n\n.tb-status:after {\n position: absolute;\n top: 2px;\n left: 2px;\n font-family: 'Material Icons Round';\n font-size: 20px;\n line-height: 1;\n}\n\n.tb-status.status-ok:after {\n content: \"check\";\n color: #198038;\n font-weight: 600;\n}\n\n.tb-status.status-warn:after {\n content: \"warning\";\n color: #FAA405;\n}\n\n.tb-status.status-critical:after {\n content: \"warning\";\n color: #D12730;\n}\n\n.tb-value-container {\n user-select: none;\n}\n\n.tb-count {\n font-style: normal;\n font-weight: 500;\n font-size: 26px;\n line-height: 36px;\n}\n\n.tb-total {\n padding-left: 4px;\n font-weight: 500;\n font-size: 14px;\n line-height: 20px;\n color: rgba(0, 0, 0, 0.54);\n}\n\n@media screen and (min-width: 960px) and (max-width: 1819px) {\n .tb-status {\n width: 1.25rem;\n height: 1.25rem;\n }\n .tb-status:after {\n font-size: 1rem;\n }\n .tb-count {\n font-size: 1.25rem;\n line-height: 24px;\n }\n .tb-total {\n font-size: 11px;\n line-height: 16px;\n }\n}" + "cardHtml": "
    HTML code here
    ", + "cardCss": ".card {\n font-weight: bold;\n font-size: 32px;\n color: #999;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}" }, - "title": "Markdown/HTML Card", - "showTitleIcon": false, - "iconColor": "rgba(0, 0, 0, 0.87)", - "iconSize": "24px", - "titleTooltip": "", + "title": "HTML Card", "dropShadow": true, - "enableFullscreen": false, - "widgetStyle": {}, - "titleStyle": { - "fontSize": "16px", - "fontWeight": 400 - }, - "showLegend": false, "useDashboardTimewindow": true, "displayTimewindow": true, + "enableFullscreen": false, + "margin": "16px 16px 16px 0", "borderRadius": "5px", + "widgetStyle": {}, "widgetCss": "", "pageSize": 1024, "noDataDisplayMessage": "", @@ -8260,19 +8182,50 @@ }, "row": 0, "col": 0, - "id": "13b57ab5-e5ed-701c-4c67-5bb1198e9a53" + "id": "38063fe5-1bd8-695b-a40b-92c1aed19831" }, - "867613d5-9440-fac1-9156-cd8773df5c97": { - "typeFullFqn": "system.cards.markdown_card", + "e48e7a66-a30e-2494-b0c0-dd3249944286": { + "typeFullFqn": "system.gateway_widgets.gateway_status", "type": "latest", - "sizeX": 5, - "sizeY": 3.5, + "sizeX": 7.5, + "sizeY": 3, "config": { "datasources": [ { "type": "entity", - "name": "", - "dataKeys": [] + "name": "function", + "entityAliasId": "a2f01c66-96cf-49c5-303f-e6f21c559ee8", + "dataKeys": [ + { + "name": "active", + "type": "attribute", + "label": "active", + "color": "#2196f3", + "settings": {}, + "_hash": 0.07932656697286933 + }, + { + "name": "lastDisconnectTime", + "type": "attribute", + "label": "lastDisconnectTime", + "color": "#4caf50", + "settings": {}, + "_hash": 0.06662431625551446 + }, + { + "name": "lastConnectTime", + "type": "attribute", + "label": "lastConnectTime", + "color": "#f44336", + "settings": {}, + "_hash": 0.28485659401606434 + } + ], + "alarmFilterConfig": { + "statusList": [ + "ACTIVE" + ] + } } ], "timewindow": { @@ -8292,8 +8245,8 @@ "interval": 1000, "timewindowMs": 60000, "fixedTimewindow": { - "startTimeMs": 1733234218432, - "endTimeMs": 1733320618432 + "startTimeMs": 1733240126084, + "endTimeMs": 1733326526084 }, "quickInterval": "CURRENT_DAY", "hideInterval": false, @@ -8307,29 +8260,21 @@ } }, "showTitle": false, - "backgroundColor": "#fff", + "backgroundColor": "rgb(255, 255, 255)", "color": "rgba(0, 0, 0, 0.87)", - "padding": "0", + "padding": "", "settings": { - "useMarkdownTextFunction": false, - "markdownTextPattern": "
    \n \n
    ", - "markdownTextFunction": "return '# Some title\\n - Entity name: ' + data[0]['entityName'];", - "applyDefaultMarkdownStyle": false, - "markdownCss": ".tb-card-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n}" + "cardHtml": "
    HTML code here
    ", + "cardCss": ".card {\n font-weight: bold;\n font-size: 32px;\n color: #999;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}" }, - "title": "Markdown/HTML Card", - "showTitleIcon": false, - "iconColor": "rgba(0, 0, 0, 0.87)", - "iconSize": "24px", - "titleTooltip": "", - "dropShadow": false, + "title": "HTML Card", + "dropShadow": true, + "useDashboardTimewindow": true, + "displayTimewindow": true, "enableFullscreen": false, + "margin": "16px 16px 16px 0", + "borderRadius": "5px", "widgetStyle": {}, - "titleStyle": { - "fontSize": "16px", - "fontWeight": 400 - }, - "showLegend": false, "widgetCss": "", "pageSize": 1024, "noDataDisplayMessage": "", @@ -8337,9 +8282,9 @@ }, "row": 0, "col": 0, - "id": "867613d5-9440-fac1-9156-cd8773df5c97" + "id": "e48e7a66-a30e-2494-b0c0-dd3249944286" }, - "56274c38-33fc-fe9d-aa39-ff3e1215276b": { + "3a1f2fe6-7da9-15aa-777d-383e0ac01520": { "typeFullFqn": "system.cards.markdown_card", "type": "latest", "sizeX": 5, @@ -8396,7 +8341,7 @@ "settings": { "useMarkdownTextFunction": true, "markdownTextPattern": "let buttonsHtml = \"\" \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n let disabled = false;\n if (index == 2) {\n disabled = data[0] && data[0].RemoteLoggingLevel ? data[0].RemoteLoggingLevel == \"NONE\" : true;\n } else if (index == 4) {\n const conf = data[0].general_configuration ? JSON.parse(data[0].general_configuration) : {};\n disabled = !conf.remoteShell;\n }\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", - "markdownTextFunction": "const states = ['storage_statistics', 'machine_statistics'];\nconst currentState = ctx.stateController.getStateId();\nlet buttonsHtml = \"\";\nconst buttonName = \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", + "markdownTextFunction": "const states = ['storage_statistics', 'machine_statistics', 'custom_statistics'];\nconst currentState = ctx.stateController.getStateId();\nlet buttonsHtml = \"\";\nconst buttonName = \nctx.actionsApi.getActionDescriptors('elementClick').forEach((btn, index)=>{\n buttonsHtml += ``\n});\n\nreturn `
    ${buttonsHtml}
    `;", "applyDefaultMarkdownStyle": false, "markdownCss": ".action-buttons-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n align-content: start;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n line-height: 36px;\r\n}" }, @@ -8444,6 +8389,20 @@ "openInSeparateDialog": false, "openInPopover": false, "id": "b35fc758-b21a-f5d3-e968-3572f1bb9ad4" + }, + { + "name": "Custom", + "icon": "more_horiz", + "useShowWidgetActionFunction": null, + "showWidgetActionFunction": "return true;", + "type": "updateDashboardState", + "targetDashboardStateId": "custom_statistics", + "setEntityId": true, + "stateEntityParamName": null, + "openRightLayout": false, + "openInSeparateDialog": false, + "openInPopover": false, + "id": "fcff099d-8164-08fd-7ffa-e1565772f368" } ] }, @@ -8456,45 +8415,20 @@ }, "row": 0, "col": 0, - "id": "56274c38-33fc-fe9d-aa39-ff3e1215276b" + "id": "3a1f2fe6-7da9-15aa-777d-383e0ac01520" }, - "38063fe5-1bd8-695b-a40b-92c1aed19831": { - "typeFullFqn": "system.gateway_widgets.gateway_status", - "type": "latest", - "sizeX": 7.5, - "sizeY": 3, - "config": { - "datasources": [ - { - "type": "entity", - "name": "function", - "entityAliasId": "a2f01c66-96cf-49c5-303f-e6f21c559ee8", - "dataKeys": [ - { - "name": "active", - "type": "attribute", - "label": "active", - "color": "#2196f3", - "settings": {}, - "_hash": 0.07932656697286933 - }, - { - "name": "lastDisconnectTime", - "type": "attribute", - "label": "lastDisconnectTime", - "color": "#4caf50", - "settings": {}, - "_hash": 0.06662431625551446 - }, - { - "name": "lastConnectTime", - "type": "attribute", - "label": "lastConnectTime", - "color": "#f44336", - "settings": {}, - "_hash": 0.28485659401606434 - } - ], + "7a34986a-ec7f-4c64-84f9-338cf1626722": { + "typeFullFqn": "system.gateway_widgets.gateway_custom_statistics", + "type": "timeseries", + "sizeX": 8, + "sizeY": 5, + "config": { + "datasources": [ + { + "type": "entity", + "name": "", + "entityAliasId": "a2f01c66-96cf-49c5-303f-e6f21c559ee8", + "dataKeys": [], "alarmFilterConfig": { "statusList": [ "ACTIVE" @@ -8503,50 +8437,58 @@ } ], "timewindow": { - "displayValue": "", - "selectedTab": 0, "realtime": { - "realtimeType": 1, - "interval": 1000, - "timewindowMs": 60000, - "quickInterval": "CURRENT_DAY", - "hideInterval": false, - "hideLastInterval": false, - "hideQuickInterval": false - }, - "history": { - "historyType": 0, - "interval": 1000, - "timewindowMs": 60000, - "fixedTimewindow": { - "startTimeMs": 1733240126084, - "endTimeMs": 1733326526084 - }, - "quickInterval": "CURRENT_DAY", - "hideInterval": false, - "hideLastInterval": false, - "hideFixedInterval": false, - "hideQuickInterval": false - }, - "aggregation": { - "type": "AVG", - "limit": 25000 + "timewindowMs": 60000 } }, "showTitle": false, - "backgroundColor": "rgb(255, 255, 255)", + "backgroundColor": "#fff", "color": "rgba(0, 0, 0, 0.87)", - "padding": "", + "padding": "8px", "settings": { - "cardHtml": "
    HTML code here
    ", - "cardCss": ".card {\n font-weight: bold;\n font-size: 32px;\n color: #999;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}" + "shadowSize": 4, + "fontColor": "#545454", + "fontSize": 10, + "xaxis": { + "showLabels": true, + "color": "#545454" + }, + "yaxis": { + "showLabels": true, + "color": "#545454" + }, + "grid": { + "color": "#545454", + "tickColor": "#DDDDDD", + "verticalLines": true, + "horizontalLines": true, + "outlineWidth": 1 + }, + "legend": { + "show": true, + "position": "nw", + "backgroundColor": "#f0f0f0", + "backgroundOpacity": 0.85, + "labelBoxBorderColor": "rgba(1, 1, 1, 0.45)" + }, + "decimals": 1, + "stack": false, + "tooltipIndividual": false, + "showLegend": false }, - "title": "HTML Card", + "title": "Gateway custom statistics ", "dropShadow": true, + "enableFullscreen": false, + "titleStyle": { + "fontSize": "16px", + "fontWeight": 400 + }, + "mobileHeight": null, "useDashboardTimewindow": true, "displayTimewindow": true, - "enableFullscreen": false, - "margin": "16px 16px 16px 0", + "showTitleIcon": false, + "titleTooltip": "", + "margin": "16px", "borderRadius": "5px", "widgetStyle": {}, "widgetCss": "", @@ -8556,7 +8498,7 @@ }, "row": 0, "col": 0, - "id": "38063fe5-1bd8-695b-a40b-92c1aed19831" + "id": "7a34986a-ec7f-4c64-84f9-338cf1626722" } }, "states": { @@ -8876,97 +8818,240 @@ } } }, - "gateway_devices_0": { - "name": "Gateway devices", + "storage_statistics": { + "name": "Storage statistics", "root": false, "layouts": { "main": { "widgets": { - "1615bd4e-c0a4-c32c-3706-3c83214cb8d7": { - "sizeX": 24, - "sizeY": 11, + "b4194e1e-97af-ed0b-a6a4-70011c71c579": { + "sizeX": 5, + "sizeY": 12, + "resizable": true, "row": 0, - "col": 0 + "col": 25, + "mobileOrder": 1, + "mobileHeight": 3 + }, + "3a005e49-327c-beaa-8d19-c36b833001f0": { + "sizeX": 25, + "sizeY": 14, + "row": 0, + "col": 0, + "resizable": true, + "mobileOrder": 2, + "mobileHeight": null + }, + "bc199c75-00da-ca8a-dd0d-16da97a9fa53": { + "sizeX": 5, + "sizeY": 2, + "row": 12, + "col": 25, + "resizable": true, + "preserveAspectRatio": false, + "mobileOrder": 3, + "mobileHeight": 2 } }, "gridSettings": { + "layoutType": "default", "backgroundColor": "#eeeeee", - "columns": 24, + "columns": 30, "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", + "minColumns": 25, + "viewFormat": "grid", "autoFillHeight": true, + "rowHeight": 70, "backgroundImageUrl": null, "mobileAutoFillHeight": false, - "mobileRowHeight": 70, - "layoutType": "default" + "mobileRowHeight": 70 } } } }, - "gateway_devices_1": { - "name": "gateway_devices_mqtt", + "machine_statistics": { + "name": "Machine statistics", "root": false, "layouts": { "main": { "widgets": { - "aafba3d8-a381-21c0-ecbe-446da3cdc041": { - "sizeX": 24, - "sizeY": 11, + "867613d5-9440-fac1-9156-cd8773df5c97": { + "sizeX": 25, + "sizeY": 14, "row": 0, - "col": 0 + "col": 0, + "resizable": true, + "mobileOrder": 2, + "mobileHeight": null + }, + "56274c38-33fc-fe9d-aa39-ff3e1215276b": { + "sizeX": 5, + "sizeY": 12, + "resizable": true, + "row": 0, + "col": 25, + "mobileOrder": 1, + "mobileHeight": 3 + }, + "38063fe5-1bd8-695b-a40b-92c1aed19831": { + "sizeX": 5, + "sizeY": 2, + "row": 12, + "col": 25, + "resizable": true, + "mobileOrder": 3, + "mobileHeight": 2 } }, "gridSettings": { + "layoutType": "default", "backgroundColor": "#eeeeee", - "columns": 24, + "columns": 30, "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", + "minColumns": 25, + "viewFormat": "grid", "autoFillHeight": true, + "rowHeight": 70, "backgroundImageUrl": null, "mobileAutoFillHeight": false, - "mobileRowHeight": 70, - "layoutType": "default" + "mobileRowHeight": 70 } } } }, - "gateway_devices_2": { - "name": "gateway_devices_modbus", + "storage_statistics_info": { + "name": "Storage statistics info", "root": false, "layouts": { "main": { "widgets": { - "7f676bb2-bde2-10e7-80d8-25dd734e8e22": { - "sizeX": 24, - "sizeY": 11, + "5f26fe0d-4417-31c6-0a98-8760cda909c5": { + "sizeX": 6, + "sizeY": 3, + "mobileHeight": 3, + "resizable": true, + "row": 0, + "col": 0, + "mobileOrder": 1 + }, + "dc060491-215c-3e63-edc2-66d52888735d": { + "sizeX": 6, + "sizeY": 3, + "mobileHeight": 3, + "resizable": true, + "row": 3, + "col": 0, + "mobileOrder": 2 + }, + "b37b2916-acd7-353b-6fbc-ceddac152ee8": { + "sizeX": 15, + "sizeY": 6, + "mobileHeight": 6, + "resizable": true, + "row": 0, + "col": 6, + "mobileOrder": 3 + }, + "b5ffefb2-9fb5-cf22-bba2-dba9a98891db": { + "sizeX": 21, + "sizeY": 7, + "mobileHeight": 6, + "resizable": true, + "row": 6, + "col": 0, + "mobileOrder": 4 + } + }, + "gridSettings": { + "layoutType": "default", + "backgroundColor": "#eeeeee", + "columns": 24, + "margin": 16, + "outerMargin": true, + "backgroundSizeMode": "100%", + "minColumns": 21, + "viewFormat": "grid", + "autoFillHeight": false, + "rowHeight": 70, + "backgroundImageUrl": null, + "mobileAutoFillHeight": false, + "mobileRowHeight": 70 + } + } + } + }, + "machine_statistics_info": { + "name": "Machine statistics info", + "root": false, + "layouts": { + "main": { + "widgets": { + "7543e668-35b7-bb97-2f14-163399f8d038": { + "sizeX": 21, + "sizeY": 9, + "mobileHeight": 6, + "resizable": true, + "row": 3, + "col": 0, + "mobileOrder": 4 + }, + "7f3ebf9f-d967-44fe-fbe4-4667a2abcf88": { + "sizeX": 7, + "sizeY": 3, + "resizable": true, + "row": 0, + "col": 0, + "mobileOrder": 1, + "mobileHeight": 2 + }, + "ea75a492-d149-9a53-b45f-840a0ce42a40": { + "sizeX": 7, + "sizeY": 3, + "resizable": true, + "row": 0, + "col": 7, + "mobileOrder": 2, + "mobileHeight": 2 + }, + "13b57ab5-e5ed-701c-4c67-5bb1198e9a53": { + "sizeX": 7, + "sizeY": 3, + "resizable": true, "row": 0, - "col": 0 + "col": 14, + "mobileOrder": 3, + "mobileHeight": 2 } }, "gridSettings": { + "layoutType": "default", "backgroundColor": "#eeeeee", "columns": 24, - "margin": 0, + "margin": 16, "outerMargin": true, "backgroundSizeMode": "100%", - "autoFillHeight": true, + "minColumns": 21, + "viewFormat": "grid", + "autoFillHeight": false, + "rowHeight": 70, "backgroundImageUrl": null, "mobileAutoFillHeight": false, - "mobileRowHeight": 70, - "layoutType": "default" + "mobileRowHeight": 70 } } } }, - "gateway_devices_3": { - "name": "gateway_devices_grpc", + "gateway_devices_all": { + "name": "Gateway devices", "root": false, "layouts": { "main": { "widgets": { - "d64482d8-001a-6f33-9b56-665530098fe5": { + "1615bd4e-c0a4-c32c-3706-3c83214cb8d7": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -8979,7 +9064,7 @@ "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", - "autoFillHeight": false, + "autoFillHeight": true, "backgroundImageUrl": null, "mobileAutoFillHeight": false, "mobileRowHeight": 70, @@ -8988,13 +9073,13 @@ } } }, - "gateway_devices_4": { - "name": "gateway_devices_opcua", + "gateway_devices_bacnet": { + "name": "gateway_devices_bacnet", "root": false, "layouts": { "main": { "widgets": { - "bb27723a-989c-2327-5808-b56d490b93ab": { + "c3d39b60-a668-7f5e-e6f4-cae27151f4aa": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9016,7 +9101,7 @@ } } }, - "gateway_devices_6": { + "gateway_devices_ble": { "name": "gateway_devices_ble", "root": false, "layouts": { @@ -9044,13 +9129,13 @@ } } }, - "gateway_devices_7": { - "name": "gateway_devices_request", + "gateway_devices_can": { + "name": "gateway_devices_can", "root": false, "layouts": { "main": { "widgets": { - "3f6ed61b-f5af-13e3-7505-f69fd53f8211": { + "b06cecaa-2806-65a9-782d-4f2d8cf95a6c": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9072,13 +9157,13 @@ } } }, - "gateway_devices_8": { - "name": "gateway_devices_can", + "gateway_devices_custom": { + "name": "gateway_devices_custom", "root": false, "layouts": { "main": { "widgets": { - "b06cecaa-2806-65a9-782d-4f2d8cf95a6c": { + "75b6372d-4def-42b4-8774-4edf413a8b83": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9100,13 +9185,13 @@ } } }, - "gateway_devices_9": { - "name": "gateway_devices_bacnet", + "gateway_devices_ftp": { + "name": "gateway_devices_ftp", "root": false, "layouts": { "main": { "widgets": { - "c3d39b60-a668-7f5e-e6f4-cae27151f4aa": { + "819c1d39-de7c-8ac3-858e-0040d286823e": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9128,13 +9213,13 @@ } } }, - "gateway_devices_10": { - "name": "gateway_devices_odbc", + "gateway_devices_grpc": { + "name": "gateway_devices_grpc", "root": false, "layouts": { "main": { "widgets": { - "f78a0d66-60cb-188f-857f-9acd4d24bd5a": { + "d64482d8-001a-6f33-9b56-665530098fe5": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9156,13 +9241,13 @@ } } }, - "gateway_devices_11": { - "name": "gateway_devices_rest", + "gateway_devices_modbus": { + "name": "gateway_devices_modbus", "root": false, "layouts": { "main": { "widgets": { - "b81a171c-77c0-b857-21d2-cff02a1cb733": { + "7f676bb2-bde2-10e7-80d8-25dd734e8e22": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9175,7 +9260,7 @@ "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", - "autoFillHeight": false, + "autoFillHeight": true, "backgroundImageUrl": null, "mobileAutoFillHeight": false, "mobileRowHeight": 70, @@ -9184,13 +9269,13 @@ } } }, - "gateway_devices_12": { - "name": "gateway_devices_snmp", + "gateway_devices_mqtt": { + "name": "gateway_devices_mqtt", "root": false, "layouts": { "main": { "widgets": { - "0e399bef-01d2-4e4e-02d2-e254ebe91e56": { + "aafba3d8-a381-21c0-ecbe-446da3cdc041": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9203,7 +9288,7 @@ "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", - "autoFillHeight": false, + "autoFillHeight": true, "backgroundImageUrl": null, "mobileAutoFillHeight": false, "mobileRowHeight": 70, @@ -9212,13 +9297,13 @@ } } }, - "gateway_devices_13": { - "name": "gateway_devices_ftp", + "gateway_devices_ocpp": { + "name": "gateway_devices_ocpp", "root": false, "layouts": { "main": { "widgets": { - "819c1d39-de7c-8ac3-858e-0040d286823e": { + "d1951ec7-ab13-87e4-bc05-ce2318dca353": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9240,13 +9325,13 @@ } } }, - "gateway_devices_14": { - "name": "gateway_devices_socket", + "gateway_devices_odbc": { + "name": "gateway_devices_odbc", "root": false, "layouts": { "main": { "widgets": { - "d4f73f32-f719-98bb-d427-b5c8957e8f47": { + "f78a0d66-60cb-188f-857f-9acd4d24bd5a": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9268,13 +9353,13 @@ } } }, - "gateway_devices_15": { - "name": "gateway_devices_xmpp", + "gateway_devices_opcua": { + "name": "gateway_devices_opcua", "root": false, "layouts": { "main": { "widgets": { - "f16a258c-3f6c-9317-fda7-48b33d8fe8b9": { + "bb27723a-989c-2327-5808-b56d490b93ab": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9296,13 +9381,13 @@ } } }, - "gateway_devices_16": { - "name": "gateway_devices_ocpp", + "gateway_devices_request": { + "name": "gateway_devices_request", "root": false, "layouts": { "main": { "widgets": { - "d1951ec7-ab13-87e4-bc05-ce2318dca353": { + "3f6ed61b-f5af-13e3-7505-f69fd53f8211": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9324,13 +9409,13 @@ } } }, - "gateway_devices_17": { - "name": "gateway_devices_custom", + "gateway_devices_rest": { + "name": "gateway_devices_rest", "root": false, "layouts": { "main": { "widgets": { - "75b6372d-4def-42b4-8774-4edf413a8b83": { + "b81a171c-77c0-b857-21d2-cff02a1cb733": { "sizeX": 24, "sizeY": 11, "row": 0, @@ -9352,225 +9437,135 @@ } } }, - "storage_statistics": { - "name": "Storage statistics", + "gateway_devices_snmp": { + "name": "gateway_devices_snmp", "root": false, "layouts": { "main": { "widgets": { - "b4194e1e-97af-ed0b-a6a4-70011c71c579": { - "sizeX": 5, - "sizeY": 12, - "resizable": true, - "row": 0, - "col": 25, - "mobileOrder": 1, - "mobileHeight": 3 - }, - "3a005e49-327c-beaa-8d19-c36b833001f0": { - "sizeX": 25, - "sizeY": 14, + "0e399bef-01d2-4e4e-02d2-e254ebe91e56": { + "sizeX": 24, + "sizeY": 11, "row": 0, - "col": 0, - "resizable": true, - "mobileOrder": 2, - "mobileHeight": null - }, - "bc199c75-00da-ca8a-dd0d-16da97a9fa53": { - "sizeX": 5, - "sizeY": 2, - "row": 12, - "col": 25, - "resizable": true, - "preserveAspectRatio": false, - "mobileOrder": 3, - "mobileHeight": 2 + "col": 0 } }, "gridSettings": { - "layoutType": "default", "backgroundColor": "#eeeeee", - "columns": 30, + "columns": 24, "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", - "minColumns": 25, - "viewFormat": "grid", - "autoFillHeight": true, - "rowHeight": 70, + "autoFillHeight": false, "backgroundImageUrl": null, "mobileAutoFillHeight": false, - "mobileRowHeight": 70 + "mobileRowHeight": 70, + "layoutType": "default" } } } }, - "machine_statistics": { - "name": "Machine statistics", + "gateway_devices_socket": { + "name": "gateway_devices_socket", "root": false, "layouts": { "main": { "widgets": { - "867613d5-9440-fac1-9156-cd8773df5c97": { - "sizeX": 25, - "sizeY": 14, - "row": 0, - "col": 0, - "resizable": true, - "mobileOrder": 2, - "mobileHeight": null - }, - "56274c38-33fc-fe9d-aa39-ff3e1215276b": { - "sizeX": 5, - "sizeY": 12, - "resizable": true, + "d4f73f32-f719-98bb-d427-b5c8957e8f47": { + "sizeX": 24, + "sizeY": 11, "row": 0, - "col": 25, - "mobileOrder": 1, - "mobileHeight": 3 - }, - "38063fe5-1bd8-695b-a40b-92c1aed19831": { - "sizeX": 5, - "sizeY": 2, - "row": 12, - "col": 25, - "resizable": true, - "mobileOrder": 3, - "mobileHeight": 2 + "col": 0 } }, "gridSettings": { - "layoutType": "default", "backgroundColor": "#eeeeee", - "columns": 30, + "columns": 24, "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", - "minColumns": 25, - "viewFormat": "grid", - "autoFillHeight": true, - "rowHeight": 70, + "autoFillHeight": false, "backgroundImageUrl": null, "mobileAutoFillHeight": false, - "mobileRowHeight": 70 + "mobileRowHeight": 70, + "layoutType": "default" } } } }, - "storage_statistics_info": { - "name": "Storage statistics info", + "gateway_devices_xmpp": { + "name": "gateway_devices_xmpp", "root": false, "layouts": { "main": { "widgets": { - "5f26fe0d-4417-31c6-0a98-8760cda909c5": { - "sizeX": 6, - "sizeY": 3, - "mobileHeight": 3, - "resizable": true, - "row": 0, - "col": 0, - "mobileOrder": 1 - }, - "dc060491-215c-3e63-edc2-66d52888735d": { - "sizeX": 6, - "sizeY": 3, - "mobileHeight": 3, - "resizable": true, - "row": 3, - "col": 0, - "mobileOrder": 2 - }, - "b37b2916-acd7-353b-6fbc-ceddac152ee8": { - "sizeX": 15, - "sizeY": 6, - "mobileHeight": 6, - "resizable": true, + "f16a258c-3f6c-9317-fda7-48b33d8fe8b9": { + "sizeX": 24, + "sizeY": 11, "row": 0, - "col": 6, - "mobileOrder": 3 - }, - "b5ffefb2-9fb5-cf22-bba2-dba9a98891db": { - "sizeX": 21, - "sizeY": 7, - "mobileHeight": 6, - "resizable": true, - "row": 6, - "col": 0, - "mobileOrder": 4 + "col": 0 } }, "gridSettings": { - "layoutType": "default", "backgroundColor": "#eeeeee", "columns": 24, - "margin": 16, + "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", - "minColumns": 21, - "viewFormat": "grid", "autoFillHeight": false, - "rowHeight": 70, "backgroundImageUrl": null, "mobileAutoFillHeight": false, - "mobileRowHeight": 70 + "mobileRowHeight": 70, + "layoutType": "default" } } } }, - "machine_statistics_info": { - "name": "Machine statistics info", + "custom_statistics": { + "name": "Custom statistics", "root": false, "layouts": { "main": { "widgets": { - "7543e668-35b7-bb97-2f14-163399f8d038": { - "sizeX": 21, - "sizeY": 9, - "mobileHeight": 6, + "e48e7a66-a30e-2494-b0c0-dd3249944286": { + "sizeX": 4, + "sizeY": 2, + "preserveAspectRatio": false, "resizable": true, - "row": 3, - "col": 0, - "mobileOrder": 4 + "row": 12, + "col": 20, + "mobileOrder": 3, + "mobileHeight": 2 }, - "7f3ebf9f-d967-44fe-fbe4-4667a2abcf88": { - "sizeX": 7, - "sizeY": 3, + "3a1f2fe6-7da9-15aa-777d-383e0ac01520": { + "sizeX": 4, + "sizeY": 12, "resizable": true, "row": 0, - "col": 0, + "col": 20, "mobileOrder": 1, - "mobileHeight": 2 + "mobileHeight": 3 }, - "ea75a492-d149-9a53-b45f-840a0ce42a40": { - "sizeX": 7, - "sizeY": 3, - "resizable": true, + "7a34986a-ec7f-4c64-84f9-338cf1626722": { + "sizeX": 20, + "sizeY": 14, + "mobileHeight": null, "row": 0, - "col": 7, - "mobileOrder": 2, - "mobileHeight": 2 - }, - "13b57ab5-e5ed-701c-4c67-5bb1198e9a53": { - "sizeX": 7, - "sizeY": 3, + "col": 0, "resizable": true, - "row": 0, - "col": 14, - "mobileOrder": 3, - "mobileHeight": 2 + "mobileOrder": 2 } }, "gridSettings": { "layoutType": "default", "backgroundColor": "#eeeeee", "columns": 24, - "margin": 16, + "margin": 0, "outerMargin": true, "backgroundSizeMode": "100%", - "minColumns": 21, + "minColumns": 24, "viewFormat": "grid", - "autoFillHeight": false, + "autoFillHeight": true, "rowHeight": 70, "backgroundImageUrl": null, "mobileAutoFillHeight": false, @@ -10299,16 +10294,29 @@ "hideAggregation": false, "hideAggInterval": false, "hideTimezone": false, - "selectedTab": 1, + "selectedTab": 0, + "realtime": { + "realtimeType": 0, + "interval": 120000, + "timewindowMs": 900000, + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideQuickInterval": false + }, "history": { "historyType": 0, - "timewindowMs": 300000, "interval": 120000, + "timewindowMs": 900000, "fixedTimewindow": { "startTimeMs": 1686306375309.7058, "endTimeMs": 1686307998839.1177 }, - "quickInterval": "CURRENT_DAY" + "quickInterval": "CURRENT_DAY", + "hideInterval": false, + "hideLastInterval": false, + "hideFixedInterval": false, + "hideQuickInterval": false }, "aggregation": { "type": "NONE", diff --git a/application/src/main/data/resources/js_modules/gateway-management-extension.js b/application/src/main/data/resources/js_modules/gateway-management-extension.js index 9af11f0601..c94d71efba 100644 --- a/application/src/main/data/resources/js_modules/gateway-management-extension.js +++ b/application/src/main/data/resources/js_modules/gateway-management-extension.js @@ -1,7 +1,7 @@ -System.register(["@angular/core","@angular/material/sort","@angular/material/table","@angular/material/paginator","@shared/public-api","@angular/common","@core/public-api","@angular/forms","@angular/material/dialog","@ngrx/store","@angular/router","rxjs","rxjs/operators","tslib","@angular/material/tooltip","@ngx-translate/core","@angular/cdk/collections","@shared/components/dialog/json-object-edit-dialog.component","@shared/import-export/import-export.service","@shared/components/popover.service","@shared/decorators/coercion","@angular/material/core"],(function(e){"use strict";var t,n,a,r,i,o,s,p,l,c,d,m,u,g,y,h,f,v,b,x,w,C,S,E,T,I,k,M,P,F,O,q,B,R,N,_,D,V,G,A,j,L,U,z,K,H,W,Q,J,Y,X,Z,ee,te,ne,ae,re,ie,oe,se,pe,le,ce,de,me,ue,ge,ye,he,fe,ve,be,xe,we,Ce,Se,Ee,Te,Ie,ke,Me,Pe,Fe,Oe,qe,Be,Re,Ne,_e,De,Ve,Ge,Ae,je,Le,Ue;return{setters:[function(e){t=e,n=e.inject,a=e.KeyValueDiffers,r=e.EventEmitter,i=e.forwardRef,o=e.ChangeDetectionStrategy,s=e.assertInInjectionContext,p=e.DestroyRef,e.ɵRuntimeError,e.ɵgetOutputDestroyRef,e.Injector,e.effect,e.untracked,e.assertNotInReactiveContext,e.signal,e.computed,l=e.booleanAttribute,c=e.ChangeDetectorRef,d=e.output,m=e.ɵNG_COMP_DEF},function(e){u=e.MatSort},function(e){g=e.MatTableDataSource},function(e){y=e.MatPaginator},function(e){h=e.Direction,f=e.PageLink,v=e.DataKeyType,b=e.SharedModule,x=e.LegendPosition,w=e.NULL_UUID,C=e.AttributeScope,S=e.DatasourceType,E=e.EntityType,T=e.widgetType,I=e.DialogComponent,k=e.coerceBoolean,M=e.emptyPageData,P=e.isClientSideTelemetryType,F=e.TelemetrySubscriber,O=e.coerceNumber,q=e.helpBaseUrl,B=e.ContentType,R=e.PageComponent,N=e.TbTableDatasource,_=e.HOUR,D=e.DeviceCredentialsType},function(e){V=e.CommonModule},function(e){G=e.deepClone,A=e,j=e.isDefinedAndNotNull,L=e.isLiteralObject,U=e.isEqual,z=e.WINDOW,K=e.deleteNullProperties,H=e.DialogService,W=e.isNumber,Q=e.isString,J=e.isUndefinedOrNull,Y=e.isObject,X=e.generateSecret,Z=e.camelCase,ee=e.deepTrim},function(e){te=e,ne=e.Validators,ae=e.NG_VALUE_ACCESSOR,re=e.NG_VALIDATORS,ie=e.FormBuilder,oe=e.FormControl},function(e){se=e.MAT_DIALOG_DATA,pe=e,le=e.MatDialog},function(e){ce=e},function(e){de=e},function(e){me=e.Subject,ue=e.fromEvent,ge=e.BehaviorSubject,ye=e.ReplaySubject,he=e.of,fe=e.Observable,ve=e.forkJoin},function(e){be=e.takeUntil,xe=e.filter,we=e.tap,Ce=e.catchError,Se=e.map,Ee=e.publishReplay,Te=e.refCount,Ie=e.take,ke=e.debounceTime,Me=e.distinctUntilChanged,Pe=e.startWith,Fe=e.switchMap,Oe=e.mergeMap},function(e){qe=e.__decorate},function(e){Be=e,Re=e.MatTooltip},function(e){Ne=e,_e=e.TranslateService,De=e.TranslateModule},function(e){Ve=e.SelectionModel},function(e){Ge=e.JsonObjectEditDialogComponent},function(e){Ae=e},function(e){je=e},function(e){Le=e.coerceBoolean},function(e){Ue=e.ErrorStateMatcher}],execute:function(){e("getDefaultConfig",Pt);const $e=e("noLeadTrailSpacesRegex",/^\S+(?: \S+)*$/),ze=e("integerRegex",/^[-+]?\d+$/),Ke=e("nonZeroFloat",/^-?(?!0(\.0+)?$)\d+(\.\d+)?$/),He=e("jsonRequired",(e=>e.value?null:{required:!0}));var We,Qe,Je;e("GatewayLogLevel",We),function(e){e.NONE="NONE",e.CRITICAL="CRITICAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e.DEBUG="DEBUG",e.TRACE="TRACE"}(We||e("GatewayLogLevel",We={})),e("GatewayVersion",Qe),function(e){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"}(Qe||e("GatewayVersion",Qe={})),e("ConnectorType",Je),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"}(Je||e("ConnectorType",Je={}));const Ye=e("GatewayConnectorDefaultTypesTranslatesMap",new Map([[Je.MQTT,"MQTT"],[Je.MODBUS,"MODBUS"],[Je.GRPC,"GRPC"],[Je.OPCUA,"OPCUA"],[Je.BLE,"BLE"],[Je.REQUEST,"REQUEST"],[Je.CAN,"CAN"],[Je.BACNET,"BACNET"],[Je.ODBC,"ODBC"],[Je.REST,"REST"],[Je.SNMP,"SNMP"],[Je.FTP,"FTP"],[Je.SOCKET,"SOCKET"],[Je.XMPP,"XMPP"],[Je.OCPP,"OCPP"],[Je.CUSTOM,"CUSTOM"]]));var Xe;e("SocketEncoding",Xe),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"}(Xe||e("SocketEncoding",Xe={}));var Ze={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:{"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-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"}},"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","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","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","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":"Delete mapping?","delete-slave-title":"Delete slave?","delete-device-title":"Delete device ?",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 convertor","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":"This field supports constants and JSONPath expressions.",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"},"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",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",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 (ms)","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-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:{attributes:"Attributes",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 memory","machine-resources":"Machine resources","free-disk":"Gateway free disk",statistic:"Statistic",statistics:"Statistics","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","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","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 (in sec)","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","command-pattern":"Command is not valid",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"},suffix:{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:"Extract from message",topic:"Extract from topic",const:"Constant",identifier:"Identifier",path:"Path",expression:"Expression"},"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 (ms)","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.","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",hints:{"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.","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.",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 data transmission to the master. Acceptable values: true or false.","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.","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."}}}},et={"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 نشطة."}},tt={"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"},nt={"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"},at={"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"},rt={"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={"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"},ot={"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."}},st={"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"},pt={"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."}},lt={"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"},ct={"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"},dt={"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"},mt={"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 文件的文件夹中,使用以下命令在终端中启动网关"},ut={"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"};var gt={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"}]}]}},yt={"3.5.2":{broker:{host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"anonymous"}},mapping:[{topicFilter:"sensor/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"message",deviceProfileExpression:"${sensorType}"},sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"string",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/data)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"},sendDataOnlyOnChange:!1,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"},sendDataOnlyOnChange:!1,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:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}},{topicFilter:"sensor/+/connect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"}},{topicFilter:"sensor/+/disconnect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)"}}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"},attributeNameExpressionSource:"message",attributeNameExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{type:"twoWay",deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTopicQoS:1,responseTimeout:1e4,valueExpression:"${params}"},{type:"oneWay",deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},legacy:{broker:{name:"Default Local Broker",host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"basic",username:"user",password:"password"}},mapping:[{topicFilter:"sensor/data",converter:{type:"json",deviceNameJsonExpression:"${serialNumber}",deviceTypeJsonExpression:"${sensorType}",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",converter:{type:"json",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/data)",deviceTypeTopicExpression:"Thermometer",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{topicFilter:"sensor/raw_data",converter:{type:"bytes",deviceNameExpression:"[0:4]",deviceTypeExpression:"default",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"raw",key:"rawData",value:"[:]"}],timeseries:[{type:"raw",key:"temp",value:"[4:]"}]}},{topicFilter:"custom/sensors/+",converter:{type:"custom",extension:"CustomMqttUplinkConverter",cached:!0,"extension-config":{temperatureBytes:2,humidityBytes:2,batteryLevelBytes:1}}}],connectRequests:[{topicFilter:"sensor/connect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/connect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/connect)"}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/disconnect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/disconnect)"}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceNameJsonExpression:"${serialNumber}",attributeNameJsonExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTimeout:1e4,valueExpression:"${params}"},{deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},ht={"3.5.2":{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:3e4},attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"8int_read",type:"8int",functionCode:4,objectsCount:1,address:6},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"8int_read_multiplier",type:"8int",functionCode:4,objectsCount:1,address:10,multiplier:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"8uint_read",type:"8uint",functionCode:4,objectsCount:1,address:17,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"8int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]},coils_initializer:{attributes:[{address:5,type:"8int",tag:"coil",objectsCount:1,value:0}],timeseries:[],attributeUpdates:[],rpc:[]}}}},legacy:{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",sendDataOnlyOnChange:!0,connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:[{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]}],coils_initializer:[{attributes:[{address:5,type:"string",tag:"sm",objectsCount:1,value:"12"}],timeseries:[],attributeUpdates:[],rpc:[]}]}}}},ft={"3.5.2":{server:{url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:36e5,pollPeriodInMillis:5e3,enableSubscriptions:!0,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"}},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNodeSource:"path",deviceInfo:{deviceNameExpression:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",deviceNameExpressionSource:"path",deviceProfileExpression:"Device",deviceProfileExpressionSource:"constant"},attributes:[{key:"temperature °C",type:"path",value:"${ns=2;i=5}"}],timeseries:[{key:"humidity",type:"path",value:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",type:"path",value:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[{type:"integer",value:2},{type:"integer",value:4}]}],attributes_updates:[{key:"deviceName",type:"path",value:"Root\\.Objects\\.Device1\\.serialNumber"}]}]},legacy:{server:{name:"OPC-UA Default Server",url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:5e3,disableSubscriptions:!1,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNamePattern:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",attributes:[{key:"temperature °C",path:"${ns=2;i=5}"}],timeseries:[{key:"humidity",path:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",path:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[2,4]}],attributes_updates:[{attributeOnThingsBoard:"deviceName",attributeOnDevice:"Root\\.Objects\\.Device1\\.serialNumber"}]}]}}},vt={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"}]}]},bt={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,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,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"}]}}],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",requestValueExpression:"${params}",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"}}]},xt={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"}]}]},wt={"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"}]}]}},Ct={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]}]}},St={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"}}]},Et={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"}]}]},Tt={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}"}]},It={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}"}]}]},kt={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 Mt=e("connectorConfigs",{[Je.MQTT]:yt,[Je.MODBUS]:ht,[Je.OPCUA]:ft,[Je.BLE]:vt,[Je.REQUEST]:bt,[Je.CAN]:xt,[Je.BACNET]:wt,[Je.ODBC]:Ct,[Je.REST]:St,[Je.SNMP]:Et,[Je.FTP]:Tt,[Je.SOCKET]:gt,[Je.XMPP]:It,[Je.OCPP]:kt});function Pt(e){const t=Mt[e];if(!t)throw new Error("No default config found");return t}var Ft;e("ModbusDataType",Ft),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"}(Ft||e("ModbusDataType",Ft={}));const Ot=e("ModbusEditableDataTypes",[Ft.BYTES,Ft.BITS,Ft.STRING]);var qt,Bt;e("ModbusObjectCountByDataType",qt),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"}(qt||e("ModbusObjectCountByDataType",qt={})),e("MappingValueType",Bt),function(e){e.STRING="string",e.INTEGER="integer",e.DOUBLE="double",e.BOOLEAN="boolean"}(Bt||e("MappingValueType",Bt={}));const Rt=e("mappingValueTypesMap",new Map([[Bt.STRING,{name:"value.string",icon:"mdi:format-text"}],[Bt.INTEGER,{name:"value.integer",icon:"mdi:numeric"}],[Bt.DOUBLE,{name:"value.double",icon:"mdi:numeric"}],[Bt.BOOLEAN,{name:"value.boolean",icon:"mdi:checkbox-marked-outline"}]])),Nt=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 _t,Dt,Vt;e("ConfigurationModes",_t),function(e){e.BASIC="basic",e.ADVANCED="advanced"}(_t||e("ConfigurationModes",_t={})),e("ReportStrategyType",Dt),function(e){e.OnChange="ON_CHANGE",e.OnReportPeriod="ON_REPORT_PERIOD",e.OnChangeOrReportPeriod="ON_CHANGE_OR_REPORT_PERIOD",e.OnReceived="ON_RECEIVED"}(Dt||e("ReportStrategyType",Dt={})),e("ReportStrategyDefaultValue",Vt),function(e){e[e.Gateway=6e4]="Gateway",e[e.Connector=6e4]="Connector",e[e.Device=3e4]="Device",e[e.Key=15e3]="Key"}(Vt||e("ReportStrategyDefaultValue",Vt={}));const Gt=e("ReportStrategyTypeTranslationsMap",new Map([[Dt.OnChange,"gateway.report-strategy.on-change"],[Dt.OnReportPeriod,"gateway.report-strategy.on-report-period"],[Dt.OnChangeOrReportPeriod,"gateway.report-strategy.on-change-or-report-period"],[Dt.OnReceived,"gateway.report-strategy.on-received"]]));var At;!function(e){e.EXCEPTION="EXCEPTION"}(At||(At={}));const jt={...We,...At},Lt=()=>[10,20,30];function Ut(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"a",17),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.onTabChanged(n))})),t.ɵɵtext(1),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("active",a.activeLink.name===e.name),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.name," ")}}function $t(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",18),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.created-time")))}function zt(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 Kt(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"widgets.gateway.level")))}function Ht(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell")(1,"span"),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(a.statusClass(e.status)),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.status)}}function Wt(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.message")))}function Qt(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵclassMap(a.statusClassMsg(e.status)),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.message," ")}}function Jt(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",21)}function Yt(e,n){1&e&&t.ɵɵelement(0,"mat-row",21)}class Xt{constructor(){this.displayedColumns=["ts","status","message"],this.gatewayLogLinks=[{name:"General",key:"LOGS"},{name:"Service",key:"SERVICE_LOGS"},{name:"Connection",key:"CONNECTION_LOGS"},{name:"Storage",key:"STORAGE_LOGS"},{key:"EXTENSIONS_LOGS",name:"Extension"}];const e={property:"ts",direction:h.DESC};this.pageLink=new f(10,0,null,e),this.dataSource=new g([])}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:"Connector",filterFn:e=>!e.message.includes("_converter.py")},{key:`${e.key}_LOGS`,name:"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 jt.DEBUG:return"status status-debug";case jt.WARNING:return"status status-warning";case jt.ERROR:case jt.EXCEPTION:return"status status-error";default:return"status status-info"}}statusClassMsg(e){if(e===jt.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:v.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||Xt)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Xt,selectors:[["tb-gateway-logs"]],viewQuery:function(e,n){if(1&e&&(t.ɵɵviewQuery(u,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"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:22,vars:21,consts:[["tabPanel",""],["mat-tab-nav-bar","",3,"tabPanel"],["mat-tab-link","",3,"active","click",4,"ngFor","ngForOf"],["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"],[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,"nav",1),t.ɵɵtemplate(1,Ut,2,2,"a",2),t.ɵɵelementEnd(),t.ɵɵelement(2,"mat-tab-nav-panel",null,0),t.ɵɵelementStart(4,"table",3),t.ɵɵelementContainerStart(5,4),t.ɵɵtemplate(6,$t,3,3,"mat-header-cell",5)(7,zt,3,4,"mat-cell",6),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(8,7),t.ɵɵtemplate(9,Kt,3,3,"mat-header-cell",8)(10,Ht,3,3,"mat-cell",6),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(11,9),t.ɵɵtemplate(12,Wt,3,3,"mat-header-cell",10)(13,Qt,2,3,"mat-cell",11),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(14,Jt,1,0,"mat-header-row",12)(15,Yt,1,0,"mat-row",13),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"span",14),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(19,"span",15)(20,"mat-divider")(21,"mat-paginator",16)),2&e){const e=t.ɵɵreference(3);t.ɵɵproperty("tabPanel",e),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.logLinks),t.ɵɵadvance(3),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(18,18,"attribute.no-telemetry-text")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",0===n.dataSource.data.length),t.ɵɵadvance(2),t.ɵɵproperty("length",n.dataSource.data.length)("pageIndex",n.pageLink.page)("pageSize",n.pageLink.pageSize)("pageSizeOptions",t.ɵɵpureFunction0(20,Lt))}},dependencies:t.ɵɵgetComponentDepsFactory(Xt,[V,b]),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",Xt);const Zt=["statisticChart"],en=e=>({"hidden-label":e});function tn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",23),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function nn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",23),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.attributeOnGateway),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.attributeOnGateway," ")}}function an(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.statistic-commands-empty")," "))}function rn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",24)(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",25),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,2,"gateway.statistics.command")),t.ɵɵadvance(2),t.ɵɵproperty("value",e.commandObj.command)}}function on(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-card",16)(1,"mat-form-field",17)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",18),t.ɵɵtemplate(6,tn,2,2,"mat-option",19)(7,nn,2,2,"mat-option",19),t.ɵɵelementEnd()(),t.ɵɵtemplate(8,an,3,3,"mat-error",20),t.ɵɵelementStart(9,"div")(10,"button",21),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.navigateToStatistics())})),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(13,rn,5,4,"mat-form-field",22),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.statisticForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.statistics.statistic")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.statisticsKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.commands),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!e.statisticsKeys.length&&!e.commands.length),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,9,"gateway.statistics.statistics-button")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.commandObj)}}function sn(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",26),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,1,"widgets.gateway.created-time")," "))}function pn(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[0],"yyyy-MM-dd HH:mm:ss")," ")}}function ln(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",27),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,1,"widgets.gateway.message")," "))}function cn(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[1]," ")}}function dn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",28)}function mn(e,n){1&e&&t.ɵɵelement(0,"mat-row",28)}function un(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",29),t.ɵɵelement(1,"span",30),t.ɵɵelementStart(2,"div",31),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.onLegendKeyHiddenChange(n.dataIndex))})),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵstyleProp("background-color",e.dataKey.color),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction1(5,en,a.legendData.keys[e.dataIndex].dataKey.hidden)),t.ɵɵproperty("innerHTML",e.dataKey.label,t.ɵɵsanitizeHtml)}}class gn{constructor(e,t,n){this.fb=e,this.attributeService=t,this.utils=n,this.isNumericData=!1,this.dataTypeDefined=!1,this.statisticsKeys=[],this.commands=[],this.subscriptionOptions={callbacks:{onDataUpdated:()=>this.ctx.ngZone.run((()=>{this.onDataUpdated()})),onDataUpdateError:(e,t)=>this.ctx.ngZone.run((()=>{this.onDataUpdateError(t)}))},useDashboardTimewindow:!1,legendConfig:{position:x.bottom}},this.init=()=>{this.flotCtx={$scope:this.ctx.$scope,$injector:this.ctx.$injector,utils:this.ctx.utils,isMobile:this.ctx.isMobile,isEdit:this.ctx.isEdit,subscriptionApi:this.ctx.subscriptionApi,detectChanges:this.ctx.detectChanges,settings:this.ctx.settings}},this.updateChart=()=>{},this.resize=()=>{};const a={property:"0",direction:h.DESC};this.pageLink=new f(Number.POSITIVE_INFINITY,0,null,a),this.displayedColumns=["0","1"],this.dataSource=new g([]),this.statisticForm=this.fb.group({statisticKey:[null,[]]}),this.statisticForm.get("statisticKey").valueChanges.subscribe((e=>{this.commandObj=null,this.commands.length&&(this.commandObj=this.commands.find((t=>t.attributeOnGateway===e))),this.subscriptionInfo&&this.createChartsSubscription(this.ctx.defaultSubscription.datasources[0].entity,e)}))}ngAfterViewInit(){if(this.dataSource.sort=this.sort,this.sort.sortChange.subscribe((()=>this.sortData())),this.init(),this.ctx.defaultSubscription.datasources.length){const e=this.ctx.defaultSubscription.datasources[0].entity;if(e.id.id===w)return;this.general?this.attributeService.getEntityTimeseriesLatest(e.id).subscribe((t=>{const n=Object.keys(t).filter((e=>e.includes("ConnectorEventsProduced")||e.includes("ConnectorEventsSent")));this.createGeneralChartsSubscription(e,n)})):this.attributeService.getEntityAttributes(e.id,C.SHARED_SCOPE,["general_configuration"]).subscribe((t=>{t&&t.length&&(this.commands=t[0].value.statistics.commands,!this.statisticForm.get("statisticKey").value&&this.commands&&this.commands.length&&(this.statisticForm.get("statisticKey").setValue(this.commands[0].attributeOnGateway),this.createChartsSubscription(e,this.commands[0].attributeOnGateway)))}))}}navigateToStatistics(){const e=G(this.ctx.stateController.getStateParams());this.ctx.stateController.openState("configuration",{defaultTab:"statistics",...e})}sortData(){this.dataSource.sortData(this.dataSource.data,this.sort)}onLegendKeyHiddenChange(e){this.legendData.keys[e].dataKey.hidden=!this.legendData.keys[e].dataKey.hidden,this.subscription.updateDataVisibility(e)}createChartsSubscription(e,t){const n=[{type:S.entity,entityType:E.DEVICE,entityId:e.id.id,entityName:e.name,timeseries:[]}];n[0].timeseries=[{name:t,label:t}],this.subscriptionInfo=n,this.changeSubscription(n),this.ctx.defaultSubscription.unsubscribe()}createGeneralChartsSubscription(e,t){const n=[{type:S.entity,entityType:E.DEVICE,entityId:e.id.id,entityName:e.name,timeseries:[]}];n[0].timeseries=[],t?.length&&t.forEach((e=>{n[0].timeseries.push({name:e,label:e})})),this.ctx.defaultSubscription.datasources[0].dataKeys.forEach((e=>{n[0].timeseries.push({name:e.name,label:e.label})})),this.changeSubscription(n),this.ctx.defaultSubscription.unsubscribe()}reset(){this.resize$&&this.resize$.disconnect(),this.subscription&&this.subscription.unsubscribe()}onDataUpdateError(e){const t=this.utils.parseException(e);let n=t.name;t.message&&(n+=": "+t.message),console.error(n)}onDataUpdated(){this.isDataOnlyNumbers(),this.isNumericData&&(this.chartInited||this.initChart())}initChart(){this.chartInited=!0,this.flotCtx.$container=$(this.statisticChart.nativeElement),this.resize$.observe(this.statisticChart.nativeElement)}isDataOnlyNumbers(){this.general?this.isNumericData=!0:(this.dataSource.data=this.subscription.data.length?this.subscription.data[0].data:[],this.dataSource.data.length&&!this.dataTypeDefined&&(this.dataTypeDefined=!0,this.isNumericData=this.dataSource.data.every((e=>!isNaN(+e[1])))))}changeSubscription(e){this.subscription&&this.reset(),this.ctx.datasources[0].entity&&this.ctx.subscriptionApi.createSubscriptionFromInfo(T.timeseries,e,this.subscriptionOptions,!1,!0).subscribe((e=>{this.dataTypeDefined=!1,this.subscription=e,this.isDataOnlyNumbers(),this.legendData=this.subscription.legendData,this.flotCtx.defaultSubscription=e,this.resize$=new ResizeObserver((()=>{this.resize()})),this.ctx.detectChanges(),this.isNumericData&&this.initChart()}))}static{this.ɵfac=function(e){return new(e||gn)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(A.AttributeService),t.ɵɵdirectiveInject(A.UtilsService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gn,selectors:[["tb-gateway-statistics"]],viewQuery:function(e,n){if(1&e&&(t.ɵɵviewQuery(u,5),t.ɵɵviewQuery(Zt,5)),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.sort=e.first),t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.statisticChart=e.first)}},inputs:{ctx:"ctx",general:"general"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:19,vars:19,consts:[["statisticChart",""],[1,"statistics-container","lt-md:flex-col","flex","flex-row"],[3,"formGroup",4,"ngIf"],[1,"chart-box","flex","flex-col"],[1,"chart-container"],["mat-table","","matSort","","matSortDisableClear","",3,"dataSource","matSortActive","matSortDirection"],["matColumnDef","0"],["mat-sort-header","",4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","1"],["mat-sort-header","","style","width: 70%",4,"matHeaderCellDef"],["class","mat-row-select",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","mat-row-select",4,"matRowDef","matRowDefColumns"],[1,"no-data-found","items-start","justify-center"],[1,"legend","flex","flex-1","flex-row","items-center","justify-center"],["class","legend-keys flex flex-row items-center justify-center",4,"ngFor","ngForOf"],[3,"formGroup"],["subscriptSizing","dynamic",1,"mat-block"],["formControlName","statisticKey"],[3,"value",4,"ngFor","ngForOf"],[4,"ngIf"],["mat-flat-button","","color","primary",3,"click"],["class","mat-block",4,"ngIf"],[3,"value"],[1,"mat-block"],["matInput","","disabled","",3,"value"],["mat-sort-header",""],["mat-sort-header","",2,"width","70%"],[1,"mat-row-select"],[1,"legend-keys","flex","flex-row","items-center","justify-center"],[1,"legend-line"],[1,"legend-label",3,"click","innerHTML"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",1),t.ɵɵtemplate(1,on,14,11,"mat-card",2),t.ɵɵelementStart(2,"div",3),t.ɵɵelement(3,"div",4,0),t.ɵɵelementStart(5,"table",5),t.ɵɵelementContainerStart(6,6),t.ɵɵtemplate(7,sn,3,3,"mat-header-cell",7)(8,pn,3,4,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(9,9),t.ɵɵtemplate(10,ln,3,3,"mat-header-cell",10)(11,cn,2,1,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(12,dn,1,0,"mat-header-row",11)(13,mn,1,0,"mat-row",12),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"span",13),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",14),t.ɵɵtemplate(18,un,3,7,"div",15),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.general),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.isNumericData),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.isNumericData),t.ɵɵproperty("dataSource",n.dataSource)("matSortActive",n.pageLink.sortOrder.property)("matSortDirection",n.pageLink.sortDirection()),t.ɵɵadvance(7),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",0!==n.dataSource.data.length||n.isNumericData),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,17,"attribute.no-telemetry-text")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.isNumericData),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",null==n.legendData?null:n.legendData.keys))},dependencies:t.ɵɵgetComponentDepsFactory(gn,[V,b]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;padding:0}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%]{height:100%;overflow-y:auto}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] mat-card[_ngcontent-%COMP%]{width:40%;height:100%;margin-right:35px;padding:15px;gap:22px}@media only screen and (max-width: 750px){[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] mat-card[_ngcontent-%COMP%]{width:100%}}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] .chart-box[_ngcontent-%COMP%], [_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] .chart-container[_ngcontent-%COMP%]{height:100%;flex-grow:1}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] .chart-box[_ngcontent-%COMP%]{overflow:auto}[_nghost-%COMP%] .statistics-container[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{height:100%}[_nghost-%COMP%] .legend[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;padding-top:8px;padding-bottom:4px;margin-top:15px}[_nghost-%COMP%] .legend[_ngcontent-%COMP%] .legend-keys[_ngcontent-%COMP%] .legend-label[_ngcontent-%COMP%]{padding:2px 20px 2px 10px;white-space:nowrap}[_nghost-%COMP%] .legend[_ngcontent-%COMP%] .legend-keys[_ngcontent-%COMP%] .legend-label.hidden-label[_ngcontent-%COMP%]{text-decoration:line-through;opacity:.6}[_nghost-%COMP%] .legend[_ngcontent-%COMP%] .legend-keys[_ngcontent-%COMP%] .legend-label[_ngcontent-%COMP%]:focus{outline:none}[_nghost-%COMP%] .legend[_ngcontent-%COMP%] .legend-keys[_ngcontent-%COMP%] .legend-line[_ngcontent-%COMP%]{display:inline-block;width:15px;height:3px;text-align:left;vertical-align:middle;outline:none}']})}}var yn;e("GatewayStatisticsComponent",gn),e("BACnetRequestTypes",yn),function(e){e.WriteProperty="writeProperty",e.ReadProperty="readProperty"}(yn||e("BACnetRequestTypes",yn={}));const hn=e("BACnetRequestTypesTranslates",new Map([[yn.WriteProperty,"gateway.rpc.write-property"],[yn.ReadProperty,"gateway.rpc.read-property"]]));var fn;e("BACnetObjectTypes",fn),function(e){e.BinaryInput="binaryInput",e.BinaryOutput="binaryOutput",e.AnalogInput="analogInput",e.AnalogOutput="analogOutput",e.BinaryValue="binaryValue",e.AnalogValue="analogValue"}(fn||e("BACnetObjectTypes",fn={}));const vn=e("BACnetObjectTypesTranslates",new Map([[fn.AnalogOutput,"gateway.rpc.analog-output"],[fn.AnalogInput,"gateway.rpc.analog-input"],[fn.BinaryOutput,"gateway.rpc.binary-output"],[fn.BinaryInput,"gateway.rpc.binary-input"],[fn.BinaryValue,"gateway.rpc.binary-value"],[fn.AnalogValue,"gateway.rpc.analog-value"]]));var bn;e("BLEMethods",bn),function(e){e.WRITE="write",e.READ="read",e.SCAN="scan"}(bn||e("BLEMethods",bn={}));const xn=e("BLEMethodsTranslates",new Map([[bn.WRITE,"gateway.rpc.write"],[bn.READ,"gateway.rpc.read"],[bn.SCAN,"gateway.rpc.scan"]]));var wn,Cn;e("CANByteOrders",wn),function(e){e.LITTLE="LITTLE",e.BIG="BIG"}(wn||e("CANByteOrders",wn={})),e("SocketMethodProcessings",Cn),function(e){e.WRITE="write",e.READ="read"}(Cn||e("SocketMethodProcessings",Cn={}));const Sn=e("SocketMethodProcessingsTranslates",new Map([[Cn.WRITE,"gateway.rpc.write"],[Cn.READ,"gateway.rpc.read"]]));var En;e("SNMPMethods",En),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"}(En||e("SNMPMethods",En={}));const Tn=e("SNMPMethodsTranslations",new Map([[En.SET,"gateway.rpc.set"],[En.MULTISET,"gateway.rpc.multiset"],[En.GET,"gateway.rpc.get"],[En.BULKWALK,"gateway.rpc.bulk-walk"],[En.TABLE,"gateway.rpc.table"],[En.MULTIGET,"gateway.rpc.multi-get"],[En.GETNEXT,"gateway.rpc.get-next"],[En.BULKGET,"gateway.rpc.bulk-get"],[En.WALKS,"gateway.rpc.walk"]]));var In,kn,Mn;e("HTTPMethods",In),function(e){e.CONNECT="CONNECT",e.DELETE="DELETE",e.GET="GET",e.HEAD="HEAD",e.OPTIONS="OPTIONS",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.TRACE="TRACE"}(In||e("HTTPMethods",In={})),e("SocketEncodings",kn),function(e){e.UTF_8="utf-8"}(kn||e("SocketEncodings",kn={})),e("RestSecurityType",Mn),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic"}(Mn||e("RestSecurityType",Mn={}));const Pn=e("RestSecurityTypeTranslationsMap",new Map([[Mn.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Mn.BASIC,"gateway.broker.security-types.basic"]]));class Fn{transform(e){return e.map((({value:e})=>e.toString())).join(", ")}static{this.ɵfac=function(e){return new(e||Fn)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getRpcTemplateArrayView",type:Fn,pure:!0,standalone:!0})}}e("RpcTemplateArrayViewPipe",Fn);class On{constructor(){this.differs=n(a),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=>{j(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||On)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"keyValueIsNotEmpty",type:On,pure:!1,standalone:!0})}}e("KeyValueIsNotEmptyPipe",On);const qn=e=>({$implicit:e,innerValue:!1}),Bn=e=>({"padding-left":e}),Rn=(e,t)=>({"boolean-true":e,"boolean-false":t}),Nn=e=>({$implicit:e,innerValue:!0});function _n(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext();const a=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",a)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,qn,e))}}function Dn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",19),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 Vn(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(12);t.ɵɵproperty("ngTemplateOutlet",e)}}function Gn(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(10);t.ɵɵproperty("ngTemplateOutlet",e)}}function An(e,n){if(1&e&&(t.ɵɵelementStart(0,"div"),t.ɵɵtemplate(1,Gn,1,1,"ng-container",21),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵreference(8);t.ɵɵclassMap(t.ɵɵpureFunction2(4,Rn,!0===e.value,!1===e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf","method"===e.key)("ngIfElse",n)}}function jn(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate(e.value)}}function Ln(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 Un(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext(3);const a=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",a)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,Nn,e))}}function $n(e,n){if(1&e&&(t.ɵɵtemplate(0,Un,1,4,"ng-container",12),t.ɵɵpipe(1,"keyvalue")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("ngForOf",t.ɵɵpipeBind2(1,1,e.value,n.originalOrder))}}function zn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14)(1,"div",15),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,Dn,3,3,"div",16)(5,Vn,1,1,"ng-container",17)(6,An,2,7,"div",18)(7,jn,1,1,"ng-template",null,1,t.ɵɵtemplateRefExtractor)(9,Ln,2,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor)(11,$n,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=n.innerValue,r=t.ɵɵnextContext(2);t.ɵɵstyleMap(t.ɵɵpureFunction1(10,Bn,a?"16px":"0")),t.ɵɵclassMap(r.getRpcParamsRowClasses(e.value)),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",a?e.key:t.ɵɵpipeBind1(3,8,"gateway.rpc."+e.key)," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",r.isArray(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",r.isObject(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!r.isObject(e.value)&&!r.isArray(e.value))}}function Kn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",6)(1,"mat-expansion-panel-header")(2,"mat-panel-title",7)(3,"span",8),t.ɵɵtext(4),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-panel-description")(6,"button",9),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.deleteTemplate(n,a))})),t.ɵɵelementStart(7,"mat-icon",10),t.ɵɵtext(8,"delete"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",11),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.applyTemplate(n,a))})),t.ɵɵelementStart(10,"mat-icon",10),t.ɵɵtext(11,"play_arrow"),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(12,_n,1,4,"ng-container",12),t.ɵɵpipe(13,"keyValueIsNotEmpty"),t.ɵɵtemplate(14,zn,13,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.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(13,3,e.config))}}class Hn{constructor(e){this.attributeService=e,this.saveTemplate=new r,this.useTemplate=new r,this.originalOrder=()=>0,this.isObject=e=>L(e),this.isArray=e=>Array.isArray(e),this.SNMPMethodsTranslations=Tn}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 a=`${this.connectorType}_template`;this.attributeService.saveEntityAttributes({id:this.ctx.defaultSubscription.targetDeviceId,entityType:E.DEVICE},C.SERVER_SCOPE,[{key:a,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||Hn)(t.ɵɵdirectiveInject(A.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Hn,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:4,vars:4,consts:[["RPCTemplateRef",""],["value",""],["SNMPMethod",""],["RPCObjectRow",""],[1,"mat-subtitle-1","title"],["hideToggle","",4,"ngFor","ngForOf"],["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",4,"ngFor","ngForOf"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"rpc-params-row","flex"],[1,"template-key"],["tbTruncateWithTooltip","","class","array-value",4,"ngIf"],[3,"ngTemplateOutlet",4,"ngIf"],[3,"class",4,"ngIf"],["tbTruncateWithTooltip","",1,"array-value"],[3,"ngTemplateOutlet"],[3,"ngTemplateOutlet",4,"ngIf","ngIfElse"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,Kn,16,5,"mat-expansion-panel",5)),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,"gateway.rpc.templates-title")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcTemplates))},dependencies:t.ɵɵgetComponentDepsFactory(Hn,[V,b,Fn,On]),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 Wn(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 Qn(e,n){1&e&&(t.ɵɵelementStart(0,"div",12),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",Hn);class Jn extends I{constructor(e,t,n,a,r){super(e,t,a),this.store=e,this.router=t,this.data=n,this.dialogRef=a,this.fb=r,this.config=this.data.config,this.templates=this.data.templates,this.templateNameCtrl=this.fb.control("",[ne.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||Jn)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef),t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Jn,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["class","mat-mdc-form-field-error","style","margin-top: -15px; padding-left: 10px; font-size: 14px;",4,"ngIf"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"mat-mdc-form-field-error",2,"margin-top","-15px","padding-left","10px","font-size","14px"]],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,Wn,3,3,"mat-error",7),t.ɵɵelementEnd(),t.ɵɵtemplate(12,Qn,3,3,"div",8),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",9)(14,"button",10),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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.ɵɵproperty("ngIf",n.templateNameCtrl.hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.validateDuplicateName(n.templateNameCtrl)),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(Jn,[V,b]),encapsulation:2})}}function Yn(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",6),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SecurityTypeTranslationsMap.get(e))," ")}}function Xn(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.username-required"))}function Zn(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.password-required"))}function ea(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7)(2,"div",8),t.ɵɵtext(3,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",9)(5,"mat-form-field",10),t.ɵɵelement(6,"input",11),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,Xn,3,3,"mat-icon",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",7)(10,"div",8),t.ɵɵtext(11,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"div",9)(13,"mat-form-field",10),t.ɵɵelement(14,"input",13),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,Zn,3,3,"mat-icon",12),t.ɵɵelementStart(17,"div",14),t.ɵɵelement(18,"tb-toggle-password",15),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("password").hasError("required")&&e.securityFormGroup.get("password").touched),t.ɵɵadvance(),t.ɵɵclassProp("hide-toggle",e.securityFormGroup.get("password").hasError("required"))}}e("GatewayServiceRPCConnectorTemplateDialogComponent",Jn);class ta{constructor(e){this.fb=e,this.BrokerSecurityType=Mn,this.securityTypes=Object.values(Mn),this.SecurityTypeTranslationsMap=Pn,this.destroy$=new me,this.propagateChange=e=>{},this.securityFormGroup=this.fb.group({type:[Mn.ANONYMOUS,[]],username:["",[ne.required,ne.pattern($e)]],password:["",[ne.required,ne.pattern($e)]]}),this.observeSecurityForm()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){e.type||(e.type=Mn.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===Mn.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(be(this.destroy$)).subscribe((e=>this.updateView(e))),this.securityFormGroup.get("type").valueChanges.pipe(be(this.destroy$)).subscribe((e=>this.updateValidators(e)))}static{this.ɵfac=function(e){return new(e||ta)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ta,selectors:[["tb-rest-connector-security"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>ta)),multi:!0},{provide:re,useExisting:i((()=>ta)),multi:!0}]),t.ɵɵStandaloneFeature],decls:7,vars:3,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",4,"ngFor","ngForOf"],[4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(5,Yn,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵtemplate(6,ea,19,10,"ng-container",5),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value===n.BrokerSecurityType.BASIC))},dependencies:t.ɵɵgetComponentDepsFactory(ta,[b,V]),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",ta);class na{constructor(e,t,n){this.elementRef=e,this.renderer=t,this.tooltip=n,this.tooltipEnabled=!0,this.position="above",this.destroy$=new me}ngOnInit(){this.observeMouseEvents(),this.applyTruncationStyles()}ngAfterViewInit(){this.tooltip.position=this.position}ngOnDestroy(){this.tooltip._isTooltipVisible()&&this.hideTooltip(),this.destroy$.next(),this.destroy$.complete()}observeMouseEvents(){ue(this.elementRef.nativeElement,"mouseenter").pipe(xe((()=>this.tooltipEnabled)),xe((()=>this.isOverflown(this.elementRef.nativeElement))),we((()=>this.showTooltip())),be(this.destroy$)).subscribe(),ue(this.elementRef.nativeElement,"mouseleave").pipe(xe((()=>this.tooltipEnabled)),xe((()=>this.tooltip._isTooltipVisible())),we((()=>this.hideTooltip())),be(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,a){this.el=e,this.renderer=t,this.translate=n,this.window=a,this.destroy$=new me,this.renderer.setStyle(this.el.nativeElement,"max-height","48px"),this.renderer.setStyle(this.el.nativeElement,"overflow","auto"),ue(a,"resize").pipe(be(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,a=e.querySelectorAll("mat-chip:not(.ellipsis-chip)");if(this.chipsValue.length>1){const r=this.el.nativeElement.querySelector(".ellipsis-text");this.renderer.setStyle(t,"display","inline-flex"),r.innerHTML=this.translate.instant("gateway.ellipsis-chips-text",{count:this.chipsValue.length});const i=e.offsetWidth-(t.offsetWidth+n);let o=0,s=0;a.forEach((e=>{this.renderer.setStyle(e,"display","inline-flex");const t=e.querySelector(".mdc-evolution-chip__text-label");this.applyMaxChipTextWidth(t,i/3),o+(e.offsetWidth+n)<=i&&she(M())))).subscribe((e=>{this.attributesSubject.next(e.data),this.pageDataSubject.next(e),r.next(e)})),r}fetchAttributes(e,t,n){return this.getAllAttributes(e,t).pipe(Se((e=>{const t=e.filter((e=>0!==e.lastUpdateTs));return n.filterData(t)})))}getAllAttributes(e,t){if(!this.allAttributes){let n;P.get(t)?(this.telemetrySubscriber=F.createEntityAttributesSubscription(this.telemetryWsService,e,t,this.zone),this.telemetrySubscriber.subscribe(),n=this.telemetrySubscriber.attributeData$()):n=this.attributeService.getEntityAttributes(e,t),this.allAttributes=n.pipe(Ee(1),Te())}return this.allAttributes}isAllSelected(){const e=this.selection.selected.length;return this.attributesSubject.pipe(Se((t=>e===t.length)))}isEmpty(){return this.attributesSubject.pipe(Se((e=>!e.length)))}total(){return this.pageDataSubject.pipe(Se((e=>e.totalElements)))}masterToggle(){this.attributesSubject.pipe(we((e=>{this.selection.selected.length===e.length?this.selection.clear():e.forEach((e=>{this.selection.select(e)}))})),Ie(1)).subscribe()}}e("AttributeDatasource",ra);const ia=()=>({maxWidth:"970px"});function oa(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",4)(1,"mat-expansion-panel-header",5)(2,"mat-panel-title")(3,"mat-slide-toggle",6),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,7),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(5);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 sa(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8),t.ɵɵtext(1,"gateway.report-strategy.label"),t.ɵɵelementEnd(),t.ɵɵelementContainer(2,7)),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(5);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e)}}function pa(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",16),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,a.ReportTypeTranslateMap.get(e)))}}function la(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),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 ca(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",17),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",18),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,la,3,3,"mat-icon",19),t.ɵɵelementStart(8,"span",20),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 da(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"div",11),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",12)(6,"mat-select",13),t.ɵɵtemplate(7,pa,3,4,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,ca,10,7,"div",15)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.type")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/report-strategy_fn")("tb-help-popup-style",t.ɵɵpureFunction0(7,ia)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.reportStrategyTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnChange&&e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnReceived)}}class ma{constructor(e){this.fb=e,this.isExpansionMode=!1,this.defaultValue=Vt.Key,this.reportStrategyTypes=Object.values(Dt),this.ReportTypeTranslateMap=Gt,this.ReportStrategyType=Dt,this.destroy$=new me,this.showStrategyControl=this.fb.control(!1),this.reportStrategyFormGroup=this.fb.group({type:[{value:Dt.OnReportPeriod,disabled:!0},[]],reportPeriod:[{value:this.defaultValue,disabled:!0},[ne.required,ne.min(100)]]}),this.observeStrategyFormChange(),this.observeStrategyToggle()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){this.isExpansionMode&&this.showStrategyControl.setValue(!!e,{emitEvent:!1}),e&&this.reportStrategyFormGroup.enable({emitEvent:!1});const{type:t=Dt.OnReportPeriod,reportPeriod:n=this.defaultValue}=e??{};this.reportStrategyFormGroup.setValue({type:t,reportPeriod:n},{emitEvent:!1}),this.onTypeChange(t)}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(be(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()})),this.reportStrategyFormGroup.get("type").valueChanges.pipe(be(this.destroy$)).subscribe((e=>this.onTypeChange(e)))}observeStrategyToggle(){this.showStrategyControl.valueChanges.pipe(be(this.destroy$),xe((()=>this.isExpansionMode))).subscribe((e=>{e?(this.reportStrategyFormGroup.enable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").addValidators(ne.required),this.onChange(this.reportStrategyFormGroup.value)):(this.reportStrategyFormGroup.disable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").removeValidators(ne.required),this.onChange(null)),this.reportStrategyFormGroup.updateValueAndValidity({emitEvent:!1})}))}onTypeChange(e){const t=this.reportStrategyFormGroup.get("reportPeriod");e===Dt.OnChange||e===Dt.OnReceived?t.disable({emitEvent:!1}):this.isExpansionMode&&!this.showStrategyControl.value||t.enable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||ma)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ma,selectors:[["tb-report-strategy"]],inputs:{isExpansionMode:"isExpansionMode",defaultValue:"defaultValue"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>ma)),multi:!0},{provide:re,useExisting:i((()=>ma)),multi:!0}]),t.ɵɵStandaloneFeature],decls:6,vars:3,consts:[["defaultMode",""],["strategyFields",""],[3,"formGroup"],["class","tb-settings",3,"expanded",4,"ngIf","ngIfElse"],[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",3,"tb-help-popup","tb-help-popup-style"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],[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){if(1&e&&(t.ɵɵelementContainerStart(0,2),t.ɵɵtemplate(1,oa,8,6,"mat-expansion-panel",3)(2,sa,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(4,da,9,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(3);t.ɵɵproperty("formGroup",n.reportStrategyFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isExpansionMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(ma,[V,b,na]),encapsulation:2,changeDetection:o.OnPush})}}e("ReportStrategyComponent",ma),qe([k()],ma.prototype,"isExpansionMode",void 0),qe([O()],ma.prototype,"defaultValue",void 0);class ua{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,C.SERVER_SCOPE,["active","lastDisconnectTime","lastConnectTime"]).subscribe((e=>{const t=e.find((e=>"active"===e.key)).value,n=e.find((e=>"lastDisconnectTime"===e.key))?.value,a=e.find((e=>"lastConnectTime"===e.key))?.value;this.isGatewayActive=this.getGatewayStatus(t,a,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],a=e.find((e=>"lastConnectTime"===e.dataKey.name)).data[0][1];this.isGatewayActive=this.getGatewayStatus(t,a,n),this.cd.detectChanges()}static{this.ɵfac=function(e){return new(e||ua)(t.ɵɵdirectiveInject(A.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ua,selectors:[["tb-gateway-status"]],inputs:{ctx:"ctx",deviceId:"deviceId"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:9,vars:10,consts:[[1,"min-h-10","flex-1","flex","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(ua,[V,b]),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})}}var ga,ya;e("GatewayStatusComponent",ua),e("ConvertorType",ga),function(e){e.JSON="json",e.BYTES="bytes",e.CUSTOM="custom"}(ga||e("ConvertorType",ga={})),e("MQTTSourceType",ya),function(e){e.MSG="message",e.TOPIC="topic",e.CONST="constant"}(ya||e("MQTTSourceType",ya={}));const ha=e("MqttVersions",[{name:3.1,value:3},{name:3.11,value:4},{name:5,value:5}]),fa=e("QualityTypeTranslationsMap",new Map([[0,"gateway.qos.at-most-once"],[1,"gateway.qos.at-least-once"],[2,"gateway.qos.exactly-once"]])),va=e("ConvertorTypeTranslationsMap",new Map([[ga.JSON,"gateway.JSON"],[ga.BYTES,"gateway.bytes"],[ga.CUSTOM,"gateway.custom"]]));var ba;e("RequestType",ba),function(e){e.CONNECT_REQUEST="connectRequests",e.DISCONNECT_REQUEST="disconnectRequests",e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(ba||e("RequestType",ba={}));const xa=e("RequestTypesTranslationsMap",new Map([[ba.CONNECT_REQUEST,"gateway.request.connect-request"],[ba.DISCONNECT_REQUEST,"gateway.request.disconnect-request"],[ba.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[ba.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[ba.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]])),wa=e("DataConversionTranslationsMap",new Map([[ga.JSON,"gateway.JSON-hint"],[ga.BYTES,"gateway.bytes-hint"],[ga.CUSTOM,"gateway.custom-hint"]]));var Ca,Sa;e("SocketType",Ca),function(e){e.TCP="TCP",e.UDP="UDP"}(Ca||e("SocketType",Ca={})),e("SocketValueKey",Sa),function(e){e.TIMESERIES="telemetry",e.ATTRIBUTES="attributes",e.ATTRIBUTES_REQUESTS="attributeRequests",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_METHODS="serverSideRpc"}(Sa||e("SocketValueKey",Sa={}));const Ea=e("SocketKeysPanelTitleTranslationsMap",new Map([[Sa.ATTRIBUTES,"gateway.attributes"],[Sa.TIMESERIES,"gateway.timeseries"],[Sa.ATTRIBUTES_REQUESTS,"gateway.attribute-requests"],[Sa.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Sa.RPC_METHODS,"gateway.rpc-methods"]]));var Ta,Ia;e("RequestsType",Ta),function(e){e.Shared="shared",e.Client="client"}(Ta||e("RequestsType",Ta={})),e("ExpressionType",Ia),function(e){e.Constant="constant",e.Expression="expression"}(Ia||e("ExpressionType",Ia={}));const ka=e("SocketKeysAddKeyTranslationsMap",new Map([[Sa.ATTRIBUTES,"gateway.add-attribute"],[Sa.TIMESERIES,"gateway.add-timeseries"],[Sa.ATTRIBUTES_REQUESTS,"gateway.add-attribute-request"],[Sa.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Sa.RPC_METHODS,"gateway.add-rpc-method"]])),Ma=e("SocketKeysDeleteKeyTranslationsMap",new Map([[Sa.ATTRIBUTES,"gateway.delete-attribute"],[Sa.TIMESERIES,"gateway.delete-timeseries"],[Sa.ATTRIBUTES_REQUESTS,"gateway.delete-attribute-request"],[Sa.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Sa.RPC_METHODS,"gateway.delete-rpc-method"]])),Pa=e("SocketKeysNoKeysTextTranslationsMap",new Map([[Sa.ATTRIBUTES,"gateway.no-attributes"],[Sa.TIMESERIES,"gateway.no-timeseries"],[Sa.ATTRIBUTES_REQUESTS,"gateway.no-attribute-requests"],[Sa.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Sa.RPC_METHODS,"gateway.no-rpc-methods"]]));var Fa;e("PortLimits",Fa),function(e){e[e.MIN=1]="MIN",e[e.MAX=65535]="MAX"}(Fa||e("PortLimits",Fa={}));const Oa=e("GatewayConnectorConfigVersionMap",new Map([[Je.BACNET,Qe.v3_6_2],[Je.SOCKET,Qe.v3_6_0],[Je.MQTT,Qe.v3_5_2],[Je.OPCUA,Qe.v3_5_2],[Je.MODBUS,Qe.v3_5_2]]));var qa,Ba,Ra,Na;e("OPCUaSourceType",qa),function(e){e.PATH="path",e.IDENTIFIER="identifier",e.CONST="constant"}(qa||e("OPCUaSourceType",qa={})),e("SecurityType",Ba),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic",e.CERTIFICATES="certificates"}(Ba||e("SecurityType",Ba={})),e("ModeType",Ra),function(e){e.NONE="None",e.SIGN="Sign",e.SIGNANDENCRYPT="SignAndEncrypt"}(Ra||e("ModeType",Ra={})),e("MappingType",Na),function(e){e.DATA="data",e.REQUESTS="requests",e.OPCUA="OPCua"}(Na||e("MappingType",Na={}));const _a=e("MappingTypeTranslationsMap",new Map([[Na.DATA,"gateway.data-mapping"],[Na.REQUESTS,"gateway.requests-mapping"],[Na.OPCUA,"gateway.data-mapping"]]));var Da;e("SecurityPolicy",Da),function(e){e.BASIC128="Basic128Rsa15",e.BASIC256="Basic256",e.BASIC256SHA="Basic256Sha256"}(Da||e("SecurityPolicy",Da={}));const Va=e("SecurityPolicyTypes",[{value:Da.BASIC128,name:"Basic128RSA15"},{value:Da.BASIC256,name:"Basic256"},{value:Da.BASIC256SHA,name:"Basic256SHA256"}]),Ga=e("SecurityTypeTranslationsMap",new Map([[Ba.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Ba.BASIC,"gateway.broker.security-types.basic"],[Ba.CERTIFICATES,"gateway.broker.security-types.certificates"]])),Aa=e("SourceTypeTranslationsMap",new Map([[ya.MSG,"gateway.source-type.msg"],[ya.TOPIC,"gateway.source-type.topic"],[ya.CONST,"gateway.source-type.const"],[qa.PATH,"gateway.source-type.path"],[qa.IDENTIFIER,"gateway.source-type.identifier"],[qa.CONST,"gateway.source-type.const"],[Ia.Expression,"gateway.source-type.expression"]]));var ja;e("MappingKeysType",ja),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.CUSTOM="extensionConfig",e.RPC_METHODS="rpc_methods",e.ATTRIBUTES_UPDATES="attributes_updates"}(ja||e("MappingKeysType",ja={}));const La=e("MappingKeysPanelTitleTranslationsMap",new Map([[ja.ATTRIBUTES,"gateway.attributes"],[ja.TIMESERIES,"gateway.timeseries"],[ja.CUSTOM,"gateway.keys"],[ja.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[ja.RPC_METHODS,"gateway.rpc-methods"]])),Ua=e("MappingKeysAddKeyTranslationsMap",new Map([[ja.ATTRIBUTES,"gateway.add-attribute"],[ja.TIMESERIES,"gateway.add-timeseries"],[ja.CUSTOM,"gateway.add-key"],[ja.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[ja.RPC_METHODS,"gateway.add-rpc-method"]])),$a=e("MappingKeysDeleteKeyTranslationsMap",new Map([[ja.ATTRIBUTES,"gateway.delete-attribute"],[ja.TIMESERIES,"gateway.delete-timeseries"],[ja.CUSTOM,"gateway.delete-key"],[ja.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[ja.RPC_METHODS,"gateway.delete-rpc-method"]])),za=e("MappingKeysNoKeysTextTranslationsMap",new Map([[ja.ATTRIBUTES,"gateway.no-attributes"],[ja.TIMESERIES,"gateway.no-timeseries"],[ja.CUSTOM,"gateway.no-keys"],[ja.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[ja.RPC_METHODS,"gateway.no-rpc-methods"]])),Ka=e("QualityTypes",[0,1,2]);var Ha;e("ServerSideRpcType",Ha),function(e){e.WithResponse="twoWay",e.WithoutResponse="oneWay"}(Ha||e("ServerSideRpcType",Ha={}));const Wa=e("HelpLinkByMappingTypeMap",new Map([[Na.DATA,q+"/docs/iot-gateway/config/mqtt/#section-mapping"],[Na.OPCUA,q+"/docs/iot-gateway/config/opc-ua/#section-mapping"],[Na.REQUESTS,q+"/docs/iot-gateway/config/mqtt/#requests-mapping"]])),Qa=e("MappingHintTranslationsMap",new Map([[Na.DATA,"gateway.data-mapping-hint"],[Na.OPCUA,"gateway.opcua-data-mapping-hint"],[Na.REQUESTS,"gateway.requests-mapping-hint"]]));var Ja,Ya,Xa,Za,er,tr,nr,ar;e("ServerSideRPCType",Ja),function(e){e.ONE_WAY="oneWay",e.TWO_WAY="twoWay"}(Ja||e("ServerSideRPCType",Ja={})),e("ModbusProtocolType",Ya),function(e){e.TCP="tcp",e.UDP="udp",e.Serial="serial"}(Ya||e("ModbusProtocolType",Ya={})),e("ModbusMethodType",Xa),function(e){e.SOCKET="socket",e.RTU="rtu"}(Xa||e("ModbusMethodType",Xa={})),e("ModbusSerialMethodType",Za),function(e){e.RTU="rtu",e.ASCII="ascii"}(Za||e("ModbusSerialMethodType",Za={})),e("ModbusParity",er),function(e){e.Even="E",e.Odd="O",e.None="N"}(er||e("ModbusParity",er={})),e("ModbusOrderType",tr),function(e){e.BIG="BIG",e.LITTLE="LITTLE"}(tr||e("ModbusOrderType",tr={})),e("ModbusRegisterType",nr),function(e){e.HoldingRegisters="holding_registers",e.CoilsInitializer="coils_initializer",e.InputRegisters="input_registers",e.DiscreteInputs="discrete_inputs"}(nr||e("ModbusRegisterType",nr={})),e("ModbusValueKey",ar),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_REQUESTS="rpc"}(ar||e("ModbusValueKey",ar={}));const rr=e("ModbusBaudrates",[4800,9600,19200,38400,57600,115200,230400,460800,921600]),ir=e("ModbusByteSizes",[5,6,7,8]),or=e("ModbusRegisterTranslationsMap",new Map([[nr.HoldingRegisters,"gateway.holding_registers"],[nr.CoilsInitializer,"gateway.coils_initializer"],[nr.InputRegisters,"gateway.input_registers"],[nr.DiscreteInputs,"gateway.discrete_inputs"]]));var sr;e("ModbusBitTargetType",sr),function(e){e.BooleanType="bool",e.IntegerType="int"}(sr||e("ModbusBitTargetType",sr={}));const pr=e("ModbusBitTargetTypeTranslationMap",new Map([[sr.BooleanType,"gateway.boolean"],[sr.IntegerType,"gateway.integer"]])),lr=e("ModbusMethodLabelsMap",new Map([[Xa.SOCKET,"Socket"],[Xa.RTU,"RTU"],[Za.ASCII,"ASCII"]])),cr=e("ModbusProtocolLabelsMap",new Map([[Ya.TCP,"TCP"],[Ya.UDP,"UDP"],[Ya.Serial,"Serial"]])),dr=e("ModbusParityLabelsMap",new Map([[er.Even,"Even"],[er.Odd,"Odd"],[er.None,"None"]])),mr=e("ModbusKeysPanelTitleTranslationsMap",new Map([[ar.ATTRIBUTES,"gateway.attributes"],[ar.TIMESERIES,"gateway.timeseries"],[ar.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[ar.RPC_REQUESTS,"gateway.rpc-requests"]])),ur=e("ModbusKeysAddKeyTranslationsMap",new Map([[ar.ATTRIBUTES,"gateway.add-attribute"],[ar.TIMESERIES,"gateway.add-timeseries"],[ar.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[ar.RPC_REQUESTS,"gateway.add-rpc-request"]])),gr=e("ModbusKeysDeleteKeyTranslationsMap",new Map([[ar.ATTRIBUTES,"gateway.delete-attribute"],[ar.TIMESERIES,"gateway.delete-timeseries"],[ar.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[ar.RPC_REQUESTS,"gateway.delete-rpc-request"]])),yr=e("ModbusKeysNoKeysTextTranslationsMap",new Map([[ar.ATTRIBUTES,"gateway.no-attributes"],[ar.TIMESERIES,"gateway.no-timeseries"],[ar.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[ar.RPC_REQUESTS,"gateway.no-rpc-requests"]]));var hr;e("ModifierType",hr),function(e){e.DIVIDER="divider",e.MULTIPLIER="multiplier"}(hr||e("ModifierType",hr={}));const fr=e("ModifierTypesMap",new Map([[hr.DIVIDER,{name:"gateway.divider",icon:"mdi:division"}],[hr.MULTIPLIER,{name:"gateway.multiplier",icon:"mdi:multiplication"}]]));var vr,br;e("DeviceInfoType",vr),function(e){e.FULL="full",e.PARTIAL="partial"}(vr||e("DeviceInfoType",vr={})),e("SegmentationType",br),function(e){e.BOTH="segmentedBoth",e.TRANSMIT="segmentedTransmit",e.RECEIVE="segmentedReceive",e.NO="noSegmentation"}(br||e("SegmentationType",br={}));const xr=e("SegmentationTypeTranslationsMap",new Map([[br.BOTH,"gateway.bacnet.segmentation.both"],[br.TRANSMIT,"gateway.bacnet.segmentation.transmit"],[br.RECEIVE,"gateway.bacnet.segmentation.receive"],[br.NO,"gateway.bacnet.segmentation.no"]]));var wr;e("BacnetDeviceKeysType",wr),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.RPC_METHODS="serverSideRpc",e.ATTRIBUTES_UPDATES="attributeUpdates"}(wr||e("BacnetDeviceKeysType",wr={}));const Cr=e("BacnetDeviceKeysPanelTitleTranslationsMap",new Map([[wr.ATTRIBUTES,"gateway.attributes"],[wr.TIMESERIES,"gateway.timeseries"],[wr.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[wr.RPC_METHODS,"gateway.rpc-methods"]])),Sr=e("BacnetDeviceKeysAddKeyTranslationsMap",new Map([[wr.ATTRIBUTES,"gateway.add-attribute"],[wr.TIMESERIES,"gateway.add-timeseries"],[wr.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[wr.RPC_METHODS,"gateway.add-rpc-method"]])),Er=e("BacnetDeviceKeysDeleteKeyTranslationsMap",new Map([[wr.ATTRIBUTES,"gateway.delete-attribute"],[wr.TIMESERIES,"gateway.delete-timeseries"],[wr.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[wr.RPC_METHODS,"gateway.delete-rpc-method"]])),Tr=e("BacnetDeviceKeysNoKeysTextTranslationsMap",new Map([[wr.ATTRIBUTES,"gateway.no-attributes"],[wr.TIMESERIES,"gateway.no-timeseries"],[wr.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[wr.RPC_METHODS,"gateway.no-rpc-methods"]]));var Ir;e("BacnetKeyObjectType",Ir),function(e){e.analogInput="analogInput",e.analogOutput="analogOutput",e.analogValue="analogValue",e.binaryInput="binaryInput",e.binaryOutput="binaryOutput",e.binaryValue="binaryValue"}(Ir||e("BacnetKeyObjectType",Ir={}));const kr=e("BacnetKeyObjectTypeTranslationsMap",new Map([[Ir.analogInput,"gateway.bacnet.object-type.analog-input"],[Ir.analogOutput,"gateway.bacnet.object-type.analog-output"],[Ir.analogValue,"gateway.bacnet.object-type.analog-value"],[Ir.binaryInput,"gateway.bacnet.object-type.binary-input"],[Ir.binaryOutput,"gateway.bacnet.object-type.binary-output"],[Ir.binaryValue,"gateway.bacnet.object-type.binary-value"]]));var Mr;e("BacnetPropertyId",Mr),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"}(Mr||e("BacnetPropertyId",Mr={}));const Pr=e("BacnetPropertyIdByObjectType",new Map([[Ir.analogInput,[Mr.presentValue,Mr.statusFlags,Mr.covIncrement]],[Ir.analogOutput,[Mr.presentValue,Mr.statusFlags,Mr.covIncrement]],[Ir.analogValue,[Mr.presentValue,Mr.statusFlags,Mr.covIncrement]],[Ir.binaryInput,[Mr.presentValue,Mr.statusFlags,Mr.eventState,Mr.outOfService,Mr.polarity]],[Ir.binaryOutput,[Mr.presentValue,Mr.statusFlags,Mr.eventState,Mr.outOfService,Mr.polarity,Mr.priorityArray,Mr.relinquishDefault,Mr.currentCommandPriority,Mr.eventMessageTexts,Mr.eventMessageTextsConfig,Mr.eventAlgorithmInhibitReference,Mr.timeDelayNormal]],[Ir.binaryValue,[Mr.presentValue,Mr.statusFlags,Mr.eventState,Mr.outOfService]]])),Fr=e("BacnetPropertyIdTranslationsMap",new Map([[Mr.presentValue,"gateway.bacnet.property-id.present-value"],[Mr.statusFlags,"gateway.bacnet.property-id.status-flags"],[Mr.covIncrement,"gateway.bacnet.property-id.cov-increment"],[Mr.eventState,"gateway.bacnet.property-id.event-state"],[Mr.outOfService,"gateway.bacnet.property-id.out-of-service"],[Mr.polarity,"gateway.bacnet.property-id.polarity"],[Mr.priorityArray,"gateway.bacnet.property-id.priority-array"],[Mr.relinquishDefault,"gateway.bacnet.property-id.relinquish-default"],[Mr.currentCommandPriority,"gateway.bacnet.property-id.current-command-priority"],[Mr.eventMessageTexts,"gateway.bacnet.property-id.event-message-texts"],[Mr.eventMessageTextsConfig,"gateway.bacnet.property-id.event-message-texts-config"],[Mr.eventAlgorithmInhibitReference,"gateway.bacnet.property-id.event-algorithm-inhibit-reference"],[Mr.timeDelayNormal,"gateway.bacnet.property-id.time-delay-normal"]]));var Or;e("BacnetRequestType",Or),function(e){e.Write="writeProperty",e.Read="readProperty"}(Or||e("BacnetRequestType",Or={}));const qr=e("BacnetRequestTypeTranslationsMap",new Map([[Or.Write,"gateway.bacnet.request-type.write"],[Or.Read,"gateway.bacnet.request-type.read"]]));class Br{static{this.mqttRequestTypeKeys=Object.values(ba)}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 a=e.deviceInfo??this.extractConverterDeviceInfo(e),r={...e,deviceInfo:a,extensionConfig:e.extensionConfig||e["extension-config"]||null};return this.cleanUpOldFields(r),{converter:r,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===ba.SERVER_SIDE_RPC&&delete e.type;const{attributeNameExpression:t,deviceInfo:a,...r}=e,i={...r,attributeNameJsonExpression:t||null,deviceNameJsonExpression:a?.deviceNameExpressionSource!==ya.TOPIC?a?.deviceNameExpression:null,deviceNameTopicExpression:a?.deviceNameExpressionSource===ya.TOPIC?a?.deviceNameExpression:null};return this.cleanUpNewFields(i),i})),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!==ga.BYTES?{...n,deviceNameJsonExpression:t?.deviceNameExpressionSource===ya.MSG?t.deviceNameExpression:null,deviceTypeJsonExpression:t?.deviceProfileExpressionSource===ya.MSG?t.deviceProfileExpression:null,deviceNameTopicExpression:t?.deviceNameExpressionSource!==ya.MSG?t?.deviceNameExpression:null,deviceTypeTopicExpression:t?.deviceProfileExpressionSource!==ya.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])),K(e)}static cleanUpNewFields(e){this.mqttRequestMappingNewFields.forEach((t=>delete e[t])),K(e)}static getTypeSourceByValue(e){return e.includes("${")?ya.MSG:e.includes("/")?ya.TOPIC:ya.CONST}static extractConverterDeviceInfo(e){const t=e.deviceNameExpression||e.deviceNameJsonExpression||e.deviceNameTopicExpression||null,n=e.deviceNameExpressionSource?e.deviceNameExpressionSource:t?this.getTypeSourceByValue(t):null,a=e.deviceProfileExpression||e.deviceTypeTopicExpression||e.deviceTypeJsonExpression||"default",r=e.deviceProfileExpressionSource?e.deviceProfileExpressionSource:a?this.getTypeSourceByValue(a):null;return t||a?{deviceNameExpression:t,deviceNameExpressionSource:n,deviceProfileExpression:a,deviceProfileExpressionSource:r}:null}static mapRequestToUpgradedVersion(e,t){const n=e.deviceNameJsonExpression||e.deviceNameTopicExpression||null,a=e.deviceTypeTopicExpression||e.deviceTypeJsonExpression||"default",r=a?this.getTypeSourceByValue(a):null,i=e.attributeNameExpressionSource||e.attributeNameJsonExpression||null,o=t===ba.SERVER_SIDE_RPC?1:null,s=t===ba.SERVER_SIDE_RPC?e.responseTopicExpression?Ha.WithResponse:Ha.WithoutResponse:null;return{...e,attributeNameExpression:i,attributeNameExpressionSource:i?this.getTypeSourceByValue(i):null,deviceInfo:e.deviceInfo?e.deviceInfo:n?{deviceNameExpression:n,deviceNameExpressionSource:this.getTypeSourceByValue(n),deviceProfileExpression:a,deviceProfileExpressionSource:r}:null,responseTopicQoS:o,type:s}}}e("MqttVersionMappingUtil",Br);class Rr{constructor(e,t){this.gatewayVersionIn=e,this.connector=t,this.gatewayVersion=zr.parseVersion(this.gatewayVersionIn),this.configVersion=zr.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=zr.parseVersion(Oa.get(this.connector.type)),t=this.gatewayVersion>=e,n=!this.configVersion||this.configVersion=e&&e>this.gatewayVersion}}e("GatewayConnectorVersionProcessor",Rr);class Nr extends Rr{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.mqttRequestTypeKeys=Object.values(ba)}getUpgradedVersion(){const{connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:a,serverSideRpc:r}=this.connector.configurationJson;let i={...this.connector.configurationJson,requestsMapping:Br.mapRequestsToUpgradedVersion({connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:a,serverSideRpc:r}),mapping:Br.mapMappingToUpgradedVersion(this.connector.configurationJson.mapping)};return this.mqttRequestTypeKeys.forEach((e=>{const{[e]:t,...n}=i;i={...n}})),this.cleanUpConfigJson(i),{...this.connector,configurationJson:i,configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const{requestsMapping:e,mapping:t,...n}=this.connector.configurationJson,a=e?Br.mapRequestsToDowngradedVersion(e):{},r=Br.mapMappingToDowngradedVersion(t);return{...this.connector,configurationJson:{...n,...a,mapping:r},configVersion:this.gatewayVersionIn}}cleanUpConfigJson(e){U(e.requestsMapping,{})&&delete e.requestsMapping,U(e.mapping,[])&&delete e.mapping}}e("MqttVersionProcessor",Nr);class _r extends Rr{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?Kr.mapMasterToUpgradedVersion(e.master):{slaves:[]},slave:e.slave?Kr.mapSlaveToUpgradedVersion(e.slave):{}},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{...e,slave:e.slave?Kr.mapSlaveToDowngradedVersion(e.slave):{},master:e.master?.slaves?Kr.mapMasterToDowngradedVersion(e.master):{slaves:[]}},configVersion:this.gatewayVersionIn}}}e("ModbusVersionProcessor",_r);class Dr extends Rr{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson.server;return{...this.connector,configurationJson:{server:e?Hr.mapServerToUpgradedVersion(e):{},mapping:e?.mapping?Hr.mapMappingToUpgradedVersion(e.mapping):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:{server:Hr.mapServerToDowngradedVersion(this.connector.configurationJson)},configVersion:this.gatewayVersionIn}}} +System.register(["@angular/core","@angular/material/sort","@angular/material/table","@angular/material/paginator","@shared/public-api","@angular/common","@angular/forms","rxjs","rxjs/operators","@core/public-api","@angular/material/dialog","tslib","@angular/material/tooltip","@ngx-translate/core","@angular/cdk/collections","@ngrx/store","@angular/router","echarts/core","@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,I,E,M,k,P,D,O,A,F,R,B,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,Ie,Ee,Me,ke,Pe,De,Oe,Ae,Fe,Re,Be,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;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.Direction,S=e.PageLink,C=e.DataKeyType,_=e.SharedModule,T=e,I=e.coerceBoolean,E=e.emptyPageData,M=e.isClientSideTelemetryType,k=e.TelemetrySubscriber,P=e.coerceNumber,D=e.AttributeScope,O=e.helpBaseUrl,A=e.DialogComponent,F=e.defaultLegendConfig,R=e.widgetType,B=e.NULL_UUID,N=e.DatasourceType,L=e.EntityType,V=e.ContentType,q=e.PageComponent,G=e.TbTableDatasource,z=e.HOUR,U=e.DeviceCredentialsType},function(e){j=e.CommonModule},function(e){H=e,W=e.NG_VALUE_ACCESSOR,$=e.Validators,K=e.NG_VALIDATORS,Y=e.FormBuilder,X=e.FormControl},function(e){Z=e.Observable,Q=e.ReplaySubject,J=e.shareReplay,ee=e.combineLatest,te=e.Subject,ne=e.fromEvent,ie=e.BehaviorSubject,ae=e.of,re=e.zip,oe=e.forkJoin,se=e.merge},function(e){le=e.takeUntil,pe=e.map,ce=e.distinctUntilChanged,de=e.debounceTime,ue=e.filter,me=e.tap,he=e.catchError,ge=e.publishReplay,fe=e.refCount,ye=e.take,ve=e.takeWhile,xe=e.switchMap,be=e.startWith,we=e.mergeMap},function(e){Se=e.isEqual,Ce=e.WINDOW,_e=e,Te=e.deleteNullProperties,Ie=e.DialogService,Ee=e.isNumber,Me=e.isString,ke=e.isDefinedAndNotNull,Pe=e.formatValue,De=e.isLiteralObject,Oe=e.deepClone,Ae=e.isUndefinedOrNull,Fe=e.isObject,Re=e.generateSecret,Be=e.camelCase,Ne=e.deepTrim},function(e){Le=e.MatDialog,Ve=e.MAT_DIALOG_DATA,qe=e},function(e){Ge=e.__decorate,ze=e.__extends},function(e){Ue=e,je=e.MatTooltip},function(e){He=e,We=e.TranslateService,$e=e.TranslateModule},function(e){Ke=e.SelectionModel},function(e){Ye=e},function(e){Xe=e},function(e){Ze=e},function(e){Qe=e.calculateAxisSize,Je=e.measureAxisNameSize},function(e){et=e},function(e){tt=e},function(e){nt=e.JsonObjectEditDialogComponent},function(e){it=e},function(e){at=e},function(e){rt=e},function(e){ot=e.coerceBoolean},function(e){st=e.ErrorStateMatcher}],execute:function(){e("getDefaultConfig",Wt);const lt=e("jsonRequired",(e=>e.value?null:{required:!0}));var pt,ct,dt;e("GatewayLogLevel",pt),function(e){e.NONE="NONE",e.CRITICAL="CRITICAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e.DEBUG="DEBUG",e.TRACE="TRACE"}(pt||e("GatewayLogLevel",pt={})),e("GatewayVersion",ct),function(e){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"}(ct||e("GatewayVersion",ct={})),e("ConnectorType",dt),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"}(dt||e("ConnectorType",dt={}));const ut=e("GatewayConnectorDefaultTypesTranslatesMap",new Map([[dt.MQTT,"MQTT"],[dt.MODBUS,"MODBUS"],[dt.GRPC,"GRPC"],[dt.OPCUA,"OPCUA"],[dt.BLE,"BLE"],[dt.REQUEST,"REQUEST"],[dt.CAN,"CAN"],[dt.BACNET,"BACNET"],[dt.ODBC,"ODBC"],[dt.REST,"REST"],[dt.SNMP,"SNMP"],[dt.FTP,"FTP"],[dt.SOCKET,"SOCKET"],[dt.XMPP,"XMPP"],[dt.OCPP,"OCPP"],[dt.CUSTOM,"CUSTOM"],[dt.KNX,"KNX"]])),mt=e("ConnectorsTypesByVersion",new Map([[ct.v3_7_0,Object.values(dt)],[ct.Legacy,Object.values(dt).filter((e=>e!==dt.KNX))]]));var ht,gt;e("SocketEncoding",ht),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"}(ht||e("SocketEncoding",ht={})),e("HTTPMethods",gt),function(e){e.DELETE="DELETE",e.GET="GET",e.HEAD="HEAD",e.OPTIONS="OPTIONS",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT"}(gt||e("HTTPMethods",gt={}));var ft={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","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","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",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:{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",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-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":"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"},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.","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",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 data transmission to the master. Acceptable values: true or false.","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."}}}},yt={"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 نشطة."}},vt={"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"},xt={"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"},bt={"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"},wt={"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."}},St={"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"},Ct={"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."}},_t={"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"},Tt={"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."}},It={"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"},Et={"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"},Mt={"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"},kt={"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 文件的文件夹中,使用以下命令在终端中启动网关"},Pt={"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"};var Dt={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"}]}]}},Ot={"3.5.2":{broker:{host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"anonymous"}},mapping:[{topicFilter:"sensor/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"message",deviceProfileExpression:"${sensorType}"},sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"string",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/data)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"},sendDataOnlyOnChange:!1,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"},sendDataOnlyOnChange:!1,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:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}},{topicFilter:"sensor/+/connect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"}},{topicFilter:"sensor/+/disconnect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)"}}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"},attributeNameExpressionSource:"message",attributeNameExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{type:"twoWay",deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTopicQoS:1,responseTimeout:1e4,valueExpression:"${params}"},{type:"oneWay",deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},legacy:{broker:{name:"Default Local Broker",host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"basic",username:"user",password:"password"}},mapping:[{topicFilter:"sensor/data",converter:{type:"json",deviceNameJsonExpression:"${serialNumber}",deviceTypeJsonExpression:"${sensorType}",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",converter:{type:"json",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/data)",deviceTypeTopicExpression:"Thermometer",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{topicFilter:"sensor/raw_data",converter:{type:"bytes",deviceNameExpression:"[0:4]",deviceTypeExpression:"default",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"raw",key:"rawData",value:"[:]"}],timeseries:[{type:"raw",key:"temp",value:"[4:]"}]}},{topicFilter:"custom/sensors/+",converter:{type:"custom",extension:"CustomMqttUplinkConverter",cached:!0,"extension-config":{temperatureBytes:2,humidityBytes:2,batteryLevelBytes:1}}}],connectRequests:[{topicFilter:"sensor/connect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/connect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/connect)"}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/disconnect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/disconnect)"}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceNameJsonExpression:"${serialNumber}",attributeNameJsonExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTimeout:1e4,valueExpression:"${params}"},{deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},At={"3.5.2":{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:3e4},attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"8int_read",type:"8int",functionCode:4,objectsCount:1,address:6},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"8int_read_multiplier",type:"8int",functionCode:4,objectsCount:1,address:10,multiplier:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"8uint_read",type:"8uint",functionCode:4,objectsCount:1,address:17,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"8int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]},coils_initializer:{attributes:[{address:5,type:"8int",tag:"coil",objectsCount:1,value:0}],timeseries:[],attributeUpdates:[],rpc:[]}}}},legacy:{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",sendDataOnlyOnChange:!0,connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:[{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]}],coils_initializer:[{attributes:[{address:5,type:"string",tag:"sm",objectsCount:1,value:"12"}],timeseries:[],attributeUpdates:[],rpc:[]}]}}}},Ft={"3.5.2":{server:{url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:36e5,pollPeriodInMillis:5e3,enableSubscriptions:!0,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"}},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNodeSource:"path",deviceInfo:{deviceNameExpression:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",deviceNameExpressionSource:"path",deviceProfileExpression:"Device",deviceProfileExpressionSource:"constant"},attributes:[{key:"temperature °C",type:"path",value:"${ns=2;i=5}"}],timeseries:[{key:"humidity",type:"path",value:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",type:"path",value:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[{type:"integer",value:2},{type:"integer",value:4}]}],attributes_updates:[{key:"deviceName",type:"path",value:"Root\\.Objects\\.Device1\\.serialNumber"}]}]},legacy:{server:{name:"OPC-UA Default Server",url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:5e3,disableSubscriptions:!1,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNamePattern:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",attributes:[{key:"temperature °C",path:"${ns=2;i=5}"}],timeseries:[{key:"humidity",path:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",path:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[2,4]}],attributes_updates:[{attributeOnThingsBoard:"deviceName",attributeOnDevice:"Root\\.Objects\\.Device1\\.serialNumber"}]}]}}},Rt={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"}]}]},Bt={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,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,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"}]}}],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",requestValueExpression:"${params}",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"}}]},Nt={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"}]}]},Lt={"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"}]}]}},Vt={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]}]}},qt={"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"}}]}},Gt={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}"}]},Ut={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 Ht=e("connectorConfigs",{[dt.MQTT]:Ot,[dt.MODBUS]:At,[dt.OPCUA]:Ft,[dt.BLE]:Rt,[dt.REQUEST]:Bt,[dt.CAN]:Nt,[dt.BACNET]:Lt,[dt.ODBC]:Vt,[dt.REST]:qt,[dt.SNMP]:Gt,[dt.FTP]:zt,[dt.SOCKET]:Dt,[dt.XMPP]:Ut,[dt.OCPP]:jt,[dt.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"}]}}});function Wt(e){const t=Ht[e];if(!t)throw new Error("No default config found");return t}var $t;e("ModbusDataType",$t),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"}($t||e("ModbusDataType",$t={}));const Kt=e("ModbusEditableDataTypes",[$t.BYTES,$t.BITS,$t.STRING]);var Yt,Xt;e("ModbusObjectCountByDataType",Yt),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"}(Yt||e("ModbusObjectCountByDataType",Yt={})),e("MappingValueType",Xt),function(e){e.STRING="string",e.INTEGER="integer",e.DOUBLE="double",e.BOOLEAN="boolean"}(Xt||e("MappingValueType",Xt={}));const Zt=e("mappingValueTypesMap",new Map([[Xt.STRING,{name:"value.string",icon:"mdi:format-text"}],[Xt.INTEGER,{name:"value.integer",icon:"mdi:numeric"}],[Xt.DOUBLE,{name:"value.double",icon:"mdi:numeric"}],[Xt.BOOLEAN,{name:"value.boolean",icon:"mdi:checkbox-marked-outline"}]])),Qt=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 Jt,en,tn;e("ConfigurationModes",Jt),function(e){e.BASIC="basic",e.ADVANCED="advanced"}(Jt||e("ConfigurationModes",Jt={})),e("ReportStrategyType",en),function(e){e.OnChange="ON_CHANGE",e.OnReportPeriod="ON_REPORT_PERIOD",e.OnChangeOrReportPeriod="ON_CHANGE_OR_REPORT_PERIOD",e.OnReceived="ON_RECEIVED"}(en||e("ReportStrategyType",en={})),e("ReportStrategyDefaultValue",tn),function(e){e[e.Gateway=6e4]="Gateway",e[e.Connector=6e4]="Connector",e[e.Device=3e4]="Device",e[e.Key=15e3]="Key"}(tn||e("ReportStrategyDefaultValue",tn={}));const nn=e("ReportStrategyTypeTranslationsMap",new Map([[en.OnChange,"gateway.report-strategy.on-change"],[en.OnReportPeriod,"gateway.report-strategy.on-report-period"],[en.OnChangeOrReportPeriod,"gateway.report-strategy.on-change-or-report-period"],[en.OnReceived,"gateway.report-strategy.on-received"]])),an=e("numberInputPattern",new RegExp(/^\d{1,15}(\.\d{1,15})?$/)),rn=e("noLeadTrailSpacesRegex",/^\S+(?: \S+)*$/),on=e("integerRegex",/^[-+]?\d+$/),sn=e("nonZeroFloat",/^-?(?!0(\.0+)?$)\d+(\.\d+)?$/);var ln;!function(e){e.EXCEPTION="EXCEPTION"}(ln||(ln={}));const pn={...pt,...ln},cn=()=>[10,20,30];function dn(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 un(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 mn(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 hn(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 gn(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 fn(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 yn(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 vn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",23)}function xn(e,n){1&e&&t.ɵɵelement(0,"mat-row",23)}class bn{constructor(){this.displayedColumns=["ts","status","message"],this.gatewayLogLinks=[{name:"General",key:"LOGS"},{name:"Service",key:"SERVICE_LOGS"},{name:"Connection",key:"CONNECTION_LOGS"},{name:"Storage",key:"STORAGE_LOGS"},{key:"EXTENSIONS_LOGS",name:"Extension"}];const e={property:"ts",direction:w.DESC};this.pageLink=new S(10,0,null,e),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:"Connector",filterFn:e=>!e.message.includes("_converter.py")},{key:`${e.key}_converter_LOGS`,name:"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 pn.DEBUG:return"status status-debug";case pn.WARNING:return"status status-warning";case pn.ERROR:case pn.EXCEPTION:return"status status-error";default:return"status status-info"}}statusClassMsg(e){if(e===pn.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:C.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||bn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bn,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:23,vars:21,consts:[["tabPanel",""],[1,"flex","h-full","flex-col"],["mat-tab-nav-bar","",3,"tabPanel"],["mat-tab-link","",3,"active","click",4,"ngFor","ngForOf"],[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.ɵɵtemplate(2,dn,2,2,"a",3),t.ɵɵelementEnd(),t.ɵɵelement(3,"mat-tab-nav-panel",null,0),t.ɵɵelementStart(5,"div",4)(6,"table",5),t.ɵɵelementContainerStart(7,6),t.ɵɵtemplate(8,un,3,3,"mat-header-cell",7)(9,mn,3,4,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(10,9),t.ɵɵtemplate(11,hn,3,3,"mat-header-cell",10)(12,gn,3,3,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,11),t.ɵɵtemplate(14,fn,3,3,"mat-header-cell",12)(15,yn,2,3,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(16,vn,1,0,"mat-header-row",14)(17,xn,1,0,"mat-row",15),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"span",16),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(21,"span",17),t.ɵɵelementEnd(),t.ɵɵelement(22,"mat-paginator",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵreference(4);t.ɵɵadvance(),t.ɵɵproperty("tabPanel",e),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.logLinks),t.ɵɵadvance(4),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(20,18,"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(20,cn))}},dependencies:t.ɵɵgetComponentDepsFactory(bn,[j,_]),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 Vr(e){e||(s(Vr),e=n(p));const t=new fe((t=>e.onDestroy(t.next.bind(t))));return e=>e.pipe(be(t))}e("OpcVersionProcessor",Dr);class Gr{constructor(){this.fb=n(ie),this.destroyRef=n(p),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(Vr(this.destroyRef)).subscribe((e=>this.onChange(this.mapOnChangeValue(e))))}static{this.ɵfac=function(e){return new(e||Gr)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Gr})}}e("ControlValueAccessorBaseAbstract",Gr);class Ar extends Gr{constructor(){super(...arguments),this.withReportStrategy=!0,this.initialized=new r,this.isLegacy=!1,this.fb=n(ie)}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(Ar)))(n||Ar)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:Ar,inputs:{generalTabContent:"generalTabContent",withReportStrategy:[2,"withReportStrategy","withReportStrategy",l]},outputs:{initialized:"initialized"},features:[t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature]})}}e("GatewayConnectorBasicConfigDirective",Ar);class jr extends Rr{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{socket:e?Wr.mapSocketToUpgradedVersion(e):{},devices:e?.devices?Wr.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:Wr.mapSocketToDowngradedVersion(this.connector.configurationJson),configVersion:this.gatewayVersionIn}}}e("SocketVersionProcessor",jr);class Lr extends Rr{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?Qr.mapApplicationToUpgradedVersion(e.general):{},devices:e?.devices?Qr.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{general:e?.application?Qr.mapApplicationToDowngradedVersion(e.application):{},devices:e?.devices?Qr.mapDevicesToDowngradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}}e("BacnetVersionProcessor",Lr);const Ur=["searchInput"];class $r{constructor(){this.withReportStrategy=!0,this.textSearchMode=!1,this.onChange=()=>{},this.translate=n(_e),this.dialog=n(le),this.dialogService=n(H),this.fb=n(ie),this.cd=n(c),this.destroyRef=n(p),this.textSearch=this.fb.control("",{nonNullable:!0}),this.entityFormArray=this.fb.array([]),this.entityFormArray.valueChanges.pipe(Vr()).subscribe((e=>{this.updateTableData(e),this.onChange(e)})),this.dataSource=this.getDatasource()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(ke(150),Me(((e,t)=>(e??"")===t.trim())),Vr(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||$r)}}static{this.ɵdir=t.ɵɵdefineDirective({type:$r,viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Ur,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:[2,"withReportStrategy","withReportStrategy",l]},features:[t.ɵɵInputTransformsFeature]})}}e("AbstractDevicesConfigTableComponent",$r);class zr{static getConfig(e,t){switch(e.type){case Je.MQTT:return new Nr(t,e).getProcessedByVersion();case Je.OPCUA:return new Dr(t,e).getProcessedByVersion();case Je.MODBUS:return new _r(t,e).getProcessedByVersion();case Je.SOCKET:return new jr(t,e).getProcessedByVersion();case Je.BACNET:return new Lr(t,e).getProcessedByVersion();default:return e}}static parseVersion(e){if(W(e))return e;if(Q(e)){const[t,n="0",a="0"]=e.split(".");return parseFloat(`${t}.${n}${a.slice(0,1)}`)}return 0}}e("GatewayConnectorVersionMappingUtil",zr);class Kr{static mapMasterToUpgradedVersion(e){return{slaves:e.slaves.map((e=>{const{sendDataOnlyOnChange:t,...n}=e;return{...n,deviceType:e.deviceType??"default",reportStrategy:t?{type:Dt.OnChange}:{type:Dt.OnReportPeriod,reportPeriod:e.pollPeriod}}}))}}static mapMasterToDowngradedVersion(e){return{slaves:e.slaves.map((e=>{const{reportStrategy:t,...n}=e;return{...n,sendDataOnlyOnChange:t?.type!==Dt.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?Ft.INT16:e.type})))}),{})}}e("ModbusVersionMappingUtil",Kr);class Hr{static mapServerToUpgradedVersion(e){const{mapping:t,disableSubscriptions:n,pollPeriodInMillis:a,...r}=e;return{...r,pollPeriodInMillis:a??5e3,enableSubscriptions:!n}}static mapServerToDowngradedVersion(e){const{mapping:t,server:n}=e,{enableSubscriptions:a,...r}=n??{};return{...r,mapping:t?this.mapMappingToDowngradedVersion(t):[],disableSubscriptions:!a}}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 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("${")?qa.IDENTIFIER:e.includes("/")||e.includes("\\")?qa.PATH:qa.CONST}static getDeviceNodeSourceByValue(e){return e.includes("${")?qa.IDENTIFIER:qa.PATH}static getArgumentType(e){switch(typeof e){case"boolean":return"boolean";case"number":return Number.isInteger(e)?"integer":"float";default:return"string"}}}e("OpcVersionMappingUtil",Hr);class Wr{static mapSocketToUpgradedVersion(e){const{devices:t,...n}=e??{};return 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("[")?Ia.Expression:Ia.Constant}}e("SocketVersionMappingUtil",Wr);class Qr{static mapApplicationToUpgradedVersion(e){const{address:t="",...n}=e,[a,r]=t.split(":"),[i,o]=a.split("/");return{host:i,port:r,mask:o,...n}}static mapApplicationToDowngradedVersion(e){const{host:t="",port:n="",mask:a="",...r}=e;return{address:a?`${t}/${a}:${n}`:`${t}:${n}`,...r}}static mapDevicesToUpgradedVersion(e){return e?.map((({address:e="",deviceName:t,deviceType:n,attributes:a,timeseries:r,attributeUpdates:i,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(a),timeseries:this.getUpdateKeys(r),attributeUpdates:this.getUpdateKeys(i),serverSideRpc:this.getUpdateKeys(o)})))??[]}static mapDevicesToDowngradedVersion(e){return e?.map((({port:e,host:t,deviceInfo:n,attributes:a,timeseries:r,attributeUpdates:i,serverSideRpc:o,...s})=>({...s,address:`${t}:${e}`,deviceName:n?.deviceNameExpression,deviceType:n?.deviceProfileExpression,attributes:this.getDowngradedKeys(a),timeseries:this.getDowngradedKeys(r),attributeUpdates:this.getDowngradedKeys(i),serverSideRpc:this.getDowngradedKeys(o)})))??[]}static getExpressionSource(e){return e.includes("${")||e.includes("[")?Ia.Expression:Ia.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",Qr);class Jr{transform(e,t){const n=zr.parseVersion(e);return t===Je.MODBUS?n>=zr.parseVersion(Qe.v3_5_2):n>=zr.parseVersion(Qe.v3_6_0)}static{this.ɵfac=function(e){return new(e||Jr)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"withReportStrategy",type:Jr,pure:!0,standalone:!0})}}e("ReportStrategyVersionPipe",Jr);const Yr=e=>({type:e});function Xr(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.bACnetRequestTypesTranslates.get(e))," ")}}function Zr(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.bACnetObjectTypesTranslates.get(e))," ")}}function ei(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",9),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",11),t.ɵɵtemplate(10,Xr,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",13),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-form-field",15)(18,"mat-label"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-select",16),t.ɵɵtemplate(22,Zr,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",17),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"mat-form-field",10)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,8,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,10,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetRequestTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,12,"gateway.rpc.requestTimeout")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,14,"gateway.rpc.objectType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetObjectTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,16,"gateway.rpc.identifier")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,18,"gateway.rpc.propertyId"))}}function ti(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.bLEMethodsTranslates.get(e))," ")}}function ni(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",21),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",10)(11,"mat-label"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-select",22),t.ɵɵtemplate(15,ti,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"mat-slide-toggle",23),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,7,"gateway.rpc.characteristicUUID")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bLEMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.rpc.withResponse")," ")}}function ai(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 ri(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",24),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",25),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",26),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-slide-toggle",27),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-slide-toggle",28),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",14)(20,"mat-form-field",15)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",15)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-select",30),t.ɵɵtemplate(30,ai,3,4,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",14)(32,"mat-form-field",15)(33,"mat-label"),t.ɵɵtext(34),t.ɵɵpipe(35,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(36,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",15)(38,"mat-label"),t.ɵɵtext(39),t.ɵɵpipe(40,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(41,"input",32),t.ɵɵelementEnd()(),t.ɵɵelementStart(42,"mat-form-field")(43,"mat-label"),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(46,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(47,"mat-form-field")(48,"mat-label"),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(51,"input",34),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,14,"gateway.rpc.nodeID")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,16,"gateway.rpc.isExtendedID")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,18,"gateway.rpc.isFD")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,20,"gateway.rpc.bitrateSwitch")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,22,"gateway.rpc.dataLength")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,24,"gateway.rpc.dataByteorder")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.cANByteOrders),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(35,26,"gateway.rpc.dataBefore")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(40,28,"gateway.rpc.dataAfter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(45,30,"gateway.rpc.dataInHEX")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(50,32,"gateway.rpc.dataExpression"))}}function ii(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),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 oi(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 si(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 pi(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SNMPMethodsTranslations.get(e))," ")}}function li(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",45)(1,"mat-form-field",46),t.ɵɵelement(2,"input",47),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-icon",48),t.ɵɵpipe(4,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,a=t.ɵɵnextContext(3);return t.ɵɵresetView(a.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 ci(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",39),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵtemplate(10,pi,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-slide-toggle",38),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"fieldset",41)(15,"span",42),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(18,li,6,4,"div",43),t.ɵɵelementStart(19,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addSNMPoid())})),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,7,"gateway.rpc.requestFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,9,"gateway.rpc.method")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sNMPMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,11,"gateway.rpc.withResponse")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(17,13,"gateway.rpc.oids"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",e.getFormArrayControls("oid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,15,"gateway.rpc.add-oid")," ")}}function di(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function mi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",65),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",64),t.ɵɵelement(5,"input",66),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-icon",67),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,a=t.ɵɵnextContext(4);return t.ɵɵresetView(a.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 ui(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,mi,9,4,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function gi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",49),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",14)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,di,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",14)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",54),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",55),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"fieldset",56)(39,"span",42),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(42,ui,11,7,"div",57),t.ɵɵelementStart(43,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,11,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,13,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,15,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,17,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,19,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,21,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,23,"gateway.rpc.valueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,25,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(45,27,"gateway.rpc.add-header")," ")}}function yi(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function hi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",73),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",64),t.ɵɵelement(6,"input",74),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-icon",67),t.ɵɵpipe(8,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,a=t.ɵɵnextContext(4);return t.ɵɵresetView(a.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 fi(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,hi,10,7,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function vi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",68),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",59)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,yi,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",59)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",69),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",70),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",71),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field")(39,"mat-label"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",72),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"fieldset",56)(44,"span",42),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(47,fi,11,7,"div",57),t.ɵɵelementStart(48,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,14,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,16,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,18,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,20,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,22,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,24,"gateway.rpc.requestValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,26,"gateway.rpc.responseValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(46,28,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(50,30,"gateway.rpc.add-header")," ")}}function bi(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 xi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",75),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",76),t.ɵɵelementStart(10,"mat-icon",77),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.openEditJSONDialog(n))})),t.ɵɵtext(12,"edit "),t.ɵɵelementEnd(),t.ɵɵtemplate(13,bi,3,3,"mat-error",78),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.ɵɵproperty("ngIf",e.commandForm.get("params").hasError("invalidJSON"))}}function wi(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,6),t.ɵɵtemplate(1,ei,33,20,"ng-template",7)(2,ni,19,13,"ng-template",7)(3,ri,52,34,"ng-template",7)(4,ii,10,6,"ng-template",7)(5,oi,13,9,"ng-template",7)(6,si,13,9,"ng-template",7)(7,ci,22,17,"ng-template",7)(8,gi,46,29,"ng-template",7)(9,vi,51,32,"ng-template",7)(10,xi,14,10,"ng-template",8),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.CAN),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.FTP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OCPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.XMPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SNMP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REQUEST)}}class Ci{constructor(e,t){this.fb=e,this.dialog=t,this.sendCommand=new r,this.saveTemplate=new r,this.ConnectorType=Je,this.bACnetRequestTypes=Object.values(yn),this.bACnetObjectTypes=Object.values(fn),this.bLEMethods=Object.values(bn),this.cANByteOrders=Object.values(wn),this.sNMPMethods=Object.values(En),this.hTTPMethods=Object.values(In),this.bACnetRequestTypesTranslates=hn,this.bACnetObjectTypesTranslates=vn,this.bLEMethodsTranslates=xn,this.SNMPMethodsTranslations=Tn,this.gatewayConnectorDefaultTypesTranslates=Ye,this.urlPattern=/^[-a-zA-Zd_$:{}?~+=\/.0-9-]*$/,this.numbersOnlyPattern=/^[0-9]*$/,this.hexOnlyPattern=/^[0-9A-Fa-f ]+$/,this.propagateChange=e=>{},this.destroy$=new me}ngOnInit(){this.commandForm=this.connectorParamsFormGroupByType(this.connectorType),this.observeFormChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}connectorParamsFormGroupByType(e){let t;switch(e){case Je.BACNET:t=this.fb.group({method:[null,[ne.required,ne.pattern($e)]],requestType:[null,[ne.required,ne.pattern($e)]],requestTimeout:[null,[ne.required,ne.min(10),ne.pattern(this.numbersOnlyPattern)]],objectType:[null,[]],identifier:[null,[ne.required,ne.min(1),ne.pattern(this.numbersOnlyPattern)]],propertyId:[null,[ne.required,ne.pattern($e)]]});break;case Je.BLE:t=this.fb.group({methodRPC:[null,[ne.required,ne.pattern($e)]],characteristicUUID:["00002A00-0000-1000-8000-00805F9B34FB",[ne.required,ne.pattern($e)]],methodProcessing:[null,[ne.required]],withResponse:[!1,[]]});break;case Je.CAN:t=this.fb.group({method:[null,[ne.required,ne.pattern($e)]],nodeID:[null,[ne.required,ne.min(0),ne.pattern(this.numbersOnlyPattern)]],isExtendedID:[!1,[]],isFD:[!1,[]],bitrateSwitch:[!1,[]],dataLength:[null,[ne.min(1),ne.pattern(this.numbersOnlyPattern)]],dataByteorder:[null,[]],dataBefore:[null,[ne.pattern($e),ne.pattern(this.hexOnlyPattern)]],dataAfter:[null,[ne.pattern($e),ne.pattern(this.hexOnlyPattern)]],dataInHEX:[null,[ne.pattern($e),ne.pattern(this.hexOnlyPattern)]],dataExpression:[null,[ne.pattern($e)]]});break;case Je.FTP:t=this.fb.group({methodFilter:[null,[ne.required,ne.pattern($e)]],valueExpression:[null,[ne.required,ne.pattern($e)]]});break;case Je.OCPP:case Je.XMPP:t=this.fb.group({methodRPC:[null,[ne.required,ne.pattern($e)]],valueExpression:[null,[ne.required,ne.pattern($e)]],withResponse:[!1,[]]});break;case Je.SNMP:t=this.fb.group({requestFilter:[null,[ne.required,ne.pattern($e)]],method:[null,[ne.required]],withResponse:[!1,[]],oid:this.fb.array([],[ne.required])});break;case Je.REST:t=this.fb.group({methodFilter:[null,[ne.required,ne.pattern($e)]],httpMethod:[null,[ne.required]],requestUrlExpression:[null,[ne.required,ne.pattern(this.urlPattern)]],responseTimeout:[null,[ne.required,ne.min(10),ne.pattern(this.numbersOnlyPattern)]],timeout:[null,[ne.required,ne.min(10),ne.pattern(this.numbersOnlyPattern)]],tries:[null,[ne.required,ne.min(1),ne.pattern(this.numbersOnlyPattern)]],valueExpression:[null,[ne.required,ne.pattern($e)]],httpHeaders:this.fb.array([]),security:[{},[ne.required]]});break;case Je.REQUEST:t=this.fb.group({methodFilter:[null,[ne.required,ne.pattern($e)]],httpMethod:[null,[ne.required]],requestUrlExpression:[null,[ne.required,ne.pattern(this.urlPattern)]],responseTimeout:[null,[ne.required,ne.min(10),ne.pattern(this.numbersOnlyPattern)]],timeout:[null,[ne.required,ne.min(10),ne.pattern(this.numbersOnlyPattern)]],tries:[null,[ne.required,ne.min(1),ne.pattern(this.numbersOnlyPattern)]],requestValueExpression:[null,[ne.required,ne.pattern($e)]],responseValueExpression:[null,[ne.pattern($e)]],httpHeaders:this.fb.array([])});break;default:t=this.fb.group({command:[null,[ne.required,ne.pattern($e)]],params:[{},[He]]})}return t}addSNMPoid(e=null){const t=this.commandForm.get("oid");t&&t.push(this.fb.control(e,[ne.required,ne.pattern($e)]),{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,[ne.required,ne.pattern($e)]],value:[e.value,[ne.required,ne.pattern($e)]]});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(Ge,{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=G(e),this.connectorType){case Je.SNMP:this.clearFromArrayByName("oid"),e.oid.forEach((e=>{this.addSNMPoid(e)})),delete e.oid;break;case Je.REQUEST:case Je.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(be(this.destroy$)).subscribe((e=>{this.connectorType!==Je.REST&&this.connectorType!==Je.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||Ci)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(pe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Ci,selectors:[["tb-gateway-service-rpc-connector"]],inputs:{connectorType:"connectorType"},outputs:{sendCommand:"sendCommand",saveTemplate:"saveTemplate"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Ci)),multi:!0}]),t.ɵɵStandaloneFeature],decls:12,vars:16,consts:[[1,"command-form","flex","flex-col",3,"formGroup"],[1,"mat-subtitle-1","title"],[3,"ngIf"],[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"],[3,"ngSwitch"],[3,"ngSwitchCase"],["ngSwitchDefault",""],["matInput","","formControlName","method","placeholder","set_state"],[1,"mat-block"],["formControlName","requestType"],[3,"value",4,"ngFor","ngForOf"],["matInput","","formControlName","requestTimeout","type","number","min","10","step","1","placeholder","1000"],[1,"flex","flex-1","flex-row","gap-2.5"],[1,"flex-1"],["formControlName","objectType"],["matInput","","formControlName","identifier","type","number","min","1","step","1","placeholder","1"],["matInput","","formControlName","propertyId","placeholder","presentValue"],[3,"value"],["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"],["class","flex flex-1 flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","flex-row","items-center","justify-center","gap-2.5"],["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"],[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"],["class","flex flex-col gap-2.5 border",4,"ngIf"],[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"],["class","flex flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],[3,"formGroupName"],["appearance","outline",1,"flex-1"],["matInput","","formControlName","headerName"],["matInput","","formControlName","value","placeholder","application/json"],[2,"cursor","pointer","width","30px",3,"click","matTooltip"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","1"],["matInput","","formControlName","requestValueExpression","placeholder","${params}"],["matInput","","formControlName","responseValueExpression","placeholder","${temp}"],["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"],[4,"ngIf"]],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,wi,11,10,"ng-template",2),t.ɵɵelementStart(5,"div",3)(6,"button",4),t.ɵɵlistener("click",(function(){return n.save()})),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",5),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,Yr,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorType),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(Ci,[V,b]),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 Si(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function Ei(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,a.ModbusFunctionCodeTranslationsMap.get(e)))}}function Ti(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function Ii(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function ki(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"mat-form-field",3)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",14),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Ii,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.ɵɵproperty("ngIf",e.rpcParametersFormGroup.get("value").hasError("required")&&e.rpcParametersFormGroup.get("value").touched)}}class Mi{constructor(e){this.fb=e,this.ModbusEditableDataTypes=Ot,this.ModbusFunctionCodeTranslationsMap=Nt,this.modbusDataTypes=Object.values(Ft),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 me,this.rpcParametersFormGroup=this.fb.group({type:[Ft.BYTES,[ne.required]],functionCode:[this.defaultFunctionCodes[0],[ne.required]],value:[{value:"",disabled:!0},[ne.required,ne.pattern($e)]],address:[null,[ne.required]],objectsCount:[1,[ne.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(be(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeKeyDataType(){this.rpcParametersFormGroup.get("type").valueChanges.pipe(be(this.destroy$)).subscribe((e=>{this.ModbusEditableDataTypes.includes(e)||this.rpcParametersFormGroup.get("objectsCount").patchValue(qt[e],{emitEvent:!1}),this.updateFunctionCodes(e)}))}observeFunctionCode(){this.rpcParametersFormGroup.get("functionCode").valueChanges.pipe(be(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===Ft.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||Mi)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Mi,selectors:[["tb-gateway-modbus-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Mi)),multi:!0},{provide:re,useExisting:i((()=>Mi)),multi:!0}]),t.ɵɵStandaloneFeature],decls:35,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"],[1,"flex-1"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["formControlName","functionCode"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],["class","flex",4,"ngIf"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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.ɵɵtemplate(13,Si,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-form-field",3)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-select",6),t.ɵɵtemplate(19,Ei,3,4,"mat-option",5),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",2)(21,"mat-form-field",3)(22,"mat-label"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",7),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,Ti,3,3,"mat-icon",8),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",3)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",9),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,ki,8,7,"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.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(17,20,"gateway.rpc.functionCode")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.functionCodes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,22,"gateway.rpc.address")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.rpcParametersFormGroup.get("address").hasError("required")&&n.rpcParametersFormGroup.get("address").touched),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,26,"gateway.rpc.objectsCount")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,28,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(n.rpcParametersFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.writeFunctionCodes.includes(n.rpcParametersFormGroup.get("functionCode").value)))},dependencies:t.ɵɵgetComponentDepsFactory(Mi,[V,b]),styles:['@charset "UTF-8";[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:o.OnPush})}}function Pi(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 Fi(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 Oi{constructor(e){this.fb=e,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new me,this.rpcParametersFormGroup=this.fb.group({methodFilter:[null,[ne.required,ne.pattern($e)]],requestTopicExpression:[null,[ne.required,ne.pattern($e)]],responseTopicExpression:[{value:null,disabled:!0},[ne.required,ne.pattern($e)]],responseTimeout:[{value:null,disabled:!0},[ne.min(10),ne.pattern(ze)]],valueExpression:[null,[ne.required,ne.pattern($e)]],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(be(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeWithResponse(){this.rpcParametersFormGroup.get("withResponse").valueChanges.pipe(we((e=>this.toggleResponseFields(e))),be(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||Oi)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Oi,selectors:[["tb-gateway-mqtt-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Oi)),multi:!0},{provide:re,useExisting:i((()=>Oi)),multi:!0}]),t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","requestTopicExpression","placeholder","sensor/${deviceName}/request/${methodName}/${requestId}"],["formControlName","withResponse",1,"margin",3,"click"],[4,"ngIf"],["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")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",1),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-slide-toggle",3),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,Pi,5,3,"mat-form-field",4)(15,Fi,5,3,"mat-form-field",4),t.ɵɵelementStart(16,"mat-form-field")(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,a;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.ɵɵproperty("ngIf",null==(e=n.rpcParametersFormGroup.get("withResponse"))?null:e.value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",null==(a=n.rpcParametersFormGroup.get("withResponse"))?null:a.value),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(19,13,"gateway.rpc.valueExpression"))}},dependencies:t.ɵɵgetComponentDepsFactory(Oi,[V,b]),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 qi(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",26),t.ɵɵelement(1,"mat-icon",27),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("svgIcon",a.valueTypes.get(e).icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,a.valueTypes.get(e).name))}}function Bi(e,n){1&e&&(t.ɵɵelement(0,"input",28),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function Ri(e,n){1&e&&(t.ɵɵelement(0,"input",29),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function Ni(e,n){1&e&&(t.ɵɵelement(0,"input",30),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function _i(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",31)(1,"mat-option",26),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",26),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function Di(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",32),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function Vi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"div",9)(2,"div",10),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12)(6,"mat-select",13)(7,"mat-select-trigger")(8,"div",14),t.ɵɵelement(9,"mat-icon",15),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(13,qi,5,5,"mat-option",16),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",17)(15,"div",10),t.ɵɵtext(16,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-form-field",18),t.ɵɵelementContainerStart(18,19),t.ɵɵtemplate(19,Bi,2,3,"input",20)(20,Ri,2,3,"input",21)(21,Ni,2,3,"input",22)(22,_i,5,2,"mat-select",23),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(23,Di,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",25),t.ɵɵpipe(25,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,a=t.ɵɵnextContext();return t.ɵɵresetView(a.removeArgument(n))})),t.ɵɵelementStart(26,"mat-icon"),t.ɵɵtext(27,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e,a;const r=n.$implicit,i=t.ɵɵnextContext();t.ɵɵproperty("formGroup",r),t.ɵɵadvance(9),t.ɵɵproperty("svgIcon",null==(e=i.valueTypes.get(r.get("type").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,11,null==(a=i.valueTypes.get(r.get("type").value))?null:a.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",i.valueTypeKeys),t.ɵɵadvance(5),t.ɵɵproperty("ngSwitch",r.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",i.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",i.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",i.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",i.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",r.get(r.get("type").value+"Value").hasError("required")&&r.get(r.get("type").value+"Value").touched),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(25,13,"gateway.rpc.remove"))}}class Gi{constructor(e,t){this.fb=e,this.cdr=t,this.valueTypeKeys=Object.values(Bt),this.MappingValueType=Bt,this.valueTypes=Rt,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new me,this.rpcParametersFormGroup=this.fb.group({method:[null,[ne.required,ne.pattern($e)]],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(be(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??Bt.STRING],stringValue:[e.stringValue??{value:"",disabled:!(U(e,{})||e.stringValue)},[ne.required,ne.pattern($e)]],integerValue:[{value:e.integerValue??0,disabled:!j(e.integerValue)},[ne.required,ne.pattern(ze)]],doubleValue:[{value:e.doubleValue??0,disabled:!j(e.doubleValue)},[ne.required]],booleanValue:[{value:e.booleanValue??!1,disabled:!j(e.booleanValue)},[ne.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(be(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||Gi)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Gi,selectors:[["tb-gateway-opc-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Gi)),multi:!0},{provide:re,useExisting:i((()=>Gi)),multi:!0}]),t.ɵɵStandaloneFeature],decls:18,vars:14,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","tb-flex","no-padding-top","hint-container"],[1,"tb-flex"],["matInput","","formControlName","method","placeholder","multiply"],["formArrayName","arguments",1,"tb-form-panel","stroked","arguments-container"],[1,"fields-label"],["class","flex flex-1 items-center justify-center gap-2.5",3,"formGroup",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","items-center","justify-center","gap-2.5",3,"formGroup"],[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",4,"ngFor","ngForOf"],[1,"tb-form-row","column-xs","value-container","item-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","matTooltip"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["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"]],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.ɵɵtemplate(14,Vi,28,15,"div",6),t.ɵɵelementStart(15,"button",7),t.ɵɵlistener("click",(function(){return n.addArgument()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,6,"gateway.rpc.hint.opc-method")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,8,"gateway.rpc.method")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,10,"gateway.rpc.arguments")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcParametersFormGroup.get("arguments").controls),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,12,"gateway.rpc.add-argument")," "))},dependencies:t.ɵɵgetComponentDepsFactory(Gi,[V,b]),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 Ai(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,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SocketMethodProcessingsTranslates.get(e))," ")}}function ji(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.toUpperCase()," ")}}class Li extends Gr{constructor(){super(...arguments),this.SocketMethodProcessingsTranslates=Sn,this.socketMethodProcessings=Object.values(Cn),this.socketEncoding=Object.values(Xe)}initFormGroup(){return this.fb.group({methodRPC:[null,[ne.required,ne.pattern($e)]],methodProcessing:[Cn.WRITE,[ne.required]],encoding:[kn.UTF_8,[ne.required,ne.pattern($e)]],withResponse:[!1,[]]})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(Li)))(n||Li)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:Li,selectors:[["tb-gateway-socket-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Li)),multi:!0},{provide:re,useExisting:i((()=>Li)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],[1,"w-full"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],[1,"mat-block"],["formControlName","methodProcessing"],[3,"value",4,"ngFor","ngForOf"],["formControlName","encoding"],["formControlName","withResponse",1,"mat-slide","margin"],[3,"value"]],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.ɵɵtemplate(11,Ai,3,4,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",3)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-select",6),t.ɵɵtemplate(17,ji,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"mat-slide-toggle",7),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketMethodProcessings),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,11,"gateway.encoding")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(20,13,"gateway.rpc.withResponse")," "))},dependencies:t.ɵɵgetComponentDepsFactory(Li,[V,b]),encapsulation:2,changeDetection:o.OnPush})}}const Ui=e=>({border:e}),$i=e=>({type:e});function zi(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",15),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function Ki(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 Hi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",9),t.ɵɵtemplate(6,zi,2,2,"mat-option",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",11)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",12),t.ɵɵtemplate(12,Ki,3,3,"mat-error",13),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",14),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(),t.ɵɵelementContainerEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.RPCCommands),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,8,"gateway.statistics.timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.commandForm.get("time").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("disabled",e.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,10,"gateway.rpc-command-send")," ")}}function Wi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector",17),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 Qi(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-modbus-rpc-parameters",24)}function Ji(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-mqtt-rpc-parameters",24)}function Yi(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-opc-rpc-parameters",24)}function Xi(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-socket-rpc-parameters",24)}function Zi(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",18)(1,"div",19),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(4,20),t.ɵɵtemplate(5,Qi,1,0,"tb-gateway-modbus-rpc-parameters",21)(6,Ji,1,0,"tb-gateway-mqtt-rpc-parameters",21)(7,Yi,1,0,"tb-gateway-opc-rpc-parameters",21)(8,Xi,1,0,"tb-gateway-socket-rpc-parameters",21),t.ɵɵelementContainerEnd(),t.ɵɵelementStart(9,"div",22)(10,"button",23),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",14),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){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,10,"gateway.rpc.title",t.ɵɵpureFunction1(17,$i,e.gatewayConnectorDefaultTypesTranslates.get(e.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,13,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,15,"gateway.rpc-command-send")," ")}}function eo(e,n){if(1&e&&t.ɵɵtemplate(0,Wi,1,1,"tb-gateway-service-rpc-connector",16)(1,Zi,16,19,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2),n=t.ɵɵnextContext();t.ɵɵproperty("ngIf",!n.typesWithUpdatedParams.has(n.connectorType))("ngIfElse",e)}}function to(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",25)(1,"mat-icon",26),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 no(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector-templates",27),t.ɵɵlistener("useTemplate",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext();return t.ɵɵresetView(a.useTemplate(n))})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("rpcTemplates",e.templates)("ctx",e.ctx)("connectorType",e.connectorType)}}class ao{constructor(e,t,n,a,r){this.fb=e,this.dialog=t,this.utils=n,this.cd=a,this.attributeService=r,this.contentTypes=B,this.RPCCommands=["Ping","Stats","Devices","Update","Version","Restart","Reboot"],this.templates=[],this.ConnectorType=Je,this.gatewayConnectorDefaultTypesTranslates=Ye,this.typesWithUpdatedParams=new Set([Je.MQTT,Je.OPCUA,Je.MODBUS,Je.SOCKET]),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,[ne.required]],time:[60,[ne.required,ne.min(1)]],params:["{}",[He]],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:S.entity,entityType:E.DEVICE,entityId:this.ctx.defaultSubscription.targetDeviceId,entityName:"Connector",attributes:[{name:`${this.connectorType}_template`}]}];this.ctx.subscriptionApi.createSubscriptionFromInfo(T.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_",a=this.isConnector?this.getCommandFromParamsByType(t.params):t.command.toLowerCase(),r=this.ctx.stateController.getStateParams().connector_rpc?.value.configurationJson.id,i=r?{...t.params,connectorId:r}:t.params;this.ctx.controlApi.sendTwoWayCommand(n+a,i,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 Je.MQTT:case Je.FTP:case Je.SNMP:case Je.REST:case Je.REQUEST:return e.methodFilter;case Je.MODBUS:return e.tag;case Je.BACNET:case Je.CAN:case Je.OPCUA:return e.method;case Je.BLE:case Je.OCPP:case Je.SOCKET:case Je.XMPP:return e.methodRPC;default:return e.command}}saveTemplate(){this.dialog.open(Jn,{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},n=this.templates,a=n.findIndex((e=>e.name==t.name));a>-1&&n.splice(a,1),n.push(t);const r=`${this.connectorType}_template`;this.attributeService.saveEntityAttributes({id:this.ctx.defaultSubscription.targetDeviceId,entityType:E.DEVICE},C.SERVER_SCOPE,[{key:r,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||ao)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(pe.MatDialog),t.ɵɵdirectiveInject(A.UtilsService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(A.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ao,selectors:[["tb-gateway-service-rpc"]],inputs:{ctx:"ctx",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:12,vars:14,consts:[["connectorForm",""],["updatedParameters",""],[1,"flex","flex-1","flex-col"],[1,"command-form","flex","flex-row","gap-2.5","lt-sm:flex-col",3,"formGroup"],[4,"ngIf","ngIfElse"],[1,"result-block",3,"formGroup"],["class","result-time flex flex-1 flex-row items-center justify-center",4,"ngIf"],["readonly","true","formControlName","result",3,"contentType"],["class","border",3,"rpcTemplates","ctx","connectorType","useTemplate",4,"ngIf"],["formControlName","command"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","formControlName","time","type","number","min","1"],[4,"ngIf"],["mat-raised-button","","color","primary",3,"click","disabled"],[3,"value"],["formControlName","params",3,"connectorType","sendCommand","saveTemplate",4,"ngIf","ngIfElse"],["formControlName","params",3,"sendCommand","saveTemplate","connectorType"],[1,"rpc-parameters","flex","flex-col"],[1,"mat-subtitle-1","tb-form-panel-title"],[3,"ngSwitch"],["formControlName","params",4,"ngSwitchCase"],[1,"fex-row","template-actions","flex","flex-1","items-center","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],["formControlName","params"],[1,"result-time","flex","flex-1","flex-row","items-center","justify-center"],[1,"material-icons"],[1,"border",3,"useTemplate","rpcTemplates","ctx","connectorType"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",2)(1,"div",3),t.ɵɵtemplate(2,Hi,16,12,"ng-container",4)(3,eo,3,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"section",5)(6,"span"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,to,6,4,"div",6),t.ɵɵelementEnd(),t.ɵɵelement(10,"tb-json-content",7),t.ɵɵelementEnd()(),t.ɵɵtemplate(11,no,1,3,"tb-gateway-service-rpc-connector-templates",8)),2&e){const e=t.ɵɵreference(4);t.ɵɵclassMap(t.ɵɵpureFunction1(12,Ui,n.isConnector)),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.isConnector)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(8,10,"gateway.rpc-command-result")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.resultTime),t.ɵɵadvance(),t.ɵɵproperty("contentType",n.contentTypes.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isConnector)}},dependencies:t.ɵɵgetComponentDepsFactory(ao,[V,b,Ci,Mi,Oi,Gi,Hn,Li]),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 ro(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",ao);class io extends I{constructor(e,t,n,a,r){super(e,t,a),this.store=e,this.router=t,this.data=n,this.dialogRef=a,this.fb=r,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||io)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef),t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:io,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["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,ro,3,3,"mat-error",9),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",10)(18,"button",11),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",12),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.ɵɵproperty("ngIf",n.gatewayControl.hasError("required")),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(io,[V,b]),encapsulation:2})}}var oo;e("GatewayRemoteConfigurationDialogComponent",io),function(e){e.tls="tls",e.accessToken="accessToken"}(oo||(oo={}));const so="configuration_drafts",po="RemoteLoggingLevel",lo=new Map([[oo.tls,"gateway.security-types.tls"],[oo.accessToken,"gateway.security-types.access-token"]]);var co,mo;!function(e){e.none="NONE",e.critical="CRITICAL",e.error="ERROR",e.warning="WARNING",e.info="INFO",e.debug="DEBUG"}(co||(co={})),function(e){e.memory="memory",e.file="file"}(mo||(mo={}));const uo=new Map([[mo.memory,"gateway.storage-types.memory-storage"],[mo.file,"gateway.storage-types.file-storage"]]);var go;!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"}(go||(go={}));const yo={config:{},name:"",configType:null,enabled:!1};function ho(e){return JSON.stringify(e.value)===JSON.stringify({})?{validJSON:!0}:null}function fo(e){return e.replace("_","").replace("-","").replace(/^\s+|\s+/g,"").toLowerCase()+".json"}function vo(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 bo(e){return{id:e,entityType:E.DEVICE}}function xo(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,oo.accessToken)?(t.securityType=oo.accessToken,t.accessToken=e.thingsboard.security.accessToken):(t.securityType=oo.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===mo.memory?(t.storageType=mo.memory,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count):e.storage.type===mo.file&&(t.storageType=mo.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 wo(e){const t={};for(const n of e)n.enabled||(t[n.name]={connector:n.configType,config:n.config});return t}function Co(e){const t={thingsboard:So(e)};return function(e,t){for(const n of t)if(n.enabled){const t=n.configType;Array.isArray(e[t])||(e[t]=[]);const a={name:n.name,config:n.config};e[t].push(a)}}(t,e.connectors),t}function So(e){let t;t=e.securityType===oo.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 a;a=e.storageType===mo.memory?{type:mo.memory,read_records_count:e.readRecordsCount,max_records_count:e.maxRecordsCount}:{type:mo.file,data_folder_path:e.dataFolderPath,max_file_count:e.maxFilesCount,max_read_records_count:e.readRecordsCount,max_records_per_file:e.maxRecordsCount};const r=[];for(const t of e.connectors)if(t.enabled){const e={configuration:fo(t.name),name:t.name,type:t.configType};r.push(e)}return{thingsboard:n,connectors:r,storage:a,logs:window.btoa(vo(e.remoteLoggingLevel,e.remoteLoggingPathToLogs))}}const Eo=["formContainer"],To=(e,t,n)=>({"gap-1.25":e,"flex-row":t,"flex-col":n}),Io=(e,t,n)=>({"gap-1.25":e,"flex-row justify-end item-center":t,"flex-col justify-evenly item-center":n});function ko(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 Mo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-host-required "),t.ɵɵelementEnd())}function Po(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-required "),t.ɵɵelementEnd())}function Fo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-min "),t.ɵɵelementEnd())}function Oo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-max "),t.ɵɵelementEnd())}function qo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-pattern "),t.ɵɵelementEnd())}function Bo(e,n){1&e&&(t.ɵɵelementStart(0,"div",16)(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",30),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",32),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 Ro(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function No(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.path-logs-required "),t.ɵɵelementEnd())}function _o(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 Do(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-required "),t.ɵɵelementEnd())}function Vo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-min "),t.ɵɵelementEnd())}function Go(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-pattern "),t.ɵɵelementEnd())}function Ao(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-required "),t.ɵɵelementEnd())}function jo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-min "),t.ɵɵelementEnd())}function Lo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-pattern "),t.ɵɵelementEnd())}function Uo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-required "),t.ɵɵelementEnd())}function $o(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-min "),t.ɵɵelementEnd())}function zo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-pattern "),t.ɵɵelementEnd())}function Ko(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-path-required "),t.ɵɵelementEnd())}function Ho(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"mat-form-field",8)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",33),t.ɵɵtemplate(6,Uo,2,0,"mat-error",10)(7,$o,2,0,"mat-error",10)(8,zo,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",8)(10,"mat-label"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",34),t.ɵɵtemplate(14,Ko,2,0,"mat-error",10),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction3(12,To,e.layoutGap,e.alignment,!e.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.storage-max-files")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,10,"gateway.storage-path")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("dataFolderPath").hasError("required"))}}function Wo(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function Qo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.connector-type-required "),t.ɵɵelementEnd())}function Jo(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.connector-name-required "),t.ɵɵelementEnd())}function Yo(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",35)(1,"div",36)(2,"div",37),t.ɵɵelement(3,"mat-slide-toggle",38),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",39)(5,"mat-form-field",8)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵlistener("selectionChange",(function(){const n=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.changeConnectorType(n))})),t.ɵɵtemplate(10,Wo,2,2,"mat-option",7),t.ɵɵelementEnd(),t.ɵɵtemplate(11,Qo,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",8)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"input",41),t.ɵɵlistener("blur",(function(){const n=t.ɵɵrestoreView(e),a=n.$implicit,r=n.index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.changeConnectorName(a,r))})),t.ɵɵelementEnd(),t.ɵɵtemplate(17,Jo,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",42)(19,"button",43),t.ɵɵpipe(20,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e),r=a.$implicit,i=a.index,o=t.ɵɵnextContext();return t.ɵɵresetView(o.openConfigDialog(n,i,r.get("config").value,r.get("name").value))})),t.ɵɵelementStart(21,"mat-icon"),t.ɵɵtext(22,"more_horiz"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",43),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,a=t.ɵɵnextContext();return t.ɵɵresetView(a.removeConnector(n))})),t.ɵɵelementStart(25,"mat-icon"),t.ɵɵtext(26,"close"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,a=n.index,r=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("formGroupName",a),t.ɵɵadvance(3),t.ɵɵclassMap(t.ɵɵpureFunction3(24,To,r.layoutGap,r.alignment,!r.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,16,"gateway.connector-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",r.connectorTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("configType").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,18,"gateway.connector-name")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.get("name").hasError("required")),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction3(28,Io,r.layoutGap,r.alignment,!r.alignment)),t.ɵɵadvance(),t.ɵɵclassProp("mat-warn",e.get("config").invalid),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,20,"gateway.update-config")),t.ɵɵproperty("disabled",r.isReadOnlyForm),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,22,"gateway.delete")),t.ɵɵproperty("disabled",r.isReadOnlyForm)}}function Xo(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",44),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 Zo(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",45),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 es extends R{constructor(e,t,n,a,r,i,o,s,p,l,c){super(e),this.store=e,this.elementRef=t,this.utils=n,this.ngZone=a,this.fb=r,this.window=i,this.dialog=o,this.translate=s,this.deviceService=p,this.attributeService=l,this.importExport=c,this.alignment=!0,this.layoutGap=!0,this.securityTypes=lo,this.gatewayLogLevels=Object.keys(co).map((e=>co[e])),this.connectorTypes=Object.keys(go),this.storageTypes=uo,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 a=this.gatewayConfigurationGroup.get("gateway").value,r={key:e,value:t};return this.attributeService.saveEntityAttributes(bo(a),n,[r])}createConnector(e=yo){this.connectors.push(this.fb.group({enabled:[e.enabled],configType:[e.configType,[ne.required]],name:[e.name,[ne.required]],config:[e.config,[ne.nullValidator,ho]]}))}getFormField(e){return this.gatewayConfigurationGroup.get(e)}buildForm(){this.gatewayConfigurationGroup=this.fb.group({gateway:[null,[]],accessToken:[null,[ne.required]],securityType:[oo.accessToken],host:[this.window.location.hostname,[ne.required]],port:[1883,[ne.required,ne.min(1),ne.max(65535),ne.pattern(/^-?[0-9]+$/)]],remoteConfiguration:[!0],caCertPath:["/etc/thingsboard-gateway/ca.pem"],privateKeyPath:["/etc/thingsboard-gateway/privateKey.pem"],certPath:["/etc/thingsboard-gateway/certificate.pem"],remoteLoggingLevel:[co.debug],remoteLoggingPathToLogs:["./logs/",[ne.required]],storageType:[mo.memory],readRecordsCount:[100,[ne.required,ne.min(1),ne.pattern(/^-?[0-9]+$/)]],maxRecordsCount:[1e4,[ne.required,ne.min(1),ne.pattern(/^-?[0-9]+$/)]],maxFilesCount:[5,[ne.required,ne.min(1),ne.pattern(/^-?[0-9]+$/)]],dataFolderPath:["./data/",[ne.required]],connectors:this.fb.array([])}),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1}),this.subscribeStorageType$=this.getFormField("storageType").valueChanges.subscribe((e=>{e===mo.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?ve([this.deviceService.getDeviceCredentials(e).pipe(we((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,a,r;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===oo.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===mo.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: "+fo(n.name)+"\n");return t}(e),function(e,t){for(const n of t)n.enabled&&(e[fo(n.name)]=JSON.stringify(n.config))}(t,e.connectors),n=t,a=e.remoteLoggingLevel,r=e.remoteLoggingPathToLogs,n["logs.conf"]=vo(a,r),this.importExport.exportJSZip(t,this.archiveFileName),this.saveAttribute(po,this.gatewayConfigurationGroup.value.remoteLoggingLevel.toUpperCase(),C.SHARED_SCOPE)}addNewConnector(){this.createConnector()}removeConnector(e){e>-1&&(this.connectors.removeAt(e),this.connectors.markAsDirty())}openConfigDialog(e,t,n,a){e&&(e.stopPropagation(),e.preventDefault()),this.dialog.open(Ge,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{jsonValue:n,required:!0,title:this.translate.instant("gateway.title-connectors-json",{typeName:a})}}).afterClosed().subscribe((e=>{e&&(this.connectors.at(t).get("config").patchValue(e),this.ctx.detectChanges())}))}createConnectorName(e,t,n=0){const a=n?t+n:t;return-1===e.findIndex((e=>e.name===a))?a:this.createConnectorName(e,t,++n)}validateConnectorName(e,t,n,a=0){for(let r=0;r{this.ctx.showSuccessToast(this.successfulSaved,2e3,"top","left",this.toastTargetId),this.gatewayConfigurationGroup.markAsPristine()}))}getAttributes(e){const t=[];return t.push(ve([this.getAttribute("current_configuration",C.CLIENT_SCOPE,e),this.getAttribute(so,C.SERVER_SCOPE,e)]).pipe(we((([e,t])=>{this.setFormGatewaySettings(e),this.setFormConnectorsDraft(t),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1})})))),t.push(this.getAttribute(po,C.SHARED_SCOPE,e).pipe(we((e=>this.processLoggingLevel(e))))),t}getAttribute(e,t,n){return this.attributeService.getEntityAttributes(bo(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(xo(n));else for(const t of Object.keys(n)){let a="No name";Object.prototype.hasOwnProperty.call(n[t],"name")&&(a=n[t].name);const r={enabled:!0,configType:e,config:n[t].config,name:a};this.createConnector(r)}}}}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=co.debug;e.length>0&&co[e[0].value.toLowerCase()]&&(t=co[e[0].value.toLowerCase()]),this.getFormField("remoteLoggingLevel").patchValue(t)}static{this.ɵfac=function(e){return new(e||es)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(t.ElementRef),t.ɵɵdirectiveInject(A.UtilsService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(te.UntypedFormBuilder),t.ɵɵdirectiveInject(z),t.ɵɵdirectiveInject(pe.MatDialog),t.ɵɵdirectiveInject(Ne.TranslateService),t.ɵɵdirectiveInject(A.DeviceService),t.ɵɵdirectiveInject(A.AttributeService),t.ɵɵdirectiveInject(Ae.ImportExportService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:es,selectors:[["tb-gateway-form"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Eo,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:104,vars:104,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"],[1,"flex"],["formControlName","securityType"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","type","text","formControlName","host"],["translate","",4,"ngIf"],["matInput","","type","number","formControlName","port"],["class","flex flex-col",4,"ngIf"],["formControlName","remoteConfiguration"],["formControlName","remoteLoggingLevel"],["matInput","","type","text","formControlName","remoteLoggingPathToLogs"],[1,"flex","flex-col"],["formControlName","storageType"],["matInput","","type","number","formControlName","readRecordsCount"],["matInput","","type","number","formControlName","maxRecordsCount"],["class","flex",3,"class",4,"ngIf"],[1,"gateway-config","flex","flex-col"],["formArrayName","connectors",4,"ngFor","ngForOf"],[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","click",4,"ngIf"],["mat-raised-button","","color","primary","type","submit",3,"disabled","matTooltip",4,"ngIf"],[3,"value"],["translate",""],["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"],["formArrayName","connectors"],[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"],["mat-raised-button","","color","primary","type","submit",3,"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.ɵɵtemplate(16,ko,3,4,"mat-option",7),t.ɵɵpipe(17,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",5)(19,"mat-form-field",8)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",9),t.ɵɵtemplate(24,Mo,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",8)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(29,"input",11),t.ɵɵtemplate(30,Po,2,0,"mat-error",10)(31,Fo,2,0,"mat-error",10)(32,Oo,2,0,"mat-error",10)(33,qo,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,Bo,16,9,"div",12),t.ɵɵelementStart(35,"mat-checkbox",13),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"div",5)(39,"mat-form-field",8)(40,"mat-label"),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-select",14),t.ɵɵtemplate(44,Ro,2,2,"mat-option",7),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"mat-form-field",8)(46,"mat-label"),t.ɵɵtext(47),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",15),t.ɵɵtemplate(50,No,2,0,"mat-error",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(51,"mat-expansion-panel")(52,"mat-expansion-panel-header")(53,"mat-panel-title")(54,"div",3),t.ɵɵtext(55),t.ɵɵpipe(56,"translate"),t.ɵɵpipe(57,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(58,"div",16)(59,"mat-form-field")(60,"mat-label"),t.ɵɵtext(61),t.ɵɵpipe(62,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"mat-select",17),t.ɵɵtemplate(64,_o,3,4,"mat-option",7),t.ɵɵpipe(65,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(66,"div",5)(67,"mat-form-field",8)(68,"mat-label"),t.ɵɵtext(69),t.ɵɵpipe(70,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(71,"input",18),t.ɵɵtemplate(72,Do,2,0,"mat-error",10)(73,Vo,2,0,"mat-error",10)(74,Go,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(75,"mat-form-field",8)(76,"mat-label"),t.ɵɵtext(77),t.ɵɵpipe(78,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(79,"input",19),t.ɵɵtemplate(80,Ao,2,0,"mat-error",10)(81,jo,2,0,"mat-error",10)(82,Lo,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(83,Ho,15,16,"div",20),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"mat-expansion-panel")(85,"mat-expansion-panel-header")(86,"mat-panel-title")(87,"div",3),t.ɵɵtext(88),t.ɵɵpipe(89,"translate"),t.ɵɵpipe(90,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",21),t.ɵɵtemplate(92,Yo,27,32,"section",22),t.ɵɵelementStart(93,"span",23),t.ɵɵtext(94),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(96,"div")(97,"button",24),t.ɵɵpipe(98,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addNewConnector())})),t.ɵɵtext(99),t.ɵɵpipe(100,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(101,"section",25),t.ɵɵtemplate(102,Xo,4,7,"button",26)(103,Zo,4,7,"button",27),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("toastTarget",n.toastTargetId),t.ɵɵproperty("formGroup",n.gatewayConfigurationGroup),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,54,t.ɵɵpipeBind1(8,52,"gateway.thingsboard"))),t.ɵɵadvance(3),t.ɵɵproperty("deviceName",n.deviceNameForm)("isStateForm",n.isStateForm)("newGatewayType",n.gatewayType),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,56,"gateway.security-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(17,58,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(92,To,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,60,"gateway.thingsboard-host")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("host").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,62,"gateway.thingsboard-port")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","tls"===n.gatewayConfigurationGroup.get("securityType").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,64,"gateway.remote")),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(96,To,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(42,66,"gateway.remote-logging-level")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.gatewayLogLevels),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(48,68,"gateway.path-logs")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteLoggingPathToLogs").hasError("required")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(57,72,t.ɵɵpipeBind1(56,70,"gateway.storage"))),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(62,74,"gateway.storage-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(65,76,n.storageTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(100,To,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(70,78,"gateway.storage-pack-size")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(78,80,"file"!==n.gatewayConfigurationGroup.get("storageType").value?"gateway.storage-max-records":"gateway.storage-max-file-records")," "),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","file"===n.gatewayConfigurationGroup.get("storageType").value),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(90,84,t.ɵɵpipeBind1(89,82,"gateway.connectors-config"))),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.connectors.controls),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.connectors.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(95,86,"gateway.no-connectors")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(98,88,"gateway.connector-add")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(100,90,"action.add")," "),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.gatewayConfigurationGroup.get("remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteConfiguration").value))},dependencies:t.ɵɵgetComponentDepsFactory(es,[V,b]),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",es);class ts{transform(e,t){return zr.parseVersion(e)>=zr.parseVersion(Oa.get(t))}static{this.ɵfac=function(e){return new(e||ts)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"isLatestVersionConfig",type:ts,pure:!0,standalone:!0})}}class ns{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:Fa.MIN,max:Fa.MAX}):""}static{this.ɵfac=function(e){return new(e||ns)(t.ɵɵdirectiveInject(Ne.TranslateService,16))}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getGatewayPortTooltip",type:ns,pure:!0,standalone:!0})}}class as{transform(e,t,n,a){switch(e){case Je.OPCUA:return this.getOpcConnectorHelpLink(t,n);case Je.MQTT:return this.getMqttConnectorHelpLink(t,n,a);case Je.BACNET:return this.getBacnetConnectorHelpLink(t,n)}}getOpcConnectorHelpLink(e,t){if(t!==qa.CONST)return`widget/lib/gateway/${e}-${t}_fn`}getMqttConnectorHelpLink(e,t,n){if(t!==ya.CONST)return n?e!==ja.ATTRIBUTES&&e!==ja.TIMESERIES||n!==ga.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!==qa.CONST)return`widget/lib/gateway/bacnet-device-${e}-${t}_fn`}static{this.ɵfac=function(e){return new(e||as)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getConnectorMappingHelpLink",type:as,pure:!0,standalone:!0})}}function rs(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.value," ")}}function is(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",22),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 os(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",23),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function ss(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",24),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function ps(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function ls(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",25)(2,"mat-label",26),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 cs(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",27)(2,"mat-label",26),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 ds extends I{constructor(e,t,n,a,r,i){super(e,t,a),this.store=e,this.router=t,this.data=n,this.dialogRef=a,this.fb=r,this.isLatestVersionConfig=i,this.connectorType=Je,this.gatewayConnectorDefaultTypesTranslatesMap=Ye,this.gatewayLogLevel=Object.values(We),this.submitted=!1,this.destroy$=new me,this.connectorForm=this.fb.group({type:[Je.MQTT,[]],name:["",[ne.required,this.uniqNameRequired(),ne.pattern($e)]],logLevel:[We.INFO,[]],useDefaults:[!0,[]],sendDataOnlyOnChange:[!1,[]],class:["",[]],key:["auto",[]]})}ngOnInit(){this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}helpLinkId(){return q+"/docs/iot-gateway/configuration/"}cancel(){this.dialogRef.close(null)}add(){this.submitted=!0;const e=this.connectorForm.getRawValue();if(e.useDefaults){const t=Pt(e.type),n=this.data.gatewayVersion;n&&(e.configVersion=n),e.configurationJson=(this.isLatestVersionConfig.transform(n,e.type)?t[Oa.get(e.type)]:t[Qe.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}}observeTypeChange(){this.connectorForm.get("type").valueChanges.pipe(we((e=>{const t=this.connectorForm.get("useDefaults");e===Je.GRPC||e===Je.CUSTOM?t.setValue(!1):t.value||t.setValue(!0)})),be(this.destroy$)).subscribe()}static{this.ɵfac=function(e){return new(e||ds)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef),t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(ts))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ds,selectors:[["tb-add-connector-dialog"]],standalone:!0,features:[t.ɵɵProvidersFeature([ts]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:44,vars:27,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",4,"ngFor","ngForOf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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.ɵɵtemplate(17,rs,2,2,"mat-option",12),t.ɵɵpipe(18,"keyvalue"),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,is,3,3,"mat-icon",15),t.ɵɵelementEnd()(),t.ɵɵtemplate(26,os,6,3,"div",16)(27,ss,6,3,"div",16),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",17),t.ɵɵtemplate(33,ps,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵtemplate(34,ls,6,6,"div",16)(35,cs,6,6,"div",16),t.ɵɵpipe(36,"withReportStrategy"),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"div",18)(38,"button",19),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(39),t.ɵɵpipe(40,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(41,"button",20),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,14,"gateway.add-connector")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLinkId()),t.ɵɵadvance(11),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(18,16,n.gatewayConnectorDefaultTypesTranslatesMap)),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,18,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("name").hasError("required")&&n.connectorForm.get("name").touched||n.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.GRPC),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value!==n.connectorType.GRPC&&n.connectorForm.get("type").value!==n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.MQTT&&!t.ɵɵpipeBind2(36,20,n.data.gatewayVersion,n.connectorType.MQTT)),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(40,23,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.connectorForm.invalid||!n.connectorForm.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(43,25,"action.add")," "))},dependencies:t.ɵɵgetComponentDepsFactory(ds,[V,b,Jr]),styles:['@charset "UTF-8";[_nghost-%COMP%] .add-connector[_ngcontent-%COMP%]{min-width:400px;width:500px}']})}}e("AddConnectorDialogComponent",ds);const ms=()=>({maxWidth:"970px"});function us(e,n){1&e&&(t.ɵɵelementStart(0,"div",6),t.ɵɵtext(1,"gateway.device-info.source"),t.ɵɵelementEnd())}function gs(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",20),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SourceTypeTranslationsMap.get(e))," ")}}function ys(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",12)(2,"mat-select",18),t.ɵɵtemplate(3,gs,3,4,"mat-option",19),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function hs(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.device-info.device-name-expression-required"))}function fs(e,n){if(1&e&&(t.ɵɵelement(0,"div",22),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,ms))}}function vs(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",20),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SourceTypeTranslationsMap.get(e))," ")}}function bs(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",12)(2,"mat-select",25),t.ɵɵtemplate(3,vs,3,4,"mat-option",19),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function xs(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.device-info.device-profile-expression-required"))}function ws(e,n){if(1&e&&(t.ɵɵelement(0,"div",22),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,ms))}}function Cs(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",23)(1,"div",9),t.ɵɵtext(2,"gateway.device-info.profile-name"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,bs,4,1,"div",10),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12),t.ɵɵelement(6,"input",24),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,xs,3,3,"mat-icon",14)(9,ws,2,8,"div",15),t.ɵɵpipe(10,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingFormGroup.get("deviceProfileExpression").hasError("required")&&e.mappingFormGroup.get("deviceProfileExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(10,6,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType))}}class Ss extends R{get deviceInfoType(){return this.deviceInfoTypeValue}set deviceInfoType(e){this.deviceInfoTypeValue!==e&&(this.deviceInfoTypeValue=e)}constructor(e,t,n,a){super(e),this.store=e,this.translate=t,this.dialog=n,this.fb=a,this.SourceTypeTranslationsMap=Aa,this.DeviceInfoType=vr,this.useSource=!0,this.required=!1,this.connectorType=Je.MQTT,this.sourceTypes=Object.values(ya),this.destroy$=new me,this.propagateChange=e=>{}}ngOnInit(){this.mappingFormGroup=this.fb.group({deviceNameExpression:["",this.required?[ne.required,ne.pattern($e)]:[ne.pattern($e)]]}),this.useSource&&this.mappingFormGroup.addControl("deviceNameExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.deviceInfoType===vr.FULL&&(this.useSource&&this.mappingFormGroup.addControl("deviceProfileExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.mappingFormGroup.addControl("deviceProfileExpression",this.fb.control("",this.required?[ne.required,ne.pattern($e)]:[ne.pattern($e)]))),this.mappingFormGroup.valueChanges.pipe(be(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||Ss)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(Ne.TranslateService),t.ɵɵdirectiveInject(pe.MatDialog),t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Ss,selectors:[["tb-device-info-table"]],inputs:{useSource:"useSource",required:"required",connectorType:"connectorType",convertorType:"convertorType",sourceTypes:"sourceTypes",deviceInfoType:"deviceInfoType"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Ss)),multi:!0},{provide:re,useExisting:i((()=>Ss)),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","table-name-column"],["class","tb-form-table-header-cell table-column","translate","",4,"ngIf"],["translate","",1,"tb-form-table-header-cell","table-column"],[1,"tb-form-table-body","no-gap"],[1,"tb-form-table-row","tb-form-row","no-border","same-padding","top-same-padding"],["translate","",1,"fixed-title-width","tb-required"],["class","tb-flex no-gap raw-value-option",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["class","tb-form-table-row tb-form-row no-border same-padding bottom-same-padding",4,"ngIf"],[1,"tb-flex","no-gap","raw-value-option"],["formControlName","deviceNameExpressionSource"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-form-table-row","tb-form-row","no-border","same-padding","bottom-same-padding"],["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,us,2,0,"div",5),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9," gateway.device-info.expression "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",7)(11,"div",8)(12,"div",9),t.ɵɵtext(13,"gateway.device-info.name"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,ys,4,1,"div",10),t.ɵɵelementStart(15,"div",11)(16,"mat-form-field",12),t.ɵɵelement(17,"input",13),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,hs,3,3,"mat-icon",14)(20,fs,2,8,"div",15),t.ɵɵpipe(21,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(22,Cs,11,11,"div",16),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(),t.ɵɵclassProp("tb-required",n.required),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(4),t.ɵɵclassProp("bottom-same-padding",n.deviceInfoType!==n.DeviceInfoType.FULL),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(18,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.mappingFormGroup.get("deviceNameExpression").hasError("required")&&n.mappingFormGroup.get("deviceNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(21,13,n.connectorType,"name-field",n.mappingFormGroup.get("deviceNameExpressionSource").value,n.convertorType)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceInfoType===n.DeviceInfoType.FULL))},dependencies:t.ɵɵgetComponentDepsFactory(Ss,[V,b,as]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}[_nghost-%COMP%] .tb-form-row.bottom-same-padding[_ngcontent-%COMP%]{padding-bottom:16px}[_nghost-%COMP%] .tb-form-row.top-same-padding[_ngcontent-%COMP%]{padding-top:16px}[_nghost-%COMP%] .tb-form-row[_ngcontent-%COMP%] .fixed-title-width[_ngcontent-%COMP%]{width:19%}[_nghost-%COMP%] .table-column[_ngcontent-%COMP%]{width:40%}[_nghost-%COMP%] .table-name-column[_ngcontent-%COMP%]{width:20%}[_nghost-%COMP%] .raw-name[_ngcontent-%COMP%]{width:19%}[_nghost-%COMP%] .raw-value-option[_ngcontent-%COMP%]{max-width:40%}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:o.OnPush})}}qe([k()],Ss.prototype,"useSource",void 0),qe([k()],Ss.prototype,"required",void 0);const Es=()=>({maxWidth:"970px"});function Ts(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",19),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 Is(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵelement(1,"mat-icon",22),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){let e,a;const r=n.$implicit,i=t.ɵɵnextContext(2);t.ɵɵproperty("value",r),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("svgIcon",null==(e=i.valueTypes.get(r))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,null==(a=i.valueTypes.get(r))?null:a.name))}}function ks(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Is,5,5,"mat-option",20),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function Ms(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",23)(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 Ps(e,n){1&e&&(t.ɵɵelement(0,"input",24),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function Fs(e,n){1&e&&(t.ɵɵelement(0,"input",25),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function Os(e,n){1&e&&(t.ɵɵelement(0,"input",26),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function qs(e,n){1&e&&(t.ɵɵelement(0,"input",27),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function Bs(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",28)(1,"mat-option",21),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",21),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function Rs(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",29),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function Ns(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",30),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,Es))}}class _s{constructor(e){this.fb=e,this.valueTypeKeys=Object.values(Bt),this.valueTypes=Rt,this.MappingValueType=Bt,this.destroy$=new me,this.onChange=e=>{},this.valueTypeFormGroup=this.fb.group({type:[Bt.STRING],stringValue:[{value:"",disabled:this.rawData},[ne.required,ne.pattern($e)]],integerValue:[{value:0,disabled:!0},[ne.required,ne.pattern(ze)]],doubleValue:[{value:0,disabled:!0},[ne.required]],booleanValue:[{value:!1,disabled:!0},[ne.required]],rawValue:[{value:"",disabled:!this.rawData},[ne.required,ne.pattern($e)]]}),this.valueTypeFormGroup.valueChanges.pipe(be(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(be(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 Bt.BOOLEAN;case"number":return Number.isInteger(e)?Bt.INTEGER:Bt.DOUBLE;default:return Bt.STRING}}static{this.ɵfac=function(e){return new(e||_s)(t.ɵɵdirectiveInject(te.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:_s,selectors:[["tb-type-value-field"]],inputs:{rawData:"rawData",helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>_s)),multi:!0},{provide:re,useExisting:i((()=>_s)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:17,consts:[["raw",""],[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"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[4,"ngIf","ngIfElse"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex","tb-suffix-absolute"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","rawValue",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style","click",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["value","raw"],["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",3,"click","tb-help-popup","tb-help-popup-style"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,1),t.ɵɵelementStart(1,"div",2)(2,"div",3),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",4)(5,"mat-form-field",5)(6,"mat-select",6)(7,"mat-select-trigger")(8,"div",7),t.ɵɵtemplate(9,Ts,1,1,"mat-icon",8),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(14,ks,2,1,"ng-container",9)(15,Ms,4,3,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(17,"div",2)(18,"div",3),t.ɵɵtext(19,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",10),t.ɵɵelementContainerStart(21,11),t.ɵɵtemplate(22,Ps,2,3,"input",12)(23,Fs,2,3,"input",13)(24,Os,2,3,"input",14)(25,qs,2,3,"input",15)(26,Bs,5,2,"mat-select",16),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,Rs,3,3,"mat-icon",17)(28,Ns,1,3,"div",18),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){let e,a;const r=t.ɵɵreference(16);t.ɵɵproperty("formGroup",n.valueTypeFormGroup),t.ɵɵadvance(9),t.ɵɵproperty("ngIf",!n.rawData),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,13,null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.name)||t.ɵɵpipeBind1(13,15,"gateway.raw")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",!n.rawData)("ngIfElse",r),t.ɵɵadvance(7),t.ɵɵproperty("ngSwitch",n.valueTypeFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase","raw"),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(a=n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value))?null:a.hasError("required"))&&n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value).touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.helpLink)}},dependencies:t.ɵɵgetComponentDepsFactory(_s,[b,V]),styles:['@charset "UTF-8";[_nghost-%COMP%]{gap:16px;display:grid;width:100%}']})}}function Ds(e,n){if(1&e&&t.ɵɵelement(0,"tb-type-value-field",14),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("helpLink",e.helpLink)}}function Vs(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",7),t.ɵɵelementContainerStart(2,8),t.ɵɵelementStart(3,"mat-expansion-panel",9)(4,"mat-expansion-panel-header",10)(5,"mat-panel-title")(6,"div",11),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,Ds,1,1,"ng-template",12),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",13),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).index,r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.deleteKey(n,a))})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e;const a=n.$implicit,r=n.last;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",a),t.ɵɵadvance(),t.ɵɵproperty("expanded",r),t.ɵɵadvance(4),t.ɵɵtextInterpolate(null!==(e=null==(e=a.get("typeValue").value)?null:e.value)&&void 0!==e?e:""),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,"gateway.delete-value"))}}function Gs(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtemplate(1,Vs,13,6,"div",5),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function As(e,n){1&e&&(t.ɵɵelementStart(0,"div",15)(1,"span",16),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate("gateway.no-value"))}qe([k()],_s.prototype,"rawData",void 0);class js{constructor(e){this.fb=e,this.destroy$=new me,this.onChange=e=>{}}ngOnInit(){this.valueListFormArray=this.fb.array([]),this.valueListFormArray.valueChanges.pipe(be(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||js)(t.ɵɵdirectiveInject(te.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:js,selectors:[["tb-type-value-panel"]],inputs:{helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>js)),multi:!0},{provide:re,useExisting:i((()=>js)),multi:!0}]),t.ɵɵStandaloneFeature],decls:8,vars:5,consts:[["noKeys",""],[1,"tb-form-panel","no-border","no-padding"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-form-panel","no-border","no-padding","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",1),t.ɵɵtemplate(1,Gs,2,2,"div",2),t.ɵɵelementStart(2,"div")(3,"button",3),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(6,As,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)}if(2&e){const e=t.ɵɵreference(7);t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.valueListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,3,"gateway.add-value")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(js,[V,b,_s]),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%] .see-example[_ngcontent-%COMP%]{width:32px;height:32px;margin:4px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}const Ls=()=>({maxWidth:"970px"});function Us(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",19),t.ɵɵtext(2),t.ɵɵelementEnd(),t.ɵɵtext(3),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",e.get("key").value," "),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",":","  ")}}function $s(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.key-required"))}function zs(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,Ls))}}function Ks(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",44),2&e){let e;const n=t.ɵɵnextContext(4).$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("svgIcon",null==(e=a.valueTypes.get(n.get("type").value))?null:e.icon)}}function Hs(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,a=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,null!==(e=null==(e=a.valueTypes.get(n.get("type").value))?null:e.name)&&void 0!==e?e:a.valueTypes.get(n.get("type").value))," ")}}function Ws(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 Qs(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-select-trigger")(1,"div",42),t.ɵɵtemplate(2,Ks,1,1,"mat-icon",43)(3,Hs,3,3,"span",36)(4,Ws,3,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵreference(5),a=t.ɵɵnextContext(3).$implicit,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==(e=r.valueTypes.get(a.get("type").value))?null:e.icon),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!r.rawData)("ngIfElse",n)}}function Js(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",48),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(6);t.ɵɵpropertyInterpolate("svgIcon",n.valueTypes.get(e).icon)}}function Ys(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵtemplate(1,Js,1,1,"mat-icon",47),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){let e,a;const r=n.$implicit,i=t.ɵɵnextContext(6);t.ɵɵproperty("value",r),t.ɵɵadvance(),t.ɵɵproperty("ngIf",null==(e=i.valueTypes.get(r))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,3,null!==(a=null==(a=i.valueTypes.get(r))?null:a.name)&&void 0!==a?a:i.valueTypes.get(r))," ")}}function Xs(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Ys,5,5,"mat-option",45),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function Zs(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",46)(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 ep(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-required"))}function tp(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,Ls))}}function np(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",28),t.ɵɵelement(10,"input",29),t.ɵɵpipe(11,"translate"),t.ɵɵtemplate(12,$s,3,3,"mat-icon",30)(13,zs,2,8,"div",31),t.ɵɵpipe(14,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",32)(19,"div",33),t.ɵɵtext(20,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",34)(22,"mat-select",35),t.ɵɵtemplate(23,Qs,6,3,"mat-select-trigger",18)(24,Xs,2,1,"ng-container",36)(25,Zs,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"div",37)(28,"div",27),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",38),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,ep,3,3,"mat-icon",30)(36,tp,2,8,"div",31),t.ɵɵpipe(37,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵreference(26),n=t.ɵɵnextContext(2).$implicit,a=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,13,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,15,"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(11,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("key").hasError("required")&&n.get("key").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(14,19,a.connectorType===a.ConnectorType.MQTT&&a.connectorType,a.keysType,n.get("type").value,a.convertorType)),t.ɵɵadvance(10),t.ɵɵproperty("ngIf",!a.rawData),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!a.rawData)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(29,24,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(31,26,"gateway.value")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("value").hasError("required")&&n.get("value").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(37,30,a.connectorType,a.keysType,n.get("type").value,a.convertorType))}}function ap(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.key-required"))}function rp(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-required"))}function ip(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",33),t.ɵɵtext(3,"gateway.key"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",28),t.ɵɵelement(5,"input",29),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,ap,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",26)(9,"div",33),t.ɵɵtext(10,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",49),t.ɵɵelement(12,"input",39),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,rp,3,3,"mat-icon",30),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function op(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-required"))}function sp(e,n){1&e&&t.ɵɵelement(0,"tb-type-value-panel",54)}function pp(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",27),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",28),t.ɵɵelement(7,"input",50),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,op,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",14)(11,"mat-expansion-panel",51)(12,"mat-expansion-panel-header",52)(13,"mat-panel-title")(14,"div",53),t.ɵɵpipe(15,"translate"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(18,sp,1,0,"ng-template",20),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.ɵɵproperty("ngIf",n.get("method").hasError("required")&&n.get("method").touched),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 lp(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",55),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function cp(e,n){if(1&e&&t.ɵɵtemplate(0,np,38,35,"div",22)(1,ip,15,8,"div",22)(2,pp,19,17,"div",22)(3,lp,1,2,"tb-report-strategy",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType!==e.MappingKeysType.CUSTOM&&e.keysType!==e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.withReportStrategy&&(e.keysType===e.MappingKeysType.ATTRIBUTES||e.keysType===e.MappingKeysType.TIMESERIES))}}function dp(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵelementContainerStart(2,15),t.ɵɵelementStart(3,"mat-expansion-panel",16)(4,"mat-expansion-panel-header",17)(5,"mat-panel-title"),t.ɵɵtemplate(6,Us,4,2,"ng-container",18),t.ɵɵelementStart(7,"div",19),t.ɵɵtext(8),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,cp,4,4,"ng-template",20),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",21),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).index,r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.deleteKey(n,a))})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,a=n.last,r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",a),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.keysType!==r.MappingKeysType.RPC_METHODS),t.ɵɵadvance(2),t.ɵɵtextInterpolate(r.valueTitle(e)),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function mp(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",11),t.ɵɵtemplate(1,dp,14,7,"div",12),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function up(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",56)(1,"span",57),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class gp extends R{constructor(e,t){super(t),this.fb=e,this.store=t,this.valueTypeEnum=Bt,this.valueTypes=Rt,this.valueTypeKeys=Object.values(Bt),this.rawData=!1,this.withReportStrategy=!0,this.keysDataApplied=new r,this.MappingKeysType=ja,this.ReportStrategyDefaultValue=Vt,this.ConnectorType=Je,this.errorText=""}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===ja.RPC_METHODS?this.fb.group({method:["",[ne.required]],arguments:[[],[]]}):this.keysType===ja.CUSTOM?this.fb.group({key:["",[ne.required,ne.pattern($e)]],value:["",[ne.required,ne.pattern($e)]]}):this.fb.group({key:["",[ne.required,ne.pattern($e)]],type:[this.rawData?"raw":this.valueTypeKeys[0]],value:["",[ne.required,ne.pattern($e)]],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===ja.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===ja.CUSTOM&&(e=Object.keys(e).map((t=>({key:t,value:e[t],type:""})))),e.forEach((e=>{let n;if(this.keysType===ja.RPC_METHODS)n=this.fb.group({method:[e.method,[ne.required]],arguments:[[...e.arguments],[]]});else if(this.keysType===ja.CUSTOM){const{key:t,value:a}=e;n=this.fb.group({key:[t,[ne.required,ne.pattern($e)]],value:[a,[ne.required,ne.pattern($e)]]})}else{const{key:t,value:a,type:r,reportStrategy:i}=e;n=this.fb.group({key:[t,[ne.required,ne.pattern($e)]],type:[r],value:[a,[ne.required,ne.pattern($e)]],reportStrategy:[{value:i,disabled:this.isReportStrategyDisabled()}]})}t.push(n)}))),this.fb.array(t)}valueTitle(e){const t=this.keysType===ja.RPC_METHODS?e.get("method").value:e.get("value").value;return j(t)?"object"==typeof t?JSON.stringify(t):t:""}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===ja.ATTRIBUTES||this.keysType===ja.TIMESERIES))}static{this.ɵfac=function(e){return new(e||gp)(t.ɵɵdirectiveInject(te.UntypedFormBuilder),t.ɵɵdirectiveInject(ce.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gp,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",popover:"popover"},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:19,vars:16,consts:[["noKeys",""],["rawOption",""],["rawText",""],[1,"tb-mapping-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[4,"ngIf"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[4,"ngIf","ngIfElse"],[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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matSuffix","","tb-help-popup-placement","left",1,"see-example",3,"tb-help-popup","tb-help-popup-style"],[1,"tb-flex","align-center"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["class","tb-mat-20",3,"svgIcon",4,"ngIf"],[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"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],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.ɵɵtemplate(5,mp,2,2,"div",6),t.ɵɵelementStart(6,"div")(7,"button",7),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,up,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",8)(13,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(gp,[V,b,ma,js,as]),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%] .tb-mapping-keys-panel[_ngcontent-%COMP%] .see-example[_ngcontent-%COMP%]{width:32px;height:32px;margin:4px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}']})}}qe([k()],gp.prototype,"rawData",void 0),qe([k()],gp.prototype,"withReportStrategy",void 0);const yp=()=>({maxWidth:"970px"}),hp=(e,t)=>[e,t];function fp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function vp(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.QualityTranslationsMap.get(e))," ")}}function bp(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.ConvertorTypeTranslationsMap.get(e))," ")}}function xp(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",40),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("convertorType",e.ConvertorTypeEnum.JSON)("deviceInfoType",e.DeviceInfoType.FULL)}}function wp(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",41),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)("convertorType",e.ConvertorTypeEnum.BYTES)("sourceTypes",t.ɵɵpureFunction2(3,hp,e.sourceTypesEnum.MSG,e.sourceTypesEnum.CONST))}}function Cp(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 Sp(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 Ep(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.ɵɵtemplate(6,Cp,2,1,"mat-chip",44),t.ɵɵelementStart(7,"mat-chip",45),t.ɵɵelement(8,"label",46),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",47,0),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵreference(10),r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.manageKeys(n,a,r.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(12,"tb-icon",48),t.ɵɵtext(13,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",31)(15,"div",32),t.ɵɵtext(16,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",42)(18,"mat-chip-listbox",43),t.ɵɵtemplate(19,Sp,2,1,"mat-chip",44),t.ɵɵelementStart(20,"mat-chip",45),t.ɵɵelement(21,"label",46),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"button",47,1),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵreference(23),r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.manageKeys(n,a,r.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(25,"tb-icon",48),t.ɵɵtext(26,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterAttributes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,6,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterTelemetry),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,8,"action.edit"))}}function Tp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function Ip(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 kp(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",21)(2,"div",49),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",23),t.ɵɵelement(7,"input",50),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,Tp,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",51)(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.ɵɵtemplate(21,Ip,2,1,"mat-chip",44),t.ɵɵelementStart(22,"mat-chip",45),t.ɵɵelement(23,"label",46),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",47,2),t.ɵɵpipe(26,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵreference(25),r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.manageKeys(n,a,r.MappingKeysType.CUSTOM))})),t.ɵɵelementStart(27,"tb-icon",48),t.ɵɵtext(28,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,8,"gateway.extension-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,10,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("converter.custom.extension").hasError("required")&&e.mappingForm.get("converter.custom.extension").touched),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,14,"gateway.extension-configuration-hint")),t.ɵɵadvance(6),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.customKeys),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(26,16,"action.edit"))}}function Mp(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,fp,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,vp,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,bp,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,xp,1,2,"ng-template",17)(30,wp,1,6,"ng-template",17)(31,Ep,27,10,"div",37)(32,kp,29,18,"div",37),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("topicFilter").hasError("required")&&e.mappingForm.get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(23,yp)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,17,"gateway.response-topic-Qos-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,19,"gateway.mqtt-qos")," "),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.qualityTypes),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.convertorTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,21,e.DataConversionTranslationsMap.get(e.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroupName",e.converterType)("ngSwitch",e.converterType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.BYTES),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.BYTES||e.converterType===e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.CUSTOM)}}function Pp(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.RequestTypesTranslationsMap.get(e))," ")}}function Fp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function Op(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",56),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,Fp,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,yp))}}function qp(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",57),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)}}function Bp(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",57),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.PARTIAL)}}function Rp(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SourceTypeTranslationsMap.get(e))," ")}}function Np(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 _p(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SourceTypeTranslationsMap.get(e))," ")}}function Dp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 Vp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 Gp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 Ap(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",34)(1,"div",58),t.ɵɵtext(2,"gateway.from-device-request-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",59),t.ɵɵtext(4," gateway.from-device-request-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",60)(6,"div",61)(7,"div",62),t.ɵɵtext(8,"gateway.device-info.device-name-expression"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",63)(10,"mat-form-field",23)(11,"mat-select",64),t.ɵɵtemplate(12,Rp,3,4,"mat-option",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(13,"mat-form-field",23),t.ɵɵelement(14,"input",65),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,Np,3,3,"mat-icon",25),t.ɵɵelement(17,"div",26),t.ɵɵelementEnd()()(),t.ɵɵelementStart(18,"div",21)(19,"div",22),t.ɵɵtext(20,"gateway.attribute-name-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",63)(22,"mat-form-field",23)(23,"mat-select",66),t.ɵɵtemplate(24,_p,3,4,"mat-option",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"mat-form-field",23),t.ɵɵelement(26,"input",67),t.ɵɵpipe(27,"translate"),t.ɵɵtemplate(28,Dp,3,3,"mat-icon",25),t.ɵɵelement(29,"div",26),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(30,"div",34)(31,"div",58),t.ɵɵtext(32,"gateway.to-device-response-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"div",59),t.ɵɵtext(34," gateway.to-device-response-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"div",21)(36,"div",22),t.ɵɵtext(37,"gateway.response-value-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field",23),t.ɵɵelement(39,"input",68),t.ɵɵpipe(40,"translate"),t.ɵɵtemplate(41,Vp,3,3,"mat-icon",25),t.ɵɵelement(42,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(43,"div",21)(44,"div",22),t.ɵɵtext(45,"gateway.response-topic-expression"),t.ɵɵelementEnd(),t.ɵɵelementStart(46,"mat-form-field",23),t.ɵɵelement(47,"input",69),t.ɵɵpipe(48,"translate"),t.ɵɵtemplate(49,Gp,3,3,"mat-icon",25),t.ɵɵelement(50,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"div",70)(52,"mat-slide-toggle",71)(53,"mat-label",72),t.ɵɵpipe(54,"translate"),t.ɵɵtext(55),t.ɵɵpipe(56,"translate"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(12),t.ɵɵproperty("ngForOf",e.sourceTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(32,yp)),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",e.sourceTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(27,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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(33,yp)),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(40,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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(34,yp)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(48,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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(35,yp)),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(54,28,"gateway.retain-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(56,30,"gateway.retain")," ")}}function jp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 Lp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-filter-required"))}function Up(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 $p(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 zp(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",49),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",23),t.ɵɵelement(6,"input",73),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,jp,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",49),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",74),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,Lp,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",68),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,Up,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",69),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,$p,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",70)(35,"mat-slide-toggle",71)(36,"mat-label",72),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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(38,yp)),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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(39,yp)),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 Kp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 Hp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-filter-required"))}function Wp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 Qp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-expression-required"))}function Jp(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),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 Yp(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(4);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.QualityTranslationsMap.get(e))," ")}}function Xp(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵtext(1," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("matTooltip",e.responseTimeoutErrorTooltip)}}function Zp(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",79),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Jp,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",80),t.ɵɵtemplate(16,Yp,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",81),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,Xp,2,1,"mat-icon",25),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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(17,yp)),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.ɵɵproperty("ngIf",(e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").hasError("required")||e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").hasError("min"))&&e.mappingForm.get("requestValue.serverSideRpc.responseTimeout").touched)}}function el(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",75)(1,"tb-toggle-select",33)(2,"tb-toggle-option",39),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-option",39),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",21)(9,"div",49),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23),t.ɵɵelement(14,"input",73),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,Kp,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",21)(18,"div",49),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",23),t.ɵɵelement(23,"input",76),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,Hp,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",77),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,Wp,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",68),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,Qp,3,3,"mat-icon",25),t.ɵɵelement(41,"div",26),t.ɵɵelementEnd()(),t.ɵɵtemplate(42,Zp,24,18,"ng-container",78)),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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(41,yp)),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/expressions_fn")("tb-help-popup-style",t.ɵɵpureFunction0(42,yp)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.type").value===e.ServerSideRPCType.TWO_WAY)}}function tl(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",52),t.ɵɵtemplate(5,Pp,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(6,53)(7,54),t.ɵɵtemplate(8,Op,8,8,"div",55)(9,qp,1,1,"ng-template",17)(10,Bp,1,1,"ng-template",17)(11,Ap,57,36,"ng-template",17)(12,zp,40,40,"ng-template",17)(13,el,43,43,"ng-template",17),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.requestTypes),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e.mappingForm.get("requestValue").get(e.requestMappingType))("ngSwitch",e.requestMappingType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.requestMappingType===e.RequestTypeEnum.ATTRIBUTE_REQUEST||e.requestMappingType===e.RequestTypeEnum.CONNECT_REQUEST||e.requestMappingType===e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.CONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_UPDATE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.SERVER_SIDE_RPC)}}function nl(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SourceTypeTranslationsMap.get(e))," ")}}function al(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",38),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-node-required"))}function rl(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 il(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 ol(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 sl(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 pl(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",21)(1,"div",82)(2,"div",83),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",84)(7,"mat-form-field",23)(8,"mat-select",85),t.ɵɵtemplate(9,nl,3,4,"mat-option",29),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",86),t.ɵɵelement(11,"input",87),t.ɵɵpipe(12,"translate"),t.ɵɵtemplate(13,al,3,3,"mat-icon",25),t.ɵɵelement(14,"div",26),t.ɵɵpipe(15,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵelement(16,"tb-device-info-table",88),t.ɵɵelementStart(17,"div",31)(18,"div",32),t.ɵɵtext(19,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"div",42)(21,"mat-chip-listbox",43),t.ɵɵtemplate(22,rl,2,1,"mat-chip",44),t.ɵɵelementStart(23,"mat-chip",45),t.ɵɵelement(24,"label",46),t.ɵɵelementEnd()(),t.ɵɵelementStart(25,"button",47,3),t.ɵɵpipe(27,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵreference(26),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(28,"tb-icon",48),t.ɵɵtext(29,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(30,"div",31)(31,"div",32),t.ɵɵtext(32,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(33,"div",42)(34,"mat-chip-listbox",43),t.ɵɵtemplate(35,il,2,1,"mat-chip",44),t.ɵɵelementStart(36,"mat-chip",45),t.ɵɵelement(37,"label",46),t.ɵɵelementEnd()(),t.ɵɵelementStart(38,"button",47,4),t.ɵɵpipe(40,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵreference(39),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(41,"tb-icon",48),t.ɵɵtext(42,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(43,"div",31)(44,"div",32),t.ɵɵtext(45,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(46,"div",42)(47,"mat-chip-listbox",43),t.ɵɵtemplate(48,ol,2,1,"mat-chip",44),t.ɵɵelementStart(49,"mat-chip",45),t.ɵɵelement(50,"label",46),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"button",47,5),t.ɵɵpipe(53,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵreference(52),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.MappingKeysType.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(54,"tb-icon",48),t.ɵɵtext(55,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(56,"div",31)(57,"div",32),t.ɵɵtext(58,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(59,"div",42)(60,"mat-chip-listbox",43),t.ɵɵtemplate(61,sl,2,1,"mat-chip",44),t.ɵɵelementStart(62,"mat-chip",45),t.ɵɵelement(63,"label",46),t.ɵɵelementEnd()(),t.ɵɵelementStart(64,"button",47,6),t.ɵɵpipe(66,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵreference(65),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.MappingKeysType.RPC_METHODS))})),t.ɵɵelementStart(67,"tb-icon",48),t.ɵɵtext(68,"edit"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,22,"gateway.device-node-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,24,"gateway.device-node")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",t.ɵɵpureFunction2(40,hp,e.OPCUaSourceTypesEnum.PATH,e.OPCUaSourceTypesEnum.IDENTIFIER)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(12,26,"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,28,e.ConnectorType.OPCUA,"device-node",e.mappingForm.get("deviceNodeSource").value))("tb-help-popup-style",t.ɵɵpureFunction0(43,yp)),t.ɵɵadvance(2),t.ɵɵproperty("connectorType",e.ConnectorType.OPCUA)("sourceTypes",e.OPCUaSourceTypes)("deviceInfoType",e.DeviceInfoType.FULL),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.opcAttributes),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.opcAttributes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(27,32,"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(40,34,"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(53,36,"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(66,38,"action.edit"))}}class ll extends I{constructor(e,t,n,a,r,i,o,s,p){super(e,t,a),this.store=e,this.router=t,this.data=n,this.dialogRef=a,this.fb=r,this.popoverService=i,this.renderer=o,this.viewContainerRef=s,this.translate=p,this.MappingType=Na,this.qualityTypes=Ka,this.QualityTranslationsMap=fa,this.convertorTypes=Object.values(ga),this.ConvertorTypeEnum=ga,this.ConvertorTypeTranslationsMap=va,this.sourceTypes=Object.values(ya),this.OPCUaSourceTypes=Object.values(qa),this.OPCUaSourceTypesEnum=qa,this.sourceTypesEnum=ya,this.SourceTypeTranslationsMap=Aa,this.requestTypes=Object.values(ba),this.RequestTypeEnum=ba,this.RequestTypesTranslationsMap=xa,this.DeviceInfoType=vr,this.ServerSideRPCType=Ja,this.MappingKeysType=ja,this.MappingHintTranslationsMap=Qa,this.MappingTypeTranslationsMap=_a,this.DataConversionTranslationsMap=wa,this.HelpLinkByMappingTypeMap=Wa,this.ConnectorType=Je,this.keysPopupClosed=!0,this.destroy$=new me,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 Na.DATA:this.mappingForm=this.fb.group({}),this.createDataMappingForm();break;case Na.REQUESTS:this.mappingForm=this.fb.group({}),this.createRequestMappingForm();break;case Na.OPCUA:this.createOPCUAMappingForm()}}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){this.mappingForm.valid&&this.dialogRef.close(this.prepareMappingData())}manageKeys(e,t,n){e&&e.stopPropagation();const a=t._elementRef.nativeElement;if(this.popoverService.hasPopover(a))this.popoverService.hidePopover(a);else{const e=(this.data.mappingType!==Na.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===ga.BYTES,panelTitle:La.get(n),addKeyTitle:Ua.get(n),deleteKeyTitle:$a.get(n),noKeysText:za.get(n),withReportStrategy:this.data.withReportStrategy,connectorType:this.data.mappingType===Na.OPCUA?Je.OPCUA:Je.MQTT,convertorType:this.converterType};this.data.mappingType===Na.OPCUA&&(t.valueTypeKeys=Object.values(qa),t.valueTypeEnum=qa,t.valueTypes=Aa,t.sourceType=this.mappingForm.get("deviceNodeSource").value),this.keysPopupClosed=!1;const r=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,gp,"leftBottom",!1,null,t,{},{},{},!0);r.tbComponentRef.instance.popover=r,r.tbComponentRef.instance.keysDataApplied.pipe(be(this.destroy$)).subscribe((t=>{r.hide(),e.patchValue(t),e.markAsDirty()})),r.tbHideStart.pipe(be(this.destroy$)).subscribe((()=>{this.keysPopupClosed=!0}))}}prepareMappingData(){const e=this.mappingForm.value;switch(this.data.mappingType){case Na.DATA:const{converter:t,topicFilter:n,subscriptionQos:a}=e;return{topicFilter:n,subscriptionQos:a,converter:{type:t.type,...t[t.type]}};case Na.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 Na.DATA:const{converter:e,topicFilter:t,subscriptionQos:n}=this.data.value;return{topicFilter:t,subscriptionQos:n,converter:{type:e.type,[e.type]:{...e}}};case Na.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("",[ne.required,ne.pattern($e)])),this.mappingForm.addControl("subscriptionQos",this.fb.control(0)),this.mappingForm.addControl("converter",this.fb.group({type:[ga.JSON,[]],json:this.fb.group({deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]]}),bytes:this.fb.group({deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]]}),custom:this.fb.group({extension:["",[ne.required,ne.pattern($e)]],extensionConfig:[{},[]]})})),this.mappingForm.patchValue(this.getFormValueData()),this.mappingForm.get("converter.type").valueChanges.pipe(Pe(this.mappingForm.get("converter.type").value),be(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(ba.CONNECT_REQUEST,[])),this.mappingForm.addControl("requestValue",this.fb.group({connectRequests:this.fb.group({topicFilter:["",[ne.required,ne.pattern($e)]],deviceInfo:[{},[]]}),disconnectRequests:this.fb.group({topicFilter:["",[ne.required,ne.pattern($e)]],deviceInfo:[{},[]]}),attributeRequests:this.fb.group({topicFilter:["",[ne.required,ne.pattern($e)]],deviceInfo:this.fb.group({deviceNameExpressionSource:[ya.MSG,[]],deviceNameExpression:["",[ne.required]]}),attributeNameExpressionSource:[ya.MSG,[]],attributeNameExpression:["",[ne.required,ne.pattern($e)]],topicExpression:["",[ne.required,ne.pattern($e)]],valueExpression:["",[ne.required,ne.pattern($e)]],retain:[!1,[]]}),attributeUpdates:this.fb.group({deviceNameFilter:["",[ne.required,ne.pattern($e)]],attributeFilter:["",[ne.required,ne.pattern($e)]],topicExpression:["",[ne.required,ne.pattern($e)]],valueExpression:["",[ne.required,ne.pattern($e)]],retain:[!0,[]]}),serverSideRpc:this.fb.group({type:[Ja.TWO_WAY,[]],deviceNameFilter:["",[ne.required,ne.pattern($e)]],methodFilter:["",[ne.required,ne.pattern($e)]],requestTopicExpression:["",[ne.required,ne.pattern($e)]],responseTopicExpression:["",[ne.required,ne.pattern($e)]],valueExpression:["",[ne.required,ne.pattern($e)]],responseTopicQoS:[0,[]],responseTimeout:[1e4,[ne.required,ne.min(1)]]})})),this.mappingForm.get("requestType").valueChanges.pipe(Pe(this.mappingForm.get("requestType").value),be(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(be(this.destroy$)).subscribe((e=>{const t=this.mappingForm.get("requestValue.serverSideRpc");e===Ja.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:[qa.PATH,[]],deviceNodePattern:["",[ne.required]],deviceInfo:[{},[]],attributes:[[],[]],timeseries:[[],[]],rpc_methods:[[],[]],attributes_updates:[[],[]]}),this.mappingForm.patchValue(this.getFormValueData())}static{this.ɵfac=function(e){return new(e||ll)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef),t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(je.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(Ne.TranslateService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ll,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",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","ngSwitch"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["formControlName","deviceInfo","required","true",3,"convertorType","deviceInfoType"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","convertorType","sourceTypes"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[4,"ngFor","ngForOf"],[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","ngSwitch"],["class","tb-form-row column-xs",4,"ngIf"],["matInput","","name","value",3,"formControl","placeholder"],["formControlName","deviceInfo","required","true",3,"deviceInfoType"],["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"],["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"],["translate","",1,"tb-flex","no-flex","align-center"],[1,"tb-required",3,"tb-hint-tooltip-icon"],[1,"tb-flex","device-config"],["formControlName","deviceNodeSource"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","device-node-pattern-field"],["matInput","","name","value","formControlName","deviceNodePattern",3,"placeholder"],["formControlName","deviceInfo","required","true",3,"connectorType","sourceTypes","deviceInfoType"]],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,Mp,33,24,"ng-template",17)(17,tl,14,9,"ng-template",17)(18,pl,69,44,"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(ll,[V,b,as,aa,Ss]),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%] .see-example{width:32px;height:32px;margin:4px}[_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%}']})}}e("MappingDialogComponent",ll);const cl=["searchInput"],dl=()=>({minWidth:"96px",textAlign:"center"});function ml(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",24)(2,"span",25),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageMapping(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",11),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 ul(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-header-cell",29),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 gl(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext().$implicit,r=t.ɵɵnextContext();t.ɵɵclassProp("request-column",r.mappingType===r.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e[a.def]," ")}}function yl(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,26),t.ɵɵtemplate(1,ul,3,5,"mat-header-cell",27)(2,gl,2,3,"mat-cell",28),t.ɵɵelementContainerEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("matColumnDef",e.def)}}function hl(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",31)}function fl(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageMapping(n,a))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.deleteMapping(n,a))})),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 vl(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,fl,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",32),t.ɵɵelementContainer(4,33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",34)(6,"button",35),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",36),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",37,2),t.ɵɵelementContainer(11,33),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,dl)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function bl(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",38)}function xl(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class wl{set mappingType(e){this.mappingTypeValue!==e&&(this.mappingTypeValue=e)}get mappingType(){return this.mappingTypeValue}constructor(e,t,n,a){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=a,this.required=!1,this.withReportStrategy=!0,this.mappingTypeTranslationsMap=_a,this.mappingTypeEnum=Na,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 me,this.mappingFormGroup=this.fb.array([]),this.dirtyValue=!this.activeValue,this.dataSource=new Cl}ngOnInit(){this.setMappingColumns(),this.displayedColumns.push(...this.mappingColumns.map((e=>e.def)),"actions"),this.mappingFormGroup.valueChanges.pipe(be(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(ke(150),Me(((e,t)=>(e??"")===t.trim())),be(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=j(t)?this.mappingFormGroup.at(t).value:{};this.dialog.open(ll,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{mappingType:this.mappingType,value:n,buttonTitle:J(t)?"action.add":"action.apply",withReportStrategy:this.withReportStrategy}}).afterClosed().pipe(Ie(1),be(this.destroy$)).subscribe((e=>{e&&(j(t)?this.mappingFormGroup.at(t).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(),this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title"),"",this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).subscribe((e=>{e&&(this.mappingFormGroup.removeAt(t),this.mappingFormGroup.markAsDirty())}))}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.mappingFormGroup.push(this.fb.control(e))))}getMappingValue(e){switch(this.mappingType){case Na.DATA:const t=va.get(e.converter?.type);return{topicFilter:e.topicFilter,QoS:e.subscriptionQos,converter:t?this.translate.instant(t):""};case Na.REQUESTS:let n;const a=e;return n=a.requestType===ba.ATTRIBUTE_UPDATE?a.requestValue.attributeFilter:a.requestType===ba.SERVER_SIDE_RPC?a.requestValue.methodFilter:a.requestValue.topicFilter,{requestType:e.requestType,type:this.translate.instant(xa.get(e.requestType)),details:n};case Na.OPCUA:const r=e.deviceInfo?.deviceNameExpression,i=e.deviceInfo?.deviceProfileExpression,{deviceNodePattern:o}=e;return{deviceNodePattern:o,deviceNamePattern:r,deviceProfileExpression:i};default:return{}}}setMappingColumns(){switch(this.mappingType){case Na.DATA:this.mappingColumns.push({def:"topicFilter",title:"gateway.topic-filter"},{def:"QoS",title:"gateway.mqtt-qos"},{def:"converter",title:"gateway.payload-type"});break;case Na.REQUESTS:this.mappingColumns.push({def:"type",title:"gateway.type"},{def:"details",title:"gateway.details"});break;case Na.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||wl)(t.ɵɵdirectiveInject(Ne.TranslateService),t.ɵɵdirectiveInject(pe.MatDialog),t.ɵɵdirectiveInject(A.DialogService),t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:wl,selectors:[["tb-mapping-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(cl,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:ae,useExisting:i((()=>wl)),multi:!0},{provide:re,useExisting:i((()=>wl)),multi:!0}]),t.ɵɵStandaloneFeature],decls:40,vars:33,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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef",4,"ngFor","ngForOf"],["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"],[3,"matColumnDef"],["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,ml,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵtemplate(23,yl,3,1,"ng-container",14),t.ɵɵelementContainerStart(24,15),t.ɵɵtemplate(25,hl,1,0,"mat-header-cell",16)(26,vl,12,6,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,bl,1,0,"mat-header-row",18)(28,xl,1,0,"mat-row",19),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"section",20),t.ɵɵpipe(30,"async"),t.ɵɵelementStart(31,"button",21),t.ɵɵlistener("click",(function(a){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(a))})),t.ɵɵelementStart(32,"mat-icon",22),t.ɵɵtext(33,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"span"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(37,"span",23),t.ɵɵpipe(38,"async"),t.ɵɵtext(39," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,19,n.dataSource.isEmpty())),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,21,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,23,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,25,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.mappingColumns),t.ɵɵadvance(4),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(30,27,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,29,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(38,31,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(wl,[V,b,na,ll]),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",wl),qe([k()],wl.prototype,"required",void 0),qe([k()],wl.prototype,"withReportStrategy",void 0);class Cl extends N{constructor(){super()}}function Sl(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",7),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SecurityTypeTranslationsMap.get(e))," ")}}function El(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",17),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function Tl(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",10)(4,"mat-form-field",11),t.ɵɵelement(5,"input",12),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,El,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",8)(9,"div",9),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",14),t.ɵɵpipe(14,"translate"),t.ɵɵelementStart(15,"div",15),t.ɵɵelement(16,"tb-toggle-password",16),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,3,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,5,"gateway.set"))}}function Il(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 kl(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",17),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function Ml(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",8)(2,"div",9),t.ɵɵtext(3,"gateway.mode"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11)(6,"mat-select",24),t.ɵɵtemplate(7,Il,2,2,"mat-option",4),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(8,"div",8)(9,"div",9),t.ɵɵtext(10,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",12),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,kl,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8)(17,"div",9),t.ɵɵtext(18,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",10)(20,"mat-form-field",11),t.ɵɵelement(21,"input",14),t.ɵɵpipe(22,"translate"),t.ɵɵelementStart(23,"div",15),t.ɵɵelement(24,"tb-toggle-password",16),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",e.modeTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,6,"gateway.set"))}}function Pl(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",18),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",8)(4,"div",19),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",10)(8,"mat-form-field",11),t.ɵɵelement(9,"input",20),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",8)(12,"div",19),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"div",10)(16,"mat-form-field",11),t.ɵɵelement(17,"input",21),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",8)(20,"div",19),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"div",10)(24,"mat-form-field",11),t.ɵɵelement(25,"input",22),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(27,Ml,25,8,"ng-container",23)),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.ɵɵproperty("ngIf",e.extendCertificatesModel)}}e("MappingDatasource",Cl);class Fl{constructor(e,t){this.fb=e,this.cdr=t,this.title="gateway.security",this.extendCertificatesModel=!1,this.BrokerSecurityType=Ba,this.securityTypes=Object.values(Ba),this.modeTypes=Object.values(Ra),this.SecurityTypeTranslationsMap=Ga,this.destroy$=new me}ngOnInit(){this.securityFormGroup=this.fb.group({type:[Ba.ANONYMOUS,[]],username:["",[ne.required,ne.pattern($e)]],password:["",[ne.pattern($e)]],pathToCACert:["",[ne.pattern($e)]],pathToPrivateKey:["",[ne.pattern($e)]],pathToClientCert:["",[ne.pattern($e)]]}),this.extendCertificatesModel&&this.securityFormGroup.addControl("mode",this.fb.control(Ra.NONE,[])),this.securityFormGroup.valueChanges.pipe(be(this.destroy$)).subscribe((e=>{K(e),this.onChange(e),this.onTouched()})),this.securityFormGroup.get("type").valueChanges.pipe(be(this.destroy$)).subscribe((e=>this.updateValidators(e)))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){if(e)e.type||(e.type=Ba.ANONYMOUS),this.updateValidators(e.type),this.securityFormGroup.reset(e,{emitEvent:!1});else{const e={type:Ba.ANONYMOUS};this.securityFormGroup.reset(e,{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.securityFormGroup.get("type").value!==Ba.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===Ba.BASIC)this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1});else if(e===Ba.CERTIFICATES&&(this.securityFormGroup.get("pathToCACert").enable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").enable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").enable({emitEvent:!1}),this.extendCertificatesModel)){const e=this.securityFormGroup.get("mode");e&&!e.value&&e.setValue(Ra.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||Fl)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Fl,selectors:[["tb-security-config"]],inputs:{title:"title",extendCertificatesModel:"extendCertificatesModel"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Fl)),multi:!0},{provide:re,useExisting:i((()=>Fl)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,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",4,"ngFor","ngForOf"],[3,"ngSwitch"],[3,"ngSwitchCase"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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"],[4,"ngIf"],["formControlName","mode"]],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.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵtemplate(6,Sl,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵelementContainerStart(7,5),t.ɵɵtemplate(8,Tl,17,7,"ng-template",6)(9,Pl,28,22,"ng-template",6),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,n.title)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.BASIC),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.CERTIFICATES))},dependencies:t.ɵɵgetComponentDepsFactory(Fl,[V,b,na]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:o.OnPush})}}e("SecurityConfigComponent",Fl),qe([k()],Fl.prototype,"extendCertificatesModel",void 0);const Ol=()=>({min:1e3}),ql=()=>({min:50}),Bl=()=>({min:100});function Rl(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.server-url-required"))}function Nl(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.ɵɵpipeBind2(1,1,"gateway.timeout-error",t.ɵɵpureFunction0(4,Ol)))}function _l(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",20),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function Dl(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.ɵɵpipeBind2(1,1,"gateway.scan-period-error",t.ɵɵpureFunction0(4,Ol)))}function Vl(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.ɵɵpipeBind2(1,1,"gateway.poll-period-error",t.ɵɵpureFunction0(4,ql)))}function Gl(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",21),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,Vl,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.ɵɵproperty("ngIf",(e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("required")||e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("min"))&&e.serverConfigFormGroup.get("pollPeriodInMillis").touched)}}function Al(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.ɵɵpipeBind2(1,1,"gateway.sub-check-period-error",t.ɵɵpureFunction0(4,Bl)))}class jl{constructor(e){this.fb=e,this.hideNewFields=!1,this.securityPolicyTypes=Va,this.destroy$=new me,this.serverConfigFormGroup=this.fb.group({url:["",[ne.required,ne.pattern($e)]],timeoutInMillis:[1e3,[ne.required,ne.min(1e3)]],scanPeriodInMillis:[_,[ne.required,ne.min(1e3)]],pollPeriodInMillis:[5e3,[ne.required,ne.min(50)]],enableSubscriptions:[!0,[]],subCheckPeriodInMillis:[100,[ne.required,ne.min(100)]],showMap:[!1,[]],security:[Da.BASIC128,[]],identity:[]}),this.serverConfigFormGroup.valueChanges.pipe(be(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=_,pollPeriodInMillis:a=5e3,enableSubscriptions:r=!0,subCheckPeriodInMillis:i=100,showMap:o=!1,security:s=Da.BASIC128,identity:p={}}=e;this.serverConfigFormGroup.reset({...e,timeoutInMillis:t,scanPeriodInMillis:n,pollPeriodInMillis:a,enableSubscriptions:r,subCheckPeriodInMillis:i,showMap:o,security:s,identity:p},{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||jl)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:jl,selectors:[["tb-opc-server-config"]],inputs:{hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>jl)),multi:!0},{provide:re,useExisting:i((()=>jl)),multi:!0}]),t.ɵɵStandaloneFeature],decls:62,vars:56,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","class","tb-error",3,"matTooltip",4,"ngIf"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip",""],["matInput","","type","number","min","1000","name","value","formControlName","timeoutInMillis",3,"placeholder"],["formControlName","security"],[3,"value",4,"ngFor","ngForOf"],["matInput","","type","number","min","1000","name","value","formControlName","scanPeriodInMillis",3,"placeholder"],["class","tb-form-row column-xs",4,"ngIf"],["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,"extendCertificatesModel"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,Rl,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,Nl,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",1)(19,"div",6),t.ɵɵpipe(20,"translate"),t.ɵɵelementStart(21,"div",7),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"mat-form-field",3)(25,"mat-select",9),t.ɵɵtemplate(26,_l,2,2,"mat-option",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"div",1)(28,"div",6),t.ɵɵpipe(29,"translate"),t.ɵɵelementStart(30,"div",7),t.ɵɵtext(31),t.ɵɵpipe(32,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",3),t.ɵɵelement(34,"input",11),t.ɵɵpipe(35,"translate"),t.ɵɵtemplate(36,Dl,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵtemplate(37,Gl,10,10,"div",12),t.ɵɵelementStart(38,"div",1)(39,"div",6),t.ɵɵpipe(40,"translate"),t.ɵɵelementStart(41,"div",7),t.ɵɵtext(42),t.ɵɵpipe(43,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(44,"mat-form-field",3),t.ɵɵelement(45,"input",13),t.ɵɵpipe(46,"translate"),t.ɵɵtemplate(47,Al,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(48,"div",14)(49,"mat-slide-toggle",15)(50,"mat-label",16),t.ɵɵpipe(51,"translate"),t.ɵɵelementStart(52,"div",7),t.ɵɵtext(53),t.ɵɵpipe(54,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(55,"div",14)(56,"mat-slide-toggle",17)(57,"mat-label",16),t.ɵɵpipe(58,"translate"),t.ɵɵtext(59),t.ɵɵpipe(60,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelement(61,"tb-security-config",18),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.serverConfigFormGroup.get("url").hasError("required")&&n.serverConfigFormGroup.get("url").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,26,"gateway.hints.opc-timeout")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,28,"gateway.timeout")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,30,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("timeoutInMillis").hasError("required")||n.serverConfigFormGroup.get("timeoutInMillis").hasError("min"))&&n.serverConfigFormGroup.get("timeoutInMillis").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(20,32,"gateway.hints.security-policy")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,34,"gateway.security-policy")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.securityPolicyTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(29,36,"gateway.hints.scan-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(32,38,"gateway.scan-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,40,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("scanPeriodInMillis").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(40,42,"gateway.hints.sub-check-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(43,44,"gateway.sub-check-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(46,46,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("subCheckPeriodInMillis").touched),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(51,48,"gateway.hints.enable-subscription")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(54,50,"gateway.enable-subscription")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(58,52,"gateway.hints.show-map")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(60,54,"gateway.show-map")," "),t.ɵɵadvance(2),t.ɵɵproperty("extendCertificatesModel",!0))},dependencies:t.ɵɵgetComponentDepsFactory(jl,[V,b,Fl,na]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:o.OnPush})}}e("OpcServerConfigComponent",jl),qe([k()],jl.prototype,"hideNewFields",void 0);class Ll extends Ar{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Na,this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){return{server:e.server?Hr.mapServerToUpgradedVersion(e.server):{},mapping:e.server?.mapping?Hr.mapMappingToUpgradedVersion(e.server.mapping):[]}}getMappedValue(e){return{server:Hr.mapServerToDowngradedVersion(e)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(Ll)))(n||Ll)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:Ll,selectors:[["tb-opc-ua-legacy-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Ll)),multi:!0},{provide:re,useExisting:i((()=>Ll)),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(Ll,[V,b,Fl,wl,jl]),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",Ll),qe([k()],Ll.prototype,"withReportStrategy",void 0);class Ul extends Ar{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Na,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(Ul)))(n||Ul)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:Ul,selectors:[["tb-opc-ua-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Ul)),multi:!0},{provide:re,useExisting:i((()=>Ul)),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(Ul,[V,b,Fl,wl,jl]),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",Ul),qe([k()],Ul.prototype,"withReportStrategy",void 0);class $l extends Ar{constructor(){super(...arguments),this.withReportStrategy=!0,this.MappingType=Na}initBasicFormGroup(){return this.fb.group({mapping:[],requestsMapping:[],broker:[],workers:[]})}getRequestDataArray(e){const t=[];return Y(e)&&Object.keys(e).forEach((n=>{for(const a of e[n])t.push({requestType:n,requestValue:a})})),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($l)))(n||$l)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:$l,inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵInheritDefinitionFeature]})}}function zl(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.max-number-of-workers-required"))}function Kl(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.max-messages-queue-for-worker-required"))}e("MqttBasicConfigDirective",$l),qe([k()],$l.prototype,"withReportStrategy",void 0);class Hl{constructor(e){this.fb=e,this.destroy$=new me,this.workersConfigFormGroup=this.fb.group({maxNumberOfWorkers:[100,[ne.required,ne.min(1)]],maxMessageNumberPerWorker:[10,[ne.required,ne.min(1)]]}),this.workersConfigFormGroup.valueChanges.pipe(be(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||Hl)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Hl,selectors:[["tb-workers-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Hl)),multi:!0},{provide:re,useExisting:i((()=>Hl)),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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","name","value","type","number","min","1","formControlName","maxMessageNumberPerWorker",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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,zl,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,Kl,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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("min")||n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("required")&&n.workersConfigFormGroup.get("maxNumberOfWorkers").touched),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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("min")||n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("required")&&n.workersConfigFormGroup.get("maxMessageNumberPerWorker").touched))},dependencies:t.ɵɵgetComponentDepsFactory(Hl,[V,b,na]),encapsulation:2,changeDetection:o.OnPush})}}function Wl(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.host-required"))}function Ql(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",13),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 Jl(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.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function Yl(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",15),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",Hl);class Xl{constructor(e,t){this.fb=e,this.cdr=t,this.mqttVersions=ha,this.portLimits=Fa,this.destroy$=new me,this.brokerConfigFormGroup=this.fb.group({host:["",[ne.required,ne.pattern($e)]],port:[null,[ne.required,ne.min(Fa.MIN),ne.max(Fa.MAX)]],version:[5,[]],clientId:["tb_gw_"+X(5),[ne.pattern($e)]],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_"+X(5))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{version:t=5,clientId:n=`tb_gw_${X(5)}`,security:a={}}=e;this.brokerConfigFormGroup.reset({...e,version:t,clientId:n,security:a},{emitEvent:!1}),this.cdr.markForCheck()}validate(){return this.brokerConfigFormGroup.valid?null:{brokerConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||Xl)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Xl,selectors:[["tb-broker-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Xl)),multi:!0},{provide:re,useExisting:i((()=>Xl)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:16,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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["formControlName","version"],[3,"value",4,"ngFor","ngForOf"],["matInput","","name","value","formControlName","clientId",3,"placeholder"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip","click",4,"ngIf"],["formControlName","security"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,Wl,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,Ql,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.ɵɵtemplate(20,Jl,2,2,"mat-option",9),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",1)(22,"div",7),t.ɵɵtext(23,"gateway.client-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",3),t.ɵɵelement(25,"input",10),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,Yl,4,3,"button",11),t.ɵɵelementEnd()(),t.ɵɵelement(28,"tb-security-config",12),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.brokerConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,10,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.brokerConfigFormGroup.get("host").hasError("required")&&n.brokerConfigFormGroup.get("host").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.brokerConfigFormGroup.get("port").hasError("required")||n.brokerConfigFormGroup.get("port").hasError("min")||n.brokerConfigFormGroup.get("port").hasError("max"))&&n.brokerConfigFormGroup.get("port").touched),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.mqttVersions),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!n.brokerConfigFormGroup.get("clientId").value))},dependencies:t.ɵɵgetComponentDepsFactory(Xl,[V,b,Fl,ns]),encapsulation:2,changeDetection:o.OnPush})}}e("BrokerConfigControlComponent",Xl);class Zl extends $l{mapConfigToFormValue(e){const{broker:t,mapping:n=[],requestsMapping:a}=e;return{workers:t&&(t.maxNumberOfWorkers||t.maxMessageNumberPerWorker)?{maxNumberOfWorkers:t.maxNumberOfWorkers,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker}:{},mapping:n??[],broker:t??{},requestsMapping:this.getRequestDataArray(a)}}getMappedValue(e){const{broker:t,workers:n,mapping:a,requestsMapping:r}=e||{};return{broker:this.getBrokerMappedValue(t,n),mapping:a,requestsMapping:r?.length?this.getRequestDataObject(r):{}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(Zl)))(n||Zl)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:Zl,selectors:[["tb-mqtt-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Zl)),multi:!0},{provide:re,useExisting:i((()=>Zl)),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(Zl,[V,b,Fl,Hl,Xl,wl]),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",Zl);class ec extends $l{mapConfigToFormValue(e){const{broker:t,mapping:n=[],connectRequests:a=[],disconnectRequests:r=[],attributeRequests:i=[],attributeUpdates:o=[],serverSideRpc:s=[]}=e,p=Br.mapRequestsToUpgradedVersion({connectRequests:a,disconnectRequests:r,attributeRequests:i,attributeUpdates:o,serverSideRpc:s});return{workers:t&&(t.maxNumberOfWorkers||t.maxMessageNumberPerWorker)?{maxNumberOfWorkers:t.maxNumberOfWorkers,maxMessageNumberPerWorker:t.maxMessageNumberPerWorker}:{},mapping:Br.mapMappingToUpgradedVersion(n)||[],broker:t||{},requestsMapping:this.getRequestDataArray(p)}}getMappedValue(e){const{broker:t,workers:n,mapping:a,requestsMapping:r}=e||{},i=r?.length?this.getRequestDataObject(r):{};return{broker:this.getBrokerMappedValue(t,n),mapping:Br.mapMappingToDowngradedVersion(a),...Br.mapRequestsToDowngradedVersion(i)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(ec)))(n||ec)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:ec,selectors:[["tb-mqtt-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>ec)),multi:!0},{provide:re,useExisting:i((()=>ec)),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(ec,[V,b,Fl,Hl,Xl,wl]),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",ec);class tc extends I{constructor(e,t,n,a,r){super(t,n,r),this.fb=e,this.store=t,this.router=n,this.data=a,this.dialogRef=r,this.portLimits=Fa,this.modbusProtocolTypes=Object.values(Ya),this.modbusMethodTypes=Object.values(Xa),this.modbusSerialMethodTypes=Object.values(Za),this.modbusParities=Object.values(er),this.modbusByteSizes=ir,this.modbusBaudrates=rr,this.modbusOrderType=Object.values(tr),this.ModbusProtocolType=Ya,this.ModbusParityLabelsMap=dr,this.ModbusProtocolLabelsMap=cr,this.ModbusMethodLabelsMap=lr,this.ReportStrategyDefaultValue=Vt,this.modbusHelpLink=q+"/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 me,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&&!U(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:[Ya.TCP],host:["",[ne.required,ne.pattern($e)]],port:[null,[ne.required,ne.min(Fa.MIN),ne.max(Fa.MAX)]],serialPort:["",[ne.required,ne.pattern($e)]],method:[Xa.SOCKET,[ne.required]],baudrate:[this.modbusBaudrates[0]],stopbits:[1],bytesize:[ir[0]],parity:[er.None],strict:[!0],unitId:[null,[ne.required]],deviceName:["",[ne.required,ne.pattern($e)]],deviceType:["",[ne.required,ne.pattern($e)]],timeout:[35],byteOrder:[tr.BIG],wordOrder:[tr.BIG],retries:[!0],retryOnEmpty:[!0],retryOnInvalid:[!0],pollPeriod:[5e3,[ne.required]],connectAttemptTimeMs:[5e3,[ne.required]],connectAttemptCount:[5,[ne.required]],waitAfterFailedAttemptsMs:[3e5,[ne.required]],values:[{}],security:[{}]}),this.addFieldsToFormGroup()}updateSlaveFormGroup(){this.slaveConfigFormGroup.patchValue({...this.data.value,port:this.data.value.type===Ya.Serial?null:this.data.value.port,serialPort:this.data.value.type===Ya.Serial?this.data.value.port:"",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(be(this.destroy$)).subscribe((e=>{this.updateControlsEnabling(e),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Xa.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Ya.Serial?Za.ASCII:Xa.SOCKET,{emitEvent:!1})}updateControlsEnabling(e){const[t,n]=e===Ya.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(be(this.destroy$)).subscribe((e=>this.updateSecurityEnabling(e)))}updateSecurityEnabling(e){e&&this.protocolType!==Ya.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||tc)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef))}}static{this.ɵdir=t.ɵɵdefineDirective({type:tc,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusSlaveDialogAbstract",tc);const nc=()=>({maxWidth:"970px"});function ac(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),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 rc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"span",23),t.ɵɵtext(5),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",24),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"span",25),t.ɵɵtext(10),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",24),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"span",25),t.ɵɵtext(15),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(3,6,"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 ic(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",44),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function oc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",45),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function sc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",45),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(5);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.ModbusFunctionCodeTranslationsMap.get(e))," ")}}function pc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",35),t.ɵɵtext(2,"gateway.function-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32)(4,"mat-select",46),t.ɵɵtemplate(5,sc,3,4,"mat-option",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.functionCodesMap.get(e.get("id").value)||n.defaultFunctionCodes)}}function lc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",44),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.objects-count-required"))}function cc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",44),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 dc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",47),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",48),t.ɵɵelement(5,"input",49),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,cc,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("bit").hasError("max")&&e.get("bit").touched)}}function mc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",45),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(6);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,a.BitTargetTypeTranslationMap.get(e)))}}function uc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",47),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit-target-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",50)(5,"mat-form-field",51)(6,"mat-select",52),t.ɵɵtemplate(7,mc,3,4,"mat-option",37),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.bit-target-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.bitTargetTypes)}}function gc(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,dc,8,7,"div",38)(2,uc,8,4,"div",38),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("objectsCount").value>1),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields)}}function yc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",44),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function hc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",45),t.ɵɵelement(1,"mat-icon",61),t.ɵɵelementStart(2,"span"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(5);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("svgIcon",a.ModifierTypesMap.get(e).icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,a.ModifierTypesMap.get(e).name))}}function fc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",44),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.modifier-invalid"))}function vc(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",53)(1,"mat-expansion-panel",15)(2,"mat-expansion-panel-header",16)(3,"mat-panel-title")(4,"mat-slide-toggle",54),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label",55),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",50)(10,"div",56)(11,"div",35),t.ɵɵtext(12,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",51)(14,"mat-select",57)(15,"mat-select-trigger")(16,"div",58),t.ɵɵelement(17,"mat-icon",59),t.ɵɵelementStart(18,"span"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(21,hc,5,5,"mat-option",37),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(22,"div",30)(23,"div",35),t.ɵɵtext(24,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",48),t.ɵɵelement(26,"input",60),t.ɵɵpipe(27,"translate"),t.ɵɵtemplate(28,fc,3,3,"mat-icon",34),t.ɵɵelementEnd()()()()}if(2&e){let e,n;const a=t.ɵɵnextContext(2).$implicit,r=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("expanded",r.enableModifiersControlMap.get(a.get("id").value).value),t.ɵɵadvance(3),t.ɵɵproperty("formControl",r.enableModifiersControlMap.get(a.get("id").value)),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,9,"gateway.hints.modbus.modifier")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,11,"gateway.modifier")," "),t.ɵɵadvance(10),t.ɵɵproperty("svgIcon",null==(e=r.ModifierTypesMap.get(a.get("modifierType").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,13,null==(n=r.ModifierTypesMap.get(a.get("modifierType").value))?null:n.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",r.modifierTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(27,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",a.get("modifierValue").hasError("pattern")&&a.get("modifierValue").touched)}}function bc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",44),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function xc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",62),t.ɵɵtext(2,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32),t.ɵɵelement(4,"input",63),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,bc,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function wc(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",64),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Key)("isExpansionMode",!0)}}function Cc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",26),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelement(3,"div",27),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",28)(5,"div",29),t.ɵɵtext(6,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",30)(8,"div",31),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10," gateway.key "),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",32),t.ɵɵelement(12,"input",33),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,ic,3,3,"mat-icon",34),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",28)(16,"div",29),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",30)(19,"div",35),t.ɵɵtext(20," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",32)(22,"mat-select",36),t.ɵɵtemplate(23,oc,2,2,"mat-option",37),t.ɵɵelementEnd()()(),t.ɵɵtemplate(24,pc,6,1,"div",38),t.ɵɵelementStart(25,"div",30)(26,"div",31),t.ɵɵpipe(27,"translate"),t.ɵɵtext(28,"gateway.objects-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-form-field",32),t.ɵɵelement(30,"input",39),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,lc,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(33,gc,3,2,"ng-container",40),t.ɵɵelementStart(34,"div",30)(35,"div",31),t.ɵɵpipe(36,"translate"),t.ɵɵtext(37,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field",32),t.ɵɵelement(39,"input",41),t.ɵɵpipe(40,"translate"),t.ɵɵtemplate(41,yc,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(42,vc,29,17,"div",42)(43,xc,7,4,"div",38)(44,wc,1,2,"tb-report-strategy",43),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(33,nc)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(9,21,"gateway.hints.modbus.key")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,23,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("tag").hasError("required")&&e.get("tag").touched),t.ɵɵadvance(9),t.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withFunctionCode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(27,25,"gateway.hints.modbus.objects-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(31,27,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(e.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("objectsCount").hasError("required")&&e.get("objectsCount").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("type").value===n.ModbusDataType.BITS&&!n.isMaster),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(36,29,"gateway.hints.modbus.address")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(40,31,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("address").hasError("required")&&e.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.showModifiersMap.get(e.get("id").value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy)}}function Sc(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,ac,2,3,"div",17)(7,rc,16,12,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,Cc,45,34,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).index,r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.deleteKey(n,a))})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,a=n.last,r=t.ɵɵreference(8),i=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",a),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",i.isMaster)("ngIfElse",r),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,i.deleteKeyTitle))}}function Ec(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,Sc,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByControlId)}}function Tc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",65)(1,"span",66),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class Ic{constructor(e){this.fb=e,this.isMaster=!1,this.hideNewFields=!1,this.keysDataApplied=new r,this.withFunctionCode=!0,this.withReportStrategy=!0,this.enableModifiersControlMap=new Map,this.showModifiersMap=new Map,this.functionCodesMap=new Map,this.defaultFunctionCodes=[],this.modbusDataTypes=Object.values(Ft),this.modifierTypes=Object.values(hr),this.bitTargetTypes=Object.values(sr),this.BitTargetTypeTranslationMap=pr,this.ModbusEditableDataTypes=Ot,this.ModbusFunctionCodeTranslationsMap=Nt,this.ModifierTypesMap=fr,this.ReportStrategyDefaultValue=Vt,this.ModbusDataType=Ft,this.destroy$=new me,this.defaultReadFunctionCodes=[3,4],this.bitsReadFunctionCodes=[1,2],this.defaultWriteFunctionCodes=[6,16],this.bitsWriteFunctionCodes=[5,15]}ngOnInit(){this.withFunctionCode=!this.isMaster||this.keysType!==ar.ATTRIBUTES&&this.keysType!==ar.TIMESERIES,this.withReportStrategy=!(this.isMaster||this.keysType!==ar.ATTRIBUTES&&this.keysType!==ar.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=X(5),t=this.fb.group({tag:["",[ne.required,ne.pattern($e)]],value:[{value:"",disabled:!this.isMaster},[ne.required,ne.pattern($e)]],type:[Ft.BYTES,[ne.required]],address:[null,[ne.required]],objectsCount:[1,[ne.required]],functionCode:[{value:this.getDefaultFunctionCodes()[0],disabled:!this.withFunctionCode},[ne.required]],reportStrategy:[{value:null,disabled:!this.withReportStrategy}],modifierType:[{value:hr.MULTIPLIER,disabled:!0}],modifierValue:[{value:1,disabled:!0},[ne.pattern(Ke)]],bit:[{value:null,disabled:!0}],bitTargetType:[{value:sr.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,...a}=e;return t?{...a,[t]:n}:a}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:a,address:r,objectsCount:i,functionCode:o,multiplier:s,divider:p,reportStrategy:l,bit:c,bitTargetType:d}=e,m=X(5),u=this.shouldShowModifier(a);return this.showModifiersMap.set(m,u),this.enableModifiersControlMap.set(m,this.fb.control((s||p)&&u)),this.fb.group({tag:[t,[ne.required,ne.pattern($e)]],value:[{value:n,disabled:!this.isMaster},[ne.required,ne.pattern($e)]],type:[a,[ne.required]],address:[r,[ne.required]],objectsCount:[i,[ne.required]],functionCode:[{value:o,disabled:!this.withFunctionCode},[ne.required]],modifierType:[{value:p?hr.DIVIDER:hr.MULTIPLIER,disabled:!this.enableModifiersControlMap.get(m).value}],bit:[{value:c,disabled:a!==Ft.BITS||i<2},[ne.max(i-1)]],bitTargetType:[{value:d??sr.IntegerType,disabled:a!==Ft.BITS||this.hideNewFields}],modifierValue:[{value:s??p??1,disabled:!this.enableModifiersControlMap.get(m).value},[ne.pattern(Ke)]],id:[{value:m,disabled:!0}],reportStrategy:[{value:l,disabled:!this.withReportStrategy}]})}shouldShowModifier(e){return!(this.isMaster||this.keysType!==ar.ATTRIBUTES&&this.keysType!==ar.TIMESERIES||this.ModbusEditableDataTypes.includes(e))}observeKeyDataType(e){e.get("type").valueChanges.pipe(be(this.destroy$)).subscribe((t=>{this.ModbusEditableDataTypes.includes(t)||e.get("objectsCount").patchValue(qt[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(xe((()=>e.get("type").value===Ft.BITS)),be(this.destroy$)).subscribe((()=>this.toggleBitsFields(e)))}toggleBitsFields(e){const{objectsCount:t,type:n,bit:a,bitTargetType:r}=e.controls,i=n.value===Ft.BITS,o=t.value>1;i&&o?(a.enable({emitEvent:!1}),a.setValidators(ne.max(t.value-1))):a.disable({emitEvent:!1}),a.updateValueAndValidity({emitEvent:!1}),r[i?"enable":"disable"]({emitEvent:!1})}observeEnableModifier(e){this.enableModifiersControlMap.get(e.get("id").value).valueChanges.pipe(be(this.destroy$)).subscribe((t=>this.toggleModifierControls(e,t)))}toggleModifierControls(e,t){const n=e.get("modifierType"),a=e.get("modifierValue");t?(n.enable(),a.enable()):(n.disable(),a.disable())}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===Ft.BITS?this.bitsWriteFunctionCodes:[],...this.defaultWriteFunctionCodes];if(this.keysType===ar.ATTRIBUTES_UPDATES)return t.sort(((e,t)=>e-t));const n=[...this.defaultReadFunctionCodes];return e===Ft.BITS&&n.push(...this.bitsReadFunctionCodes),this.keysType===ar.RPC_REQUESTS&&n.push(...t),n.sort(((e,t)=>e-t))}getDefaultFunctionCodes(){return this.keysType===ar.ATTRIBUTES_UPDATES?this.defaultWriteFunctionCodes:this.keysType===ar.RPC_REQUESTS?[...this.defaultReadFunctionCodes,...this.defaultWriteFunctionCodes]:this.defaultReadFunctionCodes}static{this.ɵfac=function(e){return new(e||Ic)(t.ɵɵdirectiveInject(te.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Ic,selectors:[["tb-modbus-data-keys-panel"]],inputs:{isMaster:"isMaster",hideNewFields:"hideNewFields",panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keysType:"keysType",values:"values",popover:"popover"},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:19,vars:16,consts:[["noKeys",""],["tagName",""],[1,"tb-modbus-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container","tbTruncateWithTooltip","",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["tbTruncateWithTooltip","",1,"title-container"],[1,"tb-flex"],[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",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"],["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","tag",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],[4,"ngIf"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"defaultValue","isExpansionMode",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,"tb-form-panel","stroked","tb-slide-toggle"],[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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,Ec,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,Tc,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(Ic,[V,b,as,ma,na]),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: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",Ic),qe([k()],Ic.prototype,"isMaster",void 0),qe([k()],Ic.prototype,"hideNewFields",void 0);const kc=()=>({$implicit:null}),Mc=e=>({$implicit:e});function Pc(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7),t.ɵɵelementContainer(2,8),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(4);t.ɵɵadvance(),t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",n)("ngTemplateOutletContext",t.ɵɵpureFunction0(3,kc))}}function Fc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab",11),t.ɵɵpipe(1,"translate"),t.ɵɵelementStart(2,"div",7),t.ɵɵelementContainer(3,8),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2),r=t.ɵɵreference(4);t.ɵɵpropertyInterpolate("label",t.ɵɵpipeBind1(1,4,a.ModbusValuesTranslationsMap.get(e))),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",a.valuesFormGroup.get(e)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",r)("ngTemplateOutletContext",t.ɵɵpureFunction1(6,Mc,e))}}function Oc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group",9),t.ɵɵtemplate(1,Fc,4,8,"mat-tab",10),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.modbusRegisterTypes)}}function qc(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 Bc(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 Rc(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 Nc(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 _c(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵtext(2,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",14)(4,"mat-chip-listbox",15),t.ɵɵtemplate(5,qc,2,1,"mat-chip",16),t.ɵɵelementStart(6,"mat-chip",17),t.ɵɵelement(7,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",19,2),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵreference(9),i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageKeys(n,r,i.ModbusValueKey.ATTRIBUTES,a))})),t.ɵɵelementStart(11,"tb-icon",20),t.ɵɵtext(12,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(13,"div",12)(14,"div",13),t.ɵɵtext(15,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-chip-listbox",15),t.ɵɵtemplate(18,Bc,2,1,"mat-chip",16),t.ɵɵelementStart(19,"mat-chip",17),t.ɵɵelement(20,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(21,"button",19,3),t.ɵɵpipe(23,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵreference(22),i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageKeys(n,r,i.ModbusValueKey.TIMESERIES,a))})),t.ɵɵelementStart(24,"tb-icon",20),t.ɵɵtext(25,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(26,"div",12)(27,"div",13),t.ɵɵtext(28,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",14)(30,"mat-chip-listbox",15),t.ɵɵtemplate(31,Rc,2,1,"mat-chip",16),t.ɵɵelementStart(32,"mat-chip",17),t.ɵɵelement(33,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"button",19,4),t.ɵɵpipe(36,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵreference(35),i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageKeys(n,r,i.ModbusValueKey.ATTRIBUTES_UPDATES,a))})),t.ɵɵelementStart(37,"tb-icon",20),t.ɵɵtext(38,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(39,"div",12)(40,"div",13),t.ɵɵtext(41,"gateway.rpc-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",14)(43,"mat-chip-listbox",15),t.ɵɵtemplate(44,Nc,2,1,"mat-chip",16),t.ɵɵelementStart(45,"mat-chip",17),t.ɵɵelement(46,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"button",19,5),t.ɵɵpipe(49,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵreference(48),i=t.ɵɵnextContext();return t.ɵɵresetView(i.manageKeys(n,r,i.ModbusValueKey.RPC_REQUESTS,a))})),t.ɵɵelementStart(50,"tb-icon",20),t.ɵɵtext(51,"edit"),t.ɵɵelementEnd()()()()}if(2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("tbEllipsisChipList",a.getValueGroup(a.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",a.getValueGroup(a.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,16,"action.edit")),t.ɵɵproperty("disabled",a.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",a.getValueGroup(a.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",a.getValueGroup(a.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(23,18,"action.edit")),t.ɵɵproperty("disabled",a.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",a.getValueGroup(a.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",a.getValueGroup(a.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(36,20,"action.edit")),t.ɵɵproperty("disabled",a.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",a.getValueGroup(a.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",a.getValueGroup(a.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,22,"action.edit")),t.ɵɵproperty("disabled",a.disabled)}}class Dc{constructor(e,t,n,a,r){this.fb=e,this.popoverService=t,this.renderer=n,this.viewContainerRef=a,this.cdr=r,this.singleMode=!1,this.hideNewFields=!1,this.disabled=!1,this.modbusRegisterTypes=Object.values(nr),this.modbusValueKeys=Object.values(ar),this.ModbusValuesTranslationsMap=or,this.ModbusValueKey=ar,this.destroy$=new me}ngOnInit(){this.initializeValuesFormGroup(),this.observeValuesChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){if(this.singleMode)this.valuesFormGroup.setValue(this.getSingleRegisterState(e),{emitEvent:!1});else{const{holding_registers:t,coils_initializer:n,input_registers:a,discrete_inputs:r}=e;this.valuesFormGroup.setValue({holding_registers:this.getSingleRegisterState(t),coils_initializer:this.getSingleRegisterState(n),input_registers:this.getSingleRegisterState(a),discrete_inputs:this.getSingleRegisterState(r)},{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,a){e.stopPropagation();const r=t._elementRef.nativeElement;if(this.popoverService.hasPopover(r))return void this.popoverService.hidePopover(r);const i=this.getValueGroup(n,a),o={values:i.value,isMaster:!this.singleMode,keysType:n,panelTitle:mr.get(n),addKeyTitle:ur.get(n),deleteKeyTitle:gr.get(n),noKeysText:yr.get(n),hideNewFields:this.hideNewFields},s=this.popoverService.displayPopover(r,this.renderer,this.viewContainerRef,Ic,"leftBottom",!1,null,o,{},{},{},!0);s.tbComponentRef.instance.popover=s,s.tbComponentRef.instance.keysDataApplied.pipe(be(this.destroy$)).subscribe((e=>{s.hide(),i.patchValue(e),i.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(be(this.destroy$)).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||Dc)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(je.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Dc,selectors:[["tb-modbus-values"]],inputs:{singleMode:"singleMode",hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Dc)),multi:!0},{provide:re,useExisting:i((()=>Dc)),multi:!0}]),t.ɵɵStandaloneFeature],decls:5,vars:2,consts:[["multipleView",""],["singleView",""],["attributesButton",""],["telemetryButton",""],["attributesUpdatesButton",""],["rpcRequestsButton",""],[4,"ngIf","ngIfElse"],[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"formGroup"],[3,"label",4,"ngFor","ngForOf"],[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"],[4,"ngFor","ngForOf"],[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){if(1&e&&t.ɵɵtemplate(0,Pc,3,4,"ng-container",6)(1,Oc,2,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(3,_c,52,24,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2);t.ɵɵproperty("ngIf",n.singleMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(Dc,[V,b,aa]),styles:['@charset "UTF-8";[_nghost-%COMP%] .mat-mdc-tab-body-wrapper{min-height:320px} .mdc-evolution-chip-set__chips{align-items:center}'],changeDetection:o.OnPush})}}function Vc(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",16),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function Gc(e,n){1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-slide-toggle",18)(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",Dc),qe([k()],Dc.prototype,"singleMode",void 0),qe([k()],Dc.prototype,"hideNewFields",void 0);class Ac{constructor(e,t){this.fb=e,this.cdr=t,this.isMaster=!1,this.disabled=!1,this.destroy$=new me,this.securityConfigFormGroup=this.fb.group({certfile:["",[ne.pattern($e)]],keyfile:["",[ne.pattern($e)]],password:["",[ne.pattern($e)]],server_hostname:["",[ne.pattern($e)]],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:a,server_hostname:r}=e,i={certfile:t??"",password:n??"",keyfile:a??"",server_hostname:r??"",reqclicert:!!e.reqclicert};this.securityConfigFormGroup.reset(i,{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(be(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}static{this.ɵfac=function(e){return new(e||Ac)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Ac,selectors:[["tb-modbus-security-config"]],inputs:{isMaster:"isMaster"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Ac)),multi:!0},{provide:re,useExisting:i((()=>Ac)),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","formControlName","certfile",3,"placeholder"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","keyfile",3,"placeholder"],["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"],["class","tb-form-row space-between tb-flex fill-width",4,"ngIf"],["class","tb-form-row",4,"ngIf"],["matInput","","name","value","formControlName","server_hostname",3,"placeholder"],[1,"tb-form-row"],["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,Vc,7,3,"div",14)(32,Gc,5,3,"div",15),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.ɵɵproperty("ngIf",!n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster))},dependencies:t.ɵɵgetComponentDepsFactory(Ac,[V,b,na]),encapsulation:2,changeDetection:o.OnPush})}}function jc(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusProtocolLabelsMap.get(e))}}function Lc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function Uc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Lc,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function $c(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 zc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,$c,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function Kc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function Hc(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Kc,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function Wc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusMethodLabelsMap.get(e))}}function Qc(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 Jc(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 Yc(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusParityLabelsMap.get(e))}}function Xc(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,Qc,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,Jc,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,Yc,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function Zc(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function ed(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function td(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function nd(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 ad(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function rd(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 id(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 od(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",Ac),qe([k()],Ac.prototype,"isMaster",void 0);class sd extends tc{constructor(e,t,n,a,r){super(e,t,n,a,r),this.fb=e,this.store=t,this.router=n,this.data=a,this.dialogRef=r}getSlaveResultData(){const{values:e,type:t,serialPort:n,...a}=this.slaveConfigFormGroup.value,r={...a,type:t,...e};return t===Ya.Serial&&(r.port=n),r.reportStrategy||delete r.reportStrategy,K(r),r}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("reportStrategy",this.fb.control(null))}static{this.ɵfac=function(e){return new(e||sd)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:sd,selectors:[["tb-modbus-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["formControlName","retryOnInvalid",1,"mat-slide"],[1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","0","name","value","formControlName","pollPeriod",3,"placeholder"],["translate","",1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","connectAttemptTimeMs",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","connectAttemptCount",3,"placeholder"],["matInput","","type","number","min","0","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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,jc,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,Uc,8,7,"div",15)(20,zc,8,9,"div",16)(21,Hc,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,Wc,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,Xc,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,Zc,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,ed,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,td,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,nd,5,3,"div",28)(54,ad,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,rd,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,id,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,od,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),a=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",a),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(sd,[V,b,Dc,Ac,ns,ma,na]),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 pd(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusProtocolLabelsMap.get(e))}}function ld(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function cd(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,ld,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function dd(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 md(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,dd,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function ud(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function gd(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,ud,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function yd(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusMethodLabelsMap.get(e))}}function hd(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 fd(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 vd(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusParityLabelsMap.get(e))}}function bd(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,hd,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,fd,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,vd,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function xd(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function wd(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function Cd(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function Sd(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 Ed(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function Td(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 Id(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 kd(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",sd);class Md extends tc{constructor(e,t,n,a,r){super(e,t,n,a,r),this.fb=e,this.store=t,this.router=n,this.data=a,this.dialogRef=r}getSlaveResultData(){const{values:e,type:t,serialPort:n,...a}=this.slaveConfigFormGroup.value,r={...a,type:t,...e};return t===Ya.Serial&&(r.port=n),K(r),r}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("sendDataOnlyOnChange",this.fb.control(!1))}static{this.ɵfac=function(e){return new(e||Md)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Md,selectors:[["tb-modbus-legacy-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["formControlName","retryOnInvalid",1,"mat-slide"],[1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["tbTruncateWithTooltip","","translate",""],["matInput","","type","number","min","0","name","value","formControlName","pollPeriod",3,"placeholder"],["translate","",1,"fixed-title-width-260","tb-required",3,"tb-hint-tooltip-icon"],["matInput","","type","number","min","0","name","value","formControlName","connectAttemptTimeMs",3,"placeholder"],["matInput","","type","number","min","0","name","value","formControlName","connectAttemptCount",3,"placeholder"],["matInput","","type","number","min","0","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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,pd,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,cd,8,7,"div",15)(20,md,8,9,"div",16)(21,gd,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,yd,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,bd,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,xd,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,wd,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,Cd,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,Sd,5,3,"div",28)(54,Ed,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,Td,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,Id,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,kd,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),a=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",a),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(Md,[V,b,Dc,Ac,ns,ma]),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 Pd(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusProtocolLabelsMap.get(e))}}function Fd(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.host-required"))}function Od(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",39),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Fd,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function qd(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",40),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 Bd(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",41),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,qd,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function Rd(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.port-required"))}function Nd(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",42),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Rd,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched)}}function _d(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.ModbusMethodLabelsMap.get(e))}}function Dd(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.unit-id-required"))}function Vd(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-required"))}function Gd(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-profile-required"))}function Ad(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.ɵɵtextInterpolate(e)}}function jd(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12)(5,"mat-select",43),t.ɵɵtemplate(6,Ad,2,2,"mat-option",6),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates)}}function Ld(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.ɵɵtextInterpolate(e)}}function Ud(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.ɵɵtextInterpolate(e)}}function $d(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",44)(1,"mat-expansion-panel",45)(2,"mat-expansion-panel-header",46)(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"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",48),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",Md);class zd{constructor(e){this.fb=e,this.ModbusProtocolLabelsMap=cr,this.ModbusMethodLabelsMap=lr,this.portLimits=Fa,this.modbusProtocolTypes=Object.values(Ya),this.modbusMethodTypes=Object.values(Xa),this.modbusSerialMethodTypes=Object.values(Za),this.modbusOrderType=Object.values(tr),this.ModbusProtocolType=Ya,this.modbusBaudrates=rr,this.isSlaveEnabled=!1,this.serialSpecificControlKeys=["serialPort","baudrate"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new me,this.showSecurityControl=this.fb.control(!1),this.slaveConfigFormGroup=this.fb.group({type:[Ya.TCP],host:["",[ne.required,ne.pattern($e)]],port:[null,[ne.required,ne.min(Fa.MIN),ne.max(Fa.MAX)]],serialPort:["",[ne.required,ne.pattern($e)]],method:[Xa.SOCKET],unitId:[null,[ne.required]],baudrate:[this.modbusBaudrates[0]],deviceName:["",[ne.required,ne.pattern($e)]],deviceType:["",[ne.required,ne.pattern($e)]],pollPeriod:[5e3,[ne.required]],sendDataToThingsBoard:[!1],byteOrder:[tr.BIG],wordOrder:[tr.BIG],security:[],identity:this.fb.group({vendorName:["",[ne.pattern($e)]],productCode:["",[ne.pattern($e)]],vendorUrl:["",[ne.pattern($e)]],productName:["",[ne.pattern($e)]],modelName:["",[ne.pattern($e)]]}),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&&!U(e.security,{})),this.updateSlaveConfig(e)}setDisabledState(e){this.isSlaveEnabled=!e,this.updateFormEnableState()}observeValueChanges(){this.slaveConfigFormGroup.valueChanges.pipe(be(this.destroy$)).subscribe((e=>{e.type===Ya.Serial&&(e.port=e.serialPort,delete e.serialPort),this.onChange(e),this.onTouched()}))}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(be(this.destroy$)).subscribe((e=>{this.updateFormEnableState(),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Xa.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Ya.Serial?Za.ASCII:Xa.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(be(this.destroy$)).subscribe((e=>this.updateSecurityEnable(e)))}updateSecurityEnable(e){e&&this.isSlaveEnabled&&this.protocolType!==Ya.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}updateEnablingByProtocol(){const e=this.protocolType===Ya.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:a="",productName:r="",modelName:i=""}=e.identity??{},o={vendorName:t,productCode:n,vendorUrl:a,productName:r,modelName:i},{type:s=Ya.TCP,method:p=Xa.RTU,unitId:l=0,deviceName:c="",deviceType:d="",pollPeriod:m=5e3,sendDataToThingsBoard:u=!1,byteOrder:g=tr.BIG,wordOrder:y=tr.BIG,security:h={},values:f={},baudrate:v=this.modbusBaudrates[0],host:b="",port:x=null}=e,w={type:s,method:p,unitId:l,deviceName:c,deviceType:d,pollPeriod:m,sendDataToThingsBoard:!!u,byteOrder:g,wordOrder:y,security:h,identity:o,values:f,baudrate:v,host:s===Ya.Serial?"":b,port:s===Ya.Serial?null:x,serialPort:s===Ya.Serial?x:""};this.slaveConfigFormGroup.setValue(w,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||zd)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:zd,selectors:[["tb-modbus-slave-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>zd)),multi:!0},{provide:re,useExisting:i((()=>zd)),multi:!0}]),t.ɵɵStandaloneFeature],decls:112,vars:59,consts:[["serialPort",""],[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",4,"ngFor","ngForOf"],[1,"tb-form-panel","no-border","no-padding","padding-top"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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","0","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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[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"],[3,"value"],["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-form-panel","stroked","tb-slide-toggle"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],["formControlName","security"]],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.server-slave-config"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",5),t.ɵɵtemplate(6,Pd,2,2,"tb-toggle-option",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",7),t.ɵɵtemplate(8,Od,8,7,"div",8)(9,Bd,8,9,"div",9)(10,Nd,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",10)(13,"div",11),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-form-field",12)(17,"mat-select",13),t.ɵɵtemplate(18,_d,2,2,"mat-option",6),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",10)(20,"div",14),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",12),t.ɵɵelement(24,"input",15),t.ɵɵpipe(25,"translate"),t.ɵɵtemplate(26,Dd,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(27,"div",10)(28,"div",17),t.ɵɵtext(29,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",12),t.ɵɵelement(31,"input",18),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,Vd,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",10)(35,"div",17),t.ɵɵtext(36,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",12),t.ɵɵelement(38,"input",19),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,Gd,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(41,"div",10)(42,"div",20),t.ɵɵpipe(43,"translate"),t.ɵɵelementStart(44,"span",21),t.ɵɵtext(45," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",12),t.ɵɵelement(47,"input",22),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(49,jd,7,4,"div",8),t.ɵɵelementStart(50,"div",23)(51,"mat-slide-toggle",24)(52,"mat-label"),t.ɵɵtext(53),t.ɵɵpipe(54,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(55,"div",25)(56,"mat-expansion-panel",26)(57,"mat-expansion-panel-header")(58,"mat-panel-title")(59,"div",27),t.ɵɵtext(60,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(61,"div",7)(62,"div",10)(63,"div",11),t.ɵɵpipe(64,"translate"),t.ɵɵtext(65,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(66,"mat-form-field",12)(67,"mat-select",28),t.ɵɵtemplate(68,Ld,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵelementStart(69,"div",10)(70,"div",11),t.ɵɵpipe(71,"translate"),t.ɵɵtext(72,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(73,"mat-form-field",12)(74,"mat-select",29),t.ɵɵtemplate(75,Ud,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵtemplate(76,$d,9,5,"div",30),t.ɵɵelementContainerStart(77,31),t.ɵɵelementStart(78,"div",10)(79,"div",4),t.ɵɵtext(80,"gateway.vendor-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",12),t.ɵɵelement(82,"input",32),t.ɵɵpipe(83,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"div",10)(85,"div",4),t.ɵɵtext(86,"gateway.product-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(87,"mat-form-field",12),t.ɵɵelement(88,"input",33),t.ɵɵpipe(89,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(90,"div",10)(91,"div",4),t.ɵɵtext(92,"gateway.vendor-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(93,"mat-form-field",12),t.ɵɵelement(94,"input",34),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(96,"div",10)(97,"div",4),t.ɵɵtext(98,"gateway.product-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(99,"mat-form-field",12),t.ɵɵelement(100,"input",35),t.ɵɵpipe(101,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(102,"div",10)(103,"div",4),t.ɵɵtext(104,"gateway.model-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(105,"mat-form-field",12),t.ɵɵelement(106,"input",36),t.ɵɵpipe(107,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()(),t.ɵɵelementStart(108,"div",25)(109,"div",27),t.ɵɵtext(110,"gateway.values"),t.ɵɵelementEnd(),t.ɵɵelement(111,"tb-modbus-values",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵreference(11);t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(14,29,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,31,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(25,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,35,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(39,37,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(43,39,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(48,41,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(54,43,"gateway.send-data-to-platform")," "),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(64,45,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(71,47,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup.get("identity")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(83,49,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(89,51,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(95,53,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(101,55,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(107,57,"gateway.set"))}},dependencies:t.ɵɵgetComponentDepsFactory(zd,[V,b,Dc,Ac,ns,na]),encapsulation:2,changeDetection:o.OnPush})}}e("ModbusSlaveConfigComponent",zd);const Kd=["searchInput"],Hd=()=>["deviceName","info","unitId","type","actions"],Wd=()=>({minWidth:"96px",textAlign:"center"});function Qd(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",28)(2,"span",29),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",11),t.ɵɵelementStart(6,"button",13),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageSlave(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",13),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 Jd(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 Yd(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 Xd(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 Zd(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){let e;const a=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(null!==(e=a.host)&&void 0!==e?e:a.port)}}function em(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 tm(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 nm(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 am(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",30),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",a.ModbusProtocolLabelsMap.get(e.type)," ")}}function rm(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function im(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageSlave(n,a))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",13),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.deleteSlave(n,a))})),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 om(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,im,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,Wd)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function sm(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function pm(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class lm{constructor(e,t,n,a,r){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=a,this.cdr=r,this.isLegacy=!1,this.textSearchMode=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.ModbusProtocolLabelsMap=cr,this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new me,this.masterFormGroup=this.fb.group({slaves:this.fb.array([])}),this.dataSource=new cm}get slaves(){return this.masterFormGroup.get("slaves")}ngOnInit(){this.masterFormGroup.valueChanges.pipe(be(this.destroy$)).subscribe((e=>{this.updateTableData(e.slaves),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(ke(150),Me(((e,t)=>(e??"")===t.trim())),be(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=j(t),a=n?this.slaves.at(t).value:{};this.getSlaveDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ie(1),be(this.destroy$)).subscribe((e=>{e&&(n?this.slaves.at(t).patchValue(e):this.slaves.push(this.fb.control(e)),this.masterFormGroup.markAsDirty())}))}getSlaveDialog(e,t){return this.isLegacy?this.dialog.open(Md,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,hideNewFields:!0,buttonTitle:t}}):this.dialog.open(sd,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,hideNewFields:!1}})}deleteSlave(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-slave-title"),"",this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ie(1),be(this.destroy$)).subscribe((e=>{e&&(this.slaves.removeAt(t),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||lm)(t.ɵɵdirectiveInject(Ne.TranslateService),t.ɵɵdirectiveInject(pe.MatDialog),t.ɵɵdirectiveInject(A.DialogService),t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:lm,selectors:[["tb-modbus-master-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Kd,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{isLegacy:"isLegacy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>lm)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,Qd,14,9,"div",8),t.ɵɵpipe(8,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-toolbar",7)(10,"div",9)(11,"button",10),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"mat-icon"),t.ɵɵtext(14,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",11)(16,"mat-label"),t.ɵɵtext(17," "),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",12,0),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",13),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",14)(26,"table",15),t.ɵɵelementContainerStart(27,16),t.ɵɵtemplate(28,Jd,4,3,"mat-header-cell",17)(29,Yd,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(30,16),t.ɵɵtemplate(31,Xd,3,3,"mat-header-cell",17)(32,Zd,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(33,16),t.ɵɵtemplate(34,em,3,3,"mat-header-cell",17)(35,tm,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(36,16),t.ɵɵtemplate(37,nm,4,3,"mat-header-cell",17)(38,am,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(39,19),t.ɵɵtemplate(40,rm,1,0,"mat-header-cell",20)(41,om,12,6,"mat-cell",21),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(42,sm,1,0,"mat-header-row",22)(43,pm,1,0,"mat-row",23),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"section",24),t.ɵɵpipe(45,"async"),t.ɵɵelementStart(46,"button",25),t.ɵɵlistener("click",(function(a){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageSlave(a))})),t.ɵɵelementStart(47,"mat-icon",26),t.ɵɵtext(48,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"span"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(52,"span",27),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(8,25,n.dataSource.isEmpty())),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,Hd))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(40,Hd)),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(lm,[V,b,na]),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",lm),qe([Le()],lm.prototype,"isLegacy",void 0);class cm extends N{constructor(){super()}}e("SlavesDatasource",cm);class dm extends Ar{constructor(){super(),this.enableSlaveControl=new oe(!1),this.enableSlaveControl.valueChanges.pipe(Vr()).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&&(U(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&&!U(e.slave,{}))}static{this.ɵfac=function(e){return new(e||dm)}}static{this.ɵdir=t.ɵɵdefineDirective({type:dm,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusBasicConfigDirective",dm);class mm extends dm{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(mm)))(n||mm)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:mm,selectors:[["tb-modbus-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>mm)),multi:!0},{provide:re,useExisting:i((()=>mm)),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(mm,[V,b,zd,lm,aa]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:o.OnPush})}}e("ModbusBasicConfigComponent",mm);class um extends dm{constructor(){super(...arguments),this.isLegacy=!0}mapConfigToFormValue(e){return{master:e.master?.slaves?e.master:{slaves:[]},slave:e.slave?Kr.mapSlaveToUpgradedVersion(e.slave):{}}}getMappedValue(e){return{master:e.master,slave:e.slave?Kr.mapSlaveToDowngradedVersion(e.slave):{}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(um)))(n||um)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:um,selectors:[["tb-modbus-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>um)),multi:!0},{provide:re,useExisting:i((()=>um)),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(um,[V,b,zd,lm,aa]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:o.OnPush})}}e("ModbusLegacyBasicConfigComponent",um);const gm=()=>({maxWidth:"970px"});function ym(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," ")}}function hm(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("methodRPC").value)}}function fm(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("attributeOnThingsBoard").value)}}function vm(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate2(" ",e.get("requestExpression").value+" - ","",e.get("attributeNameExpression").value," ")}}function bm(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21),t.ɵɵtemplate(1,hm,2,1,"ng-container",22)(2,fm,2,1,"ng-container",22)(3,vm,2,2,"ng-container",22),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngSwitch",e.keysType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_UPDATES),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_REQUESTS)}}function xm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function wm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function Cm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function Sm(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",42),2&e){const e=t.ɵɵnextContext(5);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function Em(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"div",28)(11,"mat-form-field",29),t.ɵɵelement(12,"input",30),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,xm,3,3,"mat-icon",31),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",26)(19,"div",32)(20,"span",33),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"div",34),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"label",35),t.ɵɵtext(25,"from"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",36),t.ɵɵelement(27,"input",37),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,wm,3,3,"mat-icon",31),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"label",38),t.ɵɵtext(31,"to"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",36),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,Cm,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(36,Sm,1,2,"tb-report-strategy",40),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),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,gm)),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteFrom").hasError("required")&&e.get("byteFrom").touched),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteTo").hasError("required")&&e.get("byteTo").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy&&(n.keysType===n.SocketValueKey.ATTRIBUTES||n.keysType===n.SocketValueKey.TIMESERIES))}}function Tm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function Im(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function km(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",43),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29),t.ɵɵelement(7,"input",44),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,Tm,3,3,"mat-icon",31),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",26)(11,"div",45),t.ɵɵpipe(12,"translate"),t.ɵɵtext(13," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",28)(15,"mat-form-field",29)(16,"mat-select",46),t.ɵɵtemplate(17,Im,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(18,"div",48)(19,"mat-slide-toggle",49),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(20,"mat-label",50),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,7,"gateway.method-name")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("methodRPC").hasError("required")&&e.get("methodRPC").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(12,11,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,13,"gateway.hints.socket.with-response")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,15,"gateway.rpc.withResponse")," ")}}function Mm(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 Pm(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 Fm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-expression-required"))}function Om(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/request-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,gm))}function qm(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 Bm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 Rm(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/attribute-name-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,gm))}function Nm(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",52),t.ɵɵtemplate(8,Mm,3,4,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",53)(14,"mat-form-field",29)(15,"mat-select",54),t.ɵɵtemplate(16,Pm,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-form-field",29),t.ɵɵelement(18,"input",55),t.ɵɵpipe(19,"translate"),t.ɵɵtemplate(20,Fm,3,3,"mat-icon",31)(21,Om,1,3,"div",56),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",26)(23,"div",43),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"div",53)(27,"mat-form-field",29)(28,"mat-select",57),t.ɵɵtemplate(29,qm,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"mat-form-field",29),t.ɵɵelement(31,"input",58),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,Bm,3,3,"mat-icon",31)(34,Rm,1,3,"div",56),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,12,"gateway.hints.socket.attribute-requests-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.requestsType),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,14,"gateway.request-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("requestExpression").hasError("required")&&e.get("requestExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("requestExpressionSource").value===n.ExpressionType.Expression),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,18,"gateway.attribute-name-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,20,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeNameExpression").hasError("required")&&e.get("attributeNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("attributeNameExpressionSource").value===n.ExpressionType.Expression)}}function _m(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function Dm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 Vm(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",46),t.ɵɵtemplate(8,_m,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",28)(14,"mat-form-field",29),t.ɵɵelement(15,"input",59),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,Dm,3,3,"mat-icon",31),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,5,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.attribute-on-platform")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeOnThingsBoard").hasError("required")&&e.get("attributeOnThingsBoard").touched)}}function Gm(e,n){if(1&e&&t.ɵɵtemplate(0,Em,37,27,"div",23)(1,km,24,17,"div",23)(2,Nm,35,22,"div",23)(3,Vm,18,11,"div",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.TIMESERIES||e.keysType===e.SocketValueKey.ATTRIBUTES),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_UPDATES)}}function Am(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,ym,2,1,"div",17)(7,bm,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,Gm,4,4,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).index,r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.deleteKey(n,a))})),t.ɵɵelementStart(12,"mat-icon"),t.ɵɵtext(13,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,a=n.last,r=t.ɵɵreference(8),i=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",a),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",i.keysType===i.SocketValueKey.TIMESERIES||i.keysType===i.SocketValueKey.ATTRIBUTES)("ngIfElse",r),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,i.deleteKeyTitle))}}function jm(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,Am,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function Lm(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",60)(1,"span",61),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class Um extends R{constructor(e,t){super(t),this.fb=e,this.store=t,this.withReportStrategy=!0,this.keysDataApplied=new r,this.SocketValueKey=Sa,this.socketEncoding=Object.values(Xe),this.requestsType=Object.values(Ta),this.expressionType=Object.values(Ia),this.ExpressionType=Ia,this.ReportStrategyDefaultValue=Vt}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===Sa.RPC_METHODS?this.fb.group({methodRPC:["",[ne.required]],encoding:[Xe.UTF16,[ne.required]],withResponse:[!0]}):this.keysType===Sa.ATTRIBUTES_UPDATES?this.fb.group({encoding:[Xe.UTF16,[ne.required]],attributeOnThingsBoard:["",[ne.required]]}):this.keysType===Sa.ATTRIBUTES_REQUESTS?this.fb.group({type:[Ta.Shared],requestExpressionSource:[Ia.Constant],attributeNameExpressionSource:[Ia.Constant],requestExpression:["",[ne.required]],attributeNameExpression:["",[ne.required]]}):this.fb.group({key:["",[ne.required,ne.pattern($e)]],byteFrom:[0,[ne.required]],byteTo:[0,[ne.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(){this.keysDataApplied.emit(this.keysListFormArray.value)}prepareKeysFormArray(e){const t=[];return e?.forEach((e=>{let n;if(this.keysType===Sa.RPC_METHODS){const t=e;n=this.fb.group({methodRPC:[t.methodRPC,[ne.required]],encoding:[t.encoding,[ne.required]],withResponse:[t.withResponse]})}else if(this.keysType===Sa.ATTRIBUTES_REQUESTS){const t=e;n=this.fb.group({type:[t.type??Ta.Shared],requestExpressionSource:[t.requestExpressionSource??Ia.Constant],attributeNameExpressionSource:[t.attributeNameExpressionSource??Ia.Constant],requestExpression:[t.requestExpression,[ne.required]],attributeNameExpression:[t.attributeNameExpression,[ne.required]]})}else if(this.keysType===Sa.ATTRIBUTES_UPDATES)n=this.fb.group({encoding:[e.encoding??Xe.UTF16],attributeOnThingsBoard:[e.attributeOnThingsBoard,[ne.required]]});else{const{key:t,byteFrom:a,byteTo:r,reportStrategy:i}=e;n=this.fb.group({key:[t,[ne.required,ne.pattern($e)]],byteFrom:[a??0,[ne.required]],byteTo:[r??0,[ne.required]],reportStrategy:[{value:i,disabled:this.isReportStrategyDisabled()}]})}t.push(n)})),this.fb.array(t)}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===Sa.ATTRIBUTES||this.keysType===Sa.TIMESERIES))}static{this.ɵfac=function(e){return new(e||Um)(t.ɵɵdirectiveInject(te.UntypedFormBuilder),t.ɵɵdirectiveInject(ce.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Um,selectors:[["tb-device-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",popover:"popover",withReportStrategy:"withReportStrategy"},outputs:{keysDataApplied:"keysDataApplied"},standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:19,vars:16,consts:[["noKeys",""],["valueTitle",""],[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"title-container"],[1,"title-container",3,"ngSwitch"],[4,"ngSwitchCase"],["class","tb-form-panel no-border no-padding",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],[1,"fixed-title-width","tb-flex","align-center"],[1,"tb-required"],["matSuffix","","tb-help-popup-placement","left",1,"see-example",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",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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",4,"ngFor","ngForOf"],[1,"tb-form-row"],["formControlName","withResponse",1,"mat-slide",3,"click"],[3,"tb-hint-tooltip-icon"],[3,"value"],["formControlName","type"],[1,"tb-flex"],["formControlName","requestExpressionSource"],["matInput","","name","value","formControlName","requestExpression",3,"placeholder"],["matSuffix","","class","see-example","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","attributeOnThingsBoard",3,"placeholder"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,jm,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,Lm,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(Um,[V,b,ma]),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%] .tb-device-keys-panel[_ngcontent-%COMP%] .see-example[_ngcontent-%COMP%]{width:32px;height:32px;margin:4px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:o.OnPush})}}e("DeviceDataKeysPanelComponent",Um),qe([k()],Um.prototype,"withReportStrategy",void 0);const $m=()=>({maxWidth:"970px"});function zm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-filter-required"))}function Km(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function Hm(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function Wm(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function Qm(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 Jm(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 Ym(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 Xm(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 Zm(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 eu extends I{constructor(e,t,n,a,r,i,o,s,p){super(e,t,a),this.store=e,this.router=t,this.data=n,this.dialogRef=a,this.fb=r,this.popoverService=i,this.renderer=o,this.viewContainerRef=s,this.cdr=p,this.SocketValueKey=Sa,this.keysPopupClosed=!0,this.socketDeviceHelpLink=q+"/docs/iot-gateway/config/socket/#device-subsection",this.socketEncoding=Object.values(Xe),this.destroy$=new me,this.deviceFormGroup=this.fb.group({address:["",[ne.required,ne.pattern($e)]],deviceName:["",[ne.required,ne.pattern($e)]],deviceType:["",[ne.required,ne.pattern($e)]],encoding:[Xe.UTF8],telemetry:[[]],attributes:[[]],attributeRequests:[[]],attributeUpdates:[[]],serverSideRpc:[[]]}),this.deviceFormGroup.patchValue(this.data.value,{emitEvent:!1})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){this.deviceFormGroup.valid&&this.dialogRef.close(this.deviceFormGroup.value)}manageKeys(e,t,n){e.stopPropagation();const a=t._elementRef.nativeElement;if(this.popoverService.hasPopover(a))return void this.popoverService.hidePopover(a);this.popoverService.hasPopover(a)&&this.popoverService.hidePopover(a);const r=this.deviceFormGroup.get(n),i={keys:r.value,keysType:n,panelTitle:Ea.get(n),addKeyTitle:ka.get(n),deleteKeyTitle:Ma.get(n),noKeysText:Pa.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1;const o=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,Um,"leftBottom",!1,null,i,{},{},{},!0);o.tbComponentRef.instance.popover=o,o.tbComponentRef.instance.keysDataApplied.pipe(be(this.destroy$)).subscribe((e=>{o.hide(),r.patchValue(e),r.markAsDirty(),this.cdr.markForCheck()})),o.tbHideStart.pipe(be(this.destroy$)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||eu)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef),t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(je.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:eu,selectors:[["tb-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:118,vars:56,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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","tb-help-popup-placement","left",1,"see-example",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",4,"ngFor","ngForOf"],[1,"tb-form-row","space-between","tb-flex"],["translate","",1,"fixed-title-width"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[4,"ngFor","ngForOf"],[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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"]],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,zm,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,Km,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,Hm,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.ɵɵtemplate(45,Wm,2,2,"mat-option",26),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(46,"div",27)(47,"div",28),t.ɵɵtext(48,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"div",29)(50,"mat-chip-listbox",30),t.ɵɵtemplate(51,Qm,2,1,"mat-chip",31),t.ɵɵelementStart(52,"mat-chip",32),t.ɵɵelement(53,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(54,"button",34,0),t.ɵɵpipe(56,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(55);return t.ɵɵresetView(n.manageKeys(a,r,n.SocketValueKey.TIMESERIES))})),t.ɵɵelementStart(57,"tb-icon",35),t.ɵɵtext(58,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(59,"div",27)(60,"div",28),t.ɵɵtext(61,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(62,"div",29)(63,"mat-chip-listbox",30),t.ɵɵtemplate(64,Jm,2,1,"mat-chip",31),t.ɵɵelementStart(65,"mat-chip",32),t.ɵɵelement(66,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(67,"button",34,1),t.ɵɵpipe(69,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(68);return t.ɵɵresetView(n.manageKeys(a,r,n.SocketValueKey.ATTRIBUTES))})),t.ɵɵelementStart(70,"tb-icon",35),t.ɵɵtext(71,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(72,"div",27)(73,"div",28),t.ɵɵtext(74,"gateway.attribute-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(75,"div",29)(76,"mat-chip-listbox",30),t.ɵɵtemplate(77,Ym,2,1,"mat-chip",31),t.ɵɵelementStart(78,"mat-chip",32),t.ɵɵelement(79,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(80,"button",34,2),t.ɵɵpipe(82,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(81);return t.ɵɵresetView(n.manageKeys(a,r,n.SocketValueKey.ATTRIBUTES_REQUESTS))})),t.ɵɵelementStart(83,"tb-icon",35),t.ɵɵtext(84,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(85,"div",27)(86,"div",28),t.ɵɵtext(87,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(88,"div",29)(89,"mat-chip-listbox",30),t.ɵɵtemplate(90,Xm,2,1,"mat-chip",31),t.ɵɵelementStart(91,"mat-chip",32),t.ɵɵelement(92,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(93,"button",34,3),t.ɵɵpipe(95,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(94);return t.ɵɵresetView(n.manageKeys(a,r,n.SocketValueKey.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(96,"tb-icon",35),t.ɵɵtext(97,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(98,"div",27)(99,"div",28),t.ɵɵtext(100,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(101,"div",29)(102,"mat-chip-listbox",30),t.ɵɵtemplate(103,Zm,2,1,"mat-chip",31),t.ɵɵelementStart(104,"mat-chip",32),t.ɵɵelement(105,"label",33),t.ɵɵelementEnd()(),t.ɵɵelementStart(106,"button",34,4),t.ɵɵpipe(108,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(107);return t.ɵɵresetView(n.manageKeys(a,r,n.SocketValueKey.RPC_METHODS))})),t.ɵɵelementStart(109,"tb-icon",35),t.ɵɵtext(110,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(111,"div",36)(112,"button",37),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(113),t.ɵɵpipe(114,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"button",38),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(116),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,31,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.socketDeviceHelpLink),t.ɵɵadvance(12),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("address").hasError("required")&&n.deviceFormGroup.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/address-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(55,$m)),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,35,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceName").hasError("required")&&n.deviceFormGroup.get("deviceName").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,37,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceType").hasError("required")&&n.deviceFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(40,39,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(56,41,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(69,43,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(82,45,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(95,47,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(108,49,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(114,51,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(117,53,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(eu,[V,b,aa]),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%] .see-example{width:32px;height:32px;margin:4px}[_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",eu);const tu=["searchInput"],nu=()=>["address","deviceName","actions"],au=()=>({minWidth:"96px",textAlign:"center"});function ru(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageDevices(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",11),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 iu(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 ou(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 su(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 pu(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 lu(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function cu(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageDevices(n,a))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.deleteDevice(n,a))})),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 du(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,cu,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,au)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function mu(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function uu(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class gu{constructor(e,t,n,a,r){this.translate=e,this.dialog=t,this.dialogService=n,this.fb=a,this.cdr=r,this.withReportStrategy=!0,this.textSearchMode=!1,this.textSearch=this.fb.control("",{nonNullable:!0}),this.onChange=()=>{},this.destroy$=new me,this.devicesFormGroup=this.fb.array([]),this.dataSource=new yu}ngOnInit(){this.devicesFormGroup.valueChanges.pipe(be(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(ke(150),Me(((e,t)=>(e??"")===t.trim())),be(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=j(t),a=n?this.devicesFormGroup.at(t).value:{};this.getDeviceDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ie(1),be(this.destroy$)).subscribe((e=>{e&&(n?this.devicesFormGroup.at(t).patchValue(e):this.devicesFormGroup.push(this.fb.control(e)),this.devicesFormGroup.markAsDirty())}))}validate(){return this.devicesFormGroup.controls.length?null:{devicesFormGroup:{valid:!1}}}getDeviceDialog(e,t){return this.dialog.open(eu,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title"),"",this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ie(1),be(this.destroy$)).subscribe((e=>{e&&(this.devicesFormGroup.removeAt(t),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||gu)(t.ɵɵdirectiveInject(Ne.TranslateService),t.ɵɵdirectiveInject(pe.MatDialog),t.ɵɵdirectiveInject(A.DialogService),t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gu,selectors:[["tb-devices-config-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(tu,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>gu)),multi:!0},{provide:re,useExisting:i((()=>gu)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,ru,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,iu,3,3,"mat-header-cell",15)(25,ou,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,su,4,3,"mat-header-cell",15)(28,pu,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,17),t.ɵɵtemplate(30,lu,1,0,"mat-header-cell",18)(31,du,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(32,mu,1,0,"mat-header-row",20)(33,uu,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"section",22),t.ɵɵpipe(35,"async"),t.ɵɵelementStart(36,"button",23),t.ɵɵlistener("click",(function(a){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(a))})),t.ɵɵelementStart(37,"mat-icon",24),t.ɵɵtext(38,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"span"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,20,n.dataSource.isEmpty())),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,nu))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,nu)),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(gu,[V,b,na]),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",gu),qe([k()],gu.prototype,"withReportStrategy",void 0);let yu=class extends N{constructor(){super()}};function hu(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function fu(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.address-required"))}function vu(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),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 bu(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.socketConfigFormGroup.get("bufferSize").hasError("min")?"gateway.buffer-size-range":"gateway.buffer-size-required"))}}e("DevicesDatasource",yu);class xu{constructor(e){this.fb=e,this.portLimits=Fa,this.socketTypes=Object.values(Ca),this.destroy$=new me,this.socketConfigFormGroup=this.fb.group({address:["",[ne.required,ne.pattern($e)]],type:[Ca.TCP],port:[5e4,[ne.required,ne.min(Fa.MIN),ne.max(Fa.MAX)]],bufferSize:[1024,[ne.required,ne.min(1),ne.pattern($e)]]}),this.socketConfigFormGroup.valueChanges.pipe(be(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=Ca.TCP,port:a=5e4,bufferSize:r=1024}=e??{};this.socketConfigFormGroup.reset({address:t,type:n,port:a,bufferSize:r},{emitEvent:!1})}validate(){return this.socketConfigFormGroup.valid?null:{socketConfigFormGroup:{valid:!1}}}static{this.ɵfac=function(e){return new(e||xu)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:xu,selectors:[["tb-socket-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>xu)),multi:!0},{provide:re,useExisting:i((()=>xu)),multi:!0}]),t.ɵɵStandaloneFeature],decls:34,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"],["tbTruncateWithTooltip",""],["formControlName","type","appearance","fill"],[3,"value",4,"ngFor","ngForOf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(7,hu,2,2,"tb-toggle-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",6),t.ɵɵtext(10,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",9),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,fu,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",1)(17,"div",6),t.ɵɵtext(18,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",7)(20,"mat-form-field",8),t.ɵɵelement(21,"input",11),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,vu,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(24,"div",1)(25,"div",12),t.ɵɵpipe(26,"translate"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",7)(30,"mat-form-field",8),t.ɵɵelement(31,"input",13),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,bu,3,3,"mat-icon",10),t.ɵɵelementEnd()()()()),2&e&&(t.ɵɵproperty("formGroup",n.socketConfigFormGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,13,"gateway.connection-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("address").hasError("required")&&n.socketConfigFormGroup.get("address").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.socketConfigFormGroup.get("port").hasError("required")||n.socketConfigFormGroup.get("port").hasError("min")||n.socketConfigFormGroup.get("port").hasError("max"))&&n.socketConfigFormGroup.get("port").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,19,"gateway.hints.buffer-size")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(28,21,"gateway.buffer-size")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,23,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("bufferSize").hasError("required")||n.socketConfigFormGroup.get("bufferSize").hasError("min")&&n.socketConfigFormGroup.get("bufferSize").touched))},dependencies:t.ɵɵgetComponentDepsFactory(xu,[V,b,ns,na]),encapsulation:2,changeDetection:o.OnPush})}}e("SocketConfigComponent",xu);class wu extends Ar{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(wu)))(n||wu)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:wu,selectors:[["tb-socket-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>wu)),multi:!0},{provide:re,useExisting:i((()=>wu)),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(wu,[V,b,xu,gu]),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",wu);class Cu extends Ar{constructor(){super(...arguments),this.isLegacy=!0}getMappedValue(e){return Wr.mapSocketToDowngradedVersion(e)}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:Wr.mapSocketToUpgradedVersion(e),devices:e?.devices?Wr.mapDevicesToUpgradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(Cu)))(n||Cu)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:Cu,selectors:[["tb-socket-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Cu)),multi:!0},{provide:re,useExisting:i((()=>Cu)),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(Cu,[V,b,xu,gu]),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 Su(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 Eu(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 Tu(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 Iu(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 ku(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 Mu(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,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.SegmentationTypeTranslationsMap.get(e))," ")}}e("SocketLegacyBasicConfigComponent",Cu);class Pu extends Gr{constructor(){super(...arguments),this.segmentationTypes=Object.values(br),this.SegmentationTypeTranslationsMap=xr,this.portLimits=Fa}get applicationConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({objectName:["",[ne.required,ne.pattern($e)]],host:["",[ne.required,ne.pattern($e)]],port:[null,[ne.required,ne.min(Fa.MIN),ne.max(Fa.MAX)]],mask:[""],objectIdentifier:[null,[ne.required]],vendorIdentifier:[null,[ne.required]],maxApduLengthAccepted:[],segmentationSupported:[br.BOTH]})}mapOnChangeValue(e){return K(e),e}onWriteValue(e){const{maxApduLengthAccepted:t=1476,segmentationSupported:n=br.BOTH,...a}=e;this.formGroup.reset({...a,maxApduLengthAccepted:t,segmentationSupported:n},{emitEvent:!1})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(Pu)))(n||Pu)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:Pu,selectors:[["tb-bacnet-application-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Pu)),multi:!0},{provide:re,useExisting:i((()=>Pu)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:67,vars:41,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"]],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,Su,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,Eu,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,Tu,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,Iu,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,ku,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,Mu,3,4,"mat-option",21,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()()()()()),2&e&&(t.ɵɵproperty("formGroup",n.applicationConfigFormGroup),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,19,"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,21,"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,23,"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,25,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(31,27,"gateway.hints.bacnet.object-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,29,"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,31,"gateway.hints.bacnet.vendor-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(43,33,"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,35,"gateway.hints.bacnet.apdu-length")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(58,37,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(61,39,"gateway.hints.bacnet.segmentation")),t.ɵɵadvance(5),t.ɵɵrepeater(n.segmentationTypes))},dependencies:t.ɵɵgetComponentDepsFactory(Pu,[V,b,ns]),encapsulation:2,changeDetection:o.OnPush})}}function Fu(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 Ou(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,Fu,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 qu(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 Bu(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,qu,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 Ru(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,a=t.ɵɵnextContext(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.BacnetRequestTypeTranslationsMap.get(e))," ")}}function Nu(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,Ru,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 _u(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 Du(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,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.BacnetKeyObjectTypeTranslationsMap.get(e))," ")}}function Vu(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.object-id-required"))}function Gu(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,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.BacnetPropertyIdTranslationsMap.get(e))," ")}}function Au(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 ju extends Gr{constructor(){super(...arguments),this.withReportStrategy=!0,this.propertyIds=Pr.get(Ir.analogOutput),this.objectTypes=Object.values(Ir),this.requestTypes=Object.values(Or),this.ReportStrategyDefaultValue=Vt,this.BacnetDeviceKeysType=wr,this.BacnetKeyObjectTypeTranslationsMap=kr,this.BacnetPropertyIdTranslationsMap=Fr,this.BacnetRequestTypeTranslationsMap=qr}ngOnInit(){this.formGroup=this.initKeyFormGroup(),this.observeValueChanges(),this.observeObjectType()}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keyType===wr.ATTRIBUTES||this.keyType===wr.TIMESERIES))}initKeyFormGroup(){return this.fb.group({key:[{value:"",disabled:this.keyType===wr.RPC_METHODS},[ne.required,ne.pattern($e)]],method:[{value:"",disabled:this.keyType!==wr.RPC_METHODS},[ne.required,ne.pattern($e)]],objectType:[Ir.analogOutput],objectId:[0,[ne.required]],propertyId:[Mr.presentValue],requestTimeout:[{value:0,disabled:this.keyType!==wr.RPC_METHODS}],requestType:[{value:Or.Write,disabled:this.keyType!==wr.RPC_METHODS}],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]})}observeObjectType(){this.formGroup.get("objectType").valueChanges.pipe(Vr(this.destroyRef)).subscribe((e=>{this.propertyIds=Pr.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(ju)))(n||ju)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:ju,selectors:[["tb-bacnet-device-data-key"]],inputs:{keyType:"keyType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",l]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>ju)),multi:!0},{provide:re,useExisting:i((()=>ju)),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,Ou,10,12)(6,Bu,9,10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",1)(8,"div",2),t.ɵɵtext(9,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵtemplate(10,Nu,9,6,"div",3)(11,_u,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,Du,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,Vu,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,Gu,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵtemplate(34,Au,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(ju,[V,b,ma]),encapsulation:2,changeDetection:o.OnPush})}}function Lu(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 Uu(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,Lu,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 a=t.ɵɵrestoreView(e).$index,r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.deleteKey(n,a))})),t.ɵɵelementStart(11,"mat-icon"),t.ɵɵtext(12,"delete"),t.ɵɵelementEnd()()()}if(2&e){let e;const a=n.$implicit,r=n.$index,i=n.$count,o=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",a),t.ɵɵadvance(),t.ɵɵproperty("expanded",r===i-1),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",null!==(e=null==a.value?null:a.value.key)&&void 0!==e?e:null==a.value?null:a.value.method," "),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(10,4,o.deleteKeyTitle))}}function $u(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,Uu,13,6,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function zu(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 Ku extends R{constructor(e,t){super(t),this.fb=e,this.store=t,this.withReportStrategy=!0,this.keysDataApplied=d(),this.ReportStrategyDefaultValue=Vt}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||Ku)(t.ɵɵdirectiveInject(te.UntypedFormBuilder),t.ɵɵdirectiveInject(ce.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Ku,selectors:[["tb-bacnet-device-data-keys-panel"]],inputs:{panelTitle:"panelTitle",addKeyTitle:"addKeyTitle",deleteKeyTitle:"deleteKeyTitle",noKeysText:"noKeysText",keys:"keys",keysType:"keysType",popover:"popover",withReportStrategy:[2,"withReportStrategy","withReportStrategy",l]},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,$u,3,0,"div",3)(6,zu,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(Ku,[V,b,ju]),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%] .tb-device-keys-panel[_ngcontent-%COMP%] .see-example[_ngcontent-%COMP%]{width:32px;height:32px;margin:4px}[_nghost-%COMP%] .mat-mdc-form-field-icon-suffix{display:flex}'],changeDetection:o.OnPush})}}function Hu(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 Wu(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.deviceFormGroup.get("port")))}}function Qu(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"mat-expansion-panel",33)(2,"mat-expansion-panel-header")(3,"mat-panel-title")(4,"div",34),t.ɵɵtext(5,"gateway.advanced-configuration-settings"),t.ɵɵelementEnd()()(),t.ɵɵelement(6,"tb-string-items-list",35),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 Ju(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 Yu(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 Xu(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 Zu(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 eg(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 tg extends I{constructor(e,t,n,a,r,i,o,s,p,l){super(e,t,a),this.store=e,this.router=t,this.data=n,this.dialogRef=a,this.fb=r,this.popoverService=i,this.renderer=o,this.viewContainerRef=s,this.cdr=p,this.destroyRef=l,this.deviceFormGroup=this.fb.group({host:["",[ne.required,ne.pattern($e)]],port:["",[ne.required,ne.min(Fa.MIN),ne.max(Fa.MAX)]],deviceInfo:[],altResponsesAddresses:[{value:[],disabled:this.data.hideNewFields}],pollPeriod:[1e4,[ne.required,ne.min(0)]],timeseries:[[]],attributes:[[]],attributeUpdates:[[]],serverSideRpc:[[]]}),this.keysPopupClosed=!0,this.BacnetDeviceKeysType=wr,this.DeviceInfoType=vr,this.portLimits=Fa,this.deviceHelpLink=q+"/docs/iot-gateway/config/bacnet/#device-object-settings",this.sourceTypes=Object.values(Ia),this.ConnectorType=Je,this.deviceFormGroup.patchValue(this.data.value,{emitEvent:!1})}cancel(){this.keysPopupClosed&&this.dialogRef.close(null)}add(){if(this.deviceFormGroup.valid){const{altResponsesAddresses:e,...t}=this.deviceFormGroup.value;this.dialogRef.close({altResponsesAddresses:e??[],...t})}}manageKeys(e,t,n){e?.stopPropagation();const a=t._elementRef.nativeElement;if(this.popoverService.hasPopover(a))return void this.popoverService.hidePopover(a);const r=this.deviceFormGroup.get(n),i={keys:r.value,keysType:n,panelTitle:Cr.get(n),addKeyTitle:Sr.get(n),deleteKeyTitle:Er.get(n),noKeysText:Tr.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1;const o=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,Ku,"leftBottom",!1,null,i,{},{},{},!0);o.tbComponentRef.instance.popover=o,o.tbComponentRef.instance.keysDataApplied.subscribe((e=>{o.hide(),r.patchValue(e),r.markAsDirty(),this.cdr.markForCheck()})),o.tbHideStart.pipe(Vr(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||tg)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(de.Router),t.ɵɵdirectiveInject(se),t.ɵɵdirectiveInject(pe.MatDialogRef),t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(je.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:tg,selectors:[["tb-bacnet-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:99,vars:46,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","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","sourceTypes","connectorType"],[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"],["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"],[1,"tb-settings","chips-panel","w-full"],["translate","",1,"tb-form-panel-title"],["editable","","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,Hu,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,Wu,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵtemplate(26,Qu,9,6,"div",12),t.ɵɵelement(27,"tb-device-info-table",18),t.ɵɵelementStart(28,"div",12)(29,"div",19)(30,"span",20),t.ɵɵtext(31,"gateway.poll-period"),t.ɵɵelementEnd()(),t.ɵɵelementStart(32,"mat-form-field",14),t.ɵɵelement(33,"input",21),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,Ju,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(36,"div",22)(37,"div",23),t.ɵɵtext(38,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"div",24)(40,"mat-chip-listbox",25),t.ɵɵrepeaterCreate(41,Yu,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(43,"mat-chip",26),t.ɵɵelement(44,"label",27),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"button",28,0),t.ɵɵpipe(47,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(46);return t.ɵɵresetView(n.manageKeys(a,r,n.BacnetDeviceKeysType.ATTRIBUTES))})),t.ɵɵelementStart(48,"tb-icon",29),t.ɵɵtext(49,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(50,"div",22)(51,"div",23),t.ɵɵtext(52,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(53,"div",24)(54,"mat-chip-listbox",25),t.ɵɵrepeaterCreate(55,Xu,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(57,"mat-chip",26),t.ɵɵelement(58,"label",27),t.ɵɵelementEnd()(),t.ɵɵelementStart(59,"button",28,1),t.ɵɵpipe(61,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(60);return t.ɵɵresetView(n.manageKeys(a,r,n.BacnetDeviceKeysType.TIMESERIES))})),t.ɵɵelementStart(62,"tb-icon",29),t.ɵɵtext(63,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(64,"div",22)(65,"div",23),t.ɵɵtext(66,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"div",24)(68,"mat-chip-listbox",25),t.ɵɵrepeaterCreate(69,Zu,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(71,"mat-chip",26),t.ɵɵelement(72,"label",27),t.ɵɵelementEnd()(),t.ɵɵelementStart(73,"button",28,2),t.ɵɵpipe(75,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(74);return t.ɵɵresetView(n.manageKeys(a,r,n.BacnetDeviceKeysType.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(76,"tb-icon",29),t.ɵɵtext(77,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(78,"div",22)(79,"div",23),t.ɵɵtext(80,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"div",24)(82,"mat-chip-listbox",25),t.ɵɵrepeaterCreate(83,eg,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(85,"mat-chip",26),t.ɵɵelement(86,"label",27),t.ɵɵelementEnd()(),t.ɵɵelementStart(87,"button",28,3),t.ɵɵpipe(89,"translate"),t.ɵɵlistener("click",(function(a){t.ɵɵrestoreView(e);const r=t.ɵɵreference(88);return t.ɵɵresetView(n.manageKeys(a,r,n.BacnetDeviceKeysType.RPC_METHODS))})),t.ɵɵelementStart(90,"tb-icon",29),t.ɵɵtext(91,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(92,"div",30)(93,"button",31),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(94),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(96,"button",32),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(97),t.ɵɵpipe(98,"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("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,30,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.deviceFormGroup.get("port").hasError("required")||n.deviceFormGroup.get("port").hasError("min")||n.deviceFormGroup.get("port").hasError("max"))&&n.deviceFormGroup.get("port").touched?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?-1:26),t.ɵɵadvance(),t.ɵɵproperty("deviceInfoType",n.DeviceInfoType.FULL)("sourceTypes",n.sourceTypes)("connectorType",n.ConnectorType.BACNET),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,32,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("pollPeriod").hasError("required")&&n.deviceFormGroup.get("pollPeriod").touched?35:-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(47,34,"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(61,36,"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(75,38,"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(89,40,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(95,42,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(98,44,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(tg,[V,b,aa,na,ns,Ss]),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%] .see-example{width:32px;height:32px;margin:4px}[_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 ng=()=>["deviceName","host","port","actions"],ag=()=>({minWidth:"96px",textAlign:"center"});function rg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),t.ɵɵpipe(7,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext();return t.ɵɵresetView(a.manageDevices(n))})),t.ɵɵelementStart(8,"mat-icon"),t.ɵɵtext(9,"add"),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"button",11),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 ig(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 og(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 sg(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 pg(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 lg(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 cg(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 dg(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function mg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageDevices(n,a))})),t.ɵɵelementStart(2,"tb-icon"),t.ɵɵtext(3,"edit"),t.ɵɵelementEnd()(),t.ɵɵelementStart(4,"button",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext().index,r=t.ɵɵnextContext();return t.ɵɵresetView(r.deleteDevice(n,a))})),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 ug(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,mg,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,ag)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function gg(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function yg(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class hg extends $r{constructor(){super(...arguments),this.hideNewFields=!1}getDatasource(){return new fg}manageDevices(e,t){e&&e.stopPropagation();const n=j(t),a=n?this.entityFormArray.at(t).value:{};this.getDeviceDialog(a,n?"action.apply":"action.add").afterClosed().pipe(Ie(1),Vr(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):this.entityFormArray.push(this.fb.control(e)),this.entityFormArray.markAsDirty())}))}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title"),"",this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(Ie(1),Vr(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),this.entityFormArray.markAsDirty())}))}getDeviceDialog(e,t){return this.dialog.open(tg,{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(hg)))(n||hg)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:hg,selectors:[["tb-bacnet-devices-config-table"]],inputs:{hideNewFields:[2,"hideNewFields","hideNewFields",l]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>hg)),multi:!0},{provide:re,useExisting:i((()=>hg)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,rg,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,ig,4,3,"mat-header-cell",15)(25,og,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,sg,3,3,"mat-header-cell",15)(28,pg,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,14),t.ɵɵtemplate(30,lg,3,3,"mat-header-cell",15)(31,cg,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(32,17),t.ɵɵtemplate(33,dg,1,0,"mat-header-cell",18)(34,ug,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(35,gg,1,0,"mat-header-row",20)(36,yg,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"section",22),t.ɵɵpipe(38,"async"),t.ɵɵelementStart(39,"button",23),t.ɵɵlistener("click",(function(a){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(a))})),t.ɵɵelementStart(40,"mat-icon",24),t.ɵɵtext(41,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"span"),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(45,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,21,n.dataSource.isEmpty())),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,ng))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,ng)),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(hg,[V,b,na]),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 fg extends N{constructor(){super()}}class vg extends Ar{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(vg)))(n||vg)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:vg,selectors:[["tb-bacnet-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>vg)),multi:!0},{provide:re,useExisting:i((()=>vg)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:14,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"]],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,8,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,10,"gateway.application"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,12,"gateway.devices"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("hideNewFields",n.isLegacy))},dependencies:t.ɵɵgetComponentDepsFactory(vg,[V,b,Pu,hg]),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 bg extends Ar{constructor(){super(...arguments),this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.general?Qr.mapApplicationToUpgradedVersion(e.general):{},devices:e.devices?.length?Qr.mapDevicesToUpgradedVersion(e.devices):[]}}getMappedValue(e){return{general:e.application?Qr.mapApplicationToDowngradedVersion(e.application):{},devices:e.devices?.length?Qr.mapDevicesToDowngradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(bg)))(n||bg)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:bg,selectors:[["tb-bacnet-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>bg)),multi:!0},{provide:re,useExisting:i((()=>bg)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:14,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"]],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,8,"gateway.general")),t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",n.generalTabContent),t.ɵɵadvance(),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(5,10,"gateway.application"),"*"),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate1("label","",t.ɵɵpipeBind1(8,12,"gateway.devices"),"*"),t.ɵɵadvance(3),t.ɵɵproperty("hideNewFields",n.isLegacy))},dependencies:t.ɵɵgetComponentDepsFactory(bg,[V,b,Pu,hg]),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})}}const xg=(e,t)=>({hasErrors:e,noErrors:t}),wg=()=>({minWidth:"144px",maxWidth:"144px",textAlign:"center"}),Cg=()=>({minWidth:"144px",maxWidth:"144px",width:"144px",textAlign:"center"}),Sg=e=>({"tb-current-entity":e});function Eg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",32),t.ɵɵpipe(1,"translate"),t.ɵɵpipe(2,"async"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext();return t.ɵɵresetView(a.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 Tg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",33)(1,"button",34),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext();return t.ɵɵresetView(a.onAddConnector(n))})),t.ɵɵelementStart(2,"mat-icon",35),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 Ig(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-enabled")," "))}function kg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"mat-slide-toggle",37),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return n.stopPropagation(),t.ɵɵresetView(r.onEnableConnector(a))})),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("checked",a.activeConnectors.includes(e.key))}}function Mg(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",38),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-name"),""))}function Pg(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 Fg(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-type")," "))}function Og(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",a.returnType(e)," ")}}function qg(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration")," "))}function Bg(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40)(1,"div",41),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(a.isConnectorSynced(e)?"status-sync":"status-unsync"),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",a.isConnectorSynced(e)?"sync":"out of sync"," ")}}function Rg(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-status")," "))}function Ng(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell",40)(1,"span",42),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.connectorLogs(a,n))})),t.ɵɵelementEnd()()}if(2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction2(3,xg,+a.getErrorsCount(e)>0,0==+a.getErrorsCount(e)||""===a.getErrorsCount(e))),t.ɵɵpropertyInterpolate("matTooltip","Errors: "+a.getErrorsCount(e))}}function _g(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell"),t.ɵɵelement(1,"div",43),t.ɵɵelementStart(2,"div",44),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,wg)),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.connectors-table-actions")))}function Dg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"div",45)(2,"button",46),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.connectorRpc(a,n))})),t.ɵɵelementStart(3,"mat-icon"),t.ɵɵtext(4,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"button",47),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.connectorLogs(a,n))})),t.ɵɵelementStart(6,"mat-icon"),t.ɵɵtext(7,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",48),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.deleteConnector(a,n))})),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"delete"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",49)(12,"button",50),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(13,"mat-icon",51),t.ɵɵtext(14,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-menu",52,1)(17,"button",46),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.connectorRpc(a,n))})),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(20,"button",47),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.connectorLogs(a,n))})),t.ɵɵelementStart(21,"mat-icon"),t.ɵɵtext(22,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",48),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.deleteConnector(a,n))})),t.ɵɵelementStart(24,"mat-icon"),t.ɵɵtext(25,"delete"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,a=t.ɵɵreference(16);t.ɵɵadvance(),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,Cg)),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.value.configurationJson.id),t.ɵɵadvance(10),t.ɵɵproperty("matMenuTriggerFor",a),t.ɵɵadvance(5),t.ɵɵproperty("disabled",!e.value.configurationJson.id)}}function Vg(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",53)}function Gg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-row",54),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).$implicit,r=t.ɵɵnextContext();return t.ɵɵresetView(r.selectConnector(n,a))})),t.ɵɵelementEnd()}if(2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction1(2,Sg,a.isSameConnector(e)))}}function Ag(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",55),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1("v",e.connectorForm.get("configVersion").value,"")}}function jg(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-select",56)(1,"tb-toggle-option",57),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-option",57),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 Lg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind2(1,2,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT))}}function Ug(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind2(1,2,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT))}}function $g(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Lg,2,5,"tb-mqtt-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Ug,2,5,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MQTT))("ngIfElse",e)}}function zg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind2(1,2,e.connectorForm.get("configVersion").value,e.ConnectorType.OPCUA))}}function Kg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind2(1,2,e.connectorForm.get("configVersion").value,e.ConnectorType.OPCUA))}}function Hg(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,zg,2,5,"tb-opc-ua-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Kg,2,5,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.OPCUA))("ngIfElse",e)}}function Wg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function Qg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function Jg(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Wg,1,1,"tb-modbus-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Qg,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MODBUS))("ngIfElse",e)}}function Yg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function Xg(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function Zg(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Yg,1,1,"tb-socket-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Xg,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.SOCKET))("ngIfElse",e)}}function ey(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind2(1,2,e.connectorForm.get("configVersion").value,e.ConnectorType.BACNET))}}function ty(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind2(1,2,e.connectorForm.get("configVersion").value,e.ConnectorType.BACNET))}}function ny(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,ey,2,5,"tb-bacnet-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,ty,2,5,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.BACNET))("ngIfElse",e)}}function ay(e,n){if(1&e&&(t.ɵɵelementContainerStart(0)(1,62),t.ɵɵtemplate(2,$g,5,5,"ng-container",63)(3,Hg,5,5,"ng-container",63)(4,Jg,5,5,"ng-container",63)(5,Zg,5,5,"ng-container",63)(6,ny,5,5,"ng-container",63),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",e.initialConnector.type),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET)}}function ry(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group")(1,"mat-tab",68),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,69),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",68),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-json-object-edit",70),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(41);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 iy(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",58),t.ɵɵtemplate(1,ay,7,6,"ng-container",59)(2,ry,8,12,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(4,"div",60)(5,"button",61),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onSaveConnector())})),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵreference(3),a=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(e=a.connectorForm.get("mode"))?null:e.value)===a.ConnectorConfigurationModes.BASIC)("ngIfElse",n),t.ɵɵadvance(4),t.ɵɵproperty("disabled",!a.connectorForm.dirty||a.connectorForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,4,"action.save")," ")}}function oy(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",87),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 sy(e,n){1&e&&(t.ɵɵelementStart(0,"div",72)(1,"div",83),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",74)(4,"mat-form-field",75),t.ɵɵelement(5,"input",88),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function py(e,n){1&e&&(t.ɵɵelementStart(0,"div",72)(1,"div",83),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",74)(4,"mat-form-field",75),t.ɵɵelement(5,"input",89),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function ly(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",57),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function cy(e,n){1&e&&(t.ɵɵelementStart(0,"div",72)(1,"mat-slide-toggle",90)(2,"mat-label",91),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 dy(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",92),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Connector)}}function my(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",71)(1,"div",72)(2,"div",73),t.ɵɵtext(3,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",74)(5,"mat-form-field",75),t.ɵɵelement(6,"input",76),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,oy,3,3,"mat-icon",77),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,sy,7,3,"div",78)(10,py,7,3,"div",78),t.ɵɵelementStart(11,"div",79)(12,"div",80),t.ɵɵtext(13,"gateway.logs-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",81)(15,"mat-slide-toggle",82)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",72)(20,"div",83),t.ɵɵtext(21,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",74)(23,"mat-form-field",75)(24,"mat-select",84),t.ɵɵtemplate(25,ly,2,2,"mat-option",85),t.ɵɵelementEnd()()()()(),t.ɵɵtemplate(26,cy,6,6,"div",78),t.ɵɵpipe(27,"withReportStrategy"),t.ɵɵtemplate(28,dy,1,2,"tb-report-strategy",86),t.ɵɵpipe(29,"withReportStrategy"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.connectorForm),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.connectorForm.get("name").hasError("required")&&e.connectorForm.get("name").touched||e.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.GRPC),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.enable-remote-logging")," "),t.ɵɵadvance(8),t.ɵɵproperty("ngForOf",e.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.MQTT&&!t.ɵɵpipeBind2(27,13,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(29,16,e.connectorForm.get("configVersion").value,e.connectorForm.get("type").value))}}class uy{isErrorState(e){return e&&e.invalid}}e("ForceErrorStateMatcher",uy);class gy extends R{constructor(e,t,n,a,r,i,o,s,p,l,c){super(e),this.store=e,this.fb=t,this.translate=n,this.attributeService=a,this.dialogService=r,this.dialog=i,this.telemetryWsService=o,this.zone=s,this.utils=p,this.withReportStrategy=l,this.cd=c,this.ConnectorType=Je,this.allowBasicConfig=new Set([Je.MQTT,Je.OPCUA,Je.MODBUS,Je.SOCKET,Je.BACNET]),this.gatewayLogLevel=Object.values(We),this.displayedColumns=["enabled","key","type","syncStatus","errors","actions"],this.GatewayConnectorTypesTranslatesMap=Ye,this.ConnectorConfigurationModes=_t,this.ReportStrategyDefaultValue=Vt,this.basicConfigInitSubject=new me,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 me,this.attributeUpdateSubject=new me,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)?C.SHARED_SCOPE:C.SERVER_SCOPE;ve(this.getEntityAttributeTasks(e,n)).pipe(Ie(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=[],a=[{key:e.name,value:e}],r=[],i=!this.activeConnectors.includes(e.name)&&t===C.SHARED_SCOPE||!this.inactiveConnectors.includes(e.name)&&t===C.SERVER_SCOPE,o=this.initialConnector&&this.initialConnector.name!==e.name;return o&&(r.push({key:this.initialConnector.name}),this.removeConnectorFromList(this.initialConnector.name,!0),this.removeConnectorFromList(this.initialConnector.name,!1)),i&&(t===C.SHARED_SCOPE?this.activeConnectors.push(e.name):this.inactiveConnectors.push(e.name)),(o||i)&&n.push(this.getSaveEntityAttributesTask(t)),n.push(this.attributeService.saveEntityAttributes(this.device,t,a)),r.length&&n.push(this.attributeService.deleteEntityAttributes(this.device,t,r)),n}getSaveEntityAttributesTask(e){const t=e===C.SHARED_SCOPE?"active_connectors":"inactive_connectors",n=e===C.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,a=n.indexOf(e);-1!==a&&n.splice(a,1)}getUpdatedConnectorData(e){const t={...e};return t.configuration=`${Z(t.name)}.json`,delete t.basicConfig,t.type!==Je.GRPC&&delete t.key,t.type!==Je.CUSTOM&&delete t.class,this.allowBasicConfig.has(t.type)||delete t.mode,this.withReportStrategy.transform(t.configVersion,t.type)&&J(t.reportStrategy)&&delete t.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=h[this.sort.direction.toUpperCase()],this.attributeDataSource.loadAttributes(this.device,C.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,C.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,C.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,a=n.name===t.name,r=U(n.configurationJson,{})&&a,i=this.hasSameConfig(n.configurationJson,t.configurationJson),o=n.ts&&n.ts<=t.ts;return a&&o&&(i||r)}))}hasSameConfig(e,t){const{name:n,id:a,enableRemoteLogging:r,logLevel:i,reportStrategy:o,configVersion:s,...p}=e,{name:l,id:c,enableRemoteLogging:d,logLevel:m,reportStrategy:u,configVersion:g,...y}=t;return U(p,y)}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:_t.BASIC,name:"",type:Je.MQTT,sendDataOnlyOnChange:!1,enableRemoteLogging:!1,logLevel:We.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(Ie(1),Fe((t=>{if(!t)return;const n=[],a=this.activeConnectors.includes(e.value?.name)?C.SHARED_SCOPE:C.SERVER_SCOPE;return n.push(this.attributeService.deleteEntityAttributes(this.device,a,[e])),this.removeConnectorFromList(e.key,!0),this.removeConnectorFromList(e.key,!1),n.push(this.getSaveEntityAttributesTask(a)),ve(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=G(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=G(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(Ie(1),xe(Boolean),Fe((()=>this.openAddConnectorDialog())),xe(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(Ie(1)).subscribe((()=>{this.patchConnectorBasicConfig(e.basicConfig)})):this.patchConnectorBasicConfig(e.basicConfig)}setInitialConnectorValues(e){const{basicConfig:t,mode:n,enableRemoteLogging:a,...r}=e;this.toggleReportStrategy(e),this.connectorForm.get("mode").setValue(this.allowBasicConfig.has(e.type)?e.mode??_t.BASIC:null,{emitEvent:!1}),this.connectorForm.get("enableRemoteLogging").setValue(a,{emitEvent:!1}),this.connectorForm.patchValue(r,{emitEvent:!1})}openAddConnectorDialog(){return this.ctx.ngZone.run((()=>this.dialog.open(ds,{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)),a=this.initialConnector?.name.toLowerCase()===t;return n&&!a?{duplicateName:{valid:!1}}:null}}initDataSources(){const e={property:"key",direction:h.ASC};this.pageLink=new f(1e3,0,null,e),this.attributeDataSource=new ra(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.inactiveConnectorsDataSource=new ra(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.serverDataSource=new ra(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.dataSource=new g([])}initConnectorForm(){this.connectorForm=this.fb.group({mode:[_t.BASIC],name:["",[ne.required,this.uniqNameRequired(),ne.pattern($e)]],type:["",[ne.required]],enableRemoteLogging:[!1],logLevel:["",[ne.required]],sendDataOnlyOnChange:[!1],key:["auto"],class:[""],configuration:[""],configurationJson:[{},[ne.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()===h.DESC?-1:1/0:n;default:return e[t]||e.value[t]}}}loadConnectors(){this.device&&this.device.id!==w&&ve([this.attributeService.getEntityAttributes(this.device,C.SHARED_SCOPE,["active_connectors"]),this.attributeService.getEntityAttributes(this.device,C.SERVER_SCOPE,["inactive_connectors"]),this.attributeService.getEntityAttributes(this.device,C.CLIENT_SCOPE,["Version"])]).pipe(be(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,C.SERVER_SCOPE).pipe(be(this.destroy$)).subscribe((e=>{const t=e.find((e=>"active"===e.key)).value,n=e.find((e=>"lastDisconnectTime"===e.key))?.value,a=e.find((e=>"lastConnectTime"===e.key))?.value;this.isGatewayActive=this.getGatewayStatus(t,a,n)}))}parseConnectors(e){const t=e?.[0]?.value||[];return Q(t)?JSON.parse(t):t}observeModeChange(){this.connectorForm.get("mode").valueChanges.pipe(be(this.destroy$)).subscribe((e=>{e===_t.BASIC&&this.patchConnectorBasicConfig(this.connectorForm.get("configurationJson").value)}))}observeAttributeChange(){this.attributeUpdateSubject.pipe(ke(300),we((e=>this.executeAttributeUpdates(e))),be(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){ve(this.getAttributeExecutionTasks(e)).pipe(Ie(1),we((()=>this.updateData(!0))),be(this.destroy$)).subscribe()}getAttributeExecutionTasks(e){const t=this.activeConnectors.includes(e.key),n=t?C.SERVER_SCOPE:C.SHARED_SCOPE,a=t?C.SHARED_SCOPE:C.SERVER_SCOPE;return[this.attributeService.saveEntityAttributes(this.device,C.SHARED_SCOPE,[{key:"active_connectors",value:this.activeConnectors}]),this.attributeService.saveEntityAttributes(this.device,C.SERVER_SCOPE,[{key:"inactive_connectors",value:this.inactiveConnectors}]),this.attributeService.deleteEntityAttributes(this.device,n,[e]),this.attributeService.saveEntityAttributes(this.device,a,[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],a=e.find((e=>"lastConnectTime"===e.dataKey.name)).data[0][1];this.isGatewayActive=this.getGatewayStatus(t,a,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:S.entity,entityType:E.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(T.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(xe((()=>!!this.initialConnector)),be(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("configurationJson"),n=this.connectorForm.get("type").value,a=this.connectorForm.get("mode").value;if(!U(e,t?.value)&&this.allowBasicConfig.has(n)&&a===_t.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(be(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("basicConfig"),n=this.connectorForm.get("type").value,a=this.connectorForm.get("mode").value;!U(e,t?.value)&&this.allowBasicConfig.has(n)&&a===_t.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):he(!0)}setFormValue(e){this.connectorForm.disabled&&this.connectorForm.enable();const t=zr.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!==_t.ADVANCED?this.basicConfigInitSubject.asObservable().pipe(Ie(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===Je.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||gy)(t.ɵɵdirectiveInject(ce.Store),t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(Ne.TranslateService),t.ɵɵdirectiveInject(A.AttributeService),t.ɵɵdirectiveInject(A.DialogService),t.ɵɵdirectiveInject(pe.MatDialog),t.ɵɵdirectiveInject(A.TelemetryWebsocketService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(A.UtilsService),t.ɵɵdirectiveInject(Jr),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gy,selectors:[["tb-gateway-connector"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(u,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:Ue,useClass:uy},Jr]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:42,vars:21,consts:[["generalTabContent",""],["cellActionsMenu","matMenu"],["defaultConfig",""],["legacy",""],[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","click",4,"ngIf"],[1,"table-container"],["class","mat-headline-5 tb-absolute-fill tb-add-new items-center justify-center",4,"ngIf"],["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"],["class","version-placeholder",4,"ngIf"],["formControlName","mode","appearance","fill",4,"ngIf"],["translate","",1,"no-data-found","items-center","justify-center"],["class","tb-form-panel section-container no-border no-padding tb-flex space-between",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["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","","matTooltip","RPC","matTooltipPosition","above",3,"click","disabled"],["mat-icon-button","","matTooltip","Logs","matTooltipPosition","above",3,"click"],["mat-icon-button","","matTooltip","Delete connector","matTooltipPosition","above",3,"click"],[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"],[1,"version-placeholder"],["formControlName","mode","appearance","fill"],[3,"value"],[1,"tb-form-panel","section-container","no-border","no-padding","tb-flex","space-between"],[4,"ngIf","ngIfElse"],[1,"flex","justify-end"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[3,"ngSwitch"],[4,"ngSwitchCase"],["formControlName","basicConfig",3,"generalTabContent","withReportStrategy","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"generalTabContent","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],[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"],[3,"value",4,"ngFor","ngForOf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4)(1,"section",5)(2,"mat-toolbar",6)(3,"h2"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(6,Eg,5,6,"button",7),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",8),t.ɵɵtemplate(8,Tg,7,3,"section",9),t.ɵɵelementStart(9,"table",10),t.ɵɵelementContainerStart(10,11),t.ɵɵtemplate(11,Ig,3,3,"mat-header-cell",12)(12,kg,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,14),t.ɵɵtemplate(14,Mg,3,3,"mat-header-cell",15)(15,Pg,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(16,16),t.ɵɵtemplate(17,Fg,3,3,"mat-header-cell",17)(18,Og,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(19,19),t.ɵɵtemplate(20,qg,3,3,"mat-header-cell",17)(21,Bg,3,3,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(22,20),t.ɵɵtemplate(23,Rg,3,3,"mat-header-cell",17)(24,Ng,2,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,21),t.ɵɵtemplate(26,_g,5,6,"mat-header-cell",22)(27,Dg,26,6,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,Vg,1,0,"mat-header-row",23)(29,Gg,1,4,"mat-row",24),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"section",25)(31,"div",26)(32,"div",27),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,Ag,2,1,"span",28),t.ɵɵelementEnd(),t.ɵɵtemplate(36,jg,7,8,"tb-toggle-select",29),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"span",30),t.ɵɵtext(38," gateway.select-connector "),t.ɵɵelementEnd(),t.ɵɵtemplate(39,iy,8,6,"section",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(40,my,30,19,"ng-template",null,0,t.ɵɵtemplateRefExtractor)),2&e&&(t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,17,"gateway.connectors")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==n.dataSource||null==n.dataSource.data?null:n.dataSource.data.length),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!(null!=n.dataSource&&(null!=n.dataSource.data&&n.dataSource.data.length))),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,19,"gateway.configuration")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("configVersion").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.initialConnector&&n.allowBasicConfig.has(n.initialConnector.type)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.initialConnector),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.initialConnector))},dependencies:t.ɵɵgetComponentDepsFactory(gy,[V,b,Jr,ts,Zl,ec,Ul,Ll,mm,um,wu,Cu,ma,vg,bg]),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",gy);class yy{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||yy)(t.ɵɵdirectiveInject(A.DeviceService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yy,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(yy,[V,b]),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 hy,fy,vy;e("DeviceGatewayCommandComponent",yy),e("GatewayBasicConfigTab",hy),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"}(hy||e("GatewayBasicConfigTab",hy={})),e("StorageTypes",fy),function(e){e.MEMORY="memory",e.FILE="file",e.SQLITE="sqlite"}(fy||e("StorageTypes",fy={})),e("LocalLogsConfigs",vy),function(e){e.service="service",e.connector="connector",e.converter="converter",e.tb_connection="tb_connection",e.storage="storage",e.extension="extension"}(vy||e("LocalLogsConfigs",vy={}));const by=e("LocalLogsConfigTranslateMap",new Map([[vy.service,"Service"],[vy.connector,"Connector"],[vy.converter,"Converter"],[vy.tb_connection,"TB Connection"],[vy.storage,"Storage"],[vy.extension,"Extension"]])),xy=e("StorageTypesTranslationMap",new Map([[fy.MEMORY,"gateway.storage-types.memory-storage"],[fy.FILE,"gateway.storage-types.file-storage"],[fy.SQLITE,"gateway.storage-types.sqlite"]]));var wy;e("LogSavingPeriod",wy),function(e){e.days="D",e.hours="H",e.minutes="M",e.seconds="S"}(wy||e("LogSavingPeriod",wy={}));const Cy=e("LogSavingPeriodTranslations",new Map([[wy.days,"gateway.logs.days"],[wy.hours,"gateway.logs.hours"],[wy.minutes,"gateway.logs.minutes"],[wy.seconds,"gateway.logs.seconds"]]));var Sy;e("SecurityTypes",Sy),function(e){e.ACCESS_TOKEN="accessToken",e.USERNAME_PASSWORD="usernamePassword",e.TLS_ACCESS_TOKEN="tlsAccessToken",e.TLS_PRIVATE_KEY="tlsPrivateKey"}(Sy||e("SecurityTypes",Sy={}));const Ey=e("SecurityTypesTranslationsMap",new Map([[Sy.ACCESS_TOKEN,"gateway.security-types.access-token"],[Sy.USERNAME_PASSWORD,"gateway.security-types.username-password"],[Sy.TLS_ACCESS_TOKEN,"gateway.security-types.tls-access-token"]])),Ty=e("numberInputPattern",new RegExp(/^\d{1,15}$/)),Iy=e("logsHandlerClass","thingsboard_gateway.tb_utility.tb_rotating_file_handler.TimedRotatingFileHandler"),ky=e("logsLegacyHandlerClass","thingsboard_gateway.tb_utility.tb_handler.TimedRotatingFileHandler");function My(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",10),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,a.storageTypesTranslationMap.get(e))," ")}}function Py(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 Fy(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 Oy(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 qy(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 By(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 Ry(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 Ny(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",11)(1,"mat-form-field",12)(2,"mat-label",13),t.ɵɵtext(3,"gateway.storage-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",14),t.ɵɵtemplate(5,Py,3,3,"mat-error",15)(6,Fy,3,3,"mat-error",15)(7,Oy,3,3,"mat-error",15),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",12)(12,"mat-label",13),t.ɵɵtext(13,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",17),t.ɵɵtemplate(15,qy,3,3,"mat-error",15)(16,By,3,3,"mat-error",15)(17,Ry,3,3,"mat-error",15),t.ɵɵelementStart(18,"mat-icon",16),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,8,"gateway.hints.read-record-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,10,"gateway.hints.max-records-count"))}}function _y(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 Dy(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 Vy(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 Gy(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 Ay(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 jy(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 Ly(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 Uy(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 $y(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 zy(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 Ky(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-data-folder-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",18),t.ɵɵtemplate(6,_y,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",19),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.storage-max-files"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",20),t.ɵɵtemplate(14,Dy,3,3,"mat-error",15)(15,Vy,3,3,"mat-error",15)(16,Gy,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"mat-form-field",12)(22,"mat-label",13),t.ɵɵtext(23,"gateway.storage-max-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",21),t.ɵɵtemplate(25,Ay,3,3,"mat-error",15)(26,jy,3,3,"mat-error",15)(27,Ly,3,3,"mat-error",15),t.ɵɵelementStart(28,"mat-icon",16),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"mat-form-field",12)(32,"mat-label",13),t.ɵɵtext(33,"gateway.storage-max-file-records"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",22),t.ɵɵtemplate(35,Uy,3,3,"mat-error",15)(36,$y,3,3,"mat-error",15)(37,zy,3,3,"mat-error",15),t.ɵɵelementStart(38,"mat-icon",16),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_folder_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,14,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,16,"gateway.hints.max-file-count")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,18,"gateway.hints.max-read-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,20,"gateway.hints.max-records"))}}function Hy(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 Wy(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 Qy(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 Jy(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 Yy(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 Xy(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 Zy(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 eh(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",23),t.ɵɵtemplate(6,Hy,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",16),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.messages-ttl-check-in-hours"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",24),t.ɵɵtemplate(14,Wy,3,3,"mat-error",15)(15,Qy,3,3,"mat-error",15)(16,Jy,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"mat-form-field",25)(21,"mat-label",13),t.ɵɵtext(22,"gateway.messages-ttl-in-days"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",26),t.ɵɵtemplate(24,Yy,3,3,"mat-error",15)(25,Xy,3,3,"mat-error",15)(26,Zy,3,3,"mat-error",15),t.ɵɵelementStart(27,"mat-icon",16),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_file_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,10,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,12,"gateway.hints.ttl-check-hour")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,14,"gateway.hints.ttl-messages-day"))}}class th{constructor(e){this.fb=e,this.initialized=new r,this.StorageTypes=fy,this.storageTypes=Object.values(fy),this.storageTypesTranslationMap=xy,this.onChange=()=>{},this.storageFormGroup=this.initStorageFormGroup(),this.observeStorageTypeChanges(),this.storageFormGroup.valueChanges.pipe(Vr()).subscribe((e=>{this.onChange(e)}))}ngAfterViewInit(){this.initialized.emit({storage:this.storageFormGroup.value})}writeValue(e){this.storageFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.storageFormGroup.valid?null:{storageFormGroup:{valid:!1}}}removeAllStorageValidators(){for(const e in this.storageFormGroup.controls)"type"!==e&&(this.storageFormGroup.controls[e].clearValidators(),this.storageFormGroup.controls[e].setErrors(null),this.storageFormGroup.controls[e].updateValueAndValidity())}initStorageFormGroup(){return this.fb.group({type:[fy.MEMORY,[ne.required]],read_records_count:[100,[ne.required,ne.min(1),ne.pattern(Ty)]],max_records_count:[1e5,[ne.required,ne.min(1),ne.pattern(Ty)]],data_folder_path:["./data/",[ne.required]],max_file_count:[10,[ne.min(1),ne.pattern(Ty)]],max_read_records_count:[10,[ne.min(1),ne.pattern(Ty)]],max_records_per_file:[1e4,[ne.min(1),ne.pattern(Ty)]],data_file_path:["./data/data.db",[ne.required]],messages_ttl_check_in_hours:[1,[ne.min(1),ne.pattern(Ty)]],messages_ttl_in_days:[7,[ne.min(1),ne.pattern(Ty)]]})}observeStorageTypeChanges(){this.storageFormGroup.get("type").valueChanges.pipe(Vr()).subscribe((e=>{switch(this.removeAllStorageValidators(),e){case fy.MEMORY:this.addMemoryStorageValidators(this.storageFormGroup);break;case fy.FILE:this.addFileStorageValidators(this.storageFormGroup);break;case fy.SQLITE:this.addSqliteStorageValidators(this.storageFormGroup)}}))}addMemoryStorageValidators(e){e.get("read_records_count").addValidators([ne.required,ne.min(1),ne.pattern(Ty)]),e.get("max_records_count").addValidators([ne.required,ne.min(1),ne.pattern(Ty)]),e.get("read_records_count").updateValueAndValidity({emitEvent:!1}),e.get("max_records_count").updateValueAndValidity({emitEvent:!1})}addFileStorageValidators(e){["max_file_count","max_read_records_count","max_records_per_file"].forEach((t=>{e.get(t).addValidators([ne.required,ne.min(1),ne.pattern(Ty)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}addSqliteStorageValidators(e){["messages_ttl_check_in_hours","messages_ttl_in_days"].forEach((t=>{e.get(t).addValidators([ne.required,ne.min(1),ne.pattern(Ty)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}static{this.ɵfac=function(e){return new(e||th)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:th,selectors:[["tb-gateway-storage-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>th)),multi:!0},{provide:re,useExisting:i((()=>th)),multi:!0}]),t.ɵɵStandaloneFeature],decls:15,vars:9,consts:[[1,"mat-content","mat-padding","configuration-block","w-full",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",4,"ngFor","ngForOf"],[1,"tb-form-panel-hint"],[3,"ngSwitch"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"value"],[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"],[4,"ngIf"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","number","matInput","","formControlName","max_records_count"],["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"],["appearance","outline",1,"mat-block"],["matInput","","type","number","formControlName","messages_ttl_in_days"]],template:function(e,n){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.ɵɵtemplate(7,My,3,4,"tb-toggle-option",5),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(11,7),t.ɵɵtemplate(12,Ny,21,12,"section",8)(13,Ky,41,22,"section",9)(14,eh,30,16,"section",9),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.storageFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.storageTypes),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.hints."+n.storageFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.storageFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.MEMORY),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.FILE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.SQLITE))},dependencies:t.ɵɵgetComponentDepsFactory(th,[V,b]),styles:['@charset "UTF-8";[_nghost-%COMP%] .configuration-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;max-height:70vh}[_nghost-%COMP%] .dialog-mode[_ngcontent-%COMP%] .configuration-block[_ngcontent-%COMP%]{max-height:60vh}']})}}function nh(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 ah(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 rh(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 ih(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 oh(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 sh(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 ph(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 lh(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 ch(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 dh(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 mh(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 uh(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 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.grpc-min-time-between-pings-pattern")," "))}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.grpc-max-pings-without-data-required")," "))}function hh(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 fh(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 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.grpc-min-ping-interval-without-data-required")," "))}function bh(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 xh(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 wh{constructor(e){this.fb=e,this.initialized=new r,this.onChange=()=>{},this.grpcFormGroup=this.initGrpcFormGroup(),this.grpcFormGroup.valueChanges.pipe(Vr()).subscribe((e=>{this.onChange(e)})),this.grpcFormGroup.get("enabled").valueChanges.pipe(Vr()).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,[ne.required,ne.min(1),ne.max(65535),ne.pattern(Ty)]],keepAliveTimeMs:[1e4,[ne.required,ne.min(1),ne.pattern(Ty)]],keepAliveTimeoutMs:[5e3,[ne.required,ne.min(1),ne.pattern(Ty)]],keepalivePermitWithoutCalls:[!0],maxPingsWithoutData:[0,[ne.required,ne.min(0),ne.pattern(Ty)]],minTimeBetweenPingsMs:[1e4,[ne.required,ne.min(1),ne.pattern(Ty)]],minPingIntervalWithoutDataMs:[5e3,[ne.required,ne.min(1),ne.pattern(Ty)]]})}static{this.ɵfac=function(e){return new(e||wh)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:wh,selectors:[["tb-gateway-grpc-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>wh)),multi:!0},{provide:re,useExisting:i((()=>wh)),multi:!0}]),t.ɵɵStandaloneFeature],decls:75,vars:47,consts:[[1,"mat-content","mat-padding","configuration-block",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"],[4,"ngIf"],["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,nh,3,3,"mat-error",10)(20,ah,3,3,"mat-error",10)(21,rh,3,3,"mat-error",10)(22,ih,3,3,"mat-error",10),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",11),t.ɵɵelementStart(27,"mat-icon",9),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(30,oh,3,3,"mat-error",10)(31,sh,3,3,"mat-error",10)(32,ph,3,3,"mat-error",10),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",12),t.ɵɵelementStart(38,"mat-icon",9),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(41,lh,3,3,"mat-error",10)(42,ch,3,3,"mat-error",10)(43,dh,3,3,"mat-error",10),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",13),t.ɵɵelementStart(48,"mat-icon",9),t.ɵɵpipe(49,"translate"),t.ɵɵtext(50,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(51,mh,3,3,"mat-error",10)(52,uh,3,3,"mat-error",10)(53,gh,3,3,"mat-error",10),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",14),t.ɵɵelementStart(59,"mat-icon",9),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(62,yh,3,3,"mat-error",10)(63,hh,3,3,"mat-error",10)(64,fh,3,3,"mat-error",10),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",15),t.ɵɵelementStart(69,"mat-icon",9),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(72,vh,3,3,"mat-error",10)(73,bh,3,3,"mat-error",10)(74,xh,3,3,"mat-error",10),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.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,37,"gateway.hints.grpc-keep-alive-timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,39,"gateway.hints.grpc-keep-alive")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,41,"gateway.hints.grpc-min-time-between-pings")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(60,43,"gateway.hints.grpc-max-pings-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,45,"gateway.hints.grpc-min-ping-interval-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("pattern")))},dependencies:t.ɵɵgetComponentDepsFactory(wh,[V,b]),styles:['@charset "UTF-8";[_nghost-%COMP%] .configuration-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;max-height:70vh}[_nghost-%COMP%] .dialog-mode[_ngcontent-%COMP%] .configuration-block[_ngcontent-%COMP%]{max-height:60vh}']})}}function Ch(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 Sh(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 Eh(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function Th(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",30),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,a=t.ɵɵnextContext();t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(a.localLogsConfigTranslateMap.get(e))}}function Ih(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function kh(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 Mh(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 Ph(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 Fh(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),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 Oh(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 qh(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 Bh{constructor(e){this.fb=e,this.initialized=new r,this.logSavingPeriods=Cy,this.localLogsConfigs=Object.keys(vy),this.localLogsConfigTranslateMap=by,this.gatewayLogLevel=Object.values(We),this.remoteLogLevel=Object.values(We).filter((e=>e!==We.NONE)),this.onChange=()=>{},this.logsFormGroup=this.initLogsFormGroup(),this.showRemoteLogsControl=this.fb.control(!1),this.logsFormGroup.valueChanges.pipe(Vr()).subscribe((e=>{this.onChange(e)})),this.logSelector=this.fb.control(vy.service);for(const e of Object.keys(vy))this.addLocalLogConfig(e,{});this.showRemoteLogsControl.valueChanges.pipe(Vr()).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??We.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",[ne.required,ne.pattern(/^[^\s].*[^\s]$/)]],logFormat:["%(asctime)s.%(msecs)03d - |%(levelname)s| - [%(filename)s] - %(module)s - %(funcName)s - %(lineno)d - %(message)s",[ne.required,ne.pattern(/^[^\s].*[^\s]$/)]],type:["remote",[ne.required]],logLevel:[{value:We.INFO,disabled:!0}],local:this.fb.group({})})}addLocalLogConfig(e,t){const n=this.logsFormGroup.get("local"),a=this.fb.group({logLevel:[t.logLevel||We.INFO,[ne.required]],filePath:[t.filePath||"./logs",[ne.required]],backupCount:[t.backupCount||7,[ne.required,ne.min(0)]],savingTime:[t.savingTime||3,[ne.required,ne.min(0)]],savingPeriod:[t.savingPeriod||wy.days,[ne.required]]});n.addControl(e,a,{emitEvent:!1})}updateRemoteLogs(e){const t=e&&e!==We.NONE;this.showRemoteLogsControl.patchValue(t,{emitEvent:!1}),this.logsFormGroup.get("logLevel")[t?"enable":"disable"]({emitEvent:!1}),this.logsFormGroup.get("logLevel").patchValue(e===We.NONE?We.INFO:e,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||Bh)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Bh,selectors:[["tb-gateway-logs-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Bh)),multi:!0},{provide:re,useExisting:i((()=>Bh)),multi:!0}]),t.ɵɵStandaloneFeature],decls:72,vars:33,consts:[[1,"mat-content","mat-padding","configuration-block",3,"formGroup"],[1,"tb-form-panel","no-padding-bottom"],[1,"flex","flex-col"],["appearance","outline"],["translate",""],["matInput","","formControlName","dateFormat"],[4,"ngIf"],["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",4,"ngFor","ngForOf"],["formGroupName","local",1,"tb-form-panel","no-padding-bottom"],["translate","",1,"tb-form-panel-title"],[1,"toggle-group",3,"formControl"],["class","first-capital",3,"value",4,"ngFor","ngForOf"],[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"],[3,"value"],[1,"first-capital",3,"value"]],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,Ch,3,3,"mat-error",6),t.ɵɵelementStart(8,"mat-icon",7),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",8),t.ɵɵtemplate(15,Sh,3,3,"mat-error",6),t.ɵɵelementStart(16,"mat-icon",7),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",9)(20,"mat-expansion-panel",10)(21,"mat-expansion-panel-header",11)(22,"mat-panel-title")(23,"mat-slide-toggle",12),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵelementStart(24,"mat-label")(25,"div",13),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",14),t.ɵɵtemplate(33,Eh,2,2,"mat-option",15),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(34,"div",16)(35,"div",17),t.ɵɵtext(36,"gateway.logs.local"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"tb-toggle-select",18),t.ɵɵtemplate(38,Th,2,2,"tb-toggle-option",19),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(39,20),t.ɵɵelementStart(40,"div",21)(41,"mat-form-field",22)(42,"mat-label",4),t.ɵɵtext(43,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-select",14),t.ɵɵtemplate(45,Ih,2,2,"mat-option",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",22)(47,"mat-label",4),t.ɵɵtext(48,"gateway.logs.file-path"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",23),t.ɵɵtemplate(50,kh,3,3,"mat-error",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"div",21)(52,"div",24)(53,"mat-form-field",22)(54,"mat-label",4),t.ɵɵtext(55,"gateway.logs.saving-period"),t.ɵɵelementEnd(),t.ɵɵelement(56,"input",25),t.ɵɵtemplate(57,Mh,3,3,"mat-error",6)(58,Ph,3,3,"mat-error",6),t.ɵɵelementEnd(),t.ɵɵelementStart(59,"mat-form-field",26)(60,"mat-select",27),t.ɵɵtemplate(61,Fh,3,4,"mat-option",15),t.ɵɵpipe(62,"keyvalue"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(63,"mat-form-field",22)(64,"mat-label",4),t.ɵɵtext(65,"gateway.logs.backup-count"),t.ɵɵelementEnd(),t.ɵɵelement(66,"input",28),t.ɵɵtemplate(67,Oh,3,3,"mat-error",6)(68,qh,3,3,"mat-error",6),t.ɵɵelementStart(69,"mat-icon",7),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.logsFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("dateFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,21,"gateway.hints.date-form")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("logFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",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.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,25,"gateway.hints.remote-log")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,27,"gateway.logs.remote")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.remoteLogLevel),t.ɵɵadvance(4),t.ɵɵproperty("formControl",n.logSelector),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.localLogsConfigs),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.getLogFormGroup(n.logSelector.value)),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(5),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".filePath").hasError("required")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("min")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(62,29,n.logSavingPeriods)),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("min")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,31,"gateway.hints.backup-count")))},dependencies:t.ɵɵgetComponentDepsFactory(Bh,[V,b]),styles:['@charset "UTF-8";.configuration-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;max-height:70vh}.dialog-mode[_ngcontent-%COMP%] .configuration-block[_ngcontent-%COMP%]{max-height:60vh}']})}}function Rh(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 Nh(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 _h(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,"device.generate-client-id"))}function Dh(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 Vh(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 Gh(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("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 Ah(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 jh(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("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 Lh(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"device.client-id-or-user-name-necessary"))}function Uh(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"gateway.hints.username-required-with-password"))}class $h{constructor(e){this.fb=e,this.onChange=()=>{},this.initForm(),this.usernameFormGroup.valueChanges.pipe(Vr()).subscribe((e=>this.onChange(e)))}writeValue(e){this.usernameFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){e?this.usernameFormGroup.disable({emitEvent:!1}):this.usernameFormGroup.enable({emitEvent:!1})}validate(){return this.usernameFormGroup.valid?null:{usernameFormGroup:{valid:!1}}}initForm(){this.usernameFormGroup=this.createSecurityFormGroup()}createSecurityFormGroup(){return this.fb.group({clientId:[null,[ne.pattern(/^[^.\s]+$/)]],username:[null,[ne.pattern(/^[^.\s]+$/)]],password:[null,[ne.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(X(20))}static{this.ɵfac=function(e){return new(e||$h)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$h,selectors:[["tb-gateway-username-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>$h)),multi:!0},{provide:re,useExisting:i((()=>$h)),multi:!0}]),t.ɵɵStandaloneFeature],decls:33,vars:17,consts:[[3,"formGroup"],[1,"tb-form-row","no-border","no-padding","tb-standard-fields"],["appearance","outline",1,"flex"],["translate",""],["matInput","","formControlName","clientId"],[4,"ngIf"],["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"],["class","block",3,"error",4,"ngIf"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"],[1,"block",3,"error"]],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,Rh,3,3,"mat-error",5)(7,Nh,2,4,"tb-copy-button",6)(8,_h,4,3,"button",7),t.ɵɵelementStart(9,"mat-icon",8),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",9),t.ɵɵtemplate(16,Dh,3,3,"mat-error",5)(17,Vh,2,4,"tb-copy-button",6)(18,Gh,4,3,"button",7),t.ɵɵelementStart(19,"mat-icon",8),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"mat-form-field",10)(23,"mat-label",3),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",11),t.ɵɵtemplate(26,Ah,2,4,"tb-copy-button",6)(27,jh,4,3,"button",7),t.ɵɵelementStart(28,"mat-icon",8),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵtemplate(31,Lh,2,3,"tb-error",12)(32,Uh,2,3,"tb-error",12)),2&e&&(t.ɵɵproperty("formGroup",n.usernameFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.usernameFormGroup.get("clientId").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.get("username").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("atLeastOneRequired")&&n.usernameFormGroup.touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("usernameRequired")&&n.usernameFormGroup.touched))},dependencies:t.ɵɵgetComponentDepsFactory($h,[V,b]),encapsulation:2})}}class zh{constructor(e,t){this.deviceService=e,this.destroyRef=t,this.initialCredentialsSubject=new ge(null)}get initialCredentials(){return this.initialCredentialsSubject.value}get initialCredentials$(){return this.initialCredentialsSubject.asObservable()}updateCredentials(e){let t={};switch(e.type){case Sy.USERNAME_PASSWORD:this.shouldUpdateCredentials(e)&&(t=this.generateMqttCredentials(e));break;case Sy.ACCESS_TOKEN:case Sy.TLS_ACCESS_TOKEN:this.shouldUpdateAccessToken(e)&&(t={credentialsType:D.ACCESS_TOKEN,credentialsId:e.accessToken,credentialsValue:null})}return this.initialCredentialsSubject.next({...this.initialCredentials,...t}),Object.keys(t).length?this.deviceService.saveDeviceCredentials(this.initialCredentials):he(null)}setInitialCredentials(e){this.deviceService.getDeviceCredentials(e.id).pipe(Vr(this.destroyRef)).subscribe((e=>{this.initialCredentialsSubject.next({...e,version:null})}))}shouldUpdateSecurityConfig(e){switch(e.type){case Sy.USERNAME_PASSWORD:return this.shouldUpdateCredentials(e);case Sy.ACCESS_TOKEN:case Sy.TLS_ACCESS_TOKEN:return this.shouldUpdateAccessToken(e)}}credentialsToSecurityConfig(e){const t=e.credentialsType===D.MQTT_BASIC?Sy.USERNAME_PASSWORD:Sy.ACCESS_TOKEN;if(e.credentialsType!==D.MQTT_BASIC)return{type:t,accessToken:e.credentialsId};if(e.credentialsValue){const{clientId:n,userName:a,password:r}=JSON.parse(e.credentialsValue);return{type:t,clientId:n,username:a,password:r}}}shouldUpdateCredentials(e){if(this.initialCredentials.credentialsType!==D.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!==D.ACCESS_TOKEN||this.initialCredentials.credentialsId!==e.accessToken}generateMqttCredentials(e){const{clientId:t,username:n,password:a}=e,r={...t&&{clientId:t},...n&&{userName:n},...a&&{password:a}};return{credentialsType:D.MQTT_BASIC,credentialsValue:JSON.stringify(r)}}static{this.ɵfac=function(e){return new(e||zh)(t.ɵɵinject(A.DeviceService),t.ɵɵinject(t.DestroyRef))}}static{this.ɵprov=t.ɵɵdefineInjectable({token:zh,factory:zh.ɵfac})}}function Kh(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;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e.value)," ")}}function Hh(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 Wh(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",13),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 Qh(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",16),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 Jh(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label",10),t.ɵɵtext(2,"security.access-token"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",11),t.ɵɵtemplate(4,Hh,3,3,"mat-error",12)(5,Wh,2,4,"tb-copy-button",13)(6,Qh,4,3,"button",14),t.ɵɵelementStart(7,"mat-icon",15),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("ngIf",e.securityFormGroup.get("accessToken").hasError("required")),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 Yh(e,n){1&e&&(t.ɵɵelement(0,"tb-file-input",17),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 Xh{constructor(e,t,n){this.fb=e,this.cd=t,this.gatewayCredentialsService=n,this.initialized=new r,this.securityTypes=Ey,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){e?this.updateFormBySecurityConfig(e):this.updateFormBySecurityConfig(this.gatewayCredentialsService.credentialsToSecurityConfig(this.gatewayCredentialsService.initialCredentials))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.securityFormGroup.valid?null:{securityFormGroup:{valid:!1}}}updateFormBySecurityConfig(e){const{clientId:t,username:n,password:a,...r}=e??{};r?.type===Sy.USERNAME_PASSWORD?this.securityFormGroup.patchValue({...r,usernamePassword:{clientId:t,username:n,password:a}},{emitEvent:!1}):this.securityFormGroup.patchValue(r,{emitEvent:!1}),this.toggleBySecurityType(this.securityFormGroup.get("type").value)}createSecurityFormGroup(){return this.fb.group({type:[Sy.ACCESS_TOKEN,[ne.required]],accessToken:[null,[ne.required,ne.pattern(/^[^.\s]+$/)]],caCert:[null,[ne.required]],usernamePassword:[]})}setupFormListeners(){this.securityFormGroup.valueChanges.pipe(Vr()).subscribe((({usernamePassword:e,...t})=>{this.onChange(e?{...t,...e}:t)})),this.securityFormGroup.get("type").valueChanges.pipe(Vr()).subscribe((e=>{this.toggleBySecurityType(e)})),this.securityFormGroup.get("caCert").valueChanges.pipe(Vr()).subscribe((()=>this.cd.detectChanges()))}toggleBySecurityType(e){switch(this.securityFormGroup.disable({emitEvent:!1}),this.securityFormGroup.get("type").enable({emitEvent:!1}),e){case Sy.ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1});break;case Sy.TLS_PRIVATE_KEY:this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case Sy.TLS_ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case Sy.USERNAME_PASSWORD:this.securityFormGroup.get("usernamePassword").enable({emitEvent:!1})}}generateAccessToken(){this.securityFormGroup.get("accessToken").patchValue(X(20))}static{this.ɵfac=function(e){return new(e||Xh)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(zh))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Xh,selectors:[["tb-gateway-security-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Xh)),multi:!0},{provide:re,useExisting:i((()=>Xh)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,consts:[[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],[3,"formGroup"],["formControlName","type",1,"toggle-group","flex"],[3,"value",4,"ngFor","ngForOf"],["appearance","outline",4,"ngIf"],["formControlName","usernamePassword"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel",4,"ngIf"],[3,"value"],["appearance","outline"],["translate",""],["matInput","","formControlName","accessToken"],[4,"ngIf"],["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"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel"]],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.ɵɵtemplate(5,Kh,3,4,"tb-toggle-option",4),t.ɵɵpipe(6,"keyvalue"),t.ɵɵelementEnd(),t.ɵɵtemplate(7,Jh,10,5,"mat-form-field",5),t.ɵɵelement(8,"tb-gateway-username-configuration",6),t.ɵɵtemplate(9,Yh,4,11,"tb-file-input",7),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(6,6,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("accesstoken")),t.ɵɵadvance(),t.ɵɵclassProp("hidden","usernamePassword"!==n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("tls")))},dependencies:t.ɵɵgetComponentDepsFactory(Xh,[V,b,$h]),encapsulation:2})}}const Zh=["configGroup"];function ef(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-host-required")," "))}function tf(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 nf(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 af(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 rf(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 of(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-security-configuration",21),t.ɵɵlistener("initialized",(function(n){t.ɵɵrestoreView(e);const a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.onInitialized(n))})),t.ɵɵelementEnd()}}function sf(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",22),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Gateway)}}function pf(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,ef,3,3,"mat-error",17),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",18),t.ɵɵtemplate(25,tf,3,3,"mat-error",17)(26,nf,3,3,"mat-error",17)(27,af,3,3,"mat-error",17)(28,rf,3,3,"mat-error",17),t.ɵɵelementStart(29,"mat-icon",16),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(32,of,1,0,"tb-gateway-security-configuration",19),t.ɵɵpipe(33,"async"),t.ɵɵtemplate(34,sf,1,1,"tb-report-strategy",20),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,13,"gateway.hints.remote-configuration")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,15,"gateway.remote-configuration")," "),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(8,17,"gateway.hints.remote-shell")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,19,"gateway.remote-shell")," "),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,21,"gateway.hints.host")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.host").hasError("required")),t.ɵɵadvance(5),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.port").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.port").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.port").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.port").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(30,23,"gateway.hints.port")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",t.ɵɵpipeBind1(33,25,e.initialCredentials$)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.withReportStrategy)}}function lf(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.send-period-required")," "))}function cf(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.send-period-min")," "))}function df(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.send-period-pattern")," "))}function mf(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.attribute-name-required")," "))}function uf(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 gf(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 yf(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 hf(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 ff(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")," "))}function vf(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",33)(1,"section",34)(2,"section",35)(3,"mat-form-field",13)(4,"mat-label",14),t.ɵɵtext(5,"gateway.statistics.attribute-name"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",36),t.ɵɵtemplate(7,mf,3,3,"mat-error",17),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",13)(12,"mat-label",14),t.ɵɵtext(13,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",37),t.ɵɵtemplate(15,uf,3,3,"mat-error",17)(16,gf,3,3,"mat-error",17)(17,yf,3,3,"mat-error",17),t.ɵɵelementStart(18,"mat-icon",16),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"mat-form-field",38)(22,"mat-label",14),t.ɵɵtext(23,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",39),t.ɵɵtemplate(25,hf,3,3,"mat-error",17)(26,ff,3,3,"mat-error",17),t.ɵɵelementStart(27,"mat-icon",16),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"button",40),t.ɵɵpipe(31,"translate"),t.ɵɵlistener("click",(function(n){const a=t.ɵɵrestoreView(e).index,r=t.ɵɵnextContext(2);return t.ɵɵresetView(r.removeCommandControl(a,n))})),t.ɵɵelementStart(32,"mat-icon"),t.ɵɵtext(33,"delete"),t.ɵɵelementEnd()()()}if(2&e){const e=n.$implicit,a=n.index,r=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("formGroupName",a),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.get("attributeOnGateway").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,12,"gateway.hints.attribute")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.get("timeout").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("timeout").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("timeout").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,14,"gateway.hints.timeout")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.get("command").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("command").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,16,"gateway.hints.command")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(31,18,"gateway.statistics.remove")),t.ɵɵproperty("disabled",!r.basicFormGroup.get("thingsboard.remoteConfiguration").value)}}function bf(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",23)(2,"mat-slide-toggle",24),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",25)(6,"mat-label",14),t.ɵɵtext(7,"gateway.statistics.send-period"),t.ɵɵelementEnd(),t.ɵɵelement(8,"input",26),t.ɵɵtemplate(9,lf,3,3,"mat-error",17)(10,cf,3,3,"mat-error",17)(11,df,3,3,"mat-error",17),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"div",27)(13,"div",28),t.ɵɵtext(14,"gateway.statistics.commands"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"div",29),t.ɵɵtext(16,"gateway.hints.commands"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(17,30),t.ɵɵtemplate(18,vf,34,20,"div",31),t.ɵɵelementStart(19,"button",32),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.addCommand())})),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,7,"gateway.statistics.statistics")," "),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.statistics.statsSendPeriodInSeconds").hasError("pattern")),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",e.commandFormArray().controls),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.basicFormGroup.get("thingsboard.remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,9,"gateway.statistics.add")," ")}}function xf(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.inactivity-timeout-seconds-required")," "))}function wf(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.inactivity-timeout-seconds-min")," "))}function Cf(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.inactivity-timeout-seconds-pattern")," "))}function Sf(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.inactivity-check-period-seconds-required")," "))}function Ef(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.inactivity-check-period-seconds-min")," "))}function Tf(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.inactivity-check-period-seconds-pattern")," "))}function If(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",35)(1,"mat-form-field",13)(2,"mat-label",14),t.ɵɵtext(3,"gateway.inactivity-timeout-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",50),t.ɵɵtemplate(5,xf,3,3,"mat-error",17)(6,wf,3,3,"mat-error",17)(7,Cf,3,3,"mat-error",17),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",13)(12,"mat-label",14),t.ɵɵtext(13,"gateway.inactivity-check-period-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",51),t.ɵɵtemplate(15,Sf,3,3,"mat-error",17)(16,Ef,3,3,"mat-error",17)(17,Tf,3,3,"mat-error",17),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.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,8,"gateway.hints.inactivity-timeout")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,10,"gateway.hints.inactivity-period"))}}function kf(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.min-pack-send-delay-required")," "))}function Mf(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.min-pack-send-delay-min")," "))}function Pf(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.min-pack-send-delay-pattern")," "))}function Ff(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.mqtt-qos-required")," "))}function Of(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.mqtt-qos-range")," "))}function qf(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.mqtt-qos-range")," "))}function Bf(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.check-connectors-configuration-required")," "))}function Rf(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.check-connectors-configuration-min")," "))}function Nf(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.check-connectors-configuration-pattern")," "))}function _f(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.max-payload-size-bytes-required")," "))}function Df(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.max-payload-size-bytes-min")," "))}function Vf(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.max-payload-size-bytes-pattern")," "))}function Gf(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.min-pack-size-to-send-required")," "))}function Af(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.min-pack-size-to-send-min")," "))}function jf(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.min-pack-size-to-send-pattern")," "))}function Lf(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",41)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",42),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(7,If,21,12,"section",43),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",8)(9,"div",28),t.ɵɵtext(10,"gateway.advanced"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"section",35)(12,"mat-form-field",13)(13,"mat-label",14),t.ɵɵtext(14,"gateway.min-pack-send-delay"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",44),t.ɵɵtemplate(16,kf,3,3,"mat-error",17)(17,Mf,3,3,"mat-error",17)(18,Pf,3,3,"mat-error",17),t.ɵɵelementStart(19,"mat-icon",16),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"mat-form-field",13)(23,"mat-label",14),t.ɵɵtext(24,"gateway.mqtt-qos"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",45)(26,"mat-option",46),t.ɵɵtext(27,"0"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-option",46),t.ɵɵtext(29,"1"),t.ɵɵelementEnd()(),t.ɵɵtemplate(30,Ff,3,3,"mat-error",17)(31,Of,3,3,"mat-error",17)(32,qf,3,3,"mat-error",17),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",13)(38,"mat-label",14),t.ɵɵtext(39,"gateway.statistics.check-connectors-configuration"),t.ɵɵelementEnd(),t.ɵɵelement(40,"input",47),t.ɵɵtemplate(41,Bf,3,3,"mat-error",17)(42,Rf,3,3,"mat-error",17)(43,Nf,3,3,"mat-error",17),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",13)(45,"mat-label",14),t.ɵɵtext(46,"gateway.statistics.max-payload-size-bytes"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",48),t.ɵɵtemplate(48,_f,3,3,"mat-error",17)(49,Df,3,3,"mat-error",17)(50,Vf,3,3,"mat-error",17),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",13)(56,"mat-label",14),t.ɵɵtext(57,"gateway.statistics.min-pack-size-to-send"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",49),t.ɵɵtemplate(59,Gf,3,3,"mat-error",17)(60,Af,3,3,"mat-error",17)(61,jf,3,3,"mat-error",17),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,26,"gateway.hints.check-device-activity")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(6,28,"gateway.checking-device-activity")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value),t.ɵɵadvance(9),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.minPackSendDelayMS").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,30,"gateway.hints.minimal-pack-delay")),t.ɵɵadvance(7),t.ɵɵproperty("value",0),t.ɵɵadvance(2),t.ɵɵproperty("value",1),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.qos").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.qos").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.qos").hasError("max")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(34,32,"gateway.hints.qos")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkConnectorsConfigurationInSeconds").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.maxPayloadSizeBytes").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(52,34,"gateway.hints.max-payload-size-bytes")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.minPackSizeToSend").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(63,36,"gateway.hints.min-pack-size-to-send"))}}class Uf{constructor(e,t,n,a){this.fb=e,this.deviceService=t,this.gatewayCredentialsService=n,this.dialog=a,this.dialogMode=!1,this.withReportStrategy=!1,this.initialized=new r,this.ReportStrategyDefaultValue=Vt,this.initialCredentials$=this.gatewayCredentialsService.initialCredentials$,this.onChange=()=>{},this.destroy$=new me,this.initBasicFormGroup(),this.observeFormChanges(),this.basicFormGroup.valueChanges.pipe(be(this.destroy$)).subscribe((e=>{this.onChange(e)}))}ngOnChanges(e){e.withReportStrategy&&!e.withReportStrategy.firstChange&&this.withReportStrategy&&this.basicFormGroup.get("thingsboard.reportStrategy").enable({emitEvent:!1})}ngAfterViewInit(){this.defaultTab&&(this.configGroup.selectedIndex=hy[this.defaultTab])}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.basicFormGroup.patchValue(e,{emitEvent:!1});(e?.thingsboard?.statistics?.commands??[]).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(be(this.destroy$)).subscribe((e=>{this.dialog.open(io,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{gatewayName:e.name}}).afterClosed().pipe(Ie(1)).subscribe((e=>{e||this.basicFormGroup.get("thingsboard.remoteConfiguration").setValue(!0,{emitEvent:!1})}))}))}addCommand(e,t=!0){const{attributeOnGateway:n=null,command:a=null,timeout:r=null}=e||{},i=this.fb.group({attributeOnGateway:[n,[ne.required,ne.pattern(/^[^.\s]+$/)]],command:[a,[ne.required,ne.pattern(/^(?=\S).*\S$/)]],timeout:[r,[ne.required,ne.min(1),ne.pattern(Ty),ne.pattern(/^[^.\s]+$/)]]});this.commandFormArray().push(i,{emitEvent:t})}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,[ne.required,ne.pattern(/^[^\s]+$/)]],port:[1883,[ne.required,ne.min(1),ne.max(65535),ne.pattern(Ty)]],remoteShell:[!1],remoteConfiguration:[!0],checkConnectorsConfigurationInSeconds:[60,[ne.required,ne.min(1),ne.pattern(Ty)]],statistics:this.fb.group({enable:[!0],statsSendPeriodInSeconds:[3600,[ne.required,ne.min(60),ne.pattern(Ty)]],commands:this.fb.array([])}),maxPayloadSizeBytes:[8196,[ne.required,ne.min(100),ne.pattern(Ty)]],minPackSendDelayMS:[50,[ne.required,ne.min(10),ne.pattern(Ty)]],minPackSizeToSend:[500,[ne.required,ne.min(100),ne.pattern(Ty)]],handleDeviceRenaming:[!0],checkingDeviceActivity:this.initCheckingDeviceActivityFormGroup(),security:[],qos:[1],reportStrategy:[{value:{type:Dt.OnReportPeriod,reportPeriod:Vt.Gateway},disabled:!0}]})}initCheckingDeviceActivityFormGroup(){return this.fb.group({checkDeviceInactivity:[!1],inactivityTimeoutSeconds:[300,[ne.min(1),ne.pattern(Ty)]],inactivityCheckPeriodSeconds:[10,[ne.min(1),ne.pattern(Ty)]]})}observeFormChanges(){this.observeRemoteConfigurationChanges(),this.observeDeviceActivityChanges()}observeRemoteConfigurationChanges(){this.basicFormGroup.get("thingsboard.remoteConfiguration").valueChanges.pipe(be(this.destroy$)).subscribe((e=>{e||this.openConfigurationConfirmDialog()}))}observeDeviceActivityChanges(){const e=this.basicFormGroup.get("thingsboard.checkingDeviceActivity");e.get("checkDeviceInactivity").valueChanges.pipe(be(this.destroy$)).subscribe((t=>{e.updateValueAndValidity();const n=[ne.min(1),ne.required,ne.pattern(Ty)];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||Uf)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(A.DeviceService),t.ɵɵdirectiveInject(zh),t.ɵɵdirectiveInject(pe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Uf,selectors:[["tb-gateway-basic-configuration"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Zh,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.configGroup=e.first)}},inputs:{device:"device",defaultTab:"defaultTab",dialogMode:"dialogMode",withReportStrategy:"withReportStrategy"},outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>Uf)),multi:!0},{provide:re,useExisting:i((()=>Uf)),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,"tb-form-row","no-border","no-padding","tb-standard-fields"],["appearance","outline",1,"flex"],["translate",""],["matInput","","formControlName","host"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],[4,"ngIf"],["matInput","","formControlName","port","type","number","min","0"],["formControlName","security",3,"initialized",4,"ngIf"],["class","tb-form-panel","formControlName","reportStrategy",3,"defaultValue",4,"ngIf"],["formControlName","security",3,"initialized"],["formControlName","reportStrategy",1,"tb-form-panel",3,"defaultValue"],["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"],[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],["translate","",1,"tb-form-panel-hint"],["formGroupName","statistics"],["formArrayName","commands","class","statistics-container flex flex-row",4,"ngFor","ngForOf"],["mat-stroked-button","","color","primary","type","button",2,"width","fit-content",3,"click","disabled"],["formArrayName","commands",1,"statistics-container","flex","flex-row"],[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"],["matInput","","formControlName","attributeOnGateway"],["matInput","","formControlName","timeout","type","number","min","0"],["appearance","outline",1,"mat-block"],["matInput","","formControlName","command"],["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"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngIf"],["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,pf,35,27,"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(a){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(a))})),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"mat-tab",2),t.ɵɵpipe(9,"translate"),t.ɵɵelementStart(10,"tb-gateway-storage-configuration",5),t.ɵɵlistener("initialized",(function(a){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(a))})),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-tab",2),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"tb-gateway-grpc-configuration",6),t.ɵɵlistener("initialized",(function(a){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.onInitialized(a))})),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-tab",2),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,bf,22,11,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-tab",2),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,Lf,65,38,"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(Uf,[V,b,ma,th,wh,Bh,Xh]),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;max-height:70vh}[_nghost-%COMP%] .dialog-mode[_ngcontent-%COMP%] .configuration-block[_ngcontent-%COMP%]{max-height:60vh}[_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",Uf),qe([k()],Uf.prototype,"dialogMode",void 0),qe([k()],Uf.prototype,"withReportStrategy",void 0);class $f{constructor(e){this.fb=e,this.destroy$=new me,this.advancedFormControl=this.fb.control(""),this.advancedFormControl.valueChanges.pipe(be(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||$f)(t.ɵɵdirectiveInject(te.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$f,selectors:[["tb-gateway-advanced-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:ae,useExisting:i((()=>$f)),multi:!0},{provide:re,useExisting:i((()=>$f)),multi:!0}]),t.ɵɵStandaloneFeature],decls:2,vars:4,consts:[["fillHeight","true","jsonRequired","",1,"flex","flex-col","config-container",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($f,[V,b]),styles:['@charset "UTF-8";[_nghost-%COMP%] .config-container[_ngcontent-%COMP%]{height:calc(100% - 120px);padding:8px}']})}}function zf(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 Kf(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 a=t.ɵɵnextContext();return t.ɵɵresetView(a.onInitialized(n))})),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("device",e.device)("defaultTab",e.defaultTab)("dialogMode",!!e.dialogRef)("withReportStrategy",t.ɵɵpipeBind1(1,4,e.gatewayVersion))}}function Hf(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-advanced-configuration",17)}function Wf(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",18),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",$f);class Qf{constructor(e,t,n,a,r){this.fb=e,this.attributeService=t,this.cd=n,this.gatewayCredentialsService=a,this.destroyRef=r,this.ConfigurationModes=_t,this.gatewayConfigAttributeKeys=["general_configuration","grpc_configuration","logs_configuration","storage_configuration","RemoteLoggingLevel","mode"],this.gatewayConfigGroup=this.fb.group({basicConfig:[],advancedConfig:[],mode:[_t.BASIC]}),this.observeAlignConfigs()}ngAfterViewInit(){this.fetchConfigAttribute(this.device)}saveConfig(){const{mode:e,advancedConfig:t}=ee(this.removeEmpty(this.gatewayConfigGroup.value)),n={mode:e,...t};n.thingsboard.statistics.commands=Object.values(n.thingsboard.statistics.commands??[]);const a=this.generateAttributes(n);this.attributeService.saveEntityAttributes(this.device,C.SHARED_SCOPE,a).pipe(Fe((e=>this.gatewayCredentialsService.updateCredentials(n.thingsboard.security))),Vr(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(Vr(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("advancedConfig");U(t.value,e)||this.gatewayConfigGroup.get("mode").value!==_t.BASIC||t.patchValue(e,{emitEvent:!1})})),this.gatewayConfigGroup.get("advancedConfig").valueChanges.pipe(Vr(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("basicConfig");U(t.value,e)||this.gatewayConfigGroup.get("mode").value!==_t.ADVANCED||t.patchValue(e,{emitEvent:!1})}))}generateAttributes(e){const t=[],n=(e,n)=>{t.push({key:e,value:n})},a=(e,t)=>{t={...t,ts:(new Date).getTime()},n(e,t)};return n("RemoteLoggingLevel",e.logs?.logLevel??We.NONE),delete e.connectors,n("logs_configuration",this.generateLogsFile(e.logs)),a("grpc_configuration",e.grpc),a("storage_configuration",e.storage),a("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"},databaseHandler:{class:this.getLogsHandlerClass(this.gatewayVersion),formatter:"LogFormatter",filename:"./logs/database.log",backupCount:1,encoding:"utf-8"}},loggers:{database:{handlers:["databaseHandler","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.getLogsHandlerClass(this.gatewayVersion),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!==w&&this.attributeService.getEntityAttributes(e,C.CLIENT_SCOPE).pipe(Oe((t=>t.length?he(t):this.attributeService.getEntityAttributes(e,C.SHARED_SCOPE,this.gatewayConfigAttributeKeys))),Vr(this.destroyRef)).subscribe((e=>{this.gatewayVersion=e.find((e=>"Version"===e.key))?.value,this.updateConfigs(e),this.cd.detectChanges()}))}updateConfigs(e){let t={},n=We.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??_t.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(xe(Boolean),Ie(1),Vr(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(vy).reduce(((t,n)=>{const a=e.handlers[`${n}Handler`]||{},r=e.loggers[n]||{};return t[n]={logLevel:r.level||We.INFO,filePath:a.filename?.split(`/${n}`)[0]||"./logs",backupCount:a.backupCount||7,savingTime:a.interval||3,savingPeriod:a.when||wy.days},t}),{}),logFormat:t,dateFormat:n}}getLogsHandlerClass(e=Qe.Legacy){return zr.parseVersion(e)>=zr.parseVersion(Qe.v3_6_3)?Iy:ky}static{this.ɵfac=function(e){return new(e||Qf)(t.ɵɵdirectiveInject(te.FormBuilder),t.ɵɵdirectiveInject(A.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(zh),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Qf,selectors:[["tb-gateway-configuration"]],inputs:{device:"device",defaultTab:"defaultTab",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵProvidersFeature([zh]),t.ɵɵStandaloneFeature],decls:22,vars:22,consts:[[1,"gateway-config-container",3,"formGroup"],[1,"content-wrapper"],["color","primary"],[1,"tb-flex","space-between","align-center"],["translate",""],[1,"toolbar-actions"],["formControlName","mode",3,"appearance"],[3,"value"],["mat-icon-button","","type","button",3,"click",4,"ngIf"],["formControlName","basicConfig",3,"device","defaultTab","dialogMode","withReportStrategy","initialized",4,"ngIf"],["formControlName","advancedConfig",4,"ngIf"],[1,"actions"],["mat-button","","color","primary","type","button",3,"click",4,"ngIf"],["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","dialogMode","withReportStrategy"],["formControlName","advancedConfig"],["mat-button","","color","primary","type","button",3,"click"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",0)(1,"div",1)(2,"mat-toolbar",2)(3,"div",3)(4,"h2",4),t.ɵɵtext(5,"gateway.gateway-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"div",5)(7,"tb-toggle-select",6)(8,"tb-toggle-option",7),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"tb-toggle-option",7),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(14,zf,3,0,"button",8),t.ɵɵelementEnd()()(),t.ɵɵtemplate(15,Kf,2,6,"tb-gateway-basic-configuration",9)(16,Hf,1,0,"tb-gateway-advanced-configuration",10),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",11),t.ɵɵtemplate(18,Wf,3,3,"button",12),t.ɵɵelementStart(19,"button",13),t.ɵɵlistener("click",(function(){return n.saveConfig()})),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.gatewayConfigGroup),t.ɵɵadvance(2),t.ɵɵclassProp("page-header",!n.dialogRef),t.ɵɵadvance(5),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(10,16,"gateway.basic")," "),t.ɵɵadvance(2),t.ɵɵproperty("value",n.ConfigurationModes.ADVANCED),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,18,"gateway.advanced")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.dialogRef),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigGroup.get("mode").value===n.ConfigurationModes.BASIC),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigGroup.get("mode").value===n.ConfigurationModes.ADVANCED),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.dialogRef),t.ɵɵadvance(),t.ɵɵproperty("disabled",n.gatewayConfigGroup.invalid||!n.gatewayConfigGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,20,"action.save")," "))},dependencies:t.ɵɵgetComponentDepsFactory(Qf,[V,b,Jr,Uf,$f]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden}[_nghost-%COMP%] .page-header.mat-toolbar[_ngcontent-%COMP%]{background:transparent;color:#000000de!important}[_nghost-%COMP%] .actions[_ngcontent-%COMP%]{grid-row:3;padding:8px 16px 8px 8px;display:flex;gap:8px;justify-content:flex-end;position:absolute;bottom:0;right:0;z-index:1;background:#fff;width:100%}[_nghost-%COMP%] .gateway-config-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden}[_nghost-%COMP%] .content-wrapper[_ngcontent-%COMP%]{flex:1}[_nghost-%COMP%] .toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center}.dialog-toggle[_ngcontent-%COMP%] .mat-button-toggle-button{color:#ffffffbf}']})}}e("GatewayConfigurationComponent",Qf);class Jf{constructor(){}static{this.ɵfac=function(e){return new(e||Jf)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Jf,selectors:[["tb-lib-styles-entry"]],standalone:!0,features:[t.ɵɵStandaloneFeature],decls:0,vars:0,template:function(e,t){},styles:['@charset "UTF-8";.tb-default .table-column{display:table-column}.tb-default .min-h-10{min-height:2.5rem}.tb-default .w-12{width:3rem}.tb-default .max-w-4\\/12{max-width:33.333333%}.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 .whitespace-nowrap{white-space:nowrap}.tb-default .pr-2{padding-right:.5rem}@media (max-width: 599px){.tb-default .lt-sm\\:flex-col{flex-direction:column}}\n'],encapsulation:2})}}const Yf=(e,t)=>{const n=e[m];if(n.styles?.length){const e=n.styles[0];let a=document.getElementById(t);if(!a){a=document.createElement("style"),a.id=t;(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}a.innerHTML=e}};class Xf{constructor(e){this.translate=e,function(e){e.setTranslation("en_US",Ze,!0),e.setTranslation("ar_AE",et,!0),e.setTranslation("ca_ES",tt,!0),e.setTranslation("cs_CZ",nt,!0),e.setTranslation("da_DK",at,!0),e.setTranslation("es_ES",rt,!0),e.setTranslation("ko_KR",it,!0),e.setTranslation("lt_LT",ot,!0),e.setTranslation("nl_BE",st,!0),e.setTranslation("pl_PL",pt,!0),e.setTranslation("pt_BR",lt,!0),e.setTranslation("sl_SI",ct,!0),e.setTranslation("tr_TR",dt,!0),e.setTranslation("zh_CN",mt,!0),e.setTranslation("zh_TW",ut,!0)}(e),Yf(Jf,"tb-gateway-css")}static{this.ɵfac=function(e){return new(e||Xf)(t.ɵɵinject(Ne.TranslateService))}}static{this.ɵmod=t.ɵɵdefineNgModule({type:Xf})}static{this.ɵinj=t.ɵɵdefineInjector({imports:[V,b,De,gn,ao,es,Qf,Xt,yy,gy]})}}e("GatewayExtensionModule",Xf),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(Xf,{imports:[V,b,De,gn,ao,es,Qf,Xt,yy,gy]})}}}));//# sourceMappingURL=gateway-management-extension.js.map +function wn(e){e||(n(wn),e=i(a));const t=new Z((t=>e.onDestroy(t.next.bind(t))));return e=>e.pipe(le(t))}e("GatewayLogsComponent",bn);function Sn(e,t){!t?.injector&&n(Sn);const l=t?.injector??i(r),p=new Q(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 Cn=["commandInput"],_n=(e,t)=>t.attributeOnGateway,Tn=e=>({command:e});function In(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 En(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 Mn(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 kn(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,Tn,e.truncate.transform(t.ɵɵpipeBind1(1,1,e.searchText$),!0,6,"...")))," ")}}function Pn(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 Dn(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,kn,3,8),t.ɵɵpipe(4,"async"),t.ɵɵtemplate(5,Pn,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 On{constructor(e,t){this.truncate=e,this.fb=t,this.commands=l(),this.onCreateNewClicked=p(),this.selectStatisticsCommandControl=this.fb.control({}),this.searchText$=this.selectStatisticsCommandControl.valueChanges.pipe(pe((e=>e?"string"==typeof e?e:e?.attributeOnGateway:"")),ce(),J(1)),this.filteredCommands$=ee([this.searchText$,Sn(this.commands)]).pipe(de(150),pe((([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:!Se(n,i)}),t.filter((t=>t.attributeOnGateway.toLowerCase().includes(e?.toLowerCase()??"")))})),J(1)),this.onChanges=e=>{},this.selectStatisticsCommandControl.valueChanges.pipe(wn()).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||On)(t.ɵɵdirectiveInject(T.TruncatePipe),t.ɵɵdirectiveInject(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:On,selectors:[["tb-statistics-commands-autocomplete"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Cn,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:W,useExisting:c((()=>On)),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,In,4,3,"button",5)(7,En,4,3,"button",6),t.ɵɵelementStart(8,"mat-autocomplete",7,1),t.ɵɵrepeaterCreate(10,Mn,4,7,"mat-option",8,_n,!1,Dn,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(On,[j,_]),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 An=()=>["createdTime","message"];function Fn(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 Rn(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 Bn(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 Nn(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 Ln(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",17)}function Vn(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:w.DESC},this.pageLink=new S(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,Fn,3,3,"mat-header-cell",4)(5,Rn,3,4,"mat-cell",5),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(6,6),t.ɵɵtemplate(7,Bn,3,3,"mat-header-cell",7)(8,Nn,5,5,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(9,Ln,1,0,"mat-header-row",9)(10,Vn,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,An))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(12,An)),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,[j,_]),styles:['@charset "UTF-8";[_nghost-%COMP%] .copy-content .mat-icon{padding:4px;font-size:18px}']})}}class Gn{constructor(e,t,n){this.elementRef=e,this.renderer=t,this.tooltip=n,this.tooltipEnabled=!0,this.position="above",this.destroy$=new te}ngOnInit(){this.observeMouseEvents(),this.applyTruncationStyles()}ngAfterViewInit(){this.tooltip.position=this.position}ngOnDestroy(){this.tooltip._isTooltipVisible()&&this.hideTooltip(),this.destroy$.next(),this.destroy$.complete()}observeMouseEvents(){ne(this.elementRef.nativeElement,"mouseenter").pipe(ue((()=>this.tooltipEnabled)),ue((()=>this.isOverflown(this.elementRef.nativeElement))),me((()=>this.showTooltip())),le(this.destroy$)).subscribe(),ne(this.elementRef.nativeElement,"mouseleave").pipe(ue((()=>this.tooltipEnabled)),ue((()=>this.tooltip._isTooltipVisible())),me((()=>this.hideTooltip())),le(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 te,this.renderer.setStyle(this.el.nativeElement,"max-height","48px"),this.renderer.setStyle(this.el.nativeElement,"overflow","auto"),ne(i,"resize").pipe(le(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&&sae(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(pe((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=k.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),fe())}return this.allAttributes}isAllSelected(){const e=this.selection.selected.length;return this.attributesSubject.pipe(pe((t=>e===t.length)))}isEmpty(){return this.attributesSubject.pipe(pe((e=>!e.length)))}total(){return this.pageDataSubject.pipe(pe((e=>e.totalElements)))}masterToggle(){this.attributesSubject.pipe(me((e=>{this.selection.selected.length===e.length?this.selection.clear():e.forEach((e=>{this.selection.select(e)}))})),ye(1)).subscribe()}}e("AttributeDatasource",Un);const jn=()=>({maxWidth:"970px"});function Hn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",4)(1,"mat-expansion-panel-header",5)(2,"mat-panel-title")(3,"mat-slide-toggle",6),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,7),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(5);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 Wn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8),t.ɵɵtext(1,"gateway.report-strategy.label"),t.ɵɵelementEnd(),t.ɵɵelementContainer(2,7)),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(5);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e)}}function $n(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",16),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 Kn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),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 Yn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",17),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",18),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Kn,3,3,"mat-icon",19),t.ɵɵelementStart(8,"span",20),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 Xn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"div",11),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",12)(6,"mat-select",13),t.ɵɵtemplate(7,$n,3,4,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,Yn,10,7,"div",15)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.type")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/report-strategy_fn")("tb-help-popup-style",t.ɵɵpureFunction0(7,jn)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.reportStrategyTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnChange&&e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnReceived)}}class Zn{constructor(e){this.fb=e,this.isExpansionMode=!1,this.defaultValue=tn.Key,this.reportStrategyTypes=Object.values(en),this.ReportTypeTranslateMap=nn,this.ReportStrategyType=en,this.destroy$=new te,this.showStrategyControl=this.fb.control(!1),this.reportStrategyFormGroup=this.fb.group({type:[{value:en.OnReportPeriod,disabled:!0},[]],reportPeriod:[{value:this.defaultValue,disabled:!0},[$.required,$.min(100)]]}),this.observeStrategyFormChange(),this.observeStrategyToggle()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){this.isExpansionMode&&this.showStrategyControl.setValue(!!e,{emitEvent:!1}),e&&this.reportStrategyFormGroup.enable({emitEvent:!1});const{type:t=en.OnReportPeriod,reportPeriod:n=this.defaultValue}=e??{};this.reportStrategyFormGroup.setValue({type:t,reportPeriod:n},{emitEvent:!1}),this.onTypeChange(t)}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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()})),this.reportStrategyFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.onTypeChange(e)))}observeStrategyToggle(){this.showStrategyControl.valueChanges.pipe(le(this.destroy$),ue((()=>this.isExpansionMode))).subscribe((e=>{e?(this.reportStrategyFormGroup.enable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").addValidators($.required),this.onChange(this.reportStrategyFormGroup.value)):(this.reportStrategyFormGroup.disable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").removeValidators($.required),this.onChange(null)),this.reportStrategyFormGroup.updateValueAndValidity({emitEvent:!1})}))}onTypeChange(e){const t=this.reportStrategyFormGroup.get("reportPeriod");e===en.OnChange||e===en.OnReceived?t.disable({emitEvent:!1}):this.isExpansionMode&&!this.showStrategyControl.value||t.enable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||Zn)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Zn,selectors:[["tb-report-strategy"]],inputs:{isExpansionMode:"isExpansionMode",defaultValue:"defaultValue"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>Zn)),multi:!0},{provide:K,useExisting:c((()=>Zn)),multi:!0}]),t.ɵɵStandaloneFeature],decls:6,vars:3,consts:[["defaultMode",""],["strategyFields",""],[3,"formGroup"],["class","tb-settings",3,"expanded",4,"ngIf","ngIfElse"],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],[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){if(1&e&&(t.ɵɵelementContainerStart(0,2),t.ɵɵtemplate(1,Hn,8,6,"mat-expansion-panel",3)(2,Wn,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(4,Xn,9,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(3);t.ɵɵproperty("formGroup",n.reportStrategyFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isExpansionMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(Zn,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}e("ReportStrategyComponent",Zn),Ge([I()],Zn.prototype,"isExpansionMode",void 0),Ge([P()],Zn.prototype,"defaultValue",void 0);class Qn{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,D.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||Qn)(t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Qn,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(Qn,[j,_]),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",Qn);class Jn{constructor(){this.tooltipText=""}static{this.ɵfac=function(e){return new(e||Jn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Jn,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(Jn,[_,j]),styles:["[_nghost-%COMP%]{display:flex;width:40px;height:40px;padding:10px}mat-icon[_ngcontent-%COMP%]{font-size:20px}"]})}}var ei,ti;e("ErrorTooltipIconComponent",Jn),e("MqttConverterType",ei),function(e){e.JSON="json",e.BYTES="bytes",e.CUSTOM="custom"}(ei||e("MqttConverterType",ei={})),e("MQTTSourceType",ti),function(e){e.MSG="message",e.TOPIC="topic",e.CONST="constant"}(ti||e("MQTTSourceType",ti={}));const ni=e("MqttVersions",[{name:3.1,value:3},{name:3.11,value:4},{name:5,value:5}]),ii=e("QualityTypeTranslationsMap",new Map([[0,"gateway.qos.at-most-once"],[1,"gateway.qos.at-least-once"],[2,"gateway.qos.exactly-once"]])),ai=e("ConvertorTypeTranslationsMap",new Map([[ei.JSON,"gateway.JSON"],[ei.BYTES,"gateway.bytes"],[ei.CUSTOM,"gateway.custom"]]));var ri;e("RequestType",ri),function(e){e.CONNECT_REQUEST="connectRequests",e.DISCONNECT_REQUEST="disconnectRequests",e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(ri||e("RequestType",ri={}));const oi=e("RequestTypesTranslationsMap",new Map([[ri.CONNECT_REQUEST,"gateway.request.connect-request"],[ri.DISCONNECT_REQUEST,"gateway.request.disconnect-request"],[ri.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[ri.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[ri.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]])),si=e("DataConversionTranslationsMap",new Map([[ei.JSON,"gateway.JSON-hint"],[ei.BYTES,"gateway.bytes-hint"],[ei.CUSTOM,"gateway.custom-hint"]]));var li,pi;e("SocketType",li),function(e){e.TCP="TCP",e.UDP="UDP"}(li||e("SocketType",li={})),e("SocketValueKey",pi),function(e){e.TIMESERIES="telemetry",e.ATTRIBUTES="attributes",e.ATTRIBUTES_REQUESTS="attributeRequests",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_METHODS="serverSideRpc"}(pi||e("SocketValueKey",pi={}));const ci=e("SocketKeysPanelTitleTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.attributes"],[pi.TIMESERIES,"gateway.timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.attribute-requests"],[pi.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[pi.RPC_METHODS,"gateway.rpc-methods"]]));var di,ui;e("RequestsType",di),function(e){e.Shared="shared",e.Client="client"}(di||e("RequestsType",di={})),e("ExpressionType",ui),function(e){e.Constant="constant",e.Expression="expression"}(ui||e("ExpressionType",ui={}));const mi=e("SocketKeysAddKeyTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.add-attribute"],[pi.TIMESERIES,"gateway.add-timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.add-attribute-request"],[pi.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[pi.RPC_METHODS,"gateway.add-rpc-method"]])),hi=e("SocketKeysDeleteKeyTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.delete-attribute"],[pi.TIMESERIES,"gateway.delete-timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.delete-attribute-request"],[pi.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[pi.RPC_METHODS,"gateway.delete-rpc-method"]])),gi=e("SocketKeysNoKeysTextTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.no-attributes"],[pi.TIMESERIES,"gateway.no-timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.no-attribute-requests"],[pi.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[pi.RPC_METHODS,"gateway.no-rpc-methods"]]));var fi,yi,vi,xi;e("RestConverterType",fi),function(e){e.JSON="json",e.CUSTOM="custom"}(fi||e("RestConverterType",fi={})),e("RestSourceType",yi),function(e){e.REQUEST="request",e.CONST="constant"}(yi||e("RestSourceType",yi={})),e("ResponseType",vi),function(e){e.DEFAULT="default",e.CONST="constant",e.ADVANCED="advanced"}(vi||e("ResponseType",vi={})),e("ResponseStatus",xi),function(e){e.OK="OK",e.ERROR="Error"}(xi||e("ResponseStatus",xi={}));const bi=e("ResponseTypeTranslationsMap",new Map([[vi.DEFAULT,"gateway.rest.response-type.default"],[vi.CONST,"gateway.rest.response-type.const"],[vi.ADVANCED,"gateway.rest.response-type.advanced"]]));var wi;e("RestRequestType",wi),function(e){e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(wi||e("RestRequestType",wi={}));const Si=e("RestRequestTypesTranslationsMap",new Map([[wi.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[wi.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[wi.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]]));var Ci;e("RestRequestsScopeType",Ci),function(e){e.Shared="shared",e.Client="client"}(Ci||e("RestRequestsScopeType",Ci={}));const _i=e("RestRequestTypeFieldsMap",new Map([[wi.ATTRIBUTE_REQUEST,["HTTPMethods","endpoint","type","deviceNameExpression","attributeNameExpression"]],[wi.ATTRIBUTE_UPDATE,["HTTPMethod","SSLVerify","deviceNameFilter","attributeFilter","requestUrlExpression","valueExpression","httpHeaders","tries","allowRedirects"]],[wi.SERVER_SIDE_RPC,["HTTPMethod","deviceNameFilter","methodFilter","requestUrlExpression","valueExpression","responseTimeout","httpHeaders","tries"]],["all",["requestType","timeout","security"]]])),Ti=e("RestConvertorTypeTranslationsMap",new Map([[fi.JSON,"gateway.JSON"],[fi.CUSTOM,"gateway.custom"]])),Ii=e("RestDataConversionTranslationsMap",new Map([[fi.JSON,"gateway.hints.rest.JSON"],[fi.CUSTOM,"gateway.custom-hint"]]));var Ei;e("PortLimits",Ei),function(e){e[e.MIN=1]="MIN",e[e.MAX=65535]="MAX"}(Ei||e("PortLimits",Ei={}));const Mi=e("GatewayConnectorConfigVersionMap",new Map([[dt.REST,ct.v3_7_2],[dt.KNX,ct.v3_7_0],[dt.BACNET,ct.v3_6_2],[dt.SOCKET,ct.v3_6_0],[dt.MQTT,ct.v3_5_2],[dt.OPCUA,ct.v3_5_2],[dt.MODBUS,ct.v3_5_2]]));var ki,Pi,Di,Oi;e("OPCUaSourceType",ki),function(e){e.PATH="path",e.IDENTIFIER="identifier",e.CONST="constant"}(ki||e("OPCUaSourceType",ki={})),e("SecurityType",Pi),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic",e.CERTIFICATES="certificates"}(Pi||e("SecurityType",Pi={})),e("ModeType",Di),function(e){e.NONE="None",e.SIGN="Sign",e.SIGNANDENCRYPT="SignAndEncrypt"}(Di||e("ModeType",Di={})),e("MappingType",Oi),function(e){e.DATA="data",e.REQUESTS="requests",e.OPCUA="OPCua"}(Oi||e("MappingType",Oi={}));const Ai=e("MappingTypeTranslationsMap",new Map([[Oi.DATA,"gateway.data-mapping"],[Oi.REQUESTS,"gateway.requests-mapping"],[Oi.OPCUA,"gateway.data-mapping"]]));var Fi;e("SecurityPolicy",Fi),function(e){e.BASIC128="Basic128Rsa15",e.BASIC256="Basic256",e.BASIC256SHA="Basic256Sha256"}(Fi||e("SecurityPolicy",Fi={}));const Ri=e("SecurityPolicyTypes",[{value:Fi.BASIC128,name:"Basic128RSA15"},{value:Fi.BASIC256,name:"Basic256"},{value:Fi.BASIC256SHA,name:"Basic256SHA256"}]),Bi=e("SecurityTypeTranslationsMap",new Map([[Pi.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Pi.BASIC,"gateway.broker.security-types.basic"],[Pi.CERTIFICATES,"gateway.broker.security-types.certificates"]])),Ni=e("SourceTypeTranslationsMap",new Map([[ti.MSG,"gateway.source-type.msg"],[ti.TOPIC,"gateway.source-type.topic"],[ti.CONST,"gateway.source-type.const"],[ki.PATH,"gateway.source-type.path"],[ki.IDENTIFIER,"gateway.source-type.identifier"],[ki.CONST,"gateway.source-type.const"],[ui.Expression,"gateway.source-type.expression"],[yi.REQUEST,"gateway.source-type.request"]]));var Li;e("MappingKeysType",Li),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.CUSTOM="extensionConfig",e.RPC_METHODS="rpc_methods",e.ATTRIBUTES_UPDATES="attributes_updates"}(Li||e("MappingKeysType",Li={}));const Vi=e("MappingKeysPanelTitleTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.attributes"],[Li.TIMESERIES,"gateway.timeseries"],[Li.CUSTOM,"gateway.keys"],[Li.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Li.RPC_METHODS,"gateway.rpc-methods"]])),qi=e("MappingKeysAddKeyTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.add-attribute"],[Li.TIMESERIES,"gateway.add-timeseries"],[Li.CUSTOM,"gateway.add-key"],[Li.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Li.RPC_METHODS,"gateway.add-rpc-method"]])),Gi=e("MappingKeysDeleteKeyTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.delete-attribute"],[Li.TIMESERIES,"gateway.delete-timeseries"],[Li.CUSTOM,"gateway.delete-key"],[Li.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Li.RPC_METHODS,"gateway.delete-rpc-method"]])),zi=e("MappingKeysNoKeysTextTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.no-attributes"],[Li.TIMESERIES,"gateway.no-timeseries"],[Li.CUSTOM,"gateway.no-keys"],[Li.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Li.RPC_METHODS,"gateway.no-rpc-methods"]])),Ui=e("QualityTypes",[0,1,2]);var ji;e("ServerSideRpcType",ji),function(e){e.WithResponse="twoWay",e.WithoutResponse="oneWay"}(ji||e("ServerSideRpcType",ji={}));const Hi=e("HelpLinkByMappingTypeMap",new Map([[Oi.DATA,O+"/docs/iot-gateway/config/mqtt/#section-mapping"],[Oi.OPCUA,O+"/docs/iot-gateway/config/opc-ua/#section-mapping"],[Oi.REQUESTS,O+"/docs/iot-gateway/config/mqtt/#requests-mapping"]])),Wi=e("MappingHintTranslationsMap",new Map([[Oi.DATA,"gateway.data-mapping-hint"],[Oi.OPCUA,"gateway.opcua-data-mapping-hint"],[Oi.REQUESTS,"gateway.requests-mapping-hint"]]));var $i,Ki,Yi,Xi,Zi,Qi,Ji,ea,ta;e("ServerSideRPCType",$i),function(e){e.ONE_WAY="oneWay",e.TWO_WAY="twoWay"}($i||e("ServerSideRPCType",$i={})),e("SecurityMode",Ki),function(e){e.basic="basic",e.certificates="certificates",e.extendedCertificates="extendedCertificates"}(Ki||e("SecurityMode",Ki={})),e("ModbusProtocolType",Yi),function(e){e.TCP="tcp",e.UDP="udp",e.Serial="serial"}(Yi||e("ModbusProtocolType",Yi={})),e("ModbusMethodType",Xi),function(e){e.SOCKET="socket",e.RTU="rtu"}(Xi||e("ModbusMethodType",Xi={})),e("ModbusSerialMethodType",Zi),function(e){e.RTU="rtu",e.ASCII="ascii"}(Zi||e("ModbusSerialMethodType",Zi={})),e("ModbusParity",Qi),function(e){e.Even="E",e.Odd="O",e.None="N"}(Qi||e("ModbusParity",Qi={})),e("ModbusOrderType",Ji),function(e){e.BIG="BIG",e.LITTLE="LITTLE"}(Ji||e("ModbusOrderType",Ji={})),e("ModbusRegisterType",ea),function(e){e.HoldingRegisters="holding_registers",e.CoilsInitializer="coils_initializer",e.InputRegisters="input_registers",e.DiscreteInputs="discrete_inputs"}(ea||e("ModbusRegisterType",ea={})),e("ModbusValueKey",ta),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_REQUESTS="rpc"}(ta||e("ModbusValueKey",ta={}));const na=e("ModbusBaudrates",[4800,9600,19200,38400,57600,115200,230400,460800,921600]),ia=e("ModbusByteSizes",[5,6,7,8]),aa=e("ModbusRegisterTranslationsMap",new Map([[ea.HoldingRegisters,"gateway.holding_registers"],[ea.CoilsInitializer,"gateway.coils_initializer"],[ea.InputRegisters,"gateway.input_registers"],[ea.DiscreteInputs,"gateway.discrete_inputs"]]));var ra;e("ModbusBitTargetType",ra),function(e){e.BooleanType="bool",e.IntegerType="int"}(ra||e("ModbusBitTargetType",ra={}));const oa=e("ModbusBitTargetTypeTranslationMap",new Map([[ra.BooleanType,"gateway.boolean"],[ra.IntegerType,"gateway.integer"]])),sa=e("ModbusMethodLabelsMap",new Map([[Xi.SOCKET,"Socket"],[Xi.RTU,"RTU"],[Zi.ASCII,"ASCII"]])),la=e("ModbusProtocolLabelsMap",new Map([[Yi.TCP,"TCP"],[Yi.UDP,"UDP"],[Yi.Serial,"Serial"]])),pa=e("ModbusParityLabelsMap",new Map([[Qi.Even,"Even"],[Qi.Odd,"Odd"],[Qi.None,"None"]])),ca=e("ModbusKeysPanelTitleTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.attributes"],[ta.TIMESERIES,"gateway.timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[ta.RPC_REQUESTS,"gateway.rpc-requests"]])),da=e("ModbusKeysAddKeyTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.add-attribute"],[ta.TIMESERIES,"gateway.add-timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[ta.RPC_REQUESTS,"gateway.add-rpc-request"]])),ua=e("ModbusKeysDeleteKeyTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.delete-attribute"],[ta.TIMESERIES,"gateway.delete-timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[ta.RPC_REQUESTS,"gateway.delete-rpc-request"]])),ma=e("ModbusKeysNoKeysTextTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.no-attributes"],[ta.TIMESERIES,"gateway.no-timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[ta.RPC_REQUESTS,"gateway.no-rpc-requests"]]));var ha;e("ModifierType",ha),function(e){e.DIVIDER="divider",e.MULTIPLIER="multiplier"}(ha||e("ModifierType",ha={}));const ga=e("ModifierTypesMap",new Map([[ha.DIVIDER,{name:"gateway.divider",icon:"mdi:division"}],[ha.MULTIPLIER,{name:"gateway.multiplier",icon:"mdi:multiplication"}]]));var fa,ya;e("DeviceInfoType",fa),function(e){e.FULL="full",e.PARTIAL="partial"}(fa||e("DeviceInfoType",fa={})),e("SegmentationType",ya),function(e){e.BOTH="segmentedBoth",e.TRANSMIT="segmentedTransmit",e.RECEIVE="segmentedReceive",e.NO="noSegmentation"}(ya||e("SegmentationType",ya={}));const va=e("SegmentationTypeTranslationsMap",new Map([[ya.BOTH,"gateway.bacnet.segmentation.both"],[ya.TRANSMIT,"gateway.bacnet.segmentation.transmit"],[ya.RECEIVE,"gateway.bacnet.segmentation.receive"],[ya.NO,"gateway.bacnet.segmentation.no"]]));var xa;e("BacnetDeviceKeysType",xa),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.RPC_METHODS="serverSideRpc",e.ATTRIBUTES_UPDATES="attributeUpdates"}(xa||e("BacnetDeviceKeysType",xa={}));const ba=e("BacnetDeviceKeysPanelTitleTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.attributes"],[xa.TIMESERIES,"gateway.timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[xa.RPC_METHODS,"gateway.rpc-methods"]])),wa=e("BacnetDeviceKeysAddKeyTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.add-attribute"],[xa.TIMESERIES,"gateway.add-timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[xa.RPC_METHODS,"gateway.add-rpc-method"]])),Sa=e("BacnetDeviceKeysDeleteKeyTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.delete-attribute"],[xa.TIMESERIES,"gateway.delete-timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[xa.RPC_METHODS,"gateway.delete-rpc-method"]])),Ca=e("BacnetDeviceKeysNoKeysTextTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.no-attributes"],[xa.TIMESERIES,"gateway.no-timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[xa.RPC_METHODS,"gateway.no-rpc-methods"]]));var _a;e("BacnetKeyObjectType",_a),function(e){e.analogInput="analogInput",e.analogOutput="analogOutput",e.analogValue="analogValue",e.binaryInput="binaryInput",e.binaryOutput="binaryOutput",e.binaryValue="binaryValue"}(_a||e("BacnetKeyObjectType",_a={}));const Ta=e("BacnetKeyObjectTypeTranslationsMap",new Map([[_a.analogInput,"gateway.bacnet.object-type.analog-input"],[_a.analogOutput,"gateway.bacnet.object-type.analog-output"],[_a.analogValue,"gateway.bacnet.object-type.analog-value"],[_a.binaryInput,"gateway.bacnet.object-type.binary-input"],[_a.binaryOutput,"gateway.bacnet.object-type.binary-output"],[_a.binaryValue,"gateway.bacnet.object-type.binary-value"]]));var Ia;e("BacnetPropertyId",Ia),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"}(Ia||e("BacnetPropertyId",Ia={}));const Ea=e("BacnetPropertyIdByObjectType",new Map([[_a.analogInput,[Ia.presentValue,Ia.statusFlags,Ia.covIncrement]],[_a.analogOutput,[Ia.presentValue,Ia.statusFlags,Ia.covIncrement]],[_a.analogValue,[Ia.presentValue,Ia.statusFlags,Ia.covIncrement]],[_a.binaryInput,[Ia.presentValue,Ia.statusFlags,Ia.eventState,Ia.outOfService,Ia.polarity]],[_a.binaryOutput,[Ia.presentValue,Ia.statusFlags,Ia.eventState,Ia.outOfService,Ia.polarity,Ia.priorityArray,Ia.relinquishDefault,Ia.currentCommandPriority,Ia.eventMessageTexts,Ia.eventMessageTextsConfig,Ia.eventAlgorithmInhibitReference,Ia.timeDelayNormal]],[_a.binaryValue,[Ia.presentValue,Ia.statusFlags,Ia.eventState,Ia.outOfService]]])),Ma=e("BacnetPropertyIdTranslationsMap",new Map([[Ia.presentValue,"gateway.bacnet.property-id.present-value"],[Ia.statusFlags,"gateway.bacnet.property-id.status-flags"],[Ia.covIncrement,"gateway.bacnet.property-id.cov-increment"],[Ia.eventState,"gateway.bacnet.property-id.event-state"],[Ia.outOfService,"gateway.bacnet.property-id.out-of-service"],[Ia.polarity,"gateway.bacnet.property-id.polarity"],[Ia.priorityArray,"gateway.bacnet.property-id.priority-array"],[Ia.relinquishDefault,"gateway.bacnet.property-id.relinquish-default"],[Ia.currentCommandPriority,"gateway.bacnet.property-id.current-command-priority"],[Ia.eventMessageTexts,"gateway.bacnet.property-id.event-message-texts"],[Ia.eventMessageTextsConfig,"gateway.bacnet.property-id.event-message-texts-config"],[Ia.eventAlgorithmInhibitReference,"gateway.bacnet.property-id.event-algorithm-inhibit-reference"],[Ia.timeDelayNormal,"gateway.bacnet.property-id.time-delay-normal"]]));var ka;e("BacnetRequestType",ka),function(e){e.Write="writeProperty",e.Read="readProperty"}(ka||e("BacnetRequestType",ka={}));const Pa=e("BacnetRequestTypeTranslationsMap",new Map([[ka.Write,"gateway.bacnet.request-type.write"],[ka.Read,"gateway.bacnet.request-type.read"]]));class Da{static{this.mqttRequestTypeKeys=Object.values(ri)}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===ri.SERVER_SIDE_RPC&&delete e.type;const{attributeNameExpression:t,deviceInfo:i,...a}=e,r={...a,attributeNameJsonExpression:t||null,deviceNameJsonExpression:i?.deviceNameExpressionSource!==ti.TOPIC?i?.deviceNameExpression:null,deviceNameTopicExpression:i?.deviceNameExpressionSource===ti.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!==ei.BYTES?{...n,deviceNameJsonExpression:t?.deviceNameExpressionSource===ti.MSG?t.deviceNameExpression:null,deviceTypeJsonExpression:t?.deviceProfileExpressionSource===ti.MSG?t.deviceProfileExpression:null,deviceNameTopicExpression:t?.deviceNameExpressionSource!==ti.MSG?t?.deviceNameExpression:null,deviceTypeTopicExpression:t?.deviceProfileExpressionSource!==ti.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("${")?ti.MSG:e.includes("/")?ti.TOPIC:ti.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===ri.SERVER_SIDE_RPC?1:null,s=t===ri.SERVER_SIDE_RPC?e.responseTopicExpression?ji.WithResponse:ji.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",Da);class Oa{constructor(e,t){this.gatewayVersionIn=e,this.connector=t,this.gatewayVersion=Ua.parseVersion(this.gatewayVersionIn),this.configVersion=Ua.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=Ua.parseVersion(Mi.get(this.connector.type)),t=this.gatewayVersion>=e,n=!this.configVersion||this.configVersion=e&&e>this.gatewayVersion}}e("GatewayConnectorVersionProcessor",Oa);class Aa extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.mqttRequestTypeKeys=Object.values(ri)}getUpgradedVersion(){const{connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}=this.connector.configurationJson;let r={...this.connector.configurationJson,requestsMapping:Da.mapRequestsToUpgradedVersion({connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}),mapping:Da.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?Da.mapRequestsToDowngradedVersion(e):{},a=Da.mapMappingToDowngradedVersion(t);return{...this.connector,configurationJson:{...n,...i,mapping:a},configVersion:this.gatewayVersionIn}}cleanUpConfigJson(e){Se(e.requestsMapping,{})&&delete e.requestsMapping,Se(e.mapping,[])&&delete e.mapping}}e("MqttVersionProcessor",Aa);class Fa extends Oa{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",Fa);class Ra extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson.server;return{...this.connector,configurationJson:{server:e?Ha.mapServerToUpgradedVersion(e):{},mapping:e?.mapping?Ha.mapMappingToUpgradedVersion(e.mapping):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:{server:Ha.mapServerToDowngradedVersion(this.connector.configurationJson)},configVersion:this.gatewayVersionIn}}}e("OpcVersionProcessor",Ra);class Ba{constructor(){this.fb=i(Y),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(wn(this.destroyRef)).subscribe((e=>this.onChange(this.mapOnChangeValue(e))))}static{this.ɵfac=function(e){return new(e||Ba)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Ba})}}e("ControlValueAccessorBaseAbstract",Ba);class Na extends Ba{constructor(){super(...arguments),this.withReportStrategy=!0,this.initialized=new u,this.isLegacy=!1,this.fb=i(Y)}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(Na)))(n||Na)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:Na,inputs:{generalTabContent:"generalTabContent",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},outputs:{initialized:"initialized"},features:[t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature]})}}e("GatewayConnectorBasicConfigDirective",Na);class La extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{socket:e?Wa.mapSocketToUpgradedVersion(e):{},devices:e?.devices?Wa.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:Wa.mapSocketToDowngradedVersion(this.connector.configurationJson),configVersion:this.gatewayVersionIn}}}e("SocketVersionProcessor",La);class Va extends Oa{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?$a.mapApplicationToUpgradedVersion(e.general):{},devices:e?.devices?$a.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{general:e?.application?$a.mapApplicationToDowngradedVersion(e.application):{},devices:e?.devices?$a.mapDevicesToDowngradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}}e("BacnetVersionProcessor",Va);const qa=["searchInput"];class Ga{constructor(){this.withReportStrategy=!0,this.textSearchMode=!1,this.onChange=()=>{},this.translate=i(We),this.dialog=i(Le),this.dialogService=i(Ie),this.fb=i(Y),this.cd=i(h),this.destroyRef=i(a),this.textSearch=this.fb.control("",{nonNullable:!0}),this.entityFormArray=this.fb.array([]),this.entityFormArray.valueChanges.pipe(wn()).subscribe((e=>{this.updateTableData(e),this.onChange(e)})),this.dataSource=this.getDatasource()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),wn(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||Ga)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Ga,viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(qa,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",Ga);class za extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.restRequestTypeKeys=Object.values(wi)}getUpgradedVersion(){const{attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}=this.connector.configurationJson;let r={server:Ua.cleanUpConfigBaseInfo(a),requestsMapping:{attributeRequests:e,attributeUpdates:t,serverSideRpc:n},mapping:Ka.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:Ka.mapMappingToDowngradedVersion(t)},configVersion:this.gatewayVersionIn}}}e("RestVersionProcessor",za);class Ua{static getConfig(e,t){switch(e.type){case dt.MQTT:return new Aa(t,e).getProcessedByVersion();case dt.OPCUA:return new Ra(t,e).getProcessedByVersion();case dt.MODBUS:return new Fa(t,e).getProcessedByVersion();case dt.SOCKET:return new La(t,e).getProcessedByVersion();case dt.BACNET:return new Va(t,e).getProcessedByVersion();case dt.REST:return new za(t,e).getProcessedByVersion();default:return e}}static parseVersion(e){if(Ee(e))return e;if(Me(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",Ua);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:en.OnChange}:{type:en.OnReportPeriod,reportPeriod:e.pollPeriod}}}))}}static mapMasterToDowngradedVersion(e){return{slaves:e.slaves.map((e=>{const{reportStrategy:t,...n}=e;return{...n,sendDataOnlyOnChange:t?.type!==en.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?$t.INT16:e.type})))}),{})}}e("ModbusVersionMappingUtil",ja);class Ha{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 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("${")?ki.IDENTIFIER:e.includes("/")||e.includes("\\")?ki.PATH:ki.CONST}static getDeviceNodeSourceByValue(e){return e.includes("${")?ki.IDENTIFIER:ki.PATH}static getArgumentType(e){switch(typeof e){case"boolean":return"boolean";case"number":return Number.isInteger(e)?"integer":"float";default:return"string"}}}e("OpcVersionMappingUtil",Ha);class Wa{static mapSocketToUpgradedVersion(e){const{devices:t,...n}=e??{};return Ua.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("[")?ui.Expression:ui.Constant}}e("SocketVersionMappingUtil",Wa);class $a{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("[")?ui.Expression:ui.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",$a);class Ka{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("${")?yi.REQUEST:yi.CONST}}e("RestVersionMappingUtil",Ka);class Ya{transform(e,t){const n=Ua.parseVersion(e);return t===dt.MODBUS?n>=Ua.parseVersion(ct.v3_5_2):n>=Ua.parseVersion(ct.v3_6_0)}static{this.ɵfac=function(e){return new(e||Ya)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"withReportStrategy",type:Ya,pure:!0,standalone:!0})}}function Xa(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 Za(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 Qa(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 Ja(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 er(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 tr(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 nr(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 ir(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",Ya);class ar extends A{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=O+"/docs/iot-gateway/configuration/#subsection-statistics",this.editCommandFormGroup=this.fb.group({attributeOnGateway:["",[$.required,$.pattern(rn),this.uniqNameRequired()]],command:["",[$.required,$.pattern(/^(?=\S).*\S$/)]],timeout:[10,[$.required,$.min(1),$.pattern(an),$.pattern(/^[^.\s]+$/)]],installCmd:["",$.pattern(rn)]}),this.editCommandFormGroup.patchValue(this.data.command,{emitEvent:!1})}cancel(){this.confirmConnectorChange().pipe(ve(Boolean),wn(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):ae(!0)}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=t&&this.data.existingCommands.some((e=>e.toLowerCase()===t))&&t!==this.data.command.attributeOnGateway.toLowerCase();return n?{duplicateName:{valid:!1}}:null}}static{this.ɵfac=function(e){return new(e||ar)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ar,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,Xa,3,3,"mat-error")(19,Za,3,3,"mat-error")(20,Qa,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,Ja,3,3,"mat-error")(29,er,3,3,"mat-error")(30,tr,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,nr,3,3,"mat-error")(40,ir,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(ar,[j,_]),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 rr="sans-serif",or="12px "+rr;var sr,lr,pr=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;o18);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,bo);var wo="___EC__COMPONENT__CONTAINER___",So="___EC__EXTENDED_CLASS___";function Co(e){var t={main:"",sub:""};if(e){var n=e.split(".");t.main=n[0]||"",t.sub=n[1]||""}return t}function _o(e,t){e.$constructor=e,e.extend=function(e){var t,n,i=this;return Gr(n=i)&&/^class\s/.test(Function.prototype.toString.call(n))?t=function(e){function t(){return e.apply(this,arguments)||this}return ze(t,e),t}(i):(t=function(){(e.$constructor||i).apply(this,arguments)},function(e,t){var n=e.prototype;function i(){}for(var a in i.prototype=t.prototype,e.prototype=new i,n)n.hasOwnProperty(a)&&(e.prototype[a]=n[a]);e.prototype.constructor=e,e.superClass=t}(t,this)),Mr(t.prototype,e),t[So]=!0,t.extend=this.extend,t.superCall=Eo,t.superApply=Mo,t.superClass=i,t}}function To(e,t){e.extend=t.extend}var Io=Math.round(10*Math.random());function Eo(e,t){for(var n=[],i=2;i=0||a&&Pr(a,s)<0)){var l=n.getShallow(s,t);null!=l&&(r[e[o][0]]=l)}}return r}}var Do=Po([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),Oo=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Do(this,e,t)},e}(),Ao=function(e){this.value=e},Fo=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Ao(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}(),Ro=function(){function e(e){this._list=new Fo,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 Ao(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}(),Bo=new Ro(50);function No(e){if("string"==typeof e){var t=Bo.get(e);return t&&t.image}return e}function Lo(e,t,n,i,a){if(e){if("string"==typeof e){if(t&&t.__zrImageSrc===e||!n)return t;var r=Bo.get(e),o={hostEl:n,cb:i,cbPayload:a};return r?!qo(t=r.image)&&r.pending.push(o):((t=cr.loadImage(e,Vo,Vo)).__zrImageSrc=e,Bo.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}return t}function Vo(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;th&&(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))}Zo.x=Jo.x=n.x,Zo.y=es.y=n.y,Qo.x=es.x=n.x+n.width,Qo.y=Jo.y=n.y+n.height,Zo.transform(i),es.transform(i),Qo.transform(i),Jo.transform(i),t.x=Yo(Zo.x,Qo.x,Jo.x,es.x),t.y=Yo(Zo.y,Qo.y,Jo.y,es.y);var l=Xo(Zo.x,Qo.x,Jo.x,es.x),p=Xo(Zo.y,Qo.y,Jo.y,es.y);t.width=l-t.x,t.height=p-t.y}else t!==n&&e.copy(t,n)},e}(),as={};function rs(e,t){var n=as[t=t||or];n||(n=as[t]=new Ro(500));var i=n.get(e);return null==i&&(i=cr.measureText(e,t).width,n.put(e,i)),i}function os(e,t,n,i){var a=rs(e,t),r=cs(t),o=ls(0,a,n),s=ps(0,r,i);return new is(o,s,a,r)}function ss(e,t,n,i){var a=((e||"")+"").split("\n");if(1===a.length)return os(a[0],t,n,i);for(var r=new is(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function us(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+=ds(i[0],n.width),p+=ds(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 ms=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function hs(e,t,n,i,a){if(!t)return"";var r=(e+"").split("\n");a=gs(t,n,i,a);for(var o=0,s=r.length;o=o;l++)s-=o;var p=rs(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 fs(e,t){var n=t.containerWidth,i=t.font,a=t.contentWidth;if(!n)return"";var r=rs(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?ys(e,a,t.ascCharWidth,t.cnCharWidth):r>0?Math.floor(e.length*a/r):0;r=rs(e=e.substr(0,s),i)}return""===e&&(e=t.placeholder),e}function ys(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=_s(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)||!!Ss[e]}function _s(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}}function Ts(e,t){return null==e&&(e=0),null==t&&(t=0),[e,t]}function Is(e,t){return e[0]=t[0],e[1]=t[1],e}function Es(e){return[e[0],e[1]]}function Ms(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function ks(e,t,n,i){return e[0]=t[0]+n[0]*i,e[1]=t[1]+n[1]*i,e}function Ps(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function Ds(e){return Math.sqrt(Os(e))}function Os(e){return e[0]*e[0]+e[1]*e[1]}function As(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function Fs(e,t){var n=Ds(t);return 0===n?(e[0]=0,e[1]=0):(e[0]=t[0]/n,e[1]=t[1]/n),e}function Rs(e,t){return Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))}var Bs=Rs;var Ns=function(e,t){return(e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])};function Ls(e,t,n,i){return e[0]=t[0]+i*(n[0]-t[0]),e[1]=t[1]+i*(n[1]-t[1]),e}function Vs(e,t,n){var i=t[0],a=t[1];return e[0]=n[0]*i+n[2]*a+n[4],e[1]=n[1]*i+n[3]*a+n[5],e}function qs(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}function Gs(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}var zs=Go,Us=5e-5;function js(e){return e>Us||e<-5e-5}var Hs=[],Ws=[],$s=[1,0,0,1,0,0],Ks=Math.abs,Ys=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 js(this.rotation)||js(this.x)||js(this.y)||js(this.scaleX-1)||js(this.scaleY-1)||js(this.skewX)||js(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):zs(n),e&&(t?Uo(n,e,n):zo(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(zs(n),this.invTransform=null)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(null!=t&&1!==t){this.getGlobalScale(Hs);var n=Hs[0]<0?-1:1,i=Hs[1]<0?-1:1,a=((Hs[0]-n)*t+n)/Hs[0]||0,r=((Hs[1]-i)*t+i)/Hs[1]||0;e[0]*=a,e[1]*=a,e[2]*=r,e[3]*=r}this.invTransform=this.invTransform||[1,0,0,1,0,0],$o(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],Uo(Ws,e.invTransform,t),t=Ws);var n=this.originX,i=this.originY;(n||i)&&($s[4]=n,$s[5]=i,Uo(Ws,t,$s),Ws[4]-=n,Ws[5]-=i,t=Ws),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&&Vs(n,n,i),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],i=this.transform;return i&&Vs(n,n,i),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&Ks(e[0]-1)>1e-10&&Ks(e[3]-1)>1e-10?Math.sqrt(Ks(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){Zs(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&&Ho(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}(),Xs=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function Zs(e,t){for(var n=0;n-1e-8&&etl||e<-1e-8}function cl(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 dl(e,t,n,i,a){var r=1-a;return 3*(((t-e)*r+2*(n-t)*a)*r+(i-n)*a*a)}function ul(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(ll(c)&&ll(d)){if(ll(s))r[0]=0;else(_=-l/s)>=0&&_<=1&&(r[m++]=_)}else{var h=d*d-4*c*u;if(ll(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=el(h),v=c*s+1.5*o*(-d+y),x=c*s+1.5*o*(-d-y);(_=(-s-((v=v<0?-Js(-v,al):Js(v,al))+(x=x<0?-Js(-x,al):Js(x,al))))/(3*o))>=0&&_<=1&&(r[m++]=_)}else{var b=(2*c*s-3*o*d)/(2*el(c*c*c)),w=Math.acos(b)/3,S=el(c),C=Math.cos(w),_=(-s-2*S*C)/(3*o),T=(f=(-s+S*(C+il*Math.sin(w)))/(3*o),(-s+S*(C-il*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 ml(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(ll(o)){if(pl(r))(c=-s/r)>=0&&c<=1&&(a[l++]=c)}else{var p=r*r-4*o*s;if(ll(p))a[0]=-r/(2*o);else if(p>0){var c,d=el(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 hl(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 gl(e,t,n,i,a,r,o,s,l,p,c){var d,u,m,h,g,f=.005,y=1/0;rl[0]=l,rl[1]=p;for(var v=0;v<1;v+=.05)ol[0]=cl(e,n,a,o,v),ol[1]=cl(t,i,r,s,v),(h=Ns(rl,ol))=0&&h=0&&f=1?1:ul(0,i,r,1,e,s)&&cl(0,a,o,1,s[0])}}}var Tl=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||yo,this.ondestroy=e.ondestroy||yo,this.onrestart=e.onrestart||yo,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=Gr(e)?e:Qs[e]||_l(e)},e}(),Il={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 El(e){return(e=Math.round(e))<0?0:e>255?255:e}function Ml(e){return e<0?0:e>1?1:e}function kl(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?El(parseFloat(t)/100*255):El(parseInt(t,10))}function Pl(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Ml(parseFloat(t)/100):Ml(parseFloat(t))}function Dl(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 Ol(e,t,n){return e+(t-e)*n}function Al(e,t,n,i,a){return e[0]=t,e[1]=n,e[2]=i,e[3]=a,e}function Fl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var Rl=new Ro(20),Bl=null;function Nl(e,t){Bl&&Fl(Bl,t),Bl=Rl.put(e,Bl||t.slice())}function Ll(e,t){if(e){t=t||[];var n=Rl.get(e);if(n)return Fl(t,n);var i=(e+="").replace(/ /g,"").toLowerCase();if(i in Il)return Fl(t,Il[i]),Nl(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?(Al(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),Nl(e,t),t):void Al(t,0,0,0,1):7===r||9===r?(a=parseInt(i.slice(1,7),16))>=0&&a<=16777215?(Al(t,(16711680&a)>>16,(65280&a)>>8,255&a,9===r?parseInt(i.slice(7),16)/255:1),Nl(e,t),t):void Al(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?Al(t,+p[0],+p[1],+p[2],1):Al(t,0,0,0,1);c=Pl(p.pop());case"rgb":return p.length>=3?(Al(t,kl(p[0]),kl(p[1]),kl(p[2]),3===p.length?c:Pl(p[3])),Nl(e,t),t):void Al(t,0,0,0,1);case"hsla":return 4!==p.length?void Al(t,0,0,0,1):(p[3]=Pl(p[3]),Vl(p,t),Nl(e,t),t);case"hsl":return 3!==p.length?void Al(t,0,0,0,1):(Vl(p,t),Nl(e,t),t);default:return}}Al(t,0,0,0,1)}}function Vl(e,t){var n=(parseFloat(e[0])%360+360)%360/360,i=Pl(e[1]),a=Pl(e[2]),r=a<=.5?a*(i+1):a+i-a*i,o=2*a-r;return Al(t=t||[],El(255*Dl(o,r,n+1/3)),El(255*Dl(o,r,n)),El(255*Dl(o,r,n-1/3)),1),4===e.length&&(t[3]=e[3]),t}function ql(e,t){var n=Ll(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 Hl(n,4===n.length?"rgba":"rgb")}}function Gl(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]=El(Ol(o[0],s[0],l)),n[1]=El(Ol(o[1],s[1],l)),n[2]=El(Ol(o[2],s[2],l)),n[3]=Ml(Ol(o[3],s[3],l)),n}}function zl(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=Ll(t[a]),s=Ll(t[r]),l=i-a,p=Hl([El(Ol(o[0],s[0],l)),El(Ol(o[1],s[1],l)),El(Ol(o[2],s[2],l)),Ml(Ol(o[3],s[3],l))],"rgba");return n?{color:p,leftIndex:a,rightIndex:r,value:i}:p}}function Ul(e,t,n,i){var a=Ll(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]=Pl(n)),null!=i&&(a[2]=Pl(i)),Hl(Vl(a),"rgba")}function jl(e,t){var n=Ll(e);if(n&&null!=t)return n[3]=Ml(t),Hl(n,"rgba")}function Hl(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 Wl(e,t){var n=Ll(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var $l=new Ro(100);function Kl(e){if(zr(e)){var t=$l.get(e);return t||(t=ql(e,-.1),$l.put(e,t)),t}if(Yr(e)){var n=Mr({},e);return n.colorStops=Fr(e.colorStops,(function(e){return{offset:e.offset,color:ql(e.color,-.1)}})),n}return e}var Yl=Math.round;function Xl(e){var t;if(e&&"transparent"!==e){if("string"==typeof e&&e.indexOf("rgba")>-1){var n=Ll(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 Zl=1e-4;function Ql(e){return e-1e-4}function Jl(e){return Yl(1e3*e)/1e3}function ep(e){return Yl(1e4*e)/1e4}var tp={left:"start",right:"end",center:"middle",middle:"middle"};function np(e){return e&&!!e.image}function ip(e){return np(e)||function(e){return e&&!!e.svgElement}(e)}function ap(e){return"linear"===e.type}function rp(e){return"radial"===e.type}function op(e){return e&&("linear"===e.type||"radial"===e.type)}function sp(e){return"url(#"+e+")"}function lp(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 pp(e){var t=e.x||0,n=e.y||0,i=(e.rotation||0)*vo,a=Jr(e.scaleX,1),r=Jr(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("+Yl(o*vo)+"deg, "+Yl(s*vo)+"deg)"),l.join(" ")}var cp=bo.hasGlobalWindow&&Gr(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},dp=Array.prototype.slice;function up(e,t,n){return(t-e)*n+e}function mp(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(Or(t)){var l=function(e){return Or(e&&e[0])?2:1}(t);o=l,(1===l&&!jr(t[0])||2===l&&!jr(t[0][0]))&&(r=!0)}else if(jr(t)&&!Zr(t))o=0;else if(zr(t))if(isNaN(+t)){var p=Ll(t);p&&(s=p,o=3)}else o=0;else if(Yr(t)){var c=Mr({},s);c.colorStops=Fr(t.colorStops,(function(e){return{offset:e.offset,color:Ll(e.color)}})),ap(t)?o=4:rp(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=Gr(n)?n:Qs[n]||_l(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=wp(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?Sp:e[c];if(!wp(s)&&!d||f||(f=this._additiveValue=[]),this.discrete)e[c]=g<1?i.rawValue:a.rawValue;else if(wp(s))1===s?mp(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,vp(l),i),this._trackKeys.push(o)}s.addKeyframe(e,vp(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}(),Tp=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,i){this._$handlers||(this._$handlers={});var a=this._$handlers;if("function"==typeof t&&(i=n,n=t,t=null),!n||!e)return this;var r=this._$eventProcessor;null!=t&&r&&r.normalizeQuery&&(t=r.normalizeQuery(t)),a[e]||(a[e]=[]);for(var o=0;o=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()?kp:Mp},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof t&&Ll(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,Hl(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||{},Mr(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(Hr(e))for(var n=Nr(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(Pp,!1,e)},e.prototype.useState=function(e,t,n,i){var a=e===Pp;if(this.hasState()||!a){var r=this.currentStates,o=this.stateTransition;if(!(Pr(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}_r("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=Pr(i,e),r=Pr(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;b1e-4)return s[0]=e-n,s[1]=t-i,l[0]=e+n,void(l[1]=t+i);if(Jp[0]=Zp(a)*n+e,Jp[1]=Xp(a)*i+t,ec[0]=Zp(r)*n+e,ec[1]=Xp(r)*i+t,p(s,Jp,ec),c(l,Jp,ec),(a%=Qp)<0&&(a+=Qp),(r%=Qp)<0&&(r+=Qp),a>r&&!o?r+=Qp:aa&&(tc[0]=Zp(m)*n+e,tc[1]=Xp(m)*i+t,p(s,tc,s),c(l,tc,l))}var pc={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},cc=[],dc=[],uc=[],mc=[],hc=[],gc=[],fc=Math.min,yc=Math.max,vc=Math.cos,xc=Math.sin,bc=Math.abs,wc=Math.PI,Sc=2*wc,Cc="undefined"!=typeof Float32Array,_c=[];function Tc(e){return Math.round(e/wc*1e8)/1e8%2*wc}function Ic(e,t){var n=Tc(e[0]);n<0&&(n+=Sc);var i=n-e[0],a=e[1];a+=i,!t&&a-n>=Sc?a=n+Sc:t&&n-a>=Sc?a=n-Sc:!t&&n>a?a=n+(Sc-Tc(n-a)):t&&n0&&(this._ux=bc(n/Ep/e)||0,this._uy=bc(n/Ep/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(pc.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=bc(e-this._xi),i=bc(t-this._yi),a=n>this._ux||i>this._uy;if(this.addData(pc.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(pc.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(pc.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(),_c[0]=i,_c[1]=a,Ic(_c,r),i=_c[0];var o=(a=_c[1])-i;return this.addData(pc.A,e,t,n,n,i,o,0,r?0:1),this._ctx&&this._ctx.arc(e,t,n,i,a,r),this._xi=vc(a)*n+e,this._yi=xc(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(pc.R,e,t,n,i),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(pc.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||!Cc||(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(){uc[0]=uc[1]=hc[0]=hc[1]=Number.MAX_VALUE,mc[0]=mc[1]=gc[0]=gc[1]=-Number.MAX_VALUE;var e,t=this.data,n=0,i=0,a=0,r=0;for(e=0;en||bc(f)>i||d===t-1)&&(h=Math.sqrt(k*k+f*f),a=g,r=x);break;case pc.C:var y=e[d++],v=e[d++],x=(g=e[d++],e[d++]),b=e[d++],w=e[d++];h=fl(a,r,y,v,g,x,b,w,10),a=b,r=w;break;case pc.Q:h=Sl(a,r,y=e[d++],v=e[d++],g=e[d++],x=e[d++],10),a=g,r=x;break;case pc.A:var S=e[d++],C=e[d++],_=e[d++],T=e[d++],I=e[d++],E=e[d++],M=E+I;d+=1,m&&(o=vc(I)*_+S,s=xc(I)*T+C),h=yc(_,T)*fc(Sc,Math.abs(E)),a=vc(M)*_+S,r=xc(M)*T+C;break;case pc.R:o=a=e[d++],s=r=e[d++],h=2*e[d++]+2*e[d++];break;case pc.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 pc.M:n=a=u[b++],i=r=u[b++],e.moveTo(a,r);break;case pc.L:o=u[b++],s=u[b++];var C=bc(o-a),_=bc(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 I=C*C+_*_;I>x&&(c=o,d=s,x=I)}break;case pc.C:var E=u[b++],M=u[b++],k=u[b++],P=u[b++],D=u[b++],O=u[b++];if(f){if(y+(K=l[v++])>p){hl(a,E,k,D,T=(p-y)/K,cc),hl(r,M,P,O,T,dc),e.bezierCurveTo(cc[1],dc[1],cc[2],dc[2],cc[3],dc[3]);break e}y+=K}e.bezierCurveTo(E,M,k,P,D,O),a=D,r=O;break;case pc.Q:E=u[b++],M=u[b++],k=u[b++],P=u[b++];if(f){if(y+(K=l[v++])>p){bl(a,E,k,T=(p-y)/K,cc),bl(r,M,P,T,dc),e.quadraticCurveTo(cc[1],dc[1],cc[2],dc[2]);break e}y+=K}e.quadraticCurveTo(E,M,k,P),a=k,r=P;break;case pc.A:var A=u[b++],F=u[b++],R=u[b++],B=u[b++],N=u[b++],L=u[b++],V=u[b++],q=!u[b++],G=R>B?R:B,z=bc(R-B)>.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(A,F,R,B,V,N,U,q):e.arc(A,F,G,N,U,q),j)break e;S&&(n=vc(N)*R+A,i=xc(N)*B+F),a=vc(U)*R+A,r=xc(U)*B+F;break;case pc.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+fc($,H),s),($-=H)>0&&e.lineTo(o+H,s+fc($,W)),($-=W)>0&&e.lineTo(o+yc(H-$,0),s+W),($-=H)>0&&e.lineTo(o,s+yc(W-$,0));break e}y+=K}e.rect(o,s,H,W);break;case pc.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=pc,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function Mc(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+=Ac);var u=Math.atan2(l,s);return u<0&&(u+=Ac),u>=i&&u<=a||u+Ac>=i&&u+Ac<=a}function Rc(e,t,n,i,a,r){if(r>t&&r>i||ra?s:0}var Bc=Ec.CMD,Nc=2*Math.PI;var Lc=[-1,-1,-1],Vc=[-1,-1];function qc(e,t,n,i,a,r,o,s,l,p){if(p>t&&p>i&&p>r&&p>s||p1&&(c=void 0,c=Vc[0],Vc[0]=Vc[1],Vc[1]=c),h=cl(t,i,r,s,Vc[0]),m>1&&(g=cl(t,i,r,s,Vc[1]))),2===m?yt&&s>i&&s>r||s=0&&c<=1&&(a[l++]=c);else{var p=o*o-4*r*s;if(ll(p))(c=-o/(2*r))>=0&&c<=1&&(a[l++]=c);else if(p>0){var c,d=el(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,Lc);if(0===l)return 0;var p=xl(t,i,r);if(p>=0&&p<=1){for(var c=0,d=yl(t,i,r,p),u=0;un||s<-n)return 0;var l=Math.sqrt(n*n-s*s);Lc[0]=-l,Lc[1]=l;var p=Math.abs(i-a);if(p<1e-4)return 0;if(p>=Nc-1e-4){i=0,a=Nc;var c=r?1:-1;return o>=Lc[0]+e&&o<=Lc[1]+e?c:0}if(i>a){var d=i;i=a,a=d}i<0&&(i+=Nc,a+=Nc);for(var u=0,m=0;m<2;m++){var h=Lc[m];if(h+e>o){var g=Math.atan2(s,h);c=r?1:-1;g<0&&(g=Nc+g),(g>=i&&g<=a||g+Nc>=i&&g+Nc<=a)&&(g>Math.PI/2&&g<1.5*Math.PI&&(c=-c),u+=c)}}return u}function Uc(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+=Rc(u,m,h,g,i,a))),v&&(h=u=p[f],g=m=p[f+1]),y){case Bc.M:u=h=p[f++],m=g=p[f++];break;case Bc.L:if(n){if(Mc(u,m,p[f],p[f+1],t,i,a))return!0}else d+=Rc(u,m,p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case Bc.C:if(n){if(kc(u,m,p[f++],p[f++],p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=qc(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 Bc.Q:if(n){if(Pc(u,m,p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=Gc(u,m,p[f++],p[f++],p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case Bc.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+=Rc(u,m,r,o,i,a);var I=(i-x)*S/w+x;if(n){if(Fc(x,b,S,C,C+_,T,t,I,a))return!0}else d+=zc(x,b,S,C,C+_,T,I,a);u=Math.cos(C+_)*w+x,m=Math.sin(C+_)*S+b;break;case Bc.R:if(h=u=p[f++],g=m=p[f++],r=h+p[f++],o=g+p[f++],n){if(Mc(h,g,r,g,t,i,a)||Mc(r,g,r,o,t,i,a)||Mc(r,o,h,o,t,i,a)||Mc(h,o,h,g,t,i,a))return!0}else d+=Rc(r,g,r,o,i,a),d+=Rc(h,o,h,g,i,a);break;case Bc.Z:if(n){if(Mc(u,m,h,g,t,i,a))return!0}else d+=Rc(u,m,h,g,i,a);u=h,m=g}}return n||(s=m,l=g,Math.abs(s-l)<1e-4)||(d+=Rc(u,m,h,g,i,a)||0),0!==d}var jc=kr({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Gp),Hc={style:kr({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},zp.style)},Wc=Xs.concat(["invisible","culling","z","z2","zlevel","parent"]),$c=function(e){function t(t){return e.call(this,t)||this}var n;return ze(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?Mp:t>.2?"#eee":kp}if(e)return kp}return Mp},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(zr(t)){var n=this.__zr;if(!(!n||!n.isDarkMode())===Wl(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 Ec(!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 Uc(e,t,!0,n,i)}(r,o/s,e,t)))return!0}if(this.hasFill())return function(e,t,n){return Uc(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:Mr(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(4&this.__dirty)},t.prototype.createStyle=function(e){return ho(jc,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=Mr({},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=Mr({},i.shape),Mr(s,n.shape)):(s=Mr({},a?this.shape:i.shape),Mr(s,n.shape)):l&&(s=i.shape),s)if(r){this.shape=Mr({},this.shape);for(var p={},c=Nr(s),d=0;d0},t.prototype.hasFill=function(){var e=this.style.fill;return null!=e&&"none"!==e},t.prototype.createStyle=function(e){return ho(Kc,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=ss(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}(Hp);Yc.prototype.type="tspan";var Xc=kr({x:0,y:0},Gp),Zc={style:kr({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},zp.style)};var Qc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.createStyle=function(e){return ho(Xc,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 Zc},t.prototype.getBoundingRect=function(){var e=this.style;return this._rect||(this._rect=new is(e.x||0,e.y||0,this.getWidth(),this.getHeight())),this._rect},t}(Hp);Qc.prototype.type="image";var Jc=Math.round;function ed(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?(Jc(2*i)===Jc(2*a)&&(e.x1=e.x2=nd(i,s,!0)),Jc(2*r)===Jc(2*o)&&(e.y1=e.y2=nd(r,s,!0)),e):e}}function td(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=nd(i,s,!0),e.y=nd(a,s,!0),e.width=Math.max(nd(i+r,s,!1)-e.x,0===r?0:1),e.height=Math.max(nd(a+o,s,!1)-e.y,0===o?0:1),e):e}}function nd(e,t,n){if(!t)return e;var i=Jc(2*e);return(i+Jc(t))%2==0?i/2:(i+(n?1:-1))/2}var id=function(){this.x=0,this.y=0,this.width=0,this.height=0},ad={},rd=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new id},t.prototype.buildPath=function(e,t){var n,i,a,r;if(this.subPixelOptimize){var o=td(ad,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}($c);rd.prototype.type="rect";var od={fill:"#000"},sd={style:kr({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},zp.style)},ld=function(e){function t(t){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=od,n.attr(t),n}return ze(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=gs(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),I=i.calculatedLineHeight,E=0;El&&ws(n,e.substring(l,p),t,s),ws(n,i[2],t,s,i[1]),l=ms.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 E=S.width,M=null==E||"auto"===E;if("string"==typeof E&&"%"===E.charAt(E.length-1))O.percentWidth=E,c.push(O),O.contentWidth=rs(O.text,T);else{if(M){var k=S.backgroundColor,P=k&&k.image;P&&qo(P=No(P))&&(O.width=Math.max(O.width,P.width*I/P.height))}var D=h&&null!=a?a-b:null;null!=D&&D=0&&"right"===(E=x[I]).align;)this._placeToken(E,e,w,h,T,"right",f),S-=E.width,T-=E.width,I--;for(_+=(n-(_-m)-(g-T)-S)/2;C<=I;)E=x[C],this._placeToken(E,e,w,h,_+E.width/2,"center",f),_+=E.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&&bd(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=vd(a,r,d),p-=e.height/2-d[0]-e.innerHeight/2);var u=this._getOrCreateChild(Yc),m=u.createStyle();u.useStyle(m);var h=this._defaultStyle,g=!1,f=0,y=yd("fill"in s?s.fill:"fill"in t?t.fill:(g=!0,h.fill)),v=fd("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||or,m.opacity=eo(s.opacity,t.opacity,1),md(m,s),v&&(m.lineWidth=eo(s.lineWidth,t.lineWidth,f),m.lineDash=Jr(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 is(ls(m.x,b,m.textAlign),ps(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(rd)).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=Jr(e.fillOpacity,1);else if(u){(s=this._getOrCreateChild(Qc)).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=Jr(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=eo(e.opacity,t.opacity,1)},t.makeFont=function(e){var t="";return hd(e)&&(t=[e.fontStyle,e.fontWeight,ud(e.fontSize),e.fontFamily||"sans-serif"].join(" ")),t&&ao(t)||e.textFont||e.font},t}(Hp),pd={left:!0,right:1,center:1},cd={top:1,bottom:1,middle:1},dd=["fontStyle","fontWeight","fontSize","fontFamily"];function ud(e){return"string"!=typeof e||-1===e.indexOf("px")&&-1===e.indexOf("rem")&&-1===e.indexOf("em")?isNaN(+e)?"12px":e+"px":e}function md(e,t){for(var n=0;n0){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 Cd(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 zr(e)?(n=e,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e;var n}function _d(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 Id(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 Ed(e)}function Ed(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 Md(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 kd(e,t){var n=Rr(e,(function(e,t){return e+(isNaN(t)?0:t)}),0);if(0===n)return[];for(var i=Math.pow(10,t),a=Fr(e,(function(e){return(isNaN(e)?0:e)/n*i*100})),r=100*i,o=Fr(a,(function(e){return Math.floor(e)})),s=Rr(o,(function(e,t){return e+t}),0),l=Fr(a,(function(e,t){return e-o[t]}));sp&&(p=l[d],c=d);++o[c],l[c]=0,++s}return Fr(o,(function(e){return e/i}))}function Pd(e,t){var n=Math.max(Id(e),Id(t)),i=e+t;return n>20?i:_d(i,n)}function Dd(e){var t=2*Math.PI;return(e%t+t)%t}function Od(e){return e>-1e-4&&e=10&&t++,t}function Bd(e,t){var n=Rd(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 Nd(e){e.sort((function(e,t){return s(e,t,0)?-1:1}));for(var t=-1/0,n=1,i=0;i=0,r=!1;if(e instanceof $c){var o=bu(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(Pu(s)||Pu(l)){var p=(i=i||{}).style||{};"inherit"===p.fill?(r=!0,i=Mr({},i),(p=Mr({},p)).fill=s):!Pu(p.fill)&&Pu(s)?(r=!0,i=Mr({},i),(p=Mr({},p)).fill=Kl(s)):!Pu(p.stroke)&&Pu(l)&&(r||(i=Mr({},i),p=Mr({},p)),p.stroke=Kl(l)),i.style=p}}if(i&&null==i.z2){r||(i=Mr({},i));var c=e.z2EmphasisLift;i.z2=e.z2+(null!=c?c:_u)}return i}(this,0,t,n);if("blur"===e)return function(e,t,n){var i=Pr(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 am(e,t,n){cm(e,!0),Vu(e,zu),om(e,t,n)}function rm(e,t,n,i){i?function(e){cm(e,!1)}(e):am(e,t,n)}function om(e,t,n){var i=fu(e);null!=t?(i.focus=t,i.blurScope=n):i.focus&&(i.focus=null)}var sm=["emphasis","blur","select"],lm={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function pm(e,t,n,i){n=n||"itemStyle";for(var a=0;a1&&(o*=xm(h),s*=xm(h));var g=(a===r?-1:1)*xm((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+wm(d)*f-bm(d)*y,x=(t+i)/2+bm(d)*f+wm(d)*y,b=Tm([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=Tm(w,S);if(_m(w,S)<=-1&&(C=Sm),_m(w,S)>=1&&(C=0),C<0){var _=Math.round(C/Sm*1e6)/1e6;C=2*Sm+_%2*Sm}c.addData(p,v,x,o,s,b,C,d,r)}var Em=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Mm=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var km=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.applyTransform=function(e){},t}($c);function Pm(e){return null!=e.setData}function Dm(e,t){var n=function(e){var t=new Ec;if(!e)return t;var n,i=0,a=0,r=i,o=a,s=Ec.CMD,l=e.match(Em);if(!l)return t;for(var p=0;p=0&&(n.splice(i,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=Pr(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=Pr(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;nP*P+D*D&&(_=I,T=E),{cx:_,cy:T,x0:-c,y0:-d,x1:_*(a/w-1),y1:T*(a/w-1)}}function Xm(e,t){var n,i=Wm(t.r,0),a=Wm(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=jm(l-s),m=u>Vm&&u%Vm;if(m>Km&&(u=m),i>Km)if(u>Vm-Km)e.moveTo(p+i*Gm(s),c+i*qm(s)),e.arc(p,c,i,s,l,!d),a>Km&&(e.moveTo(p+a*Gm(l),c+a*qm(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,I=void 0,E=void 0,M=void 0,k=void 0,P=i*Gm(s),D=i*qm(s),O=a*Gm(l),A=a*qm(l),F=u>Km;if(F){var R=t.cornerRadius;R&&(n=function(e){var t;if(qr(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}(R),h=n[0],g=n[1],f=n[2],y=n[3]);var B=jm(i-a)/2;if(v=$m(B,f),x=$m(B,y),b=$m(B,h),w=$m(B,g),_=S=Wm(v,x),T=C=Wm(b,w),(S>Km||C>Km)&&(I=i*Gm(l),E=i*qm(l),M=a*Gm(s),k=a*qm(s),uKm){var j=$m(f,_),H=$m(y,_),W=Ym(M,k,P,D,i,j,d),$=Ym(I,E,O,A,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,Um(W.y0,W.x0),Um(W.y1,W.x1),!d),e.arc(p,c,i,Um(W.cy+W.y1,W.cx+W.x1),Um($.cy+$.y1,$.cx+$.x1),!d),H>0&&e.arc(p+$.cx,c+$.cy,H,Um($.y1,$.x1),Um($.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>Km&&F)if(T>Km){j=$m(h,T),W=Ym(O,A,I,E,a,-(H=$m(g,T)),d),$=Ym(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,Um(W.y0,W.x0),Um(W.y1,W.x1),!d),e.arc(p,c,a,Um(W.cy+W.y1,W.cx+W.x1),Um($.cy+$.y1,$.cx+$.x1),d),j>0&&e.arc(p+$.cx,c+$.cy,j,Um($.y1,$.x1),Um($.y0,$.x0),!d))}else e.lineTo(p+O,c+A),e.arc(p,c,a,l,s,d);else e.lineTo(p+O,c+A)}else e.moveTo(p,c);e.closePath()}}}var Zm=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},Qm=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new Zm},t.prototype.buildPath=function(e,t){Xm(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}($c);Qm.prototype.type="sector";var Jm=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},eh=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new Jm},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}($c);function th(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;ubh[1]){if(o=!1,a)return o;var p=Math.abs(bh[0]-xh[1]),c=Math.abs(xh[0]-bh[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 kh(e,t,n,i,a,r){Mh("update",e,t,n,i,a,r)}function Ph(e,t,n,i,a,r){Mh("enter",e,t,n,i,a,r)}function Dh(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 Qh(e){return!e.isGroup}function Jh(e,t,n){if(e&&t){var i,a=(i={},e.traverse((function(e){Qh(e)&&e.anid&&(i[e.anid]=e)})),i);t.traverse((function(e){if(Qh(e)&&e.anid){var t=a[e.anid];if(t){var i=r(e);e.attr(r(t)),kh(e,i,n,fu(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=Mr({},e.shape)),t}}function eg(e,t){return Fr(e,(function(e){var n=e[0];n=Bh(n,t.x),n=Nh(n,t.x+t.width);var i=e[1];return i=Bh(i,t.y),[n,i=Nh(i,t.y+t.height)]}))}function tg(e,t,n){var i=Mr({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),kr(a,n),new Qc(i)):zh(e.replace("path://",""),i,n,"center")}function ng(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=ag(h,g,p,c)/m;if(f<0||f>1)return!1;var y=ag(h,g,d,u)/m;return!(y<0||y>1)}function ag(e,t,n,i){return e*i-n*t}function rg(e){var t=e.itemTooltipOption,n=e.componentModel,i=e.itemName,a=zr(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&&Ar(Nr(l),(function(e){fo(s,e)||(s[e]=l[e],s.$vars.push(e))}));var p=fu(e.el);p.componentMainType=r,p.componentIndex=o,p.tooltipConfig={name:i,option:kr({content:i,formatterParams:s},a)}}function og(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function sg(e,t){if(e)if(qr(e))for(var n=0;n=n&&r>=a)return{x:n,y:a,width:i-n,height:r-a}},createIcon:tg,extendPath:function(e,t){return Vh(e,t)},extendShape:function(e){return $c.extend(e)},getShapeClass:Gh,getTransform:Yh,groupTransition:Jh,initProps:Ph,isElementRemoved:Dh,lineLineIntersect:ig,linePolygonIntersect:ng,makeImage:Uh,makePath:zh,mergePath:Hh,registerShape:qh,removeElement:Oh,removeElementWithFadeOut:Fh,resizePath:Wh,setTooltipConfig:rg,subPixelOptimize:Kh,subPixelOptimizeLine:$h,subPixelOptimizeRect:function(e){return td(e.shape,e.shape,e.style),e},transformDirection:Zh,traverseElements:sg,updateProps:kh}),pg={};function cg(e,t){for(var n=0;n1){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;op&&(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;tt},gte:function(e,t){return e>=t}},Lf=function(){function e(e,t){if(!jr(t)){var n="";0,jd(n)}this._opFn=Nf[e],this._rvalFloat=Ld(t)}return e.prototype.evaluate=function(e){return jr(e)?this._opFn(e,this._rvalFloat):this._opFn(Ld(e),this._rvalFloat)},e}(),Vf=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=jr(e)?e:Ld(e),i=jr(t)?t:Ld(t),a=isNaN(n),r=isNaN(i);if(a&&(n=this._incomparable),r&&(i=this._incomparable),a&&r){var o=zr(e),s=zr(t);o&&(n=s?e:0),s&&(i=o?t:0)}return ni?-this._resultLT:0},e}(),qf=function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=Ld(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=Ld(e)===this._rvalFloat)}return this._isEQ?t:!t},e}();function Gf(e,t){return"eq"===e||"ne"===e?new qf("eq"===e,t):fo(Nf,e)?new Lf(e,t):null}var zf,Uf="undefined",jf=typeof Uint32Array===Uf?Array:Uint32Array,Hf=typeof Uint16Array===Uf?Array:Uint16Array,Wf=typeof Int32Array===Uf?Array:Int32Array,$f=typeof Float64Array===Uf?Array:Float64Array,Kf={float:$f,int:Wf,ordinal:Array,number:Array,time:$f};function Yf(e){return e>65535?jf:Hf}function Xf(e,t,n,i,a){var r=Kf[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=Fr(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(Yf(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 Ff(e[i],this._dimensions[i])}zf={arrayRows:e,objectRows:function(e,t,n,i){return Ff(e[t],this._dimensions[i])},keyedColumns:e,original:function(e,t,n,i){var a=e&&(null==e.value?e:e.value);return Ff(a instanceof Array?a[i]:a,this._dimensions[i])},typedArray:function(e,t,n,i){return e[i]}}}(),e}(),Qf=ou(),Jf={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},ey=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||(this._dimNameMap=iy(this.source)))},e.prototype.getSourceDimensionIndex=function(e){return Jr(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=yf(this.source),n=!ay(e),i="",a=[],r=0,o=0;r30}var ry,oy,sy,ly,py,cy,dy,uy=Hr,my=Fr,hy="undefined"==typeof Int32Array?Array:Int32Array,gy=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],fy=["_approximateExtent"],yy=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;ty(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===Gg&&!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&&(qr(a=this.getVisual(t))?a=a.slice():uy(a)&&(a=Mr({},a)),i[t]=a),a},e.prototype.setItemVisual=function(e,t,n){var i=this._itemVisuals[e]||{};this._itemVisuals[e]=i,uy(t)?Mr(i,t):i[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){uy(e)?Mr(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?Mr(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;yu(n,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){Ar(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:my(this.dimensions,this._getDimInfo,this),this.hostModel)),py(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];Gr(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(to(arguments)))})},e.internalField=(ry=function(e){var t=e._invertedIndicesMap;Ar(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 hy(r.categories.length),r)for(var l=0;l1&&(s+="__ec__"+p),i[t]=s}})),e}();function vy(e,t){df(e)||(e=mf(e));var n=(t=t||{}).coordDimensions||[],i=t.dimensionsDefine||e.dimensionsDefine||[],a=uo(),r=[],o=function(e,t,n,i){var a=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,i||0);return Ar(t,(function(e){var t;Hr(e)&&(t=e.dimsDef)&&(a=Math.max(a,t.length))})),a}(e,n,i,t.dimensionsCount),s=t.canOmitUnusedDimensions&&ay(o),l=i===e.dimensionsDefine,p=l?iy(e):ny(i),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var d=uo(c),u=new Wf(o),m=0;m0&&(i.name=a+(r-1)),r++,t.set(a,r)}}(r),new ey({source:e,dimensions:r,fullDimensionCount:o,dimensionOmitted:s})}function xy(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 by={},wy=function(){function e(){this._coordinateSystems=[]}return e.prototype.create=function(e,t){var n=[];Ar(by,(function(i,a){var r=i.create(e,t);n=n.concat(r||[])})),this._coordinateSystems=n},e.prototype.update=function(e,t){Ar(this._coordinateSystems,(function(n){n.update&&n.update(e,t)}))},e.prototype.getCoordinateSystems=function(){return this._coordinateSystems.slice()},e.register=function(e,t){by[e]=t},e.get=function(e){return by[e]},e}(),Sy=function(e){this.coordSysDims=[],this.axisMap=uo(),this.categoryAxisMap=uo(),this.coordSysName=e};var Cy={cartesian2d:function(e,t,n,i){var a=e.getReferringComponents("xAxis",cu).models[0],r=e.getReferringComponents("yAxis",cu).models[0];t.coordSysDims=["x","y"],n.set("x",a),n.set("y",r),_y(a)&&(i.set("x",a),t.firstCategoryDimIndex=0),_y(r)&&(i.set("y",r),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,n,i){var a=e.getReferringComponents("singleAxis",cu).models[0];t.coordSysDims=["single"],n.set("single",a),_y(a)&&(i.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,n,i){var a=e.getReferringComponents("polar",cu).models[0],r=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],n.set("radius",r),n.set("angle",o),_y(r)&&(i.set("radius",r),t.firstCategoryDimIndex=0),_y(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();Ar(r.parallelAxisIndex,(function(e,r){var s=a.getComponent("parallelAxis",e),l=o[r];n.set(l,s),_y(s)&&(i.set(l,s),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=r))}))}};function _y(e){return"category"===e.get("type")}function Ty(e,t,n){var i,a,r,o=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(e){return!ty(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(Ar(i,(function(e,t){zr(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;Ar(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 Iy(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function Ey(e,t){return Iy(e,t)?e.getCalculationInfo("stackResultDimension"):t}function My(e,t,n){n=n||{};var i,a=t.getSourceManager(),r=!1;e?(r=!0,i=mf(e)):r=(i=a.getSource()).sourceFormat===Gg;var o=function(e){var t=e.get("coordinateSystem"),n=new Sy(t),i=Cy[t];if(i)return i(e,n,n.axisMap,n.categoryAxisMap),n}(t),s=function(e,t){var n,i=e.get("coordinateSystem"),a=wy.get(i);return t&&t.coordSysDims&&(n=Fr(t.coordSysDims,(function(e){var n={name:e},i=t.axisMap.get(e);if(i){var a=i.get("type");n.type=Of(a)}return n}))),n||(n=a&&(a.getDimensionsInfo?a.getDimensionsInfo():a.dimensions.slice())||["x","y"]),n}(t,o),l=n.useEncodeDefaulter,p=Gr(l)?l:l?Vr(Jg,s,t):null,c=vy(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:p,canOmitUnusedDimensions:!r}),d=function(e,t,n){var i,a;return n&&Ar(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=Ty(t,{schema:c,store:u}),h=new yy(c,t);h.setCalculationInfo(m);var g=null!=d&&function(e){if(e.sourceFormat===Gg){var t=function(e){var t=0;for(;t>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?Fy(s,o):Fy(o,s))}(o,r,a);if(s)return s(e,n,i),!0}return!1}function Ly(e){return"CANVAS"===e.nodeName.toUpperCase()}var Vy=/([&<>"'])/g,qy={"&":"&","<":"<",">":">",'"':""","'":"'"};function Gy(e){return null==e?"":(e+"").replace(Vy,(function(e,t){return qy[t]}))}var zy="ZH",Uy="EN",jy=Uy,Hy={},Wy={},$y=bo.domSupported&&(document.documentElement.lang||navigator.language||navigator.browserLanguage||jy).toUpperCase().indexOf(zy)>-1?zy:jy;function Ky(e,t){e=e.toUpperCase(),Wy[e]=new Bg(t),Hy[e]=t}function Yy(e){return Wy[e]}Ky(Uy,{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:". "}}}}),Ky(zy,{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 Xy=1e3,Zy=6e4,Qy=36e5,Jy=864e5,ev=31536e6,tv={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}"},nv="{yyyy}-{MM}-{dd}",iv={year:"{yyyy}",month:"{yyyy}-{MM}",day:nv,hour:nv+" "+tv.hour,minute:nv+" "+tv.minute,second:nv+" "+tv.second,millisecond:tv.none},av=["year","month","day","hour","minute","second","millisecond"],rv=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function ov(e,t){return"0000".substr(0,t-(e+="").length)+e}function sv(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 lv(e){return e===sv(e)}function pv(e,t,n,i){var a=Fd(e),r=a[uv(n)](),o=a[mv(n)]()+1,s=Math.floor((o-1)/3)+1,l=a[hv(n)](),p=a["get"+(n?"UTC":"")+"Day"](),c=a[gv(n)](),d=(c-1)%12+1,u=a[fv(n)](),m=a[yv(n)](),h=a[vv(n)](),g=(i instanceof Bg?i:Yy(i||$y)||Wy[jy]).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,ov(r%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,f[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,ov(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,ov(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,v[p]).replace(/{ee}/g,x[p]).replace(/{e}/g,p+"").replace(/{HH}/g,ov(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,ov(d+"",2)).replace(/{h}/g,d+"").replace(/{mm}/g,ov(u,2)).replace(/{m}/g,u+"").replace(/{ss}/g,ov(m,2)).replace(/{s}/g,m+"").replace(/{SSS}/g,ov(h,3)).replace(/{S}/g,h+"")}function cv(e,t){var n=Fd(e),i=n[mv(t)]()+1,a=n[hv(t)](),r=n[gv(t)](),o=n[fv(t)](),s=n[yv(t)](),l=0===n[vv(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 dv(e,t,n){var i=jr(e)?Fd(e):e;switch(t=t||cv(e,n)){case"year":return i[uv(n)]();case"half-year":return i[mv(n)]()>=6?1:0;case"quarter":return Math.floor((i[mv(n)]()+1)/4);case"month":return i[mv(n)]();case"day":return i[hv(n)]();case"half-day":return i[gv(n)]()/24;case"hour":return i[gv(n)]();case"minute":return i[fv(n)]();case"second":return i[yv(n)]();case"millisecond":return i[vv(n)]()}}function uv(e){return e?"getUTCFullYear":"getFullYear"}function mv(e){return e?"getUTCMonth":"getMonth"}function hv(e){return e?"getUTCDate":"getDate"}function gv(e){return e?"getUTCHours":"getHours"}function fv(e){return e?"getUTCMinutes":"getMinutes"}function yv(e){return e?"getUTCSeconds":"getSeconds"}function vv(e){return e?"getUTCMilliseconds":"getMilliseconds"}function xv(e){return e?"setUTCFullYear":"setFullYear"}function bv(e){return e?"setUTCMonth":"setMonth"}function wv(e){return e?"setUTCDate":"setDate"}function Sv(e){return e?"setUTCHours":"setHours"}function Cv(e){return e?"setUTCMinutes":"setMinutes"}function _v(e){return e?"setUTCSeconds":"setSeconds"}function Tv(e){return e?"setUTCMilliseconds":"setMilliseconds"}function Iv(e){if(!Vd(e))return zr(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function Ev(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 Mv=no;function kv(e,t,n){function i(e){return e&&ao(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?Fd(e):e;if(!isNaN(+s))return pv(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(o)return"-"}if("ordinal"===t)return Ur(e)?i(e):jr(e)&&a(e)?e+"":"-";var l=Ld(e);return a(l)?Iv(l):Ur(e)?i(e):"boolean"==typeof e?e+"":"-"}var Pv=["a","b","c","d","e","f","g"],Dv=function(e,t){return"{"+e+(null==t?"":t)+"}"};function Ov(e,t,n){qr(t)||(t=[t]);var i=t.length;if(!i)return"";for(var a=t[0].$vars||[],r=0;ri||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 Vv=Lv;Vr(Lv,"vertical"),Vr(Lv,"horizontal");function qv(e,t,n){n=Mv(n||0);var i=t.width,a=t.height,r=Cd(e.left,i),o=Cd(e.top,a),s=Cd(e.right,i),l=Cd(e.bottom,a),p=Cd(e.width,i),c=Cd(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 is(r+n[3],o+n[0],p,c);return h.margin=n,h}function Gv(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 is(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=qv(kr({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 zv(e){var t=e.layoutMode||e.constructor.layoutMode;return Hr(t)?t:t?{type:t}:null}function Uv(e,t,n){var i=n&&n.ignoreSize;!qr(i)&&(i=[i,i]);var a=o(Nv[0],0),r=o(Nv[1],1);function o(n,a){var r={},o=0,p={},c=0;if(Rv(n,(function(t){p[t]=e[t]})),Rv(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=Ir(r,n[o],!0);t.defaultOption=r}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+"Index",i=e+"Id";return uu(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}(Bg);To($v,Bg),ko($v),function(e){var t={};e.registerSubTypeDefaulter=function(e,n){var i=Co(e);t[i.main]=n},e.determineSubType=function(n,i){var a=i.type;if(!a){var r=Co(n).main;e.hasSubTypes(n)&&t[r]&&(a=t[r](i))}return a}}($v),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 Ar(e,(function(r){var o=n(i,r),s=function(e,t){var n=[];return Ar(e,(function(e){Pr(t,e)>=0&&n.push(e)})),n}(o.originalDeps=t(r),e);o.entryCount=s.length,0===o.entryCount&&a.push(r),Ar(s,(function(e){Pr(o.predecessor,e)<0&&o.predecessor.push(e);var t=n(i,e);Pr(t.successor,e)<0&&t.successor.push(r)}))})),{graph:i,noEntryList:a}}(i),s=o.graph,l=o.noEntryList,p={};for(Ar(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]),Ar(d.successor,u?h:m)}Ar(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)}}}($v,(function(e){var t=[];Ar($v.getClassesByMainType(e),(function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])})),t=Fr(t,(function(e){return Co(e).main})),"dataset"!==e&&Pr(t,"dataset")<=0&&t.unshift("dataset");return t}));var Kv=ou(),Yv=ou(),Xv=function(){function e(){}return e.prototype.getColorFromPalette=function(e,t,n){var i=Kd(this.get("color",!0)),a=this.get("colorLayer",!0);return Qv(this,Kv,i,a,e,t,n)},e.prototype.clearColorPalette=function(){!function(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}(this,Kv)},e}();function Zv(e,t,n,i){var a=Kd(e.get(["aria","decal","decals"]));return Qv(e,Yv,a,null,t,n,i)}function Qv(e,t,n,i,a,r,o){var s=t(r=r||e),l=s.paletteIdx||0,p=s.paletteNameMap=s.paletteNameMap||{};if(p.hasOwnProperty(a))return p[a];var c=null!=o&&i?function(e,t){for(var n=e.length,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 Jv=/\{@(.+?)\}/g,ex=function(){function e(){}return e.prototype.getDataParams=function(e,t){var n=this.getData(t),i=this.getRawValue(e,t),a=n.getRawIndex(e),r=n.getName(e),o=n.getRawDataItem(e),s=n.getItemVisual(e,"style"),l=s&&s[n.getItemVisual(e,"drawType")||"fill"],p=s&&s.stroke,c=this.mainType,d="series"===c,u=n.userOutput&&n.userOutput.get();return{componentType:c,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:d?this.subType:null,seriesIndex:this.seriesIndex,seriesId:d?this.id:null,seriesName:d?this.name:null,name:r,dataIndex:a,data:o,dataType:t,value:i,color:l,borderColor:p,dimensionNames:u?u.fullDimensions:null,encode:u?u.encode:null,$vars:["seriesName","name","value"]}},e.prototype.getFormattedLabel=function(e,t,n,i,a,r){t=t||"normal";var o=this.getData(n),s=this.getDataParams(e,n);(r&&(s.value=r.interpolatedValue),null!=i&&qr(s.value)&&(s.value=s.value[i]),a)||(a=o.getItemModel(e).get("normal"===t?["label","formatter"]:[t,"label","formatter"]));return Gr(a)?(s.status=t,s.dimensionIndex=i,a(s)):zr(a)?Ov(a,s).replace(Jv,(function(t,n){var i=n.length,a=n;"["===a.charAt(0)&&"]"===a.charAt(i-1)&&(a=+a.slice(1,i-1));var s=kf(o,e,a);if(r&&qr(r.interpolatedValue)){var l=o.getDimensionIndex(a);l>=0&&(s=r.interpolatedValue[l])}return null!=s?s+"":""})):void 0},e.prototype.getRawValue=function(e,t){return kf(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function tx(e){var t,n;return Hr(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function nx(e){return new ix(e)}var ix=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:r9e10&&(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(gx(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=$r(o=r.get("data",!0))?Hg:Gg,t=[];var c=this._getSourceMetaRawOption()||{},d=l&&l.metaRawOption||{},u=Jr(c.seriesLayoutBy,d.seriesLayoutBy)||null,m=Jr(c.sourceHeader,d.sourceHeader),h=Jr(c.dimensions,d.dimensions);e=u!==d.seriesLayoutBy||!!m!=!!d.sourceHeader||h?[uf(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=[uf(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&&fx(r)}var o,s=[],l=[];return Ar(e,(function(e){e.prepareSource();var t=e.getSource(a||0),n="";null==a||t||fx(n),s.push(t),l.push(e._getVersionSign())})),i?t=function(e,t){var n=Kd(e),i=n.length,a="";i||jd(a);for(var r=0,o=i;r1||n>0&&!e.noHeader;return Ar(e.blocks,(function(e){var n=Tx(e);n>=t&&(t=n+ +(i&&(!n||Cx(e)&&!e.noHeader)))})),t}return 0}function Ix(e,t,n,i){var a,r=t.noHeader,o=(a=Tx(t),{html:xx[a],richText:bx[a]}),s=[],l=t.blocks||[];io(!l||qr(l)),l=l||[];var p=e.orderMode;if(t.sortBlocks&&p){l=l.slice();var c={valueAsc:"asc",valueDesc:"desc"};if(fo(c,p)){var d=new Vf(c[p],null);l.sort((function(e,t){return d.evaluate(e.sortParam,t.sortParam)}))}else"seriesDesc"===p&&l.reverse()}Ar(l,(function(n,a){var r=t.valueFormatter,l=_x(n)(r?Mr(Mr({},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):kx(s.join(""),r?n:o.html);if(r)return u;var m=kv(t.header,"ordinal",e.useUTC),h=vx(i,e.renderMode).nameStyle;return"richText"===e.renderMode?Px(e,m,h)+o.richText+u:kx('
    '+Gy(m)+"
    "+u,n)}function Ex(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 Fr(e=qr(e)?e:[e],(function(e,t){return kv(e,qr(m)?m[t]:m,p)}))};if(!r||!o){var d=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||"#333",a),u=r?"":kv(l,"ordinal",p),m=t.valueType,h=o?[]:c(t.value,t.dataIndex),g=!s||!r,f=!s&&r,y=vx(i,a),v=y.nameStyle,x=y.valueStyle;return"richText"===a?(s?"":d)+(r?"":Px(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(qr(t)?t.join(" "):t,r)}(e,h,g,f,x)):kx((s?"":d)+(r?"":function(e,t,n){return''+Gy(e)+""}(u,!s,v))+(o?"":function(e,t,n,i){var a=n?"10px":"20px",r=t?"float:right;margin-left:"+a:"";return e=qr(e)?e:[e],''+Fr(e,(function(e){return Gy(e)})).join("  ")+""}(h,g,f,x)),n)}}function Mx(e,t,n,i,a,r){if(e)return _x(e)({useUTC:a,renderMode:n,orderMode:i,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,r)}function kx(e,t){return'
    '+e+'
    '}function Px(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function Dx(e,t){return Av(e.getData().getItemVisual(t,"style")[e.visualDrawType])}function Ox(e,t){var n=e.get("padding");return null!=n?n:"richText"===t?[8,10]:10}var Ax=function(){function e(){this.richTextStyles={},this._nextStyleNameId=qd()}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=function(e,t){var n=zr(e)?{color:e,extraCssText:t}:e||{},i=n.color,a=n.type;t=n.extraCssText;var r=n.renderMode||"html";return i?"html"===r?"subItem"===a?'':'':{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}}:""}({color:t,type:e,renderMode:n,markerId:i});return zr(a)?a:(this.richTextStyles[i]=a.style,a.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};qr(t)?Ar(t,(function(e){return Mr(n,e)})):Mr(n,t);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+e+"}"},e}();function Fx(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=qr(d),m=Dx(r,o);if(c>1||u&&!c){var h=function(e,t,n,i,a){var r=t.getData(),o=Rr(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(Sx("nameValue",{markerType:"subItem",markerColor:a,name:n.displayName,value:e,valueType:n.type})):(s.push(e),l.push(n.type)))}return i.length?Ar(i,(function(e){c(kf(r,n,e),e)})):Ar(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=kf(l,o,p[0]),n=g.type}else a=t=u?d[0]:d;var f=iu(r),y=f&&r.name||"",v=l.getName(o),x=s?y:v;return Sx("section",{header:y,noHeader:s||!f,sortParam:a,blocks:[Sx("nameValue",{markerType:"item",markerColor:m,name:x,noName:!ao(x),value:t,valueType:n,dataIndex:o})].concat(i||[])})}var Rx=ou();function Bx(e,t){return e.getName(t)||e.getId(t)}var Nx="__universalTransitionEnabled",Lx=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return ze(t,e),t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=nx({count:qx,reset:Gx}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(Rx(this).sourceManager=new mx(this)).prepareSource();var i=this.getInitialData(e,n);Ux(i,this),this.dataTask.context.data=i,Rx(this).dataBeforeProcessed=i,Vx(this),this._initSelectedMapFromData(i)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=zv(this),i=n?jv(e):{},a=this.subType;$v.hasClass(a)&&(a+="Series"),Ir(e,t.getTheme().get(this.subType)),Ir(e,this.getDefaultOption()),Yd(e,"label",["show"]),this.fillDataTextStyle(e.data),n&&Uv(e,i,n)},t.prototype.mergeOption=function(e,t){e=Ir(this.option,e,!0),this.fillDataTextStyle(e.data);var n=zv(this);n&&Uv(this.option,e,n);var i=Rx(this).sourceManager;i.dirty(),i.prepareSource();var a=this.getInitialData(e,t);Ux(a,this),this.dataTask.dirty(),this.dataTask.context.data=a,Rx(this).dataBeforeProcessed=a,Vx(this),this._initSelectedMapFromData(a)},t.prototype.fillDataTextStyle=function(e){if(e&&!$r(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=Xv.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[Bx(i,e)])&&!i.getItemModel(e).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[Nx])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){Hr(a.selectedMap)||(a.selectedMap={});for(var s=a.selectedMap,l=0;l0&&this._innerSelect(e,t)}},t.registerClass=function(e){return $v.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}($v);function Vx(e){var t=e.name;iu(e)||(e.name=function(e){var t=e.getRawData(),n=t.mapDimensionsAll("seriesName"),i=[];return Ar(n,(function(e){var n=t.getDimensionInfo(e);n.displayName&&i.push(n.displayName)})),i.join(" ")}(e)||t)}function qx(e){return e.model.getRawData().count()}function Gx(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),zx}function zx(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function Ux(e,t){Ar(mo(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),(function(n){e.wrapMethod(n,Vr(jx,t))}))}function jx(e,t){var n=Hx(e);return n&&n.setOutputEnd((t||this).count()),t}function Hx(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}}Dr(Lx,ex),Dr(Lx,Xv),To(Lx,$v);var Wx=$c.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,i=t.cy,a=t.width/2,r=t.height/2;e.moveTo(n,i-r),e.lineTo(n+a,i+r),e.lineTo(n-a,i+r),e.closePath()}}),$x=$c.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,i=t.cy,a=t.width/2,r=t.height/2;e.moveTo(n,i-r),e.lineTo(n+a,i),e.lineTo(n,i+r),e.lineTo(n-a,i),e.closePath()}}),Kx=$c.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,i=t.y,a=t.width/5*3,r=Math.max(a,t.height),o=a/2,s=o*o/(r-o),l=i-r+o+s,p=Math.asin(s/o),c=Math.cos(p)*o,d=Math.sin(p),u=Math.cos(p),m=.6*o,h=.7*o;e.moveTo(n-c,l+s),e.arc(n,l,o,Math.PI-p,2*Math.PI+p),e.bezierCurveTo(n+c-d*m,l+s+u*m,n,i-h,n,i),e.bezierCurveTo(n,i-h,n-c+d*m,l+s+u*m,n-c,l+s),e.closePath()}}),Yx=$c.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,i=t.width,a=t.x,r=t.y,o=i/3*2;e.moveTo(a,r),e.lineTo(a+o,r+n),e.lineTo(a,r+n/4*3),e.lineTo(a-o,r+n),e.lineTo(a,r),e.closePath()}}),Xx={line:function(e,t,n,i,a){a.x1=e,a.y1=t+i/2,a.x2=e+n,a.y2=t+i/2},rect:function(e,t,n,i,a){a.x=e,a.y=t,a.width=n,a.height=i},roundRect:function(e,t,n,i,a){a.x=e,a.y=t,a.width=n,a.height=i,a.r=Math.min(n,i)/4},square:function(e,t,n,i,a){var r=Math.min(n,i);a.x=e,a.y=t,a.width=r,a.height=r},circle:function(e,t,n,i,a){a.cx=e+n/2,a.cy=t+i/2,a.r=Math.min(n,i)/2},diamond:function(e,t,n,i,a){a.cx=e+n/2,a.cy=t+i/2,a.width=n,a.height=i},pin:function(e,t,n,i,a){a.x=e+n/2,a.y=t+i/2,a.width=n,a.height=i},arrow:function(e,t,n,i,a){a.x=e+n/2,a.y=t+i/2,a.width=n,a.height=i},triangle:function(e,t,n,i,a){a.cx=e+n/2,a.cy=t+i/2,a.width=n,a.height=i}},Zx={};Ar({line:lh,rect:rd,roundRect:rd,square:rd,circle:Rm,diamond:$x,pin:Kx,arrow:Yx,triangle:Wx},(function(e,t){Zx[t]=new e}));var Qx=$c.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var i=us(e,t,n),a=this.shape;return a&&"pin"===a.symbolType&&"inside"===t.position&&(i.y=n.y+.4*n.height),i},buildPath:function(e,t,n){var i=t.symbolType;if("none"!==i){var a=Zx[i];a||(a=Zx[i="rect"]),Xx[i](t.x,t.y,t.width,t.height,a.shape),a.buildPath(e,a.shape,n)}}});function Jx(e,t){if("image"!==this.type){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||"#fff",n.lineWidth=2):"line"===this.shape.symbolType?n.stroke=e:n.fill=e,this.markRedraw()}}function eb(e,t,n,i,a,r,o){var s,l=0===e.indexOf("empty");return l&&(e=e.substr(5,1).toLowerCase()+e.substr(6)),(s=0===e.indexOf("image://")?Uh(e.slice(8),new is(t,n,i,a),o?"center":"cover"):0===e.indexOf("path://")?zh(e.slice(7),{},new is(t,n,i,a),o?"center":"cover"):new Qx({shape:{symbolType:e,x:t,y:n,width:i,height:a}})).__isEmptyBrush=l,s.setColor=Jx,r&&s.setColor(r),s}function tb(e){return qr(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function nb(e,t){if(null!=e)return qr(e)||(e=[e,e]),[Cd(e[0],t[0])||0,Cd(Jr(e[1],e[0]),t[1])||0]}var ib=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return ze(t,e),t.prototype.getInitialData=function(e){return My(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new Am,n=eb("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=eb(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}(Lx);function ab(e,t){var n=e.mapDimensionsAll("defaultedLabel"),i=n.length;if(1===i){var a=kf(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 ob=function(e){function t(t,n,i,a){var r=e.call(this)||this;return r.updateData(t,n,i,a),r}return ze(t,e),t.prototype._createSymbol=function(e,t,n,i,a){this.removeAll();var r=eb(e,-1,-1,2,2,null,a);r.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),r.drift=sb,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(){Hu(this.childAt(0))},t.prototype.downplay=function(){Wu(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):kh(u,d,o,n),Rh(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,Ph(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=mg(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=nb(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 Qc){var S=h.style;h.useStyle(Mr({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else h.__isEmptyBrush?h.useStyle(Mr({},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;ug(h,d,{labelFetcher:g,labelDataIndex:t,defaultText:function(t){return T?e.getName(t):ab(e,t)},inheritColor:w,defaultOpacity:b.opacity}),this._sizeX=n[0]/2,this._sizeY=n[1]/2;var I=h.ensureState("emphasis");I.style=r,h.ensureState("select").style=s,h.ensureState("blur").style=o;var E=null==u||!0===u?Math.max(1.1,3/this._sizeY):isFinite(u)&&u>0?+u:1;I.scaleX=this._sizeX*E,I.scaleY=this._sizeY*E,this.setSymbolScale(1),rm(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=fu(this).dataIndex,r=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var o=i.getTextContent();o&&Oh(o,{style:{opacity:0}},t,{dataIndex:a,removeOpt:r,cb:function(){i.removeTextContent()}})}else i.removeTextContent();Oh(i,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:a,cb:e,removeOpt:r})},t.getSymbolSize=function(e,t){return tb(e.getItemVisual(t,"symbolSize"))},t}(Am);function sb(e,t){this.parent.drift(e,t)}function lb(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 pb(e){return null==e||Hr(e)||(e={isIgnore:e}),e||{}}function cb(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:mg(t),cursorStyle:t.get("cursor")}}var db=function(){function e(e){this.group=new Am,this._SymbolCtor=e||ob}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=pb(t);var n=this.group,i=e.hostModel,a=this._data,r=this._SymbolCtor,o=t.disableAnimation,s=cb(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(lb(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(lb(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):kh(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=cb(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=pb(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=Fr(e.dimensions,(function(e){return t.mapDimension(e)})),u=!1,m=t.getCalculationInfo("stackResultDimension");return Iy(t,d[0])&&(u=!0,d[0]=m),Iy(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 mb(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 hb="undefined"!=typeof Float32Array,gb=hb?Float32Array:Array;function fb(e){return qr(e)?hb?new Float32Array(e):e:new gb(e)}var yb=Math.min,vb=Math.max;function xb(e,t){return isNaN(e)||isNaN(t)}function bb(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(xb(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||xb(S,C))m=y,h=v;else{I=S-p,E=C-c;var P=y-p,D=S-y,O=v-c,A=C-v,F=void 0,R=void 0;if("x"===s){var B=I>0?1:-1;m=y-B*(F=Math.abs(P))*o,h=v,M=y+B*(R=Math.abs(D))*o,k=v}else if("y"===s){var N=E>0?1:-1;m=y,h=v-N*(F=Math.abs(O))*o,M=y,k=v+N*(R=Math.abs(A))*o}else F=Math.sqrt(P*P+O*O),m=y-I*o*(1-(T=(R=Math.sqrt(D*D+A*A))/(R+F))),h=v-E*o*(1-T),k=v+E*o*T,M=yb(M=y+I*o*T,vb(S,y)),k=yb(k,vb(C,v)),M=vb(M,yb(S,y)),h=v-(E=(k=vb(k,yb(C,v)))-v)*F/R,m=yb(m=y-(I=M-y)*F/R,vb(p,y)),h=yb(h,vb(c,v)),M=y+(I=y-(m=vb(m,yb(p,y))))*R/F,k=v+(E=v-(h=vb(h,yb(c,v))))*R/F}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 wb=function(){this.smooth=0,this.smoothConstraint=!0},Sb=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polyline",n}return ze(t,e),t.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},t.prototype.getDefaultShape=function(){return new wb},t.prototype.buildPath=function(e,t){var n=t.points,i=0,a=n.length/2;if(t.connectNulls){for(;a>0&&xb(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?ul(n,p,d,m,e,s):ul(i,c,u,h,e,s);if(y>0)for(var v=0;v=0){f=o?cl(i,c,u,h,x):cl(n,p,d,m,x);return o?[e,f]:[f,e]}}n=m,i=h}}},t}($c),Cb=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t}(wb),_b=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polygon",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new Cb},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&&xb(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=Fr(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:zl((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";Ar(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 yh(0,0,0,0,u,!0);return y[a]=h,y[a+"2"]=g,y}}}function jb(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 Ar(r.getViewLabels(),(function(e){var t=r.scale.getRawOrdinalNumber(e.tickValue);s[t]=1})),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function Hb(e,t){return[e[2*t],e[2*t+1]]}function Wb(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);fu(m).seriesIndex=e.seriesIndex,rm(m,P,D,O);var A=Gb(e.get("smooth")),F=e.get("smoothMonotone");if(m.setShape({smooth:A,smoothMonotone:F,connectNulls:S}),h){var R=o.getCalculationInfo("stackedOnSeries"),B=0;h.useStyle(kr(l.getAreaStyle(),{fill:E,opacity:.7,lineJoin:"bevel",decal:o.getVisual("style").decal})),R&&(B=Gb(R.get("smooth"))),h.setShape({smooth:A,stackedOnSmooth:B,smoothMonotone:F,connectNulls:S}),pm(h,e,"areaStyle"),fu(h).seriesIndex=e.seriesIndex,rm(h,P,D,O)}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=I,this._valueOrigin=v,e.get("triggerLineEvent")&&(this.packEventData(e,m),h&&this.packEventData(e,h))},t.prototype.packEventData=function(e,t){fu(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=ru(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 ob(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 Mb.prototype.highlight.call(this,e,t,n,i)},t.prototype.downplay=function(e,t,n,i){var a=e.getData(),r=ru(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 Mb.prototype.downplay.call(this,e,t,n,i)},t.prototype._changePolyState=function(e){var t=this._polygon;qu(this._polyline,e),t&&qu(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new Sb({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 _b({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");Gr(l)&&(l=l(null));var p=s.get("animationDelay")||0,c=Gr(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=Gr(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(Wb(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 ld({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&&(ug(r,mg(e,"endLabel"),{inheritColor:n,labelFetcher:e,labelDataIndex:l,defaultText:function(e,t,n){return null!=n?rb(a,n):ab(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 I=Hb(p,C[0]);s.attr({x:I[0]+x,y:I[1]+b}),a&&(T=c.getRawValue(C[0]))}else{(I=l.getPointOn(v,w))&&s.attr({x:I[0]+x,y:I[1]+b});var E=c.getRawValue(C[0]),M=c.getRawValue(C[1]);a&&(T=gu(n,u,E,M,S.t))}i.lastFrameIndex=C[0]}else{var k=1===e||i.lastFrameIndex>0?C[0]:0;I=Hb(p,k);a&&(T=c.getRawValue(k)),s.attr({x:I[0]+x,y:I[1]+b})}if(a){var P=wg(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=ub(a,t,o),f=e.getLayout("points")||[],y=t.getLayout("points")||[],v=0;v3e3||l&&qb(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(),kh(s,g,p),l&&(l.setShape({points:d,stackedOnPoints:u}),l.stopAnimation(),kh(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]}},Zb=function(e){return Math.round(e.length/2)};function Qb(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;zr(a)?m=Xb[a]:Gr(a)&&(m=a),m&&e.setData(i.downSample(i.mapDimension(l.dim),1/u,m,Zb))}}}}}function Jb(e){e.registerChartView(Kb),e.registerSeriesModel(ib),e.registerLayout(Yb("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,Qb("line"))}var ew="__ec_stack_";function tw(e){return e.get("stack")||ew+e.seriesIndex}function nw(e){return e.dim+e.index}function iw(e,t){var n=[];return t.eachSeriesByType(e,(function(e){lw(e)&&n.push(e)})),n}function aw(e){var t=function(e){var t={};Ar(e,(function(e){var n=e.coordinateSystem.getBaseAxis();if("time"===n.type||"value"===n.type)for(var i=e.getData(),a=n.dim+"_"+n.index,r=i.getDimensionIndex(i.mapDimension(n.dim)),o=i.getStore(),s=0,l=o.count();s0&&(r=null===r?s:Math.min(r,s))}n[i]=r}}return n}(e),n=[];return Ar(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=Cd(e.get("barWidth"),i),m=Cd(e.get("barMaxWidth"),i),h=Cd(e.get("barMinWidth")||(pw(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:nw(a),stackId:tw(e)})})),rw(n)}function rw(e){var t={};Ar(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 Ar(t,(function(e,t){n[t]={};var i=e.stacks,a=e.bandWidth,r=e.categoryGap;if(null==r){var o=Nr(i).length;r=Math.max(35-4*o,15)+"%"}var s=Cd(r,a),l=Cd(e.gap,1),p=e.remainedWidth,c=e.autoWidthCount,d=(p-s)/(c+(c-1)*l);d=Math.max(d,0),Ar(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;Ar(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;Ar(i,(function(e,i){n[t][i]=n[t][i]||{bandWidth:a,offset:h,width:e.width},h+=e.width*(1+l)}))})),n}function ow(e,t){var n=iw(e,t),i=aw(n);Ar(n,(function(e){var t=e.getData(),n=e.coordinateSystem.getBaseAxis(),a=tw(e),r=i[nw(n)][a],o=r.offset,s=r.width;t.setLayout({bandWidth:r.bandWidth,offset:o,size:s})}))}function sw(e){return{seriesType:e,plan:Tb(),reset:function(e){if(lw(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=Iy(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=pw(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&&fb(3*a),p=m&&s&&fb(3*a),v=m&&fb(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,I=void 0;c&&(I=+C-w.get(r,i));var E=void 0,M=void 0,k=void 0,P=void 0;if(d){var D=n.dataToPoint([C,_]);if(c)T=n.dataToPoint([I,_])[0];E=T,M=D[1]+y,k=D[0]-T,P=f,Math.abs(k)s){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}(Lx);Lx.registerClass(cw);var dw=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.getInitialData=function(){return My(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=Dy(cw.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}(cw),uw="\0__throttleOriginMethod",mw="\0__throttleRate",hw="\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 fw(e,t,n,i){var a=e[t];if(a){var r=a[uw]||a,o=a[hw];if(a[mw]!==n||o!==i){if(null==n||!i)return e[t]=r;(a=e[t]=gw(r,n,"debounce"===i))[uw]=r,a[hw]=i,a[mw]=n}return a}}function yw(e,t){var n=e[t];n&&n[uw]&&(n.clear&&n.clear(),e[t]=n[uw])}var vw=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},xw=function(e){function t(t){var n=e.call(this,t)||this;return n.type="sausage",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new vw},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){Fh(t,e,fu(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}(Mb),Iw={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=Cw(t.x,e.x),s=_w(t.x+t.width,a),l=Cw(t.y,e.y),p=_w(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=_w(t.r,e.r),r=Cw(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}},Ew={cartesian2d:function(e,t,n,i,a,r,o,s,l){var p=new rd({shape:Mr({},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?xw:Qm,c=new p({shape:i,z2:1});c.name="item";var d,u,m=Fw(a);if(c.calculateTextPosition=(d=m,u=({isRoundCap:p===xw}||{}).isRoundCap,function(e,t,n){var i=t.position;if(!i||i instanceof Array)return us(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)+bw(h,r+y,!1),w=l+m*x(h)+ww(h,r+y,!1),S="right",C="middle";break;case"insideStartAngle":b=s+m*v(h)+bw(h,-r+y,!1),w=l+m*x(h)+ww(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)+bw(g,r+y,!0),w=l+m*x(g)+ww(g,r+y,!0),S="left",C="middle";break;case"insideEndAngle":b=s+m*v(g)+bw(g,-r+y,!0),w=l+m*x(g)+ww(g,-r+y,!0),S="right",C="middle";break;default:return us(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?kh:Ph)(c,{shape:g},r)}return c}};function Mw(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?kh:Ph)(n,{shape:l},t,a,null),(o?kh:Ph)(n,{shape:p},t?e.baseAxis.model:null,a)}function kw(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 Fw(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 Rw(e,t,n,i,a,r,o,s){var l=t.getItemVisual(n,"style");if(s){if(!r.get("roundCap")){var p=e.shape;Mr(p,Sw(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=mg(i);ug(e,m,{labelFetcher:r,labelDataIndex:n,defaultText:ab(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(jr(i))e.setTextConfig({rotation:i});else if(qr(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,Fw(o),i.get(["label","rotate"]))}Sg(h,m,r.getRawValue(n),(function(e){return rb(t,e)}));var f=i.getModel(["emphasis"]);rm(e,f.get("focus"),f.get("blurScope"),f.get("disabled")),pm(e,i),function(e){return null!=e.startAngle&&null!=e.endAngle&&e.startAngle===e.endAngle}(a)&&(e.style.fill="none",e.style.stroke="none",Ar(e.states,(function(e){e.style&&(e.style.fill=e.style.stroke="none")})))}var Bw=function(){},Nw=function(e){function t(t){var n=e.call(this,t)||this;return n.type="largeBar",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new Bw},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);fu(this).dataIndex=t>=0?t:null}),30,!1);function qw(e,t,n){if(Nb(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 Gw(e){e.registerChartView(Tw),e.registerSeriesModel(dw),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Vr(ow,"bar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,sw("bar")),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,Qb("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)}))}))}function zw(e,t){function n(t,n){var i=[];return t.eachComponent({mainType:"series",subType:e,query:n},(function(e){i.push(e.seriesIndex)})),i}Ar([[e+"ToggleSelect","toggleSelect"],[e+"Select","select"],[e+"UnSelect","unselect"]],(function(e){t(e[0],(function(t,i,a){t=Mr({},t),a.dispatchAction(Mr(t,{type:e[1],seriesIndex:n(i,t)}))}))}))}function Uw(e,t,n,i,a){var r=e+t;n.isSilent(r)||i.eachComponent({mainType:"series",subType:"pie"},(function(e){for(var t=e.seriesIndex,i=e.option.selectedMap,o=a.selected,s=0;si?c=r=E+w*i/2:(r=E+C,c=a-C),t.setItemLayout(n,{angle:i,startAngle:r,endAngle:c,clockwise:y,cx:o,cy:s,r0:p,r:v?Sd(e,b,[p,l]):l}),E=a}})),Ta&&(a+=Xw);var m=Math.atan2(s,o);if(m<0&&(m+=Xw),m>=i&&m<=a||m+Xw>=i&&m+Xw<=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,oS.fromArray(e[0]),sS.fromArray(e[1]),lS.fromArray(e[2]),Ko.sub(pS,oS,sS),Ko.sub(cS,lS,sS);var n=pS.len(),i=cS.len();if(!(n<.001||i<.001)){pS.scale(1/n),cS.scale(1/i);var a=pS.dot(cS);if(Math.cos(t)1&&Ko.copy(mS,lS),mS.toArray(e[1])}}}}function gS(e,t,n){if(n<=180&&n>0){n=n/180*Math.PI,oS.fromArray(e[0]),sS.fromArray(e[1]),lS.fromArray(e[2]),Ko.sub(pS,sS,oS),Ko.sub(cS,lS,sS);var i=pS.len(),a=cS.len();if(!(i<.001||a<.001))if(pS.scale(1/i),cS.scale(1/a),pS.dot(t)=o)Ko.copy(mS,lS);else{mS.scaleAndAdd(cS,r/Math.tan(Math.PI/2-s));var l=lS.x!==sS.x?(mS.x-sS.x)/(lS.x-sS.x):(mS.y-sS.y)/(lS.y-sS.y);if(isNaN(l))return;l<0?Ko.copy(mS,sS):l>1&&Ko.copy(mS,lS)}mS.toArray(e[1])}}}function fS(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 yS(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=Bs(i[0],i[1]),r=Bs(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=Ls([],i[1],i[0],o/a),l=Ls([],i[1],i[2],o/r),p=Ls([],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 SS(e,t,n,i){return wS(e,"y","height",t,n,i)}function CS(e){var t=[];e.sort((function(e,t){return t.priority-e.priority}));var n=new is(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;an?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 ES(e){return"center"===e.position}function MS(e){var t,n,i=e.getData(),a=[],r=!1,o=(e.get("minShowLabelAngle")||0)*_S,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=Cd(f.get("edgeDistance"),p),w=f.get("bleedMargin"),S=g.getModel("labelLine"),C=S.get("length");C=Cd(C,p);var _=S.get("length2");if(_=Cd(_,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(jr(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=I,u.rotation=V,u.setStyle({verticalAlign:"middle"}),O){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 Ko(P,D),linePoints:E,textAlign:M,labelDistance:v,labelAlignTo:x,edgeDistance:b,bleedMargin:w,rect:U,unconstrainedWidth:U.width,labelStyleWidth:u.style.width})}s.setTextConfig({inside:O})}})),!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}(Mb);function DS(e,t,n){t=qr(t)&&{coordDimensions:t}||Mr({encodeDefine:e.getEncode()},t);var i=e.getSource(),a=vy(i,t).dimensions,r=new yy(a,e);return r.initData(i,n),r}var OS=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}(),AS=ou(),FS=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new OS(Lr(this.getData,this),Lr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return DS(this,{coordDimensions:["value"],encodeDefaulter:Vr(ef,this)})},t.prototype.getDataParams=function(t){var n=this.getData(),i=AS(n),a=i.seats;if(!a){var r=[];n.each(n.mapDimension("value"),(function(e){r.push(e)})),a=i.seats=kd(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){Yd(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}(Lx);function RS(e){e.registerChartView(PS),e.registerSeriesModel(FS),zw("pie",e.registerAction),e.registerLayout(Vr(Kw,"pie")),e.registerProcessor(Yw("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!(jr(i)&&!isNaN(i)&&i<0)}))}}}("pie"))}var BS=function(e,t){this.target=e,this.topTarget=t&&t.topTarget},NS=function(){function e(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new BS(t,e),"dragstart",e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,i=e.offsetY,a=n-this._x,r=i-this._y;this._x=n,this._y=i,t.drift(a,r,e),this.handler.dispatchToElement(new BS(t,e),"drag",e.event);var o=this.handler.findHover(n,i,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new BS(s,e),"dragleave",e.event),o&&o!==s&&this.handler.dispatchToElement(new BS(o,e),"dragenter",e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new BS(t,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new BS(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},e}(),LS=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,VS=[],qS=bo.browser.firefox&&+bo.browser.version.split(".")[0]<39;function GS(e,t,n,i){return n=n||{},i?zS(e,t,n):qS&&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):zS(e,t,n),n}function zS(e,t,n){if(bo.domSupported&&e.getBoundingClientRect){var i=t.clientX,a=t.clientY;if(Ly(e)){var r=e.getBoundingClientRect();return n.zrX=i-r.left,void(n.zrY=a-r.top)}if(Ny(VS,e,i,a))return n.zrX=VS[0],void(n.zrY=VS[1])}n.zrX=n.zrY=0}function US(e){return e||window.event}function jS(e,t,n){if(null!=(t=US(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&&GS(e,a,t,n)}else{GS(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&&LS.test(t.type)&&(t.which=1&o?1:2&o?3:4&o?2:0),t}function HS(e,t,n,i){e.addEventListener(t,n,i)}var WS=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function $S(e){return 2===e.which||3===e.which}var KS=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=YS(a)/YS(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}}}}},ZS="silent";function QS(){WS(this.event)}var JS=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handler=null,t}return ze(t,e),t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(Tp),eC=function(e,t){this.x=e,this.y=t},tC=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],nC=new is(0,0,0,0),iC=function(e){function t(t,n,i,a,r){var o=e.call(this)||this;return o._hovered=new eC(0,0),o.storage=t,o.painter=n,o.painterRoot=a,o._pointerSize=r,i=i||new JS,o.proxy=null,o.setHandlerProxy(i),o._draggingMgr=new NS(o),o}return ze(t,e),t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(Ar(tC,(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=oC(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 eC(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 eC(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:QS}}(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 eC(e,t);if(rC(i,a,e,t,n),this._pointerSize&&!a.target){for(var r=[],o=this._pointerSize,s=o/2,l=new is(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||(nC.copy(c.getBoundingRect()),c.transform&&nC.applyTransform(c.transform),nC.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=aC(o,n,i))&&(!t.topTarget&&(t.topTarget=o),s!==ZS)){t.target=o;break}}}function oC(e,t,n){var i=e.painter;return t<0||t>i.getWidth()||n<0||n>i.getHeight()}Ar(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(e){iC.prototype[e]=function(t){var n,i,a=t.zrX,r=t.zrY,o=oC(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||Bs(this._downPoint,[t.zrX,t.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,e,t)}}));function sC(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 lC(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 pC(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 cC(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 dC(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=cC(e[c],e,l,p,0,t);l+=u,0!==(p-=u)&&0!==(d=pC(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-pC(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=sC(e,n,i,t))s&&(l=s),lC(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 mC=!1;function hC(){mC||(mC=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function gC(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var fC=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=gC}return e.prototype.traverse=function(e,t){for(var n=0;n0&&(p.__clipPaths=[]),isNaN(p.z)&&(hC(),p.z=0),isNaN(p.z2)&&(hC(),p.z2=0),isNaN(p.zlevel)&&(hC(),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}(),yC=bo.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function vC(){return(new Date).getTime()}var xC,bC,wC=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 ze(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=vC()-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,yC((function t(){e._running&&(yC(t),!e._paused&&e.update())}))},t.prototype.start=function(){this._running||(this._time=vC(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=vC(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=vC()-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 _p(e,t.loop);return this.addAnimator(n),n},t}(Tp),SC=bo.domSupported,CC=(bC={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:xC=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:Fr(xC,(function(e){var t=e.replace("mouse","pointer");return bC.hasOwnProperty(t)?t:e}))}),_C=["mousemove","mouseup"],TC=["pointermove","pointerup"],IC=!1;function EC(e){var t=e.pointerType;return"pen"===t||"touch"===t}function MC(e){e&&(e.zrByTouch=!0)}function kC(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 PC=function(e,t){this.stopPropagation=yo,this.stopImmediatePropagation=yo,this.preventDefault=yo,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY},DC={mousedown:function(e){e=jS(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=jS(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=jS(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){kC(this,(e=jS(this.dom,e)).toElement||e.relatedTarget)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){IC=!0,e=jS(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){IC||(e=jS(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){MC(e=jS(this.dom,e)),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),DC.mousemove.call(this,e),DC.mousedown.call(this,e)},touchmove:function(e){MC(e=jS(this.dom,e)),this.handler.processGesture(e,"change"),DC.mousemove.call(this,e)},touchend:function(e){MC(e=jS(this.dom,e)),this.handler.processGesture(e,"end"),DC.mouseup.call(this,e),+new Date-+this.__lastTouchMoment<300&&DC.click.call(this,e)},pointerdown:function(e){DC.mousedown.call(this,e)},pointermove:function(e){EC(e)||DC.mousemove.call(this,e)},pointerup:function(e){DC.mouseup.call(this,e)},pointerout:function(e){EC(e)||DC.mouseout.call(this,e)}};Ar(["click","dblclick","contextmenu"],(function(e){DC[e]=function(t){t=jS(this.dom,t),this.trigger(e,t)}}));var OC={pointermove:function(e){EC(e)||OC.mousemove.call(this,e)},pointerup:function(e){OC.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 AC(e,t){var n=t.domHandlers;bo.pointerEventsSupported?Ar(CC.pointer,(function(i){RC(t,i,(function(t){n[i].call(e,t)}))})):(bo.touchEventsSupported&&Ar(CC.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)}))})),Ar(CC.mouse,(function(i){RC(t,i,(function(a){a=US(a),t.touching||n[i].call(e,a)}))})))}function FC(e,t){function n(n){RC(t,n,(function(i){i=US(i),kC(e,i.target)||(i=function(e,t){return jS(e.dom,new PC(e,t),!0)}(e,i),t.domHandlers[n].call(e,i))}),{capture:!0})}bo.pointerEventsSupported?Ar(TC,n):bo.touchEventsSupported||Ar(_C,n)}function RC(e,t,n,i){e.mounted[t]=n,e.listenerOpts[t]=i,HS(e.domTarget,t,n,i)}function BC(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 NC=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 NC(t,DC),SC&&(i._globalHandlerScope=new NC(document,OC)),AC(i,i._localHandlerScope),i}return ze(t,e),t.prototype.dispose=function(){BC(this._localHandlerScope),SC&&BC(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,SC&&+this.__pointerCapturing^+e){this.__pointerCapturing=e;var t=this._globalHandlerScope;e?FC(this,t):BC(t)}},t}(Tp),VC={},qC={};var GC,zC=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 fC,r=n.renderer||"canvas";VC[r]||(r=Nr(VC)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var o=new VC[r](t,a,n,e),s=n.ssr||o.ssrOnly;this.storage=a,this.painter=o;var l,p=bo.node||bo.worker||s?null:new LC(o.getViewportRoot(),o.root),c=n.useCoarsePointer;(null==c||"auto"===c?bo.touchEventsSupported:!!c)&&(l=Jr(n.pointerSize,44)),this.handler=new iC(a,o,p,o.root,l),this.animation=new wC({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 Wl(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;t=0;o--)i[o]&&!au(i[o])?r=!0:(i[o]=null,!r&&a--);i.length=a,e[n]=i}})),delete e[ZC],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 s_=Ar,l_=Hr,p_=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function c_(e){var t=e&&e.itemStyle;if(t)for(var n=0,i=p_.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=Pd(m,y),h=y;break}}}return i[0]=m,i[1]=h,i}))}))}var M_=function(){function e(){this.group=new Am,this.uid=Py("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}();_o(M_),ko(M_);var k_=ou(),P_={itemStyle:Po(Ag,!0),lineStyle:Po(Pg,!0)},D_={lineStyle:"stroke",itemStyle:"fill"};function O_(e,t){var n=e.visualStyleMapper||P_[t];return n||(console.warn("Unknown style type '"+t+"'."),P_.itemStyle)}function A_(e,t){var n=e.visualDrawType||D_[t];return n||(console.warn("Unknown style type '"+t+"'."),"fill")}var F_={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=e.getModel(i),r=O_(e,i)(a),o=a.getShallow("decal");o&&(n.setVisual("decal",o),o.dirty=!0);var s=A_(e,i),l=r[s],p=Gr(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||Gr(r.fill)?d:r.fill,r.stroke="auto"===r.stroke||Gr(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=Mr({},r);a[s]=p(i),t.setItemVisual(n,"style",a)}}}},R_=new Bg,B_={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData&&!t.isSeriesFiltered(e)){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=O_(e,i),r=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[i]){R_.option=n[i];var o=a(R_);Mr(e.ensureUniqueItemVisual(t,"style"),o),R_.option.decal&&(e.setItemVisual(t,"decal",R_.option.decal),R_.option.decal.dirty=!0),r in o&&e.setItemVisual(t,"colorFromPalette",!1)}}:null}}}},N_={performRawSeries:!0,overallReset:function(e){var t=uo();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)),k_(e).scope=a}})),e.eachSeries((function(t){if(!t.isColorBySeries()&&!e.isSeriesFiltered(t)){var n=t.getRawData(),i={},a=t.getData(),r=k_(t).scope,o=t.visualStyleAccessPath||"itemStyle",s=A_(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)}}))}}))}},L_=Math.PI;var V_=function(){function e(e,t,n,i){this._stageTaskMap=uo(),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=uo();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;Ar(this._allHandlers,(function(i){var a=e.get(i.uid)||e.set(i.uid,{}),r="";io(!(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))}Ar(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=uo(),s=e.seriesType,l=e.getTargetSeries;function p(t){var s=t.uid,l=o.set(s,r&&r.get(s)||nx({plan:j_,reset:H_,count:K_}));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||nx({reset:q_});r.context={ecModel:n,api:i,overallReset:e.overallReset,scheduler:a};var o=r.agentStubMap,s=r.agentStubMap=uo(),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,nx({reset:G_,onDirty:U_})));n.context={model:e,overallProgress:c},n.agent=r,n.__block=c,a._pipe(e,n)}io(!e.createOnAllSeries,u),l?n.eachRawSeriesByType(l,m):p?p(n,i).each(m):(c=!1,Ar(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 Gr(e)&&(e={overallReset:e,seriesType:Y_(e)}),e.uid=Py("stageHandler"),t&&(e.visualType=t),e},e}();function q_(e){e.overallReset(e.ecModel,e.api,e.payload)}function G_(e){return e.overallProgress&&z_}function z_(){this.agent.dirty(),this.getDownstream().dirty()}function U_(){this.agent&&this.agent.dirty()}function j_(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function H_(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Kd(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?Fr(t,(function(e,t){return $_(t)})):W_}var W_=$_(0);function $_(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}(),lT=["symbol","symbolSize","symbolRotate","symbolOffset"],pT=lT.concat(["symbolKeepAspect"]),cT={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&&xT(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=xT(i)?i:0,a=xT(a)?a:1,r=xT(r)?r:0,o=xT(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]:jr(t)?[t]:qr(t)?t:null:null),r=i.lineDashOffset;if(a){var o=i.strokeNoScale&&e.getLineScale?e.getLineScale():1;o&&1!==o&&(a=Fr(a,(function(e){return e/o})),r/=o)}return[a,r]}var _T=new Ec(!0);function TT(e){var t=e.stroke;return!(null==t||"none"===t||!(e.lineWidth>0))}function IT(e){return"string"==typeof e&&"none"!==e}function ET(e){var t=e.fill;return null!=t&&"none"!==t}function MT(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 kT(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 PT(e,t,n){var i=Lo(t.image,t.__image,n);if(qo(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)*vo),r.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(r)}return a}}var DT=["shadowBlur","shadowOffsetX","shadowOffsetY"],OT=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function AT(e,t,n,i,a){var r=!1;if(!i&&t===(n=n||{}))return!1;if(i||t.opacity!==n.opacity){BT(e,a),r=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?Gp.opacity:o}(i||t.blend!==n.blend)&&(r||(BT(e,a),r=!0),e.globalCompositeOperation=t.blend||Gp.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[JT])if(this._disposed)kI(this.id);else{var i,a,r;if(Hr(t)&&(n=t.lazyUpdate,i=t.silent,a=t.replaceMerge,r=t.transition,t=t.notMerge),this[JT]=!0,!this._model||t){var o=new r_(this._api),s=this._theme,l=this._model=new QC;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:a},AI);var p={seriesTransition:r,optionChanged:!0};if(n)this[eI]={silent:i,updateParams:p},this[JT]=!1,this.getZr().wakeUp();else{try{sI(this),cI.update.call(this,null,p)}catch(e){throw this[eI]=null,this[JT]=!1,e}this._ssr||this._zr.flush(),this[eI]=null,this[JT]=!1,hI.call(this,i),gI.call(this,i)}}},t.prototype.setTheme=function(){Ud()},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||bo.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(bo.svgSupported){var e=this._zr;return Ar(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;Ar(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 Ar(i,(function(e){e.group.ignore=!1})),r}kI(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(LI[n]){var o=r,s=r,l=-1/0,p=-1/0,c=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();Ar(NI,(function(r,d){if(r.group===n){var u=t?r.getZr().painter.getSvgDom().innerHTML:r.renderToCanvas(Tr(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=cr.createCanvas(),g=UC(h,{renderer:t?"svg":"canvas"});if(g.resize({width:u,height:m}),t){var f="";return Ar(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 rd({shape:{x:0,y:0,width:u,height:m},style:{fill:e.connectedBackgroundColor}})),Ar(c,(function(e){var t=new Qc({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)}kI(this.id)},t.prototype.convertToPixel=function(e,t){return dI(this,"convertToPixel",e,t)},t.prototype.convertFromPixel=function(e,t){return dI(this,"convertFromPixel",e,t)},t.prototype.containPixel=function(e,t){var n;if(!this._disposed)return Ar(lu(this._model,e),(function(e,i){i.indexOf("Models")>=0&&Ar(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;kI(this.id)},t.prototype.getVisual=function(e,t){var n=lu(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?uT(a,r,t):mT(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;Ar(MI,(function(e){var t=function(t){var n,a=i.getModel(),r=t.target,o="globalout"===e;if(o?n={}:r&&gT(r,(function(e){var t=fu(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=Mr({},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)})),Ar(DI,(function(e,t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),Ar(["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?(Uw("map","selectchanged",t,i,e),Uw("pie","selectchanged",t,i,e)):"select"===e.fromAction?(Uw("map","selected",t,i,e),Uw("pie","selected",t,i,e)):"unselect"===e.fromAction&&(Uw("map","unselected",t,i,e),Uw("pie","unselected",t,i,e))}))},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?kI(this.id):this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)kI(this.id);else{this._disposed=!0,this.getDom()&&mu(this.getDom(),VI,"");var e=this,t=e._api,n=e._model;Ar(e._componentsViews,(function(e){e.dispose(n,t)})),Ar(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 NI[e.id]}},t.prototype.resize=function(e){if(!this[JT])if(this._disposed)kI(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[eI]&&(null==i&&(i=this[eI].silent),n=!0,this[eI]=null),this[JT]=!0;try{n&&sI(this),cI.update.call(this,{type:"resize",animation:Mr({duration:0},e&&e.animation)})}catch(e){throw this[JT]=!1,e}this[JT]=!1,hI.call(this,i),gI.call(this,i)}}},t.prototype.showLoading=function(e,t){if(this._disposed)kI(this.id);else if(Hr(e)&&(t=e,e=""),e=e||"default",this.hideLoading(),BI[e]){var n=BI[e](this._api,t),i=this._zr;this._loadingFX=n,i.add(n)}},t.prototype.hideLoading=function(){this._disposed?kI(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=Mr({},e);return t.type=DI[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)kI(this.id);else if(Hr(t)||(t={silent:!!t}),PI[e.type]&&this._model)if(this[JT])this._pendingActions.push(e);else{var n=t.silent;mI.call(this,e,n);var i=t.flush;i?this._zr.flush():!1!==i&&bo.browser.weChat&&this._throttledZrFlush(),hI.call(this,n),gI.call(this,n)}},t.prototype.updateLabelLayout=function(){$T.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)kI(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(Dh(e))return;if(e instanceof $c&&function(e){var t=bu(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)}}))}sI=function(e){var t=e._scheduler;t.restorePipelines(e._model),t.prepareStageTasks(),lI(e,!0),lI(e,!1),t.plan()},lI=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")&&!bo.node&&!bo.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),$T.trigger("series:afterupdate",t,i,s)},SI=function(e){e[tI]=!0,e.getZr().wakeUp()},CI=function(e){e[tI]&&(e.getZr().storage.traverse((function(e){Dh(e)||t(e)})),e[tI]=!1)},wI=function(e){return new(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return ze(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){Hu(t,n),SI(e)},n.prototype.leaveEmphasis=function(t,n){Wu(t,n),SI(e)},n.prototype.enterBlur=function(t){$u(t),SI(e)},n.prototype.leaveBlur=function(t){Ku(t),SI(e)},n.prototype.enterSelect=function(t){Yu(t),SI(e)},n.prototype.leaveSelect=function(t){Xu(t),SI(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}(i_))(e)}}(),t}(Tp),EI=II.prototype;EI.on=aI("on"),EI.off=aI("off"),EI.one=function(e,t,n){var i=this;Ud(),this.on.call(this,e,(function n(){for(var a=[],r=0;r=0)){WI.push(n);var r=V_.wrapStageHandler(n,a);r.__prio=t,r.__raw=n,e.push(r)}}function KI(e,t){BI[e]=t}var YI=function(e){var t=(e=Tr(e)).type,n="";t||jd(n);var i=t.split(":");2!==i.length&&jd(n);var a=!1;"echarts"===i[0]&&(t=i[1],a=!0),e.__isBuiltIn=a,cx.set(t,e)};HI(XT,F_),HI(ZT,B_),HI(ZT,N_),HI(XT,cT),HI(ZT,dT),HI(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=UT(n,t))}));var a=i.getVisual("decal");if(a)i.getVisual("style").decal=UT(a,t)}}))})),GI(I_),zI(900,(function(e){var t=uo();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(E_)})),KI("default",(function(e,t){kr(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 Am,i=new rd({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(i);var a,r=new ld({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 rd({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});return n.add(o),t.showSpinner&&((a=new hh({shape:{startAngle:-L_/2,endAngle:-L_/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*L_/2}).start("circularInOut"),a.animateShape(!0).when(1e3,{startAngle:3*L_/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})),jI({type:Tu,event:Tu,update:Tu},yo),jI({type:Iu,event:Iu,update:Iu},yo),jI({type:Eu,event:Eu,update:Eu},yo),jI({type:Mu,event:Mu,update:Mu},yo),jI({type:ku,event:ku,update:ku},yo),qI("light",tT),qI("dark",oT);var XI=[],ZI={registerPreprocessor:GI,registerProcessor:zI,registerPostInit:function(e){UI("afterinit",e)},registerPostUpdate:function(e){UI("afterupdate",e)},registerUpdateLifecycle:UI,registerAction:jI,registerCoordinateSystem:function(e,t){wy.register(e,t)},registerLayout:function(e,t){$I(FI,e,t,1e3,"layout")},registerVisual:HI,registerTransform:YI,registerLoading:KI,registerMap:function(e,t,n){var i=YT("registerMap");i&&i(e,t,n)},registerImpl:function(e,t){KT[e]=t},PRIORITY:QT,ComponentModel:$v,ComponentView:M_,SeriesModel:Lx,ChartView:Mb,registerComponentModel:function(e){$v.registerClass(e)},registerComponentView:function(e){M_.registerClass(e)},registerSeriesModel:function(e){Lx.registerClass(e)},registerChartView:function(e){Mb.registerClass(e)},registerSubTypeDefaulter:function(e,t){$v.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){var n;n=t,VC[e]=n}};function QI(e){qr(e)?Ar(e,(function(e){QI(e)})):Pr(XI,e)>=0||(XI.push(e),Gr(e)&&(e={install:e}),e.install(ZI))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}ze(t,e),t.prototype.getInitialData=function(e,t){return My(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"}}}(Lx);var JI=function(){},eE=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return ze(t,e),t.prototype.getDefaultShape=function(){return new JI},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}(),nE=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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=Yb("").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 tE:new db,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"}(Mb),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(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}($v)),iE=function(){function e(){}return e.prototype.getNeedCrossZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),aE=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",cu).models[0]},t.type="cartesian2dAxis",t}($v);Dr(aE,iE);var rE={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)"]}}},oE=Ir({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},rE),sE=Ir({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}}},rE),lE={category:oE,value:sE,time:Ir({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},sE),log:kr({logBase:10},sE)},pE=0,cE=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++pE}return e.createByAxisModel=function(t){var n=t.option,i=n.data,a=i&&Fr(i,dE);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(!zr(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=uo(this.categories))},e}();function dE(e){return Hr(e)&&null!=e.value?e.value:e+""}var uE={value:1,category:1,time:1,log:1};function mE(e,t,n,i){Ar(uE,(function(a,r){var o=Ir(Ir({},lE[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 ze(n,e),n.prototype.mergeDefaultAndTheme=function(e,t){var n=zv(this),i=n?jv(e):{};Ir(e,t.getTheme().get(r+"Axis")),Ir(e,this.getDefaultOption()),e.type=hE(e),n&&Uv(e,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=cE.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",hE)}function hE(e){return e.type||(e.data?"category":"value")}var gE=function(){function e(e){this._setting=e||{},this._extent=[1/0,-1/0]}return e.prototype.getSetting=function(e){return this._setting[e]},e.prototype.unionExtent=function(e){var t=this._extent;e[0]t[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}();function fE(e){return"interval"===e.type||"log"===e.type}function yE(e,t,n,i){var a={},r=e[1]-e[0],o=a.interval=Bd(r/t,!0);null!=n&&oi&&(o=a.interval=i);var s=a.intervalPrecision=xE(o);return function(e,t){!isFinite(e[0])&&(e[0]=t[0]),!isFinite(e[1])&&(e[1]=t[1]),bE(e,0,t),bE(e,1,t),e[0]>e[1]&&(e[0]=e[1])}(a.niceTickExtent=[_d(Math.ceil(e[0]/o)*o,s),_d(Math.floor(e[1]/o)*o,s)],e),a}function vE(e){var t=Math.pow(10,Rd(e)),n=e/t;return n?2===n?n=3:3===n?n=5:n*=2:n=1,_d(n*t)}function xE(e){return Id(e)+2}function bE(e,t,n){e[t]=Math.max(Math.min(e[t],n[1]),n[0])}function wE(e,t){return e>=t[0]&&e<=t[1]}function SE(e,t){return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])}function CE(e,t){return e*(t[1]-t[0])+t[0]}ko(gE);var _E=function(e){function t(t){var n=e.call(this,t)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new cE({})),qr(i)&&(i=new cE({categories:Fr(i,(function(e){return Hr(e)?e.value:e}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return ze(t,e),t.prototype.parse=function(e){return null==e?NaN:zr(e)?this._ordinalMeta.getOrdinal(e):Math.round(e)},t.prototype.contain=function(e){return wE(e=this.parse(e),this._extent)&&null!=this._ordinalMeta.categories[e]},t.prototype.normalize=function(e){return SE(e=this._getTickNumber(this.parse(e)),this._extent)},t.prototype.scale=function(e){return e=Math.round(CE(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}(gE);gE.registerClass(_E);var TE=_d,IE=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 Gr(i)&&(n._ticksGenerator=i),n}return ze(t,e),t.prototype.parse=function(e){return e},t.prototype.contain=function(e){return wE(e,this._extent)},t.prototype.normalize=function(e){return SE(e,this._extent)},t.prototype.scale=function(e){return CE(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=xE(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:TE(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)for(var s=0;s=0;--s)if(l[p]){r=l[p];break}r=r||o.none}if(qr(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 pv(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=rv,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=Br(Fr(p,(function(e){return Br(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=ME.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 PE(e){return(e/=2592e6)>6?6:e>3?3:e>2?2:1}function DE(e){return(e/=Qy)>12?12:e>6?6:e>3.5?4:e>2?2:1}function OE(e,t){return(e/=t?Zy:Xy)>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function AE(e){return Bd(e,!0)}function FE(e,t,n){var i=new Date(e);switch(sv(t)){case"year":case"month":i[bv(n)](0);case"day":i[wv(n)](1);case"hour":i[Sv(n)](0);case"minute":i[Cv(n)](0);case"second":i[_v(n)](0),i[Tv(n)](0)}return i.getTime()}gE.registerClass(EE);var RE=gE.prototype,BE=IE.prototype,NE=_d,LE=Math.floor,VE=Math.ceil,qE=Math.pow,GE=Math.log,zE=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="log",t.base=10,t._originalScale=new IE,t._interval=0,t}return ze(t,e),t.prototype.getTicks=function(e){var t=this._originalScale,n=this._extent,i=t.getExtent();return Fr(BE.getTicks.call(this,e),(function(e){var t=e.value,a=_d(qE(this.base,t));return a=t===n[0]&&this._fixMin?jE(a,i[0]):a,{value:a=t===n[1]&&this._fixMax?jE(a,i[1]):a}}),this)},t.prototype.setExtent=function(e,t){var n=GE(this.base);e=GE(Math.max(0,e))/n,t=GE(Math.max(0,t))/n,BE.setExtent.call(this,e,t)},t.prototype.getExtent=function(){var e=this.base,t=RE.getExtent.call(this);t[0]=qE(e,t[0]),t[1]=qE(e,t[1]);var n=this._originalScale.getExtent();return this._fixMin&&(t[0]=jE(t[0],n[0])),this._fixMax&&(t[1]=jE(t[1],n[1])),t},t.prototype.unionExtent=function(e){this._originalScale.unionExtent(e);var t=this.base;e[0]=GE(e[0])/GE(t),e[1]=GE(e[1])/GE(t),RE.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,a=(i=n,Math.pow(10,Rd(i)));for(e/n*a<=.5&&(a*=10);!isNaN(a)&&Math.abs(a)<1&&Math.abs(a)>0;)a*=10;var r=[_d(VE(t[0]/a)*a),_d(LE(t[1]/a)*a)];this._interval=a,this._niceExtent=r}},t.prototype.calcNiceExtent=function(e){BE.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 wE(e=GE(e)/GE(this.base),this._extent)},t.prototype.normalize=function(e){return SE(e=GE(e)/GE(this.base),this._extent)},t.prototype.scale=function(e){return e=CE(e,this._extent),qE(this.base,e)},t.type="log",t}(gE),UE=zE.prototype;function jE(e,t){return NE(e,Id(t))}UE.getMinorTicks=BE.getMinorTicks,UE.getLabel=BE.getLabel,gE.registerClass(zE);var HE=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[$E[e]]=t},e.prototype.setDeterminedMinMax=function(e,t){var n=WE[e];this[n]=t},e.prototype.freeze=function(){this.frozen=!0},e}(),WE={min:"_determinedMin",max:"_determinedMax"},$E={min:"_dataMin",max:"_dataMax"};function KE(e,t,n){var i=e.rawExtentInfo;return i||(i=new HE(e,t,n),e.rawExtentInfo=i,i)}function YE(e,t){return null==t?null:Zr(t)?NaN:e.parse(t)}function XE(e,t){var n=e.type,i=KE(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=iw("bar",o),l=!1;if(Ar(s,(function(e){l=l||e.getBaseAxis()===t.axis})),l){var p=aw(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[nw(t)];return null!=i&&null!=n?i[tw(n)]:i}}(i,n.axis);if(void 0===o)return{min:e,max:t};var s=1/0;Ar(o,(function(e){s=Math.min(e.offset,s)}));var l=-1/0;Ar(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 ZE(e,t){var n=t,i=XE(e,n),a=i.extent,r=n.get("splitNumber");e instanceof zE&&(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 QE(e,t){if(t=t||e.get("type"))switch(t){case"category":return new _E({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:[1/0,-1/0]});case"time":return new EE({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});case"value":return new IE({ticksGenerator:e.getTicksGenerator()});default:return new(gE.getClass(t)||IE)}}function JE(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)}):zr(i)?function(t){return function(n){var i=e.scale.getLabel(n);return t.replace("{value}",null!=i?i:"")}}(i):Gr(i)?(t=i,function(n,i){return null!=a&&(i=n.value-a),t(eM(e,n),i,null!=n.level?{level:n.level}:null)}):function(t){return e.scale.getLabel(t)}}function eM(e,t){return"category"===e.type?e.scale.getLabel(t):t.value}function tM(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 is(e.x,e.y,r,o)}function nM(e){var t=e.get("interval");return null==t?"auto":t}function iM(e){return"category"===e.type&&0===nM(e.getLabelModel())}function aM(e,t){var n={};return Ar(e.mapDimensionsAll(t),(function(t){n[Ey(e,t)]=!0})),Nr(n)}var rM=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 Fr(this._dimList,(function(e){return this._axes[e]}),this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Br(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}(),oM=["x","y"];function sM(e){return"interval"===e.type||"time"===e.type}var lM=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=oM,t}return ze(t,e),t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis("x").scale,t=this.getAxis("y").scale;if(sM(e)&&sM(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=$o([],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 is(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 Vs(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 Vs(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 is(i,a,r,o)},t}(rM),pM=ou();function cM(e){return"category"===e.type?function(e){var t=e.getLabelModel(),n=uM(e,t);return!t.get("show")||e.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(e):function(e){var t=e.scale.getTicks(),n=JE(e);return{labels:Fr(t,(function(t,i){return{level:t.level,formattedLabel:n(t,i),rawLabel:e.scale.getLabel(t),tickValue:t.value}}))}}(e)}function dM(e,t){return"category"===e.type?function(e,t){var n,i,a=mM(e,"ticks"),r=nM(t),o=hM(a,r);if(o)return o;t.get("show")&&!e.scale.isBlank()||(n=[]);if(Gr(r))n=yM(e,r,!0);else if("auto"===r){var s=uM(e,e.getLabelModel());i=s.labelCategoryInterval,n=Fr(s.labels,(function(e){return e.tickValue}))}else n=fM(e,i=r,!0);return gM(a,r,{ticks:n,tickCategoryInterval:i})}(e,t):{ticks:Fr(e.scale.getTicks(),(function(e){return e.value}))}}function uM(e,t){var n,i,a=mM(e,"labels"),r=nM(t),o=hM(a,r);return o||(Gr(r)?n=yM(e,r):(i="auto"===r?function(e){var t=pM(e).autoInterval;return null!=t?t:pM(e).autoInterval=e.calculateCategoryInterval()}(e):r,n=fM(e,i)),gM(a,r,{labels:n,labelCategoryInterval:i}))}function mM(e,t){return pM(e)[t]||(pM(e)[t]=[])}function hM(e,t){for(var n=0;n1&&c/l>2&&(p=Math.round(Math.ceil(p/l)*l));var d=iM(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 yM(e,t,n){var i=e.scale,a=JE(e),r=[];return Ar(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 vM=[0,1],xM=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 Md(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&&bM(n=n.slice(),i.count()),Sd(e,vM,n,t)},e.prototype.coordToData=function(e,t){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&bM(n=n.slice(),i.count());var a=Sd(e,n,vM,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=Fr(dM(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;Ar(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=_d(e),t=_d(t),c?e>t:e0&&e<100||(e=5),Fr(this.scale.getMinorTicks(e),(function(e){return Fr(e,(function(e){return{coord:this.dataToCoord(e),tickValue:e}}),this)}),this)},e.prototype.getViewLabels=function(){return cM(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(Gr(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=JE(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=ss(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=pM(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 bM(e,t){var n=(e[1]-e[0])/t/2;e[0]+=n,e[1]-=n}var wM=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 ze(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}(xM);function SM(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),Qr(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 CM(e){return"cartesian2d"===e.get("coordinateSystem")}function _M(e){var t={xAxisModel:null,yAxisModel:null};return Ar(t,(function(n,i){var a=i.replace(/Model$/,""),r=e.getReferringComponents(a,cu).models[0];t[i]=r})),t}var TM=Math.log;function IM(e,t,n){var i=IE.prototype,a=i.getTicks.call(n),r=i.getTicks.call(n,!0),o=a.length-1,s=i.getInterval.call(n),l=XE(e,t),p=l.extent,c=l.fixMin,d=l.fixMax;if("log"===e.type){var u=TM(e.base);p=[TM(p[0])/u,TM(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=vE(h),g=p[1]-h*o;else{e.getTicks().length-1>o&&(h=vE(h));var y=h*o;(g=_d((f=Math.ceil(p[1]/h)*h)-y))<0&&p[0]>=0?(g=0,f=_d(y)):f>0&&p[1]<=0&&(f=0,g=-_d(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 EM=function(){function e(e,t,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=oM,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=Nr(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;fE(s)&&o.get("alignTicks")&&null==o.get("interval")&&null==o.getTicksGenerator()?a.push(l):(ZE(s,o),fE(s)&&!s.isBlank()&&(t=l))}if(a.length){for(;!t&&a.length;){var l;ZE((l=a.pop()).scale,l.model),l.scale.isBlank()||(t=l)}a.length&&t&&Ar(a,(function(e){IM(e.scale,e.model,t.scale)}))}}}this._updateScale(e,this.model),i(n.x),i(n.y);var a={};Ar(n.x,(function(e){kM(n,"y",e,a)})),Ar(n.y,(function(e){kM(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=qv(i,{width:t.getWidth(),height:t.getHeight()});this._rect=r;var o=this._axesList;function s(){Ar(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&&(Ar(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 _E?n.count():(i=n.getTicks()).length;var o,s=e.getLabelModel(),l=JE(e),p=1;a>40&&(p=Math.ceil(a/40));for(var c=0;c0&&i>0||n<0&&i<0)}(e)}var DM=Math.PI,OM=function(){function e(e,t){this.group=new Am,this.opt=t,this.axisModel=e,kr(t,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new Am({x:t.position[0],y:t.position[1],rotation:t.rotation});n.updateTransform(),this._transformGroup=n}return e.prototype.hasBuilder=function(e){return!!AM[e]},e.prototype.add=function(e){AM[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=Dd(t-e);return Od(r)?(a=n>0?"top":"bottom",i="center"):Od(r-DM)?(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}(),AM={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&&(Vs(s,s,o),Vs(l,l,o));var c=Mr({lineCap:"round"},t.getModel(["axisLine","lineStyle"]).getLineStyle()),d=new lh({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:e.strokeContainThreshold||5,silent:!0,z2:1});$h(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"]);zr(u)&&(u=[u,u]),(zr(m)||jr(m))&&(m=[m,m]);var h=nb(t.get(["axisLine","symbolOffset"])||0,m),g=m[0],f=m[1];Ar([{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=eb(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=NM(a.getTicksCoords(),t.transform,l,kr(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,BM(s)?e.labelOffset+l*c:0],h=t.get("nameRotate");null!=h&&(h=h*DM/180),BM(s)?r=OM.innerTextLayout(e.rotation,null!=h?h:e.rotation,l):(r=function(e,t,n,i){var a,r,o=Dd(n-e),s=i[0]>i[1],l="start"===t&&!s||"start"!==t&&s;Od(o-DM/2)?(r=l?"bottom":"top",a="center"):Od(o-1.5*DM)?(r=l?"top":"bottom",a="center"):(r="middle",a=o<1.5*DM&&o>DM/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=Qr(e.nameTruncateMaxWidth,f.maxWidth,o),x=new ld({x:m[0],y:m[1],rotation:r.rotation,silent:OM.isLabelSilent(t),style:hg(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(rg({el:x,componentModel:t,itemName:a}),x.__fullText=a,x.anid="name",t.get("triggerEvent")){var b=OM.makeAxisEventDataBase(t);b.targetType="axisName",b.name=a,fu(x).eventData=b}i.add(x),x.updateTransform(),n.add(x),x.decomposeTransform()}}};function FM(e){e&&(e.ignore=!0)}function RM(e,t){var n=e&&e.getBoundingRect().clone(),i=t&&t.getBoundingRect().clone();if(n&&i){var a=Go([]);return Ho(a,a,-e.rotation),n.applyTransform(Uo([],a,e.getLocalTransform())),i.applyTransform(Uo([],a,t.getLocalTransform())),n.intersect(i)}}function BM(e){return"middle"===e||"center"===e}function NM(e,t,n,i,a){for(var r=[],o=[],s=[],l=0;l=0||e===t}function qM(e){var t=(e.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return t&&t.axesInfo[zM(e)]}function GM(e){return!!e.get(["handle","show"])}function zM(e){return e.type+"||"+e.id}var UM={},jM=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(t,n,i,a){this.axisPointerClass&&function(e){var t=qM(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=GM(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=kr({color:d.color},o));var m=Ir(Tr(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(zr(l)){var h=m.name;m.name=l.replace("{value}",null!=h?h:"")}else Gr(l)&&(m.name=l(m.name,m));var g=new Bg(m,null,this.ecModel);return Dr(g,iE.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:Ir({lineStyle:{color:"#bbb"}},pk.axisLine),axisLabel:ck(pk.axisLabel,!1),axisTick:ck(pk.axisTick,!1),splitLine:ck(pk.splitLine,!0),splitArea:ck(pk.splitArea,!0),indicator:[]},t}($v),uk=["axisLine","axisTickLabel","axisName"],mk=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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;Ar(Fr(t.getIndicatorAxes(),(function(e){var n=e.model.get("showName")?e.name:"";return new OM(e.model,{axisName:n,position:[t.cx,t.cy],rotation:e.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})})),(function(e){Ar(uk,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=qr(c)?c:[c],m=qr(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;Sk(this,"zoom","zoomOnMouseWheel",e,{scale:i>0?s:1/s,originX:r,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(i);Sk(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){xk(this._zr,"globalPan")||Sk(this,"zoom",null,e,{scale:e.pinchScale>1?1.1:1/1.1,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})},t}(Tp);function Sk(e,t,n,i,a){e.pointerChecker&&e.pointerChecker(i,a.originX,a.originY)&&(WS(i.event),Ck(e,t,n,i,a))}function Ck(e,t,n,i,a){a.isAvailableBehavior=Lr(_k,null,n,i),e.trigger(t,a)}function _k(e,t,n){var i=n[e];return!e||i&&(!zr(i)||t.event[i+"Key"])}function Tk(e,t,n){var i=e.target;i.x+=t,i.y+=n,i.dirty()}function Ik(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 Ek,Mk={axisPointer:1,tooltip:1,brush:1};function kk(e,t,n){var i=t.getComponentByElement(e.topTarget),a=i&&i.coordinateSystem;return i&&i!==n&&!Mk.hasOwnProperty(i.mainType)&&a&&a.model!==n}function Pk(e){zr(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 Dk={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"},Ok=Nr(Dk),Ak={"alignment-baseline":"textBaseline","stop-color":"stopColor"},Fk=Nr(Ak),Rk=function(){function e(){this._defs={},this._root=null}return e.prototype.parse=function(e,t){t=t||{};var n=Pk(e);this._defsUsePending=[];var i=new Am;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),Gk(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=Xk(l,{x:0,y:0,width:o,height:s}),!t.ignoreViewBox)){var u=i;(i=new Am).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 rd({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=Ek[s];if(p&&fo(Ek,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=Bk[s];if(u&&fo(Bk,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 Yc({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});Vk(t,n),Gk(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(Ek={g:function(e,t){var n=new Am;return Vk(t,n),Gk(e,n,this._defsUsePending,!1,!1),n},rect:function(e,t){var n=new rd;return Vk(t,n),Gk(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 Rm;return Vk(t,n),Gk(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 lh;return Vk(t,n),Gk(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 Nm;return Vk(t,n),Gk(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=qk(i));var a=new ih({shape:{points:n||[]},silent:!0});return Vk(t,a),Gk(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var n,i=e.getAttribute("points");i&&(n=qk(i));var a=new rh({shape:{points:n||[]},silent:!0});return Vk(t,a),Gk(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var n=new Qc;return Vk(t,n),Gk(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 Am;return Vk(t,o),Gk(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 Am;return Vk(t,o),Gk(e,o,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(r),o},path:function(e,t){var n=Om(e.getAttribute("d")||"");return Vk(t,n),Gk(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}),e}(),Bk={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 yh(t,n,i,a);return Nk(e,r),Lk(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 vh(t,n,i);return Nk(e,a),Lk(e,a),a}};function Nk(e,t){"userSpaceOnUse"===e.getAttribute("gradientUnits")&&(t.global=!0)}function Lk(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={};Yk(n,r,r);var o=r.stopColor||n.getAttribute("stop-color")||"#000000";t.colorStops.push({offset:a,color:o})}n=n.nextSibling}}function Vk(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),kr(t.__inheritedStyle,e.__inheritedStyle))}function qk(e){for(var t=Hk(e),n=[],i=0;i0;r-=2){var o=i[r],s=i[r-1],l=Hk(o);switch(a=a||[1,0,0,1,0,0],s){case"translate":jo(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Wo(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Ho(a,a,-parseFloat(l[0])*$k,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":Uo(a,[1,0,Math.tan(parseFloat(l[0])*$k),1,0,0],a);break;case"skewY":Uo(a,[1,Math.tan(parseFloat(l[0])*$k),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),Yk(e,o,s),i||function(e,t,n){for(var i=0;in&&(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 cP(e,t){return Fr(Br((e=function(e){if(!e.UTF8Encoding)return e;var t=e,n=t.UTF8Scale;return null==n&&(n=1024),Ar(t.features,(function(e){var t=e.geometry,i=t.encodeOffsets,a=t.coordinates;if(i)switch(t.type){case"LineString":t.coordinates=pP(a,i,n);break;case"Polygon":case"MultiLineString":lP(a,i,n);break;case"MultiPolygon":Ar(a,(function(e,t){return lP(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 iP(r[0],r.slice(1)));break;case"MultiPolygon":Ar(i.coordinates,(function(e){e[0]&&a.push(new iP(e[0],e.slice(1)))}));break;case"LineString":a.push(new aP([i.coordinates]));break;case"MultiLineString":a.push(new aP(i.coordinates))}var o=new rP(n[t||"name"],a,n.cp);return o.properties=n,o}))}for(var dP=[126,25],uP="南海诸岛",mP=[[[0,3.5],[7,11.2],[15,11.9],[30,7],[42,.7],[52,.7],[56,7.7],[59,.7],[64,.7],[64,0],[5,0],[0,3.5]],[[13,16.1],[19,14.7],[16,21.7],[11,23.1],[13,16.1]],[[12,32.2],[14,38.5],[15,38.5],[13,32.2],[12,32.2]],[[16,47.6],[12,53.2],[13,53.2],[18,47.6],[16,47.6]],[[6,64.4],[8,70],[9,70],[8,64.4],[6,64.4]],[[23,82.6],[29,79.8],[30,79.8],[25,82.6],[23,82.6]],[[37,70.7],[43,62.3],[44,62.3],[39,70.7],[37,70.7]],[[48,51.1],[51,45.5],[53,45.5],[50,51.1],[48,51.1]],[[51,35],[51,28.7],[53,28.7],[53,35],[51,35]],[[52,22.4],[55,17.5],[56,17.5],[53,22.4],[52,22.4]],[[58,12.6],[62,7],[63,7],[60,12.6],[58,12.6]],[[0,3.5],[0,93.1],[64,93.1],[64,0],[63,0],[63,92.4],[1,92.4],[1,3.5],[0,3.5]]],hP=0;hP0,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=uo(),n=uo(),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;ug(t,mg(i),{labelFetcher:u,labelDataIndex:d,defaultText:n},m);var h=t.getTextContent();if(h&&(IP(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 OP(e,t,n,i,a,r){e.data?e.data.setItemGraphicEl(r,t):fu(t).eventData={componentType:"geo",componentIndex:a.componentIndex,geoIndex:a.componentIndex,name:n,region:i&&i.option||{}}}function AP(e,t,n,i,a){e.data||rg({el:t,componentModel:a,itemName:n,itemTooltipOption:i.get("tooltip")})}function FP(e,t,n,i,a){t.highDownSilentOnTouch=!!a.get("selectedMode");var r=i.getModel("emphasis"),o=r.get("focus");return rm(t,o,r.get("blurScope"),r.get("disabled")),e.isGeo&&function(e,t,n){var i=fu(e);i.componentMainType=t.mainType,i.componentIndex=t.componentIndex,i.componentHighDownName=n}(t,a,n),o}function RP(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(),Ar(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"}}(Lx);var BP=Vs,NP=function(e){function t(t){var n=e.call(this)||this;return n.type="view",n.dimensions=["x","y"],n._roamTransformable=new Ys,n._rawTransformable=new Ys,n.name=t,n}return ze(t,e),t.prototype.setBoundingRect=function(e,t,n,i){return this._rect=new is(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 is(e,t,n,i)},t.prototype._transformTo=function(e,t,n,i){var a=this.getBoundingRect(),r=this._rawTransformable;r.transform=a.calculateTransform(new is(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=[Cd(e[0],t.getWidth()),Cd(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=Vs([],i,e),n=Vs([],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(),zo(this.transform||(this.transform=[]),t.transform||[1,0,0,1,0,0]),this._rawTransform=t.getLocalTransform(),this.invTransform=this.invTransform||[],$o(this.invTransform,this.transform),this.decomposeTransform()},t.prototype.getTransformInfo=function(){var e=this._rawTransformable,t=this._roamTransformable,n=new Ys;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?BP(n,e,i):Is(n,e)},t.prototype.pointToData=function(e){var t=this.invTransform;return t?BP([],e,t):[e[0],e[1]]},t.prototype.convertToPixel=function(e,t,n){var i=LP(t);return i===this?i.dataToPoint(n):null},t.prototype.convertFromPixel=function(e,t,n){var i=LP(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}(Ys);function LP(e){var t=e.seriesModel;return t?t.coordinateSystem:null}var VP={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},qP=["lng","lat"],GP=function(e){function t(t,n,i){var a=e.call(this,t)||this;a.dimensions=qP,a.type="geo",a._nameCoordMap=uo(),a.map=n;var r,o=i.projection,s=wP(n,i.nameMap,i.nameProperty),l=bP(n),p=(a.resourceType=l?l.type:null,a.regions=s.regions),c=VP[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=qv(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"))}Dr(GP,NP);var jP=function(){function e(){this.dimensions=qP}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 GP(r+a,r,Mr({nameMap:e.get("nameMap")},i(e)));o.zoomLimit=e.get("scaleLimit"),n.push(o),e.coordinateSystem=o,o.model=e,o.resize=UP,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)}})),Ar(a,(function(e,a){var r=Fr(e,(function(e){return e.get("nameMap")})),o=new GP(a,a,Mr({nameMap:Er(r)},i(e[0])));o.zoomLimit=Qr.apply(null,Fr(e,(function(e){return e.get("scaleLimit")}))),n.push(o),o.resize=UP,o.resize(e[0],t),Ar(e,(function(e){e.coordinateSystem=o,function(e,t){Ar(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=uo(),o=0;ov.x)||(b-=Math.PI);var C=w?"left":"right",_=s.getModel("label"),T=_.get("rotate"),I=T*(Math.PI/180),E=f.getTextContent();E&&(f.setTextConfig({position:_.get("position")||C,rotation:null==T?-b:I,origin:"center"}),E.setStyle("verticalAlign","middle"))}var M=s.get(["emphasis","focus"]),k="relative"===M?mo(o.getAncestorsIndices(),o.getDescendantIndices()):"ancestor"===M?o.getAncestorsIndices():"descendant"===M?o.getDescendantIndices():null;k&&(fu(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 uh({shape:eD(c,d,u,a,a)})),kh(g,{shape:eD(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(zr(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 mD(e){for(var t=[];e;)(e=e.parentNode)&&t.push(e);return t.reverse()}function hD(e,t){return Pr(mD(e),t)>=0}function gD(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}ze(t,e),t.prototype.getInitialData=function(e){var t={name:e.name,children:e.data},n=e.leaves||{},i=new Bg(n,this,this.ecModel),a=dD.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 Sx("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=gD(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}}(Lx);function fD(e){var t=e.getData().tree,n={};t.eachNode((function(t){for(var i=t;i&&i.depth>1;)i=i.parentNode;var a=Zv(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}ze(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};yD(n);var i=e.levels||[],a=this.designatedVisualItemStyle={},r=new Bg({itemStyle:a},this,t);i=e.levels=function(e,t){var n,i,a=Kd(t.get("color")),r=Kd(t.get(["aria","decal","decals"]));if(!a)return;e=e||[],Ar(e,(function(e){var t=new Bg(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=Fr(i||[],(function(e){return new Bg(e,r,t)}),this),s=dD.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 Sx("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=gD(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(e){this.layoutInfo=this.layoutInfo||{},Mr(this.layoutInfo,e)},t.prototype.mapIdToIndex=function(e){var t=this._idIndexMap;t||(t=this._idIndexMap=uo(),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(){fD(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:[]}}(Lx);function yD(e){var t=0;Ar(e.children,(function(e){yD(e);var n=e.value;qr(n)&&(n=n[0]),t+=n}));var n=e.value;qr(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),qr(e.value)?e.value[0]=n:e.value=n}var vD=function(){function e(e){this.group=new Am,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),Gv(r,c.pos,c.box)}},e.prototype._prepare=function(e,t,n){for(var i=e;i;i=i.parentNode){var a=nu(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=Cd(s.left,c),m=Cd(s.top,d),h=Cd(s.right,c),g=Cd(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=Mv(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,I=_.width,E=_.text;b>x.width&&(b-=I-y,I=y,E=null);var M=new ih({shape:{points:xD(f,0,I,v,C===w.length-1,0===C)},style:kr(n.getItemStyle(),{lineJoin:"bevel"}),textContent:new ld({style:hg(a,{text:E})}),textConfig:{position:"inside"},z2:1e5,onclick:Vr(o,T)});M.disableLabelAnimation=!0,M.getTextContent().ensureState("emphasis").style=hg(r,{text:E}),M.ensureState("emphasis").style=S,rm(M,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(M),bD(M,e,T),f+=I+8}},e.prototype.remove=function(){this.group.removeAll()},e}();function xD(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 bD(e,t,n){fu(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&&gD(n,t)}}var wD=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 is(a.x,a.y,a.width,a.height),o=this.seriesModel.layoutInfo,s=[1,0,0,1,0,0];jo(s,s,[-(t-=o.x),-(n-=o.y)]),Wo(s,s,[e.scale,e.scale]),jo(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&&Fv(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 vD(this.group))).render(e,t,n.node,(function(t){"animating"!==i._state&&(hD(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"}(Mb);var kD=Ar,PD=Hr,DD=-1,OD=function(){function e(t){var n=t.mappingMethod,i=t.type,a=this.option=Tr(t);this.type=i,this.mappingMethod=n,this._normalizeData=zD[n];var r=e.visualHandlers[i];this.applyVisual=r.applyVisual,this.getColorMapper=r.getColorMapper,this._normalizedToVisual=r._normalizedToVisual[n],"piecewise"===n?(AD(a),function(e){var t=e.pieceList;e.hasSpecialVisual=!1,Ar(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(kD(t,(function(e,t){n[e]=t})),!qr(i)){var a=[];Hr(i)?kD(i,(function(e,t){var i=n[t];a[null!=i?i:DD]=e})):a[-1]=i,i=GD(e,a)}for(var r=t.length-1;r>=0;r--)null==i[r]&&(delete n[t[r]],t.pop())}(a):AD(a,!0):(io("linear"!==n||a.dataExtent),AD(a))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return Lr(this._normalizeData,this)},e.listVisualTypes=function(){return Nr(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){Hr(e)?Ar(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,i){var a,r=qr(t)?[]:Hr(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&&kD(e.visualHandlers,(function(e,a){t.hasOwnProperty(a)&&(i[a]=t[a],n=!0)})),n?i:null},e.prepareVisualTypes=function(e){if(qr(e))e=e.slice();else{if(!PD(e))return[];var t=[];kD(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}(Am),fO=function(){function e(e){this.group=new Am,this._LineCtor=e||gO}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=yO(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=yO(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 EO(e,t){var n=[],i=bl,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=[Es(l[0]),Es(l[1])],l[2]&&l.__original.push(Es(l[2])));var d=l.__original;if(null!=l[2]){if(Is(a[0],d[0]),Is(a[1],d[2]),Is(a[2],d[1]),p&&"none"!==p){var u=JD(e.node1),m=IO(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=JD(e.node2),m=IO(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]}Is(l[0],a[0]),Is(l[1],a[2]),Is(l[2],a[1])}else{if(Is(r[0],d[0]),Is(r[1],d[1]),Ps(o,r[1],r[0]),Fs(o,o),p&&"none"!==p){u=JD(e.node1);ks(r[0],r[0],o,u*t)}if(c&&"none"!==c){u=JD(e.node2);ks(r[1],r[1],o,-u*t)}Is(l[0],r[0]),Is(l[1],r[1])}}))}function MO(e){return"view"===e.type}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(e,t){var n=new db,i=new fO,a=this.group;this._controller=new wk(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(MO(a)){var l={x:a.x,y:a.y,scaleX:a.scaleX,scaleY:a.scaleY};this._firstRender?s.attr(l):kh(s,l,e)}EO(e.getGraph(),QD(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),nO(e,"symbolSize",t,[r.offsetX,r.offsetY]),i.updateLayout(e);break;default:p.setItemLayout(n,[a.x,a.y]),ZD(e.getGraph(),e),i.updateLayout(e)}})).on("dragend",(function(){d&&d.setUnfixed(n)})),a.setDraggable(o,!!r.get("cursor")),"adjacency"===r.get(["emphasis","focus"])&&(fu(a).focus=t.getAdjacentDataIndices())}})),p.graph.eachEdge((function(e){var t=e.getGraphicEl(),n=e.getModel().get(["emphasis","focus"]);t&&"adjacency"===n&&(fu(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){aO(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)&&!kk(t,n,e)})),MO(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){Tk(r,t.dx,t.dy),n.dispatchAction({seriesId:e.id,type:"graphRoam",dx:t.dx,dy:t.dy})})).on("zoom",(function(t){Ik(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(),EO(e.getGraph(),QD(e)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):a.disable()},t.prototype._updateNodeAndLinkScale=function(){var e=this._model,t=e.getData(),n=QD(e);t.eachItemGraphicEl((function(e,t){e&&e.setSymbolScale(n)}))},t.prototype.updateLayout=function(e){EO(e.getGraph(),QD(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"}(Mb);function kO(e){return"_EC_"+e}var PO=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[kO(e)]){var i=new DO(e,t);return i.hostGraph=this,this.nodes.push(i),n[kO(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[kO(e)]},e.prototype.addEdge=function(e,t,n){var i=this._nodesMap,a=this._edgesMap;if(jr(e)&&(e=this.nodes[e]),jr(t)&&(t=this.nodes[t]),e instanceof DO||(e=i[kO(e)]),t instanceof DO||(t=i[kO(t)]),e&&t){var r=e.id+"-"+t.id,o=new OO(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 DO&&(e=e.id),t instanceof DO&&(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 DO||(t=this._nodesMap[kO(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 FO(e,t,n,i,a){for(var r=new PO(i),o=0;o "+u)),p++)}var m,h=n.get("coordinateSystem");if("cartesian2d"===h||"polar"===h)m=My(e,n);else{var g=wy.get(h),f=g&&g.dimensions||[];Pr(f,"value")<0&&f.concat(["value"]);var y=vy(e,{coordDimensions:f,encodeDefine:n.getEncode()}).dimensions;(m=new yy(y,n)).initData(e)}var v=new yy(["value"],n);return v.initData(l,s),a&&a(m,v),nD({mainData:m,struct:r,structAttr:"graph",datas:{node:m,edge:v},datasAttr:{node:"data",edge:"edgeData"}}),r.update(),r}Dr(DO,AO("hostGraph","data")),Dr(OO,AO("hostGraph","edgeData"));!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new OS(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),Yd(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){HD(n=this)&&(n.__curvenessList=[],n.__edgeMap={},WD(n));var o=FO(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=Bg.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 Ar(o.edges,(function(e){!function(e,t,n,i){if(HD(n)){var a=$D(e,t,n),r=n.__edgeMap,o=r[KD(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),Sx("nameValue",{name:l.join(" > "),value:a.value,noValue:null==a.value})}return Fx({series:this,dataIndex:e,multipleSeries:t})},t.prototype._updateCategoriesData=function(){var e=Fr(this.option.categories||[],(function(e){return null!=e.value?e:Mr({value:0},e)})),t=new yy(["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"}}}}(Lx);var RO=function(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0},BO=function(e){function t(t){var n=e.call(this,t)||this;return n.type="pointer",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new RO},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}($c);function NO(e,t){var n=null==e?"":e+"";return t&&(zr(t)?n=t.replace("{value}",n):Gr(t)&&(n=t(e))),n}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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:Cd(n[0],t.getWidth()),cy:Cd(n[1],t.getHeight()),r:Cd(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")?xw:Qm,d=p.get("show"),u=p.getModel("lineStyle"),m=u.get("width"),h=[s,l];Ic(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:jr(N)&&(L=N*Math.PI/180),0===L?d.add(new ld({style:hg(x,{text:A,x:R,y:B,verticalAlign:c<-.8?"top":c>.8?"bottom":"middle",align:p<-.4?"left":p>.4?"right":"center"},{inheritColor:F}),silent:!0})):d.add(new ld({style:hg(x,{text:A,x:R,y:B,verticalAlign:"middle",align:"center"},{inheritColor:F}),silent:!0,originX:R,originY:B,rotation:L}))}if(v.get("show")&&P!==b){O=(O=v.get("distance"))?O+l:l;for(var V=0;V<=w;V++){p=Math.cos(_),c=Math.sin(_);var q=new lh({shape:{x1:p*(h-O)+u,y1:c*(h-O)+m,x2:p*(h-C-O)+u,y2:c*(h-C-O)+m},silent:!0,style:M});"auto"===M.stroke&&q.setStyle({stroke:i((P+V/w)/b)}),d.add(q),_+=I}_-=I}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=Cd(r.get("width"),a.r),s=Cd(r.get("length"),a.r),l=e.get(["pointer","icon"]),p=r.get("offsetCenter"),c=Cd(p[0],a.r),d=Cd(p[1],a.r),u=r.get("keepAspect");return(i=l?eb(l,c-o/2,d-s,o,s,null,u):new BO({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")?xw:Qm,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);Ph(i,{rotation:-((isNaN(+n)?w[0]:Sd(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");Ph(a,{shape:{endAngle:Sd(n,b,w,o)}},e),p.add(a),yu(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,kh(s,{rotation:-((isNaN(+i)?w[0]:Sd(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");kh(v,{shape:{endAngle:Sd(i,b,w,x)}},e),p.add(v),yu(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 Qc){var c=s.style;s.useStyle(Mr({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(Sd(f.get(y,e),b,[0,1],!0))),s.z2EmphasisLift=0,pm(s,t),rm(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,pm(d,t),rm(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=eb(a,t.cx-i/2+Cd(r[0],t.r),t.cy-i/2+Cd(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 Am,d=[],u=[],m=e.isAnimationEnabled(),h=e.get(["pointer","showAbove"]);o.diff(this._data).add((function(e){d[e]=new ld({silent:!0}),u[e]=new ld({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 Am,f=i(Sd(r,[l,p],[0,1],!0)),y=n.getModel("title");if(y.get("show")){var v=y.get("offsetCenter"),x=a.cx+Cd(v[0],a.r),b=a.cy+Cd(v[1],a.r);(M=d[t]).attr({z2:h?0:2,style:hg(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+Cd(S[0],a.r),_=a.cy+Cd(S[1],a.r),T=Cd(w.get("width"),a.r),I=Cd(w.get("height"),a.r),E=e.get(["progress","show"])?o.getItemVisual(t,"style").fill:f,M=u[t],k=w.get("formatter");M.attr({z2:h?0:2,style:hg(w,{x:C,y:_,text:NO(r,k),width:isNaN(T)?null:T,height:isNaN(I)?null:I,align:"center",verticalAlign:"middle"},{inheritColor:E})}),Sg(M,{normal:w},r,(function(e){return NO(e,k)})),m&&Cg(M,t,o,e,{getFormattedLabel:function(e,t,n,i,a,o){return NO(o?o.interpolatedValue:r,k)}}),g.add(M)}c.add(g)})),this.group.add(c),this._titleEls=d,this._detailEls=u},t.type="gauge"})(Mb),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath="itemStyle",n}ze(t,e),t.prototype.getInitialData=function(e,t){return DS(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}}}(Lx);var LO=["itemStyle","opacity"],VO=function(e){function t(t,n){var i=e.call(this)||this,a=i,r=new rh,o=new ld;return a.setTextContent(o),i.setTextGuideLine(r),i.updateData(t,n,!0),i}return ze(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(LO);l=null==l?1:l,n||Rh(i),i.useStyle(e.getItemVisual(t,"style")),i.style.lineJoin="round",n?(i.setShape({points:o.points}),i.style.opacity=0,Ph(i,{style:{opacity:l}},a,t)):kh(i,{style:{opacity:l},shape:{points:o.points}},a,t),pm(i,r),this._updateLabel(e,t),rm(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;ug(a,mg(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 Ko(c[0][0],c[0][1]):null},kh(a,{style:{x:s.x,y:s.y}},r,t),a.attr({rotation:s.rotation,originX:s.x,originY:s.y,z2:10}),vS(n,xS(o),{stroke:p})},t}(ih);(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreLabelLineUpdate=!0,n}ze(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 VO(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){Fh(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"})(Mb),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new OS(Lr(this.getData,this),Lr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.getInitialData=function(e,t){return DS(this,{coordDimensions:["value"],encodeDefaulter:Vr(ef,this)})},t.prototype._defaultLabelLine=function(e){Yd(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"}}}}(Lx);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._dataGroup=new Am,n._initialized=!1,n}ze(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=zO(e);if(r.diff(o).add((function(e){UO(GO(r,a,e,l,s),r,e,p)})).update((function(t,n){var i=o.getItemGraphicEl(n),a=qO(r,t,l,s);r.setItemGraphicEl(t,i),kh(i,{shape:{points:a}},e,t),Rh(i),UO(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 rd({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),Ph(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=zO(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&&WO(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 WO(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}ze(t,e),t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(e){var t=this.option;e&&Ir(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){Ar(["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=[];Ar(Br(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}}($v);var $O=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 ze(t,e),t.prototype.isHorizontal=function(){return"horizontal"!==this.coordinateSystem.getModel().get("layout")},t}(xM);function KO(e,t,n,i,a,r){e=e||0;var o=n[1]-n[0];if(null!=a&&(a=XO(a,[0,o])),null!=r&&(r=Math.max(r,null!=a?a:0)),"all"===i){var s=Math.abs(t[1]-t[0]);s=XO(s,[0,o]),a=r=XO(s,[a,r]),i=0}t[0]=XO(t[0],n),t[1]=XO(t[1],n);var l=YO(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]=XO(t[i],d),p=YO(t,i),null!=a&&(p.sign!==l.sign||p.spanr&&(t[1-i]=t[i]+p.sign*r),t}function YO(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 XO(e,t){return Math.min(null!=t[1]?t[1]:1/0,Math.max(null!=t[0]?t[0]:-1/0,e))}var ZO=Ar,QO=Math.min,JO=Math.max,eA=Math.floor,tA=Math.ceil,nA=_d,iA=Math.PI;!function(){function e(e,t,n){this.type="parallel",this._axesMap=uo(),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;ZO(i,(function(e,n){var i=a[n],r=t.getComponent("parallelAxis",i),o=this._axesMap.set(e,new $O(e,QE(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();ZO(this.dimensions,(function(e){var t=this._axesMap.get(e);t.scale.unionExtentFromData(i,i.mapDimension(e)),ZE(t.scale,t.model)}),this)}}),this)},e.prototype.resize=function(e,t){this._rect=qv(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=aA(t.get("axisExpandWidth"),l),d=aA(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=aA(m[1]-m[0],l),m[1]=m[0]+e):(e=aA(c*(d-1),l),(m=[c*(t.get("axisExpandCenter")||eA(p/2))-e/2])[1]=m[0]+e);var h=(s-e)/(p-d);h<3&&(h=0);var g=[eA(nA(m[0]/c,1))+1,tA(nA(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])})),ZO(n,(function(t,n){var r=(i.axisExpandable?oA:rA)(n,i),o={horizontal:{x:r.position,y:i.axisLength},vertical:{x:0,y:r.position}},s={horizontal:iA/2,vertical:0},l=[o[a].x+e.x,o[a].y+e.y],p=s[a],c=[1,0,0,1,0,0];Ho(c,c,p),jo(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=[];Ar(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)?KO(o,i,r,"all"):l="none";else{var u=i[1]-i[0];(i=[JO(0,r[1]*s/u-u/2)])[1]=QO(r[1],i[0]+u),i[0]=i[1]-u}return{axisExpandWindow:i,behavior:l}}}();function aA(e,t){return QO(JO(e,t[0]),t[1])}function rA(e,t){var n=t.layoutLength/(t.axisCount-1);return{position:n*e,axisNameAvailableWidth:n,axisLabelShow:!0}}function oA(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&&IA(e);var l=Tr(s);l.brushType=UA(l.brushType,o),l.panelId=o===lA?null:o.panelId,r=e._creatingCover=vA(e,l),e._covers.push(r)}if(r){var p=WA[UA(e._brushType,o)];r.__brushOption.range=p.getCreatingRange(VA(e,r,e._track)),i&&(xA(e,r),p.updateCommon(e,r)),bA(e,r),a={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&_A(e,t,n)&&IA(e)&&(a={isEnd:i,removeOnClick:!0});return a}function UA(e,t){return"auto"===e?t.defaultBrushType:e}var jA={mousedown:function(e){if(this._dragging)HA(this,e);else if(!e.target||!e.target.draggable){qA(e);var t=this.group.transformCoordToLocal(e.offsetX,e.offsetY);this._creatingCover=null,(this._creatingPanel=_A(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=_A(e,t,n);if(!e._dragging)for(var o=0;o=0&&(r[a[o].depth]=new Bg(a[o],this,t));if(i&&n){var s=FO(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 Sx("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 Sx("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}}(Lx);var nF=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=[];Ar(g,(function(e,t){var n;qr(e)?(n=e.slice(),e.unshift(t)):qr(e.value)?((n=Mr({},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:Of(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:d,type:Of(h),dimsDef:y.slice()}];return DS(this,{coordDimensions:v,dimensionsCount:y.length+1,encodeDefaulter:Vr(Jg,v,this)})},e.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},e}(),iF=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 ze(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}(Lx);Dr(iF,nF,!0);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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=oF(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?(Rh(n),sF(s,n,i,e)):n=oF(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"}(Mb);var aF=function(){},rF=function(e){function t(t){var n=e.call(this,t)||this;return n.type="boxplotBoxPath",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new aF},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(pF);t.useStyle(r),t.style.fill=null,t.style.stroke=a}var bF=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 ze(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}(Lx);Dr(bF,nF,!0);var wF=["itemStyle","borderColor"],SF=["itemStyle","borderColor0"],CF=["itemStyle","borderColorDoji"],_F=["itemStyle","color"],TF=["itemStyle","color0"];Tb(),Tb();function IF(e,t,n,i,a,r){return n>i?-1:n0?e.get(a,t-1)<=i?1:-1:1}function EF(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 MF=function(e){function t(t,n){var i=e.call(this)||this,a=new ob(t,n),r=new Am;return i.add(a),i.add(r),i.updateData(t,n),i}return ze(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=Gr(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 Bs(e.__p1,e.__cp1)+Bs(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=yl,l=vl;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}(kF),OF=function(){this.polyline=!1,this.curveness=0,this.segs=[]},AF=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return ze(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 OF},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(Pc(p,c,(p+u)/2-(c-m)*a,(c+m)/2-(u-p)*a,u,m,r,e,t))return o}else if(Mc(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}(),RF={seriesType:"lines",plan:Tb(),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)&&Bb(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=RF.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 FF:new fO(a?i?DF:PF:i?kF:gO),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"}(Mb),"undefined"==typeof Uint32Array?Array:Uint32Array),NF="undefined"==typeof Float64Array?Array:Float64Array;function LF(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=Fr(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),Er([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}ze(t,e),t.prototype.init=function(t){t.data=t.data||[],LF(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(LF(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}}}(Lx);var VF=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=cr.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=cr.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 qF(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}ze(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()):qF(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&&(qF(a)?this.render(t,n,i):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(t,i,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){sg(this._progressiveEls||this.group,e)},t.prototype._renderOnCartesianAndCalendar=function(e,t,n,i,a){var r,o,s,l,p=e.coordinateSystem,c=Nb(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=mg(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]);I=new rd({shape:{x:P[0]-r/2,y:P[1]-o/2,width:r,height:o},style:E})}else{if(isNaN(h.get(_[1],T)))continue;I=new rd({z2:1,shape:p.dataToRect([h.get(_[0],T)]).contentShape,style:E})}if(h.hasItemOption){var D=h.getItemModel(T),O=D.getModel("emphasis");g=O.getModel("itemStyle").getItemStyle(),f=D.getModel(["blur","itemStyle"]).getItemStyle(),y=D.getModel(["select","itemStyle"]).getItemStyle(),v=D.get(["itemStyle","borderRadius"]),w=O.get("focus"),S=O.get("blurScope"),C=O.get("disabled"),x=mg(D)}I.shape.r=v;var A=e.getRawValue(T),F="-";A&&null!=A[2]&&(F=A[2]+""),ug(I,x,{labelFetcher:e,labelDataIndex:T,defaultOpacity:E.opacity,defaultText:F}),I.ensureState("emphasis").style=g,I.ensureState("blur").style=f,I.ensureState("select").style=y,rm(I,w,S,C),I.incremental=a,a&&(I.states.emphasis.hoverLayer=!0),m.add(I),h.setItemGraphicEl(T,I),this._progressiveEls&&this._progressiveEls.push(I)}},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 VF;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=Fr(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=qr(h)?h.slice():null==h?["100%","100%"]:[h,h];c[u.index]=Cd(c[u.index],m),c[d.index]=Cd(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(GF)||0;r&&(UF.attr({scaleX:t[0],scaleY:t[1],rotation:n}),UF.updateTransform(),r/=UF.getLineScale(),r*=t[i.valueDim.index]);a.valueLineWidth=r||0}(n,d.symbolScale,l,i,d);var u=d.symbolSize,m=nb(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=Qr(e.get("symbolMargin"),"15%")+"",x=!1;v.lastIndexOf("!")===v.length-1&&(x=!0,v=v.slice(0,v.length-1));var b=Cd(v,t[m.index]),w=Math.max(g+2*b,0),S=x?0:2*b,C=Vd(i),_=C?i:oR((y+S)/w);w=g+2*(b=(y-_*g)/2/(x?_:Math.max(_-1,1))),S=x?0:2*b,C||"fixed"===i||(_=p?oR((Math.abs(p)+S)/w):0),f=_*w-S,d.repeatTimes=_,d.symbolMargin=b}var T=h*(f/2),I=d.pathPosition=[];I[u.index]=n[u.wh]/2,I[m.index]="start"===o?T:"end"===o?l-T:l/2,r&&(I[0]+=r[0],I[1]+=r[1]);var E=d.bundlePosition=[];E[u.index]=n[u.xy],E[m.index]=n[m.xy];var M=d.barRectShape=Mr({},n);M[m.wh]=h*Math.max(Math.abs(n[m.wh]),Math.abs(I[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 HF(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function WF(e){var t=e.symbolPatternSize,n=eb(e.symbolType,-t/2,-t/2,t,t);return n.attr({culling:!0}),"image"!==n.type&&n.setStyle({strokeNoScale:!0}),n}function $F(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(iR(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 KF(e,t,n,i){var a=e.__pictorialBundle,r=e.__pictorialMainPath;r?aR(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=WF(n),a.add(r),aR(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 YF(e,t,n){var i=Mr({},t.barRectShape),a=e.__pictorialBarRect;a?aR(a,null,{shape:i},t,n):((a=e.__pictorialBarRect=new rd({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}})).disableMorphing=!0,e.add(a))}function XF(e,t,n,i){if(n.symbolClip){var a=e.__pictorialClipPath,r=Mr({},n.clipShape),o=t.valueDim,s=n.animationModel,l=n.dataIndex;if(a)kh(a,{shape:r},s,l);else{r[o.wh]=0,a=new rd({shape:r}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var p={};p[o.wh]=n.clipShape[o.wh],lg[i?"updateProps":"initProps"](a,{shape:p},s,l)}}}function ZF(e,t){var n=e.getItemModel(t);return n.getAnimationDelayParams=QF,n.isAnimationEnabled=JF,n}function QF(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function JF(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function eR(e,t,n,i){var a=new Am,r=new Am;return a.add(r),a.__pictorialBundle=r,r.x=n.bundlePosition[0],r.y=n.bundlePosition[1],n.symbolRepeat?$F(a,t,n):KF(a,0,n),YF(a,n,i),XF(a,t,n,i),a.__pictorialShapeStr=nR(e,n),a.__pictorialSymbolMeta=n,a}function tR(e,t,n,i){var a=i.__pictorialBarRect;a&&a.removeTextContent();var r=[];iR(i,(function(e){r.push(e)})),i.__pictorialMainPath&&r.push(i.__pictorialMainPath),i.__pictorialClipPath&&(n=null),Ar(r,(function(e){Oh(e,{scaleX:0,scaleY:0},n,t,(function(){i.parent&&i.parent.remove(i)}))})),e.setItemGraphicEl(t,null)}function nR(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function iR(e,t,n){Ar(e.__pictorialBundle.children(),(function(i){i!==e.__pictorialBarRect&&t.call(n,i)}))}function aR(e,t,n,i,a,r){t&&e.attr(t),i.symbolClip&&!a?n&&e.attr(n):n&&lg[a?"updateProps":"initProps"](e,n,i.animationModel,i.dataIndex,r)}function rR(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");iR(e,(function(e){if(e instanceof Qc){var t=e.style;e.useStyle(Mr({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,ug(h,mg(a),{labelFetcher:t.seriesModel,labelDataIndex:i,defaultText:ab(t.seriesModel.getData(),i),inheritColor:n.style.fill,defaultOpacity:n.style.opacity,defaultOutsidePosition:m}),rm(e,c,d,r.get("disabled"))}function oR(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}ze(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=Dy(cw.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"}}})}(cw);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._layers=[],n}ze(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 Vg(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(E-T)&&E0?(a.virtualPiece?a.virtualPiece.updateData(!1,i,e,t,n):(a.virtualPiece=new sR(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)Fv(o,r.get("target",!0)||"_blank")}n=!0}}))}))},t.prototype._rootToNode=function(e){e!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:lR,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"})(Mb),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreStyleOnData=!0,n}ze(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};pR(n);var i=this._levelModels=Fr(e.levels||[],(function(e){return new Bg(e,this,t)}),this),a=dD.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=gD(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(){fD(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"}}(Lx);function pR(e){var t=0;Ar(e.children,(function(e){pR(e);var n=e.value;qr(n)&&(n=n[0]),t+=n}));var n=e.value;qr(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),qr(e.value)?e.value[0]=n:e.value=n}Math.PI;var cR={color:"fill",borderColor:"stroke"},dR={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},uR=ou(),mR=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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 My(null,this)},t.prototype.getDataParams=function(t,n,i){var a=e.prototype.getDataParams.call(this,t,n);return i&&(a.info=uR(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}(Lx);function hR(e,t){return t=t||[0,0],Fr(["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 gR(e,t){return t=t||[0,0],Fr([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 fR(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 yR(e,t){return t=t||[0,0],Fr(["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 vR(e,t,n,i){return e&&(e.legacy||!1!==e.legacy&&!n&&!i&&"tspan"!==t&&("text"===t||fo(e,"text")))}function xR(e,t,n){var i,a,r,o=e;if("text"===t)r=o;else{r={},fo(o,"text")&&(r.text=o.text),fo(o,"rich")&&(r.rich=o.rich),fo(o,"textFill")&&(r.fill=o.textFill),fo(o,"textStroke")&&(r.stroke=o.textStroke),fo(o,"fontFamily")&&(r.fontFamily=o.fontFamily),fo(o,"fontSize")&&(r.fontSize=o.fontSize),fo(o,"fontStyle")&&(r.fontStyle=o.fontStyle),fo(o,"fontWeight")&&(r.fontWeight=o.fontWeight),a={type:"text",style:r,silent:!0},i={};var s=fo(o,"textPosition");n?i.position=s?o.textPosition:"inside":s&&(i.position=o.textPosition),fo(o,"textPosition")&&(i.position=o.textPosition),fo(o,"textOffset")&&(i.offset=o.textOffset),fo(o,"textRotation")&&(i.rotation=o.textRotation),fo(o,"textDistance")&&(i.distance=o.textDistance)}return bR(r,e),Ar(r.rich,(function(e){bR(e,e)})),{textConfig:i,textContent:a}}function bR(e,t){t&&(t.font=t.textFont||t.font,fo(t,"textStrokeWidth")&&(e.lineWidth=t.textStrokeWidth),fo(t,"textAlign")&&(e.align=t.textAlign),fo(t,"textVerticalAlign")&&(e.verticalAlign=t.textVerticalAlign),fo(t,"textLineHeight")&&(e.lineHeight=t.textLineHeight),fo(t,"textWidth")&&(e.width=t.textWidth),fo(t,"textHeight")&&(e.height=t.textHeight),fo(t,"textBackgroundColor")&&(e.backgroundColor=t.textBackgroundColor),fo(t,"textPadding")&&(e.padding=t.textPadding),fo(t,"textBorderColor")&&(e.borderColor=t.textBorderColor),fo(t,"textBorderWidth")&&(e.borderWidth=t.textBorderWidth),fo(t,"textBorderRadius")&&(e.borderRadius=t.textBorderRadius),fo(t,"textBoxShadowColor")&&(e.shadowColor=t.textBoxShadowColor),fo(t,"textBoxShadowBlur")&&(e.shadowBlur=t.textBoxShadowBlur),fo(t,"textBoxShadowOffsetX")&&(e.shadowOffsetX=t.textBoxShadowOffsetX),fo(t,"textBoxShadowOffsetY")&&(e.shadowOffsetY=t.textBoxShadowOffsetY))}function wR(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";SR(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,Ar(t.rich,(function(e){SR(e,e)})),i}function SR(e,t){t&&(fo(t,"fill")&&(e.textFill=t.fill),fo(t,"stroke")&&(e.textStroke=t.fill),fo(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),fo(t,"font")&&(e.font=t.font),fo(t,"fontStyle")&&(e.fontStyle=t.fontStyle),fo(t,"fontWeight")&&(e.fontWeight=t.fontWeight),fo(t,"fontSize")&&(e.fontSize=t.fontSize),fo(t,"fontFamily")&&(e.fontFamily=t.fontFamily),fo(t,"align")&&(e.textAlign=t.align),fo(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),fo(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),fo(t,"width")&&(e.textWidth=t.width),fo(t,"height")&&(e.textHeight=t.height),fo(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),fo(t,"padding")&&(e.textPadding=t.padding),fo(t,"borderColor")&&(e.textBorderColor=t.borderColor),fo(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),fo(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),fo(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),fo(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),fo(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),fo(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),fo(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),fo(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),fo(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),fo(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}var CR={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},_R=Nr(CR),TR=(Rr(Xs,(function(e,t){return e[t]=1,e}),{}),Xs.join(", "),["","style","shape","extra"]),IR=ou();function ER(e,t,n,i,a){var r=e+"Animation",o=Eh(e,i,a)||{},s=IR(t).userDuring;return o.duration>0&&(o.during=s?Lr(FR,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),Mr(o,n[r]),o}function MR(e,t,n,i){var a=(i=i||{}).dataIndex,r=i.isInit,o=i.clearStyle,s=n.isAnimationEnabled(),l=IR(e),p=t.style;l.userDuring=t.during;var c={},d={};if(function(e,t,n){for(var i=0;i<_R.length;i++){var a=_R[i],r=CR[a],o=t[a];o&&(n[r[0]]=o[0],n[r[1]]=o[1])}for(i=0;i=0)){var d=e.getAnimationStyleProps(),u=d?d.style:null;if(u){!a&&(a=i.style={});var m=Nr(n);for(p=0;p0&&e.animateFrom(u,m)}else!function(e,t,n,i,a){if(a){var r=ER("update",e,t,i,n);r.duration>0&&e.animateFrom(a,r)}}(e,t,a||0,n,c);kR(e,t),p?e.dirty():e.markRedraw()}function kR(e,t){for(var n=IR(e).leaveToProps,i=0;i=0){!r&&(r=i[e]={});var u=Nr(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:Lr(yR,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 QR(e){return e instanceof $c}function JR(e){return e instanceof Hp}var eB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(e,t,n,i){this._progressiveEls=null;var a=this._data,r=e.getData(),o=this.group,s=rB(e,r,t,n);a||o.removeAll(),r.diff(a).add((function(t){sB(n,null,t,s(t,i),e,o,r)})).remove((function(t){var n=a.getItemGraphicEl(t);n&&PR(n,uR(n).option,e)})).update((function(t,l){var p=a.getItemGraphicEl(l);sB(n,p,t,s(t,i),e,o,r)})).execute();var l=e.get("clip",!0)?Bb(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=rB(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,zR).getItemStyle(),r=x(i,zR),o=hg(r,null,null,!0,!0);o.text=r.getShallow("show")?eo(e.getFormattedLabel(i,zR),e.getFormattedLabel(i,UR),ab(t,i)):null;var l=gg(r,null,!0);return w(n,a),a=wR(a,o,l),n&&b(a,n),a.legacy=!0,a},visual:function(e,n){if(null==n&&(n=s),fo(cR,e)){var i=t.getItemVisual(n,"style");return i?i[cR[e]]:null}if(fo(dR,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);mB(t,g,a)}}(e,d,n,i,a),o>=0?r.replaceAt(d,o):r.add(d),d}function pB(e,t,n){var i,a=uR(e),r=t.type,o=t.shape,s=t.style;return n.isUniversalTransitionEnabled()||null!=r&&r!==a.customGraphicType||"path"===r&&((i=o)&&(fo(i,"pathData")||fo(i,"d")))&&yB(o)!==a.customPathData||"image"===r&&fo(s,"image")&&s.image!==a.customImagePath}function cB(e,t,n){var i=t?dB(e,t):e,a=t?uB(e,i,zR):e.style,r=e.type,o=i?i.textConfig:null,s=e.textContent,l=s?t?dB(s,t):s:null;if(a&&(n.isLegacy||vR(a,r,!!o,!!l))){n.isLegacy=!0;var p=xR(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 dB(e,t){return t?e?e[t]:null:e}function uB(e,t,n){var i=t&&t.style;return null==i&&n===zR&&e&&(i=e.styleEmphasis),i}function mB(e,t,n){t&&PR(t,uR(e).option,n)}function hB(e,t){var n=e&&e.name;return null!=n?n:"e\0\0"+t}function gB(e,t){var n=this.context,i=null!=e?n.newChildren[e]:null,a=null!=t?n.oldChildren[t]:null;lB(n.api,a,n.dataIndex,i,n.seriesModel,n.group)}function fB(e){var t=this.context,n=t.oldChildren[e];n&&PR(n,uR(n).option,t.seriesModel)}function yB(e){return e&&(e.pathData||e.d)}function vB(e){e.registerChartView(eB),e.registerSeriesModel(mR)}var xB=ou(),bB=Tr,wB=Lr,SB=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=Vr(CB,t,c);this.updatePointerEl(o,l,d),this.updateLabelEl(o,l,d,t)}else o=this._group=new Am,this.createPointerEl(o,l,e,t),this.createLabelEl(o,l,e,t),n.getZr().add(o);EB(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=qM(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=xB(e).pointerEl=new lg[a.type](bB(t.pointer));e.add(r)}},e.prototype.createLabelEl=function(e,t,n,i){if(t.label){var a=xB(e).labelEl=new ld(bB(t.label));e.add(a),TB(a,i)}},e.prototype.updatePointerEl=function(e,t,n){var i=xB(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=xB(e).labelEl;a&&(a.setStyle(t.label.style),n(a,{x:t.label.x,y:t.label.y}),TB(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=tg(r.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(e){WS(e.event)},onmousedown:wB(this._onHandleDragMove,this,0,0),drift:wB(this._onHandleDragMove,this),ondragend:wB(this._onHandleDragEnd,this)}),i.add(a)),EB(a,n,!1),a.setStyle(r.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=r.get("size");qr(s)||(s=[s,s]),a.scaleX=s[0]/2,a.scaleY=s[1]/2,fw(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,t)}},e.prototype._moveHandleToValue=function(e,t){CB(this._axisPointerModel,!t&&this._moveAnimation,this._handle,IB(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(IB(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(IB(i)),xB(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),yw(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 CB(e,t,n,i){_B(xB(n).lastProp,i)||(xB(n).lastProp=i,t?kh(n,i,e):(n.stopAnimation(),n.attr(i)))}function _B(e,t){if(Hr(e)&&Hr(t)){var n=!0;return Ar(t,(function(t,i){n=n&&_B(e[i],t)})),!!n}return e===t}function TB(e,t){e[t.get(["label","show"])?"show":"hide"]()}function IB(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function EB(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 MB(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 kB(e,t,n,i,a){var r=PB(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=Mv(o.get("padding")||0),l=o.getFont(),p=ss(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:hg(o,{text:r,font:l,fill:o.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function PB(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:eM(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};Ar(i,(function(e){var t=n.getSeriesByIndex(e.seriesIndex),i=e.dataIndexInside,a=t&&t.getDataParams(i);a&&s.seriesData.push(a)})),zr(o)?r=o.replace("{value}",r):Gr(o)&&(r=o(s))}return r}function DB(e,t,n){var i=[1,0,0,1,0,0];return Ho(i,i,n.rotation),jo(i,i,n.position),Xh([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}function OB(e,t,n,i,a,r){var o=OM.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=a.get(["label","margin"]),kB(t,i,a,r,{position:DB(i.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function AB(e,t,n){return{x1:e[n=n||0],y1:e[1-n],x2:t[n],y2:t[1-n]}}function FB(e,t,n){return{x:e[n=n||0],y:e[1-n],width:t[n],height:t[1-n]}}function RB(e,t,n,i,a,r){return{cx:e,cy:t,r0:n,r:i,startAngle:a,endAngle:r,clockwise:!0}}var BB=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.grid,s=i.get("type"),l=NB(o,r).getOtherAxis(r).getGlobalExtent(),p=r.toGlobalCoord(r.dataToCoord(t,!0));if(s&&"none"!==s){var c=MB(i),d=LB[s](r,p,l);d.style=c,e.graphicKey=d.type,e.pointer=d}OB(t,e,SM(o.model,n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=SM(t.axis.grid.model,t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=DB(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=NB(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}(SB);function NB(e,t){var n={};return n[t.dim+"AxisIndex"]=t.index,e.getCartesian(n)}var LB={line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:AB([t,n[0]],[t,n[1]],VB(e))}},shadow:function(e,t,n){var i=Math.max(1,e.getBandWidth()),a=n[1]-n[0];return{type:"Rect",shape:FB([t-i/2,n[0]],[i,a],VB(e))}}};function VB(e){return"x"===e.dim?0:1}var qB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}($v),GB=ou(),zB=Ar;function UB(e,t,n){if(!bo.node){var i=t.getZr();GB(i).records||(GB(i).records={}),function(e,t){if(GB(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);zB(GB(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)}))}GB(e).initialized=!0,n("click",Vr(HB,"click")),n("mousemove",Vr(HB,"mousemove")),n("globalout",jB)}(i,t),(GB(i).records[e]||(GB(i).records[e]={})).handler=n}}function jB(e,t,n){e.handler("leave",null,n)}function HB(e,t,n,i){t.handler(e,n,i)}function WB(e,t){if(!bo.node){var n=t.getZr();(GB(n).records||{})[e]&&(GB(n).records[e]=null)}}var $B=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(e,t,n){var i=t.getComponent("tooltip"),a=e.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";UB("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){WB("axisPointer",t)},t.prototype.dispose=function(e,t){WB("axisPointer",t)},t.type="axisPointer",t}(M_);function KB(e,t){var n,i=[],a=e.seriesIndex;if(null==a||!(n=t.getSeriesByIndex(a)))return{point:[]};var r=n.getData(),o=ru(r,e);if(null==o||o<0||qr(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(Fr(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 YB=ou();function XB(e,t,n){var i=e.currTrigger,a=[e.x,e.y],r=e,o=e.dispatchAction||Lr(n.dispatchAction,n),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){tN(a)&&(a=KB({seriesIndex:r.seriesIndex,dataIndex:r.dataIndex},t).point);var l=tN(a),p=r.axesInfo,c=s.axesInfo,d="leave"===i||tN(a),u={},m={},h={list:[],map:{}},g={showPointer:Vr(QB,m),showTooltip:Vr(JB,h)};Ar(s.coordSysMap,(function(e,t){var n=l||e.containPoint(a);Ar(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&&ZB(e,o,g,!1,u)}}))}));var f={};return Ar(c,(function(e,t){var n=e.linkGroup;n&&!m[t]&&Ar(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,eN(t),eN(e)))),f[e.key]=r}}))})),Ar(f,(function(e,t){ZB(c[t],e,g,!0,u)})),function(e,t,n){var i=n.axesInfo=[];Ar(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(tN(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=YB(i)[a]||{},o=YB(i)[a]={};Ar(e,(function(e,t){var n=e.axisPointerModel.option;"show"===n.status&&e.triggerEmphasis&&Ar(n.seriesDataIndices,(function(e){var t=e.seriesIndex+" | "+e.dataIndex;o[t]=e}))}));var s=[],l=[];Ar(r,(function(e,t){!o[t]&&l.push(e)})),Ar(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 ZB(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 Ar(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),Ar(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&&Mr(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 QB(e,t,n,i){e[t.key]={value:n,payloadBatch:i}}function JB(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=zM(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 eN(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 tN(e){return!e||null==e[0]||isNaN(e[0])||null==e[1]||isNaN(e[1])}function nN(e){jM.registerAxisPointerClass("CartesianAxisPointer",BB),e.registerComponentModel(qB),e.registerComponentView($B),e.registerPreprocessor((function(e){if(e){(!e.axisPointer||0===e.axisPointer.length)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!qr(t)&&(e.axisPointer.link=[t])}})),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,(function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=LM(e,t)})),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},XB)}function iN(e){QI(nk),QI(nN)}var aN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(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=MB(i),d=rN[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];Ho(u,u,s),jo(u,u,[i.cx,i.cy]),l=Xh([o,-a],u);var m=t.getModel("axisLabel").get("rotate")||0,h=OM.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"]));kB(e,n,i,a,u)},t}(SB);var rN={line:function(e,t,n,i){return"angle"===e.dim?{type:"Line",shape:AB(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:RB(t.cx,t.cy,i[0],i[1],(-n-a/2)*r,(a/2-n)*r)}:{type:"Sector",shape:RB(t.cx,t.cy,n-a/2,n+a/2,0,2*Math.PI)}}},oN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}($v),sN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",cu).models[0]},t.type="polarAxis",t}($v);Dr(sN,iE);var lN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="angleAxis",t}(sN),pN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="radiusAxis",t}(sN),cN=function(e){function t(t,n){return e.call(this,"radius",t,n)||this}return ze(t,e),t.prototype.pointToData=function(e,t){return this.polar.pointToData(e,t)["radius"===this.dim?0:1]},t}(xM);cN.prototype.dataToRadius=xM.prototype.dataToCoord,cN.prototype.radiusToData=xM.prototype.coordToData;var dN=ou(),uN=function(e){function t(t,n){return e.call(this,"angle",t,n||[0,360])||this}return ze(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=ss(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=dN(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}(xM);uN.prototype.dataToAngle=xM.prototype.dataToCoord,uN.prototype.angleToData=xM.prototype.coordToData;var mN=["radius","angle"],hN=function(){function e(e){this.dimensions=mN,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new cN,this._angleAxis=new uN,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 gN(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return gN(t)===this?this.pointToData(n):null},e}();function gN(e){var t=e.seriesModel,n=e.polarModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}function fN(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();Ar(aM(t,"radius"),(function(e){a.scale.unionExtentFromData(t,e)})),Ar(aM(t,"angle"),(function(e){i.scale.unionExtentFromData(t,e)}))}})),ZE(i.scale,i.model),ZE(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 yN(e,t){var n;if(e.type=t.get("type"),e.scale=QE(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 vN={dimensions:mN,create:function(e,t){var n=[];return e.eachComponent("polar",(function(e,i){var a=new hN(i+"");a.update=fN;var r=a.getRadiusAxis(),o=a.getAngleAxis(),s=e.findAxisModel("radiusAxis"),l=e.findAxisModel("angleAxis");yN(r,s),yN(o,l),function(e,t,n){var i=t.get("center"),a=n.getWidth(),r=n.getHeight();e.cx=Cd(i[0],a),e.cy=Cd(i[1],r);var o=e.getRadiusAxis(),s=Math.min(a,r)/2,l=t.get("radius");null==l?l=[0,"100%"]:qr(l)||(l=[0,l]);var p=[Cd(l[0],s),Cd(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",cu).models[0];0,e.coordinateSystem=t.coordinateSystem}})),n}},xN=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function bN(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 wN(e){return e.getRadiusAxis().inverse?0:1}function SN(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 CN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="PolarAxisPointer",n}return ze(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=Fr(n.getViewLabels(),(function(e){e=Tr(e);var t=n.scale,i="ordinal"===t.type?t.getRawOrdinalNumber(e.tickValue):e.tickValue;return e.coord=n.dataToCoord(i),e}));SN(s),SN(r),Ar(xN,(function(t){!e.get([t,"show"])||n.scale.isBlank()&&"axisLine"!==t||_N[t](this.group,e,i,r,o,a,s)}),this)}},t.type="angleAxis",t}(jM),_N={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=wN(n),u=d?0:1,m=360===Math.abs(c[1]-c[0])?"Circle":"Arc";(o=0===r[u]?new lg[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 eh({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[wN(n)],p=Fr(i,(function(e){return new lh({shape:bN(n,[l,l+s],e.coord)})}));e.add(Hh(p,{style:kr(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[wN(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];Hr(v)&&v.textStyle&&(o=new Bg(v.textStyle,l,l.ecModel))}var x=new ld({silent:OM.isLabelSilent(t),style:hg(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=OM.makeAxisEventDataBase(t);b.targetType="axisLabel",b.value=i.rawLabel,fu(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",I=b;v&&(i[s][_]||(i[s][_]={p:b,n:b}),I=i[s][_][T]);var E=void 0,M=void 0,k=void 0,P=void 0;if("radius"===d.dim){var D=d.dataToCoord(C)-b,O=r.dataToCoord(_);Math.abs(D)=P})}}}))}var ON={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},AN={splitNumber:5},FN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="polar",t}(M_);function RN(e){QI(nN),jM.registerAxisPointerClass("PolarAxisPointer",aN),e.registerCoordinateSystem("polar",vN),e.registerComponentModel(oN),e.registerComponentView(FN),mE(e,"angle",lN,ON),mE(e,"radius",pN,AN),e.registerComponentView(CN),e.registerComponentView(EN),e.registerLayout(Vr(DN,"bar"))}function BN(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),Qr(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 NN=["axisLine","axisTickLabel","axisName"],LN=["splitArea","splitLine"],VN=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="SingleAxisPointer",n}ze(t,e),t.prototype.render=function(t,n,i,a){var r=this.group;r.removeAll();var o=this._axisGroup;this._axisGroup=new Am;var s=BN(t),l=new OM(t,s);Ar(NN,l.add,l),r.add(this._axisGroup),r.add(l.getGroup()),Ar(LN,(function(e){t.get([e,"show"])&&VN[e](this,this.group,this._axisGroup,t)}),this),Jh(o,this._axisGroup,t),e.prototype.render.call(this,t,n,i,a)},t.prototype.remove=function(){$M(this)},t.type="singleAxis"}(jM),{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 UN(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return UN(t)===this?this.pointToData(n):null}}();function UN(e){var t=e.seriesModel,n=e.singleAxisModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}var jN=["x","y"],HN=["width","height"],WN=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.coordinateSystem,s=KN(o,1-$N(r)),l=o.dataToPoint(t)[0],p=i.get("type");if(p&&"none"!==p){var c=MB(i),d=WN[p](r,l,s);d.style=c,e.graphicKey=d.type,e.pointer=d}OB(t,e,BN(n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=BN(t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=DB(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=$N(a),s=KN(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=KN(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"}}}}(SB),{line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:AB([t,n[0]],[t,n[1]],$N(e))}},shadow:function(e,t,n){var i=e.getBandWidth(),a=n[1]-n[0];return{type:"Rect",shape:FB([t-i/2,n[0]],[i,a],$N(e))}}});function $N(e){return e.isHorizontal()?0:1}function KN(e,t){var n=e.getRect();return[n[jN[t]],n[jN[t]]+n[HN[t]]]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.type="single"}(M_);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(t,n,i){var a=jv(t);e.prototype.init.apply(this,arguments),YN(t,a)},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),YN(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}}}($v);function YN(e,t){var n,i=e.cellSize;1===(n=qr(i)?i:e.cellSize=[i,i]).length&&(n[1]=n[0]);var a=Fr([0,1],(function(e){return function(e,t){return null!=e[Nv[t][0]]||null!=e[Nv[t][1]]&&null!=e[Nv[t][2]]}(t,e)&&(n[e]="auto"),null!=n[e]&&"auto"!==n[e]}));Uv(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}ze(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 rd({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 rh({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 zr(e)&&e?(n=e,Ar(t,(function(e,t){n=n.replace("{"+t+"}",i?Gy(e):e)})),n):Gr(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 ld({z2:30,style:hg(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&&!zr(r)||(r&&(t=Yy(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/XN)-Math.floor(n[0].time/XN)+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 ZN(e){var t=e.calendarModel,n=e.seriesModel;return t?t.coordinateSystem:n?n.coordinateSystem:null}function QN(e,t){var n;return Ar(t,(function(t){null!=e[t]&&"auto"!==e[t]&&(n=!0)})),n}var JN=["transition","enterFrom","leaveTo"],eL=JN.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function tL(e,t,n){if(n&&(!e[n]&&t[n]&&(e[n]={}),e=e[n],t=t[n]),e&&t)for(var i=n?JN:eL,a=0;a=0;l--){var u,m,h;if(h=null!=(m=nu((u=n[l]).id,null))?a.get(m):null){var g=h.parent,f=(d=iL(g),{}),y=Gv(h,u,g===i?{width:r,height:o}:{width:d.width,height:d.height},null,{hv:u.hv,boundingMode:u.bounding},f);if(!iL(h).isNew&&y){for(var v=u.transition,x={},b=0;b=0)?x[w]=S:h[w]=S}kh(h,x,e,0)}else h.attr(f)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each((function(n){oL(n,iL(n).option,t,e._lastGraphicModel)})),this._elMap=uo()},t.prototype.dispose=function(){this._clear()},t.type="graphic"}(M_);function aL(e){var t=fo(nL,e)?nL[e]:Gh(e);var n=new t({});return iL(n).type=e,n}function rL(e,t,n,i){var a=aL(n);return t.add(a),i.set(e,a),iL(a).id=e,iL(a).isNew=!0,a}function oL(e,t,n,i){e&&e.parent&&("group"===e.type&&e.traverse((function(e){oL(e,t,n,i)})),PR(e,t,i),n.removeKey(iL(e).id))}function sL(e,t,n,i){e.isGroup||Ar([["cursor",Hp.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],(function(n){var i=n[0];fo(t,i)?e[i]=Jr(t[i],n[1]):null==e[i]&&(e[i]=n[1])})),Ar(Nr(t),(function(n){if(0===n.indexOf("on")){var i=t[n];e[n]=Gr(i)?i:null}})),fo(t,"draggable")&&(e.draggable=t.draggable),null!=t.name&&(e.name=t.name),null!=t.id&&(e.id=t.id)}var lL=["x","y","radius","angle","single"],pL=["cartesian2d","polar","singleAxis"];function cL(e){return e+"Axis"}function dL(e,t){var n,i=uo(),a=[],r=uo();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 uL(e){var t=e.ecModel,n={infoList:[],infoMap:uo()};return e.eachTargetAxis((function(e,i){var a=t.getComponent(cL(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 mL=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}(),hL=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 ze(t,e),t.prototype.init=function(e,t,n){var i=gL(e);this.settledOption=i,this.mergeDefaultAndTheme(e,n),this._doInit(i)},t.prototype.mergeOption=function(e){var t=gL(e);Ir(this.option,e,!0),Ir(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;Ar([["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=uo();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 Ar(lL,(function(n){var i=this.getReferringComponents(cL(n),du);if(i.specified){t=!0;var a=new mL;Ar(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 mL;if(r.add(a.componentIndex),e.set(n,r),i=!1,"x"===n||"y"===n){var o=a.getReferringComponents("grid",cu).models[0];o&&Ar(t,(function(e){a.componentIndex!==e.componentIndex&&o===e.getReferringComponents("grid",cu).models[0]&&r.add(e.componentIndex)}))}}}i&&Ar(lL,(function(t){if(i){var a=n.findComponents({mainType:cL(t),filter:function(e){return"category"===e.get("type",!0)}});if(a[0]){var r=new mL;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");Ar([["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(cL(t),n))}),this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each((function(n,i){Ar(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(cL(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;Ar([["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;Ar(["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=cL(this._dimName),i=t.getReferringComponents(n,cu).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 Tr(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=[];yL(["start","end"],(function(l,p){var c=e[l],d=e[l+"Value"];"percent"===a[p]?(null==c&&(c=r[p]),d=i.parse(Sd(c,r,n))):(t=!0,c=Sd(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})),vL(s),vL(o);var l=this._minMaxSpan;function p(e,t,n,a,r){var o=r?"Span":"ValueSpan";KO(0,e,n,"all",l["min"+o],l["max"+o]);for(var s=0;s<2;s++)t[s]=Sd(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];yL(n,(function(e){!function(e,t,n){t&&Ar(aM(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=KE(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&&yL(i,(function(e){var t=e.getData(),i=t.mapDimensionsAll(n);if(i.length){if("weakFilter"===a){var o=t.getStore(),s=Fr(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 yL(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)}}));yL(i,(function(e){t.setApproximateExtent(r,e)}))}}))}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._dataExtent;yL(["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=Sd(n[0]+r,n,[0,100],!0):null!=a&&(r=Sd(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=Md(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 bL={getTargetSeries:function(e){function t(t){e.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,a){var r=e.getComponent(cL(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 xL(t,i,r,e),n.push(a.__dzAxisProxy))}));var i=uo();return Ar(n,(function(e){Ar(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 wL=!1;function SL(e){wL||(wL=!0,e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,bL),function(e){e.registerAction("dataZoom",(function(e,t){Ar(dL(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 CL=function(){},_L={};function TL(e){return _L[e]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;Ar(this.option.feature,(function(e,n){var i=TL(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(t)),Ir(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"}}}($v);function IL(e,t){var n=Mv(t.get("padding")),i=t.getItemStyle(["color","opacity"]);return i.fill=t.get("backgroundColor"),e=new rd({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}ze(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=[];Ar(s,(function(e,t){p.push(t)})),new Vg(this._featureNames||[],p).add(c).update(c).remove(Vr(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=qv(i,r,a);Vv(t.get("orient"),e,t.get("itemGap"),o.width,o.height),Gv(e,i,r,a)}(a,e,n),a.add(IL(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&&!Gr(l)&&t){var p=l.style||(l.style={}),c=ss(t,ld.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 Bg(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=TL(m);if(!y)return;u=new y}l[m]=u}else if(!(u=l[h]))return;u.uid=Py("toolbox-feature"),u.model=f,u.ecModel=t,u.api=n;var v=u instanceof CL;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 CL&&s.getIcons?s.getIcons():i.get("icon"),h=i.get("title")||{};zr(m)?(p={})[l]=m:p=m;zr(h)?(c={})[l]=h:c=h;var g=i.iconPaths={};Ar(p,(function(l,p){var m=tg(l,{},{x:-r/2,y:-r/2,width:r,height:r});m.setStyle(d.getItemStyle()),m.ensureState("emphasis").style=u.getItemStyle();var h=new ld({style:{text:c[p],align:u.get("textAlign"),borderRadius:u.get("textBorderRadius"),padding:u.get("textPadding"),fill:null,font:bg({fontStyle:u.get("textFontStyle"),fontFamily:u.get("textFontFamily"),fontSize:u.get("textFontSize"),fontWeight:u.get("textFontWeight")},t)},ignore:!0});m.setTextContent(h),rg({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])?Hu:Wu)(m),a.add(m),m.on("click",Lr(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?Hu:Wu)(i[e])},u instanceof CL&&u.render&&u.render(f,t,n,i)):v&&u.dispose&&u.dispose(t,n)}},t.prototype.updateView=function(e,t,n,i){Ar(this._features,(function(e){e instanceof CL&&e.updateView&&e.updateView(e.model,t,n,i)}))},t.prototype.remove=function(e,t){Ar(this._features,(function(n){n instanceof CL&&n.remove&&n.remove(e,t)})),this.group.removeAll()},t.prototype.dispose=function(e,t){Ar(this._features,(function(n){n instanceof CL&&n.dispose&&n.dispose(e,t)}))},t.type="toolbox"}(M_);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(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=bo.browser;if(Gr(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"])}}}(CL);var EL="__ec_magicType_stack__",ML=[["line","bar"],["stack"]],kL=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.getIcons=function(){var e=this.model,t=e.get("icon"),n={};return Ar(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(kL[n]){var r,o={series:[]};Ar(ML,(function(e){Pr(e,n)>=0&&Ar(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=kL[n](t,a,e,i);r&&(kr(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,cu).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=Ir({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"})}}}(CL),{line:function(e,t,n,i){if("bar"===e)return Ir({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 Ir({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")===EL;if("line"===e||"bar"===e)return i.setIconStatus("stack",a?"normal":"emphasis"),Ir({id:t,stack:a?"":EL},i.get(["option","stack"])||{},!0)}});jI({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(e,t){t.mergeOption(e.newOption)}));var PL=new Array(60).join("-"),DL="\t";function OL(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var AL=new RegExp("[\t]+","g");function FL(e,t){var n=e.split(new RegExp("\n*"+PL+"\n*","g")),i={series:[]};return Ar(n,(function(e,n){if(function(e){if(e.slice(0,e.indexOf("\n")).indexOf(DL)>=0)return!0}(e)){var a=function(e){for(var t=e.split(/\n+/g),n=[],i=Fr(OL(t.shift()).split(AL),(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=WL[e.brushType](0,n,t);e.__rangeOffset={offset:KL[e.brushType](i.values,e.range,[1,1]),xyMinMax:i.xyMinMax}}})),e},e.prototype.matchOutputRanges=function(e,t,n){Ar(e,(function(e){var i=this.findTargetInfo(e,t);i&&!0!==i&&Ar(i.coordSyses,(function(i){var a=WL[e.brushType](1,i,e.range,!0);n(e,a.values,i,t)}))}),this)},e.prototype.setInputRanges=function(e,t){Ar(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=WL[e.brushType](0,s.coordSys,e.coordRange),p=e.__rangeOffset;e.range=p?KL[e.brushType](l.values,p.offset,(n=l.xyMinMax,i=p.xyMinMax,a=XL(n),r=XL(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 Fr(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:KA(i),isTargetByCursor:XA(i,e,n.coordSysModel),getLinearBrushOtherExtent:YA(i)}}))},e.prototype.controlSeries=function(e,t,n){var i=this.findTargetInfo(e,n);return!0===i||i&&Pr(i.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,i=zL(t,e),a=0;ae[1]&&e.reverse(),e}function zL(e,t){return lu(e,t,{includeMainTypes:VL})}var UL={grid:function(e,t){var n=e.xAxisModels,i=e.yAxisModels,a=e.gridModels,r=uo(),o={},s={};(n||i||a)&&(Ar(n,(function(e){var t=e.axis.grid.model;r.set(t.id,t),o[t.id]=!0})),Ar(i,(function(e){var t=e.axis.grid.model;r.set(t.id,t),s[t.id]=!0})),Ar(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=[];Ar(a.getCartesians(),(function(e,t){(Pr(n,e.getAxis("x").model)>=0||Pr(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:HL.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})})))},geo:function(e,t){Ar(e.geoModels,(function(e){var n=e.coordinateSystem;t.push({panelId:"geo--"+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:HL.geo})}))}},jL=[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}],HL={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(Yh(e)),t}},WL={lineX:Vr($L,0),lineY:Vr($L,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=[GL([a[0],r[0]]),GL([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:Fr(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 $L(e,t,n,i){var a=n.getAxis(["x","y"][e]),r=GL(Fr([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 KL={lineX:Vr(YL,0),lineY:Vr(YL,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 Fr(e,(function(e,i){return[e[0]-n[0]*t[i][0],e[1]-n[1]*t[i][1]]}))}};function YL(e,t,n,i){return[t[0]-i[e]*n[0],t[1]-i[e]*n[1]]}function XL(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var ZL,QL,JL=Ar,eV=$d+"toolbox-dataZoom_",tV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.render=function(e,t,n,i){this._brushController||(this._brushController=new yA(n.getZr()),this._brushController.on("brush",Lr(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 qL(nV(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 LL(e).length}(t)>1?"emphasis":"normal")}(e,t)},t.prototype.onclick=function(e,t,n){tV[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 qL(nV(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=LL(e);BL(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=KO(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=[];JL(e,(function(e,n){t.push(Tr(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)"}}}}(CL),{zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(function(e){var t=LL(e),n=t[t.length-1];t.length>1&&t.pop();var i={};return BL(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 nV(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}ZL="dataZoom",QL=function(e){var t=e.getComponent("toolbox",0),n=["feature","dataZoom"];if(t&&null!=t.get(n)){var i=t.getModel(n),a=[],r=lu(e,nV(i));return JL(r.xAxisModels,(function(e){return o(e,"xAxis","xAxisIndex")})),JL(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:eV+t+r};o[n]=r,a.push(o)}},io(null==XC.get(ZL)&&QL),XC.set(ZL,QL);var iV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}($v);function aV(e){var t=e.get("confine");return null!=t?!!t:"richText"===e.get("renderMode")}function rV(e){if(bo.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)),zr(e))r.innerHTML=e+o;else if(e){r.innerHTML="",qr(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&&!bo.node&&n.getDom()){var a=SV(i,n);this._ticket="";var r=i.dataByCoordSys,o=function(e,t,n){var i=pu(e).queryOptionMap,a=i.keys()[0];if(!a||"series"===a)return;var r=uu(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=fu(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=xV;l.x=i.x,l.y=i.y,l.update(),fu(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=KB(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(SV(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"===wV([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"===fu(n).ssrType)return;this._lastDataByCoordSys=null,gT(n,(function(e){return null!=fu(e).dataIndex?(a=e,!0):null!=fu(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=Lr(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=wV([t.tooltipOption],i),o=this._renderMode,s=[],l=Sx("section",{blocks:[],noHeader:!0}),p=[],c=new Ax;Ar(e,(function(e){Ar(e.dataByAxis,(function(e){var t=n.getComponent(e.axisDim+"Axis",e.axisIndex),a=e.value;if(t&&t.axis&&null!=a){var r=PB(a,t.axis,n,e.seriesDataIndices,e.valueLabelOpt),d=Sx("section",{header:r,noHeader:!ao(r),sortBlocks:!0,blocks:[]});l.blocks.push(d),Ar(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=eM(t.axis,{value:a}),h.axisValueLabel=r,h.marker=c.makeTooltipMarker("item",Av(h.color),o);var g=tx(u.formatTooltip(m,!0,null)),f=g.frag;if(f){var y=wV([u],i).get("valueFormatter");d.blocks.push(y?Mr({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=Mx(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=fu(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=wV([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 Ax;g.marker=f.makeTooltipMarker("item",Av(g.color),d);var y=tx(s.formatTooltip(l,!1,p)),v=m.get("order"),x=m.get("valueFormatter"),b=y.frag,w=b?Mx(x?Mr({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=fu(t),a=i.tooltipConfig.option||{};if(zr(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=wV(r,this._tooltipModel,s?{position:s}:null),p=l.get("content"),c=Math.random()+"",d=new Ax;this._showOrMove(l,(function(){var n=Tr(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(zr(c)){var m=e.ecModel.get("useUTC"),h=qr(n)?n[0]:n;d=c,h&&h.axisType&&h.axisType.indexOf("time")>=0&&(d=pv(h.axisValue,d,m)),d=Ov(d,n,!0)}else if(Gr(c)){var g=Lr((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||qr(t)?{color:i||("html"===this._renderMode?"#fff":"none")}:qr(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),Gr(t)&&(t=t([n,i],r,a.el,u,{viewSize:[s,l],contentSize:p.slice()})),qr(t))n=Cd(t[0],s),i=Cd(t[1],l);else if(Hr(t)){var m=t;m.width=p[0],m.height=p[1];var h=qv(m,{width:s,height:l});n=h.x,i=h.y,c=null,d=null}else if(zr(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-=CV(c)?p[0]/2:"right"===c?p[0]:0),d&&(i-=CV(d)?p[1]/2:"bottom"===d?p[1]:0),aV(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&&Ar(n,(function(n,r){var o=n.dataByAxis||[],s=(e[r]||{}).dataByAxis||[];(a=a&&o.length===s.length)&&Ar(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)&&Ar(o,(function(e,t){var n=l[t];a=a&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex})),i&&Ar(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){!bo.node&&t.getDom()&&(yw(this,"_updatePosition"),this._tooltipContent.dispose(),WB("itemTooltip",t))},t.type="tooltip",t}(M_);function wV(e,t,n){var i,a=t.ecModel;n?(i=new Bg(n,a,a),i=new Bg(t.option,i,a)):i=t;for(var r=e.length-1;r>=0;r--){var o=e[r];o&&(o instanceof Bg&&(o=o.get("tooltip",!0)),zr(o)&&(o={formatter:o}),o&&(i=new Bg(o,i,a)))}return i}function SV(e,t){return e.dispatchAction||Lr(t.dispatchAction,t)}function CV(e){return"center"===e||"middle"===e}function _V(e){QI(nN),e.registerComponentModel(iV),e.registerComponentView(bV),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},yo),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},yo)}var TV=Ar;function IV(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!0}function EV(e,t,n){var i={};return TV(t,(function(t){var a,r=i[t]=((a=function(){}).prototype.__hidden=a.prototype,new a);TV(e[t],(function(e,i){if(OD.isValidType(i)){var a={type:i,visual:e};n&&n(a,t),r[i]=new OD(a),"opacity"===i&&((a=Tr(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new OD(a))}}))})),i}function MV(e,t,n){var i;Ar(n,(function(e){t.hasOwnProperty(e)&&IV(t[e])&&(i=!0)})),i&&Ar(n,(function(n){t.hasOwnProperty(n)&&IV(t[n])?e[n]=Tr(t[n]):delete e[n]}))}kV(0),kV(1);function kV(e){var t=["x","y"],n=["width","height"];return{point:function(t,n,i){if(t){var a=i.range;return PV(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=[],Ar(n,(function(t,n){var i,r=nu(Zd(t),"");Hr(t)?(i=Tr(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 yy([{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}($v),RV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="timeline.slider",t.defaultOption=Dy(FV.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}(FV);Dr(RV,ex.prototype);var BV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="timeline",t}(M_),NV=function(e){function t(t,n,i,a){var r=e.call(this,t,n,i)||this;return r.type=a||"value",r}return ze(t,e),t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return"horizontal"===this.model.get("orient")},t}(xM),LV=Math.PI,VV=ou();!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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 Sx("nameValue",{noName:!0,value:o.scale.getLabel({value:e})})},Ar(["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 qv(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:LV/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*LV/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;jo(r,r,[-o,-s]),Ho(r,r,-LV/2),jo(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||zr(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 _E({ordinalMeta:e.getCategories(),extent:[1/0,-1/0]});case"time":return new EE({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});default:return new IE}}(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 NV("value",a,e.axisExtent,i);return o.model=t,o},t.prototype._createGroup=function(e){var t=this[e]=new Am;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 lh({shape:{x1:a[0],y1:0,x2:a[1],y2:0},style:Mr({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});t.add(r);var o=this._progressLine=new lh({shape:{x1:a[0],x2:this._currentPointer?this._currentPointer.x:a[0],y1:0,y2:0},style:kr({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=[],Ar(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:Lr(a._changeTimeline,a,e.value)},u=qV(s,l,t,d);u.ensureState("emphasis").style=p.getItemStyle(),u.ensureState("progress").style=c.getItemStyle(),am(u);var m=fu(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=[],Ar(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 ld({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:Lr(a._changeTimeline,a,o),silent:!1,style:hg(l,{text:i.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});u.ensureState("emphasis").style=hg(p),u.ensureState("progress").style=hg(c),t.add(u),am(u),VV(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=ds(Jr(i.get(["controlStyle",n+"BtnSize"]),a),a),d=function(e,t,n,i){var a=i.style,r=tg(e.get(["controlStyle",t]),i||{},new is(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),am(d)}}c(e.nextBtnPosition,"next",Lr(this._changeTimeline,this,p?"-":"+")),c(e.prevBtnPosition,"prev",Lr(this._changeTimeline,this,p?"+":"-")),c(e.playPosition,l?"stop":"play",Lr(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=Lr(s._handlePointerDrag,s),e.ondragend=Lr(s._handlePointerDragend,s),GV(e,s._progressLine,r,n,i,!0)},onUpdate:function(e){GV(e,s._progressLine,r,n,i)}};this._currentPointer=qV(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 KV={min:Vr($V,"min"),max:Vr($V,"max"),average:Vr($V,"average"),median:Vr($V,"median")};function YV(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)&&!qr(t.coord)&&qr(a)){var r=XV(t,n,i,e);if((t=Tr(t)).type&&KV[t.type]&&r.baseAxis&&r.valueAxis){var o=Pr(a,r.baseAxis.dim),s=Pr(a,r.valueAxis.dim),l=KV[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&&qr(a))for(var p=t.coord,c=0;c<2;c++)KV[p[c]]&&(p[c]=JV(n,n.mapDimension(a[c]),p[c]));else t.coord=[];return t}}function XV(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 ZV(e,t){return!(e&&e.containData&&t.coord&&!WV(t))||e.containData(t.coord)}function QV(e,t){return e?function(e,n,i,a){return Ff(a<2?e.coord&&e.coord[a]:e.value,t[a])}:function(e,n,i,a){return Ff(e.value,t[a])}}function JV(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 eq=ou(),tq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.init=function(){this.markerGroupMap=uo()},t.prototype.render=function(e,t,n){var i=this,a=this.markerGroupMap;a.each((function(e){eq(e).keep=!1})),t.eachSeries((function(e){var a=HV.getMarkerModelFromSeries(e,i.type);a&&i.renderSeries(e,a,t,n)})),a.each((function(e){!eq(e).keep&&i.group.remove(e.group)}))},t.prototype.markKeep=function(e){eq(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;Ar(e,(function(e){var i=HV.getMarkerModelFromSeries(e,n.type);i&&i.getData().eachItemGraphicEl((function(e){e&&(t?$u(e):Ku(e))}))}))},t.type="marker",t}(M_);function nq(e,t,n){var i=t.coordinateSystem;e.each((function(a){var r,o=e.getItemModel(a),s=Cd(o.get("x"),n.getWidth()),l=Cd(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}ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=HV.getMarkerModelFromSeries(e,"markPoint");t&&(nq(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 db),p=function(e,t,n){var i;i=e?Fr(e&&e.dimensions,(function(e){return Mr(Mr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new yy(i,n),r=Fr(n.get("data"),Vr(YV,t));e&&(r=Br(r,Vr(ZV,e)));var o=QV(!!e,i);return a.initData(r,null,o),a}(a,e,t);t.setData(p),nq(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(Gr(i)||Gr(a)||Gr(r)||Gr(s)){var c=t.getRawValue(e),d=t.getDataParams(e);Gr(i)&&(i=i(c,d)),Gr(a)&&(a=a(c,d)),Gr(r)&&(r=r(c,d)),Gr(s)&&(s=s(c,d))}var u=n.getModel("itemStyle").getItemStyle(),m=mT(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){fu(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markPoint"}(tq);var iq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}(HV),aq=ou(),rq=function(e,t,n,i){var a,r=e.getData();if(qr(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=Qr(i.yAxis,i.xAxis);else{var p=XV(i,r,t,e);s=p.valueAxis,l=JV(r,Ey(r,p.valueDataDim),o)}var c="x"===s.dim?0:1,d=1-c,u=Tr(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&&jr(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=[YV(e,a[0]),YV(e,a[1]),Mr({},a[2])];return g[2].type=g[2].type||null,Ir(g[2],g[0]),Ir(g[2],g[1]),g};function oq(e){return!isNaN(e)&&!isFinite(e)}function sq(e,t,n,i){var a=1-e,r=i.dimensions[e];return oq(t[a])&&oq(n[a])&&t[e]===n[e]&&i.getAxis(r).containData(t[e])}function lq(e,t){if("cartesian2d"===e.type){var n=t[0].coord,i=t[1].coord;if(n&&i&&(sq(1,n,i,e)||sq(0,n,i,e)))return!0}return ZV(e,t[0])&&ZV(e,t[1])}function pq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Cd(s.get("x"),a.getWidth()),p=Cd(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(Nb(o,"cartesian2d")){var m=o.getAxis("x"),h=o.getAxis("y");c=o.dimensions;oq(e.get(c[0],t))?r[0]=m.toGlobalCoord(m.getExtent()[n?0:1]):oq(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 cq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=HV.getMarkerModelFromSeries(e,"markLine");if(t){var i=t.getData(),a=aq(t).from,r=aq(t).to;a.each((function(t){pq(a,t,!0,e,n),pq(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 fO);this.group.add(l.group);var p=function(e,t,n){var i;i=e?Fr(e&&e.dimensions,(function(e){return Mr(Mr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new yy(i,n),r=new yy(i,n),o=new yy([],n),s=Fr(n.get("data"),Vr(rq,t,e,n));e&&(s=Br(s,Vr(lq,e)));var l=QV(!!e,i);return a.initData(Fr(s,(function(e){return e[0]})),null,l),r.initData(Fr(s,(function(e){return e[1]})),null,l),o.initData(Fr(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;aq(t).from=c,aq(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);pq(t,n,a,e,i);var s=r.getModel("itemStyle").getItemStyle();null==s.fill&&(s.fill=mT(o,"color")),t.setItemVisual(n,{symbolKeepAspect:r.get("symbolKeepAspect"),symbolOffset:Jr(r.get("symbolOffset",!0),f[a?0:1]),symbolRotate:Jr(r.get("symbolRotate",!0),g[a?0:1]),symbolSize:Jr(r.get("symbolSize"),h[a?0:1]),symbol:Jr(r.get("symbol",!0),m[a?0:1]),style:s})}qr(m)||(m=[m,m]),qr(h)||(h=[h,h]),qr(g)||(g=[g,g]),qr(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){fu(e).dataModel=t,e.traverse((function(e){fu(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markLine",t}(tq);function dq(e){e.registerComponentModel(iq),e.registerComponentView(cq),e.registerPreprocessor((function(e){zV(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}ze(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"}}}}(HV);var uq=ou(),mq=function(e,t,n,i){var a=i[0],r=i[1];if(a&&r){var o=YV(e,a),s=YV(e,r),l=o.coord,p=s.coord;l[0]=Qr(l[0],-1/0),l[1]=Qr(l[1],-1/0),p[0]=Qr(p[0],1/0),p[1]=Qr(p[1],1/0);var c=Er([{},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 hq(e){return!isNaN(e)&&!isFinite(e)}function gq(e,t,n,i){var a=1-e;return hq(t[a])&&hq(n[a])}function fq(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 Nb(e,"cartesian2d")?!(!n||!i||!gq(1,n,i)&&!gq(0,n,i))||function(e,t,n){return!(e&&e.containZone&&t.coord&&n.coord&&!WV(t)&&!WV(n))||e.containZone(t.coord,n.coord)}(e,a,r):ZV(e,a)||ZV(e,r)}function yq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Cd(s.get(n[0]),a.getWidth()),p=Cd(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(Nb(o,"cartesian2d")){var f=o.getAxis("x"),y=o.getAxis("y"),v=e.get(n[0],t),x=e.get(n[1],t);hq(v)?r[0]=f.toGlobalCoord(f.getExtent()["x0"===n[0]?0:1]):hq(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 vq=[["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}ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=HV.getMarkerModelFromSeries(e,"markArea");if(t){var i=t.getData();i.each((function(t){var a=Fr(vq,(function(a){return yq(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 Am});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=Fr(e&&e.dimensions,(function(e){var n=t.getData();return Mr(Mr({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}));a=Fr(r,(function(e,t){return{name:e,type:o[t%2].type}})),i=new yy(a,n)}else i=new yy(a=[{name:"value",type:"float"}],n);var s=Fr(n.get("data"),Vr(mq,t,e,n));e&&(s=Br(s,Vr(fq,e)));var l=e?function(e,t,n,i){return Ff(e.coord[Math.floor(i/2)][i%2],a[i])}:function(e,t,n,i){return Ff(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=Fr(vq,(function(n){return yq(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}($v),bq=Vr,wq=Ar,Sq=Am,Cq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return ze(t,e),t.prototype.init=function(){this.group.add(this._contentGroup=new Sq),this.group.add(this._selectorGroup=new Sq),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=qv(l,p,c),u=this.layoutInner(e,a,d,i,o,s),m=qv(kr({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=IL(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=uo(),p=t.get("selectedMode"),c=[];n.eachRawSeries((function(e){!e.get("legendHoverLink")&&c.push(e.id)})),wq(t.getData(),(function(a,r){var o=a.get("name");if(!this.newlineDisabled&&(""===o||"\n"===o)){var d=new Sq;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",bq(_q,o,null,i,c)).on("mouseover",bq(Iq,u.name,null,i,c)).on("mouseout",bq(Eq,u.name,null,i,c)),n.ssr&&y.eachChild((function(e){var t=fu(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=Ll(m.fill);g&&0===g[3]&&(g[3]=.2,m=Mr(Mr({},m),{fill:Hl(g,"rgba")}));var f=this._createItem(s,o,r,a,t,e,{},m,h,p,i);f.on("click",bq(_q,null,o,i,c)).on("mouseover",bq(Iq,null,o,i,c)).on("mouseout",bq(Eq,null,o,i,c)),n.ssr&&f.eachChild((function(e){var t=fu(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();wq(e,(function(e){var i=e.type,a=new ld({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect"})}});r.add(a),ug(a,{normal:t.getModel("selectorLabel"),emphasis:t.getModel(["emphasis","selectorLabel"])},{defaultText:e.title}),am(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),wq(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?UT(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 Sq,b=i.getModel("textStyle");if(!Gr(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=eb(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;zr(_)&&_?T=_.replace("{name}",null!=t?t:""):Gr(_)&&(T=_(t));var I=h?b.getTextColor():i.get("inactiveColor");x.add(new ld({style:hg(b,{text:T,x:S,y:m/2,fill:I,align:C,verticalAlign:"middle"},{inheritColor:I})}));var E=new rd({shape:x.getBoundingRect(),style:{fill:"transparent"}}),M=i.getModel("tooltip");return M.get("show")&&rg({el:E,componentModel:a,itemName:t,itemTooltipOption:M.option}),x.add(E),x.eachChild((function(e){e.silent=!0})),E.silent=!p,this.getContentGroup().add(x),am(x),x.__legendDataIndex=n,x},t.prototype.layoutInner=function(e,t,n,i,a,r){var o=this.getContentGroup(),s=this.getSelectorGroup();Vv(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){Vv("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}(M_);function _q(e,t,n,i){Eq(e,t,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=e?e:t}),Iq(e,t,n,i)}function Tq(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=Jr(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 rd({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&&kh(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;Ar(["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",zr(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=Pq[a],o=Dq[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"}(Cq);var Oq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="dataZoom.inside",t.defaultOption=Dy(hL.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(hL),Aq=ou();function Fq(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function Rq(e,t){e.isDisposed()||e.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:t})}function Bq(e,t,n,i){return e.coordinateSystem.containPoint([n,i])}function Nq(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,(function(e,t){var n=Aq(t),i=n.coordSysRecordMap||(n.coordSysRecordMap=uo());i.each((function(e){e.dataZoomInfoMap=null})),e.eachComponent({mainType:"dataZoom",subType:"inside"},(function(e){Ar(uL(e).infoList,(function(n){var a=n.model.uid,r=i.get(a)||i.set(a,function(e,t){var n={model:t,containsPoint:Vr(Bq,t),dispatchAction:Vr(Rq,e),dataZoomInfoMap:null,controller:null},i=n.controller=new wk(e.getZr());return Ar(["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=uo())).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),fw(e,"dispatchAction",t.model.get("throttle",!0),"fixRate")}else Fq(i,e)}))}))}var Lq=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return ze(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){Aq(e).coordSysRecordMap.each((function(e){var i=e.dataZoomInfoMap.get(t.uid);i&&(i.getRange=n)}))}(i,t,{pan:Lr(Vq.pan,this),zoom:Lr(Vq.zoom,this),scrollMove:Lr(Vq.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){!function(e,t){for(var n=Aq(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(KO(0,r,[0,100],0,d.minSpan,d.maxSpan),this.range=r,a[0]!==r[0]||a[1]!==r[1])return r}}},pan:qq((function(e,t,n,i,a,r){var o=Gq[i]([r.oldX,r.oldY],[r.newX,r.newY],t,a,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength})),scrollMove:qq((function(e,t,n,i,a,r){return Gq[i]([0,0],[r.scrollDelta,r.scrollDelta],t,a,n).signal*(e[1]-e[0])*r.scrollDelta}))};function qq(e){return function(t,n,i,a){var r=this.range,o=r.slice(),s=t.axisModels[0];if(s)return KO(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 Gq={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 zq(e){SL(e),e.registerComponentModel(Oq),e.registerComponentView(Lq),Nq(e)}var Uq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=Dy(hL.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}(hL),jq=rd,Hq="horizontal",Wq="vertical",$q=["line","bar","candlestick","scatter","custom"],Kq={easing:"cubicOut",duration:100,delay:0},Yq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return ze(t,e),t.prototype.init=function(e,t){this.api=t,this._onBrush=Lr(this._onBrush,this),this._onBrushEnd=Lr(this._onBrushEnd,this)},t.prototype.render=function(t,n,i,a){if(e.prototype.render.apply(this,arguments),fw(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(){yw(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 Am;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===Hq?{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=jv(e.option);Ar(["right","top","width","height"],(function(e){"ph"===o[e]&&(o[e]=r[e])}));var s=qv(o,a);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===Wq&&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!==Hq||a?n===Hq&&a?{scaleY:o?1:-1,scaleX:-1}:n!==Wq||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 jq({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get("backgroundColor")},z2:-40}));var a=new jq({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:"transparent"},z2:0,onclick:Lr(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:Sd(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 Am,i=new ih({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),a=new rh({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&&Ar(o.getTargetSeriesModels(),(function(e){if(!(n||!0!==t&&Pr($q,e.get("type"))<0)){var o,s=i.getComponent(cL(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 jq({silent:p,style:{fill:o.get("fillerColor")},textConfig:{position:"inside"}});a.add(c),a.add(new jq({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)"}})),Ar([0,1],(function(t){var r=o.get("handleIcon");!Zx[r]&&r.indexOf("path://")<0&&r.indexOf("image://")<0&&(r="path://"+r);var s=eb(r,-1,0,2,2,null,!0);s.attr({cursor:Xq(this._orient),draggable:!0,drift:Lr(this._onDragMove,this,t),ondragend:Lr(this._onDragEnd,this),onmouseover:Lr(this._showDataInfo,this,!0),onmouseout:Lr(this._showDataInfo,this,!1),z2:5});var l=s.getBoundingRect(),p=o.get("handleSize");this._handleHeight=Cd(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(),am(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 ld({silent:!0,invisible:!0,style:hg(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=Cd(o.get("moveHandleSize"),r[1]),m=t.moveHandle=new rd({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=eb(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 rd({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:Xq(this._orient),drift:Lr(this._onDragMove,this,"all"),ondragstart:Lr(this._showDataInfo,this,!0),ondragend:Lr(this._onDragEnd,this),onmouseover:Lr(this._showDataInfo,this,!0),onmouseout:Lr(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[Sd(e[0],[0,100],t,!0),Sd(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];KO(t,i,a,n.get("zoomLock")?"all":e,null!=o.minSpan?Sd(o.minSpan,s,a,!0):null,null!=o.maxSpan?Sd(o.maxSpan,s,a,!0):null);var l=this._range,p=this._range=Td([Sd(i[0],a,s,!0),Sd(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;Ar([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 Ko(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([Sd(n.x,i,a,!0),Sd(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&&(WS(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 jq({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?Kq:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=uL(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}(fL);function Xq(e){return"vertical"===e?"ns-resize":"ew-resize"}function Zq(e){e.registerComponentModel(Uq),e.registerComponentView(Yq),SL(e)}function Qq(e){QI(zq),QI(Zq)}var Jq=function(e,t,n){var i=Tr((eG[e]||{})[t]);return n&&qr(i)?i[i.length-1]:i},eG={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]}},tG=OD.mapVisual,nG=OD.eachVisual,iG=qr,aG=Ar,rG=Td,oG=Sd,sG=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 ze(t,e),t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&MV(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=Lr(e,this),this.controllerVisuals=EV(this.option.controller,t,e),this.targetVisuals=EV(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=Kd(e),t},t.prototype.eachTargetSeries=function(e,t){Ar(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||["<",">"],qr(e)&&(e=e.slice(),i=!0);var l=t?e:i?[p(e[0]),p(e[1])]:p(e);return zr(s)?s.replace("{value}",i?l[0]:l).replace("{value2}",i?l[1]:l):Gr(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=rG([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={});Ir(i,n),Ir(a,n);var r=this.isCategory();function o(n){iG(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]={},aG(i,(function(e,t){if(OD.isValidType(t)){var n=Jq(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";aG(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&&Tr(t)||(r?a:[a])),null==l.symbolSize&&(l.symbolSize=n&&Tr(n)||(r?s[0]:[s[0],s[0]])),l.symbol=tG(l.symbol,(function(e){return"none"===e?a:e}));var p=l.symbolSize;if(null!=p){var c=-1/0;nG(p,(function(e){e>c&&(c=e)})),l.symbolSize=tG(p,(function(e){return oG(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}($v),lG=[20,140],pG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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]=lG[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=lG[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):qr(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),Ar(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=cG(this,"outOfRange",this.getExtent()),n=cG(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 Am("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();fG([0,1],(function(l){var p=a[l];p.setStyle("fill",t.handlesColor[l]),p.y=e[l];var c=gG(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=Xh(n.handleLabelPoints[l],Yh(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=gG(e,r,s,!0),m=o[0]-d/2,h={x:p.x,y:p.y};p.y=u,p.x=m;var g=Xh(l.indicatorLabelPoint,Yh(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||wG(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 IG(e,t,n,i){for(var a=t.targetVisuals[i],r=OD.prepareVisualTypes(a),o={color:mT(e.getData(),"color")},s=0,l=r.length;s0:e.splitNumber>0)&&!e.calculable?"piecewise":"continuous"})),e.registerAction(CG,_G),Ar(TG,(function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)})),e.registerPreprocessor(MG))}function OG(e){e.registerComponentModel(pG),e.registerComponentView(xG),DG(e)}var AG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return ze(t,e),t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],FG[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=Tr(a)):(e.dataExtent=this.getExtent(),e.mappingMethod="piecewise",e.pieceList=Fr(this._pieceList,(function(e){return e=Tr(e),"inRange"!==t&&(e.visual=null),e})))}))},t.prototype.completeVisualOption=function(){var t=this.option,n={},i=OD.listVisualTypes(),a=this.isCategory();function r(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}Ar(t.pieces,(function(e){Ar(i,(function(t){e.hasOwnProperty(t)&&(n[t]=1)}))})),Ar(n,(function(e,n){var i=!1;Ar(this.stateList,(function(e){i=i||r(t,e,n)||r(t.target,e,n)}),this),!i&&Ar(this.stateList,(function(e){(t[e]||(t[e]={}))[n]=Jq(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,Ar(i,(function(e,t){var n=this.getSelectedMapKey(e);a.hasOwnProperty(n)||(a[n]=!0)}),this),"single"===n.selectedMode){var r=!1;Ar(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=Tr(e)},t.prototype.getValueState=function(e){var t=OD.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){OD.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 Ar(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=Dy(sG.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}(sG),FG={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 RG(e,t){var n=e.inverse;("vertical"===e.orient?!n:n)&&t.reverse()}var BG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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=Qr(t.get("showLabel",!0),!p);p&&this._renderEndsText(e,p[0],s,c,o),Ar(l.viewPieceList,(function(i){var l=i.piece,p=new Am;p.onclick=Lr(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 ld({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),Vv(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:hG(i.findTargetDataIndices(t),i)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if("vertical"===t.orient)return mG(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 Am,o=this.visualMapModel.textStyleModel;r.add(new ld({style:hg(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=Fr(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(eb(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=Tr(n.selected),r=t.getSelectedMapKey(e);"single"===i||!0===i?(a[r]=!0,Ar(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}(dG);function NG(e){e.registerComponentModel(AG),e.registerComponentView(BG),DG(e)}function LG(e){QI(OG),QI(NG)}ou();var VG={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},qG=function(){function e(e){if(null==(this._condVal=zr(e)?new RegExp(e):Xr(e)?e:null)){var t="";0,jd(t)}}return e.prototype.evaluate=function(e){var t=typeof e;return zr(t)?this._condVal.test(e):!!jr(t)&&this._condVal.test(e+"")},e}(),GG=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),zG=function(){function e(){}return e.prototype.evaluate=function(){for(var e=this.children,t=0;t=0&&n.attr(m.oldLayoutSelect),Pr(p,"emphasis")>=0&&n.attr(m.oldLayoutEmphasis)),kh(n,s,t,o)}else if(n.attr(s),!wg(n).valueAnimation){var c=Jr(n.style.opacity,1);n.style.opacity=0,Ph(n,{style:{opacity:c}},t,o)}if(m.oldLayout=s,n.states.select){var d=m.oldLayoutSelect={};tz(d,s,nz),tz(d,n.states.select,nz)}if(n.states.emphasis){var u=m.oldLayoutEmphasis={};tz(u,s,nz),tz(u,n.states.emphasis,nz)}Cg(n,o,l,t,t)}if(i&&!i.ignore&&!i.invisible){a=(m=ez(i)).oldLayout;var m,h={points:i.shape.points};a?(i.attr({shape:a}),kh(i,{shape:h},t)):(i.setShape(h),i.style.strokePercent=0,Ph(i,{style:{strokePercent:1}},t)),m.oldLayout=h}},e}(),az=ou();function rz(e){e.registerUpdateLifecycle("series:beforeupdate",(function(e,t,n){var i=az(t).labelManager;i||(i=az(t).labelManager=new iz),i.clearLabels()})),e.registerUpdateLifecycle("series:layoutlabels",(function(e,t,n){var i=az(t).labelManager;n.updatedSeries.forEach((function(e){i.addLabelsOfSeries(t.getViewOfSeriesModel(e))})),i.updateLayoutConfig(t),i.layout(t),i.processLabelsOverall()}))}var oz=Math.sin,sz=Math.cos,lz=Math.PI,pz=2*Math.PI,cz=180/lz,dz=function(){function e(){}return e.prototype.reset=function(e){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,e||4)},e.prototype.moveTo=function(e,t){this._add("M",e,t)},e.prototype.lineTo=function(e,t){this._add("L",e,t)},e.prototype.bezierCurveTo=function(e,t,n,i,a,r){this._add("C",e,t,n,i,a,r)},e.prototype.quadraticCurveTo=function(e,t,n,i){this._add("Q",e,t,n,i)},e.prototype.arc=function(e,t,n,i,a,r){this.ellipse(e,t,n,n,0,i,a,r)},e.prototype.ellipse=function(e,t,n,i,a,r,o,s){var l=o-r,p=!s,c=Math.abs(l),d=Ql(c-pz)||(p?l>=pz:-l>=pz),u=l>0?l%pz:l%pz+pz,m=!1;m=!!d||!Ql(c)&&u>=lz==!!p;var h=e+n*sz(r),g=t+i*oz(r);this._start&&this._add("M",h,g);var f=Math.round(a*cz);if(d){var y=1/this._p,v=(p?1:-1)*(pz-y);this._add("A",n,i,f,1,+p,e+n*sz(r+v),t+i*oz(r+v)),y>.01&&this._add("A",n,i,f,0,+p,h,g)}else{var x=e+n*sz(o),b=t+i*oz(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?Gy(o):o||"")+(i?""+n+Fr(i,(function(t){return e(t)})).join(n)+n:"")+("")}(e)}function Cz(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function _z(e,t,n,i){return wz("svg","root",{width:e,height:t,xmlns:yz,"xmlns:xlink":vz,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+e+" "+t},n)}var Tz=0;function Iz(){return Tz++}var Ez={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"},Mz="transform-origin";function kz(e,t,n){var i=Mr({},e.shape);Mr(i,t),e.buildPath(n,i);var a=new dz;return a.reset(lp(e)),n.rebuildPath(a,1),a.generateStr(),a.getStr()}function Pz(e,t){var n=t.originX,i=t.originY;(n||i)&&(e[Mz]=n+"px "+i+"px")}var Dz={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function Oz(e,t){var n=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function Az(e){return zr(e)?Ez[e]?"cubic-bezier("+Ez[e]+")":_l(e)?e:"":""}function Fz(e,t,n,i){var a=e.animators,r=a.length,o=[];if(e instanceof gh){var s=function(e,t,n){var i,a,r=e.shape.paths,o={};if(Ar(r,(function(e){var t=Cz(n.zrId);t.animation=!0,Fz(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,l=Nr(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=Oz(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 Oz(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-"+Iz();n.cssNodes["."+y]={animation:o.join(",")},t.class=y}}function Rz(e,t,n,i){var a=JSON.stringify(e),r=n.cssStyleCache[a];r||(r=n.zrId+"-cls-"+Iz(),n.cssStyleCache[a]=r,n.cssNodes["."+r+(i?":hover":"")]=e),t.class=t.class?t.class+" "+r:r}var Bz=Math.round;function Nz(e){return e&&zr(e.src)}function Lz(e){return e&&Gr(e.toDataURL)}function Vz(e,t,n,i){fz((function(a,r){var o="fill"===a||"stroke"===a;o&&op(r)?Xz(t,e,a,i):o&&ip(r)?Zz(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=Xl(i.shadowColor),h=m.opacity,g=m.color,f=u/2/l+" "+u/2/p;o=n.zrId+"-s"+n.shadowIdx++,n.defs[o]=wz("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[wz("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 qz(e,t){var n=function(e){if("function"==typeof GC)return GC(e)}(t);n&&(n.each((function(t,n){null!=t&&(e[(xz+n).toLowerCase()]=t+"")})),t.isSilent()&&(e[xz+"silent"]="true"))}function Gz(e){return Ql(e[0]-1)&&Ql(e[1])&&Ql(e[2])&&Ql(e[3]-1)}function zz(e,t,n){if(t&&(!function(e){return Ql(e[4])&&Ql(e[5])}(t)||!Gz(t))){var i=n?10:1e4;e.transform=Gz(t)?"translate("+Bz(t[4]*i)/i+" "+Bz(t[5]*i)/i+")":function(e){return"matrix("+Jl(e[0])+","+Jl(e[1])+","+Jl(e[2])+","+Jl(e[3])+","+ep(e[4])+","+ep(e[5])+")"}(t)}}function Uz(e,t,n){for(var i=e.points,a=[],r=0;r=0&&o||r;s&&(a=Kl(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),Rz(p,t,n,!0)}}(e,r,t),wz(s,e.id+"",r)}function Yz(e,t){return e instanceof $c?Kz(e,t):e instanceof Qc?function(e,t){var n=e.style,i=n.image;if(i&&!zr(i)&&(Nz(i)?i=i.src:Lz(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),zz(o,e.transform),Vz(o,n,e,t),qz(o,e),t.animation&&Fz(e,o,t),wz("image",e.id+"",o)}}(e,t):e instanceof Yc?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||or,r=n.x||0,o=function(e,t,n){return"top"===n?e+=t/2:"bottom"===n&&(e-=t/2),e}(n.y||0,cs(a),n.textBaseline),s={"dominant-baseline":"central","text-anchor":tp[n.textAlign]||n.textAlign};if(hd(n)){var l="",p=n.fontStyle,c=ud(n.fontSize);if(!parseFloat(c))return;var d=n.fontFamily||rr,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),zz(s,e.transform),Vz(s,n,e,t),qz(s,e),t.animation&&Fz(e,s,t),wz("text",e.id+"",s,void 0,i)}}(e,t):void 0}function Xz(e,t,n,i){var a,r=e[n],o={gradientUnits:r.global?"userSpaceOnUse":"objectBoundingBox"};if(ap(r))a="linearGradient",o.x1=r.x,o.y1=r.y,o.x2=r.x2,o.y2=r.y2;else{if(!rp(r))return void 0;a="radialGradient",o.cx=Jr(r.x,.5),o.cy=Jr(r.y,.5),o.r=Jr(r.r,.5)}for(var s=r.colorStops,l=[],p=0,c=s.length;pl?uU(e,null==n[d+1]?null:n[d+1].elm,n,s,d):mU(e,t,o,l))}(n,i,a):lU(a)?(lU(e.text)&&rU(n,""),uU(n,null,a,0,a.length-1)):lU(i)?mU(n,i,0,i.length-1):lU(e.text)&&rU(n,""):e.text!==t.text&&(lU(i)&&mU(n,i,0,i.length-1),rU(n,t.text)))}var fU=0,yU=function(){function e(e,t,n){if(this.type="svg",this.refreshHover=vU("refreshHover"),this.configLayer=vU("configLayer"),this.storage=t,this._opts=n=Mr({},n),this.root=e,this._id="zr"+fU++,this._oldVNode=_z(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=bz("svg");hU(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(cU(e,t))gU(e,t);else{var n=e.elm,i=iU(n);dU(t),null!==i&&(eU(i,t.elm,aU(n)),mU(i,[e],0,0))}}(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return Yz(e,Cz(this._id))},e.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),n=this._width,i=this._height,a=Cz(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=wz("rect","bg",{width:e,height:t,x:"0",y:"0"}),op(n))Xz({fill:n},a.attrs,"fill",i);else if(ip(n))Zz({style:{fill:n},dirty:yo,getBoundingRect:function(){return{width:e,height:t}}},a.attrs,"fill",i);else{var r=Xl(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=wz("g","main",{},[]);this._paintList(t,a,s?s.children:r),s&&r.push(s);var l=Fr(Nr(a.defs),(function(e){return a.defs[e]}));if(l.length&&r.push(wz("defs","defs",{},l)),e.animation){var p=function(e,t,n){var i=(n=n||{}).newline?"\n":"",a=" {"+i,r=i+"}",o=Fr(Nr(e),(function(t){return t+a+Fr(Nr(e[t]),(function(n){return n+":"+e[t][n]+";"})).join(i)+r})).join(i),s=Fr(Nr(t),(function(e){return"@keyframes "+e+a+Fr(Nr(t[e]),(function(n){return n+a+Fr(Nr(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=wz("style","stl",{},[],p);r.push(c)}}return _z(n,i,r,e.useViewBox)},e.prototype.renderToString=function(e){return e=e||{},Sz(this.renderToVNode({animation:Jr(e.cssAnimation,!0),emphasis:Jr(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Jr(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?_U:0),this._needsManuallyCompositing),p.__builtin__||_r("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,Ar(this._layers,(function(e){e.setUnpainted()}))},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?Ir(n[e],t,!0):n[e]=t;for(var i=0;i({legendKey:e,left:!0}),kU=e=>({background:e});function PU(e,n){1&e&&t.ɵɵelementContainer(0)}function DU(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,PU,1,0,"ng-container",8),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e.widgetTitlePanel)}}function OU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Min")))}function AU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Max")))}function FU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Avg")))}function RU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Total")))}function BU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Latest")))}function NU(e,n){1&e&&t.ɵɵelementContainer(0)}function LU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 VU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 qU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 GU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 zU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 UU(e,n){if(1&e&&(t.ɵɵelementStart(0,"tr")(1,"th"),t.ɵɵtemplate(2,NU,1,0,"ng-container",14),t.ɵɵelementEnd(),t.ɵɵtemplate(3,LU,2,4,"td",15)(4,VU,2,4,"td",15)(5,qU,2,4,"td",15)(6,GU,2,4,"td",15)(7,zU,2,4,"td",15),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,MU,e)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showMin),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showMax),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showAvg),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showTotal),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showLatest)}}function jU(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"table",10)(2,"thead")(3,"tr"),t.ɵɵelement(4,"th"),t.ɵɵtemplate(5,OU,3,3,"th",11)(6,AU,3,3,"th",11)(7,FU,3,3,"th",11)(8,RU,3,3,"th",11)(9,BU,3,3,"th",11),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"tbody"),t.ɵɵtemplate(11,UU,8,9,"tr",12),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngIf",!0===e.legendConfig.showMin),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showMax),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showAvg),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showTotal),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showLatest),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",e.legendKeys)}}function HU(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",18),t.ɵɵelement(2,"div",19)(3,"div",20),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,kU,e.dataKey.color)),t.ɵɵadvance(),t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(4,5,e.dataKey.label,"html"),t.ɵɵsanitizeHtml)}}class WU{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=Ze.init(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=Qe(this.myChart,this.yAxis.mainType,this.yAxis.id),n=Je(this.myChart,this.yAxis.mainType,this.yAxis.id,this.yAxis.name),i=Qe(this.myChart,this.xAxis.mainType,this.xAxis.id),a=t+n,r=i+Je(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(){Ze.use([_V,iN,LG,Qq,dq,RN,fk,Jb,Gw,RS,yk,vB,rz,IU,xU])}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=ke(this.ctx.data[t].dataKey.decimals)?this.ctx.data[t].dataKey.decimals:this.ctx.decimals,s=ke(this.ctx.data[t].dataKey.units)?this.ctx.data[t].dataKey.units:this.ctx.units,l=Pe(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=>Pe(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||WU)(t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(et.DomSanitizer),t.ɵɵdirectiveInject(tt.WidgetComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:WU,selectors:[["tb-gateway-statistics-chart"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(EU,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"],[4,"ngIf"],[1,"tb-time-series-chart-content"],[1,"tb-time-series-chart-shape"],["class","tb-time-series-chart-legend",4,"ngIf"],[4,"ngTemplateOutlet"],[1,"tb-time-series-chart-legend"],[1,"tb-time-series-chart-legend-table","vertical"],["class","tb-time-series-chart-legend-type-label right legend legend-row-color",4,"ngIf"],[4,"ngFor","ngForOf"],[1,"tb-time-series-chart-legend-type-label","right","legend","legend-row-color"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["class","tb-time-series-chart-legend-value legend",3,"innerHTML",4,"ngIf"],[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,DU,2,1,"ng-container",4),t.ɵɵelementStart(3,"div",5),t.ɵɵelement(4,"div",6,0),t.ɵɵtemplate(6,jU,12,6,"div",7)(7,HU,5,10,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.widgetComponent.dashboardWidget.showWidgetTitlePanel),t.ɵɵadvance(),t.ɵɵclassMap(n.legendClass),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.showLegend))},dependencies:t.ɵɵgetComponentDepsFactory(WU,[j,_]),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 $U=["statisticChart"];function KU(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 YU(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 XU(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 ZU(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,YU,2,1,"tb-gateway-statistics-chart",14)(2,XU,1,1,"tb-custom-statistics-table",15),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵconditional(e.isNumericData?1:2)}}function QU(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 JU{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:F(R.timeseries)},this.statisticForm.get("command").valueChanges.pipe(wn()).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===B)return;this.getGatewayGeneralConfig().pipe(wn(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(ar,{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(xe((e=>re(this.getGatewayGeneralConfig(),ae(e)))),xe((([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)))),wn(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(ve(Boolean),xe((()=>this.getGatewayGeneralConfig())),xe((t=>(this.commands=[...t.statistics.commands.filter((t=>t.attributeOnGateway!==e))],this.updateStatisticsCommands(t,this.commands)))),wn(this.destroyRef)).subscribe()}getGatewayGeneralConfig(){const e=this.ctx.defaultSubscription.datasources[0].entity;return e.id.id===B?ae(null):this.attributeService.getEntityAttributes(e.id,D.SHARED_SCOPE,["general_configuration"]).pipe(pe((e=>e[0]?.value)))}updateStatisticsCommands(e,t){const n=this.ctx.defaultSubscription.datasources[0].entity;return n.id.id!==B&&e?this.attributeService.saveEntityAttributes(n.id,D.SHARED_SCOPE,[{key:"general_configuration",value:{...e,statistics:{...e.statistics,commands:t}}}]):ae(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(R.timeseries,e,this.subscriptionOptions,!1,!0).pipe(wn(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||JU)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(_e.UtilsService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:JU,selectors:[["tb-gateway-statistics"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery($U,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,KU,8,6),t.ɵɵelementEnd()(),t.ɵɵtemplate(16,ZU,3,1,"div",10)(17,QU,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(JU,[j,_,On,qn,WU]),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 ej;e("GatewayStatisticsComponent",JU),e("BACnetRequestTypes",ej),function(e){e.WriteProperty="writeProperty",e.ReadProperty="readProperty"}(ej||e("BACnetRequestTypes",ej={}));const tj=e("BACnetRequestTypesTranslates",new Map([[ej.WriteProperty,"gateway.rpc.write-property"],[ej.ReadProperty,"gateway.rpc.read-property"]]));var nj;e("BACnetObjectTypes",nj),function(e){e.BinaryInput="binaryInput",e.BinaryOutput="binaryOutput",e.AnalogInput="analogInput",e.AnalogOutput="analogOutput",e.BinaryValue="binaryValue",e.AnalogValue="analogValue"}(nj||e("BACnetObjectTypes",nj={}));const ij=e("BACnetObjectTypesTranslates",new Map([[nj.AnalogOutput,"gateway.rpc.analog-output"],[nj.AnalogInput,"gateway.rpc.analog-input"],[nj.BinaryOutput,"gateway.rpc.binary-output"],[nj.BinaryInput,"gateway.rpc.binary-input"],[nj.BinaryValue,"gateway.rpc.binary-value"],[nj.AnalogValue,"gateway.rpc.analog-value"]]));var aj;e("BLEMethods",aj),function(e){e.WRITE="write",e.READ="read",e.SCAN="scan"}(aj||e("BLEMethods",aj={}));const rj=e("BLEMethodsTranslates",new Map([[aj.WRITE,"gateway.rpc.write"],[aj.READ,"gateway.rpc.read"],[aj.SCAN,"gateway.rpc.scan"]]));var oj,sj;e("CANByteOrders",oj),function(e){e.LITTLE="LITTLE",e.BIG="BIG"}(oj||e("CANByteOrders",oj={})),e("SocketMethodProcessings",sj),function(e){e.WRITE="write",e.READ="read"}(sj||e("SocketMethodProcessings",sj={}));const lj=e("SocketMethodProcessingsTranslates",new Map([[sj.WRITE,"gateway.rpc.write"],[sj.READ,"gateway.rpc.read"]]));var pj;e("SNMPMethods",pj),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"}(pj||e("SNMPMethods",pj={}));const cj=e("SNMPMethodsTranslations",new Map([[pj.SET,"gateway.rpc.set"],[pj.MULTISET,"gateway.rpc.multiset"],[pj.GET,"gateway.rpc.get"],[pj.BULKWALK,"gateway.rpc.bulk-walk"],[pj.TABLE,"gateway.rpc.table"],[pj.MULTIGET,"gateway.rpc.multi-get"],[pj.GETNEXT,"gateway.rpc.get-next"],[pj.BULKGET,"gateway.rpc.bulk-get"],[pj.WALKS,"gateway.rpc.walk"]]));var dj,uj;e("SocketEncodings",dj),function(e){e.UTF_8="utf-8"}(dj||e("SocketEncodings",dj={})),e("RestSecurityType",uj),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic"}(uj||e("RestSecurityType",uj={}));const mj=e("RestSecurityTypeTranslationsMap",new Map([[uj.ANONYMOUS,"gateway.broker.security-types.anonymous"],[uj.BASIC,"gateway.broker.security-types.basic"]]));class hj{transform(e){return e.map((e=>(e?.value??e).toString())).join(", ")}static{this.ɵfac=function(e){return new(e||hj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getRpcTemplateArrayView",type:hj,pure:!0,standalone:!0})}}e("RpcTemplateArrayViewPipe",hj);class gj{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=>{ke(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||gj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"keyValueIsNotEmpty",type:gj,pure:!1,standalone:!0})}}e("KeyValueIsNotEmptyPipe",gj);const fj=e=>({$implicit:e,innerValue:!1}),yj=e=>({"padding-left":e}),vj=(e,t)=>({"boolean-true":e,"boolean-false":t}),xj=e=>({$implicit:e,innerValue:!0});function bj(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext();const i=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,fj,e))}}function wj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",19),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 Sj(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(12);t.ɵɵproperty("ngTemplateOutlet",e)}}function Cj(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(10);t.ɵɵproperty("ngTemplateOutlet",e)}}function _j(e,n){if(1&e&&(t.ɵɵelementStart(0,"div"),t.ɵɵtemplate(1,Cj,1,1,"ng-container",21),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵreference(8),i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction2(4,vj,!0===e.value,!1===e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",i.type===a.ConnectorType.SNMP&&"method"===e.key)("ngIfElse",n)}}function Tj(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate(e.value)}}function Ij(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 Ej(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext(3);const i=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,xj,e))}}function Mj(e,n){if(1&e&&(t.ɵɵtemplate(0,Ej,1,4,"ng-container",12),t.ɵɵpipe(1,"keyvalue")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("ngForOf",t.ɵɵpipeBind2(1,1,e.value,n.originalOrder))}}function kj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14)(1,"div",15),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,wj,3,3,"div",16)(5,Sj,1,1,"ng-container",17)(6,_j,2,7,"div",18)(7,Tj,1,1,"ng-template",null,1,t.ɵɵtemplateRefExtractor)(9,Ij,2,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor)(11,Mj,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=n.innerValue,a=t.ɵɵnextContext(2);t.ɵɵstyleMap(t.ɵɵpureFunction1(10,yj,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.ɵɵproperty("ngIf",a.isArray(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",a.isObject(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!a.isObject(e.value)&&!a.isArray(e.value))}}function Pj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",6)(1,"mat-expansion-panel-header")(2,"mat-panel-title",7)(3,"span",8),t.ɵɵtext(4),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-panel-description")(6,"button",9),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",10),t.ɵɵtext(8,"delete"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",11),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",10),t.ɵɵtext(11,"play_arrow"),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(12,bj,1,4,"ng-container",12),t.ɵɵpipe(13,"keyValueIsNotEmpty"),t.ɵɵtemplate(14,kj,13,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.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(13,3,e.config))}}class Dj{constructor(e){this.attributeService=e,this.saveTemplate=new u,this.useTemplate=new u,this.ConnectorType=dt,this.originalOrder=()=>0,this.isObject=e=>De(e),this.isArray=e=>Array.isArray(e),this.SNMPMethodsTranslations=cj}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},D.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||Dj)(t.ɵɵdirectiveInject(_e.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Dj,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:4,vars:4,consts:[["RPCTemplateRef",""],["value",""],["SNMPMethod",""],["RPCObjectRow",""],[1,"mat-subtitle-1","title"],["hideToggle","",4,"ngFor","ngForOf"],["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",4,"ngFor","ngForOf"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"rpc-params-row","flex"],[1,"template-key"],["tbTruncateWithTooltip","","class","array-value",4,"ngIf"],[3,"ngTemplateOutlet",4,"ngIf"],[3,"class",4,"ngIf"],["tbTruncateWithTooltip","",1,"array-value"],[3,"ngTemplateOutlet"],[3,"ngTemplateOutlet",4,"ngIf","ngIfElse"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,Pj,16,5,"mat-expansion-panel",5)),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,"gateway.rpc.templates-title")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcTemplates))},dependencies:t.ɵɵgetComponentDepsFactory(Dj,[j,_,hj,gj]),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 Oj(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 Aj(e,n){1&e&&(t.ɵɵelementStart(0,"div",12),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",Dj);class Fj extends A{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("",[$.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||Fj)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Fj,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["class","mat-mdc-form-field-error","style","margin-top: -15px; padding-left: 10px; font-size: 14px;",4,"ngIf"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"mat-mdc-form-field-error",2,"margin-top","-15px","padding-left","10px","font-size","14px"]],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,Oj,3,3,"mat-error",7),t.ɵɵelementEnd(),t.ɵɵtemplate(12,Aj,3,3,"div",8),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",9)(14,"button",10),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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.ɵɵproperty("ngIf",n.templateNameCtrl.hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.validateDuplicateName(n.templateNameCtrl)),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(Fj,[j,_]),encapsulation:2})}}function Rj(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",6),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 Bj(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.username-required"))}function Nj(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.password-required"))}function Lj(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7)(2,"div",8),t.ɵɵtext(3,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",9)(5,"mat-form-field",10),t.ɵɵelement(6,"input",11),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,Bj,3,3,"mat-icon",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",7)(10,"div",8),t.ɵɵtext(11,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"div",9)(13,"mat-form-field",10),t.ɵɵelement(14,"input",13),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,Nj,3,3,"mat-icon",12),t.ɵɵelementStart(17,"div",14),t.ɵɵelement(18,"tb-toggle-password",15),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("password").hasError("required")&&e.securityFormGroup.get("password").touched),t.ɵɵadvance(),t.ɵɵclassProp("hide-toggle",e.securityFormGroup.get("password").hasError("required"))}}e("GatewayServiceRPCConnectorTemplateDialogComponent",Fj);class Vj{constructor(e){this.fb=e,this.BrokerSecurityType=uj,this.securityTypes=Object.values(uj),this.SecurityTypeTranslationsMap=mj,this.destroy$=new te,this.propagateChange=e=>{},this.securityFormGroup=this.fb.group({type:[uj.ANONYMOUS,[]],username:["",[$.required,$.pattern(rn)]],password:["",[$.required,$.pattern(rn)]]}),this.observeSecurityForm()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){e.type||(e.type=uj.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===uj.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(le(this.destroy$)).subscribe((e=>this.updateView(e))),this.securityFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.updateValidators(e)))}static{this.ɵfac=function(e){return new(e||Vj)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Vj,selectors:[["tb-rest-connector-security"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>Vj)),multi:!0},{provide:K,useExisting:c((()=>Vj)),multi:!0}]),t.ɵɵStandaloneFeature],decls:7,vars:3,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",4,"ngFor","ngForOf"],[4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(5,Rj,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵtemplate(6,Lj,19,10,"ng-container",5),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value===n.BrokerSecurityType.BASIC))},dependencies:t.ɵɵgetComponentDepsFactory(Vj,[_,j]),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",Vj);const qj=e=>({type:e});function Gj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 zj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 Uj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",9),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",11),t.ɵɵtemplate(10,Gj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",13),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-form-field",15)(18,"mat-label"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-select",16),t.ɵɵtemplate(22,zj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",17),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"mat-form-field",10)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,8,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,10,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetRequestTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,12,"gateway.rpc.requestTimeout")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,14,"gateway.rpc.objectType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetObjectTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,16,"gateway.rpc.identifier")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,18,"gateway.rpc.propertyId"))}}function jj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 Hj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",21),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",10)(11,"mat-label"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-select",22),t.ɵɵtemplate(15,jj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"mat-slide-toggle",23),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,7,"gateway.rpc.characteristicUUID")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bLEMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.rpc.withResponse")," ")}}function Wj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 $j(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",24),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",25),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",26),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-slide-toggle",27),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-slide-toggle",28),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",14)(20,"mat-form-field",15)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",15)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-select",30),t.ɵɵtemplate(30,Wj,3,4,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",14)(32,"mat-form-field",15)(33,"mat-label"),t.ɵɵtext(34),t.ɵɵpipe(35,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(36,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",15)(38,"mat-label"),t.ɵɵtext(39),t.ɵɵpipe(40,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(41,"input",32),t.ɵɵelementEnd()(),t.ɵɵelementStart(42,"mat-form-field")(43,"mat-label"),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(46,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(47,"mat-form-field")(48,"mat-label"),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(51,"input",34),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,14,"gateway.rpc.nodeID")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,16,"gateway.rpc.isExtendedID")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,18,"gateway.rpc.isFD")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,20,"gateway.rpc.bitrateSwitch")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,22,"gateway.rpc.dataLength")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,24,"gateway.rpc.dataByteorder")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.cANByteOrders),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(35,26,"gateway.rpc.dataBefore")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(40,28,"gateway.rpc.dataAfter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(45,30,"gateway.rpc.dataInHEX")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(50,32,"gateway.rpc.dataExpression"))}}function Kj(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),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 Yj(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 Xj(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 Zj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 Qj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",45)(1,"mat-form-field",46),t.ɵɵelement(2,"input",47),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-icon",48),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 Jj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",39),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵtemplate(10,Zj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-slide-toggle",38),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"fieldset",41)(15,"span",42),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(18,Qj,6,4,"div",43),t.ɵɵelementStart(19,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addSNMPoid())})),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,7,"gateway.rpc.requestFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,9,"gateway.rpc.method")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sNMPMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,11,"gateway.rpc.withResponse")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(17,13,"gateway.rpc.oids"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",e.getFormArrayControls("oid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,15,"gateway.rpc.add-oid")," ")}}function eH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function tH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",65),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",64),t.ɵɵelement(5,"input",66),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-icon",67),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 nH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,tH,9,4,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function iH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",49),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",14)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,eH,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",14)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",54),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",55),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"fieldset",56)(39,"span",42),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(42,nH,11,7,"div",57),t.ɵɵelementStart(43,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,11,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,13,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,15,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,17,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,19,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,21,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,23,"gateway.rpc.valueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,25,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(45,27,"gateway.rpc.add-header")," ")}}function aH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function rH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",73),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",64),t.ɵɵelement(6,"input",74),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-icon",67),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 oH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,rH,10,7,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function sH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",68),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",59)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,aH,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",59)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",69),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",70),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",71),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field")(39,"mat-label"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",72),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"fieldset",56)(44,"span",42),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(47,oH,11,7,"div",57),t.ɵɵelementStart(48,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,14,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,16,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,18,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,20,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,22,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,24,"gateway.rpc.requestValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,26,"gateway.rpc.responseValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(46,28,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(50,30,"gateway.rpc.add-header")," ")}}function lH(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 pH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",75),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",76),t.ɵɵelementStart(10,"mat-icon",77),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,lH,3,3,"mat-error",78),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.ɵɵproperty("ngIf",e.commandForm.get("params").hasError("invalidJSON"))}}function cH(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,6),t.ɵɵtemplate(1,Uj,33,20,"ng-template",7)(2,Hj,19,13,"ng-template",7)(3,$j,52,34,"ng-template",7)(4,Kj,10,6,"ng-template",7)(5,Yj,13,9,"ng-template",7)(6,Xj,13,9,"ng-template",7)(7,Jj,22,17,"ng-template",7)(8,iH,46,29,"ng-template",7)(9,sH,51,32,"ng-template",7)(10,pH,14,10,"ng-template",8),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.CAN),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.FTP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OCPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.XMPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SNMP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REQUEST)}}class dH{constructor(e,t){this.fb=e,this.dialog=t,this.sendCommand=new u,this.saveTemplate=new u,this.ConnectorType=dt,this.bACnetRequestTypes=Object.values(ej),this.bACnetObjectTypes=Object.values(nj),this.bLEMethods=Object.values(aj),this.cANByteOrders=Object.values(oj),this.sNMPMethods=Object.values(pj),this.hTTPMethods=Object.values(gt),this.bACnetRequestTypesTranslates=tj,this.bACnetObjectTypesTranslates=ij,this.bLEMethodsTranslates=rj,this.SNMPMethodsTranslations=cj,this.gatewayConnectorDefaultTypesTranslates=ut,this.urlPattern=/^[-a-zA-Zd_$:{}?~+=\/.0-9-]*$/,this.numbersOnlyPattern=/^[0-9]*$/,this.hexOnlyPattern=/^[0-9A-Fa-f ]+$/,this.propagateChange=e=>{},this.destroy$=new te}ngOnInit(){this.commandForm=this.connectorParamsFormGroupByType(this.connectorType),this.observeFormChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}connectorParamsFormGroupByType(e){let t;switch(e){case dt.BACNET:t=this.fb.group({method:[null,[$.required,$.pattern(rn)]],requestType:[null,[$.required,$.pattern(rn)]],requestTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],objectType:[null,[]],identifier:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],propertyId:[null,[$.required,$.pattern(rn)]]});break;case dt.BLE:t=this.fb.group({methodRPC:[null,[$.required,$.pattern(rn)]],characteristicUUID:["00002A00-0000-1000-8000-00805F9B34FB",[$.required,$.pattern(rn)]],methodProcessing:[null,[$.required]],withResponse:[!1,[]]});break;case dt.CAN:t=this.fb.group({method:[null,[$.required,$.pattern(rn)]],nodeID:[null,[$.required,$.min(0),$.pattern(this.numbersOnlyPattern)]],isExtendedID:[!1,[]],isFD:[!1,[]],bitrateSwitch:[!1,[]],dataLength:[null,[$.min(1),$.pattern(this.numbersOnlyPattern)]],dataByteorder:[null,[]],dataBefore:[null,[$.pattern(rn),$.pattern(this.hexOnlyPattern)]],dataAfter:[null,[$.pattern(rn),$.pattern(this.hexOnlyPattern)]],dataInHEX:[null,[$.pattern(rn),$.pattern(this.hexOnlyPattern)]],dataExpression:[null,[$.pattern(rn)]]});break;case dt.FTP:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],valueExpression:[null,[$.required,$.pattern(rn)]]});break;case dt.OCPP:case dt.XMPP:t=this.fb.group({methodRPC:[null,[$.required,$.pattern(rn)]],valueExpression:[null,[$.required,$.pattern(rn)]],withResponse:[!1,[]]});break;case dt.SNMP:t=this.fb.group({requestFilter:[null,[$.required,$.pattern(rn)]],method:[null,[$.required]],withResponse:[!1,[]],oid:this.fb.array([],[$.required])});break;case dt.REST:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],httpMethod:[null,[$.required]],requestUrlExpression:[null,[$.required,$.pattern(this.urlPattern)]],responseTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],timeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],tries:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],valueExpression:[null,[$.required,$.pattern(rn)]],httpHeaders:this.fb.array([]),security:[{},[$.required]]});break;case dt.REQUEST:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],httpMethod:[null,[$.required]],requestUrlExpression:[null,[$.required,$.pattern(this.urlPattern)]],responseTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],timeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],tries:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],requestValueExpression:[null,[$.required,$.pattern(rn)]],responseValueExpression:[null,[$.pattern(rn)]],httpHeaders:this.fb.array([])});break;default:t=this.fb.group({command:[null,[$.required,$.pattern(rn)]],params:[{},[lt]]})}return t}addSNMPoid(e=null){const t=this.commandForm.get("oid");t&&t.push(this.fb.control(e,[$.required,$.pattern(rn)]),{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,[$.required,$.pattern(rn)]],value:[e.value,[$.required,$.pattern(rn)]]});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(nt,{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=Oe(e),this.connectorType){case dt.SNMP:this.clearFromArrayByName("oid"),e.oid.forEach((e=>{this.addSNMPoid(e)})),delete e.oid;break;case dt.REQUEST:case dt.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(le(this.destroy$)).subscribe((e=>{this.connectorType!==dt.REST&&this.connectorType!==dt.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||dH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(qe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:dH,selectors:[["tb-gateway-service-rpc-connector"]],inputs:{connectorType:"connectorType"},outputs:{sendCommand:"sendCommand",saveTemplate:"saveTemplate"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>dH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:12,vars:16,consts:[[1,"command-form","flex","flex-col",3,"formGroup"],[1,"mat-subtitle-1","title"],[3,"ngIf"],[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"],[3,"ngSwitch"],[3,"ngSwitchCase"],["ngSwitchDefault",""],["matInput","","formControlName","method","placeholder","set_state"],[1,"mat-block"],["formControlName","requestType"],[3,"value",4,"ngFor","ngForOf"],["matInput","","formControlName","requestTimeout","type","number","min","10","step","1","placeholder","1000"],[1,"flex","flex-1","flex-row","gap-2.5"],[1,"flex-1"],["formControlName","objectType"],["matInput","","formControlName","identifier","type","number","min","1","step","1","placeholder","1"],["matInput","","formControlName","propertyId","placeholder","presentValue"],[3,"value"],["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"],["class","flex flex-1 flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","flex-row","items-center","justify-center","gap-2.5"],["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"],[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"],["class","flex flex-col gap-2.5 border",4,"ngIf"],[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"],["class","flex flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],[3,"formGroupName"],["appearance","outline",1,"flex-1"],["matInput","","formControlName","headerName"],["matInput","","formControlName","value","placeholder","application/json"],[2,"cursor","pointer","width","30px",3,"click","matTooltip"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","1"],["matInput","","formControlName","requestValueExpression","placeholder","${params}"],["matInput","","formControlName","responseValueExpression","placeholder","${temp}"],["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"],[4,"ngIf"]],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,cH,11,10,"ng-template",2),t.ɵɵelementStart(5,"div",3)(6,"button",4),t.ɵɵlistener("click",(function(){return n.save()})),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",5),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,qj,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorType),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(dH,[j,_]),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 uH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function mH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),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 hH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function gH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function fH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"mat-form-field",3)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",14),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,gH,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.ɵɵproperty("ngIf",e.rpcParametersFormGroup.get("value").hasError("required")&&e.rpcParametersFormGroup.get("value").touched)}}class yH{constructor(e){this.fb=e,this.ModbusEditableDataTypes=Kt,this.ModbusFunctionCodeTranslationsMap=Qt,this.modbusDataTypes=Object.values($t),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 te,this.rpcParametersFormGroup=this.fb.group({type:[$t.BYTES,[$.required]],functionCode:[this.defaultFunctionCodes[0],[$.required]],value:[{value:"",disabled:!0},[$.required,$.pattern(rn)]],address:[null,[$.required]],objectsCount:[1,[$.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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeKeyDataType(){this.rpcParametersFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.ModbusEditableDataTypes.includes(e)||this.rpcParametersFormGroup.get("objectsCount").patchValue(Yt[e],{emitEvent:!1}),this.updateFunctionCodes(e)}))}observeFunctionCode(){this.rpcParametersFormGroup.get("functionCode").valueChanges.pipe(le(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===$t.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||yH)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yH,selectors:[["tb-gateway-modbus-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>yH)),multi:!0},{provide:K,useExisting:c((()=>yH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:35,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"],[1,"flex-1"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["formControlName","functionCode"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],["class","flex",4,"ngIf"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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.ɵɵtemplate(13,uH,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-form-field",3)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-select",6),t.ɵɵtemplate(19,mH,3,4,"mat-option",5),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",2)(21,"mat-form-field",3)(22,"mat-label"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",7),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,hH,3,3,"mat-icon",8),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",3)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",9),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,fH,8,7,"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.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(17,20,"gateway.rpc.functionCode")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.functionCodes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,22,"gateway.rpc.address")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.rpcParametersFormGroup.get("address").hasError("required")&&n.rpcParametersFormGroup.get("address").touched),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,26,"gateway.rpc.objectsCount")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,28,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(n.rpcParametersFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.writeFunctionCodes.includes(n.rpcParametersFormGroup.get("functionCode").value)))},dependencies:t.ɵɵgetComponentDepsFactory(yH,[j,_]),styles:['@charset "UTF-8";[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:d.OnPush})}}function vH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 xH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 bH{constructor(e){this.fb=e,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new te,this.rpcParametersFormGroup=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],requestTopicExpression:[null,[$.required,$.pattern(rn)]],responseTopicExpression:[{value:null,disabled:!0},[$.required,$.pattern(rn)]],responseTimeout:[{value:null,disabled:!0},[$.min(10),$.pattern(on)]],valueExpression:[null,[$.required,$.pattern(rn)]],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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeWithResponse(){this.rpcParametersFormGroup.get("withResponse").valueChanges.pipe(me((e=>this.toggleResponseFields(e))),le(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||bH)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bH,selectors:[["tb-gateway-mqtt-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>bH)),multi:!0},{provide:K,useExisting:c((()=>bH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","requestTopicExpression","placeholder","sensor/${deviceName}/request/${methodName}/${requestId}"],["formControlName","withResponse",1,"margin",3,"click"],[4,"ngIf"],["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")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",1),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-slide-toggle",3),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,vH,5,3,"mat-form-field",4)(15,xH,5,3,"mat-form-field",4),t.ɵɵelementStart(16,"mat-form-field")(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.ɵɵproperty("ngIf",null==(e=n.rpcParametersFormGroup.get("withResponse"))?null:e.value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",null==(i=n.rpcParametersFormGroup.get("withResponse"))?null:i.value),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(19,13,"gateway.rpc.valueExpression"))}},dependencies:t.ɵɵgetComponentDepsFactory(bH,[j,_]),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 wH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",26),t.ɵɵelement(1,"mat-icon",27),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 SH(e,n){1&e&&(t.ɵɵelement(0,"input",28),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function CH(e,n){1&e&&(t.ɵɵelement(0,"input",29),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function _H(e,n){1&e&&(t.ɵɵelement(0,"input",30),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function TH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",31)(1,"mat-option",26),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",26),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function IH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",32),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function EH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"div",9)(2,"div",10),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12)(6,"mat-select",13)(7,"mat-select-trigger")(8,"div",14),t.ɵɵelement(9,"mat-icon",15),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(13,wH,5,5,"mat-option",16),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",17)(15,"div",10),t.ɵɵtext(16,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-form-field",18),t.ɵɵelementContainerStart(18,19),t.ɵɵtemplate(19,SH,2,3,"input",20)(20,CH,2,3,"input",21)(21,_H,2,3,"input",22)(22,TH,5,2,"mat-select",23),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(23,IH,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",25),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;const a=n.$implicit,r=t.ɵɵnextContext();t.ɵɵproperty("formGroup",a),t.ɵɵadvance(9),t.ɵɵproperty("svgIcon",null==(e=r.valueTypes.get(a.get("type").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,11,null==(i=r.valueTypes.get(a.get("type").value))?null:i.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",r.valueTypeKeys),t.ɵɵadvance(5),t.ɵɵproperty("ngSwitch",a.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",a.get(a.get("type").value+"Value").hasError("required")&&a.get(a.get("type").value+"Value").touched),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(25,13,"gateway.rpc.remove"))}}class MH{constructor(e,t){this.fb=e,this.cdr=t,this.valueTypeKeys=Object.values(Xt),this.MappingValueType=Xt,this.valueTypes=Zt,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new te,this.rpcParametersFormGroup=this.fb.group({method:[null,[$.required,$.pattern(rn)]],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(le(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??Xt.STRING],stringValue:[e.stringValue??{value:"",disabled:!(Se(e,{})||e.stringValue)},[$.required,$.pattern(rn)]],integerValue:[{value:e.integerValue??0,disabled:!ke(e.integerValue)},[$.required,$.pattern(on)]],doubleValue:[{value:e.doubleValue??0,disabled:!ke(e.doubleValue)},[$.required]],booleanValue:[{value:e.booleanValue??!1,disabled:!ke(e.booleanValue)},[$.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(le(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||MH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:MH,selectors:[["tb-gateway-opc-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>MH)),multi:!0},{provide:K,useExisting:c((()=>MH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:18,vars:14,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","tb-flex","no-padding-top","hint-container"],[1,"tb-flex"],["matInput","","formControlName","method","placeholder","multiply"],["formArrayName","arguments",1,"tb-form-panel","stroked","arguments-container"],[1,"fields-label"],["class","flex flex-1 items-center justify-center gap-2.5",3,"formGroup",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","items-center","justify-center","gap-2.5",3,"formGroup"],[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",4,"ngFor","ngForOf"],[1,"tb-form-row","column-xs","value-container","item-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","matTooltip"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["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"]],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.ɵɵtemplate(14,EH,28,15,"div",6),t.ɵɵelementStart(15,"button",7),t.ɵɵlistener("click",(function(){return n.addArgument()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,6,"gateway.rpc.hint.opc-method")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,8,"gateway.rpc.method")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,10,"gateway.rpc.arguments")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcParametersFormGroup.get("arguments").controls),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,12,"gateway.rpc.add-argument")," "))},dependencies:t.ɵɵgetComponentDepsFactory(MH,[j,_]),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 kH(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.SocketMethodProcessingsTranslates.get(e))," ")}}function PH(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.toUpperCase()," ")}}class DH extends Ba{constructor(){super(...arguments),this.SocketMethodProcessingsTranslates=lj,this.socketMethodProcessings=Object.values(sj),this.socketEncoding=Object.values(ht)}initFormGroup(){return this.fb.group({methodRPC:[null,[$.required,$.pattern(rn)]],methodProcessing:[sj.WRITE,[$.required]],encoding:[dj.UTF_8,[$.required,$.pattern(rn)]],withResponse:[!1,[]]})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(DH)))(n||DH)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:DH,selectors:[["tb-gateway-socket-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>DH)),multi:!0},{provide:K,useExisting:c((()=>DH)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],[1,"w-full"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],[1,"mat-block"],["formControlName","methodProcessing"],[3,"value",4,"ngFor","ngForOf"],["formControlName","encoding"],["formControlName","withResponse",1,"mat-slide","margin"],[3,"value"]],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.ɵɵtemplate(11,kH,3,4,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",3)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-select",6),t.ɵɵtemplate(17,PH,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"mat-slide-toggle",7),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketMethodProcessings),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,11,"gateway.encoding")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(20,13,"gateway.rpc.withResponse")," "))},dependencies:t.ɵɵgetComponentDepsFactory(DH,[j,_]),encapsulation:2,changeDetection:d.OnPush})}}const OH=e=>({border:e}),AH=e=>({type:e});function FH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",15),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function RH(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 BH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",9),t.ɵɵtemplate(6,FH,2,2,"mat-option",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",11)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",12),t.ɵɵtemplate(12,RH,3,3,"mat-error",13),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",14),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(),t.ɵɵelementContainerEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.RPCCommands),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,8,"gateway.statistics.timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.commandForm.get("time").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("disabled",e.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,10,"gateway.rpc-command-send")," ")}}function NH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector",17),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 LH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-modbus-rpc-parameters",24)}function VH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-mqtt-rpc-parameters",24)}function qH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-opc-rpc-parameters",24)}function GH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-socket-rpc-parameters",24)}function zH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",18)(1,"div",19),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(4,20),t.ɵɵtemplate(5,LH,1,0,"tb-gateway-modbus-rpc-parameters",21)(6,VH,1,0,"tb-gateway-mqtt-rpc-parameters",21)(7,qH,1,0,"tb-gateway-opc-rpc-parameters",21)(8,GH,1,0,"tb-gateway-socket-rpc-parameters",21),t.ɵɵelementContainerEnd(),t.ɵɵelementStart(9,"div",22)(10,"button",23),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",14),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){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,10,"gateway.rpc.title",t.ɵɵpureFunction1(17,AH,e.gatewayConnectorDefaultTypesTranslates.get(e.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,13,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,15,"gateway.rpc-command-send")," ")}}function UH(e,n){if(1&e&&t.ɵɵtemplate(0,NH,1,1,"tb-gateway-service-rpc-connector",16)(1,zH,16,19,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2),n=t.ɵɵnextContext();t.ɵɵproperty("ngIf",!n.typesWithUpdatedParams.has(n.connectorType))("ngIfElse",e)}}function jH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",25)(1,"mat-icon",26),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 HH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector-templates",27),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 WH{constructor(e,t,n,i,a){this.fb=e,this.dialog=t,this.utils=n,this.cd=i,this.attributeService=a,this.contentTypes=V,this.RPCCommands=["Ping","Stats","Devices","Update","Version","Restart","Reboot"],this.templates=[],this.ConnectorType=dt,this.gatewayConnectorDefaultTypesTranslates=ut,this.typesWithUpdatedParams=new Set([dt.MQTT,dt.OPCUA,dt.MODBUS,dt.SOCKET]),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,[$.required]],time:[60,[$.required,$.min(1)]],params:["{}",[lt]],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(R.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 dt.MQTT:case dt.FTP:case dt.SNMP:case dt.REST:case dt.REQUEST:return e.methodFilter;case dt.MODBUS:return this.modbusReadFunctionCodes.includes(e.functionCode)?"get":"set";case dt.BACNET:case dt.CAN:case dt.OPCUA:return e.method;case dt.BLE:case dt.OCPP:case dt.SOCKET:case dt.XMPP:return e.methodRPC;default:return e.command}}saveTemplate(){this.dialog.open(Fj,{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},D.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||WH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(_e.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:WH,selectors:[["tb-gateway-service-rpc"]],inputs:{ctx:"ctx",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:12,vars:14,consts:[["connectorForm",""],["updatedParameters",""],[1,"flex","flex-1","flex-col"],[1,"command-form","flex","flex-row","gap-2.5","lt-sm:flex-col",3,"formGroup"],[4,"ngIf","ngIfElse"],[1,"result-block",3,"formGroup"],["class","result-time flex flex-1 flex-row items-center justify-center",4,"ngIf"],["readonly","true","formControlName","result",3,"contentType"],["class","border",3,"rpcTemplates","ctx","connectorType","useTemplate",4,"ngIf"],["formControlName","command"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","formControlName","time","type","number","min","1"],[4,"ngIf"],["mat-raised-button","","color","primary",3,"click","disabled"],[3,"value"],["formControlName","params",3,"connectorType","sendCommand","saveTemplate",4,"ngIf","ngIfElse"],["formControlName","params",3,"sendCommand","saveTemplate","connectorType"],[1,"rpc-parameters","flex","flex-col"],[1,"mat-subtitle-1","tb-form-panel-title"],[3,"ngSwitch"],["formControlName","params",4,"ngSwitchCase"],[1,"fex-row","template-actions","flex","flex-1","items-center","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],["formControlName","params"],[1,"result-time","flex","flex-1","flex-row","items-center","justify-center"],[1,"material-icons"],[1,"border",3,"useTemplate","rpcTemplates","ctx","connectorType"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",2)(1,"div",3),t.ɵɵtemplate(2,BH,16,12,"ng-container",4)(3,UH,3,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"section",5)(6,"span"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,jH,6,4,"div",6),t.ɵɵelementEnd(),t.ɵɵelement(10,"tb-json-content",7),t.ɵɵelementEnd()(),t.ɵɵtemplate(11,HH,1,3,"tb-gateway-service-rpc-connector-templates",8)),2&e){const e=t.ɵɵreference(4);t.ɵɵclassMap(t.ɵɵpureFunction1(12,OH,n.isConnector)),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.isConnector)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(8,10,"gateway.rpc-command-result")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.resultTime),t.ɵɵadvance(),t.ɵɵproperty("contentType",n.contentTypes.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isConnector)}},dependencies:t.ɵɵgetComponentDepsFactory(WH,[j,_,dH,yH,bH,MH,Dj,DH]),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 $H(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",WH);class KH extends A{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||KH)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:KH,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["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,$H,3,3,"mat-error",9),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",10)(18,"button",11),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",12),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.ɵɵproperty("ngIf",n.gatewayControl.hasError("required")),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(KH,[j,_]),encapsulation:2})}}var YH;e("GatewayRemoteConfigurationDialogComponent",KH),function(e){e.tls="tls",e.accessToken="accessToken"}(YH||(YH={}));const XH="configuration_drafts",ZH="RemoteLoggingLevel",QH=new Map([[YH.tls,"gateway.security-types.tls"],[YH.accessToken,"gateway.security-types.access-token"]]);var JH,eW;!function(e){e.none="NONE",e.critical="CRITICAL",e.error="ERROR",e.warning="WARNING",e.info="INFO",e.debug="DEBUG"}(JH||(JH={})),function(e){e.memory="memory",e.file="file"}(eW||(eW={}));const tW=new Map([[eW.memory,"gateway.storage-types.memory-storage"],[eW.file,"gateway.storage-types.file-storage"]]);var nW;!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"}(nW||(nW={}));const iW={config:{},name:"",configType:null,enabled:!1};function aW(e){return JSON.stringify(e.value)===JSON.stringify({})?{validJSON:!0}:null}function rW(e){return e.replace("_","").replace("-","").replace(/^\s+|\s+/g,"").toLowerCase()+".json"}function oW(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 sW(e){return{id:e,entityType:L.DEVICE}}function lW(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,YH.accessToken)?(t.securityType=YH.accessToken,t.accessToken=e.thingsboard.security.accessToken):(t.securityType=YH.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===eW.memory?(t.storageType=eW.memory,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count):e.storage.type===eW.file&&(t.storageType=eW.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 pW(e){const t={};for(const n of e)n.enabled||(t[n.name]={connector:n.configType,config:n.config});return t}function cW(e){const t={thingsboard:dW(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 dW(e){let t;t=e.securityType===YH.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===eW.memory?{type:eW.memory,read_records_count:e.readRecordsCount,max_records_count:e.maxRecordsCount}:{type:eW.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:rW(t.name),name:t.name,type:t.configType};a.push(e)}return{thingsboard:n,connectors:a,storage:i,logs:window.btoa(oW(e.remoteLoggingLevel,e.remoteLoggingPathToLogs))}}const uW=["formContainer"],mW=(e,t,n)=>({"gap-1.25":e,"flex-row":t,"flex-col":n}),hW=(e,t,n)=>({"gap-1.25":e,"flex-row justify-end item-center":t,"flex-col justify-evenly item-center":n});function gW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 fW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-host-required "),t.ɵɵelementEnd())}function yW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-required "),t.ɵɵelementEnd())}function vW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-min "),t.ɵɵelementEnd())}function xW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-max "),t.ɵɵelementEnd())}function bW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-pattern "),t.ɵɵelementEnd())}function wW(e,n){1&e&&(t.ɵɵelementStart(0,"div",16)(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",30),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",32),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 SW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function CW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.path-logs-required "),t.ɵɵelementEnd())}function _W(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 TW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-required "),t.ɵɵelementEnd())}function IW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-min "),t.ɵɵelementEnd())}function EW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-pattern "),t.ɵɵelementEnd())}function MW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-required "),t.ɵɵelementEnd())}function kW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-min "),t.ɵɵelementEnd())}function PW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-pattern "),t.ɵɵelementEnd())}function DW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-required "),t.ɵɵelementEnd())}function OW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-min "),t.ɵɵelementEnd())}function AW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-pattern "),t.ɵɵelementEnd())}function FW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-path-required "),t.ɵɵelementEnd())}function RW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"mat-form-field",8)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",33),t.ɵɵtemplate(6,DW,2,0,"mat-error",10)(7,OW,2,0,"mat-error",10)(8,AW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",8)(10,"mat-label"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",34),t.ɵɵtemplate(14,FW,2,0,"mat-error",10),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction3(12,mW,e.layoutGap,e.alignment,!e.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.storage-max-files")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,10,"gateway.storage-path")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("dataFolderPath").hasError("required"))}}function BW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function NW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.connector-type-required "),t.ɵɵelementEnd())}function LW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.connector-name-required "),t.ɵɵelementEnd())}function VW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",35)(1,"div",36)(2,"div",37),t.ɵɵelement(3,"mat-slide-toggle",38),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",39)(5,"mat-form-field",8)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵlistener("selectionChange",(function(){const n=t.ɵɵrestoreView(e).$implicit,i=t.ɵɵnextContext();return t.ɵɵresetView(i.changeConnectorType(n))})),t.ɵɵtemplate(10,BW,2,2,"mat-option",7),t.ɵɵelementEnd(),t.ɵɵtemplate(11,NW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",8)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"input",41),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(17,LW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",42)(19,"button",43),t.ɵɵpipe(20,"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(21,"mat-icon"),t.ɵɵtext(22,"more_horiz"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",43),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.removeConnector(n))})),t.ɵɵelementStart(25,"mat-icon"),t.ɵɵtext(26,"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(24,mW,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,16,"gateway.connector-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",a.connectorTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("configType").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,18,"gateway.connector-name")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.get("name").hasError("required")),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction3(28,hW,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(),t.ɵɵclassProp("mat-warn",e.get("config").invalid),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,20,"gateway.update-config")),t.ɵɵproperty("disabled",a.isReadOnlyForm),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,22,"gateway.delete")),t.ɵɵproperty("disabled",a.isReadOnlyForm)}}function qW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",44),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 GW(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",45),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 zW extends q{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=QH,this.gatewayLogLevels=Object.keys(JH).map((e=>JH[e])),this.connectorTypes=Object.keys(nW),this.storageTypes=tW,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(sW(i),n,[a])}createConnector(e=iW){this.connectors.push(this.fb.group({enabled:[e.enabled],configType:[e.configType,[$.required]],name:[e.name,[$.required]],config:[e.config,[$.nullValidator,aW]]}))}getFormField(e){return this.gatewayConfigurationGroup.get(e)}buildForm(){this.gatewayConfigurationGroup=this.fb.group({gateway:[null,[]],accessToken:[null,[$.required]],securityType:[YH.accessToken],host:[this.window.location.hostname,[$.required]],port:[1883,[$.required,$.min(1),$.max(65535),$.pattern(/^-?[0-9]+$/)]],remoteConfiguration:[!0],caCertPath:["/etc/thingsboard-gateway/ca.pem"],privateKeyPath:["/etc/thingsboard-gateway/privateKey.pem"],certPath:["/etc/thingsboard-gateway/certificate.pem"],remoteLoggingLevel:[JH.debug],remoteLoggingPathToLogs:["./logs/",[$.required]],storageType:[eW.memory],readRecordsCount:[100,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],maxRecordsCount:[1e4,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],maxFilesCount:[5,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],dataFolderPath:["./data/",[$.required]],connectors:this.fb.array([])}),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1}),this.subscribeStorageType$=this.getFormField("storageType").valueChanges.subscribe((e=>{e===eW.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?oe([this.deviceService.getDeviceCredentials(e).pipe(me((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===YH.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===eW.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: "+rW(n.name)+"\n");return t}(e),function(e,t){for(const n of t)n.enabled&&(e[rW(n.name)]=JSON.stringify(n.config))}(t,e.connectors),n=t,i=e.remoteLoggingLevel,a=e.remoteLoggingPathToLogs,n["logs.conf"]=oW(i,a),this.importExport.exportJSZip(t,this.archiveFileName),this.saveAttribute(ZH,this.gatewayConfigurationGroup.value.remoteLoggingLevel.toUpperCase(),D.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(nt,{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(oe([this.getAttribute("current_configuration",D.CLIENT_SCOPE,e),this.getAttribute(XH,D.SERVER_SCOPE,e)]).pipe(me((([e,t])=>{this.setFormGatewaySettings(e),this.setFormConnectorsDraft(t),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1})})))),t.push(this.getAttribute(ZH,D.SHARED_SCOPE,e).pipe(me((e=>this.processLoggingLevel(e))))),t}getAttribute(e,t,n){return this.attributeService.getEntityAttributes(sW(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(lW(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=JH.debug;e.length>0&&JH[e[0].value.toLowerCase()]&&(t=JH[e[0].value.toLowerCase()]),this.getFormField("remoteLoggingLevel").patchValue(t)}static{this.ɵfac=function(e){return new(e||zW)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(t.ElementRef),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(Ce),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(_e.DeviceService),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(it.ImportExportService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:zW,selectors:[["tb-gateway-form"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(uW,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:104,vars:104,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"],[1,"flex"],["formControlName","securityType"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","type","text","formControlName","host"],["translate","",4,"ngIf"],["matInput","","type","number","formControlName","port"],["class","flex flex-col",4,"ngIf"],["formControlName","remoteConfiguration"],["formControlName","remoteLoggingLevel"],["matInput","","type","text","formControlName","remoteLoggingPathToLogs"],[1,"flex","flex-col"],["formControlName","storageType"],["matInput","","type","number","formControlName","readRecordsCount"],["matInput","","type","number","formControlName","maxRecordsCount"],["class","flex",3,"class",4,"ngIf"],[1,"gateway-config","flex","flex-col"],["formArrayName","connectors",4,"ngFor","ngForOf"],[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","click",4,"ngIf"],["mat-raised-button","","color","primary","type","submit",3,"disabled","matTooltip",4,"ngIf"],[3,"value"],["translate",""],["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"],["formArrayName","connectors"],[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"],["mat-raised-button","","color","primary","type","submit",3,"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.ɵɵtemplate(16,gW,3,4,"mat-option",7),t.ɵɵpipe(17,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",5)(19,"mat-form-field",8)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",9),t.ɵɵtemplate(24,fW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",8)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(29,"input",11),t.ɵɵtemplate(30,yW,2,0,"mat-error",10)(31,vW,2,0,"mat-error",10)(32,xW,2,0,"mat-error",10)(33,bW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,wW,16,9,"div",12),t.ɵɵelementStart(35,"mat-checkbox",13),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"div",5)(39,"mat-form-field",8)(40,"mat-label"),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-select",14),t.ɵɵtemplate(44,SW,2,2,"mat-option",7),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"mat-form-field",8)(46,"mat-label"),t.ɵɵtext(47),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",15),t.ɵɵtemplate(50,CW,2,0,"mat-error",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(51,"mat-expansion-panel")(52,"mat-expansion-panel-header")(53,"mat-panel-title")(54,"div",3),t.ɵɵtext(55),t.ɵɵpipe(56,"translate"),t.ɵɵpipe(57,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(58,"div",16)(59,"mat-form-field")(60,"mat-label"),t.ɵɵtext(61),t.ɵɵpipe(62,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"mat-select",17),t.ɵɵtemplate(64,_W,3,4,"mat-option",7),t.ɵɵpipe(65,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(66,"div",5)(67,"mat-form-field",8)(68,"mat-label"),t.ɵɵtext(69),t.ɵɵpipe(70,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(71,"input",18),t.ɵɵtemplate(72,TW,2,0,"mat-error",10)(73,IW,2,0,"mat-error",10)(74,EW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(75,"mat-form-field",8)(76,"mat-label"),t.ɵɵtext(77),t.ɵɵpipe(78,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(79,"input",19),t.ɵɵtemplate(80,MW,2,0,"mat-error",10)(81,kW,2,0,"mat-error",10)(82,PW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(83,RW,15,16,"div",20),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"mat-expansion-panel")(85,"mat-expansion-panel-header")(86,"mat-panel-title")(87,"div",3),t.ɵɵtext(88),t.ɵɵpipe(89,"translate"),t.ɵɵpipe(90,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",21),t.ɵɵtemplate(92,VW,27,32,"section",22),t.ɵɵelementStart(93,"span",23),t.ɵɵtext(94),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(96,"div")(97,"button",24),t.ɵɵpipe(98,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addNewConnector())})),t.ɵɵtext(99),t.ɵɵpipe(100,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(101,"section",25),t.ɵɵtemplate(102,qW,4,7,"button",26)(103,GW,4,7,"button",27),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("toastTarget",n.toastTargetId),t.ɵɵproperty("formGroup",n.gatewayConfigurationGroup),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,54,t.ɵɵpipeBind1(8,52,"gateway.thingsboard"))),t.ɵɵadvance(3),t.ɵɵproperty("deviceName",n.deviceNameForm)("isStateForm",n.isStateForm)("newGatewayType",n.gatewayType),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,56,"gateway.security-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(17,58,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(92,mW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,60,"gateway.thingsboard-host")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("host").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,62,"gateway.thingsboard-port")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","tls"===n.gatewayConfigurationGroup.get("securityType").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,64,"gateway.remote")),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(96,mW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(42,66,"gateway.remote-logging-level")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.gatewayLogLevels),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(48,68,"gateway.path-logs")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteLoggingPathToLogs").hasError("required")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(57,72,t.ɵɵpipeBind1(56,70,"gateway.storage"))),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(62,74,"gateway.storage-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(65,76,n.storageTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(100,mW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(70,78,"gateway.storage-pack-size")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(78,80,"file"!==n.gatewayConfigurationGroup.get("storageType").value?"gateway.storage-max-records":"gateway.storage-max-file-records")," "),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","file"===n.gatewayConfigurationGroup.get("storageType").value),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(90,84,t.ɵɵpipeBind1(89,82,"gateway.connectors-config"))),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.connectors.controls),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.connectors.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(95,86,"gateway.no-connectors")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(98,88,"gateway.connector-add")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(100,90,"action.add")," "),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.gatewayConfigurationGroup.get("remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteConfiguration").value))},dependencies:t.ɵɵgetComponentDepsFactory(zW,[j,_]),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",zW);class UW{transform(e,t){return Ua.parseVersion(e)>=Ua.parseVersion(Mi.get(t))}static{this.ɵfac=function(e){return new(e||UW)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"isLatestVersionConfig",type:UW,pure:!0,standalone:!0})}}class jW{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:Ei.MIN,max:Ei.MAX}):""}static{this.ɵfac=function(e){return new(e||jW)(t.ɵɵdirectiveInject(He.TranslateService,16))}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getGatewayPortTooltip",type:jW,pure:!0,standalone:!0})}}class HW{transform(e,t,n,i){switch(e){case dt.OPCUA:return this.getOpcConnectorHelpLink(t,n);case dt.MQTT:return this.getMqttConnectorHelpLink(t,n,i);case dt.BACNET:return this.getBacnetConnectorHelpLink(t,n);case dt.REST:return this.getRestConnectorHelpLink(n)}}getOpcConnectorHelpLink(e,t){if(t!==ki.CONST)return`widget/lib/gateway/${e}-${t}_fn`}getMqttConnectorHelpLink(e,t,n){if(t!==ti.CONST)return n?e!==Li.ATTRIBUTES&&e!==Li.TIMESERIES||n!==ei.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!==ki.CONST)return`widget/lib/gateway/bacnet-device-${e}-${t}_fn`}getRestConnectorHelpLink(e){if(e!==yi.CONST)return"widget/lib/gateway/rest-json_fn"}static{this.ɵfac=function(e){return new(e||HW)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getConnectorMappingHelpLink",type:HW,pure:!0,standalone:!0})}}function WW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),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 $W(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",22),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 KW(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",23),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function YW(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",24),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function XW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function ZW(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",25)(2,"mat-label",26),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 QW(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",27)(2,"mat-label",26),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 JW extends A{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=dt,this.gatewayConnectorDefaultTypesTranslatesMap=ut,this.gatewayLogLevel=Object.values(pt),this.submitted=!1,this.destroy$=new te,this.updateConnectorTypesByVersion(),this.connectorForm=this.fb.group({type:[dt.MQTT,[]],name:["",[$.required,this.uniqNameRequired(),$.pattern(rn)]],logLevel:[pt.INFO,[]],useDefaults:[!0,[]],sendDataOnlyOnChange:[!1,[]],class:["",[]],key:["auto",[]]})}ngOnInit(){this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}helpLinkId(){return O+"/docs/iot-gateway/configuration/"}cancel(){this.dialogRef.close(null)}add(){this.submitted=!0;const e=this.connectorForm.getRawValue();if(e.useDefaults){const t=Wt(e.type),n=this.data.gatewayVersion;n&&(e.configVersion=n),e.configurationJson=(this.isLatestVersionConfig.transform(n,e.type)?t[Mi.get(e.type)]:t[ct.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=mt.keys();for(let t of e)if(t===ct.Legacy||Ua.parseVersion(this.data.gatewayVersion)>=Ua.parseVersion(t)){this.connectorTypes=mt.get(t);break}}observeTypeChange(){this.connectorForm.get("type").valueChanges.pipe(me((e=>{const t=this.connectorForm.get("useDefaults");e===dt.GRPC||e===dt.CUSTOM?t.setValue(!1):t.value||t.setValue(!0)})),le(this.destroy$)).subscribe()}static{this.ɵfac=function(e){return new(e||JW)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(UW))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:JW,selectors:[["tb-add-connector-dialog"]],standalone:!0,features:[t.ɵɵProvidersFeature([UW]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:43,vars:25,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",4,"ngFor","ngForOf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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.ɵɵtemplate(17,WW,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(18,"div",8)(19,"div",13),t.ɵɵtext(20,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",10),t.ɵɵelement(22,"input",14),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,$W,3,3,"mat-icon",15),t.ɵɵelementEnd()(),t.ɵɵtemplate(25,KW,6,3,"div",16)(26,YW,6,3,"div",16),t.ɵɵelementStart(27,"div",8)(28,"div",9),t.ɵɵtext(29,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",10)(31,"mat-select",17),t.ɵɵtemplate(32,XW,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵtemplate(33,ZW,6,6,"div",16)(34,QW,6,6,"div",16),t.ɵɵpipe(35,"withReportStrategy"),t.ɵɵelementEnd()(),t.ɵɵelementStart(36,"div",18)(37,"button",19),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(38),t.ɵɵpipe(39,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"button",20),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,14,"gateway.add-connector")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLinkId()),t.ɵɵadvance(11),t.ɵɵproperty("ngForOf",n.connectorTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(23,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("name").hasError("required")&&n.connectorForm.get("name").touched||n.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.GRPC),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value!==n.connectorType.GRPC&&n.connectorForm.get("type").value!==n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.MQTT&&!t.ɵɵpipeBind2(35,18,n.data.gatewayVersion,n.connectorType.MQTT)),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(39,21,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.connectorForm.invalid||!n.connectorForm.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(42,23,"action.add")," "))},dependencies:t.ɵɵgetComponentDepsFactory(JW,[j,_,Ya]),styles:['@charset "UTF-8";[_nghost-%COMP%] .add-connector[_ngcontent-%COMP%]{min-width:400px;width:500px}']})}}e("AddConnectorDialogComponent",JW);const e$=()=>({maxWidth:"970px"});function t$(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1,"gateway.device-info.source"),t.ɵɵelementEnd())}function n$(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(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function i$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",18)(2,"mat-select",19),t.ɵɵtemplate(3,n$,3,4,"mat-option",20),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function a$(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.device-info.device-name-expression-required"))}function r$(e,n){if(1&e&&(t.ɵɵelement(0,"div",23),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,e$))}}function o$(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(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function s$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",18)(2,"mat-select",26),t.ɵɵtemplate(3,o$,3,4,"mat-option",20),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function l$(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.device-info.device-profile-expression-required"))}function p$(e,n){if(1&e&&(t.ɵɵelement(0,"div",23),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,e$))}}function c$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",24)(1,"div",9),t.ɵɵtext(2,"gateway.device-info.profile-name"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,s$,4,1,"div",10),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12),t.ɵɵelement(6,"input",25),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,l$,3,3,"mat-icon",14)(9,p$,2,8,"div",15),t.ɵɵpipe(10,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingFormGroup.get("deviceProfileExpression").hasError("required")&&e.mappingFormGroup.get("deviceProfileExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(10,6,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType))}}class d$ extends q{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=Ni,this.DeviceInfoType=fa,this.useSource=!0,this.required=!1,this.connectorType=dt.MQTT,this.sourceTypes=Object.values(ti),this.destroy$=new te,this.propagateChange=e=>{}}ngOnInit(){this.mappingFormGroup=this.fb.group({deviceNameExpression:["",this.required?[$.required,$.pattern(rn)]:[$.pattern(rn)]]}),this.useSource&&this.mappingFormGroup.addControl("deviceNameExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.deviceInfoType===fa.FULL&&(this.useSource&&this.mappingFormGroup.addControl("deviceProfileExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.mappingFormGroup.addControl("deviceProfileExpression",this.fb.control("",this.required?[$.required,$.pattern(rn)]:[$.pattern(rn)]))),this.mappingFormGroup.valueChanges.pipe(le(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||d$)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:d$,selectors:[["tb-device-info-table"]],inputs:{useSource:"useSource",required:"required",connectorType:"connectorType",convertorType:"convertorType",sourceTypes:"sourceTypes",deviceInfoType:"deviceInfoType"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>d$)),multi:!0},{provide:K,useExisting:c((()=>d$)),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"],["class","tb-form-table-header-cell w-1/5","translate","",4,"ngIf"],["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"],["class","no-gap w-1/5",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["class","tb-form-table-row tb-form-row no-border same-padding pb-4",4,"ngIf"],[1,"no-gap","w-1/5"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","!w-full"],["formControlName","deviceNameExpressionSource"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["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"],["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,t$,2,0,"div",5),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9," gateway.device-info.expression "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",7)(11,"div",8)(12,"div",9),t.ɵɵtext(13,"gateway.device-info.name"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,i$,4,1,"div",10),t.ɵɵelementStart(15,"div",11)(16,"mat-form-field",12),t.ɵɵelement(17,"input",13),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,a$,3,3,"mat-icon",14)(20,r$,2,8,"div",15),t.ɵɵpipe(21,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(22,c$,11,11,"div",16),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(),t.ɵɵclassProp("tb-required",n.required),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(4),t.ɵɵclassProp("pb-4",n.deviceInfoType!==n.DeviceInfoType.FULL),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(18,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.mappingFormGroup.get("deviceNameExpression").hasError("required")&&n.mappingFormGroup.get("deviceNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(21,13,n.connectorType,"name-field",n.mappingFormGroup.get("deviceNameExpressionSource").value,n.convertorType)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceInfoType===n.DeviceInfoType.FULL))},dependencies:t.ɵɵgetComponentDepsFactory(d$,[j,_,HW]),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})}}Ge([I()],d$.prototype,"useSource",void 0),Ge([I()],d$.prototype,"required",void 0);const u$=()=>({maxWidth:"970px"});function m$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",19),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 h$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵelement(1,"mat-icon",22),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 g$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,h$,5,5,"mat-option",20),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function f$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",23)(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 y$(e,n){1&e&&(t.ɵɵelement(0,"input",24),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function v$(e,n){1&e&&(t.ɵɵelement(0,"input",25),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function x$(e,n){1&e&&(t.ɵɵelement(0,"input",26),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function b$(e,n){1&e&&(t.ɵɵelement(0,"input",27),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function w$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",28)(1,"mat-option",21),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",21),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function S$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",29),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function C$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",30),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,u$))}}class _${constructor(e){this.fb=e,this.valueTypeKeys=Object.values(Xt),this.valueTypes=Zt,this.MappingValueType=Xt,this.destroy$=new te,this.onChange=e=>{},this.valueTypeFormGroup=this.fb.group({type:[Xt.STRING],stringValue:[{value:"",disabled:this.rawData},[$.required,$.pattern(rn)]],integerValue:[{value:0,disabled:!0},[$.required,$.pattern(on)]],doubleValue:[{value:0,disabled:!0},[$.required]],booleanValue:[{value:!1,disabled:!0},[$.required]],rawValue:[{value:"",disabled:!this.rawData},[$.required,$.pattern(rn)]]}),this.valueTypeFormGroup.valueChanges.pipe(le(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(le(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 Xt.BOOLEAN;case"number":return Number.isInteger(e)?Xt.INTEGER:Xt.DOUBLE;default:return Xt.STRING}}static{this.ɵfac=function(e){return new(e||_$)(t.ɵɵdirectiveInject(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:_$,selectors:[["tb-type-value-field"]],inputs:{rawData:"rawData",helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>_$)),multi:!0},{provide:K,useExisting:c((()=>_$)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:17,consts:[["raw",""],[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"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[4,"ngIf","ngIfElse"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex","tb-suffix-absolute"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","rawValue",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style","click",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["value","raw"],["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,"click","tb-help-popup","tb-help-popup-style"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,1),t.ɵɵelementStart(1,"div",2)(2,"div",3),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",4)(5,"mat-form-field",5)(6,"mat-select",6)(7,"mat-select-trigger")(8,"div",7),t.ɵɵtemplate(9,m$,1,1,"mat-icon",8),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(14,g$,2,1,"ng-container",9)(15,f$,4,3,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(17,"div",2)(18,"div",3),t.ɵɵtext(19,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",10),t.ɵɵelementContainerStart(21,11),t.ɵɵtemplate(22,y$,2,3,"input",12)(23,v$,2,3,"input",13)(24,x$,2,3,"input",14)(25,b$,2,3,"input",15)(26,w$,5,2,"mat-select",16),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,S$,3,3,"mat-icon",17)(28,C$,1,3,"div",18),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){let e,i;const a=t.ɵɵreference(16);t.ɵɵproperty("formGroup",n.valueTypeFormGroup),t.ɵɵadvance(9),t.ɵɵproperty("ngIf",!n.rawData),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,13,null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.name)||t.ɵɵpipeBind1(13,15,"gateway.raw")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",!n.rawData)("ngIfElse",a),t.ɵɵadvance(7),t.ɵɵproperty("ngSwitch",n.valueTypeFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase","raw"),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(i=n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value))?null:i.hasError("required"))&&n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value).touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.helpLink)}},dependencies:t.ɵɵgetComponentDepsFactory(_$,[_,j]),styles:['@charset "UTF-8";[_nghost-%COMP%]{gap:16px;display:grid;width:100%}']})}}function T$(e,n){if(1&e&&t.ɵɵelement(0,"tb-type-value-field",14),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("helpLink",e.helpLink)}}function I$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",7),t.ɵɵelementContainerStart(2,8),t.ɵɵelementStart(3,"mat-expansion-panel",9)(4,"mat-expansion-panel-header",10)(5,"mat-panel-title")(6,"div",11),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,T$,1,1,"ng-template",12),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",13),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.last;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i),t.ɵɵadvance(),t.ɵɵproperty("expanded",a),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 E$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtemplate(1,I$,13,6,"div",5),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function M$(e,n){1&e&&(t.ɵɵelementStart(0,"div",15)(1,"span",16),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate("gateway.no-value"))}Ge([I()],_$.prototype,"rawData",void 0);class k${constructor(e){this.fb=e,this.destroy$=new te,this.onChange=e=>{}}ngOnInit(){this.valueListFormArray=this.fb.array([]),this.valueListFormArray.valueChanges.pipe(le(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(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:k$,selectors:[["tb-type-value-panel"]],inputs:{helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>k$)),multi:!0},{provide:K,useExisting:c((()=>k$)),multi:!0}]),t.ɵɵStandaloneFeature],decls:8,vars:5,consts:[["noKeys",""],[1,"tb-form-panel","no-border","no-padding"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-form-panel","no-border","no-padding","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",1),t.ɵɵtemplate(1,E$,2,2,"div",2),t.ɵɵelementStart(2,"div")(3,"button",3),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(6,M$,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)}if(2&e){const e=t.ɵɵreference(7);t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.valueListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,3,"gateway.add-value")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(k$,[j,_,_$]),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 P$=()=>({maxWidth:"970px"});function D$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",19),t.ɵɵtext(2),t.ɵɵelementEnd(),t.ɵɵtext(3),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",e.get("key").value," "),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",":","  ")}}function O$(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.key-required"))}function A$(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,P$))}}function F$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",44),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 R$(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 B$(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 N$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-select-trigger")(1,"div",42),t.ɵɵtemplate(2,F$,1,1,"mat-icon",43)(3,R$,3,3,"span",36)(4,B$,3,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵreference(5),i=t.ɵɵnextContext(3).$implicit,a=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==(e=a.valueTypes.get(i.get("type").value))?null:e.icon),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!a.rawData)("ngIfElse",n)}}function L$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",48),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(6);t.ɵɵpropertyInterpolate("svgIcon",n.valueTypes.get(e).icon)}}function V$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵtemplate(1,L$,1,1,"mat-icon",47),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.ɵɵproperty("ngIf",null==(e=r.valueTypes.get(a))?null:e.icon),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 q$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,V$,5,5,"mat-option",45),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function G$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",46)(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 z$(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-required"))}function U$(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,P$))}}function j$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",28),t.ɵɵelement(10,"input",29),t.ɵɵpipe(11,"translate"),t.ɵɵtemplate(12,O$,3,3,"mat-icon",30)(13,A$,2,8,"div",31),t.ɵɵpipe(14,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",32)(19,"div",33),t.ɵɵtext(20,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",34)(22,"mat-select",35),t.ɵɵtemplate(23,N$,6,3,"mat-select-trigger",18)(24,q$,2,1,"ng-container",36)(25,G$,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"div",37)(28,"div",27),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",38),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,z$,3,3,"mat-icon",30)(36,U$,2,8,"div",31),t.ɵɵpipe(37,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵreference(26),n=t.ɵɵnextContext(2).$implicit,i=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,13,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,15,"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(11,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("key").hasError("required")&&n.get("key").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(14,19,i.connectorType,i.keysType,n.get("type").value,i.convertorType)),t.ɵɵadvance(10),t.ɵɵproperty("ngIf",!i.rawData),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!i.rawData)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(29,24,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(31,26,"gateway.value")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("value").hasError("required")&&n.get("value").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(37,30,i.connectorType,i.keysType,n.get("type").value,i.convertorType))}}function H$(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.key-required"))}function W$(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-required"))}function $$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",33),t.ɵɵtext(3,"gateway.key"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",28),t.ɵɵelement(5,"input",29),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,H$,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",26)(9,"div",33),t.ɵɵtext(10,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",49),t.ɵɵelement(12,"input",39),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,W$,3,3,"mat-icon",30),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function K$(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-required"))}function Y$(e,n){1&e&&t.ɵɵelement(0,"tb-type-value-panel",54)}function X$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",27),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",28),t.ɵɵelement(7,"input",50),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,K$,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",14)(11,"mat-expansion-panel",51)(12,"mat-expansion-panel-header",52)(13,"mat-panel-title")(14,"div",53),t.ɵɵpipe(15,"translate"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(18,Y$,1,0,"ng-template",20),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.ɵɵproperty("ngIf",n.get("method").hasError("required")&&n.get("method").touched),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 Z$(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",55),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function Q$(e,n){if(1&e&&t.ɵɵtemplate(0,j$,38,35,"div",22)(1,$$,15,8,"div",22)(2,X$,19,17,"div",22)(3,Z$,1,2,"tb-report-strategy",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType!==e.MappingKeysType.CUSTOM&&e.keysType!==e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.withReportStrategy&&(e.keysType===e.MappingKeysType.ATTRIBUTES||e.keysType===e.MappingKeysType.TIMESERIES))}}function J$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵelementContainerStart(2,15),t.ɵɵelementStart(3,"mat-expansion-panel",16)(4,"mat-expansion-panel-header",17)(5,"mat-panel-title"),t.ɵɵtemplate(6,D$,4,2,"ng-container",18),t.ɵɵelementStart(7,"div",19),t.ɵɵtext(8),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,Q$,4,4,"ng-template",20),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",21),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.last,a=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",a.keysType!==a.MappingKeysType.RPC_METHODS),t.ɵɵadvance(2),t.ɵɵtextInterpolate(a.valueTitle(e)),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,a.deleteKeyTitle))}}function eK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",11),t.ɵɵtemplate(1,J$,14,7,"div",12),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function tK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",56)(1,"span",57),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class nK extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.valueTypeEnum=Xt,this.valueTypes=Zt,this.valueTypeKeys=Object.values(Xt),this.rawData=!1,this.withReportStrategy=!0,this.keysDataApplied=new u,this.MappingKeysType=Li,this.ReportStrategyDefaultValue=tn,this.ConnectorType=dt,this.errorText=""}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===Li.RPC_METHODS?this.fb.group({method:["",[$.required]],arguments:[[],[]]}):this.keysType===Li.CUSTOM?this.fb.group({key:["",[$.required,$.pattern(rn)]],value:["",[$.required,$.pattern(rn)]]}):this.fb.group({key:["",[$.required,$.pattern(rn)]],type:[this.rawData?"raw":this.valueTypeKeys[0]],value:["",[$.required,$.pattern(rn)]],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===Li.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===Li.CUSTOM&&(e=Object.keys(e).map((t=>({key:t,value:e[t],type:""})))),e.forEach((e=>{let n;if(this.keysType===Li.RPC_METHODS)n=this.fb.group({method:[e.method,[$.required]],arguments:[[...e.arguments],[]]});else if(this.keysType===Li.CUSTOM){const{key:t,value:i}=e;n=this.fb.group({key:[t,[$.required,$.pattern(rn)]],value:[i,[$.required,$.pattern(rn)]]})}else{const{key:t,value:i,type:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[$.required,$.pattern(rn)]],type:[a],value:[i,[$.required,$.pattern(rn)]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)}))),this.fb.array(t)}valueTitle(e){const t=this.keysType===Li.RPC_METHODS?e.get("method").value:e.get("value").value;return ke(t)?"object"==typeof t?JSON.stringify(t):t:""}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===Li.ATTRIBUTES||this.keysType===Li.TIMESERIES))}static{this.ɵfac=function(e){return new(e||nK)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:nK,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:19,vars:16,consts:[["noKeys",""],["rawOption",""],["rawText",""],[1,"tb-mapping-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[4,"ngIf"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[4,"ngIf","ngIfElse"],[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"],["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-flex","align-center"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["class","tb-mat-20",3,"svgIcon",4,"ngIf"],[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"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],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.ɵɵtemplate(5,eK,2,2,"div",6),t.ɵɵelementStart(6,"div")(7,"button",7),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,tK,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",8)(13,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(nK,[j,_,Zn,k$,HW]),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}']})}}Ge([I()],nK.prototype,"rawData",void 0),Ge([I()],nK.prototype,"withReportStrategy",void 0);const iK=()=>({maxWidth:"970px"}),aK=(e,t)=>[e,t];function rK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function oK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 sK(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",40),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 lK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",41),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("convertorType",e.ConvertorTypeEnum.JSON)("deviceInfoType",e.DeviceInfoType.FULL)}}function pK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",42),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)("convertorType",e.ConvertorTypeEnum.BYTES)("sourceTypes",t.ɵɵpureFunction2(3,aK,e.sourceTypesEnum.MSG,e.sourceTypesEnum.CONST))}}function cK(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function dK(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 uK(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 mK(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",43)(5,"mat-chip-listbox",44),t.ɵɵtemplate(6,dK,2,1,"mat-chip",45),t.ɵɵelementStart(7,"mat-chip",46),t.ɵɵelement(8,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",48,0),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(10),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(12,"tb-icon",49),t.ɵɵtext(13,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",31)(15,"div",32),t.ɵɵtext(16,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",43)(18,"mat-chip-listbox",44),t.ɵɵtemplate(19,uK,2,1,"mat-chip",45),t.ɵɵelementStart(20,"mat-chip",46),t.ɵɵelement(21,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"button",48,1),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(23),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(25,"tb-icon",49),t.ɵɵtext(26,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterAttributes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,6,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterTelemetry),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,8,"action.edit"))}}function hK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function gK(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 fK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",21)(2,"div",50),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",23),t.ɵɵelement(7,"input",51),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,hK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",52)(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",43)(20,"mat-chip-listbox",44),t.ɵɵtemplate(21,gK,2,1,"mat-chip",45),t.ɵɵelementStart(22,"mat-chip",46),t.ɵɵelement(23,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",48,2),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.CUSTOM))})),t.ɵɵelementStart(27,"tb-icon",49),t.ɵɵtext(28,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,8,"gateway.extension-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,10,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("converter.custom.extension").hasError("required")&&e.mappingForm.get("converter.custom.extension").touched),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,14,"gateway.extension-configuration-hint")),t.ɵɵadvance(6),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.customKeys),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(26,16,"action.edit"))}}function yK(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,rK,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,oK,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,sK,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,lK,1,2,"ng-template",17)(30,pK,1,6,"ng-template",17)(31,cK,1,2,"tb-report-strategy",37)(32,mK,27,10,"div",38)(33,fK,29,18,"div",38),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("topicFilter").hasError("required")&&e.mappingForm.get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(24,iK)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",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",e.qualityTypes),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.convertorTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,22,e.DataConversionTranslationsMap.get(e.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroupName",e.converterType)("ngSwitch",e.converterType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.BYTES),t.ɵɵadvance(),t.ɵɵconditional(e.data.withReportStrategy?31:-1),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.BYTES||e.converterType===e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.CUSTOM)}}function vK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 xK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function bK(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",57),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,xK,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,iK))}}function wK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",58),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)}}function SK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",58),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.PARTIAL)}}function CK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 _K(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 TK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 IK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 EK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 MK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 kK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",34)(1,"div",59),t.ɵɵtext(2,"gateway.from-device-request-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",60),t.ɵɵtext(4," gateway.from-device-request-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",61)(6,"div",62)(7,"div",63),t.ɵɵtext(8,"gateway.device-info.device-name-expression"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",64)(10,"div",65)(11,"mat-form-field",23)(12,"mat-select",66),t.ɵɵtemplate(13,CK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",67),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,_K,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",64)(23,"div",65)(24,"mat-form-field",23)(25,"mat-select",68),t.ɵɵtemplate(26,TK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"mat-form-field",23),t.ɵɵelement(28,"input",69),t.ɵɵpipe(29,"translate"),t.ɵɵtemplate(30,IK,3,3,"mat-icon",25),t.ɵɵelement(31,"div",26),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(32,"div",34)(33,"div",59),t.ɵɵtext(34,"gateway.to-device-response-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"div",60),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",70),t.ɵɵpipe(42,"translate"),t.ɵɵtemplate(43,EK,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",71),t.ɵɵpipe(50,"translate"),t.ɵɵtemplate(51,MK,3,3,"mat-icon",25),t.ɵɵelement(52,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(53,"div",72)(54,"mat-slide-toggle",73)(55,"mat-label",74),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,iK)),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,iK)),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,iK)),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,iK)),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 PK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 DK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-filter-required"))}function OK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 AK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 FK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",50),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",23),t.ɵɵelement(6,"input",75),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,PK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",50),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",76),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,DK,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",70),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,OK,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",71),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,AK,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",72)(35,"mat-slide-toggle",73)(36,"mat-label",74),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,iK)),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,iK)),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 RK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 BK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-filter-required"))}function NK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 LK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-expression-required"))}function VK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 qK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 GK(e,n){if(1&e&&t.ɵɵelement(0,"tb-error-icon",84),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("tooltipText",e.responseTimeoutErrorTooltip)}}function zK(e,n){1&e&&(t.ɵɵelementStart(0,"span",85),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function UK(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",81),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,VK,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",82),t.ɵɵtemplate(16,qK,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",83),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,GK,1,1,"tb-error-icon",84)(24,zK,2,0,"span",85),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,iK)),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 jK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",77)(1,"tb-toggle-select",33)(2,"tb-toggle-option",40),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-option",40),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",21)(9,"div",50),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23),t.ɵɵelement(14,"input",75),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,RK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",21)(18,"div",50),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",23),t.ɵɵelement(23,"input",78),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,BK,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",79),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,NK,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",70),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,LK,3,3,"mat-icon",25),t.ɵɵelement(41,"div",26),t.ɵɵelementEnd()(),t.ɵɵtemplate(42,UK,25,18,"ng-container",80)),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,iK)),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,iK)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.type").value===e.ServerSideRPCType.TWO_WAY)}}function HK(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",53),t.ɵɵtemplate(5,vK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(6,54)(7,55),t.ɵɵtemplate(8,bK,8,8,"div",56)(9,wK,1,1,"ng-template",17)(10,SK,1,1,"ng-template",17)(11,kK,59,36,"ng-template",17)(12,FK,40,40,"ng-template",17)(13,jK,43,43,"ng-template",17),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.requestTypes),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e.mappingForm.get("requestValue").get(e.requestMappingType))("ngSwitch",e.requestMappingType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.requestMappingType===e.RequestTypeEnum.ATTRIBUTE_REQUEST||e.requestMappingType===e.RequestTypeEnum.CONNECT_REQUEST||e.requestMappingType===e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.CONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_UPDATE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.SERVER_SIDE_RPC)}}function WK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 $K(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-node-required"))}function KK(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function YK(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 XK(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 ZK(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 QK(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 JK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",86)(1,"div",87)(2,"div",88),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",89)(7,"mat-form-field",90)(8,"mat-select",91),t.ɵɵtemplate(9,WK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"mat-form-field",90),t.ɵɵelement(11,"input",92),t.ɵɵpipe(12,"translate"),t.ɵɵtemplate(13,$K,3,3,"mat-icon",25),t.ɵɵelement(14,"div",26),t.ɵɵpipe(15,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()(),t.ɵɵelement(16,"tb-device-info-table",93),t.ɵɵtemplate(17,KK,1,2,"tb-report-strategy",37),t.ɵɵelementStart(18,"div",31)(19,"div",32),t.ɵɵtext(20,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",43)(22,"mat-chip-listbox",44),t.ɵɵtemplate(23,YK,2,1,"mat-chip",45),t.ɵɵelementStart(24,"mat-chip",46),t.ɵɵelement(25,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",48,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",49),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",43)(35,"mat-chip-listbox",44),t.ɵɵtemplate(36,XK,2,1,"mat-chip",45),t.ɵɵelementStart(37,"mat-chip",46),t.ɵɵelement(38,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"button",48,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",49),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",43)(48,"mat-chip-listbox",44),t.ɵɵtemplate(49,ZK,2,1,"mat-chip",45),t.ɵɵelementStart(50,"mat-chip",46),t.ɵɵelement(51,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"button",48,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",49),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",43)(61,"mat-chip-listbox",44),t.ɵɵtemplate(62,QK,2,1,"mat-chip",45),t.ɵɵelementStart(63,"mat-chip",46),t.ɵɵelement(64,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(65,"button",48,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",49),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,aK,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,iK)),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 eY extends A{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=Oi,this.qualityTypes=Ui,this.QualityTranslationsMap=ii,this.convertorTypes=Object.values(ei),this.ConvertorTypeEnum=ei,this.ConvertorTypeTranslationsMap=ai,this.sourceTypes=Object.values(ti),this.OPCUaSourceTypes=Object.values(ki),this.OPCUaSourceTypesEnum=ki,this.sourceTypesEnum=ti,this.SourceTypeTranslationsMap=Ni,this.requestTypes=Object.values(ri),this.RequestTypeEnum=ri,this.RequestTypesTranslationsMap=oi,this.DeviceInfoType=fa,this.ServerSideRPCType=$i,this.MappingKeysType=Li,this.MappingHintTranslationsMap=Wi,this.MappingTypeTranslationsMap=Ai,this.DataConversionTranslationsMap=si,this.HelpLinkByMappingTypeMap=Hi,this.ConnectorType=dt,this.ReportStrategyDefaultValue=tn,this.keysPopupClosed=!0,this.destroy$=new te,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 Oi.DATA:this.mappingForm=this.fb.group({}),this.createDataMappingForm();break;case Oi.REQUESTS:this.mappingForm=this.fb.group({}),this.createRequestMappingForm();break;case Oi.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!==Oi.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===ei.BYTES,panelTitle:Vi.get(n),addKeyTitle:qi.get(n),deleteKeyTitle:Gi.get(n),noKeysText:zi.get(n),withReportStrategy:this.data.withReportStrategy,connectorType:this.data.mappingType===Oi.OPCUA?dt.OPCUA:dt.MQTT,convertorType:this.converterType};this.data.mappingType===Oi.OPCUA&&(t.valueTypeKeys=Object.values(ki),t.valueTypeEnum=ki,t.valueTypes=Ni,t.sourceType=this.mappingForm.get("deviceNodeSource").value),this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,nK,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(le(this.destroy$)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty()})),this.popoverComponent.tbHideStart.pipe(le(this.destroy$)).subscribe((()=>{this.keysPopupClosed=!0}))}}prepareMappingData(){const e=this.mappingForm.value;switch(Te(e),this.data.mappingType){case Oi.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 Oi.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 Oi.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 Oi.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("",[$.required,$.pattern(rn)])),this.mappingForm.addControl("subscriptionQos",this.fb.control(0)),this.mappingForm.addControl("converter",this.fb.group({type:[ei.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:["",[$.required,$.pattern(rn)]],extensionConfig:[{},[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})})),this.mappingForm.patchValue(this.getFormValueData()),this.mappingForm.get("converter.type").valueChanges.pipe(be(this.mappingForm.get("converter.type").value),le(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(ri.CONNECT_REQUEST,[])),this.mappingForm.addControl("requestValue",this.fb.group({connectRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(rn)]],deviceInfo:[{},[]]}),disconnectRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(rn)]],deviceInfo:[{},[]]}),attributeRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(rn)]],deviceInfo:this.fb.group({deviceNameExpressionSource:[ti.MSG,[]],deviceNameExpression:["",[$.required]]}),attributeNameExpressionSource:[ti.MSG,[]],attributeNameExpression:["",[$.required,$.pattern(rn)]],topicExpression:["",[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],retain:[!1,[]]}),attributeUpdates:this.fb.group({deviceNameFilter:["",[$.required,$.pattern(rn)]],attributeFilter:["",[$.required,$.pattern(rn)]],topicExpression:["",[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],retain:[!0,[]]}),serverSideRpc:this.fb.group({type:[$i.TWO_WAY,[]],deviceNameFilter:["",[$.required,$.pattern(rn)]],methodFilter:["",[$.required,$.pattern(rn)]],requestTopicExpression:["",[$.required,$.pattern(rn)]],responseTopicExpression:["",[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],responseTopicQoS:[0,[]],responseTimeout:[1e4,[$.required,$.min(1)]]}),reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})),this.mappingForm.get("requestType").valueChanges.pipe(be(this.mappingForm.get("requestType").value),le(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(le(this.destroy$)).subscribe((e=>{const t=this.mappingForm.get("requestValue.serverSideRpc");e===$i.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:[ki.PATH,[]],deviceNodePattern:["",[$.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||eY)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(He.TranslateService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:eY,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","ngSwitch"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["formControlName","deviceInfo","required","true",3,"convertorType","deviceInfoType"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","convertorType","sourceTypes"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[4,"ngFor","ngForOf"],[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","ngSwitch"],["class","tb-form-row column-xs",4,"ngIf"],["matInput","","name","value",3,"formControl","placeholder"],["formControlName","deviceInfo","required","true",3,"deviceInfoType"],["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"]],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,yK,34,25,"ng-template",17)(17,HK,14,9,"ng-template",17)(18,JK,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(eY,[j,_,HW,zn,d$,Jn,Zn]),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",eY);const tY=["searchInput"],nY=()=>({minWidth:"96px",textAlign:"center"});function iY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",24)(2,"span",25),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 aY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-header-cell",29),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 rY(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().$implicit,a=t.ɵɵnextContext();t.ɵɵclassProp("request-column",a.mappingType===a.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e[i.def]," ")}}function oY(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,26),t.ɵɵtemplate(1,aY,3,5,"mat-header-cell",27)(2,rY,2,3,"mat-cell",28),t.ɵɵelementContainerEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("matColumnDef",e.def)}}function sY(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",31)}function lY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 pY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,lY,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",32),t.ɵɵelementContainer(4,33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",34)(6,"button",35),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",36),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",37,2),t.ɵɵelementContainer(11,33),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,nY)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function cY(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",38)}function dY(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class uY{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=Ai,this.mappingTypeEnum=Oi,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 te,this.mappingFormGroup=this.fb.array([]),this.dirtyValue=!this.activeValue,this.dataSource=new mY}ngOnInit(){this.setMappingColumns(),this.displayedColumns.push(...this.mappingColumns.map((e=>e.def)),"actions"),this.mappingFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t)?this.mappingFormGroup.at(t).value:{};this.dialog.open(eY,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{mappingType:this.mappingType,value:n,buttonTitle:Ae(t)?"action.add":"action.apply",withReportStrategy:this.withReportStrategy}}).afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(ke(t)?this.mappingFormGroup.at(t).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.mappingFormGroup.controls[t].value,i=n.deviceInfo?.deviceNameExpression??n.topicFilter??this.getRequestDetails(n);this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:i}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).subscribe((e=>{e&&(this.mappingFormGroup.removeAt(t),this.mappingFormGroup.markAsDirty())}))}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.mappingFormGroup.push(this.fb.control(e))))}getMappingValue(e){switch(this.mappingType){case Oi.DATA:const t=ai.get(e.converter?.type);return{topicFilter:e.topicFilter,QoS:e.subscriptionQos,converter:t?this.translate.instant(t):""};case Oi.REQUESTS:return{requestType:e.requestType,type:this.translate.instant(oi.get(e.requestType)),details:this.getRequestDetails(e)};case Oi.OPCUA:const n=e.deviceInfo?.deviceNameExpression,i=e.deviceInfo?.deviceProfileExpression,{deviceNodePattern:a}=e;return{deviceNodePattern:a,deviceNamePattern:n,deviceProfileExpression:i};default:return{}}}getRequestDetails(e){let t;return t=e.requestType===ri.ATTRIBUTE_UPDATE?e.requestValue.attributeFilter:e.requestType===ri.SERVER_SIDE_RPC?e.requestValue.methodFilter:e.requestValue.topicFilter,t}setMappingColumns(){switch(this.mappingType){case Oi.DATA:this.mappingColumns.push({def:"topicFilter",title:"gateway.topic-filter"},{def:"QoS",title:"gateway.mqtt-qos"},{def:"converter",title:"gateway.payload-type"});break;case Oi.REQUESTS:this.mappingColumns.push({def:"type",title:"gateway.type"},{def:"details",title:"gateway.details"});break;case Oi.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||uY)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:uY,selectors:[["tb-mapping-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(tY,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:W,useExisting:c((()=>uY)),multi:!0},{provide:K,useExisting:c((()=>uY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:40,vars:33,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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef",4,"ngFor","ngForOf"],["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"],[3,"matColumnDef"],["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,iY,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵtemplate(23,oY,3,1,"ng-container",14),t.ɵɵelementContainerStart(24,15),t.ɵɵtemplate(25,sY,1,0,"mat-header-cell",16)(26,pY,12,6,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,cY,1,0,"mat-header-row",18)(28,dY,1,0,"mat-row",19),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"section",20),t.ɵɵpipe(30,"async"),t.ɵɵelementStart(31,"button",21),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))})),t.ɵɵelementStart(32,"mat-icon",22),t.ɵɵtext(33,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"span"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(37,"span",23),t.ɵɵpipe(38,"async"),t.ɵɵtext(39," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,19,n.dataSource.isEmpty())),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,21,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,23,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,25,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.mappingColumns),t.ɵɵadvance(4),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(30,27,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,29,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(38,31,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(uY,[j,_,Gn]),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",uY),Ge([I()],uY.prototype,"required",void 0),Ge([I()],uY.prototype,"withReportStrategy",void 0);let mY=class extends G{constructor(){super()}};function hY(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",7),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 gY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",18),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function fY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",10)(4,"mat-form-field",11),t.ɵɵelement(5,"input",12),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,gY,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",8)(9,"div",14),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",15),t.ɵɵpipe(14,"translate"),t.ɵɵelementStart(15,"div",16),t.ɵɵelement(16,"tb-toggle-password",17),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,3,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,5,"gateway.set"))}}function yY(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 vY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",18),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function xY(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",8)(2,"div",14),t.ɵɵtext(3,"gateway.mode"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11)(6,"mat-select",25),t.ɵɵtemplate(7,yY,2,2,"mat-option",4),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(8,"div",8)(9,"div",14),t.ɵɵtext(10,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",12),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,vY,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8)(17,"div",14),t.ɵɵtext(18,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",10)(20,"mat-form-field",11),t.ɵɵelement(21,"input",15),t.ɵɵpipe(22,"translate"),t.ɵɵelementStart(23,"div",16),t.ɵɵelement(24,"tb-toggle-password",17),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",e.modeTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,6,"gateway.set"))}}function bY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",8)(4,"div",20),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",10)(8,"mat-form-field",11),t.ɵɵelement(9,"input",21),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",8)(12,"div",20),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"div",10)(16,"mat-form-field",11),t.ɵɵelement(17,"input",22),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",8)(20,"div",20),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"div",10)(24,"mat-form-field",11),t.ɵɵelement(25,"input",23),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(27,xY,25,8,"ng-container",24)),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.ɵɵproperty("ngIf",e.mode()===e.SecurityMode.extendedCertificates)}}e("MappingDatasource",mY);class wY{constructor(e,t){this.fb=e,this.cdr=t,this.title="gateway.security",this.mode=l(Ki.certificates),this.BrokerSecurityType=Pi,this.SecurityMode=Ki,this.securityTypes=Object.values(Pi),this.modeTypes=Object.values(Di),this.SecurityTypeTranslationsMap=Bi,this.destroy$=new te,o((()=>{this.mode()===Ki.basic&&(this.securityTypes=this.securityTypes.filter((e=>e!==Pi.CERTIFICATES)))}))}ngOnInit(){this.securityFormGroup=this.fb.group({type:[Pi.ANONYMOUS,[]],username:["",[$.required,$.pattern(rn)]],password:["",[$.pattern(rn)]],pathToCACert:["",[$.pattern(rn)]],pathToPrivateKey:["",[$.pattern(rn)]],pathToClientCert:["",[$.pattern(rn)]]}),this.mode()===Ki.extendedCertificates&&this.securityFormGroup.addControl("mode",this.fb.control(Di.NONE,[])),this.securityFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{Te(e),this.onChange(e),this.onTouched()})),this.securityFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.updateValidators(e)))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){if(e)e.type||(e.type=Pi.ANONYMOUS),this.updateValidators(e.type),this.securityFormGroup.reset(e,{emitEvent:!1});else{const e={type:Pi.ANONYMOUS};this.securityFormGroup.reset(e,{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.securityFormGroup.get("type").value!==Pi.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===Pi.BASIC)this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1});else if(e===Pi.CERTIFICATES&&(this.securityFormGroup.get("pathToCACert").enable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").enable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").enable({emitEvent:!1}),this.mode()===Ki.extendedCertificates)){const e=this.securityFormGroup.get("mode");e&&!e.value&&e.setValue(Di.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||wY)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:wY,selectors:[["tb-security-config"]],inputs:{title:"title",mode:[1,"mode"]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>wY)),multi:!0},{provide:K,useExisting:c((()=>wY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,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",4,"ngFor","ngForOf"],[3,"ngSwitch"],[3,"ngSwitchCase"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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"],[4,"ngIf"],["formControlName","mode"]],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.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵtemplate(6,hY,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵelementContainerStart(7,5),t.ɵɵtemplate(8,fY,17,7,"ng-template",6)(9,bY,28,22,"ng-template",6),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,n.title)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.BASIC),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.CERTIFICATES))},dependencies:t.ɵɵgetComponentDepsFactory(wY,[j,_,Gn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("SecurityConfigComponent",wY);const SY=()=>({min:1e3}),CY=()=>({min:50}),_Y=()=>({min:100});function TY(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.server-url-required"))}function IY(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,SY)))}function EY(e,n){1&e&&(t.ɵɵelementStart(0,"span",10),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function MY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",22),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function kY(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.ɵɵpipeBind2(1,1,"gateway.scan-period-error",t.ɵɵpureFunction0(4,SY)))}function PY(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.ɵɵpipeBind2(1,1,"gateway.poll-period-error",t.ɵɵpureFunction0(4,CY)))}function DY(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",23),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,PY,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.ɵɵproperty("ngIf",(e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("required")||e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("min"))&&e.serverConfigFormGroup.get("pollPeriodInMillis").touched)}}function OY(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.ɵɵpipeBind2(1,1,"gateway.sub-check-period-error",t.ɵɵpureFunction0(4,_Y)))}class AY{constructor(e){this.fb=e,this.hideNewFields=!1,this.securityPolicyTypes=Ri,this.SecurityMode=Ki,this.destroy$=new te,this.serverConfigFormGroup=this.fb.group({url:["",[$.required,$.pattern(rn)]],timeoutInMillis:[1e3,[$.required,$.min(1e3)]],scanPeriodInMillis:[z,[$.required,$.min(1e3)]],pollPeriodInMillis:[5e3,[$.required,$.min(50)]],enableSubscriptions:[!0,[]],subCheckPeriodInMillis:[100,[$.required,$.min(100)]],showMap:[!1,[]],security:[Fi.BASIC128,[]],identity:[]}),this.serverConfigFormGroup.valueChanges.pipe(le(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=z,pollPeriodInMillis:i=5e3,enableSubscriptions:a=!0,subCheckPeriodInMillis:r=100,showMap:o=!1,security:s=Fi.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||AY)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:AY,selectors:[["tb-opc-server-config"]],inputs:{hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>AY)),multi:!0},{provide:K,useExisting:c((()=>AY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:63,vars:56,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","class","tb-error",3,"matTooltip",4,"ngIf"],[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",4,"ngFor","ngForOf"],["matInput","","type","number","min","1000","name","value","formControlName","scanPeriodInMillis",3,"placeholder"],["class","tb-form-row column-xs",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,TY,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,IY,2,5,"tb-error-icon",9)(18,EY,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.ɵɵtemplate(27,MY,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(28,"div",1)(29,"div",6),t.ɵɵpipe(30,"translate"),t.ɵɵelementStart(31,"div",7),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"mat-form-field",3),t.ɵɵelement(35,"input",13),t.ɵɵpipe(36,"translate"),t.ɵɵtemplate(37,kY,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵtemplate(38,DY,10,10,"div",14),t.ɵɵelementStart(39,"div",1)(40,"div",6),t.ɵɵpipe(41,"translate"),t.ɵɵelementStart(42,"div",7),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"mat-form-field",3),t.ɵɵelement(46,"input",15),t.ɵɵpipe(47,"translate"),t.ɵɵtemplate(48,OY,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(49,"div",16)(50,"mat-slide-toggle",17)(51,"mat-label",18),t.ɵɵpipe(52,"translate"),t.ɵɵelementStart(53,"div",7),t.ɵɵtext(54),t.ɵɵpipe(55,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(56,"div",16)(57,"mat-slide-toggle",19)(58,"mat-label",18),t.ɵɵpipe(59,"translate"),t.ɵɵtext(60),t.ɵɵpipe(61,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelement(62,"tb-security-config",20),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.serverConfigFormGroup.get("url").hasError("required")&&n.serverConfigFormGroup.get("url").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,26,"gateway.hints.opc-timeout")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,28,"gateway.timeout")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,30,"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,32,"gateway.hints.security-policy")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,34,"gateway.security-policy")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.securityPolicyTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(30,36,"gateway.hints.scan-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,38,"gateway.scan-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,40,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("scanPeriodInMillis").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(41,42,"gateway.hints.sub-check-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(44,44,"gateway.sub-check-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(47,46,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("subCheckPeriodInMillis").touched),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(52,48,"gateway.hints.enable-subscription")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(55,50,"gateway.enable-subscription")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(59,52,"gateway.hints.show-map")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(61,54,"gateway.show-map")," "),t.ɵɵadvance(2),t.ɵɵproperty("mode",n.SecurityMode.extendedCertificates))},dependencies:t.ɵɵgetComponentDepsFactory(AY,[j,_,wY,Gn,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("OpcServerConfigComponent",AY),Ge([I()],AY.prototype,"hideNewFields",void 0);class FY extends Na{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Oi,this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){return{server:e.server?Ha.mapServerToUpgradedVersion(e.server):{},mapping:e.server?.mapping?Ha.mapMappingToUpgradedVersion(e.server.mapping):[]}}getMappedValue(e){return{server:Ha.mapServerToDowngradedVersion(e)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(FY)))(n||FY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:FY,selectors:[["tb-opc-ua-legacy-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>FY)),multi:!0},{provide:K,useExisting:c((()=>FY)),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(FY,[j,_,wY,uY,AY]),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",FY),Ge([I()],FY.prototype,"withReportStrategy",void 0);class RY extends Na{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Oi,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(RY)))(n||RY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:RY,selectors:[["tb-opc-ua-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>RY)),multi:!0},{provide:K,useExisting:c((()=>RY)),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(RY,[j,_,wY,uY,AY]),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",RY),Ge([I()],RY.prototype,"withReportStrategy",void 0);class BY extends Na{constructor(){super(...arguments),this.withReportStrategy=!0,this.MappingType=Oi}initBasicFormGroup(){return this.fb.group({mapping:[],requestsMapping:[],broker:[],workers:[]})}getRequestDataArray(e){const t=[];return Fe(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(BY)))(n||BY)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:BY,inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵInheritDefinitionFeature]})}}function NY(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.max-number-of-workers-required"))}function LY(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.max-messages-queue-for-worker-required"))}e("MqttBasicConfigDirective",BY),Ge([I()],BY.prototype,"withReportStrategy",void 0);class VY{constructor(e){this.fb=e,this.destroy$=new te,this.workersConfigFormGroup=this.fb.group({maxNumberOfWorkers:[100,[$.required,$.min(1)]],maxMessageNumberPerWorker:[10,[$.required,$.min(1)]]}),this.workersConfigFormGroup.valueChanges.pipe(le(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||VY)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:VY,selectors:[["tb-workers-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>VY)),multi:!0},{provide:K,useExisting:c((()=>VY)),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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","name","value","type","number","min","1","formControlName","maxMessageNumberPerWorker",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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,NY,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,LY,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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("min")||n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("required")&&n.workersConfigFormGroup.get("maxNumberOfWorkers").touched),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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("min")||n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("required")&&n.workersConfigFormGroup.get("maxMessageNumberPerWorker").touched))},dependencies:t.ɵɵgetComponentDepsFactory(VY,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}function qY(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.host-required"))}function GY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",13),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 zY(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.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function UY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",15),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",VY);class jY{constructor(e,t){this.fb=e,this.cdr=t,this.mqttVersions=ni,this.portLimits=Ei,this.destroy$=new te,this.brokerConfigFormGroup=this.fb.group({host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],version:[5,[]],clientId:["tb_gw_"+Re(5),[$.pattern(rn)]],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_"+Re(5))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{version:t=5,clientId:n=`tb_gw_${Re(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||jY)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:jY,selectors:[["tb-broker-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>jY)),multi:!0},{provide:K,useExisting:c((()=>jY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:16,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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["formControlName","version"],[3,"value",4,"ngFor","ngForOf"],["matInput","","name","value","formControlName","clientId",3,"placeholder"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip","click",4,"ngIf"],["formControlName","security"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,qY,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,GY,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.ɵɵtemplate(20,zY,2,2,"mat-option",9),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",1)(22,"div",7),t.ɵɵtext(23,"gateway.client-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",3),t.ɵɵelement(25,"input",10),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,UY,4,3,"button",11),t.ɵɵelementEnd()(),t.ɵɵelement(28,"tb-security-config",12),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.brokerConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,10,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.brokerConfigFormGroup.get("host").hasError("required")&&n.brokerConfigFormGroup.get("host").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.brokerConfigFormGroup.get("port").hasError("required")||n.brokerConfigFormGroup.get("port").hasError("min")||n.brokerConfigFormGroup.get("port").hasError("max"))&&n.brokerConfigFormGroup.get("port").touched),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.mqttVersions),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!n.brokerConfigFormGroup.get("clientId").value))},dependencies:t.ɵɵgetComponentDepsFactory(jY,[j,_,wY,jW]),encapsulation:2,changeDetection:d.OnPush})}}e("BrokerConfigControlComponent",jY);class HY extends BY{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(HY)))(n||HY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:HY,selectors:[["tb-mqtt-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>HY)),multi:!0},{provide:K,useExisting:c((()=>HY)),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(HY,[j,_,VY,jY,uY]),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",HY);class WY extends BY{mapConfigToFormValue(e){const{broker:t,mapping:n=[],connectRequests:i=[],disconnectRequests:a=[],attributeRequests:r=[],attributeUpdates:o=[],serverSideRpc:s=[]}=e,l=Da.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:Da.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:Da.mapMappingToDowngradedVersion(i),...Da.mapRequestsToDowngradedVersion(r)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(WY)))(n||WY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:WY,selectors:[["tb-mqtt-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>WY)),multi:!0},{provide:K,useExisting:c((()=>WY)),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(WY,[j,_,VY,jY,uY]),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",WY);class $Y extends A{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=Ei,this.modbusProtocolTypes=Object.values(Yi),this.modbusMethodTypes=Object.values(Xi),this.modbusSerialMethodTypes=Object.values(Zi),this.modbusParities=Object.values(Qi),this.modbusByteSizes=ia,this.modbusBaudrates=na,this.modbusOrderType=Object.values(Ji),this.ModbusProtocolType=Yi,this.ModbusParityLabelsMap=pa,this.ModbusProtocolLabelsMap=la,this.ModbusMethodLabelsMap=sa,this.ReportStrategyDefaultValue=tn,this.modbusHelpLink=O+"/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 te,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&&!Se(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:[Yi.TCP],host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],serialPort:["",[$.required,$.pattern(rn)]],method:[Xi.SOCKET,[$.required]],baudrate:[this.modbusBaudrates[0]],stopbits:[1],bytesize:[ia[0]],parity:[Qi.None],strict:[!0],unitId:[null,[$.required]],deviceName:["",[$.required,$.pattern(rn)]],deviceType:["",[$.required,$.pattern(rn)]],timeout:[35],byteOrder:[Ji.BIG],wordOrder:[Ji.BIG],retries:[!0],retryOnEmpty:[!0],retryOnInvalid:[!0],pollPeriod:[1e3,[$.required]],connectAttemptTimeMs:[500,[$.required]],connectAttemptCount:[5,[$.required]],waitAfterFailedAttemptsMs:[3e4,[$.required]],values:[{}],security:[{}]}),this.addFieldsToFormGroup()}updateSlaveFormGroup(){this.slaveConfigFormGroup.patchValue({...this.data.value,port:this.data.value.type===Yi.Serial?null:this.data.value.port,serialPort:this.data.value.type===Yi.Serial?this.data.value.port:"",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(le(this.destroy$)).subscribe((e=>{this.updateControlsEnabling(e),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Xi.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Yi.Serial?Zi.ASCII:Xi.SOCKET,{emitEvent:!1})}updateControlsEnabling(e){const[t,n]=e===Yi.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(le(this.destroy$)).subscribe((e=>this.updateSecurityEnabling(e)))}updateSecurityEnabling(e){e&&this.protocolType!==Yi.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||$Y)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵdir=t.ɵɵdefineDirective({type:$Y,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusSlaveDialogAbstract",$Y);const KY=()=>({maxWidth:"970px"});function YY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),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 XY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"span",23),t.ɵɵtext(5),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",24),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"span",25),t.ɵɵtext(10),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",24),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"span",25),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 ZY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",45),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 QY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function JY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),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 eX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",35),t.ɵɵtext(2,"gateway.function-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32)(4,"mat-select",47),t.ɵɵtemplate(5,JY,3,4,"mat-option",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.functionCodesMap.get(e.get("id").value)||n.defaultFunctionCodes)}}function tX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.objects-count-required"))}function nX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),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 iX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",49),t.ɵɵelement(5,"input",50),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,nX,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("bit").hasError("max")&&e.get("bit").touched)}}function aX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),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 rX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit-target-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",51)(5,"mat-form-field",52)(6,"mat-select",53),t.ɵɵtemplate(7,aX,3,4,"mat-option",37),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.bit-target-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.bitTargetTypes)}}function oX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,iX,8,7,"div",38)(2,rX,8,4,"div",38),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("objectsCount").value>1),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields)}}function sX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function lX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵelement(1,"mat-icon",62),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 pX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.modifier-invalid"))}function cX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",54)(1,"mat-expansion-panel",15)(2,"mat-expansion-panel-header",16)(3,"mat-panel-title")(4,"mat-slide-toggle",55),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label",56),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",51)(10,"div",57)(11,"div",35),t.ɵɵtext(12,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",52)(14,"mat-select",58)(15,"mat-select-trigger")(16,"div",59),t.ɵɵelement(17,"mat-icon",60),t.ɵɵelementStart(18,"span"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(21,lX,5,5,"mat-option",37),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(22,"div",30)(23,"div",35),t.ɵɵtext(24,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",49),t.ɵɵelement(26,"input",61),t.ɵɵpipe(27,"translate"),t.ɵɵtemplate(28,pX,3,3,"mat-icon",34),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,9,"gateway.hints.modbus.modifier")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,11,"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,13,null==(n=a.ModifierTypesMap.get(i.get("modifierType").value))?null:n.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",a.modifierTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(27,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",i.get("modifierValue").hasError("pattern")&&i.get("modifierValue").touched)}}function dX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function uX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",63),t.ɵɵtext(2,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32),t.ɵɵelement(4,"input",64),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,dX,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function mX(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",65),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Key)("isExpansionMode",!0)}}function hX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",26),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelement(3,"div",27),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",28)(5,"div",29),t.ɵɵtext(6,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",30)(8,"div",31),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",32),t.ɵɵelement(13,"input",33),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,ZY,3,3,"mat-icon",34),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",28)(17,"div",29),t.ɵɵtext(18,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",30)(20,"div",35),t.ɵɵtext(21," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",32)(23,"mat-select",36),t.ɵɵtemplate(24,QY,2,2,"mat-option",37),t.ɵɵelementEnd()()(),t.ɵɵtemplate(25,eX,6,1,"div",38),t.ɵɵelementStart(26,"div",30)(27,"div",39),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"gateway.objects-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",32),t.ɵɵelement(31,"input",40),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,tX,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,oX,3,2,"ng-container",41),t.ɵɵelementStart(35,"div",30)(36,"div",39),t.ɵɵpipe(37,"translate"),t.ɵɵtext(38,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"mat-form-field",32),t.ɵɵelement(40,"input",42),t.ɵɵpipe(41,"translate"),t.ɵɵtemplate(42,sX,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(43,cX,29,17,"div",43)(44,uX,7,4,"div",38)(45,mX,1,2,"tb-report-strategy",44),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,20,"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(36,KY)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(9,22,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.hints.modbus.method":"gateway.hints.modbus.key")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,24,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.method-name":"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,26,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("tag").hasError("required")&&e.get("tag").touched),t.ɵɵadvance(9),t.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withFunctionCode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(28,28,"gateway.hints.modbus.objects-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,30,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(e.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("objectsCount").hasError("required")&&e.get("objectsCount").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("type").value===n.ModbusDataType.BITS),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(37,32,"gateway.hints.modbus.address")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(41,34,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("address").hasError("required")&&e.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.showModifiersMap.get(e.get("id").value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy)}}function gX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,YY,2,3,"div",17)(7,XY,16,12,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,hX,46,37,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),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.last,a=t.ɵɵreference(8),r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.isMaster)("ngIfElse",a),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function fX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,gX,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByControlId)}}function yX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",66)(1,"span",67),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class vX{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($t),this.modifierTypes=Object.values(ha),this.bitTargetTypes=Object.values(ra),this.BitTargetTypeTranslationMap=oa,this.ModbusEditableDataTypes=Kt,this.ModbusFunctionCodeTranslationsMap=Qt,this.ModifierTypesMap=ga,this.ReportStrategyDefaultValue=tn,this.ModbusDataType=$t,this.ModbusValueKey=ta,this.destroy$=new te,this.defaultReadFunctionCodes=[3,4],this.bitsReadFunctionCodes=[1,2],this.defaultWriteFunctionCodes=[6,16],this.bitsWriteFunctionCodes=[5,15]}ngOnInit(){this.withFunctionCode=!this.isMaster||this.keysType!==ta.ATTRIBUTES&&this.keysType!==ta.TIMESERIES,this.withReportStrategy=!(this.isMaster||this.keysType!==ta.ATTRIBUTES&&this.keysType!==ta.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=Re(5),t=this.fb.group({tag:["",[$.required,$.pattern(rn)]],value:[{value:"",disabled:!this.isMaster},[$.required,$.pattern(rn)]],type:[$t.BYTES,[$.required]],address:[null,[$.required]],objectsCount:[1,[$.required]],functionCode:[{value:this.getDefaultFunctionCodes()[0],disabled:!this.withFunctionCode},[$.required]],reportStrategy:[{value:null,disabled:!this.withReportStrategy}],modifierType:[{value:ha.MULTIPLIER,disabled:!0}],modifierValue:[{value:1,disabled:!0},[$.pattern(sn)]],bit:[{value:null,disabled:!0}],bitTargetType:[{value:ra.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=Re(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,[$.required,$.pattern(rn)]],value:[{value:n,disabled:!this.isMaster},[$.required,$.pattern(rn)]],type:[i,[$.required]],address:[a,[$.required]],objectsCount:[r,[$.required]],functionCode:[{value:o,disabled:!this.withFunctionCode},[$.required]],modifierType:[{value:l?ha.DIVIDER:ha.MULTIPLIER,disabled:!this.enableModifiersControlMap.get(u).value}],bit:[{value:c,disabled:i!==$t.BITS||r<2},[$.max(r-1)]],bitTargetType:[{value:d??ra.IntegerType,disabled:i!==$t.BITS||this.hideNewFields}],modifierValue:[{value:s??l??1,disabled:!this.enableModifiersControlMap.get(u).value},[$.pattern(sn)]],id:[{value:u,disabled:!0}],reportStrategy:[{value:p,disabled:!this.withReportStrategy}]})}shouldShowModifier(e){return!(this.isMaster||this.keysType!==ta.ATTRIBUTES&&this.keysType!==ta.TIMESERIES||this.ModbusEditableDataTypes.includes(e))}observeKeyDataType(e){e.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((t=>{this.ModbusEditableDataTypes.includes(t)||e.get("objectsCount").patchValue(Yt[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(ue((()=>e.get("type").value===$t.BITS)),le(this.destroy$)).subscribe((()=>this.toggleBitsFields(e)))}toggleBitsFields(e){const{objectsCount:t,type:n,bit:i,bitTargetType:a}=e.controls,r=n.value===$t.BITS,o=t.value>1;r&&o?(i.enable({emitEvent:!1}),i.setValidators($.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(le(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===$t.BITS?this.bitsWriteFunctionCodes:[],...this.defaultWriteFunctionCodes];if(this.keysType===ta.ATTRIBUTES_UPDATES)return t.sort(((e,t)=>e-t));const n=[...this.defaultReadFunctionCodes];return e===$t.BITS&&n.push(...this.bitsReadFunctionCodes),this.keysType===ta.RPC_REQUESTS&&n.push(...t),n.sort(((e,t)=>e-t))}getDefaultFunctionCodes(){return this.keysType===ta.ATTRIBUTES_UPDATES?this.defaultWriteFunctionCodes:this.keysType===ta.RPC_REQUESTS?[...this.defaultReadFunctionCodes,...this.defaultWriteFunctionCodes]:this.defaultReadFunctionCodes}static{this.ɵfac=function(e){return new(e||vX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:vX,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:19,vars:16,consts:[["noKeys",""],["tagName",""],[1,"tb-modbus-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container","tbTruncateWithTooltip","",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["tbTruncateWithTooltip","",1,"title-container"],[1,"tb-flex"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["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"],[4,"ngIf"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"defaultValue","isExpansionMode",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,"tb-form-panel","stroked","tb-slide-toggle"],[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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,fX,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,yX,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(vX,[j,_,Zn,Gn]),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: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",vX),Ge([I()],vX.prototype,"isMaster",void 0),Ge([I()],vX.prototype,"hideNewFields",void 0);const xX=()=>({$implicit:null}),bX=e=>({$implicit:e});function wX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7),t.ɵɵelementContainer(2,8),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(4);t.ɵɵadvance(),t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",n)("ngTemplateOutletContext",t.ɵɵpureFunction0(3,xX))}}function SX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab",11),t.ɵɵpipe(1,"translate"),t.ɵɵelementStart(2,"div",7),t.ɵɵelementContainer(3,8),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2),a=t.ɵɵreference(4);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,bX,e))}}function CX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group",9),t.ɵɵtemplate(1,SX,4,8,"mat-tab",10),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.modbusRegisterTypes)}}function _X(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 TX(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 IX(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 EX(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 MX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵtext(2,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",14)(4,"mat-chip-listbox",15),t.ɵɵtemplate(5,_X,2,1,"mat-chip",16),t.ɵɵelementStart(6,"mat-chip",17),t.ɵɵelement(7,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",19,2),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(9),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES,i))})),t.ɵɵelementStart(11,"tb-icon",20),t.ɵɵtext(12,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(13,"div",12)(14,"div",13),t.ɵɵtext(15,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-chip-listbox",15),t.ɵɵtemplate(18,TX,2,1,"mat-chip",16),t.ɵɵelementStart(19,"mat-chip",17),t.ɵɵelement(20,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(21,"button",19,3),t.ɵɵpipe(23,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(22),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.TIMESERIES,i))})),t.ɵɵelementStart(24,"tb-icon",20),t.ɵɵtext(25,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(26,"div",12)(27,"div",13),t.ɵɵtext(28,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",14)(30,"mat-chip-listbox",15),t.ɵɵtemplate(31,IX,2,1,"mat-chip",16),t.ɵɵelementStart(32,"mat-chip",17),t.ɵɵelement(33,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"button",19,4),t.ɵɵpipe(36,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(35),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES_UPDATES,i))})),t.ɵɵelementStart(37,"tb-icon",20),t.ɵɵtext(38,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(39,"div",12)(40,"div",13),t.ɵɵtext(41,"gateway.rpc-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",14)(43,"mat-chip-listbox",15),t.ɵɵtemplate(44,EX,2,1,"mat-chip",16),t.ɵɵelementStart(45,"mat-chip",17),t.ɵɵelement(46,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"button",19,5),t.ɵɵpipe(49,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(48),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.RPC_REQUESTS,i))})),t.ɵɵelementStart(50,"tb-icon",20),t.ɵɵtext(51,"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.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,16,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(23,18,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(36,20,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,22,"action.edit")),t.ɵɵproperty("disabled",i.disabled)}}class kX{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(ea),this.modbusValueKeys=Object.values(ta),this.ModbusValuesTranslationsMap=aa,this.ModbusValueKey=ta}ngOnInit(){this.initializeValuesFormGroup(),this.observeValuesChanges()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){if(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:da.get(n),deleteKeyTitle:ua.get(n),noKeysText:ma.get(n),hideNewFields:this.hideNewFields};this.popoverComponent=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,vX,"leftBottom",!1,null,o,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(wn(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(wn(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||kX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:kX,selectors:[["tb-modbus-values"]],inputs:{singleMode:"singleMode",hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>kX)),multi:!0},{provide:K,useExisting:c((()=>kX)),multi:!0}]),t.ɵɵStandaloneFeature],decls:5,vars:2,consts:[["multipleView",""],["singleView",""],["attributesButton",""],["telemetryButton",""],["attributesUpdatesButton",""],["rpcRequestsButton",""],[4,"ngIf","ngIfElse"],[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"formGroup"],[3,"label",4,"ngFor","ngForOf"],[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"],[4,"ngFor","ngForOf"],[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){if(1&e&&t.ɵɵtemplate(0,wX,3,4,"ng-container",6)(1,CX,2,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(3,MX,52,24,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2);t.ɵɵproperty("ngIf",n.singleMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(kX,[j,_,zn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .mat-mdc-tab-body-wrapper{min-height:320px} .mdc-evolution-chip-set__chips{align-items:center}'],changeDetection:d.OnPush})}}function PX(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",16),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function DX(e,n){1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-slide-toggle",18)(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",kX),Ge([I()],kX.prototype,"singleMode",void 0),Ge([I()],kX.prototype,"hideNewFields",void 0);class OX{constructor(e,t){this.fb=e,this.cdr=t,this.isMaster=!1,this.disabled=!1,this.destroy$=new te,this.securityConfigFormGroup=this.fb.group({certfile:["",[$.pattern(rn)]],keyfile:["",[$.pattern(rn)]],password:["",[$.pattern(rn)]],server_hostname:["",[$.pattern(rn)]],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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}static{this.ɵfac=function(e){return new(e||OX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:OX,selectors:[["tb-modbus-security-config"]],inputs:{isMaster:"isMaster"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>OX)),multi:!0},{provide:K,useExisting:c((()=>OX)),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","formControlName","certfile",3,"placeholder"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","keyfile",3,"placeholder"],["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"],["class","tb-form-row space-between tb-flex fill-width",4,"ngIf"],["class","tb-form-row",4,"ngIf"],["matInput","","name","value","formControlName","server_hostname",3,"placeholder"],[1,"tb-form-row"],["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,PX,7,3,"div",14)(32,DX,5,3,"div",15),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.ɵɵproperty("ngIf",!n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster))},dependencies:t.ɵɵgetComponentDepsFactory(OX,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}function AX(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),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 FX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function RX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,FX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function BX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 NX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,BX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function LX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function VX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,LX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function qX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 GX(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 zX(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 UX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 jX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,GX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,zX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,UX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function HX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function WX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function $X(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function KX(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 YX(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function XX(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 ZX(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 QX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",OX),Ge([I()],OX.prototype,"isMaster",void 0);class JX extends $Y{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===Yi.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||JX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:JX,selectors:[["tb-modbus-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,AX,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,RX,8,7,"div",15)(20,NX,8,9,"div",16)(21,VX,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,qX,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,jX,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,HX,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,WX,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,$X,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,KX,5,3,"div",28)(54,YX,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,XX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,ZX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,QX,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),i=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",i),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(JX,[j,_,kX,OX,jW,Zn,Gn]),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 eZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),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 tZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function nZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,tZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function iZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 aZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,iZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function rZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function oZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,rZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function sZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 lZ(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 pZ(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 cZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 dZ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,lZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,pZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,cZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function uZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function mZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function hZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function gZ(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 fZ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function yZ(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 vZ(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 xZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",JX);class bZ extends $Y{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===Yi.Serial&&(a.port=n),Te(a),a}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("sendDataOnlyOnChange",this.fb.control(!1))}static{this.ɵfac=function(e){return new(e||bZ)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bZ,selectors:[["tb-modbus-legacy-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,eZ,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,nZ,8,7,"div",15)(20,aZ,8,9,"div",16)(21,oZ,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,sZ,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,dZ,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,uZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,mZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,hZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,gZ,5,3,"div",28)(54,fZ,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,yZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,vZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,xZ,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),i=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",i),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(bZ,[j,_,kX,OX,jW,Zn]),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 wZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",38),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 SZ(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.host-required"))}function CZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",39),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,SZ,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function _Z(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",40),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 TZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",41),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,_Z,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function IZ(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.port-required"))}function EZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",42),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,IZ,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched)}}function MZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),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 kZ(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.unit-id-required"))}function PZ(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-required"))}function DZ(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-profile-required"))}function OZ(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.ɵɵtextInterpolate(e)}}function AZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12)(5,"mat-select",43),t.ɵɵtemplate(6,OZ,2,2,"mat-option",6),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates)}}function FZ(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.ɵɵtextInterpolate(e)}}function RZ(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.ɵɵtextInterpolate(e)}}function BZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",44)(1,"mat-expansion-panel",45)(2,"mat-expansion-panel-header",46)(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"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",48),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",bZ);class NZ{constructor(e){this.fb=e,this.ModbusProtocolLabelsMap=la,this.ModbusMethodLabelsMap=sa,this.portLimits=Ei,this.modbusProtocolTypes=Object.values(Yi),this.modbusMethodTypes=Object.values(Xi),this.modbusSerialMethodTypes=Object.values(Zi),this.modbusOrderType=Object.values(Ji),this.ModbusProtocolType=Yi,this.modbusBaudrates=na,this.isSlaveEnabled=!1,this.serialSpecificControlKeys=["serialPort","baudrate"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new te,this.showSecurityControl=this.fb.control(!1),this.slaveConfigFormGroup=this.fb.group({type:[Yi.TCP],host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],serialPort:["",[$.required,$.pattern(rn)]],method:[Xi.SOCKET],unitId:[null,[$.required]],baudrate:[this.modbusBaudrates[0]],deviceName:["",[$.required,$.pattern(rn)]],deviceType:["",[$.required,$.pattern(rn)]],pollPeriod:[1e3,[$.required]],sendDataToThingsBoard:[!1],byteOrder:[Ji.BIG],wordOrder:[Ji.BIG],security:[],identity:this.fb.group({vendorName:["",[$.pattern(rn)]],productCode:["",[$.pattern(rn)]],vendorUrl:["",[$.pattern(rn)]],productName:["",[$.pattern(rn)]],modelName:["",[$.pattern(rn)]]}),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&&!Se(e.security,{})),this.updateSlaveConfig(e)}setDisabledState(e){this.isSlaveEnabled=!e,this.updateFormEnableState()}observeValueChanges(){this.slaveConfigFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{e.type===Yi.Serial&&(e.port=e.serialPort,delete e.serialPort),this.onChange(e),this.onTouched()}))}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateFormEnableState(),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Xi.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Yi.Serial?Zi.ASCII:Xi.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(le(this.destroy$)).subscribe((e=>this.updateSecurityEnable(e)))}updateSecurityEnable(e){e&&this.isSlaveEnabled&&this.protocolType!==Yi.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}updateEnablingByProtocol(){const e=this.protocolType===Yi.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=Yi.TCP,method:l=Xi.RTU,unitId:p=0,deviceName:c="",deviceType:d="",pollPeriod:u=1e3,sendDataToThingsBoard:m=!1,byteOrder:h=Ji.BIG,wordOrder:g=Ji.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===Yi.Serial?"":x,port:s===Yi.Serial?null:b,serialPort:s===Yi.Serial?b:""};this.slaveConfigFormGroup.setValue(w,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||NZ)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:NZ,selectors:[["tb-modbus-slave-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>NZ)),multi:!0},{provide:K,useExisting:c((()=>NZ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:112,vars:59,consts:[["serialPort",""],[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",4,"ngFor","ngForOf"],[1,"tb-form-panel","no-border","no-padding","padding-top"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[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"],[3,"value"],["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-form-panel","stroked","tb-slide-toggle"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],["formControlName","security"]],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.server-slave-config"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",5),t.ɵɵtemplate(6,wZ,2,2,"tb-toggle-option",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",7),t.ɵɵtemplate(8,CZ,8,7,"div",8)(9,TZ,8,9,"div",9)(10,EZ,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",10)(13,"div",11),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-form-field",12)(17,"mat-select",13),t.ɵɵtemplate(18,MZ,2,2,"mat-option",6),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",10)(20,"div",14),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",12),t.ɵɵelement(24,"input",15),t.ɵɵpipe(25,"translate"),t.ɵɵtemplate(26,kZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(27,"div",10)(28,"div",17),t.ɵɵtext(29,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",12),t.ɵɵelement(31,"input",18),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,PZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",10)(35,"div",17),t.ɵɵtext(36,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",12),t.ɵɵelement(38,"input",19),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,DZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(41,"div",10)(42,"div",20),t.ɵɵpipe(43,"translate"),t.ɵɵelementStart(44,"span",21),t.ɵɵtext(45," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",12),t.ɵɵelement(47,"input",22),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(49,AZ,7,4,"div",8),t.ɵɵelementStart(50,"div",23)(51,"mat-slide-toggle",24)(52,"mat-label"),t.ɵɵtext(53),t.ɵɵpipe(54,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(55,"div",25)(56,"mat-expansion-panel",26)(57,"mat-expansion-panel-header")(58,"mat-panel-title")(59,"div",27),t.ɵɵtext(60,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(61,"div",7)(62,"div",10)(63,"div",11),t.ɵɵpipe(64,"translate"),t.ɵɵtext(65,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(66,"mat-form-field",12)(67,"mat-select",28),t.ɵɵtemplate(68,FZ,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵelementStart(69,"div",10)(70,"div",11),t.ɵɵpipe(71,"translate"),t.ɵɵtext(72,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(73,"mat-form-field",12)(74,"mat-select",29),t.ɵɵtemplate(75,RZ,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵtemplate(76,BZ,9,5,"div",30),t.ɵɵelementContainerStart(77,31),t.ɵɵelementStart(78,"div",10)(79,"div",4),t.ɵɵtext(80,"gateway.vendor-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",12),t.ɵɵelement(82,"input",32),t.ɵɵpipe(83,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"div",10)(85,"div",4),t.ɵɵtext(86,"gateway.product-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(87,"mat-form-field",12),t.ɵɵelement(88,"input",33),t.ɵɵpipe(89,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(90,"div",10)(91,"div",4),t.ɵɵtext(92,"gateway.vendor-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(93,"mat-form-field",12),t.ɵɵelement(94,"input",34),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(96,"div",10)(97,"div",4),t.ɵɵtext(98,"gateway.product-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(99,"mat-form-field",12),t.ɵɵelement(100,"input",35),t.ɵɵpipe(101,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(102,"div",10)(103,"div",4),t.ɵɵtext(104,"gateway.model-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(105,"mat-form-field",12),t.ɵɵelement(106,"input",36),t.ɵɵpipe(107,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()(),t.ɵɵelementStart(108,"div",25)(109,"div",27),t.ɵɵtext(110,"gateway.values"),t.ɵɵelementEnd(),t.ɵɵelement(111,"tb-modbus-values",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵreference(11);t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(14,29,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,31,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(25,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,35,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(39,37,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(43,39,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(48,41,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(54,43,"gateway.send-data-to-platform")," "),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(64,45,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(71,47,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup.get("identity")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(83,49,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(89,51,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(95,53,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(101,55,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(107,57,"gateway.set"))}},dependencies:t.ɵɵgetComponentDepsFactory(NZ,[j,_,kX,OX,jW,Gn]),encapsulation:2,changeDetection:d.OnPush})}}e("ModbusSlaveConfigComponent",NZ);const LZ=["searchInput"],VZ=()=>["deviceName","info","unitId","type","actions"],qZ=()=>({minWidth:"96px",textAlign:"center"});function GZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",28)(2,"span",29),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",11),t.ɵɵelementStart(6,"button",13),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",13),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 zZ(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 UZ(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 jZ(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 HZ(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 WZ(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 $Z(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 KZ(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 YZ(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 XZ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function ZZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",13),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 QZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,ZZ,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,qZ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function JZ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function eQ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class tQ{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=la,this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new te,this.masterFormGroup=this.fb.group({slaves:this.fb.array([])}),this.dataSource=new nQ}get slaves(){return this.masterFormGroup.get("slaves")}ngOnInit(){this.masterFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e.slaves),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t),i=n?this.slaves.at(t).value:{};this.getSlaveDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(n?this.slaves.at(t).patchValue(e):this.slaves.push(this.fb.control(e)),this.masterFormGroup.markAsDirty())}))}getSlaveDialog(e,t){return this.isLegacy?this.dialog.open(bZ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,hideNewFields:!0,buttonTitle:t}}):this.dialog.open(JX,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,hideNewFields:!1}})}deleteSlave(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-slave-title",{name:this.slaves.controls[t].value.deviceName}),this.translate.instant("gateway.delete-slave-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(this.slaves.removeAt(t),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||tQ)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:tQ,selectors:[["tb-modbus-master-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(LZ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{isLegacy:"isLegacy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>tQ)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,GZ,14,9,"div",8),t.ɵɵpipe(8,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-toolbar",7)(10,"div",9)(11,"button",10),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"mat-icon"),t.ɵɵtext(14,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",11)(16,"mat-label"),t.ɵɵtext(17," "),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",12,0),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",13),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",14)(26,"table",15),t.ɵɵelementContainerStart(27,16),t.ɵɵtemplate(28,zZ,4,3,"mat-header-cell",17)(29,UZ,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(30,16),t.ɵɵtemplate(31,jZ,3,3,"mat-header-cell",17)(32,HZ,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(33,16),t.ɵɵtemplate(34,WZ,3,3,"mat-header-cell",17)(35,$Z,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(36,16),t.ɵɵtemplate(37,KZ,4,3,"mat-header-cell",17)(38,YZ,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(39,19),t.ɵɵtemplate(40,XZ,1,0,"mat-header-cell",20)(41,QZ,12,6,"mat-cell",21),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(42,JZ,1,0,"mat-header-row",22)(43,eQ,1,0,"mat-row",23),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"section",24),t.ɵɵpipe(45,"async"),t.ɵɵelementStart(46,"button",25),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageSlave(i))})),t.ɵɵelementStart(47,"mat-icon",26),t.ɵɵtext(48,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"span"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(52,"span",27),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(8,25,n.dataSource.isEmpty())),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,VZ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(40,VZ)),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(tQ,[j,_,Gn]),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",tQ),Ge([ot()],tQ.prototype,"isLegacy",void 0);class nQ extends G{constructor(){super()}}e("SlavesDatasource",nQ);class iQ extends Na{constructor(){super(),this.enableSlaveControl=new X(!1),this.enableSlaveControl.valueChanges.pipe(wn()).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&&(Se(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&&!Se(e.slave,{}))}static{this.ɵfac=function(e){return new(e||iQ)}}static{this.ɵdir=t.ɵɵdefineDirective({type:iQ,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusBasicConfigDirective",iQ);class aQ extends iQ{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(aQ)))(n||aQ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:aQ,selectors:[["tb-modbus-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>aQ)),multi:!0},{provide:K,useExisting:c((()=>aQ)),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(aQ,[j,_,NZ,tQ,zn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusBasicConfigComponent",aQ);class rQ extends iQ{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(rQ)))(n||rQ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:rQ,selectors:[["tb-modbus-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>rQ)),multi:!0},{provide:K,useExisting:c((()=>rQ)),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(rQ,[j,_,NZ,tQ,zn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusLegacyBasicConfigComponent",rQ);const oQ=()=>({maxWidth:"970px"});function sQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," ")}}function lQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("methodRPC").value)}}function pQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("attributeOnThingsBoard").value)}}function cQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate2(" ",e.get("requestExpression").value+" - ","",e.get("attributeNameExpression").value," ")}}function dQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21),t.ɵɵtemplate(1,lQ,2,1,"ng-container",22)(2,pQ,2,1,"ng-container",22)(3,cQ,2,2,"ng-container",22),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngSwitch",e.keysType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_UPDATES),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_REQUESTS)}}function uQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function mQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function hQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function gQ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",42),2&e){const e=t.ɵɵnextContext(5);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function fQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"div",28)(11,"mat-form-field",29),t.ɵɵelement(12,"input",30),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,uQ,3,3,"mat-icon",31),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",26)(19,"div",32)(20,"span",33),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"div",34),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"label",35),t.ɵɵtext(25,"from"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",36),t.ɵɵelement(27,"input",37),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,mQ,3,3,"mat-icon",31),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"label",38),t.ɵɵtext(31,"to"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",36),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,hQ,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(36,gQ,1,2,"tb-report-strategy",40),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),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,oQ)),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteFrom").hasError("required")&&e.get("byteFrom").touched),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteTo").hasError("required")&&e.get("byteTo").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy&&(n.keysType===n.SocketValueKey.ATTRIBUTES||n.keysType===n.SocketValueKey.TIMESERIES))}}function yQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function vQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function xQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",43),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29),t.ɵɵelement(7,"input",44),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,yQ,3,3,"mat-icon",31),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",26)(11,"div",45),t.ɵɵpipe(12,"translate"),t.ɵɵtext(13," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",28)(15,"mat-form-field",29)(16,"mat-select",46),t.ɵɵtemplate(17,vQ,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(18,"div",48)(19,"mat-slide-toggle",49),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(20,"mat-label",50),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,7,"gateway.method-name")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("methodRPC").hasError("required")&&e.get("methodRPC").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(12,11,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,13,"gateway.hints.socket.with-response")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,15,"gateway.rpc.withResponse")," ")}}function bQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 wQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 SQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-expression-required"))}function CQ(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/request-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,oQ))}function _Q(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 TQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 IQ(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/attribute-name-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,oQ))}function EQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",52),t.ɵɵtemplate(8,bQ,3,4,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",53)(14,"mat-form-field",29)(15,"mat-select",54),t.ɵɵtemplate(16,wQ,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-form-field",29),t.ɵɵelement(18,"input",55),t.ɵɵpipe(19,"translate"),t.ɵɵtemplate(20,SQ,3,3,"mat-icon",31)(21,CQ,1,3,"div",56),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",26)(23,"div",43),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"div",53)(27,"mat-form-field",29)(28,"mat-select",57),t.ɵɵtemplate(29,_Q,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"mat-form-field",29),t.ɵɵelement(31,"input",58),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,TQ,3,3,"mat-icon",31)(34,IQ,1,3,"div",56),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,12,"gateway.hints.socket.attribute-requests-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.requestsType),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,14,"gateway.request-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("requestExpression").hasError("required")&&e.get("requestExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("requestExpressionSource").value===n.ExpressionType.Expression),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,18,"gateway.attribute-name-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,20,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeNameExpression").hasError("required")&&e.get("attributeNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("attributeNameExpressionSource").value===n.ExpressionType.Expression)}}function MQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function kQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 PQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",46),t.ɵɵtemplate(8,MQ,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",28)(14,"mat-form-field",29),t.ɵɵelement(15,"input",59),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,kQ,3,3,"mat-icon",31),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,5,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.attribute-on-platform")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeOnThingsBoard").hasError("required")&&e.get("attributeOnThingsBoard").touched)}}function DQ(e,n){if(1&e&&t.ɵɵtemplate(0,fQ,37,27,"div",23)(1,xQ,24,17,"div",23)(2,EQ,35,22,"div",23)(3,PQ,18,11,"div",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.TIMESERIES||e.keysType===e.SocketValueKey.ATTRIBUTES),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_UPDATES)}}function OQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,sQ,2,1,"div",17)(7,dQ,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,DQ,4,4,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),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.last,a=t.ɵɵreference(8),r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.keysType===r.SocketValueKey.TIMESERIES||r.keysType===r.SocketValueKey.ATTRIBUTES)("ngIfElse",a),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function AQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,OQ,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function FQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",60)(1,"span",61),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class RQ extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=new u,this.SocketValueKey=pi,this.socketEncoding=Object.values(ht),this.requestsType=Object.values(di),this.expressionType=Object.values(ui),this.ExpressionType=ui,this.ReportStrategyDefaultValue=tn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===pi.RPC_METHODS?this.fb.group({methodRPC:["",[$.required]],encoding:[ht.UTF16,[$.required]],withResponse:[!0]}):this.keysType===pi.ATTRIBUTES_UPDATES?this.fb.group({encoding:[ht.UTF16,[$.required]],attributeOnThingsBoard:["",[$.required]]}):this.keysType===pi.ATTRIBUTES_REQUESTS?this.fb.group({type:[di.Shared],requestExpressionSource:[ui.Constant],attributeNameExpressionSource:[ui.Constant],requestExpression:["",[$.required]],attributeNameExpression:["",[$.required]]}):this.fb.group({key:["",[$.required,$.pattern(rn)]],byteFrom:[0,[$.required]],byteTo:[0,[$.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===pi.RPC_METHODS){const t=e;n=this.fb.group({methodRPC:[t.methodRPC,[$.required]],encoding:[t.encoding,[$.required]],withResponse:[t.withResponse]})}else if(this.keysType===pi.ATTRIBUTES_REQUESTS){const t=e;n=this.fb.group({type:[t.type??di.Shared],requestExpressionSource:[t.requestExpressionSource??ui.Constant],attributeNameExpressionSource:[t.attributeNameExpressionSource??ui.Constant],requestExpression:[t.requestExpression,[$.required]],attributeNameExpression:[t.attributeNameExpression,[$.required]]})}else if(this.keysType===pi.ATTRIBUTES_UPDATES)n=this.fb.group({encoding:[e.encoding??ht.UTF16],attributeOnThingsBoard:[e.attributeOnThingsBoard,[$.required]]});else{const{key:t,byteFrom:i,byteTo:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[$.required,$.pattern(rn)]],byteFrom:[i??0,[$.required]],byteTo:[a??0,[$.required]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)})),this.fb.array(t)}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===pi.ATTRIBUTES||this.keysType===pi.TIMESERIES))}static{this.ɵfac=function(e){return new(e||RQ)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:RQ,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:19,vars:16,consts:[["noKeys",""],["valueTitle",""],[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"title-container"],[1,"title-container",3,"ngSwitch"],[4,"ngSwitchCase"],["class","tb-form-panel no-border no-padding",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],[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",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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",4,"ngFor","ngForOf"],[1,"tb-form-row"],["formControlName","withResponse",1,"mat-slide",3,"click"],[3,"tb-hint-tooltip-icon"],[3,"value"],["formControlName","type"],[1,"tb-flex"],["formControlName","requestExpressionSource"],["matInput","","name","value","formControlName","requestExpression",3,"placeholder"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","attributeOnThingsBoard",3,"placeholder"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,AQ,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,FQ,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(RQ,[j,_,Zn]),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",RQ),Ge([I()],RQ.prototype,"withReportStrategy",void 0);const BQ=()=>({maxWidth:"970px"});function NQ(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.address-filter-required"))}function LQ(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-required"))}function VQ(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-profile-required"))}function qQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function GQ(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 zQ(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 UQ(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 jQ(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 HQ(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 WQ(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 $Q extends A{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:["",[$.required,$.pattern(rn)]],deviceName:["",[$.required,$.pattern(rn)]],deviceType:["",[$.required,$.pattern(rn)]],encoding:[ht.UTF8],telemetry:[[]],attributes:[[]],attributeRequests:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.SocketValueKey=pi,this.socketDeviceHelpLink=O+"/docs/iot-gateway/config/socket/#device-subsection",this.socketEncoding=Object.values(ht),this.ReportStrategyDefaultValue=tn,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:ci.get(n),addKeyTitle:mi.get(n),deleteKeyTitle:hi.get(n),noKeysText:gi.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,RQ,"leftBottom",!1,null,r,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(wn(this.destroyRef)).subscribe((e=>{this.popoverComponent.hide(),a.patchValue(e),a.markAsDirty(),this.cdr.markForCheck()})),this.popoverComponent.tbHideStart.pipe(wn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||$Q)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$Q,selectors:[["tb-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:119,vars:57,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","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"],["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",4,"ngFor","ngForOf"],["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"],[4,"ngFor","ngForOf"],[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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"]],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,NQ,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,LQ,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,VQ,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.ɵɵtemplate(45,qQ,2,2,"mat-option",26),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(46,GQ,1,2,"tb-report-strategy",27),t.ɵɵelementStart(47,"div",28)(48,"div",29),t.ɵɵtext(49,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(50,"div",30)(51,"mat-chip-listbox",31),t.ɵɵtemplate(52,zQ,2,1,"mat-chip",32),t.ɵɵelementStart(53,"mat-chip",33),t.ɵɵelement(54,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(55,"button",35,0),t.ɵɵpipe(57,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(56);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.TIMESERIES))})),t.ɵɵelementStart(58,"tb-icon",36),t.ɵɵtext(59,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(60,"div",28)(61,"div",29),t.ɵɵtext(62,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"div",30)(64,"mat-chip-listbox",31),t.ɵɵtemplate(65,UQ,2,1,"mat-chip",32),t.ɵɵelementStart(66,"mat-chip",33),t.ɵɵelement(67,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(68,"button",35,1),t.ɵɵpipe(70,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(69);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES))})),t.ɵɵelementStart(71,"tb-icon",36),t.ɵɵtext(72,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(73,"div",28)(74,"div",29),t.ɵɵtext(75,"gateway.attribute-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(76,"div",30)(77,"mat-chip-listbox",31),t.ɵɵtemplate(78,jQ,2,1,"mat-chip",32),t.ɵɵelementStart(79,"mat-chip",33),t.ɵɵelement(80,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(81,"button",35,2),t.ɵɵpipe(83,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(82);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES_REQUESTS))})),t.ɵɵelementStart(84,"tb-icon",36),t.ɵɵtext(85,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(86,"div",28)(87,"div",29),t.ɵɵtext(88,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(89,"div",30)(90,"mat-chip-listbox",31),t.ɵɵtemplate(91,HQ,2,1,"mat-chip",32),t.ɵɵelementStart(92,"mat-chip",33),t.ɵɵelement(93,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"button",35,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.SocketValueKey.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(97,"tb-icon",36),t.ɵɵtext(98,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(99,"div",28)(100,"div",29),t.ɵɵtext(101,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(102,"div",30)(103,"mat-chip-listbox",31),t.ɵɵtemplate(104,WQ,2,1,"mat-chip",32),t.ɵɵelementStart(105,"mat-chip",33),t.ɵɵelement(106,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(107,"button",35,4),t.ɵɵpipe(109,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(108);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.RPC_METHODS))})),t.ɵɵelementStart(110,"tb-icon",36),t.ɵɵtext(111,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(112,"div",37)(113,"button",38),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(114),t.ɵɵpipe(115,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(116,"button",39),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(117),t.ɵɵpipe(118,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,32,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.socketDeviceHelpLink),t.ɵɵadvance(12),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,34,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("address").hasError("required")&&n.deviceFormGroup.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/address-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(56,BQ)),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,36,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceName").hasError("required")&&n.deviceFormGroup.get("deviceName").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,38,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceType").hasError("required")&&n.deviceFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(40,40,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?46:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(57,42,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,44,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(83,46,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(96,48,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(109,50,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(115,52,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(118,54,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory($Q,[j,_,zn,Zn]),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",$Q);const KQ=["searchInput"],YQ=()=>["address","deviceName","actions"],XQ=()=>({minWidth:"96px",textAlign:"center"});function ZQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 QQ(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 JQ(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 eJ(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 tJ(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 nJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function iJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 aJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,iJ,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,XQ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function rJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function oJ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class sJ{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 te,this.devicesFormGroup=this.fb.array([]),this.dataSource=new lJ}ngOnInit(){this.devicesFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t),i=n?this.devicesFormGroup.at(t).value:{};this.getDeviceDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(n?this.devicesFormGroup.at(t).patchValue(e):this.devicesFormGroup.push(this.fb.control(e)),this.devicesFormGroup.markAsDirty())}))}validate(){return this.devicesFormGroup.controls.length?null:{devicesFormGroup:{valid:!1}}}getDeviceDialog(e,t){return this.dialog.open($Q,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:this.devicesFormGroup.controls[t].value.deviceName}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(this.devicesFormGroup.removeAt(t),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||sJ)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:sJ,selectors:[["tb-devices-config-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(KQ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>sJ)),multi:!0},{provide:K,useExisting:c((()=>sJ)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,ZQ,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,QQ,3,3,"mat-header-cell",15)(25,JQ,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,eJ,4,3,"mat-header-cell",15)(28,tJ,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,17),t.ɵɵtemplate(30,nJ,1,0,"mat-header-cell",18)(31,aJ,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(32,rJ,1,0,"mat-header-row",20)(33,oJ,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"section",22),t.ɵɵpipe(35,"async"),t.ɵɵelementStart(36,"button",23),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(37,"mat-icon",24),t.ɵɵtext(38,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"span"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,20,n.dataSource.isEmpty())),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,YQ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,YQ)),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(sJ,[j,_,Gn]),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",sJ),Ge([I()],sJ.prototype,"withReportStrategy",void 0);let lJ=class extends G{constructor(){super()}};function pJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function cJ(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.address-required"))}function dJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),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 uJ(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.socketConfigFormGroup.get("bufferSize").hasError("min")?"gateway.buffer-size-range":"gateway.buffer-size-required"))}}e("DevicesDatasource",lJ);class mJ{constructor(e){this.fb=e,this.portLimits=Ei,this.socketTypes=Object.values(li),this.onChange=e=>{},this.destroy$=new te,this.socketConfigFormGroup=this.fb.group({address:["",[$.required,$.pattern(rn)]],type:[li.TCP],port:[5e4,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],bufferSize:[1024,[$.required,$.min(1),$.pattern(rn)]]}),this.socketConfigFormGroup.valueChanges.pipe(le(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=li.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||mJ)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:mJ,selectors:[["tb-socket-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>mJ)),multi:!0},{provide:K,useExisting:c((()=>mJ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:34,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"],["tbTruncateWithTooltip",""],["formControlName","type","appearance","fill"],[3,"value",4,"ngFor","ngForOf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(7,pJ,2,2,"tb-toggle-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",6),t.ɵɵtext(10,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",9),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,cJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",1)(17,"div",6),t.ɵɵtext(18,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",7)(20,"mat-form-field",8),t.ɵɵelement(21,"input",11),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,dJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(24,"div",1)(25,"div",12),t.ɵɵpipe(26,"translate"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",7)(30,"mat-form-field",8),t.ɵɵelement(31,"input",13),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,uJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()()()),2&e&&(t.ɵɵproperty("formGroup",n.socketConfigFormGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,13,"gateway.connection-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("address").hasError("required")&&n.socketConfigFormGroup.get("address").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.socketConfigFormGroup.get("port").hasError("required")||n.socketConfigFormGroup.get("port").hasError("min")||n.socketConfigFormGroup.get("port").hasError("max"))&&n.socketConfigFormGroup.get("port").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,19,"gateway.hints.buffer-size")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(28,21,"gateway.buffer-size")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,23,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("bufferSize").hasError("required")||n.socketConfigFormGroup.get("bufferSize").hasError("min")&&n.socketConfigFormGroup.get("bufferSize").touched))},dependencies:t.ɵɵgetComponentDepsFactory(mJ,[j,_,jW,Gn]),encapsulation:2,changeDetection:d.OnPush})}}e("SocketConfigComponent",mJ);class hJ extends Na{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(hJ)))(n||hJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:hJ,selectors:[["tb-socket-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>hJ)),multi:!0},{provide:K,useExisting:c((()=>hJ)),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(hJ,[j,_,mJ,sJ]),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",hJ);class gJ extends Na{constructor(){super(...arguments),this.isLegacy=!0}getMappedValue(e){return Wa.mapSocketToDowngradedVersion(e)}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:Wa.mapSocketToUpgradedVersion(e),devices:e?.devices?Wa.mapDevicesToUpgradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(gJ)))(n||gJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:gJ,selectors:[["tb-socket-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>gJ)),multi:!0},{provide:K,useExisting:c((()=>gJ)),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(gJ,[j,_,mJ,sJ]),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 fJ(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 yJ(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 vJ(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 xJ(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 bJ(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 wJ(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",gJ);class SJ extends Ba{constructor(){super(...arguments),this.segmentationTypes=Object.values(ya),this.SegmentationTypeTranslationsMap=va,this.portLimits=Ei}get applicationConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({objectName:["",[$.required,$.pattern(rn)]],host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],mask:[""],objectIdentifier:[null,[$.required]],vendorIdentifier:[null,[$.required]],maxApduLengthAccepted:[],segmentationSupported:[ya.BOTH],networkNumber:[],deviceDiscoveryTimeoutInSec:[]})}mapOnChangeValue(e){return Te(e),e}onWriteValue(e){const{maxApduLengthAccepted:t=1476,segmentationSupported:n=ya.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(SJ)))(n||SJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:SJ,selectors:[["tb-bacnet-application-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>SJ)),multi:!0},{provide:K,useExisting:c((()=>SJ)),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,fJ,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,yJ,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,vJ,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,xJ,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,bJ,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,wJ,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(SJ,[j,_,jW]),encapsulation:2,changeDetection:d.OnPush})}}function CJ(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 _J(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,CJ,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 TJ(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 IJ(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,TJ,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 EJ(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 MJ(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,EJ,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 kJ(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 PJ(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 DJ(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 OJ(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 AJ(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 FJ extends Ba{constructor(){super(...arguments),this.withReportStrategy=!0,this.propertyIds=Ea.get(_a.analogOutput),this.objectTypes=Object.values(_a),this.requestTypes=Object.values(ka),this.ReportStrategyDefaultValue=tn,this.BacnetDeviceKeysType=xa,this.BacnetKeyObjectTypeTranslationsMap=Ta,this.BacnetPropertyIdTranslationsMap=Ma,this.BacnetRequestTypeTranslationsMap=Pa}ngOnInit(){this.formGroup=this.initKeyFormGroup(),this.observeValueChanges(),this.observeObjectType()}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keyType===xa.ATTRIBUTES||this.keyType===xa.TIMESERIES))}initKeyFormGroup(){return this.fb.group({key:[{value:"",disabled:this.keyType===xa.RPC_METHODS},[$.required,$.pattern(rn)]],method:[{value:"",disabled:this.keyType!==xa.RPC_METHODS},[$.required,$.pattern(rn)]],objectType:[_a.analogOutput],objectId:[0,[$.required]],propertyId:[Ia.presentValue],requestTimeout:[{value:0,disabled:this.keyType!==xa.RPC_METHODS}],requestType:[{value:ka.Write,disabled:this.keyType!==xa.RPC_METHODS}],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]})}observeObjectType(){this.formGroup.get("objectType").valueChanges.pipe(wn(this.destroyRef)).subscribe((e=>{this.propertyIds=Ea.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(FJ)))(n||FJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:FJ,selectors:[["tb-bacnet-device-data-key"]],inputs:{keyType:"keyType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>FJ)),multi:!0},{provide:K,useExisting:c((()=>FJ)),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,_J,10,12)(6,IJ,9,10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",1)(8,"div",2),t.ɵɵtext(9,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵtemplate(10,MJ,9,6,"div",3)(11,kJ,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,PJ,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,DJ,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,OJ,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵtemplate(34,AJ,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(FJ,[j,_,Zn]),encapsulation:2,changeDetection:d.OnPush})}}function RJ(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 BJ(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,RJ,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 NJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,BJ,13,6,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function LJ(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 VJ extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=tn}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||VJ)(t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:VJ,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,NJ,3,0,"div",3)(6,LJ,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(VJ,[j,_,FJ]),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 qJ(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 GJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.deviceFormGroup.get("port")))}}function zJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"mat-expansion-panel",34)(2,"mat-expansion-panel-header")(3,"mat-panel-title")(4,"div",35),t.ɵɵtext(5,"gateway.advanced-configuration-settings"),t.ɵɵelementEnd()()(),t.ɵɵelement(6,"tb-string-items-list",36),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 UJ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",19),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function jJ(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 HJ(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 WJ(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 $J(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 KJ(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 YJ extends A{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:["",[$.required,$.pattern(rn)]],port:["",[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],deviceInfo:[],altResponsesAddresses:[{value:[],disabled:this.data.hideNewFields}],pollPeriod:[1e4,[$.required,$.min(0)]],timeseries:[[]],attributes:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.BacnetDeviceKeysType=xa,this.DeviceInfoType=fa,this.portLimits=Ei,this.deviceHelpLink=O+"/docs/iot-gateway/config/bacnet/#device-object-settings",this.sourceTypes=Object.values(ui),this.ConnectorType=dt,this.ReportStrategyDefaultValue=tn,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:ba.get(n),addKeyTitle:wa.get(n),deleteKeyTitle:Sa.get(n),noKeysText:Ca.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,VJ,"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(wn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||YJ)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:YJ,selectors:[["tb-bacnet-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:100,vars:47,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","","type","number","name","value","formControlName","port",3,"min","max","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"],["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"],[1,"tb-settings","chips-panel","w-full"],["translate","",1,"tb-form-panel-title"],["editable","","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,qJ,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,GJ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵtemplate(26,zJ,9,6,"div",12),t.ɵɵelement(27,"tb-device-info-table",18),t.ɵɵtemplate(28,UJ,1,2,"tb-report-strategy",19),t.ɵɵelementStart(29,"div",12)(30,"div",20)(31,"span",21),t.ɵɵtext(32,"gateway.poll-period"),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",14),t.ɵɵelement(34,"input",22),t.ɵɵpipe(35,"translate"),t.ɵɵtemplate(36,jJ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"div",23)(38,"div",24),t.ɵɵtext(39,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"div",25)(41,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(42,HJ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(44,"mat-chip",27),t.ɵɵelement(45,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"button",29,0),t.ɵɵpipe(48,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(47);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES))})),t.ɵɵelementStart(49,"tb-icon",30),t.ɵɵtext(50,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(51,"div",23)(52,"div",24),t.ɵɵtext(53,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(54,"div",25)(55,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(56,WJ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(58,"mat-chip",27),t.ɵɵelement(59,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(60,"button",29,1),t.ɵɵpipe(62,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(61);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.TIMESERIES))})),t.ɵɵelementStart(63,"tb-icon",30),t.ɵɵtext(64,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(65,"div",23)(66,"div",24),t.ɵɵtext(67,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(68,"div",25)(69,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(70,$J,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(72,"mat-chip",27),t.ɵɵelement(73,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(74,"button",29,2),t.ɵɵpipe(76,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(75);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(77,"tb-icon",30),t.ɵɵtext(78,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(79,"div",23)(80,"div",24),t.ɵɵtext(81,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(82,"div",25)(83,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(84,KJ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(86,"mat-chip",27),t.ɵɵelement(87,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(88,"button",29,3),t.ɵɵpipe(90,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(89);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.RPC_METHODS))})),t.ɵɵelementStart(91,"tb-icon",30),t.ɵɵtext(92,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(93,"div",31)(94,"button",32),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(97,"button",33),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,27,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.deviceHelpLink),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(17,29,"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("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,31,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.deviceFormGroup.get("port").hasError("required")||n.deviceFormGroup.get("port").hasError("min")||n.deviceFormGroup.get("port").hasError("max"))&&n.deviceFormGroup.get("port").touched?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?-1:26),t.ɵɵadvance(),t.ɵɵproperty("deviceInfoType",n.DeviceInfoType.FULL)("sourceTypes",n.sourceTypes)("connectorType",n.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?28:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("pollPeriod").hasError("required")&&n.deviceFormGroup.get("pollPeriod").touched?36:-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(48,35,"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(62,37,"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(76,39,"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(90,41,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,43,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(99,45,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(YJ,[j,_,zn,Gn,jW,d$,Zn]),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 XJ=()=>["deviceName","host","port","actions"],ZJ=()=>({minWidth:"96px",textAlign:"center"});function QJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 JJ(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 e1(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 t1(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 n1(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 i1(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 a1(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 r1(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function o1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 s1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,o1,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,ZJ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function l1(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function p1(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class c1 extends Ga{constructor(){super(...arguments),this.hideNewFields=!1}getDatasource(){return new d1}manageDevices(e,t){e&&e.stopPropagation();const n=ke(t),i=n?this.entityFormArray.at(t).value:{};this.getDeviceDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),wn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):this.entityFormArray.push(this.fb.control(e)),this.entityFormArray.markAsDirty())}))}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:this.entityFormArray.controls[t].value.deviceInfo?.deviceNameExpression}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),wn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),this.entityFormArray.markAsDirty())}))}getDeviceDialog(e,t){return this.dialog.open(YJ,{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(c1)))(n||c1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:c1,selectors:[["tb-bacnet-devices-config-table"]],inputs:{hideNewFields:[2,"hideNewFields","hideNewFields",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>c1)),multi:!0},{provide:K,useExisting:c((()=>c1)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,QJ,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,JJ,4,3,"mat-header-cell",15)(25,e1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,t1,3,3,"mat-header-cell",15)(28,n1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,14),t.ɵɵtemplate(30,i1,3,3,"mat-header-cell",15)(31,a1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(32,17),t.ɵɵtemplate(33,r1,1,0,"mat-header-cell",18)(34,s1,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(35,l1,1,0,"mat-header-row",20)(36,p1,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"section",22),t.ɵɵpipe(38,"async"),t.ɵɵelementStart(39,"button",23),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(40,"mat-icon",24),t.ɵɵtext(41,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"span"),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(45,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,21,n.dataSource.isEmpty())),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,XJ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,XJ)),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(c1,[j,_,Gn]),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 d1 extends G{constructor(){super()}}class u1 extends Na{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(u1)))(n||u1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:u1,selectors:[["tb-bacnet-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>u1)),multi:!0},{provide:K,useExisting:c((()=>u1)),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(u1,[j,_,SJ,c1]),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 m1 extends Na{constructor(){super(...arguments),this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.general?$a.mapApplicationToUpgradedVersion(e.general):{},devices:e.devices?.length?$a.mapDevicesToUpgradedVersion(e.devices):[]}}getMappedValue(e){return{general:e.application?$a.mapApplicationToDowngradedVersion(e.application):{},devices:e.devices?.length?$a.mapDevicesToDowngradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(m1)))(n||m1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:m1,selectors:[["tb-bacnet-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>m1)),multi:!0},{provide:K,useExisting:c((()=>m1)),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(m1,[j,_,SJ,c1]),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 h1(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 g1(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 f1 extends Ba{constructor(){super(...arguments),this.portLimits=Ei}get serverConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.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(f1)))(n||f1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:f1,selectors:[["tb-rest-server-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>f1)),multi:!0},{provide:K,useExisting:c((()=>f1)),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,h1,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,g1,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(f1,[j,_,jW,Gn,Jn]),encapsulation:2,changeDetection:d.OnPush})}}const y1=()=>({min:1});function v1(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 x1(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 b1(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 w1(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,7),t.ɵɵelementStart(1,"div",8)(2,"div",9),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",10)(6,"mat-form-field",11)(7,"mat-select",12),t.ɵɵrepeaterCreate(8,x1,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",10)(15,"mat-form-field",11)(16,"mat-select",13),t.ɵɵrepeaterCreate(17,b1,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 S1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.response-timeout-required"))}function C1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,y1)))}function _1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function T1(e,n){1&e&&(t.ɵɵelementStart(0,"span",18),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function I1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-required"))}function E1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-pattern"))}function M1(e,n){if(1&e&&(t.ɵɵdeclareLet(0),t.ɵɵelementContainerStart(1,7),t.ɵɵelementStart(2,"div",8)(3,"mat-slide-toggle",14)(4,"mat-label"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(7,"div",8)(8,"div",15),t.ɵɵtext(9,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",11),t.ɵɵelement(11,"input",16),t.ɵɵpipe(12,"translate"),t.ɵɵdeclareLet(13),t.ɵɵtemplate(14,S1,2,3,"tb-error-icon",17)(15,C1,2,5,"tb-error-icon",17)(16,_1,2,3,"tb-error-icon",17)(17,T1,2,0,"span",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",8)(19,"div",15),t.ɵɵtext(20,"gateway.rest.response-attribute"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",11),t.ɵɵelement(22,"input",19),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,I1,2,3,"tb-error-icon",17)(25,E1,2,3,"tb-error-icon",17),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 k1 extends Ba{get responseConfigFormGroup(){return this.formGroup}constructor(){super(),this.ResponseTypeTranslationsMap=bi,this.ResponseType=vi,this.responseTypes=Object.values(vi),this.responseStatuses=Object.values(xi),this.observeIsExpected()}initFormGroup(){return this.fb.group({type:[vi.DEFAULT],[vi.CONST]:this.fb.group({successResponse:[xi.OK],unsuccessfulResponse:[xi.ERROR]}),[vi.ADVANCED]:this.fb.group({responseExpected:[!0],timeout:[null,[$.required,$.min(.001),$.pattern(an)]],responseAttribute:["",[$.required,$.pattern(rn)]]})})}mapOnChangeValue({type:e,...t}){return{type:e,...t[e]??{}}}onWriteValue(e){const{type:t=vi.DEFAULT,...n}=e??{};this.toggleIsExpected(n.responseExpected,t),this.responseConfigFormGroup.patchValue({type:t,[t]:n},{emitEvent:!1})}toggleIsExpected(e,t){const n=e&&t===vi.ADVANCED;this.responseConfigFormGroup.get(vi.ADVANCED).get("timeout")[n?"enable":"disable"]({emitEvent:!1}),this.responseConfigFormGroup.get(vi.ADVANCED).get("responseAttribute")[n?"enable":"disable"]({emitEvent:!1})}observeIsExpected(){se(this.responseConfigFormGroup.get("type").valueChanges,this.responseConfigFormGroup.get(vi.ADVANCED).get("responseExpected").valueChanges).pipe(wn()).subscribe((()=>this.toggleIsExpected(this.responseConfigFormGroup.get(vi.ADVANCED).get("responseExpected").value,this.responseConfigFormGroup.get("type").value)))}static{this.ɵfac=function(e){return new(e||k1)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:k1,selectors:[["tb-rest-response-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>k1)),multi:!0},{provide:K,useExisting:c((()=>k1)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:7,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,"ngSwitch"],[3,"ngSwitchCase"],[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){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,v1,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementContainerStart(8,5),t.ɵɵtemplate(9,w1,19,7,"ng-template",6)(10,M1,26,12,"ng-template",6),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.responseConfigFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.response")),t.ɵɵadvance(3),t.ɵɵrepeater(n.responseTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.responseConfigFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.ResponseType.CONST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.ResponseType.ADVANCED))},dependencies:t.ɵɵgetComponentDepsFactory(k1,[j,_,Jn]),encapsulation:2,changeDetection:d.OnPush})}}function P1(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 D1(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 O1(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 A1(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 F1(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 R1(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 B1(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 N1(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,R1,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,B1,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 L1(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 V1(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 q1(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,L1,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.ɵɵtemplate(23,V1,3,1,"mat-chip",45),t.ɵɵelementStart(24,"mat-chip",35),t.ɵɵelement(25,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",37,2),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.CUSTOM))})),t.ɵɵelementStart(29,"tb-icon",38),t.ɵɵtext(30,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.rest.extension")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,12,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,14,"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,16,"gateway.extension-configuration")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,18,"gateway.extension-configuration-hint")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,20,"gateway.keys")),t.ɵɵadvance(3),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.customKeys),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,22,"action.edit"))}}class G1 extends A{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:["",[$.required,$.pattern(rn)]],HTTPMethods:[[gt.POST],[$.required]],security:[{type:Pi.ANONYMOUS}],converter:this.fb.group({type:[fi.JSON,[]],deviceInfo:[],reportStrategy:[],attributes:[[]],timeseries:[[]],extension:["",[$.required,$.pattern(rn)]],extensionConfig:[]}),response:[]}),this.keysPopupClosed=!0,this.helpLink=`${O}/docs/iot-gateway/config/rest/#mapping-section`,this.httpMethods=Object.values(gt),this.converterTypes=Object.values(fi),this.restSourceTypes=Object.values(yi),this.SecurityMode=Ki,this.MappingKeysType=Li,this.DeviceInfoType=fa,this.RestConvertorTypeTranslationsMap=Ti,this.RestDataConversionTranslationsMap=Ii,this.RestConverterType=fi,this.ConnectorType=dt,this.ReportStrategyDefaultValue=tn,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:Vi.get(n),addKeyTitle:qi.get(n),deleteKeyTitle:Gi.get(n),noKeysText:zi.get(n),withReportStrategy:this.data.withReportStrategy,convertorType:this.converterType,connectorType:dt.REST};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,nK,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(wn(this.destroyRef)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty(),this.cd.markForCheck()})),this.popoverComponent.tbHideStart.pipe(wn(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(wn(this.destroyRef)).subscribe((e=>this.toggleConverterFieldsByType(e)))}toggleConverterFieldsByType(e){const t=e===fi.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||G1)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.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-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"],[4,"ngFor","ngForOf"]],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,P1,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,D1,2,2,"mat-option",17,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(30,O1,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,A1,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,F1,1,2,"tb-report-strategy",27)(49,N1,30,11,"div",28)(50,q1,31,24,"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(G1,[j,_,zn,d$,wY,k1,Jn,Zn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .device-info .fixed-title-width{min-width:0}'],changeDetection:d.OnPush})}}const z1=()=>["endpoint","httpMethods","securityType","actions"];function U1(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",8),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 j1(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.rest.endpoint")))}function H1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",32)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.endpoint)}}function W1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",33),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rest.http-methods")," "))}function $1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",38),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function K1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",34)(1,"mat-chip-listbox",35),t.ɵɵrepeaterCreate(2,$1,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(4,"mat-chip",36),t.ɵɵelement(5,"label",37),t.ɵɵelementEnd()()()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵproperty("tbEllipsisChipList",e.HTTPMethods),t.ɵɵadvance(),t.ɵɵrepeater(e.HTTPMethods)}}function Y1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.security-type")," "))}function X1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",39)(1,"div",31),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 Z1(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",40)}function Q1(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().index,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().index,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 J1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,Q1,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",41),t.ɵɵelementContainer(4,42),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",43)(6,"button",44),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",45),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",46,2),t.ɵɵelementContainer(11,42),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 e0(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",47)}function t0(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class n0 extends Ga{getDatasource(){return new i0}manageMapping(e,t){e&&e.stopPropagation();const n=ke(t),i=n?this.entityFormArray.at(t).value:{};this.getMappingDialog(i,n?"action.apply":"action.add").afterClosed().pipe(wn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):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.entityFormArray.at(t).value.endpoint}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(wn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),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(G1,{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(n0)))(n||n0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:n0,selectors:[["tb-rest-mapping-table"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>n0)),multi:!0},{provide:K,useExisting:c((()=>n0)),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"],[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,"!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,U1,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,j1,4,3,"mat-header-cell",14)(24,H1,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,W1,3,3,"mat-header-cell",16)(27,K1,6,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,13),t.ɵɵtemplate(29,Y1,3,3,"mat-header-cell",18)(30,X1,4,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(31,20),t.ɵɵtemplate(32,Z1,1,0,"mat-header-cell",21)(33,J1,12,3,"mat-cell",22),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(34,e0,1,0,"mat-header-row",23)(35,t0,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,z1))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,z1)),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(n0,[j,_,Gn,zn]),styles:[".http-method-label[_ngcontent-%COMP%]{font-size:12px}"],changeDetection:d.OnPush})}}let i0=class extends G{constructor(){super()}};function a0(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 r0(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 o0(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 s0(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,r0,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,o0,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 l0(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,a0,2,1,"div",13),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,s0,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 p0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,l0,14,7,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function c0(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 d0 extends q{constructor(e,t){super(t),this.fb=e,this.store=t,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=tn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}addKey(){this.keysListFormArray.push(this.fb.group({key:["",[$.required,$.pattern(rn)]],value:["",[$.required,$.pattern(rn)]]}))}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,[$.required,$.pattern(rn)]],value:[e[n],[$.required,$.pattern(rn)]]}))})),this.fb.array(t)}static{this.ɵfac=function(e){return new(e||d0)(t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:d0,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,p0,3,0,"div",3)(6,c0,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(d0,[j,_]),encapsulation:2,changeDetection:d.OnPush})}}const u0=()=>({min:1}),m0=()=>({maxWidth:"970px"});function h0(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 g0(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 f0(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 y0(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 v0(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 x0(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 b0(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,g0,2,3,"tb-error-icon",22)(8,f0,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,y0,2,2,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(17,v0,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,x0,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 w0(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 S0(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 C0(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,w0,2,3,"tb-error-icon",22)(8,S0,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 _0(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 T0(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 I0(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,_0,2,3,"tb-error-icon",22)(8,T0,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 E0(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 M0(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 k0(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,E0,2,3,"tb-error-icon",22)(8,M0,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 P0(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 D0(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 O0(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 A0(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 F0(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 R0(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,P0,2,3,"tb-error-icon",22)(8,D0,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,O0,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,A0,2,3,"tb-error-icon",22)(25,F0,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 B0(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,u0)))}function N0(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 L0(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function V0(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,B0,2,5,"tb-error-icon",22)(7,N0,2,3,"tb-error-icon",22)(8,L0,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 q0(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 G0(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 z0(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 U0(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 j0(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,m0))}function H0(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,q0,2,3,"tb-error-icon",22)(8,G0,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,z0,2,3,"tb-error-icon",22)(16,U0,2,3,"tb-error-icon",22)(17,j0,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 W0(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,u0)))}function $0(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 K0(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function Y0(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,W0,2,5,"tb-error-icon",22)(7,$0,2,3,"tb-error-icon",22)(8,K0,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 X0(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 Z0(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 Q0(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,u0)))}function J0(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 e2(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function t2(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 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.tries-pattern"))}function i2(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 a2(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,Z0,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,Q0,2,5,"tb-error-icon",22)(29,J0,2,3,"tb-error-icon",22)(30,e2,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,t2,2,3,"tb-error-icon",22)(38,n2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵtemplate(39,i2,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 r2 extends A{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(wi),this.requestsScopeType=Object.values(Ci),this.httpMethods=Object.values(gt),this.helpLink=`${O}/docs/iot-gateway/config/rest/#attribute-request-section`,this.RestRequestTypesTranslationsMap=Si,this.SecurityMode=Ki,this.RestRequestType=wi,this.mappingFormGroup=this.fb.group({requestType:[wi.ATTRIBUTE_REQUEST],endpoint:["",[$.required,$.pattern(rn)]],HTTPMethods:[[gt.POST],[$.required]],HTTPMethod:[gt.POST,[$.required]],type:[Ci.Shared],security:[{type:Pi.ANONYMOUS}],timeout:[null,[$.min(.001),$.pattern(an)]],deviceNameExpression:["",[$.required,$.pattern(rn)]],attributeNameExpression:["",[$.required,$.pattern(rn)]],SSLVerify:[!1],deviceNameFilter:["",[$.required,$.pattern(rn)]],methodFilter:["",[$.required,$.pattern(rn)]],attributeFilter:["",[$.required,$.pattern(rn)]],requestUrlExpression:[this.data.defaultRequestUrl,[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],responseTimeout:[null,[$.min(.001),$.pattern(an)]],tries:[null,[$.min(1),$.pattern(an)]],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,d0,"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(wn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}observeRequestTypeChange(){this.mappingFormGroup.get("requestType").valueChanges.pipe(ce(),wn(this.destroyRef)).subscribe((e=>this.toggleFieldsByRequestType(e)))}toggleFieldsByRequestType(e){this.mappingFormGroup.disable({emitEvent:!1}),_i.get("all").forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1}))),_i.get(e).forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1})))}static{this.ɵfac=function(e){return new(e||r2)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:r2,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,h0,3,4,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(19,b0,26,14)(20,C0,9,7,"div",9)(21,I0,9,7,"div",9)(22,k0,9,7,"div",9)(23,R0,26,17)(24,V0,9,4,"div",9)(25,H0,18,11)(26,Y0,9,4,"div",9)(27,X0,6,6,"div",14),t.ɵɵelement(28,"tb-security-config",15),t.ɵɵtemplate(29,a2,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(r2,[j,_,zn,wY,Jn]),styles:["[_nghost-%COMP%] .tb-form-row.request-url-row[_ngcontent-%COMP%]{gap:6px}"],changeDetection:d.OnPush})}}const o2=()=>["type","details","actions"],s2=()=>({});function l2(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",8),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 p2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",27)(1,"div",28),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.type")))}function c2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29)(1,"div",28),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 d2(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.details")," "))}function u2(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,s2)).join(", ")," ")}}function m2(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.methodFilter," ")}}function h2(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.endpoint," ")}}function g2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29)(1,"div",28),t.ɵɵtemplate(2,u2,1,2)(3,m2,1,1)(4,h2,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 f2(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",31)}function y2(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().index,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().index,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 v2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,y2,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",32),t.ɵɵelementContainer(4,33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",34)(6,"button",35),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",36),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",37,2),t.ɵɵelementContainer(11,33),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 x2(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",38)}function b2(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class w2 extends Ga{constructor(){super(...arguments),this.Object=Object,this.RestRequestTypesTranslationsMap=Si}getDatasource(){return new S2}manageMapping(e,t){e&&e.stopPropagation();const n=ke(t),{requestType:i=wi.ATTRIBUTE_REQUEST,requestValue:a={}}=n?this.entityFormArray.at(t).value:{};this.getMappingDialog({requestType:i,...a},n?"action.apply":"action.add").afterClosed().pipe(wn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):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(this.entityFormArray.at(t).value)}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(wn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),this.entityFormArray.markAsDirty())}))}updateTableData(e,t){t&&(e=e.filter((e=>{const n=this.getRequestDetails(e);return Object.values(e).some((e=>Me(e)&&this.translate.instant(Si.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(r2,{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(w2)))(n||w2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:w2,selectors:[["tb-rest-request-mapping-table"]],inputs:{defaultRequestUrl:"defaultRequestUrl"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>w2)),multi:!0},{provide:K,useExisting:c((()=>w2)),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"],[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,"!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,l2,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,p2,4,3,"mat-header-cell",14)(24,c2,4,3,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,d2,3,3,"mat-header-cell",16)(27,g2,5,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,17),t.ɵɵtemplate(29,f2,1,0,"mat-header-cell",18)(30,v2,12,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(31,x2,1,0,"mat-header-row",20)(32,b2,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,o2))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,o2)),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(w2,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}class S2 extends G{constructor(){super()}}class C2 extends Na{initBasicFormGroup(){return this.fb.group({server:[],mapping:[],requestsMapping:[]})}getRequestDataArray(e){const t=[];return Fe(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(C2)))(n||C2)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:C2,features:[t.ɵɵInheritDefinitionFeature]})}}class _2 extends C2{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(_2)))(n||_2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:_2,selectors:[["tb-rest-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>_2)),multi:!0},{provide:K,useExisting:c((()=>_2)),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(_2,[j,_,f1,n0,w2]),encapsulation:2,changeDetection:d.OnPush})}}class T2 extends C2{mapConfigToFormValue({attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}){return{server:{...a??{}},mapping:Ka.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:Ka.mapMappingToDowngradedVersion(t),attributeRequests:i,attributeUpdates:a,serverSideRpc:r}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(T2)))(n||T2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:T2,selectors:[["tb-rest-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>T2)),multi:!0},{provide:K,useExisting:c((()=>T2)),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(T2,[j,_,f1,n0,w2]),encapsulation:2,changeDetection:d.OnPush})}}const I2=(e,t)=>({hasErrors:e,noErrors:t}),E2=()=>({minWidth:"144px",maxWidth:"144px",textAlign:"center"}),M2=()=>({minWidth:"144px",maxWidth:"144px",width:"144px",textAlign:"center"}),k2=e=>({"tb-current-entity":e});function P2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",32),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 D2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",33)(1,"button",34),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onAddConnector(n))})),t.ɵɵelementStart(2,"mat-icon",35),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 O2(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-enabled")," "))}function A2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"mat-slide-toggle",37),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 F2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",38),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-name"),""))}function R2(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 B2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-type")," "))}function N2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.returnType(e)," ")}}function L2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration")," "))}function V2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40)(1,"div",41),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 q2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-status")," "))}function G2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell",40)(1,"span",42),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,I2,+i.getErrorsCount(e)>0,0==+i.getErrorsCount(e)||""===i.getErrorsCount(e))),t.ɵɵpropertyInterpolate("matTooltip","Errors: "+i.getErrorsCount(e))}}function z2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell"),t.ɵɵelement(1,"div",43),t.ɵɵelementStart(2,"div",44),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,E2)),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.connectors-table-actions")))}function U2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"div",45)(2,"button",46),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(3,"mat-icon"),t.ɵɵtext(4,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"button",47),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(6,"mat-icon"),t.ɵɵtext(7,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",48),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"delete"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",49)(12,"button",50),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(13,"mat-icon",51),t.ɵɵtext(14,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-menu",52,1)(17,"button",46),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(20,"button",47),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(21,"mat-icon"),t.ɵɵtext(22,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",48),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(24,"mat-icon"),t.ɵɵtext(25,"delete"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,i=t.ɵɵreference(16);t.ɵɵadvance(),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,M2)),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.value.configurationJson.id),t.ɵɵadvance(10),t.ɵɵproperty("matMenuTriggerFor",i),t.ɵɵadvance(5),t.ɵɵproperty("disabled",!e.value.configurationJson.id)}}function j2(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",53)}function H2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-row",54),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,k2,i.isSameConnector(e)))}}function W2(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",55),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1("v",e.connectorForm.get("configVersion").value,"")}}function $2(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-select",56)(1,"tb-toggle-option",57),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-option",57),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 K2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function Y2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function X2(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,K2,2,4,"tb-mqtt-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Y2,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MQTT))("ngIfElse",e)}}function Z2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function Q2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function J2(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Z2,2,4,"tb-opc-ua-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Q2,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.OPCUA))("ngIfElse",e)}}function e3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function t3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function n3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,e3,1,1,"tb-modbus-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,t3,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MODBUS))("ngIfElse",e)}}function i3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function a3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function r3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,i3,1,1,"tb-socket-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,a3,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.SOCKET))("ngIfElse",e)}}function o3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function s3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function l3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,o3,2,4,"tb-bacnet-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,s3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.BACNET))("ngIfElse",e)}}function p3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-basic-config",69),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function c3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-legacy-basic-config",69),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function d3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,p3,2,4,"tb-rest-basic-config",68),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,c3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.REST))("ngIfElse",e)}}function u3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0)(1,62),t.ɵɵtemplate(2,X2,5,5,"ng-container",63)(3,J2,5,5,"ng-container",63)(4,n3,5,5,"ng-container",63)(5,r3,5,5,"ng-container",63)(6,l3,5,5,"ng-container",63)(7,d3,5,5,"ng-container",63),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",e.initialConnector.type),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REST)}}function m3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group")(1,"mat-tab",70),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,71),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",70),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-json-object-edit",72),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(41);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 h3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",58),t.ɵɵtemplate(1,u3,8,7,"ng-container",59)(2,m3,8,12,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(4,"div",60)(5,"button",61),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onSaveConnector())})),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵreference(3),i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(e=i.connectorForm.get("mode"))?null:e.value)===i.ConnectorConfigurationModes.BASIC)("ngIfElse",n),t.ɵɵadvance(4),t.ɵɵproperty("disabled",!i.connectorForm.dirty||i.connectorForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,4,"action.save")," ")}}function g3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",89),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 f3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"div",85),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",76)(4,"mat-form-field",77),t.ɵɵelement(5,"input",90),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function y3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"div",85),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",76)(4,"mat-form-field",77),t.ɵɵelement(5,"input",91),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function v3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",57),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function x3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"mat-slide-toggle",92)(2,"mat-label",93),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 b3(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",94),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Connector)}}function w3(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",73)(1,"div",74)(2,"div",75),t.ɵɵtext(3,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",76)(5,"mat-form-field",77),t.ɵɵelement(6,"input",78),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,g3,3,3,"mat-icon",79),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,f3,7,3,"div",80)(10,y3,7,3,"div",80),t.ɵɵelementStart(11,"div",81)(12,"div",82),t.ɵɵtext(13,"gateway.logs-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",83)(15,"mat-slide-toggle",84)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",74)(20,"div",85),t.ɵɵtext(21,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",76)(23,"mat-form-field",77)(24,"mat-select",86),t.ɵɵtemplate(25,v3,2,2,"mat-option",87),t.ɵɵelementEnd()()()()(),t.ɵɵtemplate(26,x3,6,6,"div",80),t.ɵɵpipe(27,"withReportStrategy"),t.ɵɵtemplate(28,b3,1,2,"tb-report-strategy",88),t.ɵɵpipe(29,"withReportStrategy"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.connectorForm),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.connectorForm.get("name").hasError("required")&&e.connectorForm.get("name").touched||e.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.GRPC),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.enable-remote-logging")," "),t.ɵɵadvance(8),t.ɵɵproperty("ngForOf",e.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.MQTT&&!t.ɵɵpipeBind2(27,13,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(29,16,e.connectorForm.get("configVersion").value,e.connectorForm.get("type").value))}}class S3{isErrorState(e){return e&&e.invalid}}e("ForceErrorStateMatcher",S3);class C3 extends q{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=dt,this.allowBasicConfig=new Set([dt.MQTT,dt.OPCUA,dt.MODBUS,dt.SOCKET,dt.BACNET,dt.REST]),this.gatewayLogLevel=Object.values(pt),this.displayedColumns=["enabled","key","type","syncStatus","errors","actions"],this.GatewayConnectorTypesTranslatesMap=ut,this.ConnectorConfigurationModes=Jt,this.ReportStrategyDefaultValue=tn,this.basicConfigInitSubject=new te,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 te,this.attributeUpdateSubject=new te,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)?D.SHARED_SCOPE:D.SERVER_SCOPE;oe(this.getEntityAttributeTasks(e,n)).pipe(ye(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===D.SHARED_SCOPE||!this.inactiveConnectors.includes(e.name)&&t===D.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===D.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===D.SHARED_SCOPE?"active_connectors":"inactive_connectors",n=e===D.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=`${Be(t.name)}.json`,delete t.basicConfig,t.type!==dt.GRPC&&delete t.key,t.type!==dt.CUSTOM&&delete t.class,this.allowBasicConfig.has(t.type)||delete t.mode,this.withReportStrategy.transform(t.configVersion,t.type)&&(t.configurationJson.reportStrategy=t.reportStrategy,Ae(t.reportStrategy)&&delete t.reportStrategy,Ae(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=w[this.sort.direction.toUpperCase()],this.attributeDataSource.loadAttributes(this.device,D.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,D.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,D.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=Se(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 Se(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:Jt.BASIC,name:"",type:dt.MQTT,sendDataOnlyOnChange:!1,enableRemoteLogging:!1,logLevel:pt.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(ye(1),xe((t=>{if(!t)return;const n=[],i=this.activeConnectors.includes(e.value?.name)?D.SHARED_SCOPE:D.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)),oe(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=Oe(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=Oe(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(ye(1),ue(Boolean),xe((()=>this.openAddConnectorDialog())),ue(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(ye(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??Jt.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(JW,{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:w.ASC};this.pageLink=new S(1e3,0,null,e),this.attributeDataSource=new Un(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.inactiveConnectorsDataSource=new Un(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.serverDataSource=new Un(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.dataSource=new x([])}initConnectorForm(){this.connectorForm=this.fb.group({mode:[Jt.BASIC],name:["",[$.required,this.uniqNameRequired(),$.pattern(rn)]],type:["",[$.required]],enableRemoteLogging:[!1],logLevel:["",[$.required]],sendDataOnlyOnChange:[!1],key:["auto"],class:[""],configuration:[""],configurationJson:[{},[$.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()===w.DESC?-1:1/0:n;default:return e[t]||e.value[t]}}}loadConnectors(){this.device&&this.device.id!==B&&oe([this.attributeService.getEntityAttributes(this.device,D.SHARED_SCOPE,["active_connectors"]),this.attributeService.getEntityAttributes(this.device,D.SERVER_SCOPE,["inactive_connectors"]),this.attributeService.getEntityAttributes(this.device,D.CLIENT_SCOPE,["Version"])]).pipe(le(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,D.SERVER_SCOPE).pipe(le(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 Me(t)?JSON.parse(t):t}observeModeChange(){this.connectorForm.get("mode").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{e===Jt.BASIC&&this.patchConnectorBasicConfig(this.connectorForm.get("configurationJson").value)}))}observeAttributeChange(){this.attributeUpdateSubject.pipe(de(300),me((e=>this.executeAttributeUpdates(e))),le(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){oe(this.getAttributeExecutionTasks(e)).pipe(ye(1),me((()=>this.updateData(!0))),le(this.destroy$)).subscribe()}getAttributeExecutionTasks(e){const t=this.activeConnectors.includes(e.key),n=t?D.SERVER_SCOPE:D.SHARED_SCOPE,i=t?D.SHARED_SCOPE:D.SERVER_SCOPE;return[this.attributeService.saveEntityAttributes(this.device,D.SHARED_SCOPE,[{key:"active_connectors",value:this.activeConnectors}]),this.attributeService.saveEntityAttributes(this.device,D.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(R.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(ue((()=>!!this.initialConnector)),le(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("configurationJson"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;if(!Se(e,t?.value)&&this.allowBasicConfig.has(n)&&i===Jt.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(le(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("basicConfig"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;!Se(e,t?.value)&&this.allowBasicConfig.has(n)&&i===Jt.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):ae(!0)}setFormValue(e){this.connectorForm.disabled&&this.connectorForm.enable();const t=Ua.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!==Jt.ADVANCED?this.basicConfigInitSubject.asObservable().pipe(ye(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===dt.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||C3)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.TelemetryWebsocketService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(Ya),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:C3,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:st,useClass:S3},Ya]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:42,vars:21,consts:[["generalTabContent",""],["cellActionsMenu","matMenu"],["defaultConfig",""],["legacy",""],[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","click",4,"ngIf"],[1,"table-container"],["class","mat-headline-5 tb-absolute-fill tb-add-new items-center justify-center",4,"ngIf"],["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"],["class","version-placeholder",4,"ngIf"],["formControlName","mode","appearance","fill",4,"ngIf"],["translate","",1,"no-data-found","items-center","justify-center"],["class","tb-form-panel section-container no-border no-padding tb-flex space-between",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["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","","matTooltip","RPC","matTooltipPosition","above",3,"click","disabled"],["mat-icon-button","","matTooltip","Logs","matTooltipPosition","above",3,"click"],["mat-icon-button","","matTooltip","Delete connector","matTooltipPosition","above",3,"click"],[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"],[1,"version-placeholder"],["formControlName","mode","appearance","fill"],[3,"value"],[1,"tb-form-panel","section-container","no-border","no-padding","tb-flex","space-between"],[4,"ngIf","ngIfElse"],[1,"flex","justify-end"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[3,"ngSwitch"],[4,"ngSwitchCase"],["formControlName","basicConfig",3,"generalTabContent","withReportStrategy","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"generalTabContent","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent"],["class","h-full","formControlName","basicConfig",3,"generalTabContent","withReportStrategy","initialized",4,"ngIf","ngIfElse"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],[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"],[3,"value",4,"ngFor","ngForOf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4)(1,"section",5)(2,"mat-toolbar",6)(3,"h2"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(6,P2,5,6,"button",7),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",8),t.ɵɵtemplate(8,D2,7,3,"section",9),t.ɵɵelementStart(9,"table",10),t.ɵɵelementContainerStart(10,11),t.ɵɵtemplate(11,O2,3,3,"mat-header-cell",12)(12,A2,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,14),t.ɵɵtemplate(14,F2,3,3,"mat-header-cell",15)(15,R2,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(16,16),t.ɵɵtemplate(17,B2,3,3,"mat-header-cell",17)(18,N2,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(19,19),t.ɵɵtemplate(20,L2,3,3,"mat-header-cell",17)(21,V2,3,3,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(22,20),t.ɵɵtemplate(23,q2,3,3,"mat-header-cell",17)(24,G2,2,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,21),t.ɵɵtemplate(26,z2,5,6,"mat-header-cell",22)(27,U2,26,6,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,j2,1,0,"mat-header-row",23)(29,H2,1,4,"mat-row",24),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"section",25)(31,"div",26)(32,"div",27),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,W2,2,1,"span",28),t.ɵɵelementEnd(),t.ɵɵtemplate(36,$2,7,8,"tb-toggle-select",29),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"span",30),t.ɵɵtext(38," gateway.select-connector "),t.ɵɵelementEnd(),t.ɵɵtemplate(39,h3,8,6,"section",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(40,w3,30,19,"ng-template",null,0,t.ɵɵtemplateRefExtractor)),2&e&&(t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,17,"gateway.connectors")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==n.dataSource||null==n.dataSource.data?null:n.dataSource.data.length),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!(null!=n.dataSource&&(null!=n.dataSource.data&&n.dataSource.data.length))),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,19,"gateway.configuration")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("configVersion").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.initialConnector&&n.allowBasicConfig.has(n.initialConnector.type)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.initialConnector),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.initialConnector))},dependencies:t.ɵɵgetComponentDepsFactory(C3,[j,_,Ya,UW,HY,WY,RY,FY,aQ,rQ,hJ,gJ,Zn,u1,m1,T2,_2]),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",C3);class _3{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||_3)(t.ɵɵdirectiveInject(_e.DeviceService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:_3,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(_3,[j,_]),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 T3,I3,E3;e("DeviceGatewayCommandComponent",_3),e("GatewayBasicConfigTab",T3),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"}(T3||e("GatewayBasicConfigTab",T3={})),e("StorageTypes",I3),function(e){e.MEMORY="memory",e.FILE="file",e.SQLITE="sqlite"}(I3||e("StorageTypes",I3={})),e("LocalLogsConfigs",E3),function(e){e.service="service",e.connector="connector",e.converter="converter",e.tb_connection="tb_connection",e.storage="storage",e.extension="extension"}(E3||e("LocalLogsConfigs",E3={}));const M3=e("LocalLogsConfigTranslateMap",new Map([[E3.service,"Service"],[E3.connector,"Connector"],[E3.converter,"Converter"],[E3.tb_connection,"TB Connection"],[E3.storage,"Storage"],[E3.extension,"Extension"]])),k3=e("StorageTypesTranslationMap",new Map([[I3.MEMORY,"gateway.storage-types.memory-storage"],[I3.FILE,"gateway.storage-types.file-storage"],[I3.SQLITE,"gateway.storage-types.sqlite"]]));var P3;e("LogSavingPeriod",P3),function(e){e.days="D",e.hours="H",e.minutes="M",e.seconds="S"}(P3||e("LogSavingPeriod",P3={}));const D3=e("LogSavingPeriodTranslations",new Map([[P3.days,"gateway.logs.days"],[P3.hours,"gateway.logs.hours"],[P3.minutes,"gateway.logs.minutes"],[P3.seconds,"gateway.logs.seconds"]]));var O3;e("SecurityTypes",O3),function(e){e.ACCESS_TOKEN="accessToken",e.USERNAME_PASSWORD="usernamePassword",e.TLS_ACCESS_TOKEN="tlsAccessToken",e.TLS_PRIVATE_KEY="tlsPrivateKey"}(O3||e("SecurityTypes",O3={}));const A3=e("SecurityTypesTranslationsMap",new Map([[O3.ACCESS_TOKEN,"gateway.security-types.access-token"],[O3.USERNAME_PASSWORD,"gateway.security-types.username-password"],[O3.TLS_ACCESS_TOKEN,"gateway.security-types.tls-access-token"]])),F3=e("logsHandlerClass","thingsboard_gateway.tb_utility.tb_rotating_file_handler.TimedRotatingFileHandler"),R3=e("logsLegacyHandlerClass","thingsboard_gateway.tb_utility.tb_handler.TimedRotatingFileHandler");function B3(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",10),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 N3(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 L3(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 V3(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 q3(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 G3(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 z3(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 U3(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",11)(1,"mat-form-field",12)(2,"mat-label",13),t.ɵɵtext(3,"gateway.storage-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",14),t.ɵɵtemplate(5,N3,3,3,"mat-error",15)(6,L3,3,3,"mat-error",15)(7,V3,3,3,"mat-error",15),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",12)(12,"mat-label",13),t.ɵɵtext(13,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",17),t.ɵɵtemplate(15,q3,3,3,"mat-error",15)(16,G3,3,3,"mat-error",15)(17,z3,3,3,"mat-error",15),t.ɵɵelementStart(18,"mat-icon",16),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,8,"gateway.hints.read-record-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,10,"gateway.hints.max-records-count"))}}function j3(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 H3(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 W3(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 $3(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 K3(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 Y3(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 X3(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 Z3(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 Q3(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 J3(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 e4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-data-folder-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",18),t.ɵɵtemplate(6,j3,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",19),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.storage-max-files"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",20),t.ɵɵtemplate(14,H3,3,3,"mat-error",15)(15,W3,3,3,"mat-error",15)(16,$3,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"mat-form-field",12)(22,"mat-label",13),t.ɵɵtext(23,"gateway.storage-max-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",21),t.ɵɵtemplate(25,K3,3,3,"mat-error",15)(26,Y3,3,3,"mat-error",15)(27,X3,3,3,"mat-error",15),t.ɵɵelementStart(28,"mat-icon",16),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"mat-form-field",12)(32,"mat-label",13),t.ɵɵtext(33,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",22),t.ɵɵtemplate(35,Z3,3,3,"mat-error",15)(36,Q3,3,3,"mat-error",15)(37,J3,3,3,"mat-error",15),t.ɵɵelementStart(38,"mat-icon",16),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_folder_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,14,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,16,"gateway.hints.max-file-count")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,18,"gateway.hints.max-read-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,20,"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 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.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 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-check-in-hours-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.messages-ttl-in-days-required")," "))}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.messages-ttl-in-days-min")," "))}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.messages-ttl-in-days-pattern")," "))}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-required")," "))}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-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 d4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",23),t.ɵɵtemplate(6,t4,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",16),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.messages-ttl-check-in-hours"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",24),t.ɵɵtemplate(14,n4,3,3,"mat-error",15)(15,i4,3,3,"mat-error",15)(16,a4,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"mat-form-field",12)(22,"mat-label",13),t.ɵɵtext(23,"gateway.messages-ttl-in-days"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",25),t.ɵɵtemplate(25,r4,3,3,"mat-error",15)(26,o4,3,3,"mat-error",15)(27,s4,3,3,"mat-error",15),t.ɵɵelementStart(28,"mat-icon",26),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"mat-form-field",12)(32,"mat-label",13),t.ɵɵtext(33,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",22),t.ɵɵtemplate(35,l4,3,3,"mat-error",15)(36,p4,3,3,"mat-error",15)(37,c4,3,3,"mat-error",15),t.ɵɵelementStart(38,"mat-icon",26),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_file_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,14,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,16,"gateway.hints.ttl-check-hour")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,18,"gateway.hints.ttl-messages-day")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,20,"gateway.hints.max-records"))}}class u4{constructor(e){this.fb=e,this.initialized=new u,this.StorageTypes=I3,this.storageTypes=Object.values(I3),this.storageTypesTranslationMap=k3,this.onChange=()=>{},this.storageFormGroup=this.initStorageFormGroup(),this.observeStorageTypeChanges(),this.storageFormGroup.valueChanges.pipe(wn()).subscribe((e=>{this.onChange(e)}))}ngAfterViewInit(){this.initialized.emit({storage:this.storageFormGroup.value})}writeValue(e){this.storageFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.storageFormGroup.valid?null:{storageFormGroup:{valid:!1}}}removeAllStorageValidators(){for(const e in this.storageFormGroup.controls)"type"!==e&&(this.storageFormGroup.controls[e].clearValidators(),this.storageFormGroup.controls[e].setErrors(null),this.storageFormGroup.controls[e].updateValueAndValidity())}initStorageFormGroup(){return this.fb.group({type:[I3.MEMORY,[$.required]],read_records_count:[100,[$.required,$.min(1),$.pattern(an)]],max_records_count:[1e5,[$.required,$.min(1),$.pattern(an)]],data_folder_path:["./data/",[$.required]],max_file_count:[10,[$.min(1),$.pattern(an)]],max_read_records_count:[10,[$.min(1),$.pattern(an)]],max_records_per_file:[1e4,[$.min(1),$.pattern(an)]],data_file_path:["./data/data.db",[$.required]],messages_ttl_check_in_hours:[1,[$.min(1),$.pattern(an)]],messages_ttl_in_days:[7,[$.min(1),$.pattern(an)]]})}observeStorageTypeChanges(){this.storageFormGroup.get("type").valueChanges.pipe(wn()).subscribe((e=>{switch(this.removeAllStorageValidators(),e){case I3.MEMORY:this.addMemoryStorageValidators(this.storageFormGroup);break;case I3.FILE:this.addFileStorageValidators(this.storageFormGroup);break;case I3.SQLITE:this.addSqliteStorageValidators(this.storageFormGroup)}}))}addMemoryStorageValidators(e){e.get("read_records_count").addValidators([$.required,$.min(1),$.pattern(an)]),e.get("max_records_count").addValidators([$.required,$.min(1),$.pattern(an)]),e.get("read_records_count").updateValueAndValidity({emitEvent:!1}),e.get("max_records_count").updateValueAndValidity({emitEvent:!1})}addFileStorageValidators(e){["max_file_count","max_read_records_count","max_records_per_file"].forEach((t=>{e.get(t).addValidators([$.required,$.min(1),$.pattern(an)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}addSqliteStorageValidators(e){["messages_ttl_check_in_hours","messages_ttl_in_days","max_records_per_file"].forEach((t=>{e.get(t).addValidators([$.required,$.min(1),$.pattern(an)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}static{this.ɵfac=function(e){return new(e||u4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:u4,selectors:[["tb-gateway-storage-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>u4)),multi:!0},{provide:K,useExisting:c((()=>u4)),multi:!0}]),t.ɵɵStandaloneFeature],decls:15,vars:9,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",4,"ngFor","ngForOf"],[1,"tb-form-panel-hint"],[3,"ngSwitch"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"value"],[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"],[4,"ngIf"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","number","matInput","","formControlName","max_records_count"],["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"]],template:function(e,n){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.ɵɵtemplate(7,B3,3,4,"tb-toggle-option",5),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(11,7),t.ɵɵtemplate(12,U3,21,12,"section",8)(13,e4,41,22,"section",9)(14,d4,41,22,"section",9),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.storageFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.storageTypes),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.hints."+n.storageFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.storageFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.MEMORY),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.FILE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.SQLITE))},dependencies:t.ɵɵgetComponentDepsFactory(u4,[j,_]),encapsulation:2})}}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.thingsboard-port-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.thingsboard-port-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.thingsboard-port-max")," "))}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.thingsboard-port-pattern")," "))}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.grpc-keep-alive-timeout-required")," "))}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.grpc-keep-alive-timeout-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.grpc-keep-alive-timeout-pattern")," "))}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.grpc-keep-alive-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.grpc-keep-alive-min")," "))}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.grpc-keep-alive-pattern")," "))}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.grpc-min-time-between-pings-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.grpc-min-time-between-pings-min")," "))}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.grpc-min-time-between-pings-pattern")," "))}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.grpc-max-pings-without-data-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.grpc-max-pings-without-data-min")," "))}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.grpc-max-pings-without-data-pattern")," "))}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.grpc-min-ping-interval-without-data-required")," "))}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.grpc-min-ping-interval-without-data-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.grpc-min-ping-interval-without-data-pattern")," "))}class O4{constructor(e){this.fb=e,this.initialized=new u,this.onChange=()=>{},this.grpcFormGroup=this.initGrpcFormGroup(),this.grpcFormGroup.valueChanges.pipe(wn()).subscribe((e=>{this.onChange(e)})),this.grpcFormGroup.get("enabled").valueChanges.pipe(wn()).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,[$.required,$.min(1),$.max(65535),$.pattern(an)]],keepAliveTimeMs:[1e4,[$.required,$.min(1),$.pattern(an)]],keepAliveTimeoutMs:[5e3,[$.required,$.min(1),$.pattern(an)]],keepalivePermitWithoutCalls:[!0],maxPingsWithoutData:[0,[$.required,$.min(0),$.pattern(an)]],minTimeBetweenPingsMs:[1e4,[$.required,$.min(1),$.pattern(an)]],minPingIntervalWithoutDataMs:[5e3,[$.required,$.min(1),$.pattern(an)]]})}static{this.ɵfac=function(e){return new(e||O4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:O4,selectors:[["tb-gateway-grpc-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>O4)),multi:!0},{provide:K,useExisting:c((()=>O4)),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"],[4,"ngIf"],["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,m4,3,3,"mat-error",10)(20,h4,3,3,"mat-error",10)(21,g4,3,3,"mat-error",10)(22,f4,3,3,"mat-error",10),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",11),t.ɵɵelementStart(27,"mat-icon",9),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(30,y4,3,3,"mat-error",10)(31,v4,3,3,"mat-error",10)(32,x4,3,3,"mat-error",10),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",12),t.ɵɵelementStart(38,"mat-icon",9),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(41,b4,3,3,"mat-error",10)(42,w4,3,3,"mat-error",10)(43,S4,3,3,"mat-error",10),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",13),t.ɵɵelementStart(48,"mat-icon",9),t.ɵɵpipe(49,"translate"),t.ɵɵtext(50,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(51,C4,3,3,"mat-error",10)(52,_4,3,3,"mat-error",10)(53,T4,3,3,"mat-error",10),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",14),t.ɵɵelementStart(59,"mat-icon",9),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(62,I4,3,3,"mat-error",10)(63,E4,3,3,"mat-error",10)(64,M4,3,3,"mat-error",10),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",15),t.ɵɵelementStart(69,"mat-icon",9),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(72,k4,3,3,"mat-error",10)(73,P4,3,3,"mat-error",10)(74,D4,3,3,"mat-error",10),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.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,37,"gateway.hints.grpc-keep-alive-timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,39,"gateway.hints.grpc-keep-alive")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,41,"gateway.hints.grpc-min-time-between-pings")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(60,43,"gateway.hints.grpc-max-pings-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,45,"gateway.hints.grpc-min-ping-interval-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("pattern")))},dependencies:t.ɵɵgetComponentDepsFactory(O4,[j,_]),encapsulation:2})}}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.logs.date-format-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.logs.log-format-required")," "))}function R4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function B4(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",30),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 N4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}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.logs.file-path-required")," "))}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.logs.saving-period-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.logs.saving-period-min")," "))}function G4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),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 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.logs.backup-count-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.logs.backup-count-min")," "))}class j4{constructor(e){this.fb=e,this.initialized=new u,this.logSavingPeriods=D3,this.localLogsConfigs=Object.keys(E3),this.localLogsConfigTranslateMap=M3,this.gatewayLogLevel=Object.values(pt),this.remoteLogLevel=Object.values(pt).filter((e=>e!==pt.NONE)),this.onChange=()=>{},this.logsFormGroup=this.initLogsFormGroup(),this.showRemoteLogsControl=this.fb.control(!1),this.logsFormGroup.valueChanges.pipe(wn()).subscribe((e=>{this.onChange(e)})),this.logSelector=this.fb.control(E3.service);for(const e of Object.keys(E3))this.addLocalLogConfig(e,{});this.showRemoteLogsControl.valueChanges.pipe(wn()).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??pt.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",[$.required,$.pattern(/^[^\s].*[^\s]$/)]],logFormat:["%(asctime)s.%(msecs)03d - |%(levelname)s| - [%(filename)s] - %(module)s - %(funcName)s - %(lineno)d - %(message)s",[$.required,$.pattern(/^[^\s].*[^\s]$/)]],type:["remote",[$.required]],logLevel:[{value:pt.INFO,disabled:!0}],local:this.fb.group({})})}addLocalLogConfig(e,t){const n=this.logsFormGroup.get("local"),i=this.fb.group({logLevel:[t.logLevel||pt.INFO,[$.required]],filePath:[t.filePath||"./logs",[$.required]],backupCount:[t.backupCount||7,[$.required,$.min(0)]],savingTime:[t.savingTime||3,[$.required,$.min(0)]],savingPeriod:[t.savingPeriod||P3.days,[$.required]]});n.addControl(e,i,{emitEvent:!1})}updateRemoteLogs(e){const t=e&&e!==pt.NONE;this.showRemoteLogsControl.patchValue(t,{emitEvent:!1}),this.logsFormGroup.get("logLevel")[t?"enable":"disable"]({emitEvent:!1}),this.logsFormGroup.get("logLevel").patchValue(e===pt.NONE?pt.INFO:e,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||j4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:j4,selectors:[["tb-gateway-logs-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>j4)),multi:!0},{provide:K,useExisting:c((()=>j4)),multi:!0}]),t.ɵɵStandaloneFeature],decls:72,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"],[4,"ngIf"],["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",4,"ngFor","ngForOf"],["formGroupName","local",1,"tb-form-panel","no-padding-bottom"],["translate","",1,"tb-form-panel-title"],[1,"toggle-group",3,"formControl"],["class","first-capital",3,"value",4,"ngFor","ngForOf"],[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"],[3,"value"],[1,"first-capital",3,"value"]],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,A4,3,3,"mat-error",6),t.ɵɵelementStart(8,"mat-icon",7),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",8),t.ɵɵtemplate(15,F4,3,3,"mat-error",6),t.ɵɵelementStart(16,"mat-icon",7),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",9)(20,"mat-expansion-panel",10)(21,"mat-expansion-panel-header",11)(22,"mat-panel-title")(23,"mat-slide-toggle",12),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵelementStart(24,"mat-label")(25,"div",13),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",14),t.ɵɵtemplate(33,R4,2,2,"mat-option",15),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(34,"div",16)(35,"div",17),t.ɵɵtext(36,"gateway.logs.local"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"tb-toggle-select",18),t.ɵɵtemplate(38,B4,2,2,"tb-toggle-option",19),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(39,20),t.ɵɵelementStart(40,"div",21)(41,"mat-form-field",22)(42,"mat-label",4),t.ɵɵtext(43,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-select",14),t.ɵɵtemplate(45,N4,2,2,"mat-option",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",22)(47,"mat-label",4),t.ɵɵtext(48,"gateway.logs.file-path"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",23),t.ɵɵtemplate(50,L4,3,3,"mat-error",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"div",21)(52,"div",24)(53,"mat-form-field",22)(54,"mat-label",4),t.ɵɵtext(55,"gateway.logs.saving-period"),t.ɵɵelementEnd(),t.ɵɵelement(56,"input",25),t.ɵɵtemplate(57,V4,3,3,"mat-error",6)(58,q4,3,3,"mat-error",6),t.ɵɵelementEnd(),t.ɵɵelementStart(59,"mat-form-field",26)(60,"mat-select",27),t.ɵɵtemplate(61,G4,3,4,"mat-option",15),t.ɵɵpipe(62,"keyvalue"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(63,"mat-form-field",22)(64,"mat-label",4),t.ɵɵtext(65,"gateway.logs.backup-count"),t.ɵɵelementEnd(),t.ɵɵelement(66,"input",28),t.ɵɵtemplate(67,z4,3,3,"mat-error",6)(68,U4,3,3,"mat-error",6),t.ɵɵelementStart(69,"mat-icon",7),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.logsFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("dateFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,21,"gateway.hints.date-form")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("logFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",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.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,25,"gateway.hints.remote-log")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,27,"gateway.logs.remote")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.remoteLogLevel),t.ɵɵadvance(4),t.ɵɵproperty("formControl",n.logSelector),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.localLogsConfigs),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.getLogFormGroup(n.logSelector.value)),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(5),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".filePath").hasError("required")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("min")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(62,29,n.logSavingPeriods)),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("min")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,31,"gateway.hints.backup-count")))},dependencies:t.ɵɵgetComponentDepsFactory(j4,[j,_]),encapsulation:2})}}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,"security.clientId-required")," "))}function W4(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 $4(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,"device.generate-client-id"))}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,"security.username-required")," "))}function Y4(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 X4(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("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 Z4(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 Q4(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("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 J4(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"device.client-id-or-user-name-necessary"))}function e5(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"gateway.hints.username-required-with-password"))}class t5{constructor(e){this.fb=e,this.onChange=()=>{},this.initForm(),this.usernameFormGroup.valueChanges.pipe(wn()).subscribe((e=>this.onChange(e)))}writeValue(e){this.usernameFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){e?this.usernameFormGroup.disable({emitEvent:!1}):this.usernameFormGroup.enable({emitEvent:!1})}validate(){return this.usernameFormGroup.valid?null:{usernameFormGroup:{valid:!1}}}initForm(){this.usernameFormGroup=this.createSecurityFormGroup()}createSecurityFormGroup(){return this.fb.group({clientId:[null,[$.pattern(/^[^.\s]+$/)]],username:[null,[$.pattern(/^[^.\s]+$/)]],password:[null,[$.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(Re(20))}static{this.ɵfac=function(e){return new(e||t5)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:t5,selectors:[["tb-gateway-username-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>t5)),multi:!0},{provide:K,useExisting:c((()=>t5)),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"],[4,"ngIf"],["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"],["class","block",3,"error",4,"ngIf"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"],[1,"block",3,"error"]],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,H4,3,3,"mat-error",5)(7,W4,2,4,"tb-copy-button",6)(8,$4,4,3,"button",7),t.ɵɵelementStart(9,"mat-icon",8),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",9),t.ɵɵtemplate(16,K4,3,3,"mat-error",5)(17,Y4,2,4,"tb-copy-button",6)(18,X4,4,3,"button",7),t.ɵɵelementStart(19,"mat-icon",8),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"mat-form-field",10)(23,"mat-label",3),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",11),t.ɵɵtemplate(26,Z4,2,4,"tb-copy-button",6)(27,Q4,4,3,"button",7),t.ɵɵelementStart(28,"mat-icon",8),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵtemplate(31,J4,2,3,"tb-error",12)(32,e5,2,3,"tb-error",12)),2&e&&(t.ɵɵproperty("formGroup",n.usernameFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.usernameFormGroup.get("clientId").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.get("username").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("atLeastOneRequired")&&n.usernameFormGroup.touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("usernameRequired")&&n.usernameFormGroup.touched))},dependencies:t.ɵɵgetComponentDepsFactory(t5,[j,_]),encapsulation:2})}}class n5{constructor(e,t){this.deviceService=e,this.destroyRef=t,this.initialCredentialsSubject=new ie(null)}get initialCredentials(){return this.initialCredentialsSubject.value}get initialCredentials$(){return this.initialCredentialsSubject.asObservable()}updateCredentials(e){let t={};switch(e.type){case O3.USERNAME_PASSWORD:this.shouldUpdateCredentials(e)&&(t=this.generateMqttCredentials(e));break;case O3.ACCESS_TOKEN:case O3.TLS_ACCESS_TOKEN:this.shouldUpdateAccessToken(e)&&(t={credentialsType:U.ACCESS_TOKEN,credentialsId:e.accessToken,credentialsValue:null})}return this.initialCredentialsSubject.next({...this.initialCredentials,...t}),Object.keys(t).length?this.deviceService.saveDeviceCredentials(this.initialCredentials):ae(null)}setInitialCredentials(e){this.deviceService.getDeviceCredentials(e.id).pipe(wn(this.destroyRef)).subscribe((e=>{this.initialCredentialsSubject.next({...e,version:null})}))}shouldUpdateSecurityConfig(e){switch(e.type){case O3.USERNAME_PASSWORD:return this.shouldUpdateCredentials(e);case O3.ACCESS_TOKEN:case O3.TLS_ACCESS_TOKEN:return this.shouldUpdateAccessToken(e)}}credentialsToSecurityConfig(e){const t=e.credentialsType===U.MQTT_BASIC?O3.USERNAME_PASSWORD:O3.ACCESS_TOKEN;if(e.credentialsType!==U.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!==U.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!==U.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:U.MQTT_BASIC,credentialsValue:JSON.stringify(a)}}static{this.ɵfac=function(e){return new(e||n5)(t.ɵɵinject(_e.DeviceService),t.ɵɵinject(t.DestroyRef))}}static{this.ɵprov=t.ɵɵdefineInjectable({token:n5,factory:n5.ɵfac})}}function i5(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;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e.value)," ")}}function a5(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 r5(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",13),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 o5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",16),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 s5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label",10),t.ɵɵtext(2,"security.access-token"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",11),t.ɵɵtemplate(4,a5,3,3,"mat-error",12)(5,r5,2,4,"tb-copy-button",13)(6,o5,4,3,"button",14),t.ɵɵelementStart(7,"mat-icon",15),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("ngIf",e.securityFormGroup.get("accessToken").hasError("required")),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 l5(e,n){1&e&&(t.ɵɵelement(0,"tb-file-input",17),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 p5{constructor(e,t,n){this.fb=e,this.cd=t,this.gatewayCredentialsService=n,this.initialized=new u,this.securityTypes=A3,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){e?this.updateFormBySecurityConfig(e):this.updateFormBySecurityConfig(this.gatewayCredentialsService.credentialsToSecurityConfig(this.gatewayCredentialsService.initialCredentials))}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===O3.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:[O3.ACCESS_TOKEN,[$.required]],accessToken:[null,[$.required,$.pattern(/^[^.\s]+$/)]],caCert:[null,[$.required]],usernamePassword:[]})}setupFormListeners(){this.securityFormGroup.valueChanges.pipe(wn()).subscribe((({usernamePassword:e,...t})=>{this.onChange(e?{...t,...e}:t)})),this.securityFormGroup.get("type").valueChanges.pipe(wn()).subscribe((e=>{this.toggleBySecurityType(e)})),this.securityFormGroup.get("caCert").valueChanges.pipe(wn()).subscribe((()=>this.cd.detectChanges()))}toggleBySecurityType(e){switch(this.securityFormGroup.disable({emitEvent:!1}),this.securityFormGroup.get("type").enable({emitEvent:!1}),e){case O3.ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1});break;case O3.TLS_PRIVATE_KEY:this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case O3.TLS_ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case O3.USERNAME_PASSWORD:this.securityFormGroup.get("usernamePassword").enable({emitEvent:!1})}}generateAccessToken(){this.securityFormGroup.get("accessToken").patchValue(Re(20))}static{this.ɵfac=function(e){return new(e||p5)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(n5))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:p5,selectors:[["tb-gateway-security-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>p5)),multi:!0},{provide:K,useExisting:c((()=>p5)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,consts:[[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],[3,"formGroup"],["formControlName","type",1,"toggle-group","flex"],[3,"value",4,"ngFor","ngForOf"],["appearance","outline",4,"ngIf"],["formControlName","usernamePassword"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel",4,"ngIf"],[3,"value"],["appearance","outline"],["translate",""],["matInput","","formControlName","accessToken"],[4,"ngIf"],["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"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel"]],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.ɵɵtemplate(5,i5,3,4,"tb-toggle-option",4),t.ɵɵpipe(6,"keyvalue"),t.ɵɵelementEnd(),t.ɵɵtemplate(7,s5,10,5,"mat-form-field",5),t.ɵɵelement(8,"tb-gateway-username-configuration",6),t.ɵɵtemplate(9,l5,4,11,"tb-file-input",7),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(6,6,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("accesstoken")),t.ɵɵadvance(),t.ɵɵclassProp("hidden","usernamePassword"!==n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("tls")))},dependencies:t.ɵɵgetComponentDepsFactory(p5,[j,_,t5]),encapsulation:2})}}const c5=["configGroup"];function d5(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 u5(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 m5(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 h5(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 g5(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 f5(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 y5(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",21),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Gateway)}}function v5(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,d5,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,u5,3,3,"mat-error")(26,m5,3,3,"mat-error")(27,h5,3,3,"mat-error")(28,g5,3,3,"mat-error"),t.ɵɵelementStart(29,"mat-icon",16),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(32,f5,1,0,"tb-gateway-security-configuration",18),t.ɵɵpipe(33,"async"),t.ɵɵtemplate(34,y5,1,1,"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.ɵɵproperty("ngIf",t.ɵɵpipeBind1(33,22,e.initialCredentials$)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.withReportStrategy)}}function x5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",23)(1,"mat-label",33),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-slide-toggle",34)(6,"mat-label",33),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 b5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",23),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.statistics")," "))}function w5(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 S5(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 C5(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 _5(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 T5(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 I5(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 E5(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 M5(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 k5(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 P5(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 D5(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 O5(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 A5(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 F5(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 R5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",35)(1,"section",36)(2,"section",37)(3,"mat-form-field",38)(4,"mat-label",14),t.ɵɵtext(5,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",39),t.ɵɵtemplate(7,E5,3,3,"mat-error")(8,M5,3,3,"mat-error")(9,k5,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",38)(14,"mat-label",14),t.ɵɵtext(15,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",40),t.ɵɵtemplate(17,P5,3,3,"mat-error")(18,D5,3,3,"mat-error")(19,O5,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",41)(25,"mat-label",14),t.ɵɵtext(26,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",42),t.ɵɵtemplate(28,A5,3,3,"mat-error")(29,F5,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",43)(35,"mat-expansion-panel-header")(36,"mat-panel-title")(37,"div",28),t.ɵɵtext(38,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(39,"mat-form-field",38)(40,"mat-label",14),t.ɵɵtext(41,"gateway.statistics.install-cmd"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",44),t.ɵɵelementStart(43,"mat-icon",45),t.ɵɵpipe(44,"translate"),t.ɵɵtext(45,"info_outlined "),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(46,"button",46),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 B5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",22),t.ɵɵtemplate(2,x5,10,12)(3,b5,3,3,"mat-slide-toggle",23),t.ɵɵelementStart(4,"mat-form-field",24)(5,"mat-label",14),t.ɵɵtext(6,"gateway.statistics.send-period"),t.ɵɵelementEnd(),t.ɵɵelement(7,"input",25),t.ɵɵtemplate(8,w5,3,3,"mat-error")(9,S5,3,3,"mat-error")(10,C5,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",24)(12,"mat-label",14),t.ɵɵtext(13,"gateway.statistics.custom-send-period"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",26),t.ɵɵtemplate(15,_5,3,3,"mat-error")(16,T5,3,3,"mat-error")(17,I5,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",27)(19,"div",28),t.ɵɵtext(20,"gateway.statistics.commands"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",29),t.ɵɵtext(22,"gateway.hints.commands"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(23,30),t.ɵɵtemplate(24,R5,50,20,"div",31),t.ɵɵelementStart(25,"button",32),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.addCommand())})),t.ɵɵtext(26),t.ɵɵpipe(27,"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.ɵɵproperty("ngForOf",e.commandFormArray().controls),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.basicFormGroup.get("thingsboard.remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,6,"gateway.statistics.add")," ")}}function N5(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 L5(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 V5(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 q5(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 G5(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 z5(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 U5(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",37)(1,"mat-form-field",38)(2,"mat-label",14),t.ɵɵtext(3,"gateway.inactivity-timeout-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",56),t.ɵɵtemplate(5,N5,3,3,"mat-error")(6,L5,3,3,"mat-error")(7,V5,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",38)(12,"mat-label",14),t.ɵɵtext(13,"gateway.inactivity-check-period-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",57),t.ɵɵtemplate(15,q5,3,3,"mat-error")(16,G5,3,3,"mat-error")(17,z5,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 j5(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 H5(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 W5(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 $5(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 K5(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 Y5(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 X5(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 Z5(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 Q5(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 J5(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 e6(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 t6(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 n6(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 i6(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 a6(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 r6(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",47)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",48),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(7,U5,21,8,"section",49),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",8)(9,"div",28),t.ɵɵtext(10,"gateway.advanced"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"section",37)(12,"mat-form-field",38)(13,"mat-label",14),t.ɵɵtext(14,"gateway.min-pack-send-delay"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",50),t.ɵɵtemplate(16,j5,3,3,"mat-error")(17,H5,3,3,"mat-error")(18,W5,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",38)(23,"mat-label",14),t.ɵɵtext(24,"gateway.mqtt-qos"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",51)(26,"mat-option",52),t.ɵɵtext(27,"0"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-option",52),t.ɵɵtext(29,"1"),t.ɵɵelementEnd()(),t.ɵɵtemplate(30,$5,3,3,"mat-error")(31,K5,3,3,"mat-error")(32,Y5,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",37)(37,"mat-form-field",38)(38,"mat-label",14),t.ɵɵtext(39,"gateway.statistics.check-connectors-configuration"),t.ɵɵelementEnd(),t.ɵɵelement(40,"input",53),t.ɵɵtemplate(41,X5,3,3,"mat-error")(42,Z5,3,3,"mat-error")(43,Q5,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",38)(45,"mat-label",14),t.ɵɵtext(46,"gateway.statistics.max-payload-size-bytes"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",54),t.ɵɵtemplate(48,J5,3,3,"mat-error")(49,e6,3,3,"mat-error")(50,t6,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",37)(55,"mat-form-field",38)(56,"mat-label",14),t.ɵɵtext(57,"gateway.statistics.min-pack-size-to-send"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",55),t.ɵɵtemplate(59,n6,3,3,"mat-error")(60,i6,3,3,"mat-error")(61,a6,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.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value),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 o6{constructor(e,t,n,i,a){this.fb=e,this.deviceService=t,this.gatewayCredentialsService=n,this.destroyRef=i,this.dialog=a,this.gatewayVersion=ct.Legacy,this.dialogMode=!1,this.withReportStrategy=!1,this.initialized=new u,this.ReportStrategyDefaultValue=tn,this.initialCredentials$=this.gatewayCredentialsService.initialCredentials$,this.onChange=()=>{},this.destroy$=new te,this.initBasicFormGroup(),this.observeFormChanges(),this.basicFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.onChange(e)}))}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=T3[this.defaultTab])}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.basicFormGroup.patchValue(e,{emitEvent:!1});const t=e?.thingsboard?.statistics?.commands??[];this.commandFormArray().clear({emitEvent:!1}),t.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(le(this.destroy$)).subscribe((e=>{this.dialog.open(KH,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{gatewayName:e.name}}).afterClosed().pipe(ye(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,[$.required,$.pattern(rn),this.uniqNameRequired()]],command:[i,[$.required,$.pattern(/^(?=\S).*\S$/)]],timeout:[a,[$.required,$.min(1),$.pattern(an),$.pattern(/^[^.\s]+$/)]],installCmd:[r,$.pattern(rn)]});this.commandFormArray().push(o,{emitEvent:t})}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=e.dirty&&t&&this.commandFormArray().value.some((e=>e.attributeOnGateway?.toLowerCase()===t));return n?{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,[$.required,$.pattern(/^[^\s]+$/)]],port:[1883,[$.required,$.min(1),$.max(65535),$.pattern(an)]],remoteShell:[!1],remoteConfiguration:[!0],checkConnectorsConfigurationInSeconds:[60,[$.required,$.min(1),$.pattern(an)]],statistics:this.fb.group({enable:[!0],enableCustom:[{value:!1,disabled:!0}],statsSendPeriodInSeconds:[3600,[$.required,$.min(60),$.pattern(an)]],customStatsSendPeriodInSeconds:[3600,[$.required,$.min(60),$.pattern(an)]],commands:this.fb.array([])}),maxPayloadSizeBytes:[8196,[$.required,$.min(100),$.pattern(an)]],minPackSendDelayMS:[50,[$.required,$.min(10),$.pattern(an)]],minPackSizeToSend:[500,[$.required,$.min(100),$.pattern(an)]],handleDeviceRenaming:[!0],checkingDeviceActivity:this.initCheckingDeviceActivityFormGroup(),security:[],qos:[1],reportStrategy:[{value:{type:en.OnReceived},disabled:!0}]})}initCheckingDeviceActivityFormGroup(){return this.fb.group({checkDeviceInactivity:[!1],inactivityTimeoutSeconds:[300,[$.min(1),$.pattern(an)]],inactivityCheckPeriodSeconds:[10,[$.min(1),$.pattern(an)]]})}onVersionChange(){if(this.hasUpdatedStatistics=Ua.parseVersion(this.gatewayVersion)>=Ua.parseVersion(ct.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(wn(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(le(this.destroy$)).subscribe((e=>{e||this.openConfigurationConfirmDialog()}))}observeDeviceActivityChanges(){const e=this.basicFormGroup.get("thingsboard.checkingDeviceActivity");e.get("checkDeviceInactivity").valueChanges.pipe(le(this.destroy$)).subscribe((t=>{e.updateValueAndValidity();const n=[$.min(1),$.required,$.pattern(an)];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||o6)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.DeviceService),t.ɵɵdirectiveInject(n5),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(qe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:o6,selectors:[["tb-gateway-basic-configuration"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(c5,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:W,useExisting:c((()=>o6)),multi:!0},{provide:K,useExisting:c((()=>o6)),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",3,"initialized",4,"ngIf"],["class","tb-form-panel","formControlName","reportStrategy",3,"defaultValue",4,"ngIf"],["formControlName","security",3,"initialized"],["formControlName","reportStrategy",1,"tb-form-panel",3,"defaultValue"],["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","class","statistics-container flex flex-row",4,"ngFor","ngForOf"],["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"],["formArrayName","commands",1,"statistics-container","flex","flex-row"],[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"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngIf"],["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,v5,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,B5,28,8,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-tab",2),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,r6,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(o6,[j,_,Zn,u4,O4,j4,p5]),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",o6),Ge([I()],o6.prototype,"dialogMode",void 0),Ge([I()],o6.prototype,"withReportStrategy",void 0);class s6{constructor(e){this.fb=e,this.destroy$=new te,this.advancedFormControl=this.fb.control(""),this.advancedFormControl.valueChanges.pipe(le(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||s6)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:s6,selectors:[["tb-gateway-advanced-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>s6)),multi:!0},{provide:K,useExisting:c((()=>s6)),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(s6,[j,_]),encapsulation:2})}}function l6(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 p6(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 c6(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-advanced-configuration",10)}function d6(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",s6);class u6{constructor(e,t,n,i,a){this.fb=e,this.attributeService=t,this.cd=n,this.gatewayCredentialsService=i,this.destroyRef=a,this.ConfigurationModes=Jt,this.gatewayConfigAttributeKeys=["general_configuration","grpc_configuration","logs_configuration","storage_configuration","RemoteLoggingLevel","mode"],this.useUpdatedLogs=!1,this.gatewayConfigGroup=this.fb.group({basicConfig:[],advancedConfig:[],mode:[Jt.BASIC]}),this.observeAlignConfigs()}ngAfterViewInit(){this.fetchConfigAttribute(this.device)}saveConfig(){const{mode:e,advancedConfig:t}=Ne(this.removeEmpty(this.gatewayConfigGroup.value)),n={mode:e,...t};n.thingsboard.statistics.commands=Object.values(n.thingsboard.statistics.commands??[]);const i=this.generateAttributes(n);this.attributeService.saveEntityAttributes(this.device,D.SHARED_SCOPE,i).pipe(xe((e=>this.gatewayCredentialsService.updateCredentials(n.thingsboard.security))),wn(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(wn(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("advancedConfig");Se(t.value,e)||this.gatewayConfigGroup.get("mode").value!==Jt.BASIC||t.patchValue(e,{emitEvent:!1})})),this.gatewayConfigGroup.get("advancedConfig").valueChanges.pipe(wn(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("basicConfig");Se(t.value,e)||this.gatewayConfigGroup.get("mode").value!==Jt.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??pt.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"},...this.useUpdatedLogs?{}:{databaseHandler:{class:this.useUpdatedLogs?F3:R3,formatter:"LogFormatter",filename:"./logs/database.log",backupCount:1,encoding:"utf-8"}}},loggers:{...this.useUpdatedLogs?{}:{database:{handlers:["databaseHandler","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?F3:R3,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!==B&&this.attributeService.getEntityAttributes(e,D.CLIENT_SCOPE).pipe(we((t=>t.length?ae(t):this.attributeService.getEntityAttributes(e,D.SHARED_SCOPE,this.gatewayConfigAttributeKeys))),wn(this.destroyRef)).subscribe((e=>{this.gatewayVersion=e.find((e=>"Version"===e.key))?.value,this.useUpdatedLogs=Ua.parseVersion(this.gatewayVersion??ct.Legacy)>=Ua.parseVersion(ct.v3_6_3),this.updateConfigs(e),this.cd.detectChanges()}))}updateConfigs(e){let t={},n=pt.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??Jt.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(ue(Boolean),ye(1),wn(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(E3).reduce(((t,n)=>{const i=e.handlers[`${n}Handler`]||{},a=e.loggers[n]||{};return t[n]={logLevel:a.level||pt.INFO,filePath:i.filename?.split(`/${n}`)[0]||"./logs",backupCount:i.backupCount||7,savingTime:i.interval||3,savingPeriod:i.when||P3.days},t}),{}),logFormat:t,dateFormat:n}}static{this.ɵfac=function(e){return new(e||u6)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(n5),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:u6,selectors:[["tb-gateway-configuration"]],inputs:{device:"device",defaultTab:"defaultTab",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵProvidersFeature([n5]),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",3,"click",4,"ngIf"],[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,l6,3,0,"button",7),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8),t.ɵɵtemplate(17,p6,2,7,"tb-gateway-basic-configuration",9)(18,c6,1,0,"tb-gateway-advanced-configuration",10),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",11),t.ɵɵtemplate(20,d6,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.ɵɵproperty("ngIf",n.dialogRef),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(u6,[j,_,Ya,o6,s6]),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",u6);class m6{constructor(){}static{this.ɵfac=function(e){return new(e||m6)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:m6,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}.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 .\\!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 h6=(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 g6{constructor(e){this.translate=e,function(e){e.setTranslation("en_US",ft,!0),e.setTranslation("ar_AE",yt,!0),e.setTranslation("ca_ES",vt,!0),e.setTranslation("cs_CZ",xt,!0),e.setTranslation("da_DK",bt,!0),e.setTranslation("es_ES",wt,!0),e.setTranslation("ko_KR",St,!0),e.setTranslation("lt_LT",Ct,!0),e.setTranslation("nl_BE",_t,!0),e.setTranslation("pl_PL",Tt,!0),e.setTranslation("pt_BR",It,!0),e.setTranslation("sl_SI",Et,!0),e.setTranslation("tr_TR",Mt,!0),e.setTranslation("zh_CN",kt,!0),e.setTranslation("zh_TW",Pt,!0)}(e),(e=>{h6(m6,e)})("tb-gateway-css")}static{this.ɵfac=function(e){return new(e||g6)(t.ɵɵinject(He.TranslateService))}}static{this.ɵmod=t.ɵɵdefineNgModule({type:g6})}static{this.ɵinj=t.ɵɵdefineInjector({imports:[j,_,$e,JU,WH,zW,u6,bn,_3,C3]})}}e("GatewayExtensionModule",g6),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(g6,{imports:[j,_,$e,JU,WH,zW,u6,bn,_3,C3]})}}}));//# sourceMappingURL=gateway-management-extension.js.map diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index b4d178a737..706ba3af53 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1284,7 +1284,7 @@ transport: # URL of gateways dashboard repository repository_url: "${TB_GATEWAY_DASHBOARD_SYNC_REPOSITORY_URL:https://github.com/thingsboard/gateway-management-extensions-dist.git}" # Branch of gateways dashboard repository to work with - branch: "${TB_GATEWAY_DASHBOARD_SYNC_BRANCH:release/4.0.0}" + branch: "${TB_GATEWAY_DASHBOARD_SYNC_BRANCH:}" # Fetch frequency in hours for gateways dashboard repository fetch_frequency: "${TB_GATEWAY_DASHBOARD_SYNC_FETCH_FREQUENCY:24}" From ad40848a25efa3c3c06b58ef563e4b327a205d66 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Fri, 11 Apr 2025 12:29:20 +0300 Subject: [PATCH 253/286] Fix DefaultTbCoreConsumerServiceTest --- .../server/service/queue/DefaultTbCoreConsumerService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java index e115e4f7b5..fe2d291765 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerService.java @@ -20,6 +20,7 @@ import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEventPublisher; @@ -116,6 +117,7 @@ import java.util.function.Function; import java.util.stream.Collectors; @Service +@Slf4j @TbCoreComponent public class DefaultTbCoreConsumerService extends AbstractConsumerService implements TbCoreConsumerService { From 48d9aca0abec1525e69ba500c91673c8efe56f66 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 12:29:45 +0300 Subject: [PATCH 254/286] minor fixes --- .../org/thingsboard/server/actors/app/AppActor.java | 2 +- .../calculatedField/CalculatedFieldManagerActor.java | 6 +++--- .../CalculatedFieldManagerMessageProcessor.java | 12 +++++++----- .../server/actors/tenant/TenantActor.java | 3 ++- .../cf/DefaultCalculatedFieldInitService.java | 8 ++++---- .../DefaultTbCalculatedFieldConsumerService.java | 5 ++--- application/src/main/resources/thingsboard.yml | 4 ++++ .../queue/DefaultTbCoreConsumerServiceTest.java | 4 ++++ .../server/dao/cf/CalculatedFieldService.java | 2 -- .../org/thingsboard/server/common/msg/MsgType.java | 2 +- ...java => CalculatedFieldInitProfileEntityMsg.java} | 4 ++-- .../queue/discovery/event/PartitionChangeEvent.java | 1 - .../queue/provider/KafkaMonolithQueueFactory.java | 3 +++ .../provider/KafkaTbRuleEngineQueueFactory.java | 3 +++ .../server/dao/cf/BaseCalculatedFieldService.java | 6 ------ 15 files changed, 36 insertions(+), 29 deletions(-) rename common/message/src/main/java/org/thingsboard/server/common/msg/cf/{CalculatedFieldProfileEntityMsg.java => CalculatedFieldInitProfileEntityMsg.java} (88%) diff --git a/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java b/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java index fc9f344563..a79a182fa1 100644 --- a/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/app/AppActor.java @@ -114,7 +114,7 @@ public class AppActor extends ContextAwareActor { ctx.broadcastToChildrenByType(msg, EntityType.TENANT); break; case CF_CACHE_INIT_MSG: - case CF_PROFILE_ENTITY_MSG: + case CF_INIT_PROFILE_ENTITY_MSG: case CF_INIT_MSG: case CF_LINK_INIT_MSG: case CF_STATE_RESTORE_MSG: diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java index d5a3da03e4..9f59a80e67 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerActor.java @@ -25,9 +25,9 @@ import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldInitProfileEntityMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; -import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg; /** * Created by ashvayka on 15.03.18. @@ -70,8 +70,8 @@ public class CalculatedFieldManagerActor extends AbstractCalculatedFieldActor { case CF_CACHE_INIT_MSG: processor.onCacheInitMsg((CalculatedFieldCacheInitMsg) msg); break; - case CF_PROFILE_ENTITY_MSG: - processor.onProfileEntityMsg((CalculatedFieldProfileEntityMsg) msg); + case CF_INIT_PROFILE_ENTITY_MSG: + processor.onProfileEntityMsg((CalculatedFieldInitProfileEntityMsg) msg); break; case CF_INIT_MSG: processor.onFieldInitMsg((CalculatedFieldInitMsg) msg); diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index e62c531b16..a896bbd74b 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -38,9 +38,9 @@ import org.thingsboard.server.common.data.page.PageDataIterable; import org.thingsboard.server.common.msg.cf.CalculatedFieldCacheInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldEntityLifecycleMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldInitMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldInitProfileEntityMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldLinkInitMsg; import org.thingsboard.server.common.msg.cf.CalculatedFieldPartitionChangeMsg; -import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.TbCallback; @@ -86,7 +86,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware protected TbActorCtx ctx; - @Value("${calculated_fields.init_fetch_pack_size:50000}") + @Value("${queue.calculated_fields.init_tenant_fetch_pack_size:1000}") @Getter private int initFetchPackSize; @@ -123,7 +123,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware msg.getCallback().onSuccess(); } - public void onProfileEntityMsg(CalculatedFieldProfileEntityMsg msg) { + public void onProfileEntityMsg(CalculatedFieldInitProfileEntityMsg msg) { log.debug("[{}] Processing profile entity message.", msg.getTenantId().getId()); entityProfileCache.add(msg.getProfileEntityId(), msg.getEntityId()); msg.getCallback().onSuccess(); @@ -538,7 +538,8 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware return switch (entityId.getEntityType()) { case ASSET -> assetProfileCache.get(tenantId, (AssetId) entityId).getId(); case DEVICE -> deviceProfileCache.get(tenantId, (DeviceId) entityId).getId(); - default -> null; + default -> + throw new IllegalArgumentException("'" + entityId.getEntityType() + "' is not profile entity." + entityId); }; } @@ -567,10 +568,11 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware public void initCalculatedFields() { PageDataIterable cfs = new PageDataIterable<>(pageLink -> cfDaoService.findCalculatedFieldsByTenantId(tenantId, pageLink), initFetchPackSize); cfs.forEach(cf -> { + log.trace("Processing calculated field record: {}", cf); try { onFieldInitMsg(new CalculatedFieldInitMsg(cf.getTenantId(), cf)); } catch (CalculatedFieldException e) { - throw new RuntimeException(e); + log.error("Failed to process calculated field record: {}", cf, e); } }); calculatedFields.values().forEach(cf -> { diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index a5be701d38..2a039327f2 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -178,7 +178,7 @@ public class TenantActor extends RuleChainManagerActor { onRuleChainMsg((RuleChainAwareMsg) msg); break; case CF_CACHE_INIT_MSG: - case CF_PROFILE_ENTITY_MSG: + case CF_INIT_PROFILE_ENTITY_MSG: case CF_INIT_MSG: case CF_LINK_INIT_MSG: case CF_STATE_RESTORE_MSG: @@ -202,6 +202,7 @@ public class TenantActor extends RuleChainManagerActor { } else { log.debug("[{}] CF Actor is not initialized. ToCalculatedFieldSystemMsg: [{}]", tenantId, msg); } + msg.getCallback().onSuccess(); return; } if (priority) { diff --git a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java index 826a5243cf..79950f2e3f 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java @@ -23,7 +23,7 @@ import org.springframework.stereotype.Service; import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.common.data.ProfileEntityIdInfo; import org.thingsboard.server.common.data.page.PageDataIterable; -import org.thingsboard.server.common.msg.cf.CalculatedFieldProfileEntityMsg; +import org.thingsboard.server.common.msg.cf.CalculatedFieldInitProfileEntityMsg; import org.thingsboard.server.dao.asset.AssetService; import org.thingsboard.server.dao.device.DeviceService; import org.thingsboard.server.queue.util.AfterStartUp; @@ -39,7 +39,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer private final DeviceService deviceService; private final ActorSystemContext actorSystemContext; - @Value("${calculated_fields.init_fetch_pack_size:50000}") + @Value("${queue.calculated_fields.init_fetch_pack_size:50000}") @Getter private int initFetchPackSize; @@ -49,7 +49,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer for (ProfileEntityIdInfo idInfo : deviceIdInfos) { log.trace("Processing device record: {}", idInfo); try { - actorSystemContext.tell(new CalculatedFieldProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); + actorSystemContext.tell(new CalculatedFieldInitProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); } catch (Exception e) { log.error("Failed to process device record: {}", idInfo, e); } @@ -58,7 +58,7 @@ public class DefaultCalculatedFieldInitService implements CalculatedFieldInitSer for (ProfileEntityIdInfo idInfo : assetIdInfos) { log.trace("Processing asset record: {}", idInfo); try { - actorSystemContext.tell(new CalculatedFieldProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); + actorSystemContext.tell(new CalculatedFieldInitProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); } catch (Exception e) { log.error("Failed to process asset record: {}", idInfo, e); } diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index ea2b87e5e4..41bf76ff0e 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -131,6 +131,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa stateService.restore(queueKey, partitions); } }); + // eventConsumer's partitions will be updated by stateService // Cleanup old entities after corresponding consumers are stopped. // Any periodic tasks need to check that the entity is still managed by the current server before processing. @@ -174,9 +175,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa packSubmitFuture.cancel(true); log.info("Timeout to process message: {}", pendingMsgHolder.getMsg()); } - if (log.isDebugEnabled()) { - ctx.getAckMap().forEach((id, msg) -> log.debug("[{}] Timeout to process message: {}", id, msg.getValue())); - } + ctx.getAckMap().forEach((id, msg) -> log.debug("[{}] Timeout to process message: {}", id, msg.getValue())); ctx.getFailedMap().forEach((id, msg) -> log.warn("[{}] Failed to process message: {}", id, msg.getValue())); } consumer.commit(); diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 716797c2d2..14f0437402 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1848,6 +1848,10 @@ queue: pool_size: "${TB_QUEUE_CF_POOL_SIZE:8}" # RocksDB path for storing CF states rocks_db_path: "${TB_QUEUE_CF_ROCKS_DB_PATH:${user.home}/.rocksdb/cf_states}" + # The fetch size specifies how many rows will be returned + init_fetch_pack_size: "${TB_QUEUE_CF_FETCH_PACK_SIZE:50000}" + # The fetch size specifies how many rows will be returned + init_tenant_fetch_pack_size: "${TB_QUEUE_CF_TENANT_FETCH_PACK_SIZE:1000}" transport: # For high-priority notifications that require minimum latency and processing time notifications_topic: "${TB_QUEUE_TRANSPORT_NOTIFICATIONS_TOPIC:tb_transport.notifications}" diff --git a/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java b/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java index 26832f6176..4a5ecef970 100644 --- a/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import org.slf4j.Logger; import org.springframework.test.util.ReflectionTestUtils; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.TenantId; @@ -51,6 +52,8 @@ public class DefaultTbCoreConsumerServiceTest { private TbCoreConsumerStats statsMock; @Mock private RuleEngineCallService ruleEngineCallServiceMock; + @Mock + private Logger logMock; @Mock private TbCallback tbCallbackMock; @@ -69,6 +72,7 @@ public class DefaultTbCoreConsumerServiceTest { executor = MoreExecutors.newDirectExecutorService(); ReflectionTestUtils.setField(defaultTbCoreConsumerServiceMock, "stateService", stateServiceMock); ReflectionTestUtils.setField(defaultTbCoreConsumerServiceMock, "deviceActivityEventsExecutor", executor); + ReflectionTestUtils.setField(defaultTbCoreConsumerServiceMock, "log", logMock); } @AfterEach diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java index b6f43cda67..5101d6d57e 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/cf/CalculatedFieldService.java @@ -55,8 +55,6 @@ public interface CalculatedFieldService extends EntityDaoService { List findAllCalculatedFieldLinksByEntityId(TenantId tenantId, EntityId entityId); - List findAllCalculatedFieldLinksByTenantId(TenantId tenantId); - PageData findAllCalculatedFieldLinksByTenantId(TenantId tenantId, PageLink pageLink); PageData findAllCalculatedFieldLinks(PageLink pageLink); diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java b/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java index 5bada73c8c..f1c404ce16 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/MsgType.java @@ -137,7 +137,7 @@ public enum MsgType { CF_CACHE_INIT_MSG, // Sent to init caches for CF actor; - CF_PROFILE_ENTITY_MSG, // Sent to init profile entities cache; + CF_INIT_PROFILE_ENTITY_MSG, // Sent to init profile entities cache; CF_INIT_MSG, // Sent to init particular calculated field; CF_LINK_INIT_MSG, // Sent to init particular calculated field; CF_STATE_RESTORE_MSG, // Sent to restore particular calculated field entity state; diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldProfileEntityMsg.java b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldInitProfileEntityMsg.java similarity index 88% rename from common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldProfileEntityMsg.java rename to common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldInitProfileEntityMsg.java index 72447af677..66cd2ac441 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldProfileEntityMsg.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/cf/CalculatedFieldInitProfileEntityMsg.java @@ -22,7 +22,7 @@ import org.thingsboard.server.common.msg.MsgType; import org.thingsboard.server.common.msg.ToCalculatedFieldSystemMsg; @Data -public class CalculatedFieldProfileEntityMsg implements ToCalculatedFieldSystemMsg { +public class CalculatedFieldInitProfileEntityMsg implements ToCalculatedFieldSystemMsg { private final TenantId tenantId; private final EntityId profileEntityId; @@ -30,7 +30,7 @@ public class CalculatedFieldProfileEntityMsg implements ToCalculatedFieldSystemM @Override public MsgType getMsgType() { - return MsgType.CF_PROFILE_ENTITY_MSG; + return MsgType.CF_INIT_PROFILE_ENTITY_MSG; } } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java index 7c2d0b0240..32537edba5 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/discovery/event/PartitionChangeEvent.java @@ -18,7 +18,6 @@ package org.thingsboard.server.queue.discovery.event; import lombok.Getter; import lombok.ToString; import org.thingsboard.server.common.data.DataConstants; -import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.queue.discovery.QueueKey; diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index 87a9d6a697..0738f660df 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -517,6 +517,9 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi @Override public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi) { String queueName = DataConstants.CF_QUEUE_NAME; + if (tpi == null) { + throw new IllegalArgumentException("TopicPartitionInfo is required."); + } TenantId tenantId = tpi.getTenantId().orElse(TenantId.SYS_TENANT_ID); Integer partitionId = tpi.getPartition().orElseThrow(() -> new IllegalArgumentException("PartitionId is required.")); String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, partitionId); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java index fdf2b2f3f7..b4884ae72c 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbRuleEngineQueueFactory.java @@ -318,6 +318,9 @@ public class KafkaTbRuleEngineQueueFactory implements TbRuleEngineQueueFactory { @Override public TbQueueConsumer> createToCalculatedFieldMsgConsumer(TopicPartitionInfo tpi) { String queueName = DataConstants.CF_QUEUE_NAME; + if (tpi == null) { + throw new IllegalArgumentException("TopicPartitionInfo is required."); + } TenantId tenantId = tpi.getTenantId().orElse(TenantId.SYS_TENANT_ID); Integer partitionId = tpi.getPartition().orElseThrow(() -> new IllegalArgumentException("PartitionId is required.")); String groupId = topicService.buildConsumerGroupId("cf-", tenantId, queueName, partitionId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java b/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java index d3fea73849..0c5df18e80 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java @@ -182,12 +182,6 @@ public class BaseCalculatedFieldService extends AbstractEntityService implements return calculatedFieldLinkDao.findCalculatedFieldLinksByEntityId(tenantId, entityId); } - @Override - public List findAllCalculatedFieldLinksByTenantId(TenantId tenantId) { - log.trace("Executing findAllCalculatedFieldLinksByTenantId, tenantId [{}]", tenantId); - return calculatedFieldLinkDao.findCalculatedFieldLinksByTenantId(tenantId); - } - @Override public PageData findAllCalculatedFieldLinksByTenantId(TenantId tenantId, PageLink pageLink) { log.trace("Executing findAllCalculatedFieldLinksByTenantId, tenantId[{}] pageLink [{}]", tenantId, pageLink); From 6e7ea4a35280004a573debb7d8890df867a19691 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 11 Apr 2025 12:41:02 +0300 Subject: [PATCH 255/286] UI: Remove echart from module map --- ui-ngx/src/app/modules/common/modules-map.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui-ngx/src/app/modules/common/modules-map.ts b/ui-ngx/src/app/modules/common/modules-map.ts index 530a41f006..70432e8cdf 100644 --- a/ui-ngx/src/app/modules/common/modules-map.ts +++ b/ui-ngx/src/app/modules/common/modules-map.ts @@ -76,8 +76,6 @@ import * as TranslateCore from '@ngx-translate/core'; import * as MatDateTimePicker from '@mat-datetimepicker/core'; import _moment from 'moment'; import * as tslib from 'tslib'; -import * as Echarts from 'echarts'; -import * as EchartsCore from 'echarts/core'; import * as TbCore from '@core/public-api'; import * as TbShared from '@shared/public-api'; @@ -407,8 +405,6 @@ class ModulesMap implements IModulesMap { '@mat-datetimepicker/core': MatDateTimePicker, moment: _moment, tslib, - 'echarts': Echarts, - 'echarts/core': EchartsCore, '@core/public-api': TbCore, '@shared/public-api': TbShared, From cc5d9dbb2c53f997554307cce45fcd7e36ae848e Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Fri, 11 Apr 2025 12:44:09 +0300 Subject: [PATCH 256/286] Added sync of fat edge consumer group into per edge group. Fixed clean up edge topics --- .../edge/rpc/KafkaEdgeGrpcSession.java | 1 + .../ttl/KafkaEdgeTopicsCleanUpService.java | 13 ++++--- .../server/queue/TbEdgeQueueAdmin.java | 22 ++++++++++++ .../server/queue/kafka/TbKafkaAdmin.java | 36 +++++++++++++++---- .../provider/KafkaMonolithQueueFactory.java | 6 +++- .../provider/KafkaTbCoreQueueFactory.java | 6 +++- 6 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 common/cluster-api/src/main/java/org/thingsboard/server/queue/TbEdgeQueueAdmin.java diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java index 076e8eb8f6..37687f14a9 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/KafkaEdgeGrpcSession.java @@ -141,6 +141,7 @@ public class KafkaEdgeGrpcSession extends EdgeGrpcSession { String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edge.getId()).getTopic(); TbKafkaAdmin kafkaAdmin = new TbKafkaAdmin(kafkaSettings, kafkaTopicConfigs.getEdgeEventConfigs()); kafkaAdmin.deleteTopic(topic); + kafkaAdmin.deleteConsumerGroup(topic); } } diff --git a/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java b/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java index 73712542fd..6d06c85585 100644 --- a/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java +++ b/application/src/main/java/org/thingsboard/server/service/ttl/KafkaEdgeTopicsCleanUpService.java @@ -113,7 +113,7 @@ public class KafkaEdgeTopicsCleanUpService extends AbstractCleanUpService { .ifPresentOrElse(lastConnectTime -> { String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic(); if (kafkaAdmin.isTopicEmpty(topic)) { - kafkaAdmin.deleteTopic(topic); + deleteTopicAndConsumerGroup(topic); log.info("[{}] Removed outdated topic {} for edge {} older than {}", tenantId, topic, edgeId, Date.from(Instant.ofEpochMilli(currentTimeMillis - ttlMillis))); } @@ -121,7 +121,7 @@ public class KafkaEdgeTopicsCleanUpService extends AbstractCleanUpService { Edge edge = edgeService.findEdgeById(tenantId, edgeId); if (edge == null) { String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic(); - kafkaAdmin.deleteTopic(topic); + deleteTopicAndConsumerGroup(topic); log.info("[{}] Removed topic {} for deleted edge {}", tenantId, topic, edgeId); } }); @@ -132,12 +132,17 @@ public class KafkaEdgeTopicsCleanUpService extends AbstractCleanUpService { } else { for (EdgeId edgeId : edgeIds) { String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic(); - kafkaAdmin.deleteTopic(topic); + deleteTopicAndConsumerGroup(topic); } log.info("[{}] Removed topics for not existing tenant and edges {}", tenantId, edgeIds); } } + private void deleteTopicAndConsumerGroup(String topic) { + kafkaAdmin.deleteTopic(topic); + kafkaAdmin.deleteConsumerGroup(topic); + } + private boolean isTopicExpired(long lastConnectTime, long ttlMillis, long currentTimeMillis) { return lastConnectTime + ttlMillis < currentTimeMillis; } @@ -146,7 +151,7 @@ public class KafkaEdgeTopicsCleanUpService extends AbstractCleanUpService { Map> tenantEdgeMap = new HashMap<>(); for (String topic : topics) { try { - String remaining = topic.substring(prefix.length()); + String remaining = topic.substring(prefix.length() + 1); String[] parts = remaining.split("\\."); TenantId tenantId = TenantId.fromUUID(UUID.fromString(parts[0])); EdgeId edgeId = new EdgeId(UUID.fromString(parts[1])); diff --git a/common/cluster-api/src/main/java/org/thingsboard/server/queue/TbEdgeQueueAdmin.java b/common/cluster-api/src/main/java/org/thingsboard/server/queue/TbEdgeQueueAdmin.java new file mode 100644 index 0000000000..9be50bb145 --- /dev/null +++ b/common/cluster-api/src/main/java/org/thingsboard/server/queue/TbEdgeQueueAdmin.java @@ -0,0 +1,22 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.queue; + +public interface TbEdgeQueueAdmin extends TbQueueAdmin { + void syncEdgeNotificationsOffsets(String fatGroupId, String newGroupId); + + void deleteConsumerGroup(String consumerGroupId); +} diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java index 37f881b49c..1e0064a5c8 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/kafka/TbKafkaAdmin.java @@ -26,6 +26,7 @@ import org.apache.kafka.clients.admin.TopicDescription; import org.apache.kafka.clients.consumer.OffsetAndMetadata; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.errors.TopicExistsException; +import org.thingsboard.server.queue.TbEdgeQueueAdmin; import org.thingsboard.server.queue.TbQueueAdmin; import org.thingsboard.server.queue.util.PropertyUtils; @@ -43,7 +44,7 @@ import java.util.stream.Collectors; * Created by ashvayka on 24.09.18. */ @Slf4j -public class TbKafkaAdmin implements TbQueueAdmin { +public class TbKafkaAdmin implements TbQueueAdmin, TbEdgeQueueAdmin { private final TbKafkaSettings settings; private final Map topicConfigs; @@ -149,17 +150,38 @@ public class TbKafkaAdmin implements TbQueueAdmin { * */ public void syncOffsets(String fatGroupId, String newGroupId, Integer partitionId) { try { - syncOffsetsUnsafe(fatGroupId, newGroupId, partitionId); + log.info("syncOffsets [{}][{}][{}]", fatGroupId, newGroupId, partitionId); + if (partitionId == null) { + return; + } + syncOffsetsUnsafe(fatGroupId, newGroupId, "." + partitionId); } catch (Exception e) { log.warn("Failed to syncOffsets from {} to {} partitionId {}", fatGroupId, newGroupId, partitionId, e); } } - void syncOffsetsUnsafe(String fatGroupId, String newGroupId, Integer partitionId) throws ExecutionException, InterruptedException, TimeoutException { - log.info("syncOffsets [{}][{}][{}]", fatGroupId, newGroupId, partitionId); - if (partitionId == null) { - return; + /** + * Sync edge notifications offsets from a fat group to a single group per edge + * */ + public void syncEdgeNotificationsOffsets(String fatGroupId, String newGroupId) { + try { + log.info("syncEdgeNotificationsOffsets [{}][{}]", fatGroupId, newGroupId); + syncOffsetsUnsafe(fatGroupId, newGroupId, newGroupId); + } catch (Exception e) { + log.warn("Failed to syncEdgeNotificationsOffsets from {} to {}", fatGroupId, newGroupId, e); + } + } + + @Override + public void deleteConsumerGroup(String consumerGroupId) { + try { + settings.getAdminClient().deleteConsumerGroups(Collections.singletonList(consumerGroupId)); + } catch (Exception e) { + log.warn("Failed to delete consumer group {}", consumerGroupId, e); } + } + + void syncOffsetsUnsafe(String fatGroupId, String newGroupId, String topicSuffix) throws ExecutionException, InterruptedException, TimeoutException { Map oldOffsets = getConsumerGroupOffsets(fatGroupId); if (oldOffsets.isEmpty()) { return; @@ -167,7 +189,7 @@ public class TbKafkaAdmin implements TbQueueAdmin { for (var consumerOffset : oldOffsets.entrySet()) { var tp = consumerOffset.getKey(); - if (!tp.topic().endsWith("." + partitionId)) { + if (!tp.topic().endsWith(topicSuffix)) { continue; } var om = consumerOffset.getValue(); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java index 508cdff2a9..b47fcf5e6c 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaMonolithQueueFactory.java @@ -44,6 +44,7 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToUsageStatsServiceM import org.thingsboard.server.gen.transport.TransportProtos.ToVersionControlServiceMsg; import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.TransportApiResponseMsg; +import org.thingsboard.server.queue.TbEdgeQueueAdmin; import org.thingsboard.server.queue.TbQueueAdmin; import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.TbQueueProducer; @@ -101,7 +102,7 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi private final TbQueueAdmin vcAdmin; private final TbQueueAdmin housekeeperAdmin; private final TbQueueAdmin housekeeperReprocessingAdmin; - private final TbQueueAdmin edgeAdmin; + private final TbEdgeQueueAdmin edgeAdmin; private final TbQueueAdmin edgeEventAdmin; private final TbQueueAdmin cfAdmin; private final TbQueueAdmin cfStateAdmin; @@ -494,6 +495,9 @@ public class KafkaMonolithQueueFactory implements TbCoreQueueFactory, TbRuleEngi TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic(); + + edgeAdmin.syncEdgeNotificationsOffsets(topicService.buildTopicName("monolith-edge-event-consumer"), topic); + consumerBuilder.topic(topic); consumerBuilder.clientId("monolith-to-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + edgeConsumerCount.incrementAndGet()); consumerBuilder.groupId(topic); diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java index 14766ecbdb..ea7c56f0aa 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/provider/KafkaTbCoreQueueFactory.java @@ -42,6 +42,7 @@ import org.thingsboard.server.gen.transport.TransportProtos.ToUsageStatsServiceM import org.thingsboard.server.gen.transport.TransportProtos.ToVersionControlServiceMsg; import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.TransportApiResponseMsg; +import org.thingsboard.server.queue.TbEdgeQueueAdmin; import org.thingsboard.server.queue.TbQueueAdmin; import org.thingsboard.server.queue.TbQueueConsumer; import org.thingsboard.server.queue.TbQueueProducer; @@ -99,7 +100,7 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { private final TbQueueAdmin vcAdmin; private final TbQueueAdmin housekeeperAdmin; private final TbQueueAdmin housekeeperReprocessingAdmin; - private final TbQueueAdmin edgeAdmin; + private final TbEdgeQueueAdmin edgeAdmin; private final TbQueueAdmin edgeEventAdmin; private final TbQueueAdmin cfAdmin; private final TbQueueAdmin edqsEventsAdmin; @@ -440,6 +441,9 @@ public class KafkaTbCoreQueueFactory implements TbCoreQueueFactory { TbKafkaConsumerTemplate.TbKafkaConsumerTemplateBuilder> consumerBuilder = TbKafkaConsumerTemplate.builder(); consumerBuilder.settings(kafkaSettings); String topic = topicService.buildEdgeEventNotificationsTopicPartitionInfo(tenantId, edgeId).getTopic(); + + edgeAdmin.syncEdgeNotificationsOffsets(topicService.buildTopicName("tb-core-edge-event-consumer"), topic); + consumerBuilder.topic(topic); consumerBuilder.clientId("tb-core-edge-event-consumer-" + serviceInfoProvider.getServiceId() + "-" + edgeConsumerCount.incrementAndGet()); consumerBuilder.groupId(topic); From 870dc1b4c46bee7314ed224d6ee5bfb17fe6cf79 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 12:44:37 +0300 Subject: [PATCH 257/286] fixed sql query --- .../server/dao/sql/device/DefaultNativeAssetRepository.java | 2 +- .../server/dao/sql/device/DefaultNativeDeviceRepository.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java index 6c2a8dc506..ec47da3499 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeAssetRepository.java @@ -51,7 +51,7 @@ public class DefaultNativeAssetRepository extends AbstractNativeRepository imple @Override public PageData findProfileEntityIdInfosByTenantId(UUID tenantId, Pageable pageable) { - String PROFILE_ASSET_ID_INFO_QUERY = String.format("SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset WHERE tenant_id = %s ORDER BY created_time ASC LIMIT %%s OFFSET %%s", tenantId); + String PROFILE_ASSET_ID_INFO_QUERY = String.format("SELECT tenant_id as tenantId, asset_profile_id as profileId, id as id FROM asset WHERE tenant_id = '%s' ORDER BY created_time ASC LIMIT %%s OFFSET %%s", tenantId); return find(COUNT_QUERY, PROFILE_ASSET_ID_INFO_QUERY, pageable, row -> { AssetId id = new AssetId((UUID) row.get("id")); AssetProfileId profileId = new AssetProfileId((UUID) row.get("profileId")); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java index 1648bb2255..78ee2795b0 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/device/DefaultNativeDeviceRepository.java @@ -63,7 +63,7 @@ public class DefaultNativeDeviceRepository extends AbstractNativeRepository impl @Override public PageData findProfileEntityIdInfosByTenantId(UUID tenantId, Pageable pageable) { - String PROFILE_DEVICE_ID_INFO_QUERY = String.format("SELECT tenant_id as tenantId, device_profile_id as profileId, id as id FROM device WHERE tenant_id = %s ORDER BY created_time ASC LIMIT %%s OFFSET %%s", tenantId); + String PROFILE_DEVICE_ID_INFO_QUERY = String.format("SELECT tenant_id as tenantId, device_profile_id as profileId, id as id FROM device WHERE tenant_id = '%s' ORDER BY created_time ASC LIMIT %%s OFFSET %%s", tenantId); return find(COUNT_QUERY, PROFILE_DEVICE_ID_INFO_QUERY, pageable, row -> { DeviceId id = new DeviceId((UUID) row.get("id")); DeviceProfileId profileId = new DeviceProfileId((UUID) row.get("profileId")); From 4e9a5dbbbd98e1dfa4346303653129a4b11c61a9 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Fri, 11 Apr 2025 13:41:54 +0300 Subject: [PATCH 258/286] Module update --- .../js_modules/gateway-management-extension.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/application/src/main/data/resources/js_modules/gateway-management-extension.js b/application/src/main/data/resources/js_modules/gateway-management-extension.js index c94d71efba..183f475e63 100644 --- a/application/src/main/data/resources/js_modules/gateway-management-extension.js +++ b/application/src/main/data/resources/js_modules/gateway-management-extension.js @@ -1,7 +1,17 @@ -System.register(["@angular/core","@angular/material/sort","@angular/material/table","@angular/material/paginator","@shared/public-api","@angular/common","@angular/forms","rxjs","rxjs/operators","@core/public-api","@angular/material/dialog","tslib","@angular/material/tooltip","@ngx-translate/core","@angular/cdk/collections","@ngrx/store","@angular/router","echarts/core","@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,I,E,M,k,P,D,O,A,F,R,B,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,Ie,Ee,Me,ke,Pe,De,Oe,Ae,Fe,Re,Be,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;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.Direction,S=e.PageLink,C=e.DataKeyType,_=e.SharedModule,T=e,I=e.coerceBoolean,E=e.emptyPageData,M=e.isClientSideTelemetryType,k=e.TelemetrySubscriber,P=e.coerceNumber,D=e.AttributeScope,O=e.helpBaseUrl,A=e.DialogComponent,F=e.defaultLegendConfig,R=e.widgetType,B=e.NULL_UUID,N=e.DatasourceType,L=e.EntityType,V=e.ContentType,q=e.PageComponent,G=e.TbTableDatasource,z=e.HOUR,U=e.DeviceCredentialsType},function(e){j=e.CommonModule},function(e){H=e,W=e.NG_VALUE_ACCESSOR,$=e.Validators,K=e.NG_VALIDATORS,Y=e.FormBuilder,X=e.FormControl},function(e){Z=e.Observable,Q=e.ReplaySubject,J=e.shareReplay,ee=e.combineLatest,te=e.Subject,ne=e.fromEvent,ie=e.BehaviorSubject,ae=e.of,re=e.zip,oe=e.forkJoin,se=e.merge},function(e){le=e.takeUntil,pe=e.map,ce=e.distinctUntilChanged,de=e.debounceTime,ue=e.filter,me=e.tap,he=e.catchError,ge=e.publishReplay,fe=e.refCount,ye=e.take,ve=e.takeWhile,xe=e.switchMap,be=e.startWith,we=e.mergeMap},function(e){Se=e.isEqual,Ce=e.WINDOW,_e=e,Te=e.deleteNullProperties,Ie=e.DialogService,Ee=e.isNumber,Me=e.isString,ke=e.isDefinedAndNotNull,Pe=e.formatValue,De=e.isLiteralObject,Oe=e.deepClone,Ae=e.isUndefinedOrNull,Fe=e.isObject,Re=e.generateSecret,Be=e.camelCase,Ne=e.deepTrim},function(e){Le=e.MatDialog,Ve=e.MAT_DIALOG_DATA,qe=e},function(e){Ge=e.__decorate,ze=e.__extends},function(e){Ue=e,je=e.MatTooltip},function(e){He=e,We=e.TranslateService,$e=e.TranslateModule},function(e){Ke=e.SelectionModel},function(e){Ye=e},function(e){Xe=e},function(e){Ze=e},function(e){Qe=e.calculateAxisSize,Je=e.measureAxisNameSize},function(e){et=e},function(e){tt=e},function(e){nt=e.JsonObjectEditDialogComponent},function(e){it=e},function(e){at=e},function(e){rt=e},function(e){ot=e.coerceBoolean},function(e){st=e.ErrorStateMatcher}],execute:function(){e("getDefaultConfig",Wt);const lt=e("jsonRequired",(e=>e.value?null:{required:!0}));var pt,ct,dt;e("GatewayLogLevel",pt),function(e){e.NONE="NONE",e.CRITICAL="CRITICAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e.DEBUG="DEBUG",e.TRACE="TRACE"}(pt||e("GatewayLogLevel",pt={})),e("GatewayVersion",ct),function(e){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"}(ct||e("GatewayVersion",ct={})),e("ConnectorType",dt),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"}(dt||e("ConnectorType",dt={}));const ut=e("GatewayConnectorDefaultTypesTranslatesMap",new Map([[dt.MQTT,"MQTT"],[dt.MODBUS,"MODBUS"],[dt.GRPC,"GRPC"],[dt.OPCUA,"OPCUA"],[dt.BLE,"BLE"],[dt.REQUEST,"REQUEST"],[dt.CAN,"CAN"],[dt.BACNET,"BACNET"],[dt.ODBC,"ODBC"],[dt.REST,"REST"],[dt.SNMP,"SNMP"],[dt.FTP,"FTP"],[dt.SOCKET,"SOCKET"],[dt.XMPP,"XMPP"],[dt.OCPP,"OCPP"],[dt.CUSTOM,"CUSTOM"],[dt.KNX,"KNX"]])),mt=e("ConnectorsTypesByVersion",new Map([[ct.v3_7_0,Object.values(dt)],[ct.Legacy,Object.values(dt).filter((e=>e!==dt.KNX))]]));var ht,gt;e("SocketEncoding",ht),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"}(ht||e("SocketEncoding",ht={})),e("HTTPMethods",gt),function(e){e.DELETE="DELETE",e.GET="GET",e.HEAD="HEAD",e.OPTIONS="OPTIONS",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT"}(gt||e("HTTPMethods",gt={}));var ft={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","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","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",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:{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",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-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":"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"},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.","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",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 data transmission to the master. Acceptable values: true or false.","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."}}}},yt={"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 نشطة."}},vt={"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"},xt={"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"},bt={"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"},wt={"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."}},St={"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"},Ct={"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."}},_t={"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"},Tt={"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."}},It={"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"},Et={"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"},Mt={"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"},kt={"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 文件的文件夹中,使用以下命令在终端中启动网关"},Pt={"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"};var Dt={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"}]}]}},Ot={"3.5.2":{broker:{host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"anonymous"}},mapping:[{topicFilter:"sensor/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"message",deviceProfileExpression:"${sensorType}"},sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"string",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/data)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"},sendDataOnlyOnChange:!1,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"},sendDataOnlyOnChange:!1,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:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}},{topicFilter:"sensor/+/connect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"}},{topicFilter:"sensor/+/disconnect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)"}}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"},attributeNameExpressionSource:"message",attributeNameExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{type:"twoWay",deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTopicQoS:1,responseTimeout:1e4,valueExpression:"${params}"},{type:"oneWay",deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},legacy:{broker:{name:"Default Local Broker",host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"basic",username:"user",password:"password"}},mapping:[{topicFilter:"sensor/data",converter:{type:"json",deviceNameJsonExpression:"${serialNumber}",deviceTypeJsonExpression:"${sensorType}",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",converter:{type:"json",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/data)",deviceTypeTopicExpression:"Thermometer",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{topicFilter:"sensor/raw_data",converter:{type:"bytes",deviceNameExpression:"[0:4]",deviceTypeExpression:"default",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"raw",key:"rawData",value:"[:]"}],timeseries:[{type:"raw",key:"temp",value:"[4:]"}]}},{topicFilter:"custom/sensors/+",converter:{type:"custom",extension:"CustomMqttUplinkConverter",cached:!0,"extension-config":{temperatureBytes:2,humidityBytes:2,batteryLevelBytes:1}}}],connectRequests:[{topicFilter:"sensor/connect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/connect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/connect)"}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/disconnect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/disconnect)"}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceNameJsonExpression:"${serialNumber}",attributeNameJsonExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTimeout:1e4,valueExpression:"${params}"},{deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},At={"3.5.2":{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:3e4},attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"8int_read",type:"8int",functionCode:4,objectsCount:1,address:6},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"8int_read_multiplier",type:"8int",functionCode:4,objectsCount:1,address:10,multiplier:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"8uint_read",type:"8uint",functionCode:4,objectsCount:1,address:17,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"8int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]},coils_initializer:{attributes:[{address:5,type:"8int",tag:"coil",objectsCount:1,value:0}],timeseries:[],attributeUpdates:[],rpc:[]}}}},legacy:{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",sendDataOnlyOnChange:!0,connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:[{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]}],coils_initializer:[{attributes:[{address:5,type:"string",tag:"sm",objectsCount:1,value:"12"}],timeseries:[],attributeUpdates:[],rpc:[]}]}}}},Ft={"3.5.2":{server:{url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:36e5,pollPeriodInMillis:5e3,enableSubscriptions:!0,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"}},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNodeSource:"path",deviceInfo:{deviceNameExpression:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",deviceNameExpressionSource:"path",deviceProfileExpression:"Device",deviceProfileExpressionSource:"constant"},attributes:[{key:"temperature °C",type:"path",value:"${ns=2;i=5}"}],timeseries:[{key:"humidity",type:"path",value:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",type:"path",value:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[{type:"integer",value:2},{type:"integer",value:4}]}],attributes_updates:[{key:"deviceName",type:"path",value:"Root\\.Objects\\.Device1\\.serialNumber"}]}]},legacy:{server:{name:"OPC-UA Default Server",url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:5e3,disableSubscriptions:!1,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNamePattern:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",attributes:[{key:"temperature °C",path:"${ns=2;i=5}"}],timeseries:[{key:"humidity",path:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",path:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[2,4]}],attributes_updates:[{attributeOnThingsBoard:"deviceName",attributeOnDevice:"Root\\.Objects\\.Device1\\.serialNumber"}]}]}}},Rt={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"}]}]},Bt={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,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,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"}]}}],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",requestValueExpression:"${params}",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"}}]},Nt={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"}]}]},Lt={"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"}]}]}},Vt={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]}]}},qt={"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"}}]}},Gt={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}"}]},Ut={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 Ht=e("connectorConfigs",{[dt.MQTT]:Ot,[dt.MODBUS]:At,[dt.OPCUA]:Ft,[dt.BLE]:Rt,[dt.REQUEST]:Bt,[dt.CAN]:Nt,[dt.BACNET]:Lt,[dt.ODBC]:Vt,[dt.REST]:qt,[dt.SNMP]:Gt,[dt.FTP]:zt,[dt.SOCKET]:Dt,[dt.XMPP]:Ut,[dt.OCPP]:jt,[dt.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"}]}}});function Wt(e){const t=Ht[e];if(!t)throw new Error("No default config found");return t}var $t;e("ModbusDataType",$t),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"}($t||e("ModbusDataType",$t={}));const Kt=e("ModbusEditableDataTypes",[$t.BYTES,$t.BITS,$t.STRING]);var Yt,Xt;e("ModbusObjectCountByDataType",Yt),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"}(Yt||e("ModbusObjectCountByDataType",Yt={})),e("MappingValueType",Xt),function(e){e.STRING="string",e.INTEGER="integer",e.DOUBLE="double",e.BOOLEAN="boolean"}(Xt||e("MappingValueType",Xt={}));const Zt=e("mappingValueTypesMap",new Map([[Xt.STRING,{name:"value.string",icon:"mdi:format-text"}],[Xt.INTEGER,{name:"value.integer",icon:"mdi:numeric"}],[Xt.DOUBLE,{name:"value.double",icon:"mdi:numeric"}],[Xt.BOOLEAN,{name:"value.boolean",icon:"mdi:checkbox-marked-outline"}]])),Qt=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 Jt,en,tn;e("ConfigurationModes",Jt),function(e){e.BASIC="basic",e.ADVANCED="advanced"}(Jt||e("ConfigurationModes",Jt={})),e("ReportStrategyType",en),function(e){e.OnChange="ON_CHANGE",e.OnReportPeriod="ON_REPORT_PERIOD",e.OnChangeOrReportPeriod="ON_CHANGE_OR_REPORT_PERIOD",e.OnReceived="ON_RECEIVED"}(en||e("ReportStrategyType",en={})),e("ReportStrategyDefaultValue",tn),function(e){e[e.Gateway=6e4]="Gateway",e[e.Connector=6e4]="Connector",e[e.Device=3e4]="Device",e[e.Key=15e3]="Key"}(tn||e("ReportStrategyDefaultValue",tn={}));const nn=e("ReportStrategyTypeTranslationsMap",new Map([[en.OnChange,"gateway.report-strategy.on-change"],[en.OnReportPeriod,"gateway.report-strategy.on-report-period"],[en.OnChangeOrReportPeriod,"gateway.report-strategy.on-change-or-report-period"],[en.OnReceived,"gateway.report-strategy.on-received"]])),an=e("numberInputPattern",new RegExp(/^\d{1,15}(\.\d{1,15})?$/)),rn=e("noLeadTrailSpacesRegex",/^\S+(?: \S+)*$/),on=e("integerRegex",/^[-+]?\d+$/),sn=e("nonZeroFloat",/^-?(?!0(\.0+)?$)\d+(\.\d+)?$/);var ln;!function(e){e.EXCEPTION="EXCEPTION"}(ln||(ln={}));const pn={...pt,...ln},cn=()=>[10,20,30];function dn(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 un(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 mn(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 hn(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 gn(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 fn(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 yn(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 vn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",23)}function xn(e,n){1&e&&t.ɵɵelement(0,"mat-row",23)}class bn{constructor(){this.displayedColumns=["ts","status","message"],this.gatewayLogLinks=[{name:"General",key:"LOGS"},{name:"Service",key:"SERVICE_LOGS"},{name:"Connection",key:"CONNECTION_LOGS"},{name:"Storage",key:"STORAGE_LOGS"},{key:"EXTENSIONS_LOGS",name:"Extension"}];const e={property:"ts",direction:w.DESC};this.pageLink=new S(10,0,null,e),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:"Connector",filterFn:e=>!e.message.includes("_converter.py")},{key:`${e.key}_converter_LOGS`,name:"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 pn.DEBUG:return"status status-debug";case pn.WARNING:return"status status-warning";case pn.ERROR:case pn.EXCEPTION:return"status status-error";default:return"status status-info"}}statusClassMsg(e){if(e===pn.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:C.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||bn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bn,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:23,vars:21,consts:[["tabPanel",""],[1,"flex","h-full","flex-col"],["mat-tab-nav-bar","",3,"tabPanel"],["mat-tab-link","",3,"active","click",4,"ngFor","ngForOf"],[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.ɵɵtemplate(2,dn,2,2,"a",3),t.ɵɵelementEnd(),t.ɵɵelement(3,"mat-tab-nav-panel",null,0),t.ɵɵelementStart(5,"div",4)(6,"table",5),t.ɵɵelementContainerStart(7,6),t.ɵɵtemplate(8,un,3,3,"mat-header-cell",7)(9,mn,3,4,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(10,9),t.ɵɵtemplate(11,hn,3,3,"mat-header-cell",10)(12,gn,3,3,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,11),t.ɵɵtemplate(14,fn,3,3,"mat-header-cell",12)(15,yn,2,3,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(16,vn,1,0,"mat-header-row",14)(17,xn,1,0,"mat-row",15),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"span",16),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(21,"span",17),t.ɵɵelementEnd(),t.ɵɵelement(22,"mat-paginator",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵreference(4);t.ɵɵadvance(),t.ɵɵproperty("tabPanel",e),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.logLinks),t.ɵɵadvance(4),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(20,18,"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(20,cn))}},dependencies:t.ɵɵgetComponentDepsFactory(bn,[j,_]),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}']})}} +System.register(["@angular/core","@angular/material/sort","@angular/material/table","@angular/material/paginator","@shared/public-api","@angular/common","@angular/forms","rxjs","rxjs/operators","@core/public-api","@angular/material/dialog","tslib","@angular/material/tooltip","@ngx-translate/core","@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,I,E,M,k,P,D,O,A,F,R,B,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,Ie,Ee,Me,ke,Pe,De,Oe,Ae,Fe,Re,Be,Ne,Le,Ve,qe,Ge,ze,Ue,je,He,We,$e,Ke,Ye,Xe,Ze,Qe,Je,et,tt,nt,it,at,rt,ot;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.Direction,S=e.PageLink,C=e.DataKeyType,_=e.SharedModule,T=e,I=e.coerceBoolean,E=e.emptyPageData,M=e.isClientSideTelemetryType,k=e.TelemetrySubscriber,P=e.coerceNumber,D=e.AttributeScope,O=e.helpBaseUrl,A=e.DialogComponent,F=e.defaultLegendConfig,R=e.widgetType,B=e.NULL_UUID,N=e.DatasourceType,L=e.EntityType,V=e.ContentType,q=e.PageComponent,G=e.TbTableDatasource,z=e.HOUR,U=e.DeviceCredentialsType},function(e){j=e.CommonModule},function(e){H=e,W=e.NG_VALUE_ACCESSOR,$=e.Validators,K=e.NG_VALIDATORS,Y=e.FormBuilder,X=e.FormControl},function(e){Z=e.Observable,Q=e.ReplaySubject,J=e.shareReplay,ee=e.combineLatest,te=e.Subject,ne=e.fromEvent,ie=e.BehaviorSubject,ae=e.of,re=e.zip,oe=e.forkJoin,se=e.merge},function(e){le=e.takeUntil,pe=e.map,ce=e.distinctUntilChanged,de=e.debounceTime,ue=e.filter,me=e.tap,he=e.catchError,ge=e.publishReplay,fe=e.refCount,ye=e.take,ve=e.takeWhile,xe=e.switchMap,be=e.startWith,we=e.mergeMap},function(e){Se=e.isEqual,Ce=e.WINDOW,_e=e,Te=e.deleteNullProperties,Ie=e.DialogService,Ee=e.isNumber,Me=e.isString,ke=e.isDefinedAndNotNull,Pe=e.formatValue,De=e.isLiteralObject,Oe=e.deepClone,Ae=e.isUndefinedOrNull,Fe=e.isObject,Re=e.generateSecret,Be=e.camelCase,Ne=e.deepTrim},function(e){Le=e.MatDialog,Ve=e.MAT_DIALOG_DATA,qe=e},function(e){Ge=e.__decorate,ze=e.__extends},function(e){Ue=e,je=e.MatTooltip},function(e){He=e,We=e.TranslateService,$e=e.TranslateModule},function(e){Ke=e.SelectionModel},function(e){Ye=e},function(e){Xe=e},function(e){Ze=e.calculateAxisSize,Qe=e.measureAxisNameSize},function(e){Je=e},function(e){et=e},function(e){tt=e.JsonObjectEditDialogComponent},function(e){nt=e},function(e){it=e},function(e){at=e},function(e){rt=e.coerceBoolean},function(e){ot=e.ErrorStateMatcher}],execute:function(){e("getDefaultConfig",Ht);const st=e("jsonRequired",(e=>e.value?null:{required:!0}));var lt,pt,ct;e("GatewayLogLevel",lt),function(e){e.NONE="NONE",e.CRITICAL="CRITICAL",e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e.DEBUG="DEBUG",e.TRACE="TRACE"}(lt||e("GatewayLogLevel",lt={})),e("GatewayVersion",pt),function(e){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"}(pt||e("GatewayVersion",pt={})),e("ConnectorType",ct),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"}(ct||e("ConnectorType",ct={}));const dt=e("GatewayConnectorDefaultTypesTranslatesMap",new Map([[ct.MQTT,"MQTT"],[ct.MODBUS,"MODBUS"],[ct.GRPC,"GRPC"],[ct.OPCUA,"OPCUA"],[ct.BLE,"BLE"],[ct.REQUEST,"REQUEST"],[ct.CAN,"CAN"],[ct.BACNET,"BACNET"],[ct.ODBC,"ODBC"],[ct.REST,"REST"],[ct.SNMP,"SNMP"],[ct.FTP,"FTP"],[ct.SOCKET,"SOCKET"],[ct.XMPP,"XMPP"],[ct.OCPP,"OCPP"],[ct.CUSTOM,"CUSTOM"],[ct.KNX,"KNX"]])),ut=e("ConnectorsTypesByVersion",new Map([[pt.v3_7_0,Object.values(ct)],[pt.Legacy,Object.values(ct).filter((e=>e!==ct.KNX))]]));var mt,ht;e("SocketEncoding",mt),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"}(mt||e("SocketEncoding",mt={})),e("HTTPMethods",ht),function(e){e.DELETE="DELETE",e.GET="GET",e.HEAD="HEAD",e.OPTIONS="OPTIONS",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT"}(ht||e("HTTPMethods",ht={}));var gt={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","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","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",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:{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",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-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":"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"},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.","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",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 data transmission to the master. Acceptable values: true or false.","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."}}}},ft={"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 نشطة."}},yt={"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"},vt={"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"},xt={"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"},bt={"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."}},wt={"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"},St={"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."}},Ct={"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"},_t={"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."}},Tt={"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"},It={"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"},Et={"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"},Mt={"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 文件的文件夹中,使用以下命令在终端中启动网关"},kt={"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"};var Pt={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"}]}]}},Dt={"3.5.2":{broker:{host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"anonymous"}},mapping:[{topicFilter:"sensor/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"message",deviceProfileExpression:"${sensorType}"},sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"string",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",subscriptionQos:1,converter:{type:"json",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/data)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"},sendDataOnlyOnChange:!1,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"},sendDataOnlyOnChange:!1,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:"message",deviceNameExpression:"${serialNumber}",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}},{topicFilter:"sensor/+/connect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)",deviceProfileExpressionSource:"constant",deviceProfileExpression:"Thermometer"}}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"}},{topicFilter:"sensor/+/disconnect",deviceInfo:{deviceNameExpressionSource:"topic",deviceNameExpression:"(?<=sensor/)(.*?)(?=/connect)"}}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceInfo:{deviceNameExpressionSource:"message",deviceNameExpression:"${serialNumber}"},attributeNameExpressionSource:"message",attributeNameExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{type:"twoWay",deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTopicQoS:1,responseTimeout:1e4,valueExpression:"${params}"},{type:"oneWay",deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},legacy:{broker:{name:"Default Local Broker",host:"127.0.0.1",port:1883,clientId:"ThingsBoard_gateway",version:5,maxMessageNumberPerWorker:10,maxNumberOfWorkers:100,sendDataOnlyOnChange:!1,security:{type:"basic",username:"user",password:"password"}},mapping:[{topicFilter:"sensor/data",converter:{type:"json",deviceNameJsonExpression:"${serialNumber}",deviceTypeJsonExpression:"${sensorType}",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"},{type:"string",key:"${sensorModel}",value:"on"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"},{type:"string",key:"combine",value:"${hum}:${temp}"}]}},{topicFilter:"sensor/+/data",converter:{type:"json",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/data)",deviceTypeTopicExpression:"Thermometer",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"string",key:"model",value:"${sensorModel}"}],timeseries:[{type:"double",key:"temperature",value:"${temp}"},{type:"double",key:"humidity",value:"${hum}"}]}},{topicFilter:"sensor/raw_data",converter:{type:"bytes",deviceNameExpression:"[0:4]",deviceTypeExpression:"default",sendDataOnlyOnChange:!1,timeout:6e4,attributes:[{type:"raw",key:"rawData",value:"[:]"}],timeseries:[{type:"raw",key:"temp",value:"[4:]"}]}},{topicFilter:"custom/sensors/+",converter:{type:"custom",extension:"CustomMqttUplinkConverter",cached:!0,"extension-config":{temperatureBytes:2,humidityBytes:2,batteryLevelBytes:1}}}],connectRequests:[{topicFilter:"sensor/connect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/connect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/connect)"}],disconnectRequests:[{topicFilter:"sensor/disconnect",deviceNameJsonExpression:"${serialNumber}"},{topicFilter:"sensor/+/disconnect",deviceNameTopicExpression:"(?<=sensor/)(.*?)(?=/disconnect)"}],attributeRequests:[{retain:!1,topicFilter:"v1/devices/me/attributes/request",deviceNameJsonExpression:"${serialNumber}",attributeNameJsonExpression:"${versionAttribute}, ${pduAttribute}",topicExpression:"devices/${deviceName}/attrs",valueExpression:"${attributeKey}: ${attributeValue}"}],attributeUpdates:[{retain:!0,deviceNameFilter:".*",attributeFilter:"firmwareVersion",topicExpression:"sensor/${deviceName}/${attributeKey}",valueExpression:'{"${attributeKey}":"${attributeValue}"}'}],serverSideRpc:[{deviceNameFilter:".*",methodFilter:"echo",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",responseTopicExpression:"sensor/${deviceName}/response/${methodName}/${requestId}",responseTimeout:1e4,valueExpression:"${params}"},{deviceNameFilter:".*",methodFilter:"no-reply",requestTopicExpression:"sensor/${deviceName}/request/${methodName}/${requestId}",valueExpression:"${params}"}]}},Ot={"3.5.2":{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:3e4},attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"8int_read",type:"8int",functionCode:4,objectsCount:1,address:6},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"8int_read_multiplier",type:"8int",functionCode:4,objectsCount:1,address:10,multiplier:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"8uint_read",type:"8uint",functionCode:4,objectsCount:1,address:17,reportStrategy:{type:"ON_REPORT_PERIOD",reportPeriod:15e3}},{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"8int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]},coils_initializer:{attributes:[{address:5,type:"8int",tag:"coil",objectsCount:1,value:0}],timeseries:[],attributeUpdates:[],rpc:[]}}}},legacy:{master:{slaves:[{host:"127.0.0.1",port:5021,type:"tcp",method:"socket",timeout:35,byteOrder:"LITTLE",wordOrder:"LITTLE",retries:!0,retryOnEmpty:!0,retryOnInvalid:!0,pollPeriod:5e3,unitId:1,deviceName:"Temp Sensor",deviceType:"default",sendDataOnlyOnChange:!0,connectAttemptTimeMs:5e3,connectAttemptCount:5,waitAfterFailedAttemptsMs:3e5,attributes:[{tag:"string_read",type:"string",functionCode:4,objectsCount:4,address:1},{tag:"bits_read",type:"bits",functionCode:4,objectsCount:1,address:5},{tag:"16int_read",type:"16int",functionCode:4,objectsCount:1,address:7},{tag:"32int_read_divider",type:"32int",functionCode:4,objectsCount:2,address:8,divider:10},{tag:"32int_read",type:"32int",functionCode:4,objectsCount:2,address:11},{tag:"64int_read",type:"64int",functionCode:4,objectsCount:4,address:13}],timeseries:[{tag:"16uint_read",type:"16uint",functionCode:4,objectsCount:2,address:18},{tag:"32uint_read",type:"32uint",functionCode:4,objectsCount:4,address:20},{tag:"64uint_read",type:"64uint",functionCode:4,objectsCount:1,address:24},{tag:"16float_read",type:"16float",functionCode:4,objectsCount:1,address:25},{tag:"32float_read",type:"32float",functionCode:4,objectsCount:2,address:26},{tag:"64float_read",type:"64float",functionCode:4,objectsCount:4,address:28}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31},{tag:"getValue",type:"bits",functionCode:1,objectsCount:1,address:31},{tag:"setCPUFanSpeed",type:"32int",functionCode:16,objectsCount:2,address:33},{tag:"getCPULoad",type:"32int",functionCode:4,objectsCount:2,address:35}]}]},slave:{type:"tcp",host:"127.0.0.1",port:5026,method:"socket",deviceName:"Modbus Slave Example",deviceType:"default",pollPeriod:5e3,sendDataToThingsBoard:!1,byteOrder:"LITTLE",wordOrder:"LITTLE",unitId:0,values:{holding_registers:[{attributes:[{address:1,type:"string",tag:"sm",objectsCount:1,value:"ON"}],timeseries:[{address:2,type:"int",tag:"smm",objectsCount:1,value:"12334"}],attributeUpdates:[{tag:"shared_attribute_write",type:"32int",functionCode:6,objectsCount:2,address:29,value:1243}],rpc:[{tag:"setValue",type:"bits",functionCode:5,objectsCount:1,address:31,value:1}]}],coils_initializer:[{attributes:[{address:5,type:"string",tag:"sm",objectsCount:1,value:"12"}],timeseries:[],attributeUpdates:[],rpc:[]}]}}}},At={"3.5.2":{server:{url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:36e5,pollPeriodInMillis:5e3,enableSubscriptions:!0,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"}},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNodeSource:"path",deviceInfo:{deviceNameExpression:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",deviceNameExpressionSource:"path",deviceProfileExpression:"Device",deviceProfileExpressionSource:"constant"},attributes:[{key:"temperature °C",type:"path",value:"${ns=2;i=5}"}],timeseries:[{key:"humidity",type:"path",value:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",type:"path",value:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[{type:"integer",value:2},{type:"integer",value:4}]}],attributes_updates:[{key:"deviceName",type:"path",value:"Root\\.Objects\\.Device1\\.serialNumber"}]}]},legacy:{server:{name:"OPC-UA Default Server",url:"localhost:4840/freeopcua/server/",timeoutInMillis:5e3,scanPeriodInMillis:5e3,disableSubscriptions:!1,subCheckPeriodInMillis:100,showMap:!1,security:"Basic128Rsa15",identity:{type:"anonymous"},mapping:[{deviceNodePattern:"Root\\.Objects\\.Device1",deviceNamePattern:"Device ${Root\\.Objects\\.Device1\\.serialNumber}",attributes:[{key:"temperature °C",path:"${ns=2;i=5}"}],timeseries:[{key:"humidity",path:"${Root\\.Objects\\.Device1\\.TemperatureAndHumiditySensor\\.Humidity}"},{key:"batteryLevel",path:"${Battery\\.batteryLevel}"}],rpc_methods:[{method:"multiply",arguments:[2,4]}],attributes_updates:[{attributeOnThingsBoard:"deviceName",attributeOnDevice:"Root\\.Objects\\.Device1\\.serialNumber"}]}]}}},Ft={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"}]}]},Rt={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,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,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"}]}}],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",requestValueExpression:"${params}",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"}}]},Bt={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"}]}]},Nt={"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"}]}]}},Lt={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]}]}},Vt={"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"}]}]},Gt={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}"}]},zt={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}"}]}]},Ut={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 jt=e("connectorConfigs",{[ct.MQTT]:Dt,[ct.MODBUS]:Ot,[ct.OPCUA]:At,[ct.BLE]:Ft,[ct.REQUEST]:Rt,[ct.CAN]:Bt,[ct.BACNET]:Nt,[ct.ODBC]:Lt,[ct.REST]:Vt,[ct.SNMP]:qt,[ct.FTP]:Gt,[ct.SOCKET]:Pt,[ct.XMPP]:zt,[ct.OCPP]:Ut,[ct.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"}]}}});function Ht(e){const t=jt[e];if(!t)throw new Error("No default config found");return t}var Wt;e("ModbusDataType",Wt),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"}(Wt||e("ModbusDataType",Wt={}));const $t=e("ModbusEditableDataTypes",[Wt.BYTES,Wt.BITS,Wt.STRING]);var Kt,Yt;e("ModbusObjectCountByDataType",Kt),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"}(Kt||e("ModbusObjectCountByDataType",Kt={})),e("MappingValueType",Yt),function(e){e.STRING="string",e.INTEGER="integer",e.DOUBLE="double",e.BOOLEAN="boolean"}(Yt||e("MappingValueType",Yt={}));const Xt=e("mappingValueTypesMap",new Map([[Yt.STRING,{name:"value.string",icon:"mdi:format-text"}],[Yt.INTEGER,{name:"value.integer",icon:"mdi:numeric"}],[Yt.DOUBLE,{name:"value.double",icon:"mdi:numeric"}],[Yt.BOOLEAN,{name:"value.boolean",icon:"mdi:checkbox-marked-outline"}]])),Zt=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 Qt,Jt,en;e("ConfigurationModes",Qt),function(e){e.BASIC="basic",e.ADVANCED="advanced"}(Qt||e("ConfigurationModes",Qt={})),e("ReportStrategyType",Jt),function(e){e.OnChange="ON_CHANGE",e.OnReportPeriod="ON_REPORT_PERIOD",e.OnChangeOrReportPeriod="ON_CHANGE_OR_REPORT_PERIOD",e.OnReceived="ON_RECEIVED"}(Jt||e("ReportStrategyType",Jt={})),e("ReportStrategyDefaultValue",en),function(e){e[e.Gateway=6e4]="Gateway",e[e.Connector=6e4]="Connector",e[e.Device=3e4]="Device",e[e.Key=15e3]="Key"}(en||e("ReportStrategyDefaultValue",en={}));const tn=e("ReportStrategyTypeTranslationsMap",new Map([[Jt.OnChange,"gateway.report-strategy.on-change"],[Jt.OnReportPeriod,"gateway.report-strategy.on-report-period"],[Jt.OnChangeOrReportPeriod,"gateway.report-strategy.on-change-or-report-period"],[Jt.OnReceived,"gateway.report-strategy.on-received"]])),nn=e("numberInputPattern",new RegExp(/^\d{1,15}(\.\d{1,15})?$/)),an=e("noLeadTrailSpacesRegex",/^\S+(?: \S+)*$/),rn=e("integerRegex",/^[-+]?\d+$/),on=e("nonZeroFloat",/^-?(?!0(\.0+)?$)\d+(\.\d+)?$/);var sn;!function(e){e.EXCEPTION="EXCEPTION"}(sn||(sn={}));const ln={...lt,...sn},pn=()=>[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 dn(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 un(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 mn(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 hn(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 gn(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 fn(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 yn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",23)}function vn(e,n){1&e&&t.ɵɵelement(0,"mat-row",23)}class xn{constructor(){this.displayedColumns=["ts","status","message"],this.gatewayLogLinks=[{name:"General",key:"LOGS"},{name:"Service",key:"SERVICE_LOGS"},{name:"Connection",key:"CONNECTION_LOGS"},{name:"Storage",key:"STORAGE_LOGS"},{key:"EXTENSIONS_LOGS",name:"Extension"}];const e={property:"ts",direction:w.DESC};this.pageLink=new S(10,0,null,e),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:"Connector",filterFn:e=>!e.message.includes("_converter.py")},{key:`${e.key}_converter_LOGS`,name:"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 ln.DEBUG:return"status status-debug";case ln.WARNING:return"status status-warning";case ln.ERROR:case ln.EXCEPTION:return"status status-error";default:return"status status-info"}}statusClassMsg(e){if(e===ln.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:C.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||xn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:xn,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:23,vars:21,consts:[["tabPanel",""],[1,"flex","h-full","flex-col"],["mat-tab-nav-bar","",3,"tabPanel"],["mat-tab-link","",3,"active","click",4,"ngFor","ngForOf"],[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.ɵɵtemplate(2,cn,2,2,"a",3),t.ɵɵelementEnd(),t.ɵɵelement(3,"mat-tab-nav-panel",null,0),t.ɵɵelementStart(5,"div",4)(6,"table",5),t.ɵɵelementContainerStart(7,6),t.ɵɵtemplate(8,dn,3,3,"mat-header-cell",7)(9,un,3,4,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(10,9),t.ɵɵtemplate(11,mn,3,3,"mat-header-cell",10)(12,hn,3,3,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,11),t.ɵɵtemplate(14,gn,3,3,"mat-header-cell",12)(15,fn,2,3,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(16,yn,1,0,"mat-header-row",14)(17,vn,1,0,"mat-row",15),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"span",16),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(21,"span",17),t.ɵɵelementEnd(),t.ɵɵelement(22,"mat-paginator",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵreference(4);t.ɵɵadvance(),t.ɵɵproperty("tabPanel",e),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.logLinks),t.ɵɵadvance(4),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(20,18,"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(20,pn))}},dependencies:t.ɵɵgetComponentDepsFactory(xn,[j,_]),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 wn(e){e||(n(wn),e=i(a));const t=new Z((t=>e.onDestroy(t.next.bind(t))));return e=>e.pipe(le(t))}e("GatewayLogsComponent",bn);function Sn(e,t){!t?.injector&&n(Sn);const l=t?.injector??i(r),p=new Q(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 Cn=["commandInput"],_n=(e,t)=>t.attributeOnGateway,Tn=e=>({command:e});function In(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 En(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 Mn(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 kn(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,Tn,e.truncate.transform(t.ɵɵpipeBind1(1,1,e.searchText$),!0,6,"...")))," ")}}function Pn(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 Dn(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,kn,3,8),t.ɵɵpipe(4,"async"),t.ɵɵtemplate(5,Pn,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 On{constructor(e,t){this.truncate=e,this.fb=t,this.commands=l(),this.onCreateNewClicked=p(),this.selectStatisticsCommandControl=this.fb.control({}),this.searchText$=this.selectStatisticsCommandControl.valueChanges.pipe(pe((e=>e?"string"==typeof e?e:e?.attributeOnGateway:"")),ce(),J(1)),this.filteredCommands$=ee([this.searchText$,Sn(this.commands)]).pipe(de(150),pe((([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:!Se(n,i)}),t.filter((t=>t.attributeOnGateway.toLowerCase().includes(e?.toLowerCase()??"")))})),J(1)),this.onChanges=e=>{},this.selectStatisticsCommandControl.valueChanges.pipe(wn()).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||On)(t.ɵɵdirectiveInject(T.TruncatePipe),t.ɵɵdirectiveInject(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:On,selectors:[["tb-statistics-commands-autocomplete"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Cn,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:W,useExisting:c((()=>On)),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,In,4,3,"button",5)(7,En,4,3,"button",6),t.ɵɵelementStart(8,"mat-autocomplete",7,1),t.ɵɵrepeaterCreate(10,Mn,4,7,"mat-option",8,_n,!1,Dn,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(On,[j,_]),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 An=()=>["createdTime","message"];function Fn(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 Rn(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 Bn(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 Nn(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 Ln(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",17)}function Vn(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:w.DESC},this.pageLink=new S(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,Fn,3,3,"mat-header-cell",4)(5,Rn,3,4,"mat-cell",5),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(6,6),t.ɵɵtemplate(7,Bn,3,3,"mat-header-cell",7)(8,Nn,5,5,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(9,Ln,1,0,"mat-header-row",9)(10,Vn,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,An))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(12,An)),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,[j,_]),styles:['@charset "UTF-8";[_nghost-%COMP%] .copy-content .mat-icon{padding:4px;font-size:18px}']})}}class Gn{constructor(e,t,n){this.elementRef=e,this.renderer=t,this.tooltip=n,this.tooltipEnabled=!0,this.position="above",this.destroy$=new te}ngOnInit(){this.observeMouseEvents(),this.applyTruncationStyles()}ngAfterViewInit(){this.tooltip.position=this.position}ngOnDestroy(){this.tooltip._isTooltipVisible()&&this.hideTooltip(),this.destroy$.next(),this.destroy$.complete()}observeMouseEvents(){ne(this.elementRef.nativeElement,"mouseenter").pipe(ue((()=>this.tooltipEnabled)),ue((()=>this.isOverflown(this.elementRef.nativeElement))),me((()=>this.showTooltip())),le(this.destroy$)).subscribe(),ne(this.elementRef.nativeElement,"mouseleave").pipe(ue((()=>this.tooltipEnabled)),ue((()=>this.tooltip._isTooltipVisible())),me((()=>this.hideTooltip())),le(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 te,this.renderer.setStyle(this.el.nativeElement,"max-height","48px"),this.renderer.setStyle(this.el.nativeElement,"overflow","auto"),ne(i,"resize").pipe(le(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&&sae(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(pe((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=k.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),fe())}return this.allAttributes}isAllSelected(){const e=this.selection.selected.length;return this.attributesSubject.pipe(pe((t=>e===t.length)))}isEmpty(){return this.attributesSubject.pipe(pe((e=>!e.length)))}total(){return this.pageDataSubject.pipe(pe((e=>e.totalElements)))}masterToggle(){this.attributesSubject.pipe(me((e=>{this.selection.selected.length===e.length?this.selection.clear():e.forEach((e=>{this.selection.select(e)}))})),ye(1)).subscribe()}}e("AttributeDatasource",Un);const jn=()=>({maxWidth:"970px"});function Hn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",4)(1,"mat-expansion-panel-header",5)(2,"mat-panel-title")(3,"mat-slide-toggle",6),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,7),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(5);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 Wn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8),t.ɵɵtext(1,"gateway.report-strategy.label"),t.ɵɵelementEnd(),t.ɵɵelementContainer(2,7)),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(5);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e)}}function $n(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",16),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 Kn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),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 Yn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",17),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",18),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,Kn,3,3,"mat-icon",19),t.ɵɵelementStart(8,"span",20),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 Xn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"div",11),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",12)(6,"mat-select",13),t.ɵɵtemplate(7,$n,3,4,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,Yn,10,7,"div",15)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.type")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/report-strategy_fn")("tb-help-popup-style",t.ɵɵpureFunction0(7,jn)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.reportStrategyTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnChange&&e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnReceived)}}class Zn{constructor(e){this.fb=e,this.isExpansionMode=!1,this.defaultValue=tn.Key,this.reportStrategyTypes=Object.values(en),this.ReportTypeTranslateMap=nn,this.ReportStrategyType=en,this.destroy$=new te,this.showStrategyControl=this.fb.control(!1),this.reportStrategyFormGroup=this.fb.group({type:[{value:en.OnReportPeriod,disabled:!0},[]],reportPeriod:[{value:this.defaultValue,disabled:!0},[$.required,$.min(100)]]}),this.observeStrategyFormChange(),this.observeStrategyToggle()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){this.isExpansionMode&&this.showStrategyControl.setValue(!!e,{emitEvent:!1}),e&&this.reportStrategyFormGroup.enable({emitEvent:!1});const{type:t=en.OnReportPeriod,reportPeriod:n=this.defaultValue}=e??{};this.reportStrategyFormGroup.setValue({type:t,reportPeriod:n},{emitEvent:!1}),this.onTypeChange(t)}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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()})),this.reportStrategyFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.onTypeChange(e)))}observeStrategyToggle(){this.showStrategyControl.valueChanges.pipe(le(this.destroy$),ue((()=>this.isExpansionMode))).subscribe((e=>{e?(this.reportStrategyFormGroup.enable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").addValidators($.required),this.onChange(this.reportStrategyFormGroup.value)):(this.reportStrategyFormGroup.disable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").removeValidators($.required),this.onChange(null)),this.reportStrategyFormGroup.updateValueAndValidity({emitEvent:!1})}))}onTypeChange(e){const t=this.reportStrategyFormGroup.get("reportPeriod");e===en.OnChange||e===en.OnReceived?t.disable({emitEvent:!1}):this.isExpansionMode&&!this.showStrategyControl.value||t.enable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||Zn)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Zn,selectors:[["tb-report-strategy"]],inputs:{isExpansionMode:"isExpansionMode",defaultValue:"defaultValue"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>Zn)),multi:!0},{provide:K,useExisting:c((()=>Zn)),multi:!0}]),t.ɵɵStandaloneFeature],decls:6,vars:3,consts:[["defaultMode",""],["strategyFields",""],[3,"formGroup"],["class","tb-settings",3,"expanded",4,"ngIf","ngIfElse"],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],[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){if(1&e&&(t.ɵɵelementContainerStart(0,2),t.ɵɵtemplate(1,Hn,8,6,"mat-expansion-panel",3)(2,Wn,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(4,Xn,9,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(3);t.ɵɵproperty("formGroup",n.reportStrategyFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isExpansionMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(Zn,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}e("ReportStrategyComponent",Zn),Ge([I()],Zn.prototype,"isExpansionMode",void 0),Ge([P()],Zn.prototype,"defaultValue",void 0);class Qn{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,D.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||Qn)(t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Qn,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(Qn,[j,_]),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",Qn);class Jn{constructor(){this.tooltipText=""}static{this.ɵfac=function(e){return new(e||Jn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Jn,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(Jn,[_,j]),styles:["[_nghost-%COMP%]{display:flex;width:40px;height:40px;padding:10px}mat-icon[_ngcontent-%COMP%]{font-size:20px}"]})}}var ei,ti;e("ErrorTooltipIconComponent",Jn),e("MqttConverterType",ei),function(e){e.JSON="json",e.BYTES="bytes",e.CUSTOM="custom"}(ei||e("MqttConverterType",ei={})),e("MQTTSourceType",ti),function(e){e.MSG="message",e.TOPIC="topic",e.CONST="constant"}(ti||e("MQTTSourceType",ti={}));const ni=e("MqttVersions",[{name:3.1,value:3},{name:3.11,value:4},{name:5,value:5}]),ii=e("QualityTypeTranslationsMap",new Map([[0,"gateway.qos.at-most-once"],[1,"gateway.qos.at-least-once"],[2,"gateway.qos.exactly-once"]])),ai=e("ConvertorTypeTranslationsMap",new Map([[ei.JSON,"gateway.JSON"],[ei.BYTES,"gateway.bytes"],[ei.CUSTOM,"gateway.custom"]]));var ri;e("RequestType",ri),function(e){e.CONNECT_REQUEST="connectRequests",e.DISCONNECT_REQUEST="disconnectRequests",e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(ri||e("RequestType",ri={}));const oi=e("RequestTypesTranslationsMap",new Map([[ri.CONNECT_REQUEST,"gateway.request.connect-request"],[ri.DISCONNECT_REQUEST,"gateway.request.disconnect-request"],[ri.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[ri.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[ri.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]])),si=e("DataConversionTranslationsMap",new Map([[ei.JSON,"gateway.JSON-hint"],[ei.BYTES,"gateway.bytes-hint"],[ei.CUSTOM,"gateway.custom-hint"]]));var li,pi;e("SocketType",li),function(e){e.TCP="TCP",e.UDP="UDP"}(li||e("SocketType",li={})),e("SocketValueKey",pi),function(e){e.TIMESERIES="telemetry",e.ATTRIBUTES="attributes",e.ATTRIBUTES_REQUESTS="attributeRequests",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_METHODS="serverSideRpc"}(pi||e("SocketValueKey",pi={}));const ci=e("SocketKeysPanelTitleTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.attributes"],[pi.TIMESERIES,"gateway.timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.attribute-requests"],[pi.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[pi.RPC_METHODS,"gateway.rpc-methods"]]));var di,ui;e("RequestsType",di),function(e){e.Shared="shared",e.Client="client"}(di||e("RequestsType",di={})),e("ExpressionType",ui),function(e){e.Constant="constant",e.Expression="expression"}(ui||e("ExpressionType",ui={}));const mi=e("SocketKeysAddKeyTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.add-attribute"],[pi.TIMESERIES,"gateway.add-timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.add-attribute-request"],[pi.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[pi.RPC_METHODS,"gateway.add-rpc-method"]])),hi=e("SocketKeysDeleteKeyTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.delete-attribute"],[pi.TIMESERIES,"gateway.delete-timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.delete-attribute-request"],[pi.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[pi.RPC_METHODS,"gateway.delete-rpc-method"]])),gi=e("SocketKeysNoKeysTextTranslationsMap",new Map([[pi.ATTRIBUTES,"gateway.no-attributes"],[pi.TIMESERIES,"gateway.no-timeseries"],[pi.ATTRIBUTES_REQUESTS,"gateway.no-attribute-requests"],[pi.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[pi.RPC_METHODS,"gateway.no-rpc-methods"]]));var fi,yi,vi,xi;e("RestConverterType",fi),function(e){e.JSON="json",e.CUSTOM="custom"}(fi||e("RestConverterType",fi={})),e("RestSourceType",yi),function(e){e.REQUEST="request",e.CONST="constant"}(yi||e("RestSourceType",yi={})),e("ResponseType",vi),function(e){e.DEFAULT="default",e.CONST="constant",e.ADVANCED="advanced"}(vi||e("ResponseType",vi={})),e("ResponseStatus",xi),function(e){e.OK="OK",e.ERROR="Error"}(xi||e("ResponseStatus",xi={}));const bi=e("ResponseTypeTranslationsMap",new Map([[vi.DEFAULT,"gateway.rest.response-type.default"],[vi.CONST,"gateway.rest.response-type.const"],[vi.ADVANCED,"gateway.rest.response-type.advanced"]]));var wi;e("RestRequestType",wi),function(e){e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(wi||e("RestRequestType",wi={}));const Si=e("RestRequestTypesTranslationsMap",new Map([[wi.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[wi.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[wi.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]]));var Ci;e("RestRequestsScopeType",Ci),function(e){e.Shared="shared",e.Client="client"}(Ci||e("RestRequestsScopeType",Ci={}));const _i=e("RestRequestTypeFieldsMap",new Map([[wi.ATTRIBUTE_REQUEST,["HTTPMethods","endpoint","type","deviceNameExpression","attributeNameExpression"]],[wi.ATTRIBUTE_UPDATE,["HTTPMethod","SSLVerify","deviceNameFilter","attributeFilter","requestUrlExpression","valueExpression","httpHeaders","tries","allowRedirects"]],[wi.SERVER_SIDE_RPC,["HTTPMethod","deviceNameFilter","methodFilter","requestUrlExpression","valueExpression","responseTimeout","httpHeaders","tries"]],["all",["requestType","timeout","security"]]])),Ti=e("RestConvertorTypeTranslationsMap",new Map([[fi.JSON,"gateway.JSON"],[fi.CUSTOM,"gateway.custom"]])),Ii=e("RestDataConversionTranslationsMap",new Map([[fi.JSON,"gateway.hints.rest.JSON"],[fi.CUSTOM,"gateway.custom-hint"]]));var Ei;e("PortLimits",Ei),function(e){e[e.MIN=1]="MIN",e[e.MAX=65535]="MAX"}(Ei||e("PortLimits",Ei={}));const Mi=e("GatewayConnectorConfigVersionMap",new Map([[dt.REST,ct.v3_7_2],[dt.KNX,ct.v3_7_0],[dt.BACNET,ct.v3_6_2],[dt.SOCKET,ct.v3_6_0],[dt.MQTT,ct.v3_5_2],[dt.OPCUA,ct.v3_5_2],[dt.MODBUS,ct.v3_5_2]]));var ki,Pi,Di,Oi;e("OPCUaSourceType",ki),function(e){e.PATH="path",e.IDENTIFIER="identifier",e.CONST="constant"}(ki||e("OPCUaSourceType",ki={})),e("SecurityType",Pi),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic",e.CERTIFICATES="certificates"}(Pi||e("SecurityType",Pi={})),e("ModeType",Di),function(e){e.NONE="None",e.SIGN="Sign",e.SIGNANDENCRYPT="SignAndEncrypt"}(Di||e("ModeType",Di={})),e("MappingType",Oi),function(e){e.DATA="data",e.REQUESTS="requests",e.OPCUA="OPCua"}(Oi||e("MappingType",Oi={}));const Ai=e("MappingTypeTranslationsMap",new Map([[Oi.DATA,"gateway.data-mapping"],[Oi.REQUESTS,"gateway.requests-mapping"],[Oi.OPCUA,"gateway.data-mapping"]]));var Fi;e("SecurityPolicy",Fi),function(e){e.BASIC128="Basic128Rsa15",e.BASIC256="Basic256",e.BASIC256SHA="Basic256Sha256"}(Fi||e("SecurityPolicy",Fi={}));const Ri=e("SecurityPolicyTypes",[{value:Fi.BASIC128,name:"Basic128RSA15"},{value:Fi.BASIC256,name:"Basic256"},{value:Fi.BASIC256SHA,name:"Basic256SHA256"}]),Bi=e("SecurityTypeTranslationsMap",new Map([[Pi.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Pi.BASIC,"gateway.broker.security-types.basic"],[Pi.CERTIFICATES,"gateway.broker.security-types.certificates"]])),Ni=e("SourceTypeTranslationsMap",new Map([[ti.MSG,"gateway.source-type.msg"],[ti.TOPIC,"gateway.source-type.topic"],[ti.CONST,"gateway.source-type.const"],[ki.PATH,"gateway.source-type.path"],[ki.IDENTIFIER,"gateway.source-type.identifier"],[ki.CONST,"gateway.source-type.const"],[ui.Expression,"gateway.source-type.expression"],[yi.REQUEST,"gateway.source-type.request"]]));var Li;e("MappingKeysType",Li),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.CUSTOM="extensionConfig",e.RPC_METHODS="rpc_methods",e.ATTRIBUTES_UPDATES="attributes_updates"}(Li||e("MappingKeysType",Li={}));const Vi=e("MappingKeysPanelTitleTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.attributes"],[Li.TIMESERIES,"gateway.timeseries"],[Li.CUSTOM,"gateway.keys"],[Li.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Li.RPC_METHODS,"gateway.rpc-methods"]])),qi=e("MappingKeysAddKeyTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.add-attribute"],[Li.TIMESERIES,"gateway.add-timeseries"],[Li.CUSTOM,"gateway.add-key"],[Li.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Li.RPC_METHODS,"gateway.add-rpc-method"]])),Gi=e("MappingKeysDeleteKeyTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.delete-attribute"],[Li.TIMESERIES,"gateway.delete-timeseries"],[Li.CUSTOM,"gateway.delete-key"],[Li.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Li.RPC_METHODS,"gateway.delete-rpc-method"]])),zi=e("MappingKeysNoKeysTextTranslationsMap",new Map([[Li.ATTRIBUTES,"gateway.no-attributes"],[Li.TIMESERIES,"gateway.no-timeseries"],[Li.CUSTOM,"gateway.no-keys"],[Li.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Li.RPC_METHODS,"gateway.no-rpc-methods"]])),Ui=e("QualityTypes",[0,1,2]);var ji;e("ServerSideRpcType",ji),function(e){e.WithResponse="twoWay",e.WithoutResponse="oneWay"}(ji||e("ServerSideRpcType",ji={}));const Hi=e("HelpLinkByMappingTypeMap",new Map([[Oi.DATA,O+"/docs/iot-gateway/config/mqtt/#section-mapping"],[Oi.OPCUA,O+"/docs/iot-gateway/config/opc-ua/#section-mapping"],[Oi.REQUESTS,O+"/docs/iot-gateway/config/mqtt/#requests-mapping"]])),Wi=e("MappingHintTranslationsMap",new Map([[Oi.DATA,"gateway.data-mapping-hint"],[Oi.OPCUA,"gateway.opcua-data-mapping-hint"],[Oi.REQUESTS,"gateway.requests-mapping-hint"]]));var $i,Ki,Yi,Xi,Zi,Qi,Ji,ea,ta;e("ServerSideRPCType",$i),function(e){e.ONE_WAY="oneWay",e.TWO_WAY="twoWay"}($i||e("ServerSideRPCType",$i={})),e("SecurityMode",Ki),function(e){e.basic="basic",e.certificates="certificates",e.extendedCertificates="extendedCertificates"}(Ki||e("SecurityMode",Ki={})),e("ModbusProtocolType",Yi),function(e){e.TCP="tcp",e.UDP="udp",e.Serial="serial"}(Yi||e("ModbusProtocolType",Yi={})),e("ModbusMethodType",Xi),function(e){e.SOCKET="socket",e.RTU="rtu"}(Xi||e("ModbusMethodType",Xi={})),e("ModbusSerialMethodType",Zi),function(e){e.RTU="rtu",e.ASCII="ascii"}(Zi||e("ModbusSerialMethodType",Zi={})),e("ModbusParity",Qi),function(e){e.Even="E",e.Odd="O",e.None="N"}(Qi||e("ModbusParity",Qi={})),e("ModbusOrderType",Ji),function(e){e.BIG="BIG",e.LITTLE="LITTLE"}(Ji||e("ModbusOrderType",Ji={})),e("ModbusRegisterType",ea),function(e){e.HoldingRegisters="holding_registers",e.CoilsInitializer="coils_initializer",e.InputRegisters="input_registers",e.DiscreteInputs="discrete_inputs"}(ea||e("ModbusRegisterType",ea={})),e("ModbusValueKey",ta),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_REQUESTS="rpc"}(ta||e("ModbusValueKey",ta={}));const na=e("ModbusBaudrates",[4800,9600,19200,38400,57600,115200,230400,460800,921600]),ia=e("ModbusByteSizes",[5,6,7,8]),aa=e("ModbusRegisterTranslationsMap",new Map([[ea.HoldingRegisters,"gateway.holding_registers"],[ea.CoilsInitializer,"gateway.coils_initializer"],[ea.InputRegisters,"gateway.input_registers"],[ea.DiscreteInputs,"gateway.discrete_inputs"]]));var ra;e("ModbusBitTargetType",ra),function(e){e.BooleanType="bool",e.IntegerType="int"}(ra||e("ModbusBitTargetType",ra={}));const oa=e("ModbusBitTargetTypeTranslationMap",new Map([[ra.BooleanType,"gateway.boolean"],[ra.IntegerType,"gateway.integer"]])),sa=e("ModbusMethodLabelsMap",new Map([[Xi.SOCKET,"Socket"],[Xi.RTU,"RTU"],[Zi.ASCII,"ASCII"]])),la=e("ModbusProtocolLabelsMap",new Map([[Yi.TCP,"TCP"],[Yi.UDP,"UDP"],[Yi.Serial,"Serial"]])),pa=e("ModbusParityLabelsMap",new Map([[Qi.Even,"Even"],[Qi.Odd,"Odd"],[Qi.None,"None"]])),ca=e("ModbusKeysPanelTitleTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.attributes"],[ta.TIMESERIES,"gateway.timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[ta.RPC_REQUESTS,"gateway.rpc-requests"]])),da=e("ModbusKeysAddKeyTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.add-attribute"],[ta.TIMESERIES,"gateway.add-timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[ta.RPC_REQUESTS,"gateway.add-rpc-request"]])),ua=e("ModbusKeysDeleteKeyTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.delete-attribute"],[ta.TIMESERIES,"gateway.delete-timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[ta.RPC_REQUESTS,"gateway.delete-rpc-request"]])),ma=e("ModbusKeysNoKeysTextTranslationsMap",new Map([[ta.ATTRIBUTES,"gateway.no-attributes"],[ta.TIMESERIES,"gateway.no-timeseries"],[ta.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[ta.RPC_REQUESTS,"gateway.no-rpc-requests"]]));var ha;e("ModifierType",ha),function(e){e.DIVIDER="divider",e.MULTIPLIER="multiplier"}(ha||e("ModifierType",ha={}));const ga=e("ModifierTypesMap",new Map([[ha.DIVIDER,{name:"gateway.divider",icon:"mdi:division"}],[ha.MULTIPLIER,{name:"gateway.multiplier",icon:"mdi:multiplication"}]]));var fa,ya;e("DeviceInfoType",fa),function(e){e.FULL="full",e.PARTIAL="partial"}(fa||e("DeviceInfoType",fa={})),e("SegmentationType",ya),function(e){e.BOTH="segmentedBoth",e.TRANSMIT="segmentedTransmit",e.RECEIVE="segmentedReceive",e.NO="noSegmentation"}(ya||e("SegmentationType",ya={}));const va=e("SegmentationTypeTranslationsMap",new Map([[ya.BOTH,"gateway.bacnet.segmentation.both"],[ya.TRANSMIT,"gateway.bacnet.segmentation.transmit"],[ya.RECEIVE,"gateway.bacnet.segmentation.receive"],[ya.NO,"gateway.bacnet.segmentation.no"]]));var xa;e("BacnetDeviceKeysType",xa),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.RPC_METHODS="serverSideRpc",e.ATTRIBUTES_UPDATES="attributeUpdates"}(xa||e("BacnetDeviceKeysType",xa={}));const ba=e("BacnetDeviceKeysPanelTitleTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.attributes"],[xa.TIMESERIES,"gateway.timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[xa.RPC_METHODS,"gateway.rpc-methods"]])),wa=e("BacnetDeviceKeysAddKeyTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.add-attribute"],[xa.TIMESERIES,"gateway.add-timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[xa.RPC_METHODS,"gateway.add-rpc-method"]])),Sa=e("BacnetDeviceKeysDeleteKeyTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.delete-attribute"],[xa.TIMESERIES,"gateway.delete-timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[xa.RPC_METHODS,"gateway.delete-rpc-method"]])),Ca=e("BacnetDeviceKeysNoKeysTextTranslationsMap",new Map([[xa.ATTRIBUTES,"gateway.no-attributes"],[xa.TIMESERIES,"gateway.no-timeseries"],[xa.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[xa.RPC_METHODS,"gateway.no-rpc-methods"]]));var _a;e("BacnetKeyObjectType",_a),function(e){e.analogInput="analogInput",e.analogOutput="analogOutput",e.analogValue="analogValue",e.binaryInput="binaryInput",e.binaryOutput="binaryOutput",e.binaryValue="binaryValue"}(_a||e("BacnetKeyObjectType",_a={}));const Ta=e("BacnetKeyObjectTypeTranslationsMap",new Map([[_a.analogInput,"gateway.bacnet.object-type.analog-input"],[_a.analogOutput,"gateway.bacnet.object-type.analog-output"],[_a.analogValue,"gateway.bacnet.object-type.analog-value"],[_a.binaryInput,"gateway.bacnet.object-type.binary-input"],[_a.binaryOutput,"gateway.bacnet.object-type.binary-output"],[_a.binaryValue,"gateway.bacnet.object-type.binary-value"]]));var Ia;e("BacnetPropertyId",Ia),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"}(Ia||e("BacnetPropertyId",Ia={}));const Ea=e("BacnetPropertyIdByObjectType",new Map([[_a.analogInput,[Ia.presentValue,Ia.statusFlags,Ia.covIncrement]],[_a.analogOutput,[Ia.presentValue,Ia.statusFlags,Ia.covIncrement]],[_a.analogValue,[Ia.presentValue,Ia.statusFlags,Ia.covIncrement]],[_a.binaryInput,[Ia.presentValue,Ia.statusFlags,Ia.eventState,Ia.outOfService,Ia.polarity]],[_a.binaryOutput,[Ia.presentValue,Ia.statusFlags,Ia.eventState,Ia.outOfService,Ia.polarity,Ia.priorityArray,Ia.relinquishDefault,Ia.currentCommandPriority,Ia.eventMessageTexts,Ia.eventMessageTextsConfig,Ia.eventAlgorithmInhibitReference,Ia.timeDelayNormal]],[_a.binaryValue,[Ia.presentValue,Ia.statusFlags,Ia.eventState,Ia.outOfService]]])),Ma=e("BacnetPropertyIdTranslationsMap",new Map([[Ia.presentValue,"gateway.bacnet.property-id.present-value"],[Ia.statusFlags,"gateway.bacnet.property-id.status-flags"],[Ia.covIncrement,"gateway.bacnet.property-id.cov-increment"],[Ia.eventState,"gateway.bacnet.property-id.event-state"],[Ia.outOfService,"gateway.bacnet.property-id.out-of-service"],[Ia.polarity,"gateway.bacnet.property-id.polarity"],[Ia.priorityArray,"gateway.bacnet.property-id.priority-array"],[Ia.relinquishDefault,"gateway.bacnet.property-id.relinquish-default"],[Ia.currentCommandPriority,"gateway.bacnet.property-id.current-command-priority"],[Ia.eventMessageTexts,"gateway.bacnet.property-id.event-message-texts"],[Ia.eventMessageTextsConfig,"gateway.bacnet.property-id.event-message-texts-config"],[Ia.eventAlgorithmInhibitReference,"gateway.bacnet.property-id.event-algorithm-inhibit-reference"],[Ia.timeDelayNormal,"gateway.bacnet.property-id.time-delay-normal"]]));var ka;e("BacnetRequestType",ka),function(e){e.Write="writeProperty",e.Read="readProperty"}(ka||e("BacnetRequestType",ka={}));const Pa=e("BacnetRequestTypeTranslationsMap",new Map([[ka.Write,"gateway.bacnet.request-type.write"],[ka.Read,"gateway.bacnet.request-type.read"]]));class Da{static{this.mqttRequestTypeKeys=Object.values(ri)}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===ri.SERVER_SIDE_RPC&&delete e.type;const{attributeNameExpression:t,deviceInfo:i,...a}=e,r={...a,attributeNameJsonExpression:t||null,deviceNameJsonExpression:i?.deviceNameExpressionSource!==ti.TOPIC?i?.deviceNameExpression:null,deviceNameTopicExpression:i?.deviceNameExpressionSource===ti.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!==ei.BYTES?{...n,deviceNameJsonExpression:t?.deviceNameExpressionSource===ti.MSG?t.deviceNameExpression:null,deviceTypeJsonExpression:t?.deviceProfileExpressionSource===ti.MSG?t.deviceProfileExpression:null,deviceNameTopicExpression:t?.deviceNameExpressionSource!==ti.MSG?t?.deviceNameExpression:null,deviceTypeTopicExpression:t?.deviceProfileExpressionSource!==ti.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("${")?ti.MSG:e.includes("/")?ti.TOPIC:ti.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===ri.SERVER_SIDE_RPC?1:null,s=t===ri.SERVER_SIDE_RPC?e.responseTopicExpression?ji.WithResponse:ji.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",Da);class Oa{constructor(e,t){this.gatewayVersionIn=e,this.connector=t,this.gatewayVersion=Ua.parseVersion(this.gatewayVersionIn),this.configVersion=Ua.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=Ua.parseVersion(Mi.get(this.connector.type)),t=this.gatewayVersion>=e,n=!this.configVersion||this.configVersion=e&&e>this.gatewayVersion}}e("GatewayConnectorVersionProcessor",Oa);class Aa extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.mqttRequestTypeKeys=Object.values(ri)}getUpgradedVersion(){const{connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}=this.connector.configurationJson;let r={...this.connector.configurationJson,requestsMapping:Da.mapRequestsToUpgradedVersion({connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}),mapping:Da.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?Da.mapRequestsToDowngradedVersion(e):{},a=Da.mapMappingToDowngradedVersion(t);return{...this.connector,configurationJson:{...n,...i,mapping:a},configVersion:this.gatewayVersionIn}}cleanUpConfigJson(e){Se(e.requestsMapping,{})&&delete e.requestsMapping,Se(e.mapping,[])&&delete e.mapping}}e("MqttVersionProcessor",Aa);class Fa extends Oa{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",Fa);class Ra extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson.server;return{...this.connector,configurationJson:{server:e?Ha.mapServerToUpgradedVersion(e):{},mapping:e?.mapping?Ha.mapMappingToUpgradedVersion(e.mapping):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:{server:Ha.mapServerToDowngradedVersion(this.connector.configurationJson)},configVersion:this.gatewayVersionIn}}}e("OpcVersionProcessor",Ra);class Ba{constructor(){this.fb=i(Y),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(wn(this.destroyRef)).subscribe((e=>this.onChange(this.mapOnChangeValue(e))))}static{this.ɵfac=function(e){return new(e||Ba)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Ba})}}e("ControlValueAccessorBaseAbstract",Ba);class Na extends Ba{constructor(){super(...arguments),this.withReportStrategy=!0,this.initialized=new u,this.isLegacy=!1,this.fb=i(Y)}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(Na)))(n||Na)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:Na,inputs:{generalTabContent:"generalTabContent",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},outputs:{initialized:"initialized"},features:[t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature]})}}e("GatewayConnectorBasicConfigDirective",Na);class La extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{socket:e?Wa.mapSocketToUpgradedVersion(e):{},devices:e?.devices?Wa.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:Wa.mapSocketToDowngradedVersion(this.connector.configurationJson),configVersion:this.gatewayVersionIn}}}e("SocketVersionProcessor",La);class Va extends Oa{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?$a.mapApplicationToUpgradedVersion(e.general):{},devices:e?.devices?$a.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{general:e?.application?$a.mapApplicationToDowngradedVersion(e.application):{},devices:e?.devices?$a.mapDevicesToDowngradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}}e("BacnetVersionProcessor",Va);const qa=["searchInput"];class Ga{constructor(){this.withReportStrategy=!0,this.textSearchMode=!1,this.onChange=()=>{},this.translate=i(We),this.dialog=i(Le),this.dialogService=i(Ie),this.fb=i(Y),this.cd=i(h),this.destroyRef=i(a),this.textSearch=this.fb.control("",{nonNullable:!0}),this.entityFormArray=this.fb.array([]),this.entityFormArray.valueChanges.pipe(wn()).subscribe((e=>{this.updateTableData(e),this.onChange(e)})),this.dataSource=this.getDatasource()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),wn(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||Ga)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Ga,viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(qa,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",Ga);class za extends Oa{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.restRequestTypeKeys=Object.values(wi)}getUpgradedVersion(){const{attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}=this.connector.configurationJson;let r={server:Ua.cleanUpConfigBaseInfo(a),requestsMapping:{attributeRequests:e,attributeUpdates:t,serverSideRpc:n},mapping:Ka.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:Ka.mapMappingToDowngradedVersion(t)},configVersion:this.gatewayVersionIn}}}e("RestVersionProcessor",za);class Ua{static getConfig(e,t){switch(e.type){case dt.MQTT:return new Aa(t,e).getProcessedByVersion();case dt.OPCUA:return new Ra(t,e).getProcessedByVersion();case dt.MODBUS:return new Fa(t,e).getProcessedByVersion();case dt.SOCKET:return new La(t,e).getProcessedByVersion();case dt.BACNET:return new Va(t,e).getProcessedByVersion();case dt.REST:return new za(t,e).getProcessedByVersion();default:return e}}static parseVersion(e){if(Ee(e))return e;if(Me(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",Ua);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:en.OnChange}:{type:en.OnReportPeriod,reportPeriod:e.pollPeriod}}}))}}static mapMasterToDowngradedVersion(e){return{slaves:e.slaves.map((e=>{const{reportStrategy:t,...n}=e;return{...n,sendDataOnlyOnChange:t?.type!==en.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?$t.INT16:e.type})))}),{})}}e("ModbusVersionMappingUtil",ja);class Ha{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 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("${")?ki.IDENTIFIER:e.includes("/")||e.includes("\\")?ki.PATH:ki.CONST}static getDeviceNodeSourceByValue(e){return e.includes("${")?ki.IDENTIFIER:ki.PATH}static getArgumentType(e){switch(typeof e){case"boolean":return"boolean";case"number":return Number.isInteger(e)?"integer":"float";default:return"string"}}}e("OpcVersionMappingUtil",Ha);class Wa{static mapSocketToUpgradedVersion(e){const{devices:t,...n}=e??{};return Ua.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("[")?ui.Expression:ui.Constant}}e("SocketVersionMappingUtil",Wa);class $a{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("[")?ui.Expression:ui.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",$a);class Ka{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("${")?yi.REQUEST:yi.CONST}}e("RestVersionMappingUtil",Ka);class Ya{transform(e,t){const n=Ua.parseVersion(e);return t===dt.MODBUS?n>=Ua.parseVersion(ct.v3_5_2):n>=Ua.parseVersion(ct.v3_6_0)}static{this.ɵfac=function(e){return new(e||Ya)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"withReportStrategy",type:Ya,pure:!0,standalone:!0})}}function Xa(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 Za(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 Qa(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 Ja(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 er(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 tr(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 nr(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 ir(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",Ya);class ar extends A{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=O+"/docs/iot-gateway/configuration/#subsection-statistics",this.editCommandFormGroup=this.fb.group({attributeOnGateway:["",[$.required,$.pattern(rn),this.uniqNameRequired()]],command:["",[$.required,$.pattern(/^(?=\S).*\S$/)]],timeout:[10,[$.required,$.min(1),$.pattern(an),$.pattern(/^[^.\s]+$/)]],installCmd:["",$.pattern(rn)]}),this.editCommandFormGroup.patchValue(this.data.command,{emitEvent:!1})}cancel(){this.confirmConnectorChange().pipe(ve(Boolean),wn(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):ae(!0)}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=t&&this.data.existingCommands.some((e=>e.toLowerCase()===t))&&t!==this.data.command.attributeOnGateway.toLowerCase();return n?{duplicateName:{valid:!1}}:null}}static{this.ɵfac=function(e){return new(e||ar)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ar,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,Xa,3,3,"mat-error")(19,Za,3,3,"mat-error")(20,Qa,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,Ja,3,3,"mat-error")(29,er,3,3,"mat-error")(30,tr,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,nr,3,3,"mat-error")(40,ir,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(ar,[j,_]),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 rr="sans-serif",or="12px "+rr;var sr,lr,pr=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;o18);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,bo);var wo="___EC__COMPONENT__CONTAINER___",So="___EC__EXTENDED_CLASS___";function Co(e){var t={main:"",sub:""};if(e){var n=e.split(".");t.main=n[0]||"",t.sub=n[1]||""}return t}function _o(e,t){e.$constructor=e,e.extend=function(e){var t,n,i=this;return Gr(n=i)&&/^class\s/.test(Function.prototype.toString.call(n))?t=function(e){function t(){return e.apply(this,arguments)||this}return ze(t,e),t}(i):(t=function(){(e.$constructor||i).apply(this,arguments)},function(e,t){var n=e.prototype;function i(){}for(var a in i.prototype=t.prototype,e.prototype=new i,n)n.hasOwnProperty(a)&&(e.prototype[a]=n[a]);e.prototype.constructor=e,e.superClass=t}(t,this)),Mr(t.prototype,e),t[So]=!0,t.extend=this.extend,t.superCall=Eo,t.superApply=Mo,t.superClass=i,t}}function To(e,t){e.extend=t.extend}var Io=Math.round(10*Math.random());function Eo(e,t){for(var n=[],i=2;i=0||a&&Pr(a,s)<0)){var l=n.getShallow(s,t);null!=l&&(r[e[o][0]]=l)}}return r}}var Do=Po([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),Oo=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Do(this,e,t)},e}(),Ao=function(e){this.value=e},Fo=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Ao(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}(),Ro=function(){function e(e){this._list=new Fo,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 Ao(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}(),Bo=new Ro(50);function No(e){if("string"==typeof e){var t=Bo.get(e);return t&&t.image}return e}function Lo(e,t,n,i,a){if(e){if("string"==typeof e){if(t&&t.__zrImageSrc===e||!n)return t;var r=Bo.get(e),o={hostEl:n,cb:i,cbPayload:a};return r?!qo(t=r.image)&&r.pending.push(o):((t=cr.loadImage(e,Vo,Vo)).__zrImageSrc=e,Bo.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}return t}function Vo(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;th&&(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))}Zo.x=Jo.x=n.x,Zo.y=es.y=n.y,Qo.x=es.x=n.x+n.width,Qo.y=Jo.y=n.y+n.height,Zo.transform(i),es.transform(i),Qo.transform(i),Jo.transform(i),t.x=Yo(Zo.x,Qo.x,Jo.x,es.x),t.y=Yo(Zo.y,Qo.y,Jo.y,es.y);var l=Xo(Zo.x,Qo.x,Jo.x,es.x),p=Xo(Zo.y,Qo.y,Jo.y,es.y);t.width=l-t.x,t.height=p-t.y}else t!==n&&e.copy(t,n)},e}(),as={};function rs(e,t){var n=as[t=t||or];n||(n=as[t]=new Ro(500));var i=n.get(e);return null==i&&(i=cr.measureText(e,t).width,n.put(e,i)),i}function os(e,t,n,i){var a=rs(e,t),r=cs(t),o=ls(0,a,n),s=ps(0,r,i);return new is(o,s,a,r)}function ss(e,t,n,i){var a=((e||"")+"").split("\n");if(1===a.length)return os(a[0],t,n,i);for(var r=new is(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function us(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+=ds(i[0],n.width),p+=ds(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 ms=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function hs(e,t,n,i,a){if(!t)return"";var r=(e+"").split("\n");a=gs(t,n,i,a);for(var o=0,s=r.length;o=o;l++)s-=o;var p=rs(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 fs(e,t){var n=t.containerWidth,i=t.font,a=t.contentWidth;if(!n)return"";var r=rs(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?ys(e,a,t.ascCharWidth,t.cnCharWidth):r>0?Math.floor(e.length*a/r):0;r=rs(e=e.substr(0,s),i)}return""===e&&(e=t.placeholder),e}function ys(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=_s(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)||!!Ss[e]}function _s(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}}function Ts(e,t){return null==e&&(e=0),null==t&&(t=0),[e,t]}function Is(e,t){return e[0]=t[0],e[1]=t[1],e}function Es(e){return[e[0],e[1]]}function Ms(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function ks(e,t,n,i){return e[0]=t[0]+n[0]*i,e[1]=t[1]+n[1]*i,e}function Ps(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function Ds(e){return Math.sqrt(Os(e))}function Os(e){return e[0]*e[0]+e[1]*e[1]}function As(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function Fs(e,t){var n=Ds(t);return 0===n?(e[0]=0,e[1]=0):(e[0]=t[0]/n,e[1]=t[1]/n),e}function Rs(e,t){return Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))}var Bs=Rs;var Ns=function(e,t){return(e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])};function Ls(e,t,n,i){return e[0]=t[0]+i*(n[0]-t[0]),e[1]=t[1]+i*(n[1]-t[1]),e}function Vs(e,t,n){var i=t[0],a=t[1];return e[0]=n[0]*i+n[2]*a+n[4],e[1]=n[1]*i+n[3]*a+n[5],e}function qs(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}function Gs(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}var zs=Go,Us=5e-5;function js(e){return e>Us||e<-5e-5}var Hs=[],Ws=[],$s=[1,0,0,1,0,0],Ks=Math.abs,Ys=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 js(this.rotation)||js(this.x)||js(this.y)||js(this.scaleX-1)||js(this.scaleY-1)||js(this.skewX)||js(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):zs(n),e&&(t?Uo(n,e,n):zo(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(zs(n),this.invTransform=null)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(null!=t&&1!==t){this.getGlobalScale(Hs);var n=Hs[0]<0?-1:1,i=Hs[1]<0?-1:1,a=((Hs[0]-n)*t+n)/Hs[0]||0,r=((Hs[1]-i)*t+i)/Hs[1]||0;e[0]*=a,e[1]*=a,e[2]*=r,e[3]*=r}this.invTransform=this.invTransform||[1,0,0,1,0,0],$o(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],Uo(Ws,e.invTransform,t),t=Ws);var n=this.originX,i=this.originY;(n||i)&&($s[4]=n,$s[5]=i,Uo(Ws,t,$s),Ws[4]-=n,Ws[5]-=i,t=Ws),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&&Vs(n,n,i),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],i=this.transform;return i&&Vs(n,n,i),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&Ks(e[0]-1)>1e-10&&Ks(e[3]-1)>1e-10?Math.sqrt(Ks(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){Zs(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&&Ho(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}(),Xs=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function Zs(e,t){for(var n=0;n-1e-8&&etl||e<-1e-8}function cl(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 dl(e,t,n,i,a){var r=1-a;return 3*(((t-e)*r+2*(n-t)*a)*r+(i-n)*a*a)}function ul(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(ll(c)&&ll(d)){if(ll(s))r[0]=0;else(_=-l/s)>=0&&_<=1&&(r[m++]=_)}else{var h=d*d-4*c*u;if(ll(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=el(h),v=c*s+1.5*o*(-d+y),x=c*s+1.5*o*(-d-y);(_=(-s-((v=v<0?-Js(-v,al):Js(v,al))+(x=x<0?-Js(-x,al):Js(x,al))))/(3*o))>=0&&_<=1&&(r[m++]=_)}else{var b=(2*c*s-3*o*d)/(2*el(c*c*c)),w=Math.acos(b)/3,S=el(c),C=Math.cos(w),_=(-s-2*S*C)/(3*o),T=(f=(-s+S*(C+il*Math.sin(w)))/(3*o),(-s+S*(C-il*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 ml(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(ll(o)){if(pl(r))(c=-s/r)>=0&&c<=1&&(a[l++]=c)}else{var p=r*r-4*o*s;if(ll(p))a[0]=-r/(2*o);else if(p>0){var c,d=el(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 hl(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 gl(e,t,n,i,a,r,o,s,l,p,c){var d,u,m,h,g,f=.005,y=1/0;rl[0]=l,rl[1]=p;for(var v=0;v<1;v+=.05)ol[0]=cl(e,n,a,o,v),ol[1]=cl(t,i,r,s,v),(h=Ns(rl,ol))=0&&h=0&&f=1?1:ul(0,i,r,1,e,s)&&cl(0,a,o,1,s[0])}}}var Tl=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||yo,this.ondestroy=e.ondestroy||yo,this.onrestart=e.onrestart||yo,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=Gr(e)?e:Qs[e]||_l(e)},e}(),Il={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 El(e){return(e=Math.round(e))<0?0:e>255?255:e}function Ml(e){return e<0?0:e>1?1:e}function kl(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?El(parseFloat(t)/100*255):El(parseInt(t,10))}function Pl(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Ml(parseFloat(t)/100):Ml(parseFloat(t))}function Dl(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 Ol(e,t,n){return e+(t-e)*n}function Al(e,t,n,i,a){return e[0]=t,e[1]=n,e[2]=i,e[3]=a,e}function Fl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var Rl=new Ro(20),Bl=null;function Nl(e,t){Bl&&Fl(Bl,t),Bl=Rl.put(e,Bl||t.slice())}function Ll(e,t){if(e){t=t||[];var n=Rl.get(e);if(n)return Fl(t,n);var i=(e+="").replace(/ /g,"").toLowerCase();if(i in Il)return Fl(t,Il[i]),Nl(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?(Al(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),Nl(e,t),t):void Al(t,0,0,0,1):7===r||9===r?(a=parseInt(i.slice(1,7),16))>=0&&a<=16777215?(Al(t,(16711680&a)>>16,(65280&a)>>8,255&a,9===r?parseInt(i.slice(7),16)/255:1),Nl(e,t),t):void Al(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?Al(t,+p[0],+p[1],+p[2],1):Al(t,0,0,0,1);c=Pl(p.pop());case"rgb":return p.length>=3?(Al(t,kl(p[0]),kl(p[1]),kl(p[2]),3===p.length?c:Pl(p[3])),Nl(e,t),t):void Al(t,0,0,0,1);case"hsla":return 4!==p.length?void Al(t,0,0,0,1):(p[3]=Pl(p[3]),Vl(p,t),Nl(e,t),t);case"hsl":return 3!==p.length?void Al(t,0,0,0,1):(Vl(p,t),Nl(e,t),t);default:return}}Al(t,0,0,0,1)}}function Vl(e,t){var n=(parseFloat(e[0])%360+360)%360/360,i=Pl(e[1]),a=Pl(e[2]),r=a<=.5?a*(i+1):a+i-a*i,o=2*a-r;return Al(t=t||[],El(255*Dl(o,r,n+1/3)),El(255*Dl(o,r,n)),El(255*Dl(o,r,n-1/3)),1),4===e.length&&(t[3]=e[3]),t}function ql(e,t){var n=Ll(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 Hl(n,4===n.length?"rgba":"rgb")}}function Gl(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]=El(Ol(o[0],s[0],l)),n[1]=El(Ol(o[1],s[1],l)),n[2]=El(Ol(o[2],s[2],l)),n[3]=Ml(Ol(o[3],s[3],l)),n}}function zl(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=Ll(t[a]),s=Ll(t[r]),l=i-a,p=Hl([El(Ol(o[0],s[0],l)),El(Ol(o[1],s[1],l)),El(Ol(o[2],s[2],l)),Ml(Ol(o[3],s[3],l))],"rgba");return n?{color:p,leftIndex:a,rightIndex:r,value:i}:p}}function Ul(e,t,n,i){var a=Ll(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]=Pl(n)),null!=i&&(a[2]=Pl(i)),Hl(Vl(a),"rgba")}function jl(e,t){var n=Ll(e);if(n&&null!=t)return n[3]=Ml(t),Hl(n,"rgba")}function Hl(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 Wl(e,t){var n=Ll(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var $l=new Ro(100);function Kl(e){if(zr(e)){var t=$l.get(e);return t||(t=ql(e,-.1),$l.put(e,t)),t}if(Yr(e)){var n=Mr({},e);return n.colorStops=Fr(e.colorStops,(function(e){return{offset:e.offset,color:ql(e.color,-.1)}})),n}return e}var Yl=Math.round;function Xl(e){var t;if(e&&"transparent"!==e){if("string"==typeof e&&e.indexOf("rgba")>-1){var n=Ll(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 Zl=1e-4;function Ql(e){return e-1e-4}function Jl(e){return Yl(1e3*e)/1e3}function ep(e){return Yl(1e4*e)/1e4}var tp={left:"start",right:"end",center:"middle",middle:"middle"};function np(e){return e&&!!e.image}function ip(e){return np(e)||function(e){return e&&!!e.svgElement}(e)}function ap(e){return"linear"===e.type}function rp(e){return"radial"===e.type}function op(e){return e&&("linear"===e.type||"radial"===e.type)}function sp(e){return"url(#"+e+")"}function lp(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 pp(e){var t=e.x||0,n=e.y||0,i=(e.rotation||0)*vo,a=Jr(e.scaleX,1),r=Jr(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("+Yl(o*vo)+"deg, "+Yl(s*vo)+"deg)"),l.join(" ")}var cp=bo.hasGlobalWindow&&Gr(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},dp=Array.prototype.slice;function up(e,t,n){return(t-e)*n+e}function mp(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(Or(t)){var l=function(e){return Or(e&&e[0])?2:1}(t);o=l,(1===l&&!jr(t[0])||2===l&&!jr(t[0][0]))&&(r=!0)}else if(jr(t)&&!Zr(t))o=0;else if(zr(t))if(isNaN(+t)){var p=Ll(t);p&&(s=p,o=3)}else o=0;else if(Yr(t)){var c=Mr({},s);c.colorStops=Fr(t.colorStops,(function(e){return{offset:e.offset,color:Ll(e.color)}})),ap(t)?o=4:rp(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=Gr(n)?n:Qs[n]||_l(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=wp(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?Sp:e[c];if(!wp(s)&&!d||f||(f=this._additiveValue=[]),this.discrete)e[c]=g<1?i.rawValue:a.rawValue;else if(wp(s))1===s?mp(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,vp(l),i),this._trackKeys.push(o)}s.addKeyframe(e,vp(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}(),Tp=function(){function e(e){e&&(this._$eventProcessor=e)}return e.prototype.on=function(e,t,n,i){this._$handlers||(this._$handlers={});var a=this._$handlers;if("function"==typeof t&&(i=n,n=t,t=null),!n||!e)return this;var r=this._$eventProcessor;null!=t&&r&&r.normalizeQuery&&(t=r.normalizeQuery(t)),a[e]||(a[e]=[]);for(var o=0;o=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()?kp:Mp},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof t&&Ll(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,Hl(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||{},Mr(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(Hr(e))for(var n=Nr(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(Pp,!1,e)},e.prototype.useState=function(e,t,n,i){var a=e===Pp;if(this.hasState()||!a){var r=this.currentStates,o=this.stateTransition;if(!(Pr(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}_r("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=Pr(i,e),r=Pr(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;b1e-4)return s[0]=e-n,s[1]=t-i,l[0]=e+n,void(l[1]=t+i);if(Jp[0]=Zp(a)*n+e,Jp[1]=Xp(a)*i+t,ec[0]=Zp(r)*n+e,ec[1]=Xp(r)*i+t,p(s,Jp,ec),c(l,Jp,ec),(a%=Qp)<0&&(a+=Qp),(r%=Qp)<0&&(r+=Qp),a>r&&!o?r+=Qp:aa&&(tc[0]=Zp(m)*n+e,tc[1]=Xp(m)*i+t,p(s,tc,s),c(l,tc,l))}var pc={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},cc=[],dc=[],uc=[],mc=[],hc=[],gc=[],fc=Math.min,yc=Math.max,vc=Math.cos,xc=Math.sin,bc=Math.abs,wc=Math.PI,Sc=2*wc,Cc="undefined"!=typeof Float32Array,_c=[];function Tc(e){return Math.round(e/wc*1e8)/1e8%2*wc}function Ic(e,t){var n=Tc(e[0]);n<0&&(n+=Sc);var i=n-e[0],a=e[1];a+=i,!t&&a-n>=Sc?a=n+Sc:t&&n-a>=Sc?a=n-Sc:!t&&n>a?a=n+(Sc-Tc(n-a)):t&&n0&&(this._ux=bc(n/Ep/e)||0,this._uy=bc(n/Ep/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(pc.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=bc(e-this._xi),i=bc(t-this._yi),a=n>this._ux||i>this._uy;if(this.addData(pc.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(pc.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(pc.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(),_c[0]=i,_c[1]=a,Ic(_c,r),i=_c[0];var o=(a=_c[1])-i;return this.addData(pc.A,e,t,n,n,i,o,0,r?0:1),this._ctx&&this._ctx.arc(e,t,n,i,a,r),this._xi=vc(a)*n+e,this._yi=xc(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(pc.R,e,t,n,i),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(pc.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||!Cc||(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(){uc[0]=uc[1]=hc[0]=hc[1]=Number.MAX_VALUE,mc[0]=mc[1]=gc[0]=gc[1]=-Number.MAX_VALUE;var e,t=this.data,n=0,i=0,a=0,r=0;for(e=0;en||bc(f)>i||d===t-1)&&(h=Math.sqrt(k*k+f*f),a=g,r=x);break;case pc.C:var y=e[d++],v=e[d++],x=(g=e[d++],e[d++]),b=e[d++],w=e[d++];h=fl(a,r,y,v,g,x,b,w,10),a=b,r=w;break;case pc.Q:h=Sl(a,r,y=e[d++],v=e[d++],g=e[d++],x=e[d++],10),a=g,r=x;break;case pc.A:var S=e[d++],C=e[d++],_=e[d++],T=e[d++],I=e[d++],E=e[d++],M=E+I;d+=1,m&&(o=vc(I)*_+S,s=xc(I)*T+C),h=yc(_,T)*fc(Sc,Math.abs(E)),a=vc(M)*_+S,r=xc(M)*T+C;break;case pc.R:o=a=e[d++],s=r=e[d++],h=2*e[d++]+2*e[d++];break;case pc.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 pc.M:n=a=u[b++],i=r=u[b++],e.moveTo(a,r);break;case pc.L:o=u[b++],s=u[b++];var C=bc(o-a),_=bc(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 I=C*C+_*_;I>x&&(c=o,d=s,x=I)}break;case pc.C:var E=u[b++],M=u[b++],k=u[b++],P=u[b++],D=u[b++],O=u[b++];if(f){if(y+(K=l[v++])>p){hl(a,E,k,D,T=(p-y)/K,cc),hl(r,M,P,O,T,dc),e.bezierCurveTo(cc[1],dc[1],cc[2],dc[2],cc[3],dc[3]);break e}y+=K}e.bezierCurveTo(E,M,k,P,D,O),a=D,r=O;break;case pc.Q:E=u[b++],M=u[b++],k=u[b++],P=u[b++];if(f){if(y+(K=l[v++])>p){bl(a,E,k,T=(p-y)/K,cc),bl(r,M,P,T,dc),e.quadraticCurveTo(cc[1],dc[1],cc[2],dc[2]);break e}y+=K}e.quadraticCurveTo(E,M,k,P),a=k,r=P;break;case pc.A:var A=u[b++],F=u[b++],R=u[b++],B=u[b++],N=u[b++],L=u[b++],V=u[b++],q=!u[b++],G=R>B?R:B,z=bc(R-B)>.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(A,F,R,B,V,N,U,q):e.arc(A,F,G,N,U,q),j)break e;S&&(n=vc(N)*R+A,i=xc(N)*B+F),a=vc(U)*R+A,r=xc(U)*B+F;break;case pc.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+fc($,H),s),($-=H)>0&&e.lineTo(o+H,s+fc($,W)),($-=W)>0&&e.lineTo(o+yc(H-$,0),s+W),($-=H)>0&&e.lineTo(o,s+yc(W-$,0));break e}y+=K}e.rect(o,s,H,W);break;case pc.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=pc,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function Mc(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+=Ac);var u=Math.atan2(l,s);return u<0&&(u+=Ac),u>=i&&u<=a||u+Ac>=i&&u+Ac<=a}function Rc(e,t,n,i,a,r){if(r>t&&r>i||ra?s:0}var Bc=Ec.CMD,Nc=2*Math.PI;var Lc=[-1,-1,-1],Vc=[-1,-1];function qc(e,t,n,i,a,r,o,s,l,p){if(p>t&&p>i&&p>r&&p>s||p1&&(c=void 0,c=Vc[0],Vc[0]=Vc[1],Vc[1]=c),h=cl(t,i,r,s,Vc[0]),m>1&&(g=cl(t,i,r,s,Vc[1]))),2===m?yt&&s>i&&s>r||s=0&&c<=1&&(a[l++]=c);else{var p=o*o-4*r*s;if(ll(p))(c=-o/(2*r))>=0&&c<=1&&(a[l++]=c);else if(p>0){var c,d=el(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,Lc);if(0===l)return 0;var p=xl(t,i,r);if(p>=0&&p<=1){for(var c=0,d=yl(t,i,r,p),u=0;un||s<-n)return 0;var l=Math.sqrt(n*n-s*s);Lc[0]=-l,Lc[1]=l;var p=Math.abs(i-a);if(p<1e-4)return 0;if(p>=Nc-1e-4){i=0,a=Nc;var c=r?1:-1;return o>=Lc[0]+e&&o<=Lc[1]+e?c:0}if(i>a){var d=i;i=a,a=d}i<0&&(i+=Nc,a+=Nc);for(var u=0,m=0;m<2;m++){var h=Lc[m];if(h+e>o){var g=Math.atan2(s,h);c=r?1:-1;g<0&&(g=Nc+g),(g>=i&&g<=a||g+Nc>=i&&g+Nc<=a)&&(g>Math.PI/2&&g<1.5*Math.PI&&(c=-c),u+=c)}}return u}function Uc(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+=Rc(u,m,h,g,i,a))),v&&(h=u=p[f],g=m=p[f+1]),y){case Bc.M:u=h=p[f++],m=g=p[f++];break;case Bc.L:if(n){if(Mc(u,m,p[f],p[f+1],t,i,a))return!0}else d+=Rc(u,m,p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case Bc.C:if(n){if(kc(u,m,p[f++],p[f++],p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=qc(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 Bc.Q:if(n){if(Pc(u,m,p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=Gc(u,m,p[f++],p[f++],p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case Bc.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+=Rc(u,m,r,o,i,a);var I=(i-x)*S/w+x;if(n){if(Fc(x,b,S,C,C+_,T,t,I,a))return!0}else d+=zc(x,b,S,C,C+_,T,I,a);u=Math.cos(C+_)*w+x,m=Math.sin(C+_)*S+b;break;case Bc.R:if(h=u=p[f++],g=m=p[f++],r=h+p[f++],o=g+p[f++],n){if(Mc(h,g,r,g,t,i,a)||Mc(r,g,r,o,t,i,a)||Mc(r,o,h,o,t,i,a)||Mc(h,o,h,g,t,i,a))return!0}else d+=Rc(r,g,r,o,i,a),d+=Rc(h,o,h,g,i,a);break;case Bc.Z:if(n){if(Mc(u,m,h,g,t,i,a))return!0}else d+=Rc(u,m,h,g,i,a);u=h,m=g}}return n||(s=m,l=g,Math.abs(s-l)<1e-4)||(d+=Rc(u,m,h,g,i,a)||0),0!==d}var jc=kr({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Gp),Hc={style:kr({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},zp.style)},Wc=Xs.concat(["invisible","culling","z","z2","zlevel","parent"]),$c=function(e){function t(t){return e.call(this,t)||this}var n;return ze(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?Mp:t>.2?"#eee":kp}if(e)return kp}return Mp},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(zr(t)){var n=this.__zr;if(!(!n||!n.isDarkMode())===Wl(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 Ec(!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 Uc(e,t,!0,n,i)}(r,o/s,e,t)))return!0}if(this.hasFill())return function(e,t,n){return Uc(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:Mr(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(4&this.__dirty)},t.prototype.createStyle=function(e){return ho(jc,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=Mr({},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=Mr({},i.shape),Mr(s,n.shape)):(s=Mr({},a?this.shape:i.shape),Mr(s,n.shape)):l&&(s=i.shape),s)if(r){this.shape=Mr({},this.shape);for(var p={},c=Nr(s),d=0;d0},t.prototype.hasFill=function(){var e=this.style.fill;return null!=e&&"none"!==e},t.prototype.createStyle=function(e){return ho(Kc,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=ss(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}(Hp);Yc.prototype.type="tspan";var Xc=kr({x:0,y:0},Gp),Zc={style:kr({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},zp.style)};var Qc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.createStyle=function(e){return ho(Xc,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 Zc},t.prototype.getBoundingRect=function(){var e=this.style;return this._rect||(this._rect=new is(e.x||0,e.y||0,this.getWidth(),this.getHeight())),this._rect},t}(Hp);Qc.prototype.type="image";var Jc=Math.round;function ed(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?(Jc(2*i)===Jc(2*a)&&(e.x1=e.x2=nd(i,s,!0)),Jc(2*r)===Jc(2*o)&&(e.y1=e.y2=nd(r,s,!0)),e):e}}function td(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=nd(i,s,!0),e.y=nd(a,s,!0),e.width=Math.max(nd(i+r,s,!1)-e.x,0===r?0:1),e.height=Math.max(nd(a+o,s,!1)-e.y,0===o?0:1),e):e}}function nd(e,t,n){if(!t)return e;var i=Jc(2*e);return(i+Jc(t))%2==0?i/2:(i+(n?1:-1))/2}var id=function(){this.x=0,this.y=0,this.width=0,this.height=0},ad={},rd=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new id},t.prototype.buildPath=function(e,t){var n,i,a,r;if(this.subPixelOptimize){var o=td(ad,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}($c);rd.prototype.type="rect";var od={fill:"#000"},sd={style:kr({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},zp.style)},ld=function(e){function t(t){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=od,n.attr(t),n}return ze(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=gs(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),I=i.calculatedLineHeight,E=0;El&&ws(n,e.substring(l,p),t,s),ws(n,i[2],t,s,i[1]),l=ms.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 E=S.width,M=null==E||"auto"===E;if("string"==typeof E&&"%"===E.charAt(E.length-1))O.percentWidth=E,c.push(O),O.contentWidth=rs(O.text,T);else{if(M){var k=S.backgroundColor,P=k&&k.image;P&&qo(P=No(P))&&(O.width=Math.max(O.width,P.width*I/P.height))}var D=h&&null!=a?a-b:null;null!=D&&D=0&&"right"===(E=x[I]).align;)this._placeToken(E,e,w,h,T,"right",f),S-=E.width,T-=E.width,I--;for(_+=(n-(_-m)-(g-T)-S)/2;C<=I;)E=x[C],this._placeToken(E,e,w,h,_+E.width/2,"center",f),_+=E.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&&bd(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=vd(a,r,d),p-=e.height/2-d[0]-e.innerHeight/2);var u=this._getOrCreateChild(Yc),m=u.createStyle();u.useStyle(m);var h=this._defaultStyle,g=!1,f=0,y=yd("fill"in s?s.fill:"fill"in t?t.fill:(g=!0,h.fill)),v=fd("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||or,m.opacity=eo(s.opacity,t.opacity,1),md(m,s),v&&(m.lineWidth=eo(s.lineWidth,t.lineWidth,f),m.lineDash=Jr(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 is(ls(m.x,b,m.textAlign),ps(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(rd)).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=Jr(e.fillOpacity,1);else if(u){(s=this._getOrCreateChild(Qc)).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=Jr(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=eo(e.opacity,t.opacity,1)},t.makeFont=function(e){var t="";return hd(e)&&(t=[e.fontStyle,e.fontWeight,ud(e.fontSize),e.fontFamily||"sans-serif"].join(" ")),t&&ao(t)||e.textFont||e.font},t}(Hp),pd={left:!0,right:1,center:1},cd={top:1,bottom:1,middle:1},dd=["fontStyle","fontWeight","fontSize","fontFamily"];function ud(e){return"string"!=typeof e||-1===e.indexOf("px")&&-1===e.indexOf("rem")&&-1===e.indexOf("em")?isNaN(+e)?"12px":e+"px":e}function md(e,t){for(var n=0;n0){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 Cd(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 zr(e)?(n=e,n.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e;var n}function _d(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 Id(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 Ed(e)}function Ed(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 Md(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 kd(e,t){var n=Rr(e,(function(e,t){return e+(isNaN(t)?0:t)}),0);if(0===n)return[];for(var i=Math.pow(10,t),a=Fr(e,(function(e){return(isNaN(e)?0:e)/n*i*100})),r=100*i,o=Fr(a,(function(e){return Math.floor(e)})),s=Rr(o,(function(e,t){return e+t}),0),l=Fr(a,(function(e,t){return e-o[t]}));sp&&(p=l[d],c=d);++o[c],l[c]=0,++s}return Fr(o,(function(e){return e/i}))}function Pd(e,t){var n=Math.max(Id(e),Id(t)),i=e+t;return n>20?i:_d(i,n)}function Dd(e){var t=2*Math.PI;return(e%t+t)%t}function Od(e){return e>-1e-4&&e=10&&t++,t}function Bd(e,t){var n=Rd(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 Nd(e){e.sort((function(e,t){return s(e,t,0)?-1:1}));for(var t=-1/0,n=1,i=0;i=0,r=!1;if(e instanceof $c){var o=bu(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(Pu(s)||Pu(l)){var p=(i=i||{}).style||{};"inherit"===p.fill?(r=!0,i=Mr({},i),(p=Mr({},p)).fill=s):!Pu(p.fill)&&Pu(s)?(r=!0,i=Mr({},i),(p=Mr({},p)).fill=Kl(s)):!Pu(p.stroke)&&Pu(l)&&(r||(i=Mr({},i),p=Mr({},p)),p.stroke=Kl(l)),i.style=p}}if(i&&null==i.z2){r||(i=Mr({},i));var c=e.z2EmphasisLift;i.z2=e.z2+(null!=c?c:_u)}return i}(this,0,t,n);if("blur"===e)return function(e,t,n){var i=Pr(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 am(e,t,n){cm(e,!0),Vu(e,zu),om(e,t,n)}function rm(e,t,n,i){i?function(e){cm(e,!1)}(e):am(e,t,n)}function om(e,t,n){var i=fu(e);null!=t?(i.focus=t,i.blurScope=n):i.focus&&(i.focus=null)}var sm=["emphasis","blur","select"],lm={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function pm(e,t,n,i){n=n||"itemStyle";for(var a=0;a1&&(o*=xm(h),s*=xm(h));var g=(a===r?-1:1)*xm((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+wm(d)*f-bm(d)*y,x=(t+i)/2+bm(d)*f+wm(d)*y,b=Tm([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=Tm(w,S);if(_m(w,S)<=-1&&(C=Sm),_m(w,S)>=1&&(C=0),C<0){var _=Math.round(C/Sm*1e6)/1e6;C=2*Sm+_%2*Sm}c.addData(p,v,x,o,s,b,C,d,r)}var Em=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,Mm=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var km=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.applyTransform=function(e){},t}($c);function Pm(e){return null!=e.setData}function Dm(e,t){var n=function(e){var t=new Ec;if(!e)return t;var n,i=0,a=0,r=i,o=a,s=Ec.CMD,l=e.match(Em);if(!l)return t;for(var p=0;p=0&&(n.splice(i,0,e),this._doAdd(e))}return this},t.prototype.replace=function(e,t){var n=Pr(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=Pr(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;nP*P+D*D&&(_=I,T=E),{cx:_,cy:T,x0:-c,y0:-d,x1:_*(a/w-1),y1:T*(a/w-1)}}function Xm(e,t){var n,i=Wm(t.r,0),a=Wm(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=jm(l-s),m=u>Vm&&u%Vm;if(m>Km&&(u=m),i>Km)if(u>Vm-Km)e.moveTo(p+i*Gm(s),c+i*qm(s)),e.arc(p,c,i,s,l,!d),a>Km&&(e.moveTo(p+a*Gm(l),c+a*qm(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,I=void 0,E=void 0,M=void 0,k=void 0,P=i*Gm(s),D=i*qm(s),O=a*Gm(l),A=a*qm(l),F=u>Km;if(F){var R=t.cornerRadius;R&&(n=function(e){var t;if(qr(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}(R),h=n[0],g=n[1],f=n[2],y=n[3]);var B=jm(i-a)/2;if(v=$m(B,f),x=$m(B,y),b=$m(B,h),w=$m(B,g),_=S=Wm(v,x),T=C=Wm(b,w),(S>Km||C>Km)&&(I=i*Gm(l),E=i*qm(l),M=a*Gm(s),k=a*qm(s),uKm){var j=$m(f,_),H=$m(y,_),W=Ym(M,k,P,D,i,j,d),$=Ym(I,E,O,A,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,Um(W.y0,W.x0),Um(W.y1,W.x1),!d),e.arc(p,c,i,Um(W.cy+W.y1,W.cx+W.x1),Um($.cy+$.y1,$.cx+$.x1),!d),H>0&&e.arc(p+$.cx,c+$.cy,H,Um($.y1,$.x1),Um($.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>Km&&F)if(T>Km){j=$m(h,T),W=Ym(O,A,I,E,a,-(H=$m(g,T)),d),$=Ym(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,Um(W.y0,W.x0),Um(W.y1,W.x1),!d),e.arc(p,c,a,Um(W.cy+W.y1,W.cx+W.x1),Um($.cy+$.y1,$.cx+$.x1),d),j>0&&e.arc(p+$.cx,c+$.cy,j,Um($.y1,$.x1),Um($.y0,$.x0),!d))}else e.lineTo(p+O,c+A),e.arc(p,c,a,l,s,d);else e.lineTo(p+O,c+A)}else e.moveTo(p,c);e.closePath()}}}var Zm=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},Qm=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new Zm},t.prototype.buildPath=function(e,t){Xm(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}($c);Qm.prototype.type="sector";var Jm=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},eh=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new Jm},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}($c);function th(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;ubh[1]){if(o=!1,a)return o;var p=Math.abs(bh[0]-xh[1]),c=Math.abs(xh[0]-bh[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 kh(e,t,n,i,a,r){Mh("update",e,t,n,i,a,r)}function Ph(e,t,n,i,a,r){Mh("enter",e,t,n,i,a,r)}function Dh(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 Qh(e){return!e.isGroup}function Jh(e,t,n){if(e&&t){var i,a=(i={},e.traverse((function(e){Qh(e)&&e.anid&&(i[e.anid]=e)})),i);t.traverse((function(e){if(Qh(e)&&e.anid){var t=a[e.anid];if(t){var i=r(e);e.attr(r(t)),kh(e,i,n,fu(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=Mr({},e.shape)),t}}function eg(e,t){return Fr(e,(function(e){var n=e[0];n=Bh(n,t.x),n=Nh(n,t.x+t.width);var i=e[1];return i=Bh(i,t.y),[n,i=Nh(i,t.y+t.height)]}))}function tg(e,t,n){var i=Mr({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),kr(a,n),new Qc(i)):zh(e.replace("path://",""),i,n,"center")}function ng(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=ag(h,g,p,c)/m;if(f<0||f>1)return!1;var y=ag(h,g,d,u)/m;return!(y<0||y>1)}function ag(e,t,n,i){return e*i-n*t}function rg(e){var t=e.itemTooltipOption,n=e.componentModel,i=e.itemName,a=zr(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&&Ar(Nr(l),(function(e){fo(s,e)||(s[e]=l[e],s.$vars.push(e))}));var p=fu(e.el);p.componentMainType=r,p.componentIndex=o,p.tooltipConfig={name:i,option:kr({content:i,formatterParams:s},a)}}function og(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function sg(e,t){if(e)if(qr(e))for(var n=0;n=n&&r>=a)return{x:n,y:a,width:i-n,height:r-a}},createIcon:tg,extendPath:function(e,t){return Vh(e,t)},extendShape:function(e){return $c.extend(e)},getShapeClass:Gh,getTransform:Yh,groupTransition:Jh,initProps:Ph,isElementRemoved:Dh,lineLineIntersect:ig,linePolygonIntersect:ng,makeImage:Uh,makePath:zh,mergePath:Hh,registerShape:qh,removeElement:Oh,removeElementWithFadeOut:Fh,resizePath:Wh,setTooltipConfig:rg,subPixelOptimize:Kh,subPixelOptimizeLine:$h,subPixelOptimizeRect:function(e){return td(e.shape,e.shape,e.style),e},transformDirection:Zh,traverseElements:sg,updateProps:kh}),pg={};function cg(e,t){for(var n=0;n1){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;op&&(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;tt},gte:function(e,t){return e>=t}},Lf=function(){function e(e,t){if(!jr(t)){var n="";0,jd(n)}this._opFn=Nf[e],this._rvalFloat=Ld(t)}return e.prototype.evaluate=function(e){return jr(e)?this._opFn(e,this._rvalFloat):this._opFn(Ld(e),this._rvalFloat)},e}(),Vf=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=jr(e)?e:Ld(e),i=jr(t)?t:Ld(t),a=isNaN(n),r=isNaN(i);if(a&&(n=this._incomparable),r&&(i=this._incomparable),a&&r){var o=zr(e),s=zr(t);o&&(n=s?e:0),s&&(i=o?t:0)}return ni?-this._resultLT:0},e}(),qf=function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=Ld(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=Ld(e)===this._rvalFloat)}return this._isEQ?t:!t},e}();function Gf(e,t){return"eq"===e||"ne"===e?new qf("eq"===e,t):fo(Nf,e)?new Lf(e,t):null}var zf,Uf="undefined",jf=typeof Uint32Array===Uf?Array:Uint32Array,Hf=typeof Uint16Array===Uf?Array:Uint16Array,Wf=typeof Int32Array===Uf?Array:Int32Array,$f=typeof Float64Array===Uf?Array:Float64Array,Kf={float:$f,int:Wf,ordinal:Array,number:Array,time:$f};function Yf(e){return e>65535?jf:Hf}function Xf(e,t,n,i,a){var r=Kf[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=Fr(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(Yf(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 Ff(e[i],this._dimensions[i])}zf={arrayRows:e,objectRows:function(e,t,n,i){return Ff(e[t],this._dimensions[i])},keyedColumns:e,original:function(e,t,n,i){var a=e&&(null==e.value?e:e.value);return Ff(a instanceof Array?a[i]:a,this._dimensions[i])},typedArray:function(e,t,n,i){return e[i]}}}(),e}(),Qf=ou(),Jf={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},ey=function(){function e(e){this.dimensions=e.dimensions,this._dimOmitted=e.dimensionOmitted,this.source=e.source,this._fullDimCount=e.fullDimensionCount,this._updateDimOmitted(e.dimensionOmitted)}return e.prototype.isDimensionOmitted=function(){return this._dimOmitted},e.prototype._updateDimOmitted=function(e){this._dimOmitted=e,e&&(this._dimNameMap||(this._dimNameMap=iy(this.source)))},e.prototype.getSourceDimensionIndex=function(e){return Jr(this._dimNameMap.get(e),-1)},e.prototype.getSourceDimension=function(e){var t=this.source.dimensionsDefine;if(t)return t[e]},e.prototype.makeStoreSchema=function(){for(var e=this._fullDimCount,t=yf(this.source),n=!ay(e),i="",a=[],r=0,o=0;r30}var ry,oy,sy,ly,py,cy,dy,uy=Hr,my=Fr,hy="undefined"==typeof Int32Array?Array:Int32Array,gy=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],fy=["_approximateExtent"],yy=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;ty(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===Gg&&!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&&(qr(a=this.getVisual(t))?a=a.slice():uy(a)&&(a=Mr({},a)),i[t]=a),a},e.prototype.setItemVisual=function(e,t,n){var i=this._itemVisuals[e]||{};this._itemVisuals[e]=i,uy(t)?Mr(i,t):i[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){uy(e)?Mr(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?Mr(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;yu(n,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){Ar(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:my(this.dimensions,this._getDimInfo,this),this.hostModel)),py(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];Gr(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(to(arguments)))})},e.internalField=(ry=function(e){var t=e._invertedIndicesMap;Ar(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 hy(r.categories.length),r)for(var l=0;l1&&(s+="__ec__"+p),i[t]=s}})),e}();function vy(e,t){df(e)||(e=mf(e));var n=(t=t||{}).coordDimensions||[],i=t.dimensionsDefine||e.dimensionsDefine||[],a=uo(),r=[],o=function(e,t,n,i){var a=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,i||0);return Ar(t,(function(e){var t;Hr(e)&&(t=e.dimsDef)&&(a=Math.max(a,t.length))})),a}(e,n,i,t.dimensionsCount),s=t.canOmitUnusedDimensions&&ay(o),l=i===e.dimensionsDefine,p=l?iy(e):ny(i),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var d=uo(c),u=new Wf(o),m=0;m0&&(i.name=a+(r-1)),r++,t.set(a,r)}}(r),new ey({source:e,dimensions:r,fullDimensionCount:o,dimensionOmitted:s})}function xy(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 by={},wy=function(){function e(){this._coordinateSystems=[]}return e.prototype.create=function(e,t){var n=[];Ar(by,(function(i,a){var r=i.create(e,t);n=n.concat(r||[])})),this._coordinateSystems=n},e.prototype.update=function(e,t){Ar(this._coordinateSystems,(function(n){n.update&&n.update(e,t)}))},e.prototype.getCoordinateSystems=function(){return this._coordinateSystems.slice()},e.register=function(e,t){by[e]=t},e.get=function(e){return by[e]},e}(),Sy=function(e){this.coordSysDims=[],this.axisMap=uo(),this.categoryAxisMap=uo(),this.coordSysName=e};var Cy={cartesian2d:function(e,t,n,i){var a=e.getReferringComponents("xAxis",cu).models[0],r=e.getReferringComponents("yAxis",cu).models[0];t.coordSysDims=["x","y"],n.set("x",a),n.set("y",r),_y(a)&&(i.set("x",a),t.firstCategoryDimIndex=0),_y(r)&&(i.set("y",r),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,n,i){var a=e.getReferringComponents("singleAxis",cu).models[0];t.coordSysDims=["single"],n.set("single",a),_y(a)&&(i.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,n,i){var a=e.getReferringComponents("polar",cu).models[0],r=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],n.set("radius",r),n.set("angle",o),_y(r)&&(i.set("radius",r),t.firstCategoryDimIndex=0),_y(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();Ar(r.parallelAxisIndex,(function(e,r){var s=a.getComponent("parallelAxis",e),l=o[r];n.set(l,s),_y(s)&&(i.set(l,s),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=r))}))}};function _y(e){return"category"===e.get("type")}function Ty(e,t,n){var i,a,r,o=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(e){return!ty(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(Ar(i,(function(e,t){zr(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;Ar(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 Iy(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function Ey(e,t){return Iy(e,t)?e.getCalculationInfo("stackResultDimension"):t}function My(e,t,n){n=n||{};var i,a=t.getSourceManager(),r=!1;e?(r=!0,i=mf(e)):r=(i=a.getSource()).sourceFormat===Gg;var o=function(e){var t=e.get("coordinateSystem"),n=new Sy(t),i=Cy[t];if(i)return i(e,n,n.axisMap,n.categoryAxisMap),n}(t),s=function(e,t){var n,i=e.get("coordinateSystem"),a=wy.get(i);return t&&t.coordSysDims&&(n=Fr(t.coordSysDims,(function(e){var n={name:e},i=t.axisMap.get(e);if(i){var a=i.get("type");n.type=Of(a)}return n}))),n||(n=a&&(a.getDimensionsInfo?a.getDimensionsInfo():a.dimensions.slice())||["x","y"]),n}(t,o),l=n.useEncodeDefaulter,p=Gr(l)?l:l?Vr(Jg,s,t):null,c=vy(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:p,canOmitUnusedDimensions:!r}),d=function(e,t,n){var i,a;return n&&Ar(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=Ty(t,{schema:c,store:u}),h=new yy(c,t);h.setCalculationInfo(m);var g=null!=d&&function(e){if(e.sourceFormat===Gg){var t=function(e){var t=0;for(;t>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?Fy(s,o):Fy(o,s))}(o,r,a);if(s)return s(e,n,i),!0}return!1}function Ly(e){return"CANVAS"===e.nodeName.toUpperCase()}var Vy=/([&<>"'])/g,qy={"&":"&","<":"<",">":">",'"':""","'":"'"};function Gy(e){return null==e?"":(e+"").replace(Vy,(function(e,t){return qy[t]}))}var zy="ZH",Uy="EN",jy=Uy,Hy={},Wy={},$y=bo.domSupported&&(document.documentElement.lang||navigator.language||navigator.browserLanguage||jy).toUpperCase().indexOf(zy)>-1?zy:jy;function Ky(e,t){e=e.toUpperCase(),Wy[e]=new Bg(t),Hy[e]=t}function Yy(e){return Wy[e]}Ky(Uy,{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:". "}}}}),Ky(zy,{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 Xy=1e3,Zy=6e4,Qy=36e5,Jy=864e5,ev=31536e6,tv={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}"},nv="{yyyy}-{MM}-{dd}",iv={year:"{yyyy}",month:"{yyyy}-{MM}",day:nv,hour:nv+" "+tv.hour,minute:nv+" "+tv.minute,second:nv+" "+tv.second,millisecond:tv.none},av=["year","month","day","hour","minute","second","millisecond"],rv=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function ov(e,t){return"0000".substr(0,t-(e+="").length)+e}function sv(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 lv(e){return e===sv(e)}function pv(e,t,n,i){var a=Fd(e),r=a[uv(n)](),o=a[mv(n)]()+1,s=Math.floor((o-1)/3)+1,l=a[hv(n)](),p=a["get"+(n?"UTC":"")+"Day"](),c=a[gv(n)](),d=(c-1)%12+1,u=a[fv(n)](),m=a[yv(n)](),h=a[vv(n)](),g=(i instanceof Bg?i:Yy(i||$y)||Wy[jy]).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,ov(r%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,f[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,ov(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,ov(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,v[p]).replace(/{ee}/g,x[p]).replace(/{e}/g,p+"").replace(/{HH}/g,ov(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,ov(d+"",2)).replace(/{h}/g,d+"").replace(/{mm}/g,ov(u,2)).replace(/{m}/g,u+"").replace(/{ss}/g,ov(m,2)).replace(/{s}/g,m+"").replace(/{SSS}/g,ov(h,3)).replace(/{S}/g,h+"")}function cv(e,t){var n=Fd(e),i=n[mv(t)]()+1,a=n[hv(t)](),r=n[gv(t)](),o=n[fv(t)](),s=n[yv(t)](),l=0===n[vv(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 dv(e,t,n){var i=jr(e)?Fd(e):e;switch(t=t||cv(e,n)){case"year":return i[uv(n)]();case"half-year":return i[mv(n)]()>=6?1:0;case"quarter":return Math.floor((i[mv(n)]()+1)/4);case"month":return i[mv(n)]();case"day":return i[hv(n)]();case"half-day":return i[gv(n)]()/24;case"hour":return i[gv(n)]();case"minute":return i[fv(n)]();case"second":return i[yv(n)]();case"millisecond":return i[vv(n)]()}}function uv(e){return e?"getUTCFullYear":"getFullYear"}function mv(e){return e?"getUTCMonth":"getMonth"}function hv(e){return e?"getUTCDate":"getDate"}function gv(e){return e?"getUTCHours":"getHours"}function fv(e){return e?"getUTCMinutes":"getMinutes"}function yv(e){return e?"getUTCSeconds":"getSeconds"}function vv(e){return e?"getUTCMilliseconds":"getMilliseconds"}function xv(e){return e?"setUTCFullYear":"setFullYear"}function bv(e){return e?"setUTCMonth":"setMonth"}function wv(e){return e?"setUTCDate":"setDate"}function Sv(e){return e?"setUTCHours":"setHours"}function Cv(e){return e?"setUTCMinutes":"setMinutes"}function _v(e){return e?"setUTCSeconds":"setSeconds"}function Tv(e){return e?"setUTCMilliseconds":"setMilliseconds"}function Iv(e){if(!Vd(e))return zr(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function Ev(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 Mv=no;function kv(e,t,n){function i(e){return e&&ao(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?Fd(e):e;if(!isNaN(+s))return pv(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(o)return"-"}if("ordinal"===t)return Ur(e)?i(e):jr(e)&&a(e)?e+"":"-";var l=Ld(e);return a(l)?Iv(l):Ur(e)?i(e):"boolean"==typeof e?e+"":"-"}var Pv=["a","b","c","d","e","f","g"],Dv=function(e,t){return"{"+e+(null==t?"":t)+"}"};function Ov(e,t,n){qr(t)||(t=[t]);var i=t.length;if(!i)return"";for(var a=t[0].$vars||[],r=0;ri||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 Vv=Lv;Vr(Lv,"vertical"),Vr(Lv,"horizontal");function qv(e,t,n){n=Mv(n||0);var i=t.width,a=t.height,r=Cd(e.left,i),o=Cd(e.top,a),s=Cd(e.right,i),l=Cd(e.bottom,a),p=Cd(e.width,i),c=Cd(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 is(r+n[3],o+n[0],p,c);return h.margin=n,h}function Gv(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 is(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=qv(kr({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 zv(e){var t=e.layoutMode||e.constructor.layoutMode;return Hr(t)?t:t?{type:t}:null}function Uv(e,t,n){var i=n&&n.ignoreSize;!qr(i)&&(i=[i,i]);var a=o(Nv[0],0),r=o(Nv[1],1);function o(n,a){var r={},o=0,p={},c=0;if(Rv(n,(function(t){p[t]=e[t]})),Rv(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=Ir(r,n[o],!0);t.defaultOption=r}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+"Index",i=e+"Id";return uu(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}(Bg);To($v,Bg),ko($v),function(e){var t={};e.registerSubTypeDefaulter=function(e,n){var i=Co(e);t[i.main]=n},e.determineSubType=function(n,i){var a=i.type;if(!a){var r=Co(n).main;e.hasSubTypes(n)&&t[r]&&(a=t[r](i))}return a}}($v),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 Ar(e,(function(r){var o=n(i,r),s=function(e,t){var n=[];return Ar(e,(function(e){Pr(t,e)>=0&&n.push(e)})),n}(o.originalDeps=t(r),e);o.entryCount=s.length,0===o.entryCount&&a.push(r),Ar(s,(function(e){Pr(o.predecessor,e)<0&&o.predecessor.push(e);var t=n(i,e);Pr(t.successor,e)<0&&t.successor.push(r)}))})),{graph:i,noEntryList:a}}(i),s=o.graph,l=o.noEntryList,p={};for(Ar(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]),Ar(d.successor,u?h:m)}Ar(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)}}}($v,(function(e){var t=[];Ar($v.getClassesByMainType(e),(function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])})),t=Fr(t,(function(e){return Co(e).main})),"dataset"!==e&&Pr(t,"dataset")<=0&&t.unshift("dataset");return t}));var Kv=ou(),Yv=ou(),Xv=function(){function e(){}return e.prototype.getColorFromPalette=function(e,t,n){var i=Kd(this.get("color",!0)),a=this.get("colorLayer",!0);return Qv(this,Kv,i,a,e,t,n)},e.prototype.clearColorPalette=function(){!function(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}(this,Kv)},e}();function Zv(e,t,n,i){var a=Kd(e.get(["aria","decal","decals"]));return Qv(e,Yv,a,null,t,n,i)}function Qv(e,t,n,i,a,r,o){var s=t(r=r||e),l=s.paletteIdx||0,p=s.paletteNameMap=s.paletteNameMap||{};if(p.hasOwnProperty(a))return p[a];var c=null!=o&&i?function(e,t){for(var n=e.length,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 Jv=/\{@(.+?)\}/g,ex=function(){function e(){}return e.prototype.getDataParams=function(e,t){var n=this.getData(t),i=this.getRawValue(e,t),a=n.getRawIndex(e),r=n.getName(e),o=n.getRawDataItem(e),s=n.getItemVisual(e,"style"),l=s&&s[n.getItemVisual(e,"drawType")||"fill"],p=s&&s.stroke,c=this.mainType,d="series"===c,u=n.userOutput&&n.userOutput.get();return{componentType:c,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:d?this.subType:null,seriesIndex:this.seriesIndex,seriesId:d?this.id:null,seriesName:d?this.name:null,name:r,dataIndex:a,data:o,dataType:t,value:i,color:l,borderColor:p,dimensionNames:u?u.fullDimensions:null,encode:u?u.encode:null,$vars:["seriesName","name","value"]}},e.prototype.getFormattedLabel=function(e,t,n,i,a,r){t=t||"normal";var o=this.getData(n),s=this.getDataParams(e,n);(r&&(s.value=r.interpolatedValue),null!=i&&qr(s.value)&&(s.value=s.value[i]),a)||(a=o.getItemModel(e).get("normal"===t?["label","formatter"]:[t,"label","formatter"]));return Gr(a)?(s.status=t,s.dimensionIndex=i,a(s)):zr(a)?Ov(a,s).replace(Jv,(function(t,n){var i=n.length,a=n;"["===a.charAt(0)&&"]"===a.charAt(i-1)&&(a=+a.slice(1,i-1));var s=kf(o,e,a);if(r&&qr(r.interpolatedValue)){var l=o.getDimensionIndex(a);l>=0&&(s=r.interpolatedValue[l])}return null!=s?s+"":""})):void 0},e.prototype.getRawValue=function(e,t){return kf(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function tx(e){var t,n;return Hr(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function nx(e){return new ix(e)}var ix=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:r9e10&&(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(gx(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=$r(o=r.get("data",!0))?Hg:Gg,t=[];var c=this._getSourceMetaRawOption()||{},d=l&&l.metaRawOption||{},u=Jr(c.seriesLayoutBy,d.seriesLayoutBy)||null,m=Jr(c.sourceHeader,d.sourceHeader),h=Jr(c.dimensions,d.dimensions);e=u!==d.seriesLayoutBy||!!m!=!!d.sourceHeader||h?[uf(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=[uf(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&&fx(r)}var o,s=[],l=[];return Ar(e,(function(e){e.prepareSource();var t=e.getSource(a||0),n="";null==a||t||fx(n),s.push(t),l.push(e._getVersionSign())})),i?t=function(e,t){var n=Kd(e),i=n.length,a="";i||jd(a);for(var r=0,o=i;r1||n>0&&!e.noHeader;return Ar(e.blocks,(function(e){var n=Tx(e);n>=t&&(t=n+ +(i&&(!n||Cx(e)&&!e.noHeader)))})),t}return 0}function Ix(e,t,n,i){var a,r=t.noHeader,o=(a=Tx(t),{html:xx[a],richText:bx[a]}),s=[],l=t.blocks||[];io(!l||qr(l)),l=l||[];var p=e.orderMode;if(t.sortBlocks&&p){l=l.slice();var c={valueAsc:"asc",valueDesc:"desc"};if(fo(c,p)){var d=new Vf(c[p],null);l.sort((function(e,t){return d.evaluate(e.sortParam,t.sortParam)}))}else"seriesDesc"===p&&l.reverse()}Ar(l,(function(n,a){var r=t.valueFormatter,l=_x(n)(r?Mr(Mr({},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):kx(s.join(""),r?n:o.html);if(r)return u;var m=kv(t.header,"ordinal",e.useUTC),h=vx(i,e.renderMode).nameStyle;return"richText"===e.renderMode?Px(e,m,h)+o.richText+u:kx('
    '+Gy(m)+"
    "+u,n)}function Ex(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 Fr(e=qr(e)?e:[e],(function(e,t){return kv(e,qr(m)?m[t]:m,p)}))};if(!r||!o){var d=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||"#333",a),u=r?"":kv(l,"ordinal",p),m=t.valueType,h=o?[]:c(t.value,t.dataIndex),g=!s||!r,f=!s&&r,y=vx(i,a),v=y.nameStyle,x=y.valueStyle;return"richText"===a?(s?"":d)+(r?"":Px(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(qr(t)?t.join(" "):t,r)}(e,h,g,f,x)):kx((s?"":d)+(r?"":function(e,t,n){return''+Gy(e)+""}(u,!s,v))+(o?"":function(e,t,n,i){var a=n?"10px":"20px",r=t?"float:right;margin-left:"+a:"";return e=qr(e)?e:[e],''+Fr(e,(function(e){return Gy(e)})).join("  ")+""}(h,g,f,x)),n)}}function Mx(e,t,n,i,a,r){if(e)return _x(e)({useUTC:a,renderMode:n,orderMode:i,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,r)}function kx(e,t){return'
    '+e+'
    '}function Px(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function Dx(e,t){return Av(e.getData().getItemVisual(t,"style")[e.visualDrawType])}function Ox(e,t){var n=e.get("padding");return null!=n?n:"richText"===t?[8,10]:10}var Ax=function(){function e(){this.richTextStyles={},this._nextStyleNameId=qd()}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=function(e,t){var n=zr(e)?{color:e,extraCssText:t}:e||{},i=n.color,a=n.type;t=n.extraCssText;var r=n.renderMode||"html";return i?"html"===r?"subItem"===a?'':'':{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}}:""}({color:t,type:e,renderMode:n,markerId:i});return zr(a)?a:(this.richTextStyles[i]=a.style,a.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};qr(t)?Ar(t,(function(e){return Mr(n,e)})):Mr(n,t);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+e+"}"},e}();function Fx(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=qr(d),m=Dx(r,o);if(c>1||u&&!c){var h=function(e,t,n,i,a){var r=t.getData(),o=Rr(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(Sx("nameValue",{markerType:"subItem",markerColor:a,name:n.displayName,value:e,valueType:n.type})):(s.push(e),l.push(n.type)))}return i.length?Ar(i,(function(e){c(kf(r,n,e),e)})):Ar(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=kf(l,o,p[0]),n=g.type}else a=t=u?d[0]:d;var f=iu(r),y=f&&r.name||"",v=l.getName(o),x=s?y:v;return Sx("section",{header:y,noHeader:s||!f,sortParam:a,blocks:[Sx("nameValue",{markerType:"item",markerColor:m,name:x,noName:!ao(x),value:t,valueType:n,dataIndex:o})].concat(i||[])})}var Rx=ou();function Bx(e,t){return e.getName(t)||e.getId(t)}var Nx="__universalTransitionEnabled",Lx=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return ze(t,e),t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=nx({count:qx,reset:Gx}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(Rx(this).sourceManager=new mx(this)).prepareSource();var i=this.getInitialData(e,n);Ux(i,this),this.dataTask.context.data=i,Rx(this).dataBeforeProcessed=i,Vx(this),this._initSelectedMapFromData(i)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=zv(this),i=n?jv(e):{},a=this.subType;$v.hasClass(a)&&(a+="Series"),Ir(e,t.getTheme().get(this.subType)),Ir(e,this.getDefaultOption()),Yd(e,"label",["show"]),this.fillDataTextStyle(e.data),n&&Uv(e,i,n)},t.prototype.mergeOption=function(e,t){e=Ir(this.option,e,!0),this.fillDataTextStyle(e.data);var n=zv(this);n&&Uv(this.option,e,n);var i=Rx(this).sourceManager;i.dirty(),i.prepareSource();var a=this.getInitialData(e,t);Ux(a,this),this.dataTask.dirty(),this.dataTask.context.data=a,Rx(this).dataBeforeProcessed=a,Vx(this),this._initSelectedMapFromData(a)},t.prototype.fillDataTextStyle=function(e){if(e&&!$r(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=Xv.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[Bx(i,e)])&&!i.getItemModel(e).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[Nx])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){Hr(a.selectedMap)||(a.selectedMap={});for(var s=a.selectedMap,l=0;l0&&this._innerSelect(e,t)}},t.registerClass=function(e){return $v.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}($v);function Vx(e){var t=e.name;iu(e)||(e.name=function(e){var t=e.getRawData(),n=t.mapDimensionsAll("seriesName"),i=[];return Ar(n,(function(e){var n=t.getDimensionInfo(e);n.displayName&&i.push(n.displayName)})),i.join(" ")}(e)||t)}function qx(e){return e.model.getRawData().count()}function Gx(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),zx}function zx(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function Ux(e,t){Ar(mo(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),(function(n){e.wrapMethod(n,Vr(jx,t))}))}function jx(e,t){var n=Hx(e);return n&&n.setOutputEnd((t||this).count()),t}function Hx(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}}Dr(Lx,ex),Dr(Lx,Xv),To(Lx,$v);var Wx=$c.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,i=t.cy,a=t.width/2,r=t.height/2;e.moveTo(n,i-r),e.lineTo(n+a,i+r),e.lineTo(n-a,i+r),e.closePath()}}),$x=$c.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(e,t){var n=t.cx,i=t.cy,a=t.width/2,r=t.height/2;e.moveTo(n,i-r),e.lineTo(n+a,i),e.lineTo(n,i+r),e.lineTo(n-a,i),e.closePath()}}),Kx=$c.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.x,i=t.y,a=t.width/5*3,r=Math.max(a,t.height),o=a/2,s=o*o/(r-o),l=i-r+o+s,p=Math.asin(s/o),c=Math.cos(p)*o,d=Math.sin(p),u=Math.cos(p),m=.6*o,h=.7*o;e.moveTo(n-c,l+s),e.arc(n,l,o,Math.PI-p,2*Math.PI+p),e.bezierCurveTo(n+c-d*m,l+s+u*m,n,i-h,n,i),e.bezierCurveTo(n,i-h,n-c+d*m,l+s+u*m,n-c,l+s),e.closePath()}}),Yx=$c.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(e,t){var n=t.height,i=t.width,a=t.x,r=t.y,o=i/3*2;e.moveTo(a,r),e.lineTo(a+o,r+n),e.lineTo(a,r+n/4*3),e.lineTo(a-o,r+n),e.lineTo(a,r),e.closePath()}}),Xx={line:function(e,t,n,i,a){a.x1=e,a.y1=t+i/2,a.x2=e+n,a.y2=t+i/2},rect:function(e,t,n,i,a){a.x=e,a.y=t,a.width=n,a.height=i},roundRect:function(e,t,n,i,a){a.x=e,a.y=t,a.width=n,a.height=i,a.r=Math.min(n,i)/4},square:function(e,t,n,i,a){var r=Math.min(n,i);a.x=e,a.y=t,a.width=r,a.height=r},circle:function(e,t,n,i,a){a.cx=e+n/2,a.cy=t+i/2,a.r=Math.min(n,i)/2},diamond:function(e,t,n,i,a){a.cx=e+n/2,a.cy=t+i/2,a.width=n,a.height=i},pin:function(e,t,n,i,a){a.x=e+n/2,a.y=t+i/2,a.width=n,a.height=i},arrow:function(e,t,n,i,a){a.x=e+n/2,a.y=t+i/2,a.width=n,a.height=i},triangle:function(e,t,n,i,a){a.cx=e+n/2,a.cy=t+i/2,a.width=n,a.height=i}},Zx={};Ar({line:lh,rect:rd,roundRect:rd,square:rd,circle:Rm,diamond:$x,pin:Kx,arrow:Yx,triangle:Wx},(function(e,t){Zx[t]=new e}));var Qx=$c.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(e,t,n){var i=us(e,t,n),a=this.shape;return a&&"pin"===a.symbolType&&"inside"===t.position&&(i.y=n.y+.4*n.height),i},buildPath:function(e,t,n){var i=t.symbolType;if("none"!==i){var a=Zx[i];a||(a=Zx[i="rect"]),Xx[i](t.x,t.y,t.width,t.height,a.shape),a.buildPath(e,a.shape,n)}}});function Jx(e,t){if("image"!==this.type){var n=this.style;this.__isEmptyBrush?(n.stroke=e,n.fill=t||"#fff",n.lineWidth=2):"line"===this.shape.symbolType?n.stroke=e:n.fill=e,this.markRedraw()}}function eb(e,t,n,i,a,r,o){var s,l=0===e.indexOf("empty");return l&&(e=e.substr(5,1).toLowerCase()+e.substr(6)),(s=0===e.indexOf("image://")?Uh(e.slice(8),new is(t,n,i,a),o?"center":"cover"):0===e.indexOf("path://")?zh(e.slice(7),{},new is(t,n,i,a),o?"center":"cover"):new Qx({shape:{symbolType:e,x:t,y:n,width:i,height:a}})).__isEmptyBrush=l,s.setColor=Jx,r&&s.setColor(r),s}function tb(e){return qr(e)||(e=[+e,+e]),[e[0]||0,e[1]||0]}function nb(e,t){if(null!=e)return qr(e)||(e=[e,e]),[Cd(e[0],t[0])||0,Cd(Jr(e[1],e[0]),t[1])||0]}var ib=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return ze(t,e),t.prototype.getInitialData=function(e){return My(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new Am,n=eb("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=eb(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}(Lx);function ab(e,t){var n=e.mapDimensionsAll("defaultedLabel"),i=n.length;if(1===i){var a=kf(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 ob=function(e){function t(t,n,i,a){var r=e.call(this)||this;return r.updateData(t,n,i,a),r}return ze(t,e),t.prototype._createSymbol=function(e,t,n,i,a){this.removeAll();var r=eb(e,-1,-1,2,2,null,a);r.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),r.drift=sb,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(){Hu(this.childAt(0))},t.prototype.downplay=function(){Wu(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):kh(u,d,o,n),Rh(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,Ph(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=mg(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=nb(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 Qc){var S=h.style;h.useStyle(Mr({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else h.__isEmptyBrush?h.useStyle(Mr({},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;ug(h,d,{labelFetcher:g,labelDataIndex:t,defaultText:function(t){return T?e.getName(t):ab(e,t)},inheritColor:w,defaultOpacity:b.opacity}),this._sizeX=n[0]/2,this._sizeY=n[1]/2;var I=h.ensureState("emphasis");I.style=r,h.ensureState("select").style=s,h.ensureState("blur").style=o;var E=null==u||!0===u?Math.max(1.1,3/this._sizeY):isFinite(u)&&u>0?+u:1;I.scaleX=this._sizeX*E,I.scaleY=this._sizeY*E,this.setSymbolScale(1),rm(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=fu(this).dataIndex,r=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var o=i.getTextContent();o&&Oh(o,{style:{opacity:0}},t,{dataIndex:a,removeOpt:r,cb:function(){i.removeTextContent()}})}else i.removeTextContent();Oh(i,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:a,cb:e,removeOpt:r})},t.getSymbolSize=function(e,t){return tb(e.getItemVisual(t,"symbolSize"))},t}(Am);function sb(e,t){this.parent.drift(e,t)}function lb(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 pb(e){return null==e||Hr(e)||(e={isIgnore:e}),e||{}}function cb(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:mg(t),cursorStyle:t.get("cursor")}}var db=function(){function e(e){this.group=new Am,this._SymbolCtor=e||ob}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=pb(t);var n=this.group,i=e.hostModel,a=this._data,r=this._SymbolCtor,o=t.disableAnimation,s=cb(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(lb(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(lb(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):kh(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=cb(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=pb(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=Fr(e.dimensions,(function(e){return t.mapDimension(e)})),u=!1,m=t.getCalculationInfo("stackResultDimension");return Iy(t,d[0])&&(u=!0,d[0]=m),Iy(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 mb(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 hb="undefined"!=typeof Float32Array,gb=hb?Float32Array:Array;function fb(e){return qr(e)?hb?new Float32Array(e):e:new gb(e)}var yb=Math.min,vb=Math.max;function xb(e,t){return isNaN(e)||isNaN(t)}function bb(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(xb(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||xb(S,C))m=y,h=v;else{I=S-p,E=C-c;var P=y-p,D=S-y,O=v-c,A=C-v,F=void 0,R=void 0;if("x"===s){var B=I>0?1:-1;m=y-B*(F=Math.abs(P))*o,h=v,M=y+B*(R=Math.abs(D))*o,k=v}else if("y"===s){var N=E>0?1:-1;m=y,h=v-N*(F=Math.abs(O))*o,M=y,k=v+N*(R=Math.abs(A))*o}else F=Math.sqrt(P*P+O*O),m=y-I*o*(1-(T=(R=Math.sqrt(D*D+A*A))/(R+F))),h=v-E*o*(1-T),k=v+E*o*T,M=yb(M=y+I*o*T,vb(S,y)),k=yb(k,vb(C,v)),M=vb(M,yb(S,y)),h=v-(E=(k=vb(k,yb(C,v)))-v)*F/R,m=yb(m=y-(I=M-y)*F/R,vb(p,y)),h=yb(h,vb(c,v)),M=y+(I=y-(m=vb(m,yb(p,y))))*R/F,k=v+(E=v-(h=vb(h,yb(c,v))))*R/F}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 wb=function(){this.smooth=0,this.smoothConstraint=!0},Sb=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polyline",n}return ze(t,e),t.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},t.prototype.getDefaultShape=function(){return new wb},t.prototype.buildPath=function(e,t){var n=t.points,i=0,a=n.length/2;if(t.connectNulls){for(;a>0&&xb(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?ul(n,p,d,m,e,s):ul(i,c,u,h,e,s);if(y>0)for(var v=0;v=0){f=o?cl(i,c,u,h,x):cl(n,p,d,m,x);return o?[e,f]:[f,e]}}n=m,i=h}}},t}($c),Cb=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t}(wb),_b=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polygon",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new Cb},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&&xb(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=Fr(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:zl((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";Ar(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 yh(0,0,0,0,u,!0);return y[a]=h,y[a+"2"]=g,y}}}function jb(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 Ar(r.getViewLabels(),(function(e){var t=r.scale.getRawOrdinalNumber(e.tickValue);s[t]=1})),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function Hb(e,t){return[e[2*t],e[2*t+1]]}function Wb(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);fu(m).seriesIndex=e.seriesIndex,rm(m,P,D,O);var A=Gb(e.get("smooth")),F=e.get("smoothMonotone");if(m.setShape({smooth:A,smoothMonotone:F,connectNulls:S}),h){var R=o.getCalculationInfo("stackedOnSeries"),B=0;h.useStyle(kr(l.getAreaStyle(),{fill:E,opacity:.7,lineJoin:"bevel",decal:o.getVisual("style").decal})),R&&(B=Gb(R.get("smooth"))),h.setShape({smooth:A,stackedOnSmooth:B,smoothMonotone:F,connectNulls:S}),pm(h,e,"areaStyle"),fu(h).seriesIndex=e.seriesIndex,rm(h,P,D,O)}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=I,this._valueOrigin=v,e.get("triggerLineEvent")&&(this.packEventData(e,m),h&&this.packEventData(e,h))},t.prototype.packEventData=function(e,t){fu(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=ru(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 ob(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 Mb.prototype.highlight.call(this,e,t,n,i)},t.prototype.downplay=function(e,t,n,i){var a=e.getData(),r=ru(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 Mb.prototype.downplay.call(this,e,t,n,i)},t.prototype._changePolyState=function(e){var t=this._polygon;qu(this._polyline,e),t&&qu(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new Sb({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 _b({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");Gr(l)&&(l=l(null));var p=s.get("animationDelay")||0,c=Gr(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=Gr(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(Wb(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 ld({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&&(ug(r,mg(e,"endLabel"),{inheritColor:n,labelFetcher:e,labelDataIndex:l,defaultText:function(e,t,n){return null!=n?rb(a,n):ab(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 I=Hb(p,C[0]);s.attr({x:I[0]+x,y:I[1]+b}),a&&(T=c.getRawValue(C[0]))}else{(I=l.getPointOn(v,w))&&s.attr({x:I[0]+x,y:I[1]+b});var E=c.getRawValue(C[0]),M=c.getRawValue(C[1]);a&&(T=gu(n,u,E,M,S.t))}i.lastFrameIndex=C[0]}else{var k=1===e||i.lastFrameIndex>0?C[0]:0;I=Hb(p,k);a&&(T=c.getRawValue(k)),s.attr({x:I[0]+x,y:I[1]+b})}if(a){var P=wg(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=ub(a,t,o),f=e.getLayout("points")||[],y=t.getLayout("points")||[],v=0;v3e3||l&&qb(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(),kh(s,g,p),l&&(l.setShape({points:d,stackedOnPoints:u}),l.stopAnimation(),kh(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]}},Zb=function(e){return Math.round(e.length/2)};function Qb(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;zr(a)?m=Xb[a]:Gr(a)&&(m=a),m&&e.setData(i.downSample(i.mapDimension(l.dim),1/u,m,Zb))}}}}}function Jb(e){e.registerChartView(Kb),e.registerSeriesModel(ib),e.registerLayout(Yb("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,Qb("line"))}var ew="__ec_stack_";function tw(e){return e.get("stack")||ew+e.seriesIndex}function nw(e){return e.dim+e.index}function iw(e,t){var n=[];return t.eachSeriesByType(e,(function(e){lw(e)&&n.push(e)})),n}function aw(e){var t=function(e){var t={};Ar(e,(function(e){var n=e.coordinateSystem.getBaseAxis();if("time"===n.type||"value"===n.type)for(var i=e.getData(),a=n.dim+"_"+n.index,r=i.getDimensionIndex(i.mapDimension(n.dim)),o=i.getStore(),s=0,l=o.count();s0&&(r=null===r?s:Math.min(r,s))}n[i]=r}}return n}(e),n=[];return Ar(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=Cd(e.get("barWidth"),i),m=Cd(e.get("barMaxWidth"),i),h=Cd(e.get("barMinWidth")||(pw(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:nw(a),stackId:tw(e)})})),rw(n)}function rw(e){var t={};Ar(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 Ar(t,(function(e,t){n[t]={};var i=e.stacks,a=e.bandWidth,r=e.categoryGap;if(null==r){var o=Nr(i).length;r=Math.max(35-4*o,15)+"%"}var s=Cd(r,a),l=Cd(e.gap,1),p=e.remainedWidth,c=e.autoWidthCount,d=(p-s)/(c+(c-1)*l);d=Math.max(d,0),Ar(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;Ar(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;Ar(i,(function(e,i){n[t][i]=n[t][i]||{bandWidth:a,offset:h,width:e.width},h+=e.width*(1+l)}))})),n}function ow(e,t){var n=iw(e,t),i=aw(n);Ar(n,(function(e){var t=e.getData(),n=e.coordinateSystem.getBaseAxis(),a=tw(e),r=i[nw(n)][a],o=r.offset,s=r.width;t.setLayout({bandWidth:r.bandWidth,offset:o,size:s})}))}function sw(e){return{seriesType:e,plan:Tb(),reset:function(e){if(lw(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=Iy(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=pw(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&&fb(3*a),p=m&&s&&fb(3*a),v=m&&fb(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,I=void 0;c&&(I=+C-w.get(r,i));var E=void 0,M=void 0,k=void 0,P=void 0;if(d){var D=n.dataToPoint([C,_]);if(c)T=n.dataToPoint([I,_])[0];E=T,M=D[1]+y,k=D[0]-T,P=f,Math.abs(k)s){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}(Lx);Lx.registerClass(cw);var dw=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.getInitialData=function(){return My(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=Dy(cw.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}(cw),uw="\0__throttleOriginMethod",mw="\0__throttleRate",hw="\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 fw(e,t,n,i){var a=e[t];if(a){var r=a[uw]||a,o=a[hw];if(a[mw]!==n||o!==i){if(null==n||!i)return e[t]=r;(a=e[t]=gw(r,n,"debounce"===i))[uw]=r,a[hw]=i,a[mw]=n}return a}}function yw(e,t){var n=e[t];n&&n[uw]&&(n.clear&&n.clear(),e[t]=n[uw])}var vw=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},xw=function(e){function t(t){var n=e.call(this,t)||this;return n.type="sausage",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new vw},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){Fh(t,e,fu(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}(Mb),Iw={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=Cw(t.x,e.x),s=_w(t.x+t.width,a),l=Cw(t.y,e.y),p=_w(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=_w(t.r,e.r),r=Cw(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}},Ew={cartesian2d:function(e,t,n,i,a,r,o,s,l){var p=new rd({shape:Mr({},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?xw:Qm,c=new p({shape:i,z2:1});c.name="item";var d,u,m=Fw(a);if(c.calculateTextPosition=(d=m,u=({isRoundCap:p===xw}||{}).isRoundCap,function(e,t,n){var i=t.position;if(!i||i instanceof Array)return us(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)+bw(h,r+y,!1),w=l+m*x(h)+ww(h,r+y,!1),S="right",C="middle";break;case"insideStartAngle":b=s+m*v(h)+bw(h,-r+y,!1),w=l+m*x(h)+ww(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)+bw(g,r+y,!0),w=l+m*x(g)+ww(g,r+y,!0),S="left",C="middle";break;case"insideEndAngle":b=s+m*v(g)+bw(g,-r+y,!0),w=l+m*x(g)+ww(g,-r+y,!0),S="right",C="middle";break;default:return us(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?kh:Ph)(c,{shape:g},r)}return c}};function Mw(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?kh:Ph)(n,{shape:l},t,a,null),(o?kh:Ph)(n,{shape:p},t?e.baseAxis.model:null,a)}function kw(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 Fw(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 Rw(e,t,n,i,a,r,o,s){var l=t.getItemVisual(n,"style");if(s){if(!r.get("roundCap")){var p=e.shape;Mr(p,Sw(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=mg(i);ug(e,m,{labelFetcher:r,labelDataIndex:n,defaultText:ab(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(jr(i))e.setTextConfig({rotation:i});else if(qr(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,Fw(o),i.get(["label","rotate"]))}Sg(h,m,r.getRawValue(n),(function(e){return rb(t,e)}));var f=i.getModel(["emphasis"]);rm(e,f.get("focus"),f.get("blurScope"),f.get("disabled")),pm(e,i),function(e){return null!=e.startAngle&&null!=e.endAngle&&e.startAngle===e.endAngle}(a)&&(e.style.fill="none",e.style.stroke="none",Ar(e.states,(function(e){e.style&&(e.style.fill=e.style.stroke="none")})))}var Bw=function(){},Nw=function(e){function t(t){var n=e.call(this,t)||this;return n.type="largeBar",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new Bw},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);fu(this).dataIndex=t>=0?t:null}),30,!1);function qw(e,t,n){if(Nb(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 Gw(e){e.registerChartView(Tw),e.registerSeriesModel(dw),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,Vr(ow,"bar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,sw("bar")),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,Qb("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)}))}))}function zw(e,t){function n(t,n){var i=[];return t.eachComponent({mainType:"series",subType:e,query:n},(function(e){i.push(e.seriesIndex)})),i}Ar([[e+"ToggleSelect","toggleSelect"],[e+"Select","select"],[e+"UnSelect","unselect"]],(function(e){t(e[0],(function(t,i,a){t=Mr({},t),a.dispatchAction(Mr(t,{type:e[1],seriesIndex:n(i,t)}))}))}))}function Uw(e,t,n,i,a){var r=e+t;n.isSilent(r)||i.eachComponent({mainType:"series",subType:"pie"},(function(e){for(var t=e.seriesIndex,i=e.option.selectedMap,o=a.selected,s=0;si?c=r=E+w*i/2:(r=E+C,c=a-C),t.setItemLayout(n,{angle:i,startAngle:r,endAngle:c,clockwise:y,cx:o,cy:s,r0:p,r:v?Sd(e,b,[p,l]):l}),E=a}})),Ta&&(a+=Xw);var m=Math.atan2(s,o);if(m<0&&(m+=Xw),m>=i&&m<=a||m+Xw>=i&&m+Xw<=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,oS.fromArray(e[0]),sS.fromArray(e[1]),lS.fromArray(e[2]),Ko.sub(pS,oS,sS),Ko.sub(cS,lS,sS);var n=pS.len(),i=cS.len();if(!(n<.001||i<.001)){pS.scale(1/n),cS.scale(1/i);var a=pS.dot(cS);if(Math.cos(t)1&&Ko.copy(mS,lS),mS.toArray(e[1])}}}}function gS(e,t,n){if(n<=180&&n>0){n=n/180*Math.PI,oS.fromArray(e[0]),sS.fromArray(e[1]),lS.fromArray(e[2]),Ko.sub(pS,sS,oS),Ko.sub(cS,lS,sS);var i=pS.len(),a=cS.len();if(!(i<.001||a<.001))if(pS.scale(1/i),cS.scale(1/a),pS.dot(t)=o)Ko.copy(mS,lS);else{mS.scaleAndAdd(cS,r/Math.tan(Math.PI/2-s));var l=lS.x!==sS.x?(mS.x-sS.x)/(lS.x-sS.x):(mS.y-sS.y)/(lS.y-sS.y);if(isNaN(l))return;l<0?Ko.copy(mS,sS):l>1&&Ko.copy(mS,lS)}mS.toArray(e[1])}}}function fS(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 yS(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=Bs(i[0],i[1]),r=Bs(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=Ls([],i[1],i[0],o/a),l=Ls([],i[1],i[2],o/r),p=Ls([],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 SS(e,t,n,i){return wS(e,"y","height",t,n,i)}function CS(e){var t=[];e.sort((function(e,t){return t.priority-e.priority}));var n=new is(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;an?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 ES(e){return"center"===e.position}function MS(e){var t,n,i=e.getData(),a=[],r=!1,o=(e.get("minShowLabelAngle")||0)*_S,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=Cd(f.get("edgeDistance"),p),w=f.get("bleedMargin"),S=g.getModel("labelLine"),C=S.get("length");C=Cd(C,p);var _=S.get("length2");if(_=Cd(_,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(jr(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=I,u.rotation=V,u.setStyle({verticalAlign:"middle"}),O){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 Ko(P,D),linePoints:E,textAlign:M,labelDistance:v,labelAlignTo:x,edgeDistance:b,bleedMargin:w,rect:U,unconstrainedWidth:U.width,labelStyleWidth:u.style.width})}s.setTextConfig({inside:O})}})),!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}(Mb);function DS(e,t,n){t=qr(t)&&{coordDimensions:t}||Mr({encodeDefine:e.getEncode()},t);var i=e.getSource(),a=vy(i,t).dimensions,r=new yy(a,e);return r.initData(i,n),r}var OS=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}(),AS=ou(),FS=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new OS(Lr(this.getData,this),Lr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return DS(this,{coordDimensions:["value"],encodeDefaulter:Vr(ef,this)})},t.prototype.getDataParams=function(t){var n=this.getData(),i=AS(n),a=i.seats;if(!a){var r=[];n.each(n.mapDimension("value"),(function(e){r.push(e)})),a=i.seats=kd(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){Yd(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}(Lx);function RS(e){e.registerChartView(PS),e.registerSeriesModel(FS),zw("pie",e.registerAction),e.registerLayout(Vr(Kw,"pie")),e.registerProcessor(Yw("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!(jr(i)&&!isNaN(i)&&i<0)}))}}}("pie"))}var BS=function(e,t){this.target=e,this.topTarget=t&&t.topTarget},NS=function(){function e(e){this.handler=e,e.on("mousedown",this._dragStart,this),e.on("mousemove",this._drag,this),e.on("mouseup",this._dragEnd,this)}return e.prototype._dragStart=function(e){for(var t=e.target;t&&!t.draggable;)t=t.parent||t.__hostTarget;t&&(this._draggingTarget=t,t.dragging=!0,this._x=e.offsetX,this._y=e.offsetY,this.handler.dispatchToElement(new BS(t,e),"dragstart",e.event))},e.prototype._drag=function(e){var t=this._draggingTarget;if(t){var n=e.offsetX,i=e.offsetY,a=n-this._x,r=i-this._y;this._x=n,this._y=i,t.drift(a,r,e),this.handler.dispatchToElement(new BS(t,e),"drag",e.event);var o=this.handler.findHover(n,i,t).target,s=this._dropTarget;this._dropTarget=o,t!==o&&(s&&o!==s&&this.handler.dispatchToElement(new BS(s,e),"dragleave",e.event),o&&o!==s&&this.handler.dispatchToElement(new BS(o,e),"dragenter",e.event))}},e.prototype._dragEnd=function(e){var t=this._draggingTarget;t&&(t.dragging=!1),this.handler.dispatchToElement(new BS(t,e),"dragend",e.event),this._dropTarget&&this.handler.dispatchToElement(new BS(this._dropTarget,e),"drop",e.event),this._draggingTarget=null,this._dropTarget=null},e}(),LS=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,VS=[],qS=bo.browser.firefox&&+bo.browser.version.split(".")[0]<39;function GS(e,t,n,i){return n=n||{},i?zS(e,t,n):qS&&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):zS(e,t,n),n}function zS(e,t,n){if(bo.domSupported&&e.getBoundingClientRect){var i=t.clientX,a=t.clientY;if(Ly(e)){var r=e.getBoundingClientRect();return n.zrX=i-r.left,void(n.zrY=a-r.top)}if(Ny(VS,e,i,a))return n.zrX=VS[0],void(n.zrY=VS[1])}n.zrX=n.zrY=0}function US(e){return e||window.event}function jS(e,t,n){if(null!=(t=US(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&&GS(e,a,t,n)}else{GS(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&&LS.test(t.type)&&(t.which=1&o?1:2&o?3:4&o?2:0),t}function HS(e,t,n,i){e.addEventListener(t,n,i)}var WS=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function $S(e){return 2===e.which||3===e.which}var KS=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=YS(a)/YS(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}}}}},ZS="silent";function QS(){WS(this.event)}var JS=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handler=null,t}return ze(t,e),t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(Tp),eC=function(e,t){this.x=e,this.y=t},tC=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],nC=new is(0,0,0,0),iC=function(e){function t(t,n,i,a,r){var o=e.call(this)||this;return o._hovered=new eC(0,0),o.storage=t,o.painter=n,o.painterRoot=a,o._pointerSize=r,i=i||new JS,o.proxy=null,o.setHandlerProxy(i),o._draggingMgr=new NS(o),o}return ze(t,e),t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(Ar(tC,(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=oC(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 eC(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 eC(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:QS}}(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 eC(e,t);if(rC(i,a,e,t,n),this._pointerSize&&!a.target){for(var r=[],o=this._pointerSize,s=o/2,l=new is(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||(nC.copy(c.getBoundingRect()),c.transform&&nC.applyTransform(c.transform),nC.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=aC(o,n,i))&&(!t.topTarget&&(t.topTarget=o),s!==ZS)){t.target=o;break}}}function oC(e,t,n){var i=e.painter;return t<0||t>i.getWidth()||n<0||n>i.getHeight()}Ar(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(e){iC.prototype[e]=function(t){var n,i,a=t.zrX,r=t.zrY,o=oC(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||Bs(this._downPoint,[t.zrX,t.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,e,t)}}));function sC(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 lC(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 pC(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 cC(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 dC(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=cC(e[c],e,l,p,0,t);l+=u,0!==(p-=u)&&0!==(d=pC(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-pC(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=sC(e,n,i,t))s&&(l=s),lC(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 mC=!1;function hC(){mC||(mC=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function gC(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var fC=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=gC}return e.prototype.traverse=function(e,t){for(var n=0;n0&&(p.__clipPaths=[]),isNaN(p.z)&&(hC(),p.z=0),isNaN(p.z2)&&(hC(),p.z2=0),isNaN(p.zlevel)&&(hC(),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}(),yC=bo.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};function vC(){return(new Date).getTime()}var xC,bC,wC=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 ze(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=vC()-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,yC((function t(){e._running&&(yC(t),!e._paused&&e.update())}))},t.prototype.start=function(){this._running||(this._time=vC(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=vC(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=vC()-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 _p(e,t.loop);return this.addAnimator(n),n},t}(Tp),SC=bo.domSupported,CC=(bC={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:xC=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:Fr(xC,(function(e){var t=e.replace("mouse","pointer");return bC.hasOwnProperty(t)?t:e}))}),_C=["mousemove","mouseup"],TC=["pointermove","pointerup"],IC=!1;function EC(e){var t=e.pointerType;return"pen"===t||"touch"===t}function MC(e){e&&(e.zrByTouch=!0)}function kC(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 PC=function(e,t){this.stopPropagation=yo,this.stopImmediatePropagation=yo,this.preventDefault=yo,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY},DC={mousedown:function(e){e=jS(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=jS(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=jS(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){kC(this,(e=jS(this.dom,e)).toElement||e.relatedTarget)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){IC=!0,e=jS(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){IC||(e=jS(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){MC(e=jS(this.dom,e)),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),DC.mousemove.call(this,e),DC.mousedown.call(this,e)},touchmove:function(e){MC(e=jS(this.dom,e)),this.handler.processGesture(e,"change"),DC.mousemove.call(this,e)},touchend:function(e){MC(e=jS(this.dom,e)),this.handler.processGesture(e,"end"),DC.mouseup.call(this,e),+new Date-+this.__lastTouchMoment<300&&DC.click.call(this,e)},pointerdown:function(e){DC.mousedown.call(this,e)},pointermove:function(e){EC(e)||DC.mousemove.call(this,e)},pointerup:function(e){DC.mouseup.call(this,e)},pointerout:function(e){EC(e)||DC.mouseout.call(this,e)}};Ar(["click","dblclick","contextmenu"],(function(e){DC[e]=function(t){t=jS(this.dom,t),this.trigger(e,t)}}));var OC={pointermove:function(e){EC(e)||OC.mousemove.call(this,e)},pointerup:function(e){OC.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 AC(e,t){var n=t.domHandlers;bo.pointerEventsSupported?Ar(CC.pointer,(function(i){RC(t,i,(function(t){n[i].call(e,t)}))})):(bo.touchEventsSupported&&Ar(CC.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)}))})),Ar(CC.mouse,(function(i){RC(t,i,(function(a){a=US(a),t.touching||n[i].call(e,a)}))})))}function FC(e,t){function n(n){RC(t,n,(function(i){i=US(i),kC(e,i.target)||(i=function(e,t){return jS(e.dom,new PC(e,t),!0)}(e,i),t.domHandlers[n].call(e,i))}),{capture:!0})}bo.pointerEventsSupported?Ar(TC,n):bo.touchEventsSupported||Ar(_C,n)}function RC(e,t,n,i){e.mounted[t]=n,e.listenerOpts[t]=i,HS(e.domTarget,t,n,i)}function BC(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 NC=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 NC(t,DC),SC&&(i._globalHandlerScope=new NC(document,OC)),AC(i,i._localHandlerScope),i}return ze(t,e),t.prototype.dispose=function(){BC(this._localHandlerScope),SC&&BC(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,SC&&+this.__pointerCapturing^+e){this.__pointerCapturing=e;var t=this._globalHandlerScope;e?FC(this,t):BC(t)}},t}(Tp),VC={},qC={};var GC,zC=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 fC,r=n.renderer||"canvas";VC[r]||(r=Nr(VC)[0]),n.useDirtyRect=null!=n.useDirtyRect&&n.useDirtyRect;var o=new VC[r](t,a,n,e),s=n.ssr||o.ssrOnly;this.storage=a,this.painter=o;var l,p=bo.node||bo.worker||s?null:new LC(o.getViewportRoot(),o.root),c=n.useCoarsePointer;(null==c||"auto"===c?bo.touchEventsSupported:!!c)&&(l=Jr(n.pointerSize,44)),this.handler=new iC(a,o,p,o.root,l),this.animation=new wC({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 Wl(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;t=0;o--)i[o]&&!au(i[o])?r=!0:(i[o]=null,!r&&a--);i.length=a,e[n]=i}})),delete e[ZC],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 s_=Ar,l_=Hr,p_=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function c_(e){var t=e&&e.itemStyle;if(t)for(var n=0,i=p_.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=Pd(m,y),h=y;break}}}return i[0]=m,i[1]=h,i}))}))}var M_=function(){function e(){this.group=new Am,this.uid=Py("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}();_o(M_),ko(M_);var k_=ou(),P_={itemStyle:Po(Ag,!0),lineStyle:Po(Pg,!0)},D_={lineStyle:"stroke",itemStyle:"fill"};function O_(e,t){var n=e.visualStyleMapper||P_[t];return n||(console.warn("Unknown style type '"+t+"'."),P_.itemStyle)}function A_(e,t){var n=e.visualDrawType||D_[t];return n||(console.warn("Unknown style type '"+t+"'."),"fill")}var F_={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=e.getModel(i),r=O_(e,i)(a),o=a.getShallow("decal");o&&(n.setVisual("decal",o),o.dirty=!0);var s=A_(e,i),l=r[s],p=Gr(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||Gr(r.fill)?d:r.fill,r.stroke="auto"===r.stroke||Gr(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=Mr({},r);a[s]=p(i),t.setItemVisual(n,"style",a)}}}},R_=new Bg,B_={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData&&!t.isSeriesFiltered(e)){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=O_(e,i),r=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[i]){R_.option=n[i];var o=a(R_);Mr(e.ensureUniqueItemVisual(t,"style"),o),R_.option.decal&&(e.setItemVisual(t,"decal",R_.option.decal),R_.option.decal.dirty=!0),r in o&&e.setItemVisual(t,"colorFromPalette",!1)}}:null}}}},N_={performRawSeries:!0,overallReset:function(e){var t=uo();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)),k_(e).scope=a}})),e.eachSeries((function(t){if(!t.isColorBySeries()&&!e.isSeriesFiltered(t)){var n=t.getRawData(),i={},a=t.getData(),r=k_(t).scope,o=t.visualStyleAccessPath||"itemStyle",s=A_(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)}}))}}))}},L_=Math.PI;var V_=function(){function e(e,t,n,i){this._stageTaskMap=uo(),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=uo();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;Ar(this._allHandlers,(function(i){var a=e.get(i.uid)||e.set(i.uid,{}),r="";io(!(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))}Ar(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=uo(),s=e.seriesType,l=e.getTargetSeries;function p(t){var s=t.uid,l=o.set(s,r&&r.get(s)||nx({plan:j_,reset:H_,count:K_}));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||nx({reset:q_});r.context={ecModel:n,api:i,overallReset:e.overallReset,scheduler:a};var o=r.agentStubMap,s=r.agentStubMap=uo(),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,nx({reset:G_,onDirty:U_})));n.context={model:e,overallProgress:c},n.agent=r,n.__block=c,a._pipe(e,n)}io(!e.createOnAllSeries,u),l?n.eachRawSeriesByType(l,m):p?p(n,i).each(m):(c=!1,Ar(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 Gr(e)&&(e={overallReset:e,seriesType:Y_(e)}),e.uid=Py("stageHandler"),t&&(e.visualType=t),e},e}();function q_(e){e.overallReset(e.ecModel,e.api,e.payload)}function G_(e){return e.overallProgress&&z_}function z_(){this.agent.dirty(),this.getDownstream().dirty()}function U_(){this.agent&&this.agent.dirty()}function j_(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function H_(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Kd(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?Fr(t,(function(e,t){return $_(t)})):W_}var W_=$_(0);function $_(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}(),lT=["symbol","symbolSize","symbolRotate","symbolOffset"],pT=lT.concat(["symbolKeepAspect"]),cT={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&&xT(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=xT(i)?i:0,a=xT(a)?a:1,r=xT(r)?r:0,o=xT(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]:jr(t)?[t]:qr(t)?t:null:null),r=i.lineDashOffset;if(a){var o=i.strokeNoScale&&e.getLineScale?e.getLineScale():1;o&&1!==o&&(a=Fr(a,(function(e){return e/o})),r/=o)}return[a,r]}var _T=new Ec(!0);function TT(e){var t=e.stroke;return!(null==t||"none"===t||!(e.lineWidth>0))}function IT(e){return"string"==typeof e&&"none"!==e}function ET(e){var t=e.fill;return null!=t&&"none"!==t}function MT(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 kT(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 PT(e,t,n){var i=Lo(t.image,t.__image,n);if(qo(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)*vo),r.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(r)}return a}}var DT=["shadowBlur","shadowOffsetX","shadowOffsetY"],OT=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function AT(e,t,n,i,a){var r=!1;if(!i&&t===(n=n||{}))return!1;if(i||t.opacity!==n.opacity){BT(e,a),r=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?Gp.opacity:o}(i||t.blend!==n.blend)&&(r||(BT(e,a),r=!0),e.globalCompositeOperation=t.blend||Gp.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[JT])if(this._disposed)kI(this.id);else{var i,a,r;if(Hr(t)&&(n=t.lazyUpdate,i=t.silent,a=t.replaceMerge,r=t.transition,t=t.notMerge),this[JT]=!0,!this._model||t){var o=new r_(this._api),s=this._theme,l=this._model=new QC;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:a},AI);var p={seriesTransition:r,optionChanged:!0};if(n)this[eI]={silent:i,updateParams:p},this[JT]=!1,this.getZr().wakeUp();else{try{sI(this),cI.update.call(this,null,p)}catch(e){throw this[eI]=null,this[JT]=!1,e}this._ssr||this._zr.flush(),this[eI]=null,this[JT]=!1,hI.call(this,i),gI.call(this,i)}}},t.prototype.setTheme=function(){Ud()},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||bo.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(bo.svgSupported){var e=this._zr;return Ar(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;Ar(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 Ar(i,(function(e){e.group.ignore=!1})),r}kI(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(LI[n]){var o=r,s=r,l=-1/0,p=-1/0,c=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();Ar(NI,(function(r,d){if(r.group===n){var u=t?r.getZr().painter.getSvgDom().innerHTML:r.renderToCanvas(Tr(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=cr.createCanvas(),g=UC(h,{renderer:t?"svg":"canvas"});if(g.resize({width:u,height:m}),t){var f="";return Ar(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 rd({shape:{x:0,y:0,width:u,height:m},style:{fill:e.connectedBackgroundColor}})),Ar(c,(function(e){var t=new Qc({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)}kI(this.id)},t.prototype.convertToPixel=function(e,t){return dI(this,"convertToPixel",e,t)},t.prototype.convertFromPixel=function(e,t){return dI(this,"convertFromPixel",e,t)},t.prototype.containPixel=function(e,t){var n;if(!this._disposed)return Ar(lu(this._model,e),(function(e,i){i.indexOf("Models")>=0&&Ar(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;kI(this.id)},t.prototype.getVisual=function(e,t){var n=lu(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?uT(a,r,t):mT(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;Ar(MI,(function(e){var t=function(t){var n,a=i.getModel(),r=t.target,o="globalout"===e;if(o?n={}:r&&gT(r,(function(e){var t=fu(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=Mr({},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)})),Ar(DI,(function(e,t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),Ar(["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?(Uw("map","selectchanged",t,i,e),Uw("pie","selectchanged",t,i,e)):"select"===e.fromAction?(Uw("map","selected",t,i,e),Uw("pie","selected",t,i,e)):"unselect"===e.fromAction&&(Uw("map","unselected",t,i,e),Uw("pie","unselected",t,i,e))}))},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?kI(this.id):this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)kI(this.id);else{this._disposed=!0,this.getDom()&&mu(this.getDom(),VI,"");var e=this,t=e._api,n=e._model;Ar(e._componentsViews,(function(e){e.dispose(n,t)})),Ar(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 NI[e.id]}},t.prototype.resize=function(e){if(!this[JT])if(this._disposed)kI(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[eI]&&(null==i&&(i=this[eI].silent),n=!0,this[eI]=null),this[JT]=!0;try{n&&sI(this),cI.update.call(this,{type:"resize",animation:Mr({duration:0},e&&e.animation)})}catch(e){throw this[JT]=!1,e}this[JT]=!1,hI.call(this,i),gI.call(this,i)}}},t.prototype.showLoading=function(e,t){if(this._disposed)kI(this.id);else if(Hr(e)&&(t=e,e=""),e=e||"default",this.hideLoading(),BI[e]){var n=BI[e](this._api,t),i=this._zr;this._loadingFX=n,i.add(n)}},t.prototype.hideLoading=function(){this._disposed?kI(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=Mr({},e);return t.type=DI[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)kI(this.id);else if(Hr(t)||(t={silent:!!t}),PI[e.type]&&this._model)if(this[JT])this._pendingActions.push(e);else{var n=t.silent;mI.call(this,e,n);var i=t.flush;i?this._zr.flush():!1!==i&&bo.browser.weChat&&this._throttledZrFlush(),hI.call(this,n),gI.call(this,n)}},t.prototype.updateLabelLayout=function(){$T.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)kI(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(Dh(e))return;if(e instanceof $c&&function(e){var t=bu(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)}}))}sI=function(e){var t=e._scheduler;t.restorePipelines(e._model),t.prepareStageTasks(),lI(e,!0),lI(e,!1),t.plan()},lI=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")&&!bo.node&&!bo.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),$T.trigger("series:afterupdate",t,i,s)},SI=function(e){e[tI]=!0,e.getZr().wakeUp()},CI=function(e){e[tI]&&(e.getZr().storage.traverse((function(e){Dh(e)||t(e)})),e[tI]=!1)},wI=function(e){return new(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return ze(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){Hu(t,n),SI(e)},n.prototype.leaveEmphasis=function(t,n){Wu(t,n),SI(e)},n.prototype.enterBlur=function(t){$u(t),SI(e)},n.prototype.leaveBlur=function(t){Ku(t),SI(e)},n.prototype.enterSelect=function(t){Yu(t),SI(e)},n.prototype.leaveSelect=function(t){Xu(t),SI(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}(i_))(e)}}(),t}(Tp),EI=II.prototype;EI.on=aI("on"),EI.off=aI("off"),EI.one=function(e,t,n){var i=this;Ud(),this.on.call(this,e,(function n(){for(var a=[],r=0;r=0)){WI.push(n);var r=V_.wrapStageHandler(n,a);r.__prio=t,r.__raw=n,e.push(r)}}function KI(e,t){BI[e]=t}var YI=function(e){var t=(e=Tr(e)).type,n="";t||jd(n);var i=t.split(":");2!==i.length&&jd(n);var a=!1;"echarts"===i[0]&&(t=i[1],a=!0),e.__isBuiltIn=a,cx.set(t,e)};HI(XT,F_),HI(ZT,B_),HI(ZT,N_),HI(XT,cT),HI(ZT,dT),HI(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=UT(n,t))}));var a=i.getVisual("decal");if(a)i.getVisual("style").decal=UT(a,t)}}))})),GI(I_),zI(900,(function(e){var t=uo();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(E_)})),KI("default",(function(e,t){kr(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 Am,i=new rd({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(i);var a,r=new ld({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 rd({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});return n.add(o),t.showSpinner&&((a=new hh({shape:{startAngle:-L_/2,endAngle:-L_/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*L_/2}).start("circularInOut"),a.animateShape(!0).when(1e3,{startAngle:3*L_/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})),jI({type:Tu,event:Tu,update:Tu},yo),jI({type:Iu,event:Iu,update:Iu},yo),jI({type:Eu,event:Eu,update:Eu},yo),jI({type:Mu,event:Mu,update:Mu},yo),jI({type:ku,event:ku,update:ku},yo),qI("light",tT),qI("dark",oT);var XI=[],ZI={registerPreprocessor:GI,registerProcessor:zI,registerPostInit:function(e){UI("afterinit",e)},registerPostUpdate:function(e){UI("afterupdate",e)},registerUpdateLifecycle:UI,registerAction:jI,registerCoordinateSystem:function(e,t){wy.register(e,t)},registerLayout:function(e,t){$I(FI,e,t,1e3,"layout")},registerVisual:HI,registerTransform:YI,registerLoading:KI,registerMap:function(e,t,n){var i=YT("registerMap");i&&i(e,t,n)},registerImpl:function(e,t){KT[e]=t},PRIORITY:QT,ComponentModel:$v,ComponentView:M_,SeriesModel:Lx,ChartView:Mb,registerComponentModel:function(e){$v.registerClass(e)},registerComponentView:function(e){M_.registerClass(e)},registerSeriesModel:function(e){Lx.registerClass(e)},registerChartView:function(e){Mb.registerClass(e)},registerSubTypeDefaulter:function(e,t){$v.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){var n;n=t,VC[e]=n}};function QI(e){qr(e)?Ar(e,(function(e){QI(e)})):Pr(XI,e)>=0||(XI.push(e),Gr(e)&&(e={install:e}),e.install(ZI))}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}ze(t,e),t.prototype.getInitialData=function(e,t){return My(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"}}}(Lx);var JI=function(){},eE=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return ze(t,e),t.prototype.getDefaultShape=function(){return new JI},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}(),nE=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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=Yb("").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 tE:new db,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"}(Mb),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(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}($v)),iE=function(){function e(){}return e.prototype.getNeedCrossZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),aE=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",cu).models[0]},t.type="cartesian2dAxis",t}($v);Dr(aE,iE);var rE={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)"]}}},oE=Ir({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},rE),sE=Ir({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}}},rE),lE={category:oE,value:sE,time:Ir({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},sE),log:kr({logBase:10},sE)},pE=0,cE=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++pE}return e.createByAxisModel=function(t){var n=t.option,i=n.data,a=i&&Fr(i,dE);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(!zr(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=uo(this.categories))},e}();function dE(e){return Hr(e)&&null!=e.value?e.value:e+""}var uE={value:1,category:1,time:1,log:1};function mE(e,t,n,i){Ar(uE,(function(a,r){var o=Ir(Ir({},lE[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 ze(n,e),n.prototype.mergeDefaultAndTheme=function(e,t){var n=zv(this),i=n?jv(e):{};Ir(e,t.getTheme().get(r+"Axis")),Ir(e,this.getDefaultOption()),e.type=hE(e),n&&Uv(e,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=cE.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",hE)}function hE(e){return e.type||(e.data?"category":"value")}var gE=function(){function e(e){this._setting=e||{},this._extent=[1/0,-1/0]}return e.prototype.getSetting=function(e){return this._setting[e]},e.prototype.unionExtent=function(e){var t=this._extent;e[0]t[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}();function fE(e){return"interval"===e.type||"log"===e.type}function yE(e,t,n,i){var a={},r=e[1]-e[0],o=a.interval=Bd(r/t,!0);null!=n&&oi&&(o=a.interval=i);var s=a.intervalPrecision=xE(o);return function(e,t){!isFinite(e[0])&&(e[0]=t[0]),!isFinite(e[1])&&(e[1]=t[1]),bE(e,0,t),bE(e,1,t),e[0]>e[1]&&(e[0]=e[1])}(a.niceTickExtent=[_d(Math.ceil(e[0]/o)*o,s),_d(Math.floor(e[1]/o)*o,s)],e),a}function vE(e){var t=Math.pow(10,Rd(e)),n=e/t;return n?2===n?n=3:3===n?n=5:n*=2:n=1,_d(n*t)}function xE(e){return Id(e)+2}function bE(e,t,n){e[t]=Math.max(Math.min(e[t],n[1]),n[0])}function wE(e,t){return e>=t[0]&&e<=t[1]}function SE(e,t){return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])}function CE(e,t){return e*(t[1]-t[0])+t[0]}ko(gE);var _E=function(e){function t(t){var n=e.call(this,t)||this;n.type="ordinal";var i=n.getSetting("ordinalMeta");return i||(i=new cE({})),qr(i)&&(i=new cE({categories:Fr(i,(function(e){return Hr(e)?e.value:e}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return ze(t,e),t.prototype.parse=function(e){return null==e?NaN:zr(e)?this._ordinalMeta.getOrdinal(e):Math.round(e)},t.prototype.contain=function(e){return wE(e=this.parse(e),this._extent)&&null!=this._ordinalMeta.categories[e]},t.prototype.normalize=function(e){return SE(e=this._getTickNumber(this.parse(e)),this._extent)},t.prototype.scale=function(e){return e=Math.round(CE(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}(gE);gE.registerClass(_E);var TE=_d,IE=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 Gr(i)&&(n._ticksGenerator=i),n}return ze(t,e),t.prototype.parse=function(e){return e},t.prototype.contain=function(e){return wE(e,this._extent)},t.prototype.normalize=function(e){return SE(e,this._extent)},t.prototype.scale=function(e){return CE(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=xE(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:TE(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)for(var s=0;s=0;--s)if(l[p]){r=l[p];break}r=r||o.none}if(qr(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 pv(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=rv,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=Br(Fr(p,(function(e){return Br(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=ME.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 PE(e){return(e/=2592e6)>6?6:e>3?3:e>2?2:1}function DE(e){return(e/=Qy)>12?12:e>6?6:e>3.5?4:e>2?2:1}function OE(e,t){return(e/=t?Zy:Xy)>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function AE(e){return Bd(e,!0)}function FE(e,t,n){var i=new Date(e);switch(sv(t)){case"year":case"month":i[bv(n)](0);case"day":i[wv(n)](1);case"hour":i[Sv(n)](0);case"minute":i[Cv(n)](0);case"second":i[_v(n)](0),i[Tv(n)](0)}return i.getTime()}gE.registerClass(EE);var RE=gE.prototype,BE=IE.prototype,NE=_d,LE=Math.floor,VE=Math.ceil,qE=Math.pow,GE=Math.log,zE=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="log",t.base=10,t._originalScale=new IE,t._interval=0,t}return ze(t,e),t.prototype.getTicks=function(e){var t=this._originalScale,n=this._extent,i=t.getExtent();return Fr(BE.getTicks.call(this,e),(function(e){var t=e.value,a=_d(qE(this.base,t));return a=t===n[0]&&this._fixMin?jE(a,i[0]):a,{value:a=t===n[1]&&this._fixMax?jE(a,i[1]):a}}),this)},t.prototype.setExtent=function(e,t){var n=GE(this.base);e=GE(Math.max(0,e))/n,t=GE(Math.max(0,t))/n,BE.setExtent.call(this,e,t)},t.prototype.getExtent=function(){var e=this.base,t=RE.getExtent.call(this);t[0]=qE(e,t[0]),t[1]=qE(e,t[1]);var n=this._originalScale.getExtent();return this._fixMin&&(t[0]=jE(t[0],n[0])),this._fixMax&&(t[1]=jE(t[1],n[1])),t},t.prototype.unionExtent=function(e){this._originalScale.unionExtent(e);var t=this.base;e[0]=GE(e[0])/GE(t),e[1]=GE(e[1])/GE(t),RE.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,a=(i=n,Math.pow(10,Rd(i)));for(e/n*a<=.5&&(a*=10);!isNaN(a)&&Math.abs(a)<1&&Math.abs(a)>0;)a*=10;var r=[_d(VE(t[0]/a)*a),_d(LE(t[1]/a)*a)];this._interval=a,this._niceExtent=r}},t.prototype.calcNiceExtent=function(e){BE.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 wE(e=GE(e)/GE(this.base),this._extent)},t.prototype.normalize=function(e){return SE(e=GE(e)/GE(this.base),this._extent)},t.prototype.scale=function(e){return e=CE(e,this._extent),qE(this.base,e)},t.type="log",t}(gE),UE=zE.prototype;function jE(e,t){return NE(e,Id(t))}UE.getMinorTicks=BE.getMinorTicks,UE.getLabel=BE.getLabel,gE.registerClass(zE);var HE=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[$E[e]]=t},e.prototype.setDeterminedMinMax=function(e,t){var n=WE[e];this[n]=t},e.prototype.freeze=function(){this.frozen=!0},e}(),WE={min:"_determinedMin",max:"_determinedMax"},$E={min:"_dataMin",max:"_dataMax"};function KE(e,t,n){var i=e.rawExtentInfo;return i||(i=new HE(e,t,n),e.rawExtentInfo=i,i)}function YE(e,t){return null==t?null:Zr(t)?NaN:e.parse(t)}function XE(e,t){var n=e.type,i=KE(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=iw("bar",o),l=!1;if(Ar(s,(function(e){l=l||e.getBaseAxis()===t.axis})),l){var p=aw(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[nw(t)];return null!=i&&null!=n?i[tw(n)]:i}}(i,n.axis);if(void 0===o)return{min:e,max:t};var s=1/0;Ar(o,(function(e){s=Math.min(e.offset,s)}));var l=-1/0;Ar(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 ZE(e,t){var n=t,i=XE(e,n),a=i.extent,r=n.get("splitNumber");e instanceof zE&&(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 QE(e,t){if(t=t||e.get("type"))switch(t){case"category":return new _E({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:[1/0,-1/0]});case"time":return new EE({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});case"value":return new IE({ticksGenerator:e.getTicksGenerator()});default:return new(gE.getClass(t)||IE)}}function JE(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)}):zr(i)?function(t){return function(n){var i=e.scale.getLabel(n);return t.replace("{value}",null!=i?i:"")}}(i):Gr(i)?(t=i,function(n,i){return null!=a&&(i=n.value-a),t(eM(e,n),i,null!=n.level?{level:n.level}:null)}):function(t){return e.scale.getLabel(t)}}function eM(e,t){return"category"===e.type?e.scale.getLabel(t):t.value}function tM(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 is(e.x,e.y,r,o)}function nM(e){var t=e.get("interval");return null==t?"auto":t}function iM(e){return"category"===e.type&&0===nM(e.getLabelModel())}function aM(e,t){var n={};return Ar(e.mapDimensionsAll(t),(function(t){n[Ey(e,t)]=!0})),Nr(n)}var rM=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 Fr(this._dimList,(function(e){return this._axes[e]}),this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Br(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}(),oM=["x","y"];function sM(e){return"interval"===e.type||"time"===e.type}var lM=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=oM,t}return ze(t,e),t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis("x").scale,t=this.getAxis("y").scale;if(sM(e)&&sM(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=$o([],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 is(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 Vs(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 Vs(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 is(i,a,r,o)},t}(rM),pM=ou();function cM(e){return"category"===e.type?function(e){var t=e.getLabelModel(),n=uM(e,t);return!t.get("show")||e.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(e):function(e){var t=e.scale.getTicks(),n=JE(e);return{labels:Fr(t,(function(t,i){return{level:t.level,formattedLabel:n(t,i),rawLabel:e.scale.getLabel(t),tickValue:t.value}}))}}(e)}function dM(e,t){return"category"===e.type?function(e,t){var n,i,a=mM(e,"ticks"),r=nM(t),o=hM(a,r);if(o)return o;t.get("show")&&!e.scale.isBlank()||(n=[]);if(Gr(r))n=yM(e,r,!0);else if("auto"===r){var s=uM(e,e.getLabelModel());i=s.labelCategoryInterval,n=Fr(s.labels,(function(e){return e.tickValue}))}else n=fM(e,i=r,!0);return gM(a,r,{ticks:n,tickCategoryInterval:i})}(e,t):{ticks:Fr(e.scale.getTicks(),(function(e){return e.value}))}}function uM(e,t){var n,i,a=mM(e,"labels"),r=nM(t),o=hM(a,r);return o||(Gr(r)?n=yM(e,r):(i="auto"===r?function(e){var t=pM(e).autoInterval;return null!=t?t:pM(e).autoInterval=e.calculateCategoryInterval()}(e):r,n=fM(e,i)),gM(a,r,{labels:n,labelCategoryInterval:i}))}function mM(e,t){return pM(e)[t]||(pM(e)[t]=[])}function hM(e,t){for(var n=0;n1&&c/l>2&&(p=Math.round(Math.ceil(p/l)*l));var d=iM(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 yM(e,t,n){var i=e.scale,a=JE(e),r=[];return Ar(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 vM=[0,1],xM=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 Md(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&&bM(n=n.slice(),i.count()),Sd(e,vM,n,t)},e.prototype.coordToData=function(e,t){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&bM(n=n.slice(),i.count());var a=Sd(e,n,vM,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=Fr(dM(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;Ar(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=_d(e),t=_d(t),c?e>t:e0&&e<100||(e=5),Fr(this.scale.getMinorTicks(e),(function(e){return Fr(e,(function(e){return{coord:this.dataToCoord(e),tickValue:e}}),this)}),this)},e.prototype.getViewLabels=function(){return cM(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(Gr(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=JE(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=ss(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=pM(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 bM(e,t){var n=(e[1]-e[0])/t/2;e[0]+=n,e[1]-=n}var wM=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 ze(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}(xM);function SM(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),Qr(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 CM(e){return"cartesian2d"===e.get("coordinateSystem")}function _M(e){var t={xAxisModel:null,yAxisModel:null};return Ar(t,(function(n,i){var a=i.replace(/Model$/,""),r=e.getReferringComponents(a,cu).models[0];t[i]=r})),t}var TM=Math.log;function IM(e,t,n){var i=IE.prototype,a=i.getTicks.call(n),r=i.getTicks.call(n,!0),o=a.length-1,s=i.getInterval.call(n),l=XE(e,t),p=l.extent,c=l.fixMin,d=l.fixMax;if("log"===e.type){var u=TM(e.base);p=[TM(p[0])/u,TM(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=vE(h),g=p[1]-h*o;else{e.getTicks().length-1>o&&(h=vE(h));var y=h*o;(g=_d((f=Math.ceil(p[1]/h)*h)-y))<0&&p[0]>=0?(g=0,f=_d(y)):f>0&&p[1]<=0&&(f=0,g=-_d(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 EM=function(){function e(e,t,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=oM,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=Nr(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;fE(s)&&o.get("alignTicks")&&null==o.get("interval")&&null==o.getTicksGenerator()?a.push(l):(ZE(s,o),fE(s)&&!s.isBlank()&&(t=l))}if(a.length){for(;!t&&a.length;){var l;ZE((l=a.pop()).scale,l.model),l.scale.isBlank()||(t=l)}a.length&&t&&Ar(a,(function(e){IM(e.scale,e.model,t.scale)}))}}}this._updateScale(e,this.model),i(n.x),i(n.y);var a={};Ar(n.x,(function(e){kM(n,"y",e,a)})),Ar(n.y,(function(e){kM(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=qv(i,{width:t.getWidth(),height:t.getHeight()});this._rect=r;var o=this._axesList;function s(){Ar(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&&(Ar(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 _E?n.count():(i=n.getTicks()).length;var o,s=e.getLabelModel(),l=JE(e),p=1;a>40&&(p=Math.ceil(a/40));for(var c=0;c0&&i>0||n<0&&i<0)}(e)}var DM=Math.PI,OM=function(){function e(e,t){this.group=new Am,this.opt=t,this.axisModel=e,kr(t,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new Am({x:t.position[0],y:t.position[1],rotation:t.rotation});n.updateTransform(),this._transformGroup=n}return e.prototype.hasBuilder=function(e){return!!AM[e]},e.prototype.add=function(e){AM[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=Dd(t-e);return Od(r)?(a=n>0?"top":"bottom",i="center"):Od(r-DM)?(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}(),AM={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&&(Vs(s,s,o),Vs(l,l,o));var c=Mr({lineCap:"round"},t.getModel(["axisLine","lineStyle"]).getLineStyle()),d=new lh({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:e.strokeContainThreshold||5,silent:!0,z2:1});$h(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"]);zr(u)&&(u=[u,u]),(zr(m)||jr(m))&&(m=[m,m]);var h=nb(t.get(["axisLine","symbolOffset"])||0,m),g=m[0],f=m[1];Ar([{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=eb(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=NM(a.getTicksCoords(),t.transform,l,kr(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,BM(s)?e.labelOffset+l*c:0],h=t.get("nameRotate");null!=h&&(h=h*DM/180),BM(s)?r=OM.innerTextLayout(e.rotation,null!=h?h:e.rotation,l):(r=function(e,t,n,i){var a,r,o=Dd(n-e),s=i[0]>i[1],l="start"===t&&!s||"start"!==t&&s;Od(o-DM/2)?(r=l?"bottom":"top",a="center"):Od(o-1.5*DM)?(r=l?"top":"bottom",a="center"):(r="middle",a=o<1.5*DM&&o>DM/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=Qr(e.nameTruncateMaxWidth,f.maxWidth,o),x=new ld({x:m[0],y:m[1],rotation:r.rotation,silent:OM.isLabelSilent(t),style:hg(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(rg({el:x,componentModel:t,itemName:a}),x.__fullText=a,x.anid="name",t.get("triggerEvent")){var b=OM.makeAxisEventDataBase(t);b.targetType="axisName",b.name=a,fu(x).eventData=b}i.add(x),x.updateTransform(),n.add(x),x.decomposeTransform()}}};function FM(e){e&&(e.ignore=!0)}function RM(e,t){var n=e&&e.getBoundingRect().clone(),i=t&&t.getBoundingRect().clone();if(n&&i){var a=Go([]);return Ho(a,a,-e.rotation),n.applyTransform(Uo([],a,e.getLocalTransform())),i.applyTransform(Uo([],a,t.getLocalTransform())),n.intersect(i)}}function BM(e){return"middle"===e||"center"===e}function NM(e,t,n,i,a){for(var r=[],o=[],s=[],l=0;l=0||e===t}function qM(e){var t=(e.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return t&&t.axesInfo[zM(e)]}function GM(e){return!!e.get(["handle","show"])}function zM(e){return e.type+"||"+e.id}var UM={},jM=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(t,n,i,a){this.axisPointerClass&&function(e){var t=qM(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=GM(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=kr({color:d.color},o));var m=Ir(Tr(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(zr(l)){var h=m.name;m.name=l.replace("{value}",null!=h?h:"")}else Gr(l)&&(m.name=l(m.name,m));var g=new Bg(m,null,this.ecModel);return Dr(g,iE.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:Ir({lineStyle:{color:"#bbb"}},pk.axisLine),axisLabel:ck(pk.axisLabel,!1),axisTick:ck(pk.axisTick,!1),splitLine:ck(pk.splitLine,!0),splitArea:ck(pk.splitArea,!0),indicator:[]},t}($v),uk=["axisLine","axisTickLabel","axisName"],mk=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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;Ar(Fr(t.getIndicatorAxes(),(function(e){var n=e.model.get("showName")?e.name:"";return new OM(e.model,{axisName:n,position:[t.cx,t.cy],rotation:e.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})})),(function(e){Ar(uk,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=qr(c)?c:[c],m=qr(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;Sk(this,"zoom","zoomOnMouseWheel",e,{scale:i>0?s:1/s,originX:r,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(i);Sk(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){xk(this._zr,"globalPan")||Sk(this,"zoom",null,e,{scale:e.pinchScale>1?1.1:1/1.1,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})},t}(Tp);function Sk(e,t,n,i,a){e.pointerChecker&&e.pointerChecker(i,a.originX,a.originY)&&(WS(i.event),Ck(e,t,n,i,a))}function Ck(e,t,n,i,a){a.isAvailableBehavior=Lr(_k,null,n,i),e.trigger(t,a)}function _k(e,t,n){var i=n[e];return!e||i&&(!zr(i)||t.event[i+"Key"])}function Tk(e,t,n){var i=e.target;i.x+=t,i.y+=n,i.dirty()}function Ik(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 Ek,Mk={axisPointer:1,tooltip:1,brush:1};function kk(e,t,n){var i=t.getComponentByElement(e.topTarget),a=i&&i.coordinateSystem;return i&&i!==n&&!Mk.hasOwnProperty(i.mainType)&&a&&a.model!==n}function Pk(e){zr(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 Dk={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"},Ok=Nr(Dk),Ak={"alignment-baseline":"textBaseline","stop-color":"stopColor"},Fk=Nr(Ak),Rk=function(){function e(){this._defs={},this._root=null}return e.prototype.parse=function(e,t){t=t||{};var n=Pk(e);this._defsUsePending=[];var i=new Am;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),Gk(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=Xk(l,{x:0,y:0,width:o,height:s}),!t.ignoreViewBox)){var u=i;(i=new Am).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 rd({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=Ek[s];if(p&&fo(Ek,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=Bk[s];if(u&&fo(Bk,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 Yc({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});Vk(t,n),Gk(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(Ek={g:function(e,t){var n=new Am;return Vk(t,n),Gk(e,n,this._defsUsePending,!1,!1),n},rect:function(e,t){var n=new rd;return Vk(t,n),Gk(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 Rm;return Vk(t,n),Gk(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 lh;return Vk(t,n),Gk(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 Nm;return Vk(t,n),Gk(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=qk(i));var a=new ih({shape:{points:n||[]},silent:!0});return Vk(t,a),Gk(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var n,i=e.getAttribute("points");i&&(n=qk(i));var a=new rh({shape:{points:n||[]},silent:!0});return Vk(t,a),Gk(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var n=new Qc;return Vk(t,n),Gk(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 Am;return Vk(t,o),Gk(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 Am;return Vk(t,o),Gk(e,o,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(r),o},path:function(e,t){var n=Om(e.getAttribute("d")||"");return Vk(t,n),Gk(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}),e}(),Bk={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 yh(t,n,i,a);return Nk(e,r),Lk(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 vh(t,n,i);return Nk(e,a),Lk(e,a),a}};function Nk(e,t){"userSpaceOnUse"===e.getAttribute("gradientUnits")&&(t.global=!0)}function Lk(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={};Yk(n,r,r);var o=r.stopColor||n.getAttribute("stop-color")||"#000000";t.colorStops.push({offset:a,color:o})}n=n.nextSibling}}function Vk(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),kr(t.__inheritedStyle,e.__inheritedStyle))}function qk(e){for(var t=Hk(e),n=[],i=0;i0;r-=2){var o=i[r],s=i[r-1],l=Hk(o);switch(a=a||[1,0,0,1,0,0],s){case"translate":jo(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Wo(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Ho(a,a,-parseFloat(l[0])*$k,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":Uo(a,[1,0,Math.tan(parseFloat(l[0])*$k),1,0,0],a);break;case"skewY":Uo(a,[1,Math.tan(parseFloat(l[0])*$k),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),Yk(e,o,s),i||function(e,t,n){for(var i=0;in&&(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 cP(e,t){return Fr(Br((e=function(e){if(!e.UTF8Encoding)return e;var t=e,n=t.UTF8Scale;return null==n&&(n=1024),Ar(t.features,(function(e){var t=e.geometry,i=t.encodeOffsets,a=t.coordinates;if(i)switch(t.type){case"LineString":t.coordinates=pP(a,i,n);break;case"Polygon":case"MultiLineString":lP(a,i,n);break;case"MultiPolygon":Ar(a,(function(e,t){return lP(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 iP(r[0],r.slice(1)));break;case"MultiPolygon":Ar(i.coordinates,(function(e){e[0]&&a.push(new iP(e[0],e.slice(1)))}));break;case"LineString":a.push(new aP([i.coordinates]));break;case"MultiLineString":a.push(new aP(i.coordinates))}var o=new rP(n[t||"name"],a,n.cp);return o.properties=n,o}))}for(var dP=[126,25],uP="南海诸岛",mP=[[[0,3.5],[7,11.2],[15,11.9],[30,7],[42,.7],[52,.7],[56,7.7],[59,.7],[64,.7],[64,0],[5,0],[0,3.5]],[[13,16.1],[19,14.7],[16,21.7],[11,23.1],[13,16.1]],[[12,32.2],[14,38.5],[15,38.5],[13,32.2],[12,32.2]],[[16,47.6],[12,53.2],[13,53.2],[18,47.6],[16,47.6]],[[6,64.4],[8,70],[9,70],[8,64.4],[6,64.4]],[[23,82.6],[29,79.8],[30,79.8],[25,82.6],[23,82.6]],[[37,70.7],[43,62.3],[44,62.3],[39,70.7],[37,70.7]],[[48,51.1],[51,45.5],[53,45.5],[50,51.1],[48,51.1]],[[51,35],[51,28.7],[53,28.7],[53,35],[51,35]],[[52,22.4],[55,17.5],[56,17.5],[53,22.4],[52,22.4]],[[58,12.6],[62,7],[63,7],[60,12.6],[58,12.6]],[[0,3.5],[0,93.1],[64,93.1],[64,0],[63,0],[63,92.4],[1,92.4],[1,3.5],[0,3.5]]],hP=0;hP0,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=uo(),n=uo(),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;ug(t,mg(i),{labelFetcher:u,labelDataIndex:d,defaultText:n},m);var h=t.getTextContent();if(h&&(IP(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 OP(e,t,n,i,a,r){e.data?e.data.setItemGraphicEl(r,t):fu(t).eventData={componentType:"geo",componentIndex:a.componentIndex,geoIndex:a.componentIndex,name:n,region:i&&i.option||{}}}function AP(e,t,n,i,a){e.data||rg({el:t,componentModel:a,itemName:n,itemTooltipOption:i.get("tooltip")})}function FP(e,t,n,i,a){t.highDownSilentOnTouch=!!a.get("selectedMode");var r=i.getModel("emphasis"),o=r.get("focus");return rm(t,o,r.get("blurScope"),r.get("disabled")),e.isGeo&&function(e,t,n){var i=fu(e);i.componentMainType=t.mainType,i.componentIndex=t.componentIndex,i.componentHighDownName=n}(t,a,n),o}function RP(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(),Ar(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"}}(Lx);var BP=Vs,NP=function(e){function t(t){var n=e.call(this)||this;return n.type="view",n.dimensions=["x","y"],n._roamTransformable=new Ys,n._rawTransformable=new Ys,n.name=t,n}return ze(t,e),t.prototype.setBoundingRect=function(e,t,n,i){return this._rect=new is(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 is(e,t,n,i)},t.prototype._transformTo=function(e,t,n,i){var a=this.getBoundingRect(),r=this._rawTransformable;r.transform=a.calculateTransform(new is(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=[Cd(e[0],t.getWidth()),Cd(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=Vs([],i,e),n=Vs([],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(),zo(this.transform||(this.transform=[]),t.transform||[1,0,0,1,0,0]),this._rawTransform=t.getLocalTransform(),this.invTransform=this.invTransform||[],$o(this.invTransform,this.transform),this.decomposeTransform()},t.prototype.getTransformInfo=function(){var e=this._rawTransformable,t=this._roamTransformable,n=new Ys;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?BP(n,e,i):Is(n,e)},t.prototype.pointToData=function(e){var t=this.invTransform;return t?BP([],e,t):[e[0],e[1]]},t.prototype.convertToPixel=function(e,t,n){var i=LP(t);return i===this?i.dataToPoint(n):null},t.prototype.convertFromPixel=function(e,t,n){var i=LP(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}(Ys);function LP(e){var t=e.seriesModel;return t?t.coordinateSystem:null}var VP={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},qP=["lng","lat"],GP=function(e){function t(t,n,i){var a=e.call(this,t)||this;a.dimensions=qP,a.type="geo",a._nameCoordMap=uo(),a.map=n;var r,o=i.projection,s=wP(n,i.nameMap,i.nameProperty),l=bP(n),p=(a.resourceType=l?l.type:null,a.regions=s.regions),c=VP[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=qv(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"))}Dr(GP,NP);var jP=function(){function e(){this.dimensions=qP}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 GP(r+a,r,Mr({nameMap:e.get("nameMap")},i(e)));o.zoomLimit=e.get("scaleLimit"),n.push(o),e.coordinateSystem=o,o.model=e,o.resize=UP,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)}})),Ar(a,(function(e,a){var r=Fr(e,(function(e){return e.get("nameMap")})),o=new GP(a,a,Mr({nameMap:Er(r)},i(e[0])));o.zoomLimit=Qr.apply(null,Fr(e,(function(e){return e.get("scaleLimit")}))),n.push(o),o.resize=UP,o.resize(e[0],t),Ar(e,(function(e){e.coordinateSystem=o,function(e,t){Ar(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=uo(),o=0;ov.x)||(b-=Math.PI);var C=w?"left":"right",_=s.getModel("label"),T=_.get("rotate"),I=T*(Math.PI/180),E=f.getTextContent();E&&(f.setTextConfig({position:_.get("position")||C,rotation:null==T?-b:I,origin:"center"}),E.setStyle("verticalAlign","middle"))}var M=s.get(["emphasis","focus"]),k="relative"===M?mo(o.getAncestorsIndices(),o.getDescendantIndices()):"ancestor"===M?o.getAncestorsIndices():"descendant"===M?o.getDescendantIndices():null;k&&(fu(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 uh({shape:eD(c,d,u,a,a)})),kh(g,{shape:eD(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(zr(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 mD(e){for(var t=[];e;)(e=e.parentNode)&&t.push(e);return t.reverse()}function hD(e,t){return Pr(mD(e),t)>=0}function gD(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}ze(t,e),t.prototype.getInitialData=function(e){var t={name:e.name,children:e.data},n=e.leaves||{},i=new Bg(n,this,this.ecModel),a=dD.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 Sx("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=gD(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}}(Lx);function fD(e){var t=e.getData().tree,n={};t.eachNode((function(t){for(var i=t;i&&i.depth>1;)i=i.parentNode;var a=Zv(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}ze(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};yD(n);var i=e.levels||[],a=this.designatedVisualItemStyle={},r=new Bg({itemStyle:a},this,t);i=e.levels=function(e,t){var n,i,a=Kd(t.get("color")),r=Kd(t.get(["aria","decal","decals"]));if(!a)return;e=e||[],Ar(e,(function(e){var t=new Bg(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=Fr(i||[],(function(e){return new Bg(e,r,t)}),this),s=dD.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 Sx("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=gD(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(e){this.layoutInfo=this.layoutInfo||{},Mr(this.layoutInfo,e)},t.prototype.mapIdToIndex=function(e){var t=this._idIndexMap;t||(t=this._idIndexMap=uo(),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(){fD(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:[]}}(Lx);function yD(e){var t=0;Ar(e.children,(function(e){yD(e);var n=e.value;qr(n)&&(n=n[0]),t+=n}));var n=e.value;qr(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),qr(e.value)?e.value[0]=n:e.value=n}var vD=function(){function e(e){this.group=new Am,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),Gv(r,c.pos,c.box)}},e.prototype._prepare=function(e,t,n){for(var i=e;i;i=i.parentNode){var a=nu(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=Cd(s.left,c),m=Cd(s.top,d),h=Cd(s.right,c),g=Cd(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=Mv(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,I=_.width,E=_.text;b>x.width&&(b-=I-y,I=y,E=null);var M=new ih({shape:{points:xD(f,0,I,v,C===w.length-1,0===C)},style:kr(n.getItemStyle(),{lineJoin:"bevel"}),textContent:new ld({style:hg(a,{text:E})}),textConfig:{position:"inside"},z2:1e5,onclick:Vr(o,T)});M.disableLabelAnimation=!0,M.getTextContent().ensureState("emphasis").style=hg(r,{text:E}),M.ensureState("emphasis").style=S,rm(M,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(M),bD(M,e,T),f+=I+8}},e.prototype.remove=function(){this.group.removeAll()},e}();function xD(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 bD(e,t,n){fu(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&&gD(n,t)}}var wD=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 is(a.x,a.y,a.width,a.height),o=this.seriesModel.layoutInfo,s=[1,0,0,1,0,0];jo(s,s,[-(t-=o.x),-(n-=o.y)]),Wo(s,s,[e.scale,e.scale]),jo(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&&Fv(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 vD(this.group))).render(e,t,n.node,(function(t){"animating"!==i._state&&(hD(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"}(Mb);var kD=Ar,PD=Hr,DD=-1,OD=function(){function e(t){var n=t.mappingMethod,i=t.type,a=this.option=Tr(t);this.type=i,this.mappingMethod=n,this._normalizeData=zD[n];var r=e.visualHandlers[i];this.applyVisual=r.applyVisual,this.getColorMapper=r.getColorMapper,this._normalizedToVisual=r._normalizedToVisual[n],"piecewise"===n?(AD(a),function(e){var t=e.pieceList;e.hasSpecialVisual=!1,Ar(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(kD(t,(function(e,t){n[e]=t})),!qr(i)){var a=[];Hr(i)?kD(i,(function(e,t){var i=n[t];a[null!=i?i:DD]=e})):a[-1]=i,i=GD(e,a)}for(var r=t.length-1;r>=0;r--)null==i[r]&&(delete n[t[r]],t.pop())}(a):AD(a,!0):(io("linear"!==n||a.dataExtent),AD(a))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return Lr(this._normalizeData,this)},e.listVisualTypes=function(){return Nr(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){Hr(e)?Ar(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,i){var a,r=qr(t)?[]:Hr(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&&kD(e.visualHandlers,(function(e,a){t.hasOwnProperty(a)&&(i[a]=t[a],n=!0)})),n?i:null},e.prepareVisualTypes=function(e){if(qr(e))e=e.slice();else{if(!PD(e))return[];var t=[];kD(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}(Am),fO=function(){function e(e){this.group=new Am,this._LineCtor=e||gO}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=yO(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=yO(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 EO(e,t){var n=[],i=bl,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=[Es(l[0]),Es(l[1])],l[2]&&l.__original.push(Es(l[2])));var d=l.__original;if(null!=l[2]){if(Is(a[0],d[0]),Is(a[1],d[2]),Is(a[2],d[1]),p&&"none"!==p){var u=JD(e.node1),m=IO(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=JD(e.node2),m=IO(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]}Is(l[0],a[0]),Is(l[1],a[2]),Is(l[2],a[1])}else{if(Is(r[0],d[0]),Is(r[1],d[1]),Ps(o,r[1],r[0]),Fs(o,o),p&&"none"!==p){u=JD(e.node1);ks(r[0],r[0],o,u*t)}if(c&&"none"!==c){u=JD(e.node2);ks(r[1],r[1],o,-u*t)}Is(l[0],r[0]),Is(l[1],r[1])}}))}function MO(e){return"view"===e.type}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(e,t){var n=new db,i=new fO,a=this.group;this._controller=new wk(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(MO(a)){var l={x:a.x,y:a.y,scaleX:a.scaleX,scaleY:a.scaleY};this._firstRender?s.attr(l):kh(s,l,e)}EO(e.getGraph(),QD(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),nO(e,"symbolSize",t,[r.offsetX,r.offsetY]),i.updateLayout(e);break;default:p.setItemLayout(n,[a.x,a.y]),ZD(e.getGraph(),e),i.updateLayout(e)}})).on("dragend",(function(){d&&d.setUnfixed(n)})),a.setDraggable(o,!!r.get("cursor")),"adjacency"===r.get(["emphasis","focus"])&&(fu(a).focus=t.getAdjacentDataIndices())}})),p.graph.eachEdge((function(e){var t=e.getGraphicEl(),n=e.getModel().get(["emphasis","focus"]);t&&"adjacency"===n&&(fu(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){aO(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)&&!kk(t,n,e)})),MO(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){Tk(r,t.dx,t.dy),n.dispatchAction({seriesId:e.id,type:"graphRoam",dx:t.dx,dy:t.dy})})).on("zoom",(function(t){Ik(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(),EO(e.getGraph(),QD(e)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):a.disable()},t.prototype._updateNodeAndLinkScale=function(){var e=this._model,t=e.getData(),n=QD(e);t.eachItemGraphicEl((function(e,t){e&&e.setSymbolScale(n)}))},t.prototype.updateLayout=function(e){EO(e.getGraph(),QD(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"}(Mb);function kO(e){return"_EC_"+e}var PO=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[kO(e)]){var i=new DO(e,t);return i.hostGraph=this,this.nodes.push(i),n[kO(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[kO(e)]},e.prototype.addEdge=function(e,t,n){var i=this._nodesMap,a=this._edgesMap;if(jr(e)&&(e=this.nodes[e]),jr(t)&&(t=this.nodes[t]),e instanceof DO||(e=i[kO(e)]),t instanceof DO||(t=i[kO(t)]),e&&t){var r=e.id+"-"+t.id,o=new OO(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 DO&&(e=e.id),t instanceof DO&&(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 DO||(t=this._nodesMap[kO(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 FO(e,t,n,i,a){for(var r=new PO(i),o=0;o "+u)),p++)}var m,h=n.get("coordinateSystem");if("cartesian2d"===h||"polar"===h)m=My(e,n);else{var g=wy.get(h),f=g&&g.dimensions||[];Pr(f,"value")<0&&f.concat(["value"]);var y=vy(e,{coordDimensions:f,encodeDefine:n.getEncode()}).dimensions;(m=new yy(y,n)).initData(e)}var v=new yy(["value"],n);return v.initData(l,s),a&&a(m,v),nD({mainData:m,struct:r,structAttr:"graph",datas:{node:m,edge:v},datasAttr:{node:"data",edge:"edgeData"}}),r.update(),r}Dr(DO,AO("hostGraph","data")),Dr(OO,AO("hostGraph","edgeData"));!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new OS(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),Yd(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){HD(n=this)&&(n.__curvenessList=[],n.__edgeMap={},WD(n));var o=FO(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=Bg.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 Ar(o.edges,(function(e){!function(e,t,n,i){if(HD(n)){var a=$D(e,t,n),r=n.__edgeMap,o=r[KD(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),Sx("nameValue",{name:l.join(" > "),value:a.value,noValue:null==a.value})}return Fx({series:this,dataIndex:e,multipleSeries:t})},t.prototype._updateCategoriesData=function(){var e=Fr(this.option.categories||[],(function(e){return null!=e.value?e:Mr({value:0},e)})),t=new yy(["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"}}}}(Lx);var RO=function(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0},BO=function(e){function t(t){var n=e.call(this,t)||this;return n.type="pointer",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new RO},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}($c);function NO(e,t){var n=null==e?"":e+"";return t&&(zr(t)?n=t.replace("{value}",n):Gr(t)&&(n=t(e))),n}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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:Cd(n[0],t.getWidth()),cy:Cd(n[1],t.getHeight()),r:Cd(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")?xw:Qm,d=p.get("show"),u=p.getModel("lineStyle"),m=u.get("width"),h=[s,l];Ic(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:jr(N)&&(L=N*Math.PI/180),0===L?d.add(new ld({style:hg(x,{text:A,x:R,y:B,verticalAlign:c<-.8?"top":c>.8?"bottom":"middle",align:p<-.4?"left":p>.4?"right":"center"},{inheritColor:F}),silent:!0})):d.add(new ld({style:hg(x,{text:A,x:R,y:B,verticalAlign:"middle",align:"center"},{inheritColor:F}),silent:!0,originX:R,originY:B,rotation:L}))}if(v.get("show")&&P!==b){O=(O=v.get("distance"))?O+l:l;for(var V=0;V<=w;V++){p=Math.cos(_),c=Math.sin(_);var q=new lh({shape:{x1:p*(h-O)+u,y1:c*(h-O)+m,x2:p*(h-C-O)+u,y2:c*(h-C-O)+m},silent:!0,style:M});"auto"===M.stroke&&q.setStyle({stroke:i((P+V/w)/b)}),d.add(q),_+=I}_-=I}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=Cd(r.get("width"),a.r),s=Cd(r.get("length"),a.r),l=e.get(["pointer","icon"]),p=r.get("offsetCenter"),c=Cd(p[0],a.r),d=Cd(p[1],a.r),u=r.get("keepAspect");return(i=l?eb(l,c-o/2,d-s,o,s,null,u):new BO({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")?xw:Qm,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);Ph(i,{rotation:-((isNaN(+n)?w[0]:Sd(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");Ph(a,{shape:{endAngle:Sd(n,b,w,o)}},e),p.add(a),yu(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,kh(s,{rotation:-((isNaN(+i)?w[0]:Sd(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");kh(v,{shape:{endAngle:Sd(i,b,w,x)}},e),p.add(v),yu(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 Qc){var c=s.style;s.useStyle(Mr({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(Sd(f.get(y,e),b,[0,1],!0))),s.z2EmphasisLift=0,pm(s,t),rm(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,pm(d,t),rm(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=eb(a,t.cx-i/2+Cd(r[0],t.r),t.cy-i/2+Cd(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 Am,d=[],u=[],m=e.isAnimationEnabled(),h=e.get(["pointer","showAbove"]);o.diff(this._data).add((function(e){d[e]=new ld({silent:!0}),u[e]=new ld({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 Am,f=i(Sd(r,[l,p],[0,1],!0)),y=n.getModel("title");if(y.get("show")){var v=y.get("offsetCenter"),x=a.cx+Cd(v[0],a.r),b=a.cy+Cd(v[1],a.r);(M=d[t]).attr({z2:h?0:2,style:hg(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+Cd(S[0],a.r),_=a.cy+Cd(S[1],a.r),T=Cd(w.get("width"),a.r),I=Cd(w.get("height"),a.r),E=e.get(["progress","show"])?o.getItemVisual(t,"style").fill:f,M=u[t],k=w.get("formatter");M.attr({z2:h?0:2,style:hg(w,{x:C,y:_,text:NO(r,k),width:isNaN(T)?null:T,height:isNaN(I)?null:I,align:"center",verticalAlign:"middle"},{inheritColor:E})}),Sg(M,{normal:w},r,(function(e){return NO(e,k)})),m&&Cg(M,t,o,e,{getFormattedLabel:function(e,t,n,i,a,o){return NO(o?o.interpolatedValue:r,k)}}),g.add(M)}c.add(g)})),this.group.add(c),this._titleEls=d,this._detailEls=u},t.type="gauge"})(Mb),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath="itemStyle",n}ze(t,e),t.prototype.getInitialData=function(e,t){return DS(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}}}(Lx);var LO=["itemStyle","opacity"],VO=function(e){function t(t,n){var i=e.call(this)||this,a=i,r=new rh,o=new ld;return a.setTextContent(o),i.setTextGuideLine(r),i.updateData(t,n,!0),i}return ze(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(LO);l=null==l?1:l,n||Rh(i),i.useStyle(e.getItemVisual(t,"style")),i.style.lineJoin="round",n?(i.setShape({points:o.points}),i.style.opacity=0,Ph(i,{style:{opacity:l}},a,t)):kh(i,{style:{opacity:l},shape:{points:o.points}},a,t),pm(i,r),this._updateLabel(e,t),rm(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;ug(a,mg(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 Ko(c[0][0],c[0][1]):null},kh(a,{style:{x:s.x,y:s.y}},r,t),a.attr({rotation:s.rotation,originX:s.x,originY:s.y,z2:10}),vS(n,xS(o),{stroke:p})},t}(ih);(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreLabelLineUpdate=!0,n}ze(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 VO(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){Fh(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"})(Mb),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new OS(Lr(this.getData,this),Lr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.getInitialData=function(e,t){return DS(this,{coordDimensions:["value"],encodeDefaulter:Vr(ef,this)})},t.prototype._defaultLabelLine=function(e){Yd(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"}}}}(Lx);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._dataGroup=new Am,n._initialized=!1,n}ze(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=zO(e);if(r.diff(o).add((function(e){UO(GO(r,a,e,l,s),r,e,p)})).update((function(t,n){var i=o.getItemGraphicEl(n),a=qO(r,t,l,s);r.setItemGraphicEl(t,i),kh(i,{shape:{points:a}},e,t),Rh(i),UO(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 rd({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),Ph(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=zO(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&&WO(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 WO(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}ze(t,e),t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(e){var t=this.option;e&&Ir(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){Ar(["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=[];Ar(Br(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}}($v);var $O=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 ze(t,e),t.prototype.isHorizontal=function(){return"horizontal"!==this.coordinateSystem.getModel().get("layout")},t}(xM);function KO(e,t,n,i,a,r){e=e||0;var o=n[1]-n[0];if(null!=a&&(a=XO(a,[0,o])),null!=r&&(r=Math.max(r,null!=a?a:0)),"all"===i){var s=Math.abs(t[1]-t[0]);s=XO(s,[0,o]),a=r=XO(s,[a,r]),i=0}t[0]=XO(t[0],n),t[1]=XO(t[1],n);var l=YO(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]=XO(t[i],d),p=YO(t,i),null!=a&&(p.sign!==l.sign||p.spanr&&(t[1-i]=t[i]+p.sign*r),t}function YO(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 XO(e,t){return Math.min(null!=t[1]?t[1]:1/0,Math.max(null!=t[0]?t[0]:-1/0,e))}var ZO=Ar,QO=Math.min,JO=Math.max,eA=Math.floor,tA=Math.ceil,nA=_d,iA=Math.PI;!function(){function e(e,t,n){this.type="parallel",this._axesMap=uo(),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;ZO(i,(function(e,n){var i=a[n],r=t.getComponent("parallelAxis",i),o=this._axesMap.set(e,new $O(e,QE(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();ZO(this.dimensions,(function(e){var t=this._axesMap.get(e);t.scale.unionExtentFromData(i,i.mapDimension(e)),ZE(t.scale,t.model)}),this)}}),this)},e.prototype.resize=function(e,t){this._rect=qv(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=aA(t.get("axisExpandWidth"),l),d=aA(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=aA(m[1]-m[0],l),m[1]=m[0]+e):(e=aA(c*(d-1),l),(m=[c*(t.get("axisExpandCenter")||eA(p/2))-e/2])[1]=m[0]+e);var h=(s-e)/(p-d);h<3&&(h=0);var g=[eA(nA(m[0]/c,1))+1,tA(nA(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])})),ZO(n,(function(t,n){var r=(i.axisExpandable?oA:rA)(n,i),o={horizontal:{x:r.position,y:i.axisLength},vertical:{x:0,y:r.position}},s={horizontal:iA/2,vertical:0},l=[o[a].x+e.x,o[a].y+e.y],p=s[a],c=[1,0,0,1,0,0];Ho(c,c,p),jo(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=[];Ar(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)?KO(o,i,r,"all"):l="none";else{var u=i[1]-i[0];(i=[JO(0,r[1]*s/u-u/2)])[1]=QO(r[1],i[0]+u),i[0]=i[1]-u}return{axisExpandWindow:i,behavior:l}}}();function aA(e,t){return QO(JO(e,t[0]),t[1])}function rA(e,t){var n=t.layoutLength/(t.axisCount-1);return{position:n*e,axisNameAvailableWidth:n,axisLabelShow:!0}}function oA(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&&IA(e);var l=Tr(s);l.brushType=UA(l.brushType,o),l.panelId=o===lA?null:o.panelId,r=e._creatingCover=vA(e,l),e._covers.push(r)}if(r){var p=WA[UA(e._brushType,o)];r.__brushOption.range=p.getCreatingRange(VA(e,r,e._track)),i&&(xA(e,r),p.updateCommon(e,r)),bA(e,r),a={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&_A(e,t,n)&&IA(e)&&(a={isEnd:i,removeOnClick:!0});return a}function UA(e,t){return"auto"===e?t.defaultBrushType:e}var jA={mousedown:function(e){if(this._dragging)HA(this,e);else if(!e.target||!e.target.draggable){qA(e);var t=this.group.transformCoordToLocal(e.offsetX,e.offsetY);this._creatingCover=null,(this._creatingPanel=_A(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=_A(e,t,n);if(!e._dragging)for(var o=0;o=0&&(r[a[o].depth]=new Bg(a[o],this,t));if(i&&n){var s=FO(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 Sx("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 Sx("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}}(Lx);var nF=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=[];Ar(g,(function(e,t){var n;qr(e)?(n=e.slice(),e.unshift(t)):qr(e.value)?((n=Mr({},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:Of(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:d,type:Of(h),dimsDef:y.slice()}];return DS(this,{coordDimensions:v,dimensionsCount:y.length+1,encodeDefaulter:Vr(Jg,v,this)})},e.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},e}(),iF=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 ze(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}(Lx);Dr(iF,nF,!0);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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=oF(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?(Rh(n),sF(s,n,i,e)):n=oF(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"}(Mb);var aF=function(){},rF=function(e){function t(t){var n=e.call(this,t)||this;return n.type="boxplotBoxPath",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new aF},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(pF);t.useStyle(r),t.style.fill=null,t.style.stroke=a}var bF=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 ze(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}(Lx);Dr(bF,nF,!0);var wF=["itemStyle","borderColor"],SF=["itemStyle","borderColor0"],CF=["itemStyle","borderColorDoji"],_F=["itemStyle","color"],TF=["itemStyle","color0"];Tb(),Tb();function IF(e,t,n,i,a,r){return n>i?-1:n0?e.get(a,t-1)<=i?1:-1:1}function EF(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 MF=function(e){function t(t,n){var i=e.call(this)||this,a=new ob(t,n),r=new Am;return i.add(a),i.add(r),i.updateData(t,n),i}return ze(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=Gr(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 Bs(e.__p1,e.__cp1)+Bs(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=yl,l=vl;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}(kF),OF=function(){this.polyline=!1,this.curveness=0,this.segs=[]},AF=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return ze(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 OF},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(Pc(p,c,(p+u)/2-(c-m)*a,(c+m)/2-(u-p)*a,u,m,r,e,t))return o}else if(Mc(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}(),RF={seriesType:"lines",plan:Tb(),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)&&Bb(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=RF.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 FF:new fO(a?i?DF:PF:i?kF:gO),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"}(Mb),"undefined"==typeof Uint32Array?Array:Uint32Array),NF="undefined"==typeof Float64Array?Array:Float64Array;function LF(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=Fr(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),Er([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}ze(t,e),t.prototype.init=function(t){t.data=t.data||[],LF(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(LF(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}}}(Lx);var VF=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=cr.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=cr.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 qF(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}ze(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()):qF(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&&(qF(a)?this.render(t,n,i):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(t,i,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){sg(this._progressiveEls||this.group,e)},t.prototype._renderOnCartesianAndCalendar=function(e,t,n,i,a){var r,o,s,l,p=e.coordinateSystem,c=Nb(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=mg(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]);I=new rd({shape:{x:P[0]-r/2,y:P[1]-o/2,width:r,height:o},style:E})}else{if(isNaN(h.get(_[1],T)))continue;I=new rd({z2:1,shape:p.dataToRect([h.get(_[0],T)]).contentShape,style:E})}if(h.hasItemOption){var D=h.getItemModel(T),O=D.getModel("emphasis");g=O.getModel("itemStyle").getItemStyle(),f=D.getModel(["blur","itemStyle"]).getItemStyle(),y=D.getModel(["select","itemStyle"]).getItemStyle(),v=D.get(["itemStyle","borderRadius"]),w=O.get("focus"),S=O.get("blurScope"),C=O.get("disabled"),x=mg(D)}I.shape.r=v;var A=e.getRawValue(T),F="-";A&&null!=A[2]&&(F=A[2]+""),ug(I,x,{labelFetcher:e,labelDataIndex:T,defaultOpacity:E.opacity,defaultText:F}),I.ensureState("emphasis").style=g,I.ensureState("blur").style=f,I.ensureState("select").style=y,rm(I,w,S,C),I.incremental=a,a&&(I.states.emphasis.hoverLayer=!0),m.add(I),h.setItemGraphicEl(T,I),this._progressiveEls&&this._progressiveEls.push(I)}},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 VF;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=Fr(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=qr(h)?h.slice():null==h?["100%","100%"]:[h,h];c[u.index]=Cd(c[u.index],m),c[d.index]=Cd(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(GF)||0;r&&(UF.attr({scaleX:t[0],scaleY:t[1],rotation:n}),UF.updateTransform(),r/=UF.getLineScale(),r*=t[i.valueDim.index]);a.valueLineWidth=r||0}(n,d.symbolScale,l,i,d);var u=d.symbolSize,m=nb(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=Qr(e.get("symbolMargin"),"15%")+"",x=!1;v.lastIndexOf("!")===v.length-1&&(x=!0,v=v.slice(0,v.length-1));var b=Cd(v,t[m.index]),w=Math.max(g+2*b,0),S=x?0:2*b,C=Vd(i),_=C?i:oR((y+S)/w);w=g+2*(b=(y-_*g)/2/(x?_:Math.max(_-1,1))),S=x?0:2*b,C||"fixed"===i||(_=p?oR((Math.abs(p)+S)/w):0),f=_*w-S,d.repeatTimes=_,d.symbolMargin=b}var T=h*(f/2),I=d.pathPosition=[];I[u.index]=n[u.wh]/2,I[m.index]="start"===o?T:"end"===o?l-T:l/2,r&&(I[0]+=r[0],I[1]+=r[1]);var E=d.bundlePosition=[];E[u.index]=n[u.xy],E[m.index]=n[m.xy];var M=d.barRectShape=Mr({},n);M[m.wh]=h*Math.max(Math.abs(n[m.wh]),Math.abs(I[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 HF(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function WF(e){var t=e.symbolPatternSize,n=eb(e.symbolType,-t/2,-t/2,t,t);return n.attr({culling:!0}),"image"!==n.type&&n.setStyle({strokeNoScale:!0}),n}function $F(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(iR(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 KF(e,t,n,i){var a=e.__pictorialBundle,r=e.__pictorialMainPath;r?aR(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=WF(n),a.add(r),aR(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 YF(e,t,n){var i=Mr({},t.barRectShape),a=e.__pictorialBarRect;a?aR(a,null,{shape:i},t,n):((a=e.__pictorialBarRect=new rd({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}})).disableMorphing=!0,e.add(a))}function XF(e,t,n,i){if(n.symbolClip){var a=e.__pictorialClipPath,r=Mr({},n.clipShape),o=t.valueDim,s=n.animationModel,l=n.dataIndex;if(a)kh(a,{shape:r},s,l);else{r[o.wh]=0,a=new rd({shape:r}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var p={};p[o.wh]=n.clipShape[o.wh],lg[i?"updateProps":"initProps"](a,{shape:p},s,l)}}}function ZF(e,t){var n=e.getItemModel(t);return n.getAnimationDelayParams=QF,n.isAnimationEnabled=JF,n}function QF(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function JF(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function eR(e,t,n,i){var a=new Am,r=new Am;return a.add(r),a.__pictorialBundle=r,r.x=n.bundlePosition[0],r.y=n.bundlePosition[1],n.symbolRepeat?$F(a,t,n):KF(a,0,n),YF(a,n,i),XF(a,t,n,i),a.__pictorialShapeStr=nR(e,n),a.__pictorialSymbolMeta=n,a}function tR(e,t,n,i){var a=i.__pictorialBarRect;a&&a.removeTextContent();var r=[];iR(i,(function(e){r.push(e)})),i.__pictorialMainPath&&r.push(i.__pictorialMainPath),i.__pictorialClipPath&&(n=null),Ar(r,(function(e){Oh(e,{scaleX:0,scaleY:0},n,t,(function(){i.parent&&i.parent.remove(i)}))})),e.setItemGraphicEl(t,null)}function nR(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function iR(e,t,n){Ar(e.__pictorialBundle.children(),(function(i){i!==e.__pictorialBarRect&&t.call(n,i)}))}function aR(e,t,n,i,a,r){t&&e.attr(t),i.symbolClip&&!a?n&&e.attr(n):n&&lg[a?"updateProps":"initProps"](e,n,i.animationModel,i.dataIndex,r)}function rR(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");iR(e,(function(e){if(e instanceof Qc){var t=e.style;e.useStyle(Mr({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,ug(h,mg(a),{labelFetcher:t.seriesModel,labelDataIndex:i,defaultText:ab(t.seriesModel.getData(),i),inheritColor:n.style.fill,defaultOpacity:n.style.opacity,defaultOutsidePosition:m}),rm(e,c,d,r.get("disabled"))}function oR(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}ze(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=Dy(cw.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"}}})}(cw);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._layers=[],n}ze(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 Vg(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(E-T)&&E0?(a.virtualPiece?a.virtualPiece.updateData(!1,i,e,t,n):(a.virtualPiece=new sR(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)Fv(o,r.get("target",!0)||"_blank")}n=!0}}))}))},t.prototype._rootToNode=function(e){e!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:lR,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"})(Mb),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreStyleOnData=!0,n}ze(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};pR(n);var i=this._levelModels=Fr(e.levels||[],(function(e){return new Bg(e,this,t)}),this),a=dD.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=gD(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(){fD(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"}}(Lx);function pR(e){var t=0;Ar(e.children,(function(e){pR(e);var n=e.value;qr(n)&&(n=n[0]),t+=n}));var n=e.value;qr(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),qr(e.value)?e.value[0]=n:e.value=n}Math.PI;var cR={color:"fill",borderColor:"stroke"},dR={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},uR=ou(),mR=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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 My(null,this)},t.prototype.getDataParams=function(t,n,i){var a=e.prototype.getDataParams.call(this,t,n);return i&&(a.info=uR(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}(Lx);function hR(e,t){return t=t||[0,0],Fr(["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 gR(e,t){return t=t||[0,0],Fr([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 fR(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 yR(e,t){return t=t||[0,0],Fr(["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 vR(e,t,n,i){return e&&(e.legacy||!1!==e.legacy&&!n&&!i&&"tspan"!==t&&("text"===t||fo(e,"text")))}function xR(e,t,n){var i,a,r,o=e;if("text"===t)r=o;else{r={},fo(o,"text")&&(r.text=o.text),fo(o,"rich")&&(r.rich=o.rich),fo(o,"textFill")&&(r.fill=o.textFill),fo(o,"textStroke")&&(r.stroke=o.textStroke),fo(o,"fontFamily")&&(r.fontFamily=o.fontFamily),fo(o,"fontSize")&&(r.fontSize=o.fontSize),fo(o,"fontStyle")&&(r.fontStyle=o.fontStyle),fo(o,"fontWeight")&&(r.fontWeight=o.fontWeight),a={type:"text",style:r,silent:!0},i={};var s=fo(o,"textPosition");n?i.position=s?o.textPosition:"inside":s&&(i.position=o.textPosition),fo(o,"textPosition")&&(i.position=o.textPosition),fo(o,"textOffset")&&(i.offset=o.textOffset),fo(o,"textRotation")&&(i.rotation=o.textRotation),fo(o,"textDistance")&&(i.distance=o.textDistance)}return bR(r,e),Ar(r.rich,(function(e){bR(e,e)})),{textConfig:i,textContent:a}}function bR(e,t){t&&(t.font=t.textFont||t.font,fo(t,"textStrokeWidth")&&(e.lineWidth=t.textStrokeWidth),fo(t,"textAlign")&&(e.align=t.textAlign),fo(t,"textVerticalAlign")&&(e.verticalAlign=t.textVerticalAlign),fo(t,"textLineHeight")&&(e.lineHeight=t.textLineHeight),fo(t,"textWidth")&&(e.width=t.textWidth),fo(t,"textHeight")&&(e.height=t.textHeight),fo(t,"textBackgroundColor")&&(e.backgroundColor=t.textBackgroundColor),fo(t,"textPadding")&&(e.padding=t.textPadding),fo(t,"textBorderColor")&&(e.borderColor=t.textBorderColor),fo(t,"textBorderWidth")&&(e.borderWidth=t.textBorderWidth),fo(t,"textBorderRadius")&&(e.borderRadius=t.textBorderRadius),fo(t,"textBoxShadowColor")&&(e.shadowColor=t.textBoxShadowColor),fo(t,"textBoxShadowBlur")&&(e.shadowBlur=t.textBoxShadowBlur),fo(t,"textBoxShadowOffsetX")&&(e.shadowOffsetX=t.textBoxShadowOffsetX),fo(t,"textBoxShadowOffsetY")&&(e.shadowOffsetY=t.textBoxShadowOffsetY))}function wR(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";SR(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,Ar(t.rich,(function(e){SR(e,e)})),i}function SR(e,t){t&&(fo(t,"fill")&&(e.textFill=t.fill),fo(t,"stroke")&&(e.textStroke=t.fill),fo(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),fo(t,"font")&&(e.font=t.font),fo(t,"fontStyle")&&(e.fontStyle=t.fontStyle),fo(t,"fontWeight")&&(e.fontWeight=t.fontWeight),fo(t,"fontSize")&&(e.fontSize=t.fontSize),fo(t,"fontFamily")&&(e.fontFamily=t.fontFamily),fo(t,"align")&&(e.textAlign=t.align),fo(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),fo(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),fo(t,"width")&&(e.textWidth=t.width),fo(t,"height")&&(e.textHeight=t.height),fo(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),fo(t,"padding")&&(e.textPadding=t.padding),fo(t,"borderColor")&&(e.textBorderColor=t.borderColor),fo(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),fo(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),fo(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),fo(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),fo(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),fo(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),fo(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),fo(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),fo(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),fo(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}var CR={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},_R=Nr(CR),TR=(Rr(Xs,(function(e,t){return e[t]=1,e}),{}),Xs.join(", "),["","style","shape","extra"]),IR=ou();function ER(e,t,n,i,a){var r=e+"Animation",o=Eh(e,i,a)||{},s=IR(t).userDuring;return o.duration>0&&(o.during=s?Lr(FR,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),Mr(o,n[r]),o}function MR(e,t,n,i){var a=(i=i||{}).dataIndex,r=i.isInit,o=i.clearStyle,s=n.isAnimationEnabled(),l=IR(e),p=t.style;l.userDuring=t.during;var c={},d={};if(function(e,t,n){for(var i=0;i<_R.length;i++){var a=_R[i],r=CR[a],o=t[a];o&&(n[r[0]]=o[0],n[r[1]]=o[1])}for(i=0;i=0)){var d=e.getAnimationStyleProps(),u=d?d.style:null;if(u){!a&&(a=i.style={});var m=Nr(n);for(p=0;p0&&e.animateFrom(u,m)}else!function(e,t,n,i,a){if(a){var r=ER("update",e,t,i,n);r.duration>0&&e.animateFrom(a,r)}}(e,t,a||0,n,c);kR(e,t),p?e.dirty():e.markRedraw()}function kR(e,t){for(var n=IR(e).leaveToProps,i=0;i=0){!r&&(r=i[e]={});var u=Nr(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:Lr(yR,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 QR(e){return e instanceof $c}function JR(e){return e instanceof Hp}var eB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(e,t,n,i){this._progressiveEls=null;var a=this._data,r=e.getData(),o=this.group,s=rB(e,r,t,n);a||o.removeAll(),r.diff(a).add((function(t){sB(n,null,t,s(t,i),e,o,r)})).remove((function(t){var n=a.getItemGraphicEl(t);n&&PR(n,uR(n).option,e)})).update((function(t,l){var p=a.getItemGraphicEl(l);sB(n,p,t,s(t,i),e,o,r)})).execute();var l=e.get("clip",!0)?Bb(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=rB(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,zR).getItemStyle(),r=x(i,zR),o=hg(r,null,null,!0,!0);o.text=r.getShallow("show")?eo(e.getFormattedLabel(i,zR),e.getFormattedLabel(i,UR),ab(t,i)):null;var l=gg(r,null,!0);return w(n,a),a=wR(a,o,l),n&&b(a,n),a.legacy=!0,a},visual:function(e,n){if(null==n&&(n=s),fo(cR,e)){var i=t.getItemVisual(n,"style");return i?i[cR[e]]:null}if(fo(dR,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);mB(t,g,a)}}(e,d,n,i,a),o>=0?r.replaceAt(d,o):r.add(d),d}function pB(e,t,n){var i,a=uR(e),r=t.type,o=t.shape,s=t.style;return n.isUniversalTransitionEnabled()||null!=r&&r!==a.customGraphicType||"path"===r&&((i=o)&&(fo(i,"pathData")||fo(i,"d")))&&yB(o)!==a.customPathData||"image"===r&&fo(s,"image")&&s.image!==a.customImagePath}function cB(e,t,n){var i=t?dB(e,t):e,a=t?uB(e,i,zR):e.style,r=e.type,o=i?i.textConfig:null,s=e.textContent,l=s?t?dB(s,t):s:null;if(a&&(n.isLegacy||vR(a,r,!!o,!!l))){n.isLegacy=!0;var p=xR(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 dB(e,t){return t?e?e[t]:null:e}function uB(e,t,n){var i=t&&t.style;return null==i&&n===zR&&e&&(i=e.styleEmphasis),i}function mB(e,t,n){t&&PR(t,uR(e).option,n)}function hB(e,t){var n=e&&e.name;return null!=n?n:"e\0\0"+t}function gB(e,t){var n=this.context,i=null!=e?n.newChildren[e]:null,a=null!=t?n.oldChildren[t]:null;lB(n.api,a,n.dataIndex,i,n.seriesModel,n.group)}function fB(e){var t=this.context,n=t.oldChildren[e];n&&PR(n,uR(n).option,t.seriesModel)}function yB(e){return e&&(e.pathData||e.d)}function vB(e){e.registerChartView(eB),e.registerSeriesModel(mR)}var xB=ou(),bB=Tr,wB=Lr,SB=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=Vr(CB,t,c);this.updatePointerEl(o,l,d),this.updateLabelEl(o,l,d,t)}else o=this._group=new Am,this.createPointerEl(o,l,e,t),this.createLabelEl(o,l,e,t),n.getZr().add(o);EB(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=qM(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=xB(e).pointerEl=new lg[a.type](bB(t.pointer));e.add(r)}},e.prototype.createLabelEl=function(e,t,n,i){if(t.label){var a=xB(e).labelEl=new ld(bB(t.label));e.add(a),TB(a,i)}},e.prototype.updatePointerEl=function(e,t,n){var i=xB(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=xB(e).labelEl;a&&(a.setStyle(t.label.style),n(a,{x:t.label.x,y:t.label.y}),TB(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=tg(r.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(e){WS(e.event)},onmousedown:wB(this._onHandleDragMove,this,0,0),drift:wB(this._onHandleDragMove,this),ondragend:wB(this._onHandleDragEnd,this)}),i.add(a)),EB(a,n,!1),a.setStyle(r.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=r.get("size");qr(s)||(s=[s,s]),a.scaleX=s[0]/2,a.scaleY=s[1]/2,fw(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,t)}},e.prototype._moveHandleToValue=function(e,t){CB(this._axisPointerModel,!t&&this._moveAnimation,this._handle,IB(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(IB(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(IB(i)),xB(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),yw(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 CB(e,t,n,i){_B(xB(n).lastProp,i)||(xB(n).lastProp=i,t?kh(n,i,e):(n.stopAnimation(),n.attr(i)))}function _B(e,t){if(Hr(e)&&Hr(t)){var n=!0;return Ar(t,(function(t,i){n=n&&_B(e[i],t)})),!!n}return e===t}function TB(e,t){e[t.get(["label","show"])?"show":"hide"]()}function IB(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function EB(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 MB(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 kB(e,t,n,i,a){var r=PB(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=Mv(o.get("padding")||0),l=o.getFont(),p=ss(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:hg(o,{text:r,font:l,fill:o.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function PB(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:eM(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};Ar(i,(function(e){var t=n.getSeriesByIndex(e.seriesIndex),i=e.dataIndexInside,a=t&&t.getDataParams(i);a&&s.seriesData.push(a)})),zr(o)?r=o.replace("{value}",r):Gr(o)&&(r=o(s))}return r}function DB(e,t,n){var i=[1,0,0,1,0,0];return Ho(i,i,n.rotation),jo(i,i,n.position),Xh([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}function OB(e,t,n,i,a,r){var o=OM.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=a.get(["label","margin"]),kB(t,i,a,r,{position:DB(i.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function AB(e,t,n){return{x1:e[n=n||0],y1:e[1-n],x2:t[n],y2:t[1-n]}}function FB(e,t,n){return{x:e[n=n||0],y:e[1-n],width:t[n],height:t[1-n]}}function RB(e,t,n,i,a,r){return{cx:e,cy:t,r0:n,r:i,startAngle:a,endAngle:r,clockwise:!0}}var BB=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.grid,s=i.get("type"),l=NB(o,r).getOtherAxis(r).getGlobalExtent(),p=r.toGlobalCoord(r.dataToCoord(t,!0));if(s&&"none"!==s){var c=MB(i),d=LB[s](r,p,l);d.style=c,e.graphicKey=d.type,e.pointer=d}OB(t,e,SM(o.model,n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=SM(t.axis.grid.model,t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=DB(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=NB(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}(SB);function NB(e,t){var n={};return n[t.dim+"AxisIndex"]=t.index,e.getCartesian(n)}var LB={line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:AB([t,n[0]],[t,n[1]],VB(e))}},shadow:function(e,t,n){var i=Math.max(1,e.getBandWidth()),a=n[1]-n[0];return{type:"Rect",shape:FB([t-i/2,n[0]],[i,a],VB(e))}}};function VB(e){return"x"===e.dim?0:1}var qB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}($v),GB=ou(),zB=Ar;function UB(e,t,n){if(!bo.node){var i=t.getZr();GB(i).records||(GB(i).records={}),function(e,t){if(GB(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);zB(GB(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)}))}GB(e).initialized=!0,n("click",Vr(HB,"click")),n("mousemove",Vr(HB,"mousemove")),n("globalout",jB)}(i,t),(GB(i).records[e]||(GB(i).records[e]={})).handler=n}}function jB(e,t,n){e.handler("leave",null,n)}function HB(e,t,n,i){t.handler(e,n,i)}function WB(e,t){if(!bo.node){var n=t.getZr();(GB(n).records||{})[e]&&(GB(n).records[e]=null)}}var $B=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(e,t,n){var i=t.getComponent("tooltip"),a=e.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";UB("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){WB("axisPointer",t)},t.prototype.dispose=function(e,t){WB("axisPointer",t)},t.type="axisPointer",t}(M_);function KB(e,t){var n,i=[],a=e.seriesIndex;if(null==a||!(n=t.getSeriesByIndex(a)))return{point:[]};var r=n.getData(),o=ru(r,e);if(null==o||o<0||qr(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(Fr(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 YB=ou();function XB(e,t,n){var i=e.currTrigger,a=[e.x,e.y],r=e,o=e.dispatchAction||Lr(n.dispatchAction,n),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){tN(a)&&(a=KB({seriesIndex:r.seriesIndex,dataIndex:r.dataIndex},t).point);var l=tN(a),p=r.axesInfo,c=s.axesInfo,d="leave"===i||tN(a),u={},m={},h={list:[],map:{}},g={showPointer:Vr(QB,m),showTooltip:Vr(JB,h)};Ar(s.coordSysMap,(function(e,t){var n=l||e.containPoint(a);Ar(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&&ZB(e,o,g,!1,u)}}))}));var f={};return Ar(c,(function(e,t){var n=e.linkGroup;n&&!m[t]&&Ar(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,eN(t),eN(e)))),f[e.key]=r}}))})),Ar(f,(function(e,t){ZB(c[t],e,g,!0,u)})),function(e,t,n){var i=n.axesInfo=[];Ar(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(tN(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=YB(i)[a]||{},o=YB(i)[a]={};Ar(e,(function(e,t){var n=e.axisPointerModel.option;"show"===n.status&&e.triggerEmphasis&&Ar(n.seriesDataIndices,(function(e){var t=e.seriesIndex+" | "+e.dataIndex;o[t]=e}))}));var s=[],l=[];Ar(r,(function(e,t){!o[t]&&l.push(e)})),Ar(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 ZB(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 Ar(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),Ar(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&&Mr(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 QB(e,t,n,i){e[t.key]={value:n,payloadBatch:i}}function JB(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=zM(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 eN(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 tN(e){return!e||null==e[0]||isNaN(e[0])||null==e[1]||isNaN(e[1])}function nN(e){jM.registerAxisPointerClass("CartesianAxisPointer",BB),e.registerComponentModel(qB),e.registerComponentView($B),e.registerPreprocessor((function(e){if(e){(!e.axisPointer||0===e.axisPointer.length)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!qr(t)&&(e.axisPointer.link=[t])}})),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,(function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=LM(e,t)})),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},XB)}function iN(e){QI(nk),QI(nN)}var aN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(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=MB(i),d=rN[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];Ho(u,u,s),jo(u,u,[i.cx,i.cy]),l=Xh([o,-a],u);var m=t.getModel("axisLabel").get("rotate")||0,h=OM.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"]));kB(e,n,i,a,u)},t}(SB);var rN={line:function(e,t,n,i){return"angle"===e.dim?{type:"Line",shape:AB(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:RB(t.cx,t.cy,i[0],i[1],(-n-a/2)*r,(a/2-n)*r)}:{type:"Sector",shape:RB(t.cx,t.cy,n-a/2,n+a/2,0,2*Math.PI)}}},oN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}($v),sN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",cu).models[0]},t.type="polarAxis",t}($v);Dr(sN,iE);var lN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="angleAxis",t}(sN),pN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="radiusAxis",t}(sN),cN=function(e){function t(t,n){return e.call(this,"radius",t,n)||this}return ze(t,e),t.prototype.pointToData=function(e,t){return this.polar.pointToData(e,t)["radius"===this.dim?0:1]},t}(xM);cN.prototype.dataToRadius=xM.prototype.dataToCoord,cN.prototype.radiusToData=xM.prototype.coordToData;var dN=ou(),uN=function(e){function t(t,n){return e.call(this,"angle",t,n||[0,360])||this}return ze(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=ss(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=dN(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}(xM);uN.prototype.dataToAngle=xM.prototype.dataToCoord,uN.prototype.angleToData=xM.prototype.coordToData;var mN=["radius","angle"],hN=function(){function e(e){this.dimensions=mN,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new cN,this._angleAxis=new uN,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 gN(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return gN(t)===this?this.pointToData(n):null},e}();function gN(e){var t=e.seriesModel,n=e.polarModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}function fN(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();Ar(aM(t,"radius"),(function(e){a.scale.unionExtentFromData(t,e)})),Ar(aM(t,"angle"),(function(e){i.scale.unionExtentFromData(t,e)}))}})),ZE(i.scale,i.model),ZE(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 yN(e,t){var n;if(e.type=t.get("type"),e.scale=QE(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 vN={dimensions:mN,create:function(e,t){var n=[];return e.eachComponent("polar",(function(e,i){var a=new hN(i+"");a.update=fN;var r=a.getRadiusAxis(),o=a.getAngleAxis(),s=e.findAxisModel("radiusAxis"),l=e.findAxisModel("angleAxis");yN(r,s),yN(o,l),function(e,t,n){var i=t.get("center"),a=n.getWidth(),r=n.getHeight();e.cx=Cd(i[0],a),e.cy=Cd(i[1],r);var o=e.getRadiusAxis(),s=Math.min(a,r)/2,l=t.get("radius");null==l?l=[0,"100%"]:qr(l)||(l=[0,l]);var p=[Cd(l[0],s),Cd(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",cu).models[0];0,e.coordinateSystem=t.coordinateSystem}})),n}},xN=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function bN(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 wN(e){return e.getRadiusAxis().inverse?0:1}function SN(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 CN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="PolarAxisPointer",n}return ze(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=Fr(n.getViewLabels(),(function(e){e=Tr(e);var t=n.scale,i="ordinal"===t.type?t.getRawOrdinalNumber(e.tickValue):e.tickValue;return e.coord=n.dataToCoord(i),e}));SN(s),SN(r),Ar(xN,(function(t){!e.get([t,"show"])||n.scale.isBlank()&&"axisLine"!==t||_N[t](this.group,e,i,r,o,a,s)}),this)}},t.type="angleAxis",t}(jM),_N={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=wN(n),u=d?0:1,m=360===Math.abs(c[1]-c[0])?"Circle":"Arc";(o=0===r[u]?new lg[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 eh({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[wN(n)],p=Fr(i,(function(e){return new lh({shape:bN(n,[l,l+s],e.coord)})}));e.add(Hh(p,{style:kr(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[wN(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];Hr(v)&&v.textStyle&&(o=new Bg(v.textStyle,l,l.ecModel))}var x=new ld({silent:OM.isLabelSilent(t),style:hg(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=OM.makeAxisEventDataBase(t);b.targetType="axisLabel",b.value=i.rawLabel,fu(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",I=b;v&&(i[s][_]||(i[s][_]={p:b,n:b}),I=i[s][_][T]);var E=void 0,M=void 0,k=void 0,P=void 0;if("radius"===d.dim){var D=d.dataToCoord(C)-b,O=r.dataToCoord(_);Math.abs(D)=P})}}}))}var ON={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},AN={splitNumber:5},FN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="polar",t}(M_);function RN(e){QI(nN),jM.registerAxisPointerClass("PolarAxisPointer",aN),e.registerCoordinateSystem("polar",vN),e.registerComponentModel(oN),e.registerComponentView(FN),mE(e,"angle",lN,ON),mE(e,"radius",pN,AN),e.registerComponentView(CN),e.registerComponentView(EN),e.registerLayout(Vr(DN,"bar"))}function BN(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),Qr(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 NN=["axisLine","axisTickLabel","axisName"],LN=["splitArea","splitLine"],VN=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="SingleAxisPointer",n}ze(t,e),t.prototype.render=function(t,n,i,a){var r=this.group;r.removeAll();var o=this._axisGroup;this._axisGroup=new Am;var s=BN(t),l=new OM(t,s);Ar(NN,l.add,l),r.add(this._axisGroup),r.add(l.getGroup()),Ar(LN,(function(e){t.get([e,"show"])&&VN[e](this,this.group,this._axisGroup,t)}),this),Jh(o,this._axisGroup,t),e.prototype.render.call(this,t,n,i,a)},t.prototype.remove=function(){$M(this)},t.type="singleAxis"}(jM),{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 UN(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return UN(t)===this?this.pointToData(n):null}}();function UN(e){var t=e.seriesModel,n=e.singleAxisModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}var jN=["x","y"],HN=["width","height"],WN=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.coordinateSystem,s=KN(o,1-$N(r)),l=o.dataToPoint(t)[0],p=i.get("type");if(p&&"none"!==p){var c=MB(i),d=WN[p](r,l,s);d.style=c,e.graphicKey=d.type,e.pointer=d}OB(t,e,BN(n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=BN(t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=DB(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=$N(a),s=KN(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=KN(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"}}}}(SB),{line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:AB([t,n[0]],[t,n[1]],$N(e))}},shadow:function(e,t,n){var i=e.getBandWidth(),a=n[1]-n[0];return{type:"Rect",shape:FB([t-i/2,n[0]],[i,a],$N(e))}}});function $N(e){return e.isHorizontal()?0:1}function KN(e,t){var n=e.getRect();return[n[jN[t]],n[jN[t]]+n[HN[t]]]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.type="single"}(M_);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(t,n,i){var a=jv(t);e.prototype.init.apply(this,arguments),YN(t,a)},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),YN(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}}}($v);function YN(e,t){var n,i=e.cellSize;1===(n=qr(i)?i:e.cellSize=[i,i]).length&&(n[1]=n[0]);var a=Fr([0,1],(function(e){return function(e,t){return null!=e[Nv[t][0]]||null!=e[Nv[t][1]]&&null!=e[Nv[t][2]]}(t,e)&&(n[e]="auto"),null!=n[e]&&"auto"!==n[e]}));Uv(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}ze(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 rd({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 rh({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 zr(e)&&e?(n=e,Ar(t,(function(e,t){n=n.replace("{"+t+"}",i?Gy(e):e)})),n):Gr(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 ld({z2:30,style:hg(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&&!zr(r)||(r&&(t=Yy(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/XN)-Math.floor(n[0].time/XN)+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 ZN(e){var t=e.calendarModel,n=e.seriesModel;return t?t.coordinateSystem:n?n.coordinateSystem:null}function QN(e,t){var n;return Ar(t,(function(t){null!=e[t]&&"auto"!==e[t]&&(n=!0)})),n}var JN=["transition","enterFrom","leaveTo"],eL=JN.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function tL(e,t,n){if(n&&(!e[n]&&t[n]&&(e[n]={}),e=e[n],t=t[n]),e&&t)for(var i=n?JN:eL,a=0;a=0;l--){var u,m,h;if(h=null!=(m=nu((u=n[l]).id,null))?a.get(m):null){var g=h.parent,f=(d=iL(g),{}),y=Gv(h,u,g===i?{width:r,height:o}:{width:d.width,height:d.height},null,{hv:u.hv,boundingMode:u.bounding},f);if(!iL(h).isNew&&y){for(var v=u.transition,x={},b=0;b=0)?x[w]=S:h[w]=S}kh(h,x,e,0)}else h.attr(f)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each((function(n){oL(n,iL(n).option,t,e._lastGraphicModel)})),this._elMap=uo()},t.prototype.dispose=function(){this._clear()},t.type="graphic"}(M_);function aL(e){var t=fo(nL,e)?nL[e]:Gh(e);var n=new t({});return iL(n).type=e,n}function rL(e,t,n,i){var a=aL(n);return t.add(a),i.set(e,a),iL(a).id=e,iL(a).isNew=!0,a}function oL(e,t,n,i){e&&e.parent&&("group"===e.type&&e.traverse((function(e){oL(e,t,n,i)})),PR(e,t,i),n.removeKey(iL(e).id))}function sL(e,t,n,i){e.isGroup||Ar([["cursor",Hp.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],(function(n){var i=n[0];fo(t,i)?e[i]=Jr(t[i],n[1]):null==e[i]&&(e[i]=n[1])})),Ar(Nr(t),(function(n){if(0===n.indexOf("on")){var i=t[n];e[n]=Gr(i)?i:null}})),fo(t,"draggable")&&(e.draggable=t.draggable),null!=t.name&&(e.name=t.name),null!=t.id&&(e.id=t.id)}var lL=["x","y","radius","angle","single"],pL=["cartesian2d","polar","singleAxis"];function cL(e){return e+"Axis"}function dL(e,t){var n,i=uo(),a=[],r=uo();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 uL(e){var t=e.ecModel,n={infoList:[],infoMap:uo()};return e.eachTargetAxis((function(e,i){var a=t.getComponent(cL(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 mL=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}(),hL=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 ze(t,e),t.prototype.init=function(e,t,n){var i=gL(e);this.settledOption=i,this.mergeDefaultAndTheme(e,n),this._doInit(i)},t.prototype.mergeOption=function(e){var t=gL(e);Ir(this.option,e,!0),Ir(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;Ar([["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=uo();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 Ar(lL,(function(n){var i=this.getReferringComponents(cL(n),du);if(i.specified){t=!0;var a=new mL;Ar(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 mL;if(r.add(a.componentIndex),e.set(n,r),i=!1,"x"===n||"y"===n){var o=a.getReferringComponents("grid",cu).models[0];o&&Ar(t,(function(e){a.componentIndex!==e.componentIndex&&o===e.getReferringComponents("grid",cu).models[0]&&r.add(e.componentIndex)}))}}}i&&Ar(lL,(function(t){if(i){var a=n.findComponents({mainType:cL(t),filter:function(e){return"category"===e.get("type",!0)}});if(a[0]){var r=new mL;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");Ar([["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(cL(t),n))}),this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each((function(n,i){Ar(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(cL(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;Ar([["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;Ar(["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=cL(this._dimName),i=t.getReferringComponents(n,cu).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 Tr(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=[];yL(["start","end"],(function(l,p){var c=e[l],d=e[l+"Value"];"percent"===a[p]?(null==c&&(c=r[p]),d=i.parse(Sd(c,r,n))):(t=!0,c=Sd(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})),vL(s),vL(o);var l=this._minMaxSpan;function p(e,t,n,a,r){var o=r?"Span":"ValueSpan";KO(0,e,n,"all",l["min"+o],l["max"+o]);for(var s=0;s<2;s++)t[s]=Sd(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];yL(n,(function(e){!function(e,t,n){t&&Ar(aM(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=KE(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&&yL(i,(function(e){var t=e.getData(),i=t.mapDimensionsAll(n);if(i.length){if("weakFilter"===a){var o=t.getStore(),s=Fr(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 yL(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)}}));yL(i,(function(e){t.setApproximateExtent(r,e)}))}}))}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._dataExtent;yL(["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=Sd(n[0]+r,n,[0,100],!0):null!=a&&(r=Sd(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=Md(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 bL={getTargetSeries:function(e){function t(t){e.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,a){var r=e.getComponent(cL(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 xL(t,i,r,e),n.push(a.__dzAxisProxy))}));var i=uo();return Ar(n,(function(e){Ar(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 wL=!1;function SL(e){wL||(wL=!0,e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,bL),function(e){e.registerAction("dataZoom",(function(e,t){Ar(dL(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 CL=function(){},_L={};function TL(e){return _L[e]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;Ar(this.option.feature,(function(e,n){var i=TL(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(t)),Ir(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"}}}($v);function IL(e,t){var n=Mv(t.get("padding")),i=t.getItemStyle(["color","opacity"]);return i.fill=t.get("backgroundColor"),e=new rd({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}ze(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=[];Ar(s,(function(e,t){p.push(t)})),new Vg(this._featureNames||[],p).add(c).update(c).remove(Vr(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=qv(i,r,a);Vv(t.get("orient"),e,t.get("itemGap"),o.width,o.height),Gv(e,i,r,a)}(a,e,n),a.add(IL(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&&!Gr(l)&&t){var p=l.style||(l.style={}),c=ss(t,ld.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 Bg(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=TL(m);if(!y)return;u=new y}l[m]=u}else if(!(u=l[h]))return;u.uid=Py("toolbox-feature"),u.model=f,u.ecModel=t,u.api=n;var v=u instanceof CL;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 CL&&s.getIcons?s.getIcons():i.get("icon"),h=i.get("title")||{};zr(m)?(p={})[l]=m:p=m;zr(h)?(c={})[l]=h:c=h;var g=i.iconPaths={};Ar(p,(function(l,p){var m=tg(l,{},{x:-r/2,y:-r/2,width:r,height:r});m.setStyle(d.getItemStyle()),m.ensureState("emphasis").style=u.getItemStyle();var h=new ld({style:{text:c[p],align:u.get("textAlign"),borderRadius:u.get("textBorderRadius"),padding:u.get("textPadding"),fill:null,font:bg({fontStyle:u.get("textFontStyle"),fontFamily:u.get("textFontFamily"),fontSize:u.get("textFontSize"),fontWeight:u.get("textFontWeight")},t)},ignore:!0});m.setTextContent(h),rg({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])?Hu:Wu)(m),a.add(m),m.on("click",Lr(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?Hu:Wu)(i[e])},u instanceof CL&&u.render&&u.render(f,t,n,i)):v&&u.dispose&&u.dispose(t,n)}},t.prototype.updateView=function(e,t,n,i){Ar(this._features,(function(e){e instanceof CL&&e.updateView&&e.updateView(e.model,t,n,i)}))},t.prototype.remove=function(e,t){Ar(this._features,(function(n){n instanceof CL&&n.remove&&n.remove(e,t)})),this.group.removeAll()},t.prototype.dispose=function(e,t){Ar(this._features,(function(n){n instanceof CL&&n.dispose&&n.dispose(e,t)}))},t.type="toolbox"}(M_);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(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=bo.browser;if(Gr(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"])}}}(CL);var EL="__ec_magicType_stack__",ML=[["line","bar"],["stack"]],kL=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.getIcons=function(){var e=this.model,t=e.get("icon"),n={};return Ar(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(kL[n]){var r,o={series:[]};Ar(ML,(function(e){Pr(e,n)>=0&&Ar(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=kL[n](t,a,e,i);r&&(kr(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,cu).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=Ir({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"})}}}(CL),{line:function(e,t,n,i){if("bar"===e)return Ir({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 Ir({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")===EL;if("line"===e||"bar"===e)return i.setIconStatus("stack",a?"normal":"emphasis"),Ir({id:t,stack:a?"":EL},i.get(["option","stack"])||{},!0)}});jI({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(e,t){t.mergeOption(e.newOption)}));var PL=new Array(60).join("-"),DL="\t";function OL(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var AL=new RegExp("[\t]+","g");function FL(e,t){var n=e.split(new RegExp("\n*"+PL+"\n*","g")),i={series:[]};return Ar(n,(function(e,n){if(function(e){if(e.slice(0,e.indexOf("\n")).indexOf(DL)>=0)return!0}(e)){var a=function(e){for(var t=e.split(/\n+/g),n=[],i=Fr(OL(t.shift()).split(AL),(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=WL[e.brushType](0,n,t);e.__rangeOffset={offset:KL[e.brushType](i.values,e.range,[1,1]),xyMinMax:i.xyMinMax}}})),e},e.prototype.matchOutputRanges=function(e,t,n){Ar(e,(function(e){var i=this.findTargetInfo(e,t);i&&!0!==i&&Ar(i.coordSyses,(function(i){var a=WL[e.brushType](1,i,e.range,!0);n(e,a.values,i,t)}))}),this)},e.prototype.setInputRanges=function(e,t){Ar(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=WL[e.brushType](0,s.coordSys,e.coordRange),p=e.__rangeOffset;e.range=p?KL[e.brushType](l.values,p.offset,(n=l.xyMinMax,i=p.xyMinMax,a=XL(n),r=XL(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 Fr(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:KA(i),isTargetByCursor:XA(i,e,n.coordSysModel),getLinearBrushOtherExtent:YA(i)}}))},e.prototype.controlSeries=function(e,t,n){var i=this.findTargetInfo(e,n);return!0===i||i&&Pr(i.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,i=zL(t,e),a=0;ae[1]&&e.reverse(),e}function zL(e,t){return lu(e,t,{includeMainTypes:VL})}var UL={grid:function(e,t){var n=e.xAxisModels,i=e.yAxisModels,a=e.gridModels,r=uo(),o={},s={};(n||i||a)&&(Ar(n,(function(e){var t=e.axis.grid.model;r.set(t.id,t),o[t.id]=!0})),Ar(i,(function(e){var t=e.axis.grid.model;r.set(t.id,t),s[t.id]=!0})),Ar(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=[];Ar(a.getCartesians(),(function(e,t){(Pr(n,e.getAxis("x").model)>=0||Pr(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:HL.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})})))},geo:function(e,t){Ar(e.geoModels,(function(e){var n=e.coordinateSystem;t.push({panelId:"geo--"+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:HL.geo})}))}},jL=[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}],HL={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(Yh(e)),t}},WL={lineX:Vr($L,0),lineY:Vr($L,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=[GL([a[0],r[0]]),GL([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:Fr(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 $L(e,t,n,i){var a=n.getAxis(["x","y"][e]),r=GL(Fr([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 KL={lineX:Vr(YL,0),lineY:Vr(YL,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 Fr(e,(function(e,i){return[e[0]-n[0]*t[i][0],e[1]-n[1]*t[i][1]]}))}};function YL(e,t,n,i){return[t[0]-i[e]*n[0],t[1]-i[e]*n[1]]}function XL(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var ZL,QL,JL=Ar,eV=$d+"toolbox-dataZoom_",tV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.render=function(e,t,n,i){this._brushController||(this._brushController=new yA(n.getZr()),this._brushController.on("brush",Lr(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 qL(nV(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 LL(e).length}(t)>1?"emphasis":"normal")}(e,t)},t.prototype.onclick=function(e,t,n){tV[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 qL(nV(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=LL(e);BL(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=KO(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=[];JL(e,(function(e,n){t.push(Tr(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)"}}}}(CL),{zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(function(e){var t=LL(e),n=t[t.length-1];t.length>1&&t.pop();var i={};return BL(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 nV(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}ZL="dataZoom",QL=function(e){var t=e.getComponent("toolbox",0),n=["feature","dataZoom"];if(t&&null!=t.get(n)){var i=t.getModel(n),a=[],r=lu(e,nV(i));return JL(r.xAxisModels,(function(e){return o(e,"xAxis","xAxisIndex")})),JL(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:eV+t+r};o[n]=r,a.push(o)}},io(null==XC.get(ZL)&&QL),XC.set(ZL,QL);var iV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}($v);function aV(e){var t=e.get("confine");return null!=t?!!t:"richText"===e.get("renderMode")}function rV(e){if(bo.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)),zr(e))r.innerHTML=e+o;else if(e){r.innerHTML="",qr(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&&!bo.node&&n.getDom()){var a=SV(i,n);this._ticket="";var r=i.dataByCoordSys,o=function(e,t,n){var i=pu(e).queryOptionMap,a=i.keys()[0];if(!a||"series"===a)return;var r=uu(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=fu(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=xV;l.x=i.x,l.y=i.y,l.update(),fu(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=KB(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(SV(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"===wV([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"===fu(n).ssrType)return;this._lastDataByCoordSys=null,gT(n,(function(e){return null!=fu(e).dataIndex?(a=e,!0):null!=fu(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=Lr(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=wV([t.tooltipOption],i),o=this._renderMode,s=[],l=Sx("section",{blocks:[],noHeader:!0}),p=[],c=new Ax;Ar(e,(function(e){Ar(e.dataByAxis,(function(e){var t=n.getComponent(e.axisDim+"Axis",e.axisIndex),a=e.value;if(t&&t.axis&&null!=a){var r=PB(a,t.axis,n,e.seriesDataIndices,e.valueLabelOpt),d=Sx("section",{header:r,noHeader:!ao(r),sortBlocks:!0,blocks:[]});l.blocks.push(d),Ar(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=eM(t.axis,{value:a}),h.axisValueLabel=r,h.marker=c.makeTooltipMarker("item",Av(h.color),o);var g=tx(u.formatTooltip(m,!0,null)),f=g.frag;if(f){var y=wV([u],i).get("valueFormatter");d.blocks.push(y?Mr({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=Mx(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=fu(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=wV([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 Ax;g.marker=f.makeTooltipMarker("item",Av(g.color),d);var y=tx(s.formatTooltip(l,!1,p)),v=m.get("order"),x=m.get("valueFormatter"),b=y.frag,w=b?Mx(x?Mr({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=fu(t),a=i.tooltipConfig.option||{};if(zr(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=wV(r,this._tooltipModel,s?{position:s}:null),p=l.get("content"),c=Math.random()+"",d=new Ax;this._showOrMove(l,(function(){var n=Tr(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(zr(c)){var m=e.ecModel.get("useUTC"),h=qr(n)?n[0]:n;d=c,h&&h.axisType&&h.axisType.indexOf("time")>=0&&(d=pv(h.axisValue,d,m)),d=Ov(d,n,!0)}else if(Gr(c)){var g=Lr((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||qr(t)?{color:i||("html"===this._renderMode?"#fff":"none")}:qr(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),Gr(t)&&(t=t([n,i],r,a.el,u,{viewSize:[s,l],contentSize:p.slice()})),qr(t))n=Cd(t[0],s),i=Cd(t[1],l);else if(Hr(t)){var m=t;m.width=p[0],m.height=p[1];var h=qv(m,{width:s,height:l});n=h.x,i=h.y,c=null,d=null}else if(zr(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-=CV(c)?p[0]/2:"right"===c?p[0]:0),d&&(i-=CV(d)?p[1]/2:"bottom"===d?p[1]:0),aV(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&&Ar(n,(function(n,r){var o=n.dataByAxis||[],s=(e[r]||{}).dataByAxis||[];(a=a&&o.length===s.length)&&Ar(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)&&Ar(o,(function(e,t){var n=l[t];a=a&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex})),i&&Ar(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){!bo.node&&t.getDom()&&(yw(this,"_updatePosition"),this._tooltipContent.dispose(),WB("itemTooltip",t))},t.type="tooltip",t}(M_);function wV(e,t,n){var i,a=t.ecModel;n?(i=new Bg(n,a,a),i=new Bg(t.option,i,a)):i=t;for(var r=e.length-1;r>=0;r--){var o=e[r];o&&(o instanceof Bg&&(o=o.get("tooltip",!0)),zr(o)&&(o={formatter:o}),o&&(i=new Bg(o,i,a)))}return i}function SV(e,t){return e.dispatchAction||Lr(t.dispatchAction,t)}function CV(e){return"center"===e||"middle"===e}function _V(e){QI(nN),e.registerComponentModel(iV),e.registerComponentView(bV),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},yo),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},yo)}var TV=Ar;function IV(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!0}function EV(e,t,n){var i={};return TV(t,(function(t){var a,r=i[t]=((a=function(){}).prototype.__hidden=a.prototype,new a);TV(e[t],(function(e,i){if(OD.isValidType(i)){var a={type:i,visual:e};n&&n(a,t),r[i]=new OD(a),"opacity"===i&&((a=Tr(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new OD(a))}}))})),i}function MV(e,t,n){var i;Ar(n,(function(e){t.hasOwnProperty(e)&&IV(t[e])&&(i=!0)})),i&&Ar(n,(function(n){t.hasOwnProperty(n)&&IV(t[n])?e[n]=Tr(t[n]):delete e[n]}))}kV(0),kV(1);function kV(e){var t=["x","y"],n=["width","height"];return{point:function(t,n,i){if(t){var a=i.range;return PV(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=[],Ar(n,(function(t,n){var i,r=nu(Zd(t),"");Hr(t)?(i=Tr(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 yy([{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}($v),RV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="timeline.slider",t.defaultOption=Dy(FV.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}(FV);Dr(RV,ex.prototype);var BV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="timeline",t}(M_),NV=function(e){function t(t,n,i,a){var r=e.call(this,t,n,i)||this;return r.type=a||"value",r}return ze(t,e),t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return"horizontal"===this.model.get("orient")},t}(xM),LV=Math.PI,VV=ou();!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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 Sx("nameValue",{noName:!0,value:o.scale.getLabel({value:e})})},Ar(["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 qv(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:LV/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*LV/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;jo(r,r,[-o,-s]),Ho(r,r,-LV/2),jo(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||zr(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 _E({ordinalMeta:e.getCategories(),extent:[1/0,-1/0]});case"time":return new EE({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});default:return new IE}}(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 NV("value",a,e.axisExtent,i);return o.model=t,o},t.prototype._createGroup=function(e){var t=this[e]=new Am;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 lh({shape:{x1:a[0],y1:0,x2:a[1],y2:0},style:Mr({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});t.add(r);var o=this._progressLine=new lh({shape:{x1:a[0],x2:this._currentPointer?this._currentPointer.x:a[0],y1:0,y2:0},style:kr({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=[],Ar(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:Lr(a._changeTimeline,a,e.value)},u=qV(s,l,t,d);u.ensureState("emphasis").style=p.getItemStyle(),u.ensureState("progress").style=c.getItemStyle(),am(u);var m=fu(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=[],Ar(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 ld({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:Lr(a._changeTimeline,a,o),silent:!1,style:hg(l,{text:i.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});u.ensureState("emphasis").style=hg(p),u.ensureState("progress").style=hg(c),t.add(u),am(u),VV(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=ds(Jr(i.get(["controlStyle",n+"BtnSize"]),a),a),d=function(e,t,n,i){var a=i.style,r=tg(e.get(["controlStyle",t]),i||{},new is(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),am(d)}}c(e.nextBtnPosition,"next",Lr(this._changeTimeline,this,p?"-":"+")),c(e.prevBtnPosition,"prev",Lr(this._changeTimeline,this,p?"+":"-")),c(e.playPosition,l?"stop":"play",Lr(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=Lr(s._handlePointerDrag,s),e.ondragend=Lr(s._handlePointerDragend,s),GV(e,s._progressLine,r,n,i,!0)},onUpdate:function(e){GV(e,s._progressLine,r,n,i)}};this._currentPointer=qV(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 KV={min:Vr($V,"min"),max:Vr($V,"max"),average:Vr($V,"average"),median:Vr($V,"median")};function YV(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)&&!qr(t.coord)&&qr(a)){var r=XV(t,n,i,e);if((t=Tr(t)).type&&KV[t.type]&&r.baseAxis&&r.valueAxis){var o=Pr(a,r.baseAxis.dim),s=Pr(a,r.valueAxis.dim),l=KV[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&&qr(a))for(var p=t.coord,c=0;c<2;c++)KV[p[c]]&&(p[c]=JV(n,n.mapDimension(a[c]),p[c]));else t.coord=[];return t}}function XV(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 ZV(e,t){return!(e&&e.containData&&t.coord&&!WV(t))||e.containData(t.coord)}function QV(e,t){return e?function(e,n,i,a){return Ff(a<2?e.coord&&e.coord[a]:e.value,t[a])}:function(e,n,i,a){return Ff(e.value,t[a])}}function JV(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 eq=ou(),tq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.init=function(){this.markerGroupMap=uo()},t.prototype.render=function(e,t,n){var i=this,a=this.markerGroupMap;a.each((function(e){eq(e).keep=!1})),t.eachSeries((function(e){var a=HV.getMarkerModelFromSeries(e,i.type);a&&i.renderSeries(e,a,t,n)})),a.each((function(e){!eq(e).keep&&i.group.remove(e.group)}))},t.prototype.markKeep=function(e){eq(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;Ar(e,(function(e){var i=HV.getMarkerModelFromSeries(e,n.type);i&&i.getData().eachItemGraphicEl((function(e){e&&(t?$u(e):Ku(e))}))}))},t.type="marker",t}(M_);function nq(e,t,n){var i=t.coordinateSystem;e.each((function(a){var r,o=e.getItemModel(a),s=Cd(o.get("x"),n.getWidth()),l=Cd(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}ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=HV.getMarkerModelFromSeries(e,"markPoint");t&&(nq(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 db),p=function(e,t,n){var i;i=e?Fr(e&&e.dimensions,(function(e){return Mr(Mr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new yy(i,n),r=Fr(n.get("data"),Vr(YV,t));e&&(r=Br(r,Vr(ZV,e)));var o=QV(!!e,i);return a.initData(r,null,o),a}(a,e,t);t.setData(p),nq(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(Gr(i)||Gr(a)||Gr(r)||Gr(s)){var c=t.getRawValue(e),d=t.getDataParams(e);Gr(i)&&(i=i(c,d)),Gr(a)&&(a=a(c,d)),Gr(r)&&(r=r(c,d)),Gr(s)&&(s=s(c,d))}var u=n.getModel("itemStyle").getItemStyle(),m=mT(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){fu(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markPoint"}(tq);var iq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}(HV),aq=ou(),rq=function(e,t,n,i){var a,r=e.getData();if(qr(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=Qr(i.yAxis,i.xAxis);else{var p=XV(i,r,t,e);s=p.valueAxis,l=JV(r,Ey(r,p.valueDataDim),o)}var c="x"===s.dim?0:1,d=1-c,u=Tr(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&&jr(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=[YV(e,a[0]),YV(e,a[1]),Mr({},a[2])];return g[2].type=g[2].type||null,Ir(g[2],g[0]),Ir(g[2],g[1]),g};function oq(e){return!isNaN(e)&&!isFinite(e)}function sq(e,t,n,i){var a=1-e,r=i.dimensions[e];return oq(t[a])&&oq(n[a])&&t[e]===n[e]&&i.getAxis(r).containData(t[e])}function lq(e,t){if("cartesian2d"===e.type){var n=t[0].coord,i=t[1].coord;if(n&&i&&(sq(1,n,i,e)||sq(0,n,i,e)))return!0}return ZV(e,t[0])&&ZV(e,t[1])}function pq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Cd(s.get("x"),a.getWidth()),p=Cd(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(Nb(o,"cartesian2d")){var m=o.getAxis("x"),h=o.getAxis("y");c=o.dimensions;oq(e.get(c[0],t))?r[0]=m.toGlobalCoord(m.getExtent()[n?0:1]):oq(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 cq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=HV.getMarkerModelFromSeries(e,"markLine");if(t){var i=t.getData(),a=aq(t).from,r=aq(t).to;a.each((function(t){pq(a,t,!0,e,n),pq(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 fO);this.group.add(l.group);var p=function(e,t,n){var i;i=e?Fr(e&&e.dimensions,(function(e){return Mr(Mr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new yy(i,n),r=new yy(i,n),o=new yy([],n),s=Fr(n.get("data"),Vr(rq,t,e,n));e&&(s=Br(s,Vr(lq,e)));var l=QV(!!e,i);return a.initData(Fr(s,(function(e){return e[0]})),null,l),r.initData(Fr(s,(function(e){return e[1]})),null,l),o.initData(Fr(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;aq(t).from=c,aq(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);pq(t,n,a,e,i);var s=r.getModel("itemStyle").getItemStyle();null==s.fill&&(s.fill=mT(o,"color")),t.setItemVisual(n,{symbolKeepAspect:r.get("symbolKeepAspect"),symbolOffset:Jr(r.get("symbolOffset",!0),f[a?0:1]),symbolRotate:Jr(r.get("symbolRotate",!0),g[a?0:1]),symbolSize:Jr(r.get("symbolSize"),h[a?0:1]),symbol:Jr(r.get("symbol",!0),m[a?0:1]),style:s})}qr(m)||(m=[m,m]),qr(h)||(h=[h,h]),qr(g)||(g=[g,g]),qr(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){fu(e).dataModel=t,e.traverse((function(e){fu(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markLine",t}(tq);function dq(e){e.registerComponentModel(iq),e.registerComponentView(cq),e.registerPreprocessor((function(e){zV(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}ze(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"}}}}(HV);var uq=ou(),mq=function(e,t,n,i){var a=i[0],r=i[1];if(a&&r){var o=YV(e,a),s=YV(e,r),l=o.coord,p=s.coord;l[0]=Qr(l[0],-1/0),l[1]=Qr(l[1],-1/0),p[0]=Qr(p[0],1/0),p[1]=Qr(p[1],1/0);var c=Er([{},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 hq(e){return!isNaN(e)&&!isFinite(e)}function gq(e,t,n,i){var a=1-e;return hq(t[a])&&hq(n[a])}function fq(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 Nb(e,"cartesian2d")?!(!n||!i||!gq(1,n,i)&&!gq(0,n,i))||function(e,t,n){return!(e&&e.containZone&&t.coord&&n.coord&&!WV(t)&&!WV(n))||e.containZone(t.coord,n.coord)}(e,a,r):ZV(e,a)||ZV(e,r)}function yq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Cd(s.get(n[0]),a.getWidth()),p=Cd(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(Nb(o,"cartesian2d")){var f=o.getAxis("x"),y=o.getAxis("y"),v=e.get(n[0],t),x=e.get(n[1],t);hq(v)?r[0]=f.toGlobalCoord(f.getExtent()["x0"===n[0]?0:1]):hq(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 vq=[["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}ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=HV.getMarkerModelFromSeries(e,"markArea");if(t){var i=t.getData();i.each((function(t){var a=Fr(vq,(function(a){return yq(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 Am});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=Fr(e&&e.dimensions,(function(e){var n=t.getData();return Mr(Mr({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}));a=Fr(r,(function(e,t){return{name:e,type:o[t%2].type}})),i=new yy(a,n)}else i=new yy(a=[{name:"value",type:"float"}],n);var s=Fr(n.get("data"),Vr(mq,t,e,n));e&&(s=Br(s,Vr(fq,e)));var l=e?function(e,t,n,i){return Ff(e.coord[Math.floor(i/2)][i%2],a[i])}:function(e,t,n,i){return Ff(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=Fr(vq,(function(n){return yq(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}($v),bq=Vr,wq=Ar,Sq=Am,Cq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return ze(t,e),t.prototype.init=function(){this.group.add(this._contentGroup=new Sq),this.group.add(this._selectorGroup=new Sq),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=qv(l,p,c),u=this.layoutInner(e,a,d,i,o,s),m=qv(kr({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=IL(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=uo(),p=t.get("selectedMode"),c=[];n.eachRawSeries((function(e){!e.get("legendHoverLink")&&c.push(e.id)})),wq(t.getData(),(function(a,r){var o=a.get("name");if(!this.newlineDisabled&&(""===o||"\n"===o)){var d=new Sq;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",bq(_q,o,null,i,c)).on("mouseover",bq(Iq,u.name,null,i,c)).on("mouseout",bq(Eq,u.name,null,i,c)),n.ssr&&y.eachChild((function(e){var t=fu(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=Ll(m.fill);g&&0===g[3]&&(g[3]=.2,m=Mr(Mr({},m),{fill:Hl(g,"rgba")}));var f=this._createItem(s,o,r,a,t,e,{},m,h,p,i);f.on("click",bq(_q,null,o,i,c)).on("mouseover",bq(Iq,null,o,i,c)).on("mouseout",bq(Eq,null,o,i,c)),n.ssr&&f.eachChild((function(e){var t=fu(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();wq(e,(function(e){var i=e.type,a=new ld({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect"})}});r.add(a),ug(a,{normal:t.getModel("selectorLabel"),emphasis:t.getModel(["emphasis","selectorLabel"])},{defaultText:e.title}),am(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),wq(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?UT(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 Sq,b=i.getModel("textStyle");if(!Gr(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=eb(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;zr(_)&&_?T=_.replace("{name}",null!=t?t:""):Gr(_)&&(T=_(t));var I=h?b.getTextColor():i.get("inactiveColor");x.add(new ld({style:hg(b,{text:T,x:S,y:m/2,fill:I,align:C,verticalAlign:"middle"},{inheritColor:I})}));var E=new rd({shape:x.getBoundingRect(),style:{fill:"transparent"}}),M=i.getModel("tooltip");return M.get("show")&&rg({el:E,componentModel:a,itemName:t,itemTooltipOption:M.option}),x.add(E),x.eachChild((function(e){e.silent=!0})),E.silent=!p,this.getContentGroup().add(x),am(x),x.__legendDataIndex=n,x},t.prototype.layoutInner=function(e,t,n,i,a,r){var o=this.getContentGroup(),s=this.getSelectorGroup();Vv(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){Vv("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}(M_);function _q(e,t,n,i){Eq(e,t,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=e?e:t}),Iq(e,t,n,i)}function Tq(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=Jr(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 rd({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&&kh(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;Ar(["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",zr(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=Pq[a],o=Dq[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"}(Cq);var Oq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="dataZoom.inside",t.defaultOption=Dy(hL.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(hL),Aq=ou();function Fq(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function Rq(e,t){e.isDisposed()||e.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:t})}function Bq(e,t,n,i){return e.coordinateSystem.containPoint([n,i])}function Nq(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,(function(e,t){var n=Aq(t),i=n.coordSysRecordMap||(n.coordSysRecordMap=uo());i.each((function(e){e.dataZoomInfoMap=null})),e.eachComponent({mainType:"dataZoom",subType:"inside"},(function(e){Ar(uL(e).infoList,(function(n){var a=n.model.uid,r=i.get(a)||i.set(a,function(e,t){var n={model:t,containsPoint:Vr(Bq,t),dispatchAction:Vr(Rq,e),dataZoomInfoMap:null,controller:null},i=n.controller=new wk(e.getZr());return Ar(["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=uo())).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),fw(e,"dispatchAction",t.model.get("throttle",!0),"fixRate")}else Fq(i,e)}))}))}var Lq=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return ze(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){Aq(e).coordSysRecordMap.each((function(e){var i=e.dataZoomInfoMap.get(t.uid);i&&(i.getRange=n)}))}(i,t,{pan:Lr(Vq.pan,this),zoom:Lr(Vq.zoom,this),scrollMove:Lr(Vq.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){!function(e,t){for(var n=Aq(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(KO(0,r,[0,100],0,d.minSpan,d.maxSpan),this.range=r,a[0]!==r[0]||a[1]!==r[1])return r}}},pan:qq((function(e,t,n,i,a,r){var o=Gq[i]([r.oldX,r.oldY],[r.newX,r.newY],t,a,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength})),scrollMove:qq((function(e,t,n,i,a,r){return Gq[i]([0,0],[r.scrollDelta,r.scrollDelta],t,a,n).signal*(e[1]-e[0])*r.scrollDelta}))};function qq(e){return function(t,n,i,a){var r=this.range,o=r.slice(),s=t.axisModels[0];if(s)return KO(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 Gq={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 zq(e){SL(e),e.registerComponentModel(Oq),e.registerComponentView(Lq),Nq(e)}var Uq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=Dy(hL.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}(hL),jq=rd,Hq="horizontal",Wq="vertical",$q=["line","bar","candlestick","scatter","custom"],Kq={easing:"cubicOut",duration:100,delay:0},Yq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return ze(t,e),t.prototype.init=function(e,t){this.api=t,this._onBrush=Lr(this._onBrush,this),this._onBrushEnd=Lr(this._onBrushEnd,this)},t.prototype.render=function(t,n,i,a){if(e.prototype.render.apply(this,arguments),fw(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(){yw(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 Am;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===Hq?{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=jv(e.option);Ar(["right","top","width","height"],(function(e){"ph"===o[e]&&(o[e]=r[e])}));var s=qv(o,a);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===Wq&&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!==Hq||a?n===Hq&&a?{scaleY:o?1:-1,scaleX:-1}:n!==Wq||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 jq({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get("backgroundColor")},z2:-40}));var a=new jq({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:"transparent"},z2:0,onclick:Lr(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:Sd(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 Am,i=new ih({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),a=new rh({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&&Ar(o.getTargetSeriesModels(),(function(e){if(!(n||!0!==t&&Pr($q,e.get("type"))<0)){var o,s=i.getComponent(cL(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 jq({silent:p,style:{fill:o.get("fillerColor")},textConfig:{position:"inside"}});a.add(c),a.add(new jq({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)"}})),Ar([0,1],(function(t){var r=o.get("handleIcon");!Zx[r]&&r.indexOf("path://")<0&&r.indexOf("image://")<0&&(r="path://"+r);var s=eb(r,-1,0,2,2,null,!0);s.attr({cursor:Xq(this._orient),draggable:!0,drift:Lr(this._onDragMove,this,t),ondragend:Lr(this._onDragEnd,this),onmouseover:Lr(this._showDataInfo,this,!0),onmouseout:Lr(this._showDataInfo,this,!1),z2:5});var l=s.getBoundingRect(),p=o.get("handleSize");this._handleHeight=Cd(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(),am(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 ld({silent:!0,invisible:!0,style:hg(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=Cd(o.get("moveHandleSize"),r[1]),m=t.moveHandle=new rd({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=eb(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 rd({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:Xq(this._orient),drift:Lr(this._onDragMove,this,"all"),ondragstart:Lr(this._showDataInfo,this,!0),ondragend:Lr(this._onDragEnd,this),onmouseover:Lr(this._showDataInfo,this,!0),onmouseout:Lr(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[Sd(e[0],[0,100],t,!0),Sd(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];KO(t,i,a,n.get("zoomLock")?"all":e,null!=o.minSpan?Sd(o.minSpan,s,a,!0):null,null!=o.maxSpan?Sd(o.maxSpan,s,a,!0):null);var l=this._range,p=this._range=Td([Sd(i[0],a,s,!0),Sd(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;Ar([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 Ko(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([Sd(n.x,i,a,!0),Sd(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&&(WS(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 jq({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?Kq:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=uL(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}(fL);function Xq(e){return"vertical"===e?"ns-resize":"ew-resize"}function Zq(e){e.registerComponentModel(Uq),e.registerComponentView(Yq),SL(e)}function Qq(e){QI(zq),QI(Zq)}var Jq=function(e,t,n){var i=Tr((eG[e]||{})[t]);return n&&qr(i)?i[i.length-1]:i},eG={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]}},tG=OD.mapVisual,nG=OD.eachVisual,iG=qr,aG=Ar,rG=Td,oG=Sd,sG=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 ze(t,e),t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&MV(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=Lr(e,this),this.controllerVisuals=EV(this.option.controller,t,e),this.targetVisuals=EV(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=Kd(e),t},t.prototype.eachTargetSeries=function(e,t){Ar(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||["<",">"],qr(e)&&(e=e.slice(),i=!0);var l=t?e:i?[p(e[0]),p(e[1])]:p(e);return zr(s)?s.replace("{value}",i?l[0]:l).replace("{value2}",i?l[1]:l):Gr(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=rG([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={});Ir(i,n),Ir(a,n);var r=this.isCategory();function o(n){iG(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]={},aG(i,(function(e,t){if(OD.isValidType(t)){var n=Jq(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";aG(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&&Tr(t)||(r?a:[a])),null==l.symbolSize&&(l.symbolSize=n&&Tr(n)||(r?s[0]:[s[0],s[0]])),l.symbol=tG(l.symbol,(function(e){return"none"===e?a:e}));var p=l.symbolSize;if(null!=p){var c=-1/0;nG(p,(function(e){e>c&&(c=e)})),l.symbolSize=tG(p,(function(e){return oG(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}($v),lG=[20,140],pG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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]=lG[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=lG[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):qr(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),Ar(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=cG(this,"outOfRange",this.getExtent()),n=cG(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 Am("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();fG([0,1],(function(l){var p=a[l];p.setStyle("fill",t.handlesColor[l]),p.y=e[l];var c=gG(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=Xh(n.handleLabelPoints[l],Yh(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=gG(e,r,s,!0),m=o[0]-d/2,h={x:p.x,y:p.y};p.y=u,p.x=m;var g=Xh(l.indicatorLabelPoint,Yh(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||wG(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 IG(e,t,n,i){for(var a=t.targetVisuals[i],r=OD.prepareVisualTypes(a),o={color:mT(e.getData(),"color")},s=0,l=r.length;s0:e.splitNumber>0)&&!e.calculable?"piecewise":"continuous"})),e.registerAction(CG,_G),Ar(TG,(function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)})),e.registerPreprocessor(MG))}function OG(e){e.registerComponentModel(pG),e.registerComponentView(xG),DG(e)}var AG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return ze(t,e),t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],FG[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=Tr(a)):(e.dataExtent=this.getExtent(),e.mappingMethod="piecewise",e.pieceList=Fr(this._pieceList,(function(e){return e=Tr(e),"inRange"!==t&&(e.visual=null),e})))}))},t.prototype.completeVisualOption=function(){var t=this.option,n={},i=OD.listVisualTypes(),a=this.isCategory();function r(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}Ar(t.pieces,(function(e){Ar(i,(function(t){e.hasOwnProperty(t)&&(n[t]=1)}))})),Ar(n,(function(e,n){var i=!1;Ar(this.stateList,(function(e){i=i||r(t,e,n)||r(t.target,e,n)}),this),!i&&Ar(this.stateList,(function(e){(t[e]||(t[e]={}))[n]=Jq(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,Ar(i,(function(e,t){var n=this.getSelectedMapKey(e);a.hasOwnProperty(n)||(a[n]=!0)}),this),"single"===n.selectedMode){var r=!1;Ar(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=Tr(e)},t.prototype.getValueState=function(e){var t=OD.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){OD.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 Ar(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=Dy(sG.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}(sG),FG={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 RG(e,t){var n=e.inverse;("vertical"===e.orient?!n:n)&&t.reverse()}var BG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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=Qr(t.get("showLabel",!0),!p);p&&this._renderEndsText(e,p[0],s,c,o),Ar(l.viewPieceList,(function(i){var l=i.piece,p=new Am;p.onclick=Lr(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 ld({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),Vv(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:hG(i.findTargetDataIndices(t),i)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if("vertical"===t.orient)return mG(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 Am,o=this.visualMapModel.textStyleModel;r.add(new ld({style:hg(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=Fr(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(eb(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=Tr(n.selected),r=t.getSelectedMapKey(e);"single"===i||!0===i?(a[r]=!0,Ar(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}(dG);function NG(e){e.registerComponentModel(AG),e.registerComponentView(BG),DG(e)}function LG(e){QI(OG),QI(NG)}ou();var VG={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},qG=function(){function e(e){if(null==(this._condVal=zr(e)?new RegExp(e):Xr(e)?e:null)){var t="";0,jd(t)}}return e.prototype.evaluate=function(e){var t=typeof e;return zr(t)?this._condVal.test(e):!!jr(t)&&this._condVal.test(e+"")},e}(),GG=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),zG=function(){function e(){}return e.prototype.evaluate=function(){for(var e=this.children,t=0;t=0&&n.attr(m.oldLayoutSelect),Pr(p,"emphasis")>=0&&n.attr(m.oldLayoutEmphasis)),kh(n,s,t,o)}else if(n.attr(s),!wg(n).valueAnimation){var c=Jr(n.style.opacity,1);n.style.opacity=0,Ph(n,{style:{opacity:c}},t,o)}if(m.oldLayout=s,n.states.select){var d=m.oldLayoutSelect={};tz(d,s,nz),tz(d,n.states.select,nz)}if(n.states.emphasis){var u=m.oldLayoutEmphasis={};tz(u,s,nz),tz(u,n.states.emphasis,nz)}Cg(n,o,l,t,t)}if(i&&!i.ignore&&!i.invisible){a=(m=ez(i)).oldLayout;var m,h={points:i.shape.points};a?(i.attr({shape:a}),kh(i,{shape:h},t)):(i.setShape(h),i.style.strokePercent=0,Ph(i,{style:{strokePercent:1}},t)),m.oldLayout=h}},e}(),az=ou();function rz(e){e.registerUpdateLifecycle("series:beforeupdate",(function(e,t,n){var i=az(t).labelManager;i||(i=az(t).labelManager=new iz),i.clearLabels()})),e.registerUpdateLifecycle("series:layoutlabels",(function(e,t,n){var i=az(t).labelManager;n.updatedSeries.forEach((function(e){i.addLabelsOfSeries(t.getViewOfSeriesModel(e))})),i.updateLayoutConfig(t),i.layout(t),i.processLabelsOverall()}))}var oz=Math.sin,sz=Math.cos,lz=Math.PI,pz=2*Math.PI,cz=180/lz,dz=function(){function e(){}return e.prototype.reset=function(e){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,e||4)},e.prototype.moveTo=function(e,t){this._add("M",e,t)},e.prototype.lineTo=function(e,t){this._add("L",e,t)},e.prototype.bezierCurveTo=function(e,t,n,i,a,r){this._add("C",e,t,n,i,a,r)},e.prototype.quadraticCurveTo=function(e,t,n,i){this._add("Q",e,t,n,i)},e.prototype.arc=function(e,t,n,i,a,r){this.ellipse(e,t,n,n,0,i,a,r)},e.prototype.ellipse=function(e,t,n,i,a,r,o,s){var l=o-r,p=!s,c=Math.abs(l),d=Ql(c-pz)||(p?l>=pz:-l>=pz),u=l>0?l%pz:l%pz+pz,m=!1;m=!!d||!Ql(c)&&u>=lz==!!p;var h=e+n*sz(r),g=t+i*oz(r);this._start&&this._add("M",h,g);var f=Math.round(a*cz);if(d){var y=1/this._p,v=(p?1:-1)*(pz-y);this._add("A",n,i,f,1,+p,e+n*sz(r+v),t+i*oz(r+v)),y>.01&&this._add("A",n,i,f,0,+p,h,g)}else{var x=e+n*sz(o),b=t+i*oz(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?Gy(o):o||"")+(i?""+n+Fr(i,(function(t){return e(t)})).join(n)+n:"")+("")}(e)}function Cz(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function _z(e,t,n,i){return wz("svg","root",{width:e,height:t,xmlns:yz,"xmlns:xlink":vz,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+e+" "+t},n)}var Tz=0;function Iz(){return Tz++}var Ez={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"},Mz="transform-origin";function kz(e,t,n){var i=Mr({},e.shape);Mr(i,t),e.buildPath(n,i);var a=new dz;return a.reset(lp(e)),n.rebuildPath(a,1),a.generateStr(),a.getStr()}function Pz(e,t){var n=t.originX,i=t.originY;(n||i)&&(e[Mz]=n+"px "+i+"px")}var Dz={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function Oz(e,t){var n=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function Az(e){return zr(e)?Ez[e]?"cubic-bezier("+Ez[e]+")":_l(e)?e:"":""}function Fz(e,t,n,i){var a=e.animators,r=a.length,o=[];if(e instanceof gh){var s=function(e,t,n){var i,a,r=e.shape.paths,o={};if(Ar(r,(function(e){var t=Cz(n.zrId);t.animation=!0,Fz(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,l=Nr(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=Oz(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 Oz(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-"+Iz();n.cssNodes["."+y]={animation:o.join(",")},t.class=y}}function Rz(e,t,n,i){var a=JSON.stringify(e),r=n.cssStyleCache[a];r||(r=n.zrId+"-cls-"+Iz(),n.cssStyleCache[a]=r,n.cssNodes["."+r+(i?":hover":"")]=e),t.class=t.class?t.class+" "+r:r}var Bz=Math.round;function Nz(e){return e&&zr(e.src)}function Lz(e){return e&&Gr(e.toDataURL)}function Vz(e,t,n,i){fz((function(a,r){var o="fill"===a||"stroke"===a;o&&op(r)?Xz(t,e,a,i):o&&ip(r)?Zz(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=Xl(i.shadowColor),h=m.opacity,g=m.color,f=u/2/l+" "+u/2/p;o=n.zrId+"-s"+n.shadowIdx++,n.defs[o]=wz("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[wz("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 qz(e,t){var n=function(e){if("function"==typeof GC)return GC(e)}(t);n&&(n.each((function(t,n){null!=t&&(e[(xz+n).toLowerCase()]=t+"")})),t.isSilent()&&(e[xz+"silent"]="true"))}function Gz(e){return Ql(e[0]-1)&&Ql(e[1])&&Ql(e[2])&&Ql(e[3]-1)}function zz(e,t,n){if(t&&(!function(e){return Ql(e[4])&&Ql(e[5])}(t)||!Gz(t))){var i=n?10:1e4;e.transform=Gz(t)?"translate("+Bz(t[4]*i)/i+" "+Bz(t[5]*i)/i+")":function(e){return"matrix("+Jl(e[0])+","+Jl(e[1])+","+Jl(e[2])+","+Jl(e[3])+","+ep(e[4])+","+ep(e[5])+")"}(t)}}function Uz(e,t,n){for(var i=e.points,a=[],r=0;r=0&&o||r;s&&(a=Kl(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),Rz(p,t,n,!0)}}(e,r,t),wz(s,e.id+"",r)}function Yz(e,t){return e instanceof $c?Kz(e,t):e instanceof Qc?function(e,t){var n=e.style,i=n.image;if(i&&!zr(i)&&(Nz(i)?i=i.src:Lz(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),zz(o,e.transform),Vz(o,n,e,t),qz(o,e),t.animation&&Fz(e,o,t),wz("image",e.id+"",o)}}(e,t):e instanceof Yc?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||or,r=n.x||0,o=function(e,t,n){return"top"===n?e+=t/2:"bottom"===n&&(e-=t/2),e}(n.y||0,cs(a),n.textBaseline),s={"dominant-baseline":"central","text-anchor":tp[n.textAlign]||n.textAlign};if(hd(n)){var l="",p=n.fontStyle,c=ud(n.fontSize);if(!parseFloat(c))return;var d=n.fontFamily||rr,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),zz(s,e.transform),Vz(s,n,e,t),qz(s,e),t.animation&&Fz(e,s,t),wz("text",e.id+"",s,void 0,i)}}(e,t):void 0}function Xz(e,t,n,i){var a,r=e[n],o={gradientUnits:r.global?"userSpaceOnUse":"objectBoundingBox"};if(ap(r))a="linearGradient",o.x1=r.x,o.y1=r.y,o.x2=r.x2,o.y2=r.y2;else{if(!rp(r))return void 0;a="radialGradient",o.cx=Jr(r.x,.5),o.cy=Jr(r.y,.5),o.r=Jr(r.r,.5)}for(var s=r.colorStops,l=[],p=0,c=s.length;pl?uU(e,null==n[d+1]?null:n[d+1].elm,n,s,d):mU(e,t,o,l))}(n,i,a):lU(a)?(lU(e.text)&&rU(n,""),uU(n,null,a,0,a.length-1)):lU(i)?mU(n,i,0,i.length-1):lU(e.text)&&rU(n,""):e.text!==t.text&&(lU(i)&&mU(n,i,0,i.length-1),rU(n,t.text)))}var fU=0,yU=function(){function e(e,t,n){if(this.type="svg",this.refreshHover=vU("refreshHover"),this.configLayer=vU("configLayer"),this.storage=t,this._opts=n=Mr({},n),this.root=e,this._id="zr"+fU++,this._oldVNode=_z(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=bz("svg");hU(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(cU(e,t))gU(e,t);else{var n=e.elm,i=iU(n);dU(t),null!==i&&(eU(i,t.elm,aU(n)),mU(i,[e],0,0))}}(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return Yz(e,Cz(this._id))},e.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),n=this._width,i=this._height,a=Cz(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=wz("rect","bg",{width:e,height:t,x:"0",y:"0"}),op(n))Xz({fill:n},a.attrs,"fill",i);else if(ip(n))Zz({style:{fill:n},dirty:yo,getBoundingRect:function(){return{width:e,height:t}}},a.attrs,"fill",i);else{var r=Xl(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=wz("g","main",{},[]);this._paintList(t,a,s?s.children:r),s&&r.push(s);var l=Fr(Nr(a.defs),(function(e){return a.defs[e]}));if(l.length&&r.push(wz("defs","defs",{},l)),e.animation){var p=function(e,t,n){var i=(n=n||{}).newline?"\n":"",a=" {"+i,r=i+"}",o=Fr(Nr(e),(function(t){return t+a+Fr(Nr(e[t]),(function(n){return n+":"+e[t][n]+";"})).join(i)+r})).join(i),s=Fr(Nr(t),(function(e){return"@keyframes "+e+a+Fr(Nr(t[e]),(function(n){return n+a+Fr(Nr(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=wz("style","stl",{},[],p);r.push(c)}}return _z(n,i,r,e.useViewBox)},e.prototype.renderToString=function(e){return e=e||{},Sz(this.renderToVNode({animation:Jr(e.cssAnimation,!0),emphasis:Jr(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Jr(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?_U:0),this._needsManuallyCompositing),p.__builtin__||_r("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,Ar(this._layers,(function(e){e.setUnpainted()}))},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?Ir(n[e],t,!0):n[e]=t;for(var i=0;i({legendKey:e,left:!0}),kU=e=>({background:e});function PU(e,n){1&e&&t.ɵɵelementContainer(0)}function DU(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,PU,1,0,"ng-container",8),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e.widgetTitlePanel)}}function OU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Min")))}function AU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Max")))}function FU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Avg")))}function RU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Total")))}function BU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Latest")))}function NU(e,n){1&e&&t.ɵɵelementContainer(0)}function LU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 VU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 qU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 GU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 zU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 UU(e,n){if(1&e&&(t.ɵɵelementStart(0,"tr")(1,"th"),t.ɵɵtemplate(2,NU,1,0,"ng-container",14),t.ɵɵelementEnd(),t.ɵɵtemplate(3,LU,2,4,"td",15)(4,VU,2,4,"td",15)(5,qU,2,4,"td",15)(6,GU,2,4,"td",15)(7,zU,2,4,"td",15),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,MU,e)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showMin),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showMax),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showAvg),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showTotal),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showLatest)}}function jU(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"table",10)(2,"thead")(3,"tr"),t.ɵɵelement(4,"th"),t.ɵɵtemplate(5,OU,3,3,"th",11)(6,AU,3,3,"th",11)(7,FU,3,3,"th",11)(8,RU,3,3,"th",11)(9,BU,3,3,"th",11),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"tbody"),t.ɵɵtemplate(11,UU,8,9,"tr",12),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngIf",!0===e.legendConfig.showMin),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showMax),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showAvg),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showTotal),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showLatest),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",e.legendKeys)}}function HU(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",18),t.ɵɵelement(2,"div",19)(3,"div",20),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,kU,e.dataKey.color)),t.ɵɵadvance(),t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(4,5,e.dataKey.label,"html"),t.ɵɵsanitizeHtml)}}class WU{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=Ze.init(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=Qe(this.myChart,this.yAxis.mainType,this.yAxis.id),n=Je(this.myChart,this.yAxis.mainType,this.yAxis.id,this.yAxis.name),i=Qe(this.myChart,this.xAxis.mainType,this.xAxis.id),a=t+n,r=i+Je(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(){Ze.use([_V,iN,LG,Qq,dq,RN,fk,Jb,Gw,RS,yk,vB,rz,IU,xU])}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=ke(this.ctx.data[t].dataKey.decimals)?this.ctx.data[t].dataKey.decimals:this.ctx.decimals,s=ke(this.ctx.data[t].dataKey.units)?this.ctx.data[t].dataKey.units:this.ctx.units,l=Pe(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=>Pe(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||WU)(t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(et.DomSanitizer),t.ɵɵdirectiveInject(tt.WidgetComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:WU,selectors:[["tb-gateway-statistics-chart"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(EU,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"],[4,"ngIf"],[1,"tb-time-series-chart-content"],[1,"tb-time-series-chart-shape"],["class","tb-time-series-chart-legend",4,"ngIf"],[4,"ngTemplateOutlet"],[1,"tb-time-series-chart-legend"],[1,"tb-time-series-chart-legend-table","vertical"],["class","tb-time-series-chart-legend-type-label right legend legend-row-color",4,"ngIf"],[4,"ngFor","ngForOf"],[1,"tb-time-series-chart-legend-type-label","right","legend","legend-row-color"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["class","tb-time-series-chart-legend-value legend",3,"innerHTML",4,"ngIf"],[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,DU,2,1,"ng-container",4),t.ɵɵelementStart(3,"div",5),t.ɵɵelement(4,"div",6,0),t.ɵɵtemplate(6,jU,12,6,"div",7)(7,HU,5,10,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.widgetComponent.dashboardWidget.showWidgetTitlePanel),t.ɵɵadvance(),t.ɵɵclassMap(n.legendClass),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.showLegend))},dependencies:t.ɵɵgetComponentDepsFactory(WU,[j,_]),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 $U=["statisticChart"];function KU(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 YU(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 XU(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 ZU(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,YU,2,1,"tb-gateway-statistics-chart",14)(2,XU,1,1,"tb-custom-statistics-table",15),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵconditional(e.isNumericData?1:2)}}function QU(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 JU{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:F(R.timeseries)},this.statisticForm.get("command").valueChanges.pipe(wn()).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===B)return;this.getGatewayGeneralConfig().pipe(wn(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(ar,{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(xe((e=>re(this.getGatewayGeneralConfig(),ae(e)))),xe((([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)))),wn(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(ve(Boolean),xe((()=>this.getGatewayGeneralConfig())),xe((t=>(this.commands=[...t.statistics.commands.filter((t=>t.attributeOnGateway!==e))],this.updateStatisticsCommands(t,this.commands)))),wn(this.destroyRef)).subscribe()}getGatewayGeneralConfig(){const e=this.ctx.defaultSubscription.datasources[0].entity;return e.id.id===B?ae(null):this.attributeService.getEntityAttributes(e.id,D.SHARED_SCOPE,["general_configuration"]).pipe(pe((e=>e[0]?.value)))}updateStatisticsCommands(e,t){const n=this.ctx.defaultSubscription.datasources[0].entity;return n.id.id!==B&&e?this.attributeService.saveEntityAttributes(n.id,D.SHARED_SCOPE,[{key:"general_configuration",value:{...e,statistics:{...e.statistics,commands:t}}}]):ae(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(R.timeseries,e,this.subscriptionOptions,!1,!0).pipe(wn(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||JU)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(_e.UtilsService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:JU,selectors:[["tb-gateway-statistics"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery($U,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,KU,8,6),t.ɵɵelementEnd()(),t.ɵɵtemplate(16,ZU,3,1,"div",10)(17,QU,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(JU,[j,_,On,qn,WU]),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 ej;e("GatewayStatisticsComponent",JU),e("BACnetRequestTypes",ej),function(e){e.WriteProperty="writeProperty",e.ReadProperty="readProperty"}(ej||e("BACnetRequestTypes",ej={}));const tj=e("BACnetRequestTypesTranslates",new Map([[ej.WriteProperty,"gateway.rpc.write-property"],[ej.ReadProperty,"gateway.rpc.read-property"]]));var nj;e("BACnetObjectTypes",nj),function(e){e.BinaryInput="binaryInput",e.BinaryOutput="binaryOutput",e.AnalogInput="analogInput",e.AnalogOutput="analogOutput",e.BinaryValue="binaryValue",e.AnalogValue="analogValue"}(nj||e("BACnetObjectTypes",nj={}));const ij=e("BACnetObjectTypesTranslates",new Map([[nj.AnalogOutput,"gateway.rpc.analog-output"],[nj.AnalogInput,"gateway.rpc.analog-input"],[nj.BinaryOutput,"gateway.rpc.binary-output"],[nj.BinaryInput,"gateway.rpc.binary-input"],[nj.BinaryValue,"gateway.rpc.binary-value"],[nj.AnalogValue,"gateway.rpc.analog-value"]]));var aj;e("BLEMethods",aj),function(e){e.WRITE="write",e.READ="read",e.SCAN="scan"}(aj||e("BLEMethods",aj={}));const rj=e("BLEMethodsTranslates",new Map([[aj.WRITE,"gateway.rpc.write"],[aj.READ,"gateway.rpc.read"],[aj.SCAN,"gateway.rpc.scan"]]));var oj,sj;e("CANByteOrders",oj),function(e){e.LITTLE="LITTLE",e.BIG="BIG"}(oj||e("CANByteOrders",oj={})),e("SocketMethodProcessings",sj),function(e){e.WRITE="write",e.READ="read"}(sj||e("SocketMethodProcessings",sj={}));const lj=e("SocketMethodProcessingsTranslates",new Map([[sj.WRITE,"gateway.rpc.write"],[sj.READ,"gateway.rpc.read"]]));var pj;e("SNMPMethods",pj),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"}(pj||e("SNMPMethods",pj={}));const cj=e("SNMPMethodsTranslations",new Map([[pj.SET,"gateway.rpc.set"],[pj.MULTISET,"gateway.rpc.multiset"],[pj.GET,"gateway.rpc.get"],[pj.BULKWALK,"gateway.rpc.bulk-walk"],[pj.TABLE,"gateway.rpc.table"],[pj.MULTIGET,"gateway.rpc.multi-get"],[pj.GETNEXT,"gateway.rpc.get-next"],[pj.BULKGET,"gateway.rpc.bulk-get"],[pj.WALKS,"gateway.rpc.walk"]]));var dj,uj;e("SocketEncodings",dj),function(e){e.UTF_8="utf-8"}(dj||e("SocketEncodings",dj={})),e("RestSecurityType",uj),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic"}(uj||e("RestSecurityType",uj={}));const mj=e("RestSecurityTypeTranslationsMap",new Map([[uj.ANONYMOUS,"gateway.broker.security-types.anonymous"],[uj.BASIC,"gateway.broker.security-types.basic"]]));class hj{transform(e){return e.map((e=>(e?.value??e).toString())).join(", ")}static{this.ɵfac=function(e){return new(e||hj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getRpcTemplateArrayView",type:hj,pure:!0,standalone:!0})}}e("RpcTemplateArrayViewPipe",hj);class gj{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=>{ke(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||gj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"keyValueIsNotEmpty",type:gj,pure:!1,standalone:!0})}}e("KeyValueIsNotEmptyPipe",gj);const fj=e=>({$implicit:e,innerValue:!1}),yj=e=>({"padding-left":e}),vj=(e,t)=>({"boolean-true":e,"boolean-false":t}),xj=e=>({$implicit:e,innerValue:!0});function bj(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext();const i=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,fj,e))}}function wj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",19),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 Sj(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(12);t.ɵɵproperty("ngTemplateOutlet",e)}}function Cj(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(10);t.ɵɵproperty("ngTemplateOutlet",e)}}function _j(e,n){if(1&e&&(t.ɵɵelementStart(0,"div"),t.ɵɵtemplate(1,Cj,1,1,"ng-container",21),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵreference(8),i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction2(4,vj,!0===e.value,!1===e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",i.type===a.ConnectorType.SNMP&&"method"===e.key)("ngIfElse",n)}}function Tj(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate(e.value)}}function Ij(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 Ej(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext(3);const i=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,xj,e))}}function Mj(e,n){if(1&e&&(t.ɵɵtemplate(0,Ej,1,4,"ng-container",12),t.ɵɵpipe(1,"keyvalue")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("ngForOf",t.ɵɵpipeBind2(1,1,e.value,n.originalOrder))}}function kj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14)(1,"div",15),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,wj,3,3,"div",16)(5,Sj,1,1,"ng-container",17)(6,_j,2,7,"div",18)(7,Tj,1,1,"ng-template",null,1,t.ɵɵtemplateRefExtractor)(9,Ij,2,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor)(11,Mj,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=n.innerValue,a=t.ɵɵnextContext(2);t.ɵɵstyleMap(t.ɵɵpureFunction1(10,yj,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.ɵɵproperty("ngIf",a.isArray(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",a.isObject(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!a.isObject(e.value)&&!a.isArray(e.value))}}function Pj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",6)(1,"mat-expansion-panel-header")(2,"mat-panel-title",7)(3,"span",8),t.ɵɵtext(4),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-panel-description")(6,"button",9),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",10),t.ɵɵtext(8,"delete"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",11),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",10),t.ɵɵtext(11,"play_arrow"),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(12,bj,1,4,"ng-container",12),t.ɵɵpipe(13,"keyValueIsNotEmpty"),t.ɵɵtemplate(14,kj,13,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.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(13,3,e.config))}}class Dj{constructor(e){this.attributeService=e,this.saveTemplate=new u,this.useTemplate=new u,this.ConnectorType=dt,this.originalOrder=()=>0,this.isObject=e=>De(e),this.isArray=e=>Array.isArray(e),this.SNMPMethodsTranslations=cj}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},D.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||Dj)(t.ɵɵdirectiveInject(_e.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Dj,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:4,vars:4,consts:[["RPCTemplateRef",""],["value",""],["SNMPMethod",""],["RPCObjectRow",""],[1,"mat-subtitle-1","title"],["hideToggle","",4,"ngFor","ngForOf"],["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",4,"ngFor","ngForOf"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"rpc-params-row","flex"],[1,"template-key"],["tbTruncateWithTooltip","","class","array-value",4,"ngIf"],[3,"ngTemplateOutlet",4,"ngIf"],[3,"class",4,"ngIf"],["tbTruncateWithTooltip","",1,"array-value"],[3,"ngTemplateOutlet"],[3,"ngTemplateOutlet",4,"ngIf","ngIfElse"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,Pj,16,5,"mat-expansion-panel",5)),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,"gateway.rpc.templates-title")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcTemplates))},dependencies:t.ɵɵgetComponentDepsFactory(Dj,[j,_,hj,gj]),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 Oj(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 Aj(e,n){1&e&&(t.ɵɵelementStart(0,"div",12),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",Dj);class Fj extends A{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("",[$.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||Fj)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Fj,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["class","mat-mdc-form-field-error","style","margin-top: -15px; padding-left: 10px; font-size: 14px;",4,"ngIf"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"mat-mdc-form-field-error",2,"margin-top","-15px","padding-left","10px","font-size","14px"]],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,Oj,3,3,"mat-error",7),t.ɵɵelementEnd(),t.ɵɵtemplate(12,Aj,3,3,"div",8),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",9)(14,"button",10),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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.ɵɵproperty("ngIf",n.templateNameCtrl.hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.validateDuplicateName(n.templateNameCtrl)),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(Fj,[j,_]),encapsulation:2})}}function Rj(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",6),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 Bj(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.username-required"))}function Nj(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.password-required"))}function Lj(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7)(2,"div",8),t.ɵɵtext(3,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",9)(5,"mat-form-field",10),t.ɵɵelement(6,"input",11),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,Bj,3,3,"mat-icon",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",7)(10,"div",8),t.ɵɵtext(11,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"div",9)(13,"mat-form-field",10),t.ɵɵelement(14,"input",13),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,Nj,3,3,"mat-icon",12),t.ɵɵelementStart(17,"div",14),t.ɵɵelement(18,"tb-toggle-password",15),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("password").hasError("required")&&e.securityFormGroup.get("password").touched),t.ɵɵadvance(),t.ɵɵclassProp("hide-toggle",e.securityFormGroup.get("password").hasError("required"))}}e("GatewayServiceRPCConnectorTemplateDialogComponent",Fj);class Vj{constructor(e){this.fb=e,this.BrokerSecurityType=uj,this.securityTypes=Object.values(uj),this.SecurityTypeTranslationsMap=mj,this.destroy$=new te,this.propagateChange=e=>{},this.securityFormGroup=this.fb.group({type:[uj.ANONYMOUS,[]],username:["",[$.required,$.pattern(rn)]],password:["",[$.required,$.pattern(rn)]]}),this.observeSecurityForm()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){e.type||(e.type=uj.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===uj.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(le(this.destroy$)).subscribe((e=>this.updateView(e))),this.securityFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.updateValidators(e)))}static{this.ɵfac=function(e){return new(e||Vj)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Vj,selectors:[["tb-rest-connector-security"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>Vj)),multi:!0},{provide:K,useExisting:c((()=>Vj)),multi:!0}]),t.ɵɵStandaloneFeature],decls:7,vars:3,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",4,"ngFor","ngForOf"],[4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(5,Rj,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵtemplate(6,Lj,19,10,"ng-container",5),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value===n.BrokerSecurityType.BASIC))},dependencies:t.ɵɵgetComponentDepsFactory(Vj,[_,j]),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",Vj);const qj=e=>({type:e});function Gj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 zj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 Uj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",9),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",11),t.ɵɵtemplate(10,Gj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",13),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-form-field",15)(18,"mat-label"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-select",16),t.ɵɵtemplate(22,zj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",17),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"mat-form-field",10)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,8,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,10,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetRequestTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,12,"gateway.rpc.requestTimeout")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,14,"gateway.rpc.objectType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetObjectTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,16,"gateway.rpc.identifier")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,18,"gateway.rpc.propertyId"))}}function jj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 Hj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",21),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",10)(11,"mat-label"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-select",22),t.ɵɵtemplate(15,jj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"mat-slide-toggle",23),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,7,"gateway.rpc.characteristicUUID")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bLEMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.rpc.withResponse")," ")}}function Wj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 $j(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",24),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",25),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",26),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-slide-toggle",27),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-slide-toggle",28),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",14)(20,"mat-form-field",15)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",15)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-select",30),t.ɵɵtemplate(30,Wj,3,4,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",14)(32,"mat-form-field",15)(33,"mat-label"),t.ɵɵtext(34),t.ɵɵpipe(35,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(36,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",15)(38,"mat-label"),t.ɵɵtext(39),t.ɵɵpipe(40,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(41,"input",32),t.ɵɵelementEnd()(),t.ɵɵelementStart(42,"mat-form-field")(43,"mat-label"),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(46,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(47,"mat-form-field")(48,"mat-label"),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(51,"input",34),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,14,"gateway.rpc.nodeID")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,16,"gateway.rpc.isExtendedID")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,18,"gateway.rpc.isFD")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,20,"gateway.rpc.bitrateSwitch")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,22,"gateway.rpc.dataLength")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,24,"gateway.rpc.dataByteorder")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.cANByteOrders),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(35,26,"gateway.rpc.dataBefore")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(40,28,"gateway.rpc.dataAfter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(45,30,"gateway.rpc.dataInHEX")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(50,32,"gateway.rpc.dataExpression"))}}function Kj(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),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 Yj(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 Xj(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 Zj(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 Qj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",45)(1,"mat-form-field",46),t.ɵɵelement(2,"input",47),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-icon",48),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 Jj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",39),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵtemplate(10,Zj,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-slide-toggle",38),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"fieldset",41)(15,"span",42),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(18,Qj,6,4,"div",43),t.ɵɵelementStart(19,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addSNMPoid())})),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,7,"gateway.rpc.requestFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,9,"gateway.rpc.method")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sNMPMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,11,"gateway.rpc.withResponse")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(17,13,"gateway.rpc.oids"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",e.getFormArrayControls("oid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,15,"gateway.rpc.add-oid")," ")}}function eH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function tH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",65),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",64),t.ɵɵelement(5,"input",66),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-icon",67),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 nH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,tH,9,4,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function iH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",49),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",14)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,eH,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",14)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",54),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",55),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"fieldset",56)(39,"span",42),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(42,nH,11,7,"div",57),t.ɵɵelementStart(43,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,11,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,13,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,15,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,17,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,19,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,21,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,23,"gateway.rpc.valueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,25,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(45,27,"gateway.rpc.add-header")," ")}}function aH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function rH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",73),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",64),t.ɵɵelement(6,"input",74),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-icon",67),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 oH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,rH,10,7,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function sH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",68),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",59)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,aH,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",59)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",69),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",70),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",71),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field")(39,"mat-label"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",72),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"fieldset",56)(44,"span",42),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(47,oH,11,7,"div",57),t.ɵɵelementStart(48,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,14,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,16,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,18,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,20,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,22,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,24,"gateway.rpc.requestValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,26,"gateway.rpc.responseValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(46,28,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(50,30,"gateway.rpc.add-header")," ")}}function lH(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 pH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",75),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",76),t.ɵɵelementStart(10,"mat-icon",77),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,lH,3,3,"mat-error",78),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.ɵɵproperty("ngIf",e.commandForm.get("params").hasError("invalidJSON"))}}function cH(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,6),t.ɵɵtemplate(1,Uj,33,20,"ng-template",7)(2,Hj,19,13,"ng-template",7)(3,$j,52,34,"ng-template",7)(4,Kj,10,6,"ng-template",7)(5,Yj,13,9,"ng-template",7)(6,Xj,13,9,"ng-template",7)(7,Jj,22,17,"ng-template",7)(8,iH,46,29,"ng-template",7)(9,sH,51,32,"ng-template",7)(10,pH,14,10,"ng-template",8),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.CAN),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.FTP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OCPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.XMPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SNMP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REQUEST)}}class dH{constructor(e,t){this.fb=e,this.dialog=t,this.sendCommand=new u,this.saveTemplate=new u,this.ConnectorType=dt,this.bACnetRequestTypes=Object.values(ej),this.bACnetObjectTypes=Object.values(nj),this.bLEMethods=Object.values(aj),this.cANByteOrders=Object.values(oj),this.sNMPMethods=Object.values(pj),this.hTTPMethods=Object.values(gt),this.bACnetRequestTypesTranslates=tj,this.bACnetObjectTypesTranslates=ij,this.bLEMethodsTranslates=rj,this.SNMPMethodsTranslations=cj,this.gatewayConnectorDefaultTypesTranslates=ut,this.urlPattern=/^[-a-zA-Zd_$:{}?~+=\/.0-9-]*$/,this.numbersOnlyPattern=/^[0-9]*$/,this.hexOnlyPattern=/^[0-9A-Fa-f ]+$/,this.propagateChange=e=>{},this.destroy$=new te}ngOnInit(){this.commandForm=this.connectorParamsFormGroupByType(this.connectorType),this.observeFormChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}connectorParamsFormGroupByType(e){let t;switch(e){case dt.BACNET:t=this.fb.group({method:[null,[$.required,$.pattern(rn)]],requestType:[null,[$.required,$.pattern(rn)]],requestTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],objectType:[null,[]],identifier:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],propertyId:[null,[$.required,$.pattern(rn)]]});break;case dt.BLE:t=this.fb.group({methodRPC:[null,[$.required,$.pattern(rn)]],characteristicUUID:["00002A00-0000-1000-8000-00805F9B34FB",[$.required,$.pattern(rn)]],methodProcessing:[null,[$.required]],withResponse:[!1,[]]});break;case dt.CAN:t=this.fb.group({method:[null,[$.required,$.pattern(rn)]],nodeID:[null,[$.required,$.min(0),$.pattern(this.numbersOnlyPattern)]],isExtendedID:[!1,[]],isFD:[!1,[]],bitrateSwitch:[!1,[]],dataLength:[null,[$.min(1),$.pattern(this.numbersOnlyPattern)]],dataByteorder:[null,[]],dataBefore:[null,[$.pattern(rn),$.pattern(this.hexOnlyPattern)]],dataAfter:[null,[$.pattern(rn),$.pattern(this.hexOnlyPattern)]],dataInHEX:[null,[$.pattern(rn),$.pattern(this.hexOnlyPattern)]],dataExpression:[null,[$.pattern(rn)]]});break;case dt.FTP:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],valueExpression:[null,[$.required,$.pattern(rn)]]});break;case dt.OCPP:case dt.XMPP:t=this.fb.group({methodRPC:[null,[$.required,$.pattern(rn)]],valueExpression:[null,[$.required,$.pattern(rn)]],withResponse:[!1,[]]});break;case dt.SNMP:t=this.fb.group({requestFilter:[null,[$.required,$.pattern(rn)]],method:[null,[$.required]],withResponse:[!1,[]],oid:this.fb.array([],[$.required])});break;case dt.REST:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],httpMethod:[null,[$.required]],requestUrlExpression:[null,[$.required,$.pattern(this.urlPattern)]],responseTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],timeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],tries:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],valueExpression:[null,[$.required,$.pattern(rn)]],httpHeaders:this.fb.array([]),security:[{},[$.required]]});break;case dt.REQUEST:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],httpMethod:[null,[$.required]],requestUrlExpression:[null,[$.required,$.pattern(this.urlPattern)]],responseTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],timeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],tries:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],requestValueExpression:[null,[$.required,$.pattern(rn)]],responseValueExpression:[null,[$.pattern(rn)]],httpHeaders:this.fb.array([])});break;default:t=this.fb.group({command:[null,[$.required,$.pattern(rn)]],params:[{},[lt]]})}return t}addSNMPoid(e=null){const t=this.commandForm.get("oid");t&&t.push(this.fb.control(e,[$.required,$.pattern(rn)]),{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,[$.required,$.pattern(rn)]],value:[e.value,[$.required,$.pattern(rn)]]});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(nt,{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=Oe(e),this.connectorType){case dt.SNMP:this.clearFromArrayByName("oid"),e.oid.forEach((e=>{this.addSNMPoid(e)})),delete e.oid;break;case dt.REQUEST:case dt.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(le(this.destroy$)).subscribe((e=>{this.connectorType!==dt.REST&&this.connectorType!==dt.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||dH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(qe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:dH,selectors:[["tb-gateway-service-rpc-connector"]],inputs:{connectorType:"connectorType"},outputs:{sendCommand:"sendCommand",saveTemplate:"saveTemplate"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>dH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:12,vars:16,consts:[[1,"command-form","flex","flex-col",3,"formGroup"],[1,"mat-subtitle-1","title"],[3,"ngIf"],[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"],[3,"ngSwitch"],[3,"ngSwitchCase"],["ngSwitchDefault",""],["matInput","","formControlName","method","placeholder","set_state"],[1,"mat-block"],["formControlName","requestType"],[3,"value",4,"ngFor","ngForOf"],["matInput","","formControlName","requestTimeout","type","number","min","10","step","1","placeholder","1000"],[1,"flex","flex-1","flex-row","gap-2.5"],[1,"flex-1"],["formControlName","objectType"],["matInput","","formControlName","identifier","type","number","min","1","step","1","placeholder","1"],["matInput","","formControlName","propertyId","placeholder","presentValue"],[3,"value"],["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"],["class","flex flex-1 flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","flex-row","items-center","justify-center","gap-2.5"],["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"],[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"],["class","flex flex-col gap-2.5 border",4,"ngIf"],[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"],["class","flex flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],[3,"formGroupName"],["appearance","outline",1,"flex-1"],["matInput","","formControlName","headerName"],["matInput","","formControlName","value","placeholder","application/json"],[2,"cursor","pointer","width","30px",3,"click","matTooltip"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","1"],["matInput","","formControlName","requestValueExpression","placeholder","${params}"],["matInput","","formControlName","responseValueExpression","placeholder","${temp}"],["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"],[4,"ngIf"]],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,cH,11,10,"ng-template",2),t.ɵɵelementStart(5,"div",3)(6,"button",4),t.ɵɵlistener("click",(function(){return n.save()})),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",5),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,qj,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorType),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(dH,[j,_]),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 uH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function mH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),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 hH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function gH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function fH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"mat-form-field",3)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",14),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,gH,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.ɵɵproperty("ngIf",e.rpcParametersFormGroup.get("value").hasError("required")&&e.rpcParametersFormGroup.get("value").touched)}}class yH{constructor(e){this.fb=e,this.ModbusEditableDataTypes=Kt,this.ModbusFunctionCodeTranslationsMap=Qt,this.modbusDataTypes=Object.values($t),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 te,this.rpcParametersFormGroup=this.fb.group({type:[$t.BYTES,[$.required]],functionCode:[this.defaultFunctionCodes[0],[$.required]],value:[{value:"",disabled:!0},[$.required,$.pattern(rn)]],address:[null,[$.required]],objectsCount:[1,[$.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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeKeyDataType(){this.rpcParametersFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.ModbusEditableDataTypes.includes(e)||this.rpcParametersFormGroup.get("objectsCount").patchValue(Yt[e],{emitEvent:!1}),this.updateFunctionCodes(e)}))}observeFunctionCode(){this.rpcParametersFormGroup.get("functionCode").valueChanges.pipe(le(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===$t.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||yH)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yH,selectors:[["tb-gateway-modbus-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>yH)),multi:!0},{provide:K,useExisting:c((()=>yH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:35,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"],[1,"flex-1"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["formControlName","functionCode"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],["class","flex",4,"ngIf"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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.ɵɵtemplate(13,uH,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-form-field",3)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-select",6),t.ɵɵtemplate(19,mH,3,4,"mat-option",5),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",2)(21,"mat-form-field",3)(22,"mat-label"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",7),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,hH,3,3,"mat-icon",8),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",3)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",9),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,fH,8,7,"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.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(17,20,"gateway.rpc.functionCode")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.functionCodes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,22,"gateway.rpc.address")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.rpcParametersFormGroup.get("address").hasError("required")&&n.rpcParametersFormGroup.get("address").touched),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,26,"gateway.rpc.objectsCount")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,28,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(n.rpcParametersFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.writeFunctionCodes.includes(n.rpcParametersFormGroup.get("functionCode").value)))},dependencies:t.ɵɵgetComponentDepsFactory(yH,[j,_]),styles:['@charset "UTF-8";[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:d.OnPush})}}function vH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 xH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 bH{constructor(e){this.fb=e,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new te,this.rpcParametersFormGroup=this.fb.group({methodFilter:[null,[$.required,$.pattern(rn)]],requestTopicExpression:[null,[$.required,$.pattern(rn)]],responseTopicExpression:[{value:null,disabled:!0},[$.required,$.pattern(rn)]],responseTimeout:[{value:null,disabled:!0},[$.min(10),$.pattern(on)]],valueExpression:[null,[$.required,$.pattern(rn)]],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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeWithResponse(){this.rpcParametersFormGroup.get("withResponse").valueChanges.pipe(me((e=>this.toggleResponseFields(e))),le(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||bH)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bH,selectors:[["tb-gateway-mqtt-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>bH)),multi:!0},{provide:K,useExisting:c((()=>bH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","requestTopicExpression","placeholder","sensor/${deviceName}/request/${methodName}/${requestId}"],["formControlName","withResponse",1,"margin",3,"click"],[4,"ngIf"],["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")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",1),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-slide-toggle",3),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,vH,5,3,"mat-form-field",4)(15,xH,5,3,"mat-form-field",4),t.ɵɵelementStart(16,"mat-form-field")(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.ɵɵproperty("ngIf",null==(e=n.rpcParametersFormGroup.get("withResponse"))?null:e.value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",null==(i=n.rpcParametersFormGroup.get("withResponse"))?null:i.value),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(19,13,"gateway.rpc.valueExpression"))}},dependencies:t.ɵɵgetComponentDepsFactory(bH,[j,_]),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 wH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",26),t.ɵɵelement(1,"mat-icon",27),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 SH(e,n){1&e&&(t.ɵɵelement(0,"input",28),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function CH(e,n){1&e&&(t.ɵɵelement(0,"input",29),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function _H(e,n){1&e&&(t.ɵɵelement(0,"input",30),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function TH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",31)(1,"mat-option",26),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",26),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function IH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",32),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function EH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"div",9)(2,"div",10),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12)(6,"mat-select",13)(7,"mat-select-trigger")(8,"div",14),t.ɵɵelement(9,"mat-icon",15),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(13,wH,5,5,"mat-option",16),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",17)(15,"div",10),t.ɵɵtext(16,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-form-field",18),t.ɵɵelementContainerStart(18,19),t.ɵɵtemplate(19,SH,2,3,"input",20)(20,CH,2,3,"input",21)(21,_H,2,3,"input",22)(22,TH,5,2,"mat-select",23),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(23,IH,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",25),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;const a=n.$implicit,r=t.ɵɵnextContext();t.ɵɵproperty("formGroup",a),t.ɵɵadvance(9),t.ɵɵproperty("svgIcon",null==(e=r.valueTypes.get(a.get("type").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,11,null==(i=r.valueTypes.get(a.get("type").value))?null:i.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",r.valueTypeKeys),t.ɵɵadvance(5),t.ɵɵproperty("ngSwitch",a.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",a.get(a.get("type").value+"Value").hasError("required")&&a.get(a.get("type").value+"Value").touched),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(25,13,"gateway.rpc.remove"))}}class MH{constructor(e,t){this.fb=e,this.cdr=t,this.valueTypeKeys=Object.values(Xt),this.MappingValueType=Xt,this.valueTypes=Zt,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new te,this.rpcParametersFormGroup=this.fb.group({method:[null,[$.required,$.pattern(rn)]],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(le(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??Xt.STRING],stringValue:[e.stringValue??{value:"",disabled:!(Se(e,{})||e.stringValue)},[$.required,$.pattern(rn)]],integerValue:[{value:e.integerValue??0,disabled:!ke(e.integerValue)},[$.required,$.pattern(on)]],doubleValue:[{value:e.doubleValue??0,disabled:!ke(e.doubleValue)},[$.required]],booleanValue:[{value:e.booleanValue??!1,disabled:!ke(e.booleanValue)},[$.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(le(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||MH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:MH,selectors:[["tb-gateway-opc-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>MH)),multi:!0},{provide:K,useExisting:c((()=>MH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:18,vars:14,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","tb-flex","no-padding-top","hint-container"],[1,"tb-flex"],["matInput","","formControlName","method","placeholder","multiply"],["formArrayName","arguments",1,"tb-form-panel","stroked","arguments-container"],[1,"fields-label"],["class","flex flex-1 items-center justify-center gap-2.5",3,"formGroup",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","items-center","justify-center","gap-2.5",3,"formGroup"],[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",4,"ngFor","ngForOf"],[1,"tb-form-row","column-xs","value-container","item-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","matTooltip"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["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"]],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.ɵɵtemplate(14,EH,28,15,"div",6),t.ɵɵelementStart(15,"button",7),t.ɵɵlistener("click",(function(){return n.addArgument()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,6,"gateway.rpc.hint.opc-method")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,8,"gateway.rpc.method")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,10,"gateway.rpc.arguments")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcParametersFormGroup.get("arguments").controls),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,12,"gateway.rpc.add-argument")," "))},dependencies:t.ɵɵgetComponentDepsFactory(MH,[j,_]),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 kH(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.SocketMethodProcessingsTranslates.get(e))," ")}}function PH(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.toUpperCase()," ")}}class DH extends Ba{constructor(){super(...arguments),this.SocketMethodProcessingsTranslates=lj,this.socketMethodProcessings=Object.values(sj),this.socketEncoding=Object.values(ht)}initFormGroup(){return this.fb.group({methodRPC:[null,[$.required,$.pattern(rn)]],methodProcessing:[sj.WRITE,[$.required]],encoding:[dj.UTF_8,[$.required,$.pattern(rn)]],withResponse:[!1,[]]})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(DH)))(n||DH)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:DH,selectors:[["tb-gateway-socket-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>DH)),multi:!0},{provide:K,useExisting:c((()=>DH)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],[1,"w-full"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],[1,"mat-block"],["formControlName","methodProcessing"],[3,"value",4,"ngFor","ngForOf"],["formControlName","encoding"],["formControlName","withResponse",1,"mat-slide","margin"],[3,"value"]],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.ɵɵtemplate(11,kH,3,4,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",3)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-select",6),t.ɵɵtemplate(17,PH,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"mat-slide-toggle",7),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketMethodProcessings),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,11,"gateway.encoding")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(20,13,"gateway.rpc.withResponse")," "))},dependencies:t.ɵɵgetComponentDepsFactory(DH,[j,_]),encapsulation:2,changeDetection:d.OnPush})}}const OH=e=>({border:e}),AH=e=>({type:e});function FH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",15),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function RH(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 BH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",9),t.ɵɵtemplate(6,FH,2,2,"mat-option",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",11)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",12),t.ɵɵtemplate(12,RH,3,3,"mat-error",13),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",14),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(),t.ɵɵelementContainerEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.RPCCommands),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,8,"gateway.statistics.timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.commandForm.get("time").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("disabled",e.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,10,"gateway.rpc-command-send")," ")}}function NH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector",17),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 LH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-modbus-rpc-parameters",24)}function VH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-mqtt-rpc-parameters",24)}function qH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-opc-rpc-parameters",24)}function GH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-socket-rpc-parameters",24)}function zH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",18)(1,"div",19),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(4,20),t.ɵɵtemplate(5,LH,1,0,"tb-gateway-modbus-rpc-parameters",21)(6,VH,1,0,"tb-gateway-mqtt-rpc-parameters",21)(7,qH,1,0,"tb-gateway-opc-rpc-parameters",21)(8,GH,1,0,"tb-gateway-socket-rpc-parameters",21),t.ɵɵelementContainerEnd(),t.ɵɵelementStart(9,"div",22)(10,"button",23),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",14),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){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,10,"gateway.rpc.title",t.ɵɵpureFunction1(17,AH,e.gatewayConnectorDefaultTypesTranslates.get(e.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,13,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,15,"gateway.rpc-command-send")," ")}}function UH(e,n){if(1&e&&t.ɵɵtemplate(0,NH,1,1,"tb-gateway-service-rpc-connector",16)(1,zH,16,19,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2),n=t.ɵɵnextContext();t.ɵɵproperty("ngIf",!n.typesWithUpdatedParams.has(n.connectorType))("ngIfElse",e)}}function jH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",25)(1,"mat-icon",26),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 HH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector-templates",27),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 WH{constructor(e,t,n,i,a){this.fb=e,this.dialog=t,this.utils=n,this.cd=i,this.attributeService=a,this.contentTypes=V,this.RPCCommands=["Ping","Stats","Devices","Update","Version","Restart","Reboot"],this.templates=[],this.ConnectorType=dt,this.gatewayConnectorDefaultTypesTranslates=ut,this.typesWithUpdatedParams=new Set([dt.MQTT,dt.OPCUA,dt.MODBUS,dt.SOCKET]),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,[$.required]],time:[60,[$.required,$.min(1)]],params:["{}",[lt]],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(R.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 dt.MQTT:case dt.FTP:case dt.SNMP:case dt.REST:case dt.REQUEST:return e.methodFilter;case dt.MODBUS:return this.modbusReadFunctionCodes.includes(e.functionCode)?"get":"set";case dt.BACNET:case dt.CAN:case dt.OPCUA:return e.method;case dt.BLE:case dt.OCPP:case dt.SOCKET:case dt.XMPP:return e.methodRPC;default:return e.command}}saveTemplate(){this.dialog.open(Fj,{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},D.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||WH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(_e.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:WH,selectors:[["tb-gateway-service-rpc"]],inputs:{ctx:"ctx",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:12,vars:14,consts:[["connectorForm",""],["updatedParameters",""],[1,"flex","flex-1","flex-col"],[1,"command-form","flex","flex-row","gap-2.5","lt-sm:flex-col",3,"formGroup"],[4,"ngIf","ngIfElse"],[1,"result-block",3,"formGroup"],["class","result-time flex flex-1 flex-row items-center justify-center",4,"ngIf"],["readonly","true","formControlName","result",3,"contentType"],["class","border",3,"rpcTemplates","ctx","connectorType","useTemplate",4,"ngIf"],["formControlName","command"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","formControlName","time","type","number","min","1"],[4,"ngIf"],["mat-raised-button","","color","primary",3,"click","disabled"],[3,"value"],["formControlName","params",3,"connectorType","sendCommand","saveTemplate",4,"ngIf","ngIfElse"],["formControlName","params",3,"sendCommand","saveTemplate","connectorType"],[1,"rpc-parameters","flex","flex-col"],[1,"mat-subtitle-1","tb-form-panel-title"],[3,"ngSwitch"],["formControlName","params",4,"ngSwitchCase"],[1,"fex-row","template-actions","flex","flex-1","items-center","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],["formControlName","params"],[1,"result-time","flex","flex-1","flex-row","items-center","justify-center"],[1,"material-icons"],[1,"border",3,"useTemplate","rpcTemplates","ctx","connectorType"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",2)(1,"div",3),t.ɵɵtemplate(2,BH,16,12,"ng-container",4)(3,UH,3,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"section",5)(6,"span"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,jH,6,4,"div",6),t.ɵɵelementEnd(),t.ɵɵelement(10,"tb-json-content",7),t.ɵɵelementEnd()(),t.ɵɵtemplate(11,HH,1,3,"tb-gateway-service-rpc-connector-templates",8)),2&e){const e=t.ɵɵreference(4);t.ɵɵclassMap(t.ɵɵpureFunction1(12,OH,n.isConnector)),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.isConnector)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(8,10,"gateway.rpc-command-result")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.resultTime),t.ɵɵadvance(),t.ɵɵproperty("contentType",n.contentTypes.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isConnector)}},dependencies:t.ɵɵgetComponentDepsFactory(WH,[j,_,dH,yH,bH,MH,Dj,DH]),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 $H(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",WH);class KH extends A{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||KH)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:KH,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["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,$H,3,3,"mat-error",9),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",10)(18,"button",11),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",12),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.ɵɵproperty("ngIf",n.gatewayControl.hasError("required")),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(KH,[j,_]),encapsulation:2})}}var YH;e("GatewayRemoteConfigurationDialogComponent",KH),function(e){e.tls="tls",e.accessToken="accessToken"}(YH||(YH={}));const XH="configuration_drafts",ZH="RemoteLoggingLevel",QH=new Map([[YH.tls,"gateway.security-types.tls"],[YH.accessToken,"gateway.security-types.access-token"]]);var JH,eW;!function(e){e.none="NONE",e.critical="CRITICAL",e.error="ERROR",e.warning="WARNING",e.info="INFO",e.debug="DEBUG"}(JH||(JH={})),function(e){e.memory="memory",e.file="file"}(eW||(eW={}));const tW=new Map([[eW.memory,"gateway.storage-types.memory-storage"],[eW.file,"gateway.storage-types.file-storage"]]);var nW;!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"}(nW||(nW={}));const iW={config:{},name:"",configType:null,enabled:!1};function aW(e){return JSON.stringify(e.value)===JSON.stringify({})?{validJSON:!0}:null}function rW(e){return e.replace("_","").replace("-","").replace(/^\s+|\s+/g,"").toLowerCase()+".json"}function oW(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 sW(e){return{id:e,entityType:L.DEVICE}}function lW(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,YH.accessToken)?(t.securityType=YH.accessToken,t.accessToken=e.thingsboard.security.accessToken):(t.securityType=YH.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===eW.memory?(t.storageType=eW.memory,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count):e.storage.type===eW.file&&(t.storageType=eW.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 pW(e){const t={};for(const n of e)n.enabled||(t[n.name]={connector:n.configType,config:n.config});return t}function cW(e){const t={thingsboard:dW(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 dW(e){let t;t=e.securityType===YH.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===eW.memory?{type:eW.memory,read_records_count:e.readRecordsCount,max_records_count:e.maxRecordsCount}:{type:eW.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:rW(t.name),name:t.name,type:t.configType};a.push(e)}return{thingsboard:n,connectors:a,storage:i,logs:window.btoa(oW(e.remoteLoggingLevel,e.remoteLoggingPathToLogs))}}const uW=["formContainer"],mW=(e,t,n)=>({"gap-1.25":e,"flex-row":t,"flex-col":n}),hW=(e,t,n)=>({"gap-1.25":e,"flex-row justify-end item-center":t,"flex-col justify-evenly item-center":n});function gW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 fW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-host-required "),t.ɵɵelementEnd())}function yW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-required "),t.ɵɵelementEnd())}function vW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-min "),t.ɵɵelementEnd())}function xW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-max "),t.ɵɵelementEnd())}function bW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-pattern "),t.ɵɵelementEnd())}function wW(e,n){1&e&&(t.ɵɵelementStart(0,"div",16)(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",30),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",32),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 SW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function CW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.path-logs-required "),t.ɵɵelementEnd())}function _W(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 TW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-required "),t.ɵɵelementEnd())}function IW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-min "),t.ɵɵelementEnd())}function EW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-pattern "),t.ɵɵelementEnd())}function MW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-required "),t.ɵɵelementEnd())}function kW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-min "),t.ɵɵelementEnd())}function PW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-pattern "),t.ɵɵelementEnd())}function DW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-required "),t.ɵɵelementEnd())}function OW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-min "),t.ɵɵelementEnd())}function AW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-pattern "),t.ɵɵelementEnd())}function FW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-path-required "),t.ɵɵelementEnd())}function RW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"mat-form-field",8)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",33),t.ɵɵtemplate(6,DW,2,0,"mat-error",10)(7,OW,2,0,"mat-error",10)(8,AW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",8)(10,"mat-label"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",34),t.ɵɵtemplate(14,FW,2,0,"mat-error",10),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction3(12,mW,e.layoutGap,e.alignment,!e.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.storage-max-files")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,10,"gateway.storage-path")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("dataFolderPath").hasError("required"))}}function BW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function NW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.connector-type-required "),t.ɵɵelementEnd())}function LW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.connector-name-required "),t.ɵɵelementEnd())}function VW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",35)(1,"div",36)(2,"div",37),t.ɵɵelement(3,"mat-slide-toggle",38),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",39)(5,"mat-form-field",8)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵlistener("selectionChange",(function(){const n=t.ɵɵrestoreView(e).$implicit,i=t.ɵɵnextContext();return t.ɵɵresetView(i.changeConnectorType(n))})),t.ɵɵtemplate(10,BW,2,2,"mat-option",7),t.ɵɵelementEnd(),t.ɵɵtemplate(11,NW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",8)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"input",41),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(17,LW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",42)(19,"button",43),t.ɵɵpipe(20,"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(21,"mat-icon"),t.ɵɵtext(22,"more_horiz"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",43),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.removeConnector(n))})),t.ɵɵelementStart(25,"mat-icon"),t.ɵɵtext(26,"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(24,mW,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,16,"gateway.connector-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",a.connectorTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("configType").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,18,"gateway.connector-name")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.get("name").hasError("required")),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction3(28,hW,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(),t.ɵɵclassProp("mat-warn",e.get("config").invalid),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,20,"gateway.update-config")),t.ɵɵproperty("disabled",a.isReadOnlyForm),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,22,"gateway.delete")),t.ɵɵproperty("disabled",a.isReadOnlyForm)}}function qW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",44),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 GW(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",45),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 zW extends q{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=QH,this.gatewayLogLevels=Object.keys(JH).map((e=>JH[e])),this.connectorTypes=Object.keys(nW),this.storageTypes=tW,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(sW(i),n,[a])}createConnector(e=iW){this.connectors.push(this.fb.group({enabled:[e.enabled],configType:[e.configType,[$.required]],name:[e.name,[$.required]],config:[e.config,[$.nullValidator,aW]]}))}getFormField(e){return this.gatewayConfigurationGroup.get(e)}buildForm(){this.gatewayConfigurationGroup=this.fb.group({gateway:[null,[]],accessToken:[null,[$.required]],securityType:[YH.accessToken],host:[this.window.location.hostname,[$.required]],port:[1883,[$.required,$.min(1),$.max(65535),$.pattern(/^-?[0-9]+$/)]],remoteConfiguration:[!0],caCertPath:["/etc/thingsboard-gateway/ca.pem"],privateKeyPath:["/etc/thingsboard-gateway/privateKey.pem"],certPath:["/etc/thingsboard-gateway/certificate.pem"],remoteLoggingLevel:[JH.debug],remoteLoggingPathToLogs:["./logs/",[$.required]],storageType:[eW.memory],readRecordsCount:[100,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],maxRecordsCount:[1e4,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],maxFilesCount:[5,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],dataFolderPath:["./data/",[$.required]],connectors:this.fb.array([])}),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1}),this.subscribeStorageType$=this.getFormField("storageType").valueChanges.subscribe((e=>{e===eW.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?oe([this.deviceService.getDeviceCredentials(e).pipe(me((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===YH.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===eW.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: "+rW(n.name)+"\n");return t}(e),function(e,t){for(const n of t)n.enabled&&(e[rW(n.name)]=JSON.stringify(n.config))}(t,e.connectors),n=t,i=e.remoteLoggingLevel,a=e.remoteLoggingPathToLogs,n["logs.conf"]=oW(i,a),this.importExport.exportJSZip(t,this.archiveFileName),this.saveAttribute(ZH,this.gatewayConfigurationGroup.value.remoteLoggingLevel.toUpperCase(),D.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(nt,{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(oe([this.getAttribute("current_configuration",D.CLIENT_SCOPE,e),this.getAttribute(XH,D.SERVER_SCOPE,e)]).pipe(me((([e,t])=>{this.setFormGatewaySettings(e),this.setFormConnectorsDraft(t),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1})})))),t.push(this.getAttribute(ZH,D.SHARED_SCOPE,e).pipe(me((e=>this.processLoggingLevel(e))))),t}getAttribute(e,t,n){return this.attributeService.getEntityAttributes(sW(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(lW(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=JH.debug;e.length>0&&JH[e[0].value.toLowerCase()]&&(t=JH[e[0].value.toLowerCase()]),this.getFormField("remoteLoggingLevel").patchValue(t)}static{this.ɵfac=function(e){return new(e||zW)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(t.ElementRef),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(Ce),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(_e.DeviceService),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(it.ImportExportService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:zW,selectors:[["tb-gateway-form"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(uW,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:104,vars:104,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"],[1,"flex"],["formControlName","securityType"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","type","text","formControlName","host"],["translate","",4,"ngIf"],["matInput","","type","number","formControlName","port"],["class","flex flex-col",4,"ngIf"],["formControlName","remoteConfiguration"],["formControlName","remoteLoggingLevel"],["matInput","","type","text","formControlName","remoteLoggingPathToLogs"],[1,"flex","flex-col"],["formControlName","storageType"],["matInput","","type","number","formControlName","readRecordsCount"],["matInput","","type","number","formControlName","maxRecordsCount"],["class","flex",3,"class",4,"ngIf"],[1,"gateway-config","flex","flex-col"],["formArrayName","connectors",4,"ngFor","ngForOf"],[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","click",4,"ngIf"],["mat-raised-button","","color","primary","type","submit",3,"disabled","matTooltip",4,"ngIf"],[3,"value"],["translate",""],["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"],["formArrayName","connectors"],[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"],["mat-raised-button","","color","primary","type","submit",3,"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.ɵɵtemplate(16,gW,3,4,"mat-option",7),t.ɵɵpipe(17,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",5)(19,"mat-form-field",8)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",9),t.ɵɵtemplate(24,fW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",8)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(29,"input",11),t.ɵɵtemplate(30,yW,2,0,"mat-error",10)(31,vW,2,0,"mat-error",10)(32,xW,2,0,"mat-error",10)(33,bW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,wW,16,9,"div",12),t.ɵɵelementStart(35,"mat-checkbox",13),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"div",5)(39,"mat-form-field",8)(40,"mat-label"),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-select",14),t.ɵɵtemplate(44,SW,2,2,"mat-option",7),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"mat-form-field",8)(46,"mat-label"),t.ɵɵtext(47),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",15),t.ɵɵtemplate(50,CW,2,0,"mat-error",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(51,"mat-expansion-panel")(52,"mat-expansion-panel-header")(53,"mat-panel-title")(54,"div",3),t.ɵɵtext(55),t.ɵɵpipe(56,"translate"),t.ɵɵpipe(57,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(58,"div",16)(59,"mat-form-field")(60,"mat-label"),t.ɵɵtext(61),t.ɵɵpipe(62,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"mat-select",17),t.ɵɵtemplate(64,_W,3,4,"mat-option",7),t.ɵɵpipe(65,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(66,"div",5)(67,"mat-form-field",8)(68,"mat-label"),t.ɵɵtext(69),t.ɵɵpipe(70,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(71,"input",18),t.ɵɵtemplate(72,TW,2,0,"mat-error",10)(73,IW,2,0,"mat-error",10)(74,EW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(75,"mat-form-field",8)(76,"mat-label"),t.ɵɵtext(77),t.ɵɵpipe(78,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(79,"input",19),t.ɵɵtemplate(80,MW,2,0,"mat-error",10)(81,kW,2,0,"mat-error",10)(82,PW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(83,RW,15,16,"div",20),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"mat-expansion-panel")(85,"mat-expansion-panel-header")(86,"mat-panel-title")(87,"div",3),t.ɵɵtext(88),t.ɵɵpipe(89,"translate"),t.ɵɵpipe(90,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",21),t.ɵɵtemplate(92,VW,27,32,"section",22),t.ɵɵelementStart(93,"span",23),t.ɵɵtext(94),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(96,"div")(97,"button",24),t.ɵɵpipe(98,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addNewConnector())})),t.ɵɵtext(99),t.ɵɵpipe(100,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(101,"section",25),t.ɵɵtemplate(102,qW,4,7,"button",26)(103,GW,4,7,"button",27),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("toastTarget",n.toastTargetId),t.ɵɵproperty("formGroup",n.gatewayConfigurationGroup),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,54,t.ɵɵpipeBind1(8,52,"gateway.thingsboard"))),t.ɵɵadvance(3),t.ɵɵproperty("deviceName",n.deviceNameForm)("isStateForm",n.isStateForm)("newGatewayType",n.gatewayType),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,56,"gateway.security-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(17,58,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(92,mW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,60,"gateway.thingsboard-host")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("host").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,62,"gateway.thingsboard-port")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","tls"===n.gatewayConfigurationGroup.get("securityType").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,64,"gateway.remote")),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(96,mW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(42,66,"gateway.remote-logging-level")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.gatewayLogLevels),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(48,68,"gateway.path-logs")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteLoggingPathToLogs").hasError("required")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(57,72,t.ɵɵpipeBind1(56,70,"gateway.storage"))),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(62,74,"gateway.storage-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(65,76,n.storageTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(100,mW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(70,78,"gateway.storage-pack-size")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(78,80,"file"!==n.gatewayConfigurationGroup.get("storageType").value?"gateway.storage-max-records":"gateway.storage-max-file-records")," "),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","file"===n.gatewayConfigurationGroup.get("storageType").value),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(90,84,t.ɵɵpipeBind1(89,82,"gateway.connectors-config"))),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.connectors.controls),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.connectors.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(95,86,"gateway.no-connectors")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(98,88,"gateway.connector-add")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(100,90,"action.add")," "),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.gatewayConfigurationGroup.get("remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteConfiguration").value))},dependencies:t.ɵɵgetComponentDepsFactory(zW,[j,_]),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",zW);class UW{transform(e,t){return Ua.parseVersion(e)>=Ua.parseVersion(Mi.get(t))}static{this.ɵfac=function(e){return new(e||UW)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"isLatestVersionConfig",type:UW,pure:!0,standalone:!0})}}class jW{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:Ei.MIN,max:Ei.MAX}):""}static{this.ɵfac=function(e){return new(e||jW)(t.ɵɵdirectiveInject(He.TranslateService,16))}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getGatewayPortTooltip",type:jW,pure:!0,standalone:!0})}}class HW{transform(e,t,n,i){switch(e){case dt.OPCUA:return this.getOpcConnectorHelpLink(t,n);case dt.MQTT:return this.getMqttConnectorHelpLink(t,n,i);case dt.BACNET:return this.getBacnetConnectorHelpLink(t,n);case dt.REST:return this.getRestConnectorHelpLink(n)}}getOpcConnectorHelpLink(e,t){if(t!==ki.CONST)return`widget/lib/gateway/${e}-${t}_fn`}getMqttConnectorHelpLink(e,t,n){if(t!==ti.CONST)return n?e!==Li.ATTRIBUTES&&e!==Li.TIMESERIES||n!==ei.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!==ki.CONST)return`widget/lib/gateway/bacnet-device-${e}-${t}_fn`}getRestConnectorHelpLink(e){if(e!==yi.CONST)return"widget/lib/gateway/rest-json_fn"}static{this.ɵfac=function(e){return new(e||HW)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getConnectorMappingHelpLink",type:HW,pure:!0,standalone:!0})}}function WW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),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 $W(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",22),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 KW(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",23),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function YW(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",24),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function XW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function ZW(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",25)(2,"mat-label",26),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 QW(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",27)(2,"mat-label",26),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 JW extends A{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=dt,this.gatewayConnectorDefaultTypesTranslatesMap=ut,this.gatewayLogLevel=Object.values(pt),this.submitted=!1,this.destroy$=new te,this.updateConnectorTypesByVersion(),this.connectorForm=this.fb.group({type:[dt.MQTT,[]],name:["",[$.required,this.uniqNameRequired(),$.pattern(rn)]],logLevel:[pt.INFO,[]],useDefaults:[!0,[]],sendDataOnlyOnChange:[!1,[]],class:["",[]],key:["auto",[]]})}ngOnInit(){this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}helpLinkId(){return O+"/docs/iot-gateway/configuration/"}cancel(){this.dialogRef.close(null)}add(){this.submitted=!0;const e=this.connectorForm.getRawValue();if(e.useDefaults){const t=Wt(e.type),n=this.data.gatewayVersion;n&&(e.configVersion=n),e.configurationJson=(this.isLatestVersionConfig.transform(n,e.type)?t[Mi.get(e.type)]:t[ct.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=mt.keys();for(let t of e)if(t===ct.Legacy||Ua.parseVersion(this.data.gatewayVersion)>=Ua.parseVersion(t)){this.connectorTypes=mt.get(t);break}}observeTypeChange(){this.connectorForm.get("type").valueChanges.pipe(me((e=>{const t=this.connectorForm.get("useDefaults");e===dt.GRPC||e===dt.CUSTOM?t.setValue(!1):t.value||t.setValue(!0)})),le(this.destroy$)).subscribe()}static{this.ɵfac=function(e){return new(e||JW)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(UW))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:JW,selectors:[["tb-add-connector-dialog"]],standalone:!0,features:[t.ɵɵProvidersFeature([UW]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:43,vars:25,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",4,"ngFor","ngForOf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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.ɵɵtemplate(17,WW,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(18,"div",8)(19,"div",13),t.ɵɵtext(20,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",10),t.ɵɵelement(22,"input",14),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,$W,3,3,"mat-icon",15),t.ɵɵelementEnd()(),t.ɵɵtemplate(25,KW,6,3,"div",16)(26,YW,6,3,"div",16),t.ɵɵelementStart(27,"div",8)(28,"div",9),t.ɵɵtext(29,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",10)(31,"mat-select",17),t.ɵɵtemplate(32,XW,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵtemplate(33,ZW,6,6,"div",16)(34,QW,6,6,"div",16),t.ɵɵpipe(35,"withReportStrategy"),t.ɵɵelementEnd()(),t.ɵɵelementStart(36,"div",18)(37,"button",19),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(38),t.ɵɵpipe(39,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"button",20),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,14,"gateway.add-connector")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLinkId()),t.ɵɵadvance(11),t.ɵɵproperty("ngForOf",n.connectorTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(23,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("name").hasError("required")&&n.connectorForm.get("name").touched||n.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.GRPC),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value!==n.connectorType.GRPC&&n.connectorForm.get("type").value!==n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.MQTT&&!t.ɵɵpipeBind2(35,18,n.data.gatewayVersion,n.connectorType.MQTT)),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(39,21,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.connectorForm.invalid||!n.connectorForm.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(42,23,"action.add")," "))},dependencies:t.ɵɵgetComponentDepsFactory(JW,[j,_,Ya]),styles:['@charset "UTF-8";[_nghost-%COMP%] .add-connector[_ngcontent-%COMP%]{min-width:400px;width:500px}']})}}e("AddConnectorDialogComponent",JW);const e$=()=>({maxWidth:"970px"});function t$(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1,"gateway.device-info.source"),t.ɵɵelementEnd())}function n$(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(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function i$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",18)(2,"mat-select",19),t.ɵɵtemplate(3,n$,3,4,"mat-option",20),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function a$(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.device-info.device-name-expression-required"))}function r$(e,n){if(1&e&&(t.ɵɵelement(0,"div",23),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,e$))}}function o$(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(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function s$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",18)(2,"mat-select",26),t.ɵɵtemplate(3,o$,3,4,"mat-option",20),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function l$(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.device-info.device-profile-expression-required"))}function p$(e,n){if(1&e&&(t.ɵɵelement(0,"div",23),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,e$))}}function c$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",24)(1,"div",9),t.ɵɵtext(2,"gateway.device-info.profile-name"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,s$,4,1,"div",10),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12),t.ɵɵelement(6,"input",25),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,l$,3,3,"mat-icon",14)(9,p$,2,8,"div",15),t.ɵɵpipe(10,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingFormGroup.get("deviceProfileExpression").hasError("required")&&e.mappingFormGroup.get("deviceProfileExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(10,6,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType))}}class d$ extends q{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=Ni,this.DeviceInfoType=fa,this.useSource=!0,this.required=!1,this.connectorType=dt.MQTT,this.sourceTypes=Object.values(ti),this.destroy$=new te,this.propagateChange=e=>{}}ngOnInit(){this.mappingFormGroup=this.fb.group({deviceNameExpression:["",this.required?[$.required,$.pattern(rn)]:[$.pattern(rn)]]}),this.useSource&&this.mappingFormGroup.addControl("deviceNameExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.deviceInfoType===fa.FULL&&(this.useSource&&this.mappingFormGroup.addControl("deviceProfileExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.mappingFormGroup.addControl("deviceProfileExpression",this.fb.control("",this.required?[$.required,$.pattern(rn)]:[$.pattern(rn)]))),this.mappingFormGroup.valueChanges.pipe(le(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||d$)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:d$,selectors:[["tb-device-info-table"]],inputs:{useSource:"useSource",required:"required",connectorType:"connectorType",convertorType:"convertorType",sourceTypes:"sourceTypes",deviceInfoType:"deviceInfoType"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>d$)),multi:!0},{provide:K,useExisting:c((()=>d$)),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"],["class","tb-form-table-header-cell w-1/5","translate","",4,"ngIf"],["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"],["class","no-gap w-1/5",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["class","tb-form-table-row tb-form-row no-border same-padding pb-4",4,"ngIf"],[1,"no-gap","w-1/5"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","!w-full"],["formControlName","deviceNameExpressionSource"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["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"],["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,t$,2,0,"div",5),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9," gateway.device-info.expression "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",7)(11,"div",8)(12,"div",9),t.ɵɵtext(13,"gateway.device-info.name"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,i$,4,1,"div",10),t.ɵɵelementStart(15,"div",11)(16,"mat-form-field",12),t.ɵɵelement(17,"input",13),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,a$,3,3,"mat-icon",14)(20,r$,2,8,"div",15),t.ɵɵpipe(21,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(22,c$,11,11,"div",16),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(),t.ɵɵclassProp("tb-required",n.required),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(4),t.ɵɵclassProp("pb-4",n.deviceInfoType!==n.DeviceInfoType.FULL),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(18,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.mappingFormGroup.get("deviceNameExpression").hasError("required")&&n.mappingFormGroup.get("deviceNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(21,13,n.connectorType,"name-field",n.mappingFormGroup.get("deviceNameExpressionSource").value,n.convertorType)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceInfoType===n.DeviceInfoType.FULL))},dependencies:t.ɵɵgetComponentDepsFactory(d$,[j,_,HW]),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})}}Ge([I()],d$.prototype,"useSource",void 0),Ge([I()],d$.prototype,"required",void 0);const u$=()=>({maxWidth:"970px"});function m$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",19),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 h$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵelement(1,"mat-icon",22),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 g$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,h$,5,5,"mat-option",20),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function f$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",23)(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 y$(e,n){1&e&&(t.ɵɵelement(0,"input",24),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function v$(e,n){1&e&&(t.ɵɵelement(0,"input",25),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function x$(e,n){1&e&&(t.ɵɵelement(0,"input",26),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function b$(e,n){1&e&&(t.ɵɵelement(0,"input",27),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function w$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",28)(1,"mat-option",21),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",21),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function S$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",29),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function C$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",30),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,u$))}}class _${constructor(e){this.fb=e,this.valueTypeKeys=Object.values(Xt),this.valueTypes=Zt,this.MappingValueType=Xt,this.destroy$=new te,this.onChange=e=>{},this.valueTypeFormGroup=this.fb.group({type:[Xt.STRING],stringValue:[{value:"",disabled:this.rawData},[$.required,$.pattern(rn)]],integerValue:[{value:0,disabled:!0},[$.required,$.pattern(on)]],doubleValue:[{value:0,disabled:!0},[$.required]],booleanValue:[{value:!1,disabled:!0},[$.required]],rawValue:[{value:"",disabled:!this.rawData},[$.required,$.pattern(rn)]]}),this.valueTypeFormGroup.valueChanges.pipe(le(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(le(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 Xt.BOOLEAN;case"number":return Number.isInteger(e)?Xt.INTEGER:Xt.DOUBLE;default:return Xt.STRING}}static{this.ɵfac=function(e){return new(e||_$)(t.ɵɵdirectiveInject(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:_$,selectors:[["tb-type-value-field"]],inputs:{rawData:"rawData",helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>_$)),multi:!0},{provide:K,useExisting:c((()=>_$)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:17,consts:[["raw",""],[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"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[4,"ngIf","ngIfElse"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex","tb-suffix-absolute"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","rawValue",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style","click",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["value","raw"],["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,"click","tb-help-popup","tb-help-popup-style"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,1),t.ɵɵelementStart(1,"div",2)(2,"div",3),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",4)(5,"mat-form-field",5)(6,"mat-select",6)(7,"mat-select-trigger")(8,"div",7),t.ɵɵtemplate(9,m$,1,1,"mat-icon",8),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(14,g$,2,1,"ng-container",9)(15,f$,4,3,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(17,"div",2)(18,"div",3),t.ɵɵtext(19,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",10),t.ɵɵelementContainerStart(21,11),t.ɵɵtemplate(22,y$,2,3,"input",12)(23,v$,2,3,"input",13)(24,x$,2,3,"input",14)(25,b$,2,3,"input",15)(26,w$,5,2,"mat-select",16),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,S$,3,3,"mat-icon",17)(28,C$,1,3,"div",18),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){let e,i;const a=t.ɵɵreference(16);t.ɵɵproperty("formGroup",n.valueTypeFormGroup),t.ɵɵadvance(9),t.ɵɵproperty("ngIf",!n.rawData),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,13,null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.name)||t.ɵɵpipeBind1(13,15,"gateway.raw")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",!n.rawData)("ngIfElse",a),t.ɵɵadvance(7),t.ɵɵproperty("ngSwitch",n.valueTypeFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase","raw"),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(i=n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value))?null:i.hasError("required"))&&n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value).touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.helpLink)}},dependencies:t.ɵɵgetComponentDepsFactory(_$,[_,j]),styles:['@charset "UTF-8";[_nghost-%COMP%]{gap:16px;display:grid;width:100%}']})}}function T$(e,n){if(1&e&&t.ɵɵelement(0,"tb-type-value-field",14),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("helpLink",e.helpLink)}}function I$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",7),t.ɵɵelementContainerStart(2,8),t.ɵɵelementStart(3,"mat-expansion-panel",9)(4,"mat-expansion-panel-header",10)(5,"mat-panel-title")(6,"div",11),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,T$,1,1,"ng-template",12),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",13),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.last;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i),t.ɵɵadvance(),t.ɵɵproperty("expanded",a),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 E$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtemplate(1,I$,13,6,"div",5),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function M$(e,n){1&e&&(t.ɵɵelementStart(0,"div",15)(1,"span",16),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate("gateway.no-value"))}Ge([I()],_$.prototype,"rawData",void 0);class k${constructor(e){this.fb=e,this.destroy$=new te,this.onChange=e=>{}}ngOnInit(){this.valueListFormArray=this.fb.array([]),this.valueListFormArray.valueChanges.pipe(le(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(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:k$,selectors:[["tb-type-value-panel"]],inputs:{helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>k$)),multi:!0},{provide:K,useExisting:c((()=>k$)),multi:!0}]),t.ɵɵStandaloneFeature],decls:8,vars:5,consts:[["noKeys",""],[1,"tb-form-panel","no-border","no-padding"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-form-panel","no-border","no-padding","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",1),t.ɵɵtemplate(1,E$,2,2,"div",2),t.ɵɵelementStart(2,"div")(3,"button",3),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(6,M$,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)}if(2&e){const e=t.ɵɵreference(7);t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.valueListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,3,"gateway.add-value")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(k$,[j,_,_$]),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 P$=()=>({maxWidth:"970px"});function D$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",19),t.ɵɵtext(2),t.ɵɵelementEnd(),t.ɵɵtext(3),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",e.get("key").value," "),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",":","  ")}}function O$(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.key-required"))}function A$(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,P$))}}function F$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",44),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 R$(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 B$(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 N$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-select-trigger")(1,"div",42),t.ɵɵtemplate(2,F$,1,1,"mat-icon",43)(3,R$,3,3,"span",36)(4,B$,3,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵreference(5),i=t.ɵɵnextContext(3).$implicit,a=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==(e=a.valueTypes.get(i.get("type").value))?null:e.icon),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!a.rawData)("ngIfElse",n)}}function L$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",48),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(6);t.ɵɵpropertyInterpolate("svgIcon",n.valueTypes.get(e).icon)}}function V$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵtemplate(1,L$,1,1,"mat-icon",47),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.ɵɵproperty("ngIf",null==(e=r.valueTypes.get(a))?null:e.icon),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 q$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,V$,5,5,"mat-option",45),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function G$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",46)(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 z$(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-required"))}function U$(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,P$))}}function j$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",28),t.ɵɵelement(10,"input",29),t.ɵɵpipe(11,"translate"),t.ɵɵtemplate(12,O$,3,3,"mat-icon",30)(13,A$,2,8,"div",31),t.ɵɵpipe(14,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",32)(19,"div",33),t.ɵɵtext(20,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",34)(22,"mat-select",35),t.ɵɵtemplate(23,N$,6,3,"mat-select-trigger",18)(24,q$,2,1,"ng-container",36)(25,G$,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"div",37)(28,"div",27),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",38),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,z$,3,3,"mat-icon",30)(36,U$,2,8,"div",31),t.ɵɵpipe(37,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵreference(26),n=t.ɵɵnextContext(2).$implicit,i=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,13,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,15,"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(11,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("key").hasError("required")&&n.get("key").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(14,19,i.connectorType,i.keysType,n.get("type").value,i.convertorType)),t.ɵɵadvance(10),t.ɵɵproperty("ngIf",!i.rawData),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!i.rawData)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(29,24,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(31,26,"gateway.value")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("value").hasError("required")&&n.get("value").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(37,30,i.connectorType,i.keysType,n.get("type").value,i.convertorType))}}function H$(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.key-required"))}function W$(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-required"))}function $$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",33),t.ɵɵtext(3,"gateway.key"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",28),t.ɵɵelement(5,"input",29),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,H$,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",26)(9,"div",33),t.ɵɵtext(10,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",49),t.ɵɵelement(12,"input",39),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,W$,3,3,"mat-icon",30),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function K$(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-required"))}function Y$(e,n){1&e&&t.ɵɵelement(0,"tb-type-value-panel",54)}function X$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",27),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",28),t.ɵɵelement(7,"input",50),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,K$,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",14)(11,"mat-expansion-panel",51)(12,"mat-expansion-panel-header",52)(13,"mat-panel-title")(14,"div",53),t.ɵɵpipe(15,"translate"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(18,Y$,1,0,"ng-template",20),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.ɵɵproperty("ngIf",n.get("method").hasError("required")&&n.get("method").touched),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 Z$(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",55),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function Q$(e,n){if(1&e&&t.ɵɵtemplate(0,j$,38,35,"div",22)(1,$$,15,8,"div",22)(2,X$,19,17,"div",22)(3,Z$,1,2,"tb-report-strategy",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType!==e.MappingKeysType.CUSTOM&&e.keysType!==e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.withReportStrategy&&(e.keysType===e.MappingKeysType.ATTRIBUTES||e.keysType===e.MappingKeysType.TIMESERIES))}}function J$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵelementContainerStart(2,15),t.ɵɵelementStart(3,"mat-expansion-panel",16)(4,"mat-expansion-panel-header",17)(5,"mat-panel-title"),t.ɵɵtemplate(6,D$,4,2,"ng-container",18),t.ɵɵelementStart(7,"div",19),t.ɵɵtext(8),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,Q$,4,4,"ng-template",20),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",21),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.last,a=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",a.keysType!==a.MappingKeysType.RPC_METHODS),t.ɵɵadvance(2),t.ɵɵtextInterpolate(a.valueTitle(e)),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,a.deleteKeyTitle))}}function eK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",11),t.ɵɵtemplate(1,J$,14,7,"div",12),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function tK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",56)(1,"span",57),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class nK extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.valueTypeEnum=Xt,this.valueTypes=Zt,this.valueTypeKeys=Object.values(Xt),this.rawData=!1,this.withReportStrategy=!0,this.keysDataApplied=new u,this.MappingKeysType=Li,this.ReportStrategyDefaultValue=tn,this.ConnectorType=dt,this.errorText=""}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===Li.RPC_METHODS?this.fb.group({method:["",[$.required]],arguments:[[],[]]}):this.keysType===Li.CUSTOM?this.fb.group({key:["",[$.required,$.pattern(rn)]],value:["",[$.required,$.pattern(rn)]]}):this.fb.group({key:["",[$.required,$.pattern(rn)]],type:[this.rawData?"raw":this.valueTypeKeys[0]],value:["",[$.required,$.pattern(rn)]],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===Li.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===Li.CUSTOM&&(e=Object.keys(e).map((t=>({key:t,value:e[t],type:""})))),e.forEach((e=>{let n;if(this.keysType===Li.RPC_METHODS)n=this.fb.group({method:[e.method,[$.required]],arguments:[[...e.arguments],[]]});else if(this.keysType===Li.CUSTOM){const{key:t,value:i}=e;n=this.fb.group({key:[t,[$.required,$.pattern(rn)]],value:[i,[$.required,$.pattern(rn)]]})}else{const{key:t,value:i,type:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[$.required,$.pattern(rn)]],type:[a],value:[i,[$.required,$.pattern(rn)]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)}))),this.fb.array(t)}valueTitle(e){const t=this.keysType===Li.RPC_METHODS?e.get("method").value:e.get("value").value;return ke(t)?"object"==typeof t?JSON.stringify(t):t:""}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===Li.ATTRIBUTES||this.keysType===Li.TIMESERIES))}static{this.ɵfac=function(e){return new(e||nK)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:nK,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:19,vars:16,consts:[["noKeys",""],["rawOption",""],["rawText",""],[1,"tb-mapping-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[4,"ngIf"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[4,"ngIf","ngIfElse"],[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"],["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-flex","align-center"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["class","tb-mat-20",3,"svgIcon",4,"ngIf"],[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"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],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.ɵɵtemplate(5,eK,2,2,"div",6),t.ɵɵelementStart(6,"div")(7,"button",7),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,tK,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",8)(13,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(nK,[j,_,Zn,k$,HW]),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}']})}}Ge([I()],nK.prototype,"rawData",void 0),Ge([I()],nK.prototype,"withReportStrategy",void 0);const iK=()=>({maxWidth:"970px"}),aK=(e,t)=>[e,t];function rK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function oK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 sK(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",40),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 lK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",41),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("convertorType",e.ConvertorTypeEnum.JSON)("deviceInfoType",e.DeviceInfoType.FULL)}}function pK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",42),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)("convertorType",e.ConvertorTypeEnum.BYTES)("sourceTypes",t.ɵɵpureFunction2(3,aK,e.sourceTypesEnum.MSG,e.sourceTypesEnum.CONST))}}function cK(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function dK(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 uK(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 mK(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",43)(5,"mat-chip-listbox",44),t.ɵɵtemplate(6,dK,2,1,"mat-chip",45),t.ɵɵelementStart(7,"mat-chip",46),t.ɵɵelement(8,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",48,0),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(10),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(12,"tb-icon",49),t.ɵɵtext(13,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",31)(15,"div",32),t.ɵɵtext(16,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",43)(18,"mat-chip-listbox",44),t.ɵɵtemplate(19,uK,2,1,"mat-chip",45),t.ɵɵelementStart(20,"mat-chip",46),t.ɵɵelement(21,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"button",48,1),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(23),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(25,"tb-icon",49),t.ɵɵtext(26,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterAttributes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,6,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterTelemetry),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,8,"action.edit"))}}function hK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function gK(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 fK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",21)(2,"div",50),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",23),t.ɵɵelement(7,"input",51),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,hK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",52)(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",43)(20,"mat-chip-listbox",44),t.ɵɵtemplate(21,gK,2,1,"mat-chip",45),t.ɵɵelementStart(22,"mat-chip",46),t.ɵɵelement(23,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",48,2),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.CUSTOM))})),t.ɵɵelementStart(27,"tb-icon",49),t.ɵɵtext(28,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,8,"gateway.extension-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,10,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("converter.custom.extension").hasError("required")&&e.mappingForm.get("converter.custom.extension").touched),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,14,"gateway.extension-configuration-hint")),t.ɵɵadvance(6),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.customKeys),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(26,16,"action.edit"))}}function yK(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,rK,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,oK,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,sK,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,lK,1,2,"ng-template",17)(30,pK,1,6,"ng-template",17)(31,cK,1,2,"tb-report-strategy",37)(32,mK,27,10,"div",38)(33,fK,29,18,"div",38),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("topicFilter").hasError("required")&&e.mappingForm.get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(24,iK)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",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",e.qualityTypes),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.convertorTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,22,e.DataConversionTranslationsMap.get(e.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroupName",e.converterType)("ngSwitch",e.converterType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.BYTES),t.ɵɵadvance(),t.ɵɵconditional(e.data.withReportStrategy?31:-1),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.BYTES||e.converterType===e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.CUSTOM)}}function vK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 xK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function bK(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",57),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,xK,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,iK))}}function wK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",58),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)}}function SK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",58),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.PARTIAL)}}function CK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 _K(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 TK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 IK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 EK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 MK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 kK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",34)(1,"div",59),t.ɵɵtext(2,"gateway.from-device-request-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",60),t.ɵɵtext(4," gateway.from-device-request-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",61)(6,"div",62)(7,"div",63),t.ɵɵtext(8,"gateway.device-info.device-name-expression"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",64)(10,"div",65)(11,"mat-form-field",23)(12,"mat-select",66),t.ɵɵtemplate(13,CK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",67),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,_K,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",64)(23,"div",65)(24,"mat-form-field",23)(25,"mat-select",68),t.ɵɵtemplate(26,TK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"mat-form-field",23),t.ɵɵelement(28,"input",69),t.ɵɵpipe(29,"translate"),t.ɵɵtemplate(30,IK,3,3,"mat-icon",25),t.ɵɵelement(31,"div",26),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(32,"div",34)(33,"div",59),t.ɵɵtext(34,"gateway.to-device-response-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"div",60),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",70),t.ɵɵpipe(42,"translate"),t.ɵɵtemplate(43,EK,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",71),t.ɵɵpipe(50,"translate"),t.ɵɵtemplate(51,MK,3,3,"mat-icon",25),t.ɵɵelement(52,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(53,"div",72)(54,"mat-slide-toggle",73)(55,"mat-label",74),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,iK)),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,iK)),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,iK)),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,iK)),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 PK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 DK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-filter-required"))}function OK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 AK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 FK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",50),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",23),t.ɵɵelement(6,"input",75),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,PK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",50),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",76),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,DK,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",70),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,OK,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",71),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,AK,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",72)(35,"mat-slide-toggle",73)(36,"mat-label",74),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,iK)),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,iK)),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 RK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 BK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-filter-required"))}function NK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 LK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-expression-required"))}function VK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 qK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 GK(e,n){if(1&e&&t.ɵɵelement(0,"tb-error-icon",84),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("tooltipText",e.responseTimeoutErrorTooltip)}}function zK(e,n){1&e&&(t.ɵɵelementStart(0,"span",85),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function UK(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",81),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,VK,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",82),t.ɵɵtemplate(16,qK,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",83),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,GK,1,1,"tb-error-icon",84)(24,zK,2,0,"span",85),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,iK)),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 jK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",77)(1,"tb-toggle-select",33)(2,"tb-toggle-option",40),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-option",40),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",21)(9,"div",50),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23),t.ɵɵelement(14,"input",75),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,RK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",21)(18,"div",50),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",23),t.ɵɵelement(23,"input",78),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,BK,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",79),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,NK,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",70),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,LK,3,3,"mat-icon",25),t.ɵɵelement(41,"div",26),t.ɵɵelementEnd()(),t.ɵɵtemplate(42,UK,25,18,"ng-container",80)),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,iK)),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,iK)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.type").value===e.ServerSideRPCType.TWO_WAY)}}function HK(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",53),t.ɵɵtemplate(5,vK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(6,54)(7,55),t.ɵɵtemplate(8,bK,8,8,"div",56)(9,wK,1,1,"ng-template",17)(10,SK,1,1,"ng-template",17)(11,kK,59,36,"ng-template",17)(12,FK,40,40,"ng-template",17)(13,jK,43,43,"ng-template",17),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.requestTypes),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e.mappingForm.get("requestValue").get(e.requestMappingType))("ngSwitch",e.requestMappingType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.requestMappingType===e.RequestTypeEnum.ATTRIBUTE_REQUEST||e.requestMappingType===e.RequestTypeEnum.CONNECT_REQUEST||e.requestMappingType===e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.CONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_UPDATE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.SERVER_SIDE_RPC)}}function WK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 $K(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-node-required"))}function KK(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function YK(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 XK(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 ZK(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 QK(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 JK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",86)(1,"div",87)(2,"div",88),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",89)(7,"mat-form-field",90)(8,"mat-select",91),t.ɵɵtemplate(9,WK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"mat-form-field",90),t.ɵɵelement(11,"input",92),t.ɵɵpipe(12,"translate"),t.ɵɵtemplate(13,$K,3,3,"mat-icon",25),t.ɵɵelement(14,"div",26),t.ɵɵpipe(15,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()(),t.ɵɵelement(16,"tb-device-info-table",93),t.ɵɵtemplate(17,KK,1,2,"tb-report-strategy",37),t.ɵɵelementStart(18,"div",31)(19,"div",32),t.ɵɵtext(20,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",43)(22,"mat-chip-listbox",44),t.ɵɵtemplate(23,YK,2,1,"mat-chip",45),t.ɵɵelementStart(24,"mat-chip",46),t.ɵɵelement(25,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",48,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",49),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",43)(35,"mat-chip-listbox",44),t.ɵɵtemplate(36,XK,2,1,"mat-chip",45),t.ɵɵelementStart(37,"mat-chip",46),t.ɵɵelement(38,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"button",48,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",49),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",43)(48,"mat-chip-listbox",44),t.ɵɵtemplate(49,ZK,2,1,"mat-chip",45),t.ɵɵelementStart(50,"mat-chip",46),t.ɵɵelement(51,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"button",48,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",49),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",43)(61,"mat-chip-listbox",44),t.ɵɵtemplate(62,QK,2,1,"mat-chip",45),t.ɵɵelementStart(63,"mat-chip",46),t.ɵɵelement(64,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(65,"button",48,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",49),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,aK,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,iK)),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 eY extends A{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=Oi,this.qualityTypes=Ui,this.QualityTranslationsMap=ii,this.convertorTypes=Object.values(ei),this.ConvertorTypeEnum=ei,this.ConvertorTypeTranslationsMap=ai,this.sourceTypes=Object.values(ti),this.OPCUaSourceTypes=Object.values(ki),this.OPCUaSourceTypesEnum=ki,this.sourceTypesEnum=ti,this.SourceTypeTranslationsMap=Ni,this.requestTypes=Object.values(ri),this.RequestTypeEnum=ri,this.RequestTypesTranslationsMap=oi,this.DeviceInfoType=fa,this.ServerSideRPCType=$i,this.MappingKeysType=Li,this.MappingHintTranslationsMap=Wi,this.MappingTypeTranslationsMap=Ai,this.DataConversionTranslationsMap=si,this.HelpLinkByMappingTypeMap=Hi,this.ConnectorType=dt,this.ReportStrategyDefaultValue=tn,this.keysPopupClosed=!0,this.destroy$=new te,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 Oi.DATA:this.mappingForm=this.fb.group({}),this.createDataMappingForm();break;case Oi.REQUESTS:this.mappingForm=this.fb.group({}),this.createRequestMappingForm();break;case Oi.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!==Oi.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===ei.BYTES,panelTitle:Vi.get(n),addKeyTitle:qi.get(n),deleteKeyTitle:Gi.get(n),noKeysText:zi.get(n),withReportStrategy:this.data.withReportStrategy,connectorType:this.data.mappingType===Oi.OPCUA?dt.OPCUA:dt.MQTT,convertorType:this.converterType};this.data.mappingType===Oi.OPCUA&&(t.valueTypeKeys=Object.values(ki),t.valueTypeEnum=ki,t.valueTypes=Ni,t.sourceType=this.mappingForm.get("deviceNodeSource").value),this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,nK,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(le(this.destroy$)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty()})),this.popoverComponent.tbHideStart.pipe(le(this.destroy$)).subscribe((()=>{this.keysPopupClosed=!0}))}}prepareMappingData(){const e=this.mappingForm.value;switch(Te(e),this.data.mappingType){case Oi.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 Oi.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 Oi.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 Oi.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("",[$.required,$.pattern(rn)])),this.mappingForm.addControl("subscriptionQos",this.fb.control(0)),this.mappingForm.addControl("converter",this.fb.group({type:[ei.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:["",[$.required,$.pattern(rn)]],extensionConfig:[{},[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})})),this.mappingForm.patchValue(this.getFormValueData()),this.mappingForm.get("converter.type").valueChanges.pipe(be(this.mappingForm.get("converter.type").value),le(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(ri.CONNECT_REQUEST,[])),this.mappingForm.addControl("requestValue",this.fb.group({connectRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(rn)]],deviceInfo:[{},[]]}),disconnectRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(rn)]],deviceInfo:[{},[]]}),attributeRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(rn)]],deviceInfo:this.fb.group({deviceNameExpressionSource:[ti.MSG,[]],deviceNameExpression:["",[$.required]]}),attributeNameExpressionSource:[ti.MSG,[]],attributeNameExpression:["",[$.required,$.pattern(rn)]],topicExpression:["",[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],retain:[!1,[]]}),attributeUpdates:this.fb.group({deviceNameFilter:["",[$.required,$.pattern(rn)]],attributeFilter:["",[$.required,$.pattern(rn)]],topicExpression:["",[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],retain:[!0,[]]}),serverSideRpc:this.fb.group({type:[$i.TWO_WAY,[]],deviceNameFilter:["",[$.required,$.pattern(rn)]],methodFilter:["",[$.required,$.pattern(rn)]],requestTopicExpression:["",[$.required,$.pattern(rn)]],responseTopicExpression:["",[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],responseTopicQoS:[0,[]],responseTimeout:[1e4,[$.required,$.min(1)]]}),reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})),this.mappingForm.get("requestType").valueChanges.pipe(be(this.mappingForm.get("requestType").value),le(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(le(this.destroy$)).subscribe((e=>{const t=this.mappingForm.get("requestValue.serverSideRpc");e===$i.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:[ki.PATH,[]],deviceNodePattern:["",[$.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||eY)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(He.TranslateService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:eY,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","ngSwitch"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["formControlName","deviceInfo","required","true",3,"convertorType","deviceInfoType"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","convertorType","sourceTypes"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[4,"ngFor","ngForOf"],[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","ngSwitch"],["class","tb-form-row column-xs",4,"ngIf"],["matInput","","name","value",3,"formControl","placeholder"],["formControlName","deviceInfo","required","true",3,"deviceInfoType"],["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"]],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,yK,34,25,"ng-template",17)(17,HK,14,9,"ng-template",17)(18,JK,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(eY,[j,_,HW,zn,d$,Jn,Zn]),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",eY);const tY=["searchInput"],nY=()=>({minWidth:"96px",textAlign:"center"});function iY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",24)(2,"span",25),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 aY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-header-cell",29),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 rY(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().$implicit,a=t.ɵɵnextContext();t.ɵɵclassProp("request-column",a.mappingType===a.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e[i.def]," ")}}function oY(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,26),t.ɵɵtemplate(1,aY,3,5,"mat-header-cell",27)(2,rY,2,3,"mat-cell",28),t.ɵɵelementContainerEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("matColumnDef",e.def)}}function sY(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",31)}function lY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 pY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,lY,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",32),t.ɵɵelementContainer(4,33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",34)(6,"button",35),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",36),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",37,2),t.ɵɵelementContainer(11,33),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,nY)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function cY(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",38)}function dY(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class uY{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=Ai,this.mappingTypeEnum=Oi,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 te,this.mappingFormGroup=this.fb.array([]),this.dirtyValue=!this.activeValue,this.dataSource=new mY}ngOnInit(){this.setMappingColumns(),this.displayedColumns.push(...this.mappingColumns.map((e=>e.def)),"actions"),this.mappingFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t)?this.mappingFormGroup.at(t).value:{};this.dialog.open(eY,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{mappingType:this.mappingType,value:n,buttonTitle:Ae(t)?"action.add":"action.apply",withReportStrategy:this.withReportStrategy}}).afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(ke(t)?this.mappingFormGroup.at(t).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.mappingFormGroup.controls[t].value,i=n.deviceInfo?.deviceNameExpression??n.topicFilter??this.getRequestDetails(n);this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:i}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).subscribe((e=>{e&&(this.mappingFormGroup.removeAt(t),this.mappingFormGroup.markAsDirty())}))}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.mappingFormGroup.push(this.fb.control(e))))}getMappingValue(e){switch(this.mappingType){case Oi.DATA:const t=ai.get(e.converter?.type);return{topicFilter:e.topicFilter,QoS:e.subscriptionQos,converter:t?this.translate.instant(t):""};case Oi.REQUESTS:return{requestType:e.requestType,type:this.translate.instant(oi.get(e.requestType)),details:this.getRequestDetails(e)};case Oi.OPCUA:const n=e.deviceInfo?.deviceNameExpression,i=e.deviceInfo?.deviceProfileExpression,{deviceNodePattern:a}=e;return{deviceNodePattern:a,deviceNamePattern:n,deviceProfileExpression:i};default:return{}}}getRequestDetails(e){let t;return t=e.requestType===ri.ATTRIBUTE_UPDATE?e.requestValue.attributeFilter:e.requestType===ri.SERVER_SIDE_RPC?e.requestValue.methodFilter:e.requestValue.topicFilter,t}setMappingColumns(){switch(this.mappingType){case Oi.DATA:this.mappingColumns.push({def:"topicFilter",title:"gateway.topic-filter"},{def:"QoS",title:"gateway.mqtt-qos"},{def:"converter",title:"gateway.payload-type"});break;case Oi.REQUESTS:this.mappingColumns.push({def:"type",title:"gateway.type"},{def:"details",title:"gateway.details"});break;case Oi.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||uY)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:uY,selectors:[["tb-mapping-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(tY,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:W,useExisting:c((()=>uY)),multi:!0},{provide:K,useExisting:c((()=>uY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:40,vars:33,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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef",4,"ngFor","ngForOf"],["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"],[3,"matColumnDef"],["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,iY,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵtemplate(23,oY,3,1,"ng-container",14),t.ɵɵelementContainerStart(24,15),t.ɵɵtemplate(25,sY,1,0,"mat-header-cell",16)(26,pY,12,6,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,cY,1,0,"mat-header-row",18)(28,dY,1,0,"mat-row",19),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"section",20),t.ɵɵpipe(30,"async"),t.ɵɵelementStart(31,"button",21),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))})),t.ɵɵelementStart(32,"mat-icon",22),t.ɵɵtext(33,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"span"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(37,"span",23),t.ɵɵpipe(38,"async"),t.ɵɵtext(39," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,19,n.dataSource.isEmpty())),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,21,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,23,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,25,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.mappingColumns),t.ɵɵadvance(4),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(30,27,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,29,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(38,31,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(uY,[j,_,Gn]),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",uY),Ge([I()],uY.prototype,"required",void 0),Ge([I()],uY.prototype,"withReportStrategy",void 0);let mY=class extends G{constructor(){super()}};function hY(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",7),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 gY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",18),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function fY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",10)(4,"mat-form-field",11),t.ɵɵelement(5,"input",12),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,gY,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",8)(9,"div",14),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",15),t.ɵɵpipe(14,"translate"),t.ɵɵelementStart(15,"div",16),t.ɵɵelement(16,"tb-toggle-password",17),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,3,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,5,"gateway.set"))}}function yY(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 vY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",18),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function xY(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",8)(2,"div",14),t.ɵɵtext(3,"gateway.mode"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11)(6,"mat-select",25),t.ɵɵtemplate(7,yY,2,2,"mat-option",4),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(8,"div",8)(9,"div",14),t.ɵɵtext(10,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",12),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,vY,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8)(17,"div",14),t.ɵɵtext(18,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",10)(20,"mat-form-field",11),t.ɵɵelement(21,"input",15),t.ɵɵpipe(22,"translate"),t.ɵɵelementStart(23,"div",16),t.ɵɵelement(24,"tb-toggle-password",17),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",e.modeTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,6,"gateway.set"))}}function bY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",8)(4,"div",20),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",10)(8,"mat-form-field",11),t.ɵɵelement(9,"input",21),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",8)(12,"div",20),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"div",10)(16,"mat-form-field",11),t.ɵɵelement(17,"input",22),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",8)(20,"div",20),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"div",10)(24,"mat-form-field",11),t.ɵɵelement(25,"input",23),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(27,xY,25,8,"ng-container",24)),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.ɵɵproperty("ngIf",e.mode()===e.SecurityMode.extendedCertificates)}}e("MappingDatasource",mY);class wY{constructor(e,t){this.fb=e,this.cdr=t,this.title="gateway.security",this.mode=l(Ki.certificates),this.BrokerSecurityType=Pi,this.SecurityMode=Ki,this.securityTypes=Object.values(Pi),this.modeTypes=Object.values(Di),this.SecurityTypeTranslationsMap=Bi,this.destroy$=new te,o((()=>{this.mode()===Ki.basic&&(this.securityTypes=this.securityTypes.filter((e=>e!==Pi.CERTIFICATES)))}))}ngOnInit(){this.securityFormGroup=this.fb.group({type:[Pi.ANONYMOUS,[]],username:["",[$.required,$.pattern(rn)]],password:["",[$.pattern(rn)]],pathToCACert:["",[$.pattern(rn)]],pathToPrivateKey:["",[$.pattern(rn)]],pathToClientCert:["",[$.pattern(rn)]]}),this.mode()===Ki.extendedCertificates&&this.securityFormGroup.addControl("mode",this.fb.control(Di.NONE,[])),this.securityFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{Te(e),this.onChange(e),this.onTouched()})),this.securityFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.updateValidators(e)))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){if(e)e.type||(e.type=Pi.ANONYMOUS),this.updateValidators(e.type),this.securityFormGroup.reset(e,{emitEvent:!1});else{const e={type:Pi.ANONYMOUS};this.securityFormGroup.reset(e,{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.securityFormGroup.get("type").value!==Pi.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===Pi.BASIC)this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1});else if(e===Pi.CERTIFICATES&&(this.securityFormGroup.get("pathToCACert").enable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").enable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").enable({emitEvent:!1}),this.mode()===Ki.extendedCertificates)){const e=this.securityFormGroup.get("mode");e&&!e.value&&e.setValue(Di.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||wY)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:wY,selectors:[["tb-security-config"]],inputs:{title:"title",mode:[1,"mode"]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>wY)),multi:!0},{provide:K,useExisting:c((()=>wY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,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",4,"ngFor","ngForOf"],[3,"ngSwitch"],[3,"ngSwitchCase"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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"],[4,"ngIf"],["formControlName","mode"]],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.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵtemplate(6,hY,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵelementContainerStart(7,5),t.ɵɵtemplate(8,fY,17,7,"ng-template",6)(9,bY,28,22,"ng-template",6),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,n.title)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.BASIC),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.CERTIFICATES))},dependencies:t.ɵɵgetComponentDepsFactory(wY,[j,_,Gn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("SecurityConfigComponent",wY);const SY=()=>({min:1e3}),CY=()=>({min:50}),_Y=()=>({min:100});function TY(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.server-url-required"))}function IY(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,SY)))}function EY(e,n){1&e&&(t.ɵɵelementStart(0,"span",10),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function MY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",22),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function kY(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.ɵɵpipeBind2(1,1,"gateway.scan-period-error",t.ɵɵpureFunction0(4,SY)))}function PY(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.ɵɵpipeBind2(1,1,"gateway.poll-period-error",t.ɵɵpureFunction0(4,CY)))}function DY(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",23),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,PY,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.ɵɵproperty("ngIf",(e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("required")||e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("min"))&&e.serverConfigFormGroup.get("pollPeriodInMillis").touched)}}function OY(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.ɵɵpipeBind2(1,1,"gateway.sub-check-period-error",t.ɵɵpureFunction0(4,_Y)))}class AY{constructor(e){this.fb=e,this.hideNewFields=!1,this.securityPolicyTypes=Ri,this.SecurityMode=Ki,this.destroy$=new te,this.serverConfigFormGroup=this.fb.group({url:["",[$.required,$.pattern(rn)]],timeoutInMillis:[1e3,[$.required,$.min(1e3)]],scanPeriodInMillis:[z,[$.required,$.min(1e3)]],pollPeriodInMillis:[5e3,[$.required,$.min(50)]],enableSubscriptions:[!0,[]],subCheckPeriodInMillis:[100,[$.required,$.min(100)]],showMap:[!1,[]],security:[Fi.BASIC128,[]],identity:[]}),this.serverConfigFormGroup.valueChanges.pipe(le(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=z,pollPeriodInMillis:i=5e3,enableSubscriptions:a=!0,subCheckPeriodInMillis:r=100,showMap:o=!1,security:s=Fi.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||AY)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:AY,selectors:[["tb-opc-server-config"]],inputs:{hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>AY)),multi:!0},{provide:K,useExisting:c((()=>AY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:63,vars:56,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","class","tb-error",3,"matTooltip",4,"ngIf"],[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",4,"ngFor","ngForOf"],["matInput","","type","number","min","1000","name","value","formControlName","scanPeriodInMillis",3,"placeholder"],["class","tb-form-row column-xs",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,TY,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,IY,2,5,"tb-error-icon",9)(18,EY,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.ɵɵtemplate(27,MY,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(28,"div",1)(29,"div",6),t.ɵɵpipe(30,"translate"),t.ɵɵelementStart(31,"div",7),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"mat-form-field",3),t.ɵɵelement(35,"input",13),t.ɵɵpipe(36,"translate"),t.ɵɵtemplate(37,kY,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵtemplate(38,DY,10,10,"div",14),t.ɵɵelementStart(39,"div",1)(40,"div",6),t.ɵɵpipe(41,"translate"),t.ɵɵelementStart(42,"div",7),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"mat-form-field",3),t.ɵɵelement(46,"input",15),t.ɵɵpipe(47,"translate"),t.ɵɵtemplate(48,OY,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(49,"div",16)(50,"mat-slide-toggle",17)(51,"mat-label",18),t.ɵɵpipe(52,"translate"),t.ɵɵelementStart(53,"div",7),t.ɵɵtext(54),t.ɵɵpipe(55,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(56,"div",16)(57,"mat-slide-toggle",19)(58,"mat-label",18),t.ɵɵpipe(59,"translate"),t.ɵɵtext(60),t.ɵɵpipe(61,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelement(62,"tb-security-config",20),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.serverConfigFormGroup.get("url").hasError("required")&&n.serverConfigFormGroup.get("url").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,26,"gateway.hints.opc-timeout")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,28,"gateway.timeout")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,30,"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,32,"gateway.hints.security-policy")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,34,"gateway.security-policy")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.securityPolicyTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(30,36,"gateway.hints.scan-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,38,"gateway.scan-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,40,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("scanPeriodInMillis").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(41,42,"gateway.hints.sub-check-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(44,44,"gateway.sub-check-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(47,46,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("subCheckPeriodInMillis").touched),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(52,48,"gateway.hints.enable-subscription")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(55,50,"gateway.enable-subscription")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(59,52,"gateway.hints.show-map")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(61,54,"gateway.show-map")," "),t.ɵɵadvance(2),t.ɵɵproperty("mode",n.SecurityMode.extendedCertificates))},dependencies:t.ɵɵgetComponentDepsFactory(AY,[j,_,wY,Gn,Jn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("OpcServerConfigComponent",AY),Ge([I()],AY.prototype,"hideNewFields",void 0);class FY extends Na{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Oi,this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){return{server:e.server?Ha.mapServerToUpgradedVersion(e.server):{},mapping:e.server?.mapping?Ha.mapMappingToUpgradedVersion(e.server.mapping):[]}}getMappedValue(e){return{server:Ha.mapServerToDowngradedVersion(e)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(FY)))(n||FY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:FY,selectors:[["tb-opc-ua-legacy-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>FY)),multi:!0},{provide:K,useExisting:c((()=>FY)),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(FY,[j,_,wY,uY,AY]),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",FY),Ge([I()],FY.prototype,"withReportStrategy",void 0);class RY extends Na{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Oi,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(RY)))(n||RY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:RY,selectors:[["tb-opc-ua-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>RY)),multi:!0},{provide:K,useExisting:c((()=>RY)),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(RY,[j,_,wY,uY,AY]),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",RY),Ge([I()],RY.prototype,"withReportStrategy",void 0);class BY extends Na{constructor(){super(...arguments),this.withReportStrategy=!0,this.MappingType=Oi}initBasicFormGroup(){return this.fb.group({mapping:[],requestsMapping:[],broker:[],workers:[]})}getRequestDataArray(e){const t=[];return Fe(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(BY)))(n||BY)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:BY,inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵInheritDefinitionFeature]})}}function NY(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.max-number-of-workers-required"))}function LY(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.max-messages-queue-for-worker-required"))}e("MqttBasicConfigDirective",BY),Ge([I()],BY.prototype,"withReportStrategy",void 0);class VY{constructor(e){this.fb=e,this.destroy$=new te,this.workersConfigFormGroup=this.fb.group({maxNumberOfWorkers:[100,[$.required,$.min(1)]],maxMessageNumberPerWorker:[10,[$.required,$.min(1)]]}),this.workersConfigFormGroup.valueChanges.pipe(le(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||VY)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:VY,selectors:[["tb-workers-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>VY)),multi:!0},{provide:K,useExisting:c((()=>VY)),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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","name","value","type","number","min","1","formControlName","maxMessageNumberPerWorker",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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,NY,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,LY,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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("min")||n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("required")&&n.workersConfigFormGroup.get("maxNumberOfWorkers").touched),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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("min")||n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("required")&&n.workersConfigFormGroup.get("maxMessageNumberPerWorker").touched))},dependencies:t.ɵɵgetComponentDepsFactory(VY,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}function qY(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.host-required"))}function GY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",13),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 zY(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.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function UY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",15),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",VY);class jY{constructor(e,t){this.fb=e,this.cdr=t,this.mqttVersions=ni,this.portLimits=Ei,this.destroy$=new te,this.brokerConfigFormGroup=this.fb.group({host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],version:[5,[]],clientId:["tb_gw_"+Re(5),[$.pattern(rn)]],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_"+Re(5))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{version:t=5,clientId:n=`tb_gw_${Re(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||jY)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:jY,selectors:[["tb-broker-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>jY)),multi:!0},{provide:K,useExisting:c((()=>jY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:16,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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["formControlName","version"],[3,"value",4,"ngFor","ngForOf"],["matInput","","name","value","formControlName","clientId",3,"placeholder"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip","click",4,"ngIf"],["formControlName","security"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,qY,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,GY,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.ɵɵtemplate(20,zY,2,2,"mat-option",9),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",1)(22,"div",7),t.ɵɵtext(23,"gateway.client-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",3),t.ɵɵelement(25,"input",10),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,UY,4,3,"button",11),t.ɵɵelementEnd()(),t.ɵɵelement(28,"tb-security-config",12),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.brokerConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,10,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.brokerConfigFormGroup.get("host").hasError("required")&&n.brokerConfigFormGroup.get("host").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.brokerConfigFormGroup.get("port").hasError("required")||n.brokerConfigFormGroup.get("port").hasError("min")||n.brokerConfigFormGroup.get("port").hasError("max"))&&n.brokerConfigFormGroup.get("port").touched),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.mqttVersions),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!n.brokerConfigFormGroup.get("clientId").value))},dependencies:t.ɵɵgetComponentDepsFactory(jY,[j,_,wY,jW]),encapsulation:2,changeDetection:d.OnPush})}}e("BrokerConfigControlComponent",jY);class HY extends BY{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(HY)))(n||HY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:HY,selectors:[["tb-mqtt-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>HY)),multi:!0},{provide:K,useExisting:c((()=>HY)),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(HY,[j,_,VY,jY,uY]),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",HY);class WY extends BY{mapConfigToFormValue(e){const{broker:t,mapping:n=[],connectRequests:i=[],disconnectRequests:a=[],attributeRequests:r=[],attributeUpdates:o=[],serverSideRpc:s=[]}=e,l=Da.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:Da.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:Da.mapMappingToDowngradedVersion(i),...Da.mapRequestsToDowngradedVersion(r)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(WY)))(n||WY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:WY,selectors:[["tb-mqtt-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>WY)),multi:!0},{provide:K,useExisting:c((()=>WY)),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(WY,[j,_,VY,jY,uY]),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",WY);class $Y extends A{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=Ei,this.modbusProtocolTypes=Object.values(Yi),this.modbusMethodTypes=Object.values(Xi),this.modbusSerialMethodTypes=Object.values(Zi),this.modbusParities=Object.values(Qi),this.modbusByteSizes=ia,this.modbusBaudrates=na,this.modbusOrderType=Object.values(Ji),this.ModbusProtocolType=Yi,this.ModbusParityLabelsMap=pa,this.ModbusProtocolLabelsMap=la,this.ModbusMethodLabelsMap=sa,this.ReportStrategyDefaultValue=tn,this.modbusHelpLink=O+"/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 te,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&&!Se(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:[Yi.TCP],host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],serialPort:["",[$.required,$.pattern(rn)]],method:[Xi.SOCKET,[$.required]],baudrate:[this.modbusBaudrates[0]],stopbits:[1],bytesize:[ia[0]],parity:[Qi.None],strict:[!0],unitId:[null,[$.required]],deviceName:["",[$.required,$.pattern(rn)]],deviceType:["",[$.required,$.pattern(rn)]],timeout:[35],byteOrder:[Ji.BIG],wordOrder:[Ji.BIG],retries:[!0],retryOnEmpty:[!0],retryOnInvalid:[!0],pollPeriod:[1e3,[$.required]],connectAttemptTimeMs:[500,[$.required]],connectAttemptCount:[5,[$.required]],waitAfterFailedAttemptsMs:[3e4,[$.required]],values:[{}],security:[{}]}),this.addFieldsToFormGroup()}updateSlaveFormGroup(){this.slaveConfigFormGroup.patchValue({...this.data.value,port:this.data.value.type===Yi.Serial?null:this.data.value.port,serialPort:this.data.value.type===Yi.Serial?this.data.value.port:"",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(le(this.destroy$)).subscribe((e=>{this.updateControlsEnabling(e),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Xi.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Yi.Serial?Zi.ASCII:Xi.SOCKET,{emitEvent:!1})}updateControlsEnabling(e){const[t,n]=e===Yi.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(le(this.destroy$)).subscribe((e=>this.updateSecurityEnabling(e)))}updateSecurityEnabling(e){e&&this.protocolType!==Yi.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||$Y)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵdir=t.ɵɵdefineDirective({type:$Y,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusSlaveDialogAbstract",$Y);const KY=()=>({maxWidth:"970px"});function YY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),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 XY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"span",23),t.ɵɵtext(5),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",24),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"span",25),t.ɵɵtext(10),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",24),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"span",25),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 ZY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",45),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 QY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function JY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),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 eX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",35),t.ɵɵtext(2,"gateway.function-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32)(4,"mat-select",47),t.ɵɵtemplate(5,JY,3,4,"mat-option",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.functionCodesMap.get(e.get("id").value)||n.defaultFunctionCodes)}}function tX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.objects-count-required"))}function nX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),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 iX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",49),t.ɵɵelement(5,"input",50),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,nX,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("bit").hasError("max")&&e.get("bit").touched)}}function aX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),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 rX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit-target-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",51)(5,"mat-form-field",52)(6,"mat-select",53),t.ɵɵtemplate(7,aX,3,4,"mat-option",37),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.bit-target-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.bitTargetTypes)}}function oX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,iX,8,7,"div",38)(2,rX,8,4,"div",38),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("objectsCount").value>1),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields)}}function sX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function lX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵelement(1,"mat-icon",62),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 pX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.modifier-invalid"))}function cX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",54)(1,"mat-expansion-panel",15)(2,"mat-expansion-panel-header",16)(3,"mat-panel-title")(4,"mat-slide-toggle",55),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label",56),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",51)(10,"div",57)(11,"div",35),t.ɵɵtext(12,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",52)(14,"mat-select",58)(15,"mat-select-trigger")(16,"div",59),t.ɵɵelement(17,"mat-icon",60),t.ɵɵelementStart(18,"span"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(21,lX,5,5,"mat-option",37),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(22,"div",30)(23,"div",35),t.ɵɵtext(24,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",49),t.ɵɵelement(26,"input",61),t.ɵɵpipe(27,"translate"),t.ɵɵtemplate(28,pX,3,3,"mat-icon",34),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,9,"gateway.hints.modbus.modifier")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,11,"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,13,null==(n=a.ModifierTypesMap.get(i.get("modifierType").value))?null:n.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",a.modifierTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(27,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",i.get("modifierValue").hasError("pattern")&&i.get("modifierValue").touched)}}function dX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function uX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",63),t.ɵɵtext(2,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32),t.ɵɵelement(4,"input",64),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,dX,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function mX(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",65),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Key)("isExpansionMode",!0)}}function hX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",26),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelement(3,"div",27),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",28)(5,"div",29),t.ɵɵtext(6,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",30)(8,"div",31),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",32),t.ɵɵelement(13,"input",33),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,ZY,3,3,"mat-icon",34),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",28)(17,"div",29),t.ɵɵtext(18,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",30)(20,"div",35),t.ɵɵtext(21," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",32)(23,"mat-select",36),t.ɵɵtemplate(24,QY,2,2,"mat-option",37),t.ɵɵelementEnd()()(),t.ɵɵtemplate(25,eX,6,1,"div",38),t.ɵɵelementStart(26,"div",30)(27,"div",39),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"gateway.objects-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",32),t.ɵɵelement(31,"input",40),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,tX,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,oX,3,2,"ng-container",41),t.ɵɵelementStart(35,"div",30)(36,"div",39),t.ɵɵpipe(37,"translate"),t.ɵɵtext(38,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"mat-form-field",32),t.ɵɵelement(40,"input",42),t.ɵɵpipe(41,"translate"),t.ɵɵtemplate(42,sX,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(43,cX,29,17,"div",43)(44,uX,7,4,"div",38)(45,mX,1,2,"tb-report-strategy",44),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,20,"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(36,KY)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(9,22,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.hints.modbus.method":"gateway.hints.modbus.key")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,24,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.method-name":"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,26,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("tag").hasError("required")&&e.get("tag").touched),t.ɵɵadvance(9),t.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withFunctionCode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(28,28,"gateway.hints.modbus.objects-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,30,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(e.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("objectsCount").hasError("required")&&e.get("objectsCount").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("type").value===n.ModbusDataType.BITS),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(37,32,"gateway.hints.modbus.address")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(41,34,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("address").hasError("required")&&e.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.showModifiersMap.get(e.get("id").value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy)}}function gX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,YY,2,3,"div",17)(7,XY,16,12,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,hX,46,37,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),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.last,a=t.ɵɵreference(8),r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.isMaster)("ngIfElse",a),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function fX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,gX,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByControlId)}}function yX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",66)(1,"span",67),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class vX{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($t),this.modifierTypes=Object.values(ha),this.bitTargetTypes=Object.values(ra),this.BitTargetTypeTranslationMap=oa,this.ModbusEditableDataTypes=Kt,this.ModbusFunctionCodeTranslationsMap=Qt,this.ModifierTypesMap=ga,this.ReportStrategyDefaultValue=tn,this.ModbusDataType=$t,this.ModbusValueKey=ta,this.destroy$=new te,this.defaultReadFunctionCodes=[3,4],this.bitsReadFunctionCodes=[1,2],this.defaultWriteFunctionCodes=[6,16],this.bitsWriteFunctionCodes=[5,15]}ngOnInit(){this.withFunctionCode=!this.isMaster||this.keysType!==ta.ATTRIBUTES&&this.keysType!==ta.TIMESERIES,this.withReportStrategy=!(this.isMaster||this.keysType!==ta.ATTRIBUTES&&this.keysType!==ta.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=Re(5),t=this.fb.group({tag:["",[$.required,$.pattern(rn)]],value:[{value:"",disabled:!this.isMaster},[$.required,$.pattern(rn)]],type:[$t.BYTES,[$.required]],address:[null,[$.required]],objectsCount:[1,[$.required]],functionCode:[{value:this.getDefaultFunctionCodes()[0],disabled:!this.withFunctionCode},[$.required]],reportStrategy:[{value:null,disabled:!this.withReportStrategy}],modifierType:[{value:ha.MULTIPLIER,disabled:!0}],modifierValue:[{value:1,disabled:!0},[$.pattern(sn)]],bit:[{value:null,disabled:!0}],bitTargetType:[{value:ra.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=Re(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,[$.required,$.pattern(rn)]],value:[{value:n,disabled:!this.isMaster},[$.required,$.pattern(rn)]],type:[i,[$.required]],address:[a,[$.required]],objectsCount:[r,[$.required]],functionCode:[{value:o,disabled:!this.withFunctionCode},[$.required]],modifierType:[{value:l?ha.DIVIDER:ha.MULTIPLIER,disabled:!this.enableModifiersControlMap.get(u).value}],bit:[{value:c,disabled:i!==$t.BITS||r<2},[$.max(r-1)]],bitTargetType:[{value:d??ra.IntegerType,disabled:i!==$t.BITS||this.hideNewFields}],modifierValue:[{value:s??l??1,disabled:!this.enableModifiersControlMap.get(u).value},[$.pattern(sn)]],id:[{value:u,disabled:!0}],reportStrategy:[{value:p,disabled:!this.withReportStrategy}]})}shouldShowModifier(e){return!(this.isMaster||this.keysType!==ta.ATTRIBUTES&&this.keysType!==ta.TIMESERIES||this.ModbusEditableDataTypes.includes(e))}observeKeyDataType(e){e.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((t=>{this.ModbusEditableDataTypes.includes(t)||e.get("objectsCount").patchValue(Yt[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(ue((()=>e.get("type").value===$t.BITS)),le(this.destroy$)).subscribe((()=>this.toggleBitsFields(e)))}toggleBitsFields(e){const{objectsCount:t,type:n,bit:i,bitTargetType:a}=e.controls,r=n.value===$t.BITS,o=t.value>1;r&&o?(i.enable({emitEvent:!1}),i.setValidators($.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(le(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===$t.BITS?this.bitsWriteFunctionCodes:[],...this.defaultWriteFunctionCodes];if(this.keysType===ta.ATTRIBUTES_UPDATES)return t.sort(((e,t)=>e-t));const n=[...this.defaultReadFunctionCodes];return e===$t.BITS&&n.push(...this.bitsReadFunctionCodes),this.keysType===ta.RPC_REQUESTS&&n.push(...t),n.sort(((e,t)=>e-t))}getDefaultFunctionCodes(){return this.keysType===ta.ATTRIBUTES_UPDATES?this.defaultWriteFunctionCodes:this.keysType===ta.RPC_REQUESTS?[...this.defaultReadFunctionCodes,...this.defaultWriteFunctionCodes]:this.defaultReadFunctionCodes}static{this.ɵfac=function(e){return new(e||vX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:vX,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:19,vars:16,consts:[["noKeys",""],["tagName",""],[1,"tb-modbus-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container","tbTruncateWithTooltip","",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["tbTruncateWithTooltip","",1,"title-container"],[1,"tb-flex"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["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"],[4,"ngIf"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"defaultValue","isExpansionMode",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,"tb-form-panel","stroked","tb-slide-toggle"],[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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,fX,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,yX,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(vX,[j,_,Zn,Gn]),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: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",vX),Ge([I()],vX.prototype,"isMaster",void 0),Ge([I()],vX.prototype,"hideNewFields",void 0);const xX=()=>({$implicit:null}),bX=e=>({$implicit:e});function wX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7),t.ɵɵelementContainer(2,8),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(4);t.ɵɵadvance(),t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",n)("ngTemplateOutletContext",t.ɵɵpureFunction0(3,xX))}}function SX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab",11),t.ɵɵpipe(1,"translate"),t.ɵɵelementStart(2,"div",7),t.ɵɵelementContainer(3,8),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2),a=t.ɵɵreference(4);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,bX,e))}}function CX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group",9),t.ɵɵtemplate(1,SX,4,8,"mat-tab",10),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.modbusRegisterTypes)}}function _X(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 TX(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 IX(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 EX(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 MX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵtext(2,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",14)(4,"mat-chip-listbox",15),t.ɵɵtemplate(5,_X,2,1,"mat-chip",16),t.ɵɵelementStart(6,"mat-chip",17),t.ɵɵelement(7,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",19,2),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(9),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES,i))})),t.ɵɵelementStart(11,"tb-icon",20),t.ɵɵtext(12,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(13,"div",12)(14,"div",13),t.ɵɵtext(15,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-chip-listbox",15),t.ɵɵtemplate(18,TX,2,1,"mat-chip",16),t.ɵɵelementStart(19,"mat-chip",17),t.ɵɵelement(20,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(21,"button",19,3),t.ɵɵpipe(23,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(22),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.TIMESERIES,i))})),t.ɵɵelementStart(24,"tb-icon",20),t.ɵɵtext(25,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(26,"div",12)(27,"div",13),t.ɵɵtext(28,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",14)(30,"mat-chip-listbox",15),t.ɵɵtemplate(31,IX,2,1,"mat-chip",16),t.ɵɵelementStart(32,"mat-chip",17),t.ɵɵelement(33,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"button",19,4),t.ɵɵpipe(36,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(35),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES_UPDATES,i))})),t.ɵɵelementStart(37,"tb-icon",20),t.ɵɵtext(38,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(39,"div",12)(40,"div",13),t.ɵɵtext(41,"gateway.rpc-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",14)(43,"mat-chip-listbox",15),t.ɵɵtemplate(44,EX,2,1,"mat-chip",16),t.ɵɵelementStart(45,"mat-chip",17),t.ɵɵelement(46,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"button",19,5),t.ɵɵpipe(49,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(48),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.RPC_REQUESTS,i))})),t.ɵɵelementStart(50,"tb-icon",20),t.ɵɵtext(51,"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.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,16,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(23,18,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(36,20,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,22,"action.edit")),t.ɵɵproperty("disabled",i.disabled)}}class kX{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(ea),this.modbusValueKeys=Object.values(ta),this.ModbusValuesTranslationsMap=aa,this.ModbusValueKey=ta}ngOnInit(){this.initializeValuesFormGroup(),this.observeValuesChanges()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){if(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:da.get(n),deleteKeyTitle:ua.get(n),noKeysText:ma.get(n),hideNewFields:this.hideNewFields};this.popoverComponent=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,vX,"leftBottom",!1,null,o,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(wn(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(wn(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||kX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:kX,selectors:[["tb-modbus-values"]],inputs:{singleMode:"singleMode",hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>kX)),multi:!0},{provide:K,useExisting:c((()=>kX)),multi:!0}]),t.ɵɵStandaloneFeature],decls:5,vars:2,consts:[["multipleView",""],["singleView",""],["attributesButton",""],["telemetryButton",""],["attributesUpdatesButton",""],["rpcRequestsButton",""],[4,"ngIf","ngIfElse"],[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"formGroup"],[3,"label",4,"ngFor","ngForOf"],[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"],[4,"ngFor","ngForOf"],[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){if(1&e&&t.ɵɵtemplate(0,wX,3,4,"ng-container",6)(1,CX,2,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(3,MX,52,24,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2);t.ɵɵproperty("ngIf",n.singleMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(kX,[j,_,zn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .mat-mdc-tab-body-wrapper{min-height:320px} .mdc-evolution-chip-set__chips{align-items:center}'],changeDetection:d.OnPush})}}function PX(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",16),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function DX(e,n){1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-slide-toggle",18)(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",kX),Ge([I()],kX.prototype,"singleMode",void 0),Ge([I()],kX.prototype,"hideNewFields",void 0);class OX{constructor(e,t){this.fb=e,this.cdr=t,this.isMaster=!1,this.disabled=!1,this.destroy$=new te,this.securityConfigFormGroup=this.fb.group({certfile:["",[$.pattern(rn)]],keyfile:["",[$.pattern(rn)]],password:["",[$.pattern(rn)]],server_hostname:["",[$.pattern(rn)]],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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}static{this.ɵfac=function(e){return new(e||OX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:OX,selectors:[["tb-modbus-security-config"]],inputs:{isMaster:"isMaster"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>OX)),multi:!0},{provide:K,useExisting:c((()=>OX)),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","formControlName","certfile",3,"placeholder"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","keyfile",3,"placeholder"],["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"],["class","tb-form-row space-between tb-flex fill-width",4,"ngIf"],["class","tb-form-row",4,"ngIf"],["matInput","","name","value","formControlName","server_hostname",3,"placeholder"],[1,"tb-form-row"],["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,PX,7,3,"div",14)(32,DX,5,3,"div",15),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.ɵɵproperty("ngIf",!n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster))},dependencies:t.ɵɵgetComponentDepsFactory(OX,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}function AX(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),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 FX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function RX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,FX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function BX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 NX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,BX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function LX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function VX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,LX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function qX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 GX(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 zX(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 UX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 jX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,GX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,zX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,UX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function HX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function WX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function $X(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function KX(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 YX(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function XX(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 ZX(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 QX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",OX),Ge([I()],OX.prototype,"isMaster",void 0);class JX extends $Y{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===Yi.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||JX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:JX,selectors:[["tb-modbus-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,AX,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,RX,8,7,"div",15)(20,NX,8,9,"div",16)(21,VX,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,qX,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,jX,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,HX,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,WX,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,$X,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,KX,5,3,"div",28)(54,YX,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,XX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,ZX,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,QX,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),i=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",i),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(JX,[j,_,kX,OX,jW,Zn,Gn]),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 eZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),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 tZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function nZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,tZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function iZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 aZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,iZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function rZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function oZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,rZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function sZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 lZ(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 pZ(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 cZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 dZ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,lZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,pZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,cZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function uZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function mZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function hZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function gZ(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 fZ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function yZ(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 vZ(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 xZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",JX);class bZ extends $Y{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===Yi.Serial&&(a.port=n),Te(a),a}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("sendDataOnlyOnChange",this.fb.control(!1))}static{this.ɵfac=function(e){return new(e||bZ)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:bZ,selectors:[["tb-modbus-legacy-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,eZ,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,nZ,8,7,"div",15)(20,aZ,8,9,"div",16)(21,oZ,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,sZ,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,dZ,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,uZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,mZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,hZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,gZ,5,3,"div",28)(54,fZ,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,yZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,vZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,xZ,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),i=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",i),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(bZ,[j,_,kX,OX,jW,Zn]),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 wZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",38),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 SZ(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.host-required"))}function CZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",39),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,SZ,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function _Z(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",40),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 TZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",41),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,_Z,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function IZ(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.port-required"))}function EZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",42),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,IZ,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched)}}function MZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),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 kZ(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.unit-id-required"))}function PZ(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-required"))}function DZ(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-profile-required"))}function OZ(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.ɵɵtextInterpolate(e)}}function AZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12)(5,"mat-select",43),t.ɵɵtemplate(6,OZ,2,2,"mat-option",6),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates)}}function FZ(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.ɵɵtextInterpolate(e)}}function RZ(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.ɵɵtextInterpolate(e)}}function BZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",44)(1,"mat-expansion-panel",45)(2,"mat-expansion-panel-header",46)(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"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",48),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",bZ);class NZ{constructor(e){this.fb=e,this.ModbusProtocolLabelsMap=la,this.ModbusMethodLabelsMap=sa,this.portLimits=Ei,this.modbusProtocolTypes=Object.values(Yi),this.modbusMethodTypes=Object.values(Xi),this.modbusSerialMethodTypes=Object.values(Zi),this.modbusOrderType=Object.values(Ji),this.ModbusProtocolType=Yi,this.modbusBaudrates=na,this.isSlaveEnabled=!1,this.serialSpecificControlKeys=["serialPort","baudrate"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new te,this.showSecurityControl=this.fb.control(!1),this.slaveConfigFormGroup=this.fb.group({type:[Yi.TCP],host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],serialPort:["",[$.required,$.pattern(rn)]],method:[Xi.SOCKET],unitId:[null,[$.required]],baudrate:[this.modbusBaudrates[0]],deviceName:["",[$.required,$.pattern(rn)]],deviceType:["",[$.required,$.pattern(rn)]],pollPeriod:[1e3,[$.required]],sendDataToThingsBoard:[!1],byteOrder:[Ji.BIG],wordOrder:[Ji.BIG],security:[],identity:this.fb.group({vendorName:["",[$.pattern(rn)]],productCode:["",[$.pattern(rn)]],vendorUrl:["",[$.pattern(rn)]],productName:["",[$.pattern(rn)]],modelName:["",[$.pattern(rn)]]}),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&&!Se(e.security,{})),this.updateSlaveConfig(e)}setDisabledState(e){this.isSlaveEnabled=!e,this.updateFormEnableState()}observeValueChanges(){this.slaveConfigFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{e.type===Yi.Serial&&(e.port=e.serialPort,delete e.serialPort),this.onChange(e),this.onTouched()}))}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateFormEnableState(),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Xi.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Yi.Serial?Zi.ASCII:Xi.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(le(this.destroy$)).subscribe((e=>this.updateSecurityEnable(e)))}updateSecurityEnable(e){e&&this.isSlaveEnabled&&this.protocolType!==Yi.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}updateEnablingByProtocol(){const e=this.protocolType===Yi.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=Yi.TCP,method:l=Xi.RTU,unitId:p=0,deviceName:c="",deviceType:d="",pollPeriod:u=1e3,sendDataToThingsBoard:m=!1,byteOrder:h=Ji.BIG,wordOrder:g=Ji.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===Yi.Serial?"":x,port:s===Yi.Serial?null:b,serialPort:s===Yi.Serial?b:""};this.slaveConfigFormGroup.setValue(w,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||NZ)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:NZ,selectors:[["tb-modbus-slave-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>NZ)),multi:!0},{provide:K,useExisting:c((()=>NZ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:112,vars:59,consts:[["serialPort",""],[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",4,"ngFor","ngForOf"],[1,"tb-form-panel","no-border","no-padding","padding-top"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[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"],[3,"value"],["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-form-panel","stroked","tb-slide-toggle"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],["formControlName","security"]],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.server-slave-config"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",5),t.ɵɵtemplate(6,wZ,2,2,"tb-toggle-option",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",7),t.ɵɵtemplate(8,CZ,8,7,"div",8)(9,TZ,8,9,"div",9)(10,EZ,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",10)(13,"div",11),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-form-field",12)(17,"mat-select",13),t.ɵɵtemplate(18,MZ,2,2,"mat-option",6),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",10)(20,"div",14),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",12),t.ɵɵelement(24,"input",15),t.ɵɵpipe(25,"translate"),t.ɵɵtemplate(26,kZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(27,"div",10)(28,"div",17),t.ɵɵtext(29,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",12),t.ɵɵelement(31,"input",18),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,PZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",10)(35,"div",17),t.ɵɵtext(36,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",12),t.ɵɵelement(38,"input",19),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,DZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(41,"div",10)(42,"div",20),t.ɵɵpipe(43,"translate"),t.ɵɵelementStart(44,"span",21),t.ɵɵtext(45," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",12),t.ɵɵelement(47,"input",22),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(49,AZ,7,4,"div",8),t.ɵɵelementStart(50,"div",23)(51,"mat-slide-toggle",24)(52,"mat-label"),t.ɵɵtext(53),t.ɵɵpipe(54,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(55,"div",25)(56,"mat-expansion-panel",26)(57,"mat-expansion-panel-header")(58,"mat-panel-title")(59,"div",27),t.ɵɵtext(60,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(61,"div",7)(62,"div",10)(63,"div",11),t.ɵɵpipe(64,"translate"),t.ɵɵtext(65,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(66,"mat-form-field",12)(67,"mat-select",28),t.ɵɵtemplate(68,FZ,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵelementStart(69,"div",10)(70,"div",11),t.ɵɵpipe(71,"translate"),t.ɵɵtext(72,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(73,"mat-form-field",12)(74,"mat-select",29),t.ɵɵtemplate(75,RZ,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵtemplate(76,BZ,9,5,"div",30),t.ɵɵelementContainerStart(77,31),t.ɵɵelementStart(78,"div",10)(79,"div",4),t.ɵɵtext(80,"gateway.vendor-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",12),t.ɵɵelement(82,"input",32),t.ɵɵpipe(83,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"div",10)(85,"div",4),t.ɵɵtext(86,"gateway.product-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(87,"mat-form-field",12),t.ɵɵelement(88,"input",33),t.ɵɵpipe(89,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(90,"div",10)(91,"div",4),t.ɵɵtext(92,"gateway.vendor-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(93,"mat-form-field",12),t.ɵɵelement(94,"input",34),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(96,"div",10)(97,"div",4),t.ɵɵtext(98,"gateway.product-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(99,"mat-form-field",12),t.ɵɵelement(100,"input",35),t.ɵɵpipe(101,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(102,"div",10)(103,"div",4),t.ɵɵtext(104,"gateway.model-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(105,"mat-form-field",12),t.ɵɵelement(106,"input",36),t.ɵɵpipe(107,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()(),t.ɵɵelementStart(108,"div",25)(109,"div",27),t.ɵɵtext(110,"gateway.values"),t.ɵɵelementEnd(),t.ɵɵelement(111,"tb-modbus-values",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵreference(11);t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(14,29,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,31,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(25,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,35,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(39,37,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(43,39,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(48,41,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(54,43,"gateway.send-data-to-platform")," "),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(64,45,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(71,47,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup.get("identity")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(83,49,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(89,51,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(95,53,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(101,55,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(107,57,"gateway.set"))}},dependencies:t.ɵɵgetComponentDepsFactory(NZ,[j,_,kX,OX,jW,Gn]),encapsulation:2,changeDetection:d.OnPush})}}e("ModbusSlaveConfigComponent",NZ);const LZ=["searchInput"],VZ=()=>["deviceName","info","unitId","type","actions"],qZ=()=>({minWidth:"96px",textAlign:"center"});function GZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",28)(2,"span",29),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",11),t.ɵɵelementStart(6,"button",13),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",13),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 zZ(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 UZ(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 jZ(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 HZ(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 WZ(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 $Z(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 KZ(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 YZ(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 XZ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function ZZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",13),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 QZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,ZZ,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,qZ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function JZ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function eQ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class tQ{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=la,this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new te,this.masterFormGroup=this.fb.group({slaves:this.fb.array([])}),this.dataSource=new nQ}get slaves(){return this.masterFormGroup.get("slaves")}ngOnInit(){this.masterFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e.slaves),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t),i=n?this.slaves.at(t).value:{};this.getSlaveDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(n?this.slaves.at(t).patchValue(e):this.slaves.push(this.fb.control(e)),this.masterFormGroup.markAsDirty())}))}getSlaveDialog(e,t){return this.isLegacy?this.dialog.open(bZ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,hideNewFields:!0,buttonTitle:t}}):this.dialog.open(JX,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,hideNewFields:!1}})}deleteSlave(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-slave-title",{name:this.slaves.controls[t].value.deviceName}),this.translate.instant("gateway.delete-slave-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(this.slaves.removeAt(t),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||tQ)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:tQ,selectors:[["tb-modbus-master-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(LZ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{isLegacy:"isLegacy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>tQ)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,GZ,14,9,"div",8),t.ɵɵpipe(8,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-toolbar",7)(10,"div",9)(11,"button",10),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"mat-icon"),t.ɵɵtext(14,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",11)(16,"mat-label"),t.ɵɵtext(17," "),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",12,0),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",13),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",14)(26,"table",15),t.ɵɵelementContainerStart(27,16),t.ɵɵtemplate(28,zZ,4,3,"mat-header-cell",17)(29,UZ,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(30,16),t.ɵɵtemplate(31,jZ,3,3,"mat-header-cell",17)(32,HZ,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(33,16),t.ɵɵtemplate(34,WZ,3,3,"mat-header-cell",17)(35,$Z,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(36,16),t.ɵɵtemplate(37,KZ,4,3,"mat-header-cell",17)(38,YZ,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(39,19),t.ɵɵtemplate(40,XZ,1,0,"mat-header-cell",20)(41,QZ,12,6,"mat-cell",21),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(42,JZ,1,0,"mat-header-row",22)(43,eQ,1,0,"mat-row",23),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"section",24),t.ɵɵpipe(45,"async"),t.ɵɵelementStart(46,"button",25),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageSlave(i))})),t.ɵɵelementStart(47,"mat-icon",26),t.ɵɵtext(48,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"span"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(52,"span",27),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(8,25,n.dataSource.isEmpty())),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,VZ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(40,VZ)),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(tQ,[j,_,Gn]),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",tQ),Ge([ot()],tQ.prototype,"isLegacy",void 0);class nQ extends G{constructor(){super()}}e("SlavesDatasource",nQ);class iQ extends Na{constructor(){super(),this.enableSlaveControl=new X(!1),this.enableSlaveControl.valueChanges.pipe(wn()).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&&(Se(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&&!Se(e.slave,{}))}static{this.ɵfac=function(e){return new(e||iQ)}}static{this.ɵdir=t.ɵɵdefineDirective({type:iQ,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusBasicConfigDirective",iQ);class aQ extends iQ{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(aQ)))(n||aQ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:aQ,selectors:[["tb-modbus-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>aQ)),multi:!0},{provide:K,useExisting:c((()=>aQ)),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(aQ,[j,_,NZ,tQ,zn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusBasicConfigComponent",aQ);class rQ extends iQ{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(rQ)))(n||rQ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:rQ,selectors:[["tb-modbus-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>rQ)),multi:!0},{provide:K,useExisting:c((()=>rQ)),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(rQ,[j,_,NZ,tQ,zn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusLegacyBasicConfigComponent",rQ);const oQ=()=>({maxWidth:"970px"});function sQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," ")}}function lQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("methodRPC").value)}}function pQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("attributeOnThingsBoard").value)}}function cQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate2(" ",e.get("requestExpression").value+" - ","",e.get("attributeNameExpression").value," ")}}function dQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21),t.ɵɵtemplate(1,lQ,2,1,"ng-container",22)(2,pQ,2,1,"ng-container",22)(3,cQ,2,2,"ng-container",22),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngSwitch",e.keysType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_UPDATES),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_REQUESTS)}}function uQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function mQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function hQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function gQ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",42),2&e){const e=t.ɵɵnextContext(5);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function fQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"div",28)(11,"mat-form-field",29),t.ɵɵelement(12,"input",30),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,uQ,3,3,"mat-icon",31),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",26)(19,"div",32)(20,"span",33),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"div",34),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"label",35),t.ɵɵtext(25,"from"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",36),t.ɵɵelement(27,"input",37),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,mQ,3,3,"mat-icon",31),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"label",38),t.ɵɵtext(31,"to"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",36),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,hQ,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(36,gQ,1,2,"tb-report-strategy",40),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),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,oQ)),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteFrom").hasError("required")&&e.get("byteFrom").touched),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteTo").hasError("required")&&e.get("byteTo").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy&&(n.keysType===n.SocketValueKey.ATTRIBUTES||n.keysType===n.SocketValueKey.TIMESERIES))}}function yQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function vQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function xQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",43),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29),t.ɵɵelement(7,"input",44),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,yQ,3,3,"mat-icon",31),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",26)(11,"div",45),t.ɵɵpipe(12,"translate"),t.ɵɵtext(13," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",28)(15,"mat-form-field",29)(16,"mat-select",46),t.ɵɵtemplate(17,vQ,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(18,"div",48)(19,"mat-slide-toggle",49),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(20,"mat-label",50),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,7,"gateway.method-name")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("methodRPC").hasError("required")&&e.get("methodRPC").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(12,11,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,13,"gateway.hints.socket.with-response")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,15,"gateway.rpc.withResponse")," ")}}function bQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 wQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 SQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-expression-required"))}function CQ(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/request-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,oQ))}function _Q(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 TQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 IQ(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/attribute-name-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,oQ))}function EQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",52),t.ɵɵtemplate(8,bQ,3,4,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",53)(14,"mat-form-field",29)(15,"mat-select",54),t.ɵɵtemplate(16,wQ,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-form-field",29),t.ɵɵelement(18,"input",55),t.ɵɵpipe(19,"translate"),t.ɵɵtemplate(20,SQ,3,3,"mat-icon",31)(21,CQ,1,3,"div",56),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",26)(23,"div",43),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"div",53)(27,"mat-form-field",29)(28,"mat-select",57),t.ɵɵtemplate(29,_Q,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"mat-form-field",29),t.ɵɵelement(31,"input",58),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,TQ,3,3,"mat-icon",31)(34,IQ,1,3,"div",56),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,12,"gateway.hints.socket.attribute-requests-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.requestsType),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,14,"gateway.request-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("requestExpression").hasError("required")&&e.get("requestExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("requestExpressionSource").value===n.ExpressionType.Expression),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,18,"gateway.attribute-name-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,20,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeNameExpression").hasError("required")&&e.get("attributeNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("attributeNameExpressionSource").value===n.ExpressionType.Expression)}}function MQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function kQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 PQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",46),t.ɵɵtemplate(8,MQ,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",28)(14,"mat-form-field",29),t.ɵɵelement(15,"input",59),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,kQ,3,3,"mat-icon",31),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,5,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.attribute-on-platform")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeOnThingsBoard").hasError("required")&&e.get("attributeOnThingsBoard").touched)}}function DQ(e,n){if(1&e&&t.ɵɵtemplate(0,fQ,37,27,"div",23)(1,xQ,24,17,"div",23)(2,EQ,35,22,"div",23)(3,PQ,18,11,"div",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.TIMESERIES||e.keysType===e.SocketValueKey.ATTRIBUTES),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_UPDATES)}}function OQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,sQ,2,1,"div",17)(7,dQ,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,DQ,4,4,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),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.last,a=t.ɵɵreference(8),r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.keysType===r.SocketValueKey.TIMESERIES||r.keysType===r.SocketValueKey.ATTRIBUTES)("ngIfElse",a),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function AQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,OQ,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function FQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",60)(1,"span",61),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class RQ extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=new u,this.SocketValueKey=pi,this.socketEncoding=Object.values(ht),this.requestsType=Object.values(di),this.expressionType=Object.values(ui),this.ExpressionType=ui,this.ReportStrategyDefaultValue=tn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===pi.RPC_METHODS?this.fb.group({methodRPC:["",[$.required]],encoding:[ht.UTF16,[$.required]],withResponse:[!0]}):this.keysType===pi.ATTRIBUTES_UPDATES?this.fb.group({encoding:[ht.UTF16,[$.required]],attributeOnThingsBoard:["",[$.required]]}):this.keysType===pi.ATTRIBUTES_REQUESTS?this.fb.group({type:[di.Shared],requestExpressionSource:[ui.Constant],attributeNameExpressionSource:[ui.Constant],requestExpression:["",[$.required]],attributeNameExpression:["",[$.required]]}):this.fb.group({key:["",[$.required,$.pattern(rn)]],byteFrom:[0,[$.required]],byteTo:[0,[$.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===pi.RPC_METHODS){const t=e;n=this.fb.group({methodRPC:[t.methodRPC,[$.required]],encoding:[t.encoding,[$.required]],withResponse:[t.withResponse]})}else if(this.keysType===pi.ATTRIBUTES_REQUESTS){const t=e;n=this.fb.group({type:[t.type??di.Shared],requestExpressionSource:[t.requestExpressionSource??ui.Constant],attributeNameExpressionSource:[t.attributeNameExpressionSource??ui.Constant],requestExpression:[t.requestExpression,[$.required]],attributeNameExpression:[t.attributeNameExpression,[$.required]]})}else if(this.keysType===pi.ATTRIBUTES_UPDATES)n=this.fb.group({encoding:[e.encoding??ht.UTF16],attributeOnThingsBoard:[e.attributeOnThingsBoard,[$.required]]});else{const{key:t,byteFrom:i,byteTo:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[$.required,$.pattern(rn)]],byteFrom:[i??0,[$.required]],byteTo:[a??0,[$.required]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)})),this.fb.array(t)}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===pi.ATTRIBUTES||this.keysType===pi.TIMESERIES))}static{this.ɵfac=function(e){return new(e||RQ)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:RQ,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:19,vars:16,consts:[["noKeys",""],["valueTitle",""],[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"title-container"],[1,"title-container",3,"ngSwitch"],[4,"ngSwitchCase"],["class","tb-form-panel no-border no-padding",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],[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",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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",4,"ngFor","ngForOf"],[1,"tb-form-row"],["formControlName","withResponse",1,"mat-slide",3,"click"],[3,"tb-hint-tooltip-icon"],[3,"value"],["formControlName","type"],[1,"tb-flex"],["formControlName","requestExpressionSource"],["matInput","","name","value","formControlName","requestExpression",3,"placeholder"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","attributeOnThingsBoard",3,"placeholder"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,AQ,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,FQ,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(RQ,[j,_,Zn]),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",RQ),Ge([I()],RQ.prototype,"withReportStrategy",void 0);const BQ=()=>({maxWidth:"970px"});function NQ(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.address-filter-required"))}function LQ(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-required"))}function VQ(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-profile-required"))}function qQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function GQ(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 zQ(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 UQ(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 jQ(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 HQ(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 WQ(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 $Q extends A{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:["",[$.required,$.pattern(rn)]],deviceName:["",[$.required,$.pattern(rn)]],deviceType:["",[$.required,$.pattern(rn)]],encoding:[ht.UTF8],telemetry:[[]],attributes:[[]],attributeRequests:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.SocketValueKey=pi,this.socketDeviceHelpLink=O+"/docs/iot-gateway/config/socket/#device-subsection",this.socketEncoding=Object.values(ht),this.ReportStrategyDefaultValue=tn,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:ci.get(n),addKeyTitle:mi.get(n),deleteKeyTitle:hi.get(n),noKeysText:gi.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,RQ,"leftBottom",!1,null,r,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(wn(this.destroyRef)).subscribe((e=>{this.popoverComponent.hide(),a.patchValue(e),a.markAsDirty(),this.cdr.markForCheck()})),this.popoverComponent.tbHideStart.pipe(wn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||$Q)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$Q,selectors:[["tb-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:119,vars:57,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","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"],["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",4,"ngFor","ngForOf"],["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"],[4,"ngFor","ngForOf"],[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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"]],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,NQ,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,LQ,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,VQ,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.ɵɵtemplate(45,qQ,2,2,"mat-option",26),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(46,GQ,1,2,"tb-report-strategy",27),t.ɵɵelementStart(47,"div",28)(48,"div",29),t.ɵɵtext(49,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(50,"div",30)(51,"mat-chip-listbox",31),t.ɵɵtemplate(52,zQ,2,1,"mat-chip",32),t.ɵɵelementStart(53,"mat-chip",33),t.ɵɵelement(54,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(55,"button",35,0),t.ɵɵpipe(57,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(56);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.TIMESERIES))})),t.ɵɵelementStart(58,"tb-icon",36),t.ɵɵtext(59,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(60,"div",28)(61,"div",29),t.ɵɵtext(62,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"div",30)(64,"mat-chip-listbox",31),t.ɵɵtemplate(65,UQ,2,1,"mat-chip",32),t.ɵɵelementStart(66,"mat-chip",33),t.ɵɵelement(67,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(68,"button",35,1),t.ɵɵpipe(70,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(69);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES))})),t.ɵɵelementStart(71,"tb-icon",36),t.ɵɵtext(72,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(73,"div",28)(74,"div",29),t.ɵɵtext(75,"gateway.attribute-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(76,"div",30)(77,"mat-chip-listbox",31),t.ɵɵtemplate(78,jQ,2,1,"mat-chip",32),t.ɵɵelementStart(79,"mat-chip",33),t.ɵɵelement(80,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(81,"button",35,2),t.ɵɵpipe(83,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(82);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES_REQUESTS))})),t.ɵɵelementStart(84,"tb-icon",36),t.ɵɵtext(85,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(86,"div",28)(87,"div",29),t.ɵɵtext(88,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(89,"div",30)(90,"mat-chip-listbox",31),t.ɵɵtemplate(91,HQ,2,1,"mat-chip",32),t.ɵɵelementStart(92,"mat-chip",33),t.ɵɵelement(93,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"button",35,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.SocketValueKey.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(97,"tb-icon",36),t.ɵɵtext(98,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(99,"div",28)(100,"div",29),t.ɵɵtext(101,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(102,"div",30)(103,"mat-chip-listbox",31),t.ɵɵtemplate(104,WQ,2,1,"mat-chip",32),t.ɵɵelementStart(105,"mat-chip",33),t.ɵɵelement(106,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(107,"button",35,4),t.ɵɵpipe(109,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(108);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.RPC_METHODS))})),t.ɵɵelementStart(110,"tb-icon",36),t.ɵɵtext(111,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(112,"div",37)(113,"button",38),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(114),t.ɵɵpipe(115,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(116,"button",39),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(117),t.ɵɵpipe(118,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,32,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.socketDeviceHelpLink),t.ɵɵadvance(12),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,34,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("address").hasError("required")&&n.deviceFormGroup.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/address-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(56,BQ)),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,36,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceName").hasError("required")&&n.deviceFormGroup.get("deviceName").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,38,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceType").hasError("required")&&n.deviceFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(40,40,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?46:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(57,42,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,44,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(83,46,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(96,48,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(109,50,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(115,52,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(118,54,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory($Q,[j,_,zn,Zn]),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",$Q);const KQ=["searchInput"],YQ=()=>["address","deviceName","actions"],XQ=()=>({minWidth:"96px",textAlign:"center"});function ZQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 QQ(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 JQ(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 eJ(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 tJ(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 nJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function iJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 aJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,iJ,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,XQ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function rJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function oJ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class sJ{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 te,this.devicesFormGroup=this.fb.array([]),this.dataSource=new lJ}ngOnInit(){this.devicesFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t),i=n?this.devicesFormGroup.at(t).value:{};this.getDeviceDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(n?this.devicesFormGroup.at(t).patchValue(e):this.devicesFormGroup.push(this.fb.control(e)),this.devicesFormGroup.markAsDirty())}))}validate(){return this.devicesFormGroup.controls.length?null:{devicesFormGroup:{valid:!1}}}getDeviceDialog(e,t){return this.dialog.open($Q,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:this.devicesFormGroup.controls[t].value.deviceName}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(this.devicesFormGroup.removeAt(t),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||sJ)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:sJ,selectors:[["tb-devices-config-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(KQ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>sJ)),multi:!0},{provide:K,useExisting:c((()=>sJ)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,ZQ,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,QQ,3,3,"mat-header-cell",15)(25,JQ,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,eJ,4,3,"mat-header-cell",15)(28,tJ,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,17),t.ɵɵtemplate(30,nJ,1,0,"mat-header-cell",18)(31,aJ,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(32,rJ,1,0,"mat-header-row",20)(33,oJ,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"section",22),t.ɵɵpipe(35,"async"),t.ɵɵelementStart(36,"button",23),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(37,"mat-icon",24),t.ɵɵtext(38,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"span"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,20,n.dataSource.isEmpty())),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,YQ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,YQ)),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(sJ,[j,_,Gn]),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",sJ),Ge([I()],sJ.prototype,"withReportStrategy",void 0);let lJ=class extends G{constructor(){super()}};function pJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function cJ(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.address-required"))}function dJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),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 uJ(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.socketConfigFormGroup.get("bufferSize").hasError("min")?"gateway.buffer-size-range":"gateway.buffer-size-required"))}}e("DevicesDatasource",lJ);class mJ{constructor(e){this.fb=e,this.portLimits=Ei,this.socketTypes=Object.values(li),this.onChange=e=>{},this.destroy$=new te,this.socketConfigFormGroup=this.fb.group({address:["",[$.required,$.pattern(rn)]],type:[li.TCP],port:[5e4,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],bufferSize:[1024,[$.required,$.min(1),$.pattern(rn)]]}),this.socketConfigFormGroup.valueChanges.pipe(le(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=li.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||mJ)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:mJ,selectors:[["tb-socket-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>mJ)),multi:!0},{provide:K,useExisting:c((()=>mJ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:34,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"],["tbTruncateWithTooltip",""],["formControlName","type","appearance","fill"],[3,"value",4,"ngFor","ngForOf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(7,pJ,2,2,"tb-toggle-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",6),t.ɵɵtext(10,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",9),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,cJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",1)(17,"div",6),t.ɵɵtext(18,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",7)(20,"mat-form-field",8),t.ɵɵelement(21,"input",11),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,dJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(24,"div",1)(25,"div",12),t.ɵɵpipe(26,"translate"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",7)(30,"mat-form-field",8),t.ɵɵelement(31,"input",13),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,uJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()()()),2&e&&(t.ɵɵproperty("formGroup",n.socketConfigFormGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,13,"gateway.connection-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("address").hasError("required")&&n.socketConfigFormGroup.get("address").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.socketConfigFormGroup.get("port").hasError("required")||n.socketConfigFormGroup.get("port").hasError("min")||n.socketConfigFormGroup.get("port").hasError("max"))&&n.socketConfigFormGroup.get("port").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,19,"gateway.hints.buffer-size")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(28,21,"gateway.buffer-size")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,23,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("bufferSize").hasError("required")||n.socketConfigFormGroup.get("bufferSize").hasError("min")&&n.socketConfigFormGroup.get("bufferSize").touched))},dependencies:t.ɵɵgetComponentDepsFactory(mJ,[j,_,jW,Gn]),encapsulation:2,changeDetection:d.OnPush})}}e("SocketConfigComponent",mJ);class hJ extends Na{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(hJ)))(n||hJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:hJ,selectors:[["tb-socket-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>hJ)),multi:!0},{provide:K,useExisting:c((()=>hJ)),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(hJ,[j,_,mJ,sJ]),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",hJ);class gJ extends Na{constructor(){super(...arguments),this.isLegacy=!0}getMappedValue(e){return Wa.mapSocketToDowngradedVersion(e)}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:Wa.mapSocketToUpgradedVersion(e),devices:e?.devices?Wa.mapDevicesToUpgradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(gJ)))(n||gJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:gJ,selectors:[["tb-socket-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>gJ)),multi:!0},{provide:K,useExisting:c((()=>gJ)),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(gJ,[j,_,mJ,sJ]),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 fJ(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 yJ(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 vJ(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 xJ(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 bJ(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 wJ(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",gJ);class SJ extends Ba{constructor(){super(...arguments),this.segmentationTypes=Object.values(ya),this.SegmentationTypeTranslationsMap=va,this.portLimits=Ei}get applicationConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({objectName:["",[$.required,$.pattern(rn)]],host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],mask:[""],objectIdentifier:[null,[$.required]],vendorIdentifier:[null,[$.required]],maxApduLengthAccepted:[],segmentationSupported:[ya.BOTH],networkNumber:[],deviceDiscoveryTimeoutInSec:[]})}mapOnChangeValue(e){return Te(e),e}onWriteValue(e){const{maxApduLengthAccepted:t=1476,segmentationSupported:n=ya.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(SJ)))(n||SJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:SJ,selectors:[["tb-bacnet-application-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>SJ)),multi:!0},{provide:K,useExisting:c((()=>SJ)),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,fJ,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,yJ,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,vJ,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,xJ,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,bJ,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,wJ,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(SJ,[j,_,jW]),encapsulation:2,changeDetection:d.OnPush})}}function CJ(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 _J(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,CJ,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 TJ(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 IJ(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,TJ,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 EJ(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 MJ(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,EJ,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 kJ(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 PJ(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 DJ(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 OJ(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 AJ(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 FJ extends Ba{constructor(){super(...arguments),this.withReportStrategy=!0,this.propertyIds=Ea.get(_a.analogOutput),this.objectTypes=Object.values(_a),this.requestTypes=Object.values(ka),this.ReportStrategyDefaultValue=tn,this.BacnetDeviceKeysType=xa,this.BacnetKeyObjectTypeTranslationsMap=Ta,this.BacnetPropertyIdTranslationsMap=Ma,this.BacnetRequestTypeTranslationsMap=Pa}ngOnInit(){this.formGroup=this.initKeyFormGroup(),this.observeValueChanges(),this.observeObjectType()}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keyType===xa.ATTRIBUTES||this.keyType===xa.TIMESERIES))}initKeyFormGroup(){return this.fb.group({key:[{value:"",disabled:this.keyType===xa.RPC_METHODS},[$.required,$.pattern(rn)]],method:[{value:"",disabled:this.keyType!==xa.RPC_METHODS},[$.required,$.pattern(rn)]],objectType:[_a.analogOutput],objectId:[0,[$.required]],propertyId:[Ia.presentValue],requestTimeout:[{value:0,disabled:this.keyType!==xa.RPC_METHODS}],requestType:[{value:ka.Write,disabled:this.keyType!==xa.RPC_METHODS}],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]})}observeObjectType(){this.formGroup.get("objectType").valueChanges.pipe(wn(this.destroyRef)).subscribe((e=>{this.propertyIds=Ea.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(FJ)))(n||FJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:FJ,selectors:[["tb-bacnet-device-data-key"]],inputs:{keyType:"keyType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>FJ)),multi:!0},{provide:K,useExisting:c((()=>FJ)),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,_J,10,12)(6,IJ,9,10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",1)(8,"div",2),t.ɵɵtext(9,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵtemplate(10,MJ,9,6,"div",3)(11,kJ,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,PJ,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,DJ,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,OJ,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵtemplate(34,AJ,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(FJ,[j,_,Zn]),encapsulation:2,changeDetection:d.OnPush})}}function RJ(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 BJ(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,RJ,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 NJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,BJ,13,6,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function LJ(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 VJ extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=tn}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||VJ)(t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(at.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:VJ,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,NJ,3,0,"div",3)(6,LJ,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(VJ,[j,_,FJ]),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 qJ(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 GJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.deviceFormGroup.get("port")))}}function zJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"mat-expansion-panel",34)(2,"mat-expansion-panel-header")(3,"mat-panel-title")(4,"div",35),t.ɵɵtext(5,"gateway.advanced-configuration-settings"),t.ɵɵelementEnd()()(),t.ɵɵelement(6,"tb-string-items-list",36),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 UJ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",19),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function jJ(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 HJ(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 WJ(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 $J(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 KJ(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 YJ extends A{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:["",[$.required,$.pattern(rn)]],port:["",[$.required,$.min(Ei.MIN),$.max(Ei.MAX)]],deviceInfo:[],altResponsesAddresses:[{value:[],disabled:this.data.hideNewFields}],pollPeriod:[1e4,[$.required,$.min(0)]],timeseries:[[]],attributes:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.BacnetDeviceKeysType=xa,this.DeviceInfoType=fa,this.portLimits=Ei,this.deviceHelpLink=O+"/docs/iot-gateway/config/bacnet/#device-object-settings",this.sourceTypes=Object.values(ui),this.ConnectorType=dt,this.ReportStrategyDefaultValue=tn,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:ba.get(n),addKeyTitle:wa.get(n),deleteKeyTitle:Sa.get(n),noKeysText:Ca.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,VJ,"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(wn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||YJ)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:YJ,selectors:[["tb-bacnet-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:100,vars:47,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","","type","number","name","value","formControlName","port",3,"min","max","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"],["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"],[1,"tb-settings","chips-panel","w-full"],["translate","",1,"tb-form-panel-title"],["editable","","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,qJ,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,GJ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵtemplate(26,zJ,9,6,"div",12),t.ɵɵelement(27,"tb-device-info-table",18),t.ɵɵtemplate(28,UJ,1,2,"tb-report-strategy",19),t.ɵɵelementStart(29,"div",12)(30,"div",20)(31,"span",21),t.ɵɵtext(32,"gateway.poll-period"),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",14),t.ɵɵelement(34,"input",22),t.ɵɵpipe(35,"translate"),t.ɵɵtemplate(36,jJ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"div",23)(38,"div",24),t.ɵɵtext(39,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"div",25)(41,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(42,HJ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(44,"mat-chip",27),t.ɵɵelement(45,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"button",29,0),t.ɵɵpipe(48,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(47);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES))})),t.ɵɵelementStart(49,"tb-icon",30),t.ɵɵtext(50,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(51,"div",23)(52,"div",24),t.ɵɵtext(53,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(54,"div",25)(55,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(56,WJ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(58,"mat-chip",27),t.ɵɵelement(59,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(60,"button",29,1),t.ɵɵpipe(62,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(61);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.TIMESERIES))})),t.ɵɵelementStart(63,"tb-icon",30),t.ɵɵtext(64,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(65,"div",23)(66,"div",24),t.ɵɵtext(67,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(68,"div",25)(69,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(70,$J,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(72,"mat-chip",27),t.ɵɵelement(73,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(74,"button",29,2),t.ɵɵpipe(76,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(75);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(77,"tb-icon",30),t.ɵɵtext(78,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(79,"div",23)(80,"div",24),t.ɵɵtext(81,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(82,"div",25)(83,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(84,KJ,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(86,"mat-chip",27),t.ɵɵelement(87,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(88,"button",29,3),t.ɵɵpipe(90,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(89);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.RPC_METHODS))})),t.ɵɵelementStart(91,"tb-icon",30),t.ɵɵtext(92,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(93,"div",31)(94,"button",32),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(97,"button",33),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,27,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.deviceHelpLink),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(17,29,"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("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,31,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.deviceFormGroup.get("port").hasError("required")||n.deviceFormGroup.get("port").hasError("min")||n.deviceFormGroup.get("port").hasError("max"))&&n.deviceFormGroup.get("port").touched?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?-1:26),t.ɵɵadvance(),t.ɵɵproperty("deviceInfoType",n.DeviceInfoType.FULL)("sourceTypes",n.sourceTypes)("connectorType",n.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?28:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("pollPeriod").hasError("required")&&n.deviceFormGroup.get("pollPeriod").touched?36:-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(48,35,"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(62,37,"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(76,39,"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(90,41,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,43,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(99,45,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(YJ,[j,_,zn,Gn,jW,d$,Zn]),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 XJ=()=>["deviceName","host","port","actions"],ZJ=()=>({minWidth:"96px",textAlign:"center"});function QJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 JJ(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 e1(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 t1(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 n1(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 i1(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 a1(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 r1(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function o1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 s1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,o1,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,ZJ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function l1(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function p1(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class c1 extends Ga{constructor(){super(...arguments),this.hideNewFields=!1}getDatasource(){return new d1}manageDevices(e,t){e&&e.stopPropagation();const n=ke(t),i=n?this.entityFormArray.at(t).value:{};this.getDeviceDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),wn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):this.entityFormArray.push(this.fb.control(e)),this.entityFormArray.markAsDirty())}))}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:this.entityFormArray.controls[t].value.deviceInfo?.deviceNameExpression}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),wn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),this.entityFormArray.markAsDirty())}))}getDeviceDialog(e,t){return this.dialog.open(YJ,{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(c1)))(n||c1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:c1,selectors:[["tb-bacnet-devices-config-table"]],inputs:{hideNewFields:[2,"hideNewFields","hideNewFields",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>c1)),multi:!0},{provide:K,useExisting:c((()=>c1)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,QJ,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,JJ,4,3,"mat-header-cell",15)(25,e1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,t1,3,3,"mat-header-cell",15)(28,n1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,14),t.ɵɵtemplate(30,i1,3,3,"mat-header-cell",15)(31,a1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(32,17),t.ɵɵtemplate(33,r1,1,0,"mat-header-cell",18)(34,s1,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(35,l1,1,0,"mat-header-row",20)(36,p1,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"section",22),t.ɵɵpipe(38,"async"),t.ɵɵelementStart(39,"button",23),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(40,"mat-icon",24),t.ɵɵtext(41,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"span"),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(45,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,21,n.dataSource.isEmpty())),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,XJ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,XJ)),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(c1,[j,_,Gn]),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 d1 extends G{constructor(){super()}}class u1 extends Na{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(u1)))(n||u1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:u1,selectors:[["tb-bacnet-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>u1)),multi:!0},{provide:K,useExisting:c((()=>u1)),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(u1,[j,_,SJ,c1]),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 m1 extends Na{constructor(){super(...arguments),this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.general?$a.mapApplicationToUpgradedVersion(e.general):{},devices:e.devices?.length?$a.mapDevicesToUpgradedVersion(e.devices):[]}}getMappedValue(e){return{general:e.application?$a.mapApplicationToDowngradedVersion(e.application):{},devices:e.devices?.length?$a.mapDevicesToDowngradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(m1)))(n||m1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:m1,selectors:[["tb-bacnet-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>m1)),multi:!0},{provide:K,useExisting:c((()=>m1)),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(m1,[j,_,SJ,c1]),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 h1(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 g1(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 f1 extends Ba{constructor(){super(...arguments),this.portLimits=Ei}get serverConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({host:["",[$.required,$.pattern(rn)]],port:[null,[$.required,$.min(Ei.MIN),$.max(Ei.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(f1)))(n||f1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:f1,selectors:[["tb-rest-server-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>f1)),multi:!0},{provide:K,useExisting:c((()=>f1)),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,h1,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,g1,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(f1,[j,_,jW,Gn,Jn]),encapsulation:2,changeDetection:d.OnPush})}}const y1=()=>({min:1});function v1(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 x1(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 b1(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 w1(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,7),t.ɵɵelementStart(1,"div",8)(2,"div",9),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",10)(6,"mat-form-field",11)(7,"mat-select",12),t.ɵɵrepeaterCreate(8,x1,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",10)(15,"mat-form-field",11)(16,"mat-select",13),t.ɵɵrepeaterCreate(17,b1,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 S1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.response-timeout-required"))}function C1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,y1)))}function _1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function T1(e,n){1&e&&(t.ɵɵelementStart(0,"span",18),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function I1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-required"))}function E1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-pattern"))}function M1(e,n){if(1&e&&(t.ɵɵdeclareLet(0),t.ɵɵelementContainerStart(1,7),t.ɵɵelementStart(2,"div",8)(3,"mat-slide-toggle",14)(4,"mat-label"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(7,"div",8)(8,"div",15),t.ɵɵtext(9,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",11),t.ɵɵelement(11,"input",16),t.ɵɵpipe(12,"translate"),t.ɵɵdeclareLet(13),t.ɵɵtemplate(14,S1,2,3,"tb-error-icon",17)(15,C1,2,5,"tb-error-icon",17)(16,_1,2,3,"tb-error-icon",17)(17,T1,2,0,"span",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",8)(19,"div",15),t.ɵɵtext(20,"gateway.rest.response-attribute"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",11),t.ɵɵelement(22,"input",19),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,I1,2,3,"tb-error-icon",17)(25,E1,2,3,"tb-error-icon",17),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 k1 extends Ba{get responseConfigFormGroup(){return this.formGroup}constructor(){super(),this.ResponseTypeTranslationsMap=bi,this.ResponseType=vi,this.responseTypes=Object.values(vi),this.responseStatuses=Object.values(xi),this.observeIsExpected()}initFormGroup(){return this.fb.group({type:[vi.DEFAULT],[vi.CONST]:this.fb.group({successResponse:[xi.OK],unsuccessfulResponse:[xi.ERROR]}),[vi.ADVANCED]:this.fb.group({responseExpected:[!0],timeout:[null,[$.required,$.min(.001),$.pattern(an)]],responseAttribute:["",[$.required,$.pattern(rn)]]})})}mapOnChangeValue({type:e,...t}){return{type:e,...t[e]??{}}}onWriteValue(e){const{type:t=vi.DEFAULT,...n}=e??{};this.toggleIsExpected(n.responseExpected,t),this.responseConfigFormGroup.patchValue({type:t,[t]:n},{emitEvent:!1})}toggleIsExpected(e,t){const n=e&&t===vi.ADVANCED;this.responseConfigFormGroup.get(vi.ADVANCED).get("timeout")[n?"enable":"disable"]({emitEvent:!1}),this.responseConfigFormGroup.get(vi.ADVANCED).get("responseAttribute")[n?"enable":"disable"]({emitEvent:!1})}observeIsExpected(){se(this.responseConfigFormGroup.get("type").valueChanges,this.responseConfigFormGroup.get(vi.ADVANCED).get("responseExpected").valueChanges).pipe(wn()).subscribe((()=>this.toggleIsExpected(this.responseConfigFormGroup.get(vi.ADVANCED).get("responseExpected").value,this.responseConfigFormGroup.get("type").value)))}static{this.ɵfac=function(e){return new(e||k1)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:k1,selectors:[["tb-rest-response-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>k1)),multi:!0},{provide:K,useExisting:c((()=>k1)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:7,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,"ngSwitch"],[3,"ngSwitchCase"],[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){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,v1,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementContainerStart(8,5),t.ɵɵtemplate(9,w1,19,7,"ng-template",6)(10,M1,26,12,"ng-template",6),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.responseConfigFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.response")),t.ɵɵadvance(3),t.ɵɵrepeater(n.responseTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.responseConfigFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.ResponseType.CONST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.ResponseType.ADVANCED))},dependencies:t.ɵɵgetComponentDepsFactory(k1,[j,_,Jn]),encapsulation:2,changeDetection:d.OnPush})}}function P1(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 D1(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 O1(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 A1(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 F1(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 R1(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 B1(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 N1(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,R1,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,B1,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 L1(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 V1(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 q1(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,L1,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.ɵɵtemplate(23,V1,3,1,"mat-chip",45),t.ɵɵelementStart(24,"mat-chip",35),t.ɵɵelement(25,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",37,2),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.CUSTOM))})),t.ɵɵelementStart(29,"tb-icon",38),t.ɵɵtext(30,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.rest.extension")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,12,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,14,"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,16,"gateway.extension-configuration")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,18,"gateway.extension-configuration-hint")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,20,"gateway.keys")),t.ɵɵadvance(3),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.customKeys),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,22,"action.edit"))}}class G1 extends A{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:["",[$.required,$.pattern(rn)]],HTTPMethods:[[gt.POST],[$.required]],security:[{type:Pi.ANONYMOUS}],converter:this.fb.group({type:[fi.JSON,[]],deviceInfo:[],reportStrategy:[],attributes:[[]],timeseries:[[]],extension:["",[$.required,$.pattern(rn)]],extensionConfig:[]}),response:[]}),this.keysPopupClosed=!0,this.helpLink=`${O}/docs/iot-gateway/config/rest/#mapping-section`,this.httpMethods=Object.values(gt),this.converterTypes=Object.values(fi),this.restSourceTypes=Object.values(yi),this.SecurityMode=Ki,this.MappingKeysType=Li,this.DeviceInfoType=fa,this.RestConvertorTypeTranslationsMap=Ti,this.RestDataConversionTranslationsMap=Ii,this.RestConverterType=fi,this.ConnectorType=dt,this.ReportStrategyDefaultValue=tn,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:Vi.get(n),addKeyTitle:qi.get(n),deleteKeyTitle:Gi.get(n),noKeysText:zi.get(n),withReportStrategy:this.data.withReportStrategy,convertorType:this.converterType,connectorType:dt.REST};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,nK,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(wn(this.destroyRef)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty(),this.cd.markForCheck()})),this.popoverComponent.tbHideStart.pipe(wn(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(wn(this.destroyRef)).subscribe((e=>this.toggleConverterFieldsByType(e)))}toggleConverterFieldsByType(e){const t=e===fi.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||G1)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.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-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"],[4,"ngFor","ngForOf"]],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,P1,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,D1,2,2,"mat-option",17,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(30,O1,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,A1,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,F1,1,2,"tb-report-strategy",27)(49,N1,30,11,"div",28)(50,q1,31,24,"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(G1,[j,_,zn,d$,wY,k1,Jn,Zn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .device-info .fixed-title-width{min-width:0}'],changeDetection:d.OnPush})}}const z1=()=>["endpoint","httpMethods","securityType","actions"];function U1(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",8),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 j1(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.rest.endpoint")))}function H1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",32)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.endpoint)}}function W1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",33),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rest.http-methods")," "))}function $1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",38),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function K1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",34)(1,"mat-chip-listbox",35),t.ɵɵrepeaterCreate(2,$1,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(4,"mat-chip",36),t.ɵɵelement(5,"label",37),t.ɵɵelementEnd()()()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵproperty("tbEllipsisChipList",e.HTTPMethods),t.ɵɵadvance(),t.ɵɵrepeater(e.HTTPMethods)}}function Y1(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.security-type")," "))}function X1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",39)(1,"div",31),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 Z1(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",40)}function Q1(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().index,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().index,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 J1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,Q1,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",41),t.ɵɵelementContainer(4,42),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",43)(6,"button",44),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",45),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",46,2),t.ɵɵelementContainer(11,42),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 e0(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",47)}function t0(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class n0 extends Ga{getDatasource(){return new i0}manageMapping(e,t){e&&e.stopPropagation();const n=ke(t),i=n?this.entityFormArray.at(t).value:{};this.getMappingDialog(i,n?"action.apply":"action.add").afterClosed().pipe(wn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):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.entityFormArray.at(t).value.endpoint}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(wn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),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(G1,{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(n0)))(n||n0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:n0,selectors:[["tb-rest-mapping-table"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>n0)),multi:!0},{provide:K,useExisting:c((()=>n0)),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"],[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,"!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,U1,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,j1,4,3,"mat-header-cell",14)(24,H1,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,W1,3,3,"mat-header-cell",16)(27,K1,6,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,13),t.ɵɵtemplate(29,Y1,3,3,"mat-header-cell",18)(30,X1,4,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(31,20),t.ɵɵtemplate(32,Z1,1,0,"mat-header-cell",21)(33,J1,12,3,"mat-cell",22),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(34,e0,1,0,"mat-header-row",23)(35,t0,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,z1))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,z1)),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(n0,[j,_,Gn,zn]),styles:[".http-method-label[_ngcontent-%COMP%]{font-size:12px}"],changeDetection:d.OnPush})}}let i0=class extends G{constructor(){super()}};function a0(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 r0(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 o0(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 s0(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,r0,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,o0,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 l0(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,a0,2,1,"div",13),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,s0,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 p0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,l0,14,7,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function c0(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 d0 extends q{constructor(e,t){super(t),this.fb=e,this.store=t,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=tn}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}addKey(){this.keysListFormArray.push(this.fb.group({key:["",[$.required,$.pattern(rn)]],value:["",[$.required,$.pattern(rn)]]}))}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,[$.required,$.pattern(rn)]],value:[e[n],[$.required,$.pattern(rn)]]}))})),this.fb.array(t)}static{this.ɵfac=function(e){return new(e||d0)(t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:d0,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,p0,3,0,"div",3)(6,c0,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(d0,[j,_]),encapsulation:2,changeDetection:d.OnPush})}}const u0=()=>({min:1}),m0=()=>({maxWidth:"970px"});function h0(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 g0(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 f0(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 y0(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 v0(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 x0(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 b0(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,g0,2,3,"tb-error-icon",22)(8,f0,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,y0,2,2,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(17,v0,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,x0,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 w0(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 S0(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 C0(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,w0,2,3,"tb-error-icon",22)(8,S0,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 _0(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 T0(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 I0(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,_0,2,3,"tb-error-icon",22)(8,T0,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 E0(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 M0(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 k0(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,E0,2,3,"tb-error-icon",22)(8,M0,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 P0(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 D0(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 O0(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 A0(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 F0(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 R0(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,P0,2,3,"tb-error-icon",22)(8,D0,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,O0,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,A0,2,3,"tb-error-icon",22)(25,F0,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 B0(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,u0)))}function N0(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 L0(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function V0(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,B0,2,5,"tb-error-icon",22)(7,N0,2,3,"tb-error-icon",22)(8,L0,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 q0(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 G0(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 z0(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 U0(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 j0(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,m0))}function H0(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,q0,2,3,"tb-error-icon",22)(8,G0,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,z0,2,3,"tb-error-icon",22)(16,U0,2,3,"tb-error-icon",22)(17,j0,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 W0(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,u0)))}function $0(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 K0(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function Y0(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,W0,2,5,"tb-error-icon",22)(7,$0,2,3,"tb-error-icon",22)(8,K0,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 X0(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 Z0(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 Q0(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,u0)))}function J0(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 e2(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function t2(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 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.tries-pattern"))}function i2(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 a2(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,Z0,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,Q0,2,5,"tb-error-icon",22)(29,J0,2,3,"tb-error-icon",22)(30,e2,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,t2,2,3,"tb-error-icon",22)(38,n2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵtemplate(39,i2,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 r2 extends A{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(wi),this.requestsScopeType=Object.values(Ci),this.httpMethods=Object.values(gt),this.helpLink=`${O}/docs/iot-gateway/config/rest/#attribute-request-section`,this.RestRequestTypesTranslationsMap=Si,this.SecurityMode=Ki,this.RestRequestType=wi,this.mappingFormGroup=this.fb.group({requestType:[wi.ATTRIBUTE_REQUEST],endpoint:["",[$.required,$.pattern(rn)]],HTTPMethods:[[gt.POST],[$.required]],HTTPMethod:[gt.POST,[$.required]],type:[Ci.Shared],security:[{type:Pi.ANONYMOUS}],timeout:[null,[$.min(.001),$.pattern(an)]],deviceNameExpression:["",[$.required,$.pattern(rn)]],attributeNameExpression:["",[$.required,$.pattern(rn)]],SSLVerify:[!1],deviceNameFilter:["",[$.required,$.pattern(rn)]],methodFilter:["",[$.required,$.pattern(rn)]],attributeFilter:["",[$.required,$.pattern(rn)]],requestUrlExpression:[this.data.defaultRequestUrl,[$.required,$.pattern(rn)]],valueExpression:["",[$.required,$.pattern(rn)]],responseTimeout:[null,[$.min(.001),$.pattern(an)]],tries:[null,[$.min(1),$.pattern(an)]],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,d0,"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(wn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}observeRequestTypeChange(){this.mappingFormGroup.get("requestType").valueChanges.pipe(ce(),wn(this.destroyRef)).subscribe((e=>this.toggleFieldsByRequestType(e)))}toggleFieldsByRequestType(e){this.mappingFormGroup.disable({emitEvent:!1}),_i.get("all").forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1}))),_i.get(e).forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1})))}static{this.ɵfac=function(e){return new(e||r2)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(rt.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:r2,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,h0,3,4,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(19,b0,26,14)(20,C0,9,7,"div",9)(21,I0,9,7,"div",9)(22,k0,9,7,"div",9)(23,R0,26,17)(24,V0,9,4,"div",9)(25,H0,18,11)(26,Y0,9,4,"div",9)(27,X0,6,6,"div",14),t.ɵɵelement(28,"tb-security-config",15),t.ɵɵtemplate(29,a2,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(r2,[j,_,zn,wY,Jn]),styles:["[_nghost-%COMP%] .tb-form-row.request-url-row[_ngcontent-%COMP%]{gap:6px}"],changeDetection:d.OnPush})}}const o2=()=>["type","details","actions"],s2=()=>({});function l2(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",8),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 p2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",27)(1,"div",28),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.type")))}function c2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29)(1,"div",28),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 d2(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.details")," "))}function u2(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,s2)).join(", ")," ")}}function m2(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.methodFilter," ")}}function h2(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.endpoint," ")}}function g2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29)(1,"div",28),t.ɵɵtemplate(2,u2,1,2)(3,m2,1,1)(4,h2,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 f2(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",31)}function y2(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().index,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().index,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 v2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,y2,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",32),t.ɵɵelementContainer(4,33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",34)(6,"button",35),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",36),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",37,2),t.ɵɵelementContainer(11,33),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 x2(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",38)}function b2(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class w2 extends Ga{constructor(){super(...arguments),this.Object=Object,this.RestRequestTypesTranslationsMap=Si}getDatasource(){return new S2}manageMapping(e,t){e&&e.stopPropagation();const n=ke(t),{requestType:i=wi.ATTRIBUTE_REQUEST,requestValue:a={}}=n?this.entityFormArray.at(t).value:{};this.getMappingDialog({requestType:i,...a},n?"action.apply":"action.add").afterClosed().pipe(wn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):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(this.entityFormArray.at(t).value)}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(wn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),this.entityFormArray.markAsDirty())}))}updateTableData(e,t){t&&(e=e.filter((e=>{const n=this.getRequestDetails(e);return Object.values(e).some((e=>Me(e)&&this.translate.instant(Si.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(r2,{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(w2)))(n||w2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:w2,selectors:[["tb-rest-request-mapping-table"]],inputs:{defaultRequestUrl:"defaultRequestUrl"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>w2)),multi:!0},{provide:K,useExisting:c((()=>w2)),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"],[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,"!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,l2,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,p2,4,3,"mat-header-cell",14)(24,c2,4,3,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,d2,3,3,"mat-header-cell",16)(27,g2,5,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,17),t.ɵɵtemplate(29,f2,1,0,"mat-header-cell",18)(30,v2,12,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(31,x2,1,0,"mat-header-row",20)(32,b2,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,o2))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,o2)),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(w2,[j,_,Gn]),encapsulation:2,changeDetection:d.OnPush})}}class S2 extends G{constructor(){super()}}class C2 extends Na{initBasicFormGroup(){return this.fb.group({server:[],mapping:[],requestsMapping:[]})}getRequestDataArray(e){const t=[];return Fe(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(C2)))(n||C2)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:C2,features:[t.ɵɵInheritDefinitionFeature]})}}class _2 extends C2{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(_2)))(n||_2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:_2,selectors:[["tb-rest-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>_2)),multi:!0},{provide:K,useExisting:c((()=>_2)),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(_2,[j,_,f1,n0,w2]),encapsulation:2,changeDetection:d.OnPush})}}class T2 extends C2{mapConfigToFormValue({attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}){return{server:{...a??{}},mapping:Ka.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:Ka.mapMappingToDowngradedVersion(t),attributeRequests:i,attributeUpdates:a,serverSideRpc:r}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(T2)))(n||T2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:T2,selectors:[["tb-rest-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>T2)),multi:!0},{provide:K,useExisting:c((()=>T2)),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(T2,[j,_,f1,n0,w2]),encapsulation:2,changeDetection:d.OnPush})}}const I2=(e,t)=>({hasErrors:e,noErrors:t}),E2=()=>({minWidth:"144px",maxWidth:"144px",textAlign:"center"}),M2=()=>({minWidth:"144px",maxWidth:"144px",width:"144px",textAlign:"center"}),k2=e=>({"tb-current-entity":e});function P2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",32),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 D2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",33)(1,"button",34),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onAddConnector(n))})),t.ɵɵelementStart(2,"mat-icon",35),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 O2(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-enabled")," "))}function A2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"mat-slide-toggle",37),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 F2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",38),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-name"),""))}function R2(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 B2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-type")," "))}function N2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.returnType(e)," ")}}function L2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration")," "))}function V2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40)(1,"div",41),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 q2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-status")," "))}function G2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell",40)(1,"span",42),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,I2,+i.getErrorsCount(e)>0,0==+i.getErrorsCount(e)||""===i.getErrorsCount(e))),t.ɵɵpropertyInterpolate("matTooltip","Errors: "+i.getErrorsCount(e))}}function z2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell"),t.ɵɵelement(1,"div",43),t.ɵɵelementStart(2,"div",44),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,E2)),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.connectors-table-actions")))}function U2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"div",45)(2,"button",46),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(3,"mat-icon"),t.ɵɵtext(4,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"button",47),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(6,"mat-icon"),t.ɵɵtext(7,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",48),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"delete"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",49)(12,"button",50),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(13,"mat-icon",51),t.ɵɵtext(14,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-menu",52,1)(17,"button",46),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(20,"button",47),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(21,"mat-icon"),t.ɵɵtext(22,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",48),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(24,"mat-icon"),t.ɵɵtext(25,"delete"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,i=t.ɵɵreference(16);t.ɵɵadvance(),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,M2)),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.value.configurationJson.id),t.ɵɵadvance(10),t.ɵɵproperty("matMenuTriggerFor",i),t.ɵɵadvance(5),t.ɵɵproperty("disabled",!e.value.configurationJson.id)}}function j2(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",53)}function H2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-row",54),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,k2,i.isSameConnector(e)))}}function W2(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",55),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1("v",e.connectorForm.get("configVersion").value,"")}}function $2(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-select",56)(1,"tb-toggle-option",57),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-option",57),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 K2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function Y2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function X2(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,K2,2,4,"tb-mqtt-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Y2,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MQTT))("ngIfElse",e)}}function Z2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function Q2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function J2(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,Z2,2,4,"tb-opc-ua-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,Q2,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.OPCUA))("ngIfElse",e)}}function e3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function t3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function n3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,e3,1,1,"tb-modbus-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,t3,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MODBUS))("ngIfElse",e)}}function i3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function a3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function r3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,i3,1,1,"tb-socket-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,a3,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.SOCKET))("ngIfElse",e)}}function o3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function s3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function l3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,o3,2,4,"tb-bacnet-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,s3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.BACNET))("ngIfElse",e)}}function p3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-basic-config",69),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function c3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-legacy-basic-config",69),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function d3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,p3,2,4,"tb-rest-basic-config",68),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,c3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.REST))("ngIfElse",e)}}function u3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0)(1,62),t.ɵɵtemplate(2,X2,5,5,"ng-container",63)(3,J2,5,5,"ng-container",63)(4,n3,5,5,"ng-container",63)(5,r3,5,5,"ng-container",63)(6,l3,5,5,"ng-container",63)(7,d3,5,5,"ng-container",63),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",e.initialConnector.type),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REST)}}function m3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group")(1,"mat-tab",70),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,71),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",70),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-json-object-edit",72),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(41);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 h3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",58),t.ɵɵtemplate(1,u3,8,7,"ng-container",59)(2,m3,8,12,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(4,"div",60)(5,"button",61),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onSaveConnector())})),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵreference(3),i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(e=i.connectorForm.get("mode"))?null:e.value)===i.ConnectorConfigurationModes.BASIC)("ngIfElse",n),t.ɵɵadvance(4),t.ɵɵproperty("disabled",!i.connectorForm.dirty||i.connectorForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,4,"action.save")," ")}}function g3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",89),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 f3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"div",85),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",76)(4,"mat-form-field",77),t.ɵɵelement(5,"input",90),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function y3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"div",85),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",76)(4,"mat-form-field",77),t.ɵɵelement(5,"input",91),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function v3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",57),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function x3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"mat-slide-toggle",92)(2,"mat-label",93),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 b3(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",94),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Connector)}}function w3(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",73)(1,"div",74)(2,"div",75),t.ɵɵtext(3,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",76)(5,"mat-form-field",77),t.ɵɵelement(6,"input",78),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,g3,3,3,"mat-icon",79),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,f3,7,3,"div",80)(10,y3,7,3,"div",80),t.ɵɵelementStart(11,"div",81)(12,"div",82),t.ɵɵtext(13,"gateway.logs-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",83)(15,"mat-slide-toggle",84)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",74)(20,"div",85),t.ɵɵtext(21,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",76)(23,"mat-form-field",77)(24,"mat-select",86),t.ɵɵtemplate(25,v3,2,2,"mat-option",87),t.ɵɵelementEnd()()()()(),t.ɵɵtemplate(26,x3,6,6,"div",80),t.ɵɵpipe(27,"withReportStrategy"),t.ɵɵtemplate(28,b3,1,2,"tb-report-strategy",88),t.ɵɵpipe(29,"withReportStrategy"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.connectorForm),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.connectorForm.get("name").hasError("required")&&e.connectorForm.get("name").touched||e.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.GRPC),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.enable-remote-logging")," "),t.ɵɵadvance(8),t.ɵɵproperty("ngForOf",e.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.MQTT&&!t.ɵɵpipeBind2(27,13,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(29,16,e.connectorForm.get("configVersion").value,e.connectorForm.get("type").value))}}class S3{isErrorState(e){return e&&e.invalid}}e("ForceErrorStateMatcher",S3);class C3 extends q{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=dt,this.allowBasicConfig=new Set([dt.MQTT,dt.OPCUA,dt.MODBUS,dt.SOCKET,dt.BACNET,dt.REST]),this.gatewayLogLevel=Object.values(pt),this.displayedColumns=["enabled","key","type","syncStatus","errors","actions"],this.GatewayConnectorTypesTranslatesMap=ut,this.ConnectorConfigurationModes=Jt,this.ReportStrategyDefaultValue=tn,this.basicConfigInitSubject=new te,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 te,this.attributeUpdateSubject=new te,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)?D.SHARED_SCOPE:D.SERVER_SCOPE;oe(this.getEntityAttributeTasks(e,n)).pipe(ye(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===D.SHARED_SCOPE||!this.inactiveConnectors.includes(e.name)&&t===D.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===D.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===D.SHARED_SCOPE?"active_connectors":"inactive_connectors",n=e===D.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=`${Be(t.name)}.json`,delete t.basicConfig,t.type!==dt.GRPC&&delete t.key,t.type!==dt.CUSTOM&&delete t.class,this.allowBasicConfig.has(t.type)||delete t.mode,this.withReportStrategy.transform(t.configVersion,t.type)&&(t.configurationJson.reportStrategy=t.reportStrategy,Ae(t.reportStrategy)&&delete t.reportStrategy,Ae(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=w[this.sort.direction.toUpperCase()],this.attributeDataSource.loadAttributes(this.device,D.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,D.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,D.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=Se(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 Se(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:Jt.BASIC,name:"",type:dt.MQTT,sendDataOnlyOnChange:!1,enableRemoteLogging:!1,logLevel:pt.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(ye(1),xe((t=>{if(!t)return;const n=[],i=this.activeConnectors.includes(e.value?.name)?D.SHARED_SCOPE:D.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)),oe(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=Oe(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=Oe(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(ye(1),ue(Boolean),xe((()=>this.openAddConnectorDialog())),ue(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(ye(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??Jt.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(JW,{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:w.ASC};this.pageLink=new S(1e3,0,null,e),this.attributeDataSource=new Un(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.inactiveConnectorsDataSource=new Un(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.serverDataSource=new Un(this.attributeService,this.telemetryWsService,this.zone,this.translate),this.dataSource=new x([])}initConnectorForm(){this.connectorForm=this.fb.group({mode:[Jt.BASIC],name:["",[$.required,this.uniqNameRequired(),$.pattern(rn)]],type:["",[$.required]],enableRemoteLogging:[!1],logLevel:["",[$.required]],sendDataOnlyOnChange:[!1],key:["auto"],class:[""],configuration:[""],configurationJson:[{},[$.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()===w.DESC?-1:1/0:n;default:return e[t]||e.value[t]}}}loadConnectors(){this.device&&this.device.id!==B&&oe([this.attributeService.getEntityAttributes(this.device,D.SHARED_SCOPE,["active_connectors"]),this.attributeService.getEntityAttributes(this.device,D.SERVER_SCOPE,["inactive_connectors"]),this.attributeService.getEntityAttributes(this.device,D.CLIENT_SCOPE,["Version"])]).pipe(le(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,D.SERVER_SCOPE).pipe(le(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 Me(t)?JSON.parse(t):t}observeModeChange(){this.connectorForm.get("mode").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{e===Jt.BASIC&&this.patchConnectorBasicConfig(this.connectorForm.get("configurationJson").value)}))}observeAttributeChange(){this.attributeUpdateSubject.pipe(de(300),me((e=>this.executeAttributeUpdates(e))),le(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){oe(this.getAttributeExecutionTasks(e)).pipe(ye(1),me((()=>this.updateData(!0))),le(this.destroy$)).subscribe()}getAttributeExecutionTasks(e){const t=this.activeConnectors.includes(e.key),n=t?D.SERVER_SCOPE:D.SHARED_SCOPE,i=t?D.SHARED_SCOPE:D.SERVER_SCOPE;return[this.attributeService.saveEntityAttributes(this.device,D.SHARED_SCOPE,[{key:"active_connectors",value:this.activeConnectors}]),this.attributeService.saveEntityAttributes(this.device,D.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(R.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(ue((()=>!!this.initialConnector)),le(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("configurationJson"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;if(!Se(e,t?.value)&&this.allowBasicConfig.has(n)&&i===Jt.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(le(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("basicConfig"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;!Se(e,t?.value)&&this.allowBasicConfig.has(n)&&i===Jt.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):ae(!0)}setFormValue(e){this.connectorForm.disabled&&this.connectorForm.enable();const t=Ua.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!==Jt.ADVANCED?this.basicConfigInitSubject.asObservable().pipe(ye(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===dt.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||C3)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.TelemetryWebsocketService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(Ya),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:C3,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:st,useClass:S3},Ya]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:42,vars:21,consts:[["generalTabContent",""],["cellActionsMenu","matMenu"],["defaultConfig",""],["legacy",""],[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","click",4,"ngIf"],[1,"table-container"],["class","mat-headline-5 tb-absolute-fill tb-add-new items-center justify-center",4,"ngIf"],["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"],["class","version-placeholder",4,"ngIf"],["formControlName","mode","appearance","fill",4,"ngIf"],["translate","",1,"no-data-found","items-center","justify-center"],["class","tb-form-panel section-container no-border no-padding tb-flex space-between",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["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","","matTooltip","RPC","matTooltipPosition","above",3,"click","disabled"],["mat-icon-button","","matTooltip","Logs","matTooltipPosition","above",3,"click"],["mat-icon-button","","matTooltip","Delete connector","matTooltipPosition","above",3,"click"],[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"],[1,"version-placeholder"],["formControlName","mode","appearance","fill"],[3,"value"],[1,"tb-form-panel","section-container","no-border","no-padding","tb-flex","space-between"],[4,"ngIf","ngIfElse"],[1,"flex","justify-end"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[3,"ngSwitch"],[4,"ngSwitchCase"],["formControlName","basicConfig",3,"generalTabContent","withReportStrategy","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"generalTabContent","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent"],["class","h-full","formControlName","basicConfig",3,"generalTabContent","withReportStrategy","initialized",4,"ngIf","ngIfElse"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],[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"],[3,"value",4,"ngFor","ngForOf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4)(1,"section",5)(2,"mat-toolbar",6)(3,"h2"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(6,P2,5,6,"button",7),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",8),t.ɵɵtemplate(8,D2,7,3,"section",9),t.ɵɵelementStart(9,"table",10),t.ɵɵelementContainerStart(10,11),t.ɵɵtemplate(11,O2,3,3,"mat-header-cell",12)(12,A2,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,14),t.ɵɵtemplate(14,F2,3,3,"mat-header-cell",15)(15,R2,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(16,16),t.ɵɵtemplate(17,B2,3,3,"mat-header-cell",17)(18,N2,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(19,19),t.ɵɵtemplate(20,L2,3,3,"mat-header-cell",17)(21,V2,3,3,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(22,20),t.ɵɵtemplate(23,q2,3,3,"mat-header-cell",17)(24,G2,2,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,21),t.ɵɵtemplate(26,z2,5,6,"mat-header-cell",22)(27,U2,26,6,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,j2,1,0,"mat-header-row",23)(29,H2,1,4,"mat-row",24),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"section",25)(31,"div",26)(32,"div",27),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,W2,2,1,"span",28),t.ɵɵelementEnd(),t.ɵɵtemplate(36,$2,7,8,"tb-toggle-select",29),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"span",30),t.ɵɵtext(38," gateway.select-connector "),t.ɵɵelementEnd(),t.ɵɵtemplate(39,h3,8,6,"section",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(40,w3,30,19,"ng-template",null,0,t.ɵɵtemplateRefExtractor)),2&e&&(t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,17,"gateway.connectors")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==n.dataSource||null==n.dataSource.data?null:n.dataSource.data.length),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!(null!=n.dataSource&&(null!=n.dataSource.data&&n.dataSource.data.length))),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,19,"gateway.configuration")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("configVersion").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.initialConnector&&n.allowBasicConfig.has(n.initialConnector.type)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.initialConnector),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.initialConnector))},dependencies:t.ɵɵgetComponentDepsFactory(C3,[j,_,Ya,UW,HY,WY,RY,FY,aQ,rQ,hJ,gJ,Zn,u1,m1,T2,_2]),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",C3);class _3{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||_3)(t.ɵɵdirectiveInject(_e.DeviceService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:_3,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(_3,[j,_]),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 T3,I3,E3;e("DeviceGatewayCommandComponent",_3),e("GatewayBasicConfigTab",T3),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"}(T3||e("GatewayBasicConfigTab",T3={})),e("StorageTypes",I3),function(e){e.MEMORY="memory",e.FILE="file",e.SQLITE="sqlite"}(I3||e("StorageTypes",I3={})),e("LocalLogsConfigs",E3),function(e){e.service="service",e.connector="connector",e.converter="converter",e.tb_connection="tb_connection",e.storage="storage",e.extension="extension"}(E3||e("LocalLogsConfigs",E3={}));const M3=e("LocalLogsConfigTranslateMap",new Map([[E3.service,"Service"],[E3.connector,"Connector"],[E3.converter,"Converter"],[E3.tb_connection,"TB Connection"],[E3.storage,"Storage"],[E3.extension,"Extension"]])),k3=e("StorageTypesTranslationMap",new Map([[I3.MEMORY,"gateway.storage-types.memory-storage"],[I3.FILE,"gateway.storage-types.file-storage"],[I3.SQLITE,"gateway.storage-types.sqlite"]]));var P3;e("LogSavingPeriod",P3),function(e){e.days="D",e.hours="H",e.minutes="M",e.seconds="S"}(P3||e("LogSavingPeriod",P3={}));const D3=e("LogSavingPeriodTranslations",new Map([[P3.days,"gateway.logs.days"],[P3.hours,"gateway.logs.hours"],[P3.minutes,"gateway.logs.minutes"],[P3.seconds,"gateway.logs.seconds"]]));var O3;e("SecurityTypes",O3),function(e){e.ACCESS_TOKEN="accessToken",e.USERNAME_PASSWORD="usernamePassword",e.TLS_ACCESS_TOKEN="tlsAccessToken",e.TLS_PRIVATE_KEY="tlsPrivateKey"}(O3||e("SecurityTypes",O3={}));const A3=e("SecurityTypesTranslationsMap",new Map([[O3.ACCESS_TOKEN,"gateway.security-types.access-token"],[O3.USERNAME_PASSWORD,"gateway.security-types.username-password"],[O3.TLS_ACCESS_TOKEN,"gateway.security-types.tls-access-token"]])),F3=e("logsHandlerClass","thingsboard_gateway.tb_utility.tb_rotating_file_handler.TimedRotatingFileHandler"),R3=e("logsLegacyHandlerClass","thingsboard_gateway.tb_utility.tb_handler.TimedRotatingFileHandler");function B3(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",10),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 N3(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 L3(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 V3(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 q3(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 G3(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 z3(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 U3(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",11)(1,"mat-form-field",12)(2,"mat-label",13),t.ɵɵtext(3,"gateway.storage-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",14),t.ɵɵtemplate(5,N3,3,3,"mat-error",15)(6,L3,3,3,"mat-error",15)(7,V3,3,3,"mat-error",15),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",12)(12,"mat-label",13),t.ɵɵtext(13,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",17),t.ɵɵtemplate(15,q3,3,3,"mat-error",15)(16,G3,3,3,"mat-error",15)(17,z3,3,3,"mat-error",15),t.ɵɵelementStart(18,"mat-icon",16),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,8,"gateway.hints.read-record-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,10,"gateway.hints.max-records-count"))}}function j3(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 H3(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 W3(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 $3(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 K3(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 Y3(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 X3(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 Z3(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 Q3(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 J3(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 e4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-data-folder-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",18),t.ɵɵtemplate(6,j3,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",19),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.storage-max-files"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",20),t.ɵɵtemplate(14,H3,3,3,"mat-error",15)(15,W3,3,3,"mat-error",15)(16,$3,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"mat-form-field",12)(22,"mat-label",13),t.ɵɵtext(23,"gateway.storage-max-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",21),t.ɵɵtemplate(25,K3,3,3,"mat-error",15)(26,Y3,3,3,"mat-error",15)(27,X3,3,3,"mat-error",15),t.ɵɵelementStart(28,"mat-icon",16),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"mat-form-field",12)(32,"mat-label",13),t.ɵɵtext(33,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",22),t.ɵɵtemplate(35,Z3,3,3,"mat-error",15)(36,Q3,3,3,"mat-error",15)(37,J3,3,3,"mat-error",15),t.ɵɵelementStart(38,"mat-icon",16),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_folder_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,14,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,16,"gateway.hints.max-file-count")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,18,"gateway.hints.max-read-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,20,"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 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.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 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-check-in-hours-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.messages-ttl-in-days-required")," "))}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.messages-ttl-in-days-min")," "))}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.messages-ttl-in-days-pattern")," "))}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-required")," "))}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-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 d4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",23),t.ɵɵtemplate(6,t4,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",16),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.messages-ttl-check-in-hours"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",24),t.ɵɵtemplate(14,n4,3,3,"mat-error",15)(15,i4,3,3,"mat-error",15)(16,a4,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"mat-form-field",12)(22,"mat-label",13),t.ɵɵtext(23,"gateway.messages-ttl-in-days"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",25),t.ɵɵtemplate(25,r4,3,3,"mat-error",15)(26,o4,3,3,"mat-error",15)(27,s4,3,3,"mat-error",15),t.ɵɵelementStart(28,"mat-icon",26),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"mat-form-field",12)(32,"mat-label",13),t.ɵɵtext(33,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",22),t.ɵɵtemplate(35,l4,3,3,"mat-error",15)(36,p4,3,3,"mat-error",15)(37,c4,3,3,"mat-error",15),t.ɵɵelementStart(38,"mat-icon",26),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_file_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,14,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,16,"gateway.hints.ttl-check-hour")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,18,"gateway.hints.ttl-messages-day")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,20,"gateway.hints.max-records"))}}class u4{constructor(e){this.fb=e,this.initialized=new u,this.StorageTypes=I3,this.storageTypes=Object.values(I3),this.storageTypesTranslationMap=k3,this.onChange=()=>{},this.storageFormGroup=this.initStorageFormGroup(),this.observeStorageTypeChanges(),this.storageFormGroup.valueChanges.pipe(wn()).subscribe((e=>{this.onChange(e)}))}ngAfterViewInit(){this.initialized.emit({storage:this.storageFormGroup.value})}writeValue(e){this.storageFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.storageFormGroup.valid?null:{storageFormGroup:{valid:!1}}}removeAllStorageValidators(){for(const e in this.storageFormGroup.controls)"type"!==e&&(this.storageFormGroup.controls[e].clearValidators(),this.storageFormGroup.controls[e].setErrors(null),this.storageFormGroup.controls[e].updateValueAndValidity())}initStorageFormGroup(){return this.fb.group({type:[I3.MEMORY,[$.required]],read_records_count:[100,[$.required,$.min(1),$.pattern(an)]],max_records_count:[1e5,[$.required,$.min(1),$.pattern(an)]],data_folder_path:["./data/",[$.required]],max_file_count:[10,[$.min(1),$.pattern(an)]],max_read_records_count:[10,[$.min(1),$.pattern(an)]],max_records_per_file:[1e4,[$.min(1),$.pattern(an)]],data_file_path:["./data/data.db",[$.required]],messages_ttl_check_in_hours:[1,[$.min(1),$.pattern(an)]],messages_ttl_in_days:[7,[$.min(1),$.pattern(an)]]})}observeStorageTypeChanges(){this.storageFormGroup.get("type").valueChanges.pipe(wn()).subscribe((e=>{switch(this.removeAllStorageValidators(),e){case I3.MEMORY:this.addMemoryStorageValidators(this.storageFormGroup);break;case I3.FILE:this.addFileStorageValidators(this.storageFormGroup);break;case I3.SQLITE:this.addSqliteStorageValidators(this.storageFormGroup)}}))}addMemoryStorageValidators(e){e.get("read_records_count").addValidators([$.required,$.min(1),$.pattern(an)]),e.get("max_records_count").addValidators([$.required,$.min(1),$.pattern(an)]),e.get("read_records_count").updateValueAndValidity({emitEvent:!1}),e.get("max_records_count").updateValueAndValidity({emitEvent:!1})}addFileStorageValidators(e){["max_file_count","max_read_records_count","max_records_per_file"].forEach((t=>{e.get(t).addValidators([$.required,$.min(1),$.pattern(an)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}addSqliteStorageValidators(e){["messages_ttl_check_in_hours","messages_ttl_in_days","max_records_per_file"].forEach((t=>{e.get(t).addValidators([$.required,$.min(1),$.pattern(an)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}static{this.ɵfac=function(e){return new(e||u4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:u4,selectors:[["tb-gateway-storage-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>u4)),multi:!0},{provide:K,useExisting:c((()=>u4)),multi:!0}]),t.ɵɵStandaloneFeature],decls:15,vars:9,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",4,"ngFor","ngForOf"],[1,"tb-form-panel-hint"],[3,"ngSwitch"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"value"],[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"],[4,"ngIf"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","number","matInput","","formControlName","max_records_count"],["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"]],template:function(e,n){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.ɵɵtemplate(7,B3,3,4,"tb-toggle-option",5),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(11,7),t.ɵɵtemplate(12,U3,21,12,"section",8)(13,e4,41,22,"section",9)(14,d4,41,22,"section",9),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.storageFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.storageTypes),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.hints."+n.storageFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.storageFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.MEMORY),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.FILE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.SQLITE))},dependencies:t.ɵɵgetComponentDepsFactory(u4,[j,_]),encapsulation:2})}}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.thingsboard-port-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.thingsboard-port-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.thingsboard-port-max")," "))}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.thingsboard-port-pattern")," "))}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.grpc-keep-alive-timeout-required")," "))}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.grpc-keep-alive-timeout-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.grpc-keep-alive-timeout-pattern")," "))}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.grpc-keep-alive-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.grpc-keep-alive-min")," "))}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.grpc-keep-alive-pattern")," "))}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.grpc-min-time-between-pings-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.grpc-min-time-between-pings-min")," "))}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.grpc-min-time-between-pings-pattern")," "))}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.grpc-max-pings-without-data-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.grpc-max-pings-without-data-min")," "))}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.grpc-max-pings-without-data-pattern")," "))}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.grpc-min-ping-interval-without-data-required")," "))}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.grpc-min-ping-interval-without-data-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.grpc-min-ping-interval-without-data-pattern")," "))}class O4{constructor(e){this.fb=e,this.initialized=new u,this.onChange=()=>{},this.grpcFormGroup=this.initGrpcFormGroup(),this.grpcFormGroup.valueChanges.pipe(wn()).subscribe((e=>{this.onChange(e)})),this.grpcFormGroup.get("enabled").valueChanges.pipe(wn()).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,[$.required,$.min(1),$.max(65535),$.pattern(an)]],keepAliveTimeMs:[1e4,[$.required,$.min(1),$.pattern(an)]],keepAliveTimeoutMs:[5e3,[$.required,$.min(1),$.pattern(an)]],keepalivePermitWithoutCalls:[!0],maxPingsWithoutData:[0,[$.required,$.min(0),$.pattern(an)]],minTimeBetweenPingsMs:[1e4,[$.required,$.min(1),$.pattern(an)]],minPingIntervalWithoutDataMs:[5e3,[$.required,$.min(1),$.pattern(an)]]})}static{this.ɵfac=function(e){return new(e||O4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:O4,selectors:[["tb-gateway-grpc-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>O4)),multi:!0},{provide:K,useExisting:c((()=>O4)),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"],[4,"ngIf"],["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,m4,3,3,"mat-error",10)(20,h4,3,3,"mat-error",10)(21,g4,3,3,"mat-error",10)(22,f4,3,3,"mat-error",10),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",11),t.ɵɵelementStart(27,"mat-icon",9),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(30,y4,3,3,"mat-error",10)(31,v4,3,3,"mat-error",10)(32,x4,3,3,"mat-error",10),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",12),t.ɵɵelementStart(38,"mat-icon",9),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(41,b4,3,3,"mat-error",10)(42,w4,3,3,"mat-error",10)(43,S4,3,3,"mat-error",10),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",13),t.ɵɵelementStart(48,"mat-icon",9),t.ɵɵpipe(49,"translate"),t.ɵɵtext(50,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(51,C4,3,3,"mat-error",10)(52,_4,3,3,"mat-error",10)(53,T4,3,3,"mat-error",10),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",14),t.ɵɵelementStart(59,"mat-icon",9),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(62,I4,3,3,"mat-error",10)(63,E4,3,3,"mat-error",10)(64,M4,3,3,"mat-error",10),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",15),t.ɵɵelementStart(69,"mat-icon",9),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(72,k4,3,3,"mat-error",10)(73,P4,3,3,"mat-error",10)(74,D4,3,3,"mat-error",10),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.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,37,"gateway.hints.grpc-keep-alive-timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,39,"gateway.hints.grpc-keep-alive")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,41,"gateway.hints.grpc-min-time-between-pings")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(60,43,"gateway.hints.grpc-max-pings-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,45,"gateway.hints.grpc-min-ping-interval-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("pattern")))},dependencies:t.ɵɵgetComponentDepsFactory(O4,[j,_]),encapsulation:2})}}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.logs.date-format-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.logs.log-format-required")," "))}function R4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function B4(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",30),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 N4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}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.logs.file-path-required")," "))}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.logs.saving-period-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.logs.saving-period-min")," "))}function G4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),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 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.logs.backup-count-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.logs.backup-count-min")," "))}class j4{constructor(e){this.fb=e,this.initialized=new u,this.logSavingPeriods=D3,this.localLogsConfigs=Object.keys(E3),this.localLogsConfigTranslateMap=M3,this.gatewayLogLevel=Object.values(pt),this.remoteLogLevel=Object.values(pt).filter((e=>e!==pt.NONE)),this.onChange=()=>{},this.logsFormGroup=this.initLogsFormGroup(),this.showRemoteLogsControl=this.fb.control(!1),this.logsFormGroup.valueChanges.pipe(wn()).subscribe((e=>{this.onChange(e)})),this.logSelector=this.fb.control(E3.service);for(const e of Object.keys(E3))this.addLocalLogConfig(e,{});this.showRemoteLogsControl.valueChanges.pipe(wn()).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??pt.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",[$.required,$.pattern(/^[^\s].*[^\s]$/)]],logFormat:["%(asctime)s.%(msecs)03d - |%(levelname)s| - [%(filename)s] - %(module)s - %(funcName)s - %(lineno)d - %(message)s",[$.required,$.pattern(/^[^\s].*[^\s]$/)]],type:["remote",[$.required]],logLevel:[{value:pt.INFO,disabled:!0}],local:this.fb.group({})})}addLocalLogConfig(e,t){const n=this.logsFormGroup.get("local"),i=this.fb.group({logLevel:[t.logLevel||pt.INFO,[$.required]],filePath:[t.filePath||"./logs",[$.required]],backupCount:[t.backupCount||7,[$.required,$.min(0)]],savingTime:[t.savingTime||3,[$.required,$.min(0)]],savingPeriod:[t.savingPeriod||P3.days,[$.required]]});n.addControl(e,i,{emitEvent:!1})}updateRemoteLogs(e){const t=e&&e!==pt.NONE;this.showRemoteLogsControl.patchValue(t,{emitEvent:!1}),this.logsFormGroup.get("logLevel")[t?"enable":"disable"]({emitEvent:!1}),this.logsFormGroup.get("logLevel").patchValue(e===pt.NONE?pt.INFO:e,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||j4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:j4,selectors:[["tb-gateway-logs-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>j4)),multi:!0},{provide:K,useExisting:c((()=>j4)),multi:!0}]),t.ɵɵStandaloneFeature],decls:72,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"],[4,"ngIf"],["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",4,"ngFor","ngForOf"],["formGroupName","local",1,"tb-form-panel","no-padding-bottom"],["translate","",1,"tb-form-panel-title"],[1,"toggle-group",3,"formControl"],["class","first-capital",3,"value",4,"ngFor","ngForOf"],[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"],[3,"value"],[1,"first-capital",3,"value"]],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,A4,3,3,"mat-error",6),t.ɵɵelementStart(8,"mat-icon",7),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",8),t.ɵɵtemplate(15,F4,3,3,"mat-error",6),t.ɵɵelementStart(16,"mat-icon",7),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",9)(20,"mat-expansion-panel",10)(21,"mat-expansion-panel-header",11)(22,"mat-panel-title")(23,"mat-slide-toggle",12),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵelementStart(24,"mat-label")(25,"div",13),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",14),t.ɵɵtemplate(33,R4,2,2,"mat-option",15),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(34,"div",16)(35,"div",17),t.ɵɵtext(36,"gateway.logs.local"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"tb-toggle-select",18),t.ɵɵtemplate(38,B4,2,2,"tb-toggle-option",19),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(39,20),t.ɵɵelementStart(40,"div",21)(41,"mat-form-field",22)(42,"mat-label",4),t.ɵɵtext(43,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-select",14),t.ɵɵtemplate(45,N4,2,2,"mat-option",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",22)(47,"mat-label",4),t.ɵɵtext(48,"gateway.logs.file-path"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",23),t.ɵɵtemplate(50,L4,3,3,"mat-error",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"div",21)(52,"div",24)(53,"mat-form-field",22)(54,"mat-label",4),t.ɵɵtext(55,"gateway.logs.saving-period"),t.ɵɵelementEnd(),t.ɵɵelement(56,"input",25),t.ɵɵtemplate(57,V4,3,3,"mat-error",6)(58,q4,3,3,"mat-error",6),t.ɵɵelementEnd(),t.ɵɵelementStart(59,"mat-form-field",26)(60,"mat-select",27),t.ɵɵtemplate(61,G4,3,4,"mat-option",15),t.ɵɵpipe(62,"keyvalue"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(63,"mat-form-field",22)(64,"mat-label",4),t.ɵɵtext(65,"gateway.logs.backup-count"),t.ɵɵelementEnd(),t.ɵɵelement(66,"input",28),t.ɵɵtemplate(67,z4,3,3,"mat-error",6)(68,U4,3,3,"mat-error",6),t.ɵɵelementStart(69,"mat-icon",7),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.logsFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("dateFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,21,"gateway.hints.date-form")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("logFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",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.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,25,"gateway.hints.remote-log")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,27,"gateway.logs.remote")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.remoteLogLevel),t.ɵɵadvance(4),t.ɵɵproperty("formControl",n.logSelector),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.localLogsConfigs),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.getLogFormGroup(n.logSelector.value)),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(5),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".filePath").hasError("required")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("min")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(62,29,n.logSavingPeriods)),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("min")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,31,"gateway.hints.backup-count")))},dependencies:t.ɵɵgetComponentDepsFactory(j4,[j,_]),encapsulation:2})}}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,"security.clientId-required")," "))}function W4(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 $4(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,"device.generate-client-id"))}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,"security.username-required")," "))}function Y4(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 X4(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("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 Z4(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 Q4(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("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 J4(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"device.client-id-or-user-name-necessary"))}function e5(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"gateway.hints.username-required-with-password"))}class t5{constructor(e){this.fb=e,this.onChange=()=>{},this.initForm(),this.usernameFormGroup.valueChanges.pipe(wn()).subscribe((e=>this.onChange(e)))}writeValue(e){this.usernameFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){e?this.usernameFormGroup.disable({emitEvent:!1}):this.usernameFormGroup.enable({emitEvent:!1})}validate(){return this.usernameFormGroup.valid?null:{usernameFormGroup:{valid:!1}}}initForm(){this.usernameFormGroup=this.createSecurityFormGroup()}createSecurityFormGroup(){return this.fb.group({clientId:[null,[$.pattern(/^[^.\s]+$/)]],username:[null,[$.pattern(/^[^.\s]+$/)]],password:[null,[$.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(Re(20))}static{this.ɵfac=function(e){return new(e||t5)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:t5,selectors:[["tb-gateway-username-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>t5)),multi:!0},{provide:K,useExisting:c((()=>t5)),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"],[4,"ngIf"],["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"],["class","block",3,"error",4,"ngIf"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"],[1,"block",3,"error"]],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,H4,3,3,"mat-error",5)(7,W4,2,4,"tb-copy-button",6)(8,$4,4,3,"button",7),t.ɵɵelementStart(9,"mat-icon",8),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",9),t.ɵɵtemplate(16,K4,3,3,"mat-error",5)(17,Y4,2,4,"tb-copy-button",6)(18,X4,4,3,"button",7),t.ɵɵelementStart(19,"mat-icon",8),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"mat-form-field",10)(23,"mat-label",3),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",11),t.ɵɵtemplate(26,Z4,2,4,"tb-copy-button",6)(27,Q4,4,3,"button",7),t.ɵɵelementStart(28,"mat-icon",8),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵtemplate(31,J4,2,3,"tb-error",12)(32,e5,2,3,"tb-error",12)),2&e&&(t.ɵɵproperty("formGroup",n.usernameFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.usernameFormGroup.get("clientId").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.get("username").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("atLeastOneRequired")&&n.usernameFormGroup.touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("usernameRequired")&&n.usernameFormGroup.touched))},dependencies:t.ɵɵgetComponentDepsFactory(t5,[j,_]),encapsulation:2})}}class n5{constructor(e,t){this.deviceService=e,this.destroyRef=t,this.initialCredentialsSubject=new ie(null)}get initialCredentials(){return this.initialCredentialsSubject.value}get initialCredentials$(){return this.initialCredentialsSubject.asObservable()}updateCredentials(e){let t={};switch(e.type){case O3.USERNAME_PASSWORD:this.shouldUpdateCredentials(e)&&(t=this.generateMqttCredentials(e));break;case O3.ACCESS_TOKEN:case O3.TLS_ACCESS_TOKEN:this.shouldUpdateAccessToken(e)&&(t={credentialsType:U.ACCESS_TOKEN,credentialsId:e.accessToken,credentialsValue:null})}return this.initialCredentialsSubject.next({...this.initialCredentials,...t}),Object.keys(t).length?this.deviceService.saveDeviceCredentials(this.initialCredentials):ae(null)}setInitialCredentials(e){this.deviceService.getDeviceCredentials(e.id).pipe(wn(this.destroyRef)).subscribe((e=>{this.initialCredentialsSubject.next({...e,version:null})}))}shouldUpdateSecurityConfig(e){switch(e.type){case O3.USERNAME_PASSWORD:return this.shouldUpdateCredentials(e);case O3.ACCESS_TOKEN:case O3.TLS_ACCESS_TOKEN:return this.shouldUpdateAccessToken(e)}}credentialsToSecurityConfig(e){const t=e.credentialsType===U.MQTT_BASIC?O3.USERNAME_PASSWORD:O3.ACCESS_TOKEN;if(e.credentialsType!==U.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!==U.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!==U.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:U.MQTT_BASIC,credentialsValue:JSON.stringify(a)}}static{this.ɵfac=function(e){return new(e||n5)(t.ɵɵinject(_e.DeviceService),t.ɵɵinject(t.DestroyRef))}}static{this.ɵprov=t.ɵɵdefineInjectable({token:n5,factory:n5.ɵfac})}}function i5(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;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e.value)," ")}}function a5(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 r5(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",13),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 o5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",16),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 s5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label",10),t.ɵɵtext(2,"security.access-token"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",11),t.ɵɵtemplate(4,a5,3,3,"mat-error",12)(5,r5,2,4,"tb-copy-button",13)(6,o5,4,3,"button",14),t.ɵɵelementStart(7,"mat-icon",15),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("ngIf",e.securityFormGroup.get("accessToken").hasError("required")),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 l5(e,n){1&e&&(t.ɵɵelement(0,"tb-file-input",17),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 p5{constructor(e,t,n){this.fb=e,this.cd=t,this.gatewayCredentialsService=n,this.initialized=new u,this.securityTypes=A3,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){e?this.updateFormBySecurityConfig(e):this.updateFormBySecurityConfig(this.gatewayCredentialsService.credentialsToSecurityConfig(this.gatewayCredentialsService.initialCredentials))}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===O3.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:[O3.ACCESS_TOKEN,[$.required]],accessToken:[null,[$.required,$.pattern(/^[^.\s]+$/)]],caCert:[null,[$.required]],usernamePassword:[]})}setupFormListeners(){this.securityFormGroup.valueChanges.pipe(wn()).subscribe((({usernamePassword:e,...t})=>{this.onChange(e?{...t,...e}:t)})),this.securityFormGroup.get("type").valueChanges.pipe(wn()).subscribe((e=>{this.toggleBySecurityType(e)})),this.securityFormGroup.get("caCert").valueChanges.pipe(wn()).subscribe((()=>this.cd.detectChanges()))}toggleBySecurityType(e){switch(this.securityFormGroup.disable({emitEvent:!1}),this.securityFormGroup.get("type").enable({emitEvent:!1}),e){case O3.ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1});break;case O3.TLS_PRIVATE_KEY:this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case O3.TLS_ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case O3.USERNAME_PASSWORD:this.securityFormGroup.get("usernamePassword").enable({emitEvent:!1})}}generateAccessToken(){this.securityFormGroup.get("accessToken").patchValue(Re(20))}static{this.ɵfac=function(e){return new(e||p5)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(n5))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:p5,selectors:[["tb-gateway-security-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>p5)),multi:!0},{provide:K,useExisting:c((()=>p5)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,consts:[[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],[3,"formGroup"],["formControlName","type",1,"toggle-group","flex"],[3,"value",4,"ngFor","ngForOf"],["appearance","outline",4,"ngIf"],["formControlName","usernamePassword"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel",4,"ngIf"],[3,"value"],["appearance","outline"],["translate",""],["matInput","","formControlName","accessToken"],[4,"ngIf"],["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"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel"]],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.ɵɵtemplate(5,i5,3,4,"tb-toggle-option",4),t.ɵɵpipe(6,"keyvalue"),t.ɵɵelementEnd(),t.ɵɵtemplate(7,s5,10,5,"mat-form-field",5),t.ɵɵelement(8,"tb-gateway-username-configuration",6),t.ɵɵtemplate(9,l5,4,11,"tb-file-input",7),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(6,6,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("accesstoken")),t.ɵɵadvance(),t.ɵɵclassProp("hidden","usernamePassword"!==n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("tls")))},dependencies:t.ɵɵgetComponentDepsFactory(p5,[j,_,t5]),encapsulation:2})}}const c5=["configGroup"];function d5(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 u5(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 m5(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 h5(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 g5(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 f5(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 y5(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",21),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Gateway)}}function v5(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,d5,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,u5,3,3,"mat-error")(26,m5,3,3,"mat-error")(27,h5,3,3,"mat-error")(28,g5,3,3,"mat-error"),t.ɵɵelementStart(29,"mat-icon",16),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(32,f5,1,0,"tb-gateway-security-configuration",18),t.ɵɵpipe(33,"async"),t.ɵɵtemplate(34,y5,1,1,"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.ɵɵproperty("ngIf",t.ɵɵpipeBind1(33,22,e.initialCredentials$)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.withReportStrategy)}}function x5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",23)(1,"mat-label",33),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-slide-toggle",34)(6,"mat-label",33),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 b5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",23),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.statistics")," "))}function w5(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 S5(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 C5(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 _5(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 T5(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 I5(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 E5(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 M5(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 k5(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 P5(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 D5(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 O5(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 A5(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 F5(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 R5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",35)(1,"section",36)(2,"section",37)(3,"mat-form-field",38)(4,"mat-label",14),t.ɵɵtext(5,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",39),t.ɵɵtemplate(7,E5,3,3,"mat-error")(8,M5,3,3,"mat-error")(9,k5,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",38)(14,"mat-label",14),t.ɵɵtext(15,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",40),t.ɵɵtemplate(17,P5,3,3,"mat-error")(18,D5,3,3,"mat-error")(19,O5,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",41)(25,"mat-label",14),t.ɵɵtext(26,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",42),t.ɵɵtemplate(28,A5,3,3,"mat-error")(29,F5,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",43)(35,"mat-expansion-panel-header")(36,"mat-panel-title")(37,"div",28),t.ɵɵtext(38,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(39,"mat-form-field",38)(40,"mat-label",14),t.ɵɵtext(41,"gateway.statistics.install-cmd"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",44),t.ɵɵelementStart(43,"mat-icon",45),t.ɵɵpipe(44,"translate"),t.ɵɵtext(45,"info_outlined "),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(46,"button",46),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 B5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",22),t.ɵɵtemplate(2,x5,10,12)(3,b5,3,3,"mat-slide-toggle",23),t.ɵɵelementStart(4,"mat-form-field",24)(5,"mat-label",14),t.ɵɵtext(6,"gateway.statistics.send-period"),t.ɵɵelementEnd(),t.ɵɵelement(7,"input",25),t.ɵɵtemplate(8,w5,3,3,"mat-error")(9,S5,3,3,"mat-error")(10,C5,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",24)(12,"mat-label",14),t.ɵɵtext(13,"gateway.statistics.custom-send-period"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",26),t.ɵɵtemplate(15,_5,3,3,"mat-error")(16,T5,3,3,"mat-error")(17,I5,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",27)(19,"div",28),t.ɵɵtext(20,"gateway.statistics.commands"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",29),t.ɵɵtext(22,"gateway.hints.commands"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(23,30),t.ɵɵtemplate(24,R5,50,20,"div",31),t.ɵɵelementStart(25,"button",32),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.addCommand())})),t.ɵɵtext(26),t.ɵɵpipe(27,"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.ɵɵproperty("ngForOf",e.commandFormArray().controls),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.basicFormGroup.get("thingsboard.remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,6,"gateway.statistics.add")," ")}}function N5(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 L5(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 V5(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 q5(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 G5(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 z5(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 U5(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",37)(1,"mat-form-field",38)(2,"mat-label",14),t.ɵɵtext(3,"gateway.inactivity-timeout-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",56),t.ɵɵtemplate(5,N5,3,3,"mat-error")(6,L5,3,3,"mat-error")(7,V5,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",38)(12,"mat-label",14),t.ɵɵtext(13,"gateway.inactivity-check-period-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",57),t.ɵɵtemplate(15,q5,3,3,"mat-error")(16,G5,3,3,"mat-error")(17,z5,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 j5(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 H5(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 W5(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 $5(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 K5(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 Y5(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 X5(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 Z5(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 Q5(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 J5(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 e6(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 t6(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 n6(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 i6(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 a6(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 r6(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",47)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",48),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(7,U5,21,8,"section",49),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",8)(9,"div",28),t.ɵɵtext(10,"gateway.advanced"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"section",37)(12,"mat-form-field",38)(13,"mat-label",14),t.ɵɵtext(14,"gateway.min-pack-send-delay"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",50),t.ɵɵtemplate(16,j5,3,3,"mat-error")(17,H5,3,3,"mat-error")(18,W5,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",38)(23,"mat-label",14),t.ɵɵtext(24,"gateway.mqtt-qos"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",51)(26,"mat-option",52),t.ɵɵtext(27,"0"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-option",52),t.ɵɵtext(29,"1"),t.ɵɵelementEnd()(),t.ɵɵtemplate(30,$5,3,3,"mat-error")(31,K5,3,3,"mat-error")(32,Y5,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",37)(37,"mat-form-field",38)(38,"mat-label",14),t.ɵɵtext(39,"gateway.statistics.check-connectors-configuration"),t.ɵɵelementEnd(),t.ɵɵelement(40,"input",53),t.ɵɵtemplate(41,X5,3,3,"mat-error")(42,Z5,3,3,"mat-error")(43,Q5,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",38)(45,"mat-label",14),t.ɵɵtext(46,"gateway.statistics.max-payload-size-bytes"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",54),t.ɵɵtemplate(48,J5,3,3,"mat-error")(49,e6,3,3,"mat-error")(50,t6,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",37)(55,"mat-form-field",38)(56,"mat-label",14),t.ɵɵtext(57,"gateway.statistics.min-pack-size-to-send"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",55),t.ɵɵtemplate(59,n6,3,3,"mat-error")(60,i6,3,3,"mat-error")(61,a6,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.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value),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 o6{constructor(e,t,n,i,a){this.fb=e,this.deviceService=t,this.gatewayCredentialsService=n,this.destroyRef=i,this.dialog=a,this.gatewayVersion=ct.Legacy,this.dialogMode=!1,this.withReportStrategy=!1,this.initialized=new u,this.ReportStrategyDefaultValue=tn,this.initialCredentials$=this.gatewayCredentialsService.initialCredentials$,this.onChange=()=>{},this.destroy$=new te,this.initBasicFormGroup(),this.observeFormChanges(),this.basicFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.onChange(e)}))}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=T3[this.defaultTab])}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.basicFormGroup.patchValue(e,{emitEvent:!1});const t=e?.thingsboard?.statistics?.commands??[];this.commandFormArray().clear({emitEvent:!1}),t.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(le(this.destroy$)).subscribe((e=>{this.dialog.open(KH,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{gatewayName:e.name}}).afterClosed().pipe(ye(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,[$.required,$.pattern(rn),this.uniqNameRequired()]],command:[i,[$.required,$.pattern(/^(?=\S).*\S$/)]],timeout:[a,[$.required,$.min(1),$.pattern(an),$.pattern(/^[^.\s]+$/)]],installCmd:[r,$.pattern(rn)]});this.commandFormArray().push(o,{emitEvent:t})}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=e.dirty&&t&&this.commandFormArray().value.some((e=>e.attributeOnGateway?.toLowerCase()===t));return n?{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,[$.required,$.pattern(/^[^\s]+$/)]],port:[1883,[$.required,$.min(1),$.max(65535),$.pattern(an)]],remoteShell:[!1],remoteConfiguration:[!0],checkConnectorsConfigurationInSeconds:[60,[$.required,$.min(1),$.pattern(an)]],statistics:this.fb.group({enable:[!0],enableCustom:[{value:!1,disabled:!0}],statsSendPeriodInSeconds:[3600,[$.required,$.min(60),$.pattern(an)]],customStatsSendPeriodInSeconds:[3600,[$.required,$.min(60),$.pattern(an)]],commands:this.fb.array([])}),maxPayloadSizeBytes:[8196,[$.required,$.min(100),$.pattern(an)]],minPackSendDelayMS:[50,[$.required,$.min(10),$.pattern(an)]],minPackSizeToSend:[500,[$.required,$.min(100),$.pattern(an)]],handleDeviceRenaming:[!0],checkingDeviceActivity:this.initCheckingDeviceActivityFormGroup(),security:[],qos:[1],reportStrategy:[{value:{type:en.OnReceived},disabled:!0}]})}initCheckingDeviceActivityFormGroup(){return this.fb.group({checkDeviceInactivity:[!1],inactivityTimeoutSeconds:[300,[$.min(1),$.pattern(an)]],inactivityCheckPeriodSeconds:[10,[$.min(1),$.pattern(an)]]})}onVersionChange(){if(this.hasUpdatedStatistics=Ua.parseVersion(this.gatewayVersion)>=Ua.parseVersion(ct.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(wn(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(le(this.destroy$)).subscribe((e=>{e||this.openConfigurationConfirmDialog()}))}observeDeviceActivityChanges(){const e=this.basicFormGroup.get("thingsboard.checkingDeviceActivity");e.get("checkDeviceInactivity").valueChanges.pipe(le(this.destroy$)).subscribe((t=>{e.updateValueAndValidity();const n=[$.min(1),$.required,$.pattern(an)];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||o6)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.DeviceService),t.ɵɵdirectiveInject(n5),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(qe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:o6,selectors:[["tb-gateway-basic-configuration"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(c5,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:W,useExisting:c((()=>o6)),multi:!0},{provide:K,useExisting:c((()=>o6)),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",3,"initialized",4,"ngIf"],["class","tb-form-panel","formControlName","reportStrategy",3,"defaultValue",4,"ngIf"],["formControlName","security",3,"initialized"],["formControlName","reportStrategy",1,"tb-form-panel",3,"defaultValue"],["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","class","statistics-container flex flex-row",4,"ngFor","ngForOf"],["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"],["formArrayName","commands",1,"statistics-container","flex","flex-row"],[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"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngIf"],["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,v5,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,B5,28,8,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-tab",2),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,r6,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(o6,[j,_,Zn,u4,O4,j4,p5]),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",o6),Ge([I()],o6.prototype,"dialogMode",void 0),Ge([I()],o6.prototype,"withReportStrategy",void 0);class s6{constructor(e){this.fb=e,this.destroy$=new te,this.advancedFormControl=this.fb.control(""),this.advancedFormControl.valueChanges.pipe(le(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||s6)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:s6,selectors:[["tb-gateway-advanced-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>s6)),multi:!0},{provide:K,useExisting:c((()=>s6)),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(s6,[j,_]),encapsulation:2})}}function l6(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 p6(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 c6(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-advanced-configuration",10)}function d6(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",s6);class u6{constructor(e,t,n,i,a){this.fb=e,this.attributeService=t,this.cd=n,this.gatewayCredentialsService=i,this.destroyRef=a,this.ConfigurationModes=Jt,this.gatewayConfigAttributeKeys=["general_configuration","grpc_configuration","logs_configuration","storage_configuration","RemoteLoggingLevel","mode"],this.useUpdatedLogs=!1,this.gatewayConfigGroup=this.fb.group({basicConfig:[],advancedConfig:[],mode:[Jt.BASIC]}),this.observeAlignConfigs()}ngAfterViewInit(){this.fetchConfigAttribute(this.device)}saveConfig(){const{mode:e,advancedConfig:t}=Ne(this.removeEmpty(this.gatewayConfigGroup.value)),n={mode:e,...t};n.thingsboard.statistics.commands=Object.values(n.thingsboard.statistics.commands??[]);const i=this.generateAttributes(n);this.attributeService.saveEntityAttributes(this.device,D.SHARED_SCOPE,i).pipe(xe((e=>this.gatewayCredentialsService.updateCredentials(n.thingsboard.security))),wn(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(wn(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("advancedConfig");Se(t.value,e)||this.gatewayConfigGroup.get("mode").value!==Jt.BASIC||t.patchValue(e,{emitEvent:!1})})),this.gatewayConfigGroup.get("advancedConfig").valueChanges.pipe(wn(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("basicConfig");Se(t.value,e)||this.gatewayConfigGroup.get("mode").value!==Jt.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??pt.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"},...this.useUpdatedLogs?{}:{databaseHandler:{class:this.useUpdatedLogs?F3:R3,formatter:"LogFormatter",filename:"./logs/database.log",backupCount:1,encoding:"utf-8"}}},loggers:{...this.useUpdatedLogs?{}:{database:{handlers:["databaseHandler","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?F3:R3,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!==B&&this.attributeService.getEntityAttributes(e,D.CLIENT_SCOPE).pipe(we((t=>t.length?ae(t):this.attributeService.getEntityAttributes(e,D.SHARED_SCOPE,this.gatewayConfigAttributeKeys))),wn(this.destroyRef)).subscribe((e=>{this.gatewayVersion=e.find((e=>"Version"===e.key))?.value,this.useUpdatedLogs=Ua.parseVersion(this.gatewayVersion??ct.Legacy)>=Ua.parseVersion(ct.v3_6_3),this.updateConfigs(e),this.cd.detectChanges()}))}updateConfigs(e){let t={},n=pt.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??Jt.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(ue(Boolean),ye(1),wn(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(E3).reduce(((t,n)=>{const i=e.handlers[`${n}Handler`]||{},a=e.loggers[n]||{};return t[n]={logLevel:a.level||pt.INFO,filePath:i.filename?.split(`/${n}`)[0]||"./logs",backupCount:i.backupCount||7,savingTime:i.interval||3,savingPeriod:i.when||P3.days},t}),{}),logFormat:t,dateFormat:n}}static{this.ɵfac=function(e){return new(e||u6)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(n5),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:u6,selectors:[["tb-gateway-configuration"]],inputs:{device:"device",defaultTab:"defaultTab",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵProvidersFeature([n5]),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",3,"click",4,"ngIf"],[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,l6,3,0,"button",7),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8),t.ɵɵtemplate(17,p6,2,7,"tb-gateway-basic-configuration",9)(18,c6,1,0,"tb-gateway-advanced-configuration",10),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",11),t.ɵɵtemplate(20,d6,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.ɵɵproperty("ngIf",n.dialogRef),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(u6,[j,_,Ya,o6,s6]),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",u6);class m6{constructor(){}static{this.ɵfac=function(e){return new(e||m6)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:m6,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}.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 .\\!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 h6=(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 g6{constructor(e){this.translate=e,function(e){e.setTranslation("en_US",ft,!0),e.setTranslation("ar_AE",yt,!0),e.setTranslation("ca_ES",vt,!0),e.setTranslation("cs_CZ",xt,!0),e.setTranslation("da_DK",bt,!0),e.setTranslation("es_ES",wt,!0),e.setTranslation("ko_KR",St,!0),e.setTranslation("lt_LT",Ct,!0),e.setTranslation("nl_BE",_t,!0),e.setTranslation("pl_PL",Tt,!0),e.setTranslation("pt_BR",It,!0),e.setTranslation("sl_SI",Et,!0),e.setTranslation("tr_TR",Mt,!0),e.setTranslation("zh_CN",kt,!0),e.setTranslation("zh_TW",Pt,!0)}(e),(e=>{h6(m6,e)})("tb-gateway-css")}static{this.ɵfac=function(e){return new(e||g6)(t.ɵɵinject(He.TranslateService))}}static{this.ɵmod=t.ɵɵdefineNgModule({type:g6})}static{this.ɵinj=t.ɵɵdefineInjector({imports:[j,_,$e,JU,WH,zW,u6,bn,_3,C3]})}}e("GatewayExtensionModule",g6),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(g6,{imports:[j,_,$e,JU,WH,zW,u6,bn,_3,C3]})}}}));//# sourceMappingURL=gateway-management-extension.js.map +function bn(e){e||(n(bn),e=i(a));const t=new Z((t=>e.onDestroy(t.next.bind(t))));return e=>e.pipe(le(t))}e("GatewayLogsComponent",xn);function wn(e,t){!t?.injector&&n(wn);const l=t?.injector??i(r),p=new Q(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 Sn=["commandInput"],Cn=(e,t)=>t.attributeOnGateway,_n=e=>({command:e});function Tn(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 In(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 En(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 Mn(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,_n,e.truncate.transform(t.ɵɵpipeBind1(1,1,e.searchText$),!0,6,"...")))," ")}}function kn(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 Pn(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,Mn,3,8),t.ɵɵpipe(4,"async"),t.ɵɵtemplate(5,kn,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 Dn{constructor(e,t){this.truncate=e,this.fb=t,this.commands=l(),this.onCreateNewClicked=p(),this.selectStatisticsCommandControl=this.fb.control({}),this.searchText$=this.selectStatisticsCommandControl.valueChanges.pipe(pe((e=>e?"string"==typeof e?e:e?.attributeOnGateway:"")),ce(),J(1)),this.filteredCommands$=ee([this.searchText$,wn(this.commands)]).pipe(de(150),pe((([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:!Se(n,i)}),t.filter((t=>t.attributeOnGateway.toLowerCase().includes(e?.toLowerCase()??"")))})),J(1)),this.onChanges=e=>{},this.selectStatisticsCommandControl.valueChanges.pipe(bn()).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||Dn)(t.ɵɵdirectiveInject(T.TruncatePipe),t.ɵɵdirectiveInject(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Dn,selectors:[["tb-statistics-commands-autocomplete"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Sn,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:W,useExisting:c((()=>Dn)),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,Tn,4,3,"button",5)(7,In,4,3,"button",6),t.ɵɵelementStart(8,"mat-autocomplete",7,1),t.ɵɵrepeaterCreate(10,En,4,7,"mat-option",8,Cn,!1,Pn,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(Dn,[j,_]),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 On=()=>["createdTime","message"];function An(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 Fn(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 Rn(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 Bn(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 Nn(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",17)}function Ln(e,n){1&e&&t.ɵɵelement(0,"mat-row",17)}class Vn{constructor(){this.data=l([]),this.defaultPageSizes=[10,20,30],this.defaultSortOrder={property:"0",direction:w.DESC},this.pageLink=new S(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||Vn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Vn,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,An,3,3,"mat-header-cell",4)(5,Fn,3,4,"mat-cell",5),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(6,6),t.ɵɵtemplate(7,Rn,3,3,"mat-header-cell",7)(8,Bn,5,5,"mat-cell",8),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(9,Nn,1,0,"mat-header-row",9)(10,Ln,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,On))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(12,On)),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(Vn,[j,_]),styles:['@charset "UTF-8";[_nghost-%COMP%] .copy-content .mat-icon{padding:4px;font-size:18px}']})}}class qn{constructor(e,t,n){this.elementRef=e,this.renderer=t,this.tooltip=n,this.tooltipEnabled=!0,this.position="above",this.destroy$=new te}ngOnInit(){this.observeMouseEvents(),this.applyTruncationStyles()}ngAfterViewInit(){this.tooltip.position=this.position}ngOnDestroy(){this.tooltip._isTooltipVisible()&&this.hideTooltip(),this.destroy$.next(),this.destroy$.complete()}observeMouseEvents(){ne(this.elementRef.nativeElement,"mouseenter").pipe(ue((()=>this.tooltipEnabled)),ue((()=>this.isOverflown(this.elementRef.nativeElement))),me((()=>this.showTooltip())),le(this.destroy$)).subscribe(),ne(this.elementRef.nativeElement,"mouseleave").pipe(ue((()=>this.tooltipEnabled)),ue((()=>this.tooltip._isTooltipVisible())),me((()=>this.hideTooltip())),le(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 te,this.renderer.setStyle(this.el.nativeElement,"max-height","48px"),this.renderer.setStyle(this.el.nativeElement,"overflow","auto"),ne(i,"resize").pipe(le(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&&sae(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(pe((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=k.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),fe())}return this.allAttributes}isAllSelected(){const e=this.selection.selected.length;return this.attributesSubject.pipe(pe((t=>e===t.length)))}isEmpty(){return this.attributesSubject.pipe(pe((e=>!e.length)))}total(){return this.pageDataSubject.pipe(pe((e=>e.totalElements)))}masterToggle(){this.attributesSubject.pipe(me((e=>{this.selection.selected.length===e.length?this.selection.clear():e.forEach((e=>{this.selection.select(e)}))})),ye(1)).subscribe()}}e("AttributeDatasource",zn);const Un=()=>({maxWidth:"970px"});function jn(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",4)(1,"mat-expansion-panel-header",5)(2,"mat-panel-title")(3,"mat-slide-toggle",6),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,7),t.ɵɵelementEnd()}if(2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(5);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 Hn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8),t.ɵɵtext(1,"gateway.report-strategy.label"),t.ɵɵelementEnd(),t.ɵɵelementContainer(2,7)),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(5);t.ɵɵadvance(2),t.ɵɵproperty("ngTemplateOutlet",e)}}function Wn(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",16),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 $n(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",19),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 Kn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",17),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",18),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,$n,3,3,"mat-icon",19),t.ɵɵelementStart(8,"span",20),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 Yn(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"div",10),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelement(4,"div",11),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",12)(6,"mat-select",13),t.ɵɵtemplate(7,Wn,3,4,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,Kn,10,7,"div",15)),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,5,"gateway.type")," "),t.ɵɵadvance(2),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/report-strategy_fn")("tb-help-popup-style",t.ɵɵpureFunction0(7,Un)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.reportStrategyTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnChange&&e.reportStrategyFormGroup.get("type").value!==e.ReportStrategyType.OnReceived)}}class Xn{constructor(e){this.fb=e,this.isExpansionMode=!1,this.defaultValue=en.Key,this.reportStrategyTypes=Object.values(Jt),this.ReportTypeTranslateMap=tn,this.ReportStrategyType=Jt,this.destroy$=new te,this.showStrategyControl=this.fb.control(!1),this.reportStrategyFormGroup=this.fb.group({type:[{value:Jt.OnReportPeriod,disabled:!0},[]],reportPeriod:[{value:this.defaultValue,disabled:!0},[$.required,$.min(100)]]}),this.observeStrategyFormChange(),this.observeStrategyToggle()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){this.isExpansionMode&&this.showStrategyControl.setValue(!!e,{emitEvent:!1}),e&&this.reportStrategyFormGroup.enable({emitEvent:!1});const{type:t=Jt.OnReportPeriod,reportPeriod:n=this.defaultValue}=e??{};this.reportStrategyFormGroup.setValue({type:t,reportPeriod:n},{emitEvent:!1}),this.onTypeChange(t)}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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()})),this.reportStrategyFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.onTypeChange(e)))}observeStrategyToggle(){this.showStrategyControl.valueChanges.pipe(le(this.destroy$),ue((()=>this.isExpansionMode))).subscribe((e=>{e?(this.reportStrategyFormGroup.enable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").addValidators($.required),this.onChange(this.reportStrategyFormGroup.value)):(this.reportStrategyFormGroup.disable({emitEvent:!1}),this.reportStrategyFormGroup.get("reportPeriod").removeValidators($.required),this.onChange(null)),this.reportStrategyFormGroup.updateValueAndValidity({emitEvent:!1})}))}onTypeChange(e){const t=this.reportStrategyFormGroup.get("reportPeriod");e===Jt.OnChange||e===Jt.OnReceived?t.disable({emitEvent:!1}):this.isExpansionMode&&!this.showStrategyControl.value||t.enable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||Xn)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Xn,selectors:[["tb-report-strategy"]],inputs:{isExpansionMode:"isExpansionMode",defaultValue:"defaultValue"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>Xn)),multi:!0},{provide:K,useExisting:c((()=>Xn)),multi:!0}]),t.ɵɵStandaloneFeature],decls:6,vars:3,consts:[["defaultMode",""],["strategyFields",""],[3,"formGroup"],["class","tb-settings",3,"expanded",4,"ngIf","ngIfElse"],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],[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){if(1&e&&(t.ɵɵelementContainerStart(0,2),t.ɵɵtemplate(1,jn,8,6,"mat-expansion-panel",3)(2,Hn,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(4,Yn,9,8,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(3);t.ɵɵproperty("formGroup",n.reportStrategyFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isExpansionMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(Xn,[j,_,qn]),encapsulation:2,changeDetection:d.OnPush})}}e("ReportStrategyComponent",Xn),Ge([I()],Xn.prototype,"isExpansionMode",void 0),Ge([P()],Xn.prototype,"defaultValue",void 0);class Zn{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,D.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||Zn)(t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Zn,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(Zn,[j,_]),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",Zn);class Qn{constructor(){this.tooltipText=""}static{this.ɵfac=function(e){return new(e||Qn)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Qn,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(Qn,[_,j]),styles:["[_nghost-%COMP%]{display:flex;width:40px;height:40px;padding:10px}mat-icon[_ngcontent-%COMP%]{font-size:20px}"]})}}var Jn,ei;e("ErrorTooltipIconComponent",Qn),e("MqttConverterType",Jn),function(e){e.JSON="json",e.BYTES="bytes",e.CUSTOM="custom"}(Jn||e("MqttConverterType",Jn={})),e("MQTTSourceType",ei),function(e){e.MSG="message",e.TOPIC="topic",e.CONST="constant"}(ei||e("MQTTSourceType",ei={}));const ti=e("MqttVersions",[{name:3.1,value:3},{name:3.11,value:4},{name:5,value:5}]),ni=e("QualityTypeTranslationsMap",new Map([[0,"gateway.qos.at-most-once"],[1,"gateway.qos.at-least-once"],[2,"gateway.qos.exactly-once"]])),ii=e("ConvertorTypeTranslationsMap",new Map([[Jn.JSON,"gateway.JSON"],[Jn.BYTES,"gateway.bytes"],[Jn.CUSTOM,"gateway.custom"]]));var ai;e("RequestType",ai),function(e){e.CONNECT_REQUEST="connectRequests",e.DISCONNECT_REQUEST="disconnectRequests",e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(ai||e("RequestType",ai={}));const ri=e("RequestTypesTranslationsMap",new Map([[ai.CONNECT_REQUEST,"gateway.request.connect-request"],[ai.DISCONNECT_REQUEST,"gateway.request.disconnect-request"],[ai.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[ai.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[ai.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]])),oi=e("DataConversionTranslationsMap",new Map([[Jn.JSON,"gateway.JSON-hint"],[Jn.BYTES,"gateway.bytes-hint"],[Jn.CUSTOM,"gateway.custom-hint"]]));var si,li;e("SocketType",si),function(e){e.TCP="TCP",e.UDP="UDP"}(si||e("SocketType",si={})),e("SocketValueKey",li),function(e){e.TIMESERIES="telemetry",e.ATTRIBUTES="attributes",e.ATTRIBUTES_REQUESTS="attributeRequests",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_METHODS="serverSideRpc"}(li||e("SocketValueKey",li={}));const pi=e("SocketKeysPanelTitleTranslationsMap",new Map([[li.ATTRIBUTES,"gateway.attributes"],[li.TIMESERIES,"gateway.timeseries"],[li.ATTRIBUTES_REQUESTS,"gateway.attribute-requests"],[li.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[li.RPC_METHODS,"gateway.rpc-methods"]]));var ci,di;e("RequestsType",ci),function(e){e.Shared="shared",e.Client="client"}(ci||e("RequestsType",ci={})),e("ExpressionType",di),function(e){e.Constant="constant",e.Expression="expression"}(di||e("ExpressionType",di={}));const ui=e("SocketKeysAddKeyTranslationsMap",new Map([[li.ATTRIBUTES,"gateway.add-attribute"],[li.TIMESERIES,"gateway.add-timeseries"],[li.ATTRIBUTES_REQUESTS,"gateway.add-attribute-request"],[li.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[li.RPC_METHODS,"gateway.add-rpc-method"]])),mi=e("SocketKeysDeleteKeyTranslationsMap",new Map([[li.ATTRIBUTES,"gateway.delete-attribute"],[li.TIMESERIES,"gateway.delete-timeseries"],[li.ATTRIBUTES_REQUESTS,"gateway.delete-attribute-request"],[li.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[li.RPC_METHODS,"gateway.delete-rpc-method"]])),hi=e("SocketKeysNoKeysTextTranslationsMap",new Map([[li.ATTRIBUTES,"gateway.no-attributes"],[li.TIMESERIES,"gateway.no-timeseries"],[li.ATTRIBUTES_REQUESTS,"gateway.no-attribute-requests"],[li.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[li.RPC_METHODS,"gateway.no-rpc-methods"]]));var gi,fi,yi,vi;e("RestConverterType",gi),function(e){e.JSON="json",e.CUSTOM="custom"}(gi||e("RestConverterType",gi={})),e("RestSourceType",fi),function(e){e.REQUEST="request",e.CONST="constant"}(fi||e("RestSourceType",fi={})),e("ResponseType",yi),function(e){e.DEFAULT="default",e.CONST="constant",e.ADVANCED="advanced"}(yi||e("ResponseType",yi={})),e("ResponseStatus",vi),function(e){e.OK="OK",e.ERROR="Error"}(vi||e("ResponseStatus",vi={}));const xi=e("ResponseTypeTranslationsMap",new Map([[yi.DEFAULT,"gateway.rest.response-type.default"],[yi.CONST,"gateway.rest.response-type.const"],[yi.ADVANCED,"gateway.rest.response-type.advanced"]]));var bi;e("RestRequestType",bi),function(e){e.ATTRIBUTE_REQUEST="attributeRequests",e.ATTRIBUTE_UPDATE="attributeUpdates",e.SERVER_SIDE_RPC="serverSideRpc"}(bi||e("RestRequestType",bi={}));const wi=e("RestRequestTypesTranslationsMap",new Map([[bi.ATTRIBUTE_REQUEST,"gateway.request.attribute-request"],[bi.ATTRIBUTE_UPDATE,"gateway.request.attribute-update"],[bi.SERVER_SIDE_RPC,"gateway.request.rpc-connection"]]));var Si;e("RestRequestsScopeType",Si),function(e){e.Shared="shared",e.Client="client"}(Si||e("RestRequestsScopeType",Si={}));const Ci=e("RestRequestTypeFieldsMap",new Map([[bi.ATTRIBUTE_REQUEST,["HTTPMethods","endpoint","type","deviceNameExpression","attributeNameExpression"]],[bi.ATTRIBUTE_UPDATE,["HTTPMethod","SSLVerify","deviceNameFilter","attributeFilter","requestUrlExpression","valueExpression","httpHeaders","tries","allowRedirects"]],[bi.SERVER_SIDE_RPC,["HTTPMethod","deviceNameFilter","methodFilter","requestUrlExpression","valueExpression","responseTimeout","httpHeaders","tries"]],["all",["requestType","timeout","security"]]])),_i=e("RestConvertorTypeTranslationsMap",new Map([[gi.JSON,"gateway.JSON"],[gi.CUSTOM,"gateway.custom"]])),Ti=e("RestDataConversionTranslationsMap",new Map([[gi.JSON,"gateway.hints.rest.JSON"],[gi.CUSTOM,"gateway.custom-hint"]]));var Ii;e("PortLimits",Ii),function(e){e[e.MIN=1]="MIN",e[e.MAX=65535]="MAX"}(Ii||e("PortLimits",Ii={}));const Ei=e("GatewayConnectorConfigVersionMap",new Map([[ct.REST,pt.v3_7_2],[ct.KNX,pt.v3_7_0],[ct.BACNET,pt.v3_6_2],[ct.SOCKET,pt.v3_6_0],[ct.MQTT,pt.v3_5_2],[ct.OPCUA,pt.v3_5_2],[ct.MODBUS,pt.v3_5_2]]));var Mi,ki,Pi,Di;e("OPCUaSourceType",Mi),function(e){e.PATH="path",e.IDENTIFIER="identifier",e.CONST="constant"}(Mi||e("OPCUaSourceType",Mi={})),e("SecurityType",ki),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic",e.CERTIFICATES="certificates"}(ki||e("SecurityType",ki={})),e("ModeType",Pi),function(e){e.NONE="None",e.SIGN="Sign",e.SIGNANDENCRYPT="SignAndEncrypt"}(Pi||e("ModeType",Pi={})),e("MappingType",Di),function(e){e.DATA="data",e.REQUESTS="requests",e.OPCUA="OPCua"}(Di||e("MappingType",Di={}));const Oi=e("MappingTypeTranslationsMap",new Map([[Di.DATA,"gateway.data-mapping"],[Di.REQUESTS,"gateway.requests-mapping"],[Di.OPCUA,"gateway.data-mapping"]]));var Ai;e("SecurityPolicy",Ai),function(e){e.BASIC128="Basic128Rsa15",e.BASIC256="Basic256",e.BASIC256SHA="Basic256Sha256"}(Ai||e("SecurityPolicy",Ai={}));const Fi=e("SecurityPolicyTypes",[{value:Ai.BASIC128,name:"Basic128RSA15"},{value:Ai.BASIC256,name:"Basic256"},{value:Ai.BASIC256SHA,name:"Basic256SHA256"}]),Ri=e("SecurityTypeTranslationsMap",new Map([[ki.ANONYMOUS,"gateway.broker.security-types.anonymous"],[ki.BASIC,"gateway.broker.security-types.basic"],[ki.CERTIFICATES,"gateway.broker.security-types.certificates"]])),Bi=e("SourceTypeTranslationsMap",new Map([[ei.MSG,"gateway.source-type.msg"],[ei.TOPIC,"gateway.source-type.topic"],[ei.CONST,"gateway.source-type.const"],[Mi.PATH,"gateway.source-type.path"],[Mi.IDENTIFIER,"gateway.source-type.identifier"],[Mi.CONST,"gateway.source-type.const"],[di.Expression,"gateway.source-type.expression"],[fi.REQUEST,"gateway.source-type.request"]]));var Ni;e("MappingKeysType",Ni),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.CUSTOM="extensionConfig",e.RPC_METHODS="rpc_methods",e.ATTRIBUTES_UPDATES="attributes_updates"}(Ni||e("MappingKeysType",Ni={}));const Li=e("MappingKeysPanelTitleTranslationsMap",new Map([[Ni.ATTRIBUTES,"gateway.attributes"],[Ni.TIMESERIES,"gateway.timeseries"],[Ni.CUSTOM,"gateway.keys"],[Ni.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[Ni.RPC_METHODS,"gateway.rpc-methods"]])),Vi=e("MappingKeysAddKeyTranslationsMap",new Map([[Ni.ATTRIBUTES,"gateway.add-attribute"],[Ni.TIMESERIES,"gateway.add-timeseries"],[Ni.CUSTOM,"gateway.add-key"],[Ni.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[Ni.RPC_METHODS,"gateway.add-rpc-method"]])),qi=e("MappingKeysDeleteKeyTranslationsMap",new Map([[Ni.ATTRIBUTES,"gateway.delete-attribute"],[Ni.TIMESERIES,"gateway.delete-timeseries"],[Ni.CUSTOM,"gateway.delete-key"],[Ni.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[Ni.RPC_METHODS,"gateway.delete-rpc-method"]])),Gi=e("MappingKeysNoKeysTextTranslationsMap",new Map([[Ni.ATTRIBUTES,"gateway.no-attributes"],[Ni.TIMESERIES,"gateway.no-timeseries"],[Ni.CUSTOM,"gateway.no-keys"],[Ni.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[Ni.RPC_METHODS,"gateway.no-rpc-methods"]])),zi=e("QualityTypes",[0,1,2]);var Ui;e("ServerSideRpcType",Ui),function(e){e.WithResponse="twoWay",e.WithoutResponse="oneWay"}(Ui||e("ServerSideRpcType",Ui={}));const ji=e("HelpLinkByMappingTypeMap",new Map([[Di.DATA,O+"/docs/iot-gateway/config/mqtt/#section-mapping"],[Di.OPCUA,O+"/docs/iot-gateway/config/opc-ua/#section-mapping"],[Di.REQUESTS,O+"/docs/iot-gateway/config/mqtt/#requests-mapping"]])),Hi=e("MappingHintTranslationsMap",new Map([[Di.DATA,"gateway.data-mapping-hint"],[Di.OPCUA,"gateway.opcua-data-mapping-hint"],[Di.REQUESTS,"gateway.requests-mapping-hint"]]));var Wi,$i,Ki,Yi,Xi,Zi,Qi,Ji,ea;e("ServerSideRPCType",Wi),function(e){e.ONE_WAY="oneWay",e.TWO_WAY="twoWay"}(Wi||e("ServerSideRPCType",Wi={})),e("SecurityMode",$i),function(e){e.basic="basic",e.certificates="certificates",e.extendedCertificates="extendedCertificates"}($i||e("SecurityMode",$i={})),e("ModbusProtocolType",Ki),function(e){e.TCP="tcp",e.UDP="udp",e.Serial="serial"}(Ki||e("ModbusProtocolType",Ki={})),e("ModbusMethodType",Yi),function(e){e.SOCKET="socket",e.RTU="rtu"}(Yi||e("ModbusMethodType",Yi={})),e("ModbusSerialMethodType",Xi),function(e){e.RTU="rtu",e.ASCII="ascii"}(Xi||e("ModbusSerialMethodType",Xi={})),e("ModbusParity",Zi),function(e){e.Even="E",e.Odd="O",e.None="N"}(Zi||e("ModbusParity",Zi={})),e("ModbusOrderType",Qi),function(e){e.BIG="BIG",e.LITTLE="LITTLE"}(Qi||e("ModbusOrderType",Qi={})),e("ModbusRegisterType",Ji),function(e){e.HoldingRegisters="holding_registers",e.CoilsInitializer="coils_initializer",e.InputRegisters="input_registers",e.DiscreteInputs="discrete_inputs"}(Ji||e("ModbusRegisterType",Ji={})),e("ModbusValueKey",ea),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.ATTRIBUTES_UPDATES="attributeUpdates",e.RPC_REQUESTS="rpc"}(ea||e("ModbusValueKey",ea={}));const ta=e("ModbusBaudrates",[4800,9600,19200,38400,57600,115200,230400,460800,921600]),na=e("ModbusByteSizes",[5,6,7,8]),ia=e("ModbusRegisterTranslationsMap",new Map([[Ji.HoldingRegisters,"gateway.holding_registers"],[Ji.CoilsInitializer,"gateway.coils_initializer"],[Ji.InputRegisters,"gateway.input_registers"],[Ji.DiscreteInputs,"gateway.discrete_inputs"]]));var aa;e("ModbusBitTargetType",aa),function(e){e.BooleanType="bool",e.IntegerType="int"}(aa||e("ModbusBitTargetType",aa={}));const ra=e("ModbusBitTargetTypeTranslationMap",new Map([[aa.BooleanType,"gateway.boolean"],[aa.IntegerType,"gateway.integer"]])),oa=e("ModbusMethodLabelsMap",new Map([[Yi.SOCKET,"Socket"],[Yi.RTU,"RTU"],[Xi.ASCII,"ASCII"]])),sa=e("ModbusProtocolLabelsMap",new Map([[Ki.TCP,"TCP"],[Ki.UDP,"UDP"],[Ki.Serial,"Serial"]])),la=e("ModbusParityLabelsMap",new Map([[Zi.Even,"Even"],[Zi.Odd,"Odd"],[Zi.None,"None"]])),pa=e("ModbusKeysPanelTitleTranslationsMap",new Map([[ea.ATTRIBUTES,"gateway.attributes"],[ea.TIMESERIES,"gateway.timeseries"],[ea.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[ea.RPC_REQUESTS,"gateway.rpc-requests"]])),ca=e("ModbusKeysAddKeyTranslationsMap",new Map([[ea.ATTRIBUTES,"gateway.add-attribute"],[ea.TIMESERIES,"gateway.add-timeseries"],[ea.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[ea.RPC_REQUESTS,"gateway.add-rpc-request"]])),da=e("ModbusKeysDeleteKeyTranslationsMap",new Map([[ea.ATTRIBUTES,"gateway.delete-attribute"],[ea.TIMESERIES,"gateway.delete-timeseries"],[ea.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[ea.RPC_REQUESTS,"gateway.delete-rpc-request"]])),ua=e("ModbusKeysNoKeysTextTranslationsMap",new Map([[ea.ATTRIBUTES,"gateway.no-attributes"],[ea.TIMESERIES,"gateway.no-timeseries"],[ea.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[ea.RPC_REQUESTS,"gateway.no-rpc-requests"]]));var ma;e("ModifierType",ma),function(e){e.DIVIDER="divider",e.MULTIPLIER="multiplier"}(ma||e("ModifierType",ma={}));const ha=e("ModifierTypesMap",new Map([[ma.DIVIDER,{name:"gateway.divider",icon:"mdi:division"}],[ma.MULTIPLIER,{name:"gateway.multiplier",icon:"mdi:multiplication"}]]));var ga,fa;e("DeviceInfoType",ga),function(e){e.FULL="full",e.PARTIAL="partial"}(ga||e("DeviceInfoType",ga={})),e("SegmentationType",fa),function(e){e.BOTH="segmentedBoth",e.TRANSMIT="segmentedTransmit",e.RECEIVE="segmentedReceive",e.NO="noSegmentation"}(fa||e("SegmentationType",fa={}));const ya=e("SegmentationTypeTranslationsMap",new Map([[fa.BOTH,"gateway.bacnet.segmentation.both"],[fa.TRANSMIT,"gateway.bacnet.segmentation.transmit"],[fa.RECEIVE,"gateway.bacnet.segmentation.receive"],[fa.NO,"gateway.bacnet.segmentation.no"]]));var va;e("BacnetDeviceKeysType",va),function(e){e.ATTRIBUTES="attributes",e.TIMESERIES="timeseries",e.RPC_METHODS="serverSideRpc",e.ATTRIBUTES_UPDATES="attributeUpdates"}(va||e("BacnetDeviceKeysType",va={}));const xa=e("BacnetDeviceKeysPanelTitleTranslationsMap",new Map([[va.ATTRIBUTES,"gateway.attributes"],[va.TIMESERIES,"gateway.timeseries"],[va.ATTRIBUTES_UPDATES,"gateway.attribute-updates"],[va.RPC_METHODS,"gateway.rpc-methods"]])),ba=e("BacnetDeviceKeysAddKeyTranslationsMap",new Map([[va.ATTRIBUTES,"gateway.add-attribute"],[va.TIMESERIES,"gateway.add-timeseries"],[va.ATTRIBUTES_UPDATES,"gateway.add-attribute-update"],[va.RPC_METHODS,"gateway.add-rpc-method"]])),wa=e("BacnetDeviceKeysDeleteKeyTranslationsMap",new Map([[va.ATTRIBUTES,"gateway.delete-attribute"],[va.TIMESERIES,"gateway.delete-timeseries"],[va.ATTRIBUTES_UPDATES,"gateway.delete-attribute-update"],[va.RPC_METHODS,"gateway.delete-rpc-method"]])),Sa=e("BacnetDeviceKeysNoKeysTextTranslationsMap",new Map([[va.ATTRIBUTES,"gateway.no-attributes"],[va.TIMESERIES,"gateway.no-timeseries"],[va.ATTRIBUTES_UPDATES,"gateway.no-attribute-updates"],[va.RPC_METHODS,"gateway.no-rpc-methods"]]));var Ca;e("BacnetKeyObjectType",Ca),function(e){e.analogInput="analogInput",e.analogOutput="analogOutput",e.analogValue="analogValue",e.binaryInput="binaryInput",e.binaryOutput="binaryOutput",e.binaryValue="binaryValue"}(Ca||e("BacnetKeyObjectType",Ca={}));const _a=e("BacnetKeyObjectTypeTranslationsMap",new Map([[Ca.analogInput,"gateway.bacnet.object-type.analog-input"],[Ca.analogOutput,"gateway.bacnet.object-type.analog-output"],[Ca.analogValue,"gateway.bacnet.object-type.analog-value"],[Ca.binaryInput,"gateway.bacnet.object-type.binary-input"],[Ca.binaryOutput,"gateway.bacnet.object-type.binary-output"],[Ca.binaryValue,"gateway.bacnet.object-type.binary-value"]]));var Ta;e("BacnetPropertyId",Ta),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"}(Ta||e("BacnetPropertyId",Ta={}));const Ia=e("BacnetPropertyIdByObjectType",new Map([[Ca.analogInput,[Ta.presentValue,Ta.statusFlags,Ta.covIncrement]],[Ca.analogOutput,[Ta.presentValue,Ta.statusFlags,Ta.covIncrement]],[Ca.analogValue,[Ta.presentValue,Ta.statusFlags,Ta.covIncrement]],[Ca.binaryInput,[Ta.presentValue,Ta.statusFlags,Ta.eventState,Ta.outOfService,Ta.polarity]],[Ca.binaryOutput,[Ta.presentValue,Ta.statusFlags,Ta.eventState,Ta.outOfService,Ta.polarity,Ta.priorityArray,Ta.relinquishDefault,Ta.currentCommandPriority,Ta.eventMessageTexts,Ta.eventMessageTextsConfig,Ta.eventAlgorithmInhibitReference,Ta.timeDelayNormal]],[Ca.binaryValue,[Ta.presentValue,Ta.statusFlags,Ta.eventState,Ta.outOfService]]])),Ea=e("BacnetPropertyIdTranslationsMap",new Map([[Ta.presentValue,"gateway.bacnet.property-id.present-value"],[Ta.statusFlags,"gateway.bacnet.property-id.status-flags"],[Ta.covIncrement,"gateway.bacnet.property-id.cov-increment"],[Ta.eventState,"gateway.bacnet.property-id.event-state"],[Ta.outOfService,"gateway.bacnet.property-id.out-of-service"],[Ta.polarity,"gateway.bacnet.property-id.polarity"],[Ta.priorityArray,"gateway.bacnet.property-id.priority-array"],[Ta.relinquishDefault,"gateway.bacnet.property-id.relinquish-default"],[Ta.currentCommandPriority,"gateway.bacnet.property-id.current-command-priority"],[Ta.eventMessageTexts,"gateway.bacnet.property-id.event-message-texts"],[Ta.eventMessageTextsConfig,"gateway.bacnet.property-id.event-message-texts-config"],[Ta.eventAlgorithmInhibitReference,"gateway.bacnet.property-id.event-algorithm-inhibit-reference"],[Ta.timeDelayNormal,"gateway.bacnet.property-id.time-delay-normal"]]));var Ma;e("BacnetRequestType",Ma),function(e){e.Write="writeProperty",e.Read="readProperty"}(Ma||e("BacnetRequestType",Ma={}));const ka=e("BacnetRequestTypeTranslationsMap",new Map([[Ma.Write,"gateway.bacnet.request-type.write"],[Ma.Read,"gateway.bacnet.request-type.read"]]));class Pa{static{this.mqttRequestTypeKeys=Object.values(ai)}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===ai.SERVER_SIDE_RPC&&delete e.type;const{attributeNameExpression:t,deviceInfo:i,...a}=e,r={...a,attributeNameJsonExpression:t||null,deviceNameJsonExpression:i?.deviceNameExpressionSource!==ei.TOPIC?i?.deviceNameExpression:null,deviceNameTopicExpression:i?.deviceNameExpressionSource===ei.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!==Jn.BYTES?{...n,deviceNameJsonExpression:t?.deviceNameExpressionSource===ei.MSG?t.deviceNameExpression:null,deviceTypeJsonExpression:t?.deviceProfileExpressionSource===ei.MSG?t.deviceProfileExpression:null,deviceNameTopicExpression:t?.deviceNameExpressionSource!==ei.MSG?t?.deviceNameExpression:null,deviceTypeTopicExpression:t?.deviceProfileExpressionSource!==ei.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("${")?ei.MSG:e.includes("/")?ei.TOPIC:ei.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===ai.SERVER_SIDE_RPC?1:null,s=t===ai.SERVER_SIDE_RPC?e.responseTopicExpression?Ui.WithResponse:Ui.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",Pa);class Da{constructor(e,t){this.gatewayVersionIn=e,this.connector=t,this.gatewayVersion=za.parseVersion(this.gatewayVersionIn),this.configVersion=za.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=za.parseVersion(Ei.get(this.connector.type)),t=this.gatewayVersion>=e,n=!this.configVersion||this.configVersion=e&&e>this.gatewayVersion}}e("GatewayConnectorVersionProcessor",Da);class Oa extends Da{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.mqttRequestTypeKeys=Object.values(ai)}getUpgradedVersion(){const{connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}=this.connector.configurationJson;let r={...this.connector.configurationJson,requestsMapping:Pa.mapRequestsToUpgradedVersion({connectRequests:e,disconnectRequests:t,attributeRequests:n,attributeUpdates:i,serverSideRpc:a}),mapping:Pa.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?Pa.mapRequestsToDowngradedVersion(e):{},a=Pa.mapMappingToDowngradedVersion(t);return{...this.connector,configurationJson:{...n,...i,mapping:a},configVersion:this.gatewayVersionIn}}cleanUpConfigJson(e){Se(e.requestsMapping,{})&&delete e.requestsMapping,Se(e.mapping,[])&&delete e.mapping}}e("MqttVersionProcessor",Oa);class Aa extends Da{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?Ua.mapMasterToUpgradedVersion(e.master):{slaves:[]},slave:e.slave?Ua.mapSlaveToUpgradedVersion(e.slave):{}},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{...e,slave:e.slave?Ua.mapSlaveToDowngradedVersion(e.slave):{},master:e.master?.slaves?Ua.mapMasterToDowngradedVersion(e.master):{slaves:[]}},configVersion:this.gatewayVersionIn}}}e("ModbusVersionProcessor",Aa);class Fa extends Da{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson.server;return{...this.connector,configurationJson:{server:e?ja.mapServerToUpgradedVersion(e):{},mapping:e?.mapping?ja.mapMappingToUpgradedVersion(e.mapping):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:{server:ja.mapServerToDowngradedVersion(this.connector.configurationJson)},configVersion:this.gatewayVersionIn}}}e("OpcVersionProcessor",Fa);class Ra{constructor(){this.fb=i(Y),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(bn(this.destroyRef)).subscribe((e=>this.onChange(this.mapOnChangeValue(e))))}static{this.ɵfac=function(e){return new(e||Ra)}}static{this.ɵdir=t.ɵɵdefineDirective({type:Ra})}}e("ControlValueAccessorBaseAbstract",Ra);class Ba extends Ra{constructor(){super(...arguments),this.withReportStrategy=!0,this.initialized=new u,this.isLegacy=!1,this.fb=i(Y)}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(Ba)))(n||Ba)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:Ba,inputs:{generalTabContent:"generalTabContent",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},outputs:{initialized:"initialized"},features:[t.ɵɵInputTransformsFeature,t.ɵɵInheritDefinitionFeature]})}}e("GatewayConnectorBasicConfigDirective",Ba);class Na extends Da{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t}getUpgradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{socket:e?Ha.mapSocketToUpgradedVersion(e):{},devices:e?.devices?Ha.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){return{...this.connector,configurationJson:Ha.mapSocketToDowngradedVersion(this.connector.configurationJson),configVersion:this.gatewayVersionIn}}}e("SocketVersionProcessor",Na);class La extends Da{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?Wa.mapApplicationToUpgradedVersion(e.general):{},devices:e?.devices?Wa.mapDevicesToUpgradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}getDowngradedVersion(){const e=this.connector.configurationJson;return{...this.connector,configurationJson:{general:e?.application?Wa.mapApplicationToDowngradedVersion(e.application):{},devices:e?.devices?Wa.mapDevicesToDowngradedVersion(e.devices):[]},configVersion:this.gatewayVersionIn}}}e("BacnetVersionProcessor",La);const Va=["searchInput"];class qa{constructor(){this.withReportStrategy=!0,this.textSearchMode=!1,this.onChange=()=>{},this.translate=i(We),this.dialog=i(Le),this.dialogService=i(Ie),this.fb=i(Y),this.cd=i(h),this.destroyRef=i(a),this.textSearch=this.fb.control("",{nonNullable:!0}),this.entityFormArray=this.fb.array([]),this.entityFormArray.valueChanges.pipe(bn()).subscribe((e=>{this.updateTableData(e),this.onChange(e)})),this.dataSource=this.getDatasource()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),bn(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||qa)}}static{this.ɵdir=t.ɵɵdefineDirective({type:qa,viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(Va,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",qa);class Ga extends Da{constructor(e,t){super(e,t),this.gatewayVersionIn=e,this.connector=t,this.restRequestTypeKeys=Object.values(bi)}getUpgradedVersion(){const{attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}=this.connector.configurationJson;let r={server:za.cleanUpConfigBaseInfo(a),requestsMapping:{attributeRequests:e,attributeUpdates:t,serverSideRpc:n},mapping:$a.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:$a.mapMappingToDowngradedVersion(t)},configVersion:this.gatewayVersionIn}}}e("RestVersionProcessor",Ga);class za{static getConfig(e,t){switch(e.type){case ct.MQTT:return new Oa(t,e).getProcessedByVersion();case ct.OPCUA:return new Fa(t,e).getProcessedByVersion();case ct.MODBUS:return new Aa(t,e).getProcessedByVersion();case ct.SOCKET:return new Na(t,e).getProcessedByVersion();case ct.BACNET:return new La(t,e).getProcessedByVersion();case ct.REST:return new Ga(t,e).getProcessedByVersion();default:return e}}static parseVersion(e){if(Ee(e))return e;if(Me(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",za);class Ua{static mapMasterToUpgradedVersion(e){return{slaves:e.slaves.map((e=>{const{sendDataOnlyOnChange:t,...n}=e;return{...n,deviceType:e.deviceType??"default",reportStrategy:t?{type:Jt.OnChange}:{type:Jt.OnReportPeriod,reportPeriod:e.pollPeriod}}}))}}static mapMasterToDowngradedVersion(e){return{slaves:e.slaves.map((e=>{const{reportStrategy:t,...n}=e;return{...n,sendDataOnlyOnChange:t?.type!==Jt.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?Wt.INT16:e.type})))}),{})}}e("ModbusVersionMappingUtil",Ua);class ja{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 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("${")?Mi.IDENTIFIER:e.includes("/")||e.includes("\\")?Mi.PATH:Mi.CONST}static getDeviceNodeSourceByValue(e){return e.includes("${")?Mi.IDENTIFIER:Mi.PATH}static getArgumentType(e){switch(typeof e){case"boolean":return"boolean";case"number":return Number.isInteger(e)?"integer":"float";default:return"string"}}}e("OpcVersionMappingUtil",ja);class Ha{static mapSocketToUpgradedVersion(e){const{devices:t,...n}=e??{};return za.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("[")?di.Expression:di.Constant}}e("SocketVersionMappingUtil",Ha);class Wa{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("[")?di.Expression:di.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",Wa);class $a{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("${")?fi.REQUEST:fi.CONST}}e("RestVersionMappingUtil",$a);class Ka{transform(e,t){const n=za.parseVersion(e);return t===ct.MODBUS?n>=za.parseVersion(pt.v3_5_2):n>=za.parseVersion(pt.v3_6_0)}static{this.ɵfac=function(e){return new(e||Ka)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"withReportStrategy",type:Ka,pure:!0,standalone:!0})}}function Ya(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 Xa(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 Za(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 Qa(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 Ja(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 er(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 tr(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 nr(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",Ka);class ir extends A{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=O+"/docs/iot-gateway/configuration/#subsection-statistics",this.editCommandFormGroup=this.fb.group({attributeOnGateway:["",[$.required,$.pattern(an),this.uniqNameRequired()]],command:["",[$.required,$.pattern(/^(?=\S).*\S$/)]],timeout:[10,[$.required,$.min(1),$.pattern(nn),$.pattern(/^[^.\s]+$/)]],installCmd:["",$.pattern(an)]}),this.editCommandFormGroup.patchValue(this.data.command,{emitEvent:!1})}cancel(){this.confirmConnectorChange().pipe(ve(Boolean),bn(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):ae(!0)}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=t&&this.data.existingCommands.some((e=>e.toLowerCase()===t))&&t!==this.data.command.attributeOnGateway.toLowerCase();return n?{duplicateName:{valid:!1}}:null}}static{this.ɵfac=function(e){return new(e||ir)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:ir,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,Ya,3,3,"mat-error")(19,Xa,3,3,"mat-error")(20,Za,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,Qa,3,3,"mat-error")(29,Ja,3,3,"mat-error")(30,er,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,tr,3,3,"mat-error")(40,nr,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(ir,[j,_]),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 ar=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},rr=new function(){this.browser=new ar,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?(rr.wxa=!0,rr.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?rr.worker=!0:"undefined"==typeof navigator||0===navigator.userAgent.indexOf("Node.js")?(rr.node=!0,rr.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,rr);var or="sans-serif",sr="12px "+or;var lr,pr,cr=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?Wo(s,o):Wo(o,s))}(o,r,a);if(s)return s(e,n,i),!0}return!1}function Xo(e){return"CANVAS"===e.nodeName.toUpperCase()}var Zo=/([&<>"'])/g,Qo={"&":"&","<":"<",">":">",'"':""","'":"'"};function Jo(e){return null==e?"":(e+"").replace(Zo,(function(e,t){return Qo[t]}))}var es=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ts=[],ns=rr.browser.firefox&&+rr.browser.version.split(".")[0]<39;function is(e,t,n,i){return n=n||{},i?as(e,t,n):ns&&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):as(e,t,n),n}function as(e,t,n){if(rr.domSupported&&e.getBoundingClientRect){var i=t.clientX,a=t.clientY;if(Xo(e)){var r=e.getBoundingClientRect();return n.zrX=i-r.left,void(n.zrY=a-r.top)}if(Yo(ts,e,i,a))return n.zrX=ts[0],void(n.zrY=ts[1])}n.zrX=n.zrY=0}function rs(e){return e||window.event}function os(e,t,n){if(null!=(t=rs(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&&is(e,a,t,n)}else{is(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&&es.test(t.type)&&(t.which=1&o?1:2&o?3:4&o?2:0),t}function ss(e,t,n,i){e.addEventListener(t,n,i)}var ls=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function ps(e){return 2===e.which||3===e.which}var cs=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=ds(a)/ds(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 ms(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function hs(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 gs(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 fs(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 ys(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 vs(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 xs(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 bs(e){var t=[1,0,0,1,0,0];return hs(t,e),t}var ws=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}(),Ss=Math.min,Cs=Math.max,_s=new ws,Ts=new ws,Is=new ws,Es=new ws,Ms=new ws,ks=new ws,Ps=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=Ss(e.x,this.x),n=Ss(e.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Cs(e.x+e.width,this.x+this.width)-t:this.width=e.width,isFinite(this.y)&&isFinite(this.height)?this.height=Cs(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 fs(a,a,[-t.x,-t.y]),vs(a,a,[n,i]),fs(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))}_s.x=Is.x=n.x,_s.y=Es.y=n.y,Ts.x=Es.x=n.x+n.width,Ts.y=Is.y=n.y+n.height,_s.transform(i),Es.transform(i),Ts.transform(i),Is.transform(i),t.x=Ss(_s.x,Ts.x,Is.x,Es.x),t.y=Ss(_s.y,Ts.y,Is.y,Es.y);var l=Cs(_s.x,Ts.x,Is.x,Es.x),p=Cs(_s.y,Ts.y,Is.y,Es.y);t.width=l-t.x,t.height=p-t.y}else t!==n&&e.copy(t,n)},e}(),Ds="silent";function Os(){ls(this.event)}var As=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.handler=null,t}return ze(t,e),t.prototype.dispose=function(){},t.prototype.setCursor=function(){},t}(Uo),Fs=function(e,t){this.x=e,this.y=t},Rs=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Bs=new Ps(0,0,0,0),Ns=function(e){function t(t,n,i,a,r){var o=e.call(this)||this;return o._hovered=new Fs(0,0),o.storage=t,o.painter=n,o.painterRoot=a,o._pointerSize=r,i=i||new As,o.proxy=null,o.setHandlerProxy(i),o._draggingMgr=new zo(o),o}return ze(t,e),t.prototype.setHandlerProxy=function(e){this.proxy&&this.proxy.dispose(),e&&(Rr(Rs,(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 Fs(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 Fs(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:Os}}(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 Fs(e,t);if(Vs(i,a,e,t,n),this._pointerSize&&!a.target){for(var r=[],o=this._pointerSize,s=o/2,l=new Ps(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||(Bs.copy(c.getBoundingRect()),c.transform&&Bs.applyTransform(c.transform),Bs.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=Ls(o,n,i))&&(!t.topTarget&&(t.topTarget=o),s!==Ds)){t.target=o;break}}}function qs(e,t,n){var i=e.painter;return t<0||t>i.getWidth()||n<0||n>i.getHeight()}Rr(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(e){Ns.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||Fo(this._downPoint,[t.zrX,t.zrY])>4)return;this._downPoint=null}this.dispatchToElement(n,e,t)}}));function Gs(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 zs(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 Us(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 js(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 Hs(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=js(e[c],e,l,p,0,t);l+=u,0!==(p-=u)&&0!==(d=Us(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-Us(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=Gs(e,n,i,t))s&&(l=s),zs(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 $s=!1;function Ks(){$s||($s=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function Ys(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var Xs=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=Ys}return e.prototype.traverse=function(e,t){for(var n=0;n0&&(p.__clipPaths=[]),isNaN(p.z)&&(Ks(),p.z=0),isNaN(p.z2)&&(Ks(),p.z2=0),isNaN(p.zlevel)&&(Ks(),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}(),Zs=rr.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)},Qs={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-Qs.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*Qs.bounceIn(2*e):.5*Qs.bounceOut(2*e-1)+.5}},Js=Math.pow,el=Math.sqrt,tl=1e-8,nl=1e-4,il=el(3),al=1/3,rl=Co(),ol=Co(),sl=Co();function ll(e){return e>-1e-8&&etl||e<-1e-8}function cl(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 dl(e,t,n,i,a){var r=1-a;return 3*(((t-e)*r+2*(n-t)*a)*r+(i-n)*a*a)}function ul(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(ll(c)&&ll(d)){if(ll(s))r[0]=0;else(_=-l/s)>=0&&_<=1&&(r[m++]=_)}else{var h=d*d-4*c*u;if(ll(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=el(h),v=c*s+1.5*o*(-d+y),x=c*s+1.5*o*(-d-y);(_=(-s-((v=v<0?-Js(-v,al):Js(v,al))+(x=x<0?-Js(-x,al):Js(x,al))))/(3*o))>=0&&_<=1&&(r[m++]=_)}else{var b=(2*c*s-3*o*d)/(2*el(c*c*c)),w=Math.acos(b)/3,S=el(c),C=Math.cos(w),_=(-s-2*S*C)/(3*o),T=(f=(-s+S*(C+il*Math.sin(w)))/(3*o),(-s+S*(C-il*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 ml(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(ll(o)){if(pl(r))(c=-s/r)>=0&&c<=1&&(a[l++]=c)}else{var p=r*r-4*o*s;if(ll(p))a[0]=-r/(2*o);else if(p>0){var c,d=el(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 hl(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 gl(e,t,n,i,a,r,o,s,l,p,c){var d,u,m,h,g,f=.005,y=1/0;rl[0]=l,rl[1]=p;for(var v=0;v<1;v+=.05)ol[0]=cl(e,n,a,o,v),ol[1]=cl(t,i,r,s,v),(h=Bo(rl,ol))=0&&h=0&&f=1?1:ul(0,i,r,1,e,s)&&cl(0,a,o,1,s[0])}}}var Tl=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||wo,this.ondestroy=e.ondestroy||wo,this.onrestart=e.onrestart||wo,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=jr(e)?e:Qs[e]||_l(e)},e}(),Il=function(e){this.value=e},El=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Il(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}(),Ml=function(){function e(e){this._list=new El,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 Il(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}(),kl={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 Pl(e){return(e=Math.round(e))<0?0:e>255?255:e}function Dl(e){return e<0?0:e>1?1:e}function Ol(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Pl(parseFloat(t)/100*255):Pl(parseInt(t,10))}function Al(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Dl(parseFloat(t)/100):Dl(parseFloat(t))}function Fl(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 Rl(e,t,n){return e+(t-e)*n}function Bl(e,t,n,i,a){return e[0]=t,e[1]=n,e[2]=i,e[3]=a,e}function Nl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var Ll=new Ml(20),Vl=null;function ql(e,t){Vl&&Nl(Vl,t),Vl=Ll.put(e,Vl||t.slice())}function Gl(e,t){if(e){t=t||[];var n=Ll.get(e);if(n)return Nl(t,n);var i=(e+="").replace(/ /g,"").toLowerCase();if(i in kl)return Nl(t,kl[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?(Bl(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 Bl(t,0,0,0,1):7===r||9===r?(a=parseInt(i.slice(1,7),16))>=0&&a<=16777215?(Bl(t,(16711680&a)>>16,(65280&a)>>8,255&a,9===r?parseInt(i.slice(7),16)/255:1),ql(e,t),t):void Bl(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?Bl(t,+p[0],+p[1],+p[2],1):Bl(t,0,0,0,1);c=Al(p.pop());case"rgb":return p.length>=3?(Bl(t,Ol(p[0]),Ol(p[1]),Ol(p[2]),3===p.length?c:Al(p[3])),ql(e,t),t):void Bl(t,0,0,0,1);case"hsla":return 4!==p.length?void Bl(t,0,0,0,1):(p[3]=Al(p[3]),zl(p,t),ql(e,t),t);case"hsl":return 3!==p.length?void Bl(t,0,0,0,1):(zl(p,t),ql(e,t),t);default:return}}Bl(t,0,0,0,1)}}function zl(e,t){var n=(parseFloat(e[0])%360+360)%360/360,i=Al(e[1]),a=Al(e[2]),r=a<=.5?a*(i+1):a+i-a*i,o=2*a-r;return Bl(t=t||[],Pl(255*Fl(o,r,n+1/3)),Pl(255*Fl(o,r,n)),Pl(255*Fl(o,r,n-1/3)),1),4===e.length&&(t[3]=e[3]),t}function Ul(e,t){var n=Gl(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 Kl(n,4===n.length?"rgba":"rgb")}}function jl(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]=Pl(Rl(o[0],s[0],l)),n[1]=Pl(Rl(o[1],s[1],l)),n[2]=Pl(Rl(o[2],s[2],l)),n[3]=Dl(Rl(o[3],s[3],l)),n}}function Hl(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=Gl(t[a]),s=Gl(t[r]),l=i-a,p=Kl([Pl(Rl(o[0],s[0],l)),Pl(Rl(o[1],s[1],l)),Pl(Rl(o[2],s[2],l)),Dl(Rl(o[3],s[3],l))],"rgba");return n?{color:p,leftIndex:a,rightIndex:r,value:i}:p}}function Wl(e,t,n,i){var a=Gl(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]=Al(n)),null!=i&&(a[2]=Al(i)),Kl(zl(a),"rgba")}function $l(e,t){var n=Gl(e);if(n&&null!=t)return n[3]=Dl(t),Kl(n,"rgba")}function Kl(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 Yl(e,t){var n=Gl(e);return n?(.299*n[0]+.587*n[1]+.114*n[2])*n[3]/255+(1-n[3])*t:0}var Xl=new Ml(100);function Zl(e){if(Hr(e)){var t=Xl.get(e);return t||(t=Ul(e,-.1),Xl.put(e,t)),t}if(Qr(e)){var n=kr({},e);return n.colorStops=Br(e.colorStops,(function(e){return{offset:e.offset,color:Ul(e.color,-.1)}})),n}return e}var Ql=Math.round;function Jl(e){var t;if(e&&"transparent"!==e){if("string"==typeof e&&e.indexOf("rgba")>-1){var n=Gl(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 ep=1e-4;function tp(e){return e-1e-4}function np(e){return Ql(1e3*e)/1e3}function ip(e){return Ql(1e4*e)/1e4}var ap={left:"start",right:"end",center:"middle",middle:"middle"};function rp(e){return e&&!!e.image}function op(e){return rp(e)||function(e){return e&&!!e.svgElement}(e)}function sp(e){return"linear"===e.type}function lp(e){return"radial"===e.type}function pp(e){return e&&("linear"===e.type||"radial"===e.type)}function cp(e){return"url(#"+e+")"}function dp(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 up(e){var t=e.x||0,n=e.y||0,i=(e.rotation||0)*So,a=io(e.scaleX,1),r=io(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("+Ql(o*So)+"deg, "+Ql(s*So)+"deg)"),l.join(" ")}var mp=rr.hasGlobalWindow&&jr(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},hp=Array.prototype.slice;function gp(e,t,n){return(t-e)*n+e}function fp(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(Fr(t)){var l=function(e){return Fr(e&&e[0])?2:1}(t);o=l,(1===l&&!$r(t[0])||2===l&&!$r(t[0][0]))&&(r=!0)}else if($r(t)&&!to(t))o=0;else if(Hr(t))if(isNaN(+t)){var p=Gl(t);p&&(s=p,o=3)}else o=0;else if(Qr(t)){var c=kr({},s);c.colorStops=Br(t.colorStops,(function(e){return{offset:e.offset,color:Gl(e.color)}})),sp(t)?o=4:lp(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=jr(n)?n:Qs[n]||_l(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=_p(i),l=Cp(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?Tp:e[c];if(!_p(s)&&!d||f||(f=this._additiveValue=[]),this.discrete)e[c]=g<1?i.rawValue:a.rawValue;else if(_p(s))1===s?fp(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,wp(l),i),this._trackKeys.push(o)}s.addKeyframe(e,wp(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 Mp(){return(new Date).getTime()}var kp,Pp,Dp=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 ze(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=Mp()-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,Zs((function t(){e._running&&(Zs(t),!e._paused&&e.update())}))},t.prototype.start=function(){this._running||(this._time=Mp(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=Mp(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=Mp()-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 Ep(e,t.loop);return this.addAnimator(n),n},t}(Uo),Op=rr.domSupported,Ap=(Pp={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:kp=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:Br(kp,(function(e){var t=e.replace("mouse","pointer");return Pp.hasOwnProperty(t)?t:e}))}),Fp=["mousemove","mouseup"],Rp=["pointermove","pointerup"],Bp=!1;function Np(e){var t=e.pointerType;return"pen"===t||"touch"===t}function Lp(e){e&&(e.zrByTouch=!0)}function Vp(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=wo,this.stopImmediatePropagation=wo,this.preventDefault=wo,this.type=t.type,this.target=this.currentTarget=e.dom,this.pointerType=t.pointerType,this.clientX=t.clientX,this.clientY=t.clientY},Gp={mousedown:function(e){e=os(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=os(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=os(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){Vp(this,(e=os(this.dom,e)).toElement||e.relatedTarget)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){Bp=!0,e=os(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){Bp||(e=os(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){Lp(e=os(this.dom,e)),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),Gp.mousemove.call(this,e),Gp.mousedown.call(this,e)},touchmove:function(e){Lp(e=os(this.dom,e)),this.handler.processGesture(e,"change"),Gp.mousemove.call(this,e)},touchend:function(e){Lp(e=os(this.dom,e)),this.handler.processGesture(e,"end"),Gp.mouseup.call(this,e),+new Date-+this.__lastTouchMoment<300&&Gp.click.call(this,e)},pointerdown:function(e){Gp.mousedown.call(this,e)},pointermove:function(e){Np(e)||Gp.mousemove.call(this,e)},pointerup:function(e){Gp.mouseup.call(this,e)},pointerout:function(e){Np(e)||Gp.mouseout.call(this,e)}};Rr(["click","dblclick","contextmenu"],(function(e){Gp[e]=function(t){t=os(this.dom,t),this.trigger(e,t)}}));var zp={pointermove:function(e){Np(e)||zp.mousemove.call(this,e)},pointerup:function(e){zp.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 Up(e,t){var n=t.domHandlers;rr.pointerEventsSupported?Rr(Ap.pointer,(function(i){Hp(t,i,(function(t){n[i].call(e,t)}))})):(rr.touchEventsSupported&&Rr(Ap.touch,(function(i){Hp(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)}))})),Rr(Ap.mouse,(function(i){Hp(t,i,(function(a){a=rs(a),t.touching||n[i].call(e,a)}))})))}function jp(e,t){function n(n){Hp(t,n,(function(i){i=rs(i),Vp(e,i.target)||(i=function(e,t){return os(e.dom,new qp(e,t),!0)}(e,i),t.domHandlers[n].call(e,i))}),{capture:!0})}rr.pointerEventsSupported?Rr(Rp,n):rr.touchEventsSupported||Rr(Fp,n)}function Hp(e,t,n,i){e.mounted[t]=n,e.listenerOpts[t]=i,ss(e.domTarget,t,n,i)}function Wp(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 $p=function(e,t){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=e,this.domHandlers=t},Kp=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 $p(t,Gp),Op&&(i._globalHandlerScope=new $p(document,zp)),Up(i,i._localHandlerScope),i}return ze(t,e),t.prototype.dispose=function(){Wp(this._localHandlerScope),Op&&Wp(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,Op&&+this.__pointerCapturing^+e){this.__pointerCapturing=e;var t=this._globalHandlerScope;e?jp(this,t):Wp(t)}},t}(Uo),Yp=1;rr.hasGlobalWindow&&(Yp=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var Xp=Yp,Zp="#333",Qp="#ccc",Jp=ms,ec=5e-5;function tc(e){return e>ec||e<-5e-5}var nc=[],ic=[],ac=[1,0,0,1,0,0],rc=Math.abs,oc=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 tc(this.rotation)||tc(this.x)||tc(this.y)||tc(this.scaleX-1)||tc(this.scaleY-1)||tc(this.skewX)||tc(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):Jp(n),e&&(t?gs(n,e,n):hs(n,e)),this.transform=n,this._resolveGlobalScaleRatio(n)):n&&(Jp(n),this.invTransform=null)},e.prototype._resolveGlobalScaleRatio=function(e){var t=this.globalScaleRatio;if(null!=t&&1!==t){this.getGlobalScale(nc);var n=nc[0]<0?-1:1,i=nc[1]<0?-1:1,a=((nc[0]-n)*t+n)/nc[0]||0,r=((nc[1]-i)*t+i)/nc[1]||0;e[0]*=a,e[1]*=a,e[2]*=r,e[3]*=r}this.invTransform=this.invTransform||[1,0,0,1,0,0],xs(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],gs(ic,e.invTransform,t),t=ic);var n=this.originX,i=this.originY;(n||i)&&(ac[4]=n,ac[5]=i,gs(ic,t,ac),ic[4]-=n,ic[5]-=i,t=ic),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&&Lo(n,n,i),n},e.prototype.transformCoordToGlobal=function(e,t){var n=[e,t],i=this.transform;return i&&Lo(n,n,i),n},e.prototype.getLineScale=function(){var e=this.transform;return e&&rc(e[0]-1)>1e-10&&rc(e[3]-1)>1e-10?Math.sqrt(rc(e[0]*e[3]-e[2]*e[1])):1},e.prototype.copyTransform=function(e){lc(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&&ys(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}(),sc=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function lc(e,t){for(var n=0;n=0?parseFloat(e)/100*t:parseFloat(e):e}function yc(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+=fc(i[0],n.width),p+=fc(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 vc="__zr_normal__",xc=sc.concat(["ignore"]),bc=Nr(sc,(function(e,t){return e[t]=!0,e}),{ignore:!1}),wc={},Sc=new Ps(0,0,0,0),Cc=function(){function e(e){this.id=_r(),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=Sc;n.layoutRect?p.copy(n.layoutRect):p.copy(this.getBoundingRect()),i||p.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(wc,n,p):yc(wc,n,p),a.x=wc.x,a.y=wc.y,r=wc.align,o=wc.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=fc(c[0],p.width),u=fc(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()?Qp:Zp},e.prototype.getOutsideStroke=function(e){var t=this.__zr&&this.__zr.getBackgroundColor(),n="string"==typeof t&&Gl(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,Kl(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||{},kr(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(Kr(e))for(var n=qr(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(vc,!1,e)},e.prototype.useState=function(e,t,n,i){var a=e===vc;if(this.hasState()||!a){var r=this.currentStates,o=this.stateTransition;if(!(Dr(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}Tr("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=Dr(i,e),r=Dr(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=Dr(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=Dr(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;n0&&(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 Vc(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 Hr(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 Gc(e){return e.sort((function(e,t){return e-t})),e}function zc(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 Uc(e)}function Uc(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 jc(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 Hc(e,t){var n=Nr(e,(function(e,t){return e+(isNaN(t)?0:t)}),0);if(0===n)return[];for(var i=Math.pow(10,t),a=Br(e,(function(e){return(isNaN(e)?0:e)/n*i*100})),r=100*i,o=Br(a,(function(e){return Math.floor(e)})),s=Nr(o,(function(e,t){return e+t}),0),l=Br(a,(function(e,t){return e-o[t]}));sp&&(p=l[d],c=d);++o[c],l[c]=0,++s}return Br(o,(function(e){return e/i}))}function Wc(e,t){var n=Math.max(zc(e),zc(t)),i=e+t;return n>20?i:qc(i,n)}function $c(e){var t=2*Math.PI;return(e%t+t)%t}function Kc(e){return e>-1e-4&&e=10&&t++,t}function Jc(e,t){var n=Qc(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 ed(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&&Dr(a,s)<0)){var l=n.getShallow(s,t);null!=l&&(r[e[o][0]]=l)}}return r}}var Ud=zd([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),jd=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Ud(this,e,t)},e}(),Hd=new Ml(50);function Wd(e){if("string"==typeof e){var t=Hd.get(e);return t&&t.image}return e}function $d(e,t,n,i,a){if(e){if("string"==typeof e){if(t&&t.__zrImageSrc===e||!n)return t;var r=Hd.get(e),o={hostEl:n,cb:i,cbPayload:a};return r?!Yd(t=r.image)&&r.pending.push(o):((t=dr.loadImage(e,Kd,Kd)).__zrImageSrc=e,Hd.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}return t}function Kd(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=o;l++)s-=o;var p=cc(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 Jd(e,t){var n=t.containerWidth,i=t.font,a=t.contentWidth;if(!n)return"";var r=cc(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?eu(e,a,t.ascCharWidth,t.cnCharWidth):r>0?Math.floor(e.length*a/r):0;r=cc(e=e.substr(0,s),i)}return""===e&&(e=t.placeholder),e}function eu(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=su(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)||!!ru[e]}function su(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 lu="__zr_style_"+Math.round(10*Math.random()),pu={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},cu={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};pu[lu]=!0;var du=["z","z2","invisible"],uu=["invisible"],mu=function(e){function t(t){return e.call(this,t)||this}var n;return ze(t,e),t.prototype._init=function(t){for(var n=qr(t),i=0;i1e-4)return s[0]=e-n,s[1]=t-i,l[0]=e+n,void(l[1]=t+i);if(wu[0]=xu(a)*n+e,wu[1]=vu(a)*i+t,Su[0]=xu(r)*n+e,Su[1]=vu(r)*i+t,p(s,wu,Su),c(l,wu,Su),(a%=bu)<0&&(a+=bu),(r%=bu)<0&&(r+=bu),a>r&&!o?r+=bu:aa&&(Cu[0]=xu(m)*n+e,Cu[1]=vu(m)*i+t,p(s,Cu,s),c(l,Cu,l))}var Du={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Ou=[],Au=[],Fu=[],Ru=[],Bu=[],Nu=[],Lu=Math.min,Vu=Math.max,qu=Math.cos,Gu=Math.sin,zu=Math.abs,Uu=Math.PI,ju=2*Uu,Hu="undefined"!=typeof Float32Array,Wu=[];function $u(e){return Math.round(e/Uu*1e8)/1e8%2*Uu}function Ku(e,t){var n=$u(e[0]);n<0&&(n+=ju);var i=n-e[0],a=e[1];a+=i,!t&&a-n>=ju?a=n+ju:t&&n-a>=ju?a=n-ju:!t&&n>a?a=n+(ju-$u(n-a)):t&&n0&&(this._ux=zu(n/Xp/e)||0,this._uy=zu(n/Xp/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(Du.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=zu(e-this._xi),i=zu(t-this._yi),a=n>this._ux||i>this._uy;if(this.addData(Du.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(Du.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(Du.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(),Wu[0]=i,Wu[1]=a,Ku(Wu,r),i=Wu[0];var o=(a=Wu[1])-i;return this.addData(Du.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=Gu(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(Du.R,e,t,n,i),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Du.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||!Hu||(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(){Fu[0]=Fu[1]=Bu[0]=Bu[1]=Number.MAX_VALUE,Ru[0]=Ru[1]=Nu[0]=Nu[1]=-Number.MAX_VALUE;var e,t=this.data,n=0,i=0,a=0,r=0;for(e=0;en||zu(f)>i||d===t-1)&&(h=Math.sqrt(k*k+f*f),a=g,r=x);break;case Du.C:var y=e[d++],v=e[d++],x=(g=e[d++],e[d++]),b=e[d++],w=e[d++];h=fl(a,r,y,v,g,x,b,w,10),a=b,r=w;break;case Du.Q:h=Sl(a,r,y=e[d++],v=e[d++],g=e[d++],x=e[d++],10),a=g,r=x;break;case Du.A:var S=e[d++],C=e[d++],_=e[d++],T=e[d++],I=e[d++],E=e[d++],M=E+I;d+=1,m&&(o=qu(I)*_+S,s=Gu(I)*T+C),h=Vu(_,T)*Lu(ju,Math.abs(E)),a=qu(M)*_+S,r=Gu(M)*T+C;break;case Du.R:o=a=e[d++],s=r=e[d++],h=2*e[d++]+2*e[d++];break;case Du.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 Du.M:n=a=u[b++],i=r=u[b++],e.moveTo(a,r);break;case Du.L:o=u[b++],s=u[b++];var C=zu(o-a),_=zu(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 I=C*C+_*_;I>x&&(c=o,d=s,x=I)}break;case Du.C:var E=u[b++],M=u[b++],k=u[b++],P=u[b++],D=u[b++],O=u[b++];if(f){if(y+(K=l[v++])>p){hl(a,E,k,D,T=(p-y)/K,Ou),hl(r,M,P,O,T,Au),e.bezierCurveTo(Ou[1],Au[1],Ou[2],Au[2],Ou[3],Au[3]);break e}y+=K}e.bezierCurveTo(E,M,k,P,D,O),a=D,r=O;break;case Du.Q:E=u[b++],M=u[b++],k=u[b++],P=u[b++];if(f){if(y+(K=l[v++])>p){bl(a,E,k,T=(p-y)/K,Ou),bl(r,M,P,T,Au),e.quadraticCurveTo(Ou[1],Au[1],Ou[2],Au[2]);break e}y+=K}e.quadraticCurveTo(E,M,k,P),a=k,r=P;break;case Du.A:var A=u[b++],F=u[b++],R=u[b++],B=u[b++],N=u[b++],L=u[b++],V=u[b++],q=!u[b++],G=R>B?R:B,z=zu(R-B)>.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(A,F,R,B,V,N,U,q):e.arc(A,F,G,N,U,q),j)break e;S&&(n=qu(N)*R+A,i=Gu(N)*B+F),a=qu(U)*R+A,r=Gu(U)*B+F;break;case Du.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+Lu($,H),s),($-=H)>0&&e.lineTo(o+H,s+Lu($,W)),($-=W)>0&&e.lineTo(o+Vu(H-$,0),s+W),($-=H)>0&&e.lineTo(o,s+Vu(W-$,0));break e}y+=K}e.rect(o,s,H,W);break;case Du.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=Du,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function Xu(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+=tm);var u=Math.atan2(l,s);return u<0&&(u+=tm),u>=i&&u<=a||u+tm>=i&&u+tm<=a}function im(e,t,n,i,a,r){if(r>t&&r>i||ra?s:0}var am=Yu.CMD,rm=2*Math.PI;var om=[-1,-1,-1],sm=[-1,-1];function lm(e,t,n,i,a,r,o,s,l,p){if(p>t&&p>i&&p>r&&p>s||p1&&(c=void 0,c=sm[0],sm[0]=sm[1],sm[1]=c),h=cl(t,i,r,s,sm[0]),m>1&&(g=cl(t,i,r,s,sm[1]))),2===m?yt&&s>i&&s>r||s=0&&c<=1&&(a[l++]=c);else{var p=o*o-4*r*s;if(ll(p))(c=-o/(2*r))>=0&&c<=1&&(a[l++]=c);else if(p>0){var c,d=el(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,om);if(0===l)return 0;var p=xl(t,i,r);if(p>=0&&p<=1){for(var c=0,d=yl(t,i,r,p),u=0;un||s<-n)return 0;var l=Math.sqrt(n*n-s*s);om[0]=-l,om[1]=l;var p=Math.abs(i-a);if(p<1e-4)return 0;if(p>=rm-1e-4){i=0,a=rm;var c=r?1:-1;return o>=om[0]+e&&o<=om[1]+e?c:0}if(i>a){var d=i;i=a,a=d}i<0&&(i+=rm,a+=rm);for(var u=0,m=0;m<2;m++){var h=om[m];if(h+e>o){var g=Math.atan2(s,h);c=r?1:-1;g<0&&(g=rm+g),(g>=i&&g<=a||g+rm>=i&&g+rm<=a)&&(g>Math.PI/2&&g<1.5*Math.PI&&(c=-c),u+=c)}}return u}function dm(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+=im(u,m,h,g,i,a))),v&&(h=u=p[f],g=m=p[f+1]),y){case am.M:u=h=p[f++],m=g=p[f++];break;case am.L:if(n){if(Xu(u,m,p[f],p[f+1],t,i,a))return!0}else d+=im(u,m,p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case am.C:if(n){if(Zu(u,m,p[f++],p[f++],p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=lm(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 am.Q:if(n){if(Qu(u,m,p[f++],p[f++],p[f],p[f+1],t,i,a))return!0}else d+=pm(u,m,p[f++],p[f++],p[f],p[f+1],i,a)||0;u=p[f++],m=p[f++];break;case am.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+=im(u,m,r,o,i,a);var I=(i-x)*S/w+x;if(n){if(nm(x,b,S,C,C+_,T,t,I,a))return!0}else d+=cm(x,b,S,C,C+_,T,I,a);u=Math.cos(C+_)*w+x,m=Math.sin(C+_)*S+b;break;case am.R:if(h=u=p[f++],g=m=p[f++],r=h+p[f++],o=g+p[f++],n){if(Xu(h,g,r,g,t,i,a)||Xu(r,g,r,o,t,i,a)||Xu(r,o,h,o,t,i,a)||Xu(h,o,h,g,t,i,a))return!0}else d+=im(r,g,r,o,i,a),d+=im(h,o,h,g,i,a);break;case am.Z:if(n){if(Xu(u,m,h,g,t,i,a))return!0}else d+=im(u,m,h,g,i,a);u=h,m=g}}return n||(s=m,l=g,Math.abs(s-l)<1e-4)||(d+=im(u,m,h,g,i,a)||0),0!==d}var um=Pr({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},pu),mm={style:Pr({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},cu.style)},hm=sc.concat(["invisible","culling","z","z2","zlevel","parent"]),gm=function(e){function t(t){return e.call(this,t)||this}var n;return ze(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?Zp:t>.2?"#eee":Qp}if(e)return Qp}return Zp},t.prototype.getInsideTextStroke=function(e){var t=this.style.fill;if(Hr(t)){var n=this.__zr;if(!(!n||!n.isDarkMode())===Yl(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 Yu(!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 dm(e,t,!0,n,i)}(r,o/s,e,t)))return!0}if(this.hasFill())return function(e,t,n){return dm(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:kr(n,e),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(4&this.__dirty)},t.prototype.createStyle=function(e){return vo(um,e)},t.prototype._innerSaveToNormal=function(t){e.prototype._innerSaveToNormal.call(this,t);var n=this._normalState;t.shape&&!n.shape&&(n.shape=kr({},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=kr({},i.shape),kr(s,n.shape)):(s=kr({},a?this.shape:i.shape),kr(s,n.shape)):l&&(s=i.shape),s)if(r){this.shape=kr({},this.shape);for(var p={},c=qr(s),d=0;d0},t.prototype.hasFill=function(){var e=this.style.fill;return null!=e&&"none"!==e},t.prototype.createStyle=function(e){return vo(fm,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=uc(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}(mu);ym.prototype.type="tspan";var vm=Pr({x:0,y:0},pu),xm={style:Pr({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},cu.style)};var bm=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.createStyle=function(e){return vo(vm,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 xm},t.prototype.getBoundingRect=function(){var e=this.style;return this._rect||(this._rect=new Ps(e.x||0,e.y||0,this.getWidth(),this.getHeight())),this._rect},t}(mu);bm.prototype.type="image";var wm=Math.round;function Sm(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?(wm(2*i)===wm(2*a)&&(e.x1=e.x2=_m(i,s,!0)),wm(2*r)===wm(2*o)&&(e.y1=e.y2=_m(r,s,!0)),e):e}}function Cm(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=_m(i,s,!0),e.y=_m(a,s,!0),e.width=Math.max(_m(i+r,s,!1)-e.x,0===r?0:1),e.height=Math.max(_m(a+o,s,!1)-e.y,0===o?0:1),e):e}}function _m(e,t,n){if(!t)return e;var i=wm(2*e);return(i+wm(t))%2==0?i/2:(i+(n?1:-1))/2}var Tm=function(){this.x=0,this.y=0,this.width=0,this.height=0},Im={},Em=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new Tm},t.prototype.buildPath=function(e,t){var n,i,a,r;if(this.subPixelOptimize){var o=Cm(Im,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}(gm);Em.prototype.type="rect";var Mm={fill:"#000"},km={style:Pr({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},cu.style)},Pm=function(e){function t(t){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=Mm,n.attr(t),n}return ze(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=Qd(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),I=i.calculatedLineHeight,E=0;El&&au(n,e.substring(l,p),t,s),au(n,i[2],t,s,i[1]),l=Xd.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 E=S.width,M=null==E||"auto"===E;if("string"==typeof E&&"%"===E.charAt(E.length-1))O.percentWidth=E,c.push(O),O.contentWidth=cc(O.text,T);else{if(M){var k=S.backgroundColor,P=k&&k.image;P&&Yd(P=Wd(P))&&(O.width=Math.max(O.width,P.width*I/P.height))}var D=h&&null!=a?a-b:null;null!=D&&D=0&&"right"===(E=x[I]).align;)this._placeToken(E,e,w,h,T,"right",f),S-=E.width,T-=E.width,I--;for(_+=(n-(_-m)-(g-T)-S)/2;C<=I;)E=x[C],this._placeToken(E,e,w,h,_+E.width/2,"center",f),_+=E.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&&zm(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=qm(a,r,d),p-=e.height/2-d[0]-e.innerHeight/2);var u=this._getOrCreateChild(ym),m=u.createStyle();u.useStyle(m);var h=this._defaultStyle,g=!1,f=0,y=Vm("fill"in s?s.fill:"fill"in t?t.fill:(g=!0,h.fill)),v=Lm("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||sr,m.opacity=ao(s.opacity,t.opacity,1),Rm(m,s),v&&(m.lineWidth=ao(s.lineWidth,t.lineWidth,f),m.lineDash=io(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 Ps(mc(m.x,b,m.textAlign),hc(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(Em)).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=io(e.fillOpacity,1);else if(u){(s=this._getOrCreateChild(bm)).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=io(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=ao(e.opacity,t.opacity,1)},t.makeFont=function(e){var t="";return Bm(e)&&(t=[e.fontStyle,e.fontWeight,Fm(e.fontSize),e.fontFamily||"sans-serif"].join(" ")),t&&lo(t)||e.textFont||e.font},t}(mu),Dm={left:!0,right:1,center:1},Om={top:1,bottom:1,middle:1},Am=["fontStyle","fontWeight","fontSize","fontFamily"];function Fm(e){return"string"!=typeof e||-1===e.indexOf("px")&&-1===e.indexOf("rem")&&-1===e.indexOf("em")?isNaN(+e)?"12px":e+"px":e}function Rm(e,t){for(var n=0;n=0,r=!1;if(e instanceof gm){var o=$m(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(ih(s)||ih(l)){var p=(i=i||{}).style||{};"inherit"===p.fill?(r=!0,i=kr({},i),(p=kr({},p)).fill=s):!ih(p.fill)&&ih(s)?(r=!0,i=kr({},i),(p=kr({},p)).fill=Zl(s)):!ih(p.stroke)&&ih(l)&&(r||(i=kr({},i),p=kr({},p)),p.stroke=Zl(l)),i.style=p}}if(i&&null==i.z2){r||(i=kr({},i));var c=e.z2EmphasisLift;i.z2=e.z2+(null!=c?c:Zm)}return i}(this,0,t,n);if("blur"===e)return function(e,t,n){var i=Dr(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 Dh(e,t,n){Nh(e,!0),uh(e,gh),Ah(e,t,n)}function Oh(e,t,n,i){i?function(e){Nh(e,!1)}(e):Dh(e,t,n)}function Ah(e,t,n){var i=Um(e);null!=t?(i.focus=t,i.blurScope=n):i.focus&&(i.focus=null)}var Fh=["emphasis","blur","select"],Rh={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Bh(e,t,n,i){n=n||"itemStyle";for(var a=0;a1&&(o*=Wh(h),s*=Wh(h));var g=(a===r?-1:1)*Wh((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+Kh(d)*f-$h(d)*y,x=(t+i)/2+$h(d)*f+Kh(d)*y,b=Qh([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=Qh(w,S);if(Zh(w,S)<=-1&&(C=Yh),Zh(w,S)>=1&&(C=0),C<0){var _=Math.round(C/Yh*1e6)/1e6;C=2*Yh+_%2*Yh}c.addData(p,v,x,o,s,b,C,d,r)}var eg=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,tg=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var ng=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.applyTransform=function(e){},t}(gm);function ig(e){return null!=e.setData}function ag(e,t){var n=function(e){var t=new Yu;if(!e)return t;var n,i=0,a=0,r=i,o=a,s=Yu.CMD,l=e.match(eg);if(!l)return t;for(var p=0;pP*P+D*D&&(_=I,T=E),{cx:_,cy:T,x0:-c,y0:-d,x1:_*(a/w-1),y1:T*(a/w-1)}}function Sg(e,t){var n,i=vg(t.r,0),a=vg(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=fg(l-s),m=u>dg&&u%dg;if(m>bg&&(u=m),i>bg)if(u>dg-bg)e.moveTo(p+i*mg(s),c+i*ug(s)),e.arc(p,c,i,s,l,!d),a>bg&&(e.moveTo(p+a*mg(l),c+a*ug(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,I=void 0,E=void 0,M=void 0,k=void 0,P=i*mg(s),D=i*ug(s),O=a*mg(l),A=a*ug(l),F=u>bg;if(F){var R=t.cornerRadius;R&&(n=function(e){var t;if(Ur(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}(R),h=n[0],g=n[1],f=n[2],y=n[3]);var B=fg(i-a)/2;if(v=xg(B,f),x=xg(B,y),b=xg(B,h),w=xg(B,g),_=S=vg(v,x),T=C=vg(b,w),(S>bg||C>bg)&&(I=i*mg(l),E=i*ug(l),M=a*mg(s),k=a*ug(s),ubg){var j=xg(f,_),H=xg(y,_),W=wg(M,k,P,D,i,j,d),$=wg(I,E,O,A,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,gg(W.y0,W.x0),gg(W.y1,W.x1),!d),e.arc(p,c,i,gg(W.cy+W.y1,W.cx+W.x1),gg($.cy+$.y1,$.cx+$.x1),!d),H>0&&e.arc(p+$.cx,c+$.cy,H,gg($.y1,$.x1),gg($.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>bg&&F)if(T>bg){j=xg(h,T),W=wg(O,A,I,E,a,-(H=xg(g,T)),d),$=wg(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,gg(W.y0,W.x0),gg(W.y1,W.x1),!d),e.arc(p,c,a,gg(W.cy+W.y1,W.cx+W.x1),gg($.cy+$.y1,$.cx+$.x1),d),j>0&&e.arc(p+$.cx,c+$.cy,j,gg($.y1,$.x1),gg($.y0,$.x0),!d))}else e.lineTo(p+O,c+A),e.arc(p,c,a,l,s,d);else e.lineTo(p+O,c+A)}else e.moveTo(p,c);e.closePath()}}}var Cg=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},_g=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new Cg},t.prototype.buildPath=function(e,t){Sg(e,t)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(gm);_g.prototype.type="sector";var Tg=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},Ig=function(e){function t(t){return e.call(this,t)||this}return ze(t,e),t.prototype.getDefaultShape=function(){return new Tg},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}(gm);function Eg(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;uWg[1]){if(o=!1,a)return o;var p=Math.abs(Wg[0]-Hg[1]),c=Math.abs(Hg[0]-Wg[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 tf(e,t,n,i,a,r){ef("update",e,t,n,i,a,r)}function nf(e,t,n,i,a,r){ef("enter",e,t,n,i,a,r)}function af(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 Ef(e){return!e.isGroup}function Mf(e,t,n){if(e&&t){var i,a=(i={},e.traverse((function(e){Ef(e)&&e.anid&&(i[e.anid]=e)})),i);t.traverse((function(e){if(Ef(e)&&e.anid){var t=a[e.anid];if(t){var i=r(e);e.attr(r(t)),tf(e,i,n,Um(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=kr({},e.shape)),t}}function kf(e,t){return Br(e,(function(e){var n=e[0];n=pf(n,t.x),n=cf(n,t.x+t.width);var i=e[1];return i=pf(i,t.y),[n,i=cf(i,t.y+t.height)]}))}function Pf(e,t){var n=pf(e.x,t.x),i=cf(e.x+e.width,t.x+t.width),a=pf(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 Df(e,t,n){var i=kr({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),Pr(a,n),new bm(i)):yf(e.replace("path://",""),i,n,"center")}function Of(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=Ff(h,g,p,c)/m;if(f<0||f>1)return!1;var y=Ff(h,g,d,u)/m;return!(y<0||y>1)}function Ff(e,t,n,i){return e*i-n*t}function Rf(e){var t=e.itemTooltipOption,n=e.componentModel,i=e.itemName,a=Hr(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&&Rr(qr(l),(function(e){bo(s,e)||(s[e]=l[e],s.$vars.push(e))}));var p=Um(e.el);p.componentMainType=r,p.componentIndex=o,p.tooltipConfig={name:i,option:Pr({content:i,formatterParams:s},a)}}function Bf(e,t){var n;e.isGroup&&(n=t(e)),n||e.traverse(t)}function Nf(e,t){if(e)if(Ur(e))for(var n=0;n-1?fy:vy;function Sy(e,t){e=e.toUpperCase(),by[e]=new uy(t),xy[e]=t}function Cy(e){return by[e]}Sy(yy,{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:". "}}}}),Sy(fy,{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 _y=1e3,Ty=6e4,Iy=36e5,Ey=864e5,My=31536e6,ky={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}"},Py="{yyyy}-{MM}-{dd}",Dy={year:"{yyyy}",month:"{yyyy}-{MM}",day:Py,hour:Py+" "+ky.hour,minute:Py+" "+ky.minute,second:Py+" "+ky.second,millisecond:ky.none},Oy=["year","month","day","hour","minute","second","millisecond"],Ay=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function Fy(e,t){return"0000".substr(0,t-(e+="").length)+e}function Ry(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 By(e){return e===Ry(e)}function Ny(e,t,n,i){var a=Xc(e),r=a[qy(n)](),o=a[Gy(n)]()+1,s=Math.floor((o-1)/3)+1,l=a[zy(n)](),p=a["get"+(n?"UTC":"")+"Day"](),c=a[Uy(n)](),d=(c-1)%12+1,u=a[jy(n)](),m=a[Hy(n)](),h=a[Wy(n)](),g=(i instanceof uy?i:Cy(i||wy)||by[vy]).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,Fy(r%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,f[o-1]).replace(/{MMM}/g,y[o-1]).replace(/{MM}/g,Fy(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Fy(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,v[p]).replace(/{ee}/g,x[p]).replace(/{e}/g,p+"").replace(/{HH}/g,Fy(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,Fy(d+"",2)).replace(/{h}/g,d+"").replace(/{mm}/g,Fy(u,2)).replace(/{m}/g,u+"").replace(/{ss}/g,Fy(m,2)).replace(/{s}/g,m+"").replace(/{SSS}/g,Fy(h,3)).replace(/{S}/g,h+"")}function Ly(e,t){var n=Xc(e),i=n[Gy(t)]()+1,a=n[zy(t)](),r=n[Uy(t)](),o=n[jy(t)](),s=n[Hy(t)](),l=0===n[Wy(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 Vy(e,t,n){var i=$r(e)?Xc(e):e;switch(t=t||Ly(e,n)){case"year":return i[qy(n)]();case"half-year":return i[Gy(n)]()>=6?1:0;case"quarter":return Math.floor((i[Gy(n)]()+1)/4);case"month":return i[Gy(n)]();case"day":return i[zy(n)]();case"half-day":return i[Uy(n)]()/24;case"hour":return i[Uy(n)]();case"minute":return i[jy(n)]();case"second":return i[Hy(n)]();case"millisecond":return i[Wy(n)]()}}function qy(e){return e?"getUTCFullYear":"getFullYear"}function Gy(e){return e?"getUTCMonth":"getMonth"}function zy(e){return e?"getUTCDate":"getDate"}function Uy(e){return e?"getUTCHours":"getHours"}function jy(e){return e?"getUTCMinutes":"getMinutes"}function Hy(e){return e?"getUTCSeconds":"getSeconds"}function Wy(e){return e?"getUTCMilliseconds":"getMilliseconds"}function $y(e){return e?"setUTCFullYear":"setFullYear"}function Ky(e){return e?"setUTCMonth":"setMonth"}function Yy(e){return e?"setUTCDate":"setDate"}function Xy(e){return e?"setUTCHours":"setHours"}function Zy(e){return e?"setUTCMinutes":"setMinutes"}function Qy(e){return e?"setUTCSeconds":"setSeconds"}function Jy(e){return e?"setUTCMilliseconds":"setMilliseconds"}function ev(e){if(!nd(e))return Hr(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function tv(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 nv=oo;function iv(e,t,n){function i(e){return e&&lo(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?Xc(e):e;if(!isNaN(+s))return Ny(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n);if(o)return"-"}if("ordinal"===t)return Wr(e)?i(e):$r(e)&&a(e)?e+"":"-";var l=td(e);return a(l)?ev(l):Wr(e)?i(e):"boolean"==typeof e?e+"":"-"}var av=["a","b","c","d","e","f","g"],rv=function(e,t){return"{"+e+(null==t?"":t)+"}"};function ov(e,t,n){Ur(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 lv(e,t){return t=t||"transparent",Hr(e)?e:Kr(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function pv(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=Rr,dv=["left","right","top","bottom","width","height"],uv=[["width","left","right"],["height","top","bottom"]];function mv(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 hv=mv;zr(mv,"vertical"),zr(mv,"horizontal");function gv(e,t,n){n=nv(n||0);var i=t.width,a=t.height,r=Vc(e.left,i),o=Vc(e.top,a),s=Vc(e.right,i),l=Vc(e.bottom,a),p=Vc(e.width,i),c=Vc(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 Ps(r+n[3],o+n[0],p,c);return h.margin=n,h}function fv(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 Ps(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=gv(Pr({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 yv(e){var t=e.layoutMode||e.constructor.layoutMode;return Kr(t)?t:t?{type:t}:null}function vv(e,t,n){var i=n&&n.ignoreSize;!Ur(i)&&(i=[i,i]);var a=o(uv[0],0),r=o(uv[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=Er(r,n[o],!0);t.defaultOption=r}return t.defaultOption},t.prototype.getReferringComponents=function(e,t){var n=e+"Index",i=e+"Id";return kd(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}(uy);Nd(Sv,uy),Gd(Sv),function(e){var t={};e.registerSubTypeDefaulter=function(e,n){var i=Rd(e);t[i.main]=n},e.determineSubType=function(n,i){var a=i.type;if(!a){var r=Rd(n).main;e.hasSubTypes(n)&&t[r]&&(a=t[r](i))}return a}}(Sv),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 Rr(e,(function(r){var o=n(i,r),s=function(e,t){var n=[];return Rr(e,(function(e){Dr(t,e)>=0&&n.push(e)})),n}(o.originalDeps=t(r),e);o.entryCount=s.length,0===o.entryCount&&a.push(r),Rr(s,(function(e){Dr(o.predecessor,e)<0&&o.predecessor.push(e);var t=n(i,e);Dr(t.successor,e)<0&&t.successor.push(r)}))})),{graph:i,noEntryList:a}}(i),s=o.graph,l=o.noEntryList,p={};for(Rr(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]),Rr(d.successor,u?h:m)}Rr(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)}}}(Sv,(function(e){var t=[];Rr(Sv.getClassesByMainType(e),(function(e){t=t.concat(e.dependencies||e.prototype.dependencies||[])})),t=Br(t,(function(e){return Rd(e).main})),"dataset"!==e&&Dr(t,"dataset")<=0&&t.unshift("dataset");return t}));var Cv="";"undefined"!=typeof navigator&&(Cv=navigator.platform||"");var _v="rgba(0, 0, 0, 0.2)",Tv={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:_v,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:_v,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:_v,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:_v,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:_v,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:_v,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:Cv.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},Iv=fo(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Ev="original",Mv="arrayRows",kv="objectRows",Pv="keyedColumns",Dv="typedArray",Ov="unknown",Av="column",Fv="row",Rv=1,Bv=2,Nv=3,Lv=Cd();function Vv(e,t,n){var i={},a=Gv(t);if(!a||!e)return i;var r,o,s=[],l=[],p=t.ecModel,c=Lv(p).datasetMap,d=a.uid+"_"+n.seriesLayoutBy;Rr(e=e.slice(),(function(t,n){var a=Kr(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 Jv="\0_ec_inner";var ex=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.init=function(e,t,n,i,a,r){i=i||{},this.option=null,this._theme=new uy(i),this._locale=new uy(a),this._optionManager=r},t.prototype.setOption=function(e,t,n){var i=ix(t);this._optionManager.setOption(e,n,i),this._resetOption(null,i)},t.prototype.resetOption=function(e,t){return this._resetOption(e,ix(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)):$v(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&&Rr(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=fo(),s=t&&t.replaceMergeMainTypeMap;Lv(this).datasetMap=fo(),Rr(e,(function(e,t){null!=e&&(Sv.hasClass(t)?t&&(r.push(t),o.set(t,!0)):n[t]=null==n[t]?Ir(e):Er(n[t],e,!0))})),s&&s.each((function(e,t){Sv.hasClass(t)&&!o.get(t)&&(r.push(t),o.set(t,!0))})),Sv.topologicalTravel(r,Sv.getAllClassMainTypes(),(function(t){var r=function(e,t,n){var i=jv.get(t);if(!i)return n;var a=i(e);return a?n.concat(a):n}(this,t,dd(e[t])),o=i.get(t),l=o?s&&s.get(t)?"replaceMerge":"normalMerge":"replaceAll",p=fd(o,r,l);(function(e,t,n){Rr(e,(function(e){var i=e.newOption;Kr(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,Sv),n[t]=null,i.set(t,null),a.set(t,0);var c,d=[],u=[],m=0;Rr(p,(function(e,n){var i=e.existing,a=e.newOption;if(a){var r="series"===t,o=Sv.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=kr({componentIndex:n},e.keyInfo);kr(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&&Hv(this)}),this),this._seriesIndices||Hv(this)},t.prototype.getOption=function(){var e=Ir(this.option);return Rr(e,(function(t,n){if(Sv.hasClass(n)){for(var i=dd(t),a=i.length,r=!1,o=a-1;o>=0;o--)i[o]&&!wd(i[o])?r=!0:(i[o]=null,!r&&a--);i.length=a,e[n]=i}})),delete e[Jv],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 dx=Rr,ux=Kr,mx=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function hx(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=Wc(m,y),h=y;break}}}return i[0]=m,i[1]=h,i}))}))}var Ax,Fx,Rx,Bx,Nx,Lx=function(e){this.data=e.data||(e.sourceFormat===Pv?{}:[]),this.sourceFormat=e.sourceFormat||Ov,this.seriesLayoutBy=e.seriesLayoutBy||Av,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 ib(this.getData(t),e)},e.prototype.formatTooltip=function(e,t,n){},e}();function ob(e){var t,n;return Kr(e)?e.type&&(n=e):t=e,{text:t,frag:n}}function sb(e){return new lb(e)}var lb=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}},hb=function(){function e(e,t){if(!$r(t)){var n="";0,sd(n)}this._opFn=mb[e],this._rvalFloat=td(t)}return e.prototype.evaluate=function(e){return $r(e)?this._opFn(e,this._rvalFloat):this._opFn(td(e),this._rvalFloat)},e}(),gb=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=$r(e)?e:td(e),i=$r(t)?t:td(t),a=isNaN(n),r=isNaN(i);if(a&&(n=this._incomparable),r&&(i=this._incomparable),a&&r){var o=Hr(e),s=Hr(t);o&&(n=s?e:0),s&&(i=o?t:0)}return ni?-this._resultLT:0},e}(),fb=function(){function e(e,t){this._rval=t,this._isEQ=e,this._rvalTypeof=typeof t,this._rvalFloat=td(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=td(e)===this._rvalFloat)}return this._isEQ?t:!t},e}();function yb(e,t){return"eq"===e||"ne"===e?new fb("eq"===e,t):bo(mb,e)?new hb(e,t):null}var vb=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 xb(e){var t=e.sourceFormat;if(!Tb(t)){var n="";0,sd(n)}return e.data}function bb(e){var t=e.sourceFormat,n=e.data;if(!Tb(t)){var i="";0,sd(i)}if(t===Mv){for(var a=[],r=0,o=n.length;r65535?Mb:kb}function Fb(e,t,n,i,a){var r=Ob[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=Br(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(Ab(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])}Ib={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}(),Bb=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(Lb(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=Xr(o=r.get("data",!0))?Dv:Ev,t=[];var c=this._getSourceMetaRawOption()||{},d=l&&l.metaRawOption||{},u=io(c.seriesLayoutBy,d.seriesLayoutBy)||null,m=io(c.sourceHeader,d.sourceHeader),h=io(c.dimensions,d.dimensions);e=u!==d.seriesLayoutBy||!!m!=!!d.sourceHeader||h?[qx(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=[qx(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&&Vb(r)}var o,s=[],l=[];return Rr(e,(function(e){e.prepareSource();var t=e.getSource(a||0),n="";null==a||t||Vb(n),s.push(t),l.push(e._getVersionSign())})),i?t=function(e,t){var n=dd(e),i=n.length,a="";i||sd(a);for(var r=0,o=i;r1||n>0&&!e.noHeader;return Rr(e.blocks,(function(e){var n=$b(e);n>=t&&(t=n+ +(i&&(!n||Hb(e)&&!e.noHeader)))})),t}return 0}function Kb(e,t,n,i){var a,r=t.noHeader,o=(a=$b(t),{html:zb[a],richText:Ub[a]}),s=[],l=t.blocks||[];so(!l||Ur(l)),l=l||[];var p=e.orderMode;if(t.sortBlocks&&p){l=l.slice();var c={valueAsc:"asc",valueDesc:"desc"};if(bo(c,p)){var d=new gb(c[p],null);l.sort((function(e,t){return d.evaluate(e.sortParam,t.sortParam)}))}else"seriesDesc"===p&&l.reverse()}Rr(l,(function(n,a){var r=t.valueFormatter,l=Wb(n)(r?kr(kr({},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):Zb(s.join(""),r?n:o.html);if(r)return u;var m=iv(t.header,"ordinal",e.useUTC),h=Gb(i,e.renderMode).nameStyle;return"richText"===e.renderMode?Qb(e,m,h)+o.richText+u:Zb('
    '+Jo(m)+"
    "+u,n)}function Yb(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 Br(e=Ur(e)?e:[e],(function(e,t){return iv(e,Ur(m)?m[t]:m,p)}))};if(!r||!o){var d=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||"#333",a),u=r?"":iv(l,"ordinal",p),m=t.valueType,h=o?[]:c(t.value,t.dataIndex),g=!s||!r,f=!s&&r,y=Gb(i,a),v=y.nameStyle,x=y.valueStyle;return"richText"===a?(s?"":d)+(r?"":Qb(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(Ur(t)?t.join(" "):t,r)}(e,h,g,f,x)):Zb((s?"":d)+(r?"":function(e,t,n){return''+Jo(e)+""}(u,!s,v))+(o?"":function(e,t,n,i){var a=n?"10px":"20px",r=t?"float:right;margin-left:"+a:"";return e=Ur(e)?e:[e],''+Br(e,(function(e){return Jo(e)})).join("  ")+""}(h,g,f,x)),n)}}function Xb(e,t,n,i,a,r){if(e)return Wb(e)({useUTC:a,renderMode:n,orderMode:i,markupStyleCreator:t,valueFormatter:e.valueFormatter},e,0,r)}function Zb(e,t){return'
    '+e+'
    '}function Qb(e,t,n){return e.markupStyleCreator.wrapRichTextStyle(t,n)}function Jb(e,t){return lv(e.getData().getItemVisual(t,"style")[e.visualDrawType])}function ew(e,t){var n=e.get("padding");return null!=n?n:"richText"===t?[8,10]:10}var tw=function(){function e(){this.richTextStyles={},this._nextStyleNameId=id()}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=sv({color:t,type:e,renderMode:n,markerId:i});return Hr(a)?a:(this.richTextStyles[i]=a.style,a.content)},e.prototype.wrapRichTextStyle=function(e,t){var n={};Ur(t)?Rr(t,(function(e){return kr(n,e)})):kr(n,t);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+e+"}"},e}();function nw(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=Ur(d),m=Jb(r,o);if(c>1||u&&!c){var h=function(e,t,n,i,a){var r=t.getData(),o=Nr(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(jb("nameValue",{markerType:"subItem",markerColor:a,name:n.displayName,value:e,valueType:n.type})):(s.push(e),l.push(n.type)))}return i.length?Rr(i,(function(e){c(ib(r,n,e),e)})):Rr(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=ib(l,o,p[0]),n=g.type}else a=t=u?d[0]:d;var f=bd(r),y=f&&r.name||"",v=l.getName(o),x=s?y:v;return jb("section",{header:y,noHeader:s||!f,sortParam:a,blocks:[jb("nameValue",{markerType:"item",markerColor:m,name:x,noName:!lo(x),value:t,valueType:n,dataIndex:o})].concat(i||[])})}var iw=Cd();function aw(e,t){return e.getName(t)||e.getId(t)}var rw="__universalTransitionEnabled",ow=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._selectedDataIndicesMap={},t}return ze(t,e),t.prototype.init=function(e,t,n){this.seriesIndex=this.componentIndex,this.dataTask=sb({count:lw,reset:pw}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(e,n),(iw(this).sourceManager=new Bb(this)).prepareSource();var i=this.getInitialData(e,n);dw(i,this),this.dataTask.context.data=i,iw(this).dataBeforeProcessed=i,sw(this),this._initSelectedMapFromData(i)},t.prototype.mergeDefaultAndTheme=function(e,t){var n=yv(this),i=n?xv(e):{},a=this.subType;Sv.hasClass(a)&&(a+="Series"),Er(e,t.getTheme().get(this.subType)),Er(e,this.getDefaultOption()),ud(e,"label",["show"]),this.fillDataTextStyle(e.data),n&&vv(e,i,n)},t.prototype.mergeOption=function(e,t){e=Er(this.option,e,!0),this.fillDataTextStyle(e.data);var n=yv(this);n&&vv(this.option,e,n);var i=iw(this).sourceManager;i.dirty(),i.prepareSource();var a=this.getInitialData(e,t);dw(a,this),this.dataTask.dirty(),this.dataTask.context.data=a,iw(this).dataBeforeProcessed=a,sw(this),this._initSelectedMapFromData(a)},t.prototype.fillDataTextStyle=function(e){if(e&&!Xr(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=Xv.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[aw(i,e)])&&!i.getItemModel(e).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[rw])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){Kr(a.selectedMap)||(a.selectedMap={});for(var s=a.selectedMap,l=0;l0&&this._innerSelect(e,t)}},t.registerClass=function(e){return Sv.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}(Sv);function sw(e){var t=e.name;bd(e)||(e.name=function(e){var t=e.getRawData(),n=t.mapDimensionsAll("seriesName"),i=[];return Rr(n,(function(e){var n=t.getDimensionInfo(e);n.displayName&&i.push(n.displayName)})),i.join(" ")}(e)||t)}function lw(e){return e.model.getRawData().count()}function pw(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),cw}function cw(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function dw(e,t){Rr(yo(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),(function(n){e.wrapMethod(n,zr(uw,t))}))}function uw(e,t){var n=mw(e);return n&&n.setOutputEnd((t||this).count()),t}function mw(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}}Ar(ow,rb),Ar(ow,Xv),Nd(ow,Sv);var hw=function(){function e(){this.group=new Mc,this.uid=hy("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 gw(){var e=Cd();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"}}Bd(hw),Gd(hw);var fw=Cd(),yw=gw(),vw=function(){function e(){this.group=new Mc,this.uid=hy("viewChart"),this.renderTask=sb({plan:ww,reset:Sw}),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){Nf(this.group,e)},e.markUpdateMethod=function(e,t){fw(e).updateMethod=t},e.protoInitialize=void(e.prototype.type="chart"),e}();function xw(e,t,n){e&&Lh(e)&&("emphasis"===t?vh:xh)(e,n)}function bw(e,t,n){var i=Sd(e,t),a=t&&null!=t.highlightKey?function(e){var t=Wm[e];return null==t&&Hm<=32&&(t=Wm[e]=Hm++),t}(t.highlightKey):null;null!=i?Rr(dd(i),(function(t){xw(e.getItemGraphicEl(t),n,a)})):e.eachItemGraphicEl((function(e){xw(e,n,a)}))}function ww(e){return yw(e.model)}function Sw(e){var t=e.model,n=e.ecModel,i=e.api,a=e.payload,r=t.pipelineContext.progressiveRender,o=e.view,s=a&&fw(a).updateMethod,l=r?"incrementalPrepareRender":s&&o[s]?s:"render";return"render"!==l&&o[l](t,n,i,a),Cw[l]}Bd(vw),Gd(vw);var Cw={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)}}},_w="\0__throttleOriginMethod",Tw="\0__throttleRate",Iw="\0__throttleType";function Ew(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 Mw(e,t,n,i){var a=e[t];if(a){var r=a[_w]||a,o=a[Iw];if(a[Tw]!==n||o!==i){if(null==n||!i)return e[t]=r;(a=e[t]=Ew(r,n,"debounce"===i))[_w]=r,a[Iw]=i,a[Tw]=n}return a}}function kw(e,t){var n=e[t];n&&n[_w]&&(n.clear&&n.clear(),e[t]=n[_w])}var Pw=Cd(),Dw={itemStyle:zd(py,!0),lineStyle:zd(oy,!0)},Ow={lineStyle:"stroke",itemStyle:"fill"};function Aw(e,t){var n=e.visualStyleMapper||Dw[t];return n||(console.warn("Unknown style type '"+t+"'."),Dw.itemStyle)}function Fw(e,t){var n=e.visualDrawType||Ow[t];return n||(console.warn("Unknown style type '"+t+"'."),"fill")}var Rw={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=e.getModel(i),r=Aw(e,i)(a),o=a.getShallow("decal");o&&(n.setVisual("decal",o),o.dirty=!0);var s=Fw(e,i),l=r[s],p=jr(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||jr(r.fill)?d:r.fill,r.stroke="auto"===r.stroke||jr(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=kr({},r);a[s]=p(i),t.setItemVisual(n,"style",a)}}}},Bw=new uy,Nw={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData&&!t.isSeriesFiltered(e)){var n=e.getData(),i=e.visualStyleAccessPath||"itemStyle",a=Aw(e,i),r=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(e,t){var n=e.getRawDataItem(t);if(n&&n[i]){Bw.option=n[i];var o=a(Bw);kr(e.ensureUniqueItemVisual(t,"style"),o),Bw.option.decal&&(e.setItemVisual(t,"decal",Bw.option.decal),Bw.option.decal.dirty=!0),r in o&&e.setItemVisual(t,"colorFromPalette",!1)}}:null}}}},Lw={performRawSeries:!0,overallReset:function(e){var t=fo();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)),Pw(e).scope=a}})),e.eachSeries((function(t){if(!t.isColorBySeries()&&!e.isSeriesFiltered(t)){var n=t.getRawData(),i={},a=t.getData(),r=Pw(t).scope,o=t.visualStyleAccessPath||"itemStyle",s=Fw(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)}}))}}))}},Vw=Math.PI;var qw=function(){function e(e,t,n,i){this._stageTaskMap=fo(),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=fo();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;Rr(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))}Rr(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=fo(),s=e.seriesType,l=e.getTargetSeries;function p(t){var s=t.uid,l=o.set(s,r&&r.get(s)||sb({plan:Hw,reset:Ww,count:Yw}));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||sb({reset:Gw});r.context={ecModel:n,api:i,overallReset:e.overallReset,scheduler:a};var o=r.agentStubMap,s=r.agentStubMap=fo(),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,sb({reset:zw,onDirty:jw})));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,Rr(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 jr(e)&&(e={overallReset:e,seriesType:Xw(e)}),e.uid=hy("stageHandler"),t&&(e.visualType=t),e},e}();function Gw(e){e.overallReset(e.ecModel,e.api,e.payload)}function zw(e){return e.overallProgress&&Uw}function Uw(){this.agent.dirty(),this.getDownstream().dirty()}function jw(){this.agent&&this.agent.dirty()}function Hw(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function Ww(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=dd(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?Br(t,(function(e,t){return Kw(t)})):$w}var $w=Kw(0);function Kw(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}(),pS=["symbol","symbolSize","symbolRotate","symbolOffset"],cS=pS.concat(["symbolKeepAspect"]),dS={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&&AS(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=AS(i)?i:0,a=AS(a)?a:1,r=AS(r)?r:0,o=AS(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]:$r(t)?[t]:Ur(t)?t:null:null),r=i.lineDashOffset;if(a){var o=i.strokeNoScale&&e.getLineScale?e.getLineScale():1;o&&1!==o&&(a=Br(a,(function(e){return e/o})),r/=o)}return[a,r]}var LS=new Yu(!0);function VS(e){var t=e.stroke;return!(null==t||"none"===t||!(e.lineWidth>0))}function qS(e){return"string"==typeof e&&"none"!==e}function GS(e){var t=e.fill;return null!=t&&"none"!==t}function zS(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 US(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 jS(e,t,n){var i=$d(t.image,t.__image,n);if(Yd(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)*So),r.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(r)}return a}}var HS=["shadowBlur","shadowOffsetX","shadowOffsetY"],WS=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function $S(e,t,n,i,a){var r=!1;if(!i&&t===(n=n||{}))return!1;if(i||t.opacity!==n.opacity){XS(e,a),r=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?pu.opacity:o}(i||t.blend!==n.blend)&&(r||(XS(e,a),r=!0),e.globalCompositeOperation=t.blend||pu.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[mC])if(this._disposed)jC(this.id);else{var i,a,r;if(Kr(t)&&(n=t.lazyUpdate,i=t.silent,a=t.replaceMerge,r=t.transition,t=t.notMerge),this[mC]=!0,!this._model||t){var o=new px(this._api),s=this._theme,l=this._model=new ex;l.scheduler=this._scheduler,l.ssr=this._ssr,l.init(null,null,null,s,this._locale,o)}this._model.setOption(e,{replaceMerge:a},KC);var p={seriesTransition:r,optionChanged:!0};if(n)this[hC]={silent:i,updateParams:p},this[mC]=!1,this.getZr().wakeUp();else{try{wC(this),_C.update.call(this,null,p)}catch(e){throw this[hC]=null,this[mC]=!1,e}this._ssr||this._zr.flush(),this[hC]=null,this[mC]=!1,MC.call(this,i),kC.call(this,i)}}},t.prototype.setTheme=function(){od()},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||rr.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(rr.svgSupported){var e=this._zr;return Rr(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;Rr(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 Rr(i,(function(e){e.group.ignore=!1})),r}jC(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(JC[n]){var o=r,s=r,l=-1/0,p=-1/0,c=[],d=e&&e.pixelRatio||this.getDevicePixelRatio();Rr(QC,(function(r,d){if(r.group===n){var u=t?r.getZr().painter.getSvgDom().innerHTML:r.renderToCanvas(Ir(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=dr.createCanvas(),g=Ac(h,{renderer:t?"svg":"canvas"});if(g.resize({width:u,height:m}),t){var f="";return Rr(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 Em({shape:{x:0,y:0,width:u,height:m},style:{fill:e.connectedBackgroundColor}})),Rr(c,(function(e){var t=new bm({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)}jC(this.id)},t.prototype.convertToPixel=function(e,t){return TC(this,"convertToPixel",e,t)},t.prototype.convertFromPixel=function(e,t){return TC(this,"convertFromPixel",e,t)},t.prototype.containPixel=function(e,t){var n;if(!this._disposed)return Rr(Td(this._model,e),(function(e,i){i.indexOf("Models")>=0&&Rr(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;jC(this.id)},t.prototype.getVisual=function(e,t){var n=Td(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?mS(a,r,t):hS(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;Rr(UC,(function(e){var t=function(t){var n,a=i.getModel(),r=t.target,o="globalout"===e;if(o?n={}:r&&vS(r,(function(e){var t=Um(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=kr({},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)})),Rr(WC,(function(e,t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),Rr(["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?(yS("map","selectchanged",t,i,e),yS("pie","selectchanged",t,i,e)):"select"===e.fromAction?(yS("map","selected",t,i,e),yS("pie","selected",t,i,e)):"unselect"===e.fromAction&&(yS("map","unselected",t,i,e),yS("pie","unselected",t,i,e))}))},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){this._disposed?jC(this.id):this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed)jC(this.id);else{this._disposed=!0,this.getDom()&&Pd(this.getDom(),t_,"");var e=this,t=e._api,n=e._model;Rr(e._componentsViews,(function(e){e.dispose(n,t)})),Rr(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 QC[e.id]}},t.prototype.resize=function(e){if(!this[mC])if(this._disposed)jC(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[hC]&&(null==i&&(i=this[hC].silent),n=!0,this[hC]=null),this[mC]=!0;try{n&&wC(this),_C.update.call(this,{type:"resize",animation:kr({duration:0},e&&e.animation)})}catch(e){throw this[mC]=!1,e}this[mC]=!1,MC.call(this,i),kC.call(this,i)}}},t.prototype.showLoading=function(e,t){if(this._disposed)jC(this.id);else if(Kr(e)&&(t=e,e=""),e=e||"default",this.hideLoading(),ZC[e]){var n=ZC[e](this._api,t),i=this._zr;this._loadingFX=n,i.add(n)}},t.prototype.hideLoading=function(){this._disposed?jC(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},t.prototype.makeActionFromEvent=function(e){var t=kr({},e);return t.type=WC[e.type],t},t.prototype.dispatchAction=function(e,t){if(this._disposed)jC(this.id);else if(Kr(t)||(t={silent:!!t}),HC[e.type]&&this._model)if(this[mC])this._pendingActions.push(e);else{var n=t.silent;EC.call(this,e,n);var i=t.flush;i?this._zr.flush():!1!==i&&rr.browser.weChat&&this._throttledZrFlush(),MC.call(this,n),kC.call(this,n)}},t.prototype.updateLabelLayout=function(){sC.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(e){if(this._disposed)jC(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(af(e))return;if(e instanceof gm&&function(e){var t=$m(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)}}))}wC=function(e){var t=e._scheduler;t.restorePipelines(e._model),t.prepareStageTasks(),SC(e,!0),SC(e,!1),t.plan()},SC=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")&&!rr.node&&!rr.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)},NC=function(e){e[gC]=!0,e.getZr().wakeUp()},LC=function(e){e[gC]&&(e.getZr().storage.traverse((function(e){af(e)||t(e)})),e[gC]=!1)},RC=function(e){return new(function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return ze(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){vh(t,n),NC(e)},n.prototype.leaveEmphasis=function(t,n){xh(t,n),NC(e)},n.prototype.enterBlur=function(t){bh(t),NC(e)},n.prototype.leaveBlur=function(t){wh(t),NC(e)},n.prototype.enterSelect=function(t){Sh(t),NC(e)},n.prototype.leaveSelect=function(t){Ch(t),NC(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}(rx))(e)},BC=function(e){function t(e,t){for(var n=0;n=0)){p_.push(n);var r=qw.wrapStageHandler(n,a);r.__prio=t,r.__raw=n,e.push(r)}}function d_(e,t){ZC[e]=t}var u_=function(e){var t=(e=Ir(e)).type,n="";t||sd(n);var i=t.split(":");2!==i.length&&sd(n);var a=!1;"echarts"===i[0]&&(t=i[1],a=!0),e.__isBuiltIn=a,Cb.set(t,e)};function m_(e){return null==e?0:e.length||1}function h_(e){return e}l_(cC,Rw),l_(dC,Nw),l_(dC,Lw),l_(cC,dS),l_(dC,uS),l_(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=iC(n,t))}));var a=i.getVisual("decal");if(a)i.getVisual("style").decal=iC(a,t)}}))})),a_(Dx),r_(900,(function(e){var t=fo();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(Ox)})),d_("default",(function(e,t){Pr(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 Mc,i=new Em({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});n.add(i);var a,r=new Pm({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 Em({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});return n.add(o),t.showSpinner&&((a=new qg({shape:{startAngle:-Vw/2,endAngle:-Vw/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*Vw/2}).start("circularInOut"),a.animateShape(!0).when(1e3,{startAngle:3*Vw/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:Qm,event:Qm,update:Qm},wo),s_({type:Jm,event:Jm,update:Jm},wo),s_({type:eh,event:eh,update:eh},wo),s_({type:th,event:th,update:th},wo),s_({type:nh,event:nh,update:nh},wo),i_("light",nS),i_("dark",sS);var g_=function(){function e(e,t,n,i,a,r){this._old=e,this._new=t,this._oldKeyGetter=n||h_,this._newKeyGetter=i||h_,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 E_,M_,k_,P_,D_,O_,A_,F_=Kr,R_=Br,B_="undefined"==typeof Int32Array?Array:Int32Array,N_=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],L_=["_approximateExtent"],V_=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;C_(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===Ev&&!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&&(Ur(a=this.getVisual(t))?a=a.slice():F_(a)&&(a=kr({},a)),i[t]=a),a},e.prototype.setItemVisual=function(e,t,n){var i=this._itemVisuals[e]||{};this._itemVisuals[e]=i,F_(t)?kr(i,t):i[t]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(e,t){F_(e)?kr(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?kr(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;jm(n,this.dataType,e,t),this._graphicEls[e]=t},e.prototype.getItemGraphicEl=function(e){return this._graphicEls[e]},e.prototype.eachItemGraphicEl=function(e,t){Rr(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:R_(this.dimensions,this._getDimInfo,this),this.hostModel)),D_(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(e,t){var n=this[e];jr(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(e),this[e]=function(){var e=n.apply(this,arguments);return t.apply(this,[e].concat(ro(arguments)))})},e.internalField=(E_=function(e){var t=e._invertedIndicesMap;Rr(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 B_(r.categories.length),r)for(var l=0;l1&&(s+="__ec__"+p),i[t]=s}})),e}();function q_(e,t){Vx(e)||(e=Gx(e));var n=(t=t||{}).coordDimensions||[],i=t.dimensionsDefine||e.dimensionsDefine||[],a=fo(),r=[],o=function(e,t,n,i){var a=Math.max(e.dimensionsDetectedCount||1,t.length,n.length,i||0);return Rr(t,(function(e){var t;Kr(e)&&(t=e.dimsDef)&&(a=Math.max(a,t.length))})),a}(e,n,i,t.dimensionsCount),s=t.canOmitUnusedDimensions&&I_(o),l=i===e.dimensionsDefine,p=l?T_(e):__(i),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var d=fo(c),u=new Pb(o),m=0;m0&&(i.name=a+(r-1)),r++,t.set(a,r)}}(r),new S_({source:e,dimensions:r,fullDimensionCount:o,dimensionOmitted:s})}function G_(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 z_=function(e){this.coordSysDims=[],this.axisMap=fo(),this.categoryAxisMap=fo(),this.coordSysName=e};var U_={cartesian2d:function(e,t,n,i){var a=e.getReferringComponents("xAxis",Ed).models[0],r=e.getReferringComponents("yAxis",Ed).models[0];t.coordSysDims=["x","y"],n.set("x",a),n.set("y",r),j_(a)&&(i.set("x",a),t.firstCategoryDimIndex=0),j_(r)&&(i.set("y",r),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,n,i){var a=e.getReferringComponents("singleAxis",Ed).models[0];t.coordSysDims=["single"],n.set("single",a),j_(a)&&(i.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,n,i){var a=e.getReferringComponents("polar",Ed).models[0],r=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],n.set("radius",r),n.set("angle",o),j_(r)&&(i.set("radius",r),t.firstCategoryDimIndex=0),j_(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();Rr(r.parallelAxisIndex,(function(e,r){var s=a.getComponent("parallelAxis",e),l=o[r];n.set(l,s),j_(s)&&(i.set(l,s),null==t.firstCategoryDimIndex&&(t.firstCategoryDimIndex=r))}))}};function j_(e){return"category"===e.get("type")}function H_(e,t,n){var i,a,r,o=(n=n||{}).byIndex,s=n.stackedCoordDimension;!function(e){return!C_(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(Rr(i,(function(e,t){Hr(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;Rr(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 W_(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function $_(e,t){return W_(e,t)?e.getCalculationInfo("stackResultDimension"):t}function K_(e,t,n){n=n||{};var i,a=t.getSourceManager(),r=!1;e?(r=!0,i=Gx(e)):r=(i=a.getSource()).sourceFormat===Ev;var o=function(e){var t=e.get("coordinateSystem"),n=new z_(t),i=U_[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=Br(t.coordSysDims,(function(e){var n={name:e},i=t.axisMap.get(e);if(i){var a=i.get("type");n.type=v_(a)}return n}))),n||(n=a&&(a.getDimensionsInfo?a.getDimensionsInfo():a.dimensions.slice())||["x","y"]),n}(t,o),l=n.useEncodeDefaulter,p=jr(l)?l:l?zr(Vv,s,t):null,c=q_(i,{coordDimensions:s,generateCoord:n.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:p,canOmitUnusedDimensions:!r}),d=function(e,t,n){var i,a;return n&&Rr(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=H_(t,{schema:c,store:u}),h=new V_(c,t);h.setCalculationInfo(m);var g=null!=d&&function(e){if(e.sourceFormat===Ev){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}();Gd(Y_);var X_=0,Z_=function(){function e(e){this.categories=e.categories||[],this._needCollect=e.needCollect,this._deduplication=e.deduplication,this.uid=++X_}return e.createByAxisModel=function(t){var n=t.option,i=n.data,a=i&&Br(i,Q_);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(!Hr(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=fo(this.categories))},e}();function Q_(e){return Kr(e)&&null!=e.value?e.value:e+""}function J_(e){return"interval"===e.type||"log"===e.type}function eT(e,t,n,i){var a={},r=e[1]-e[0],o=a.interval=Jc(r/t,!0);null!=n&&oi&&(o=a.interval=i);var s=a.intervalPrecision=nT(o);return function(e,t){!isFinite(e[0])&&(e[0]=t[0]),!isFinite(e[1])&&(e[1]=t[1]),iT(e,0,t),iT(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 tT(e){var t=Math.pow(10,Qc(e)),n=e/t;return n?2===n?n=3:3===n?n=5:n*=2:n=1,qc(n*t)}function nT(e){return zc(e)+2}function iT(e,t,n){e[t]=Math.max(Math.min(e[t],n[1]),n[0])}function aT(e,t){return e>=t[0]&&e<=t[1]}function rT(e,t){return t[1]===t[0]?.5:(e-t[0])/(t[1]-t[0])}function oT(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 Z_({})),Ur(i)&&(i=new Z_({categories:Br(i,(function(e){return Kr(e)?e.value:e}))})),n._ordinalMeta=i,n._extent=n.getSetting("extent")||[0,i.categories.length-1],n}return ze(t,e),t.prototype.parse=function(e){return null==e?NaN:Hr(e)?this._ordinalMeta.getOrdinal(e):Math.round(e)},t.prototype.contain=function(e){return aT(e=this.parse(e),this._extent)&&null!=this._ordinalMeta.categories[e]},t.prototype.normalize=function(e){return rT(e=this._getTickNumber(this.parse(e)),this._extent)},t.prototype.scale=function(e){return e=Math.round(oT(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}(Y_);Y_.registerClass(sT);var lT=qc,pT=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 jr(i)&&(n._ticksGenerator=i),n}return ze(t,e),t.prototype.parse=function(e){return e},t.prototype.contain=function(e){return aT(e,this._extent)},t.prototype.normalize=function(e){return rT(e,this._extent)},t.prototype.scale=function(e){return oT(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=nT(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:lT(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 Rr(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=Vc(e.get("barWidth"),i),m=Vc(e.get("barMaxWidth"),i),h=Vc(e.get("barMinWidth")||(ST(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:gT(a),stackId:hT(e)})})),vT(n)}function vT(e){var t={};Rr(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 Rr(t,(function(e,t){n[t]={};var i=e.stacks,a=e.bandWidth,r=e.categoryGap;if(null==r){var o=qr(i).length;r=Math.max(35-4*o,15)+"%"}var s=Vc(r,a),l=Vc(e.gap,1),p=e.remainedWidth,c=e.autoWidthCount,d=(p-s)/(c+(c-1)*l);d=Math.max(d,0),Rr(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;Rr(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;Rr(i,(function(e,i){n[t][i]=n[t][i]||{bandWidth:a,offset:h,width:e.width},h+=e.width*(1+l)}))})),n}function xT(e,t){var n=fT(e,t),i=yT(n);Rr(n,(function(e){var t=e.getData(),n=e.coordinateSystem.getBaseAxis(),a=hT(e),r=i[gT(n)][a],o=r.offset,s=r.width;t.setLayout({bandWidth:r.bandWidth,offset:o,size:s})}))}function bT(e){return{seriesType:e,plan:gw(),reset:function(e){if(wT(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=W_(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=ST(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&&uT(3*a),p=m&&s&&uT(3*a),v=m&&uT(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,I=void 0;c&&(I=+C-w.get(r,i));var E=void 0,M=void 0,k=void 0,P=void 0;if(d){var D=n.dataToPoint([C,_]);if(c)T=n.dataToPoint([I,_])[0];E=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(Ur(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 Ny(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=Ay,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=Lr(Br(p,(function(e){return Lr(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=_T.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 IT(e){return(e/=2592e6)>6?6:e>3?3:e>2?2:1}function ET(e){return(e/=Iy)>12?12:e>6?6:e>3.5?4:e>2?2:1}function MT(e,t){return(e/=t?Ty:_y)>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function kT(e){return Jc(e,!0)}function PT(e,t,n){var i=new Date(e);switch(Ry(t)){case"year":case"month":i[Ky(n)](0);case"day":i[Yy(n)](1);case"hour":i[Xy(n)](0);case"minute":i[Zy(n)](0);case"second":i[Qy(n)](0),i[Jy(n)](0)}return i.getTime()}Y_.registerClass(CT);var DT=Y_.prototype,OT=pT.prototype,AT=qc,FT=Math.floor,RT=Math.ceil,BT=Math.pow,NT=Math.log,LT=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="log",t.base=10,t._originalScale=new pT,t._interval=0,t}return ze(t,e),t.prototype.getTicks=function(e){var t=this._originalScale,n=this._extent,i=t.getExtent();return Br(OT.getTicks.call(this,e),(function(e){var t=e.value,a=qc(BT(this.base,t));return a=t===n[0]&&this._fixMin?qT(a,i[0]):a,{value:a=t===n[1]&&this._fixMax?qT(a,i[1]):a}}),this)},t.prototype.setExtent=function(e,t){var n=NT(this.base);e=NT(Math.max(0,e))/n,t=NT(Math.max(0,t))/n,OT.setExtent.call(this,e,t)},t.prototype.getExtent=function(){var e=this.base,t=DT.getExtent.call(this);t[0]=BT(e,t[0]),t[1]=BT(e,t[1]);var n=this._originalScale.getExtent();return this._fixMin&&(t[0]=qT(t[0],n[0])),this._fixMax&&(t[1]=qT(t[1],n[1])),t},t.prototype.unionExtent=function(e){this._originalScale.unionExtent(e);var t=this.base;e[0]=NT(e[0])/NT(t),e[1]=NT(e[1])/NT(t),DT.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=Zc(n);for(e/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var a=[qc(RT(t[0]/i)*i),qc(FT(t[1]/i)*i)];this._interval=i,this._niceExtent=a}},t.prototype.calcNiceExtent=function(e){OT.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 aT(e=NT(e)/NT(this.base),this._extent)},t.prototype.normalize=function(e){return rT(e=NT(e)/NT(this.base),this._extent)},t.prototype.scale=function(e){return e=oT(e,this._extent),BT(this.base,e)},t.type="log",t}(Y_),VT=LT.prototype;function qT(e,t){return AT(e,zc(t))}VT.getMinorTicks=OT.getMinorTicks,VT.getLabel=OT.getLabel,Y_.registerClass(LT);var GT=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[UT[e]]=t},e.prototype.setDeterminedMinMax=function(e,t){var n=zT[e];this[n]=t},e.prototype.freeze=function(){this.frozen=!0},e}(),zT={min:"_determinedMin",max:"_determinedMax"},UT={min:"_dataMin",max:"_dataMax"};function jT(e,t,n){var i=e.rawExtentInfo;return i||(i=new GT(e,t,n),e.rawExtentInfo=i,i)}function HT(e,t){return null==t?null:to(t)?NaN:e.parse(t)}function WT(e,t){var n=e.type,i=jT(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=fT("bar",o),l=!1;if(Rr(s,(function(e){l=l||e.getBaseAxis()===t.axis})),l){var p=yT(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[gT(t)];return null!=i&&null!=n?i[hT(n)]:i}}(i,n.axis);if(void 0===o)return{min:e,max:t};var s=1/0;Rr(o,(function(e){s=Math.min(e.offset,s)}));var l=-1/0;Rr(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 $T(e,t){var n=t,i=WT(e,n),a=i.extent,r=n.get("splitNumber");e instanceof LT&&(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 KT(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 CT({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});case"value":return new pT({ticksGenerator:e.getTicksGenerator()});default:return new(Y_.getClass(t)||pT)}}function YT(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)}):Hr(i)?function(t){return function(n){var i=e.scale.getLabel(n);return t.replace("{value}",null!=i?i:"")}}(i):jr(i)?(t=i,function(n,i){return null!=a&&(i=n.value-a),t(XT(e,n),i,null!=n.level?{level:n.level}:null)}):function(t){return e.scale.getLabel(t)}}function XT(e,t){return"category"===e.type?e.scale.getLabel(t):t.value}function ZT(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 Ps(e.x,e.y,r,o)}function QT(e){var t=e.get("interval");return null==t?"auto":t}function JT(e){return"category"===e.type&&0===QT(e.getLabelModel())}function eI(e,t){var n={};return Rr(e.mapDimensionsAll(t),(function(t){n[$_(e,t)]=!0})),qr(n)}var tI=function(){function e(){}return e.prototype.getNeedCrossZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}();var nI=[],iI={registerPreprocessor:a_,registerProcessor:r_,registerPostInit:function(e){o_("afterinit",e)},registerPostUpdate:function(e){o_("afterupdate",e)},registerUpdateLifecycle:o_,registerAction:s_,registerCoordinateSystem:function(e,t){sx.register(e,t)},registerLayout:function(e,t){c_(YC,e,t,1e3,"layout")},registerVisual:l_,registerTransform:u_,registerLoading:d_,registerMap:function(e,t,n){var i=pC("registerMap");i&&i(e,t,n)},registerImpl:function(e,t){lC[e]=t},PRIORITY:uC,ComponentModel:Sv,ComponentView:hw,SeriesModel:ow,ChartView:vw,registerComponentModel:function(e){Sv.registerClass(e)},registerComponentView:function(e){hw.registerClass(e)},registerSeriesModel:function(e){ow.registerClass(e)},registerChartView:function(e){vw.registerClass(e)},registerSubTypeDefaulter:function(e,t){Sv.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){Fc(e,t)}};function aI(e){Ur(e)?Rr(e,(function(e){aI(e)})):Dr(nI,e)>=0||(nI.push(e),jr(e)&&(e={install:e}),e.install(iI))}function rI(e,t){return Math.abs(e-t)<1e-8}function oI(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 yI(e,t){return Br(Lr((e=function(e){if(!e.UTF8Encoding)return e;var t=e,n=t.UTF8Scale;return null==n&&(n=1024),Rr(t.features,(function(e){var t=e.geometry,i=t.encodeOffsets,a=t.coordinates;if(i)switch(t.type){case"LineString":t.coordinates=fI(a,i,n);break;case"Polygon":case"MultiLineString":gI(a,i,n);break;case"MultiPolygon":Rr(a,(function(e,t){return gI(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 dI(r[0],r.slice(1)));break;case"MultiPolygon":Rr(i.coordinates,(function(e){e[0]&&a.push(new dI(e[0],e.slice(1)))}));break;case"LineString":a.push(new uI([i.coordinates]));break;case"MultiLineString":a.push(new uI(i.coordinates))}var o=new mI(n[t||"name"],a,n.cp);return o.properties=n,o}))}var vI=Cd();function xI(e){return"category"===e.type?function(e){var t=e.getLabelModel(),n=wI(e,t);return!t.get("show")||e.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(e):function(e){var t=e.scale.getTicks(),n=YT(e);return{labels:Br(t,(function(t,i){return{level:t.level,formattedLabel:n(t,i),rawLabel:e.scale.getLabel(t),tickValue:t.value}}))}}(e)}function bI(e,t){return"category"===e.type?function(e,t){var n,i,a=SI(e,"ticks"),r=QT(t),o=CI(a,r);if(o)return o;t.get("show")&&!e.scale.isBlank()||(n=[]);if(jr(r))n=II(e,r,!0);else if("auto"===r){var s=wI(e,e.getLabelModel());i=s.labelCategoryInterval,n=Br(s.labels,(function(e){return e.tickValue}))}else n=TI(e,i=r,!0);return _I(a,r,{ticks:n,tickCategoryInterval:i})}(e,t):{ticks:Br(e.scale.getTicks(),(function(e){return e.value}))}}function wI(e,t){var n,i,a=SI(e,"labels"),r=QT(t),o=CI(a,r);return o||(jr(r)?n=II(e,r):(i="auto"===r?function(e){var t=vI(e).autoInterval;return null!=t?t:vI(e).autoInterval=e.calculateCategoryInterval()}(e):r,n=TI(e,i)),_I(a,r,{labels:n,labelCategoryInterval:i}))}function SI(e,t){return vI(e)[t]||(vI(e)[t]=[])}function CI(e,t){for(var n=0;n1&&c/l>2&&(p=Math.round(Math.ceil(p/l)*l));var d=JT(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 II(e,t,n){var i=e.scale,a=YT(e),r=[];return Rr(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 EI=[0,1],MI=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 jc(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&&kI(n=n.slice(),i.count()),Lc(e,EI,n,t)},e.prototype.coordToData=function(e,t){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&kI(n=n.slice(),i.count());var a=Lc(e,n,EI,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=Br(bI(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;Rr(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),Br(this.scale.getMinorTicks(e),(function(e){return Br(e,(function(e){return{coord:this.dataToCoord(e),tickValue:e}}),this)}),this)},e.prototype.getViewLabels=function(){return xI(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(jr(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=YT(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=uc(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=vI(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 kI(e,t){var n=(e[1]-e[0])/t/2;e[0]+=n,e[1]-=n}var PI=2*Math.PI,DI=Yu.CMD,OI=["top","right","bottom","left"];function AI(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 FI(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)%PI<1e-4)return l[0]=c,l[1]=d,p-n;if(r){var u=i;i=em(a),a=em(u)}else i=em(i),a=em(a);i>a&&(a+=PI);var m=Math.atan2(s,o);if(m<0&&(m+=PI),m>=i&&m<=a||m+PI>=i&&m+PI<=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,qI.fromArray(e[0]),GI.fromArray(e[1]),zI.fromArray(e[2]),ws.sub(UI,qI,GI),ws.sub(jI,zI,GI);var n=UI.len(),i=jI.len();if(!(n<.001||i<.001)){UI.scale(1/n),jI.scale(1/i);var a=UI.dot(jI);if(Math.cos(t)1&&ws.copy($I,zI),$I.toArray(e[1])}}}}function YI(e,t,n){if(n<=180&&n>0){n=n/180*Math.PI,qI.fromArray(e[0]),GI.fromArray(e[1]),zI.fromArray(e[2]),ws.sub(UI,GI,qI),ws.sub(jI,zI,GI);var i=UI.len(),a=jI.len();if(!(i<.001||a<.001))if(UI.scale(1/i),jI.scale(1/a),UI.dot(t)=o)ws.copy($I,zI);else{$I.scaleAndAdd(jI,r/Math.tan(Math.PI/2-s));var l=zI.x!==GI.x?($I.x-GI.x)/(zI.x-GI.x):($I.y-GI.y)/(zI.y-GI.y);if(isNaN(l))return;l<0?ws.copy($I,GI):l>1&&ws.copy($I,zI)}$I.toArray(e[1])}}}function XI(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 ZI(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=Fo(i[0],i[1]),r=Fo(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=No([],i[1],i[0],o/a),l=No([],i[1],i[2],o/r),p=No([],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 nE(e,t,n,i){return tE(e,"y","height",t,n,i)}function iE(e){var t=[];e.sort((function(e,t){return t.priority-e.priority}));var n=new Ps(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),Dr(p,"emphasis")>=0&&n.attr(m.oldLayoutEmphasis)),tf(n,s,t,o)}else if(n.attr(s),!Zf(n).valueAnimation){var c=io(n.style.opacity,1);n.style.opacity=0,nf(n,{style:{opacity:c}},t,o)}if(m.oldLayout=s,n.states.select){var d=m.oldLayoutSelect={};cE(d,s,dE),cE(d,n.states.select,dE)}if(n.states.emphasis){var u=m.oldLayoutEmphasis={};cE(u,s,dE),cE(u,n.states.emphasis,dE)}Jf(n,o,l,t,t)}if(i&&!i.ignore&&!i.invisible){a=(m=pE(i)).oldLayout;var m,h={points:i.shape.points};a?(i.attr({shape:a}),tf(i,{shape:h},t)):(i.setShape(h),i.style.strokePercent=0,nf(i,{style:{strokePercent:1}},t)),m.oldLayout=h}},e}(),mE=Cd();function hE(e){e.registerUpdateLifecycle("series:beforeupdate",(function(e,t,n){var i=mE(t).labelManager;i||(i=mE(t).labelManager=new uE),i.clearLabels()})),e.registerUpdateLifecycle("series:layoutlabels",(function(e,t,n){var i=mE(t).labelManager;n.updatedSeries.forEach((function(e){i.addLabelsOfSeries(t.getViewOfSeriesModel(e))})),i.updateLayoutConfig(t),i.layout(t),i.processLabelsOverall()}))}aI(hE);var gE=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return ze(t,e),t.prototype.getInitialData=function(e){return K_(null,this,{useEncodeDefaulter:!0})},t.prototype.getLegendIcon=function(e){var t=new Mc,n=PS("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=PS(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}(ow);function fE(e,t){var n=e.mapDimensionsAll("defaultedLabel"),i=n.length;if(1===i){var a=ib(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 vE=function(e){function t(t,n,i,a){var r=e.call(this)||this;return r.updateData(t,n,i,a),r}return ze(t,e),t.prototype._createSymbol=function(e,t,n,i,a){this.removeAll();var r=PS(e,-1,-1,2,2,null,a);r.attr({z2:100,culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),r.drift=xE,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(){vh(this.childAt(0))},t.prototype.downplay=function(){xh(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):tf(u,d,o,n),lf(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,nf(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=Uf(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=OS(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 bm){var S=h.style;h.useStyle(kr({image:S.image,x:S.x,y:S.y,width:S.width,height:S.height},b))}else h.__isEmptyBrush?h.useStyle(kr({},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;zf(h,d,{labelFetcher:g,labelDataIndex:t,defaultText:function(t){return T?e.getName(t):fE(e,t)},inheritColor:w,defaultOpacity:b.opacity}),this._sizeX=n[0]/2,this._sizeY=n[1]/2;var I=h.ensureState("emphasis");I.style=r,h.ensureState("select").style=s,h.ensureState("blur").style=o;var E=null==u||!0===u?Math.max(1.1,3/this._sizeY):isFinite(u)&&u>0?+u:1;I.scaleX=this._sizeX*E,I.scaleY=this._sizeY*E,this.setSymbolScale(1),Oh(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=Um(this).dataIndex,r=n&&n.animation;if(this.silent=i.silent=!0,n&&n.fadeLabel){var o=i.getTextContent();o&&rf(o,{style:{opacity:0}},t,{dataIndex:a,removeOpt:r,cb:function(){i.removeTextContent()}})}else i.removeTextContent();rf(i,{style:{opacity:0},scaleX:0,scaleY:0},t,{dataIndex:a,cb:e,removeOpt:r})},t.getSymbolSize=function(e,t){return DS(e.getItemVisual(t,"symbolSize"))},t}(Mc);function xE(e,t){this.parent.drift(e,t)}function bE(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 wE(e){return null==e||Kr(e)||(e={isIgnore:e}),e||{}}function SE(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:Uf(t),cursorStyle:t.get("cursor")}}var CE=function(){function e(e){this.group=new Mc,this._SymbolCtor=e||vE}return e.prototype.updateData=function(e,t){this._progressiveEls=null,t=wE(t);var n=this.group,i=e.hostModel,a=this._data,r=this._SymbolCtor,o=t.disableAnimation,s=SE(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(bE(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(bE(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):tf(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=SE(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=wE(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=Br(e.dimensions,(function(e){return t.mapDimension(e)})),u=!1,m=t.getCalculationInfo("stackResultDimension");return W_(t,d[0])&&(u=!0,d[0]=m),W_(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 TE(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 IE=Math.min,EE=Math.max;function ME(e,t){return isNaN(e)||isNaN(t)}function kE(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(ME(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||ME(S,C))m=y,h=v;else{I=S-p,E=C-c;var P=y-p,D=S-y,O=v-c,A=C-v,F=void 0,R=void 0;if("x"===s){var B=I>0?1:-1;m=y-B*(F=Math.abs(P))*o,h=v,M=y+B*(R=Math.abs(D))*o,k=v}else if("y"===s){var N=E>0?1:-1;m=y,h=v-N*(F=Math.abs(O))*o,M=y,k=v+N*(R=Math.abs(A))*o}else F=Math.sqrt(P*P+O*O),m=y-I*o*(1-(T=(R=Math.sqrt(D*D+A*A))/(R+F))),h=v-E*o*(1-T),k=v+E*o*T,M=IE(M=y+I*o*T,EE(S,y)),k=IE(k,EE(C,v)),M=EE(M,IE(S,y)),h=v-(E=(k=EE(k,IE(C,v)))-v)*F/R,m=IE(m=y-(I=M-y)*F/R,EE(p,y)),h=IE(h,EE(c,v)),M=y+(I=y-(m=EE(m,IE(p,y))))*R/F,k=v+(E=v-(h=EE(h,IE(c,v))))*R/F}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 PE=function(){this.smooth=0,this.smoothConstraint=!0},DE=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polyline",n}return ze(t,e),t.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},t.prototype.getDefaultShape=function(){return new PE},t.prototype.buildPath=function(e,t){var n=t.points,i=0,a=n.length/2;if(t.connectNulls){for(;a>0&&ME(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?ul(n,p,d,m,e,s):ul(i,c,u,h,e,s);if(y>0)for(var v=0;v=0){f=o?cl(i,c,u,h,x):cl(n,p,d,m,x);return o?[e,f]:[f,e]}}n=m,i=h}}},t}(gm),OE=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t}(PE),AE=function(e){function t(t){var n=e.call(this,t)||this;return n.type="ec-polygon",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new OE},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&&ME(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=Br(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:Hl((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";Rr(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 Ug(0,0,0,0,u,!0);return y[a]=h,y[a+"2"]=g,y}}}function jE(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 Rr(r.getViewLabels(),(function(e){var t=r.scale.getRawOrdinalNumber(e.tickValue);s[t]=1})),function(e){return!s.hasOwnProperty(t.get(o,e))}}}}function HE(e,t){return[e[2*t],e[2*t+1]]}function WE(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);Um(m).seriesIndex=e.seriesIndex,Oh(m,P,D,O);var A=GE(e.get("smooth")),F=e.get("smoothMonotone");if(m.setShape({smooth:A,smoothMonotone:F,connectNulls:S}),h){var R=o.getCalculationInfo("stackedOnSeries"),B=0;h.useStyle(Pr(l.getAreaStyle(),{fill:E,opacity:.7,lineJoin:"bevel",decal:o.getVisual("style").decal})),R&&(B=GE(R.get("smooth"))),h.setShape({smooth:A,stackedOnSmooth:B,smoothMonotone:F,connectNulls:S}),Bh(h,e,"areaStyle"),Um(h).seriesIndex=e.seriesIndex,Oh(h,P,D,O)}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=I,this._valueOrigin=v,e.get("triggerLineEvent")&&(this.packEventData(e,m),h&&this.packEventData(e,h))},t.prototype.packEventData=function(e,t){Um(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=Sd(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 vE(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 vw.prototype.highlight.call(this,e,t,n,i)},t.prototype.downplay=function(e,t,n,i){var a=e.getData(),r=Sd(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 vw.prototype.downplay.call(this,e,t,n,i)},t.prototype._changePolyState=function(e){var t=this._polygon;mh(this._polyline,e),t&&mh(t,e)},t.prototype._newPolyline=function(e){var t=this._polyline;return t&&this._lineGroup.remove(t),t=new DE({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 AE({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");jr(l)&&(l=l(null));var p=s.get("animationDelay")||0,c=jr(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=jr(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(WE(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 Pm({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&&(zf(r,Uf(e,"endLabel"),{inheritColor:n,labelFetcher:e,labelDataIndex:l,defaultText:function(e,t,n){return null!=n?yE(a,n):fE(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 I=HE(p,C[0]);s.attr({x:I[0]+x,y:I[1]+b}),a&&(T=c.getRawValue(C[0]))}else{(I=l.getPointOn(v,w))&&s.attr({x:I[0]+x,y:I[1]+b});var E=c.getRawValue(C[0]),M=c.getRawValue(C[1]);a&&(T=Od(n,u,E,M,S.t))}i.lastFrameIndex=C[0]}else{var k=1===e||i.lastFrameIndex>0?C[0]:0;I=HE(p,k);a&&(T=c.getRawValue(k)),s.attr({x:I[0]+x,y:I[1]+b})}if(a){var P=Zf(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=_E(a,t,o),f=e.getLayout("points")||[],y=t.getLayout("points")||[],v=0;v3e3||l&&qE(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(),tf(s,g,p),l&&(l.setShape({points:d,stackedOnPoints:u}),l.stopAnimation(),tf(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]}},ZE=function(e){return Math.round(e.length/2)};function QE(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;Hr(a)?m=XE[a]:jr(a)&&(m=a),m&&e.setData(i.downSample(i.mapDimension(l.dim),1/u,m,ZE))}}}}}function JE(e){e.registerChartView(KE),e.registerSeriesModel(gE),e.registerLayout(YE("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,QE("line"))}var eM=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.getInitialData=function(e,t){return K_(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)Rr(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}(ow);ow.registerClass(eM);var tM=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.getInitialData=function(){return K_(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=gy(eM.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}(eM),nM=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},iM=function(e){function t(t){var n=e.call(this,t)||this;return n.type="sausage",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new nM},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){sf(t,e,Um(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}(vw),cM={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=sM(t.x,e.x),s=lM(t.x+t.width,a),l=sM(t.y,e.y),p=lM(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=lM(t.r,e.r),r=sM(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}},dM={cartesian2d:function(e,t,n,i,a,r,o,s,l){var p=new Em({shape:kr({},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?iM:_g,c=new p({shape:i,z2:1});c.name="item";var d,u,m=vM(a);if(c.calculateTextPosition=(d=m,u=({isRoundCap:p===iM}||{}).isRoundCap,function(e,t,n){var i=t.position;if(!i||i instanceof Array)return yc(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)+aM(h,r+y,!1),w=l+m*x(h)+rM(h,r+y,!1),S="right",C="middle";break;case"insideStartAngle":b=s+m*v(h)+aM(h,-r+y,!1),w=l+m*x(h)+rM(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)+aM(g,r+y,!0),w=l+m*x(g)+rM(g,r+y,!0),S="left",C="middle";break;case"insideEndAngle":b=s+m*v(g)+aM(g,-r+y,!0),w=l+m*x(g)+rM(g,-r+y,!0),S="right",C="middle";break;default:return yc(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?tf:nf)(c,{shape:g},r)}return c}};function uM(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?tf:nf)(n,{shape:l},t,a,null),(o?tf:nf)(n,{shape:p},t?e.baseAxis.model:null,a)}function mM(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 vM(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 xM(e,t,n,i,a,r,o,s){var l=t.getItemVisual(n,"style");if(s){if(!r.get("roundCap")){var p=e.shape;kr(p,oM(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=Uf(i);zf(e,m,{labelFetcher:r,labelDataIndex:n,defaultText:fE(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($r(i))e.setTextConfig({rotation:i});else if(Ur(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,vM(o),i.get(["label","rotate"]))}Qf(h,m,r.getRawValue(n),(function(e){return yE(t,e)}));var f=i.getModel(["emphasis"]);Oh(e,f.get("focus"),f.get("blurScope"),f.get("disabled")),Bh(e,i),function(e){return null!=e.startAngle&&null!=e.endAngle&&e.startAngle===e.endAngle}(a)&&(e.style.fill="none",e.style.stroke="none",Rr(e.states,(function(e){e.style&&(e.style.fill=e.style.stroke="none")})))}var bM=function(){},wM=function(e){function t(t){var n=e.call(this,t)||this;return n.type="largeBar",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new bM},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);Um(this).dataIndex=t>=0?t:null}),30,!1);function _M(e,t,n){if(NE(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 TM(e){e.registerChartView(pM),e.registerSeriesModel(tM),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,zr(xT,"bar")),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,bT("bar")),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,QE("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 IM=2*Math.PI,EM=Math.PI/180;function MM(e,t){return gv(e.getBoxLayoutParams(),{width:t.getWidth(),height:t.getHeight()})}function kM(e,t){var n=MM(e,t),i=e.get("center"),a=e.get("radius");Ur(a)||(a=[0,a]);var r,o,s=Vc(n.width,t.getWidth()),l=Vc(n.height,t.getHeight()),p=Math.min(s,l),c=Vc(a[0],p/2),d=Vc(a[1],p/2),u=e.coordinateSystem;if(u){var m=u.dataToPoint(i);r=m[0]||0,o=m[1]||0}else Ur(i)||(i=[i,i]),r=Vc(i[0],s)+n.x,o=Vc(i[1],l)+n.y;return{cx:r,cy:o,r0:c,r:d}}function PM(e,t,n){t.eachSeriesByType(e,(function(e){var t=e.getData(),i=t.mapDimension("value"),a=MM(e,n),r=kM(e,n),o=r.cx,s=r.cy,l=r.r,p=r.r0,c=-e.get("startAngle")*EM,d=e.get("endAngle"),u=e.get("padAngle")*EM;d="auto"===d?c-IM:-d*EM;var m=e.get("minAngle")*EM+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;Ku(S,!y),c=S[0],d=S[1];var _=Math.abs(d-c),T=_,I=0,E=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=E+w*i/2:(r=E+C,c=a-C),t.setItemLayout(n,{angle:i,startAngle:r,endAngle:c,clockwise:y,cx:o,cy:s,r0:p,r:v?Lc(e,b,[p,l]):l}),E=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 RM(e){return"center"===e.position}function BM(e){var t,n,i=e.getData(),a=[],r=!1,o=(e.get("minShowLabelAngle")||0)*OM,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=Vc(f.get("edgeDistance"),p),w=f.get("bleedMargin"),S=g.getModel("labelLine"),C=S.get("length");C=Vc(C,p);var _=S.get("length2");if(_=Vc(_,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($r(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=I,u.rotation=V,u.setStyle({verticalAlign:"middle"}),O){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 ws(P,D),linePoints:E,textAlign:M,labelDistance:v,labelAlignTo:x,edgeDistance:b,bleedMargin:w,rect:U,unconstrainedWidth:U.width,labelStyleWidth:u.style.width})}s.setTextConfig({inside:O})}})),!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}(vw);function VM(e,t,n){t=Ur(t)&&{coordDimensions:t}||kr({encodeDefine:e.getEncode()},t);var i=e.getSource(),a=q_(i,t).dimensions,r=new V_(a,e);return r.initData(i,n),r}var qM=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}(),GM=Cd(),zM=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new qM(Gr(this.getData,this),Gr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return VM(this,{coordDimensions:["value"],encodeDefaulter:zr(qv,this)})},t.prototype.getDataParams=function(t){var n=this.getData(),i=GM(n),a=i.seats;if(!a){var r=[];n.each(n.mapDimension("value"),(function(e){r.push(e)})),a=i.seats=Hc(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){ud(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}(ow);function UM(e){e.registerChartView(LM),e.registerSeriesModel(zM),fS("pie",e.registerAction),e.registerLayout(zr(PM,"pie")),e.registerProcessor(DM("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!($r(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}ze(t,e),t.prototype.getInitialData=function(e,t){return K_(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"}}}(ow);var jM=function(){},HM=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return ze(t,e),t.prototype.getDefaultShape=function(){return new jM},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}(),$M=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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=YE("").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 WM:new CE,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"}(vw),function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(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}(Sv)),KM=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Ed).models[0]},t.type="cartesian2dAxis",t}(Sv);Ar(KM,tI);var YM={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)"]}}},XM=Er({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},YM),ZM=Er({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}}},YM),QM={category:XM,value:ZM,time:Er({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},ZM),log:Pr({logBase:10},ZM)},JM={value:1,category:1,time:1,log:1};function ek(e,t,n,i){Rr(JM,(function(a,r){var o=Er(Er({},QM[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 ze(n,e),n.prototype.mergeDefaultAndTheme=function(e,t){var n=yv(this),i=n?xv(e):{};Er(e,t.getTheme().get(r+"Axis")),Er(e,this.getDefaultOption()),e.type=tk(e),n&&vv(e,i,n)},n.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=Z_.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",tk)}function tk(e){return e.type||(e.data?"category":"value")}var nk=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 Br(this._dimList,(function(e){return this._axes[e]}),this)},e.prototype.getAxesByScale=function(e){return e=e.toLowerCase(),Lr(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}(),ik=["x","y"];function ak(e){return"interval"===e.type||"time"===e.type}var rk=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="cartesian2d",t.dimensions=ik,t}return ze(t,e),t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var e=this.getAxis("x").scale,t=this.getAxis("y").scale;if(ak(e)&&ak(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=xs([],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 Ps(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 Lo(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 Lo(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 Ps(i,a,r,o)},t}(nk),ok=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 ze(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}(MI);function sk(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),no(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 lk(e){return"cartesian2d"===e.get("coordinateSystem")}function pk(e){var t={xAxisModel:null,yAxisModel:null};return Rr(t,(function(n,i){var a=i.replace(/Model$/,""),r=e.getReferringComponents(a,Ed).models[0];t[i]=r})),t}var ck=Math.log;function dk(e,t,n){var i=pT.prototype,a=i.getTicks.call(n),r=i.getTicks.call(n,!0),o=a.length-1,s=i.getInterval.call(n),l=WT(e,t),p=l.extent,c=l.fixMin,d=l.fixMax;if("log"===e.type){var u=ck(e.base);p=[ck(p[0])/u,ck(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=tT(h),g=p[1]-h*o;else{e.getTicks().length-1>o&&(h=tT(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 uk=function(){function e(e,t,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=ik,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=qr(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;J_(s)&&o.get("alignTicks")&&null==o.get("interval")&&null==o.getTicksGenerator()?a.push(l):($T(s,o),J_(s)&&!s.isBlank()&&(t=l))}if(a.length){for(;!t&&a.length;){var l;$T((l=a.pop()).scale,l.model),l.scale.isBlank()||(t=l)}a.length&&t&&Rr(a,(function(e){dk(e.scale,e.model,t.scale)}))}}}this._updateScale(e,this.model),i(n.x),i(n.y);var a={};Rr(n.x,(function(e){hk(n,"y",e,a)})),Rr(n.y,(function(e){hk(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=gv(i,{width:t.getWidth(),height:t.getHeight()});this._rect=r;var o=this._axesList;function s(){Rr(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&&(Rr(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=YT(e),p=1;a>40&&(p=Math.ceil(a/40));for(var c=0;c0&&i>0||n<0&&i<0)}(e)}var fk=Math.PI,yk=function(){function e(e,t){this.group=new Mc,this.opt=t,this.axisModel=e,Pr(t,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var n=new Mc({x:t.position[0],y:t.position[1],rotation:t.rotation});n.updateTransform(),this._transformGroup=n}return e.prototype.hasBuilder=function(e){return!!vk[e]},e.prototype.add=function(e){vk[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=$c(t-e);return Kc(r)?(a=n>0?"top":"bottom",i="center"):Kc(r-fk)?(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}(),vk={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&&(Lo(s,s,o),Lo(l,l,o));var c=kr({lineCap:"round"},t.getModel(["axisLine","lineStyle"]).getLineStyle()),d=new Fg({shape:{x1:s[0],y1:s[1],x2:l[0],y2:l[1]},style:c,strokeContainThreshold:e.strokeContainThreshold||5,silent:!0,z2:1});Sf(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"]);Hr(u)&&(u=[u,u]),(Hr(m)||$r(m))&&(m=[m,m]);var h=OS(t.get(["axisLine","symbolOffset"])||0,m),g=m[0],f=m[1];Rr([{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=PS(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=Sk(a.getTicksCoords(),t.transform,l,Pr(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,wk(s)?e.labelOffset+l*c:0],h=t.get("nameRotate");null!=h&&(h=h*fk/180),wk(s)?r=yk.innerTextLayout(e.rotation,null!=h?h:e.rotation,l):(r=function(e,t,n,i){var a,r,o=$c(n-e),s=i[0]>i[1],l="start"===t&&!s||"start"!==t&&s;Kc(o-fk/2)?(r=l?"bottom":"top",a="center"):Kc(o-1.5*fk)?(r=l?"top":"bottom",a="center"):(r="middle",a=o<1.5*fk&&o>fk/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=no(e.nameTruncateMaxWidth,f.maxWidth,o),x=new Pm({x:m[0],y:m[1],rotation:r.rotation,silent:yk.isLabelSilent(t),style:jf(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(Rf({el:x,componentModel:t,itemName:a}),x.__fullText=a,x.anid="name",t.get("triggerEvent")){var b=yk.makeAxisEventDataBase(t);b.targetType="axisName",b.name=a,Um(x).eventData=b}i.add(x),x.updateTransform(),n.add(x),x.decomposeTransform()}}};function xk(e){e&&(e.ignore=!0)}function bk(e,t){var n=e&&e.getBoundingRect().clone(),i=t&&t.getBoundingRect().clone();if(n&&i){var a=ms([]);return ys(a,a,-e.rotation),n.applyTransform(gs([],a,e.getLocalTransform())),i.applyTransform(gs([],a,t.getLocalTransform())),n.intersect(i)}}function wk(e){return"middle"===e||"center"===e}function Sk(e,t,n,i,a){for(var r=[],o=[],s=[],l=0;l=0||e===t}function Tk(e){var t=(e.ecModel.getComponent("axisPointer")||{}).coordSysAxesInfo;return t&&t.axesInfo[Ek(e)]}function Ik(e){return!!e.get(["handle","show"])}function Ek(e){return e.type+"||"+e.id}var Mk={},kk=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(t,n,i,a){this.axisPointerClass&&function(e){var t=Tk(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=Ik(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=Pr({color:d.color},o));var m=Er(Ir(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(Hr(l)){var h=m.name;m.name=l.replace("{value}",null!=h?h:"")}else jr(l)&&(m.name=l(m.name,m));var g=new uy(m,null,this.ecModel);return Ar(g,tI.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:Er({lineStyle:{color:"#bbb"}},Kk.axisLine),axisLabel:Yk(Kk.axisLabel,!1),axisTick:Yk(Kk.axisTick,!1),splitLine:Yk(Kk.splitLine,!0),splitArea:Yk(Kk.splitArea,!0),indicator:[]},t}(Sv),Zk=["axisLine","axisTickLabel","axisName"],Qk=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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;Rr(Br(t.getIndicatorAxes(),(function(e){var n=e.model.get("showName")?e.name:"";return new yk(e.model,{axisName:n,position:[t.cx,t.cy],rotation:e.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})})),(function(e){Rr(Zk,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=Ur(c)?c:[c],m=Ur(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;sP(this,"zoom","zoomOnMouseWheel",e,{scale:i>0?s:1/s,originX:r,originY:o,isAvailableBehavior:null})}if(n){var l=Math.abs(i);sP(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){aP(this._zr,"globalPan")||sP(this,"zoom",null,e,{scale:e.pinchScale>1?1.1:1/1.1,originX:e.pinchX,originY:e.pinchY,isAvailableBehavior:null})},t}(Uo);function sP(e,t,n,i,a){e.pointerChecker&&e.pointerChecker(i,a.originX,a.originY)&&(ls(i.event),lP(e,t,n,i,a))}function lP(e,t,n,i,a){a.isAvailableBehavior=Gr(pP,null,n,i),e.trigger(t,a)}function pP(e,t,n){var i=n[e];return!e||i&&(!Hr(i)||t.event[i+"Key"])}function cP(e,t,n){var i=e.target;i.x+=t,i.y+=n,i.dirty()}function dP(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 uP,mP={axisPointer:1,tooltip:1,brush:1};function hP(e,t,n){var i=t.getComponentByElement(e.topTarget),a=i&&i.coordinateSystem;return i&&i!==n&&!mP.hasOwnProperty(i.mainType)&&a&&a.model!==n}function gP(e){Hr(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 fP={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"},yP=qr(fP),vP={"alignment-baseline":"textBaseline","stop-color":"stopColor"},xP=qr(vP),bP=function(){function e(){this._defs={},this._root=null}return e.prototype.parse=function(e,t){t=t||{};var n=gP(e);this._defsUsePending=[];var i=new Mc;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),IP(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=RP(l,{x:0,y:0,width:o,height:s}),!t.ignoreViewBox)){var u=i;(i=new Mc).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 Em({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=uP[s];if(p&&bo(uP,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=wP[s];if(u&&bo(wP,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 ym({style:{text:e.textContent},silent:!0,x:this._textX||0,y:this._textY||0});_P(t,n),IP(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(uP={g:function(e,t){var n=new Mc;return _P(t,n),IP(e,n,this._defsUsePending,!1,!1),n},rect:function(e,t){var n=new Em;return _P(t,n),IP(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 sg;return _P(t,n),IP(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 Fg;return _P(t,n),IP(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 pg;return _P(t,n),IP(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=TP(i));var a=new kg({shape:{points:n||[]},silent:!0});return _P(t,a),IP(e,a,this._defsUsePending,!1,!1),a},polyline:function(e,t){var n,i=e.getAttribute("points");i&&(n=TP(i));var a=new Dg({shape:{points:n||[]},silent:!0});return _P(t,a),IP(e,a,this._defsUsePending,!1,!1),a},image:function(e,t){var n=new bm;return _P(t,n),IP(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 Mc;return _P(t,o),IP(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 Mc;return _P(t,o),IP(e,o,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(r),o},path:function(e,t){var n=rg(e.getAttribute("d")||"");return _P(t,n),IP(e,n,this._defsUsePending,!1,!1),n.silent=!0,n}}),e}(),wP={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 Ug(t,n,i,a);return SP(e,r),CP(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 jg(t,n,i);return SP(e,a),CP(e,a),a}};function SP(e,t){"userSpaceOnUse"===e.getAttribute("gradientUnits")&&(t.global=!0)}function CP(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={};FP(n,r,r);var o=r.stopColor||n.getAttribute("stop-color")||"#000000";t.colorStops.push({offset:a,color:o})}n=n.nextSibling}}function _P(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),Pr(t.__inheritedStyle,e.__inheritedStyle))}function TP(e){for(var t=PP(e),n=[],i=0;i0;r-=2){var o=i[r],s=i[r-1],l=PP(o);switch(a=a||[1,0,0,1,0,0],s){case"translate":fs(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":vs(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":ys(a,a,-parseFloat(l[0])*OP,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":gs(a,[1,0,Math.tan(parseFloat(l[0])*OP),1,0,0],a);break;case"skewY":gs(a,[1,Math.tan(parseFloat(l[0])*OP),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),FP(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=fo(),n=fo(),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;zf(t,Uf(i),{labelFetcher:u,labelDataIndex:d,defaultText:n},m);var h=t.getTextContent();if(h&&(QP(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 aD(e,t,n,i,a,r){e.data?e.data.setItemGraphicEl(r,t):Um(t).eventData={componentType:"geo",componentIndex:a.componentIndex,geoIndex:a.componentIndex,name:n,region:i&&i.option||{}}}function rD(e,t,n,i,a){e.data||Rf({el:t,componentModel:a,itemName:n,itemTooltipOption:i.get("tooltip")})}function oD(e,t,n,i,a){t.highDownSilentOnTouch=!!a.get("selectedMode");var r=i.getModel("emphasis"),o=r.get("focus");return Oh(t,o,r.get("blurScope"),r.get("disabled")),e.isGeo&&function(e,t,n){var i=Um(e);i.componentMainType=t.mainType,i.componentIndex=t.componentIndex,i.componentHighDownName=n}(t,a,n),o}function sD(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(),Rr(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"}}(ow);var lD=Lo,pD=function(e){function t(t){var n=e.call(this)||this;return n.type="view",n.dimensions=["x","y"],n._roamTransformable=new oc,n._rawTransformable=new oc,n.name=t,n}return ze(t,e),t.prototype.setBoundingRect=function(e,t,n,i){return this._rect=new Ps(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 Ps(e,t,n,i)},t.prototype._transformTo=function(e,t,n,i){var a=this.getBoundingRect(),r=this._rawTransformable;r.transform=a.calculateTransform(new Ps(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=[Vc(e[0],t.getWidth()),Vc(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=Lo([],i,e),n=Lo([],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(),hs(this.transform||(this.transform=[]),t.transform||[1,0,0,1,0,0]),this._rawTransform=t.getLocalTransform(),this.invTransform=this.invTransform||[],xs(this.invTransform,this.transform),this.decomposeTransform()},t.prototype.getTransformInfo=function(){var e=this._rawTransformable,t=this._roamTransformable,n=new oc;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?lD(n,e,i):_o(n,e)},t.prototype.pointToData=function(e){var t=this.invTransform;return t?lD([],e,t):[e[0],e[1]]},t.prototype.convertToPixel=function(e,t,n){var i=cD(t);return i===this?i.dataToPoint(n):null},t.prototype.convertFromPixel=function(e,t,n){var i=cD(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}(oc);function cD(e){var t=e.seriesModel;return t?t.coordinateSystem:null}var dD={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},uD=["lng","lat"],mD=function(e){function t(t,n,i){var a=e.call(this,t)||this;a.dimensions=uD,a.type="geo",a._nameCoordMap=fo(),a.map=n;var r,o=i.projection,s=$P(n,i.nameMap,i.nameProperty),l=WP(n),p=(a.resourceType=l?l.type:null,a.regions=s.regions),c=dD[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=gv(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"))}Ar(mD,pD);var fD=function(){function e(){this.dimensions=uD}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 mD(r+a,r,kr({nameMap:e.get("nameMap")},i(e)));o.zoomLimit=e.get("scaleLimit"),n.push(o),e.coordinateSystem=o,o.model=e,o.resize=gD,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)}})),Rr(a,(function(e,a){var r=Br(e,(function(e){return e.get("nameMap")})),o=new mD(a,a,kr({nameMap:Mr(r)},i(e[0])));o.zoomLimit=no.apply(null,Br(e,(function(e){return e.get("scaleLimit")}))),n.push(o),o.resize=gD,o.resize(e[0],t),Rr(e,(function(e){e.coordinateSystem=o,function(e,t){Rr(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=fo(),o=0;ov.x)||(b-=Math.PI);var C=w?"left":"right",_=s.getModel("label"),T=_.get("rotate"),I=T*(Math.PI/180),E=f.getTextContent();E&&(f.setTextConfig({position:_.get("position")||C,rotation:null==T?-b:I,origin:"center"}),E.setStyle("verticalAlign","middle"))}var M=s.get(["emphasis","focus"]),k="relative"===M?yo(o.getAncestorsIndices(),o.getDescendantIndices()):"ancestor"===M?o.getAncestorsIndices():"descendant"===M?o.getDescendantIndices():null;k&&(Um(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 Lg({shape:ID(c,d,u,a,a)})),tf(g,{shape:ID(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(Hr(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 VD(e){for(var t=[];e;)(e=e.parentNode)&&t.push(e);return t.reverse()}function qD(e,t){return Dr(VD(e),t)>=0}function GD(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}ze(t,e),t.prototype.getInitialData=function(e){var t={name:e.name,children:e.data},n=e.leaves||{},i=new uy(n,this,this.ecModel),a=ND.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 jb("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=GD(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}}(ow);function zD(e){var t=e.getData().tree,n={};t.eachNode((function(t){for(var i=t;i&&i.depth>1;)i=i.parentNode;var a=Zv(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}ze(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};UD(n);var i=e.levels||[],a=this.designatedVisualItemStyle={},r=new uy({itemStyle:a},this,t);i=e.levels=function(e,t){var n,i,a=dd(t.get("color")),r=dd(t.get(["aria","decal","decals"]));if(!a)return;e=e||[],Rr(e,(function(e){var t=new uy(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=Br(i||[],(function(e){return new uy(e,r,t)}),this),s=ND.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 jb("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=GD(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(e){this.layoutInfo=this.layoutInfo||{},kr(this.layoutInfo,e)},t.prototype.mapIdToIndex=function(e){var t=this._idIndexMap;t||(t=this._idIndexMap=fo(),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(){zD(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:[]}}(ow);function UD(e){var t=0;Rr(e.children,(function(e){UD(e);var n=e.value;Ur(n)&&(n=n[0]),t+=n}));var n=e.value;Ur(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),Ur(e.value)?e.value[0]=n:e.value=n}var jD=function(){function e(e){this.group=new Mc,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),fv(r,c.pos,c.box)}},e.prototype._prepare=function(e,t,n){for(var i=e;i;i=i.parentNode){var a=xd(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=Vc(s.left,c),m=Vc(s.top,d),h=Vc(s.right,c),g=Vc(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=nv(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,I=_.width,E=_.text;b>x.width&&(b-=I-y,I=y,E=null);var M=new kg({shape:{points:HD(f,0,I,v,C===w.length-1,0===C)},style:Pr(n.getItemStyle(),{lineJoin:"bevel"}),textContent:new Pm({style:jf(a,{text:E})}),textConfig:{position:"inside"},z2:1e5,onclick:zr(o,T)});M.disableLabelAnimation=!0,M.getTextContent().ensureState("emphasis").style=jf(r,{text:E}),M.ensureState("emphasis").style=S,Oh(M,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(M),WD(M,e,T),f+=I+8}},e.prototype.remove=function(){this.group.removeAll()},e}();function HD(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 WD(e,t,n){Um(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&&GD(n,t)}}var $D=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 Ps(a.x,a.y,a.width,a.height),o=this.seriesModel.layoutInfo,s=[1,0,0,1,0,0];fs(s,s,[-(t-=o.x),-(n-=o.y)]),vs(s,s,[e.scale,e.scale]),fs(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&&pv(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 jD(this.group))).render(e,t,n.node,(function(t){"animating"!==i._state&&(qD(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"}(vw);var tO=Rr,nO=Kr,iO=-1,aO=function(){function e(t){var n=t.mappingMethod,i=t.type,a=this.option=Ir(t);this.type=i,this.mappingMethod=n,this._normalizeData=hO[n];var r=e.visualHandlers[i];this.applyVisual=r.applyVisual,this.getColorMapper=r.getColorMapper,this._normalizedToVisual=r._normalizedToVisual[n],"piecewise"===n?(rO(a),function(e){var t=e.pieceList;e.hasSpecialVisual=!1,Rr(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(tO(t,(function(e,t){n[e]=t})),!Ur(i)){var a=[];Kr(i)?tO(i,(function(e,t){var i=n[t];a[null!=i?i:iO]=e})):a[-1]=i,i=mO(e,a)}for(var r=t.length-1;r>=0;r--)null==i[r]&&(delete n[t[r]],t.pop())}(a):rO(a,!0):(so("linear"!==n||a.dataExtent),rO(a))}return e.prototype.mapValueToVisual=function(e){var t=this._normalizeData(e);return this._normalizedToVisual(t,e)},e.prototype.getNormalizer=function(){return Gr(this._normalizeData,this)},e.listVisualTypes=function(){return qr(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(e,t,n){Kr(e)?Rr(e,t,n):t.call(n,e)},e.mapVisual=function(t,n,i){var a,r=Ur(t)?[]:Kr(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&&tO(e.visualHandlers,(function(e,a){t.hasOwnProperty(a)&&(i[a]=t[a],n=!0)})),n?i:null},e.prepareVisualTypes=function(e){if(Ur(e))e=e.slice();else{if(!nO(e))return[];var t=[];tO(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}(Mc),zO=function(){function e(e){this.group=new Mc,this._LineCtor=e||GO}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=UO(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=UO(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 JO(e,t){var n=[],i=bl,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=[To(l[0]),To(l[1])],l[2]&&l.__original.push(To(l[2])));var d=l.__original;if(null!=l[2]){if(_o(a[0],d[0]),_o(a[1],d[2]),_o(a[2],d[1]),p&&"none"!==p){var u=TO(e.node1),m=QO(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=TO(e.node2),m=QO(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]}_o(l[0],a[0]),_o(l[1],a[2]),_o(l[2],a[1])}else{if(_o(r[0],d[0]),_o(r[1],d[1]),Mo(o,r[1],r[0]),Oo(o,o),p&&"none"!==p){u=TO(e.node1);Eo(r[0],r[0],o,u*t)}if(c&&"none"!==c){u=TO(e.node2);Eo(r[1],r[1],o,-u*t)}_o(l[0],r[0]),_o(l[1],r[1])}}))}function eA(e){return"view"===e.type}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(e,t){var n=new CE,i=new zO,a=this.group;this._controller=new oP(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(eA(a)){var l={x:a.x,y:a.y,scaleX:a.scaleX,scaleY:a.scaleY};this._firstRender?s.attr(l):tf(s,l,e)}JO(e.getGraph(),_O(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),MO(e,"symbolSize",t,[r.offsetX,r.offsetY]),i.updateLayout(e);break;default:p.setItemLayout(n,[a.x,a.y]),CO(e.getGraph(),e),i.updateLayout(e)}})).on("dragend",(function(){d&&d.setUnfixed(n)})),a.setDraggable(o,!!r.get("cursor")),"adjacency"===r.get(["emphasis","focus"])&&(Um(a).focus=t.getAdjacentDataIndices())}})),p.graph.eachEdge((function(e){var t=e.getGraphicEl(),n=e.getModel().get(["emphasis","focus"]);t&&"adjacency"===n&&(Um(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){PO(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)&&!hP(t,n,e)})),eA(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){cP(r,t.dx,t.dy),n.dispatchAction({seriesId:e.id,type:"graphRoam",dx:t.dx,dy:t.dy})})).on("zoom",(function(t){dP(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(),JO(e.getGraph(),_O(e)),i._lineDraw.updateLayout(),n.updateLabelLayout()}))):a.disable()},t.prototype._updateNodeAndLinkScale=function(){var e=this._model,t=e.getData(),n=_O(e);t.eachItemGraphicEl((function(e,t){e&&e.setSymbolScale(n)}))},t.prototype.updateLayout=function(e){JO(e.getGraph(),_O(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"}(vw);function tA(e){return"_EC_"+e}var nA=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[tA(e)]){var i=new iA(e,t);return i.hostGraph=this,this.nodes.push(i),n[tA(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[tA(e)]},e.prototype.addEdge=function(e,t,n){var i=this._nodesMap,a=this._edgesMap;if($r(e)&&(e=this.nodes[e]),$r(t)&&(t=this.nodes[t]),e instanceof iA||(e=i[tA(e)]),t instanceof iA||(t=i[tA(t)]),e&&t){var r=e.id+"-"+t.id,o=new aA(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 iA&&(e=e.id),t instanceof iA&&(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 iA||(t=this._nodesMap[tA(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 oA(e,t,n,i,a){for(var r=new nA(i),o=0;o "+u)),p++)}var m,h=n.get("coordinateSystem");if("cartesian2d"===h||"polar"===h)m=K_(e,n);else{var g=sx.get(h),f=g&&g.dimensions||[];Dr(f,"value")<0&&f.concat(["value"]);var y=q_(e,{coordDimensions:f,encodeDefine:n.getEncode()}).dimensions;(m=new V_(y,n)).initData(e)}var v=new V_(["value"],n);return v.initData(l,s),a&&a(m,v),MD({mainData:m,struct:r,structAttr:"graph",datas:{node:m,edge:v},datasAttr:{node:"data",edge:"edgeData"}}),r.update(),r}Ar(iA,rA("hostGraph","data")),Ar(aA,rA("hostGraph","edgeData"));!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments);var n=this;function i(){return n._categoriesData}this.legendVisualProvider=new qM(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),ud(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){yO(n=this)&&(n.__curvenessList=[],n.__edgeMap={},vO(n));var o=oA(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=uy.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 Rr(o.edges,(function(e){!function(e,t,n,i){if(yO(n)){var a=xO(e,t,n),r=n.__edgeMap,o=r[bO(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),jb("nameValue",{name:l.join(" > "),value:a.value,noValue:null==a.value})}return nw({series:this,dataIndex:e,multipleSeries:t})},t.prototype._updateCategoriesData=function(){var e=Br(this.option.categories||[],(function(e){return null!=e.value?e:kr({value:0},e)})),t=new V_(["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"}}}}(ow);var sA=function(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0},lA=function(e){function t(t){var n=e.call(this,t)||this;return n.type="pointer",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new sA},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}(gm);function pA(e,t){var n=null==e?"":e+"";return t&&(Hr(t)?n=t.replace("{value}",n):jr(t)&&(n=t(e))),n}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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:Vc(n[0],t.getWidth()),cy:Vc(n[1],t.getHeight()),r:Vc(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")?iM:_g,d=p.get("show"),u=p.getModel("lineStyle"),m=u.get("width"),h=[s,l];Ku(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:$r(N)&&(L=N*Math.PI/180),0===L?d.add(new Pm({style:jf(x,{text:A,x:R,y:B,verticalAlign:c<-.8?"top":c>.8?"bottom":"middle",align:p<-.4?"left":p>.4?"right":"center"},{inheritColor:F}),silent:!0})):d.add(new Pm({style:jf(x,{text:A,x:R,y:B,verticalAlign:"middle",align:"center"},{inheritColor:F}),silent:!0,originX:R,originY:B,rotation:L}))}if(v.get("show")&&P!==b){O=(O=v.get("distance"))?O+l:l;for(var V=0;V<=w;V++){p=Math.cos(_),c=Math.sin(_);var q=new Fg({shape:{x1:p*(h-O)+u,y1:c*(h-O)+m,x2:p*(h-C-O)+u,y2:c*(h-C-O)+m},silent:!0,style:M});"auto"===M.stroke&&q.setStyle({stroke:i((P+V/w)/b)}),d.add(q),_+=I}_-=I}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=Vc(r.get("width"),a.r),s=Vc(r.get("length"),a.r),l=e.get(["pointer","icon"]),p=r.get("offsetCenter"),c=Vc(p[0],a.r),d=Vc(p[1],a.r),u=r.get("keepAspect");return(i=l?PS(l,c-o/2,d-s,o,s,null,u):new lA({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")?iM:_g,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);nf(i,{rotation:-((isNaN(+n)?w[0]:Lc(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");nf(a,{shape:{endAngle:Lc(n,b,w,o)}},e),p.add(a),jm(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,tf(s,{rotation:-((isNaN(+i)?w[0]:Lc(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");tf(v,{shape:{endAngle:Lc(i,b,w,x)}},e),p.add(v),jm(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 bm){var c=s.style;s.useStyle(kr({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(Lc(f.get(y,e),b,[0,1],!0))),s.z2EmphasisLift=0,Bh(s,t),Oh(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,Bh(d,t),Oh(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=PS(a,t.cx-i/2+Vc(r[0],t.r),t.cy-i/2+Vc(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 Mc,d=[],u=[],m=e.isAnimationEnabled(),h=e.get(["pointer","showAbove"]);o.diff(this._data).add((function(e){d[e]=new Pm({silent:!0}),u[e]=new Pm({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 Mc,f=i(Lc(r,[l,p],[0,1],!0)),y=n.getModel("title");if(y.get("show")){var v=y.get("offsetCenter"),x=a.cx+Vc(v[0],a.r),b=a.cy+Vc(v[1],a.r);(M=d[t]).attr({z2:h?0:2,style:jf(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+Vc(S[0],a.r),_=a.cy+Vc(S[1],a.r),T=Vc(w.get("width"),a.r),I=Vc(w.get("height"),a.r),E=e.get(["progress","show"])?o.getItemVisual(t,"style").fill:f,M=u[t],k=w.get("formatter");M.attr({z2:h?0:2,style:jf(w,{x:C,y:_,text:pA(r,k),width:isNaN(T)?null:T,height:isNaN(I)?null:I,align:"center",verticalAlign:"middle"},{inheritColor:E})}),Qf(M,{normal:w},r,(function(e){return pA(e,k)})),m&&Jf(M,t,o,e,{getFormattedLabel:function(e,t,n,i,a,o){return pA(o?o.interpolatedValue:r,k)}}),g.add(M)}c.add(g)})),this.group.add(c),this._titleEls=d,this._detailEls=u},t.type="gauge"})(vw),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.visualStyleAccessPath="itemStyle",n}ze(t,e),t.prototype.getInitialData=function(e,t){return VM(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}}}(ow);var cA=["itemStyle","opacity"],dA=function(e){function t(t,n){var i=e.call(this)||this,a=i,r=new Dg,o=new Pm;return a.setTextContent(o),i.setTextGuideLine(r),i.updateData(t,n,!0),i}return ze(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(cA);l=null==l?1:l,n||lf(i),i.useStyle(e.getItemVisual(t,"style")),i.style.lineJoin="round",n?(i.setShape({points:o.points}),i.style.opacity=0,nf(i,{style:{opacity:l}},a,t)):tf(i,{style:{opacity:l},shape:{points:o.points}},a,t),Bh(i,r),this._updateLabel(e,t),Oh(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;zf(a,Uf(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 ws(c[0][0],c[0][1]):null},tf(a,{style:{x:s.x,y:s.y}},r,t),a.attr({rotation:s.rotation,originX:s.x,originY:s.y,z2:10}),QI(n,JI(o),{stroke:p})},t}(kg);(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreLabelLineUpdate=!0,n}ze(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 dA(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){sf(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"})(vw),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(t){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new qM(Gr(this.getData,this),Gr(this.getRawData,this)),this._defaultLabelLine(t)},t.prototype.getInitialData=function(e,t){return VM(this,{coordDimensions:["value"],encodeDefaulter:zr(qv,this)})},t.prototype._defaultLabelLine=function(e){ud(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"}}}}(ow);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._dataGroup=new Mc,n._initialized=!1,n}ze(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=hA(e);if(r.diff(o).add((function(e){gA(mA(r,a,e,l,s),r,e,p)})).update((function(t,n){var i=o.getItemGraphicEl(n),a=uA(r,t,l,s);r.setItemGraphicEl(t,i),tf(i,{shape:{points:a}},e,t),lf(i),gA(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 Em({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),nf(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=hA(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&&vA(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 vA(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}ze(t,e),t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(e){var t=this.option;e&&Er(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){Rr(["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=[];Rr(Lr(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}}(Sv);var xA=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 ze(t,e),t.prototype.isHorizontal=function(){return"horizontal"!==this.coordinateSystem.getModel().get("layout")},t}(MI);function bA(e,t,n,i,a,r){e=e||0;var o=n[1]-n[0];if(null!=a&&(a=SA(a,[0,o])),null!=r&&(r=Math.max(r,null!=a?a:0)),"all"===i){var s=Math.abs(t[1]-t[0]);s=SA(s,[0,o]),a=r=SA(s,[a,r]),i=0}t[0]=SA(t[0],n),t[1]=SA(t[1],n);var l=wA(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]=SA(t[i],d),p=wA(t,i),null!=a&&(p.sign!==l.sign||p.spanr&&(t[1-i]=t[i]+p.sign*r),t}function wA(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 SA(e,t){return Math.min(null!=t[1]?t[1]:1/0,Math.max(null!=t[0]?t[0]:-1/0,e))}var CA=Rr,_A=Math.min,TA=Math.max,IA=Math.floor,EA=Math.ceil,MA=qc,kA=Math.PI;!function(){function e(e,t,n){this.type="parallel",this._axesMap=fo(),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;CA(i,(function(e,n){var i=a[n],r=t.getComponent("parallelAxis",i),o=this._axesMap.set(e,new xA(e,KT(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();CA(this.dimensions,(function(e){var t=this._axesMap.get(e);t.scale.unionExtentFromData(i,i.mapDimension(e)),$T(t.scale,t.model)}),this)}}),this)},e.prototype.resize=function(e,t){this._rect=gv(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=PA(t.get("axisExpandWidth"),l),d=PA(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=PA(m[1]-m[0],l),m[1]=m[0]+e):(e=PA(c*(d-1),l),(m=[c*(t.get("axisExpandCenter")||IA(p/2))-e/2])[1]=m[0]+e);var h=(s-e)/(p-d);h<3&&(h=0);var g=[IA(MA(m[0]/c,1))+1,EA(MA(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])})),CA(n,(function(t,n){var r=(i.axisExpandable?OA:DA)(n,i),o={horizontal:{x:r.position,y:i.axisLength},vertical:{x:0,y:r.position}},s={horizontal:kA/2,vertical:0},l=[o[a].x+e.x,o[a].y+e.y],p=s[a],c=[1,0,0,1,0,0];ys(c,c,p),fs(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=[];Rr(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)?bA(o,i,r,"all"):l="none";else{var u=i[1]-i[0];(i=[TA(0,r[1]*s/u-u/2)])[1]=_A(r[1],i[0]+u),i[0]=i[1]-u}return{axisExpandWindow:i,behavior:l}}}();function PA(e,t){return _A(TA(e,t[0]),t[1])}function DA(e,t){var n=t.layoutLength/(t.axisCount-1);return{position:n*e,axisNameAvailableWidth:n,axisLabelShow:!0}}function OA(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--)Gc(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&&QA(e);var l=Ir(s);l.brushType=gF(l.brushType,o),l.panelId=o===FA?null:o.panelId,r=e._creatingCover=jA(e,l),e._covers.push(r)}if(r){var p=vF[gF(e._brushType,o)];r.__brushOption.range=p.getCreatingRange(dF(e,r,e._track)),i&&(HA(e,r),p.updateCommon(e,r)),WA(e,r),a={isEnd:i}}}else i&&"single"===s.brushMode&&s.removeOnClick&&XA(e,t,n)&&QA(e)&&(a={isEnd:i,removeOnClick:!0});return a}function gF(e,t){return"auto"===e?t.defaultBrushType:e}var fF={mousedown:function(e){if(this._dragging)yF(this,e);else if(!e.target||!e.target.draggable){uF(e);var t=this.group.transformCoordToLocal(e.offsetX,e.offsetY);this._creatingCover=null,(this._creatingPanel=XA(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=XA(e,t,n);if(!e._dragging)for(var o=0;o=0&&(r[a[o].depth]=new uy(a[o],this,t));if(i&&n){var s=oA(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 jb("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 jb("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}}(ow);var MF=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=[];Rr(g,(function(e,t){var n;Ur(e)?(n=e.slice(),e.unshift(t)):Ur(e.value)?((n=kr({},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:v_(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:d,type:v_(h),dimsDef:y.slice()}];return VM(this,{coordDimensions:v,dimensionsCount:y.length+1,encodeDefaulter:zr(Vv,v,this)})},e.prototype.getBaseAxis=function(){var e=this._baseAxisDim;return this.ecModel.getComponent(e+"Axis",this.get(e+"AxisIndex")).axis},e}(),kF=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 ze(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}(ow);Ar(kF,MF,!0);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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=OF(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?(lf(n),AF(s,n,i,e)):n=OF(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"}(vw);var PF=function(){},DF=function(e){function t(t){var n=e.call(this,t)||this;return n.type="boxplotBoxPath",n}return ze(t,e),t.prototype.getDefaultShape=function(){return new PF},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(RF);t.useStyle(r),t.style.fill=null,t.style.stroke=a}var WF=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 ze(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}(ow);Ar(WF,MF,!0);var $F=["itemStyle","borderColor"],KF=["itemStyle","borderColor0"],YF=["itemStyle","borderColorDoji"],XF=["itemStyle","color"],ZF=["itemStyle","color0"];gw(),gw();function QF(e,t,n,i,a,r){return n>i?-1:n0?e.get(a,t-1)<=i?1:-1:1}function JF(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 eR=function(e){function t(t,n){var i=e.call(this)||this,a=new vE(t,n),r=new Mc;return i.add(a),i.add(r),i.updateData(t,n),i}return ze(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=jr(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 Fo(e.__p1,e.__cp1)+Fo(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=yl,l=vl;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}(tR),aR=function(){this.polyline=!1,this.curveness=0,this.segs=[]},rR=function(e){function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return ze(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 aR},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(Qu(p,c,(p+u)/2-(c-m)*a,(c+m)/2-(u-p)*a,u,m,r,e,t))return o}else if(Xu(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}(),sR={seriesType:"lines",plan:gw(),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)&&BE(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=sR.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 oR:new zO(a?i?iR:nR:i?tR:GO),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"}(vw),"undefined"==typeof Uint32Array?Array:Uint32Array),pR="undefined"==typeof Float64Array?Array:Float64Array;function cR(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=Br(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),Mr([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}ze(t,e),t.prototype.init=function(t){t.data=t.data||[],cR(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(cR(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=yo(this._flatCoords,t.flatCoords),this._flatCoordsOffset=yo(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}}}(ow);var dR=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var e=dr.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=dr.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 uR(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}ze(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()):uR(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&&(uR(a)?this.render(t,n,i):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(t,i,e.start,e.end,!0)))},t.prototype.eachRendered=function(e){Nf(this._progressiveEls||this.group,e)},t.prototype._renderOnCartesianAndCalendar=function(e,t,n,i,a){var r,o,s,l,p=e.coordinateSystem,c=NE(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=Uf(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]);I=new Em({shape:{x:P[0]-r/2,y:P[1]-o/2,width:r,height:o},style:E})}else{if(isNaN(h.get(_[1],T)))continue;I=new Em({z2:1,shape:p.dataToRect([h.get(_[0],T)]).contentShape,style:E})}if(h.hasItemOption){var D=h.getItemModel(T),O=D.getModel("emphasis");g=O.getModel("itemStyle").getItemStyle(),f=D.getModel(["blur","itemStyle"]).getItemStyle(),y=D.getModel(["select","itemStyle"]).getItemStyle(),v=D.get(["itemStyle","borderRadius"]),w=O.get("focus"),S=O.get("blurScope"),C=O.get("disabled"),x=Uf(D)}I.shape.r=v;var A=e.getRawValue(T),F="-";A&&null!=A[2]&&(F=A[2]+""),zf(I,x,{labelFetcher:e,labelDataIndex:T,defaultOpacity:E.opacity,defaultText:F}),I.ensureState("emphasis").style=g,I.ensureState("blur").style=f,I.ensureState("select").style=y,Oh(I,w,S,C),I.incremental=a,a&&(I.states.emphasis.hoverLayer=!0),m.add(I),h.setItemGraphicEl(T,I),this._progressiveEls&&this._progressiveEls.push(I)}},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 dR;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=Br(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=Ur(h)?h.slice():null==h?["100%","100%"]:[h,h];c[u.index]=Vc(c[u.index],m),c[d.index]=Vc(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(mR)||0;r&&(gR.attr({scaleX:t[0],scaleY:t[1],rotation:n}),gR.updateTransform(),r/=gR.getLineScale(),r*=t[i.valueDim.index]);a.valueLineWidth=r||0}(n,d.symbolScale,l,i,d);var u=d.symbolSize,m=OS(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=no(e.get("symbolMargin"),"15%")+"",x=!1;v.lastIndexOf("!")===v.length-1&&(x=!0,v=v.slice(0,v.length-1));var b=Vc(v,t[m.index]),w=Math.max(g+2*b,0),S=x?0:2*b,C=nd(i),_=C?i:OR((y+S)/w);w=g+2*(b=(y-_*g)/2/(x?_:Math.max(_-1,1))),S=x?0:2*b,C||"fixed"===i||(_=p?OR((Math.abs(p)+S)/w):0),f=_*w-S,d.repeatTimes=_,d.symbolMargin=b}var T=h*(f/2),I=d.pathPosition=[];I[u.index]=n[u.wh]/2,I[m.index]="start"===o?T:"end"===o?l-T:l/2,r&&(I[0]+=r[0],I[1]+=r[1]);var E=d.bundlePosition=[];E[u.index]=n[u.xy],E[m.index]=n[m.xy];var M=d.barRectShape=kr({},n);M[m.wh]=h*Math.max(Math.abs(n[m.wh]),Math.abs(I[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 yR(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function vR(e){var t=e.symbolPatternSize,n=PS(e.symbolType,-t/2,-t/2,t,t);return n.attr({culling:!0}),"image"!==n.type&&n.setStyle({strokeNoScale:!0}),n}function xR(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(kR(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 bR(e,t,n,i){var a=e.__pictorialBundle,r=e.__pictorialMainPath;r?PR(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=vR(n),a.add(r),PR(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 wR(e,t,n){var i=kr({},t.barRectShape),a=e.__pictorialBarRect;a?PR(a,null,{shape:i},t,n):((a=e.__pictorialBarRect=new Em({z2:2,shape:i,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}})).disableMorphing=!0,e.add(a))}function SR(e,t,n,i){if(n.symbolClip){var a=e.__pictorialClipPath,r=kr({},n.clipShape),o=t.valueDim,s=n.animationModel,l=n.dataIndex;if(a)tf(a,{shape:r},s,l);else{r[o.wh]=0,a=new Em({shape:r}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var p={};p[o.wh]=n.clipShape[o.wh],Lf[i?"updateProps":"initProps"](a,{shape:p},s,l)}}}function CR(e,t){var n=e.getItemModel(t);return n.getAnimationDelayParams=_R,n.isAnimationEnabled=TR,n}function _R(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function TR(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function IR(e,t,n,i){var a=new Mc,r=new Mc;return a.add(r),a.__pictorialBundle=r,r.x=n.bundlePosition[0],r.y=n.bundlePosition[1],n.symbolRepeat?xR(a,t,n):bR(a,0,n),wR(a,n,i),SR(a,t,n,i),a.__pictorialShapeStr=MR(e,n),a.__pictorialSymbolMeta=n,a}function ER(e,t,n,i){var a=i.__pictorialBarRect;a&&a.removeTextContent();var r=[];kR(i,(function(e){r.push(e)})),i.__pictorialMainPath&&r.push(i.__pictorialMainPath),i.__pictorialClipPath&&(n=null),Rr(r,(function(e){rf(e,{scaleX:0,scaleY:0},n,t,(function(){i.parent&&i.parent.remove(i)}))})),e.setItemGraphicEl(t,null)}function MR(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function kR(e,t,n){Rr(e.__pictorialBundle.children(),(function(i){i!==e.__pictorialBarRect&&t.call(n,i)}))}function PR(e,t,n,i,a,r){t&&e.attr(t),i.symbolClip&&!a?n&&e.attr(n):n&&Lf[a?"updateProps":"initProps"](e,n,i.animationModel,i.dataIndex,r)}function DR(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");kR(e,(function(e){if(e instanceof bm){var t=e.style;e.useStyle(kr({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,zf(h,Uf(a),{labelFetcher:t.seriesModel,labelDataIndex:i,defaultText:fE(t.seriesModel.getData(),i),inheritColor:n.style.fill,defaultOpacity:n.style.opacity,defaultOutsidePosition:m}),Oh(e,c,d,r.get("disabled"))}function OR(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}ze(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=gy(eM.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"}}})}(eM);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._layers=[],n}ze(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 g_(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&&!Kc(E-T)&&E0?(a.virtualPiece?a.virtualPiece.updateData(!1,i,e,t,n):(a.virtualPiece=new AR(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)pv(o,r.get("target",!0)||"_blank")}n=!0}}))}))},t.prototype._rootToNode=function(e){e!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:FR,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"})(vw),function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.ignoreStyleOnData=!0,n}ze(t,e),t.prototype.getInitialData=function(e,t){var n={name:e.name,children:e.data};RR(n);var i=this._levelModels=Br(e.levels||[],(function(e){return new uy(e,this,t)}),this),a=ND.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=GD(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(){zD(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"}}(ow);function RR(e){var t=0;Rr(e.children,(function(e){RR(e);var n=e.value;Ur(n)&&(n=n[0]),t+=n}));var n=e.value;Ur(n)&&(n=n[0]),(null==n||isNaN(n))&&(n=t),n<0&&(n=0),Ur(e.value)?e.value[0]=n:e.value=n}Math.PI;var BR={color:"fill",borderColor:"stroke"},NR={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},LR=Cd(),VR=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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 K_(null,this)},t.prototype.getDataParams=function(t,n,i){var a=e.prototype.getDataParams.call(this,t,n);return i&&(a.info=LR(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}(ow);function qR(e,t){return t=t||[0,0],Br(["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 GR(e,t){return t=t||[0,0],Br([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 zR(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 UR(e,t){return t=t||[0,0],Br(["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 jR(e,t,n,i){return e&&(e.legacy||!1!==e.legacy&&!n&&!i&&"tspan"!==t&&("text"===t||bo(e,"text")))}function HR(e,t,n){var i,a,r,o=e;if("text"===t)r=o;else{r={},bo(o,"text")&&(r.text=o.text),bo(o,"rich")&&(r.rich=o.rich),bo(o,"textFill")&&(r.fill=o.textFill),bo(o,"textStroke")&&(r.stroke=o.textStroke),bo(o,"fontFamily")&&(r.fontFamily=o.fontFamily),bo(o,"fontSize")&&(r.fontSize=o.fontSize),bo(o,"fontStyle")&&(r.fontStyle=o.fontStyle),bo(o,"fontWeight")&&(r.fontWeight=o.fontWeight),a={type:"text",style:r,silent:!0},i={};var s=bo(o,"textPosition");n?i.position=s?o.textPosition:"inside":s&&(i.position=o.textPosition),bo(o,"textPosition")&&(i.position=o.textPosition),bo(o,"textOffset")&&(i.offset=o.textOffset),bo(o,"textRotation")&&(i.rotation=o.textRotation),bo(o,"textDistance")&&(i.distance=o.textDistance)}return WR(r,e),Rr(r.rich,(function(e){WR(e,e)})),{textConfig:i,textContent:a}}function WR(e,t){t&&(t.font=t.textFont||t.font,bo(t,"textStrokeWidth")&&(e.lineWidth=t.textStrokeWidth),bo(t,"textAlign")&&(e.align=t.textAlign),bo(t,"textVerticalAlign")&&(e.verticalAlign=t.textVerticalAlign),bo(t,"textLineHeight")&&(e.lineHeight=t.textLineHeight),bo(t,"textWidth")&&(e.width=t.textWidth),bo(t,"textHeight")&&(e.height=t.textHeight),bo(t,"textBackgroundColor")&&(e.backgroundColor=t.textBackgroundColor),bo(t,"textPadding")&&(e.padding=t.textPadding),bo(t,"textBorderColor")&&(e.borderColor=t.textBorderColor),bo(t,"textBorderWidth")&&(e.borderWidth=t.textBorderWidth),bo(t,"textBorderRadius")&&(e.borderRadius=t.textBorderRadius),bo(t,"textBoxShadowColor")&&(e.shadowColor=t.textBoxShadowColor),bo(t,"textBoxShadowBlur")&&(e.shadowBlur=t.textBoxShadowBlur),bo(t,"textBoxShadowOffsetX")&&(e.shadowOffsetX=t.textBoxShadowOffsetX),bo(t,"textBoxShadowOffsetY")&&(e.shadowOffsetY=t.textBoxShadowOffsetY))}function $R(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";KR(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,Rr(t.rich,(function(e){KR(e,e)})),i}function KR(e,t){t&&(bo(t,"fill")&&(e.textFill=t.fill),bo(t,"stroke")&&(e.textStroke=t.fill),bo(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),bo(t,"font")&&(e.font=t.font),bo(t,"fontStyle")&&(e.fontStyle=t.fontStyle),bo(t,"fontWeight")&&(e.fontWeight=t.fontWeight),bo(t,"fontSize")&&(e.fontSize=t.fontSize),bo(t,"fontFamily")&&(e.fontFamily=t.fontFamily),bo(t,"align")&&(e.textAlign=t.align),bo(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),bo(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),bo(t,"width")&&(e.textWidth=t.width),bo(t,"height")&&(e.textHeight=t.height),bo(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),bo(t,"padding")&&(e.textPadding=t.padding),bo(t,"borderColor")&&(e.textBorderColor=t.borderColor),bo(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),bo(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),bo(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),bo(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),bo(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),bo(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),bo(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),bo(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),bo(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),bo(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}var YR={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},XR=qr(YR),ZR=(Nr(sc,(function(e,t){return e[t]=1,e}),{}),sc.join(", "),["","style","shape","extra"]),QR=Cd();function JR(e,t,n,i,a){var r=e+"Animation",o=Jg(e,i,a)||{},s=QR(t).userDuring;return o.duration>0&&(o.during=s?Gr(oB,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),kr(o,n[r]),o}function eB(e,t,n,i){var a=(i=i||{}).dataIndex,r=i.isInit,o=i.clearStyle,s=n.isAnimationEnabled(),l=QR(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=qr(n);for(p=0;p0&&e.animateFrom(u,m)}else!function(e,t,n,i,a){if(a){var r=JR("update",e,t,i,n);r.duration>0&&e.animateFrom(a,r)}}(e,t,a||0,n,c);tB(e,t),p?e.dirty():e.markRedraw()}function tB(e,t){for(var n=QR(e).leaveToProps,i=0;i=0){!r&&(r=i[e]={});var u=qr(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:Gr(UR,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 _B(e){return e instanceof gm}function TB(e){return e instanceof mu}var IB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(e,t,n,i){this._progressiveEls=null;var a=this._data,r=e.getData(),o=this.group,s=DB(e,r,t,n);a||o.removeAll(),r.diff(a).add((function(t){AB(n,null,t,s(t,i),e,o,r)})).remove((function(t){var n=a.getItemGraphicEl(t);n&&nB(n,LR(n).option,e)})).update((function(t,l){var p=a.getItemGraphicEl(l);AB(n,p,t,s(t,i),e,o,r)})).execute();var l=e.get("clip",!0)?BE(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=DB(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,hB).getItemStyle(),r=x(i,hB),o=jf(r,null,null,!0,!0);o.text=r.getShallow("show")?ao(e.getFormattedLabel(i,hB),e.getFormattedLabel(i,gB),fE(t,i)):null;var l=Hf(r,null,!0);return w(n,a),a=$R(a,o,l),n&&b(a,n),a.legacy=!0,a},visual:function(e,n){if(null==n&&(n=s),bo(BR,e)){var i=t.getItemVisual(n,"style");return i?i[BR[e]]:null}if(bo(NR,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);VB(t,g,a)}}(e,d,n,i,a),o>=0?r.replaceAt(d,o):r.add(d),d}function RB(e,t,n){var i,a=LR(e),r=t.type,o=t.shape,s=t.style;return n.isUniversalTransitionEnabled()||null!=r&&r!==a.customGraphicType||"path"===r&&((i=o)&&(bo(i,"pathData")||bo(i,"d")))&&UB(o)!==a.customPathData||"image"===r&&bo(s,"image")&&s.image!==a.customImagePath}function BB(e,t,n){var i=t?NB(e,t):e,a=t?LB(e,i,hB):e.style,r=e.type,o=i?i.textConfig:null,s=e.textContent,l=s?t?NB(s,t):s:null;if(a&&(n.isLegacy||jR(a,r,!!o,!!l))){n.isLegacy=!0;var p=HR(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 NB(e,t){return t?e?e[t]:null:e}function LB(e,t,n){var i=t&&t.style;return null==i&&n===hB&&e&&(i=e.styleEmphasis),i}function VB(e,t,n){t&&nB(t,LR(e).option,n)}function qB(e,t){var n=e&&e.name;return null!=n?n:"e\0\0"+t}function GB(e,t){var n=this.context,i=null!=e?n.newChildren[e]:null,a=null!=t?n.oldChildren[t]:null;FB(n.api,a,n.dataIndex,i,n.seriesModel,n.group)}function zB(e){var t=this.context,n=t.oldChildren[e];n&&nB(n,LR(n).option,t.seriesModel)}function UB(e){return e&&(e.pathData||e.d)}function jB(e){e.registerChartView(IB),e.registerSeriesModel(VR)}var HB=Cd(),WB=Ir,$B=Gr,KB=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=zr(YB,t,c);this.updatePointerEl(o,l,d),this.updateLabelEl(o,l,d,t)}else o=this._group=new Mc,this.createPointerEl(o,l,e,t),this.createLabelEl(o,l,e,t),n.getZr().add(o);JB(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=Tk(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=HB(e).pointerEl=new Lf[a.type](WB(t.pointer));e.add(r)}},e.prototype.createLabelEl=function(e,t,n,i){if(t.label){var a=HB(e).labelEl=new Pm(WB(t.label));e.add(a),ZB(a,i)}},e.prototype.updatePointerEl=function(e,t,n){var i=HB(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=HB(e).labelEl;a&&(a.setStyle(t.label.style),n(a,{x:t.label.x,y:t.label.y}),ZB(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=Df(r.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(e){ls(e.event)},onmousedown:$B(this._onHandleDragMove,this,0,0),drift:$B(this._onHandleDragMove,this),ondragend:$B(this._onHandleDragEnd,this)}),i.add(a)),JB(a,n,!1),a.setStyle(r.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var s=r.get("size");Ur(s)||(s=[s,s]),a.scaleX=s[0]/2,a.scaleY=s[1]/2,Mw(this,"_doDispatchAxisPointer",r.get("throttle")||0,"fixRate"),this._moveHandleToValue(e,t)}},e.prototype._moveHandleToValue=function(e,t){YB(this._axisPointerModel,!t&&this._moveAnimation,this._handle,QB(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(QB(n),[e,t],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(QB(i)),HB(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),kw(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 YB(e,t,n,i){XB(HB(n).lastProp,i)||(HB(n).lastProp=i,t?tf(n,i,e):(n.stopAnimation(),n.attr(i)))}function XB(e,t){if(Kr(e)&&Kr(t)){var n=!0;return Rr(t,(function(t,i){n=n&&XB(e[i],t)})),!!n}return e===t}function ZB(e,t){e[t.get(["label","show"])?"show":"hide"]()}function QB(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function JB(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 eN(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 tN(e,t,n,i,a){var r=nN(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=nv(o.get("padding")||0),l=o.getFont(),p=uc(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:jf(o,{text:r,font:l,fill:o.getTextColor(),padding:s,backgroundColor:g}),z2:10}}function nN(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:XT(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};Rr(i,(function(e){var t=n.getSeriesByIndex(e.seriesIndex),i=e.dataIndexInside,a=t&&t.getDataParams(i);a&&s.seriesData.push(a)})),Hr(o)?r=o.replace("{value}",r):jr(o)&&(r=o(s))}return r}function iN(e,t,n){var i=[1,0,0,1,0,0];return ys(i,i,n.rotation),fs(i,i,n.position),Tf([e.dataToCoord(t),(n.labelOffset||0)+(n.labelDirection||1)*(n.labelMargin||0)],i)}function aN(e,t,n,i,a,r){var o=yk.innerTextLayout(n.rotation,0,n.labelDirection);n.labelMargin=a.get(["label","margin"]),tN(t,i,a,r,{position:iN(i.axis,e,n),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function rN(e,t,n){return{x1:e[n=n||0],y1:e[1-n],x2:t[n],y2:t[1-n]}}function oN(e,t,n){return{x:e[n=n||0],y:e[1-n],width:t[n],height:t[1-n]}}function sN(e,t,n,i,a,r){return{cx:e,cy:t,r0:n,r:i,startAngle:a,endAngle:r,clockwise:!0}}var lN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.grid,s=i.get("type"),l=pN(o,r).getOtherAxis(r).getGlobalExtent(),p=r.toGlobalCoord(r.dataToCoord(t,!0));if(s&&"none"!==s){var c=eN(i),d=cN[s](r,p,l);d.style=c,e.graphicKey=d.type,e.pointer=d}aN(t,e,sk(o.model,n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=sk(t.axis.grid.model,t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=iN(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=pN(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}(KB);function pN(e,t){var n={};return n[t.dim+"AxisIndex"]=t.index,e.getCartesian(n)}var cN={line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:rN([t,n[0]],[t,n[1]],dN(e))}},shadow:function(e,t,n){var i=Math.max(1,e.getBandWidth()),a=n[1]-n[0];return{type:"Rect",shape:oN([t-i/2,n[0]],[i,a],dN(e))}}};function dN(e){return"x"===e.dim?0:1}var uN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}(Sv),mN=Cd(),hN=Rr;function gN(e,t,n){if(!rr.node){var i=t.getZr();mN(i).records||(mN(i).records={}),function(e,t){if(mN(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);hN(mN(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)}))}mN(e).initialized=!0,n("click",zr(yN,"click")),n("mousemove",zr(yN,"mousemove")),n("globalout",fN)}(i,t),(mN(i).records[e]||(mN(i).records[e]={})).handler=n}}function fN(e,t,n){e.handler("leave",null,n)}function yN(e,t,n,i){t.handler(e,n,i)}function vN(e,t){if(!rr.node){var n=t.getZr();(mN(n).records||{})[e]&&(mN(n).records[e]=null)}}var xN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.render=function(e,t,n){var i=t.getComponent("tooltip"),a=e.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click";gN("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){vN("axisPointer",t)},t.prototype.dispose=function(e,t){vN("axisPointer",t)},t.type="axisPointer",t}(hw);function bN(e,t){var n,i=[],a=e.seriesIndex;if(null==a||!(n=t.getSeriesByIndex(a)))return{point:[]};var r=n.getData(),o=Sd(r,e);if(null==o||o<0||Ur(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(Br(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 wN=Cd();function SN(e,t,n){var i=e.currTrigger,a=[e.x,e.y],r=e,o=e.dispatchAction||Gr(n.dispatchAction,n),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){EN(a)&&(a=bN({seriesIndex:r.seriesIndex,dataIndex:r.dataIndex},t).point);var l=EN(a),p=r.axesInfo,c=s.axesInfo,d="leave"===i||EN(a),u={},m={},h={list:[],map:{}},g={showPointer:zr(_N,m),showTooltip:zr(TN,h)};Rr(s.coordSysMap,(function(e,t){var n=l||e.containPoint(a);Rr(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&&CN(e,o,g,!1,u)}}))}));var f={};return Rr(c,(function(e,t){var n=e.linkGroup;n&&!m[t]&&Rr(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,IN(t),IN(e)))),f[e.key]=r}}))})),Rr(f,(function(e,t){CN(c[t],e,g,!0,u)})),function(e,t,n){var i=n.axesInfo=[];Rr(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(EN(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=wN(i)[a]||{},o=wN(i)[a]={};Rr(e,(function(e,t){var n=e.axisPointerModel.option;"show"===n.status&&e.triggerEmphasis&&Rr(n.seriesDataIndices,(function(e){var t=e.seriesIndex+" | "+e.dataIndex;o[t]=e}))}));var s=[],l=[];Rr(r,(function(e,t){!o[t]&&l.push(e)})),Rr(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 CN(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 Rr(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),Rr(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&&kr(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 _N(e,t,n,i){e[t.key]={value:n,payloadBatch:i}}function TN(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=Ek(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 IN(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 EN(e){return!e||null==e[0]||isNaN(e[0])||null==e[1]||isNaN(e[1])}function MN(e){kk.registerAxisPointerClass("CartesianAxisPointer",lN),e.registerComponentModel(uN),e.registerComponentView(xN),e.registerPreprocessor((function(e){if(e){(!e.axisPointer||0===e.axisPointer.length)&&(e.axisPointer={});var t=e.axisPointer.link;t&&!Ur(t)&&(e.axisPointer.link=[t])}})),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,(function(e,t){e.getComponent("axisPointer").coordSysAxesInfo=Ck(e,t)})),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},SN)}function kN(e){aI(Gk),aI(MN)}var PN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(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=eN(i),d=DN[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];ys(u,u,s),fs(u,u,[i.cx,i.cy]),l=Tf([o,-a],u);var m=t.getModel("axisLabel").get("rotate")||0,h=yk.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"]));tN(e,n,i,a,u)},t}(KB);var DN={line:function(e,t,n,i){return"angle"===e.dim?{type:"Line",shape:rN(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:sN(t.cx,t.cy,i[0],i[1],(-n-a/2)*r,(a/2-n)*r)}:{type:"Sector",shape:sN(t.cx,t.cy,n-a/2,n+a/2,0,2*Math.PI)}}},ON=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}(Sv),AN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ze(t,e),t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Ed).models[0]},t.type="polarAxis",t}(Sv);Ar(AN,tI);var FN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="angleAxis",t}(AN),RN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="radiusAxis",t}(AN),BN=function(e){function t(t,n){return e.call(this,"radius",t,n)||this}return ze(t,e),t.prototype.pointToData=function(e,t){return this.polar.pointToData(e,t)["radius"===this.dim?0:1]},t}(MI);BN.prototype.dataToRadius=MI.prototype.dataToCoord,BN.prototype.radiusToData=MI.prototype.coordToData;var NN=Cd(),LN=function(e){function t(t,n){return e.call(this,"angle",t,n||[0,360])||this}return ze(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=uc(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=NN(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}(MI);LN.prototype.dataToAngle=MI.prototype.dataToCoord,LN.prototype.angleToData=MI.prototype.coordToData;var VN=["radius","angle"],qN=function(){function e(e){this.dimensions=VN,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new BN,this._angleAxis=new LN,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 GN(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return GN(t)===this?this.pointToData(n):null},e}();function GN(e){var t=e.seriesModel,n=e.polarModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}function zN(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();Rr(eI(t,"radius"),(function(e){a.scale.unionExtentFromData(t,e)})),Rr(eI(t,"angle"),(function(e){i.scale.unionExtentFromData(t,e)}))}})),$T(i.scale,i.model),$T(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 UN(e,t){var n;if(e.type=t.get("type"),e.scale=KT(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 jN={dimensions:VN,create:function(e,t){var n=[];return e.eachComponent("polar",(function(e,i){var a=new qN(i+"");a.update=zN;var r=a.getRadiusAxis(),o=a.getAngleAxis(),s=e.findAxisModel("radiusAxis"),l=e.findAxisModel("angleAxis");UN(r,s),UN(o,l),function(e,t,n){var i=t.get("center"),a=n.getWidth(),r=n.getHeight();e.cx=Vc(i[0],a),e.cy=Vc(i[1],r);var o=e.getRadiusAxis(),s=Math.min(a,r)/2,l=t.get("radius");null==l?l=[0,"100%"]:Ur(l)||(l=[0,l]);var p=[Vc(l[0],s),Vc(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",Ed).models[0];0,e.coordinateSystem=t.coordinateSystem}})),n}},HN=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function WN(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 $N(e){return e.getRadiusAxis().inverse?0:1}function KN(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 YN=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="PolarAxisPointer",n}return ze(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=Br(n.getViewLabels(),(function(e){e=Ir(e);var t=n.scale,i="ordinal"===t.type?t.getRawOrdinalNumber(e.tickValue):e.tickValue;return e.coord=n.dataToCoord(i),e}));KN(s),KN(r),Rr(HN,(function(t){!e.get([t,"show"])||n.scale.isBlank()&&"axisLine"!==t||XN[t](this.group,e,i,r,o,a,s)}),this)}},t.type="angleAxis",t}(kk),XN={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=$N(n),u=d?0:1,m=360===Math.abs(c[1]-c[0])?"Circle":"Arc";(o=0===r[u]?new Lf[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 Ig({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[$N(n)],p=Br(i,(function(e){return new Fg({shape:WN(n,[l,l+s],e.coord)})}));e.add(bf(p,{style:Pr(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[$N(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];Kr(v)&&v.textStyle&&(o=new uy(v.textStyle,l,l.ecModel))}var x=new Pm({silent:yk.isLabelSilent(t),style:jf(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=yk.makeAxisEventDataBase(t);b.targetType="axisLabel",b.value=i.rawLabel,Um(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",I=b;v&&(i[s][_]||(i[s][_]={p:b,n:b}),I=i[s][_][T]);var E=void 0,M=void 0,k=void 0,P=void 0;if("radius"===d.dim){var D=d.dataToCoord(C)-b,O=r.dataToCoord(_);Math.abs(D)=P})}}}))}var aL={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},rL={splitNumber:5},oL=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="polar",t}(hw);function sL(e){aI(MN),kk.registerAxisPointerClass("PolarAxisPointer",PN),e.registerCoordinateSystem("polar",jN),e.registerComponentModel(ON),e.registerComponentView(oL),ek(e,"angle",FN,aL),ek(e,"radius",RN,rL),e.registerComponentView(YN),e.registerComponentView(JN),e.registerLayout(zr(iL,"bar"))}function lL(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),no(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 pL=["axisLine","axisTickLabel","axisName"],cL=["splitArea","splitLine"],dL=(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.axisPointerClass="SingleAxisPointer",n}ze(t,e),t.prototype.render=function(t,n,i,a){var r=this.group;r.removeAll();var o=this._axisGroup;this._axisGroup=new Mc;var s=lL(t),l=new yk(t,s);Rr(pL,l.add,l),r.add(this._axisGroup),r.add(l.getGroup()),Rr(cL,(function(e){t.get([e,"show"])&&dL[e](this,this.group,this._axisGroup,t)}),this),Mf(o,this._axisGroup,t),e.prototype.render.call(this,t,n,i,a)},t.prototype.remove=function(){Ok(this)},t.type="singleAxis"}(kk),{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 gL(t)===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(e,t,n){return gL(t)===this?this.pointToData(n):null}}();function gL(e){var t=e.seriesModel,n=e.singleAxisModel;return n&&n.coordinateSystem||t&&t.coordinateSystem}var fL=["x","y"],yL=["width","height"],vL=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.makeElOption=function(e,t,n,i,a){var r=n.axis,o=r.coordinateSystem,s=bL(o,1-xL(r)),l=o.dataToPoint(t)[0],p=i.get("type");if(p&&"none"!==p){var c=eN(i),d=vL[p](r,l,s);d.style=c,e.graphicKey=d.type,e.pointer=d}aN(t,e,lL(n),n,i,a)},t.prototype.getHandleTransform=function(e,t,n){var i=lL(t,{labelInside:!1});i.labelMargin=n.get(["handle","margin"]);var a=iN(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=xL(a),s=bL(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=bL(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"}}}}(KB),{line:function(e,t,n){return{type:"Line",subPixelOptimize:!0,shape:rN([t,n[0]],[t,n[1]],xL(e))}},shadow:function(e,t,n){var i=e.getBandWidth(),a=n[1]-n[0];return{type:"Rect",shape:oN([t-i/2,n[0]],[i,a],xL(e))}}});function xL(e){return e.isHorizontal()?0:1}function bL(e,t){var n=e.getRect();return[n[fL[t]],n[fL[t]]+n[yL[t]]]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.type="single"}(hw);!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.init=function(t,n,i){var a=xv(t);e.prototype.init.apply(this,arguments),wL(t,a)},t.prototype.mergeOption=function(t){e.prototype.mergeOption.apply(this,arguments),wL(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}}}(Sv);function wL(e,t){var n,i=e.cellSize;1===(n=Ur(i)?i:e.cellSize=[i,i]).length&&(n[1]=n[0]);var a=Br([0,1],(function(e){return function(e,t){return null!=e[uv[t][0]]||null!=e[uv[t][1]]&&null!=e[uv[t][2]]}(t,e)&&(n[e]="auto"),null!=n[e]&&"auto"!==n[e]}));vv(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}ze(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 Em({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 Dg({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 Hr(e)&&e?(n=e,Rr(t,(function(e,t){n=n.replace("{"+t+"}",i?Jo(e):e)})),n):jr(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 Pm({z2:30,style:jf(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&&!Hr(r)||(r&&(t=Cy(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/SL)-Math.floor(n[0].time/SL)+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 CL(e){var t=e.calendarModel,n=e.seriesModel;return t?t.coordinateSystem:n?n.coordinateSystem:null}function _L(e,t){var n;return Rr(t,(function(t){null!=e[t]&&"auto"!==e[t]&&(n=!0)})),n}var TL=["transition","enterFrom","leaveTo"],IL=TL.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function EL(e,t,n){if(n&&(!e[n]&&t[n]&&(e[n]={}),e=e[n],t=t[n]),e&&t)for(var i=n?TL:IL,a=0;a=0;l--){var u,m,h;if(h=null!=(m=xd((u=n[l]).id,null))?a.get(m):null){var g=h.parent,f=(d=kL(g),{}),y=fv(h,u,g===i?{width:r,height:o}:{width:d.width,height:d.height},null,{hv:u.hv,boundingMode:u.bounding},f);if(!kL(h).isNew&&y){for(var v=u.transition,x={},b=0;b=0)?x[w]=S:h[w]=S}tf(h,x,e,0)}else h.attr(f)}}},t.prototype._clear=function(){var e=this,t=this._elMap;t.each((function(n){OL(n,kL(n).option,t,e._lastGraphicModel)})),this._elMap=fo()},t.prototype.dispose=function(){this._clear()},t.type="graphic"}(hw);function PL(e){var t=bo(ML,e)?ML[e]:ff(e);var n=new t({});return kL(n).type=e,n}function DL(e,t,n,i){var a=PL(n);return t.add(a),i.set(e,a),kL(a).id=e,kL(a).isNew=!0,a}function OL(e,t,n,i){e&&e.parent&&("group"===e.type&&e.traverse((function(e){OL(e,t,n,i)})),nB(e,t,i),n.removeKey(kL(e).id))}function AL(e,t,n,i){e.isGroup||Rr([["cursor",mu.prototype.cursor],["zlevel",i||0],["z",n||0],["z2",0]],(function(n){var i=n[0];bo(t,i)?e[i]=io(t[i],n[1]):null==e[i]&&(e[i]=n[1])})),Rr(qr(t),(function(n){if(0===n.indexOf("on")){var i=t[n];e[n]=jr(i)?i:null}})),bo(t,"draggable")&&(e.draggable=t.draggable),null!=t.name&&(e.name=t.name),null!=t.id&&(e.id=t.id)}var FL=["x","y","radius","angle","single"],RL=["cartesian2d","polar","singleAxis"];function BL(e){return e+"Axis"}function NL(e,t){var n,i=fo(),a=[],r=fo();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 LL(e){var t=e.ecModel,n={infoList:[],infoMap:fo()};return e.eachTargetAxis((function(e,i){var a=t.getComponent(BL(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 VL=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}(),qL=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 ze(t,e),t.prototype.init=function(e,t,n){var i=GL(e);this.settledOption=i,this.mergeDefaultAndTheme(e,n),this._doInit(i)},t.prototype.mergeOption=function(e){var t=GL(e);Er(this.option,e,!0),Er(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;Rr([["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=fo();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 Rr(FL,(function(n){var i=this.getReferringComponents(BL(n),Md);if(i.specified){t=!0;var a=new VL;Rr(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 VL;if(r.add(a.componentIndex),e.set(n,r),i=!1,"x"===n||"y"===n){var o=a.getReferringComponents("grid",Ed).models[0];o&&Rr(t,(function(e){a.componentIndex!==e.componentIndex&&o===e.getReferringComponents("grid",Ed).models[0]&&r.add(e.componentIndex)}))}}}i&&Rr(FL,(function(t){if(i){var a=n.findComponents({mainType:BL(t),filter:function(e){return"category"===e.get("type",!0)}});if(a[0]){var r=new VL;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");Rr([["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(BL(t),n))}),this),e},t.prototype.eachTargetAxis=function(e,t){this._targetAxisInfoMap.each((function(n,i){Rr(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(BL(e),t)},t.prototype.setRawRange=function(e){var t=this.option,n=this.settledOption;Rr([["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;Rr(["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=BL(this._dimName),i=t.getReferringComponents(n,Ed).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 Ir(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=[];UL(["start","end"],(function(l,p){var c=e[l],d=e[l+"Value"];"percent"===a[p]?(null==c&&(c=r[p]),d=i.parse(Lc(c,r,n))):(t=!0,c=Lc(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})),jL(s),jL(o);var l=this._minMaxSpan;function p(e,t,n,a,r){var o=r?"Span":"ValueSpan";bA(0,e,n,"all",l["min"+o],l["max"+o]);for(var s=0;s<2;s++)t[s]=Lc(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];UL(n,(function(e){!function(e,t,n){t&&Rr(eI(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=jT(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&&UL(i,(function(e){var t=e.getData(),i=t.mapDimensionsAll(n);if(i.length){if("weakFilter"===a){var o=t.getStore(),s=Br(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 UL(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)}}));UL(i,(function(e){t.setApproximateExtent(r,e)}))}}))}},e.prototype._updateMinMaxSpan=function(){var e=this._minMaxSpan={},t=this._dataZoomModel,n=this._dataExtent;UL(["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=Lc(n[0]+r,n,[0,100],!0):null!=a&&(r=Lc(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=jc(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 WL={getTargetSeries:function(e){function t(t){e.eachComponent("dataZoom",(function(n){n.eachTargetAxis((function(i,a){var r=e.getComponent(BL(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 HL(t,i,r,e),n.push(a.__dzAxisProxy))}));var i=fo();return Rr(n,(function(e){Rr(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 $L=!1;function KL(e){$L||($L=!0,e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,WL),function(e){e.registerAction("dataZoom",(function(e,t){Rr(NL(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 YL=function(){},XL={};function ZL(e){return XL[e]}!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(t,e),t.prototype.optionUpdated=function(){e.prototype.optionUpdated.apply(this,arguments);var t=this.ecModel;Rr(this.option.feature,(function(e,n){var i=ZL(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(t)),Er(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"}}}(Sv);function QL(e,t){var n=nv(t.get("padding")),i=t.getItemStyle(["color","opacity"]);return i.fill=t.get("backgroundColor"),e=new Em({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}ze(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=[];Rr(s,(function(e,t){p.push(t)})),new g_(this._featureNames||[],p).add(c).update(c).remove(zr(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=gv(i,r,a);hv(t.get("orient"),e,t.get("itemGap"),o.width,o.height),fv(e,i,r,a)}(a,e,n),a.add(QL(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&&!jr(l)&&t){var p=l.style||(l.style={}),c=uc(t,Pm.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 uy(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=ZL(m);if(!y)return;u=new y}l[m]=u}else if(!(u=l[h]))return;u.uid=hy("toolbox-feature"),u.model=f,u.ecModel=t,u.api=n;var v=u instanceof YL;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 YL&&s.getIcons?s.getIcons():i.get("icon"),h=i.get("title")||{};Hr(m)?(p={})[l]=m:p=m;Hr(h)?(c={})[l]=h:c=h;var g=i.iconPaths={};Rr(p,(function(l,p){var m=Df(l,{},{x:-r/2,y:-r/2,width:r,height:r});m.setStyle(d.getItemStyle()),m.ensureState("emphasis").style=u.getItemStyle();var h=new Pm({style:{text:c[p],align:u.get("textAlign"),borderRadius:u.get("textBorderRadius"),padding:u.get("textPadding"),fill:null,font:Xf({fontStyle:u.get("textFontStyle"),fontFamily:u.get("textFontFamily"),fontSize:u.get("textFontSize"),fontWeight:u.get("textFontWeight")},t)},ignore:!0});m.setTextContent(h),Rf({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])?vh:xh)(m),a.add(m),m.on("click",Gr(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?vh:xh)(i[e])},u instanceof YL&&u.render&&u.render(f,t,n,i)):v&&u.dispose&&u.dispose(t,n)}},t.prototype.updateView=function(e,t,n,i){Rr(this._features,(function(e){e instanceof YL&&e.updateView&&e.updateView(e.model,t,n,i)}))},t.prototype.remove=function(e,t){Rr(this._features,(function(n){n instanceof YL&&n.remove&&n.remove(e,t)})),this.group.removeAll()},t.prototype.dispose=function(e,t){Rr(this._features,(function(n){n instanceof YL&&n.dispose&&n.dispose(e,t)}))},t.type="toolbox"}(hw);!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(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=rr.browser;if(jr(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"])}}}(YL);var JL="__ec_magicType_stack__",eV=[["line","bar"],["stack"]],tV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.getIcons=function(){var e=this.model,t=e.get("icon"),n={};return Rr(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(tV[n]){var r,o={series:[]};Rr(eV,(function(e){Dr(e,n)>=0&&Rr(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=tV[n](t,a,e,i);r&&(Pr(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,Ed).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=Er({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"})}}}(YL),{line:function(e,t,n,i){if("bar"===e)return Er({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 Er({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")===JL;if("line"===e||"bar"===e)return i.setIconStatus("stack",a?"normal":"emphasis"),Er({id:t,stack:a?"":JL},i.get(["option","stack"])||{},!0)}});s_({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(e,t){t.mergeOption(e.newOption)}));var nV=new Array(60).join("-"),iV="\t";function aV(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var rV=new RegExp("[\t]+","g");function oV(e,t){var n=e.split(new RegExp("\n*"+nV+"\n*","g")),i={series:[]};return Rr(n,(function(e,n){if(function(e){if(e.slice(0,e.indexOf("\n")).indexOf(iV)>=0)return!0}(e)){var a=function(e){for(var t=e.split(/\n+/g),n=[],i=Br(aV(t.shift()).split(rV),(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=vV[e.brushType](0,n,t);e.__rangeOffset={offset:bV[e.brushType](i.values,e.range,[1,1]),xyMinMax:i.xyMinMax}}})),e},e.prototype.matchOutputRanges=function(e,t,n){Rr(e,(function(e){var i=this.findTargetInfo(e,t);i&&!0!==i&&Rr(i.coordSyses,(function(i){var a=vV[e.brushType](1,i,e.range,!0);n(e,a.values,i,t)}))}),this)},e.prototype.setInputRanges=function(e,t){Rr(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=vV[e.brushType](0,s.coordSys,e.coordRange),p=e.__rangeOffset;e.range=p?bV[e.brushType](l.values,p.offset,(n=l.xyMinMax,i=p.xyMinMax,a=SV(n),r=SV(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 Br(this._targetInfoList,(function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:t?t(n):null,clipPath:bF(i),isTargetByCursor:SF(i,e,n.coordSysModel),getLinearBrushOtherExtent:wF(i)}}))},e.prototype.controlSeries=function(e,t,n){var i=this.findTargetInfo(e,n);return!0===i||i&&Dr(i.coordSyses,t.coordinateSystem)>=0},e.prototype.findTargetInfo=function(e,t){for(var n=this._targetInfoList,i=hV(t,e),a=0;ae[1]&&e.reverse(),e}function hV(e,t){return Td(e,t,{includeMainTypes:dV})}var gV={grid:function(e,t){var n=e.xAxisModels,i=e.yAxisModels,a=e.gridModels,r=fo(),o={},s={};(n||i||a)&&(Rr(n,(function(e){var t=e.axis.grid.model;r.set(t.id,t),o[t.id]=!0})),Rr(i,(function(e){var t=e.axis.grid.model;r.set(t.id,t),s[t.id]=!0})),Rr(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=[];Rr(a.getCartesians(),(function(e,t){(Dr(n,e.getAxis("x").model)>=0||Dr(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:yV.grid,xAxisDeclared:o[e.id],yAxisDeclared:s[e.id]})})))},geo:function(e,t){Rr(e.geoModels,(function(e){var n=e.coordinateSystem;t.push({panelId:"geo--"+e.id,geoModel:e,coordSysModel:e,coordSys:n,coordSyses:[n],getPanelRect:yV.geo})}))}},fV=[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}],yV={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys,t=e.getBoundingRect().clone();return t.applyTransform(_f(e)),t}},vV={lineX:zr(xV,0),lineY:zr(xV,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=[mV([a[0],r[0]]),mV([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:Br(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 xV(e,t,n,i){var a=n.getAxis(["x","y"][e]),r=mV(Br([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 bV={lineX:zr(wV,0),lineY:zr(wV,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 Br(e,(function(e,i){return[e[0]-n[0]*t[i][0],e[1]-n[1]*t[i][1]]}))}};function wV(e,t,n,i){return[t[0]-i[e]*n[0],t[1]-i[e]*n[1]]}function SV(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var CV,_V,TV=Rr,IV=cd+"toolbox-dataZoom_",EV=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}ze(t,e),t.prototype.render=function(e,t,n,i){this._brushController||(this._brushController=new UA(n.getZr()),this._brushController.on("brush",Gr(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 uV(MV(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 cV(e).length}(t)>1?"emphasis":"normal")}(e,t)},t.prototype.onclick=function(e,t,n){EV[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 uV(MV(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=cV(e);lV(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=bA(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=[];TV(e,(function(e,n){t.push(Ir(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)"}}}}(YL),{zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(function(e){var t=cV(e),n=t[t.length-1];t.length>1&&t.pop();var i={};return lV(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 MV(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}CV="dataZoom",_V=function(e){var t=e.getComponent("toolbox",0),n=["feature","dataZoom"];if(t&&null!=t.get(n)){var i=t.getModel(n),a=[],r=Td(e,MV(i));return TV(r.xAxisModels,(function(e){return o(e,"xAxis","xAxisIndex")})),TV(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:IV+t+r};o[n]=r,a.push(o)}},so(null==jv.get(CV)&&_V),jv.set(CV,_V);var kV=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}(Sv);function PV(e){var t=e.get("confine");return null!=t?!!t:"richText"===e.get("renderMode")}function DV(e){if(rr.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)),Hr(e))r.innerHTML=e+o;else if(e){r.innerHTML="",Ur(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&&!rr.node&&n.getDom()){var a=KV(i,n);this._ticket="";var r=i.dataByCoordSys,o=function(e,t,n){var i=Id(e).queryOptionMap,a=i.keys()[0];if(!a||"series"===a)return;var r=kd(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=Um(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=HV;l.x=i.x,l.y=i.y,l.update(),Um(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=bN(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(KV(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"===$V([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"===Um(n).ssrType)return;this._lastDataByCoordSys=null,vS(n,(function(e){return null!=Um(e).dataIndex?(a=e,!0):null!=Um(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=Gr(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=$V([t.tooltipOption],i),o=this._renderMode,s=[],l=jb("section",{blocks:[],noHeader:!0}),p=[],c=new tw;Rr(e,(function(e){Rr(e.dataByAxis,(function(e){var t=n.getComponent(e.axisDim+"Axis",e.axisIndex),a=e.value;if(t&&t.axis&&null!=a){var r=nN(a,t.axis,n,e.seriesDataIndices,e.valueLabelOpt),d=jb("section",{header:r,noHeader:!lo(r),sortBlocks:!0,blocks:[]});l.blocks.push(d),Rr(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=XT(t.axis,{value:a}),h.axisValueLabel=r,h.marker=c.makeTooltipMarker("item",lv(h.color),o);var g=ob(u.formatTooltip(m,!0,null)),f=g.frag;if(f){var y=$V([u],i).get("valueFormatter");d.blocks.push(y?kr({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=Xb(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=Um(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=$V([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 tw;g.marker=f.makeTooltipMarker("item",lv(g.color),d);var y=ob(s.formatTooltip(l,!1,p)),v=m.get("order"),x=m.get("valueFormatter"),b=y.frag,w=b?Xb(x?kr({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=Um(t),a=i.tooltipConfig.option||{};if(Hr(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=$V(r,this._tooltipModel,s?{position:s}:null),p=l.get("content"),c=Math.random()+"",d=new tw;this._showOrMove(l,(function(){var n=Ir(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(Hr(c)){var m=e.ecModel.get("useUTC"),h=Ur(n)?n[0]:n;d=c,h&&h.axisType&&h.axisType.indexOf("time")>=0&&(d=Ny(h.axisValue,d,m)),d=ov(d,n,!0)}else if(jr(c)){var g=Gr((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||Ur(t)?{color:i||("html"===this._renderMode?"#fff":"none")}:Ur(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),jr(t)&&(t=t([n,i],r,a.el,u,{viewSize:[s,l],contentSize:p.slice()})),Ur(t))n=Vc(t[0],s),i=Vc(t[1],l);else if(Kr(t)){var m=t;m.width=p[0],m.height=p[1];var h=gv(m,{width:s,height:l});n=h.x,i=h.y,c=null,d=null}else if(Hr(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-=YV(c)?p[0]/2:"right"===c?p[0]:0),d&&(i-=YV(d)?p[1]/2:"bottom"===d?p[1]:0),PV(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&&Rr(n,(function(n,r){var o=n.dataByAxis||[],s=(e[r]||{}).dataByAxis||[];(a=a&&o.length===s.length)&&Rr(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)&&Rr(o,(function(e,t){var n=l[t];a=a&&e.seriesIndex===n.seriesIndex&&e.dataIndex===n.dataIndex})),i&&Rr(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){!rr.node&&t.getDom()&&(kw(this,"_updatePosition"),this._tooltipContent.dispose(),vN("itemTooltip",t))},t.type="tooltip",t}(hw);function $V(e,t,n){var i,a=t.ecModel;n?(i=new uy(n,a,a),i=new uy(t.option,i,a)):i=t;for(var r=e.length-1;r>=0;r--){var o=e[r];o&&(o instanceof uy&&(o=o.get("tooltip",!0)),Hr(o)&&(o={formatter:o}),o&&(i=new uy(o,i,a)))}return i}function KV(e,t){return e.dispatchAction||Gr(t.dispatchAction,t)}function YV(e){return"center"===e||"middle"===e}function XV(e){aI(MN),e.registerComponentModel(kV),e.registerComponentView(WV),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},wo),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},wo)}var ZV=Rr;function QV(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!0}function JV(e,t,n){var i={};return ZV(t,(function(t){var a,r=i[t]=((a=function(){}).prototype.__hidden=a.prototype,new a);ZV(e[t],(function(e,i){if(aO.isValidType(i)){var a={type:i,visual:e};n&&n(a,t),r[i]=new aO(a),"opacity"===i&&((a=Ir(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new aO(a))}}))})),i}function eq(e,t,n){var i;Rr(n,(function(e){t.hasOwnProperty(e)&&QV(t[e])&&(i=!0)})),i&&Rr(n,(function(n){t.hasOwnProperty(n)&&QV(t[n])?e[n]=Ir(t[n]):delete e[n]}))}tq(0),tq(1);function tq(e){var t=["x","y"],n=["width","height"];return{point:function(t,n,i){if(t){var a=i.range;return nq(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=[],Rr(n,(function(t,n){var i,r=xd(hd(t),"");Kr(t)?(i=Ir(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 V_([{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}(Sv),sq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="timeline.slider",t.defaultOption=gy(oq.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}(oq);Ar(sq,rb.prototype);var lq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="timeline",t}(hw),pq=function(e){function t(t,n,i,a){var r=e.call(this,t,n,i)||this;return r.type=a||"value",r}return ze(t,e),t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return"horizontal"===this.model.get("orient")},t}(MI),cq=Math.PI,dq=Cd();!function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}ze(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 jb("nameValue",{noName:!0,value:o.scale.getLabel({value:e})})},Rr(["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 gv(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:cq/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*cq/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;fs(r,r,[-o,-s]),ys(r,r,-cq/2),fs(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||Hr(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 CT({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC")});default:return new pT}}(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 pq("value",a,e.axisExtent,i);return o.model=t,o},t.prototype._createGroup=function(e){var t=this[e]=new Mc;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 Fg({shape:{x1:a[0],y1:0,x2:a[1],y2:0},style:kr({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});t.add(r);var o=this._progressLine=new Fg({shape:{x1:a[0],x2:this._currentPointer?this._currentPointer.x:a[0],y1:0,y2:0},style:Pr({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=[],Rr(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:Gr(a._changeTimeline,a,e.value)},u=uq(s,l,t,d);u.ensureState("emphasis").style=p.getItemStyle(),u.ensureState("progress").style=c.getItemStyle(),Dh(u);var m=Um(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=[],Rr(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 Pm({x:d,y:0,rotation:e.labelRotation-e.rotation,onclick:Gr(a._changeTimeline,a,o),silent:!1,style:jf(l,{text:i.formattedLabel,align:e.labelAlign,verticalAlign:e.labelBaseline})});u.ensureState("emphasis").style=jf(p),u.ensureState("progress").style=jf(c),t.add(u),Dh(u),dq(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=fc(io(i.get(["controlStyle",n+"BtnSize"]),a),a),d=function(e,t,n,i){var a=i.style,r=Df(e.get(["controlStyle",t]),i||{},new Ps(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),Dh(d)}}c(e.nextBtnPosition,"next",Gr(this._changeTimeline,this,p?"-":"+")),c(e.prevBtnPosition,"prev",Gr(this._changeTimeline,this,p?"+":"-")),c(e.playPosition,l?"stop":"play",Gr(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=Gr(s._handlePointerDrag,s),e.ondragend=Gr(s._handlePointerDragend,s),mq(e,s._progressLine,r,n,i,!0)},onUpdate:function(e){mq(e,s._progressLine,r,n,i)}};this._currentPointer=uq(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=Gc(this._axis.getExtent().slice());n>i[1]&&(n=i[1]),n=0&&(o[r]=+o[r].toFixed(d)),[o,c]}var bq={min:zr(xq,"min"),max:zr(xq,"max"),average:zr(xq,"average"),median:zr(xq,"median")};function wq(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)&&!Ur(t.coord)&&Ur(a)){var r=Sq(t,n,i,e);if((t=Ir(t)).type&&bq[t.type]&&r.baseAxis&&r.valueAxis){var o=Dr(a,r.baseAxis.dim),s=Dr(a,r.valueAxis.dim),l=bq[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&&Ur(a))for(var p=t.coord,c=0;c<2;c++)bq[p[c]]&&(p[c]=Tq(n,n.mapDimension(a[c]),p[c]));else t.coord=[];return t}}function Sq(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 Cq(e,t){return!(e&&e.containData&&t.coord&&!vq(t))||e.containData(t.coord)}function _q(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 Tq(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 Iq=Cd(),Eq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.init=function(){this.markerGroupMap=fo()},t.prototype.render=function(e,t,n){var i=this,a=this.markerGroupMap;a.each((function(e){Iq(e).keep=!1})),t.eachSeries((function(e){var a=yq.getMarkerModelFromSeries(e,i.type);a&&i.renderSeries(e,a,t,n)})),a.each((function(e){!Iq(e).keep&&i.group.remove(e.group)}))},t.prototype.markKeep=function(e){Iq(e).keep=!0},t.prototype.toggleBlurSeries=function(e,t){var n=this;Rr(e,(function(e){var i=yq.getMarkerModelFromSeries(e,n.type);i&&i.getData().eachItemGraphicEl((function(e){e&&(t?bh(e):wh(e))}))}))},t.type="marker",t}(hw);function Mq(e,t,n){var i=t.coordinateSystem;e.each((function(a){var r,o=e.getItemModel(a),s=Vc(o.get("x"),n.getWidth()),l=Vc(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}ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=yq.getMarkerModelFromSeries(e,"markPoint");t&&(Mq(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 CE),p=function(e,t,n){var i;i=e?Br(e&&e.dimensions,(function(e){return kr(kr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new V_(i,n),r=Br(n.get("data"),zr(wq,t));e&&(r=Lr(r,zr(Cq,e)));var o=_q(!!e,i);return a.initData(r,null,o),a}(a,e,t);t.setData(p),Mq(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(jr(i)||jr(a)||jr(r)||jr(s)){var c=t.getRawValue(e),d=t.getDataParams(e);jr(i)&&(i=i(c,d)),jr(a)&&(a=a(c,d)),jr(r)&&(r=r(c,d)),jr(s)&&(s=s(c,d))}var u=n.getModel("itemStyle").getItemStyle(),m=hS(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){Um(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markPoint"}(Eq);var kq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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}(yq),Pq=Cd(),Dq=function(e,t,n,i){var a,r=e.getData();if(Ur(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=no(i.yAxis,i.xAxis);else{var p=Sq(i,r,t,e);s=p.valueAxis,l=Tq(r,$_(r,p.valueDataDim),o)}var c="x"===s.dim?0:1,d=1-c,u=Ir(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&&$r(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=[wq(e,a[0]),wq(e,a[1]),kr({},a[2])];return g[2].type=g[2].type||null,Er(g[2],g[0]),Er(g[2],g[1]),g};function Oq(e){return!isNaN(e)&&!isFinite(e)}function Aq(e,t,n,i){var a=1-e,r=i.dimensions[e];return Oq(t[a])&&Oq(n[a])&&t[e]===n[e]&&i.getAxis(r).containData(t[e])}function Fq(e,t){if("cartesian2d"===e.type){var n=t[0].coord,i=t[1].coord;if(n&&i&&(Aq(1,n,i,e)||Aq(0,n,i,e)))return!0}return Cq(e,t[0])&&Cq(e,t[1])}function Rq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Vc(s.get("x"),a.getWidth()),p=Vc(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(NE(o,"cartesian2d")){var m=o.getAxis("x"),h=o.getAxis("y");c=o.dimensions;Oq(e.get(c[0],t))?r[0]=m.toGlobalCoord(m.getExtent()[n?0:1]):Oq(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 Bq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=yq.getMarkerModelFromSeries(e,"markLine");if(t){var i=t.getData(),a=Pq(t).from,r=Pq(t).to;a.each((function(t){Rq(a,t,!0,e,n),Rq(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 zO);this.group.add(l.group);var p=function(e,t,n){var i;i=e?Br(e&&e.dimensions,(function(e){return kr(kr({},t.getData().getDimensionInfo(t.getData().mapDimension(e))||{}),{name:e,ordinalMeta:null})})):[{name:"value",type:"float"}];var a=new V_(i,n),r=new V_(i,n),o=new V_([],n),s=Br(n.get("data"),zr(Dq,t,e,n));e&&(s=Lr(s,zr(Fq,e)));var l=_q(!!e,i);return a.initData(Br(s,(function(e){return e[0]})),null,l),r.initData(Br(s,(function(e){return e[1]})),null,l),o.initData(Br(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;Pq(t).from=c,Pq(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);Rq(t,n,a,e,i);var s=r.getModel("itemStyle").getItemStyle();null==s.fill&&(s.fill=hS(o,"color")),t.setItemVisual(n,{symbolKeepAspect:r.get("symbolKeepAspect"),symbolOffset:io(r.get("symbolOffset",!0),f[a?0:1]),symbolRotate:io(r.get("symbolRotate",!0),g[a?0:1]),symbolSize:io(r.get("symbolSize"),h[a?0:1]),symbol:io(r.get("symbol",!0),m[a?0:1]),style:s})}Ur(m)||(m=[m,m]),Ur(h)||(h=[h,h]),Ur(g)||(g=[g,g]),Ur(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){Um(e).dataModel=t,e.traverse((function(e){Um(e).dataModel=t}))})),this.markKeep(l),l.group.silent=t.get("silent")||e.get("silent")},t.type="markLine",t}(Eq);function Nq(e){e.registerComponentModel(kq),e.registerComponentView(Bq),e.registerPreprocessor((function(e){hq(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}ze(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"}}}}(yq);var Lq=Cd(),Vq=function(e,t,n,i){var a=i[0],r=i[1];if(a&&r){var o=wq(e,a),s=wq(e,r),l=o.coord,p=s.coord;l[0]=no(l[0],-1/0),l[1]=no(l[1],-1/0),p[0]=no(p[0],1/0),p[1]=no(p[1],1/0);var c=Mr([{},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 qq(e){return!isNaN(e)&&!isFinite(e)}function Gq(e,t,n,i){var a=1-e;return qq(t[a])&&qq(n[a])}function zq(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 NE(e,"cartesian2d")?!(!n||!i||!Gq(1,n,i)&&!Gq(0,n,i))||function(e,t,n){return!(e&&e.containZone&&t.coord&&n.coord&&!vq(t)&&!vq(n))||e.containZone(t.coord,n.coord)}(e,a,r):Cq(e,a)||Cq(e,r)}function Uq(e,t,n,i,a){var r,o=i.coordinateSystem,s=e.getItemModel(t),l=Vc(s.get(n[0]),a.getWidth()),p=Vc(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(NE(o,"cartesian2d")){var f=o.getAxis("x"),y=o.getAxis("y"),v=e.get(n[0],t),x=e.get(n[1],t);qq(v)?r[0]=f.toGlobalCoord(f.getExtent()["x0"===n[0]?0:1]):qq(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 jq=[["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}ze(t,e),t.prototype.updateTransform=function(e,t,n){t.eachSeries((function(e){var t=yq.getMarkerModelFromSeries(e,"markArea");if(t){var i=t.getData();i.each((function(t){var a=Br(jq,(function(a){return Uq(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 Mc});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=Br(e&&e.dimensions,(function(e){var n=t.getData();return kr(kr({},n.getDimensionInfo(n.mapDimension(e))||{}),{name:e,ordinalMeta:null})}));a=Br(r,(function(e,t){return{name:e,type:o[t%2].type}})),i=new V_(a,n)}else i=new V_(a=[{name:"value",type:"float"}],n);var s=Br(n.get("data"),zr(Vq,t,e,n));e&&(s=Lr(s,zr(zq,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=Br(jq,(function(n){return Uq(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))];Gc(d),Gc(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}(Sv),Wq=zr,$q=Rr,Kq=Mc,Yq=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n.newlineDisabled=!1,n}return ze(t,e),t.prototype.init=function(){this.group.add(this._contentGroup=new Kq),this.group.add(this._selectorGroup=new Kq),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=gv(l,p,c),u=this.layoutInner(e,a,d,i,o,s),m=gv(Pr({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=QL(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=fo(),p=t.get("selectedMode"),c=[];n.eachRawSeries((function(e){!e.get("legendHoverLink")&&c.push(e.id)})),$q(t.getData(),(function(a,r){var o=a.get("name");if(!this.newlineDisabled&&(""===o||"\n"===o)){var d=new Kq;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",Wq(Xq,o,null,i,c)).on("mouseover",Wq(Qq,u.name,null,i,c)).on("mouseout",Wq(Jq,u.name,null,i,c)),n.ssr&&y.eachChild((function(e){var t=Um(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=Gl(m.fill);g&&0===g[3]&&(g[3]=.2,m=kr(kr({},m),{fill:Kl(g,"rgba")}));var f=this._createItem(s,o,r,a,t,e,{},m,h,p,i);f.on("click",Wq(Xq,null,o,i,c)).on("mouseover",Wq(Qq,null,o,i,c)).on("mouseout",Wq(Jq,null,o,i,c)),n.ssr&&f.eachChild((function(e){var t=Um(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();$q(e,(function(e){var i=e.type,a=new Pm({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect"})}});r.add(a),zf(a,{normal:t.getModel("selectorLabel"),emphasis:t.getModel(["emphasis","selectorLabel"])},{defaultText:e.title}),Dh(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),$q(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?iC(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 Kq,b=i.getModel("textStyle");if(!jr(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=PS(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;Hr(_)&&_?T=_.replace("{name}",null!=t?t:""):jr(_)&&(T=_(t));var I=h?b.getTextColor():i.get("inactiveColor");x.add(new Pm({style:jf(b,{text:T,x:S,y:m/2,fill:I,align:C,verticalAlign:"middle"},{inheritColor:I})}));var E=new Em({shape:x.getBoundingRect(),style:{fill:"transparent"}}),M=i.getModel("tooltip");return M.get("show")&&Rf({el:E,componentModel:a,itemName:t,itemTooltipOption:M.option}),x.add(E),x.eachChild((function(e){e.silent=!0})),E.silent=!p,this.getContentGroup().add(x),Dh(x),x.__legendDataIndex=n,x},t.prototype.layoutInner=function(e,t,n,i,a,r){var o=this.getContentGroup(),s=this.getSelectorGroup();hv(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){hv("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}(hw);function Xq(e,t,n,i){Jq(e,t,n,i),n.dispatchAction({type:"legendToggleSelect",name:null!=e?e:t}),Qq(e,t,n,i)}function Zq(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=io(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 Em({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&&tf(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;Rr(["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",Hr(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=nG[a],o=iG[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"}(Yq);var aG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="dataZoom.inside",t.defaultOption=gy(qL.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(qL),rG=Cd();function oG(e,t){if(t){e.removeKey(t.model.uid);var n=t.controller;n&&n.dispose()}}function sG(e,t){e.isDisposed()||e.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:t})}function lG(e,t,n,i){return e.coordinateSystem.containPoint([n,i])}function pG(e){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,(function(e,t){var n=rG(t),i=n.coordSysRecordMap||(n.coordSysRecordMap=fo());i.each((function(e){e.dataZoomInfoMap=null})),e.eachComponent({mainType:"dataZoom",subType:"inside"},(function(e){Rr(LL(e).infoList,(function(n){var a=n.model.uid,r=i.get(a)||i.set(a,function(e,t){var n={model:t,containsPoint:zr(lG,t),dispatchAction:zr(sG,e),dataZoomInfoMap:null,controller:null},i=n.controller=new oP(e.getZr());return Rr(["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=fo())).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),Mw(e,"dispatchAction",t.model.get("throttle",!0),"fixRate")}else oG(i,e)}))}))}var cG=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return ze(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){rG(e).coordSysRecordMap.each((function(e){var i=e.dataZoomInfoMap.get(t.uid);i&&(i.getRange=n)}))}(i,t,{pan:Gr(dG.pan,this),zoom:Gr(dG.zoom,this),scrollMove:Gr(dG.scrollMove,this)}))},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){!function(e,t){for(var n=rG(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(bA(0,r,[0,100],0,d.minSpan,d.maxSpan),this.range=r,a[0]!==r[0]||a[1]!==r[1])return r}}},pan:uG((function(e,t,n,i,a,r){var o=mG[i]([r.oldX,r.oldY],[r.newX,r.newY],t,a,n);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength})),scrollMove:uG((function(e,t,n,i,a,r){return mG[i]([0,0],[r.scrollDelta,r.scrollDelta],t,a,n).signal*(e[1]-e[0])*r.scrollDelta}))};function uG(e){return function(t,n,i,a){var r=this.range,o=r.slice(),s=t.axisModels[0];if(s)return bA(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 mG={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 hG(e){KL(e),e.registerComponentModel(aG),e.registerComponentView(cG),pG(e)}var gG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(t,e),t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=gy(qL.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}(qL),fG=Em,yG="horizontal",vG="vertical",xG=["line","bar","candlestick","scatter","custom"],bG={easing:"cubicOut",duration:100,delay:0},wG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._displayables={},n}return ze(t,e),t.prototype.init=function(e,t){this.api=t,this._onBrush=Gr(this._onBrush,this),this._onBrushEnd=Gr(this._onBrushEnd,this)},t.prototype.render=function(t,n,i,a){if(e.prototype.render.apply(this,arguments),Mw(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(){kw(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 Mc;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===yG?{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=xv(e.option);Rr(["right","top","width","height"],(function(e){"ph"===o[e]&&(o[e]=r[e])}));var s=gv(o,a);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===vG&&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!==yG||a?n===yG&&a?{scaleY:o?1:-1,scaleX:-1}:n!==vG||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 fG({silent:!0,shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:e.get("backgroundColor")},z2:-40}));var a=new fG({shape:{x:0,y:0,width:t[0],height:t[1]},style:{fill:"transparent"},z2:0,onclick:Gr(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:Lc(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 Mc,i=new kg({shape:{points:s},segmentIgnoreThreshold:1,style:t.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),a=new Dg({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&&Rr(o.getTargetSeriesModels(),(function(e){if(!(n||!0!==t&&Dr(xG,e.get("type"))<0)){var o,s=i.getComponent(BL(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 fG({silent:p,style:{fill:o.get("fillerColor")},textConfig:{position:"inside"}});a.add(c),a.add(new fG({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)"}})),Rr([0,1],(function(t){var r=o.get("handleIcon");!ES[r]&&r.indexOf("path://")<0&&r.indexOf("image://")<0&&(r="path://"+r);var s=PS(r,-1,0,2,2,null,!0);s.attr({cursor:SG(this._orient),draggable:!0,drift:Gr(this._onDragMove,this,t),ondragend:Gr(this._onDragEnd,this),onmouseover:Gr(this._showDataInfo,this,!0),onmouseout:Gr(this._showDataInfo,this,!1),z2:5});var l=s.getBoundingRect(),p=o.get("handleSize");this._handleHeight=Vc(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(),Dh(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 Pm({silent:!0,invisible:!0,style:jf(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=Vc(o.get("moveHandleSize"),r[1]),m=t.moveHandle=new Em({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=PS(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 Em({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:SG(this._orient),drift:Gr(this._onDragMove,this,"all"),ondragstart:Gr(this._showDataInfo,this,!0),ondragend:Gr(this._onDragEnd,this),onmouseover:Gr(this._showDataInfo,this,!0),onmouseout:Gr(this._showDataInfo,this,!1)})},t.prototype._resetInterval=function(){var e=this._range=this.dataZoomModel.getPercentRange(),t=this._getViewExtent();this._handleEnds=[Lc(e[0],[0,100],t,!0),Lc(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];bA(t,i,a,n.get("zoomLock")?"all":e,null!=o.minSpan?Lc(o.minSpan,s,a,!0):null,null!=o.maxSpan?Lc(o.maxSpan,s,a,!0):null);var l=this._range,p=this._range=Gc([Lc(i[0],a,s,!0),Lc(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=Gc(n.slice()),a=this._size;Rr([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 ws(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=Gc([Lc(n.x,i,a,!0),Lc(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&&(ls(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 fG({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?bG:null,start:t[0],end:t[1]})},t.prototype._findCoordRect=function(){var e,t=LL(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}(zL);function SG(e){return"vertical"===e?"ns-resize":"ew-resize"}function CG(e){e.registerComponentModel(gG),e.registerComponentView(wG),KL(e)}function _G(e){aI(hG),aI(CG)}var TG=function(e,t,n){var i=Ir((IG[e]||{})[t]);return n&&Ur(i)?i[i.length-1]:i},IG={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]}},EG=aO.mapVisual,MG=aO.eachVisual,kG=Ur,PG=Rr,DG=Gc,OG=Lc,AG=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 ze(t,e),t.prototype.init=function(e,t,n){this.mergeDefaultAndTheme(e,n)},t.prototype.optionUpdated=function(e,t){var n=this.option;!t&&eq(n,e,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(e){var t=this.stateList;e=Gr(e,this),this.controllerVisuals=JV(this.option.controller,t,e),this.targetVisuals=JV(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=dd(e),t},t.prototype.eachTargetSeries=function(e,t){Rr(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||["<",">"],Ur(e)&&(e=e.slice(),i=!0);var l=t?e:i?[p(e[0]),p(e[1])]:p(e);return Hr(s)?s.replace("{value}",i?l[0]:l).replace("{value2}",i?l[1]:l):jr(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=DG([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={});Er(i,n),Er(a,n);var r=this.isCategory();function o(n){kG(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]={},PG(i,(function(e,t){if(aO.isValidType(t)){var n=TG(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";PG(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&&Ir(t)||(r?a:[a])),null==l.symbolSize&&(l.symbolSize=n&&Ir(n)||(r?s[0]:[s[0],s[0]])),l.symbol=EG(l.symbol,(function(e){return"none"===e?a:e}));var p=l.symbolSize;if(null!=p){var c=-1/0;MG(p,(function(e){e>c&&(c=e)})),l.symbolSize=EG(p,(function(e){return OG(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}(Sv),FG=[20,140],RG=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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]=FG[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=FG[1])},t.prototype._resetRange=function(){var e=this.getExtent(),t=this.option.range;!t||t.auto?(e.auto=1,this.option.range=e):Ur(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),Rr(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=Gc((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=BG(this,"outOfRange",this.getExtent()),n=BG(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 Mc("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();zG([0,1],(function(l){var p=a[l];p.setStyle("fill",t.handlesColor[l]),p.y=e[l];var c=GG(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=Tf(n.handleLabelPoints[l],_f(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=GG(e,r,s,!0),m=o[0]-d/2,h={x:p.x,y:p.y};p.y=u,p.x=m;var g=Tf(l.indicatorLabelPoint,_f(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||$G(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 QG(e,t,n,i){for(var a=t.targetVisuals[i],r=aO.prepareVisualTypes(a),o={color:hS(e.getData(),"color")},s=0,l=r.length;s0:e.splitNumber>0)&&!e.calculable?"piecewise":"continuous"})),e.registerAction(YG,XG),Rr(ZG,(function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)})),e.registerPreprocessor(ez))}function az(e){e.registerComponentModel(RG),e.registerComponentView(HG),iz(e)}var rz=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n._pieceList=[],n}return ze(t,e),t.prototype.optionUpdated=function(t,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],oz[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=Ir(a)):(e.dataExtent=this.getExtent(),e.mappingMethod="piecewise",e.pieceList=Br(this._pieceList,(function(e){return e=Ir(e),"inRange"!==t&&(e.visual=null),e})))}))},t.prototype.completeVisualOption=function(){var t=this.option,n={},i=aO.listVisualTypes(),a=this.isCategory();function r(e,t,n){return e&&e[t]&&e[t].hasOwnProperty(n)}Rr(t.pieces,(function(e){Rr(i,(function(t){e.hasOwnProperty(t)&&(n[t]=1)}))})),Rr(n,(function(e,n){var i=!1;Rr(this.stateList,(function(e){i=i||r(t,e,n)||r(t.target,e,n)}),this),!i&&Rr(this.stateList,(function(e){(t[e]||(t[e]={}))[n]=TG(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,Rr(i,(function(e,t){var n=this.getSelectedMapKey(e);a.hasOwnProperty(n)||(a[n]=!0)}),this),"single"===n.selectedMode){var r=!1;Rr(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=Ir(e)},t.prototype.getValueState=function(e){var t=aO.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){aO.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 Rr(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=gy(AG.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}(AG),oz={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 sz(e,t){var n=e.inverse;("vertical"===e.orient?!n:n)&&t.reverse()}var lz=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.type=t.type,n}return ze(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=no(t.get("showLabel",!0),!p);p&&this._renderEndsText(e,p[0],s,c,o),Rr(l.viewPieceList,(function(i){var l=i.piece,p=new Mc;p.onclick=Gr(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 Pm({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),hv(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:qG(i.findTargetDataIndices(t),i)})}},t.prototype._getItemAlign=function(){var e=this.visualMapModel,t=e.option;if("vertical"===t.orient)return VG(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 Mc,o=this.visualMapModel.textStyleModel;r.add(new Pm({style:jf(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=Br(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(PS(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=Ir(n.selected),r=t.getSelectedMapKey(e);"single"===i||!0===i?(a[r]=!0,Rr(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}(NG);function pz(e){e.registerComponentModel(rz),e.registerComponentView(lz),iz(e)}function cz(e){aI(az),aI(pz)}Cd();var dz={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},uz=function(){function e(e){if(null==(this._condVal=Hr(e)?new RegExp(e):eo(e)?e:null)){var t="";0,sd(t)}}return e.prototype.evaluate=function(e){var t=typeof e;return Hr(t)?this._condVal.test(e):!!$r(t)&&this._condVal.test(e+"")},e}(),mz=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),hz=function(){function e(){}return e.prototype.evaluate=function(){for(var e=this.children,t=0;t=_z:-l>=_z),u=l>0?l%_z:l%_z+_z,m=!1;m=!!d||!tp(c)&&u>=Cz==!!p;var h=e+n*Sz(r),g=t+i*wz(r);this._start&&this._add("M",h,g);var f=Math.round(a*Tz);if(d){var y=1/this._p,v=(p?1:-1)*(_z-y);this._add("A",n,i,f,1,+p,e+n*Sz(r+v),t+i*wz(r+v)),y>.01&&this._add("A",n,i,f,0,+p,h,g)}else{var x=e+n*Sz(o),b=t+i*wz(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?Jo(o):o||"")+(i?""+n+Br(i,(function(t){return e(t)})).join(n)+n:"")+("")}(e)}function Lz(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function Vz(e,t,n,i){return Bz("svg","root",{width:e,height:t,xmlns:Oz,"xmlns:xlink":Az,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+e+" "+t},n)}var qz=0;function Gz(){return qz++}var zz={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"},Uz="transform-origin";function jz(e,t,n){var i=kr({},e.shape);kr(i,t),e.buildPath(n,i);var a=new Iz;return a.reset(dp(e)),n.rebuildPath(a,1),a.generateStr(),a.getStr()}function Hz(e,t){var n=t.originX,i=t.originY;(n||i)&&(e[Uz]=n+"px "+i+"px")}var Wz={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function $z(e,t){var n=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[n]=e,n}function Kz(e){return Hr(e)?zz[e]?"cubic-bezier("+zz[e]+")":_l(e)?e:"":""}function Yz(e,t,n,i){var a=e.animators,r=a.length,o=[];if(e instanceof Gg){var s=function(e,t,n){var i,a,r=e.shape.paths,o={};if(Rr(r,(function(e){var t=Lz(n.zrId);t.animation=!0,Yz(e,{},t,!0);var r=t.cssAnims,s=t.cssNodes,l=qr(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=$z(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 $z(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-"+Gz();n.cssNodes["."+y]={animation:o.join(",")},t.class=y}}function Xz(e,t,n,i){var a=JSON.stringify(e),r=n.cssStyleCache[a];r||(r=n.zrId+"-cls-"+Gz(),n.cssStyleCache[a]=r,n.cssNodes["."+r+(i?":hover":"")]=e),t.class=t.class?t.class+" "+r:r}var Zz=Math.round;function Qz(e){return e&&Hr(e.src)}function Jz(e){return e&&jr(e.toDataURL)}function eU(e,t,n,i){Dz((function(a,r){var o="fill"===a||"stroke"===a;o&&pp(r)?dU(t,e,a,i):o&&op(r)?uU(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=Jl(i.shadowColor),h=m.opacity,g=m.color,f=u/2/l+" "+u/2/p;o=n.zrId+"-s"+n.shadowIdx++,n.defs[o]=Bz("filter",o,{id:o,x:"-100%",y:"-100%",width:"300%",height:"300%"},[Bz("feDropShadow","",{dx:c/l,dy:d/p,stdDeviation:f,"flood-color":g,"flood-opacity":h})]),r[a]=o}t.filter=cp(o)}}(n,e,i)}function tU(e,t){var n=Rc(t);n&&(n.each((function(t,n){null!=t&&(e[(Fz+n).toLowerCase()]=t+"")})),t.isSilent()&&(e[Fz+"silent"]="true"))}function nU(e){return tp(e[0]-1)&&tp(e[1])&&tp(e[2])&&tp(e[3]-1)}function iU(e,t,n){if(t&&(!function(e){return tp(e[4])&&tp(e[5])}(t)||!nU(t))){var i=n?10:1e4;e.transform=nU(t)?"translate("+Zz(t[4]*i)/i+" "+Zz(t[5]*i)/i+")":function(e){return"matrix("+np(e[0])+","+np(e[1])+","+np(e[2])+","+np(e[3])+","+ip(e[4])+","+ip(e[5])+")"}(t)}}function aU(e,t,n){for(var i=e.points,a=[],r=0;r=0&&o||r;s&&(a=Zl(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),Xz(p,t,n,!0)}}(e,r,t),Bz(s,e.id+"",r)}function cU(e,t){return e instanceof gm?pU(e,t):e instanceof bm?function(e,t){var n=e.style,i=n.image;if(i&&!Hr(i)&&(Qz(i)?i=i.src:Jz(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),iU(o,e.transform),eU(o,n,e,t),tU(o,e),t.animation&&Yz(e,o,t),Bz("image",e.id+"",o)}}(e,t):e instanceof ym?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||sr,r=n.x||0,o=function(e,t,n){return"top"===n?e+=t/2:"bottom"===n&&(e-=t/2),e}(n.y||0,gc(a),n.textBaseline),s={"dominant-baseline":"central","text-anchor":ap[n.textAlign]||n.textAlign};if(Bm(n)){var l="",p=n.fontStyle,c=Fm(n.fontSize);if(!parseFloat(c))return;var d=n.fontFamily||or,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),iU(s,e.transform),eU(s,n,e,t),tU(s,e),t.animation&&Yz(e,s,t),Bz("text",e.id+"",s,void 0,i)}}(e,t):void 0}function dU(e,t,n,i){var a,r=e[n],o={gradientUnits:r.global?"userSpaceOnUse":"objectBoundingBox"};if(sp(r))a="linearGradient",o.x1=r.x,o.y1=r.y,o.x2=r.x2,o.y2=r.y2;else{if(!lp(r))return void 0;a="radialGradient",o.cx=io(r.x,.5),o.cy=io(r.y,.5),o.r=io(r.r,.5)}for(var s=r.colorStops,l=[],p=0,c=s.length;pl?EU(e,null==n[d+1]?null:n[d+1].elm,n,s,d):MU(e,t,o,l))}(n,i,a):CU(a)?(CU(e.text)&&bU(n,""),EU(n,null,a,0,a.length-1)):CU(i)?MU(n,i,0,i.length-1):CU(e.text)&&bU(n,""):e.text!==t.text&&(CU(i)&&MU(n,i,0,i.length-1),bU(n,t.text)))}var DU=0,OU=function(){function e(e,t,n){if(this.type="svg",this.refreshHover=AU("refreshHover"),this.configLayer=AU("configLayer"),this.storage=t,this._opts=n=kr({},n),this.root=e,this._id="zr"+DU++,this._oldVNode=Vz(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=Rz("svg");kU(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(TU(e,t))PU(e,t);else{var n=e.elm,i=vU(n);IU(t),null!==i&&(gU(i,t.elm,xU(n)),MU(i,[e],0,0))}}(this._oldVNode,e),this._oldVNode=e}},e.prototype.renderOneToVNode=function(e){return cU(e,Lz(this._id))},e.prototype.renderToVNode=function(e){e=e||{};var t=this.storage.getDisplayList(!0),n=this._width,i=this._height,a=Lz(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=Bz("rect","bg",{width:e,height:t,x:"0",y:"0"}),pp(n))dU({fill:n},a.attrs,"fill",i);else if(op(n))uU({style:{fill:n},dirty:wo,getBoundingRect:function(){return{width:e,height:t}}},a.attrs,"fill",i);else{var r=Jl(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=Bz("g","main",{},[]);this._paintList(t,a,s?s.children:r),s&&r.push(s);var l=Br(qr(a.defs),(function(e){return a.defs[e]}));if(l.length&&r.push(Bz("defs","defs",{},l)),e.animation){var p=function(e,t,n){var i=(n=n||{}).newline?"\n":"",a=" {"+i,r=i+"}",o=Br(qr(e),(function(t){return t+a+Br(qr(e[t]),(function(n){return n+":"+e[t][n]+";"})).join(i)+r})).join(i),s=Br(qr(t),(function(e){return"@keyframes "+e+a+Br(qr(t[e]),(function(n){return n+a+Br(qr(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=Bz("style","stl",{},[],p);r.push(c)}}return Vz(n,i,r,e.useViewBox)},e.prototype.renderToString=function(e){return e=e||{},Nz(this.renderToVNode({animation:io(e.cssAnimation,!0),emphasis:io(e.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:io(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?VU:0),this._needsManuallyCompositing),p.__builtin__||Tr("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,Rr(this._layers,(function(e){e.setUnpainted()}))},e.prototype.configLayer=function(e,t){if(t){var n=this._layerConfig;n[e]?Er(n[e],t,!0):n[e]=t;for(var i=0;i({legendKey:e,left:!0}),jU=e=>({background:e});function HU(e,n){1&e&&t.ɵɵelementContainer(0)}function WU(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,HU,1,0,"ng-container",8),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e.widgetTitlePanel)}}function $U(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Min")))}function KU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Max")))}function YU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Avg")))}function XU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Total")))}function ZU(e,n){1&e&&(t.ɵɵelementStart(0,"th",13),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"legend.Latest")))}function QU(e,n){1&e&&t.ɵɵelementContainer(0)}function JU(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 ej(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 tj(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 nj(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 ij(e,n){if(1&e&&(t.ɵɵelement(0,"td",16),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 aj(e,n){if(1&e&&(t.ɵɵelementStart(0,"tr")(1,"th"),t.ɵɵtemplate(2,QU,1,0,"ng-container",14),t.ɵɵelementEnd(),t.ɵɵtemplate(3,JU,2,4,"td",15)(4,ej,2,4,"td",15)(5,tj,2,4,"td",15)(6,nj,2,4,"td",15)(7,ij,2,4,"td",15),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,UU,e)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showMin),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showMax),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showAvg),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showTotal),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===i.legendConfig.showLatest)}}function rj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",9)(1,"table",10)(2,"thead")(3,"tr"),t.ɵɵelement(4,"th"),t.ɵɵtemplate(5,$U,3,3,"th",11)(6,KU,3,3,"th",11)(7,YU,3,3,"th",11)(8,XU,3,3,"th",11)(9,ZU,3,3,"th",11),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"tbody"),t.ɵɵtemplate(11,aj,8,9,"tr",12),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngIf",!0===e.legendConfig.showMin),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showMax),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showAvg),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showTotal),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!0===e.legendConfig.showLatest),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",e.legendKeys)}}function oj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",18),t.ɵɵelement(2,"div",19)(3,"div",20),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,jU,e.dataKey.color)),t.ɵɵadvance(),t.ɵɵproperty("innerHTML",t.ɵɵpipeBind2(4,5,e.dataKey.label,"html"),t.ɵɵsanitizeHtml)}}class sj{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=n_(e);if(a)return a}var r=new GC(e,t,n);return r.id="ec_"+e_++,QC[r.id]=r,i&&Pd(e,t_,r.id),BC(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=Ze(this.myChart,this.yAxis.mainType,this.yAxis.id),n=Qe(this.myChart,this.yAxis.mainType,this.yAxis.id,this.yAxis.name),i=Ze(this.myChart,this.xAxis.mainType,this.xAxis.id),a=t+n,r=i+Qe(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(){aI([XV,kN,cz,_G,Nq,sL,tP,JE,TM,UM,nP,jB,hE,GU,FU])}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=ke(this.ctx.data[t].dataKey.decimals)?this.ctx.data[t].dataKey.decimals:this.ctx.decimals,s=ke(this.ctx.data[t].dataKey.units)?this.ctx.data[t].dataKey.units:this.ctx.units,l=Pe(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=>Pe(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||sj)(t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(Je.DomSanitizer),t.ɵɵdirectiveInject(et.WidgetComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:sj,selectors:[["tb-gateway-statistics-chart"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(zU,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"],[4,"ngIf"],[1,"tb-time-series-chart-content"],[1,"tb-time-series-chart-shape"],["class","tb-time-series-chart-legend",4,"ngIf"],[4,"ngTemplateOutlet"],[1,"tb-time-series-chart-legend"],[1,"tb-time-series-chart-legend-table","vertical"],["class","tb-time-series-chart-legend-type-label right legend legend-row-color",4,"ngIf"],[4,"ngFor","ngForOf"],[1,"tb-time-series-chart-legend-type-label","right","legend","legend-row-color"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["class","tb-time-series-chart-legend-value legend",3,"innerHTML",4,"ngIf"],[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,WU,2,1,"ng-container",4),t.ɵɵelementStart(3,"div",5),t.ɵɵelement(4,"div",6,0),t.ɵɵtemplate(6,rj,12,6,"div",7)(7,oj,5,10,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.widgetComponent.dashboardWidget.showWidgetTitlePanel),t.ɵɵadvance(),t.ɵɵclassMap(n.legendClass),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.showLegend))},dependencies:t.ɵɵgetComponentDepsFactory(sj,[j,_]),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 lj=["statisticChart"];function pj(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 cj(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 dj(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 uj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,cj,2,1,"tb-gateway-statistics-chart",14)(2,dj,1,1,"tb-custom-statistics-table",15),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵconditional(e.isNumericData?1:2)}}function mj(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 hj{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:F(R.timeseries)},this.statisticForm.get("command").valueChanges.pipe(bn()).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===B)return;this.getGatewayGeneralConfig().pipe(bn(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(ir,{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(xe((e=>re(this.getGatewayGeneralConfig(),ae(e)))),xe((([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)))),bn(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(ve(Boolean),xe((()=>this.getGatewayGeneralConfig())),xe((t=>(this.commands=[...t.statistics.commands.filter((t=>t.attributeOnGateway!==e))],this.updateStatisticsCommands(t,this.commands)))),bn(this.destroyRef)).subscribe()}getGatewayGeneralConfig(){const e=this.ctx.defaultSubscription.datasources[0].entity;return e.id.id===B?ae(null):this.attributeService.getEntityAttributes(e.id,D.SHARED_SCOPE,["general_configuration"]).pipe(pe((e=>e[0]?.value)))}updateStatisticsCommands(e,t){const n=this.ctx.defaultSubscription.datasources[0].entity;return n.id.id!==B&&e?this.attributeService.saveEntityAttributes(n.id,D.SHARED_SCOPE,[{key:"general_configuration",value:{...e,statistics:{...e.statistics,commands:t}}}]):ae(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(R.timeseries,e,this.subscriptionOptions,!1,!0).pipe(bn(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||hj)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(_e.UtilsService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:hj,selectors:[["tb-gateway-statistics"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(lj,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,pj,8,6),t.ɵɵelementEnd()(),t.ɵɵtemplate(16,uj,3,1,"div",10)(17,mj,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(hj,[j,_,Dn,Vn,sj]),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 gj;e("GatewayStatisticsComponent",hj),e("BACnetRequestTypes",gj),function(e){e.WriteProperty="writeProperty",e.ReadProperty="readProperty"}(gj||e("BACnetRequestTypes",gj={}));const fj=e("BACnetRequestTypesTranslates",new Map([[gj.WriteProperty,"gateway.rpc.write-property"],[gj.ReadProperty,"gateway.rpc.read-property"]]));var yj;e("BACnetObjectTypes",yj),function(e){e.BinaryInput="binaryInput",e.BinaryOutput="binaryOutput",e.AnalogInput="analogInput",e.AnalogOutput="analogOutput",e.BinaryValue="binaryValue",e.AnalogValue="analogValue"}(yj||e("BACnetObjectTypes",yj={}));const vj=e("BACnetObjectTypesTranslates",new Map([[yj.AnalogOutput,"gateway.rpc.analog-output"],[yj.AnalogInput,"gateway.rpc.analog-input"],[yj.BinaryOutput,"gateway.rpc.binary-output"],[yj.BinaryInput,"gateway.rpc.binary-input"],[yj.BinaryValue,"gateway.rpc.binary-value"],[yj.AnalogValue,"gateway.rpc.analog-value"]]));var xj;e("BLEMethods",xj),function(e){e.WRITE="write",e.READ="read",e.SCAN="scan"}(xj||e("BLEMethods",xj={}));const bj=e("BLEMethodsTranslates",new Map([[xj.WRITE,"gateway.rpc.write"],[xj.READ,"gateway.rpc.read"],[xj.SCAN,"gateway.rpc.scan"]]));var wj,Sj;e("CANByteOrders",wj),function(e){e.LITTLE="LITTLE",e.BIG="BIG"}(wj||e("CANByteOrders",wj={})),e("SocketMethodProcessings",Sj),function(e){e.WRITE="write",e.READ="read"}(Sj||e("SocketMethodProcessings",Sj={}));const Cj=e("SocketMethodProcessingsTranslates",new Map([[Sj.WRITE,"gateway.rpc.write"],[Sj.READ,"gateway.rpc.read"]]));var _j;e("SNMPMethods",_j),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"}(_j||e("SNMPMethods",_j={}));const Tj=e("SNMPMethodsTranslations",new Map([[_j.SET,"gateway.rpc.set"],[_j.MULTISET,"gateway.rpc.multiset"],[_j.GET,"gateway.rpc.get"],[_j.BULKWALK,"gateway.rpc.bulk-walk"],[_j.TABLE,"gateway.rpc.table"],[_j.MULTIGET,"gateway.rpc.multi-get"],[_j.GETNEXT,"gateway.rpc.get-next"],[_j.BULKGET,"gateway.rpc.bulk-get"],[_j.WALKS,"gateway.rpc.walk"]]));var Ij,Ej;e("SocketEncodings",Ij),function(e){e.UTF_8="utf-8"}(Ij||e("SocketEncodings",Ij={})),e("RestSecurityType",Ej),function(e){e.ANONYMOUS="anonymous",e.BASIC="basic"}(Ej||e("RestSecurityType",Ej={}));const Mj=e("RestSecurityTypeTranslationsMap",new Map([[Ej.ANONYMOUS,"gateway.broker.security-types.anonymous"],[Ej.BASIC,"gateway.broker.security-types.basic"]]));class kj{transform(e){return e.map((e=>(e?.value??e).toString())).join(", ")}static{this.ɵfac=function(e){return new(e||kj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getRpcTemplateArrayView",type:kj,pure:!0,standalone:!0})}}e("RpcTemplateArrayViewPipe",kj);class Pj{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=>{ke(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||Pj)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"keyValueIsNotEmpty",type:Pj,pure:!1,standalone:!0})}}e("KeyValueIsNotEmptyPipe",Pj);const Dj=e=>({$implicit:e,innerValue:!1}),Oj=e=>({"padding-left":e}),Aj=(e,t)=>({"boolean-true":e,"boolean-false":t}),Fj=e=>({$implicit:e,innerValue:!0});function Rj(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext();const i=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,Dj,e))}}function Bj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",19),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 Nj(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext();const e=t.ɵɵreference(12);t.ɵɵproperty("ngTemplateOutlet",e)}}function Lj(e,n){if(1&e&&t.ɵɵelementContainer(0,20),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(10);t.ɵɵproperty("ngTemplateOutlet",e)}}function Vj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div"),t.ɵɵtemplate(1,Lj,1,1,"ng-container",21),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵreference(8),i=t.ɵɵnextContext().$implicit,a=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction2(4,Aj,!0===e.value,!1===e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",i.type===a.ConnectorType.SNMP&&"method"===e.key)("ngIfElse",n)}}function qj(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate(e.value)}}function Gj(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 zj(e,n){if(1&e&&t.ɵɵelementContainer(0,13),2&e){const e=n.$implicit;t.ɵɵnextContext(3);const i=t.ɵɵreference(15);t.ɵɵproperty("ngTemplateOutlet",i)("ngTemplateOutletContext",t.ɵɵpureFunction1(2,Fj,e))}}function Uj(e,n){if(1&e&&(t.ɵɵtemplate(0,zj,1,4,"ng-container",12),t.ɵɵpipe(1,"keyvalue")),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵproperty("ngForOf",t.ɵɵpipeBind2(1,1,e.value,n.originalOrder))}}function jj(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",14)(1,"div",15),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(4,Bj,3,3,"div",16)(5,Nj,1,1,"ng-container",17)(6,Vj,2,7,"div",18)(7,qj,1,1,"ng-template",null,1,t.ɵɵtemplateRefExtractor)(9,Gj,2,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor)(11,Uj,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=n.innerValue,a=t.ɵɵnextContext(2);t.ɵɵstyleMap(t.ɵɵpureFunction1(10,Oj,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.ɵɵproperty("ngIf",a.isArray(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",a.isObject(e.value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!a.isObject(e.value)&&!a.isArray(e.value))}}function Hj(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-expansion-panel",6)(1,"mat-expansion-panel-header")(2,"mat-panel-title",7)(3,"span",8),t.ɵɵtext(4),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-panel-description")(6,"button",9),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",10),t.ɵɵtext(8,"delete"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",11),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",10),t.ɵɵtext(11,"play_arrow"),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(12,Rj,1,4,"ng-container",12),t.ɵɵpipe(13,"keyValueIsNotEmpty"),t.ɵɵtemplate(14,jj,13,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.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(13,3,e.config))}}class Wj{constructor(e){this.attributeService=e,this.saveTemplate=new u,this.useTemplate=new u,this.ConnectorType=ct,this.originalOrder=()=>0,this.isObject=e=>De(e),this.isArray=e=>Array.isArray(e),this.SNMPMethodsTranslations=Tj}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},D.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||Wj)(t.ɵɵdirectiveInject(_e.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Wj,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:4,vars:4,consts:[["RPCTemplateRef",""],["value",""],["SNMPMethod",""],["RPCObjectRow",""],[1,"mat-subtitle-1","title"],["hideToggle","",4,"ngFor","ngForOf"],["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",4,"ngFor","ngForOf"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"rpc-params-row","flex"],[1,"template-key"],["tbTruncateWithTooltip","","class","array-value",4,"ngIf"],[3,"ngTemplateOutlet",4,"ngIf"],[3,"class",4,"ngIf"],["tbTruncateWithTooltip","",1,"array-value"],[3,"ngTemplateOutlet"],[3,"ngTemplateOutlet",4,"ngIf","ngIfElse"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,Hj,16,5,"mat-expansion-panel",5)),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,2,"gateway.rpc.templates-title")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcTemplates))},dependencies:t.ɵɵgetComponentDepsFactory(Wj,[j,_,kj,Pj]),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 $j(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 Kj(e,n){1&e&&(t.ɵɵelementStart(0,"div",12),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",Wj);class Yj extends A{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("",[$.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||Yj)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:Yj,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["class","mat-mdc-form-field-error","style","margin-top: -15px; padding-left: 10px; font-size: 14px;",4,"ngIf"],["mat-dialog-actions","",1,"justify-end"],["mat-button","","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[1,"mat-mdc-form-field-error",2,"margin-top","-15px","padding-left","10px","font-size","14px"]],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,$j,3,3,"mat-error",7),t.ɵɵelementEnd(),t.ɵɵtemplate(12,Kj,3,3,"div",8),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",9)(14,"button",10),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(15),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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.ɵɵproperty("ngIf",n.templateNameCtrl.hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.validateDuplicateName(n.templateNameCtrl)),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(Yj,[j,_]),encapsulation:2})}}function Xj(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",6),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 Zj(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.username-required"))}function Qj(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.password-required"))}function Jj(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7)(2,"div",8),t.ɵɵtext(3,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",9)(5,"mat-form-field",10),t.ɵɵelement(6,"input",11),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,Zj,3,3,"mat-icon",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(9,"div",7)(10,"div",8),t.ɵɵtext(11,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"div",9)(13,"mat-form-field",10),t.ɵɵelement(14,"input",13),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,Qj,3,3,"mat-icon",12),t.ɵɵelementStart(17,"div",14),t.ɵɵelement(18,"tb-toggle-password",15),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(15,8,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("password").hasError("required")&&e.securityFormGroup.get("password").touched),t.ɵɵadvance(),t.ɵɵclassProp("hide-toggle",e.securityFormGroup.get("password").hasError("required"))}}e("GatewayServiceRPCConnectorTemplateDialogComponent",Yj);class eH{constructor(e){this.fb=e,this.BrokerSecurityType=Ej,this.securityTypes=Object.values(Ej),this.SecurityTypeTranslationsMap=Mj,this.destroy$=new te,this.propagateChange=e=>{},this.securityFormGroup=this.fb.group({type:[Ej.ANONYMOUS,[]],username:["",[$.required,$.pattern(an)]],password:["",[$.required,$.pattern(an)]]}),this.observeSecurityForm()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){}writeValue(e){e.type||(e.type=Ej.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===Ej.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(le(this.destroy$)).subscribe((e=>this.updateView(e))),this.securityFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.updateValidators(e)))}static{this.ɵfac=function(e){return new(e||eH)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:eH,selectors:[["tb-rest-connector-security"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>eH)),multi:!0},{provide:K,useExisting:c((()=>eH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:7,vars:3,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",4,"ngFor","ngForOf"],[4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(5,Xj,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵtemplate(6,Jj,19,10,"ng-container",5),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value===n.BrokerSecurityType.BASIC))},dependencies:t.ɵɵgetComponentDepsFactory(eH,[_,j]),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",eH);const tH=e=>({type:e});function nH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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",19),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 aH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",9),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",11),t.ɵɵtemplate(10,nH,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",13),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-form-field",15)(18,"mat-label"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-select",16),t.ɵɵtemplate(22,iH,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",17),t.ɵɵelementEnd()(),t.ɵɵelementStart(28,"mat-form-field",10)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",18),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,8,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,10,"gateway.rpc.requestType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetRequestTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,12,"gateway.rpc.requestTimeout")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,14,"gateway.rpc.objectType")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bACnetObjectTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,16,"gateway.rpc.identifier")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,18,"gateway.rpc.propertyId"))}}function rH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 oH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",21),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",10)(11,"mat-label"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-select",22),t.ɵɵtemplate(15,rH,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(16,"mat-slide-toggle",23),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,5,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,7,"gateway.rpc.characteristicUUID")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.bLEMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.rpc.withResponse")," ")}}function sH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 lH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",24),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",25),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",26),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-slide-toggle",27),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-slide-toggle",28),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",14)(20,"mat-form-field",15)(21,"mat-label"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",29),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",15)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"mat-select",30),t.ɵɵtemplate(30,sH,3,4,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(31,"div",14)(32,"mat-form-field",15)(33,"mat-label"),t.ɵɵtext(34),t.ɵɵpipe(35,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(36,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",15)(38,"mat-label"),t.ɵɵtext(39),t.ɵɵpipe(40,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(41,"input",32),t.ɵɵelementEnd()(),t.ɵɵelementStart(42,"mat-form-field")(43,"mat-label"),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(46,"input",33),t.ɵɵelementEnd(),t.ɵɵelementStart(47,"mat-form-field")(48,"mat-label"),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(51,"input",34),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,14,"gateway.rpc.nodeID")),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,16,"gateway.rpc.isExtendedID")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,18,"gateway.rpc.isFD")," "),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,20,"gateway.rpc.bitrateSwitch")," "),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(23,22,"gateway.rpc.dataLength")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,24,"gateway.rpc.dataByteorder")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.cANByteOrders),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(35,26,"gateway.rpc.dataBefore")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(40,28,"gateway.rpc.dataAfter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(45,30,"gateway.rpc.dataInHEX")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(50,32,"gateway.rpc.dataExpression"))}}function pH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),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 cH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 dH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",37),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-slide-toggle",38),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 uH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),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 mH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",45)(1,"mat-form-field",46),t.ɵɵelement(2,"input",47),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-icon",48),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 hH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",39),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",10)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵtemplate(10,uH,3,4,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-slide-toggle",38),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"fieldset",41)(15,"span",42),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(18,mH,6,4,"div",43),t.ɵɵelementStart(19,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addSNMPoid())})),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,7,"gateway.rpc.requestFilter")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,9,"gateway.rpc.method")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sNMPMethods),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(13,11,"gateway.rpc.withResponse")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(17,13,"gateway.rpc.oids"),"*"),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",e.getFormArrayControls("oid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(21,15,"gateway.rpc.add-oid")," ")}}function gH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function fH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",65),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",64),t.ɵɵelement(5,"input",66),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-icon",67),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 yH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,fH,9,4,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function vH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",49),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",14)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,gH,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",14)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",54),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",55),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",36),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"fieldset",56)(39,"span",42),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(42,yH,11,7,"div",57),t.ɵɵelementStart(43,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(44),t.ɵɵpipe(45,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,11,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,13,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,15,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,17,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,19,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,21,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,23,"gateway.rpc.valueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,25,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(45,27,"gateway.rpc.add-header")," ")}}function xH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",19),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function bH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",59),t.ɵɵelementContainerStart(1,63),t.ɵɵelementStart(2,"mat-form-field",64),t.ɵɵelement(3,"input",73),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",64),t.ɵɵelement(6,"input",74),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"mat-icon",67),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 wH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",58)(1,"div",59)(2,"span",60),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"span",60),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(8,"span",61),t.ɵɵelementEnd(),t.ɵɵelement(9,"mat-divider"),t.ɵɵtemplate(10,bH,10,7,"div",62),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.rpc.header-name")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,5,"gateway.rpc.value")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",e.getFormArrayControls("httpHeaders"))}}function SH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-form-field")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",68),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",59)(6,"mat-form-field",50)(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-select",51),t.ɵɵtemplate(11,xH,2,2,"mat-option",12),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",15)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",52),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",59)(18,"mat-form-field",15)(19,"mat-label"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(22,"input",53),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",15)(24,"mat-label"),t.ɵɵtext(25),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",69),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",15)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",70),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field")(34,"mat-label"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(37,"input",71),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"mat-form-field")(39,"mat-label"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",72),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"fieldset",56)(44,"span",42),t.ɵɵtext(45),t.ɵɵpipe(46,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(47,wH,11,7,"div",57),t.ɵɵelementStart(48,"button",44),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext(2);return t.ɵɵresetView(n.addHTTPHeader())})),t.ɵɵtext(49),t.ɵɵpipe(50,"translate"),t.ɵɵelementEnd()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,12,"gateway.rpc.methodFilter")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,14,"gateway.rpc.httpMethod")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.hTTPMethods),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,16,"gateway.rpc.requestUrlExpression")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(21,18,"gateway.rpc.responseTimeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(26,20,"gateway.rpc.timeout")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,22,"gateway.rpc.tries")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,24,"gateway.rpc.requestValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(41,26,"gateway.rpc.responseValueExpression")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(46,28,"gateway.rpc.httpHeaders")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.getFormArrayControls("httpHeaders").length),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(50,30,"gateway.rpc.add-header")," ")}}function CH(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")(1,"mat-label"),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",75),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field")(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(9,"input",76),t.ɵɵelementStart(10,"mat-icon",77),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,CH,3,3,"mat-error",78),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.ɵɵproperty("ngIf",e.commandForm.get("params").hasError("invalidJSON"))}}function TH(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,6),t.ɵɵtemplate(1,aH,33,20,"ng-template",7)(2,oH,19,13,"ng-template",7)(3,lH,52,34,"ng-template",7)(4,pH,10,6,"ng-template",7)(5,cH,13,9,"ng-template",7)(6,dH,13,9,"ng-template",7)(7,hH,22,17,"ng-template",7)(8,vH,46,29,"ng-template",7)(9,SH,51,32,"ng-template",7)(10,_H,14,10,"ng-template",8),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.CAN),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.FTP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OCPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.XMPP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SNMP),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REQUEST)}}class IH{constructor(e,t){this.fb=e,this.dialog=t,this.sendCommand=new u,this.saveTemplate=new u,this.ConnectorType=ct,this.bACnetRequestTypes=Object.values(gj),this.bACnetObjectTypes=Object.values(yj),this.bLEMethods=Object.values(xj),this.cANByteOrders=Object.values(wj),this.sNMPMethods=Object.values(_j),this.hTTPMethods=Object.values(ht),this.bACnetRequestTypesTranslates=fj,this.bACnetObjectTypesTranslates=vj,this.bLEMethodsTranslates=bj,this.SNMPMethodsTranslations=Tj,this.gatewayConnectorDefaultTypesTranslates=dt,this.urlPattern=/^[-a-zA-Zd_$:{}?~+=\/.0-9-]*$/,this.numbersOnlyPattern=/^[0-9]*$/,this.hexOnlyPattern=/^[0-9A-Fa-f ]+$/,this.propagateChange=e=>{},this.destroy$=new te}ngOnInit(){this.commandForm=this.connectorParamsFormGroupByType(this.connectorType),this.observeFormChanges()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}connectorParamsFormGroupByType(e){let t;switch(e){case ct.BACNET:t=this.fb.group({method:[null,[$.required,$.pattern(an)]],requestType:[null,[$.required,$.pattern(an)]],requestTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],objectType:[null,[]],identifier:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],propertyId:[null,[$.required,$.pattern(an)]]});break;case ct.BLE:t=this.fb.group({methodRPC:[null,[$.required,$.pattern(an)]],characteristicUUID:["00002A00-0000-1000-8000-00805F9B34FB",[$.required,$.pattern(an)]],methodProcessing:[null,[$.required]],withResponse:[!1,[]]});break;case ct.CAN:t=this.fb.group({method:[null,[$.required,$.pattern(an)]],nodeID:[null,[$.required,$.min(0),$.pattern(this.numbersOnlyPattern)]],isExtendedID:[!1,[]],isFD:[!1,[]],bitrateSwitch:[!1,[]],dataLength:[null,[$.min(1),$.pattern(this.numbersOnlyPattern)]],dataByteorder:[null,[]],dataBefore:[null,[$.pattern(an),$.pattern(this.hexOnlyPattern)]],dataAfter:[null,[$.pattern(an),$.pattern(this.hexOnlyPattern)]],dataInHEX:[null,[$.pattern(an),$.pattern(this.hexOnlyPattern)]],dataExpression:[null,[$.pattern(an)]]});break;case ct.FTP:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(an)]],valueExpression:[null,[$.required,$.pattern(an)]]});break;case ct.OCPP:case ct.XMPP:t=this.fb.group({methodRPC:[null,[$.required,$.pattern(an)]],valueExpression:[null,[$.required,$.pattern(an)]],withResponse:[!1,[]]});break;case ct.SNMP:t=this.fb.group({requestFilter:[null,[$.required,$.pattern(an)]],method:[null,[$.required]],withResponse:[!1,[]],oid:this.fb.array([],[$.required])});break;case ct.REST:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(an)]],httpMethod:[null,[$.required]],requestUrlExpression:[null,[$.required,$.pattern(this.urlPattern)]],responseTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],timeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],tries:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],valueExpression:[null,[$.required,$.pattern(an)]],httpHeaders:this.fb.array([]),security:[{},[$.required]]});break;case ct.REQUEST:t=this.fb.group({methodFilter:[null,[$.required,$.pattern(an)]],httpMethod:[null,[$.required]],requestUrlExpression:[null,[$.required,$.pattern(this.urlPattern)]],responseTimeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],timeout:[null,[$.required,$.min(10),$.pattern(this.numbersOnlyPattern)]],tries:[null,[$.required,$.min(1),$.pattern(this.numbersOnlyPattern)]],requestValueExpression:[null,[$.required,$.pattern(an)]],responseValueExpression:[null,[$.pattern(an)]],httpHeaders:this.fb.array([])});break;default:t=this.fb.group({command:[null,[$.required,$.pattern(an)]],params:[{},[st]]})}return t}addSNMPoid(e=null){const t=this.commandForm.get("oid");t&&t.push(this.fb.control(e,[$.required,$.pattern(an)]),{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,[$.required,$.pattern(an)]],value:[e.value,[$.required,$.pattern(an)]]});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(tt,{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=Oe(e),this.connectorType){case ct.SNMP:this.clearFromArrayByName("oid"),e.oid.forEach((e=>{this.addSNMPoid(e)})),delete e.oid;break;case ct.REQUEST:case ct.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(le(this.destroy$)).subscribe((e=>{this.connectorType!==ct.REST&&this.connectorType!==ct.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||IH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(qe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:IH,selectors:[["tb-gateway-service-rpc-connector"]],inputs:{connectorType:"connectorType"},outputs:{sendCommand:"sendCommand",saveTemplate:"saveTemplate"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>IH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:12,vars:16,consts:[[1,"command-form","flex","flex-col",3,"formGroup"],[1,"mat-subtitle-1","title"],[3,"ngIf"],[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"],[3,"ngSwitch"],[3,"ngSwitchCase"],["ngSwitchDefault",""],["matInput","","formControlName","method","placeholder","set_state"],[1,"mat-block"],["formControlName","requestType"],[3,"value",4,"ngFor","ngForOf"],["matInput","","formControlName","requestTimeout","type","number","min","10","step","1","placeholder","1000"],[1,"flex","flex-1","flex-row","gap-2.5"],[1,"flex-1"],["formControlName","objectType"],["matInput","","formControlName","identifier","type","number","min","1","step","1","placeholder","1"],["matInput","","formControlName","propertyId","placeholder","presentValue"],[3,"value"],["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"],["class","flex flex-1 flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","flex-row","items-center","justify-center","gap-2.5"],["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"],[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"],["class","flex flex-col gap-2.5 border",4,"ngIf"],[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"],["class","flex flex-row items-center justify-center gap-2.5",4,"ngFor","ngForOf"],[3,"formGroupName"],["appearance","outline",1,"flex-1"],["matInput","","formControlName","headerName"],["matInput","","formControlName","value","placeholder","application/json"],[2,"cursor","pointer","width","30px",3,"click","matTooltip"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","timeout","type","number","step","1","min","10","placeholder","10"],["matInput","","formControlName","tries","type","number","step","1","min","1","placeholder","1"],["matInput","","formControlName","requestValueExpression","placeholder","${params}"],["matInput","","formControlName","responseValueExpression","placeholder","${temp}"],["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"],[4,"ngIf"]],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,TH,11,10,"ng-template",2),t.ɵɵelementStart(5,"div",3)(6,"button",4),t.ɵɵlistener("click",(function(){return n.save()})),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",5),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,tH,n.gatewayConnectorDefaultTypesTranslates.get(n.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorType),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(IH,[j,_]),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 EH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function MH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",11),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 kH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function PH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",12),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function DH(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",13)(1,"mat-form-field",3)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",14),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,PH,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.ɵɵproperty("ngIf",e.rpcParametersFormGroup.get("value").hasError("required")&&e.rpcParametersFormGroup.get("value").touched)}}class OH{constructor(e){this.fb=e,this.ModbusEditableDataTypes=$t,this.ModbusFunctionCodeTranslationsMap=Zt,this.modbusDataTypes=Object.values(Wt),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 te,this.rpcParametersFormGroup=this.fb.group({type:[Wt.BYTES,[$.required]],functionCode:[this.defaultFunctionCodes[0],[$.required]],value:[{value:"",disabled:!0},[$.required,$.pattern(an)]],address:[null,[$.required]],objectsCount:[1,[$.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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeKeyDataType(){this.rpcParametersFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.ModbusEditableDataTypes.includes(e)||this.rpcParametersFormGroup.get("objectsCount").patchValue(Kt[e],{emitEvent:!1}),this.updateFunctionCodes(e)}))}observeFunctionCode(){this.rpcParametersFormGroup.get("functionCode").valueChanges.pipe(le(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===Wt.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||OH)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:OH,selectors:[["tb-gateway-modbus-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>OH)),multi:!0},{provide:K,useExisting:c((()=>OH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:35,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"],[1,"flex-1"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["formControlName","functionCode"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","min","1","max","50000","name","value","formControlName","objectsCount",3,"placeholder","readonly"],["class","flex",4,"ngIf"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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.ɵɵtemplate(13,EH,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(14,"mat-form-field",3)(15,"mat-label"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"mat-select",6),t.ɵɵtemplate(19,MH,3,4,"mat-option",5),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",2)(21,"mat-form-field",3)(22,"mat-label"),t.ɵɵtext(23),t.ɵɵpipe(24,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",7),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,kH,3,3,"mat-icon",8),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-form-field",3)(29,"mat-label"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(32,"input",9),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,DH,8,7,"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.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(17,20,"gateway.rpc.functionCode")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.functionCodes),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,22,"gateway.rpc.address")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.rpcParametersFormGroup.get("address").hasError("required")&&n.rpcParametersFormGroup.get("address").touched),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(31,26,"gateway.rpc.objectsCount")),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(33,28,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(n.rpcParametersFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.writeFunctionCodes.includes(n.rpcParametersFormGroup.get("functionCode").value)))},dependencies:t.ɵɵgetComponentDepsFactory(OH,[j,_]),styles:['@charset "UTF-8";[_nghost-%COMP%] .hint-container[_ngcontent-%COMP%]{margin-bottom:12px}'],changeDetection:d.OnPush})}}function AH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 FH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-form-field")(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 RH{constructor(e){this.fb=e,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new te,this.rpcParametersFormGroup=this.fb.group({methodFilter:[null,[$.required,$.pattern(an)]],requestTopicExpression:[null,[$.required,$.pattern(an)]],responseTopicExpression:[{value:null,disabled:!0},[$.required,$.pattern(an)]],responseTimeout:[{value:null,disabled:!0},[$.min(10),$.pattern(rn)]],valueExpression:[null,[$.required,$.pattern(an)]],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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}observeWithResponse(){this.rpcParametersFormGroup.get("withResponse").valueChanges.pipe(me((e=>this.toggleResponseFields(e))),le(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||RH)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:RH,selectors:[["tb-gateway-mqtt-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>RH)),multi:!0},{provide:K,useExisting:c((()=>RH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],["matInput","","formControlName","methodFilter","placeholder","echo"],["matInput","","formControlName","requestTopicExpression","placeholder","sensor/${deviceName}/request/${methodName}/${requestId}"],["formControlName","withResponse",1,"margin",3,"click"],[4,"ngIf"],["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")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",1),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",2),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-slide-toggle",3),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,AH,5,3,"mat-form-field",4)(15,FH,5,3,"mat-form-field",4),t.ɵɵelementStart(16,"mat-form-field")(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.ɵɵproperty("ngIf",null==(e=n.rpcParametersFormGroup.get("withResponse"))?null:e.value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",null==(i=n.rpcParametersFormGroup.get("withResponse"))?null:i.value),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(19,13,"gateway.rpc.valueExpression"))}},dependencies:t.ɵɵgetComponentDepsFactory(RH,[j,_]),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 BH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",26),t.ɵɵelement(1,"mat-icon",27),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 NH(e,n){1&e&&(t.ɵɵelement(0,"input",28),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function LH(e,n){1&e&&(t.ɵɵelement(0,"input",29),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function VH(e,n){1&e&&(t.ɵɵelement(0,"input",30),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function qH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",31)(1,"mat-option",26),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",26),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function GH(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",32),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function zH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",8)(1,"div",9)(2,"div",10),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12)(6,"mat-select",13)(7,"mat-select-trigger")(8,"div",14),t.ɵɵelement(9,"mat-icon",15),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(13,BH,5,5,"mat-option",16),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",17)(15,"div",10),t.ɵɵtext(16,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-form-field",18),t.ɵɵelementContainerStart(18,19),t.ɵɵtemplate(19,NH,2,3,"input",20)(20,LH,2,3,"input",21)(21,VH,2,3,"input",22)(22,qH,5,2,"mat-select",23),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(23,GH,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",25),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;const a=n.$implicit,r=t.ɵɵnextContext();t.ɵɵproperty("formGroup",a),t.ɵɵadvance(9),t.ɵɵproperty("svgIcon",null==(e=r.valueTypes.get(a.get("type").value))?null:e.icon),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,11,null==(i=r.valueTypes.get(a.get("type").value))?null:i.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",r.valueTypeKeys),t.ɵɵadvance(5),t.ɵɵproperty("ngSwitch",a.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",r.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",a.get(a.get("type").value+"Value").hasError("required")&&a.get(a.get("type").value+"Value").touched),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(25,13,"gateway.rpc.remove"))}}class UH{constructor(e,t){this.fb=e,this.cdr=t,this.valueTypeKeys=Object.values(Yt),this.MappingValueType=Yt,this.valueTypes=Xt,this.onChange=e=>{},this.onTouched=()=>{},this.destroy$=new te,this.rpcParametersFormGroup=this.fb.group({method:[null,[$.required,$.pattern(an)]],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(le(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??Yt.STRING],stringValue:[e.stringValue??{value:"",disabled:!(Se(e,{})||e.stringValue)},[$.required,$.pattern(an)]],integerValue:[{value:e.integerValue??0,disabled:!ke(e.integerValue)},[$.required,$.pattern(rn)]],doubleValue:[{value:e.doubleValue??0,disabled:!ke(e.doubleValue)},[$.required]],booleanValue:[{value:e.booleanValue??!1,disabled:!ke(e.booleanValue)},[$.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(le(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||UH)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:UH,selectors:[["tb-gateway-opc-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>UH)),multi:!0},{provide:K,useExisting:c((()=>UH)),multi:!0}]),t.ɵɵStandaloneFeature],decls:18,vars:14,consts:[[3,"formGroup"],[1,"tb-form-hint","tb-primary-fill","tb-flex","no-padding-top","hint-container"],[1,"tb-flex"],["matInput","","formControlName","method","placeholder","multiply"],["formArrayName","arguments",1,"tb-form-panel","stroked","arguments-container"],[1,"fields-label"],["class","flex flex-1 items-center justify-center gap-2.5",3,"formGroup",4,"ngFor","ngForOf"],["mat-raised-button","",1,"self-start",3,"click"],[1,"flex","flex-1","items-center","justify-center","gap-2.5",3,"formGroup"],[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",4,"ngFor","ngForOf"],[1,"tb-form-row","column-xs","value-container","item-center","justify-between"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","tb-suffix-absolute","flex"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",1,"tb-box-button",3,"click","matTooltip"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["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"]],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.ɵɵtemplate(14,zH,28,15,"div",6),t.ɵɵelementStart(15,"button",7),t.ɵɵlistener("click",(function(){return n.addArgument()})),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.rpcParametersFormGroup),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(3,6,"gateway.rpc.hint.opc-method")," "),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(7,8,"gateway.rpc.method")),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,10,"gateway.rpc.arguments")),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",n.rpcParametersFormGroup.get("arguments").controls),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(17,12,"gateway.rpc.add-argument")," "))},dependencies:t.ɵɵgetComponentDepsFactory(UH,[j,_]),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 jH(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.SocketMethodProcessingsTranslates.get(e))," ")}}function HH(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.toUpperCase()," ")}}class WH extends Ra{constructor(){super(...arguments),this.SocketMethodProcessingsTranslates=Cj,this.socketMethodProcessings=Object.values(Sj),this.socketEncoding=Object.values(mt)}initFormGroup(){return this.fb.group({methodRPC:[null,[$.required,$.pattern(an)]],methodProcessing:[Sj.WRITE,[$.required]],encoding:[Ij.UTF_8,[$.required,$.pattern(an)]],withResponse:[!1,[]]})}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(WH)))(n||WH)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:WH,selectors:[["tb-gateway-socket-rpc-parameters"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>WH)),multi:!0},{provide:K,useExisting:c((()=>WH)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:21,vars:15,consts:[[3,"formGroup"],[1,"w-full"],["matInput","","formControlName","methodRPC","placeholder","rpcMethod1"],[1,"mat-block"],["formControlName","methodProcessing"],[3,"value",4,"ngFor","ngForOf"],["formControlName","encoding"],["formControlName","withResponse",1,"mat-slide","margin"],[3,"value"]],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.ɵɵtemplate(11,jH,3,4,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(12,"mat-form-field",3)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-select",6),t.ɵɵtemplate(17,HH,2,2,"mat-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"mat-slide-toggle",7),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e&&(t.ɵɵproperty("formGroup",n.formGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,7,"gateway.rpc.methodRPC")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,9,"gateway.rpc.methodProcessing")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketMethodProcessings),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,11,"gateway.encoding")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(20,13,"gateway.rpc.withResponse")," "))},dependencies:t.ɵɵgetComponentDepsFactory(WH,[j,_]),encapsulation:2,changeDetection:d.OnPush})}}const $H=e=>({border:e}),KH=e=>({type:e});function YH(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",15),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function XH(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 ZH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-select",9),t.ɵɵtemplate(6,YH,2,2,"mat-option",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"mat-form-field",11)(8,"mat-label"),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(11,"input",12),t.ɵɵtemplate(12,XH,3,3,"mat-error",13),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"button",14),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(),t.ɵɵelementContainerEnd()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,"gateway.statistics.command")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.RPCCommands),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,8,"gateway.statistics.timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.commandForm.get("time").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("disabled",e.commandForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,10,"gateway.rpc-command-send")," ")}}function QH(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector",17),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 JH(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-modbus-rpc-parameters",24)}function eW(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-mqtt-rpc-parameters",24)}function tW(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-opc-rpc-parameters",24)}function nW(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-socket-rpc-parameters",24)}function iW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",18)(1,"div",19),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(4,20),t.ɵɵtemplate(5,JH,1,0,"tb-gateway-modbus-rpc-parameters",21)(6,eW,1,0,"tb-gateway-mqtt-rpc-parameters",21)(7,tW,1,0,"tb-gateway-opc-rpc-parameters",21)(8,nW,1,0,"tb-gateway-socket-rpc-parameters",21),t.ɵɵelementContainerEnd(),t.ɵɵelementStart(9,"div",22)(10,"button",23),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",14),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){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind2(3,10,"gateway.rpc.title",t.ɵɵpureFunction1(17,KH,e.gatewayConnectorDefaultTypesTranslates.get(e.connectorType)))),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",e.connectorType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,13,"gateway.rpc-command-save-template")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",e.commandForm.get("params").invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,15,"gateway.rpc-command-send")," ")}}function aW(e,n){if(1&e&&t.ɵɵtemplate(0,QH,1,1,"tb-gateway-service-rpc-connector",16)(1,iW,16,19,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2),n=t.ɵɵnextContext();t.ɵɵproperty("ngIf",!n.typesWithUpdatedParams.has(n.connectorType))("ngIfElse",e)}}function rW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",25)(1,"mat-icon",26),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 oW(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-gateway-service-rpc-connector-templates",27),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 sW{constructor(e,t,n,i,a){this.fb=e,this.dialog=t,this.utils=n,this.cd=i,this.attributeService=a,this.contentTypes=V,this.RPCCommands=["Ping","Stats","Devices","Update","Version","Restart","Reboot"],this.templates=[],this.ConnectorType=ct,this.gatewayConnectorDefaultTypesTranslates=dt,this.typesWithUpdatedParams=new Set([ct.MQTT,ct.OPCUA,ct.MODBUS,ct.SOCKET]),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,[$.required]],time:[60,[$.required,$.min(1)]],params:["{}",[st]],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(R.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 ct.MQTT:case ct.FTP:case ct.SNMP:case ct.REST:case ct.REQUEST:return e.methodFilter;case ct.MODBUS:return this.modbusReadFunctionCodes.includes(e.functionCode)?"get":"set";case ct.BACNET:case ct.CAN:case ct.OPCUA:return e.method;case ct.BLE:case ct.OCPP:case ct.SOCKET:case ct.XMPP:return e.methodRPC;default:return e.command}}saveTemplate(){this.dialog.open(Yj,{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},D.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||sW)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(_e.AttributeService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:sW,selectors:[["tb-gateway-service-rpc"]],inputs:{ctx:"ctx",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵStandaloneFeature],decls:12,vars:14,consts:[["connectorForm",""],["updatedParameters",""],[1,"flex","flex-1","flex-col"],[1,"command-form","flex","flex-row","gap-2.5","lt-sm:flex-col",3,"formGroup"],[4,"ngIf","ngIfElse"],[1,"result-block",3,"formGroup"],["class","result-time flex flex-1 flex-row items-center justify-center",4,"ngIf"],["readonly","true","formControlName","result",3,"contentType"],["class","border",3,"rpcTemplates","ctx","connectorType","useTemplate",4,"ngIf"],["formControlName","command"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","formControlName","time","type","number","min","1"],[4,"ngIf"],["mat-raised-button","","color","primary",3,"click","disabled"],[3,"value"],["formControlName","params",3,"connectorType","sendCommand","saveTemplate",4,"ngIf","ngIfElse"],["formControlName","params",3,"sendCommand","saveTemplate","connectorType"],[1,"rpc-parameters","flex","flex-col"],[1,"mat-subtitle-1","tb-form-panel-title"],[3,"ngSwitch"],["formControlName","params",4,"ngSwitchCase"],[1,"fex-row","template-actions","flex","flex-1","items-center","justify-end","gap-2.5"],["mat-raised-button","",3,"click","disabled"],["formControlName","params"],[1,"result-time","flex","flex-1","flex-row","items-center","justify-center"],[1,"material-icons"],[1,"border",3,"useTemplate","rpcTemplates","ctx","connectorType"]],template:function(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",2)(1,"div",3),t.ɵɵtemplate(2,ZH,16,12,"ng-container",4)(3,aW,3,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"section",5)(6,"span"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,rW,6,4,"div",6),t.ɵɵelementEnd(),t.ɵɵelement(10,"tb-json-content",7),t.ɵɵelementEnd()(),t.ɵɵtemplate(11,oW,1,3,"tb-gateway-service-rpc-connector-templates",8)),2&e){const e=t.ɵɵreference(4);t.ɵɵclassMap(t.ɵɵpureFunction1(12,$H,n.isConnector)),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.isConnector)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.commandForm),t.ɵɵadvance(2),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(8,10,"gateway.rpc-command-result")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.resultTime),t.ɵɵadvance(),t.ɵɵproperty("contentType",n.contentTypes.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isConnector)}},dependencies:t.ɵɵgetComponentDepsFactory(sW,[j,_,IH,OH,RH,UH,Wj,WH]),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 lW(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",sW);class pW extends A{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||pW)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:pW,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"],[1,"mat-block","tb-value-type",2,"flex-grow","0"],["matInput","","required","",3,"formControl"],[4,"ngIf"],["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,lW,3,3,"mat-error",9),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",10)(18,"button",11),t.ɵɵlistener("click",(function(){return n.close()})),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",12),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.ɵɵproperty("ngIf",n.gatewayControl.hasError("required")),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(pW,[j,_]),encapsulation:2})}}var cW;e("GatewayRemoteConfigurationDialogComponent",pW),function(e){e.tls="tls",e.accessToken="accessToken"}(cW||(cW={}));const dW="configuration_drafts",uW="RemoteLoggingLevel",mW=new Map([[cW.tls,"gateway.security-types.tls"],[cW.accessToken,"gateway.security-types.access-token"]]);var hW,gW;!function(e){e.none="NONE",e.critical="CRITICAL",e.error="ERROR",e.warning="WARNING",e.info="INFO",e.debug="DEBUG"}(hW||(hW={})),function(e){e.memory="memory",e.file="file"}(gW||(gW={}));const fW=new Map([[gW.memory,"gateway.storage-types.memory-storage"],[gW.file,"gateway.storage-types.file-storage"]]);var yW;!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"}(yW||(yW={}));const vW={config:{},name:"",configType:null,enabled:!1};function xW(e){return JSON.stringify(e.value)===JSON.stringify({})?{validJSON:!0}:null}function bW(e){return e.replace("_","").replace("-","").replace(/^\s+|\s+/g,"").toLowerCase()+".json"}function wW(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 SW(e){return{id:e,entityType:L.DEVICE}}function CW(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,cW.accessToken)?(t.securityType=cW.accessToken,t.accessToken=e.thingsboard.security.accessToken):(t.securityType=cW.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===gW.memory?(t.storageType=gW.memory,t.readRecordsCount=e.storage.read_records_count,t.maxRecordsCount=e.storage.max_records_count):e.storage.type===gW.file&&(t.storageType=gW.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 _W(e){const t={};for(const n of e)n.enabled||(t[n.name]={connector:n.configType,config:n.config});return t}function TW(e){const t={thingsboard:IW(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 IW(e){let t;t=e.securityType===cW.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===gW.memory?{type:gW.memory,read_records_count:e.readRecordsCount,max_records_count:e.maxRecordsCount}:{type:gW.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:bW(t.name),name:t.name,type:t.configType};a.push(e)}return{thingsboard:n,connectors:a,storage:i,logs:window.btoa(wW(e.remoteLoggingLevel,e.remoteLoggingPathToLogs))}}const EW=["formContainer"],MW=(e,t,n)=>({"gap-1.25":e,"flex-row":t,"flex-col":n}),kW=(e,t,n)=>({"gap-1.25":e,"flex-row justify-end item-center":t,"flex-col justify-evenly item-center":n});function PW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 DW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-host-required "),t.ɵɵelementEnd())}function OW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-required "),t.ɵɵelementEnd())}function AW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-min "),t.ɵɵelementEnd())}function FW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-max "),t.ɵɵelementEnd())}function RW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.thingsboard-port-pattern "),t.ɵɵelementEnd())}function BW(e,n){1&e&&(t.ɵɵelementStart(0,"div",16)(1,"mat-form-field")(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",30),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field")(7,"mat-label"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(10,"input",31),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field")(12,"mat-label"),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",32),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 NW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e," ")}}function LW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.path-logs-required "),t.ɵɵelementEnd())}function VW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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 qW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-required "),t.ɵɵelementEnd())}function GW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-min "),t.ɵɵelementEnd())}function zW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-pack-size-pattern "),t.ɵɵelementEnd())}function UW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-required "),t.ɵɵelementEnd())}function jW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-min "),t.ɵɵelementEnd())}function HW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-records-pattern "),t.ɵɵelementEnd())}function WW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-required "),t.ɵɵelementEnd())}function $W(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-min "),t.ɵɵelementEnd())}function KW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-max-files-pattern "),t.ɵɵelementEnd())}function YW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.storage-path-required "),t.ɵɵelementEnd())}function XW(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",5)(1,"mat-form-field",8)(2,"mat-label"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",33),t.ɵɵtemplate(6,WW,2,0,"mat-error",10)(7,$W,2,0,"mat-error",10)(8,KW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",8)(10,"mat-label"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",34),t.ɵɵtemplate(14,YW,2,0,"mat-error",10),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵclassMap(t.ɵɵpureFunction3(12,MW,e.layoutGap,e.alignment,!e.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,8,"gateway.storage-max-files")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("maxFilesCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,10,"gateway.storage-path")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.gatewayConfigurationGroup.get("dataFolderPath").hasError("required"))}}function ZW(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",28),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",29),t.ɵɵtext(1," gateway.connector-type-required "),t.ɵɵelementEnd())}function JW(e,n){1&e&&(t.ɵɵelementStart(0,"mat-error",29),t.ɵɵtext(1," gateway.connector-name-required "),t.ɵɵelementEnd())}function e$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",35)(1,"div",36)(2,"div",37),t.ɵɵelement(3,"mat-slide-toggle",38),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",39)(5,"mat-form-field",8)(6,"mat-label"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-select",40),t.ɵɵlistener("selectionChange",(function(){const n=t.ɵɵrestoreView(e).$implicit,i=t.ɵɵnextContext();return t.ɵɵresetView(i.changeConnectorType(n))})),t.ɵɵtemplate(10,ZW,2,2,"mat-option",7),t.ɵɵelementEnd(),t.ɵɵtemplate(11,QW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",8)(13,"mat-label"),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"input",41),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(17,JW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",42)(19,"button",43),t.ɵɵpipe(20,"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(21,"mat-icon"),t.ɵɵtext(22,"more_horiz"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",43),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(){const n=t.ɵɵrestoreView(e).index,i=t.ɵɵnextContext();return t.ɵɵresetView(i.removeConnector(n))})),t.ɵɵelementStart(25,"mat-icon"),t.ɵɵtext(26,"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(24,MW,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(8,16,"gateway.connector-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",a.connectorTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("configType").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,18,"gateway.connector-name")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.get("name").hasError("required")),t.ɵɵadvance(),t.ɵɵclassMap(t.ɵɵpureFunction3(28,kW,a.layoutGap,a.alignment,!a.alignment)),t.ɵɵadvance(),t.ɵɵclassProp("mat-warn",e.get("config").invalid),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(20,20,"gateway.update-config")),t.ɵɵproperty("disabled",a.isReadOnlyForm),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,22,"gateway.delete")),t.ɵɵproperty("disabled",a.isReadOnlyForm)}}function t$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",44),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 n$(e,n){if(1&e&&(t.ɵɵelementStart(0,"button",45),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 i$ extends q{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=mW,this.gatewayLogLevels=Object.keys(hW).map((e=>hW[e])),this.connectorTypes=Object.keys(yW),this.storageTypes=fW,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(SW(i),n,[a])}createConnector(e=vW){this.connectors.push(this.fb.group({enabled:[e.enabled],configType:[e.configType,[$.required]],name:[e.name,[$.required]],config:[e.config,[$.nullValidator,xW]]}))}getFormField(e){return this.gatewayConfigurationGroup.get(e)}buildForm(){this.gatewayConfigurationGroup=this.fb.group({gateway:[null,[]],accessToken:[null,[$.required]],securityType:[cW.accessToken],host:[this.window.location.hostname,[$.required]],port:[1883,[$.required,$.min(1),$.max(65535),$.pattern(/^-?[0-9]+$/)]],remoteConfiguration:[!0],caCertPath:["/etc/thingsboard-gateway/ca.pem"],privateKeyPath:["/etc/thingsboard-gateway/privateKey.pem"],certPath:["/etc/thingsboard-gateway/certificate.pem"],remoteLoggingLevel:[hW.debug],remoteLoggingPathToLogs:["./logs/",[$.required]],storageType:[gW.memory],readRecordsCount:[100,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],maxRecordsCount:[1e4,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],maxFilesCount:[5,[$.required,$.min(1),$.pattern(/^-?[0-9]+$/)]],dataFolderPath:["./data/",[$.required]],connectors:this.fb.array([])}),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1}),this.subscribeStorageType$=this.getFormField("storageType").valueChanges.subscribe((e=>{e===gW.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?oe([this.deviceService.getDeviceCredentials(e).pipe(me((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===cW.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===gW.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: "+bW(n.name)+"\n");return t}(e),function(e,t){for(const n of t)n.enabled&&(e[bW(n.name)]=JSON.stringify(n.config))}(t,e.connectors),n=t,i=e.remoteLoggingLevel,a=e.remoteLoggingPathToLogs,n["logs.conf"]=wW(i,a),this.importExport.exportJSZip(t,this.archiveFileName),this.saveAttribute(uW,this.gatewayConfigurationGroup.value.remoteLoggingLevel.toUpperCase(),D.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(tt,{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(oe([this.getAttribute("current_configuration",D.CLIENT_SCOPE,e),this.getAttribute(dW,D.SERVER_SCOPE,e)]).pipe(me((([e,t])=>{this.setFormGatewaySettings(e),this.setFormConnectorsDraft(t),this.isReadOnlyForm&&this.gatewayConfigurationGroup.disable({emitEvent:!1})})))),t.push(this.getAttribute(uW,D.SHARED_SCOPE,e).pipe(me((e=>this.processLoggingLevel(e))))),t}getAttribute(e,t,n){return this.attributeService.getEntityAttributes(SW(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(CW(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=hW.debug;e.length>0&&hW[e[0].value.toLowerCase()]&&(t=hW[e[0].value.toLowerCase()]),this.getFormField("remoteLoggingLevel").patchValue(t)}static{this.ɵfac=function(e){return new(e||i$)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(t.ElementRef),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(Ce),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(_e.DeviceService),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(nt.ImportExportService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:i$,selectors:[["tb-gateway-form"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(EW,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:104,vars:104,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"],[1,"flex"],["formControlName","securityType"],[3,"value",4,"ngFor","ngForOf"],[1,"flex-1"],["matInput","","type","text","formControlName","host"],["translate","",4,"ngIf"],["matInput","","type","number","formControlName","port"],["class","flex flex-col",4,"ngIf"],["formControlName","remoteConfiguration"],["formControlName","remoteLoggingLevel"],["matInput","","type","text","formControlName","remoteLoggingPathToLogs"],[1,"flex","flex-col"],["formControlName","storageType"],["matInput","","type","number","formControlName","readRecordsCount"],["matInput","","type","number","formControlName","maxRecordsCount"],["class","flex",3,"class",4,"ngIf"],[1,"gateway-config","flex","flex-col"],["formArrayName","connectors",4,"ngFor","ngForOf"],[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","click",4,"ngIf"],["mat-raised-button","","color","primary","type","submit",3,"disabled","matTooltip",4,"ngIf"],[3,"value"],["translate",""],["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"],["formArrayName","connectors"],[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"],["mat-raised-button","","color","primary","type","submit",3,"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.ɵɵtemplate(16,PW,3,4,"mat-option",7),t.ɵɵpipe(17,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",5)(19,"mat-form-field",8)(20,"mat-label"),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"input",9),t.ɵɵtemplate(24,DW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",8)(26,"mat-label"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(29,"input",11),t.ɵɵtemplate(30,OW,2,0,"mat-error",10)(31,AW,2,0,"mat-error",10)(32,FW,2,0,"mat-error",10)(33,RW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,BW,16,9,"div",12),t.ɵɵelementStart(35,"mat-checkbox",13),t.ɵɵtext(36),t.ɵɵpipe(37,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(38,"div",5)(39,"mat-form-field",8)(40,"mat-label"),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(43,"mat-select",14),t.ɵɵtemplate(44,NW,2,2,"mat-option",7),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"mat-form-field",8)(46,"mat-label"),t.ɵɵtext(47),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",15),t.ɵɵtemplate(50,LW,2,0,"mat-error",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(51,"mat-expansion-panel")(52,"mat-expansion-panel-header")(53,"mat-panel-title")(54,"div",3),t.ɵɵtext(55),t.ɵɵpipe(56,"translate"),t.ɵɵpipe(57,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(58,"div",16)(59,"mat-form-field")(60,"mat-label"),t.ɵɵtext(61),t.ɵɵpipe(62,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"mat-select",17),t.ɵɵtemplate(64,VW,3,4,"mat-option",7),t.ɵɵpipe(65,"keyvalue"),t.ɵɵelementEnd()(),t.ɵɵelementStart(66,"div",5)(67,"mat-form-field",8)(68,"mat-label"),t.ɵɵtext(69),t.ɵɵpipe(70,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(71,"input",18),t.ɵɵtemplate(72,qW,2,0,"mat-error",10)(73,GW,2,0,"mat-error",10)(74,zW,2,0,"mat-error",10),t.ɵɵelementEnd(),t.ɵɵelementStart(75,"mat-form-field",8)(76,"mat-label"),t.ɵɵtext(77),t.ɵɵpipe(78,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(79,"input",19),t.ɵɵtemplate(80,UW,2,0,"mat-error",10)(81,jW,2,0,"mat-error",10)(82,HW,2,0,"mat-error",10),t.ɵɵelementEnd()(),t.ɵɵtemplate(83,XW,15,16,"div",20),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"mat-expansion-panel")(85,"mat-expansion-panel-header")(86,"mat-panel-title")(87,"div",3),t.ɵɵtext(88),t.ɵɵpipe(89,"translate"),t.ɵɵpipe(90,"uppercase"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",21),t.ɵɵtemplate(92,e$,27,32,"section",22),t.ɵɵelementStart(93,"span",23),t.ɵɵtext(94),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(96,"div")(97,"button",24),t.ɵɵpipe(98,"translate"),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addNewConnector())})),t.ɵɵtext(99),t.ɵɵpipe(100,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(101,"section",25),t.ɵɵtemplate(102,t$,4,7,"button",26)(103,n$,4,7,"button",27),t.ɵɵelementEnd()()}2&e&&(t.ɵɵpropertyInterpolate("toastTarget",n.toastTargetId),t.ɵɵproperty("formGroup",n.gatewayConfigurationGroup),t.ɵɵadvance(7),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(9,54,t.ɵɵpipeBind1(8,52,"gateway.thingsboard"))),t.ɵɵadvance(3),t.ɵɵproperty("deviceName",n.deviceNameForm)("isStateForm",n.isStateForm)("newGatewayType",n.gatewayType),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(14,56,"gateway.security-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(17,58,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(92,MW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(22,60,"gateway.thingsboard-host")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("host").hasError("required")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,62,"gateway.thingsboard-port")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("port").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","tls"===n.gatewayConfigurationGroup.get("securityType").value),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(37,64,"gateway.remote")),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(96,MW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(42,66,"gateway.remote-logging-level")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.gatewayLogLevels),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(48,68,"gateway.path-logs")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteLoggingPathToLogs").hasError("required")),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(57,72,t.ɵɵpipeBind1(56,70,"gateway.storage"))),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(62,74,"gateway.storage-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(65,76,n.storageTypes)),t.ɵɵadvance(2),t.ɵɵclassMap(t.ɵɵpureFunction3(100,MW,n.layoutGap,n.alignment,!n.alignment)),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(70,78,"gateway.storage-pack-size")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("readRecordsCount").hasError("pattern")),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(78,80,"file"!==n.gatewayConfigurationGroup.get("storageType").value?"gateway.storage-max-records":"gateway.storage-max-file-records")," "),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("maxRecordsCount").hasError("pattern")),t.ɵɵadvance(),t.ɵɵproperty("ngIf","file"===n.gatewayConfigurationGroup.get("storageType").value),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(90,84,t.ɵɵpipeBind1(89,82,"gateway.connectors-config"))),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.connectors.controls),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.connectors.length),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(95,86,"gateway.no-connectors")),t.ɵɵadvance(3),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(98,88,"gateway.connector-add")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(100,90,"action.add")," "),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.isReadOnlyForm),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.gatewayConfigurationGroup.get("remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.gatewayConfigurationGroup.get("remoteConfiguration").value))},dependencies:t.ɵɵgetComponentDepsFactory(i$,[j,_]),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",i$);class a${transform(e,t){return za.parseVersion(e)>=za.parseVersion(Ei.get(t))}static{this.ɵfac=function(e){return new(e||a$)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"isLatestVersionConfig",type:a$,pure:!0,standalone:!0})}}class r${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:Ii.MIN,max:Ii.MAX}):""}static{this.ɵfac=function(e){return new(e||r$)(t.ɵɵdirectiveInject(He.TranslateService,16))}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getGatewayPortTooltip",type:r$,pure:!0,standalone:!0})}}class o${transform(e,t,n,i){switch(e){case ct.OPCUA:return this.getOpcConnectorHelpLink(t,n);case ct.MQTT:return this.getMqttConnectorHelpLink(t,n,i);case ct.BACNET:return this.getBacnetConnectorHelpLink(t,n);case ct.REST:return this.getRestConnectorHelpLink(n)}}getOpcConnectorHelpLink(e,t){if(t!==Mi.CONST)return`widget/lib/gateway/${e}-${t}_fn`}getMqttConnectorHelpLink(e,t,n){if(t!==ei.CONST)return n?e!==Ni.ATTRIBUTES&&e!==Ni.TIMESERIES||n!==Jn.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!==Mi.CONST)return`widget/lib/gateway/bacnet-device-${e}-${t}_fn`}getRestConnectorHelpLink(e){if(e!==fi.CONST)return"widget/lib/gateway/rest-json_fn"}static{this.ɵfac=function(e){return new(e||o$)}}static{this.ɵpipe=t.ɵɵdefinePipe({name:"getConnectorMappingHelpLink",type:o$,pure:!0,standalone:!0})}}function s$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),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 l$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",22),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 p$(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",23),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function c$(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",24),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,1,"gateway.set")))}function d$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function u$(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",25)(2,"mat-label",26),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 m$(e,n){1&e&&(t.ɵɵelementStart(0,"div",8)(1,"mat-slide-toggle",27)(2,"mat-label",26),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 h$ extends A{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=ct,this.gatewayConnectorDefaultTypesTranslatesMap=dt,this.gatewayLogLevel=Object.values(lt),this.submitted=!1,this.destroy$=new te,this.updateConnectorTypesByVersion(),this.connectorForm=this.fb.group({type:[ct.MQTT,[]],name:["",[$.required,this.uniqNameRequired(),$.pattern(an)]],logLevel:[lt.INFO,[]],useDefaults:[!0,[]],sendDataOnlyOnChange:[!1,[]],class:["",[]],key:["auto",[]]})}ngOnInit(){this.observeTypeChange()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),super.ngOnDestroy()}helpLinkId(){return O+"/docs/iot-gateway/configuration/"}cancel(){this.dialogRef.close(null)}add(){this.submitted=!0;const e=this.connectorForm.getRawValue();if(e.useDefaults){const t=Ht(e.type),n=this.data.gatewayVersion;n&&(e.configVersion=n),e.configurationJson=(this.isLatestVersionConfig.transform(n,e.type)?t[Ei.get(e.type)]:t[pt.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=ut.keys();for(let t of e)if(t===pt.Legacy||za.parseVersion(this.data.gatewayVersion)>=za.parseVersion(t)){this.connectorTypes=ut.get(t);break}}observeTypeChange(){this.connectorForm.get("type").valueChanges.pipe(me((e=>{const t=this.connectorForm.get("useDefaults");e===ct.GRPC||e===ct.CUSTOM?t.setValue(!1):t.value||t.setValue(!0)})),le(this.destroy$)).subscribe()}static{this.ɵfac=function(e){return new(e||h$)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(a$))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:h$,selectors:[["tb-add-connector-dialog"]],standalone:!0,features:[t.ɵɵProvidersFeature([a$]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:43,vars:25,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",4,"ngFor","ngForOf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","autocomplete","off","name","value","formControlName","name",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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.ɵɵtemplate(17,s$,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(18,"div",8)(19,"div",13),t.ɵɵtext(20,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",10),t.ɵɵelement(22,"input",14),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,l$,3,3,"mat-icon",15),t.ɵɵelementEnd()(),t.ɵɵtemplate(25,p$,6,3,"div",16)(26,c$,6,3,"div",16),t.ɵɵelementStart(27,"div",8)(28,"div",9),t.ɵɵtext(29,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",10)(31,"mat-select",17),t.ɵɵtemplate(32,d$,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵtemplate(33,u$,6,6,"div",16)(34,m$,6,6,"div",16),t.ɵɵpipe(35,"withReportStrategy"),t.ɵɵelementEnd()(),t.ɵɵelementStart(36,"div",18)(37,"button",19),t.ɵɵlistener("click",(function(){return n.cancel()})),t.ɵɵtext(38),t.ɵɵpipe(39,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"button",20),t.ɵɵlistener("click",(function(){return n.add()})),t.ɵɵtext(41),t.ɵɵpipe(42,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.connectorForm),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,14,"gateway.add-connector")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.helpLinkId()),t.ɵɵadvance(11),t.ɵɵproperty("ngForOf",n.connectorTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(23,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("name").hasError("required")&&n.connectorForm.get("name").touched||n.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.GRPC),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value!==n.connectorType.GRPC&&n.connectorForm.get("type").value!==n.connectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.connectorForm.get("type").value===n.connectorType.MQTT&&!t.ɵɵpipeBind2(35,18,n.data.gatewayVersion,n.connectorType.MQTT)),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(39,21,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.connectorForm.invalid||!n.connectorForm.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(42,23,"action.add")," "))},dependencies:t.ɵɵgetComponentDepsFactory(h$,[j,_,Ka]),styles:['@charset "UTF-8";[_nghost-%COMP%] .add-connector[_ngcontent-%COMP%]{min-width:400px;width:500px}']})}}e("AddConnectorDialogComponent",h$);const g$=()=>({maxWidth:"970px"});function f$(e,n){1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtext(1,"gateway.device-info.source"),t.ɵɵelementEnd())}function y$(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(2);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function v$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",18)(2,"mat-select",19),t.ɵɵtemplate(3,y$,3,4,"mat-option",20),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function x$(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.device-info.device-name-expression-required"))}function b$(e,n){if(1&e&&(t.ɵɵelement(0,"div",23),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,g$))}}function w$(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(3);t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,2,i.SourceTypeTranslationsMap.get(e))," ")}}function S$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-form-field",18)(2,"mat-select",26),t.ɵɵtemplate(3,w$,3,4,"mat-option",20),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",e.sourceTypes)}}function C$(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.device-info.device-profile-expression-required"))}function _$(e,n){if(1&e&&(t.ɵɵelement(0,"div",23),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,g$))}}function T$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",24)(1,"div",9),t.ɵɵtext(2,"gateway.device-info.profile-name"),t.ɵɵelementEnd(),t.ɵɵtemplate(3,S$,4,1,"div",10),t.ɵɵelementStart(4,"div",11)(5,"mat-form-field",12),t.ɵɵelement(6,"input",25),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,C$,3,3,"mat-icon",14)(9,_$,2,8,"div",15),t.ɵɵpipe(10,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(3),t.ɵɵproperty("ngIf",e.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingFormGroup.get("deviceProfileExpression").hasError("required")&&e.mappingFormGroup.get("deviceProfileExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(10,6,e.connectorType,"profile-name",e.mappingFormGroup.get("deviceProfileExpressionSource").value,e.convertorType))}}class I$ extends q{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=Bi,this.DeviceInfoType=ga,this.useSource=!0,this.required=!1,this.connectorType=ct.MQTT,this.sourceTypes=Object.values(ei),this.destroy$=new te,this.propagateChange=e=>{}}ngOnInit(){this.mappingFormGroup=this.fb.group({deviceNameExpression:["",this.required?[$.required,$.pattern(an)]:[$.pattern(an)]]}),this.useSource&&this.mappingFormGroup.addControl("deviceNameExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.deviceInfoType===ga.FULL&&(this.useSource&&this.mappingFormGroup.addControl("deviceProfileExpressionSource",this.fb.control(this.sourceTypes[0],[])),this.mappingFormGroup.addControl("deviceProfileExpression",this.fb.control("",this.required?[$.required,$.pattern(an)]:[$.pattern(an)]))),this.mappingFormGroup.valueChanges.pipe(le(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||I$)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:I$,selectors:[["tb-device-info-table"]],inputs:{useSource:"useSource",required:"required",connectorType:"connectorType",convertorType:"convertorType",sourceTypes:"sourceTypes",deviceInfoType:"deviceInfoType"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>I$)),multi:!0},{provide:K,useExisting:c((()=>I$)),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"],["class","tb-form-table-header-cell w-1/5","translate","",4,"ngIf"],["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"],["class","no-gap w-1/5",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["class","tb-form-table-row tb-form-row no-border same-padding pb-4",4,"ngIf"],[1,"no-gap","w-1/5"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","!w-full"],["formControlName","deviceNameExpressionSource"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["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"],["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,f$,2,0,"div",5),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9," gateway.device-info.expression "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",7)(11,"div",8)(12,"div",9),t.ɵɵtext(13,"gateway.device-info.name"),t.ɵɵelementEnd(),t.ɵɵtemplate(14,v$,4,1,"div",10),t.ɵɵelementStart(15,"div",11)(16,"mat-form-field",12),t.ɵɵelement(17,"input",13),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,x$,3,3,"mat-icon",14)(20,b$,2,8,"div",15),t.ɵɵpipe(21,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(22,T$,11,11,"div",16),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵproperty("formGroup",n.mappingFormGroup),t.ɵɵadvance(),t.ɵɵclassProp("tb-required",n.required),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(4),t.ɵɵclassProp("pb-4",n.deviceInfoType!==n.DeviceInfoType.FULL),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.useSource),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(18,11,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.mappingFormGroup.get("deviceNameExpression").hasError("required")&&n.mappingFormGroup.get("deviceNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(21,13,n.connectorType,"name-field",n.mappingFormGroup.get("deviceNameExpressionSource").value,n.convertorType)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceInfoType===n.DeviceInfoType.FULL))},dependencies:t.ɵɵgetComponentDepsFactory(I$,[j,_,o$]),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})}}Ge([I()],I$.prototype,"useSource",void 0),Ge([I()],I$.prototype,"required",void 0);const E$=()=>({maxWidth:"970px"});function M$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",19),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 k$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",21),t.ɵɵelement(1,"mat-icon",22),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 P$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,k$,5,5,"mat-option",20),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function D$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",23)(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 O$(e,n){1&e&&(t.ɵɵelement(0,"input",24),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function A$(e,n){1&e&&(t.ɵɵelement(0,"input",25),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function F$(e,n){1&e&&(t.ɵɵelement(0,"input",26),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function R$(e,n){1&e&&(t.ɵɵelement(0,"input",27),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(1,1,"gateway.set"))}function B$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-select",28)(1,"mat-option",21),t.ɵɵtext(2,"true"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-option",21),t.ɵɵtext(4,"false"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(),t.ɵɵproperty("value",!0),t.ɵɵadvance(2),t.ɵɵproperty("value",!1))}function N$(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",29),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function L$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",30),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,E$))}}class V${constructor(e){this.fb=e,this.valueTypeKeys=Object.values(Yt),this.valueTypes=Xt,this.MappingValueType=Yt,this.destroy$=new te,this.onChange=e=>{},this.valueTypeFormGroup=this.fb.group({type:[Yt.STRING],stringValue:[{value:"",disabled:this.rawData},[$.required,$.pattern(an)]],integerValue:[{value:0,disabled:!0},[$.required,$.pattern(rn)]],doubleValue:[{value:0,disabled:!0},[$.required]],booleanValue:[{value:!1,disabled:!0},[$.required]],rawValue:[{value:"",disabled:!this.rawData},[$.required,$.pattern(an)]]}),this.valueTypeFormGroup.valueChanges.pipe(le(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(le(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 Yt.BOOLEAN;case"number":return Number.isInteger(e)?Yt.INTEGER:Yt.DOUBLE;default:return Yt.STRING}}static{this.ɵfac=function(e){return new(e||V$)(t.ɵɵdirectiveInject(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:V$,selectors:[["tb-type-value-field"]],inputs:{rawData:"rawData",helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>V$)),multi:!0},{provide:K,useExisting:c((()=>V$)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:17,consts:[["raw",""],[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"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[4,"ngIf","ngIfElse"],["appearance","outline","subscriptSizing","dynamic",1,"tb-inline-field","flex","tb-suffix-absolute"],[3,"ngSwitch"],["matInput","","required","","formControlName","stringValue",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","integerValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","doubleValue","type","number",3,"placeholder",4,"ngSwitchCase"],["matInput","","required","","formControlName","rawValue",3,"placeholder",4,"ngSwitchCase"],["formControlName","booleanValue",4,"ngSwitchCase"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style","click",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[1,"tb-mat-20",3,"svgIcon"],["value","raw"],["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,"click","tb-help-popup","tb-help-popup-style"]],template:function(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,1),t.ɵɵelementStart(1,"div",2)(2,"div",3),t.ɵɵtext(3,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",4)(5,"mat-form-field",5)(6,"mat-select",6)(7,"mat-select-trigger")(8,"div",7),t.ɵɵtemplate(9,M$,1,1,"mat-icon",8),t.ɵɵelementStart(10,"span"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(14,P$,2,1,"ng-container",9)(15,D$,4,3,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(17,"div",2)(18,"div",3),t.ɵɵtext(19,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(20,"mat-form-field",10),t.ɵɵelementContainerStart(21,11),t.ɵɵtemplate(22,O$,2,3,"input",12)(23,A$,2,3,"input",13)(24,F$,2,3,"input",14)(25,R$,2,3,"input",15)(26,B$,5,2,"mat-select",16),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,N$,3,3,"mat-icon",17)(28,L$,1,3,"div",18),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd()),2&e){let e,i;const a=t.ɵɵreference(16);t.ɵɵproperty("formGroup",n.valueTypeFormGroup),t.ɵɵadvance(9),t.ɵɵproperty("ngIf",!n.rawData),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(12,13,null==(e=n.valueTypes.get(n.valueTypeFormGroup.get("type").value))?null:e.name)||t.ɵɵpipeBind1(13,15,"gateway.raw")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",!n.rawData)("ngIfElse",a),t.ɵɵadvance(7),t.ɵɵproperty("ngSwitch",n.valueTypeFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.STRING),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.INTEGER),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.DOUBLE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase","raw"),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.MappingValueType.BOOLEAN),t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(i=n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value))?null:i.hasError("required"))&&n.valueTypeFormGroup.get(n.valueTypeFormGroup.get("type").value).touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.helpLink)}},dependencies:t.ɵɵgetComponentDepsFactory(V$,[_,j]),styles:['@charset "UTF-8";[_nghost-%COMP%]{gap:16px;display:grid;width:100%}']})}}function q$(e,n){if(1&e&&t.ɵɵelement(0,"tb-type-value-field",14),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("helpLink",e.helpLink)}}function G$(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",6)(1,"div",7),t.ɵɵelementContainerStart(2,8),t.ɵɵelementStart(3,"mat-expansion-panel",9)(4,"mat-expansion-panel-header",10)(5,"mat-panel-title")(6,"div",11),t.ɵɵtext(7),t.ɵɵelementEnd()()(),t.ɵɵtemplate(8,q$,1,1,"ng-template",12),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"button",13),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.last;t.ɵɵadvance(2),t.ɵɵproperty("formGroup",i),t.ɵɵadvance(),t.ɵɵproperty("expanded",a),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 z$(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4),t.ɵɵtemplate(1,G$,13,6,"div",5),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function U$(e,n){1&e&&(t.ɵɵelementStart(0,"div",15)(1,"span",16),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate("gateway.no-value"))}Ge([I()],V$.prototype,"rawData",void 0);class j${constructor(e){this.fb=e,this.destroy$=new te,this.onChange=e=>{}}ngOnInit(){this.valueListFormArray=this.fb.array([]),this.valueListFormArray.valueChanges.pipe(le(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||j$)(t.ɵɵdirectiveInject(H.UntypedFormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:j$,selectors:[["tb-type-value-panel"]],inputs:{helpLink:"helpLink"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>j$)),multi:!0},{provide:K,useExisting:c((()=>j$)),multi:!0}]),t.ɵɵStandaloneFeature],decls:8,vars:5,consts:[["noKeys",""],[1,"tb-form-panel","no-border","no-padding"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["type","button","mat-stroked-button","","color","primary",3,"click"],[1,"tb-form-panel","no-border","no-padding","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",1),t.ɵɵtemplate(1,z$,2,2,"div",2),t.ɵɵelementStart(2,"div")(3,"button",3),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(6,U$,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor)}if(2&e){const e=t.ɵɵreference(7);t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.valueListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,3,"gateway.add-value")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(j$,[j,_,V$]),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 H$=()=>({maxWidth:"970px"});function W$(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",19),t.ɵɵtext(2),t.ɵɵelementEnd(),t.ɵɵtext(3),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",e.get("key").value," "),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",":","  ")}}function $$(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.key-required"))}function K$(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,H$))}}function Y$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",44),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 X$(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 Z$(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 Q$(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-select-trigger")(1,"div",42),t.ɵɵtemplate(2,Y$,1,1,"mat-icon",43)(3,X$,3,3,"span",36)(4,Z$,3,3,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()),2&e){let e;const n=t.ɵɵreference(5),i=t.ɵɵnextContext(3).$implicit,a=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==(e=a.valueTypes.get(i.get("type").value))?null:e.icon),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!a.rawData)("ngIfElse",n)}}function J$(e,n){if(1&e&&t.ɵɵelement(0,"mat-icon",48),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(6);t.ɵɵpropertyInterpolate("svgIcon",n.valueTypes.get(e).icon)}}function eK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵtemplate(1,J$,1,1,"mat-icon",47),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.ɵɵproperty("ngIf",null==(e=r.valueTypes.get(a))?null:e.icon),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 tK(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,eK,5,5,"mat-option",45),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.valueTypeKeys)}}function nK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-option",46)(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 iK(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-required"))}function aK(e,n){if(1&e&&(t.ɵɵelement(0,"div",41),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,H$))}}function rK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-form-field",28),t.ɵɵelement(10,"input",29),t.ɵɵpipe(11,"translate"),t.ɵɵtemplate(12,$$,3,3,"mat-icon",30)(13,K$,2,8,"div",31),t.ɵɵpipe(14,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",32)(19,"div",33),t.ɵɵtext(20,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",34)(22,"mat-select",35),t.ɵɵtemplate(23,Q$,6,3,"mat-select-trigger",18)(24,tK,2,1,"ng-container",36)(25,nK,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"div",37)(28,"div",27),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30),t.ɵɵpipe(31,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",38),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,iK,3,3,"mat-icon",30)(36,aK,2,8,"div",31),t.ɵɵpipe(37,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵreference(26),n=t.ɵɵnextContext(2).$implicit,i=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(6,13,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,15,"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(11,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("key").hasError("required")&&n.get("key").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(14,19,i.connectorType,i.keysType,n.get("type").value,i.convertorType)),t.ɵɵadvance(10),t.ɵɵproperty("ngIf",!i.rawData),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!i.rawData)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(29,24,"gateway.JSONPath-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(31,26,"gateway.value")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,28,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.get("value").hasError("required")&&n.get("value").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind4(37,30,i.connectorType,i.keysType,n.get("type").value,i.convertorType))}}function oK(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.key-required"))}function sK(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-required"))}function lK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",33),t.ɵɵtext(3,"gateway.key"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",28),t.ɵɵelement(5,"input",29),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,oK,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",26)(9,"div",33),t.ɵɵtext(10,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",49),t.ɵɵelement(12,"input",39),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,sK,3,3,"mat-icon",30),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,6,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function pK(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-required"))}function cK(e,n){1&e&&t.ɵɵelement(0,"tb-type-value-panel",54)}function dK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",4)(1,"div",26)(2,"div",27),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",28),t.ɵɵelement(7,"input",50),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,pK,3,3,"mat-icon",30),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",14)(11,"mat-expansion-panel",51)(12,"mat-expansion-panel-header",52)(13,"mat-panel-title")(14,"div",53),t.ɵɵpipe(15,"translate"),t.ɵɵtext(16),t.ɵɵpipe(17,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(18,cK,1,0,"ng-template",20),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.ɵɵproperty("ngIf",n.get("method").hasError("required")&&n.get("method").touched),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 uK(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",55),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function mK(e,n){if(1&e&&t.ɵɵtemplate(0,rK,38,35,"div",22)(1,lK,15,8,"div",22)(2,dK,19,17,"div",22)(3,uK,1,2,"tb-report-strategy",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType!==e.MappingKeysType.CUSTOM&&e.keysType!==e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.MappingKeysType.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.withReportStrategy&&(e.keysType===e.MappingKeysType.ATTRIBUTES||e.keysType===e.MappingKeysType.TIMESERIES))}}function hK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",13)(1,"div",14),t.ɵɵelementContainerStart(2,15),t.ɵɵelementStart(3,"mat-expansion-panel",16)(4,"mat-expansion-panel-header",17)(5,"mat-panel-title"),t.ɵɵtemplate(6,W$,4,2,"ng-container",18),t.ɵɵelementStart(7,"div",19),t.ɵɵtext(8),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,mK,4,4,"ng-template",20),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",21),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.last,a=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",a.keysType!==a.MappingKeysType.RPC_METHODS),t.ɵɵadvance(2),t.ɵɵtextInterpolate(a.valueTitle(e)),t.ɵɵadvance(2),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,a.deleteKeyTitle))}}function gK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",11),t.ɵɵtemplate(1,hK,14,7,"div",12),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function fK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",56)(1,"span",57),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class yK extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.valueTypeEnum=Yt,this.valueTypes=Xt,this.valueTypeKeys=Object.values(Yt),this.rawData=!1,this.withReportStrategy=!0,this.keysDataApplied=new u,this.MappingKeysType=Ni,this.ReportStrategyDefaultValue=en,this.ConnectorType=ct,this.errorText=""}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===Ni.RPC_METHODS?this.fb.group({method:["",[$.required]],arguments:[[],[]]}):this.keysType===Ni.CUSTOM?this.fb.group({key:["",[$.required,$.pattern(an)]],value:["",[$.required,$.pattern(an)]]}):this.fb.group({key:["",[$.required,$.pattern(an)]],type:[this.rawData?"raw":this.valueTypeKeys[0]],value:["",[$.required,$.pattern(an)]],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===Ni.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===Ni.CUSTOM&&(e=Object.keys(e).map((t=>({key:t,value:e[t],type:""})))),e.forEach((e=>{let n;if(this.keysType===Ni.RPC_METHODS)n=this.fb.group({method:[e.method,[$.required]],arguments:[[...e.arguments],[]]});else if(this.keysType===Ni.CUSTOM){const{key:t,value:i}=e;n=this.fb.group({key:[t,[$.required,$.pattern(an)]],value:[i,[$.required,$.pattern(an)]]})}else{const{key:t,value:i,type:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[$.required,$.pattern(an)]],type:[a],value:[i,[$.required,$.pattern(an)]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)}))),this.fb.array(t)}valueTitle(e){const t=this.keysType===Ni.RPC_METHODS?e.get("method").value:e.get("value").value;return ke(t)?"object"==typeof t?JSON.stringify(t):t:""}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===Ni.ATTRIBUTES||this.keysType===Ni.TIMESERIES))}static{this.ɵfac=function(e){return new(e||yK)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(it.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:yK,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:19,vars:16,consts:[["noKeys",""],["rawOption",""],["rawText",""],[1,"tb-mapping-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],[4,"ngIf"],["tbTruncateWithTooltip","",1,"title-container"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],[1,"tb-form-row"],["translate","",1,"fixed-title-width","tb-required"],["appearance","outline","subscriptSizing","dynamic",1,"tb-flex","no-gap","fill-width"],["formControlName","type"],[4,"ngIf","ngIfElse"],[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"],["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-flex","align-center"],["class","tb-mat-18",3,"svgIcon",4,"ngIf"],[1,"tb-mat-18",3,"svgIcon"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["class","tb-mat-20",3,"svgIcon",4,"ngIf"],[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"],["formControlName","reportStrategy",3,"isExpansionMode","defaultValue"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],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.ɵɵtemplate(5,gK,2,2,"div",6),t.ɵɵelementStart(6,"div")(7,"button",7),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,fK,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",8)(13,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",10),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(yK,[j,_,Xn,j$,o$]),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}']})}}Ge([I()],yK.prototype,"rawData",void 0),Ge([I()],yK.prototype,"withReportStrategy",void 0);const vK=()=>({maxWidth:"970px"}),xK=(e,t)=>[e,t];function bK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function wK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 SK(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",40),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 CK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",41),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("convertorType",e.ConvertorTypeEnum.JSON)("deviceInfoType",e.DeviceInfoType.FULL)}}function _K(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",42),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)("convertorType",e.ConvertorTypeEnum.BYTES)("sourceTypes",t.ɵɵpureFunction2(3,xK,e.sourceTypesEnum.MSG,e.sourceTypesEnum.CONST))}}function TK(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function IK(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 EK(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 MK(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",43)(5,"mat-chip-listbox",44),t.ɵɵtemplate(6,IK,2,1,"mat-chip",45),t.ɵɵelementStart(7,"mat-chip",46),t.ɵɵelement(8,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"button",48,0),t.ɵɵpipe(11,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(10),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.ATTRIBUTES))})),t.ɵɵelementStart(12,"tb-icon",49),t.ɵɵtext(13,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(14,"div",31)(15,"div",32),t.ɵɵtext(16,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"div",43)(18,"mat-chip-listbox",44),t.ɵɵtemplate(19,EK,2,1,"mat-chip",45),t.ɵɵelementStart(20,"mat-chip",46),t.ɵɵelement(21,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"button",48,1),t.ɵɵpipe(24,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵreference(23),a=t.ɵɵnextContext(2);return t.ɵɵresetView(a.manageKeys(n,i,a.MappingKeysType.TIMESERIES))})),t.ɵɵelementStart(25,"tb-icon",49),t.ɵɵtext(26,"edit"),t.ɵɵelementEnd()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",e.converterAttributes),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterAttributes),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(11,6,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",e.converterTelemetry),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.converterTelemetry),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(24,8,"action.edit"))}}function kK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.extension-required"))}function PK(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 DK(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",14)(1,"div",21)(2,"div",50),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(6,"mat-form-field",23),t.ɵɵelement(7,"input",51),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,kK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"div",52)(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",43)(20,"mat-chip-listbox",44),t.ɵɵtemplate(21,PK,2,1,"mat-chip",45),t.ɵɵelementStart(22,"mat-chip",46),t.ɵɵelement(23,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(24,"button",48,2),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.CUSTOM))})),t.ɵɵelementStart(27,"tb-icon",49),t.ɵɵtext(28,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,8,"gateway.extension-hint")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,10,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("converter.custom.extension").hasError("required")&&e.mappingForm.get("converter.custom.extension").touched),t.ɵɵadvance(5),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(15,14,"gateway.extension-configuration-hint")),t.ɵɵadvance(6),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.customKeys),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(26,16,"action.edit"))}}function OK(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,bK,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,wK,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,SK,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,CK,1,2,"ng-template",17)(30,_K,1,6,"ng-template",17)(31,TK,1,2,"tb-report-strategy",37)(32,MK,27,10,"div",38)(33,DK,29,18,"div",38),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(5,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.mappingForm.get("topicFilter").hasError("required")&&e.mappingForm.get("topicFilter").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/topic-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(24,vK)),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",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",e.qualityTypes),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.convertorTypes),t.ɵɵadvance(5),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,22,e.DataConversionTranslationsMap.get(e.converterType))," "),t.ɵɵadvance(2),t.ɵɵproperty("formGroupName",e.converterType)("ngSwitch",e.converterType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConvertorTypeEnum.BYTES),t.ɵɵadvance(),t.ɵɵconditional(e.data.withReportStrategy?31:-1),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.BYTES||e.converterType===e.ConvertorTypeEnum.JSON),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.converterType===e.ConvertorTypeEnum.CUSTOM)}}function AK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 FK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.topic-required"))}function RK(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",57),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,FK,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,vK))}}function BK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",58),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.FULL)}}function NK(e,n){if(1&e&&t.ɵɵelement(0,"tb-device-info-table",58),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("deviceInfoType",e.DeviceInfoType.PARTIAL)}}function LK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 VK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 qK(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 GK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 zK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 UK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 jK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",34)(1,"div",59),t.ɵɵtext(2,"gateway.from-device-request-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",60),t.ɵɵtext(4," gateway.from-device-request-settings-hint "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",61)(6,"div",62)(7,"div",63),t.ɵɵtext(8,"gateway.device-info.device-name-expression"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",64)(10,"div",65)(11,"mat-form-field",23)(12,"mat-select",66),t.ɵɵtemplate(13,LK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",67),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,VK,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",64)(23,"div",65)(24,"mat-form-field",23)(25,"mat-select",68),t.ɵɵtemplate(26,qK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(27,"mat-form-field",23),t.ɵɵelement(28,"input",69),t.ɵɵpipe(29,"translate"),t.ɵɵtemplate(30,GK,3,3,"mat-icon",25),t.ɵɵelement(31,"div",26),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(32,"div",34)(33,"div",59),t.ɵɵtext(34,"gateway.to-device-response-settings"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"div",60),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",70),t.ɵɵpipe(42,"translate"),t.ɵɵtemplate(43,zK,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",71),t.ɵɵpipe(50,"translate"),t.ɵɵtemplate(51,UK,3,3,"mat-icon",25),t.ɵɵelement(52,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(53,"div",72)(54,"mat-slide-toggle",73)(55,"mat-label",74),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,vK)),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,vK)),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,vK)),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,vK)),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 HK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 WK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.attribute-filter-required"))}function $K(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 KK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 YK(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",50),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",23),t.ɵɵelement(6,"input",75),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,HK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"div",21)(10,"div",50),t.ɵɵpipe(11,"translate"),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"mat-form-field",23),t.ɵɵelement(15,"input",76),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,WK,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",70),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,$K,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",71),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,KK,3,3,"mat-icon",25),t.ɵɵelement(33,"div",26),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",72)(35,"mat-slide-toggle",73)(36,"mat-label",74),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,vK)),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,vK)),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 XK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 ZK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-filter-required"))}function QK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 JK(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-expression-required"))}function eY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),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 tY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 nY(e,n){if(1&e&&t.ɵɵelement(0,"tb-error-icon",84),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("tooltipText",e.responseTimeoutErrorTooltip)}}function iY(e,n){1&e&&(t.ɵɵelementStart(0,"span",85),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function aY(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",81),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,eY,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",82),t.ɵɵtemplate(16,tY,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",83),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,nY,1,1,"tb-error-icon",84)(24,iY,2,0,"span",85),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,vK)),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 rY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",77)(1,"tb-toggle-select",33)(2,"tb-toggle-option",40),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-option",40),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",21)(9,"div",50),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",23),t.ɵɵelement(14,"input",75),t.ɵɵpipe(15,"translate"),t.ɵɵtemplate(16,XK,3,3,"mat-icon",25),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"div",21)(18,"div",50),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",23),t.ɵɵelement(23,"input",78),t.ɵɵpipe(24,"translate"),t.ɵɵtemplate(25,ZK,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",79),t.ɵɵpipe(31,"translate"),t.ɵɵtemplate(32,QK,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",70),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,JK,3,3,"mat-icon",25),t.ɵɵelement(41,"div",26),t.ɵɵelementEnd()(),t.ɵɵtemplate(42,aY,25,18,"ng-container",80)),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,vK)),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,vK)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.mappingForm.get("requestValue.serverSideRpc.type").value===e.ServerSideRPCType.TWO_WAY)}}function oY(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",53),t.ɵɵtemplate(5,AK,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementContainerStart(6,54)(7,55),t.ɵɵtemplate(8,RK,8,8,"div",56)(9,BK,1,1,"ng-template",17)(10,NK,1,1,"ng-template",17)(11,jK,59,36,"ng-template",17)(12,YK,40,40,"ng-template",17)(13,rY,43,43,"ng-template",17),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.requestTypes),t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e.mappingForm.get("requestValue").get(e.requestMappingType))("ngSwitch",e.requestMappingType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.requestMappingType===e.RequestTypeEnum.ATTRIBUTE_REQUEST||e.requestMappingType===e.RequestTypeEnum.CONNECT_REQUEST||e.requestMappingType===e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.CONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.DISCONNECT_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_REQUEST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.ATTRIBUTE_UPDATE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.RequestTypeEnum.SERVER_SIDE_RPC)}}function sY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",40),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 lY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",39),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-node-required"))}function pY(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",37),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function cY(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 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.ɵɵtextInterpolate1(" ",e," ")}}function uY(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 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.ɵɵtextInterpolate1(" ",e," ")}}function hY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",86)(1,"div",87)(2,"div",88),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",89)(7,"mat-form-field",90)(8,"mat-select",91),t.ɵɵtemplate(9,sY,3,4,"mat-option",29),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"mat-form-field",90),t.ɵɵelement(11,"input",92),t.ɵɵpipe(12,"translate"),t.ɵɵtemplate(13,lY,3,3,"mat-icon",25),t.ɵɵelement(14,"div",26),t.ɵɵpipe(15,"getConnectorMappingHelpLink"),t.ɵɵelementEnd()(),t.ɵɵelement(16,"tb-device-info-table",93),t.ɵɵtemplate(17,pY,1,2,"tb-report-strategy",37),t.ɵɵelementStart(18,"div",31)(19,"div",32),t.ɵɵtext(20,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",43)(22,"mat-chip-listbox",44),t.ɵɵtemplate(23,cY,2,1,"mat-chip",45),t.ɵɵelementStart(24,"mat-chip",46),t.ɵɵelement(25,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",48,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",49),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",43)(35,"mat-chip-listbox",44),t.ɵɵtemplate(36,dY,2,1,"mat-chip",45),t.ɵɵelementStart(37,"mat-chip",46),t.ɵɵelement(38,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"button",48,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",49),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",43)(48,"mat-chip-listbox",44),t.ɵɵtemplate(49,uY,2,1,"mat-chip",45),t.ɵɵelementStart(50,"mat-chip",46),t.ɵɵelement(51,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(52,"button",48,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",49),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",43)(61,"mat-chip-listbox",44),t.ɵɵtemplate(62,mY,2,1,"mat-chip",45),t.ɵɵelementStart(63,"mat-chip",46),t.ɵɵelement(64,"label",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(65,"button",48,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",49),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,xK,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,vK)),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 gY extends A{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=Di,this.qualityTypes=zi,this.QualityTranslationsMap=ni,this.convertorTypes=Object.values(Jn),this.ConvertorTypeEnum=Jn,this.ConvertorTypeTranslationsMap=ii,this.sourceTypes=Object.values(ei),this.OPCUaSourceTypes=Object.values(Mi),this.OPCUaSourceTypesEnum=Mi,this.sourceTypesEnum=ei,this.SourceTypeTranslationsMap=Bi,this.requestTypes=Object.values(ai),this.RequestTypeEnum=ai,this.RequestTypesTranslationsMap=ri,this.DeviceInfoType=ga,this.ServerSideRPCType=Wi,this.MappingKeysType=Ni,this.MappingHintTranslationsMap=Hi,this.MappingTypeTranslationsMap=Oi,this.DataConversionTranslationsMap=oi,this.HelpLinkByMappingTypeMap=ji,this.ConnectorType=ct,this.ReportStrategyDefaultValue=en,this.keysPopupClosed=!0,this.destroy$=new te,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 Di.DATA:this.mappingForm=this.fb.group({}),this.createDataMappingForm();break;case Di.REQUESTS:this.mappingForm=this.fb.group({}),this.createRequestMappingForm();break;case Di.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!==Di.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===Jn.BYTES,panelTitle:Li.get(n),addKeyTitle:Vi.get(n),deleteKeyTitle:qi.get(n),noKeysText:Gi.get(n),withReportStrategy:this.data.withReportStrategy,connectorType:this.data.mappingType===Di.OPCUA?ct.OPCUA:ct.MQTT,convertorType:this.converterType};this.data.mappingType===Di.OPCUA&&(t.valueTypeKeys=Object.values(Mi),t.valueTypeEnum=Mi,t.valueTypes=Bi,t.sourceType=this.mappingForm.get("deviceNodeSource").value),this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,yK,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(le(this.destroy$)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty()})),this.popoverComponent.tbHideStart.pipe(le(this.destroy$)).subscribe((()=>{this.keysPopupClosed=!0}))}}prepareMappingData(){const e=this.mappingForm.value;switch(Te(e),this.data.mappingType){case Di.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 Di.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 Di.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 Di.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("",[$.required,$.pattern(an)])),this.mappingForm.addControl("subscriptionQos",this.fb.control(0)),this.mappingForm.addControl("converter",this.fb.group({type:[Jn.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:["",[$.required,$.pattern(an)]],extensionConfig:[{},[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})})),this.mappingForm.patchValue(this.getFormValueData()),this.mappingForm.get("converter.type").valueChanges.pipe(be(this.mappingForm.get("converter.type").value),le(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(ai.CONNECT_REQUEST,[])),this.mappingForm.addControl("requestValue",this.fb.group({connectRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(an)]],deviceInfo:[{},[]]}),disconnectRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(an)]],deviceInfo:[{},[]]}),attributeRequests:this.fb.group({topicFilter:["",[$.required,$.pattern(an)]],deviceInfo:this.fb.group({deviceNameExpressionSource:[ei.MSG,[]],deviceNameExpression:["",[$.required]]}),attributeNameExpressionSource:[ei.MSG,[]],attributeNameExpression:["",[$.required,$.pattern(an)]],topicExpression:["",[$.required,$.pattern(an)]],valueExpression:["",[$.required,$.pattern(an)]],retain:[!1,[]]}),attributeUpdates:this.fb.group({deviceNameFilter:["",[$.required,$.pattern(an)]],attributeFilter:["",[$.required,$.pattern(an)]],topicExpression:["",[$.required,$.pattern(an)]],valueExpression:["",[$.required,$.pattern(an)]],retain:[!0,[]]}),serverSideRpc:this.fb.group({type:[Wi.TWO_WAY,[]],deviceNameFilter:["",[$.required,$.pattern(an)]],methodFilter:["",[$.required,$.pattern(an)]],requestTopicExpression:["",[$.required,$.pattern(an)]],responseTopicExpression:["",[$.required,$.pattern(an)]],valueExpression:["",[$.required,$.pattern(an)]],responseTopicQoS:[0,[]],responseTimeout:[1e4,[$.required,$.min(1)]]}),reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]})),this.mappingForm.get("requestType").valueChanges.pipe(be(this.mappingForm.get("requestType").value),le(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(le(this.destroy$)).subscribe((e=>{const t=this.mappingForm.get("requestValue.serverSideRpc");e===Wi.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:[Mi.PATH,[]],deviceNodePattern:["",[$.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||gY)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(He.TranslateService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:gY,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","ngSwitch"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"],["class","tb-form-panel no-border no-padding",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["formControlName","deviceInfo","required","true",3,"convertorType","deviceInfoType"],["formControlName","deviceInfo","required","true",3,"deviceInfoType","convertorType","sourceTypes"],[1,"tb-flex","ellipsis-chips-container"],[1,"tb-flex",3,"tbEllipsisChipList"],[4,"ngFor","ngForOf"],[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","ngSwitch"],["class","tb-form-row column-xs",4,"ngIf"],["matInput","","name","value",3,"formControl","placeholder"],["formControlName","deviceInfo","required","true",3,"deviceInfoType"],["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"]],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,OK,34,25,"ng-template",17)(17,oY,14,9,"ng-template",17)(18,hY,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(gY,[j,_,o$,Gn,I$,Qn,Xn]),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",gY);const fY=["searchInput"],yY=()=>({minWidth:"96px",textAlign:"center"});function vY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",24)(2,"span",25),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 xY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-header-cell",29),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 bY(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().$implicit,a=t.ɵɵnextContext();t.ɵɵclassProp("request-column",a.mappingType===a.mappingTypeEnum.REQUESTS),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e[i.def]," ")}}function wY(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,26),t.ɵɵtemplate(1,xY,3,5,"mat-header-cell",27)(2,bY,2,3,"mat-cell",28),t.ɵɵelementContainerEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("matColumnDef",e.def)}}function SY(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",31)}function CY(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 _Y(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,CY,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",32),t.ɵɵelementContainer(4,33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",34)(6,"button",35),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",36),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",37,2),t.ɵɵelementContainer(11,33),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(2),n=t.ɵɵreference(10);t.ɵɵadvance(3),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,yY)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function TY(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",38)}function IY(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class EY{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=Oi,this.mappingTypeEnum=Di,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 te,this.mappingFormGroup=this.fb.array([]),this.dirtyValue=!this.activeValue,this.dataSource=new MY}ngOnInit(){this.setMappingColumns(),this.displayedColumns.push(...this.mappingColumns.map((e=>e.def)),"actions"),this.mappingFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t)?this.mappingFormGroup.at(t).value:{};this.dialog.open(gY,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{mappingType:this.mappingType,value:n,buttonTitle:Ae(t)?"action.add":"action.apply",withReportStrategy:this.withReportStrategy}}).afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(ke(t)?this.mappingFormGroup.at(t).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.mappingFormGroup.controls[t].value,i=n.deviceInfo?.deviceNameExpression??n.topicFilter??this.getRequestDetails(n);this.dialogService.confirm(this.translate.instant("gateway.delete-mapping-title",{name:i}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).subscribe((e=>{e&&(this.mappingFormGroup.removeAt(t),this.mappingFormGroup.markAsDirty())}))}pushDataAsFormArrays(e){e?.length&&e.forEach((e=>this.mappingFormGroup.push(this.fb.control(e))))}getMappingValue(e){switch(this.mappingType){case Di.DATA:const t=ii.get(e.converter?.type);return{topicFilter:e.topicFilter,QoS:e.subscriptionQos,converter:t?this.translate.instant(t):""};case Di.REQUESTS:return{requestType:e.requestType,type:this.translate.instant(ri.get(e.requestType)),details:this.getRequestDetails(e)};case Di.OPCUA:const n=e.deviceInfo?.deviceNameExpression,i=e.deviceInfo?.deviceProfileExpression,{deviceNodePattern:a}=e;return{deviceNodePattern:a,deviceNamePattern:n,deviceProfileExpression:i};default:return{}}}getRequestDetails(e){let t;return t=e.requestType===ai.ATTRIBUTE_UPDATE?e.requestValue.attributeFilter:e.requestType===ai.SERVER_SIDE_RPC?e.requestValue.methodFilter:e.requestValue.topicFilter,t}setMappingColumns(){switch(this.mappingType){case Di.DATA:this.mappingColumns.push({def:"topicFilter",title:"gateway.topic-filter"},{def:"QoS",title:"gateway.mqtt-qos"},{def:"converter",title:"gateway.payload-type"});break;case Di.REQUESTS:this.mappingColumns.push({def:"type",title:"gateway.type"},{def:"details",title:"gateway.details"});break;case Di.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||EY)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:EY,selectors:[["tb-mapping-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(fY,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:W,useExisting:c((()=>EY)),multi:!0},{provide:K,useExisting:c((()=>EY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:40,vars:33,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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[1,"flex-1"],["matInput","",3,"formControl","placeholder"],["mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"table-container"],["mat-table","",3,"dataSource"],[3,"matColumnDef",4,"ngFor","ngForOf"],["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"],[3,"matColumnDef"],["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,vY,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵtemplate(23,wY,3,1,"ng-container",14),t.ɵɵelementContainerStart(24,15),t.ɵɵtemplate(25,SY,1,0,"mat-header-cell",16)(26,_Y,12,6,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(27,TY,1,0,"mat-header-row",18)(28,IY,1,0,"mat-row",19),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"section",20),t.ɵɵpipe(30,"async"),t.ɵɵelementStart(31,"button",21),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageMapping(i))})),t.ɵɵelementStart(32,"mat-icon",22),t.ɵɵtext(33,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"span"),t.ɵɵtext(35),t.ɵɵpipe(36,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(37,"span",23),t.ɵɵpipe(38,"async"),t.ɵɵtext(39," widget.no-data-found "),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",n.textSearchMode),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,19,n.dataSource.isEmpty())),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,21,"action.search")),t.ɵɵadvance(7),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,23,"common.enter-search")),t.ɵɵproperty("formControl",n.textSearch),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,25,"action.close")),t.ɵɵadvance(5),t.ɵɵproperty("dataSource",n.dataSource),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.mappingColumns),t.ɵɵadvance(4),t.ɵɵproperty("matHeaderRowDef",n.displayedColumns)("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",n.displayedColumns),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.textSearchMode||!1===t.ɵɵpipeBind1(30,27,n.dataSource.isEmpty())),t.ɵɵadvance(6),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(36,29,"gateway.add-mapping")),t.ɵɵadvance(2),t.ɵɵclassProp("!hidden",!n.textSearchMode||!1===t.ɵɵpipeBind1(38,31,n.dataSource.isEmpty())))},dependencies:t.ɵɵgetComponentDepsFactory(EY,[j,_,qn]),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",EY),Ge([I()],EY.prototype,"required",void 0),Ge([I()],EY.prototype,"withReportStrategy",void 0);let MY=class extends G{constructor(){super()}};function kY(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",7),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 PY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",18),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function DY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",8)(1,"div",9),t.ɵɵtext(2,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",10)(4,"mat-form-field",11),t.ɵɵelement(5,"input",12),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,PY,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",8)(9,"div",14),t.ɵɵtext(10,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",15),t.ɵɵpipe(14,"translate"),t.ɵɵelementStart(15,"div",16),t.ɵɵelement(16,"tb-toggle-password",17),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,3,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,5,"gateway.set"))}}function OY(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 AY(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",18),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.username-required"))}function FY(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",8)(2,"div",14),t.ɵɵtext(3,"gateway.mode"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",10)(5,"mat-form-field",11)(6,"mat-select",25),t.ɵɵtemplate(7,OY,2,2,"mat-option",4),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(8,"div",8)(9,"div",14),t.ɵɵtext(10,"gateway.username"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",10)(12,"mat-form-field",11),t.ɵɵelement(13,"input",12),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,AY,3,3,"mat-icon",13),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8)(17,"div",14),t.ɵɵtext(18,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",10)(20,"mat-form-field",11),t.ɵɵelement(21,"input",15),t.ɵɵpipe(22,"translate"),t.ɵɵelementStart(23,"div",16),t.ɵɵelement(24,"tb-toggle-password",17),t.ɵɵelementEnd()()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",e.modeTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,4,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.securityFormGroup.get("username").hasError("required")&&e.securityFormGroup.get("username").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,6,"gateway.set"))}}function RY(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",19),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",8)(4,"div",20),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",10)(8,"mat-form-field",11),t.ɵɵelement(9,"input",21),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",8)(12,"div",20),t.ɵɵtext(13),t.ɵɵpipe(14,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(15,"div",10)(16,"mat-form-field",11),t.ɵɵelement(17,"input",22),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",8)(20,"div",20),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"div",10)(24,"mat-form-field",11),t.ɵɵelement(25,"input",23),t.ɵɵpipe(26,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(27,FY,25,8,"ng-container",24)),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.ɵɵproperty("ngIf",e.mode()===e.SecurityMode.extendedCertificates)}}e("MappingDatasource",MY);class BY{constructor(e,t){this.fb=e,this.cdr=t,this.title="gateway.security",this.mode=l($i.certificates),this.BrokerSecurityType=ki,this.SecurityMode=$i,this.securityTypes=Object.values(ki),this.modeTypes=Object.values(Pi),this.SecurityTypeTranslationsMap=Ri,this.destroy$=new te,o((()=>{this.mode()===$i.basic&&(this.securityTypes=this.securityTypes.filter((e=>e!==ki.CERTIFICATES)))}))}ngOnInit(){this.securityFormGroup=this.fb.group({type:[ki.ANONYMOUS,[]],username:["",[$.required,$.pattern(an)]],password:["",[$.pattern(an)]],pathToCACert:["",[$.pattern(an)]],pathToPrivateKey:["",[$.pattern(an)]],pathToClientCert:["",[$.pattern(an)]]}),this.mode()===$i.extendedCertificates&&this.securityFormGroup.addControl("mode",this.fb.control(Pi.NONE,[])),this.securityFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{Te(e),this.onChange(e),this.onTouched()})),this.securityFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>this.updateValidators(e)))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}writeValue(e){if(e)e.type||(e.type=ki.ANONYMOUS),this.updateValidators(e.type),this.securityFormGroup.reset(e,{emitEvent:!1});else{const e={type:ki.ANONYMOUS};this.securityFormGroup.reset(e,{emitEvent:!1})}this.cdr.markForCheck()}validate(){return this.securityFormGroup.get("type").value!==ki.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===ki.BASIC)this.securityFormGroup.get("username").enable({emitEvent:!1}),this.securityFormGroup.get("password").enable({emitEvent:!1});else if(e===ki.CERTIFICATES&&(this.securityFormGroup.get("pathToCACert").enable({emitEvent:!1}),this.securityFormGroup.get("pathToPrivateKey").enable({emitEvent:!1}),this.securityFormGroup.get("pathToClientCert").enable({emitEvent:!1}),this.mode()===$i.extendedCertificates)){const e=this.securityFormGroup.get("mode");e&&!e.value&&e.setValue(Pi.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||BY)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:BY,selectors:[["tb-security-config"]],inputs:{title:"title",mode:[1,"mode"]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>BY)),multi:!0},{provide:K,useExisting:c((()=>BY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,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",4,"ngFor","ngForOf"],[3,"ngSwitch"],[3,"ngSwitchCase"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[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"],[4,"ngIf"],["formControlName","mode"]],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.ɵɵelementStart(5,"tb-toggle-select",3),t.ɵɵtemplate(6,kY,3,4,"tb-toggle-option",4),t.ɵɵelementEnd()(),t.ɵɵelementContainerStart(7,5),t.ɵɵtemplate(8,DY,17,7,"ng-template",6)(9,RY,28,22,"ng-template",6),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,6,n.title)),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.securityTypes),t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.BASIC),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.BrokerSecurityType.CERTIFICATES))},dependencies:t.ɵɵgetComponentDepsFactory(BY,[j,_,qn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("SecurityConfigComponent",BY);const NY=()=>({min:1e3}),LY=()=>({min:50}),VY=()=>({min:100});function qY(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.server-url-required"))}function GY(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,NY)))}function zY(e,n){1&e&&(t.ɵɵelementStart(0,"span",10),t.ɵɵtext(1,"gateway.suffix.ms"),t.ɵɵelementEnd())}function UY(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",22),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function jY(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.ɵɵpipeBind2(1,1,"gateway.scan-period-error",t.ɵɵpureFunction0(4,NY)))}function HY(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.ɵɵpipeBind2(1,1,"gateway.poll-period-error",t.ɵɵpureFunction0(4,LY)))}function WY(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",23),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,HY,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.ɵɵproperty("ngIf",(e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("required")||e.serverConfigFormGroup.get("pollPeriodInMillis").hasError("min"))&&e.serverConfigFormGroup.get("pollPeriodInMillis").touched)}}function $Y(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.ɵɵpipeBind2(1,1,"gateway.sub-check-period-error",t.ɵɵpureFunction0(4,VY)))}class KY{constructor(e){this.fb=e,this.hideNewFields=!1,this.securityPolicyTypes=Fi,this.SecurityMode=$i,this.destroy$=new te,this.serverConfigFormGroup=this.fb.group({url:["",[$.required,$.pattern(an)]],timeoutInMillis:[1e3,[$.required,$.min(1e3)]],scanPeriodInMillis:[z,[$.required,$.min(1e3)]],pollPeriodInMillis:[5e3,[$.required,$.min(50)]],enableSubscriptions:[!0,[]],subCheckPeriodInMillis:[100,[$.required,$.min(100)]],showMap:[!1,[]],security:[Ai.BASIC128,[]],identity:[]}),this.serverConfigFormGroup.valueChanges.pipe(le(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=z,pollPeriodInMillis:i=5e3,enableSubscriptions:a=!0,subCheckPeriodInMillis:r=100,showMap:o=!1,security:s=Ai.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||KY)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:KY,selectors:[["tb-opc-server-config"]],inputs:{hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>KY)),multi:!0},{provide:K,useExisting:c((()=>KY)),multi:!0}]),t.ɵɵStandaloneFeature],decls:63,vars:56,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","class","tb-error",3,"matTooltip",4,"ngIf"],[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",4,"ngFor","ngForOf"],["matInput","","type","number","min","1000","name","value","formControlName","scanPeriodInMillis",3,"placeholder"],["class","tb-form-row column-xs",4,"ngIf"],["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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,qY,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,GY,2,5,"tb-error-icon",9)(18,zY,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.ɵɵtemplate(27,UY,2,2,"mat-option",12),t.ɵɵelementEnd()()(),t.ɵɵelementStart(28,"div",1)(29,"div",6),t.ɵɵpipe(30,"translate"),t.ɵɵelementStart(31,"div",7),t.ɵɵtext(32),t.ɵɵpipe(33,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"mat-form-field",3),t.ɵɵelement(35,"input",13),t.ɵɵpipe(36,"translate"),t.ɵɵtemplate(37,jY,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵtemplate(38,WY,10,10,"div",14),t.ɵɵelementStart(39,"div",1)(40,"div",6),t.ɵɵpipe(41,"translate"),t.ɵɵelementStart(42,"div",7),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(45,"mat-form-field",3),t.ɵɵelement(46,"input",15),t.ɵɵpipe(47,"translate"),t.ɵɵtemplate(48,$Y,3,5,"mat-icon",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(49,"div",16)(50,"mat-slide-toggle",17)(51,"mat-label",18),t.ɵɵpipe(52,"translate"),t.ɵɵelementStart(53,"div",7),t.ɵɵtext(54),t.ɵɵpipe(55,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(56,"div",16)(57,"mat-slide-toggle",19)(58,"mat-label",18),t.ɵɵpipe(59,"translate"),t.ɵɵtext(60),t.ɵɵpipe(61,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelement(62,"tb-security-config",20),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.serverConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.serverConfigFormGroup.get("url").hasError("required")&&n.serverConfigFormGroup.get("url").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,26,"gateway.hints.opc-timeout")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(13,28,"gateway.timeout")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,30,"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,32,"gateway.hints.security-policy")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(24,34,"gateway.security-policy")),t.ɵɵadvance(4),t.ɵɵproperty("ngForOf",n.securityPolicyTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(30,36,"gateway.hints.scan-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(33,38,"gateway.scan-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,40,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("scanPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("scanPeriodInMillis").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(41,42,"gateway.hints.sub-check-period")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(44,44,"gateway.sub-check-period")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(47,46,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("required")||n.serverConfigFormGroup.get("subCheckPeriodInMillis").hasError("min"))&&n.serverConfigFormGroup.get("subCheckPeriodInMillis").touched),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(52,48,"gateway.hints.enable-subscription")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(55,50,"gateway.enable-subscription")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(59,52,"gateway.hints.show-map")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(61,54,"gateway.show-map")," "),t.ɵɵadvance(2),t.ɵɵproperty("mode",n.SecurityMode.extendedCertificates))},dependencies:t.ɵɵgetComponentDepsFactory(KY,[j,_,BY,qn,Qn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{width:100%;height:100%;display:block}'],changeDetection:d.OnPush})}}e("OpcServerConfigComponent",KY),Ge([I()],KY.prototype,"hideNewFields",void 0);class YY extends Ba{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Di,this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({mapping:[],server:[]})}mapConfigToFormValue(e){return{server:e.server?ja.mapServerToUpgradedVersion(e.server):{},mapping:e.server?.mapping?ja.mapMappingToUpgradedVersion(e.server.mapping):[]}}getMappedValue(e){return{server:ja.mapServerToDowngradedVersion(e)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(YY)))(n||YY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:YY,selectors:[["tb-opc-ua-legacy-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>YY)),multi:!0},{provide:K,useExisting:c((()=>YY)),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(YY,[j,_,BY,EY,KY]),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",YY),Ge([I()],YY.prototype,"withReportStrategy",void 0);class XY extends Ba{constructor(){super(...arguments),this.withReportStrategy=!0,this.mappingTypes=Di,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(XY)))(n||XY)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:XY,selectors:[["tb-opc-ua-basic-config"]],inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>XY)),multi:!0},{provide:K,useExisting:c((()=>XY)),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(XY,[j,_,BY,EY,KY]),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",XY),Ge([I()],XY.prototype,"withReportStrategy",void 0);class ZY extends Ba{constructor(){super(...arguments),this.withReportStrategy=!0,this.MappingType=Di}initBasicFormGroup(){return this.fb.group({mapping:[],requestsMapping:[],broker:[],workers:[]})}getRequestDataArray(e){const t=[];return Fe(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(ZY)))(n||ZY)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:ZY,inputs:{withReportStrategy:"withReportStrategy"},features:[t.ɵɵInheritDefinitionFeature]})}}function QY(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.max-number-of-workers-required"))}function JY(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.max-messages-queue-for-worker-required"))}e("MqttBasicConfigDirective",ZY),Ge([I()],ZY.prototype,"withReportStrategy",void 0);class eX{constructor(e){this.fb=e,this.destroy$=new te,this.workersConfigFormGroup=this.fb.group({maxNumberOfWorkers:[100,[$.required,$.min(1)]],maxMessageNumberPerWorker:[10,[$.required,$.min(1)]]}),this.workersConfigFormGroup.valueChanges.pipe(le(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||eX)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:eX,selectors:[["tb-workers-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>eX)),multi:!0},{provide:K,useExisting:c((()=>eX)),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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","name","value","type","number","min","1","formControlName","maxMessageNumberPerWorker",3,"placeholder"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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,QY,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,JY,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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("min")||n.workersConfigFormGroup.get("maxNumberOfWorkers").hasError("required")&&n.workersConfigFormGroup.get("maxNumberOfWorkers").touched),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.ɵɵproperty("ngIf",n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("min")||n.workersConfigFormGroup.get("maxMessageNumberPerWorker").hasError("required")&&n.workersConfigFormGroup.get("maxMessageNumberPerWorker").touched))},dependencies:t.ɵɵgetComponentDepsFactory(eX,[j,_,qn]),encapsulation:2,changeDetection:d.OnPush})}}function tX(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.host-required"))}function nX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",13),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 iX(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.value),t.ɵɵadvance(),t.ɵɵtextInterpolate(e.name)}}function aX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",15),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",eX);class rX{constructor(e,t){this.fb=e,this.cdr=t,this.mqttVersions=ti,this.portLimits=Ii,this.destroy$=new te,this.brokerConfigFormGroup=this.fb.group({host:["",[$.required,$.pattern(an)]],port:[null,[$.required,$.min(Ii.MIN),$.max(Ii.MAX)]],version:[5,[]],clientId:["tb_gw_"+Re(5),[$.pattern(an)]],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_"+Re(5))}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){const{version:t=5,clientId:n=`tb_gw_${Re(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||rX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:rX,selectors:[["tb-broker-config-control"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>rX)),multi:!0},{provide:K,useExisting:c((()=>rX)),multi:!0}]),t.ɵɵStandaloneFeature],decls:29,vars:16,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","class","tb-error",3,"matTooltip",4,"ngIf"],["matInput","","type","number","name","value","formControlName","port",3,"min","max","placeholder"],["translate","",1,"fixed-title-width"],["formControlName","version"],[3,"value",4,"ngFor","ngForOf"],["matInput","","name","value","formControlName","clientId",3,"placeholder"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"matTooltip","click",4,"ngIf"],["formControlName","security"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,tX,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,nX,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.ɵɵtemplate(20,iX,2,2,"mat-option",9),t.ɵɵelementEnd()()(),t.ɵɵelementStart(21,"div",1)(22,"div",7),t.ɵɵtext(23,"gateway.client-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"mat-form-field",3),t.ɵɵelement(25,"input",10),t.ɵɵpipe(26,"translate"),t.ɵɵtemplate(27,aX,4,3,"button",11),t.ɵɵelementEnd()(),t.ɵɵelement(28,"tb-security-config",12),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.brokerConfigFormGroup),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,10,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.brokerConfigFormGroup.get("host").hasError("required")&&n.brokerConfigFormGroup.get("host").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(13,12,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.brokerConfigFormGroup.get("port").hasError("required")||n.brokerConfigFormGroup.get("port").hasError("min")||n.brokerConfigFormGroup.get("port").hasError("max"))&&n.brokerConfigFormGroup.get("port").touched),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.mqttVersions),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(26,14,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!n.brokerConfigFormGroup.get("clientId").value))},dependencies:t.ɵɵgetComponentDepsFactory(rX,[j,_,BY,r$]),encapsulation:2,changeDetection:d.OnPush})}}e("BrokerConfigControlComponent",rX);class oX extends ZY{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(oX)))(n||oX)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:oX,selectors:[["tb-mqtt-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>oX)),multi:!0},{provide:K,useExisting:c((()=>oX)),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(oX,[j,_,eX,rX,EY]),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",oX);class sX extends ZY{mapConfigToFormValue(e){const{broker:t,mapping:n=[],connectRequests:i=[],disconnectRequests:a=[],attributeRequests:r=[],attributeUpdates:o=[],serverSideRpc:s=[]}=e,l=Pa.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:Pa.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:Pa.mapMappingToDowngradedVersion(i),...Pa.mapRequestsToDowngradedVersion(r)}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(sX)))(n||sX)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:sX,selectors:[["tb-mqtt-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>sX)),multi:!0},{provide:K,useExisting:c((()=>sX)),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(sX,[j,_,eX,rX,EY]),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",sX);class lX extends A{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=Ii,this.modbusProtocolTypes=Object.values(Ki),this.modbusMethodTypes=Object.values(Yi),this.modbusSerialMethodTypes=Object.values(Xi),this.modbusParities=Object.values(Zi),this.modbusByteSizes=na,this.modbusBaudrates=ta,this.modbusOrderType=Object.values(Qi),this.ModbusProtocolType=Ki,this.ModbusParityLabelsMap=la,this.ModbusProtocolLabelsMap=sa,this.ModbusMethodLabelsMap=oa,this.ReportStrategyDefaultValue=en,this.modbusHelpLink=O+"/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 te,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&&!Se(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:[Ki.TCP],host:["",[$.required,$.pattern(an)]],port:[null,[$.required,$.min(Ii.MIN),$.max(Ii.MAX)]],serialPort:["",[$.required,$.pattern(an)]],method:[Yi.SOCKET,[$.required]],baudrate:[this.modbusBaudrates[0]],stopbits:[1],bytesize:[na[0]],parity:[Zi.None],strict:[!0],unitId:[null,[$.required]],deviceName:["",[$.required,$.pattern(an)]],deviceType:["",[$.required,$.pattern(an)]],timeout:[35],byteOrder:[Qi.BIG],wordOrder:[Qi.BIG],retries:[!0],retryOnEmpty:[!0],retryOnInvalid:[!0],pollPeriod:[1e3,[$.required]],connectAttemptTimeMs:[500,[$.required]],connectAttemptCount:[5,[$.required]],waitAfterFailedAttemptsMs:[3e4,[$.required]],values:[{}],security:[{}]}),this.addFieldsToFormGroup()}updateSlaveFormGroup(){this.slaveConfigFormGroup.patchValue({...this.data.value,port:this.data.value.type===Ki.Serial?null:this.data.value.port,serialPort:this.data.value.type===Ki.Serial?this.data.value.port:"",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(le(this.destroy$)).subscribe((e=>{this.updateControlsEnabling(e),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Yi.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Ki.Serial?Xi.ASCII:Yi.SOCKET,{emitEvent:!1})}updateControlsEnabling(e){const[t,n]=e===Ki.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(le(this.destroy$)).subscribe((e=>this.updateSecurityEnabling(e)))}updateSecurityEnabling(e){e&&this.protocolType!==Ki.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}static{this.ɵfac=function(e){return new(e||lX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵdir=t.ɵɵdefineDirective({type:lX,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusSlaveDialogAbstract",lX);const pX=()=>({maxWidth:"970px"});function cX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),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 dX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21)(1,"div",22),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"span",23),t.ɵɵtext(5),t.ɵɵelementEnd()(),t.ɵɵelementStart(6,"div",24),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"span",25),t.ɵɵtext(10),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"div",24),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementStart(14,"span",25),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 uX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",45),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 mX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function hX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),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 gX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",35),t.ɵɵtext(2,"gateway.function-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32)(4,"mat-select",47),t.ɵɵtemplate(5,hX,3,4,"mat-option",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.functionCodesMap.get(e.get("id").value)||n.defaultFunctionCodes)}}function fX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.objects-count-required"))}function yX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),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 vX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",49),t.ɵɵelement(5,"input",50),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,yX,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("bit").hasError("max")&&e.get("bit").touched)}}function xX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),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 bX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",48),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.bit-target-type"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",51)(5,"mat-form-field",52)(6,"mat-select",53),t.ɵɵtemplate(7,xX,3,4,"mat-option",37),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext(5);t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.bit-target-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",e.bitTargetTypes)}}function wX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,vX,8,7,"div",38)(2,bX,8,4,"div",38),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("objectsCount").value>1),t.ɵɵadvance(),t.ɵɵproperty("ngIf",!n.hideNewFields)}}function SX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.address-required"))}function CX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",46),t.ɵɵelement(1,"mat-icon",62),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 _X(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.modifier-invalid"))}function TX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",54)(1,"mat-expansion-panel",15)(2,"mat-expansion-panel-header",16)(3,"mat-panel-title")(4,"mat-slide-toggle",55),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(5,"mat-label",56),t.ɵɵpipe(6,"translate"),t.ɵɵtext(7),t.ɵɵpipe(8,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",51)(10,"div",57)(11,"div",35),t.ɵɵtext(12,"gateway.type"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"mat-form-field",52)(14,"mat-select",58)(15,"mat-select-trigger")(16,"div",59),t.ɵɵelement(17,"mat-icon",60),t.ɵɵelementStart(18,"span"),t.ɵɵtext(19),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(21,CX,5,5,"mat-option",37),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(22,"div",30)(23,"div",35),t.ɵɵtext(24,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-form-field",49),t.ɵɵelement(26,"input",61),t.ɵɵpipe(27,"translate"),t.ɵɵtemplate(28,_X,3,3,"mat-icon",34),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,9,"gateway.hints.modbus.modifier")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(8,11,"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,13,null==(n=a.ModifierTypesMap.get(i.get("modifierType").value))?null:n.name)),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",a.modifierTypes),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(27,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",i.get("modifierValue").hasError("pattern")&&i.get("modifierValue").touched)}}function IX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",45),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function EX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",30)(1,"div",63),t.ɵɵtext(2,"gateway.value"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"mat-form-field",32),t.ɵɵelement(4,"input",64),t.ɵɵpipe(5,"translate"),t.ɵɵtemplate(6,IX,3,3,"mat-icon",34),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.ɵɵproperty("ngIf",e.get("value").hasError("required")&&e.get("value").touched)}}function MX(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",65),2&e){const e=t.ɵɵnextContext(4);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Key)("isExpansionMode",!0)}}function kX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",26),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelement(3,"div",27),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",28)(5,"div",29),t.ɵɵtext(6,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",30)(8,"div",31),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10),t.ɵɵpipe(11,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",32),t.ɵɵelement(13,"input",33),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,uX,3,3,"mat-icon",34),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",28)(17,"div",29),t.ɵɵtext(18,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",30)(20,"div",35),t.ɵɵtext(21," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"mat-form-field",32)(23,"mat-select",36),t.ɵɵtemplate(24,mX,2,2,"mat-option",37),t.ɵɵelementEnd()()(),t.ɵɵtemplate(25,gX,6,1,"div",38),t.ɵɵelementStart(26,"div",30)(27,"div",39),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"gateway.objects-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",32),t.ɵɵelement(31,"input",40),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,fX,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(34,wX,3,2,"ng-container",41),t.ɵɵelementStart(35,"div",30)(36,"div",39),t.ɵɵpipe(37,"translate"),t.ɵɵtext(38,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"mat-form-field",32),t.ɵɵelement(40,"input",42),t.ɵɵpipe(41,"translate"),t.ɵɵtemplate(42,SX,3,3,"mat-icon",34),t.ɵɵelementEnd()(),t.ɵɵtemplate(43,TX,29,17,"div",43)(44,EX,7,4,"div",38)(45,MX,1,2,"tb-report-strategy",44),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,20,"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(36,pX)),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(9,22,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.hints.modbus.method":"gateway.hints.modbus.key")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(11,24,n.keysType===n.ModbusValueKey.RPC_REQUESTS?"gateway.method-name":"gateway.key")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,26,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("tag").hasError("required")&&e.get("tag").touched),t.ɵɵadvance(9),t.ɵɵproperty("ngForOf",n.modbusDataTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withFunctionCode),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(28,28,"gateway.hints.modbus.objects-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,30,"gateway.set")),t.ɵɵproperty("readonly",!n.ModbusEditableDataTypes.includes(e.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("objectsCount").hasError("required")&&e.get("objectsCount").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("type").value===n.ModbusDataType.BITS),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(37,32,"gateway.hints.modbus.address")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(41,34,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("address").hasError("required")&&e.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.showModifiersMap.get(e.get("id").value)),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy)}}function PX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,cX,2,3,"div",17)(7,dX,16,12,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,kX,46,37,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),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.last,a=t.ɵɵreference(8),r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.isMaster)("ngIfElse",a),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function DX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,PX,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByControlId)}}function OX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",66)(1,"span",67),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class AX{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(Wt),this.modifierTypes=Object.values(ma),this.bitTargetTypes=Object.values(aa),this.BitTargetTypeTranslationMap=ra,this.ModbusEditableDataTypes=$t,this.ModbusFunctionCodeTranslationsMap=Zt,this.ModifierTypesMap=ha,this.ReportStrategyDefaultValue=en,this.ModbusDataType=Wt,this.ModbusValueKey=ea,this.destroy$=new te,this.defaultReadFunctionCodes=[3,4],this.bitsReadFunctionCodes=[1,2],this.defaultWriteFunctionCodes=[6,16],this.bitsWriteFunctionCodes=[5,15]}ngOnInit(){this.withFunctionCode=!this.isMaster||this.keysType!==ea.ATTRIBUTES&&this.keysType!==ea.TIMESERIES,this.withReportStrategy=!(this.isMaster||this.keysType!==ea.ATTRIBUTES&&this.keysType!==ea.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=Re(5),t=this.fb.group({tag:["",[$.required,$.pattern(an)]],value:[{value:"",disabled:!this.isMaster},[$.required,$.pattern(an)]],type:[Wt.BYTES,[$.required]],address:[null,[$.required]],objectsCount:[1,[$.required]],functionCode:[{value:this.getDefaultFunctionCodes()[0],disabled:!this.withFunctionCode},[$.required]],reportStrategy:[{value:null,disabled:!this.withReportStrategy}],modifierType:[{value:ma.MULTIPLIER,disabled:!0}],modifierValue:[{value:1,disabled:!0},[$.pattern(on)]],bit:[{value:null,disabled:!0}],bitTargetType:[{value:aa.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=Re(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,[$.required,$.pattern(an)]],value:[{value:n,disabled:!this.isMaster},[$.required,$.pattern(an)]],type:[i,[$.required]],address:[a,[$.required]],objectsCount:[r,[$.required]],functionCode:[{value:o,disabled:!this.withFunctionCode},[$.required]],modifierType:[{value:l?ma.DIVIDER:ma.MULTIPLIER,disabled:!this.enableModifiersControlMap.get(u).value}],bit:[{value:c,disabled:i!==Wt.BITS||r<2},[$.max(r-1)]],bitTargetType:[{value:d??aa.IntegerType,disabled:i!==Wt.BITS||this.hideNewFields}],modifierValue:[{value:s??l??1,disabled:!this.enableModifiersControlMap.get(u).value},[$.pattern(on)]],id:[{value:u,disabled:!0}],reportStrategy:[{value:p,disabled:!this.withReportStrategy}]})}shouldShowModifier(e){return!(this.isMaster||this.keysType!==ea.ATTRIBUTES&&this.keysType!==ea.TIMESERIES||this.ModbusEditableDataTypes.includes(e))}observeKeyDataType(e){e.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((t=>{this.ModbusEditableDataTypes.includes(t)||e.get("objectsCount").patchValue(Kt[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(ue((()=>e.get("type").value===Wt.BITS)),le(this.destroy$)).subscribe((()=>this.toggleBitsFields(e)))}toggleBitsFields(e){const{objectsCount:t,type:n,bit:i,bitTargetType:a}=e.controls,r=n.value===Wt.BITS,o=t.value>1;r&&o?(i.enable({emitEvent:!1}),i.setValidators($.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(le(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===Wt.BITS?this.bitsWriteFunctionCodes:[],...this.defaultWriteFunctionCodes];if(this.keysType===ea.ATTRIBUTES_UPDATES)return t.sort(((e,t)=>e-t));const n=[...this.defaultReadFunctionCodes];return e===Wt.BITS&&n.push(...this.bitsReadFunctionCodes),this.keysType===ea.RPC_REQUESTS&&n.push(...t),n.sort(((e,t)=>e-t))}getDefaultFunctionCodes(){return this.keysType===ea.ATTRIBUTES_UPDATES?this.defaultWriteFunctionCodes:this.keysType===ea.RPC_REQUESTS?[...this.defaultReadFunctionCodes,...this.defaultWriteFunctionCodes]:this.defaultReadFunctionCodes}static{this.ɵfac=function(e){return new(e||AX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(it.TbPopoverComponent))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:AX,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:19,vars:16,consts:[["noKeys",""],["tagName",""],[1,"tb-modbus-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container","tbTruncateWithTooltip","",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],["tbTruncateWithTooltip","",1,"title-container"],[1,"tb-flex"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width"],["formControlName","type"],[3,"value",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["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"],[4,"ngIf"],["matInput","","type","number","min","0","max","50000","name","value","formControlName","address",3,"placeholder"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"defaultValue","isExpansionMode",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"],["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,"tb-form-panel","stroked","tb-slide-toggle"],[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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,DX,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,OX,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")",""),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(AX,[j,_,Xn,qn]),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: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",AX),Ge([I()],AX.prototype,"isMaster",void 0),Ge([I()],AX.prototype,"hideNewFields",void 0);const FX=()=>({$implicit:null}),RX=e=>({$implicit:e});function BX(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",7),t.ɵɵelementContainer(2,8),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(),n=t.ɵɵreference(4);t.ɵɵadvance(),t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",n)("ngTemplateOutletContext",t.ɵɵpureFunction0(3,FX))}}function NX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab",11),t.ɵɵpipe(1,"translate"),t.ɵɵelementStart(2,"div",7),t.ɵɵelementContainer(3,8),t.ɵɵelementEnd()()),2&e){const e=n.$implicit,i=t.ɵɵnextContext(2),a=t.ɵɵreference(4);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,RX,e))}}function LX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group",9),t.ɵɵtemplate(1,NX,4,8,"mat-tab",10),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.valuesFormGroup),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.modbusRegisterTypes)}}function VX(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 qX(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 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.tag," ")}}function zX(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 UX(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵtext(2,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",14)(4,"mat-chip-listbox",15),t.ɵɵtemplate(5,VX,2,1,"mat-chip",16),t.ɵɵelementStart(6,"mat-chip",17),t.ɵɵelement(7,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",19,2),t.ɵɵpipe(10,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(9),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES,i))})),t.ɵɵelementStart(11,"tb-icon",20),t.ɵɵtext(12,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(13,"div",12)(14,"div",13),t.ɵɵtext(15,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"div",14)(17,"mat-chip-listbox",15),t.ɵɵtemplate(18,qX,2,1,"mat-chip",16),t.ɵɵelementStart(19,"mat-chip",17),t.ɵɵelement(20,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(21,"button",19,3),t.ɵɵpipe(23,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(22),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.TIMESERIES,i))})),t.ɵɵelementStart(24,"tb-icon",20),t.ɵɵtext(25,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(26,"div",12)(27,"div",13),t.ɵɵtext(28,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",14)(30,"mat-chip-listbox",15),t.ɵɵtemplate(31,GX,2,1,"mat-chip",16),t.ɵɵelementStart(32,"mat-chip",17),t.ɵɵelement(33,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"button",19,4),t.ɵɵpipe(36,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(35),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.ATTRIBUTES_UPDATES,i))})),t.ɵɵelementStart(37,"tb-icon",20),t.ɵɵtext(38,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(39,"div",12)(40,"div",13),t.ɵɵtext(41,"gateway.rpc-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"div",14)(43,"mat-chip-listbox",15),t.ɵɵtemplate(44,zX,2,1,"mat-chip",16),t.ɵɵelementStart(45,"mat-chip",17),t.ɵɵelement(46,"label",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(47,"button",19,5),t.ɵɵpipe(49,"translate"),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵreference(48),r=t.ɵɵnextContext();return t.ɵɵresetView(r.manageKeys(n,a,r.ModbusValueKey.RPC_REQUESTS,i))})),t.ɵɵelementStart(50,"tb-icon",20),t.ɵɵtext(51,"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.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(10,16,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.TIMESERIES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(23,18,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.ATTRIBUTES_UPDATES,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(36,20,"action.edit")),t.ɵɵproperty("disabled",i.disabled),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",i.getValueGroup(i.ModbusValueKey.RPC_REQUESTS,e).value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,22,"action.edit")),t.ɵɵproperty("disabled",i.disabled)}}class jX{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(Ji),this.modbusValueKeys=Object.values(ea),this.ModbusValuesTranslationsMap=ia,this.ModbusValueKey=ea}ngOnInit(){this.initializeValuesFormGroup(),this.observeValuesChanges()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}writeValue(e){if(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:pa.get(n),addKeyTitle:ca.get(n),deleteKeyTitle:da.get(n),noKeysText:ua.get(n),hideNewFields:this.hideNewFields};this.popoverComponent=this.popoverService.displayPopover(a,this.renderer,this.viewContainerRef,AX,"leftBottom",!1,null,o,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(bn(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(bn(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||jX)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:jX,selectors:[["tb-modbus-values"]],inputs:{singleMode:"singleMode",hideNewFields:"hideNewFields"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>jX)),multi:!0},{provide:K,useExisting:c((()=>jX)),multi:!0}]),t.ɵɵStandaloneFeature],decls:5,vars:2,consts:[["multipleView",""],["singleView",""],["attributesButton",""],["telemetryButton",""],["attributesUpdatesButton",""],["rpcRequestsButton",""],[4,"ngIf","ngIfElse"],[1,"tb-form-panel","no-border","no-padding","padding-top",3,"formGroup"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"formGroup"],[3,"label",4,"ngFor","ngForOf"],[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"],[4,"ngFor","ngForOf"],[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){if(1&e&&t.ɵɵtemplate(0,BX,3,4,"ng-container",6)(1,LX,2,2,"ng-template",null,0,t.ɵɵtemplateRefExtractor)(3,UX,52,24,"ng-template",null,1,t.ɵɵtemplateRefExtractor),2&e){const e=t.ɵɵreference(2);t.ɵɵproperty("ngIf",n.singleMode)("ngIfElse",e)}},dependencies:t.ɵɵgetComponentDepsFactory(jX,[j,_,Gn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .mat-mdc-tab-body-wrapper{min-height:320px} .mdc-evolution-chip-set__chips{align-items:center}'],changeDetection:d.OnPush})}}function HX(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",16),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function WX(e,n){1&e&&(t.ɵɵelementStart(0,"div",17)(1,"mat-slide-toggle",18)(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",jX),Ge([I()],jX.prototype,"singleMode",void 0),Ge([I()],jX.prototype,"hideNewFields",void 0);class $X{constructor(e,t){this.fb=e,this.cdr=t,this.isMaster=!1,this.disabled=!1,this.destroy$=new te,this.securityConfigFormGroup=this.fb.group({certfile:["",[$.pattern(an)]],keyfile:["",[$.pattern(an)]],password:["",[$.pattern(an)]],server_hostname:["",[$.pattern(an)]],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(le(this.destroy$)).subscribe((e=>{this.onChange(e),this.onTouched()}))}static{this.ɵfac=function(e){return new(e||$X)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$X,selectors:[["tb-modbus-security-config"]],inputs:{isMaster:"isMaster"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>$X)),multi:!0},{provide:K,useExisting:c((()=>$X)),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","formControlName","certfile",3,"placeholder"],[1,"fixed-title-width",3,"tb-hint-tooltip-icon"],["matInput","","name","value","formControlName","keyfile",3,"placeholder"],["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"],["class","tb-form-row space-between tb-flex fill-width",4,"ngIf"],["class","tb-form-row",4,"ngIf"],["matInput","","name","value","formControlName","server_hostname",3,"placeholder"],[1,"tb-form-row"],["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,HX,7,3,"div",14)(32,WX,5,3,"div",15),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.ɵɵproperty("ngIf",!n.isMaster),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.isMaster))},dependencies:t.ɵɵgetComponentDepsFactory($X,[j,_,qn]),encapsulation:2,changeDetection:d.OnPush})}}function KX(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),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 YX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function XX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,YX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function ZX(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 QX(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,ZX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function JX(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function eZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,JX,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function tZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 nZ(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 iZ(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 aZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 rZ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,nZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,iZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,aZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function oZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function sZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function lZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function pZ(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 cZ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function dZ(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 uZ(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 mZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",$X),Ge([I()],$X.prototype,"isMaster",void 0);class hZ extends lX{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===Ki.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||hZ)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:hZ,selectors:[["tb-modbus-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,KX,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,XX,8,7,"div",15)(20,QX,8,9,"div",16)(21,eZ,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,tZ,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,rZ,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,oZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,sZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,lZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,pZ,5,3,"div",28)(54,cZ,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,dZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,uZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,mZ,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),i=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",i),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(hZ,[j,_,jX,$X,r$,Xn,qn]),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 gZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",52),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 fZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.host-required"))}function yZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",53),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,fZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function vZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",54),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 xZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",55),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,vZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function bZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.port-required"))}function wZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",17)(1,"div",22),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",19),t.ɵɵelement(5,"input",56),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,bZ,3,3,"mat-icon",24),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("serialPort").hasError("required")&&e.slaveConfigFormGroup.get("serialPort").touched)}}function SZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 CZ(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 _Z(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 TZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",52),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 IZ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵelementStart(1,"div",17)(2,"div",18),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-form-field",19)(6,"mat-select",57),t.ɵɵtemplate(7,CZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(8,"div",17)(9,"div",18),t.ɵɵpipe(10,"translate"),t.ɵɵtext(11,"gateway.bytesize"),t.ɵɵelementEnd(),t.ɵɵelementStart(12,"mat-form-field",19)(13,"mat-select",58),t.ɵɵtemplate(14,_Z,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(15,"div",17)(16,"div",18),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"gateway.stopbits"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"mat-form-field",19),t.ɵɵelement(20,"input",59),t.ɵɵpipe(21,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(22,"div",17)(23,"div",18),t.ɵɵpipe(24,"translate"),t.ɵɵtext(25,"gateway.parity"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",19)(27,"mat-select",60),t.ɵɵtemplate(28,TZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(29,"div",36)(30,"mat-slide-toggle",61)(31,"mat-label",38),t.ɵɵpipe(32,"translate"),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(10,12,"gateway.hints.modbus.bytesize")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusByteSizes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(17,14,"gateway.hints.modbus.stopbits")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(21,16,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(24,18,"gateway.hints.modbus.parity")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusParities),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(32,20,"gateway.hints.modbus.strict")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(34,22,"gateway.strict")," ")}}function EZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.unit-id-required"))}function MZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-name-required"))}function kZ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",54),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.device-profile-required"))}function PZ(e,n){1&e&&(t.ɵɵelementStart(0,"div",36)(1,"mat-slide-toggle",62)(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 DZ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",63),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Device)("isExpansionMode",!0)}}function OZ(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 AZ(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 FZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",64)(1,"mat-expansion-panel",65)(2,"mat-expansion-panel-header",66)(3,"mat-panel-title")(4,"mat-slide-toggle",67),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",68),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",hZ);class RZ extends lX{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===Ki.Serial&&(a.port=n),Te(a),a}addFieldsToFormGroup(){this.slaveConfigFormGroup.addControl("sendDataOnlyOnChange",this.fb.control(!1))}static{this.ɵfac=function(e){return new(e||RZ)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:RZ,selectors:[["tb-modbus-legacy-slave-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:141,vars:97,consts:[["serialPort",""],["reportStrategy",""],[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",4,"ngFor","ngForOf"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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"],[4,"ngIf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["translate","",1,"fixed-title-width","tb-required"],["matInput","","name","value","formControlName","deviceName",3,"placeholder"],["matInput","","name","value","formControlName","deviceType",3,"placeholder"],["class","tb-form-row",4,"ngIf","ngIfElse"],[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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[1,"tb-form-row"],["formControlName","retries",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","retryOnEmpty",1,"mat-slide"],["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"],[3,"value"],["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"],["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"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"defaultValue","isExpansionMode"],[1,"tb-form-panel","stroked","tb-slide-toggle"],[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){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"mat-toolbar",3)(2,"h2"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(5,"span",4)(6,"div",5),t.ɵɵelementStart(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵelementStart(8,"mat-icon",7),t.ɵɵtext(9,"close"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12),t.ɵɵtext(15,"gateway.server-connection"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"tb-toggle-select",13),t.ɵɵtemplate(17,gZ,2,2,"tb-toggle-option",14),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",10),t.ɵɵtemplate(19,yZ,8,7,"div",15)(20,xZ,8,9,"div",16)(21,wZ,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(23,"div",17)(24,"div",18),t.ɵɵpipe(25,"translate"),t.ɵɵtext(26," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(27,"mat-form-field",19)(28,"mat-select",20),t.ɵɵtemplate(29,SZ,2,2,"mat-option",14),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(30,IZ,35,24,"ng-container",21),t.ɵɵelementStart(31,"div",17)(32,"div",22),t.ɵɵpipe(33,"translate"),t.ɵɵtext(34,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(35,"mat-form-field",19),t.ɵɵelement(36,"input",23),t.ɵɵpipe(37,"translate"),t.ɵɵtemplate(38,EZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(39,"div",17)(40,"div",25),t.ɵɵtext(41,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"mat-form-field",19),t.ɵɵelement(43,"input",26),t.ɵɵpipe(44,"translate"),t.ɵɵtemplate(45,MZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"div",17)(47,"div",25),t.ɵɵtext(48,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"mat-form-field",19),t.ɵɵelement(50,"input",27),t.ɵɵpipe(51,"translate"),t.ɵɵtemplate(52,kZ,3,3,"mat-icon",24),t.ɵɵelementEnd()(),t.ɵɵtemplate(53,PZ,5,3,"div",28)(54,DZ,1,2,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(56,"div",29)(57,"mat-expansion-panel",30)(58,"mat-expansion-panel-header")(59,"mat-panel-title")(60,"div",31),t.ɵɵtext(61,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(62,"div",10)(63,"div",17)(64,"div",18),t.ɵɵpipe(65,"translate"),t.ɵɵtext(66,"gateway.connection-timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(67,"mat-form-field",19),t.ɵɵelement(68,"input",32),t.ɵɵpipe(69,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(70,"div",17)(71,"div",18),t.ɵɵpipe(72,"translate"),t.ɵɵtext(73,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(74,"mat-form-field",19)(75,"mat-select",33),t.ɵɵtemplate(76,OZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵelementStart(77,"div",17)(78,"div",18),t.ɵɵpipe(79,"translate"),t.ɵɵtext(80,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",19)(82,"mat-select",34),t.ɵɵtemplate(83,AZ,2,2,"mat-option",14),t.ɵɵelementEnd()()(),t.ɵɵtemplate(84,FZ,9,5,"div",35),t.ɵɵelementStart(85,"div",36)(86,"mat-slide-toggle",37)(87,"mat-label",38),t.ɵɵpipe(88,"translate"),t.ɵɵtext(89),t.ɵɵpipe(90,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(91,"div",36)(92,"mat-slide-toggle",39)(93,"mat-label",38),t.ɵɵpipe(94,"translate"),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(97,"div",36)(98,"mat-slide-toggle",40)(99,"mat-label",38),t.ɵɵpipe(100,"translate"),t.ɵɵtext(101),t.ɵɵpipe(102,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(103,"div",17)(104,"div",41),t.ɵɵpipe(105,"translate"),t.ɵɵelementStart(106,"span",42),t.ɵɵtext(107," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(108,"mat-form-field",19),t.ɵɵelement(109,"input",43),t.ɵɵpipe(110,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(111,"div",17)(112,"div",44),t.ɵɵpipe(113,"translate"),t.ɵɵtext(114,"gateway.connect-attempt-time"),t.ɵɵelementEnd(),t.ɵɵelementStart(115,"mat-form-field",19),t.ɵɵelement(116,"input",45),t.ɵɵpipe(117,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(118,"div",17)(119,"div",44),t.ɵɵpipe(120,"translate"),t.ɵɵtext(121,"gateway.connect-attempt-count"),t.ɵɵelementEnd(),t.ɵɵelementStart(122,"mat-form-field",19),t.ɵɵelement(123,"input",46),t.ɵɵpipe(124,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(125,"div",17)(126,"div",44),t.ɵɵpipe(127,"translate"),t.ɵɵtext(128,"gateway.wait-after-failed-attempts"),t.ɵɵelementEnd(),t.ɵɵelementStart(129,"mat-form-field",19),t.ɵɵelement(130,"input",47),t.ɵɵpipe(131,"translate"),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(132,"div",29),t.ɵɵelement(133,"tb-modbus-values",48),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(134,"div",49)(135,"button",50),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(136),t.ɵɵpipe(137,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(138,"button",51),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(139),t.ɵɵpipe(140,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(22),i=t.ɵɵreference(55);t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,45,"gateway.server-slave")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.modbusHelpLink),t.ɵɵadvance(4),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(25,47,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(33,49,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(37,51,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(44,53,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(51,55,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.data.hideNewFields)("ngIfElse",i),t.ɵɵadvance(11),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(65,57,"gateway.hints.modbus.connection-timeout")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(69,59,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(72,61,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(79,63,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(88,65,"gateway.hints.modbus.retries")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(90,67,"gateway.retries")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(94,69,"gateway.hints.modbus.retries-on-empty")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,71,"gateway.retries-on-empty")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(100,73,"gateway.hints.modbus.retries-on-invalid")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(102,75,"gateway.retries-on-invalid")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(105,77,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(110,79,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(113,81,"gateway.hints.modbus.connect-attempt-time")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(117,83,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(120,85,"gateway.hints.modbus.connect-attempt-count")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(124,87,"gateway.set")),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(127,89,"gateway.hints.modbus.wait-after-failed-attempts")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(131,91,"gateway.set")),t.ɵɵadvance(3),t.ɵɵproperty("singleMode",!0)("hideNewFields",n.data.hideNewFields),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(137,93,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.slaveConfigFormGroup.invalid||!n.slaveConfigFormGroup.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(140,95,n.data.buttonTitle)," ")}},dependencies:t.ɵɵgetComponentDepsFactory(RZ,[j,_,jX,$X,r$,Xn]),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 BZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",38),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 NZ(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.host-required"))}function LZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.host"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",39),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,NZ,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("host").hasError("required")&&e.slaveConfigFormGroup.get("host").touched)}}function VZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",40),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 qZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",41),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,VZ,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",(e.slaveConfigFormGroup.get("port").hasError("required")||e.slaveConfigFormGroup.get("port").hasError("min")||e.slaveConfigFormGroup.get("port").hasError("max"))&&e.slaveConfigFormGroup.get("port").touched)}}function GZ(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.port-required"))}function zZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",14),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12),t.ɵɵelement(5,"input",42),t.ɵɵpipe(6,"translate"),t.ɵɵtemplate(7,GZ,3,3,"mat-icon",16),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.ɵɵproperty("ngIf",e.slaveConfigFormGroup.get("port").hasError("required")&&e.slaveConfigFormGroup.get("port").touched)}}function UZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",38),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 jZ(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.unit-id-required"))}function HZ(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-required"))}function WZ(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-profile-required"))}function $Z(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.ɵɵtextInterpolate(e)}}function KZ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10)(1,"div",11),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3,"gateway.baudrate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-form-field",12)(5,"mat-select",43),t.ɵɵtemplate(6,$Z,2,2,"mat-option",6),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(2,2,"gateway.hints.modbus.baudrate")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",e.modbusBaudrates)}}function YZ(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.ɵɵtextInterpolate(e)}}function XZ(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.ɵɵtextInterpolate(e)}}function ZZ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",44)(1,"mat-expansion-panel",45)(2,"mat-expansion-panel-header",46)(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"),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelement(8,"tb-modbus-security-config",48),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",RZ);class QZ{constructor(e){this.fb=e,this.ModbusProtocolLabelsMap=sa,this.ModbusMethodLabelsMap=oa,this.portLimits=Ii,this.modbusProtocolTypes=Object.values(Ki),this.modbusMethodTypes=Object.values(Yi),this.modbusSerialMethodTypes=Object.values(Xi),this.modbusOrderType=Object.values(Qi),this.ModbusProtocolType=Ki,this.modbusBaudrates=ta,this.isSlaveEnabled=!1,this.serialSpecificControlKeys=["serialPort","baudrate"],this.tcpUdpSpecificControlKeys=["port","security","host"],this.destroy$=new te,this.showSecurityControl=this.fb.control(!1),this.slaveConfigFormGroup=this.fb.group({type:[Ki.TCP],host:["",[$.required,$.pattern(an)]],port:[null,[$.required,$.min(Ii.MIN),$.max(Ii.MAX)]],serialPort:["",[$.required,$.pattern(an)]],method:[Yi.SOCKET],unitId:[null,[$.required]],baudrate:[this.modbusBaudrates[0]],deviceName:["",[$.required,$.pattern(an)]],deviceType:["",[$.required,$.pattern(an)]],pollPeriod:[1e3,[$.required]],sendDataToThingsBoard:[!1],byteOrder:[Qi.BIG],wordOrder:[Qi.BIG],security:[],identity:this.fb.group({vendorName:["",[$.pattern(an)]],productCode:["",[$.pattern(an)]],vendorUrl:["",[$.pattern(an)]],productName:["",[$.pattern(an)]],modelName:["",[$.pattern(an)]]}),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&&!Se(e.security,{})),this.updateSlaveConfig(e)}setDisabledState(e){this.isSlaveEnabled=!e,this.updateFormEnableState()}observeValueChanges(){this.slaveConfigFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{e.type===Ki.Serial&&(e.port=e.serialPort,delete e.serialPort),this.onChange(e),this.onTouched()}))}observeTypeChange(){this.slaveConfigFormGroup.get("type").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateFormEnableState(),this.updateMethodType(e)}))}updateMethodType(e){this.slaveConfigFormGroup.get("method").value!==Yi.RTU&&this.slaveConfigFormGroup.get("method").patchValue(e===Ki.Serial?Xi.ASCII:Yi.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(le(this.destroy$)).subscribe((e=>this.updateSecurityEnable(e)))}updateSecurityEnable(e){e&&this.isSlaveEnabled&&this.protocolType!==Ki.Serial?this.slaveConfigFormGroup.get("security").enable({emitEvent:!1}):this.slaveConfigFormGroup.get("security").disable({emitEvent:!1})}updateEnablingByProtocol(){const e=this.protocolType===Ki.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=Ki.TCP,method:l=Yi.RTU,unitId:p=0,deviceName:c="",deviceType:d="",pollPeriod:u=1e3,sendDataToThingsBoard:m=!1,byteOrder:h=Qi.BIG,wordOrder:g=Qi.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===Ki.Serial?"":x,port:s===Ki.Serial?null:b,serialPort:s===Ki.Serial?b:""};this.slaveConfigFormGroup.setValue(w,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||QZ)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:QZ,selectors:[["tb-modbus-slave-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>QZ)),multi:!0},{provide:K,useExisting:c((()=>QZ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:112,vars:59,consts:[["serialPort",""],[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",4,"ngFor","ngForOf"],[1,"tb-form-panel","no-border","no-padding","padding-top"],["class","tb-form-row column-xs",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf","ngIfElse"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],["class","tb-form-panel stroked tb-slide-toggle",4,"ngIf"],[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"],[3,"value"],["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-form-panel","stroked","tb-slide-toggle"],[1,"tb-settings",3,"expanded"],[1,"flex-wrap"],[1,"mat-slide",3,"click","formControl"],["formControlName","security"]],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.server-slave-config"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"tb-toggle-select",5),t.ɵɵtemplate(6,BZ,2,2,"tb-toggle-option",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",7),t.ɵɵtemplate(8,LZ,8,7,"div",8)(9,qZ,8,9,"div",9)(10,zZ,8,7,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",10)(13,"div",11),t.ɵɵpipe(14,"translate"),t.ɵɵtext(15," gateway.method "),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"mat-form-field",12)(17,"mat-select",13),t.ɵɵtemplate(18,UZ,2,2,"mat-option",6),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",10)(20,"div",14),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22,"gateway.unit-id"),t.ɵɵelementEnd(),t.ɵɵelementStart(23,"mat-form-field",12),t.ɵɵelement(24,"input",15),t.ɵɵpipe(25,"translate"),t.ɵɵtemplate(26,jZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(27,"div",10)(28,"div",17),t.ɵɵtext(29,"gateway.device-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"mat-form-field",12),t.ɵɵelement(31,"input",18),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,HZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(34,"div",10)(35,"div",17),t.ɵɵtext(36,"gateway.device-profile"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"mat-form-field",12),t.ɵɵelement(38,"input",19),t.ɵɵpipe(39,"translate"),t.ɵɵtemplate(40,WZ,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(41,"div",10)(42,"div",20),t.ɵɵpipe(43,"translate"),t.ɵɵelementStart(44,"span",21),t.ɵɵtext(45," gateway.poll-period "),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",12),t.ɵɵelement(47,"input",22),t.ɵɵpipe(48,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(49,KZ,7,4,"div",8),t.ɵɵelementStart(50,"div",23)(51,"mat-slide-toggle",24)(52,"mat-label"),t.ɵɵtext(53),t.ɵɵpipe(54,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(55,"div",25)(56,"mat-expansion-panel",26)(57,"mat-expansion-panel-header")(58,"mat-panel-title")(59,"div",27),t.ɵɵtext(60,"gateway.advanced-connection-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(61,"div",7)(62,"div",10)(63,"div",11),t.ɵɵpipe(64,"translate"),t.ɵɵtext(65,"gateway.byte-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(66,"mat-form-field",12)(67,"mat-select",28),t.ɵɵtemplate(68,YZ,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵelementStart(69,"div",10)(70,"div",11),t.ɵɵpipe(71,"translate"),t.ɵɵtext(72,"gateway.word-order"),t.ɵɵelementEnd(),t.ɵɵelementStart(73,"mat-form-field",12)(74,"mat-select",29),t.ɵɵtemplate(75,XZ,2,2,"mat-option",6),t.ɵɵelementEnd()()(),t.ɵɵtemplate(76,ZZ,9,5,"div",30),t.ɵɵelementContainerStart(77,31),t.ɵɵelementStart(78,"div",10)(79,"div",4),t.ɵɵtext(80,"gateway.vendor-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(81,"mat-form-field",12),t.ɵɵelement(82,"input",32),t.ɵɵpipe(83,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(84,"div",10)(85,"div",4),t.ɵɵtext(86,"gateway.product-code"),t.ɵɵelementEnd(),t.ɵɵelementStart(87,"mat-form-field",12),t.ɵɵelement(88,"input",33),t.ɵɵpipe(89,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(90,"div",10)(91,"div",4),t.ɵɵtext(92,"gateway.vendor-url"),t.ɵɵelementEnd(),t.ɵɵelementStart(93,"mat-form-field",12),t.ɵɵelement(94,"input",34),t.ɵɵpipe(95,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(96,"div",10)(97,"div",4),t.ɵɵtext(98,"gateway.product-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(99,"mat-form-field",12),t.ɵɵelement(100,"input",35),t.ɵɵpipe(101,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(102,"div",10)(103,"div",4),t.ɵɵtext(104,"gateway.model-name"),t.ɵɵelementEnd(),t.ɵɵelementStart(105,"mat-form-field",12),t.ɵɵelement(106,"input",36),t.ɵɵpipe(107,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()(),t.ɵɵelementStart(108,"div",25)(109,"div",27),t.ɵɵtext(110,"gateway.values"),t.ɵɵelementEnd(),t.ɵɵelement(111,"tb-modbus-values",37),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵreference(11);t.ɵɵproperty("formGroup",n.slaveConfigFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.modbusProtocolTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial)("ngIfElse",e),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(14,29,"gateway.hints.modbus.framer-type")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.protocolType===n.ModbusProtocolType.Serial?n.modbusSerialMethodTypes:n.modbusMethodTypes),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,31,"gateway.hints.modbus.unit-id")),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(25,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("unitId").hasError("required")&&n.slaveConfigFormGroup.get("unitId").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,35,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceName").hasError("required")&&n.slaveConfigFormGroup.get("deviceName").touched),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(39,37,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.slaveConfigFormGroup.get("deviceType").hasError("required")&&n.slaveConfigFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(43,39,"gateway.hints.modbus.poll-period")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(48,41,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.protocolType===n.ModbusProtocolType.Serial),t.ɵɵadvance(4),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(54,43,"gateway.send-data-to-platform")," "),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(64,45,"gateway.hints.modbus.byte-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(71,47,"gateway.hints.modbus.word-order")),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.modbusOrderType),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.protocolType!==n.ModbusProtocolType.Serial),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.slaveConfigFormGroup.get("identity")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(83,49,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(89,51,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(95,53,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(101,55,"gateway.set")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(107,57,"gateway.set"))}},dependencies:t.ɵɵgetComponentDepsFactory(QZ,[j,_,jX,$X,r$,qn]),encapsulation:2,changeDetection:d.OnPush})}}e("ModbusSlaveConfigComponent",QZ);const JZ=["searchInput"],eQ=()=>["deviceName","info","unitId","type","actions"],tQ=()=>({minWidth:"96px",textAlign:"center"});function nQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",9)(1,"div",28)(2,"span",29),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",11),t.ɵɵelementStart(6,"button",13),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",13),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 iQ(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 aQ(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 rQ(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 oQ(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 sQ(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 lQ(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 pQ(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 cQ(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 dQ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",32)}function uQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",13),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",13),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 mQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,uQ,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,tQ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function hQ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",39)}function gQ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class fQ{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=sa,this.onChange=()=>{},this.onTouched=()=>{},this.destroy$=new te,this.masterFormGroup=this.fb.group({slaves:this.fb.array([])}),this.dataSource=new yQ}get slaves(){return this.masterFormGroup.get("slaves")}ngOnInit(){this.masterFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e.slaves),this.onChange(e),this.onTouched()}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t),i=n?this.slaves.at(t).value:{};this.getSlaveDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(n?this.slaves.at(t).patchValue(e):this.slaves.push(this.fb.control(e)),this.masterFormGroup.markAsDirty())}))}getSlaveDialog(e,t){return this.isLegacy?this.dialog.open(RZ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,hideNewFields:!0,buttonTitle:t}}):this.dialog.open(hZ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,hideNewFields:!1}})}deleteSlave(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-slave-title",{name:this.slaves.controls[t].value.deviceName}),this.translate.instant("gateway.delete-slave-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(this.slaves.removeAt(t),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||fQ)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:fQ,selectors:[["tb-modbus-master-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(JZ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{isLegacy:"isLegacy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>fQ)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,nQ,14,9,"div",8),t.ɵɵpipe(8,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(9,"mat-toolbar",7)(10,"div",9)(11,"button",10),t.ɵɵpipe(12,"translate"),t.ɵɵelementStart(13,"mat-icon"),t.ɵɵtext(14,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-form-field",11)(16,"mat-label"),t.ɵɵtext(17," "),t.ɵɵelementEnd(),t.ɵɵelement(18,"input",12,0),t.ɵɵpipe(20,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"button",13),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",14)(26,"table",15),t.ɵɵelementContainerStart(27,16),t.ɵɵtemplate(28,iQ,4,3,"mat-header-cell",17)(29,aQ,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(30,16),t.ɵɵtemplate(31,rQ,3,3,"mat-header-cell",17)(32,oQ,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(33,16),t.ɵɵtemplate(34,sQ,3,3,"mat-header-cell",17)(35,lQ,3,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(36,16),t.ɵɵtemplate(37,pQ,4,3,"mat-header-cell",17)(38,cQ,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(39,19),t.ɵɵtemplate(40,dQ,1,0,"mat-header-cell",20)(41,mQ,12,6,"mat-cell",21),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(42,hQ,1,0,"mat-header-row",22)(43,gQ,1,0,"mat-row",23),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"section",24),t.ɵɵpipe(45,"async"),t.ɵɵelementStart(46,"button",25),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageSlave(i))})),t.ɵɵelementStart(47,"mat-icon",26),t.ɵɵtext(48,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(49,"span"),t.ɵɵtext(50),t.ɵɵpipe(51,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(52,"span",27),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(8,25,n.dataSource.isEmpty())),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,eQ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(40,eQ)),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(fQ,[j,_,qn]),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",fQ),Ge([rt()],fQ.prototype,"isLegacy",void 0);class yQ extends G{constructor(){super()}}e("SlavesDatasource",yQ);class vQ extends Ba{constructor(){super(),this.enableSlaveControl=new X(!1),this.enableSlaveControl.valueChanges.pipe(bn()).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&&(Se(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&&!Se(e.slave,{}))}static{this.ɵfac=function(e){return new(e||vQ)}}static{this.ɵdir=t.ɵɵdefineDirective({type:vQ,features:[t.ɵɵInheritDefinitionFeature]})}}e("ModbusBasicConfigDirective",vQ);class xQ extends vQ{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(xQ)))(n||xQ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:xQ,selectors:[["tb-modbus-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>xQ)),multi:!0},{provide:K,useExisting:c((()=>xQ)),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(xQ,[j,_,QZ,fQ,Gn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusBasicConfigComponent",xQ);class bQ extends vQ{constructor(){super(...arguments),this.isLegacy=!0}mapConfigToFormValue(e){return{master:e.master?.slaves?e.master:{slaves:[]},slave:e.slave?Ua.mapSlaveToUpgradedVersion(e.slave):{}}}getMappedValue(e){return{master:e.master,slave:e.slave?Ua.mapSlaveToDowngradedVersion(e.slave):{}}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(bQ)))(n||bQ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:bQ,selectors:[["tb-modbus-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>bQ)),multi:!0},{provide:K,useExisting:c((()=>bQ)),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(bQ,[j,_,QZ,fQ,Gn]),styles:['@charset "UTF-8";[_nghost-%COMP%]{height:100%}'],changeDetection:d.OnPush})}}e("ModbusLegacyBasicConfigComponent",bQ);const wQ=()=>({maxWidth:"970px"});function SQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",20),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",e.get("key").value," ")}}function CQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("methodRPC").value)}}function _Q(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate(e.get("attributeOnThingsBoard").value)}}function TQ(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtext(1),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵnextContext(2).$implicit;t.ɵɵadvance(),t.ɵɵtextInterpolate2(" ",e.get("requestExpression").value+" - ","",e.get("attributeNameExpression").value," ")}}function IQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",21),t.ɵɵtemplate(1,CQ,2,1,"ng-container",22)(2,_Q,2,1,"ng-container",22)(3,TQ,2,2,"ng-container",22),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngSwitch",e.keysType),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_UPDATES),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.SocketValueKey.ATTRIBUTES_REQUESTS)}}function EQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.key-required"))}function MQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function kQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.value-required"))}function PQ(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",42),2&e){const e=t.ɵɵnextContext(5);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Key)}}function DQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",24)(2,"div",25),t.ɵɵtext(3,"gateway.platform-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",26)(5,"div",27),t.ɵɵpipe(6,"translate"),t.ɵɵpipe(7,"translate"),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"div",28)(11,"mat-form-field",29),t.ɵɵelement(12,"input",30),t.ɵɵpipe(13,"translate"),t.ɵɵtemplate(14,EQ,3,3,"mat-icon",31),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(15,"div",24)(16,"div",25),t.ɵɵtext(17,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵelementStart(18,"div",26)(19,"div",32)(20,"span",33),t.ɵɵtext(21),t.ɵɵpipe(22,"translate"),t.ɵɵelementEnd(),t.ɵɵelement(23,"div",34),t.ɵɵelementEnd(),t.ɵɵelementStart(24,"label",35),t.ɵɵtext(25,"from"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"mat-form-field",36),t.ɵɵelement(27,"input",37),t.ɵɵpipe(28,"translate"),t.ɵɵtemplate(29,MQ,3,3,"mat-icon",31),t.ɵɵelementEnd(),t.ɵɵelementStart(30,"label",38),t.ɵɵtext(31,"to"),t.ɵɵelementEnd(),t.ɵɵelementStart(32,"mat-form-field",36),t.ɵɵelement(33,"input",39),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,kQ,3,3,"mat-icon",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(36,PQ,1,2,"tb-report-strategy",40),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.ɵɵproperty("ngIf",e.get("key").hasError("required")&&e.get("key").touched),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,wQ)),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,22,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteFrom").hasError("required")&&e.get("byteFrom").touched),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(34,24,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("byteTo").hasError("required")&&e.get("byteTo").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.withReportStrategy&&(n.keysType===n.SocketValueKey.ATTRIBUTES||n.keysType===n.SocketValueKey.TIMESERIES))}}function OQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.method-required"))}function AQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function FQ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",43),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29),t.ɵɵelement(7,"input",44),t.ɵɵpipe(8,"translate"),t.ɵɵtemplate(9,OQ,3,3,"mat-icon",31),t.ɵɵelementEnd()()(),t.ɵɵelementStart(10,"div",26)(11,"div",45),t.ɵɵpipe(12,"translate"),t.ɵɵtext(13," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",28)(15,"mat-form-field",29)(16,"mat-select",46),t.ɵɵtemplate(17,AQ,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(18,"div",48)(19,"mat-slide-toggle",49),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(20,"mat-label",50),t.ɵɵpipe(21,"translate"),t.ɵɵtext(22),t.ɵɵpipe(23,"translate"),t.ɵɵelementEnd()()()()}if(2&e){const e=t.ɵɵnextContext(2).$implicit,n=t.ɵɵnextContext(2);t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,7,"gateway.method-name")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("methodRPC").hasError("required")&&e.get("methodRPC").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(12,11,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(21,13,"gateway.hints.socket.with-response")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(23,15,"gateway.rpc.withResponse")," ")}}function RQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 BQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 NQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),t.ɵɵpipe(1,"translate"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e&&t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,"gateway.request-expression-required"))}function LQ(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/request-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,wQ))}function VQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),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 qQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 GQ(e,n){1&e&&t.ɵɵelement(0,"div",34),2&e&&t.ɵɵproperty("tb-help-popup","widget/lib/gateway/attribute-name-expression_fn")("tb-help-popup-style",t.ɵɵpureFunction0(2,wQ))}function zQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.type "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",52),t.ɵɵtemplate(8,RQ,3,4,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",53)(14,"mat-form-field",29)(15,"mat-select",54),t.ɵɵtemplate(16,BQ,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(17,"mat-form-field",29),t.ɵɵelement(18,"input",55),t.ɵɵpipe(19,"translate"),t.ɵɵtemplate(20,NQ,3,3,"mat-icon",31)(21,LQ,1,3,"div",56),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"div",26)(23,"div",43),t.ɵɵtext(24),t.ɵɵpipe(25,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(26,"div",53)(27,"mat-form-field",29)(28,"mat-select",57),t.ɵɵtemplate(29,VQ,3,4,"mat-option",47),t.ɵɵelementEnd()(),t.ɵɵelementStart(30,"mat-form-field",29),t.ɵɵelement(31,"input",58),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,qQ,3,3,"mat-icon",31)(34,GQ,1,3,"div",56),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,12,"gateway.hints.socket.attribute-requests-type")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.requestsType),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,14,"gateway.request-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,16,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("requestExpression").hasError("required")&&e.get("requestExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("requestExpressionSource").value===n.ExpressionType.Expression),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(25,18,"gateway.attribute-name-expression")," "),t.ɵɵadvance(5),t.ɵɵproperty("ngForOf",n.expressionType),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,20,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeNameExpression").hasError("required")&&e.get("attributeNameExpression").touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.get("attributeNameExpressionSource").value===n.ExpressionType.Expression)}}function UQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",51),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function jQ(e,n){1&e&&(t.ɵɵelementStart(0,"mat-icon",41),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 HQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3)(1,"div",26)(2,"div",45),t.ɵɵpipe(3,"translate"),t.ɵɵtext(4," gateway.encoding "),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",28)(6,"mat-form-field",29)(7,"mat-select",46),t.ɵɵtemplate(8,UQ,2,2,"mat-option",47),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(9,"div",26)(10,"div",43),t.ɵɵtext(11),t.ɵɵpipe(12,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(13,"div",28)(14,"mat-form-field",29),t.ɵɵelement(15,"input",59),t.ɵɵpipe(16,"translate"),t.ɵɵtemplate(17,jQ,3,3,"mat-icon",31),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,5,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(12,7,"gateway.attribute-on-platform")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(16,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.get("attributeOnThingsBoard").hasError("required")&&e.get("attributeOnThingsBoard").touched)}}function WQ(e,n){if(1&e&&t.ɵɵtemplate(0,DQ,37,27,"div",23)(1,FQ,24,17,"div",23)(2,zQ,35,22,"div",23)(3,HQ,18,11,"div",23),2&e){const e=t.ɵɵnextContext(3);t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.TIMESERIES||e.keysType===e.SocketValueKey.ATTRIBUTES),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.RPC_METHODS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_REQUESTS),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.keysType===e.SocketValueKey.ATTRIBUTES_UPDATES)}}function $Q(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12)(1,"div",13),t.ɵɵelementContainerStart(2,14),t.ɵɵelementStart(3,"mat-expansion-panel",15)(4,"mat-expansion-panel-header",16)(5,"mat-panel-title"),t.ɵɵtemplate(6,SQ,2,1,"div",17)(7,IQ,4,4,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,WQ,4,4,"ng-template",18),t.ɵɵelementEnd(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"button",19),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.last,a=t.ɵɵreference(8),r=t.ɵɵnextContext(2);t.ɵɵadvance(2),t.ɵɵproperty("formGroup",e),t.ɵɵadvance(),t.ɵɵproperty("expanded",i),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",r.keysType===r.SocketValueKey.TIMESERIES||r.keysType===r.SocketValueKey.ATTRIBUTES)("ngIfElse",a),t.ɵɵadvance(4),t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(11,5,r.deleteKeyTitle))}}function KQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",10),t.ɵɵtemplate(1,$Q,14,7,"div",11),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.keysListFormArray.controls)("ngForTrackBy",e.trackByKey)}}function YQ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",60)(1,"span",61),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.noKeysText)}}class XQ extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=new u,this.SocketValueKey=li,this.socketEncoding=Object.values(mt),this.requestsType=Object.values(ci),this.expressionType=Object.values(di),this.ExpressionType=di,this.ReportStrategyDefaultValue=en}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}trackByKey(e,t){return t}addKey(){let e;e=this.keysType===li.RPC_METHODS?this.fb.group({methodRPC:["",[$.required]],encoding:[mt.UTF16,[$.required]],withResponse:[!0]}):this.keysType===li.ATTRIBUTES_UPDATES?this.fb.group({encoding:[mt.UTF16,[$.required]],attributeOnThingsBoard:["",[$.required]]}):this.keysType===li.ATTRIBUTES_REQUESTS?this.fb.group({type:[ci.Shared],requestExpressionSource:[di.Constant],attributeNameExpressionSource:[di.Constant],requestExpression:["",[$.required]],attributeNameExpression:["",[$.required]]}):this.fb.group({key:["",[$.required,$.pattern(an)]],byteFrom:[0,[$.required]],byteTo:[0,[$.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===li.RPC_METHODS){const t=e;n=this.fb.group({methodRPC:[t.methodRPC,[$.required]],encoding:[t.encoding,[$.required]],withResponse:[t.withResponse]})}else if(this.keysType===li.ATTRIBUTES_REQUESTS){const t=e;n=this.fb.group({type:[t.type??ci.Shared],requestExpressionSource:[t.requestExpressionSource??di.Constant],attributeNameExpressionSource:[t.attributeNameExpressionSource??di.Constant],requestExpression:[t.requestExpression,[$.required]],attributeNameExpression:[t.attributeNameExpression,[$.required]]})}else if(this.keysType===li.ATTRIBUTES_UPDATES)n=this.fb.group({encoding:[e.encoding??mt.UTF16],attributeOnThingsBoard:[e.attributeOnThingsBoard,[$.required]]});else{const{key:t,byteFrom:i,byteTo:a,reportStrategy:r}=e;n=this.fb.group({key:[t,[$.required,$.pattern(an)]],byteFrom:[i??0,[$.required]],byteTo:[a??0,[$.required]],reportStrategy:[{value:r,disabled:this.isReportStrategyDisabled()}]})}t.push(n)})),this.fb.array(t)}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keysType===li.ATTRIBUTES||this.keysType===li.TIMESERIES))}static{this.ɵfac=function(e){return new(e||XQ)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(it.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:XQ,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:19,vars:16,consts:[["noKeys",""],["valueTitle",""],[1,"tb-device-keys-panel"],[1,"tb-form-panel","no-border","no-padding"],[1,"tb-form-panel-title"],["class","tb-form-panel no-border no-padding key-panel",4,"ngIf","ngIfElse"],["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","key-panel"],["class","tb-form-panel no-border no-padding tb-flex no-flex row center fill-width",4,"ngFor","ngForOf","ngForTrackBy"],[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"],["class","title-container",4,"ngIf","ngIfElse"],["matExpansionPanelContent",""],["type","button","mat-icon-button","","matTooltipPosition","above",3,"click","matTooltip"],[1,"title-container"],[1,"title-container",3,"ngSwitch"],[4,"ngSwitchCase"],["class","tb-form-panel no-border no-padding",4,"ngIf"],[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","class","tb-error",3,"matTooltip",4,"ngIf"],[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",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["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",4,"ngFor","ngForOf"],[1,"tb-form-row"],["formControlName","withResponse",1,"mat-slide",3,"click"],[3,"tb-hint-tooltip-icon"],[3,"value"],["formControlName","type"],[1,"tb-flex"],["formControlName","requestExpressionSource"],["matInput","","name","value","formControlName","requestExpression",3,"placeholder"],["matSuffix","","class","see-example p-1","tb-help-popup-placement","left",3,"tb-help-popup","tb-help-popup-style",4,"ngIf"],["formControlName","attributeNameExpressionSource"],["matInput","","name","value","formControlName","attributeNameExpression",3,"placeholder"],["matInput","","name","value","formControlName","attributeOnThingsBoard",3,"placeholder"],[1,"tb-flex","no-flex","center","align-center","key-panel"],["translate","",1,"tb-prompt"]],template:function(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",2)(1,"div",3)(2,"div",4),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(5,KQ,2,2,"div",5),t.ɵɵelementStart(6,"div")(7,"button",6),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.addKey())})),t.ɵɵtext(8),t.ɵɵpipe(9,"translate"),t.ɵɵelementEnd()()(),t.ɵɵtemplate(10,YQ,3,1,"ng-template",null,0,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(12,"div",7)(13,"button",8),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(14),t.ɵɵpipe(15,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(16,"button",9),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.applyKeysData())})),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()()}if(2&e){const e=t.ɵɵreference(11);t.ɵɵadvance(3),t.ɵɵtextInterpolate2("",t.ɵɵpipeBind1(4,8,n.panelTitle),""," ("+n.keysListFormArray.controls.length+")"," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.keysListFormArray.controls.length)("ngIfElse",e),t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(9,10,n.addKeyTitle)," "),t.ɵɵadvance(6),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(15,12,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.keysListFormArray.invalid||!n.keysListFormArray.dirty),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,14,"action.apply")," ")}},dependencies:t.ɵɵgetComponentDepsFactory(XQ,[j,_,Xn]),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",XQ),Ge([I()],XQ.prototype,"withReportStrategy",void 0);const ZQ=()=>({maxWidth:"970px"});function QQ(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.address-filter-required"))}function JQ(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-required"))}function eJ(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-profile-required"))}function tJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",41),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",e.toUpperCase()," ")}}function nJ(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 iJ(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 aJ(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 rJ(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 oJ(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 sJ(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 lJ extends A{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:["",[$.required,$.pattern(an)]],deviceName:["",[$.required,$.pattern(an)]],deviceType:["",[$.required,$.pattern(an)]],encoding:[mt.UTF8],telemetry:[[]],attributes:[[]],attributeRequests:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.SocketValueKey=li,this.socketDeviceHelpLink=O+"/docs/iot-gateway/config/socket/#device-subsection",this.socketEncoding=Object.values(mt),this.ReportStrategyDefaultValue=en,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:pi.get(n),addKeyTitle:ui.get(n),deleteKeyTitle:mi.get(n),noKeysText:hi.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,XQ,"leftBottom",!1,null,r,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(bn(this.destroyRef)).subscribe((e=>{this.popoverComponent.hide(),a.patchValue(e),a.markAsDirty(),this.cdr.markForCheck()})),this.popoverComponent.tbHideStart.pipe(bn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||lJ)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:lJ,selectors:[["tb-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:119,vars:57,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","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"],["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",4,"ngFor","ngForOf"],["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"],[4,"ngFor","ngForOf"],[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"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],[3,"value"]],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,QQ,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,JQ,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,eJ,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.ɵɵtemplate(45,tJ,2,2,"mat-option",26),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(46,nJ,1,2,"tb-report-strategy",27),t.ɵɵelementStart(47,"div",28)(48,"div",29),t.ɵɵtext(49,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(50,"div",30)(51,"mat-chip-listbox",31),t.ɵɵtemplate(52,iJ,2,1,"mat-chip",32),t.ɵɵelementStart(53,"mat-chip",33),t.ɵɵelement(54,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(55,"button",35,0),t.ɵɵpipe(57,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(56);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.TIMESERIES))})),t.ɵɵelementStart(58,"tb-icon",36),t.ɵɵtext(59,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(60,"div",28)(61,"div",29),t.ɵɵtext(62,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(63,"div",30)(64,"mat-chip-listbox",31),t.ɵɵtemplate(65,aJ,2,1,"mat-chip",32),t.ɵɵelementStart(66,"mat-chip",33),t.ɵɵelement(67,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(68,"button",35,1),t.ɵɵpipe(70,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(69);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES))})),t.ɵɵelementStart(71,"tb-icon",36),t.ɵɵtext(72,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(73,"div",28)(74,"div",29),t.ɵɵtext(75,"gateway.attribute-requests"),t.ɵɵelementEnd(),t.ɵɵelementStart(76,"div",30)(77,"mat-chip-listbox",31),t.ɵɵtemplate(78,rJ,2,1,"mat-chip",32),t.ɵɵelementStart(79,"mat-chip",33),t.ɵɵelement(80,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(81,"button",35,2),t.ɵɵpipe(83,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(82);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.ATTRIBUTES_REQUESTS))})),t.ɵɵelementStart(84,"tb-icon",36),t.ɵɵtext(85,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(86,"div",28)(87,"div",29),t.ɵɵtext(88,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(89,"div",30)(90,"mat-chip-listbox",31),t.ɵɵtemplate(91,oJ,2,1,"mat-chip",32),t.ɵɵelementStart(92,"mat-chip",33),t.ɵɵelement(93,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(94,"button",35,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.SocketValueKey.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(97,"tb-icon",36),t.ɵɵtext(98,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(99,"div",28)(100,"div",29),t.ɵɵtext(101,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(102,"div",30)(103,"mat-chip-listbox",31),t.ɵɵtemplate(104,sJ,2,1,"mat-chip",32),t.ɵɵelementStart(105,"mat-chip",33),t.ɵɵelement(106,"label",34),t.ɵɵelementEnd()(),t.ɵɵelementStart(107,"button",35,4),t.ɵɵpipe(109,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(108);return t.ɵɵresetView(n.manageKeys(i,a,n.SocketValueKey.RPC_METHODS))})),t.ɵɵelementStart(110,"tb-icon",36),t.ɵɵtext(111,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(112,"div",37)(113,"button",38),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(114),t.ɵɵpipe(115,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(116,"button",39),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(117),t.ɵɵpipe(118,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,32,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.socketDeviceHelpLink),t.ɵɵadvance(12),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(19,34,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("address").hasError("required")&&n.deviceFormGroup.get("address").touched),t.ɵɵadvance(),t.ɵɵproperty("tb-help-popup","widget/lib/gateway/address-filter_fn")("tb-help-popup-style",t.ɵɵpureFunction0(56,ZQ)),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(28,36,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceName").hasError("required")&&n.deviceFormGroup.get("deviceName").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(36,38,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.deviceFormGroup.get("deviceType").hasError("required")&&n.deviceFormGroup.get("deviceType").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(40,40,"gateway.hints.encoding")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.socketEncoding),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?46:-1),t.ɵɵadvance(5),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("telemetry").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(57,42,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributes").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,44,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeRequests").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(83,46,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("attributeUpdates").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(96,48,"action.edit")),t.ɵɵadvance(9),t.ɵɵproperty("tbEllipsisChipList",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.deviceFormGroup.get("serverSideRpc").value),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(109,50,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(115,52,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(118,54,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(lJ,[j,_,Gn,Xn]),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",lJ);const pJ=["searchInput"],cJ=()=>["address","deviceName","actions"],dJ=()=>({minWidth:"96px",textAlign:"center"});function uJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 mJ(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 hJ(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 gJ(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 fJ(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 yJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function vJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 xJ(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,vJ,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,dJ)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function bJ(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function wJ(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class SJ{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 te,this.devicesFormGroup=this.fb.array([]),this.dataSource=new CJ}ngOnInit(){this.devicesFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.updateTableData(e),this.onChange(e)}))}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngAfterViewInit(){this.textSearch.valueChanges.pipe(de(150),ce(((e,t)=>(e??"")===t.trim())),le(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=ke(t),i=n?this.devicesFormGroup.at(t).value:{};this.getDeviceDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(n?this.devicesFormGroup.at(t).patchValue(e):this.devicesFormGroup.push(this.fb.control(e)),this.devicesFormGroup.markAsDirty())}))}validate(){return this.devicesFormGroup.controls.length?null:{devicesFormGroup:{valid:!1}}}getDeviceDialog(e,t){return this.dialog.open(lJ,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{value:e,buttonTitle:t,withReportStrategy:this.withReportStrategy}})}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:this.devicesFormGroup.controls[t].value.deviceName}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),le(this.destroy$)).subscribe((e=>{e&&(this.devicesFormGroup.removeAt(t),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||SJ)(t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:SJ,selectors:[["tb-devices-config-table"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(pJ,5),2&e){let e;t.ɵɵqueryRefresh(e=t.ɵɵloadQuery())&&(n.searchInputField=e.first)}},inputs:{withReportStrategy:"withReportStrategy"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>SJ)),multi:!0},{provide:K,useExisting:c((()=>SJ)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,uJ,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,mJ,3,3,"mat-header-cell",15)(25,hJ,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,gJ,4,3,"mat-header-cell",15)(28,fJ,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,17),t.ɵɵtemplate(30,yJ,1,0,"mat-header-cell",18)(31,xJ,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(32,bJ,1,0,"mat-header-row",20)(33,wJ,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(34,"section",22),t.ɵɵpipe(35,"async"),t.ɵɵelementStart(36,"button",23),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(37,"mat-icon",24),t.ɵɵtext(38,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(39,"span"),t.ɵɵtext(40),t.ɵɵpipe(41,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(42,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,20,n.dataSource.isEmpty())),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,cJ))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,cJ)),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(SJ,[j,_,qn]),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",SJ),Ge([I()],SJ.prototype,"withReportStrategy",void 0);let CJ=class extends G{constructor(){super()}};function _J(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",14),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function TJ(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.address-required"))}function IJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",15),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 EJ(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.socketConfigFormGroup.get("bufferSize").hasError("min")?"gateway.buffer-size-range":"gateway.buffer-size-required"))}}e("DevicesDatasource",CJ);class MJ{constructor(e){this.fb=e,this.portLimits=Ii,this.socketTypes=Object.values(si),this.onChange=e=>{},this.destroy$=new te,this.socketConfigFormGroup=this.fb.group({address:["",[$.required,$.pattern(an)]],type:[si.TCP],port:[5e4,[$.required,$.min(Ii.MIN),$.max(Ii.MAX)]],bufferSize:[1024,[$.required,$.min(1),$.pattern(an)]]}),this.socketConfigFormGroup.valueChanges.pipe(le(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=si.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||MJ)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:MJ,selectors:[["tb-socket-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>MJ)),multi:!0},{provide:K,useExisting:c((()=>MJ)),multi:!0}]),t.ɵɵStandaloneFeature],decls:34,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"],["tbTruncateWithTooltip",""],["formControlName","type","appearance","fill"],[3,"value",4,"ngFor","ngForOf"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["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"],[3,"value"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"]],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.ɵɵtemplate(7,_J,2,2,"tb-toggle-option",5),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"div",1)(9,"div",6),t.ɵɵtext(10,"gateway.address"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"div",7)(12,"mat-form-field",8),t.ɵɵelement(13,"input",9),t.ɵɵpipe(14,"translate"),t.ɵɵtemplate(15,TJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",1)(17,"div",6),t.ɵɵtext(18,"gateway.port"),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",7)(20,"mat-form-field",8),t.ɵɵelement(21,"input",11),t.ɵɵpipe(22,"translate"),t.ɵɵtemplate(23,IJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()(),t.ɵɵelementStart(24,"div",1)(25,"div",12),t.ɵɵpipe(26,"translate"),t.ɵɵtext(27),t.ɵɵpipe(28,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(29,"div",7)(30,"mat-form-field",8),t.ɵɵelement(31,"input",13),t.ɵɵpipe(32,"translate"),t.ɵɵtemplate(33,EJ,3,3,"mat-icon",10),t.ɵɵelementEnd()()()()),2&e&&(t.ɵɵproperty("formGroup",n.socketConfigFormGroup),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,13,"gateway.connection-type")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",n.socketTypes),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(14,15,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("address").hasError("required")&&n.socketConfigFormGroup.get("address").touched),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(22,17,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(n.socketConfigFormGroup.get("port").hasError("required")||n.socketConfigFormGroup.get("port").hasError("min")||n.socketConfigFormGroup.get("port").hasError("max"))&&n.socketConfigFormGroup.get("port").touched),t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,19,"gateway.hints.buffer-size")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(28,21,"gateway.buffer-size")," "),t.ɵɵadvance(4),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(32,23,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.socketConfigFormGroup.get("bufferSize").hasError("required")||n.socketConfigFormGroup.get("bufferSize").hasError("min")&&n.socketConfigFormGroup.get("bufferSize").touched))},dependencies:t.ɵɵgetComponentDepsFactory(MJ,[j,_,r$,qn]),encapsulation:2,changeDetection:d.OnPush})}}e("SocketConfigComponent",MJ);class kJ extends Ba{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(kJ)))(n||kJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:kJ,selectors:[["tb-socket-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>kJ)),multi:!0},{provide:K,useExisting:c((()=>kJ)),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(kJ,[j,_,MJ,SJ]),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",kJ);class PJ extends Ba{constructor(){super(...arguments),this.isLegacy=!0}getMappedValue(e){return Ha.mapSocketToDowngradedVersion(e)}initBasicFormGroup(){return this.fb.group({socket:[],devices:[]})}mapConfigToFormValue(e){return{socket:Ha.mapSocketToUpgradedVersion(e),devices:e?.devices?Ha.mapDevicesToUpgradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(PJ)))(n||PJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:PJ,selectors:[["tb-socket-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>PJ)),multi:!0},{provide:K,useExisting:c((()=>PJ)),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(PJ,[j,_,MJ,SJ]),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 DJ(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 OJ(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 AJ(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 FJ(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 RJ(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 BJ(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",PJ);class NJ extends Ra{constructor(){super(...arguments),this.segmentationTypes=Object.values(fa),this.SegmentationTypeTranslationsMap=ya,this.portLimits=Ii}get applicationConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({objectName:["",[$.required,$.pattern(an)]],host:["",[$.required,$.pattern(an)]],port:[null,[$.required,$.min(Ii.MIN),$.max(Ii.MAX)]],mask:[""],objectIdentifier:[null,[$.required]],vendorIdentifier:[null,[$.required]],maxApduLengthAccepted:[],segmentationSupported:[fa.BOTH],networkNumber:[],deviceDiscoveryTimeoutInSec:[]})}mapOnChangeValue(e){return Te(e),e}onWriteValue(e){const{maxApduLengthAccepted:t=1476,segmentationSupported:n=fa.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(NJ)))(n||NJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:NJ,selectors:[["tb-bacnet-application-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>NJ)),multi:!0},{provide:K,useExisting:c((()=>NJ)),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,DJ,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,OJ,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,AJ,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,FJ,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,RJ,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,BJ,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(NJ,[j,_,r$]),encapsulation:2,changeDetection:d.OnPush})}}function LJ(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 VJ(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,LJ,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 qJ(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 GJ(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,qJ,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 zJ(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 UJ(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,zJ,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 jJ(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 HJ(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 WJ(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 $J(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 KJ(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 YJ extends Ra{constructor(){super(...arguments),this.withReportStrategy=!0,this.propertyIds=Ia.get(Ca.analogOutput),this.objectTypes=Object.values(Ca),this.requestTypes=Object.values(Ma),this.ReportStrategyDefaultValue=en,this.BacnetDeviceKeysType=va,this.BacnetKeyObjectTypeTranslationsMap=_a,this.BacnetPropertyIdTranslationsMap=Ea,this.BacnetRequestTypeTranslationsMap=ka}ngOnInit(){this.formGroup=this.initKeyFormGroup(),this.observeValueChanges(),this.observeObjectType()}isReportStrategyDisabled(){return!(this.withReportStrategy&&(this.keyType===va.ATTRIBUTES||this.keyType===va.TIMESERIES))}initKeyFormGroup(){return this.fb.group({key:[{value:"",disabled:this.keyType===va.RPC_METHODS},[$.required,$.pattern(an)]],method:[{value:"",disabled:this.keyType!==va.RPC_METHODS},[$.required,$.pattern(an)]],objectType:[Ca.analogOutput],objectId:[0,[$.required]],propertyId:[Ta.presentValue],requestTimeout:[{value:0,disabled:this.keyType!==va.RPC_METHODS}],requestType:[{value:Ma.Write,disabled:this.keyType!==va.RPC_METHODS}],reportStrategy:[{value:null,disabled:this.isReportStrategyDisabled()}]})}observeObjectType(){this.formGroup.get("objectType").valueChanges.pipe(bn(this.destroyRef)).subscribe((e=>{this.propertyIds=Ia.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(YJ)))(n||YJ)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:YJ,selectors:[["tb-bacnet-device-data-key"]],inputs:{keyType:"keyType",withReportStrategy:[2,"withReportStrategy","withReportStrategy",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>YJ)),multi:!0},{provide:K,useExisting:c((()=>YJ)),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,VJ,10,12)(6,GJ,9,10),t.ɵɵelementEnd()(),t.ɵɵelementStart(7,"div",1)(8,"div",2),t.ɵɵtext(9,"gateway.connector-side"),t.ɵɵelementEnd(),t.ɵɵtemplate(10,UJ,9,6,"div",3)(11,jJ,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,HJ,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,WJ,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,$J,3,4,"mat-option",8,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()()(),t.ɵɵtemplate(34,KJ,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(YJ,[j,_,Xn]),encapsulation:2,changeDetection:d.OnPush})}}function XJ(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 ZJ(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,XJ,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 QJ(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,ZJ,13,6,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function JJ(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 e1 extends q{constructor(e,t,n){super(n),this.fb=e,this.popover=t,this.store=n,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=en}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||e1)(t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(it.TbPopoverComponent),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:e1,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,QJ,3,0,"div",3)(6,JJ,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(e1,[j,_,YJ]),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 t1(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 n1(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",16),t.ɵɵpipe(1,"getGatewayPortTooltip"),t.ɵɵtext(2," warning "),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("matTooltip",t.ɵɵpipeBind1(1,1,e.deviceFormGroup.get("port")))}}function i1(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",12)(1,"mat-expansion-panel",34)(2,"mat-expansion-panel-header")(3,"mat-panel-title")(4,"div",35),t.ɵɵtext(5,"gateway.advanced-configuration-settings"),t.ɵɵelementEnd()()(),t.ɵɵelement(6,"tb-string-items-list",36),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 a1(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",19),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Device)}}function r1(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 o1(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 s1(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 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.method," ")}}class c1 extends A{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:["",[$.required,$.pattern(an)]],port:["",[$.required,$.min(Ii.MIN),$.max(Ii.MAX)]],deviceInfo:[],altResponsesAddresses:[{value:[],disabled:this.data.hideNewFields}],pollPeriod:[1e4,[$.required,$.min(0)]],timeseries:[[]],attributes:[[]],attributeUpdates:[[]],serverSideRpc:[[]],reportStrategy:[{value:null,disabled:!this.data.withReportStrategy}]}),this.keysPopupClosed=!0,this.BacnetDeviceKeysType=va,this.DeviceInfoType=ga,this.portLimits=Ii,this.deviceHelpLink=O+"/docs/iot-gateway/config/bacnet/#device-object-settings",this.sourceTypes=Object.values(di),this.ConnectorType=ct,this.ReportStrategyDefaultValue=en,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:xa.get(n),addKeyTitle:ba.get(n),deleteKeyTitle:wa.get(n),noKeysText:Sa.get(n),withReportStrategy:this.data.withReportStrategy};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,e1,"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(bn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}static{this.ɵfac=function(e){return new(e||c1)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:c1,selectors:[["tb-bacnet-device-dialog"]],standalone:!0,features:[t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:100,vars:47,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","","type","number","name","value","formControlName","port",3,"min","max","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"],["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"],[1,"tb-settings","chips-panel","w-full"],["translate","",1,"tb-form-panel-title"],["editable","","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,t1,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,n1,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵtemplate(26,i1,9,6,"div",12),t.ɵɵelement(27,"tb-device-info-table",18),t.ɵɵtemplate(28,a1,1,2,"tb-report-strategy",19),t.ɵɵelementStart(29,"div",12)(30,"div",20)(31,"span",21),t.ɵɵtext(32,"gateway.poll-period"),t.ɵɵelementEnd()(),t.ɵɵelementStart(33,"mat-form-field",14),t.ɵɵelement(34,"input",22),t.ɵɵpipe(35,"translate"),t.ɵɵtemplate(36,r1,3,3,"mat-icon",16),t.ɵɵelementEnd()(),t.ɵɵelementStart(37,"div",23)(38,"div",24),t.ɵɵtext(39,"gateway.attributes"),t.ɵɵelementEnd(),t.ɵɵelementStart(40,"div",25)(41,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(42,o1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(44,"mat-chip",27),t.ɵɵelement(45,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"button",29,0),t.ɵɵpipe(48,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(47);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES))})),t.ɵɵelementStart(49,"tb-icon",30),t.ɵɵtext(50,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(51,"div",23)(52,"div",24),t.ɵɵtext(53,"gateway.timeseries"),t.ɵɵelementEnd(),t.ɵɵelementStart(54,"div",25)(55,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(56,s1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(58,"mat-chip",27),t.ɵɵelement(59,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(60,"button",29,1),t.ɵɵpipe(62,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(61);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.TIMESERIES))})),t.ɵɵelementStart(63,"tb-icon",30),t.ɵɵtext(64,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(65,"div",23)(66,"div",24),t.ɵɵtext(67,"gateway.attribute-updates"),t.ɵɵelementEnd(),t.ɵɵelementStart(68,"div",25)(69,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(70,l1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(72,"mat-chip",27),t.ɵɵelement(73,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(74,"button",29,2),t.ɵɵpipe(76,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(75);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.ATTRIBUTES_UPDATES))})),t.ɵɵelementStart(77,"tb-icon",30),t.ɵɵtext(78,"edit"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(79,"div",23)(80,"div",24),t.ɵɵtext(81,"gateway.rpc-methods"),t.ɵɵelementEnd(),t.ɵɵelementStart(82,"div",25)(83,"mat-chip-listbox",26),t.ɵɵrepeaterCreate(84,p1,2,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(86,"mat-chip",27),t.ɵɵelement(87,"label",28),t.ɵɵelementEnd()(),t.ɵɵelementStart(88,"button",29,3),t.ɵɵpipe(90,"translate"),t.ɵɵlistener("click",(function(i){t.ɵɵrestoreView(e);const a=t.ɵɵreference(89);return t.ɵɵresetView(n.manageKeys(i,a,n.BacnetDeviceKeysType.RPC_METHODS))})),t.ɵɵelementStart(91,"tb-icon",30),t.ɵɵtext(92,"edit"),t.ɵɵelementEnd()()()()()(),t.ɵɵelementStart(93,"div",31)(94,"button",32),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.cancel())})),t.ɵɵtext(95),t.ɵɵpipe(96,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(97,"button",33),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.add())})),t.ɵɵtext(98),t.ɵɵpipe(99,"translate"),t.ɵɵelementEnd()()()}2&e&&(t.ɵɵproperty("formGroup",n.deviceFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,27,"gateway.device")),t.ɵɵadvance(3),t.ɵɵproperty("tb-help",n.deviceHelpLink),t.ɵɵadvance(10),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(17,29,"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("min",n.portLimits.MIN),t.ɵɵpropertyInterpolate("max",n.portLimits.MAX),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(24,31,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional((n.deviceFormGroup.get("port").hasError("required")||n.deviceFormGroup.get("port").hasError("min")||n.deviceFormGroup.get("port").hasError("max"))&&n.deviceFormGroup.get("port").touched?25:-1),t.ɵɵadvance(),t.ɵɵconditional(n.data.hideNewFields?-1:26),t.ɵɵadvance(),t.ɵɵproperty("deviceInfoType",n.DeviceInfoType.FULL)("sourceTypes",n.sourceTypes)("connectorType",n.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵconditional(n.data.withReportStrategy?28:-1),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(35,33,"gateway.set")),t.ɵɵadvance(2),t.ɵɵconditional(n.deviceFormGroup.get("pollPeriod").hasError("required")&&n.deviceFormGroup.get("pollPeriod").touched?36:-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(48,35,"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(62,37,"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(76,39,"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(90,41,"action.edit")),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(96,43,"action.cancel")," "),t.ɵɵadvance(2),t.ɵɵproperty("disabled",n.deviceFormGroup.invalid||!n.deviceFormGroup.dirty||!n.keysPopupClosed),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(99,45,n.data.buttonTitle)," "))},dependencies:t.ɵɵgetComponentDepsFactory(c1,[j,_,Gn,qn,r$,I$,Xn]),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 d1=()=>["deviceName","host","port","actions"],u1=()=>({minWidth:"96px",textAlign:"center"});function m1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",26)(2,"span",27),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelement(5,"span",9),t.ɵɵelementStart(6,"button",11),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",11),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 h1(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 g1(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 f1(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 y1(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 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.port")," "))}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.port)}}function b1(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",30)}function w1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",11),t.ɵɵpipe(1,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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",11),t.ɵɵpipe(5,"translate"),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext().index,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 S1(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,w1,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,u1)),t.ɵɵadvance(),t.ɵɵproperty("ngTemplateOutlet",e),t.ɵɵadvance(2),t.ɵɵproperty("matMenuTriggerFor",n),t.ɵɵadvance(5),t.ɵɵproperty("ngTemplateOutlet",e)}}function C1(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",37)}function _1(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class T1 extends qa{constructor(){super(...arguments),this.hideNewFields=!1}getDatasource(){return new I1}manageDevices(e,t){e&&e.stopPropagation();const n=ke(t),i=n?this.entityFormArray.at(t).value:{};this.getDeviceDialog(i,n?"action.apply":"action.add").afterClosed().pipe(ye(1),bn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):this.entityFormArray.push(this.fb.control(e)),this.entityFormArray.markAsDirty())}))}deleteDevice(e,t){e&&e.stopPropagation(),this.dialogService.confirm(this.translate.instant("gateway.delete-device-title",{name:this.entityFormArray.controls[t].value.deviceInfo?.deviceNameExpression}),this.translate.instant("gateway.delete-device-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(ye(1),bn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),this.entityFormArray.markAsDirty())}))}getDeviceDialog(e,t){return this.dialog.open(c1,{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(T1)))(n||T1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:T1,selectors:[["tb-bacnet-devices-config-table"]],inputs:{hideNewFields:[2,"hideNewFields","hideNewFields",m]},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>T1)),multi:!0},{provide:K,useExisting:c((()=>T1)),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"],["class","mat-toolbar-tools",4,"ngIf"],[1,"mat-toolbar-tools"],["mat-icon-button","","matTooltipPosition","above",3,"matTooltip"],[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,"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,m1,14,9,"div",6),t.ɵɵpipe(4,"async"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"mat-toolbar",5)(6,"div",7)(7,"button",8),t.ɵɵpipe(8,"translate"),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"search"),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",9)(12,"mat-label"),t.ɵɵtext(13," "),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",10,0),t.ɵɵpipe(16,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"button",11),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",12)(22,"table",13),t.ɵɵelementContainerStart(23,14),t.ɵɵtemplate(24,h1,4,3,"mat-header-cell",15)(25,g1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(26,14),t.ɵɵtemplate(27,f1,3,3,"mat-header-cell",15)(28,y1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(29,14),t.ɵɵtemplate(30,v1,3,3,"mat-header-cell",15)(31,x1,3,1,"mat-cell",16),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(32,17),t.ɵɵtemplate(33,b1,1,0,"mat-header-cell",18)(34,S1,12,6,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(35,C1,1,0,"mat-header-row",20)(36,_1,1,0,"mat-row",21),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"section",22),t.ɵɵpipe(38,"async"),t.ɵɵelementStart(39,"button",23),t.ɵɵlistener("click",(function(i){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.manageDevices(i))})),t.ɵɵelementStart(40,"mat-icon",24),t.ɵɵtext(41,"add"),t.ɵɵelementEnd(),t.ɵɵelementStart(42,"span"),t.ɵɵtext(43),t.ɵɵpipe(44,"translate"),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(45,"span",25),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.ɵɵproperty("ngIf",!1===t.ɵɵpipeBind1(4,21,n.dataSource.isEmpty())),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,d1))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,d1)),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(T1,[j,_,qn]),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 I1 extends G{constructor(){super()}}class E1 extends Ba{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(E1)))(n||E1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:E1,selectors:[["tb-bacnet-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>E1)),multi:!0},{provide:K,useExisting:c((()=>E1)),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(E1,[j,_,NJ,T1]),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 M1 extends Ba{constructor(){super(...arguments),this.isLegacy=!0}initBasicFormGroup(){return this.fb.group({application:[],devices:[]})}mapConfigToFormValue(e){return{application:e.general?Wa.mapApplicationToUpgradedVersion(e.general):{},devices:e.devices?.length?Wa.mapDevicesToUpgradedVersion(e.devices):[]}}getMappedValue(e){return{general:e.application?Wa.mapApplicationToDowngradedVersion(e.application):{},devices:e.devices?.length?Wa.mapDevicesToDowngradedVersion(e.devices):[]}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(M1)))(n||M1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:M1,selectors:[["tb-bacnet-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>M1)),multi:!0},{provide:K,useExisting:c((()=>M1)),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(M1,[j,_,NJ,T1]),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 k1(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 P1(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 D1 extends Ra{constructor(){super(...arguments),this.portLimits=Ii}get serverConfigFormGroup(){return this.formGroup}initFormGroup(){return this.fb.group({host:["",[$.required,$.pattern(an)]],port:[null,[$.required,$.min(Ii.MIN),$.max(Ii.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(D1)))(n||D1)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:D1,selectors:[["tb-rest-server-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>D1)),multi:!0},{provide:K,useExisting:c((()=>D1)),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,k1,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,P1,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(D1,[j,_,r$,qn,Qn]),encapsulation:2,changeDetection:d.OnPush})}}const O1=()=>({min:1});function A1(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 F1(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 R1(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 B1(e,n){if(1&e&&(t.ɵɵelementContainerStart(0,7),t.ɵɵelementStart(1,"div",8)(2,"div",9),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",10)(6,"mat-form-field",11)(7,"mat-select",12),t.ɵɵrepeaterCreate(8,F1,2,2,"mat-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(10,"div",8)(11,"div",9),t.ɵɵtext(12),t.ɵɵpipe(13,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",10)(15,"mat-form-field",11)(16,"mat-select",13),t.ɵɵrepeaterCreate(17,R1,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 N1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.response-timeout-required"))}function L1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind2(1,1,"gateway.response-timeout-limits-error",t.ɵɵpureFunction0(4,O1)))}function V1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.timeout-pattern"))}function q1(e,n){1&e&&(t.ɵɵelementStart(0,"span",18),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function G1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-required"))}function z1(e,n){1&e&&(t.ɵɵelement(0,"tb-error-icon",17),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("tooltipText",t.ɵɵpipeBind1(1,1,"gateway.hints.rest.response-attribute-pattern"))}function U1(e,n){if(1&e&&(t.ɵɵdeclareLet(0),t.ɵɵelementContainerStart(1,7),t.ɵɵelementStart(2,"div",8)(3,"mat-slide-toggle",14)(4,"mat-label"),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(7,"div",8)(8,"div",15),t.ɵɵtext(9,"gateway.timeout"),t.ɵɵelementEnd(),t.ɵɵelementStart(10,"mat-form-field",11),t.ɵɵelement(11,"input",16),t.ɵɵpipe(12,"translate"),t.ɵɵdeclareLet(13),t.ɵɵtemplate(14,N1,2,3,"tb-error-icon",17)(15,L1,2,5,"tb-error-icon",17)(16,V1,2,3,"tb-error-icon",17)(17,q1,2,0,"span",18),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",8)(19,"div",15),t.ɵɵtext(20,"gateway.rest.response-attribute"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"mat-form-field",11),t.ɵɵelement(22,"input",19),t.ɵɵpipe(23,"translate"),t.ɵɵtemplate(24,G1,2,3,"tb-error-icon",17)(25,z1,2,3,"tb-error-icon",17),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 j1 extends Ra{get responseConfigFormGroup(){return this.formGroup}constructor(){super(),this.ResponseTypeTranslationsMap=xi,this.ResponseType=yi,this.responseTypes=Object.values(yi),this.responseStatuses=Object.values(vi),this.observeIsExpected()}initFormGroup(){return this.fb.group({type:[yi.DEFAULT],[yi.CONST]:this.fb.group({successResponse:[vi.OK],unsuccessfulResponse:[vi.ERROR]}),[yi.ADVANCED]:this.fb.group({responseExpected:[!0],timeout:[null,[$.required,$.min(.001),$.pattern(nn)]],responseAttribute:["",[$.required,$.pattern(an)]]})})}mapOnChangeValue({type:e,...t}){return{type:e,...t[e]??{}}}onWriteValue(e){const{type:t=yi.DEFAULT,...n}=e??{};this.toggleIsExpected(n.responseExpected,t),this.responseConfigFormGroup.patchValue({type:t,[t]:n},{emitEvent:!1})}toggleIsExpected(e,t){const n=e&&t===yi.ADVANCED;this.responseConfigFormGroup.get(yi.ADVANCED).get("timeout")[n?"enable":"disable"]({emitEvent:!1}),this.responseConfigFormGroup.get(yi.ADVANCED).get("responseAttribute")[n?"enable":"disable"]({emitEvent:!1})}observeIsExpected(){se(this.responseConfigFormGroup.get("type").valueChanges,this.responseConfigFormGroup.get(yi.ADVANCED).get("responseExpected").valueChanges).pipe(bn()).subscribe((()=>this.toggleIsExpected(this.responseConfigFormGroup.get(yi.ADVANCED).get("responseExpected").value,this.responseConfigFormGroup.get("type").value)))}static{this.ɵfac=function(e){return new(e||j1)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:j1,selectors:[["tb-rest-response-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>j1)),multi:!0},{provide:K,useExisting:c((()=>j1)),multi:!0}]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:11,vars:7,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,"ngSwitch"],[3,"ngSwitchCase"],[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){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,A1,3,4,"tb-toggle-option",4,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()(),t.ɵɵelementContainerStart(8,5),t.ɵɵtemplate(9,B1,19,7,"ng-template",6)(10,U1,26,12,"ng-template",6),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵproperty("formGroup",n.responseConfigFormGroup),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,5,"gateway.response")),t.ɵɵadvance(3),t.ɵɵrepeater(n.responseTypes),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.responseConfigFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.ResponseType.CONST),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.ResponseType.ADVANCED))},dependencies:t.ɵɵgetComponentDepsFactory(j1,[j,_,Qn]),encapsulation:2,changeDetection:d.OnPush})}}function H1(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 W1(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 $1(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 K1(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 Y1(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 X1(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 Z1(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 Q1(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,X1,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,Z1,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 J1(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 e0(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 t0(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,J1,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.ɵɵtemplate(23,e0,3,1,"mat-chip",45),t.ɵɵelementStart(24,"mat-chip",35),t.ɵɵelement(25,"label",36),t.ɵɵelementEnd()(),t.ɵɵelementStart(26,"button",37,2),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.CUSTOM))})),t.ɵɵelementStart(29,"tb-icon",38),t.ɵɵtext(30,"edit"),t.ɵɵelementEnd()()()()()()}if(2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(2),t.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(3,10,"gateway.hints.rest.extension")),t.ɵɵadvance(2),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(5,12,"gateway.extension")," "),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(8,14,"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,16,"gateway.extension-configuration")),t.ɵɵadvance(3),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(16,18,"gateway.extension-configuration-hint")),t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(20,20,"gateway.keys")),t.ɵɵadvance(3),t.ɵɵproperty("tbEllipsisChipList",e.customKeys),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",e.customKeys),t.ɵɵadvance(3),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,22,"action.edit"))}}class n0 extends A{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:["",[$.required,$.pattern(an)]],HTTPMethods:[[ht.POST],[$.required]],security:[{type:ki.ANONYMOUS}],converter:this.fb.group({type:[gi.JSON,[]],deviceInfo:[],reportStrategy:[],attributes:[[]],timeseries:[[]],extension:["",[$.required,$.pattern(an)]],extensionConfig:[]}),response:[]}),this.keysPopupClosed=!0,this.helpLink=`${O}/docs/iot-gateway/config/rest/#mapping-section`,this.httpMethods=Object.values(ht),this.converterTypes=Object.values(gi),this.restSourceTypes=Object.values(fi),this.SecurityMode=$i,this.MappingKeysType=Ni,this.DeviceInfoType=ga,this.RestConvertorTypeTranslationsMap=_i,this.RestDataConversionTranslationsMap=Ti,this.RestConverterType=gi,this.ConnectorType=ct,this.ReportStrategyDefaultValue=en,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:Li.get(n),addKeyTitle:Vi.get(n),deleteKeyTitle:qi.get(n),noKeysText:Gi.get(n),withReportStrategy:this.data.withReportStrategy,convertorType:this.converterType,connectorType:ct.REST};this.keysPopupClosed=!1,this.popoverComponent=this.popoverService.displayPopover(i,this.renderer,this.viewContainerRef,yK,"leftBottom",!1,null,t,{},{},{},!0),this.popoverComponent.tbComponentRef.instance.keysDataApplied.pipe(bn(this.destroyRef)).subscribe((t=>{this.popoverComponent.hide(),e.patchValue(t),e.markAsDirty(),this.cd.markForCheck()})),this.popoverComponent.tbHideStart.pipe(bn(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(bn(this.destroyRef)).subscribe((e=>this.toggleConverterFieldsByType(e)))}toggleConverterFieldsByType(e){const t=e===gi.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||n0)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:n0,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"],[4,"ngFor","ngForOf"]],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,H1,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,W1,2,2,"mat-option",17,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(30,$1,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,K1,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,Y1,1,2,"tb-report-strategy",27)(49,Q1,30,11,"div",28)(50,t0,31,24,"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(n0,[j,_,Gn,I$,BY,j1,Qn,Xn]),styles:['@charset "UTF-8";[_nghost-%COMP%] .device-info .fixed-title-width{min-width:0}'],changeDetection:d.OnPush})}}const i0=()=>["endpoint","httpMethods","securityType","actions"];function a0(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",8),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 r0(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.rest.endpoint")))}function o0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",32)(1,"div",31),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e.endpoint)}}function s0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",33),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.rest.http-methods")," "))}function l0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-chip")(1,"div",38),t.ɵɵtext(2),t.ɵɵelementEnd()()),2&e){const e=n.$implicit;t.ɵɵadvance(2),t.ɵɵtextInterpolate(e)}}function p0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",34)(1,"mat-chip-listbox",35),t.ɵɵrepeaterCreate(2,l0,3,1,"mat-chip",null,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementStart(4,"mat-chip",36),t.ɵɵelement(5,"label",37),t.ɵɵelementEnd()()()),2&e){const e=n.$implicit;t.ɵɵadvance(),t.ɵɵproperty("tbEllipsisChipList",e.HTTPMethods),t.ɵɵadvance(),t.ɵɵrepeater(e.HTTPMethods)}}function c0(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.security-type")," "))}function d0(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",39)(1,"div",31),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 u0(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",40)}function m0(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().index,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().index,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 h0(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,m0,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",41),t.ɵɵelementContainer(4,42),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",43)(6,"button",44),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",45),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",46,2),t.ɵɵelementContainer(11,42),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 g0(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",47)}function f0(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class y0 extends qa{getDatasource(){return new v0}manageMapping(e,t){e&&e.stopPropagation();const n=ke(t),i=n?this.entityFormArray.at(t).value:{};this.getMappingDialog(i,n?"action.apply":"action.add").afterClosed().pipe(bn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):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.entityFormArray.at(t).value.endpoint}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(bn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),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(n0,{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(y0)))(n||y0)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:y0,selectors:[["tb-rest-mapping-table"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>y0)),multi:!0},{provide:K,useExisting:c((()=>y0)),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"],[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,"!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,a0,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,r0,4,3,"mat-header-cell",14)(24,o0,3,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,s0,3,3,"mat-header-cell",16)(27,p0,6,1,"mat-cell",17),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,13),t.ɵɵtemplate(29,c0,3,3,"mat-header-cell",18)(30,d0,4,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(31,20),t.ɵɵtemplate(32,u0,1,0,"mat-header-cell",21)(33,h0,12,3,"mat-cell",22),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(34,g0,1,0,"mat-header-row",23)(35,f0,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,i0))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(36,i0)),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(y0,[j,_,qn,Gn]),styles:[".http-method-label[_ngcontent-%COMP%]{font-size:12px}"],changeDetection:d.OnPush})}}let v0=class extends G{constructor(){super()}};function x0(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 b0(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 w0(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 S0(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,b0,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,w0,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 C0(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,x0,2,1,"div",13),t.ɵɵelementEnd()(),t.ɵɵtemplate(9,S0,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 _0(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",3),t.ɵɵrepeaterCreate(1,C0,14,7,"div",9,t.ɵɵrepeaterTrackByIndex),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵrepeater(e.keysListFormArray.controls)}}function T0(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 I0 extends q{constructor(e,t){super(t),this.fb=e,this.store=t,this.withReportStrategy=!0,this.keysDataApplied=p(),this.ReportStrategyDefaultValue=en}ngOnInit(){this.keysListFormArray=this.prepareKeysFormArray(this.keys)}addKey(){this.keysListFormArray.push(this.fb.group({key:["",[$.required,$.pattern(an)]],value:["",[$.required,$.pattern(an)]]}))}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,[$.required,$.pattern(an)]],value:[e[n],[$.required,$.pattern(an)]]}))})),this.fb.array(t)}static{this.ɵfac=function(e){return new(e||I0)(t.ɵɵdirectiveInject(H.UntypedFormBuilder),t.ɵɵdirectiveInject(Ye.Store))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:I0,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,_0,3,0,"div",3)(6,T0,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(I0,[j,_]),encapsulation:2,changeDetection:d.OnPush})}}const E0=()=>({min:1}),M0=()=>({maxWidth:"970px"});function k0(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 P0(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 D0(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 O0(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 A0(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 F0(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 R0(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,P0,2,3,"tb-error-icon",22)(8,D0,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,O0,2,2,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd(),t.ɵɵtemplate(17,A0,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,F0,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 B0(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 N0(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 L0(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,B0,2,3,"tb-error-icon",22)(8,N0,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 V0(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 q0(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 G0(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,V0,2,3,"tb-error-icon",22)(8,q0,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 z0(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 U0(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 j0(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,z0,2,3,"tb-error-icon",22)(8,U0,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 H0(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 W0(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 $0(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 K0(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 Y0(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 X0(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,H0,2,3,"tb-error-icon",22)(8,W0,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,$0,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,K0,2,3,"tb-error-icon",22)(25,Y0,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 Z0(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,E0)))}function Q0(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 J0(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function e2(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,Z0,2,5,"tb-error-icon",22)(7,Q0,2,3,"tb-error-icon",22)(8,J0,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 t2(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 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.device-name-filter-pattern"))}function i2(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 a2(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 r2(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,M0))}function o2(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,t2,2,3,"tb-error-icon",22)(8,n2,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,i2,2,3,"tb-error-icon",22)(16,a2,2,3,"tb-error-icon",22)(17,r2,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 s2(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,E0)))}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.timeout-pattern"))}function p2(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}function c2(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,s2,2,5,"tb-error-icon",22)(7,l2,2,3,"tb-error-icon",22)(8,p2,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 d2(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 u2(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 m2(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,E0)))}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.timeout-pattern"))}function g2(e,n){1&e&&(t.ɵɵelementStart(0,"span",34),t.ɵɵtext(1,"gateway.suffix.s"),t.ɵɵelementEnd())}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.tries-min"))}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.tries-pattern"))}function v2(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 x2(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,u2,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,m2,2,5,"tb-error-icon",22)(29,h2,2,3,"tb-error-icon",22)(30,g2,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,f2,2,3,"tb-error-icon",22)(38,y2,2,3,"tb-error-icon",22),t.ɵɵelementEnd()(),t.ɵɵtemplate(39,v2,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 b2 extends A{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(bi),this.requestsScopeType=Object.values(Si),this.httpMethods=Object.values(ht),this.helpLink=`${O}/docs/iot-gateway/config/rest/#attribute-request-section`,this.RestRequestTypesTranslationsMap=wi,this.SecurityMode=$i,this.RestRequestType=bi,this.mappingFormGroup=this.fb.group({requestType:[bi.ATTRIBUTE_REQUEST],endpoint:["",[$.required,$.pattern(an)]],HTTPMethods:[[ht.POST],[$.required]],HTTPMethod:[ht.POST,[$.required]],type:[Si.Shared],security:[{type:ki.ANONYMOUS}],timeout:[null,[$.min(.001),$.pattern(nn)]],deviceNameExpression:["",[$.required,$.pattern(an)]],attributeNameExpression:["",[$.required,$.pattern(an)]],SSLVerify:[!1],deviceNameFilter:["",[$.required,$.pattern(an)]],methodFilter:["",[$.required,$.pattern(an)]],attributeFilter:["",[$.required,$.pattern(an)]],requestUrlExpression:[this.data.defaultRequestUrl,[$.required,$.pattern(an)]],valueExpression:["",[$.required,$.pattern(an)]],responseTimeout:[null,[$.min(.001),$.pattern(nn)]],tries:[null,[$.min(1),$.pattern(nn)]],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,I0,"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(bn(this.destroyRef)).subscribe((()=>{this.keysPopupClosed=!0}))}observeRequestTypeChange(){this.mappingFormGroup.get("requestType").valueChanges.pipe(ce(),bn(this.destroyRef)).subscribe((e=>this.toggleFieldsByRequestType(e)))}toggleFieldsByRequestType(e){this.mappingFormGroup.disable({emitEvent:!1}),Ci.get("all").forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1}))),Ci.get(e).forEach((e=>this.mappingFormGroup.get(e).enable({emitEvent:!1})))}static{this.ɵfac=function(e){return new(e||b2)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(Xe.Router),t.ɵɵdirectiveInject(Ve),t.ɵɵdirectiveInject(qe.MatDialogRef),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(at.TbPopoverService),t.ɵɵdirectiveInject(t.Renderer2),t.ɵɵdirectiveInject(t.ViewContainerRef),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:b2,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,k0,3,4,"mat-option",13,t.ɵɵrepeaterTrackByIdentity),t.ɵɵelementEnd()()(),t.ɵɵtemplate(19,R0,26,14)(20,L0,9,7,"div",9)(21,G0,9,7,"div",9)(22,j0,9,7,"div",9)(23,X0,26,17)(24,e2,9,4,"div",9)(25,o2,18,11)(26,c2,9,4,"div",9)(27,d2,6,6,"div",14),t.ɵɵelement(28,"tb-security-config",15),t.ɵɵtemplate(29,x2,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(b2,[j,_,Gn,BY,Qn]),styles:["[_nghost-%COMP%] .tb-form-row.request-url-row[_ngcontent-%COMP%]{gap:6px}"],changeDetection:d.OnPush})}}const w2=()=>["type","details","actions"],S2=()=>({});function C2(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",8),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 _2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",27)(1,"div",28),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(3,1,"gateway.type")))}function T2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29)(1,"div",28),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 I2(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.details")," "))}function E2(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,S2)).join(", ")," ")}}function M2(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.methodFilter," ")}}function k2(e,n){if(1&e&&t.ɵɵtext(0),2&e){const e=t.ɵɵnextContext().$implicit;t.ɵɵtextInterpolate1(" ",e.requestValue.endpoint," ")}}function P2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",29)(1,"div",28),t.ɵɵtemplate(2,E2,1,2)(3,M2,1,1)(4,k2,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 D2(e,n){1&e&&t.ɵɵelement(0,"mat-header-cell",31)}function O2(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().index,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().index,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 A2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell"),t.ɵɵtemplate(1,O2,8,6,"ng-template",null,1,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(3,"div",32),t.ɵɵelementContainer(4,33),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"div",34)(6,"button",35),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(7,"mat-icon",36),t.ɵɵtext(8,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(9,"mat-menu",37,2),t.ɵɵelementContainer(11,33),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 F2(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",38)}function R2(e,n){1&e&&t.ɵɵelement(0,"mat-row")}class B2 extends qa{constructor(){super(...arguments),this.Object=Object,this.RestRequestTypesTranslationsMap=wi}getDatasource(){return new N2}manageMapping(e,t){e&&e.stopPropagation();const n=ke(t),{requestType:i=bi.ATTRIBUTE_REQUEST,requestValue:a={}}=n?this.entityFormArray.at(t).value:{};this.getMappingDialog({requestType:i,...a},n?"action.apply":"action.add").afterClosed().pipe(bn(this.destroyRef)).subscribe((e=>{e&&(n?this.entityFormArray.at(t).patchValue(e):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(this.entityFormArray.at(t).value)}),this.translate.instant("gateway.delete-mapping-description"),this.translate.instant("action.no"),this.translate.instant("action.yes"),!0).pipe(bn(this.destroyRef)).subscribe((e=>{e&&(this.entityFormArray.removeAt(t),this.entityFormArray.markAsDirty())}))}updateTableData(e,t){t&&(e=e.filter((e=>{const n=this.getRequestDetails(e);return Object.values(e).some((e=>Me(e)&&this.translate.instant(wi.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(b2,{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(B2)))(n||B2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:B2,selectors:[["tb-rest-request-mapping-table"]],inputs:{defaultRequestUrl:"defaultRequestUrl"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>B2)),multi:!0},{provide:K,useExisting:c((()=>B2)),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"],[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,"!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,C2,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,_2,4,3,"mat-header-cell",14)(24,T2,4,3,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,13),t.ɵɵtemplate(26,I2,3,3,"mat-header-cell",16)(27,P2,5,1,"mat-cell",15),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(28,17),t.ɵɵtemplate(29,D2,1,0,"mat-header-cell",18)(30,A2,12,3,"mat-cell",19),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(31,F2,1,0,"mat-header-row",20)(32,R2,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,w2))("matHeaderRowDefSticky",!0),t.ɵɵadvance(),t.ɵɵproperty("matRowDefColumns",t.ɵɵpureFunction0(35,w2)),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(B2,[j,_,qn]),encapsulation:2,changeDetection:d.OnPush})}}class N2 extends G{constructor(){super()}}class L2 extends Ba{initBasicFormGroup(){return this.fb.group({server:[],mapping:[],requestsMapping:[]})}getRequestDataArray(e){const t=[];return Fe(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(L2)))(n||L2)}})()}static{this.ɵdir=t.ɵɵdefineDirective({type:L2,features:[t.ɵɵInheritDefinitionFeature]})}}class V2 extends L2{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(V2)))(n||V2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:V2,selectors:[["tb-rest-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>V2)),multi:!0},{provide:K,useExisting:c((()=>V2)),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(V2,[j,_,D1,y0,B2]),encapsulation:2,changeDetection:d.OnPush})}}class q2 extends L2{mapConfigToFormValue({attributeRequests:e=[],attributeUpdates:t=[],serverSideRpc:n=[],mapping:i=[],...a}){return{server:{...a??{}},mapping:$a.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:$a.mapMappingToDowngradedVersion(t),attributeRequests:i,attributeUpdates:a,serverSideRpc:r}}static{this.ɵfac=(()=>{let e;return function(n){return(e||(e=t.ɵɵgetInheritedFactory(q2)))(n||q2)}})()}static{this.ɵcmp=t.ɵɵdefineComponent({type:q2,selectors:[["tb-rest-legacy-basic-config"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>q2)),multi:!0},{provide:K,useExisting:c((()=>q2)),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(q2,[j,_,D1,y0,B2]),encapsulation:2,changeDetection:d.OnPush})}}const G2=(e,t)=>({hasErrors:e,noErrors:t}),z2=()=>({minWidth:"144px",maxWidth:"144px",textAlign:"center"}),U2=()=>({minWidth:"144px",maxWidth:"144px",width:"144px",textAlign:"center"}),j2=e=>({"tb-current-entity":e});function H2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",32),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 W2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",33)(1,"button",34),t.ɵɵlistener("click",(function(n){t.ɵɵrestoreView(e);const i=t.ɵɵnextContext();return t.ɵɵresetView(i.onAddConnector(n))})),t.ɵɵelementStart(2,"mat-icon",35),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 $2(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-enabled")," "))}function K2(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"mat-slide-toggle",37),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 Y2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",38),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-name"),""))}function X2(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 Z2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-type")," "))}function Q2(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit,i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",i.returnType(e)," ")}}function J2(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.configuration")," "))}function e3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-cell",40)(1,"div",41),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 t3(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell",39),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.connectors-table-status")," "))}function n3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell",40)(1,"span",42),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,G2,+i.getErrorsCount(e)>0,0==+i.getErrorsCount(e)||""===i.getErrorsCount(e))),t.ɵɵpropertyInterpolate("matTooltip","Errors: "+i.getErrorsCount(e))}}function i3(e,n){1&e&&(t.ɵɵelementStart(0,"mat-header-cell"),t.ɵɵelement(1,"div",43),t.ɵɵelementStart(2,"div",44),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()()),2&e&&(t.ɵɵadvance(2),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,z2)),t.ɵɵadvance(),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(4,3,"gateway.connectors-table-actions")))}function a3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-cell")(1,"div",45)(2,"button",46),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(3,"mat-icon"),t.ɵɵtext(4,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"button",47),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(6,"mat-icon"),t.ɵɵtext(7,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(8,"button",48),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(9,"mat-icon"),t.ɵɵtext(10,"delete"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(11,"div",49)(12,"button",50),t.ɵɵlistener("click",(function(n){return t.ɵɵrestoreView(e),t.ɵɵresetView(n.stopPropagation())})),t.ɵɵelementStart(13,"mat-icon",51),t.ɵɵtext(14,"more_vert"),t.ɵɵelementEnd()(),t.ɵɵelementStart(15,"mat-menu",52,1)(17,"button",46),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorRpc(i,n))})),t.ɵɵelementStart(18,"mat-icon"),t.ɵɵtext(19,"private_connectivity"),t.ɵɵelementEnd()(),t.ɵɵelementStart(20,"button",47),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.connectorLogs(i,n))})),t.ɵɵelementStart(21,"mat-icon"),t.ɵɵtext(22,"list"),t.ɵɵelementEnd()(),t.ɵɵelementStart(23,"button",48),t.ɵɵlistener("click",(function(n){const i=t.ɵɵrestoreView(e).$implicit,a=t.ɵɵnextContext();return t.ɵɵresetView(a.deleteConnector(i,n))})),t.ɵɵelementStart(24,"mat-icon"),t.ɵɵtext(25,"delete"),t.ɵɵelementEnd()()()()()}if(2&e){const e=n.$implicit,i=t.ɵɵreference(16);t.ɵɵadvance(),t.ɵɵstyleMap(t.ɵɵpureFunction0(5,U2)),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.value.configurationJson.id),t.ɵɵadvance(10),t.ɵɵproperty("matMenuTriggerFor",i),t.ɵɵadvance(5),t.ɵɵproperty("disabled",!e.value.configurationJson.id)}}function r3(e,n){1&e&&t.ɵɵelement(0,"mat-header-row",53)}function o3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"mat-row",54),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,j2,i.isSameConnector(e)))}}function s3(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",55),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵtextInterpolate1("v",e.connectorForm.get("configVersion").value,"")}}function l3(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-select",56)(1,"tb-toggle-option",57),t.ɵɵtext(2),t.ɵɵpipe(3,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"tb-toggle-option",57),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 p3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function c3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-mqtt-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function d3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,p3,2,4,"tb-mqtt-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,c3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MQTT))("ngIfElse",e)}}function u3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function m3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-opc-ua-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function h3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,u3,2,4,"tb-opc-ua-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,m3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.OPCUA))("ngIfElse",e)}}function g3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function f3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-modbus-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function y3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,g3,1,1,"tb-modbus-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,f3,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.MODBUS))("ngIfElse",e)}}function v3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function x3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-socket-legacy-basic-config",67),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(41);t.ɵɵproperty("generalTabContent",e)}}function b3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,v3,1,1,"tb-socket-basic-config",66),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,x3,1,1,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.SOCKET))("ngIfElse",e)}}function w3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function S3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-bacnet-legacy-basic-config",65),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function C3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,w3,2,4,"tb-bacnet-basic-config",64),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,S3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.BACNET))("ngIfElse",e)}}function _3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-basic-config",69),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function T3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"tb-rest-legacy-basic-config",69),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(41);t.ɵɵproperty("generalTabContent",n)("withReportStrategy",t.ɵɵpipeBind1(1,2,e.connectorForm.get("configVersion").value))}}function I3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0),t.ɵɵtemplate(1,_3,2,4,"tb-rest-basic-config",68),t.ɵɵpipe(2,"isLatestVersionConfig"),t.ɵɵtemplate(3,T3,2,4,"ng-template",null,3,t.ɵɵtemplateRefExtractor),t.ɵɵelementContainerEnd()),2&e){const e=t.ɵɵreference(4),n=t.ɵɵnextContext(3);t.ɵɵadvance(),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(2,2,n.connectorForm.get("configVersion").value,n.ConnectorType.REST))("ngIfElse",e)}}function E3(e,n){if(1&e&&(t.ɵɵelementContainerStart(0)(1,62),t.ɵɵtemplate(2,d3,5,5,"ng-container",63)(3,h3,5,5,"ng-container",63)(4,y3,5,5,"ng-container",63)(5,b3,5,5,"ng-container",63)(6,C3,5,5,"ng-container",63)(7,I3,5,5,"ng-container",63),t.ɵɵelementContainerEnd()()),2&e){const e=t.ɵɵnextContext(2);t.ɵɵadvance(),t.ɵɵproperty("ngSwitch",e.initialConnector.type),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MQTT),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.OPCUA),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.MODBUS),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.SOCKET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.BACNET),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",e.ConnectorType.REST)}}function M3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-tab-group")(1,"mat-tab",70),t.ɵɵpipe(2,"translate"),t.ɵɵelementContainer(3,71),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"mat-tab",70),t.ɵɵpipe(5,"translate"),t.ɵɵelement(6,"tb-json-object-edit",72),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()),2&e){t.ɵɵnextContext(2);const e=t.ɵɵreference(41);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 k3(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"section",58),t.ɵɵtemplate(1,E3,8,7,"ng-container",59)(2,M3,8,12,"ng-template",null,2,t.ɵɵtemplateRefExtractor),t.ɵɵelementStart(4,"div",60)(5,"button",61),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.onSaveConnector())})),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd()()()}if(2&e){let e;const n=t.ɵɵreference(3),i=t.ɵɵnextContext();t.ɵɵadvance(),t.ɵɵproperty("ngIf",(null==(e=i.connectorForm.get("mode"))?null:e.value)===i.ConnectorConfigurationModes.BASIC)("ngIfElse",n),t.ɵɵadvance(4),t.ɵɵproperty("disabled",!i.connectorForm.dirty||i.connectorForm.invalid),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,4,"action.save")," ")}}function P3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-icon",89),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 D3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"div",85),t.ɵɵtext(2,"gateway.connectors-table-class"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",76)(4,"mat-form-field",77),t.ɵɵelement(5,"input",90),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function O3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"div",85),t.ɵɵtext(2,"gateway.connectors-table-key"),t.ɵɵelementEnd(),t.ɵɵelementStart(3,"div",76)(4,"mat-form-field",77),t.ɵɵelement(5,"input",91),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()()()),2&e&&(t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(6,1,"gateway.set")))}function A3(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",57),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function F3(e,n){1&e&&(t.ɵɵelementStart(0,"div",74)(1,"mat-slide-toggle",92)(2,"mat-label",93),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 R3(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",94),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("isExpansionMode",!0)("defaultValue",e.ReportStrategyDefaultValue.Connector)}}function B3(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",73)(1,"div",74)(2,"div",75),t.ɵɵtext(3,"gateway.name"),t.ɵɵelementEnd(),t.ɵɵelementStart(4,"div",76)(5,"mat-form-field",77),t.ɵɵelement(6,"input",78),t.ɵɵpipe(7,"translate"),t.ɵɵtemplate(8,P3,3,3,"mat-icon",79),t.ɵɵelementEnd()()(),t.ɵɵtemplate(9,D3,7,3,"div",80)(10,O3,7,3,"div",80),t.ɵɵelementStart(11,"div",81)(12,"div",82),t.ɵɵtext(13,"gateway.logs-configuration"),t.ɵɵelementEnd(),t.ɵɵelementStart(14,"div",83)(15,"mat-slide-toggle",84)(16,"mat-label"),t.ɵɵtext(17),t.ɵɵpipe(18,"translate"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(19,"div",74)(20,"div",85),t.ɵɵtext(21,"gateway.remote-logging-level"),t.ɵɵelementEnd(),t.ɵɵelementStart(22,"div",76)(23,"mat-form-field",77)(24,"mat-select",86),t.ɵɵtemplate(25,A3,2,2,"mat-option",87),t.ɵɵelementEnd()()()()(),t.ɵɵtemplate(26,F3,6,6,"div",80),t.ɵɵpipe(27,"withReportStrategy"),t.ɵɵtemplate(28,R3,1,2,"tb-report-strategy",88),t.ɵɵpipe(29,"withReportStrategy"),t.ɵɵelementEnd()),2&e){const e=t.ɵɵnextContext();t.ɵɵproperty("formGroup",e.connectorForm),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("placeholder",t.ɵɵpipeBind1(7,9,"gateway.set")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.connectorForm.get("name").hasError("required")&&e.connectorForm.get("name").touched||e.connectorForm.get("name").hasError("duplicateName")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.CUSTOM),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.GRPC),t.ɵɵadvance(7),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(18,11,"gateway.enable-remote-logging")," "),t.ɵɵadvance(8),t.ɵɵproperty("ngForOf",e.gatewayLogLevel),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.connectorForm.get("type").value===e.ConnectorType.MQTT&&!t.ɵɵpipeBind2(27,13,e.connectorForm.get("configVersion").value,e.ConnectorType.MQTT)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",t.ɵɵpipeBind2(29,16,e.connectorForm.get("configVersion").value,e.connectorForm.get("type").value))}}class N3{isErrorState(e){return e&&e.invalid}}e("ForceErrorStateMatcher",N3);class L3 extends q{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=ct,this.allowBasicConfig=new Set([ct.MQTT,ct.OPCUA,ct.MODBUS,ct.SOCKET,ct.BACNET,ct.REST]),this.gatewayLogLevel=Object.values(lt),this.displayedColumns=["enabled","key","type","syncStatus","errors","actions"],this.GatewayConnectorTypesTranslatesMap=dt,this.ConnectorConfigurationModes=Qt,this.ReportStrategyDefaultValue=en,this.basicConfigInitSubject=new te,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 te,this.attributeUpdateSubject=new te,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)?D.SHARED_SCOPE:D.SERVER_SCOPE;oe(this.getEntityAttributeTasks(e,n)).pipe(ye(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===D.SHARED_SCOPE||!this.inactiveConnectors.includes(e.name)&&t===D.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===D.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===D.SHARED_SCOPE?"active_connectors":"inactive_connectors",n=e===D.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=`${Be(t.name)}.json`,delete t.basicConfig,t.type!==ct.GRPC&&delete t.key,t.type!==ct.CUSTOM&&delete t.class,this.allowBasicConfig.has(t.type)||delete t.mode,this.withReportStrategy.transform(t.configVersion,t.type)&&(t.configurationJson.reportStrategy=t.reportStrategy,Ae(t.reportStrategy)&&delete t.reportStrategy,Ae(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=w[this.sort.direction.toUpperCase()],this.attributeDataSource.loadAttributes(this.device,D.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,D.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,D.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=Se(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 Se(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:Qt.BASIC,name:"",type:ct.MQTT,sendDataOnlyOnChange:!1,enableRemoteLogging:!1,logLevel:lt.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(ye(1),xe((t=>{if(!t)return;const n=[],i=this.activeConnectors.includes(e.value?.name)?D.SHARED_SCOPE:D.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)),oe(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=Oe(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=Oe(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(ye(1),ue(Boolean),xe((()=>this.openAddConnectorDialog())),ue(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(ye(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??Qt.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(h$,{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:w.ASC};this.pageLink=new S(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 x([])}initConnectorForm(){this.connectorForm=this.fb.group({mode:[Qt.BASIC],name:["",[$.required,this.uniqNameRequired(),$.pattern(an)]],type:["",[$.required]],enableRemoteLogging:[!1],logLevel:["",[$.required]],sendDataOnlyOnChange:[!1],key:["auto"],class:[""],configuration:[""],configurationJson:[{},[$.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()===w.DESC?-1:1/0:n;default:return e[t]||e.value[t]}}}loadConnectors(){this.device&&this.device.id!==B&&oe([this.attributeService.getEntityAttributes(this.device,D.SHARED_SCOPE,["active_connectors"]),this.attributeService.getEntityAttributes(this.device,D.SERVER_SCOPE,["inactive_connectors"]),this.attributeService.getEntityAttributes(this.device,D.CLIENT_SCOPE,["Version"])]).pipe(le(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,D.SERVER_SCOPE).pipe(le(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 Me(t)?JSON.parse(t):t}observeModeChange(){this.connectorForm.get("mode").valueChanges.pipe(le(this.destroy$)).subscribe((e=>{e===Qt.BASIC&&this.patchConnectorBasicConfig(this.connectorForm.get("configurationJson").value)}))}observeAttributeChange(){this.attributeUpdateSubject.pipe(de(300),me((e=>this.executeAttributeUpdates(e))),le(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){oe(this.getAttributeExecutionTasks(e)).pipe(ye(1),me((()=>this.updateData(!0))),le(this.destroy$)).subscribe()}getAttributeExecutionTasks(e){const t=this.activeConnectors.includes(e.key),n=t?D.SERVER_SCOPE:D.SHARED_SCOPE,i=t?D.SHARED_SCOPE:D.SERVER_SCOPE;return[this.attributeService.saveEntityAttributes(this.device,D.SHARED_SCOPE,[{key:"active_connectors",value:this.activeConnectors}]),this.attributeService.saveEntityAttributes(this.device,D.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(R.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(ue((()=>!!this.initialConnector)),le(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("configurationJson"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;if(!Se(e,t?.value)&&this.allowBasicConfig.has(n)&&i===Qt.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(le(this.destroy$)).subscribe((e=>{const t=this.connectorForm.get("basicConfig"),n=this.connectorForm.get("type").value,i=this.connectorForm.get("mode").value;!Se(e,t?.value)&&this.allowBasicConfig.has(n)&&i===Qt.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):ae(!0)}setFormValue(e){this.connectorForm.disabled&&this.connectorForm.enable();const t=za.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!==Qt.ADVANCED?this.basicConfigInitSubject.asObservable().pipe(ye(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===ct.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||L3)(t.ɵɵdirectiveInject(Ye.Store),t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(He.TranslateService),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(_e.DialogService),t.ɵɵdirectiveInject(qe.MatDialog),t.ɵɵdirectiveInject(_e.TelemetryWebsocketService),t.ɵɵdirectiveInject(t.NgZone),t.ɵɵdirectiveInject(_e.UtilsService),t.ɵɵdirectiveInject(Ka),t.ɵɵdirectiveInject(t.ChangeDetectorRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:L3,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:ot,useClass:N3},Ka]),t.ɵɵInheritDefinitionFeature,t.ɵɵStandaloneFeature],decls:42,vars:21,consts:[["generalTabContent",""],["cellActionsMenu","matMenu"],["defaultConfig",""],["legacy",""],[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","click",4,"ngIf"],[1,"table-container"],["class","mat-headline-5 tb-absolute-fill tb-add-new items-center justify-center",4,"ngIf"],["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"],["class","version-placeholder",4,"ngIf"],["formControlName","mode","appearance","fill",4,"ngIf"],["translate","",1,"no-data-found","items-center","justify-center"],["class","tb-form-panel section-container no-border no-padding tb-flex space-between",4,"ngIf"],["mat-icon-button","","matTooltipPosition","above",3,"click","disabled","matTooltip"],[1,"mat-headline-5","tb-absolute-fill","tb-add-new","items-center","justify-center"],["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","","matTooltip","RPC","matTooltipPosition","above",3,"click","disabled"],["mat-icon-button","","matTooltip","Logs","matTooltipPosition","above",3,"click"],["mat-icon-button","","matTooltip","Delete connector","matTooltipPosition","above",3,"click"],[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"],[1,"version-placeholder"],["formControlName","mode","appearance","fill"],[3,"value"],[1,"tb-form-panel","section-container","no-border","no-padding","tb-flex","space-between"],[4,"ngIf","ngIfElse"],[1,"flex","justify-end"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],[3,"ngSwitch"],[4,"ngSwitchCase"],["formControlName","basicConfig",3,"generalTabContent","withReportStrategy","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent","withReportStrategy"],["formControlName","basicConfig",3,"generalTabContent","initialized",4,"ngIf","ngIfElse"],["formControlName","basicConfig",3,"initialized","generalTabContent"],["class","h-full","formControlName","basicConfig",3,"generalTabContent","withReportStrategy","initialized",4,"ngIf","ngIfElse"],["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","class","tb-error",3,"matTooltip",4,"ngIf"],["class","tb-form-row column-xs",4,"ngIf"],[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"],[3,"value",4,"ngFor","ngForOf"],["class","stroked tb-form-panel","formControlName","reportStrategy",3,"isExpansionMode","defaultValue",4,"ngIf"],["matSuffix","","matTooltipPosition","above","matTooltipClass","tb-error-tooltip",1,"tb-error",3,"matTooltip"],["matInput","","name","value","formControlName","class",3,"placeholder"],["matInput","","name","value","formControlName","key",3,"placeholder"],["formControlName","sendDataOnlyOnChange",1,"mat-slide"],[3,"tb-hint-tooltip-icon"],["formControlName","reportStrategy",1,"stroked","tb-form-panel",3,"isExpansionMode","defaultValue"]],template:function(e,n){1&e&&(t.ɵɵelementStart(0,"div",4)(1,"section",5)(2,"mat-toolbar",6)(3,"h2"),t.ɵɵtext(4),t.ɵɵpipe(5,"translate"),t.ɵɵelementEnd(),t.ɵɵtemplate(6,H2,5,6,"button",7),t.ɵɵelementEnd(),t.ɵɵelementStart(7,"div",8),t.ɵɵtemplate(8,W2,7,3,"section",9),t.ɵɵelementStart(9,"table",10),t.ɵɵelementContainerStart(10,11),t.ɵɵtemplate(11,$2,3,3,"mat-header-cell",12)(12,K2,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(13,14),t.ɵɵtemplate(14,Y2,3,3,"mat-header-cell",15)(15,X2,2,1,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(16,16),t.ɵɵtemplate(17,Z2,3,3,"mat-header-cell",17)(18,Q2,2,1,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(19,19),t.ɵɵtemplate(20,J2,3,3,"mat-header-cell",17)(21,e3,3,3,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(22,20),t.ɵɵtemplate(23,t3,3,3,"mat-header-cell",17)(24,n3,2,6,"mat-cell",18),t.ɵɵelementContainerEnd(),t.ɵɵelementContainerStart(25,21),t.ɵɵtemplate(26,i3,5,6,"mat-header-cell",22)(27,a3,26,6,"mat-cell",13),t.ɵɵelementContainerEnd(),t.ɵɵtemplate(28,r3,1,0,"mat-header-row",23)(29,o3,1,4,"mat-row",24),t.ɵɵelementEnd()()(),t.ɵɵelementStart(30,"section",25)(31,"div",26)(32,"div",27),t.ɵɵtext(33),t.ɵɵpipe(34,"translate"),t.ɵɵtemplate(35,s3,2,1,"span",28),t.ɵɵelementEnd(),t.ɵɵtemplate(36,l3,7,8,"tb-toggle-select",29),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"span",30),t.ɵɵtext(38," gateway.select-connector "),t.ɵɵelementEnd(),t.ɵɵtemplate(39,k3,8,6,"section",31),t.ɵɵelementEnd()(),t.ɵɵtemplate(40,B3,30,19,"ng-template",null,0,t.ɵɵtemplateRefExtractor)),2&e&&(t.ɵɵadvance(4),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(5,17,"gateway.connectors")),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",null==n.dataSource||null==n.dataSource.data?null:n.dataSource.data.length),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",!(null!=n.dataSource&&(null!=n.dataSource.data&&n.dataSource.data.length))),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,19,"gateway.configuration")," "),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.connectorForm.get("configVersion").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.initialConnector&&n.allowBasicConfig.has(n.initialConnector.type)),t.ɵɵadvance(),t.ɵɵclassProp("!hidden",n.initialConnector),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.initialConnector))},dependencies:t.ɵɵgetComponentDepsFactory(L3,[j,_,Ka,a$,oX,sX,XY,YY,xQ,bQ,kJ,PJ,Xn,E1,M1,q2,V2]),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",L3);class V3{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||V3)(t.ɵɵdirectiveInject(_e.DeviceService))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:V3,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(V3,[j,_]),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 q3,G3,z3;e("DeviceGatewayCommandComponent",V3),e("GatewayBasicConfigTab",q3),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"}(q3||e("GatewayBasicConfigTab",q3={})),e("StorageTypes",G3),function(e){e.MEMORY="memory",e.FILE="file",e.SQLITE="sqlite"}(G3||e("StorageTypes",G3={})),e("LocalLogsConfigs",z3),function(e){e.service="service",e.connector="connector",e.converter="converter",e.tb_connection="tb_connection",e.storage="storage",e.extension="extension"}(z3||e("LocalLogsConfigs",z3={}));const U3=e("LocalLogsConfigTranslateMap",new Map([[z3.service,"Service"],[z3.connector,"Connector"],[z3.converter,"Converter"],[z3.tb_connection,"TB Connection"],[z3.storage,"Storage"],[z3.extension,"Extension"]])),j3=e("StorageTypesTranslationMap",new Map([[G3.MEMORY,"gateway.storage-types.memory-storage"],[G3.FILE,"gateway.storage-types.file-storage"],[G3.SQLITE,"gateway.storage-types.sqlite"]]));var H3;e("LogSavingPeriod",H3),function(e){e.days="D",e.hours="H",e.minutes="M",e.seconds="S"}(H3||e("LogSavingPeriod",H3={}));const W3=e("LogSavingPeriodTranslations",new Map([[H3.days,"gateway.logs.days"],[H3.hours,"gateway.logs.hours"],[H3.minutes,"gateway.logs.minutes"],[H3.seconds,"gateway.logs.seconds"]]));var $3;e("SecurityTypes",$3),function(e){e.ACCESS_TOKEN="accessToken",e.USERNAME_PASSWORD="usernamePassword",e.TLS_ACCESS_TOKEN="tlsAccessToken",e.TLS_PRIVATE_KEY="tlsPrivateKey"}($3||e("SecurityTypes",$3={}));const K3=e("SecurityTypesTranslationsMap",new Map([[$3.ACCESS_TOKEN,"gateway.security-types.access-token"],[$3.USERNAME_PASSWORD,"gateway.security-types.username-password"],[$3.TLS_ACCESS_TOKEN,"gateway.security-types.tls-access-token"]])),Y3=e("logsHandlerClass","thingsboard_gateway.tb_utility.tb_rotating_file_handler.TimedRotatingFileHandler"),X3=e("logsLegacyHandlerClass","thingsboard_gateway.tb_utility.tb_handler.TimedRotatingFileHandler");function Z3(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",10),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 Q3(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 J3(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 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-read-record-count-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.storage-max-records-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.storage-max-records-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.storage-max-records-pattern")," "))}function a4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",11)(1,"mat-form-field",12)(2,"mat-label",13),t.ɵɵtext(3,"gateway.storage-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",14),t.ɵɵtemplate(5,Q3,3,3,"mat-error",15)(6,J3,3,3,"mat-error",15)(7,e4,3,3,"mat-error",15),t.ɵɵelementStart(8,"mat-icon",16),t.ɵɵpipe(9,"translate"),t.ɵɵtext(10,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(11,"mat-form-field",12)(12,"mat-label",13),t.ɵɵtext(13,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",17),t.ɵɵtemplate(15,t4,3,3,"mat-error",15)(16,n4,3,3,"mat-error",15)(17,i4,3,3,"mat-error",15),t.ɵɵelementStart(18,"mat-icon",16),t.ɵɵpipe(19,"translate"),t.ɵɵtext(20,"info_outlined "),t.ɵɵelementEnd()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(5),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,8,"gateway.hints.read-record-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(19,10,"gateway.hints.max-records-count"))}}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-data-folder-path-required")," "))}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-files-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-files-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-max-files-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-read-record-count-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-read-record-count-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-read-record-count-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.storage-max-records-required")," "))}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-records-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.storage-max-records-pattern")," "))}function g4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-data-folder-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",18),t.ɵɵtemplate(6,r4,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",19),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.storage-max-files"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",20),t.ɵɵtemplate(14,o4,3,3,"mat-error",15)(15,s4,3,3,"mat-error",15)(16,l4,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"mat-form-field",12)(22,"mat-label",13),t.ɵɵtext(23,"gateway.storage-max-read-record-count"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",21),t.ɵɵtemplate(25,p4,3,3,"mat-error",15)(26,c4,3,3,"mat-error",15)(27,d4,3,3,"mat-error",15),t.ɵɵelementStart(28,"mat-icon",16),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"mat-form-field",12)(32,"mat-label",13),t.ɵɵtext(33,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",22),t.ɵɵtemplate(35,u4,3,3,"mat-error",15)(36,m4,3,3,"mat-error",15)(37,h4,3,3,"mat-error",15),t.ɵɵelementStart(38,"mat-icon",16),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_folder_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,14,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_file_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,16,"gateway.hints.max-file-count")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_read_records_count").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,18,"gateway.hints.max-read-count")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,20,"gateway.hints.max-records"))}}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-path-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.messages-ttl-check-in-hours-required")," "))}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.messages-ttl-check-in-hours-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.messages-ttl-check-in-hours-pattern")," "))}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.messages-ttl-in-days-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.messages-ttl-in-days-min")," "))}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.messages-ttl-in-days-pattern")," "))}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-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-max-records-min")," "))}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-max-records-pattern")," "))}function I4(e,n){if(1&e&&(t.ɵɵelementStart(0,"section")(1,"div",11)(2,"mat-form-field",12)(3,"mat-label",13),t.ɵɵtext(4,"gateway.storage-path"),t.ɵɵelementEnd(),t.ɵɵelement(5,"input",23),t.ɵɵtemplate(6,f4,3,3,"mat-error",15),t.ɵɵelementStart(7,"mat-icon",16),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(10,"mat-form-field",12)(11,"mat-label",13),t.ɵɵtext(12,"gateway.messages-ttl-check-in-hours"),t.ɵɵelementEnd(),t.ɵɵelement(13,"input",24),t.ɵɵtemplate(14,y4,3,3,"mat-error",15)(15,v4,3,3,"mat-error",15)(16,x4,3,3,"mat-error",15),t.ɵɵelementStart(17,"mat-icon",16),t.ɵɵpipe(18,"translate"),t.ɵɵtext(19,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(20,"div",11)(21,"mat-form-field",12)(22,"mat-label",13),t.ɵɵtext(23,"gateway.messages-ttl-in-days"),t.ɵɵelementEnd(),t.ɵɵelement(24,"input",25),t.ɵɵtemplate(25,b4,3,3,"mat-error",15)(26,w4,3,3,"mat-error",15)(27,S4,3,3,"mat-error",15),t.ɵɵelementStart(28,"mat-icon",26),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()(),t.ɵɵelementStart(31,"mat-form-field",12)(32,"mat-label",13),t.ɵɵtext(33,"gateway.storage-max-records"),t.ɵɵelementEnd(),t.ɵɵelement(34,"input",22),t.ɵɵtemplate(35,C4,3,3,"mat-error",15)(36,_4,3,3,"mat-error",15)(37,T4,3,3,"mat-error",15),t.ɵɵelementStart(38,"mat-icon",26),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd()()()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(6),t.ɵɵproperty("ngIf",e.storageFormGroup.get("data_file_path").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(8,14,"gateway.hints.data-folder")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_check_in_hours").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(18,16,"gateway.hints.ttl-check-hour")),t.ɵɵadvance(8),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("messages_ttl_in_days").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(29,18,"gateway.hints.ttl-messages-day")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",e.storageFormGroup.get("max_records_per_file").hasError("pattern")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,20,"gateway.hints.max-records"))}}class E4{constructor(e){this.fb=e,this.initialized=new u,this.StorageTypes=G3,this.storageTypes=Object.values(G3),this.storageTypesTranslationMap=j3,this.onChange=()=>{},this.storageFormGroup=this.initStorageFormGroup(),this.observeStorageTypeChanges(),this.storageFormGroup.valueChanges.pipe(bn()).subscribe((e=>{this.onChange(e)}))}ngAfterViewInit(){this.initialized.emit({storage:this.storageFormGroup.value})}writeValue(e){this.storageFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}validate(){return this.storageFormGroup.valid?null:{storageFormGroup:{valid:!1}}}removeAllStorageValidators(){for(const e in this.storageFormGroup.controls)"type"!==e&&(this.storageFormGroup.controls[e].clearValidators(),this.storageFormGroup.controls[e].setErrors(null),this.storageFormGroup.controls[e].updateValueAndValidity())}initStorageFormGroup(){return this.fb.group({type:[G3.MEMORY,[$.required]],read_records_count:[100,[$.required,$.min(1),$.pattern(nn)]],max_records_count:[1e5,[$.required,$.min(1),$.pattern(nn)]],data_folder_path:["./data/",[$.required]],max_file_count:[10,[$.min(1),$.pattern(nn)]],max_read_records_count:[10,[$.min(1),$.pattern(nn)]],max_records_per_file:[1e4,[$.min(1),$.pattern(nn)]],data_file_path:["./data/data.db",[$.required]],messages_ttl_check_in_hours:[1,[$.min(1),$.pattern(nn)]],messages_ttl_in_days:[7,[$.min(1),$.pattern(nn)]]})}observeStorageTypeChanges(){this.storageFormGroup.get("type").valueChanges.pipe(bn()).subscribe((e=>{switch(this.removeAllStorageValidators(),e){case G3.MEMORY:this.addMemoryStorageValidators(this.storageFormGroup);break;case G3.FILE:this.addFileStorageValidators(this.storageFormGroup);break;case G3.SQLITE:this.addSqliteStorageValidators(this.storageFormGroup)}}))}addMemoryStorageValidators(e){e.get("read_records_count").addValidators([$.required,$.min(1),$.pattern(nn)]),e.get("max_records_count").addValidators([$.required,$.min(1),$.pattern(nn)]),e.get("read_records_count").updateValueAndValidity({emitEvent:!1}),e.get("max_records_count").updateValueAndValidity({emitEvent:!1})}addFileStorageValidators(e){["max_file_count","max_read_records_count","max_records_per_file"].forEach((t=>{e.get(t).addValidators([$.required,$.min(1),$.pattern(nn)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}addSqliteStorageValidators(e){["messages_ttl_check_in_hours","messages_ttl_in_days","max_records_per_file"].forEach((t=>{e.get(t).addValidators([$.required,$.min(1),$.pattern(nn)]),e.get(t).updateValueAndValidity({emitEvent:!1})}))}static{this.ɵfac=function(e){return new(e||E4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:E4,selectors:[["tb-gateway-storage-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>E4)),multi:!0},{provide:K,useExisting:c((()=>E4)),multi:!0}]),t.ɵɵStandaloneFeature],decls:15,vars:9,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",4,"ngFor","ngForOf"],[1,"tb-form-panel-hint"],[3,"ngSwitch"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"value"],[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"],[4,"ngIf"],["matIconSuffix","",2,"cursor","pointer",3,"matTooltip"],["type","number","matInput","","formControlName","max_records_count"],["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"]],template:function(e,n){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.ɵɵtemplate(7,Z3,3,4,"tb-toggle-option",5),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",6),t.ɵɵtext(9),t.ɵɵpipe(10,"translate"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(11,7),t.ɵɵtemplate(12,a4,21,12,"section",8)(13,g4,41,22,"section",9)(14,I4,41,22,"section",9),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.storageFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngForOf",n.storageTypes),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(10,7,"gateway.hints."+n.storageFormGroup.get("type").value)),t.ɵɵadvance(2),t.ɵɵproperty("ngSwitch",n.storageFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.MEMORY),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.FILE),t.ɵɵadvance(),t.ɵɵproperty("ngSwitchCase",n.StorageTypes.SQLITE))},dependencies:t.ɵɵgetComponentDepsFactory(E4,[j,_]),encapsulation:2})}}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.thingsboard-port-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.thingsboard-port-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.thingsboard-port-max")," "))}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.thingsboard-port-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.grpc-keep-alive-timeout-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.grpc-keep-alive-timeout-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.grpc-keep-alive-timeout-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.grpc-keep-alive-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.grpc-keep-alive-min")," "))}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.grpc-keep-alive-pattern")," "))}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.grpc-min-time-between-pings-required")," "))}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.grpc-min-time-between-pings-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.grpc-min-time-between-pings-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.grpc-max-pings-without-data-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.grpc-max-pings-without-data-min")," "))}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.grpc-max-pings-without-data-pattern")," "))}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-min-ping-interval-without-data-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.grpc-min-ping-interval-without-data-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.grpc-min-ping-interval-without-data-pattern")," "))}class $4{constructor(e){this.fb=e,this.initialized=new u,this.onChange=()=>{},this.grpcFormGroup=this.initGrpcFormGroup(),this.grpcFormGroup.valueChanges.pipe(bn()).subscribe((e=>{this.onChange(e)})),this.grpcFormGroup.get("enabled").valueChanges.pipe(bn()).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,[$.required,$.min(1),$.max(65535),$.pattern(nn)]],keepAliveTimeMs:[1e4,[$.required,$.min(1),$.pattern(nn)]],keepAliveTimeoutMs:[5e3,[$.required,$.min(1),$.pattern(nn)]],keepalivePermitWithoutCalls:[!0],maxPingsWithoutData:[0,[$.required,$.min(0),$.pattern(nn)]],minTimeBetweenPingsMs:[1e4,[$.required,$.min(1),$.pattern(nn)]],minPingIntervalWithoutDataMs:[5e3,[$.required,$.min(1),$.pattern(nn)]]})}static{this.ɵfac=function(e){return new(e||$4)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:$4,selectors:[["tb-gateway-grpc-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>$4)),multi:!0},{provide:K,useExisting:c((()=>$4)),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"],[4,"ngIf"],["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,M4,3,3,"mat-error",10)(20,k4,3,3,"mat-error",10)(21,P4,3,3,"mat-error",10)(22,D4,3,3,"mat-error",10),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",11),t.ɵɵelementStart(27,"mat-icon",9),t.ɵɵpipe(28,"translate"),t.ɵɵtext(29,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(30,O4,3,3,"mat-error",10)(31,A4,3,3,"mat-error",10)(32,F4,3,3,"mat-error",10),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",12),t.ɵɵelementStart(38,"mat-icon",9),t.ɵɵpipe(39,"translate"),t.ɵɵtext(40,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(41,R4,3,3,"mat-error",10)(42,B4,3,3,"mat-error",10)(43,N4,3,3,"mat-error",10),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",13),t.ɵɵelementStart(48,"mat-icon",9),t.ɵɵpipe(49,"translate"),t.ɵɵtext(50,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(51,L4,3,3,"mat-error",10)(52,V4,3,3,"mat-error",10)(53,q4,3,3,"mat-error",10),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",14),t.ɵɵelementStart(59,"mat-icon",9),t.ɵɵpipe(60,"translate"),t.ɵɵtext(61,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(62,G4,3,3,"mat-error",10)(63,z4,3,3,"mat-error",10)(64,U4,3,3,"mat-error",10),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",15),t.ɵɵelementStart(69,"mat-icon",9),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd(),t.ɵɵtemplate(72,j4,3,3,"mat-error",10)(73,H4,3,3,"mat-error",10)(74,W4,3,3,"mat-error",10),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.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("max")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("serverPort").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(28,37,"gateway.hints.grpc-keep-alive-timeout")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeoutMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(39,39,"gateway.hints.grpc-keep-alive")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("keepAliveTimeMs").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(49,41,"gateway.hints.grpc-min-time-between-pings")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minTimeBetweenPingsMs").hasError("pattern")),t.ɵɵadvance(6),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(60,43,"gateway.hints.grpc-max-pings-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("maxPingsWithoutData").hasError("pattern")),t.ɵɵadvance(5),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,45,"gateway.hints.grpc-min-ping-interval-without-data")),t.ɵɵadvance(3),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("min")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.grpcFormGroup.get("minPingIntervalWithoutDataMs").hasError("pattern")))},dependencies:t.ɵɵgetComponentDepsFactory($4,[j,_]),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.logs.date-format-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.logs.log-format-required")," "))}function X4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}function Z4(e,n){if(1&e&&(t.ɵɵelementStart(0,"tb-toggle-option",30),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 Q4(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){const e=n.$implicit;t.ɵɵproperty("value",e),t.ɵɵadvance(),t.ɵɵtextInterpolate(e)}}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.logs.file-path-required")," "))}function e5(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 t5(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 n5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-option",29),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 i5(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 a5(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 r5{constructor(e){this.fb=e,this.initialized=new u,this.logSavingPeriods=W3,this.localLogsConfigs=Object.keys(z3),this.localLogsConfigTranslateMap=U3,this.gatewayLogLevel=Object.values(lt),this.remoteLogLevel=Object.values(lt).filter((e=>e!==lt.NONE)),this.onChange=()=>{},this.logsFormGroup=this.initLogsFormGroup(),this.showRemoteLogsControl=this.fb.control(!1),this.logsFormGroup.valueChanges.pipe(bn()).subscribe((e=>{this.onChange(e)})),this.logSelector=this.fb.control(z3.service);for(const e of Object.keys(z3))this.addLocalLogConfig(e,{});this.showRemoteLogsControl.valueChanges.pipe(bn()).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??lt.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",[$.required,$.pattern(/^[^\s].*[^\s]$/)]],logFormat:["%(asctime)s.%(msecs)03d - |%(levelname)s| - [%(filename)s] - %(module)s - %(funcName)s - %(lineno)d - %(message)s",[$.required,$.pattern(/^[^\s].*[^\s]$/)]],type:["remote",[$.required]],logLevel:[{value:lt.INFO,disabled:!0}],local:this.fb.group({})})}addLocalLogConfig(e,t){const n=this.logsFormGroup.get("local"),i=this.fb.group({logLevel:[t.logLevel||lt.INFO,[$.required]],filePath:[t.filePath||"./logs",[$.required]],backupCount:[t.backupCount||7,[$.required,$.min(0)]],savingTime:[t.savingTime||3,[$.required,$.min(0)]],savingPeriod:[t.savingPeriod||H3.days,[$.required]]});n.addControl(e,i,{emitEvent:!1})}updateRemoteLogs(e){const t=e&&e!==lt.NONE;this.showRemoteLogsControl.patchValue(t,{emitEvent:!1}),this.logsFormGroup.get("logLevel")[t?"enable":"disable"]({emitEvent:!1}),this.logsFormGroup.get("logLevel").patchValue(e===lt.NONE?lt.INFO:e,{emitEvent:!1})}static{this.ɵfac=function(e){return new(e||r5)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:r5,selectors:[["tb-gateway-logs-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>r5)),multi:!0},{provide:K,useExisting:c((()=>r5)),multi:!0}]),t.ɵɵStandaloneFeature],decls:72,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"],[4,"ngIf"],["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",4,"ngFor","ngForOf"],["formGroupName","local",1,"tb-form-panel","no-padding-bottom"],["translate","",1,"tb-form-panel-title"],[1,"toggle-group",3,"formControl"],["class","first-capital",3,"value",4,"ngFor","ngForOf"],[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"],[3,"value"],[1,"first-capital",3,"value"]],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,K4,3,3,"mat-error",6),t.ɵɵelementStart(8,"mat-icon",7),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",8),t.ɵɵtemplate(15,Y4,3,3,"mat-error",6),t.ɵɵelementStart(16,"mat-icon",7),t.ɵɵpipe(17,"translate"),t.ɵɵtext(18,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(19,"div",9)(20,"mat-expansion-panel",10)(21,"mat-expansion-panel-header",11)(22,"mat-panel-title")(23,"mat-slide-toggle",12),t.ɵɵlistener("click",(function(e){return e.stopPropagation()})),t.ɵɵelementStart(24,"mat-label")(25,"div",13),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",14),t.ɵɵtemplate(33,X4,2,2,"mat-option",15),t.ɵɵelementEnd()()()(),t.ɵɵelementStart(34,"div",16)(35,"div",17),t.ɵɵtext(36,"gateway.logs.local"),t.ɵɵelementEnd(),t.ɵɵelementStart(37,"tb-toggle-select",18),t.ɵɵtemplate(38,Z4,2,2,"tb-toggle-option",19),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(39,20),t.ɵɵelementStart(40,"div",21)(41,"mat-form-field",22)(42,"mat-label",4),t.ɵɵtext(43,"gateway.logs.level"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-select",14),t.ɵɵtemplate(45,Q4,2,2,"mat-option",15),t.ɵɵelementEnd()(),t.ɵɵelementStart(46,"mat-form-field",22)(47,"mat-label",4),t.ɵɵtext(48,"gateway.logs.file-path"),t.ɵɵelementEnd(),t.ɵɵelement(49,"input",23),t.ɵɵtemplate(50,J4,3,3,"mat-error",6),t.ɵɵelementEnd()(),t.ɵɵelementStart(51,"div",21)(52,"div",24)(53,"mat-form-field",22)(54,"mat-label",4),t.ɵɵtext(55,"gateway.logs.saving-period"),t.ɵɵelementEnd(),t.ɵɵelement(56,"input",25),t.ɵɵtemplate(57,e5,3,3,"mat-error",6)(58,t5,3,3,"mat-error",6),t.ɵɵelementEnd(),t.ɵɵelementStart(59,"mat-form-field",26)(60,"mat-select",27),t.ɵɵtemplate(61,n5,3,4,"mat-option",15),t.ɵɵpipe(62,"keyvalue"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(63,"mat-form-field",22)(64,"mat-label",4),t.ɵɵtext(65,"gateway.logs.backup-count"),t.ɵɵelementEnd(),t.ɵɵelement(66,"input",28),t.ɵɵtemplate(67,i5,3,3,"mat-error",6)(68,a5,3,3,"mat-error",6),t.ɵɵelementStart(69,"mat-icon",7),t.ɵɵpipe(70,"translate"),t.ɵɵtext(71,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()()),2&e&&(t.ɵɵproperty("formGroup",n.logsFormGroup),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("dateFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(9,21,"gateway.hints.date-form")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("logFormat").hasError("required")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",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.ɵɵpropertyInterpolate("tb-hint-tooltip-icon",t.ɵɵpipeBind1(26,25,"gateway.hints.remote-log")),t.ɵɵadvance(2),t.ɵɵtextInterpolate(t.ɵɵpipeBind1(28,27,"gateway.logs.remote")),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.remoteLogLevel),t.ɵɵadvance(4),t.ɵɵproperty("formControl",n.logSelector),t.ɵɵadvance(),t.ɵɵproperty("ngForOf",n.localLogsConfigs),t.ɵɵadvance(),t.ɵɵproperty("formGroup",n.getLogFormGroup(n.logSelector.value)),t.ɵɵadvance(6),t.ɵɵproperty("ngForOf",n.gatewayLogLevel),t.ɵɵadvance(5),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".filePath").hasError("required")),t.ɵɵadvance(7),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".savingTime").hasError("min")),t.ɵɵadvance(3),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(62,29,n.logSavingPeriods)),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("required")),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.logsFormGroup.get("local."+n.logSelector.value+".backupCount").hasError("min")),t.ɵɵadvance(),t.ɵɵpropertyInterpolate("matTooltip",t.ɵɵpipeBind1(70,31,"gateway.hints.backup-count")))},dependencies:t.ɵɵgetComponentDepsFactory(r5,[j,_]),encapsulation:2})}}function o5(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 s5(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 l5(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,"device.generate-client-id"))}function p5(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 c5(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 d5(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("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 u5(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",6),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 m5(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("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 h5(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"device.client-id-or-user-name-necessary"))}function g5(e,n){1&e&&(t.ɵɵelement(0,"tb-error",14),t.ɵɵpipe(1,"translate")),2&e&&t.ɵɵproperty("error",t.ɵɵpipeBind1(1,1,"gateway.hints.username-required-with-password"))}class f5{constructor(e){this.fb=e,this.onChange=()=>{},this.initForm(),this.usernameFormGroup.valueChanges.pipe(bn()).subscribe((e=>this.onChange(e)))}writeValue(e){this.usernameFormGroup.patchValue(e,{emitEvent:!1})}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){e?this.usernameFormGroup.disable({emitEvent:!1}):this.usernameFormGroup.enable({emitEvent:!1})}validate(){return this.usernameFormGroup.valid?null:{usernameFormGroup:{valid:!1}}}initForm(){this.usernameFormGroup=this.createSecurityFormGroup()}createSecurityFormGroup(){return this.fb.group({clientId:[null,[$.pattern(/^[^.\s]+$/)]],username:[null,[$.pattern(/^[^.\s]+$/)]],password:[null,[$.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(Re(20))}static{this.ɵfac=function(e){return new(e||f5)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:f5,selectors:[["tb-gateway-username-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>f5)),multi:!0},{provide:K,useExisting:c((()=>f5)),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"],[4,"ngIf"],["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"],["class","block",3,"error",4,"ngIf"],["type","button","matSuffix","","mat-icon-button","","aria-label","Generate","matTooltipPosition","above",3,"click","matTooltip"],[1,"block",3,"error"]],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,o5,3,3,"mat-error",5)(7,s5,2,4,"tb-copy-button",6)(8,l5,4,3,"button",7),t.ɵɵelementStart(9,"mat-icon",8),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",9),t.ɵɵtemplate(16,p5,3,3,"mat-error",5)(17,c5,2,4,"tb-copy-button",6)(18,d5,4,3,"button",7),t.ɵɵelementStart(19,"mat-icon",8),t.ɵɵpipe(20,"translate"),t.ɵɵtext(21,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵelementStart(22,"mat-form-field",10)(23,"mat-label",3),t.ɵɵtext(24,"gateway.password"),t.ɵɵelementEnd(),t.ɵɵelement(25,"input",11),t.ɵɵtemplate(26,u5,2,4,"tb-copy-button",6)(27,m5,4,3,"button",7),t.ɵɵelementStart(28,"mat-icon",8),t.ɵɵpipe(29,"translate"),t.ɵɵtext(30,"info_outlined "),t.ɵɵelementEnd()()(),t.ɵɵtemplate(31,h5,2,3,"tb-error",12)(32,g5,2,3,"tb-error",12)),2&e&&(t.ɵɵproperty("formGroup",n.usernameFormGroup),t.ɵɵadvance(6),t.ɵɵproperty("ngIf",n.usernameFormGroup.get("clientId").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.get("username").hasError("required")),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.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("atLeastOneRequired")&&n.usernameFormGroup.touched),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.usernameFormGroup.hasError("usernameRequired")&&n.usernameFormGroup.touched))},dependencies:t.ɵɵgetComponentDepsFactory(f5,[j,_]),encapsulation:2})}}class y5{constructor(e,t){this.deviceService=e,this.destroyRef=t,this.initialCredentialsSubject=new ie(null)}get initialCredentials(){return this.initialCredentialsSubject.value}get initialCredentials$(){return this.initialCredentialsSubject.asObservable()}updateCredentials(e){let t={};switch(e.type){case $3.USERNAME_PASSWORD:this.shouldUpdateCredentials(e)&&(t=this.generateMqttCredentials(e));break;case $3.ACCESS_TOKEN:case $3.TLS_ACCESS_TOKEN:this.shouldUpdateAccessToken(e)&&(t={credentialsType:U.ACCESS_TOKEN,credentialsId:e.accessToken,credentialsValue:null})}return this.initialCredentialsSubject.next({...this.initialCredentials,...t}),Object.keys(t).length?this.deviceService.saveDeviceCredentials(this.initialCredentials):ae(null)}setInitialCredentials(e){this.deviceService.getDeviceCredentials(e.id).pipe(bn(this.destroyRef)).subscribe((e=>{this.initialCredentialsSubject.next({...e,version:null})}))}shouldUpdateSecurityConfig(e){switch(e.type){case $3.USERNAME_PASSWORD:return this.shouldUpdateCredentials(e);case $3.ACCESS_TOKEN:case $3.TLS_ACCESS_TOKEN:return this.shouldUpdateAccessToken(e)}}credentialsToSecurityConfig(e){const t=e.credentialsType===U.MQTT_BASIC?$3.USERNAME_PASSWORD:$3.ACCESS_TOKEN;if(e.credentialsType!==U.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!==U.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!==U.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:U.MQTT_BASIC,credentialsValue:JSON.stringify(a)}}static{this.ɵfac=function(e){return new(e||y5)(t.ɵɵinject(_e.DeviceService),t.ɵɵinject(t.DestroyRef))}}static{this.ɵprov=t.ɵɵdefineInjectable({token:y5,factory:y5.ɵfac})}}function v5(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;t.ɵɵproperty("value",e.key),t.ɵɵadvance(),t.ɵɵtextInterpolate1("",t.ɵɵpipeBind1(2,2,e.value)," ")}}function x5(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 b5(e,n){if(1&e&&(t.ɵɵelement(0,"tb-copy-button",13),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 w5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"button",16),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 S5(e,n){if(1&e&&(t.ɵɵelementStart(0,"mat-form-field",9)(1,"mat-label",10),t.ɵɵtext(2,"security.access-token"),t.ɵɵelementEnd(),t.ɵɵelement(3,"input",11),t.ɵɵtemplate(4,x5,3,3,"mat-error",12)(5,b5,2,4,"tb-copy-button",13)(6,w5,4,3,"button",14),t.ɵɵelementStart(7,"mat-icon",15),t.ɵɵpipe(8,"translate"),t.ɵɵtext(9,"info_outlined "),t.ɵɵelementEnd()()),2&e){const e=t.ɵɵnextContext();t.ɵɵadvance(4),t.ɵɵproperty("ngIf",e.securityFormGroup.get("accessToken").hasError("required")),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 C5(e,n){1&e&&(t.ɵɵelement(0,"tb-file-input",17),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 _5{constructor(e,t,n){this.fb=e,this.cd=t,this.gatewayCredentialsService=n,this.initialized=new u,this.securityTypes=K3,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){e?this.updateFormBySecurityConfig(e):this.updateFormBySecurityConfig(this.gatewayCredentialsService.credentialsToSecurityConfig(this.gatewayCredentialsService.initialCredentials))}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===$3.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:[$3.ACCESS_TOKEN,[$.required]],accessToken:[null,[$.required,$.pattern(/^[^.\s]+$/)]],caCert:[null,[$.required]],usernamePassword:[]})}setupFormListeners(){this.securityFormGroup.valueChanges.pipe(bn()).subscribe((({usernamePassword:e,...t})=>{this.onChange(e?{...t,...e}:t)})),this.securityFormGroup.get("type").valueChanges.pipe(bn()).subscribe((e=>{this.toggleBySecurityType(e)})),this.securityFormGroup.get("caCert").valueChanges.pipe(bn()).subscribe((()=>this.cd.detectChanges()))}toggleBySecurityType(e){switch(this.securityFormGroup.disable({emitEvent:!1}),this.securityFormGroup.get("type").enable({emitEvent:!1}),e){case $3.ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1});break;case $3.TLS_PRIVATE_KEY:this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case $3.TLS_ACCESS_TOKEN:this.securityFormGroup.get("accessToken").enable({emitEvent:!1}),this.securityFormGroup.get("caCert").enable({emitEvent:!1});break;case $3.USERNAME_PASSWORD:this.securityFormGroup.get("usernamePassword").enable({emitEvent:!1})}}generateAccessToken(){this.securityFormGroup.get("accessToken").patchValue(Re(20))}static{this.ɵfac=function(e){return new(e||_5)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(y5))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:_5,selectors:[["tb-gateway-security-configuration"]],outputs:{initialized:"initialized"},standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>_5)),multi:!0},{provide:K,useExisting:c((()=>_5)),multi:!0}]),t.ɵɵStandaloneFeature],decls:10,vars:8,consts:[[1,"tb-form-panel"],["translate","",1,"tb-form-panel-title"],[3,"formGroup"],["formControlName","type",1,"toggle-group","flex"],[3,"value",4,"ngFor","ngForOf"],["appearance","outline",4,"ngIf"],["formControlName","usernamePassword"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel",4,"ngIf"],[3,"value"],["appearance","outline"],["translate",""],["matInput","","formControlName","accessToken"],[4,"ngIf"],["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"],["formControlName","caCert",3,"hint","label","allowedExtensions","accept","dropLabel"]],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.ɵɵtemplate(5,v5,3,4,"tb-toggle-option",4),t.ɵɵpipe(6,"keyvalue"),t.ɵɵelementEnd(),t.ɵɵtemplate(7,S5,10,5,"mat-form-field",5),t.ɵɵelement(8,"tb-gateway-username-configuration",6),t.ɵɵtemplate(9,C5,4,11,"tb-file-input",7),t.ɵɵelementContainerEnd(),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(3),t.ɵɵproperty("formGroup",n.securityFormGroup),t.ɵɵadvance(2),t.ɵɵproperty("ngForOf",t.ɵɵpipeBind1(6,6,n.securityTypes)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("accesstoken")),t.ɵɵadvance(),t.ɵɵclassProp("hidden","usernamePassword"!==n.securityFormGroup.get("type").value),t.ɵɵadvance(),t.ɵɵproperty("ngIf",n.securityFormGroup.get("type").value.toLowerCase().includes("tls")))},dependencies:t.ɵɵgetComponentDepsFactory(_5,[j,_,f5]),encapsulation:2})}}const T5=["configGroup"];function I5(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 E5(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 M5(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 k5(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 P5(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 D5(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 O5(e,n){if(1&e&&t.ɵɵelement(0,"tb-report-strategy",21),2&e){const e=t.ɵɵnextContext(2);t.ɵɵproperty("defaultValue",e.ReportStrategyDefaultValue.Gateway)}}function A5(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,I5,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,E5,3,3,"mat-error")(26,M5,3,3,"mat-error")(27,k5,3,3,"mat-error")(28,P5,3,3,"mat-error"),t.ɵɵelementStart(29,"mat-icon",16),t.ɵɵpipe(30,"translate"),t.ɵɵtext(31,"info_outlined "),t.ɵɵelementEnd()()()(),t.ɵɵtemplate(32,D5,1,0,"tb-gateway-security-configuration",18),t.ɵɵpipe(33,"async"),t.ɵɵtemplate(34,O5,1,1,"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.ɵɵproperty("ngIf",t.ɵɵpipeBind1(33,22,e.initialCredentials$)),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",e.withReportStrategy)}}function F5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",23)(1,"mat-label",33),t.ɵɵpipe(2,"translate"),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd()(),t.ɵɵelementStart(5,"mat-slide-toggle",34)(6,"mat-label",33),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 R5(e,n){1&e&&(t.ɵɵelementStart(0,"mat-slide-toggle",23),t.ɵɵtext(1),t.ɵɵpipe(2,"translate"),t.ɵɵelementEnd()),2&e&&(t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(2,1,"gateway.statistics.statistics")," "))}function B5(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 N5(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 L5(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 V5(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 q5(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 G5(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 z5(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 U5(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 j5(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 H5(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 W5(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 $5(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 K5(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 Y5(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 X5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",35)(1,"section",36)(2,"section",37)(3,"mat-form-field",38)(4,"mat-label",14),t.ɵɵtext(5,"gateway.statistics.name"),t.ɵɵelementEnd(),t.ɵɵelement(6,"input",39),t.ɵɵtemplate(7,z5,3,3,"mat-error")(8,U5,3,3,"mat-error")(9,j5,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",38)(14,"mat-label",14),t.ɵɵtext(15,"gateway.statistics.timeout"),t.ɵɵelementEnd(),t.ɵɵelement(16,"input",40),t.ɵɵtemplate(17,H5,3,3,"mat-error")(18,W5,3,3,"mat-error")(19,$5,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",41)(25,"mat-label",14),t.ɵɵtext(26,"gateway.statistics.command"),t.ɵɵelementEnd(),t.ɵɵelement(27,"input",42),t.ɵɵtemplate(28,K5,3,3,"mat-error")(29,Y5,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",43)(35,"mat-expansion-panel-header")(36,"mat-panel-title")(37,"div",28),t.ɵɵtext(38,"gateway.advanced-settings"),t.ɵɵelementEnd()()(),t.ɵɵelementStart(39,"mat-form-field",38)(40,"mat-label",14),t.ɵɵtext(41,"gateway.statistics.install-cmd"),t.ɵɵelementEnd(),t.ɵɵelement(42,"input",44),t.ɵɵelementStart(43,"mat-icon",45),t.ɵɵpipe(44,"translate"),t.ɵɵtext(45,"info_outlined "),t.ɵɵelementEnd()()()()(),t.ɵɵelementStart(46,"button",46),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 Z5(e,n){if(1&e){const e=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",7)(1,"div",22),t.ɵɵtemplate(2,F5,10,12)(3,R5,3,3,"mat-slide-toggle",23),t.ɵɵelementStart(4,"mat-form-field",24)(5,"mat-label",14),t.ɵɵtext(6,"gateway.statistics.send-period"),t.ɵɵelementEnd(),t.ɵɵelement(7,"input",25),t.ɵɵtemplate(8,B5,3,3,"mat-error")(9,N5,3,3,"mat-error")(10,L5,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"mat-form-field",24)(12,"mat-label",14),t.ɵɵtext(13,"gateway.statistics.custom-send-period"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",26),t.ɵɵtemplate(15,V5,3,3,"mat-error")(16,q5,3,3,"mat-error")(17,G5,3,3,"mat-error"),t.ɵɵelementEnd()(),t.ɵɵelementStart(18,"div",27)(19,"div",28),t.ɵɵtext(20,"gateway.statistics.commands"),t.ɵɵelementEnd(),t.ɵɵelementStart(21,"div",29),t.ɵɵtext(22,"gateway.hints.commands"),t.ɵɵelementEnd(),t.ɵɵelementContainerStart(23,30),t.ɵɵtemplate(24,X5,50,20,"div",31),t.ɵɵelementStart(25,"button",32),t.ɵɵlistener("click",(function(){t.ɵɵrestoreView(e);const n=t.ɵɵnextContext();return t.ɵɵresetView(n.addCommand())})),t.ɵɵtext(26),t.ɵɵpipe(27,"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.ɵɵproperty("ngForOf",e.commandFormArray().controls),t.ɵɵadvance(),t.ɵɵproperty("disabled",!e.basicFormGroup.get("thingsboard.remoteConfiguration").value),t.ɵɵadvance(),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(27,6,"gateway.statistics.add")," ")}}function Q5(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 J5(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 e6(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 t6(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 n6(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 i6(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 a6(e,n){if(1&e&&(t.ɵɵelementStart(0,"section",37)(1,"mat-form-field",38)(2,"mat-label",14),t.ɵɵtext(3,"gateway.inactivity-timeout-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(4,"input",56),t.ɵɵtemplate(5,Q5,3,3,"mat-error")(6,J5,3,3,"mat-error")(7,e6,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",38)(12,"mat-label",14),t.ɵɵtext(13,"gateway.inactivity-check-period-seconds"),t.ɵɵelementEnd(),t.ɵɵelement(14,"input",57),t.ɵɵtemplate(15,t6,3,3,"mat-error")(16,n6,3,3,"mat-error")(17,i6,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 r6(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 o6(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 s6(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 l6(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 p6(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 c6(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 d6(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 u6(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 m6(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 h6(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 g6(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 f6(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 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.statistics.min-pack-size-to-send-required")))}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.ɵɵtextInterpolate(t.ɵɵpipeBind1(2,1,"gateway.statistics.min-pack-size-to-send-min")))}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.statistics.min-pack-size-to-send-pattern")))}function b6(e,n){if(1&e&&(t.ɵɵelementStart(0,"div",7)(1,"div",47)(2,"div",9),t.ɵɵpipe(3,"translate"),t.ɵɵelementStart(4,"mat-slide-toggle",48),t.ɵɵtext(5),t.ɵɵpipe(6,"translate"),t.ɵɵelementEnd()(),t.ɵɵtemplate(7,a6,21,8,"section",49),t.ɵɵelementEnd(),t.ɵɵelementStart(8,"div",8)(9,"div",28),t.ɵɵtext(10,"gateway.advanced"),t.ɵɵelementEnd(),t.ɵɵelementStart(11,"section",37)(12,"mat-form-field",38)(13,"mat-label",14),t.ɵɵtext(14,"gateway.min-pack-send-delay"),t.ɵɵelementEnd(),t.ɵɵelement(15,"input",50),t.ɵɵtemplate(16,r6,3,3,"mat-error")(17,o6,3,3,"mat-error")(18,s6,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",38)(23,"mat-label",14),t.ɵɵtext(24,"gateway.mqtt-qos"),t.ɵɵelementEnd(),t.ɵɵelementStart(25,"mat-select",51)(26,"mat-option",52),t.ɵɵtext(27,"0"),t.ɵɵelementEnd(),t.ɵɵelementStart(28,"mat-option",52),t.ɵɵtext(29,"1"),t.ɵɵelementEnd()(),t.ɵɵtemplate(30,l6,3,3,"mat-error")(31,p6,3,3,"mat-error")(32,c6,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",37)(37,"mat-form-field",38)(38,"mat-label",14),t.ɵɵtext(39,"gateway.statistics.check-connectors-configuration"),t.ɵɵelementEnd(),t.ɵɵelement(40,"input",53),t.ɵɵtemplate(41,d6,3,3,"mat-error")(42,u6,3,3,"mat-error")(43,m6,3,3,"mat-error"),t.ɵɵelementEnd(),t.ɵɵelementStart(44,"mat-form-field",38)(45,"mat-label",14),t.ɵɵtext(46,"gateway.statistics.max-payload-size-bytes"),t.ɵɵelementEnd(),t.ɵɵelement(47,"input",54),t.ɵɵtemplate(48,h6,3,3,"mat-error")(49,g6,3,3,"mat-error")(50,f6,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",37)(55,"mat-form-field",38)(56,"mat-label",14),t.ɵɵtext(57,"gateway.statistics.min-pack-size-to-send"),t.ɵɵelementEnd(),t.ɵɵelement(58,"input",55),t.ɵɵtemplate(59,y6,3,3,"mat-error")(60,v6,3,3,"mat-error")(61,x6,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.ɵɵproperty("ngIf",e.basicFormGroup.get("thingsboard.checkingDeviceActivity.checkDeviceInactivity").value),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 w6{constructor(e,t,n,i,a){this.fb=e,this.deviceService=t,this.gatewayCredentialsService=n,this.destroyRef=i,this.dialog=a,this.gatewayVersion=pt.Legacy,this.dialogMode=!1,this.withReportStrategy=!1,this.initialized=new u,this.ReportStrategyDefaultValue=en,this.initialCredentials$=this.gatewayCredentialsService.initialCredentials$,this.onChange=()=>{},this.destroy$=new te,this.initBasicFormGroup(),this.observeFormChanges(),this.basicFormGroup.valueChanges.pipe(le(this.destroy$)).subscribe((e=>{this.onChange(e)}))}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=q3[this.defaultTab])}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}registerOnChange(e){this.onChange=e}registerOnTouched(e){}writeValue(e){this.basicFormGroup.patchValue(e,{emitEvent:!1});const t=e?.thingsboard?.statistics?.commands??[];this.commandFormArray().clear({emitEvent:!1}),t.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(le(this.destroy$)).subscribe((e=>{this.dialog.open(pW,{disableClose:!0,panelClass:["tb-dialog","tb-fullscreen-dialog"],data:{gatewayName:e.name}}).afterClosed().pipe(ye(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,[$.required,$.pattern(an),this.uniqNameRequired()]],command:[i,[$.required,$.pattern(/^(?=\S).*\S$/)]],timeout:[a,[$.required,$.min(1),$.pattern(nn),$.pattern(/^[^.\s]+$/)]],installCmd:[r,$.pattern(an)]});this.commandFormArray().push(o,{emitEvent:t})}uniqNameRequired(){return e=>{const t=e.value?.trim().toLowerCase(),n=e.dirty&&t&&this.commandFormArray().value.some((e=>e.attributeOnGateway?.toLowerCase()===t));return n?{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,[$.required,$.pattern(/^[^\s]+$/)]],port:[1883,[$.required,$.min(1),$.max(65535),$.pattern(nn)]],remoteShell:[!1],remoteConfiguration:[!0],checkConnectorsConfigurationInSeconds:[60,[$.required,$.min(1),$.pattern(nn)]],statistics:this.fb.group({enable:[!0],enableCustom:[{value:!1,disabled:!0}],statsSendPeriodInSeconds:[3600,[$.required,$.min(60),$.pattern(nn)]],customStatsSendPeriodInSeconds:[3600,[$.required,$.min(60),$.pattern(nn)]],commands:this.fb.array([])}),maxPayloadSizeBytes:[8196,[$.required,$.min(100),$.pattern(nn)]],minPackSendDelayMS:[50,[$.required,$.min(10),$.pattern(nn)]],minPackSizeToSend:[500,[$.required,$.min(100),$.pattern(nn)]],handleDeviceRenaming:[!0],checkingDeviceActivity:this.initCheckingDeviceActivityFormGroup(),security:[],qos:[1],reportStrategy:[{value:{type:Jt.OnReceived},disabled:!0}]})}initCheckingDeviceActivityFormGroup(){return this.fb.group({checkDeviceInactivity:[!1],inactivityTimeoutSeconds:[300,[$.min(1),$.pattern(nn)]],inactivityCheckPeriodSeconds:[10,[$.min(1),$.pattern(nn)]]})}onVersionChange(){if(this.hasUpdatedStatistics=za.parseVersion(this.gatewayVersion)>=za.parseVersion(pt.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(bn(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(le(this.destroy$)).subscribe((e=>{e||this.openConfigurationConfirmDialog()}))}observeDeviceActivityChanges(){const e=this.basicFormGroup.get("thingsboard.checkingDeviceActivity");e.get("checkDeviceInactivity").valueChanges.pipe(le(this.destroy$)).subscribe((t=>{e.updateValueAndValidity();const n=[$.min(1),$.required,$.pattern(nn)];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||w6)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.DeviceService),t.ɵɵdirectiveInject(y5),t.ɵɵdirectiveInject(t.DestroyRef),t.ɵɵdirectiveInject(qe.MatDialog))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:w6,selectors:[["tb-gateway-basic-configuration"]],viewQuery:function(e,n){if(1&e&&t.ɵɵviewQuery(T5,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:W,useExisting:c((()=>w6)),multi:!0},{provide:K,useExisting:c((()=>w6)),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",3,"initialized",4,"ngIf"],["class","tb-form-panel","formControlName","reportStrategy",3,"defaultValue",4,"ngIf"],["formControlName","security",3,"initialized"],["formControlName","reportStrategy",1,"tb-form-panel",3,"defaultValue"],["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","class","statistics-container flex flex-row",4,"ngFor","ngForOf"],["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"],["formArrayName","commands",1,"statistics-container","flex","flex-row"],[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"],["class","tb-form-row no-border no-padding tb-standard-fields column-xs",4,"ngIf"],["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,A5,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,Z5,28,8,"ng-template",3),t.ɵɵelementEnd(),t.ɵɵelementStart(17,"mat-tab",2),t.ɵɵpipe(18,"translate"),t.ɵɵtemplate(19,b6,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(w6,[j,_,Xn,E4,$4,r5,_5]),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",w6),Ge([I()],w6.prototype,"dialogMode",void 0),Ge([I()],w6.prototype,"withReportStrategy",void 0);class S6{constructor(e){this.fb=e,this.destroy$=new te,this.advancedFormControl=this.fb.control(""),this.advancedFormControl.valueChanges.pipe(le(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||S6)(t.ɵɵdirectiveInject(H.FormBuilder))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:S6,selectors:[["tb-gateway-advanced-configuration"]],standalone:!0,features:[t.ɵɵProvidersFeature([{provide:W,useExisting:c((()=>S6)),multi:!0},{provide:K,useExisting:c((()=>S6)),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(S6,[j,_]),encapsulation:2})}}function C6(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 _6(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 T6(e,n){1&e&&t.ɵɵelement(0,"tb-gateway-advanced-configuration",10)}function I6(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",S6);class E6{constructor(e,t,n,i,a){this.fb=e,this.attributeService=t,this.cd=n,this.gatewayCredentialsService=i,this.destroyRef=a,this.ConfigurationModes=Qt,this.gatewayConfigAttributeKeys=["general_configuration","grpc_configuration","logs_configuration","storage_configuration","RemoteLoggingLevel","mode"],this.useUpdatedLogs=!1,this.gatewayConfigGroup=this.fb.group({basicConfig:[],advancedConfig:[],mode:[Qt.BASIC]}),this.observeAlignConfigs()}ngAfterViewInit(){this.fetchConfigAttribute(this.device)}saveConfig(){const{mode:e,advancedConfig:t}=Ne(this.removeEmpty(this.gatewayConfigGroup.value)),n={mode:e,...t};n.thingsboard.statistics.commands=Object.values(n.thingsboard.statistics.commands??[]);const i=this.generateAttributes(n);this.attributeService.saveEntityAttributes(this.device,D.SHARED_SCOPE,i).pipe(xe((e=>this.gatewayCredentialsService.updateCredentials(n.thingsboard.security))),bn(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(bn(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("advancedConfig");Se(t.value,e)||this.gatewayConfigGroup.get("mode").value!==Qt.BASIC||t.patchValue(e,{emitEvent:!1})})),this.gatewayConfigGroup.get("advancedConfig").valueChanges.pipe(bn(this.destroyRef)).subscribe((e=>{const t=this.gatewayConfigGroup.get("basicConfig");Se(t.value,e)||this.gatewayConfigGroup.get("mode").value!==Qt.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??lt.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"},...this.useUpdatedLogs?{}:{databaseHandler:{class:this.useUpdatedLogs?Y3:X3,formatter:"LogFormatter",filename:"./logs/database.log",backupCount:1,encoding:"utf-8"}}},loggers:{...this.useUpdatedLogs?{}:{database:{handlers:["databaseHandler","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?Y3:X3,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!==B&&this.attributeService.getEntityAttributes(e,D.CLIENT_SCOPE).pipe(we((t=>t.length?ae(t):this.attributeService.getEntityAttributes(e,D.SHARED_SCOPE,this.gatewayConfigAttributeKeys))),bn(this.destroyRef)).subscribe((e=>{this.gatewayVersion=e.find((e=>"Version"===e.key))?.value,this.useUpdatedLogs=za.parseVersion(this.gatewayVersion??pt.Legacy)>=za.parseVersion(pt.v3_6_3),this.updateConfigs(e),this.cd.detectChanges()}))}updateConfigs(e){let t={},n=lt.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??Qt.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(ue(Boolean),ye(1),bn(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(z3).reduce(((t,n)=>{const i=e.handlers[`${n}Handler`]||{},a=e.loggers[n]||{};return t[n]={logLevel:a.level||lt.INFO,filePath:i.filename?.split(`/${n}`)[0]||"./logs",backupCount:i.backupCount||7,savingTime:i.interval||3,savingPeriod:i.when||H3.days},t}),{}),logFormat:t,dateFormat:n}}static{this.ɵfac=function(e){return new(e||E6)(t.ɵɵdirectiveInject(H.FormBuilder),t.ɵɵdirectiveInject(_e.AttributeService),t.ɵɵdirectiveInject(t.ChangeDetectorRef),t.ɵɵdirectiveInject(y5),t.ɵɵdirectiveInject(t.DestroyRef))}}static{this.ɵcmp=t.ɵɵdefineComponent({type:E6,selectors:[["tb-gateway-configuration"]],inputs:{device:"device",defaultTab:"defaultTab",dialogRef:"dialogRef"},standalone:!0,features:[t.ɵɵProvidersFeature([y5]),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",3,"click",4,"ngIf"],[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,C6,3,0,"button",7),t.ɵɵelementEnd()()(),t.ɵɵelementStart(16,"div",8),t.ɵɵtemplate(17,_6,2,7,"tb-gateway-basic-configuration",9)(18,T6,1,0,"tb-gateway-advanced-configuration",10),t.ɵɵelementEnd(),t.ɵɵelementStart(19,"div",11),t.ɵɵtemplate(20,I6,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.ɵɵproperty("ngIf",n.dialogRef),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(E6,[j,_,Ka,w6,S6]),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",E6);class M6{constructor(){}static{this.ɵfac=function(e){return new(e||M6)}}static{this.ɵcmp=t.ɵɵdefineComponent({type:M6,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}.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 .\\!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 k6=(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 P6{constructor(e){this.translate=e,function(e){e.setTranslation("en_US",gt,!0),e.setTranslation("ar_AE",ft,!0),e.setTranslation("ca_ES",yt,!0),e.setTranslation("cs_CZ",vt,!0),e.setTranslation("da_DK",xt,!0),e.setTranslation("es_ES",bt,!0),e.setTranslation("ko_KR",wt,!0),e.setTranslation("lt_LT",St,!0),e.setTranslation("nl_BE",Ct,!0),e.setTranslation("pl_PL",_t,!0),e.setTranslation("pt_BR",Tt,!0),e.setTranslation("sl_SI",It,!0),e.setTranslation("tr_TR",Et,!0),e.setTranslation("zh_CN",Mt,!0),e.setTranslation("zh_TW",kt,!0)}(e),(e=>{k6(M6,e)})("tb-gateway-css")}static{this.ɵfac=function(e){return new(e||P6)(t.ɵɵinject(He.TranslateService))}}static{this.ɵmod=t.ɵɵdefineNgModule({type:P6})}static{this.ɵinj=t.ɵɵdefineInjector({imports:[j,_,$e,hj,sW,i$,E6,xn,V3,L3]})}}e("GatewayExtensionModule",P6),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(P6,{imports:[j,_,$e,hj,sW,i$,E6,xn,V3,L3]})}}}));//# sourceMappingURL=gateway-management-extension.js.map From 1ad2acc27c5e4d0a67ef69bb32b7271e72d78eec Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 13:43:17 +0300 Subject: [PATCH 259/286] changed log level and wrote description for yml variables --- .../server/service/cf/DefaultCalculatedFieldCache.java | 2 +- .../queue/DefaultTbCalculatedFieldConsumerService.java | 2 +- application/src/main/resources/thingsboard.yml | 4 ++-- .../service/queue/DefaultTbCoreConsumerServiceTest.java | 4 ---- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java index 219a261183..ed35d96cb7 100644 --- a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java +++ b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldCache.java @@ -64,7 +64,7 @@ public class DefaultCalculatedFieldCache implements CalculatedFieldCache { private final ConcurrentMap> entityIdCalculatedFieldLinks = new ConcurrentHashMap<>(); private final ConcurrentMap calculatedFieldsCtx = new ConcurrentHashMap<>(); - @Value("${calculatedField.initFetchPackSize:50000}") + @Value("${queue.calculated_fields.init_fetch_pack_size:50000}") @Getter private int initFetchPackSize; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java index 41bf76ff0e..f8c398b016 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbCalculatedFieldConsumerService.java @@ -175,7 +175,7 @@ public class DefaultTbCalculatedFieldConsumerService extends AbstractPartitionBa packSubmitFuture.cancel(true); log.info("Timeout to process message: {}", pendingMsgHolder.getMsg()); } - ctx.getAckMap().forEach((id, msg) -> log.debug("[{}] Timeout to process message: {}", id, msg.getValue())); + ctx.getAckMap().forEach((id, msg) -> log.warn("[{}] Timeout to process message: {}", id, msg.getValue())); ctx.getFailedMap().forEach((id, msg) -> log.warn("[{}] Failed to process message: {}", id, msg.getValue())); } consumer.commit(); diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 14f0437402..76f148c099 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1848,9 +1848,9 @@ queue: pool_size: "${TB_QUEUE_CF_POOL_SIZE:8}" # RocksDB path for storing CF states rocks_db_path: "${TB_QUEUE_CF_ROCKS_DB_PATH:${user.home}/.rocksdb/cf_states}" - # The fetch size specifies how many rows will be returned + # The fetch size specifies how many rows will be fetched from the database per request for initial fetching init_fetch_pack_size: "${TB_QUEUE_CF_FETCH_PACK_SIZE:50000}" - # The fetch size specifies how many rows will be returned + # The fetch size specifies how many rows will be fetched from the database per request for per-tenant fetching init_tenant_fetch_pack_size: "${TB_QUEUE_CF_TENANT_FETCH_PACK_SIZE:1000}" transport: # For high-priority notifications that require minimum latency and processing time diff --git a/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java b/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java index 4a5ecef970..26832f6176 100644 --- a/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/queue/DefaultTbCoreConsumerServiceTest.java @@ -24,7 +24,6 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.slf4j.Logger; import org.springframework.test.util.ReflectionTestUtils; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.TenantId; @@ -52,8 +51,6 @@ public class DefaultTbCoreConsumerServiceTest { private TbCoreConsumerStats statsMock; @Mock private RuleEngineCallService ruleEngineCallServiceMock; - @Mock - private Logger logMock; @Mock private TbCallback tbCallbackMock; @@ -72,7 +69,6 @@ public class DefaultTbCoreConsumerServiceTest { executor = MoreExecutors.newDirectExecutorService(); ReflectionTestUtils.setField(defaultTbCoreConsumerServiceMock, "stateService", stateServiceMock); ReflectionTestUtils.setField(defaultTbCoreConsumerServiceMock, "deviceActivityEventsExecutor", executor); - ReflectionTestUtils.setField(defaultTbCoreConsumerServiceMock, "log", logMock); } @AfterEach From 5f99c0bae2672351dbc357819a1f91ff884a8392 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Fri, 11 Apr 2025 15:32:55 +0300 Subject: [PATCH 260/286] added validation for entity name filter --- .../server/common/data/edqs/fields/EntityFields.java | 2 +- .../server/dao/entity/BaseEntityService.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java b/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java index 1b0975542c..b1a22e6c8a 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java @@ -147,7 +147,7 @@ public interface EntityFields { default String getAsString(String key) { return switch (key) { - case "createdTime" -> Long.toString(getCreatedTime()); + case "createdTime", "created_time" -> Long.toString(getCreatedTime()); case "title" -> getName(); case "type" -> getType(); case "label" -> getLabel(); diff --git a/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java b/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java index 4df33779ee..604cceff09 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/entity/BaseEntityService.java @@ -43,6 +43,7 @@ import org.thingsboard.server.common.data.query.EntityDataQuery; import org.thingsboard.server.common.data.query.EntityFilterType; import org.thingsboard.server.common.data.query.EntityKey; import org.thingsboard.server.common.data.query.EntityListFilter; +import org.thingsboard.server.common.data.query.EntityNameFilter; import org.thingsboard.server.common.data.query.EntityTypeFilter; import org.thingsboard.server.common.data.query.KeyFilter; import org.thingsboard.server.common.data.query.RelationsQueryFilter; @@ -61,6 +62,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import static org.thingsboard.server.common.data.id.EntityId.NULL_UUID; +import static org.thingsboard.server.common.data.query.EntityFilterType.ENTITY_NAME; import static org.thingsboard.server.common.data.query.EntityFilterType.ENTITY_TYPE; import static org.thingsboard.server.dao.service.Validator.validateEntityDataPageLink; import static org.thingsboard.server.dao.service.Validator.validateId; @@ -250,6 +252,8 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe validateRelationQuery((RelationsQueryFilter) query.getEntityFilter()); } else if (query.getEntityFilter().getType().equals(ENTITY_TYPE)) { validateEntityTypeQuery((EntityTypeFilter) query.getEntityFilter()); + } else if (query.getEntityFilter().getType().equals(ENTITY_NAME)) { + validateEntityNameQuery((EntityNameFilter) query.getEntityFilter()); } } @@ -264,6 +268,12 @@ public class BaseEntityService extends AbstractEntityService implements EntitySe } } + private static void validateEntityNameQuery(EntityNameFilter filter) { + if (filter.getEntityType() == null) { + throw new IncorrectParameterException("Entity type is required"); + } + } + private static void validateRelationQuery(RelationsQueryFilter queryFilter) { if (queryFilter.isMultiRoot() && queryFilter.getMultiRootEntitiesType() == null) { throw new IncorrectParameterException("Multi-root relation query filter should contain 'multiRootEntitiesType'"); From 53ffd00184cd49c2b45132d41f54074ec42c8cce Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Fri, 11 Apr 2025 16:04:57 +0300 Subject: [PATCH 261/286] reverted "created_time" field support --- .../server/common/data/edqs/fields/EntityFields.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java b/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java index b1a22e6c8a..1b0975542c 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/edqs/fields/EntityFields.java @@ -147,7 +147,7 @@ public interface EntityFields { default String getAsString(String key) { return switch (key) { - case "createdTime", "created_time" -> Long.toString(getCreatedTime()); + case "createdTime" -> Long.toString(getCreatedTime()); case "title" -> getName(); case "type" -> getType(); case "label" -> getLabel(); From dfbb753d5e0f2ae79743598ec54254893e6ebbfa Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 11 Apr 2025 16:13:52 +0300 Subject: [PATCH 262/286] UI: Fixed empty delete dialog in javascript library panel --- .../entity-details-page-component.models.ts | 1 + .../js-library-table-config.resolver.ts | 23 ++++++++++++------- .../admin/resource/js-resource.component.html | 2 +- .../admin/resource/js-resource.component.ts | 3 --- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/app/modules/home/models/entity/entity-details-page-component.models.ts b/ui-ngx/src/app/modules/home/models/entity/entity-details-page-component.models.ts index 704e18abe5..88ca8e69e5 100644 --- a/ui-ngx/src/app/modules/home/models/entity/entity-details-page-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/entity/entity-details-page-component.models.ts @@ -16,4 +16,5 @@ export interface IEntityDetailsPageComponent { reload(): void; + goBack(): void; } diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts index 8525983a36..cd992f8886 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-library-table-config.resolver.ts @@ -26,10 +26,10 @@ import { Router } from '@angular/router'; import { Resource, ResourceInfo, + ResourceInfoWithReferences, ResourceSubType, ResourceSubTypeTranslationMap, ResourceType, - ResourceInfoWithReferences, toResourceDeleteResult } from '@shared/models/resource.models'; import { EntityType, entityTypeResources } from '@shared/models/entity-type.models'; @@ -57,7 +57,6 @@ import { ResourcesInUseDialogData } from "@shared/components/resource/resources-in-use-dialog.component"; import { ResourcesDatasource } from "@home/pages/admin/resource/resources-datasource"; -import { AuthUser } from '@shared/models/user.model'; @Injectable() export class JsLibraryTableConfigResolver { @@ -166,6 +165,8 @@ export class JsLibraryTableConfigResolver { case 'downloadResource': this.downloadResource(action.event, action.entity); return true; + case 'deleteLibrary': + this.deleteResource(action.event, action.entity); } return false; } @@ -200,7 +201,11 @@ export class JsLibraryTableConfigResolver { ).subscribe( (deleteResult) => { if (deleteResult.success) { - this.config.updateData(); + if (this.config.getEntityDetailsPage()) { + this.config.getEntityDetailsPage().goBack(); + } else { + this.config.updateData(true); + } } else if (deleteResult.resourceIsReferencedError) { const resources: ResourceInfoWithReferences[] = [{...resource, ...{references: deleteResult.references}}]; const data = { @@ -221,11 +226,13 @@ export class JsLibraryTableConfigResolver { data }).afterClosed().subscribe((resources) => { if (resources) { - this.resourceService.deleteResource(resource.id.id, true).subscribe( - () => { - this.config.updateData(); + this.resourceService.deleteResource(resource.id.id, true).subscribe(() => { + if (this.config.getEntityDetailsPage()) { + this.config.getEntityDetailsPage().goBack(); + } else { + this.config.updateData(true); } - ); + }); } }); } else { @@ -276,7 +283,7 @@ export class JsLibraryTableConfigResolver { message: this.translate.instant('javascript.javascript-resources-are-in-use-text'), deleteText: 'javascript.delete-javascript-resource-in-use-text', selectedText: 'javascript.selected-javascript-resources', - datasource: new ResourcesDatasource(this.resourceService, resourcesWithReferences, entity => true), + datasource: new ResourcesDatasource(this.resourceService, resourcesWithReferences, () => true), columns: ['select', 'title', 'references'] } }; diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html index 62036a8ea1..c9f7483bdc 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.html @@ -30,7 +30,7 @@ diff --git a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.ts b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.ts index 5b931c438f..4a67bd10c8 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/resource/js-resource.component.ts @@ -34,7 +34,6 @@ import { startWith, takeUntil } from 'rxjs/operators'; import { ActionNotificationShow } from '@core/notification/notification.actions'; import { isDefinedAndNotNull } from '@core/utils'; import { getCurrentAuthState } from '@core/auth/auth.selectors'; -import { scadaSymbolGeneralStateHighlightRules } from '@home/pages/scada-symbol/scada-symbol-editor.models'; @Component({ selector: 'tb-js-resource', @@ -171,6 +170,4 @@ export class JsResourceComponent extends EntityComponent implements On this.entityForm.get('content').enable({ emitEvent: false }); } } - - protected readonly highlightRules = scadaSymbolGeneralStateHighlightRules; } From fdf8596ccbabe93ec1bf11f121103e04981ebaf5 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 11 Apr 2025 16:45:04 +0300 Subject: [PATCH 263/286] UI: Fixed show help popover when use slow network --- ui-ngx/src/app/shared/components/popover.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/popover.component.ts b/ui-ngx/src/app/shared/components/popover.component.ts index 2ccbb615d5..6dc4dab12a 100644 --- a/ui-ngx/src/app/shared/components/popover.component.ts +++ b/ui-ngx/src/app/shared/components/popover.component.ts @@ -472,7 +472,7 @@ export class TbPopoverComponent implements OnDestroy, OnInit { set tbOverlayStyle(value: { [klass: string]: any }) { this._tbOverlayStyle = value; - this.cdr.markForCheck(); + this.cdr.detectChanges(); } get tbOverlayStyle(): { [klass: string]: any } { From 12739b60ceaa2c2e0ec8cc2f44979ef1ff796feb Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 17:05:04 +0300 Subject: [PATCH 264/286] moved initFetchPackSize property to settings --- .../server/actors/ActorSystemContext.java | 6 ++++++ .../CalculatedFieldManagerMessageProcessor.java | 17 +++++++---------- .../TbQueueCalculatedFieldSettings.java | 2 ++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java index b5fa1e6fbd..26c82a33de 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java @@ -106,6 +106,7 @@ import org.thingsboard.server.dao.widget.WidgetsBundleService; import org.thingsboard.server.queue.discovery.DiscoveryService; import org.thingsboard.server.queue.discovery.PartitionService; import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; +import org.thingsboard.server.queue.settings.TbQueueCalculatedFieldSettings; import org.thingsboard.server.service.apiusage.TbApiUsageStateService; import org.thingsboard.server.service.cf.CalculatedFieldProcessingService; import org.thingsboard.server.service.cf.CalculatedFieldQueueService; @@ -459,6 +460,11 @@ public class ActorSystemContext { @Getter private DebugModeRateLimitsConfig debugModeRateLimitsConfig; + @Lazy + @Autowired(required = false) + @Getter + private TbQueueCalculatedFieldSettings calculatedFieldSettings; + /** * The following Service will be null if we operate in tb-core mode */ diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index a896bbd74b..ba15bd10f2 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -15,9 +15,7 @@ */ package org.thingsboard.server.actors.calculatedField; -import lombok.Getter; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; import org.thingsboard.server.actors.ActorSystemContext; import org.thingsboard.server.actors.TbActorCtx; import org.thingsboard.server.actors.TbActorRef; @@ -47,6 +45,7 @@ import org.thingsboard.server.common.msg.queue.TbCallback; import org.thingsboard.server.dao.asset.AssetService; import org.thingsboard.server.dao.cf.CalculatedFieldService; import org.thingsboard.server.dao.device.DeviceService; +import org.thingsboard.server.queue.settings.TbQueueCalculatedFieldSettings; import org.thingsboard.server.service.cf.CalculatedFieldProcessingService; import org.thingsboard.server.service.cf.CalculatedFieldStateService; import org.thingsboard.server.service.cf.cache.TenantEntityProfileCache; @@ -82,14 +81,11 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware private final TbAssetProfileCache assetProfileCache; private final TbDeviceProfileCache deviceProfileCache; private final TenantEntityProfileCache entityProfileCache; + private final TbQueueCalculatedFieldSettings cfSettings; protected final TenantId tenantId; protected TbActorCtx ctx; - @Value("${queue.calculated_fields.init_tenant_fetch_pack_size:1000}") - @Getter - private int initFetchPackSize; - CalculatedFieldManagerMessageProcessor(ActorSystemContext systemContext, TenantId tenantId) { super(systemContext); this.cfExecService = systemContext.getCalculatedFieldProcessingService(); @@ -100,6 +96,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware this.assetProfileCache = systemContext.getAssetProfileCache(); this.deviceProfileCache = systemContext.getDeviceProfileCache(); this.entityProfileCache = new TenantEntityProfileCache(); + this.cfSettings = systemContext.getCalculatedFieldSettings(); this.tenantId = tenantId; } @@ -566,7 +563,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware } public void initCalculatedFields() { - PageDataIterable cfs = new PageDataIterable<>(pageLink -> cfDaoService.findCalculatedFieldsByTenantId(tenantId, pageLink), initFetchPackSize); + PageDataIterable cfs = new PageDataIterable<>(pageLink -> cfDaoService.findCalculatedFieldsByTenantId(tenantId, pageLink), cfSettings.getInitTenantFetchPackSize()); cfs.forEach(cf -> { log.trace("Processing calculated field record: {}", cf); try { @@ -578,14 +575,14 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware calculatedFields.values().forEach(cf -> { entityIdCalculatedFields.computeIfAbsent(cf.getEntityId(), id -> new CopyOnWriteArrayList<>()).add(cf); }); - PageDataIterable cfls = new PageDataIterable<>(pageLink -> cfDaoService.findAllCalculatedFieldLinksByTenantId(tenantId, pageLink), initFetchPackSize); + PageDataIterable cfls = new PageDataIterable<>(pageLink -> cfDaoService.findAllCalculatedFieldLinksByTenantId(tenantId, pageLink), cfSettings.getInitTenantFetchPackSize()); cfls.forEach(link -> { onLinkInitMsg(new CalculatedFieldLinkInitMsg(link.getTenantId(), link)); }); } private void initEntityProfileCache() { - PageDataIterable deviceIdInfos = new PageDataIterable<>(pageLink -> deviceService.findProfileEntityIdInfosByTenantId(tenantId, pageLink), initFetchPackSize); + PageDataIterable deviceIdInfos = new PageDataIterable<>(pageLink -> deviceService.findProfileEntityIdInfosByTenantId(tenantId, pageLink), cfSettings.getInitTenantFetchPackSize()); for (ProfileEntityIdInfo idInfo : deviceIdInfos) { log.trace("Processing device record: {}", idInfo); try { @@ -594,7 +591,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware log.error("Failed to process device record: {}", idInfo, e); } } - PageDataIterable assetIdInfos = new PageDataIterable<>(pageLink -> assetService.findProfileEntityIdInfosByTenantId(tenantId, pageLink), initFetchPackSize); + PageDataIterable assetIdInfos = new PageDataIterable<>(pageLink -> assetService.findProfileEntityIdInfosByTenantId(tenantId, pageLink), cfSettings.getInitTenantFetchPackSize()); for (ProfileEntityIdInfo idInfo : assetIdInfos) { log.trace("Processing asset record: {}", idInfo); try { diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/settings/TbQueueCalculatedFieldSettings.java b/common/queue/src/main/java/org/thingsboard/server/queue/settings/TbQueueCalculatedFieldSettings.java index c2de8eff4e..9a87e88416 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/settings/TbQueueCalculatedFieldSettings.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/settings/TbQueueCalculatedFieldSettings.java @@ -31,5 +31,7 @@ public class TbQueueCalculatedFieldSettings { @Value("${queue.calculated_fields.state_topic}") private String stateTopic; + @Value("${queue.calculated_fields.init_tenant_fetch_pack_size:1000}") + private int initTenantFetchPackSize; } From 68eb2b6a3a809a71343f1b1a7f2e0977afa35cf4 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 17:14:32 +0300 Subject: [PATCH 265/286] fixed tenant and customer update --- .../CalculatedFieldManagerMessageProcessor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java index ba15bd10f2..ba1ca71bda 100644 --- a/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java +++ b/application/src/main/java/org/thingsboard/server/actors/calculatedField/CalculatedFieldManagerMessageProcessor.java @@ -535,8 +535,7 @@ public class CalculatedFieldManagerMessageProcessor extends AbstractContextAware return switch (entityId.getEntityType()) { case ASSET -> assetProfileCache.get(tenantId, (AssetId) entityId).getId(); case DEVICE -> deviceProfileCache.get(tenantId, (DeviceId) entityId).getId(); - default -> - throw new IllegalArgumentException("'" + entityId.getEntityType() + "' is not profile entity." + entityId); + default -> null; }; } From df5ff6c0bbd1ae16bf68e8badab57d1c404cb56d Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 11 Apr 2025 17:22:07 +0300 Subject: [PATCH 266/286] UI: Fixed check relation rule node validation when change enity type --- .../filter/check-relation-config.component.ts | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/rule-node/filter/check-relation-config.component.ts b/ui-ngx/src/app/modules/home/components/rule-node/filter/check-relation-config.component.ts index 95ba48e79a..fdc9d99107 100644 --- a/ui-ngx/src/app/modules/home/components/rule-node/filter/check-relation-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/rule-node/filter/check-relation-config.component.ts @@ -54,24 +54,29 @@ export class CheckRelationConfigComponent extends RuleNodeConfigurationComponent this.checkRelationConfigForm = this.fb.group({ checkForSingleEntity: [configuration.checkForSingleEntity, []], direction: [configuration.direction, []], - entityType: [configuration.entityType, - configuration && configuration.checkForSingleEntity ? [Validators.required] : []], - entityId: [configuration.entityId, - configuration && configuration.checkForSingleEntity ? [Validators.required] : []], + entityType: [configuration.entityType, [Validators.required]], + entityId: [configuration.entityId, [Validators.required]], relationType: [configuration.relationType, [Validators.required]] }); } protected validatorTriggers(): string[] { - return ['checkForSingleEntity']; + return ['checkForSingleEntity', 'entityType']; } - protected updateValidators(emitEvent: boolean) { - const checkForSingleEntity: boolean = this.checkRelationConfigForm.get('checkForSingleEntity').value; - this.checkRelationConfigForm.get('entityType').setValidators(checkForSingleEntity ? [Validators.required] : []); - this.checkRelationConfigForm.get('entityType').updateValueAndValidity({emitEvent}); - this.checkRelationConfigForm.get('entityId').setValidators(checkForSingleEntity ? [Validators.required] : []); - this.checkRelationConfigForm.get('entityId').updateValueAndValidity({emitEvent}); + protected updateValidators(_emitEvent: boolean, trigger: string) { + if (trigger === 'entityType') { + this.checkRelationConfigForm.get('entityId').reset(null); + } else { + const checkForSingleEntity: boolean = this.checkRelationConfigForm.get('checkForSingleEntity').value; + if (checkForSingleEntity) { + this.checkRelationConfigForm.get('entityType').enable({emitEvent: false}); + this.checkRelationConfigForm.get('entityId').enable({emitEvent: false}); + } else { + this.checkRelationConfigForm.get('entityType').disable({emitEvent: false}); + this.checkRelationConfigForm.get('entityId').disable({emitEvent: false}); + } + } } } From 469b3f81b76266513962a065d241a4c82fa129d1 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Fri, 11 Apr 2025 17:29:31 +0300 Subject: [PATCH 267/286] removed sending partition change event --- .../java/org/thingsboard/server/actors/tenant/TenantActor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index 2a039327f2..f0d330726d 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -283,7 +283,6 @@ public class TenantActor extends RuleChainManagerActor { log.info("[{}] Failed to init CF Actor.", tenantId, e); } } - cfActor.tellWithHighPriority(msg); if (!ruleChainsInitialized) { log.info("Tenant {} is now managed by this service, initializing rule chains", tenantId); initRuleChains(); From 3405e96370936b745540d3bdc2bf393dd4a57df7 Mon Sep 17 00:00:00 2001 From: trikimiki <41070061+trikimiki@users.noreply.github.com> Date: Fri, 11 Apr 2025 17:36:38 +0300 Subject: [PATCH 268/286] fix newlines missing '\' in compose scripts --- docker/docker-install-tb.sh | 6 ++---- docker/docker-update-service.sh | 6 ++---- docker/docker-upgrade-tb.sh | 9 +++------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/docker/docker-install-tb.sh b/docker/docker-install-tb.sh index aa68a2252f..fa50e58c8e 100755 --- a/docker/docker-install-tb.sh +++ b/docker/docker-install-tb.sh @@ -56,8 +56,7 @@ ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $? if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then COMPOSE_ARGS="\ - -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} - ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ + -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ up -d ${ADDITIONAL_STARTUP_SERVICES}" case $COMPOSE_VERSION in @@ -74,8 +73,7 @@ if [ ! -z "${ADDITIONAL_STARTUP_SERVICES// }" ]; then fi COMPOSE_ARGS="\ - -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} - ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ + -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ run --no-deps --rm -e INSTALL_TB=true -e LOAD_DEMO=${loadDemo} \ tb-core1" diff --git a/docker/docker-update-service.sh b/docker/docker-update-service.sh index de1fe0a89a..b77b7bbf6c 100755 --- a/docker/docker-update-service.sh +++ b/docker/docker-update-service.sh @@ -30,13 +30,11 @@ ADDITIONAL_CACHE_ARGS=$(additionalComposeCacheArgs) || exit $? ADDITIONAL_COMPOSE_EDQS_ARGS=$(additionalComposeEdqsArgs) || exit $? COMPOSE_ARGS_PULL="\ - -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} - ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ + -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ pull" COMPOSE_ARGS_BUILD="\ - -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} - ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ + -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ up -d --no-deps --build" case $COMPOSE_VERSION in diff --git a/docker/docker-upgrade-tb.sh b/docker/docker-upgrade-tb.sh index 05293e475e..4bf2c0807e 100755 --- a/docker/docker-upgrade-tb.sh +++ b/docker/docker-upgrade-tb.sh @@ -47,19 +47,16 @@ ADDITIONAL_COMPOSE_EDQS_ARGS=$(additionalComposeEdqsArgs) || exit $? ADDITIONAL_STARTUP_SERVICES=$(additionalStartupServices) || exit $? COMPOSE_ARGS_PULL="\ - -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} - ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ + -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ pull \ tb-core1" COMPOSE_ARGS_UP="\ - -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} - ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ + -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ up -d ${ADDITIONAL_STARTUP_SERVICES}" COMPOSE_ARGS_RUN="\ - -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} - ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ + -f docker-compose.yml ${ADDITIONAL_CACHE_ARGS} ${ADDITIONAL_COMPOSE_ARGS} ${ADDITIONAL_COMPOSE_QUEUE_ARGS} ${ADDITIONAL_COMPOSE_EDQS_ARGS} \ run --no-deps --rm -e UPGRADE_TB=true -e FROM_VERSION=${fromVersion} \ tb-core1" From 4b2dd35f3fca4ef341d0d1c9b792c858c0394dc6 Mon Sep 17 00:00:00 2001 From: trikimiki <41070061+trikimiki@users.noreply.github.com> Date: Fri, 11 Apr 2025 17:38:12 +0300 Subject: [PATCH 269/286] fix compose scripts EDQS arg --- docker/compose-utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/compose-utils.sh b/docker/compose-utils.sh index 3862024786..995cd5a596 100755 --- a/docker/compose-utils.sh +++ b/docker/compose-utils.sh @@ -134,7 +134,7 @@ function additionalComposeEdqsArgs() { if [ "$EDQS_ENABLED" = true ] then ADDITIONAL_COMPOSE_EDQS_ARGS="-f docker-compose.edqs.yml" - echo ADDITIONAL_COMPOSE_EDQS_ARGS + echo $ADDITIONAL_COMPOSE_EDQS_ARGS else echo "" fi From 32611a19c63788b323c2dc069c8b55026ca40818 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Fri, 11 Apr 2025 18:48:11 +0300 Subject: [PATCH 270/286] fixed customer id check for CustomerData --- .../service/entitiy/EntityServiceTest.java | 23 +++++++++++++++++++ .../processor/AbstractQueryProcessor.java | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java b/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java index a2c3fc07c8..0f0aeb21be 100644 --- a/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java @@ -1116,6 +1116,29 @@ public class EntityServiceTest extends AbstractControllerTest { assertThat(deviceName).isEqualTo(devices.get(0).getName()); } + @Test + public void testFindCustomerBySingleEntityFilter() { + SingleEntityFilter singleEntityFilter = new SingleEntityFilter(); + singleEntityFilter.setSingleEntity(customerId); + List entityFields = List.of( + new EntityKey(EntityKeyType.ENTITY_FIELD, "name") + ); + EntityDataPageLink pageLink = new EntityDataPageLink(1000, 0, null, null); + EntityDataQuery query = new EntityDataQuery(singleEntityFilter, pageLink, entityFields, null, null); + + //find by tenant + PageData result = findByQueryAndCheck(query, 1); + String customerName = result.getData().get(0).getLatest().get(EntityKeyType.ENTITY_FIELD).get("name").getValue(); + assertThat(customerName).isEqualTo(TEST_CUSTOMER_NAME); + + // find by customer user with generic permission + PageData customerResults = findByQueryAndCheck(customerId, query, 1); + + customerName = customerResults.getData().get(0).getLatest().get(EntityKeyType.ENTITY_FIELD).get("name").getValue(); + assertThat(customerName).isEqualTo(TEST_CUSTOMER_NAME); + } + + @Test public void testFindEntitiesByRelationEntityTypeFilter() { Customer customer = new Customer(); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java index 0c83ae4e61..d1f0d45984 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java @@ -65,7 +65,8 @@ public abstract class AbstractQueryProcessor implements protected static boolean checkCustomerId(UUID customerId, EntityData ed) { return customerId.equals(ed.getCustomerId()) || (ed.getEntityType() == EntityType.DASHBOARD && - ed.getFields().getAssignedCustomerIds().contains(customerId)); + ed.getFields().getAssignedCustomerIds().contains(customerId) + || (ed.getEntityType() == EntityType.CUSTOMER && customerId.equals(ed.getId()))); } protected boolean matches(EntityData ed) { From 3e41cbef874a0b2f5f8f6db8cf85eae36f6d8bb0 Mon Sep 17 00:00:00 2001 From: dashevchenko Date: Fri, 11 Apr 2025 20:36:22 +0300 Subject: [PATCH 271/286] fixed customer id check for Customer --- .../server/service/entitiy/EntityServiceTest.java | 2 +- .../server/edqs/query/processor/AbstractQueryProcessor.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java b/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java index 0f0aeb21be..264ac70443 100644 --- a/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java +++ b/application/src/test/java/org/thingsboard/server/service/entitiy/EntityServiceTest.java @@ -1131,7 +1131,7 @@ public class EntityServiceTest extends AbstractControllerTest { String customerName = result.getData().get(0).getLatest().get(EntityKeyType.ENTITY_FIELD).get("name").getValue(); assertThat(customerName).isEqualTo(TEST_CUSTOMER_NAME); - // find by customer user with generic permission + // find by customer user PageData customerResults = findByQueryAndCheck(customerId, query, 1); customerName = customerResults.getData().get(0).getLatest().get(EntityKeyType.ENTITY_FIELD).get("name").getValue(); diff --git a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java index d1f0d45984..30e963c252 100644 --- a/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java +++ b/common/edqs/src/main/java/org/thingsboard/server/edqs/query/processor/AbstractQueryProcessor.java @@ -64,9 +64,9 @@ public abstract class AbstractQueryProcessor implements } protected static boolean checkCustomerId(UUID customerId, EntityData ed) { - return customerId.equals(ed.getCustomerId()) || (ed.getEntityType() == EntityType.DASHBOARD && - ed.getFields().getAssignedCustomerIds().contains(customerId) - || (ed.getEntityType() == EntityType.CUSTOMER && customerId.equals(ed.getId()))); + return customerId.equals(ed.getCustomerId()) + || (ed.getEntityType() == EntityType.DASHBOARD && ed.getFields().getAssignedCustomerIds().contains(customerId)) + || (ed.getEntityType() == EntityType.CUSTOMER && customerId.equals(ed.getId())); } protected boolean matches(EntityData ed) { From 335ec57269deb657b06c4dd76f12d647de2c378f Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Sat, 12 Apr 2025 11:59:09 +0200 Subject: [PATCH 272/286] hotfix/profile-state-alarm-schedule-dynamic-attributeSource-null --- .../rule/engine/profile/ProfileState.java | 11 +- .../rule/engine/profile/ProfileStateTest.java | 127 ++++++++++++++++++ 2 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/ProfileStateTest.java diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java index 7a865c7a39..fffc66d02a 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java @@ -80,7 +80,7 @@ class ProfileState { addEntityKeysFromAlarmConditionSpec(alarmRule); AlarmSchedule schedule = alarmRule.getSchedule(); if (schedule != null) { - addScheduleDynamicValues(schedule); + addScheduleDynamicValues(schedule, entityKeys); } })); if (alarm.getClearRule() != null) { @@ -96,9 +96,9 @@ class ProfileState { } } - private void addScheduleDynamicValues(AlarmSchedule schedule) { + void addScheduleDynamicValues(AlarmSchedule schedule, final Set entityKeys) { DynamicValue dynamicValue = schedule.getDynamicValue(); - if (dynamicValue != null) { + if (dynamicValue != null && dynamicValue.getSourceAttribute() != null) { entityKeys.add( new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, dynamicValue.getSourceAttribute()) @@ -137,13 +137,14 @@ class ProfileState { } - private void addDynamicValuesRecursively(KeyFilterPredicate predicate, Set entityKeys, Set ruleKeys) { + void addDynamicValuesRecursively(KeyFilterPredicate predicate, Set entityKeys, Set ruleKeys) { switch (predicate.getType()) { case STRING: case NUMERIC: case BOOLEAN: DynamicValue value = ((SimpleKeyFilterPredicate) predicate).getValue().getDynamicValue(); - if (value != null && (value.getSourceType() == DynamicValueSourceType.CURRENT_TENANT || + if (value != null && value.getSourceAttribute() != null && ( + value.getSourceType() == DynamicValueSourceType.CURRENT_TENANT || value.getSourceType() == DynamicValueSourceType.CURRENT_CUSTOMER || value.getSourceType() == DynamicValueSourceType.CURRENT_DEVICE)) { AlarmConditionFilterKey entityKey = new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, value.getSourceAttribute()); diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/ProfileStateTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/ProfileStateTest.java new file mode 100644 index 0000000000..971b2c8958 --- /dev/null +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/ProfileStateTest.java @@ -0,0 +1,127 @@ +/** + * Copyright © 2016-2025 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.rule.engine.profile; + +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.params.provider.NullSource; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; +import org.thingsboard.server.common.data.device.profile.SpecificTimeSchedule; +import org.thingsboard.server.common.data.query.ComplexFilterPredicate; +import org.thingsboard.server.common.data.query.DynamicValue; +import org.thingsboard.server.common.data.query.DynamicValueSourceType; +import org.thingsboard.server.common.data.query.FilterPredicateType; +import org.thingsboard.server.common.data.query.SimpleKeyFilterPredicate; + +import java.util.HashSet; +import java.util.Set; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willCallRealMethod; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +class ProfileStateTest { + + ProfileState profileState; + Set entityKeys = new HashSet<>(); + Set ruleKeys = new HashSet<>(); + + @BeforeEach + void setUp() { + profileState = mock(ProfileState.class); + } + + @ParameterizedTest() + @EnumSource(DynamicValueSourceType.class) + @NullSource + void addScheduleDynamicValuesSourceAttribute(DynamicValueSourceType sourceType) { + willCallRealMethod().given(profileState).addScheduleDynamicValues(any(), any()); + final DynamicValue dynamicValue = new DynamicValue<>(sourceType, "myKey"); + SpecificTimeSchedule schedule = new SpecificTimeSchedule(); + schedule.setDynamicValue(dynamicValue); + + Assertions.assertThat(entityKeys.isEmpty()).isTrue(); + Assertions.assertThat(schedule.getDynamicValue().getSourceAttribute()).isNotNull(); + + profileState.addScheduleDynamicValues(schedule, entityKeys); + + Assertions.assertThat(entityKeys).isEqualTo(Set.of( + new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, "myKey"))); + } + + @ParameterizedTest() + @EnumSource(DynamicValueSourceType.class) + @NullSource + void addScheduleDynamicValuesSourceAttributeIsNull(DynamicValueSourceType sourceType) { + willCallRealMethod().given(profileState).addScheduleDynamicValues(any(), any()); + DynamicValue dynamicValue = new DynamicValue<>(sourceType, null); + SpecificTimeSchedule schedule = new SpecificTimeSchedule(); + schedule.setDynamicValue(dynamicValue); + + Assertions.assertThat(entityKeys.isEmpty()).isTrue(); + Assertions.assertThat(schedule.getDynamicValue().getSourceAttribute()).isNull(); + + profileState.addScheduleDynamicValues(schedule, entityKeys); + + Assertions.assertThat(entityKeys.isEmpty()).isTrue(); + } + + @ParameterizedTest() + @EnumSource(value = FilterPredicateType.class, names = {"COMPLEX"}) + void addDynamicValuesRecursivelySourceAttributeComplexKeyFilter(FilterPredicateType predicateType) { + willCallRealMethod().given(profileState).addDynamicValuesRecursively(any(), any(), any()); + ComplexFilterPredicate predicate = mock(ComplexFilterPredicate.class, RETURNS_DEEP_STUBS); + willReturn(predicateType).given(predicate).getType(); + profileState.addDynamicValuesRecursively(predicate, entityKeys, ruleKeys); + Assertions.assertThat(entityKeys.isEmpty()).isTrue(); + Assertions.assertThat(ruleKeys.isEmpty()).isTrue(); + } + + @ParameterizedTest() + @EnumSource(value = FilterPredicateType.class, names = {"STRING", "NUMERIC", "BOOLEAN"}) + void addDynamicValuesRecursivelySourceAttributeIsNull(FilterPredicateType predicateType) { + willCallRealMethod().given(profileState).addDynamicValuesRecursively(any(), any(), any()); + SimpleKeyFilterPredicate predicate = mock(SimpleKeyFilterPredicate.class, RETURNS_DEEP_STUBS); + willReturn(predicateType).given(predicate).getType(); + when(predicate.getValue().getDynamicValue().getSourceType()).thenReturn(DynamicValueSourceType.CURRENT_DEVICE); + when(predicate.getValue().getDynamicValue().getSourceAttribute()).thenReturn(null); + profileState.addDynamicValuesRecursively(predicate, entityKeys, ruleKeys); + Assertions.assertThat(entityKeys.isEmpty()).isTrue(); + Assertions.assertThat(ruleKeys.isEmpty()).isTrue(); + } + + @ParameterizedTest() + @EnumSource(value = FilterPredicateType.class, names = {"STRING", "NUMERIC", "BOOLEAN"}) + void addDynamicValuesRecursivelySourceAttributeAdded(FilterPredicateType predicateType) { + willCallRealMethod().given(profileState).addDynamicValuesRecursively(any(), any(), any()); + SimpleKeyFilterPredicate predicate = mock(SimpleKeyFilterPredicate.class, RETURNS_DEEP_STUBS); + willReturn(predicateType).given(predicate).getType(); + when(predicate.getValue().getDynamicValue().getSourceType()).thenReturn(DynamicValueSourceType.CURRENT_DEVICE); + when(predicate.getValue().getDynamicValue().getSourceAttribute()).thenReturn("myKey"); + profileState.addDynamicValuesRecursively(predicate, entityKeys, ruleKeys); + Assertions.assertThat(entityKeys).isEqualTo(Set.of( + new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, "myKey"))); + Assertions.assertThat(ruleKeys).isEqualTo(Set.of( + new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, "myKey"))); + } + +} From 51c92f323783bb1ea33b3549a247845f012b6279 Mon Sep 17 00:00:00 2001 From: Vladyslav Prykhodko Date: Mon, 14 Apr 2025 10:34:24 +0300 Subject: [PATCH 273/286] Update thingsboard.yml --- application/src/main/resources/thingsboard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 706ba3af53..b4d178a737 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1284,7 +1284,7 @@ transport: # URL of gateways dashboard repository repository_url: "${TB_GATEWAY_DASHBOARD_SYNC_REPOSITORY_URL:https://github.com/thingsboard/gateway-management-extensions-dist.git}" # Branch of gateways dashboard repository to work with - branch: "${TB_GATEWAY_DASHBOARD_SYNC_BRANCH:}" + branch: "${TB_GATEWAY_DASHBOARD_SYNC_BRANCH:release/4.0.0}" # Fetch frequency in hours for gateways dashboard repository fetch_frequency: "${TB_GATEWAY_DASHBOARD_SYNC_FETCH_FREQUENCY:24}" From 016536a8a8e9686d63a830fb5a0002e969de2cf5 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Mon, 14 Apr 2025 11:14:09 +0300 Subject: [PATCH 274/286] Add EDQS Grafana dashboard --- .../grafana/provisioning/dashboards/edqs.json | 1375 +++++++++++++++++ .../dashboards/edqs_entities.json | 161 -- 2 files changed, 1375 insertions(+), 161 deletions(-) create mode 100644 docker/monitoring/grafana/provisioning/dashboards/edqs.json delete mode 100644 docker/monitoring/grafana/provisioning/dashboards/edqs_entities.json diff --git a/docker/monitoring/grafana/provisioning/dashboards/edqs.json b/docker/monitoring/grafana/provisioning/dashboards/edqs.json new file mode 100644 index 0000000000..1a30e942eb --- /dev/null +++ b/docker/monitoring/grafana/provisioning/dashboards/edqs.json @@ -0,0 +1,1375 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.6.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 9, + "panels": [], + "title": "Data queries", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 1, + "options": { + "legend": { + "calcs": [ + "mean", + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "(sum(rate(edqsTimers_seconds_sum{statsName=\"entityDataQueryTimer\", job=~\"$core_job\"}[1m])) * 1000) / sum(rate(edqsTimers_seconds_count{statsName=\"entityDataQueryTimer\", job=~\"$core_job\"}[1m]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Query timing", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "(sum(rate(edqsTimers_seconds_sum{statsName=\"edqsDataQueryTimer\", job=~\"$edqs_job\"}[1m])) * 1000) / sum(rate(edqsTimers_seconds_count{statsName=\"edqsDataQueryTimer\", job=~\"$edqs_job\"}[1m]))", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "EDQS query timing", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Average data query timings", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 0, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 3, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(increase(edqsTimers_seconds_count{statsName=\"entityDataQueryTimer\", job=~\"$core_job\"}[1m]))", + "legendFormat": "Count", + "range": true, + "refId": "A" + } + ], + "title": "Data queries count", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 5, + "options": { + "legend": { + "calcs": [ + "max", + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "max(edqsTimers_seconds_max{statsName=\"entityDataQueryTimer\", job=~\"$core_job\"}) * 1000\n", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Query timing", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "max(edqsTimers_seconds_max{statsName=\"edqsDataQueryTimer\", job=~\"$edqs_job\"}) * 1000\n", + "hide": false, + "instant": false, + "legendFormat": "EDQS query timing", + "range": true, + "refId": "B" + } + ], + "title": "Max data query timings", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 17 + }, + "id": 8, + "panels": [], + "title": "Count queries", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 2, + "options": { + "legend": { + "calcs": [ + "mean", + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "(sum(rate(edqsTimers_seconds_sum{statsName=\"entityCountQueryTimer\", job=~\"$core_job\"}[1m])) / sum(rate(edqsTimers_seconds_count{statsName=\"entityCountQueryTimer\", job=~\"$core_job\"}[1m])))*1000\n\n", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Query timing", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "(sum(rate(edqsTimers_seconds_sum{statsName=\"edqsCountQueryTimer\", job=~\"$edqs_job\"}[1m])) * 1000) / sum(rate(edqsTimers_seconds_count{statsName=\"edqsCountQueryTimer\", job=~\"$edqs_job\"}[1m]))", + "hide": false, + "instant": false, + "legendFormat": "EDQS query timing", + "range": true, + "refId": "B" + } + ], + "title": "Average count query timings", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 0, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 4, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(increase(edqsTimers_seconds_count{statsName=\"entityCountQueryTimer\", job=~\"$core_job\"}[1m]))", + "legendFormat": "Count", + "range": true, + "refId": "A" + } + ], + "title": "Count queries count", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 26 + }, + "id": 6, + "options": { + "legend": { + "calcs": [ + "max", + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "max(edqsTimers_seconds_max{statsName=\"entityCountQueryTimer\", job=~\"$core_job\"}) * 1000\n", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Query timing", + "range": true, + "refId": "A", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "max(edqsTimers_seconds_max{statsName=\"edqsCountQueryTimer\", job=~\"$edqs_job\"}) * 1000\n", + "hide": false, + "instant": false, + "legendFormat": "EDQS query timing", + "range": true, + "refId": "B" + } + ], + "title": "Max count query timings", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 34 + }, + "id": 11, + "panels": [], + "title": "Metrics", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 8, + "x": 0, + "y": 35 + }, + "id": 12, + "options": { + "legend": { + "calcs": [ + "mean", + "lastNotNull", + "max", + "min" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "jvm_memory_used_bytes{job=~\"$edqs_job\", id=\"G1 Old Gen\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Used ({{job}})", + "range": true, + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "jvm_memory_max_bytes{job=~\"$edqs_job\", id=\"G1 Old Gen\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Max ({{job}})", + "range": true, + "refId": "B" + } + ], + "title": "Memory usage", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 8, + "x": 8, + "y": 35 + }, + "id": 10, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true, + "sortBy": "Last", + "sortDesc": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "edqsGauges{statsName=\"objectsCount\", job=~\"$edqs_job\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{objectType}} ({{job}})", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Objects count", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 8, + "x": 16, + "y": 35 + }, + "id": 13, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "edqsMapGauges{statsName=\"stringPoolSize\", job=~\"$edqs_job\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "String pool size ({{job}})", + "range": true, + "refId": "A", + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "edqsMapGauges{statsName=\"bytePoolSize\", job=~\"$edqs_job\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "legendFormat": "Byte pool size ({{job}})", + "range": true, + "refId": "B", + "useBackend": false + } + ], + "title": "Pool metrics", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 8, + "x": 0, + "y": 45 + }, + "id": 14, + "options": { + "legend": { + "calcs": [ + "last" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "edqsMapGauges{statsName=\"tenantReposSize\", job=~\"$edqs_job\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Tenant repos count ({{job}})", + "range": true, + "refId": "A", + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } + } + ], + "title": "Repos", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 8, + "x": 8, + "y": 45 + }, + "id": 15, + "options": { + "legend": { + "calcs": [ + "mean" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.6.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum(increase(edqsCounters_total{statsName=\"stringsCompressed\", job=~\"$core_job\"}[1m]))", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "Compressed", + "range": true, + "refId": "A", + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "sum(increase(edqsCounters_total{statsName=\"stringsUncompressed\", job=~\"$edqs_job\"}[1m]))", + "hide": false, + "instant": false, + "legendFormat": "Uncompressed", + "range": true, + "refId": "B" + } + ], + "title": "Compression", + "type": "timeseries" + } + ], + "refresh": "10s", + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [ + { + "allowCustomValue": false, + "current": {}, + "definition": "label_values(edqsTimers_seconds_count{statsName=\"entityDataQueryTimer\"},job)", + "includeAll": true, + "label": "Core", + "name": "core_job", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(edqsTimers_seconds_count{statsName=\"entityDataQueryTimer\"},job)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "allowCustomValue": false, + "current": {}, + "definition": "label_values(edqsGauges{statsName=\"objectsCount\"},job)", + "includeAll": true, + "label": "EDQS", + "name": "edqs_job", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(edqsGauges{statsName=\"objectsCount\"},job)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "EDQS", + "uid": "beidj2k82ayo0e", + "version": 13, + "weekStart": "" +} \ No newline at end of file diff --git a/docker/monitoring/grafana/provisioning/dashboards/edqs_entities.json b/docker/monitoring/grafana/provisioning/dashboards/edqs_entities.json deleted file mode 100644 index 3e913d4856..0000000000 --- a/docker/monitoring/grafana/provisioning/dashboards/edqs_entities.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": 6, - "iteration": 1737564772936, - "links": [], - "liveNow": false, - "panels": [ - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "decimals": 0, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 2, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "9BonzvTSz" - }, - "exemplar": true, - "expr": "sum by (objectType) (edqs_object_count{tenantId=~\"$tenantId\"})", - "interval": "", - "legendFormat": "{{objectType}}", - "refId": "A" - } - ], - "title": "EDQS object count", - "type": "timeseries" - } - ], - "refresh": "", - "schemaVersion": 35, - "style": "dark", - "tags": [], - "templating": { - "list": [ - { - "current": { - "selected": true, - "text": [ - "All" - ], - "value": [ - "$__all" - ] - }, - "definition": "label_values(edqs_object_count, tenantId)", - "hide": 0, - "includeAll": true, - "label": "Tenant", - "multi": true, - "name": "tenantId", - "options": [], - "query": { - "query": "label_values(edqs_object_count, tenantId)", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-15m", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "EDQS", - "uid": "mK5A_DdHk", - "version": 9, - "weekStart": "" -} \ No newline at end of file From 1760905b2e6761fef5f2e4bfdb14c5379663bcc7 Mon Sep 17 00:00:00 2001 From: IrynaMatveieva Date: Mon, 14 Apr 2025 11:36:54 +0300 Subject: [PATCH 275/286] set cf actor to null when stopped --- .../java/org/thingsboard/server/actors/tenant/TenantActor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index f0d330726d..9605324782 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -130,6 +130,7 @@ public class TenantActor extends RuleChainManagerActor { log.info("[{}] Stopping tenant actor.", tenantId); if (cfActor != null) { ctx.stop(cfActor.getActorId()); + cfActor = null; } } @@ -290,6 +291,7 @@ public class TenantActor extends RuleChainManagerActor { } else { if (cfActor != null) { ctx.stop(cfActor.getActorId()); + cfActor = null; } if (ruleChainsInitialized) { log.info("Tenant {} is no longer managed by this service, stopping rule chains", tenantId); From d045ef23e23bbd287d1748eac8e1cef1be36a7dd Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 14 Apr 2025 11:41:24 +0300 Subject: [PATCH 276/286] Edge - slow down processing of edge events for SYS_TENANT_ID --- .../edge/EdgeEventSourcingListener.java | 5 +++++ .../service/edge/rpc/EdgeGrpcSession.java | 2 +- .../edge/rpc/processor/BaseEdgeProcessor.java | 22 +++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java index c62a551310..8ec42b4a10 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java @@ -167,6 +167,11 @@ public class EdgeEventSourcingListener { @TransactionalEventListener(fallbackExecution = true) public void handleEvent(RelationActionEvent event) { try { + TenantId tenantId = event.getTenantId(); + if (!tenantId.isSysTenantId() && !tenantService.tenantExists(tenantId)) { + log.debug("[{}] Ignoring RelationActionEvent because tenant does not exist: {}", tenantId, event); + return; + } EntityRelation relation = event.getRelation(); if (relation == null) { log.trace("[{}] skipping RelationActionEvent event in case relation is null: {}", event.getTenantId(), event); diff --git a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java index 9ce5973639..7861885989 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/rpc/EdgeGrpcSession.java @@ -528,7 +528,7 @@ public abstract class EdgeGrpcSession implements Closeable { sessionState.getPendingMsgsMap().remove(msg.getDownlinkMsgId()); log.debug("[{}][{}][{}] Msg has been processed successfully! Msg Id: [{}], Msg: {}", tenantId, edge.getId(), sessionId, msg.getDownlinkMsgId(), msg); } else { - log.error("[{}][{}][{}] Msg processing failed! Msg Id: [{}], Error msg: {}", tenantId, edge.getId(), sessionId, msg.getDownlinkMsgId(), msg.getErrorMsg()); + log.debug("[{}][{}][{}] Msg processing failed! Msg Id: [{}], Error msg: {}", tenantId, edge.getId(), sessionId, msg.getDownlinkMsgId(), msg.getErrorMsg()); DownlinkMsg downlinkMsg = sessionState.getPendingMsgsMap().get(msg.getDownlinkMsgId()); // if NOT timeseries or attributes failures - ack failed downlink if (downlinkMsg.getEntityDataCount() == 0) { 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 9f30d70fb2..7ce1159397 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 @@ -65,6 +65,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; +import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -142,17 +143,24 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { protected ListenableFuture processActionForAllEdges(TenantId tenantId, EdgeEventType type, EdgeEventActionType actionType, EntityId entityId, - JsonNode body, EdgeId sourceEdgeId) { - List> futures = new ArrayList<>(); + EdgeId sourceEdgeId) { if (TenantId.SYS_TENANT_ID.equals(tenantId)) { - PageDataIterable tenantIds = new PageDataIterable<>(link -> edgeCtx.getTenantService().findTenantsIds(link), 1024); + PageDataIterable tenantIds = new PageDataIterable<>(link -> edgeCtx.getTenantService().findTenantsIds(link), 500); for (TenantId tenantId1 : tenantIds) { - futures.addAll(processActionForAllEdgesByTenantId(tenantId1, type, actionType, entityId, body, sourceEdgeId)); + try { + List> sysTenantFutures = processActionForAllEdgesByTenantId(tenantId1, type, actionType, entityId, null, sourceEdgeId); + for (ListenableFuture future : sysTenantFutures) { + future.get(10, TimeUnit.SECONDS); + } + } catch (Exception e) { + log.error("Failed to process action for all edges by SYS_TENANT_ID. Failed tenantId = [{}]", tenantId1, e); + } } + return Futures.immediateFuture(null); } else { - futures = processActionForAllEdgesByTenantId(tenantId, type, actionType, entityId, null, sourceEdgeId); + List> tenantFutures = processActionForAllEdgesByTenantId(tenantId, type, actionType, entityId, null, sourceEdgeId); + return Futures.transform(Futures.allAsList(tenantFutures), voids -> null, dbCallbackExecutorService); } - return Futures.transform(Futures.allAsList(futures), voids -> null, dbCallbackExecutorService); } private List> processActionForAllEdgesByTenantId(TenantId tenantId, @@ -284,7 +292,7 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { private ListenableFuture processEntityNotificationForAllEdges(TenantId tenantId, EdgeEventType type, EdgeEventActionType actionType, EntityId entityId, EdgeId sourceEdgeId) { return switch (actionType) { case ADDED, UPDATED, DELETED, CREDENTIALS_UPDATED -> // used by USER entity - processActionForAllEdges(tenantId, type, actionType, entityId, null, sourceEdgeId); + processActionForAllEdges(tenantId, type, actionType, entityId, sourceEdgeId); default -> Futures.immediateFuture(null); }; } From 69bfe737b75f757cc1ba998b4aecc998ecfedf9d Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 14 Apr 2025 11:50:48 +0300 Subject: [PATCH 277/286] Fixed to be compatible with PE --- .../service/edge/rpc/processor/BaseEdgeProcessor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 7ce1159397..4356a1d60c 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 @@ -143,12 +143,12 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { protected ListenableFuture processActionForAllEdges(TenantId tenantId, EdgeEventType type, EdgeEventActionType actionType, EntityId entityId, - EdgeId sourceEdgeId) { + JsonNode body, EdgeId sourceEdgeId) { if (TenantId.SYS_TENANT_ID.equals(tenantId)) { PageDataIterable tenantIds = new PageDataIterable<>(link -> edgeCtx.getTenantService().findTenantsIds(link), 500); for (TenantId tenantId1 : tenantIds) { try { - List> sysTenantFutures = processActionForAllEdgesByTenantId(tenantId1, type, actionType, entityId, null, sourceEdgeId); + List> sysTenantFutures = processActionForAllEdgesByTenantId(tenantId1, type, actionType, entityId, body, sourceEdgeId); for (ListenableFuture future : sysTenantFutures) { future.get(10, TimeUnit.SECONDS); } @@ -292,7 +292,7 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { private ListenableFuture processEntityNotificationForAllEdges(TenantId tenantId, EdgeEventType type, EdgeEventActionType actionType, EntityId entityId, EdgeId sourceEdgeId) { return switch (actionType) { case ADDED, UPDATED, DELETED, CREDENTIALS_UPDATED -> // used by USER entity - processActionForAllEdges(tenantId, type, actionType, entityId, sourceEdgeId); + processActionForAllEdges(tenantId, type, actionType, entityId, null, sourceEdgeId); default -> Futures.immediateFuture(null); }; } From 5d5e77813646651d798ac0126661c512e2f43362 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 14 Apr 2025 12:54:38 +0300 Subject: [PATCH 278/286] UI: Add example in shape fill image how to use attribute --- .../widget/lib/map/shape_fill_image_fn.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md index 34eacc7b9d..d0884236cb 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/shape_fill_image_fn.md @@ -42,7 +42,8 @@ In case no data is returned, default fill image will be used.
    • Calculate image URL and rotation angle depending on windSpeed and windDirection telemetry values for a weather station device type.
      -Let's assume 3 images are defined in the Shape fill images section. Each image corresponds to a particular wind speed level: low (e.g., <5 m/s), medium (e.g., 5-15 m/s), and high (e.g., >15 m/s). +Let's assume 3 images are defined in the Shape fill images section. Each image corresponds to a particular wind speed level: low (e.g., <5 m/s), medium (e.g., 5-15 m/s), and high (e.g., >15 m/s).
      +Ensure that the Type, windSpeed and windDirection keys are included in the additional data keys configuration.
    @@ -71,5 +72,24 @@ if (type === 'weather station') { {:copy-code} ``` +
      +
    • +Returns the image URL in the image attribute for a weather station device type.
      +Ensure that the Type and image keys are included in additional data keys configuration. +
    • +
    + +```javascript +const type = data.Type; +const image = data.image; +if (type === 'weather station' && image !== undefined) { + return { + url: image, + opacity: 0.8 + }; +} +{:copy-code} +``` +

    From 2478acc42d31c62f90fa511c47c79c03eb241a23 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 14 Apr 2025 13:25:32 +0300 Subject: [PATCH 279/286] Refactoring - introduced new method - findActiveEdges for all tenants --- .../edge/rpc/processor/BaseEdgeProcessor.java | 19 ++++++------------- .../server/dao/edge/EdgeService.java | 2 ++ .../thingsboard/server/dao/edge/EdgeDao.java | 2 ++ .../server/dao/edge/EdgeServiceImpl.java | 7 +++++++ .../server/dao/sql/edge/EdgeRepository.java | 12 ++++++++++++ .../server/dao/sql/edge/JpaEdgeDao.java | 8 ++++++++ 6 files changed, 37 insertions(+), 13 deletions(-) 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 4356a1d60c..d622963737 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 @@ -65,7 +65,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; -import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -144,23 +143,17 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { protected ListenableFuture processActionForAllEdges(TenantId tenantId, EdgeEventType type, EdgeEventActionType actionType, EntityId entityId, JsonNode body, EdgeId sourceEdgeId) { + List> futures = new ArrayList<>(); if (TenantId.SYS_TENANT_ID.equals(tenantId)) { - PageDataIterable tenantIds = new PageDataIterable<>(link -> edgeCtx.getTenantService().findTenantsIds(link), 500); - for (TenantId tenantId1 : tenantIds) { - try { - List> sysTenantFutures = processActionForAllEdgesByTenantId(tenantId1, type, actionType, entityId, body, sourceEdgeId); - for (ListenableFuture future : sysTenantFutures) { - future.get(10, TimeUnit.SECONDS); - } - } catch (Exception e) { - log.error("Failed to process action for all edges by SYS_TENANT_ID. Failed tenantId = [{}]", tenantId1, e); - } + 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)); } return Futures.immediateFuture(null); } else { - List> tenantFutures = processActionForAllEdgesByTenantId(tenantId, type, actionType, entityId, null, sourceEdgeId); - return Futures.transform(Futures.allAsList(tenantFutures), voids -> null, dbCallbackExecutorService); + futures = processActionForAllEdgesByTenantId(tenantId, type, actionType, entityId, null, sourceEdgeId); } + return Futures.transform(Futures.allAsList(futures), voids -> null, dbCallbackExecutorService); } private List> processActionForAllEdgesByTenantId(TenantId tenantId, diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/edge/EdgeService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/edge/EdgeService.java index 59ad6f64b3..a8993a4a37 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/edge/EdgeService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/edge/EdgeService.java @@ -47,6 +47,8 @@ public interface EdgeService extends EntityDaoService { Optional findEdgeByRoutingKey(TenantId tenantId, String routingKey); + PageData findActiveEdges(PageLink pageLink); + Edge saveEdge(Edge edge); Edge assignEdgeToCustomer(TenantId tenantId, EdgeId edgeId, CustomerId customerId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeDao.java b/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeDao.java index fdb9144ab2..405b2446b0 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeDao.java @@ -41,6 +41,8 @@ public interface EdgeDao extends Dao, TenantEntityDao { EdgeInfo findEdgeInfoById(TenantId tenantId, UUID edgeId); + PageData findActiveEdges(PageLink pageLink); + PageData findEdgeIdsByTenantId(UUID tenantId, PageLink pageLink); PageData findEdgesByTenantId(UUID tenantId, PageLink pageLink); diff --git a/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java index 8163109686..0655d05572 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/edge/EdgeServiceImpl.java @@ -192,6 +192,13 @@ public class EdgeServiceImpl extends AbstractCachedEntityService findActiveEdges(PageLink pageLink) { + log.trace("Executing findActiveEdges [{}]", pageLink); + Validator.validatePageLink(pageLink); + return edgeDao.findActiveEdges(pageLink); + } + @Override public Edge saveEdge(Edge edge) { log.trace("Executing saveEdge [{}]", edge); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/edge/EdgeRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/edge/EdgeRepository.java index c11db0a348..bd1dda54b8 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/edge/EdgeRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/edge/EdgeRepository.java @@ -44,6 +44,18 @@ public interface EdgeRepository extends JpaRepository { "WHERE d.id = :edgeId") EdgeInfoEntity findEdgeInfoById(@Param("edgeId") UUID edgeId); + @Query(value = "SELECT ee.id, ee.created_time, ee.additional_info, ee.customer_id, " + + "ee.root_rule_chain_id, ee.type, ee.name, ee.label, ee.routing_key, " + + "ee.secret, ee.tenant_id, ee.version " + + "FROM edge ee " + + "JOIN attribute_kv ON ee.id = attribute_kv.entity_id " + + "JOIN key_dictionary ON attribute_kv.attribute_key = key_dictionary.key_id " + + "WHERE attribute_kv.bool_v = true AND key_dictionary.key = 'active' " + + "AND (:textSearch IS NULL OR ee.name ILIKE CONCAT('%', :textSearch, '%')) " + + "ORDER BY ee.id", nativeQuery = true) + Page findActiveEdges(@Param("textSearch") String textSearch, + Pageable pageable); + @Query("SELECT d.id FROM EdgeEntity d WHERE d.tenantId = :tenantId " + "AND (:textSearch IS NULL OR ilike(d.name, CONCAT('%', :textSearch, '%')) = true)") Page findIdsByTenantId(@Param("tenantId") UUID tenantId, diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/edge/JpaEdgeDao.java b/dao/src/main/java/org/thingsboard/server/dao/sql/edge/JpaEdgeDao.java index 3f45b1ca1a..50b8092731 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/edge/JpaEdgeDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/edge/JpaEdgeDao.java @@ -66,6 +66,14 @@ public class JpaEdgeDao extends JpaAbstractDao implements Edge return DaoUtil.getData(edgeRepository.findEdgeInfoById(edgeId)); } + @Override + public PageData findActiveEdges(PageLink pageLink) { + return DaoUtil.toPageData( + edgeRepository.findActiveEdges( + pageLink.getTextSearch(), + DaoUtil.toPageable(pageLink))); + } + @Override public PageData findEdgeIdsByTenantId(UUID tenantId, PageLink pageLink) { return DaoUtil.pageToPageData( From 375792da193acbe838cd533fbd2f036e0d114424 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 14 Apr 2025 13:30:46 +0300 Subject: [PATCH 280/286] save edge event -Do not do validation for active edges --- .../edge/rpc/processor/BaseEdgeProcessor.java | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) 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 d622963737..bb4bd19980 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 @@ -95,28 +95,42 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { EdgeEventActionType action, EntityId entityId, JsonNode body) { - ListenableFuture> future = - edgeCtx.getAttributesService().find(tenantId, edgeId, AttributeScope.SERVER_SCOPE, DefaultDeviceStateService.ACTIVITY_STATE); - return Futures.transformAsync(future, activeOpt -> { - if (activeOpt.isEmpty()) { - log.trace("Edge is not activated. Skipping event. tenantId [{}], edgeId [{}], type[{}], " + - "action [{}], entityId [{}], body [{}]", - tenantId, edgeId, type, action, entityId, body); - return Futures.immediateFuture(null); - } - if (activeOpt.get().getBooleanValue().isPresent() && activeOpt.get().getBooleanValue().get()) { - return doSaveEdgeEvent(tenantId, edgeId, type, action, entityId, body); - } else { - if (doSaveIfEdgeIsOffline(type, action)) { - return doSaveEdgeEvent(tenantId, edgeId, type, action, entityId, body); - } else { - log.trace("Edge is not active at the moment. Skipping event. tenantId [{}], edgeId [{}], type[{}], " + + return saveEdgeEvent(tenantId, edgeId, type, action, entityId, body, true); + } + + protected ListenableFuture saveEdgeEvent(TenantId tenantId, + EdgeId edgeId, + EdgeEventType type, + EdgeEventActionType action, + EntityId entityId, + JsonNode body, + boolean doValidate) { + if (doValidate) { + ListenableFuture> future = + edgeCtx.getAttributesService().find(tenantId, edgeId, AttributeScope.SERVER_SCOPE, DefaultDeviceStateService.ACTIVITY_STATE); + return Futures.transformAsync(future, activeOpt -> { + if (activeOpt.isEmpty()) { + log.trace("Edge is not activated. Skipping event. tenantId [{}], edgeId [{}], type[{}], " + "action [{}], entityId [{}], body [{}]", tenantId, edgeId, type, action, entityId, body); return Futures.immediateFuture(null); } - } - }, dbCallbackExecutorService); + if (activeOpt.get().getBooleanValue().isPresent() && activeOpt.get().getBooleanValue().get()) { + return doSaveEdgeEvent(tenantId, edgeId, type, action, entityId, body); + } else { + if (doSaveIfEdgeIsOffline(type, action)) { + return doSaveEdgeEvent(tenantId, edgeId, type, action, entityId, body); + } else { + log.trace("Edge is not active at the moment. Skipping event. tenantId [{}], edgeId [{}], type[{}], " + + "action [{}], entityId [{}], body [{}]", + tenantId, edgeId, type, action, entityId, body); + return Futures.immediateFuture(null); + } + } + }, dbCallbackExecutorService); + } else { + return doSaveEdgeEvent(tenantId, edgeId, type, action, entityId, body); + } } private boolean doSaveIfEdgeIsOffline(EdgeEventType type, EdgeEventActionType action) { @@ -147,7 +161,7 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { 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)); + futures.add(saveEdgeEvent(edge.getTenantId(), edge.getId(), type, actionType, entityId, body, false)); } return Futures.immediateFuture(null); } else { From 5653ac7f2f496f64e1247064d271a5b860c68e62 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 14 Apr 2025 13:37:55 +0300 Subject: [PATCH 281/286] RelationActionEvent - check for existing tenant in case RELATION_DELETED --- .../server/service/edge/EdgeEventSourcingListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java index 8ec42b4a10..7bafd53644 100644 --- a/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java +++ b/application/src/main/java/org/thingsboard/server/service/edge/EdgeEventSourcingListener.java @@ -168,7 +168,7 @@ public class EdgeEventSourcingListener { public void handleEvent(RelationActionEvent event) { try { TenantId tenantId = event.getTenantId(); - if (!tenantId.isSysTenantId() && !tenantService.tenantExists(tenantId)) { + if (ActionType.RELATION_DELETED.equals(event.getActionType()) && !tenantService.tenantExists(tenantId)) { log.debug("[{}] Ignoring RelationActionEvent because tenant does not exist: {}", tenantId, event); return; } From 979ceb3453826d1415b5e103308b39ded1ef3742 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 14 Apr 2025 13:38:47 +0300 Subject: [PATCH 282/286] UI: Updated map help function. Added hint to need add key --- .../assets/help/en_US/widget/lib/map/clustering_color_fn.md | 3 ++- .../src/assets/help/en_US/widget/lib/map/color_fn_examples.md | 3 ++- .../src/assets/help/en_US/widget/lib/map/label_fn_examples.md | 3 ++- ui-ngx/src/assets/help/en_US/widget/lib/map/marker_image_fn.md | 3 ++- .../assets/help/en_US/widget/lib/map/tooltip_fn_examples.md | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/clustering_color_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/clustering_color_fn.md index 33d4df2f18..36c2340970 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/map/clustering_color_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/clustering_color_fn.md @@ -30,7 +30,8 @@ In case no data is returned, default colors will be used depending on number of
    • -Calculate color depending on temperature telemetry value: +Calculate color depending on temperature telemetry value.
      +Ensure that the temperature key is included in the additional data keys configuration.
    • diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/color_fn_examples.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/color_fn_examples.md index 8c3631bde7..7d728bf455 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/map/color_fn_examples.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/color_fn_examples.md @@ -1,6 +1,7 @@ ##### Examples -* Calculate color depending on `temperature` telemetry value for `thermostat` device type: +* Calculate color depending on `temperature` telemetry value for `thermostat` device type.
      + Ensure that the Type and temperature keys are included in the additional data keys configuration: ```javascript var type = data.Type; diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/label_fn_examples.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/label_fn_examples.md index 2e2ecfabec..7208179645 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/map/label_fn_examples.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/label_fn_examples.md @@ -1,6 +1,7 @@ ##### Examples -* Display styled label with corresponding latest telemetry data for `energy meter` or `thermometer` device types: +* Display styled label with corresponding latest telemetry data for `energy meter` or `thermometer` device types.
      + Ensure that the Type, energy and temperature keys are included in the additional data keys configuration: ```javascript var deviceType = data.Type; diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/marker_image_fn.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/marker_image_fn.md index ed8b82d4cc..57f8b0eec6 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/map/marker_image_fn.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/marker_image_fn.md @@ -40,7 +40,8 @@ In case no data is returned, default marker image will be used.
      • Calculate image url depending on temperature telemetry value for thermometer device type.
        -Let's assume 4 images are defined in Marker images section. Each image corresponds to particular temperature level: +Let's assume 4 images are defined in Marker images section. Each image corresponds to particular temperature level.
        +Ensure that the Type and temperature keys are included in the additional data keys configuration:
      diff --git a/ui-ngx/src/assets/help/en_US/widget/lib/map/tooltip_fn_examples.md b/ui-ngx/src/assets/help/en_US/widget/lib/map/tooltip_fn_examples.md index 34f8e06e0f..aba6fea32a 100644 --- a/ui-ngx/src/assets/help/en_US/widget/lib/map/tooltip_fn_examples.md +++ b/ui-ngx/src/assets/help/en_US/widget/lib/map/tooltip_fn_examples.md @@ -1,6 +1,7 @@ ##### Examples -* Display details with corresponding telemetry data for `energy meter` or `thermometer` device types: +* Display details with corresponding telemetry data for `energy meter` or `thermometer` device types.
      + Ensure that the Type, energy and temperature keys are included in the additional data keys configuration: ```javascript var deviceType = data.Type; From e964c0781e27e1cfbd44a6d3161be47ee43577a6 Mon Sep 17 00:00:00 2001 From: Volodymyr Babak Date: Mon, 14 Apr 2025 15:35:39 +0300 Subject: [PATCH 283/286] BaseEdgeProcessor - Fixed incorrect return --- .../server/service/edge/rpc/processor/BaseEdgeProcessor.java | 1 - 1 file changed, 1 deletion(-) 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 bb4bd19980..6fcb02e4bc 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 @@ -163,7 +163,6 @@ public abstract class BaseEdgeProcessor implements EdgeProcessor { for (Edge edge : edges) { futures.add(saveEdgeEvent(edge.getTenantId(), edge.getId(), type, actionType, entityId, body, false)); } - return Futures.immediateFuture(null); } else { futures = processActionForAllEdgesByTenantId(tenantId, type, actionType, entityId, null, sourceEdgeId); } From f361dfeb1ecb6d38237e2f2674d9f11943a59b37 Mon Sep 17 00:00:00 2001 From: ViacheslavKlimov Date: Mon, 14 Apr 2025 18:33:47 +0300 Subject: [PATCH 284/286] Fix CF entity profiles cache initialization --- .../server/actors/tenant/TenantActor.java | 1 + .../cf/DefaultCalculatedFieldInitService.java | 68 ------------------- .../server/queue/util/AfterStartUp.java | 1 - 3 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java diff --git a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java index 9605324782..84edd064b5 100644 --- a/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java +++ b/application/src/main/java/org/thingsboard/server/actors/tenant/TenantActor.java @@ -100,6 +100,7 @@ public class TenantActor extends RuleChainManagerActor { () -> DefaultActorService.CF_MANAGER_DISPATCHER_NAME, () -> new CalculatedFieldManagerActorCreator(systemContext, tenantId), () -> true); + cfActor.tellWithHighPriority(new CalculatedFieldCacheInitMsg(tenantId)); } catch (Exception e) { log.info("[{}] Failed to init CF Actor.", tenantId, e); } diff --git a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java b/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java deleted file mode 100644 index 79950f2e3f..0000000000 --- a/application/src/main/java/org/thingsboard/server/service/cf/DefaultCalculatedFieldInitService.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright © 2016-2025 The Thingsboard Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.thingsboard.server.service.cf; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.thingsboard.server.actors.ActorSystemContext; -import org.thingsboard.server.common.data.ProfileEntityIdInfo; -import org.thingsboard.server.common.data.page.PageDataIterable; -import org.thingsboard.server.common.msg.cf.CalculatedFieldInitProfileEntityMsg; -import org.thingsboard.server.dao.asset.AssetService; -import org.thingsboard.server.dao.device.DeviceService; -import org.thingsboard.server.queue.util.AfterStartUp; -import org.thingsboard.server.queue.util.TbRuleEngineComponent; - -@Slf4j -@Service -@TbRuleEngineComponent -@RequiredArgsConstructor -public class DefaultCalculatedFieldInitService implements CalculatedFieldInitService { - - private final AssetService assetService; - private final DeviceService deviceService; - private final ActorSystemContext actorSystemContext; - - @Value("${queue.calculated_fields.init_fetch_pack_size:50000}") - @Getter - private int initFetchPackSize; - - @AfterStartUp(order = AfterStartUp.CF_READ_PROFILE_ENTITIES_SERVICE) - public void initCalculatedFieldDefinitions() { - PageDataIterable deviceIdInfos = new PageDataIterable<>(deviceService::findProfileEntityIdInfos, initFetchPackSize); - for (ProfileEntityIdInfo idInfo : deviceIdInfos) { - log.trace("Processing device record: {}", idInfo); - try { - actorSystemContext.tell(new CalculatedFieldInitProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); - } catch (Exception e) { - log.error("Failed to process device record: {}", idInfo, e); - } - } - PageDataIterable assetIdInfos = new PageDataIterable<>(assetService::findProfileEntityIdInfos, initFetchPackSize); - for (ProfileEntityIdInfo idInfo : assetIdInfos) { - log.trace("Processing asset record: {}", idInfo); - try { - actorSystemContext.tell(new CalculatedFieldInitProfileEntityMsg(idInfo.getTenantId(), idInfo.getProfileId(), idInfo.getEntityId())); - } catch (Exception e) { - log.error("Failed to process asset record: {}", idInfo, e); - } - } - } - -} diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java b/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java index 6a3aaa4a7f..8cf48faaa6 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java @@ -37,7 +37,6 @@ public @interface AfterStartUp { int STARTUP_SERVICE = 8; int ACTOR_SYSTEM = 9; - int CF_READ_PROFILE_ENTITIES_SERVICE = 10; int CF_READ_CF_SERVICE = 10; int REGULAR_SERVICE = 11; From 757c88703470d72e17c9f7e73b9062bcc921eef8 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 15 Apr 2025 13:06:03 +0300 Subject: [PATCH 285/286] Version 4.1.0-SNAPSHOT --- application/pom.xml | 2 +- application/src/main/resources/thingsboard.yml | 2 +- common/actor/pom.xml | 2 +- common/cache/pom.xml | 2 +- common/cluster-api/pom.xml | 2 +- common/coap-server/pom.xml | 2 +- common/dao-api/pom.xml | 2 +- common/data/pom.xml | 2 +- common/edge-api/pom.xml | 2 +- common/edqs/pom.xml | 2 +- common/message/pom.xml | 2 +- common/pom.xml | 2 +- common/proto/pom.xml | 2 +- common/queue/pom.xml | 2 +- common/script/pom.xml | 2 +- common/script/remote-js-client/pom.xml | 2 +- common/script/script-api/pom.xml | 2 +- common/stats/pom.xml | 2 +- common/transport/coap/pom.xml | 2 +- common/transport/http/pom.xml | 2 +- common/transport/lwm2m/pom.xml | 2 +- common/transport/mqtt/pom.xml | 2 +- common/transport/pom.xml | 2 +- common/transport/snmp/pom.xml | 2 +- common/transport/transport-api/pom.xml | 2 +- common/util/pom.xml | 2 +- common/version-control/pom.xml | 2 +- dao/pom.xml | 2 +- edqs/pom.xml | 2 +- monitoring/pom.xml | 2 +- msa/black-box-tests/pom.xml | 2 +- msa/edqs/pom.xml | 2 +- msa/js-executor/package.json | 2 +- msa/js-executor/pom.xml | 2 +- msa/monitoring/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/lwm2m/pom.xml | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/transport/snmp/pom.xml | 2 +- msa/vc-executor-docker/pom.xml | 2 +- msa/vc-executor/pom.xml | 2 +- msa/web-ui/package.json | 2 +- msa/web-ui/pom.xml | 2 +- netty-mqtt/pom.xml | 4 ++-- pom.xml | 2 +- rest-client/pom.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- tools/pom.xml | 2 +- transport/coap/pom.xml | 2 +- transport/http/pom.xml | 2 +- transport/lwm2m/pom.xml | 2 +- transport/mqtt/pom.xml | 2 +- transport/pom.xml | 2 +- transport/snmp/pom.xml | 2 +- ui-ngx/package.json | 2 +- ui-ngx/pom.xml | 2 +- 63 files changed, 64 insertions(+), 64 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index 6ce77646f8..557179e918 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard application diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index abafd81e7c..2256946723 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -208,7 +208,7 @@ ui: # Help parameters help: # Base URL for UI help assets - base-url: "${UI_HELP_BASE_URL:https://raw.githubusercontent.com/thingsboard/thingsboard-ui-help/release-4.0}" + base-url: "${UI_HELP_BASE_URL:https://raw.githubusercontent.com/thingsboard/thingsboard-ui-help/release-4.1}" # Database telemetry parameters database: diff --git a/common/actor/pom.xml b/common/actor/pom.xml index 71b7e2eb6e..8ce6cf3761 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/cache/pom.xml b/common/cache/pom.xml index 27a536dc28..5ee70e2902 100644 --- a/common/cache/pom.xml +++ b/common/cache/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/cluster-api/pom.xml b/common/cluster-api/pom.xml index adc77dce22..d92b87fbb0 100644 --- a/common/cluster-api/pom.xml +++ b/common/cluster-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/coap-server/pom.xml b/common/coap-server/pom.xml index 3f020b289a..fe6ae3c64c 100644 --- a/common/coap-server/pom.xml +++ b/common/coap-server/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index b1b55a9461..cb8e578760 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index 5895974d82..648f3d1086 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/edge-api/pom.xml b/common/edge-api/pom.xml index f992486149..b3ec95983f 100644 --- a/common/edge-api/pom.xml +++ b/common/edge-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/edqs/pom.xml b/common/edqs/pom.xml index f7106e56fd..09181e796e 100644 --- a/common/edqs/pom.xml +++ b/common/edqs/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 380621a5ad..83100e11ea 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index 9a7a836ba5..6afae4e378 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard common diff --git a/common/proto/pom.xml b/common/proto/pom.xml index bcfb3dfc85..548b2e52c5 100644 --- a/common/proto/pom.xml +++ b/common/proto/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index e28ebfbcf0..2e4b14e282 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/script/pom.xml b/common/script/pom.xml index 80a8c4664a..61bbddc6c3 100644 --- a/common/script/pom.xml +++ b/common/script/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/script/remote-js-client/pom.xml b/common/script/remote-js-client/pom.xml index fc15448316..d247399ce6 100644 --- a/common/script/remote-js-client/pom.xml +++ b/common/script/remote-js-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT script org.thingsboard.common.script diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index 3a51b99f35..3908326c96 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT script org.thingsboard.common.script diff --git a/common/stats/pom.xml b/common/stats/pom.xml index db8367180a..90d619c133 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index 887dc014e8..314f79833b 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index 4354d14a1c..c1e3f77c4a 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/lwm2m/pom.xml b/common/transport/lwm2m/pom.xml index f918cdd167..01d0476c04 100644 --- a/common/transport/lwm2m/pom.xml +++ b/common/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index 34eeed396d..d84757981a 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 27b9bcbc9e..7180adc018 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/snmp/pom.xml b/common/transport/snmp/pom.xml index b971de293c..122696317e 100644 --- a/common/transport/snmp/pom.xml +++ b/common/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index 423fc5dc97..2cd41064da 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index acb97d3e2e..6719dc628a 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/common/version-control/pom.xml b/common/version-control/pom.xml index 22beed80d9..53a45a8197 100644 --- a/common/version-control/pom.xml +++ b/common/version-control/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index 35baa9b13b..9dca643b5d 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard dao diff --git a/edqs/pom.xml b/edqs/pom.xml index f466d2c20b..702c606daa 100644 --- a/edqs/pom.xml +++ b/edqs/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard edqs diff --git a/monitoring/pom.xml b/monitoring/pom.xml index b7735aed4c..7a55f105a7 100644 --- a/monitoring/pom.xml +++ b/monitoring/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index c3379cf37a..407e4d6079 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/edqs/pom.xml b/msa/edqs/pom.xml index deceadd06f..b3f584297e 100644 --- a/msa/edqs/pom.xml +++ b/msa/edqs/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json index 350d6029f0..1c16eaa594 100644 --- a/msa/js-executor/package.json +++ b/msa/js-executor/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-js-executor", "private": true, - "version": "4.0.0", + "version": "4.1.0", "description": "ThingsBoard JavaScript Executor Microservice", "main": "server.ts", "bin": "server.js", diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 9f89413b4b..be52d30d01 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/monitoring/pom.xml b/msa/monitoring/pom.xml index 3de71adb36..909c4ad0ac 100644 --- a/msa/monitoring/pom.xml +++ b/msa/monitoring/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa diff --git a/msa/pom.xml b/msa/pom.xml index 98e820daaf..280541452c 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index b47aec986c..4a278f9dd8 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index 1e9774cb42..f656f37a93 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 71c86d50a4..004080a542 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index e6b5611166..0d0d70e405 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/lwm2m/pom.xml b/msa/transport/lwm2m/pom.xml index 9088a9c996..596b2d3bbd 100644 --- a/msa/transport/lwm2m/pom.xml +++ b/msa/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index a61bc62921..aae7594b27 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index 46ea6612f9..9f5a0fdc7f 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/snmp/pom.xml b/msa/transport/snmp/pom.xml index 0664a89d9a..118783f98d 100644 --- a/msa/transport/snmp/pom.xml +++ b/msa/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.msa transport - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT org.thingsboard.msa.transport diff --git a/msa/vc-executor-docker/pom.xml b/msa/vc-executor-docker/pom.xml index c7e3ee5e11..088e9ab4a8 100644 --- a/msa/vc-executor-docker/pom.xml +++ b/msa/vc-executor-docker/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml index f2e4395766..b35a30f1b2 100644 --- a/msa/vc-executor/pom.xml +++ b/msa/vc-executor/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index 3374112096..8df71fc347 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-web-ui", "private": true, - "version": "4.0.0", + "version": "4.1.0", "description": "ThingsBoard Web UI Microservice", "main": "server.ts", "bin": "server.js", diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index f6f06c994a..4eba1f5e2f 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index bf55ec3083..fb3f88fd9e 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard netty-mqtt - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index 8ddd9c5346..3f8631a17b 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index 09f7e34c2c..828b33e835 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index b3681c9d69..0f089553b2 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index d036695cd3..d943759257 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index df44ee16c5..9666fa8059 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index 26e0543ab1..f9b5d9062f 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index 3cf7d677bf..058e0e96ab 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index 91fdd39755..03784a855c 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/lwm2m/pom.xml b/transport/lwm2m/pom.xml index cc929a0090..df92bde39d 100644 --- a/transport/lwm2m/pom.xml +++ b/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index da818e032b..d27ab91259 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index 66026fa10b..2cfe62ba95 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard transport diff --git a/transport/snmp/pom.xml b/transport/snmp/pom.xml index 0a36ea1f90..e561ae65b5 100644 --- a/transport/snmp/pom.xml +++ b/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT transport diff --git a/ui-ngx/package.json b/ui-ngx/package.json index e927abe7b2..e1cc3a90af 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -1,6 +1,6 @@ { "name": "thingsboard", - "version": "4.0.0", + "version": "4.1.0", "scripts": { "ng": "ng", "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --configuration development --host 0.0.0.0 --open", diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index eefea60273..79342e2ea8 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.0.0-SNAPSHOT + 4.1.0-SNAPSHOT thingsboard org.thingsboard From cedc7d2e462a04ea24776693b2377532c2161a91 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 15 Apr 2025 13:14:25 +0300 Subject: [PATCH 286/286] Cleanup upgrade scripts --- .../main/data/upgrade/basic/schema_update.sql | 79 ------------------- .../DefaultDatabaseSchemaSettingsService.java | 2 +- 2 files changed, 1 insertion(+), 80 deletions(-) diff --git a/application/src/main/data/upgrade/basic/schema_update.sql b/application/src/main/data/upgrade/basic/schema_update.sql index e91fbb823c..016e786776 100644 --- a/application/src/main/data/upgrade/basic/schema_update.sql +++ b/application/src/main/data/upgrade/basic/schema_update.sql @@ -14,82 +14,3 @@ -- limitations under the License. -- --- UPDATE SAVE TIME SERIES NODES START - -UPDATE rule_node -SET configuration = ( - (configuration::jsonb - 'skipLatestPersistence') - || jsonb_build_object( - 'processingSettings', jsonb_build_object( - 'type', 'ADVANCED', - 'timeseries', jsonb_build_object('type', 'ON_EVERY_MESSAGE'), - 'latest', jsonb_build_object('type', 'SKIP'), - 'webSockets', jsonb_build_object('type', 'ON_EVERY_MESSAGE'), - 'calculatedFields', jsonb_build_object('type', 'ON_EVERY_MESSAGE') - ) - ) - )::text, - configuration_version = 1 -WHERE type = 'org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode' - AND configuration_version = 0 - AND configuration::jsonb ->> 'skipLatestPersistence' = 'true'; - -UPDATE rule_node -SET configuration = ( - (configuration::jsonb - 'skipLatestPersistence') - || jsonb_build_object( - 'processingSettings', jsonb_build_object( - 'type', 'ON_EVERY_MESSAGE' - ) - ) - )::text, - configuration_version = 1 -WHERE type = 'org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode' - AND configuration_version = 0 - AND (configuration::jsonb ->> 'skipLatestPersistence' != 'true' OR configuration::jsonb ->> 'skipLatestPersistence' IS NULL); - --- UPDATE SAVE TIME SERIES NODES END - --- UPDATE SAVE ATTRIBUTES NODES START - -UPDATE rule_node -SET configuration = ( - configuration::jsonb - || jsonb_build_object( - 'processingSettings', jsonb_build_object('type', 'ON_EVERY_MESSAGE') - ) - )::text, - configuration_version = 3 -WHERE type = 'org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode' - AND configuration_version = 2; - --- UPDATE SAVE ATTRIBUTES NODES END - -ALTER TABLE api_usage_state ADD COLUMN IF NOT EXISTS version BIGINT DEFAULT 1; - --- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS START - -UPDATE tenant_profile -SET profile_data = profile_data - || jsonb_build_object( - 'configuration', profile_data->'configuration' || jsonb_build_object( - 'maxCalculatedFieldsPerEntity', COALESCE(profile_data->'configuration'->>'maxCalculatedFieldsPerEntity', '5')::bigint, - 'maxArgumentsPerCF', COALESCE(profile_data->'configuration'->>'maxArgumentsPerCF', '10')::bigint, - 'maxDataPointsPerRollingArg', COALESCE(profile_data->'configuration'->>'maxDataPointsPerRollingArg', '1000')::bigint, - 'maxStateSizeInKBytes', COALESCE(profile_data->'configuration'->>'maxStateSizeInKBytes', '32')::bigint, - 'maxSingleValueArgumentSizeInKBytes', COALESCE(profile_data->'configuration'->>'maxSingleValueArgumentSizeInKBytes', '2')::bigint - ) - ) -WHERE profile_data->'configuration'->>'maxCalculatedFieldsPerEntity' IS NULL; - --- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS END - --- UPDATE TENANT PROFILE DEBUG DURATION START - -UPDATE tenant_profile -SET profile_data = jsonb_set(profile_data, '{configuration,maxDebugModeDurationMinutes}', '15', true) -WHERE - profile_data->'configuration' ? 'maxDebugModeDurationMinutes' = false - OR (profile_data->'configuration'->>'maxDebugModeDurationMinutes')::int = 0; - --- UPDATE TENANT PROFILE DEBUG DURATION END diff --git a/application/src/main/java/org/thingsboard/server/service/install/DefaultDatabaseSchemaSettingsService.java b/application/src/main/java/org/thingsboard/server/service/install/DefaultDatabaseSchemaSettingsService.java index a0012a6fb3..6575c4b766 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/DefaultDatabaseSchemaSettingsService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/DefaultDatabaseSchemaSettingsService.java @@ -32,7 +32,7 @@ public class DefaultDatabaseSchemaSettingsService implements DatabaseSchemaSetti // This list should include all versions which are compatible for the upgrade. // The compatibility cycle usually breaks when we have some scripts written in Java that may not work after new release. - private static final List SUPPORTED_VERSIONS_FOR_UPGRADE = List.of("3.9.0", "3.9.1"); + private static final List SUPPORTED_VERSIONS_FOR_UPGRADE = List.of("4.0.0"); private final ProjectInfo projectInfo; private final JdbcTemplate jdbcTemplate;