import * as i0 from '@angular/core';
import { Input, HostBinding, Inject, Component, NgModule } from '@angular/core';
import { BACKEND_URL } from '@aztrix/environment';
import * as i1 from '@aztrix/translate';
import { TranslatePipe } from '@aztrix/translate';
import * as i3 from 'rxjs';
import { combineLatest, map } from 'rxjs';
import * as i2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i1$1 from '@aztrix/components/overlay';
import { ModalSize } from '@aztrix/components/overlay';
import * as i2$1 from '@aztrix/icons';
import { IconsModule } from '@aztrix/icons';
import * as i3$1 from '@aztrix/components/button';
import { ButtonModule } from '@aztrix/components/button';
import * as i4 from '@aztrix/components/theme';
import { ComponentsThemeModule } from '@aztrix/components/theme';
import { MatDialogModule } from '@angular/material/dialog';

class LegalFooterComponent {
    constructor(_translate, _backendUrl$) {
        this._translate = _translate;
        this._backendUrl$ = _backendUrl$;
        this.color = 'inherit';
        this.legalText = true;
        this.termsUrl$ = combineLatest([this._backendUrl$, this._translate.lang$]).pipe(map(([backendUrl, lang]) => backendUrl + `/policy?type=terms_conditions&lang=${lang}`));
        this.privacyUrl$ = combineLatest([this._backendUrl$, this._translate.lang$]).pipe(map(([backendUrl, lang]) => backendUrl + `/policy?type=privacy_policy_preface&lang=${lang}`));
    }
    get bugMail() {
        const subject = this._translate.instant('mail.bug.subject');
        return `mailto:${encodeURI('report@aztrix.me')}?subject=${encodeURI(subject)}`;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LegalFooterComponent, deps: [{ token: i1.TranslateService }, { token: BACKEND_URL }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: LegalFooterComponent, selector: "ax-legal-footer", inputs: { color: "color", legalText: "legalText" }, host: { properties: { "class": "this.color" } }, ngImport: i0, template: "<div class=\"text\">\n  <div class=\"legal legal-text\" *ngIf=\"legalText\">\n    {{ 'legal.text' | translate }}\n  </div>\n  <div class=\"legal\">\n    <a\n      [ngClass]=\"{'ax-base-color': color === 'primary'}\"\n      [href]=\"termsUrl$ | async\"\n      target=\"_blank\"\n      >{{ 'label.terms' | translate }}</a\n    >\n    -\n    <a\n      [ngClass]=\"{'ax-base-color': color === 'primary'}\"\n      [href]=\"privacyUrl$ | async\"\n      target=\"_blank\"\n      >{{ 'label.privacy.policy' | translate }}</a\n    >\n    -\n    <a [ngClass]=\"{'ax-base-color': color === 'primary'}\" [href]=\"bugMail\">{{\n      'label.report.abuse' | translate\n    }}</a>\n  </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center}:host span{font-size:.875rem;margin-right:.25rem}:host a{cursor:pointer}:host a:hover{text-decoration:underline}:host.inherit a{color:inherit}.legal.legal-text{margin-top:.5rem}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LegalFooterComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-legal-footer', template: "<div class=\"text\">\n  <div class=\"legal legal-text\" *ngIf=\"legalText\">\n    {{ 'legal.text' | translate }}\n  </div>\n  <div class=\"legal\">\n    <a\n      [ngClass]=\"{'ax-base-color': color === 'primary'}\"\n      [href]=\"termsUrl$ | async\"\n      target=\"_blank\"\n      >{{ 'label.terms' | translate }}</a\n    >\n    -\n    <a\n      [ngClass]=\"{'ax-base-color': color === 'primary'}\"\n      [href]=\"privacyUrl$ | async\"\n      target=\"_blank\"\n      >{{ 'label.privacy.policy' | translate }}</a\n    >\n    -\n    <a [ngClass]=\"{'ax-base-color': color === 'primary'}\" [href]=\"bugMail\">{{\n      'label.report.abuse' | translate\n    }}</a>\n  </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center}:host span{font-size:.875rem;margin-right:.25rem}:host a{cursor:pointer}:host a:hover{text-decoration:underline}:host.inherit a{color:inherit}.legal.legal-text{margin-top:.5rem}\n"] }]
        }], ctorParameters: () => [{ type: i1.TranslateService }, { type: i3.BehaviorSubject, decorators: [{
                    type: Inject,
                    args: [BACKEND_URL]
                }] }], propDecorators: { color: [{
                type: Input
            }, {
                type: HostBinding,
                args: ['class']
            }], legalText: [{
                type: Input
            }] } });

