import * as i0 from '@angular/core';
import { Injectable, Component, Input, Pipe, NgModule } from '@angular/core';
import * as i8 from '@angular/forms';
import { FormGroup, FormControl, Validators, UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
import { ActionFinishedComponent, ActionFinishedModule } from '@aztrix/components/action-finished';
import * as i3 from '@aztrix/components/overlay';
import * as i2 from '@aztrix/helpers';
import { PropertyFormControl, CustomValidators, HelperPipesModule } from '@aztrix/helpers';
import { PropertyType } from '@aztrix/models';
import { throwError, BehaviorSubject } from 'rxjs';
import { tap, mergeMap, switchMap, map, first, catchError, debounceTime, shareReplay } from 'rxjs/operators';
import * as i1 from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import * as i4 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i5 from '@aztrix/icons';
import { IconsModule } from '@aztrix/icons';
import * as i6 from '@angular/material/legacy-form-field';
import { MatLegacyFormFieldModule } from '@angular/material/legacy-form-field';
import * as i7 from '@angular/material/legacy-input';
import { MatLegacyInputModule } from '@angular/material/legacy-input';
import * as i9 from '@aztrix/components/property-select';
import { PropertySelectModule } from '@aztrix/components/property-select';
import * as i10 from '@aztrix/components/value-edit';
import { ValueEditModule } from '@aztrix/components/value-edit';
import * as i11 from '@aztrix/components/spinner';
import { SpinnerModule } from '@aztrix/components/spinner';
import * as i12 from '@aztrix/components/button';
import { ButtonModule } from '@aztrix/components/button';

class FeedbackService {
    constructor(backend, _environment) {
        this._environment = _environment;
        this.http = new HttpClient(backend);
    }
    submit(requestTypeId, summary, email, description, attachment) {
        const fields = [
            { id: 'summary', value: summary },
            { id: 'description', value: description },
            { id: 'email', value: email },
        ];
        if (attachment) {
            return this._uploadImage(attachment).pipe(tap((attachmentId) => fields.push({ id: 'attachment', value: [attachmentId] })), mergeMap(() => this._submitTicket(requestTypeId, fields)));
        }
        else {
            return this._submitTicket(requestTypeId, fields);
        }
    }
    _uploadImage(file) {
        const formData = new FormData();
        formData.append('file', file);
        return this._apiUrl$('upload').pipe(switchMap((url) => {
            return this.http
                .post(url, formData)
                .pipe(map((result) => result[0].temporaryAttachmentId));
        }));
    }
    _submitTicket(requestTypeId, fields) {
        return this._apiUrl$(`request?requestTypeId=${requestTypeId}`).pipe(switchMap((url) => this.http.post(url, { fields })));
    }
    searchKnowledgeBase(query) {
        return this._apiUrl$(`search?query=${query}&limit=5`).pipe(switchMap((url) => this.http.get(url)));
    }
    _apiUrl$(url) {
        return this._environment.string$('JIRA_SERVICE_API_KEY').pipe(first(), map((key) => `https://jsd-widget.atlassian.com/api/embeddable/${key}/${url}`));
    }
}
FeedbackService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackService, deps: [{ token: i1.HttpBackend }, { token: i2.EnvironmentService }], target: i0.ɵɵFactoryTarget.Injectable });
FeedbackService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackService, providedIn: 'any' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'any' }]
        }], ctorParameters: function () { return [{ type: i1.HttpBackend }, { type: i2.EnvironmentService }]; } });

