import { __decorate } from "tslib";
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { SharedService } from '../../../../shared/service/shared.service';
import { DomSanitizer } from '@angular/platform-browser';
import { QuizService } from '../../../../shared/service/quiz.service';
import { SummaryBase } from '../summary-base';
let FigureLabelingSummaryComponent = class FigureLabelingSummaryComponent extends SummaryBase {
    constructor(sharedService, quizService, _DomSanitizationService) {
        super(sharedService);
        this.sharedService = sharedService;
        this.quizService = quizService;
        this._DomSanitizationService = _DomSanitizationService;
    }
    ngOnChanges(changes) {
        if (this.question) {
            this.getAnswers();
        }
    }
    ngOnInit() {
        this.convertedTime = this.convertTime2(this.question.questionTimeSpent, 'time');
    }
    getAnswers() {
        this.correctAnswer = '';
        this.selectedAnswer = '';
        if (this.question) {
            // Used the data from server
            this.userAnswerView = {};
            this.userAnswerViewDetails = [];
            if (this.question.userResponse.length !== 0) {
                for (const i of this.question.userResponse) {
                    for (const item of this.question.graphicInteraction
                        .figureLabelChoices) {
                        if (Number(i) === item.choiceId) {
                            this.userAnswerView[item.choiceId] = item.label;
                            this.userAnswerViewDetails.push(item);
                        }
                    }
                }
            }
        }
        return true;
    }
    loadImagePath(assetType, slide) {
        if (this.quizService.isOnline) {
            return slide.assetPath;
        }
        return this._DomSanitizationService.bypassSecurityTrustUrl(this.splitStringForType(assetType, slide.assetName) + slide.assetsContent);
    }
};
FigureLabelingSummaryComponent.ctorParameters = () => [
    { type: SharedService },
    { type: QuizService },
    { type: DomSanitizer }
];
__decorate([
    Input('summaryData')
], FigureLabelingSummaryComponent.prototype, "question", void 0);
FigureLabelingSummaryComponent = __decorate([
    Component({
        selector: 'lib-figure-labeling-summary',
        template: "<ng-container *ngIf=\"question.itemType == 17\">\n  <div class=\"wk-row\">\n    <div class=\"wkqp-col-12\">\n      <div class=\"wkqp-layout-item mb20 summary4-mb0\">\n        <div class=\"wkqp-field-item summary5-mb0\">\n          <div\n            class=\"wk-row gray-bg-result fig-lab-que-wrapper mb20\"\n            id=\"svg-container\"\n          >\n            <span class=\"wkqb-question-number seq-left\">\n              <strong>{{ question.sequence }}</strong>\n            </span>\n            <div\n              class=\"wk-col-4 responsive-timespent time-qu-pt-remove pull-right time-qu-prmr0\"\n            >\n              <span\n                class=\"que-mob-left\"\n                [ngClass]=\"getQuestionProgressClass(question)\"\n              >\n              </span>\n              <span\n                class=\"wkqp-badge time-mob-right \"\n                [ngClass]=\"getOvertimelimitClass(question)\"\n              >\n                Time spent -\n                {{ convertedTime }}\n              </span>\n            </div>\n            <div class=\"wkqp-fullwidth\">\n              <figure-label\n                *ngIf=\"question.assets[0].assetName\"\n                [correctOptions]=\"\n                  question.graphicInteraction.figureLabelChoices\n                \"\n                [userAnswer]=\"userAnswerView\"\n                [assetData]=\"question.assets\"\n              ></figure-label>\n            </div>\n          </div>\n          <br *ngIf=\"!question.userResponse[0]\" />\n\n          <div\n            class=\"common-full-width\"\n            *ngIf=\"\n              question.userResponse &&\n              question.userResponse.length > 0 &&\n              question.userResponse[0] !== null\n            \"\n          >\n            <!--Your Response-->\n            <p\n              class=\"wkqp-prewrap mb20\"\n              [ngClass]=\"getSelectedResponseClass(question)\"\n            >\n              <strong>Your Response: </strong>\n            </p>\n            <table class=\"wk-table assets-permit-mt25mb0 mb20\">\n              <tbody>\n                <tr\n                  *ngFor=\"\n                    let labelDetails of userAnswerViewDetails;\n                    let i = index\n                  \"\n                >\n                  <td width=\"10%\">\n                    <span class=\"wk-prewrap\">{{ i + 1 }}</span>\n                  </td>\n                  <td width=\"80%\">\n                    {{ labelDetails.label }}\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n            <!--Correct Response-->\n            <div class=\"mb20\" *ngIf=\"question.isCorrect != 1\">\n              <p class=\"wkqp-alert-success wkqp-prewrap wkqp-success mb20\">\n                <strong>Correct Response: </strong>\n              </p>\n              <img\n                [src]=\"loadImagePath('image', question.assets[1])\"\n                class=\"img-responsive\"\n                alt=\"Image\"\n                width=\"300px\"\n              />\n            </div>\n          </div>\n          <div *ngIf=\"!question.userResponse[0]\">\n            <p class=\"wkqp-alert-danger\">\n              <strong>You did not answer this question</strong>\n            </p>\n          </div>\n          <div class=\"common-full-width mb20\">\n            <!--Rationale-->\n            <lib-rationale [itemData]=\"question.modelFeedback\"></lib-rationale>\n            <!-- remediation -->\n            <lib-remediation\n              [itemData]=\"question.remediationLinks\"\n            ></lib-remediation>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n</ng-container>\n",
        changeDetection: ChangeDetectionStrategy.OnPush,
        styles: [".wk-col-4.responsive-timespent.time-qu-pt-remove.pull-right.time-qu-prmr0{margin-right:0;padding-right:0}"]
    })
], FigureLabelingSummaryComponent);
export { FigureLabelingSummaryComponent };
//# sourceMappingURL=data:application/json;base64, 