class AztrixInfoModalComponent {
    constructor(backendUrl$) {
        this.backendUrl$ = backendUrl$;
        this.legal = true;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AztrixInfoModalComponent, deps: [{ token: BACKEND_URL }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: AztrixInfoModalComponent, selector: "ax-aztrix-info-modal", inputs: { legal: "legal" }, ngImport: i0, template: "<div class=\"logo\">\n  <ax-icon class=\"icon\" name=\"custom:aztrixlogo\"></ax-icon>\n</div>\n<h1 class=\"dialog-title\">{{ 'aztrix.info' | translate }}</h1>\n<div class=\"dialog-content\">\n  <p>\n    {{ 'aztrix.explanation' | translate }}\n  </p>\n</div>\n<div class=\"button-wrapper\">\n  <a axButton filled color=\"primary\" class=\"button\" [href]=\"backendUrl$ | async\" target=\"_blank\">\n    {{ 'label.moreInfo' | translate }}\n    <ax-icon class=\"icon\" name=\"open-in-new\"></ax-icon\n  ></a>\n</div>\n<ax-legal-footer class=\"legal\" *ngIf=\"legal\" color=\"primary\"></ax-legal-footer>\n", styles: [":host{position:relative;display:block;padding:0 24px;margin-top:-24px}:host ::ng-deep ax-legal-footer .text{text-align:center}:host ::ng-deep .button.ax-button .icon{margin-right:-.25rem;margin-left:.25rem}.dialog-title{font-size:1.5rem;color:#555;text-align:center}.dialog-content{text-align:center;color:#555}.dialog-content p{margin:1.5rem 0}.button-wrapper{width:100%;display:flex;justify-content:center;margin:2rem 0 1.5rem}.logo{text-align:center;margin-bottom:1.5rem;height:34px;margin-top:1.5rem}.logo .icon{width:34px;height:34px;color:var(--primary-color-500)}.link:link,.link:visited,.link:hover,.link:active{color:#fff}.link .icon{vertical-align:middle;width:20px;height:20px;margin-left:.25rem}.legal{margin:2rem 0}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "directive", type: i3$1.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "component", type: LegalFooterComponent, selector: "ax-legal-footer", inputs: ["color", "legalText"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AztrixInfoModalComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-aztrix-info-modal', template: "<div class=\"logo\">\n  <ax-icon class=\"icon\" name=\"custom:aztrixlogo\"></ax-icon>\n</div>\n<h1 class=\"dialog-title\">{{ 'aztrix.info' | translate }}</h1>\n<div class=\"dialog-content\">\n  <p>\n    {{ 'aztrix.explanation' | translate }}\n  </p>\n</div>\n<div class=\"button-wrapper\">\n  <a axButton filled color=\"primary\" class=\"button\" [href]=\"backendUrl$ | async\" target=\"_blank\">\n    {{ 'label.moreInfo' | translate }}\n    <ax-icon class=\"icon\" name=\"open-in-new\"></ax-icon\n  ></a>\n</div>\n<ax-legal-footer class=\"legal\" *ngIf=\"legal\" color=\"primary\"></ax-legal-footer>\n", styles: [":host{position:relative;display:block;padding:0 24px;margin-top:-24px}:host ::ng-deep ax-legal-footer .text{text-align:center}:host ::ng-deep .button.ax-button .icon{margin-right:-.25rem;margin-left:.25rem}.dialog-title{font-size:1.5rem;color:#555;text-align:center}.dialog-content{text-align:center;color:#555}.dialog-content p{margin:1.5rem 0}.button-wrapper{width:100%;display:flex;justify-content:center;margin:2rem 0 1.5rem}.logo{text-align:center;margin-bottom:1.5rem;height:34px;margin-top:1.5rem}.logo .icon{width:34px;height:34px;color:var(--primary-color-500)}.link:link,.link:visited,.link:hover,.link:active{color:#fff}.link .icon{vertical-align:middle;width:20px;height:20px;margin-left:.25rem}.legal{margin:2rem 0}\n"] }]
        }], ctorParameters: () => [{ type: i3.BehaviorSubject, decorators: [{
                    type: Inject,
                    args: [BACKEND_URL]
                }] }], propDecorators: { legal: [{
                type: Input
            }] } });