class FeedbackFormComponent {
    constructor(_feedback, _translate, _overlayService) {
        this._feedback = _feedback;
        this._translate = _translate;
        this._overlayService = _overlayService;
        this.emailOptions = [];
        this.feedbackForm = new FormGroup({});
    }
    ngOnChanges(changes) {
        if (changes.requestType && this.requestType) {
            this._createFeedbackForm(this.requestType);
        }
    }
    selectImage(event) {
        this._attachment = event.target.files[0];
        this.feedbackForm.get('attachment').setValue(this._attachment.name);
    }
    submitFeedback() {
        if (this.feedbackForm.valid) {
            this.feedbackForm.disable();
            const { summary, email, description } = this.feedbackForm.value;
            let title = summary;
            if (this.reportedProfile) {
                title = `${summary} // profileId: ${this.reportedProfile.id}`;
            }
            this._feedback
                .submit(this.requestType.id, title, email.value, description, this._attachment)
                .pipe(catchError((error) => {
                this.feedbackForm.enable();
                return throwError(() => error);
            }))
                .subscribe(() => {
                this._overlayService.closeModal();
                this._overlayService.createModal(ActionFinishedComponent, {
                    title: 'modal.report.submit.success',
                    init: (modal) => {
                        modal.bodyExplanation = this._translate.instant('modal.report.submit.description');
                        modal.didClickButton.subscribe(() => this._overlayService.closeModal());
                    },
                });
            });
        }
    }
    get loading() {
        return !Object.values(this.feedbackForm.controls)?.length;
    }
    _createFeedbackForm(requestType) {
        for (const field of requestType.fields) {
            switch (field.id) {
                case 'summary':
                    this.feedbackForm.addControl('summary', new FormControl('', [Validators.required, Validators.minLength(4)]));
                    break;
                case 'description':
                    this.feedbackForm.addControl('description', new FormControl('', [
                        Validators.required,
                        Validators.minLength(10),
                        Validators.maxLength(2000),
                    ]));
                    break;
                case 'email':
                    this.feedbackForm.addControl('email', PropertyFormControl.createByType(PropertyType.EMAIL, [
                        CustomValidators.propertyRequired,
                    ]));
                    break;
                case 'attachment':
                    this.feedbackForm.addControl('attachment', new FormControl({ value: null, disabled: true }));
                    break;
            }
        }
    }
}
FeedbackFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackFormComponent, deps: [{ token: FeedbackService }, { token: i2.TranslateService }, { token: i3.OverlayService }], target: i0.ɵɵFactoryTarget.Component });
FeedbackFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: FeedbackFormComponent, selector: "ax-feedback-form", inputs: { emailOptions: "emailOptions", requestType: "requestType", reportedProfile: "reportedProfile" }, usesOnChanges: true, ngImport: i0, template: "<mat-form-field *ngIf=\"reportedProfile\" class=\"c-input\" appearance=\"outline\">\n  <mat-label>{{ 'label.profile' | translate }}</mat-label>\n  <input type=\"text\" matInput [disabled]=\"true\" [value]=\"reportedProfile | displayName\" />\n</mat-form-field>\n<ax-spinner *ngIf=\"loading\"></ax-spinner>\n<mat-form-field *ngIf=\"feedbackForm.get('summary')\" class=\"c-input\" appearance=\"outline\">\n  <mat-label>{{ 'label.title' | translate }}</mat-label>\n  <input type=\"text\" matInput [formControl]=\"feedbackForm.get('summary')\" [required]=\"true\" />\n  <mat-error>\n    <ax-icon name=\"alert-circle\"></ax-icon>\n    {{ 'modal.feedback.required' | translate }}\n  </mat-error>\n</mat-form-field>\n<mat-form-field *ngIf=\"feedbackForm.get('description')\" class=\"c-input\" appearance=\"outline\">\n  <mat-label>{{ 'modal.feedback.provide.description' | translate }}</mat-label>\n  <textarea\n    rows=\"4\"\n    [placeholder]=\"\"\n    type=\"text\"\n    matInput\n    [formControl]=\"feedbackForm.get('description')\"\n  ></textarea>\n  <mat-error>\n    <ax-icon name=\"alert-circle\"></ax-icon>\n    {{ 'modal.feedback.description.length' | translate }}\n  </mat-error>\n</mat-form-field>\n<mat-form-field *ngIf=\"feedbackForm.get('attachment')\" class=\"c-input\" appearance=\"outline\">\n  <input\n    matInput\n    type=\"text\"\n    [placeholder]=\"'modal.bug.attachment' | translate\"\n    (click)=\"uploadBtn.click()\"\n    [formControl]=\"feedbackForm.get('attachment')\"\n  />\n  <button\n    axButton\n    matSuffix\n    icon-button\n    (click)=\"\n      feedbackForm.get('attachment').value\n        ? feedbackForm.get('attachment').reset()\n        : uploadBtn.click()\n    \"\n    class=\"attachment-button\"\n  >\n    <ax-icon\n      class=\"icon\"\n      [name]=\"feedbackForm.get('attachment').value ? 'close' : 'paperclip'\"\n    ></ax-icon>\n  </button>\n  <input\n    hidden\n    type=\"file\"\n    accept=\"image/jpeg, image/png\"\n    (change)=\"selectImage($event)\"\n    #uploadBtn\n  />\n</mat-form-field>\n\n<ng-container *ngIf=\"feedbackForm.get('email')\">\n  <ng-template #input>\n    <ax-value-edit\n      [form]=\"feedbackForm.get('email').get('value')\"\n      type=\"TEXT\"\n      [label]=\"'property.EMAIL.label' | translate\"\n      [required]=\"true\"\n    ></ax-value-edit>\n  </ng-template>\n  <ax-property-select\n    *ngIf=\"emailOptions?.length; else input\"\n    [form]=\"feedbackForm.get('email')\"\n    [options]=\"emailOptions\"\n    [error]=\"'modal.feedback.required' | translate\"\n    [required]=\"true\"\n  ></ax-property-select>\n</ng-container>\n\n<div class=\"h-button-wrapper\">\n  <button\n    axButton\n    (click)=\"submitFeedback()\"\n    filled\n    color=\"primary\"\n    [disabled]=\"feedbackForm.disabled || !feedbackForm.valid\"\n  >\n    {{ 'label.send' | translate }}\n  </button>\n</div>\n", styles: ["mat-form-field{width:100%}:host{display:block;padding:1rem}:host>*{padding:.5rem 0}:host>*:first-child{padding-top:0}:host>*:last-child{padding-bottom:0}.h-button-wrapper{text-align:right}.attachment-button{margin:.25rem 0}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "directive", type: i6.MatLegacyError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i6.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLegacyLabel, selector: "mat-label" }, { kind: "directive", type: i6.MatLegacySuffix, selector: "[matSuffix]" }, { kind: "directive", type: i7.MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", exportAs: ["matInput"] }, { kind: "directive", type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i8.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i9.PropertySelectComponent, selector: "ax-property-select", inputs: ["form", "options", "hint", "error", "required", "verifiedOnly", "noValuePlaceholder"] }, { kind: "component", type: i10.ValueEditComponent, selector: "ax-value-edit", inputs: ["type", "numberConfig"] }, { kind: "component", type: i11.SpinnerComponent, selector: "ax-spinner" }, { kind: "directive", type: i12.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: i2.DisplayNamePipe, name: "displayName" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackFormComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-feedback-form', template: "<mat-form-field *ngIf=\"reportedProfile\" class=\"c-input\" appearance=\"outline\">\n  <mat-label>{{ 'label.profile' | translate }}</mat-label>\n  <input type=\"text\" matInput [disabled]=\"true\" [value]=\"reportedProfile | displayName\" />\n</mat-form-field>\n<ax-spinner *ngIf=\"loading\"></ax-spinner>\n<mat-form-field *ngIf=\"feedbackForm.get('summary')\" class=\"c-input\" appearance=\"outline\">\n  <mat-label>{{ 'label.title' | translate }}</mat-label>\n  <input type=\"text\" matInput [formControl]=\"feedbackForm.get('summary')\" [required]=\"true\" />\n  <mat-error>\n    <ax-icon name=\"alert-circle\"></ax-icon>\n    {{ 'modal.feedback.required' | translate }}\n  </mat-error>\n</mat-form-field>\n<mat-form-field *ngIf=\"feedbackForm.get('description')\" class=\"c-input\" appearance=\"outline\">\n  <mat-label>{{ 'modal.feedback.provide.description' | translate }}</mat-label>\n  <textarea\n    rows=\"4\"\n    [placeholder]=\"\"\n    type=\"text\"\n    matInput\n    [formControl]=\"feedbackForm.get('description')\"\n  ></textarea>\n  <mat-error>\n    <ax-icon name=\"alert-circle\"></ax-icon>\n    {{ 'modal.feedback.description.length' | translate }}\n  </mat-error>\n</mat-form-field>\n<mat-form-field *ngIf=\"feedbackForm.get('attachment')\" class=\"c-input\" appearance=\"outline\">\n  <input\n    matInput\n    type=\"text\"\n    [placeholder]=\"'modal.bug.attachment' | translate\"\n    (click)=\"uploadBtn.click()\"\n    [formControl]=\"feedbackForm.get('attachment')\"\n  />\n  <button\n    axButton\n    matSuffix\n    icon-button\n    (click)=\"\n      feedbackForm.get('attachment').value\n        ? feedbackForm.get('attachment').reset()\n        : uploadBtn.click()\n    \"\n    class=\"attachment-button\"\n  >\n    <ax-icon\n      class=\"icon\"\n      [name]=\"feedbackForm.get('attachment').value ? 'close' : 'paperclip'\"\n    ></ax-icon>\n  </button>\n  <input\n    hidden\n    type=\"file\"\n    accept=\"image/jpeg, image/png\"\n    (change)=\"selectImage($event)\"\n    #uploadBtn\n  />\n</mat-form-field>\n\n<ng-container *ngIf=\"feedbackForm.get('email')\">\n  <ng-template #input>\n    <ax-value-edit\n      [form]=\"feedbackForm.get('email').get('value')\"\n      type=\"TEXT\"\n      [label]=\"'property.EMAIL.label' | translate\"\n      [required]=\"true\"\n    ></ax-value-edit>\n  </ng-template>\n  <ax-property-select\n    *ngIf=\"emailOptions?.length; else input\"\n    [form]=\"feedbackForm.get('email')\"\n    [options]=\"emailOptions\"\n    [error]=\"'modal.feedback.required' | translate\"\n    [required]=\"true\"\n  ></ax-property-select>\n</ng-container>\n\n<div class=\"h-button-wrapper\">\n  <button\n    axButton\n    (click)=\"submitFeedback()\"\n    filled\n    color=\"primary\"\n    [disabled]=\"feedbackForm.disabled || !feedbackForm.valid\"\n  >\n    {{ 'label.send' | translate }}\n  </button>\n</div>\n", styles: ["mat-form-field{width:100%}:host{display:block;padding:1rem}:host>*{padding:.5rem 0}:host>*:first-child{padding-top:0}:host>*:last-child{padding-bottom:0}.h-button-wrapper{text-align:right}.attachment-button{margin:.25rem 0}\n"] }]
        }], ctorParameters: function () { return [{ type: FeedbackService }, { type: i2.TranslateService }, { type: i3.OverlayService }]; }, propDecorators: { emailOptions: [{
                type: Input
            }], requestType: [{
                type: Input
            }], reportedProfile: [{
                type: Input
            }] } });

