import * as i0 from '@angular/core';
import { Component, ChangeDetectionStrategy, Input, NgModule } from '@angular/core';
import * as i1 from '@aztrix/environment';
import { CommonModule } from '@angular/common';
import { IconsModule } from '@aztrix/icons';

class FileSourceComponent {
    constructor(_transformer) {
        this._transformer = _transformer;
        this._source = '';
    }
    ngOnChanges(changes) {
        if (changes.source) {
            if (!this.source) {
                this._source = '';
            }
            else {
                this._source = this._transform(this.source);
            }
        }
    }
    _transform(url) {
        return this._transformer.transformUrl(url);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileSourceComponent, deps: [{ token: i1.UrlTransformerService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FileSourceComponent, selector: "ax-file-source", inputs: { source: "source", fileName: "fileName" }, usesOnChanges: true, ngImport: i0, template: "<a class=\"link\" [attr.href]=\"source\" [attr.download]=\"fileName\" target=\"_blank\">{{ fileName }}</a>\n", styles: [".link,.link:link,.link:visited,.link:hover,.link:active{color:var(--primary-color-500)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileSourceComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-file-source', changeDetection: ChangeDetectionStrategy.OnPush, template: "<a class=\"link\" [attr.href]=\"source\" [attr.download]=\"fileName\" target=\"_blank\">{{ fileName }}</a>\n", styles: [".link,.link:link,.link:visited,.link:hover,.link:active{color:var(--primary-color-500)}\n"] }]
        }], ctorParameters: () => [{ type: i1.UrlTransformerService }], propDecorators: { source: [{
                type: Input
            }], fileName: [{
                type: Input
            }] } });

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

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

export { FileSourceComponent, FileSourceModule };
//# sourceMappingURL=aztrix-components-file-source.mjs.map