class PoweredByAztrixComponent {
    constructor(_elementRef, _overlay) {
        this._elementRef = _elementRef;
        this._overlay = _overlay;
        this.bigLogo = false;
        this.legal = true;
        this.name = 'custom:aztrix_logo';
    }
    openDialog(evt) {
        evt.preventDefault();
        this._overlay.createModal(this._elementRef, AztrixInfoModalComponent, {
            modalSize: ModalSize.EXTRA_SMALL,
            init: (modal) => {
                modal.legal = this.legal;
            },
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PoweredByAztrixComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.OverlayService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PoweredByAztrixComponent, selector: "ax-powered-by-aztrix", inputs: { bigLogo: "bigLogo", legal: "legal", name: "name" }, ngImport: i0, template: `
    <ax-components-theme>
      <button class="aztrix-button" [ngClass]="{'big-logo': bigLogo}" (click)="openDialog($event)">
        <span>Powered by</span>
        <ax-icon class="icon logo" [name]="name"></ax-icon>
      </button>
    </ax-components-theme>
  `, isInline: true, styles: [":host{display:flex;justify-content:center}.aztrix-button{display:inline-flex;justify-content:space-between;align-items:center;color:#363f48;background-color:transparent;border:none;font-size:10px;white-space:nowrap;padding:0;height:20px;width:95px}.aztrix-button .logo{min-width:40px;margin:-3px 2px 0}.aztrix-button.big-logo{display:flex;flex-direction:column;height:auto;gap:4px}.aztrix-button.big-logo .logo{width:100%;margin:0;height:auto}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2$1.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "component", type: i4.ComponentsThemeComponent, selector: "ax-components-theme" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PoweredByAztrixComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-powered-by-aztrix', template: `
    <ax-components-theme>
      <button class="aztrix-button" [ngClass]="{'big-logo': bigLogo}" (click)="openDialog($event)">
        <span>Powered by</span>
        <ax-icon class="icon logo" [name]="name"></ax-icon>
      </button>
    </ax-components-theme>
  `, styles: [":host{display:flex;justify-content:center}.aztrix-button{display:inline-flex;justify-content:space-between;align-items:center;color:#363f48;background-color:transparent;border:none;font-size:10px;white-space:nowrap;padding:0;height:20px;width:95px}.aztrix-button .logo{min-width:40px;margin:-3px 2px 0}.aztrix-button.big-logo{display:flex;flex-direction:column;height:auto;gap:4px}.aztrix-button.big-logo .logo{width:100%;margin:0;height:auto}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.OverlayService }], propDecorators: { bigLogo: [{
                type: Input
            }], legal: [{
                type: Input
            }], name: [{
                type: Input
            }] } });

class PoweredByAztrixModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PoweredByAztrixModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: PoweredByAztrixModule, declarations: [PoweredByAztrixComponent, LegalFooterComponent, AztrixInfoModalComponent], imports: [CommonModule,
            TranslatePipe,
            IconsModule,
            MatDialogModule,
            ComponentsThemeModule,
            ButtonModule], exports: [PoweredByAztrixComponent, LegalFooterComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PoweredByAztrixModule, imports: [CommonModule,
            IconsModule,
            MatDialogModule,
            ComponentsThemeModule,
            ButtonModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PoweredByAztrixModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [PoweredByAztrixComponent, LegalFooterComponent, AztrixInfoModalComponent],
                    imports: [
                        CommonModule,
                        TranslatePipe,
                        IconsModule,
                        MatDialogModule,
                        ComponentsThemeModule,
                        ButtonModule,
                    ],
                    exports: [PoweredByAztrixComponent, LegalFooterComponent],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { LegalFooterComponent, PoweredByAztrixComponent, PoweredByAztrixModule };
//# sourceMappingURL=aztrix-components-powered-by-aztrix.mjs.map