class IconForJiraRequestTypePipe {
    transform(requestType) {
        const name = requestType.name.toLowerCase();
        if (name.includes('bug')) {
            return 'bug';
        }
        else if (name.includes('feedback') ||
            name.includes('improvement') ||
            name.includes('feature')) {
            return 'message-star';
        }
        else if (name.includes('profile')) {
            return 'alert-circle';
        }
        else if (name.includes('question')) {
            return 'message-question';
        }
        else {
            return 'message-alert';
        }
    }
}
IconForJiraRequestTypePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IconForJiraRequestTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
IconForJiraRequestTypePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: IconForJiraRequestTypePipe, name: "iconForJiraRequestType" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IconForJiraRequestTypePipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'iconForJiraRequestType',
                }]
        }] });

class FeedbackSearchComponent {
    constructor(_feedback, _overlayService, _environment) {
        this._feedback = _feedback;
        this._overlayService = _overlayService;
        this._environment = _environment;
        this.initValue = '';
        this.emailOptions = [];
        this.loadingResults$ = new BehaviorSubject(true);
        this.loadingRequestTypes$ = new BehaviorSubject(true);
        this.searchForm = new UntypedFormControl('');
        this.keyup$ = new BehaviorSubject('');
        this.searchResults$ = this.keyup$.pipe(debounceTime(500), tap(() => this.loadingResults$.next(true)), switchMap((search) => this._feedback.searchKnowledgeBase(search || 'how to').pipe(map((results) => results.articles.map((article) => {
            // eslint-disable-next-line max-len
            article.contentUrl = `https://aztrix.atlassian.net/servicedesk/customer/kb/view/${article.id}`;
            return article;
        })))), tap(() => this.loadingResults$.next(false)), shareReplay(1));
        this.requestTypes$ = this._feedback.searchKnowledgeBase('').pipe(map((results) => results.requestTypes), tap(() => this.loadingRequestTypes$.next(false)));
        this.portalUrl$ = this._environment
            .string$('JIRA_SERVICE_PORTAL_ID')
            .pipe(map((id) => `https://aztrix.atlassian.net/servicedesk/customer/portal/${id}`));
    }
    ngOnInit() {
        if (this.initValue !== '') {
            this.searchForm.setValue(this.initValue);
            this.keyup$.next(this.searchForm.value);
        }
    }
    openFeedbackModal(requestType) {
        this._overlayService.closeModal();
        this._overlayService.createModal(FeedbackFormComponent, {
            title: requestType.name,
            init: (modal) => {
                modal.requestType = requestType;
                modal.emailOptions = this.emailOptions;
            },
        });
    }
}
FeedbackSearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackSearchComponent, deps: [{ token: FeedbackService }, { token: i3.OverlayService }, { token: i2.EnvironmentService }], target: i0.ɵɵFactoryTarget.Component });
FeedbackSearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: FeedbackSearchComponent, selector: "ax-feedback-search", inputs: { initValue: "initValue", emailOptions: "emailOptions" }, ngImport: i0, template: "<div class=\"ax-modal-body-content c-modal__section\">\n  <mat-form-field class=\"c-input\" appearance=\"outline\" style=\"width: 100%\">\n    <mat-label>{{ 'modal.feedback.results.placeholder' | translate }}</mat-label>\n    <input\n      matInput\n      type=\"text\"\n      autofocus=\"true\"\n      [formControl]=\"searchForm\"\n      (keyup)=\"keyup$.next(searchForm.value)\"\n    />\n  </mat-form-field>\n  <div class=\"search-results\">\n    <h2>{{ 'modal.feedback.results.title' | translate }}</h2>\n    <ax-spinner class=\"results-loading\" *ngIf=\"loadingResults$ | async\"></ax-spinner>\n    <p *ngIf=\"!(searchResults$ | async)?.length && (loadingResults$ | async) === false\">\n      {{ 'modal.feedback.results.empty' | translate }}\n    </p>\n    <ng-container *ngIf=\"(loadingResults$ | async) === false\">\n      <a\n        class=\"search-link\"\n        *ngFor=\"let searchResult of searchResults$ | async\"\n        target=\"_blank\"\n        [href]=\"searchResult.contentUrl\"\n      >\n        <ax-icon class=\"icon\" name=\"text-box\"></ax-icon>\n        <span>{{ searchResult.title }}</span>\n      </a>\n    </ng-container>\n  </div>\n  <a class=\"portal-link\" [attr.href]=\"portalUrl$ | async\" target=\"_blank\">{{\n    'modal.feedback.articles' | translate | uppercase\n  }}</a>\n  <div class=\"contact-links\">\n    <h2>{{ 'modal.feedback.contact' | translate }}</h2>\n    <ax-spinner class=\"loading\" *ngIf=\"loadingRequestTypes$ | async\"></ax-spinner>\n    <div\n      *ngFor=\"let requestType of requestTypes$ | async\"\n      class=\"search-link\"\n      (click)=\"openFeedbackModal(requestType)\"\n    >\n      <ax-icon class=\"icon\" [name]=\"requestType | iconForJiraRequestType\"></ax-icon>\n      <span>{{ requestType.name }}</span>\n    </div>\n  </div>\n</div>\n", styles: [".search-link{color:#000;width:100%;display:flex;align-items:center;line-height:2rem;cursor:pointer}.search-link .icon{color:var(--primary-color-500)}.search-link span{margin-left:1rem}.c-modal__section{padding:1rem}.search-results{margin-bottom:.5rem;min-height:200px}.results-loading{height:150px;justify-content:center}h2{font-size:1.125rem}.portal-link{display:block;margin-bottom:1rem;color:var(--primary-color-500);font-weight:700}.contact-links{padding-top:1rem}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "component", type: i6.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLegacyLabel, selector: "mat-label" }, { kind: "directive", type: i7.MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", exportAs: ["matInput"] }, { kind: "directive", type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i11.SpinnerComponent, selector: "ax-spinner" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: IconForJiraRequestTypePipe, name: "iconForJiraRequestType" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackSearchComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-feedback-search', template: "<div class=\"ax-modal-body-content c-modal__section\">\n  <mat-form-field class=\"c-input\" appearance=\"outline\" style=\"width: 100%\">\n    <mat-label>{{ 'modal.feedback.results.placeholder' | translate }}</mat-label>\n    <input\n      matInput\n      type=\"text\"\n      autofocus=\"true\"\n      [formControl]=\"searchForm\"\n      (keyup)=\"keyup$.next(searchForm.value)\"\n    />\n  </mat-form-field>\n  <div class=\"search-results\">\n    <h2>{{ 'modal.feedback.results.title' | translate }}</h2>\n    <ax-spinner class=\"results-loading\" *ngIf=\"loadingResults$ | async\"></ax-spinner>\n    <p *ngIf=\"!(searchResults$ | async)?.length && (loadingResults$ | async) === false\">\n      {{ 'modal.feedback.results.empty' | translate }}\n    </p>\n    <ng-container *ngIf=\"(loadingResults$ | async) === false\">\n      <a\n        class=\"search-link\"\n        *ngFor=\"let searchResult of searchResults$ | async\"\n        target=\"_blank\"\n        [href]=\"searchResult.contentUrl\"\n      >\n        <ax-icon class=\"icon\" name=\"text-box\"></ax-icon>\n        <span>{{ searchResult.title }}</span>\n      </a>\n    </ng-container>\n  </div>\n  <a class=\"portal-link\" [attr.href]=\"portalUrl$ | async\" target=\"_blank\">{{\n    'modal.feedback.articles' | translate | uppercase\n  }}</a>\n  <div class=\"contact-links\">\n    <h2>{{ 'modal.feedback.contact' | translate }}</h2>\n    <ax-spinner class=\"loading\" *ngIf=\"loadingRequestTypes$ | async\"></ax-spinner>\n    <div\n      *ngFor=\"let requestType of requestTypes$ | async\"\n      class=\"search-link\"\n      (click)=\"openFeedbackModal(requestType)\"\n    >\n      <ax-icon class=\"icon\" [name]=\"requestType | iconForJiraRequestType\"></ax-icon>\n      <span>{{ requestType.name }}</span>\n    </div>\n  </div>\n</div>\n", styles: [".search-link{color:#000;width:100%;display:flex;align-items:center;line-height:2rem;cursor:pointer}.search-link .icon{color:var(--primary-color-500)}.search-link span{margin-left:1rem}.c-modal__section{padding:1rem}.search-results{margin-bottom:.5rem;min-height:200px}.results-loading{height:150px;justify-content:center}h2{font-size:1.125rem}.portal-link{display:block;margin-bottom:1rem;color:var(--primary-color-500);font-weight:700}.contact-links{padding-top:1rem}\n"] }]
        }], ctorParameters: function () { return [{ type: FeedbackService }, { type: i3.OverlayService }, { type: i2.EnvironmentService }]; }, propDecorators: { initValue: [{
                type: Input
            }], emailOptions: [{
                type: Input
            }] } });

