<!--

    Copyright © 2016-2023 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.

-->
<mat-toolbar color="primary">
  <h2>{{ 'image.embed-image' | translate }}</h2>
  <span fxFlex></span>
  <button mat-icon-button
          (click)="cancel()"
          type="button">
    <mat-icon class="material-icons">close</mat-icon>
  </button>
</mat-toolbar>
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
</mat-progress-bar>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content>
  <div class="tb-form-panel stroked tb-slide-toggle" *ngIf="!readonly || image.public">
    <mat-expansion-panel class="tb-settings" [expanded]="image.public" disabled>
      <mat-expansion-panel-header fxLayout="row wrap">
        <mat-panel-title>
          <div *ngIf="!readonly" tb-hint-tooltip-icon="{{ 'image.embed-to-html-hint' | translate }}"
               class="tb-form-row no-border no-padding">
            <mat-slide-toggle class="mat-slide" [formControl]="publicStatusControl" (click)="$event.stopPropagation()"
                              fxLayoutAlign="center">
              <div class="tb-form-panel-title">{{ 'image.embed-to-html' | translate }}</div>
            </mat-slide-toggle>
          </div>
          <div *ngIf="readonly" class="tb-form-panel-title" translate>image.embed-to-html</div>
        </mat-panel-title>
      </mat-expansion-panel-header>
      <ng-template matExpansionPanelContent>
        <div class="tb-embed-image-text" [innerHTML]="'image.embed-to-html-text' | translate"></div>
        <tb-markdown usePlainMarkdown
                     containerClass="tb-embed-image-code"
                     [data]="embedToHtmlCode()"></tb-markdown>
      </ng-template>
    </mat-expansion-panel>
  </div>
  <div class="tb-form-panel stroked">
    <div class="tb-form-panel-title" translate>image.embed-to-angular-template</div>
    <div class="tb-embed-image-text" [innerHTML]="'image.embed-to-angular-template-text' | translate"></div>
    <tb-markdown usePlainMarkdown
                 containerClass="tb-embed-image-code"
                 [data]="embedToAngularTemplateCode()"></tb-markdown>
  </div>
</div>