class FeedbackModule {
}
FeedbackModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
FeedbackModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: FeedbackModule, declarations: [IconForJiraRequestTypePipe, FeedbackSearchComponent, FeedbackFormComponent], imports: [CommonModule,
        IconsModule,
        HelperPipesModule,
        MatLegacyFormFieldModule,
        MatLegacyInputModule,
        ReactiveFormsModule,
        ActionFinishedModule,
        PropertySelectModule,
        ValueEditModule,
        SpinnerModule,
        ButtonModule,
        IconsModule], exports: [FeedbackFormComponent, FeedbackSearchComponent] });
FeedbackModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackModule, providers: [FeedbackService], imports: [CommonModule,
        IconsModule,
        HelperPipesModule,
        MatLegacyFormFieldModule,
        MatLegacyInputModule,
        ReactiveFormsModule,
        ActionFinishedModule,
        PropertySelectModule,
        ValueEditModule,
        SpinnerModule,
        ButtonModule,
        IconsModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FeedbackModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [IconForJiraRequestTypePipe, FeedbackSearchComponent, FeedbackFormComponent],
                    imports: [
                        CommonModule,
                        IconsModule,
                        HelperPipesModule,
                        MatLegacyFormFieldModule,
                        MatLegacyInputModule,
                        ReactiveFormsModule,
                        ActionFinishedModule,
                        PropertySelectModule,
                        ValueEditModule,
                        SpinnerModule,
                        ButtonModule,
                        IconsModule,
                    ],
                    providers: [FeedbackService],
                    exports: [FeedbackFormComponent, FeedbackSearchComponent],
                }]
        }] });

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

export { FeedbackFormComponent, FeedbackModule, FeedbackSearchComponent, FeedbackService };
//# sourceMappingURL=aztrix-components-feedback.mjs.map
//# sourceMappingURL=aztrix-components-feedback.mjs.map
