import { __decorate, __extends, __values } from "tslib";
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { SharedService } from '../../../../shared/service/shared.service';
import { SummaryBase } from '../summary-base';
var FillInTheBlanksSummaryComponent = /** @class */ (function (_super) {
    __extends(FillInTheBlanksSummaryComponent, _super);
    function FillInTheBlanksSummaryComponent(sharedService) {
        var _this = _super.call(this, sharedService) || this;
        _this.sharedService = sharedService;
        return _this;
    }
    FillInTheBlanksSummaryComponent.prototype.ngOnChanges = function (changes) {
        if (this.question) {
            this.getAnswers();
        }
    };
    FillInTheBlanksSummaryComponent.prototype.ngOnInit = function () {
        this.convertedTime = this.convertTime2(this.question.questionTimeSpent, 'time');
    };
    FillInTheBlanksSummaryComponent.prototype.getAnswers = function () {
        var e_1, _a;
        this.correctAnswer = '';
        this.selectedAnswer = '';
        if (this.question) {
            if (this.question.parentDetails &&
                this.question.parentDetails.assets[0]) {
                this.question.parentDetails.assetsPosition = this.question.parentDetails.assets[0].assetsPosition;
                this.question.assetsPosition = this.question.parentDetails.assets[0].assetsPosition;
            }
            try {
                for (var _b = __values(this.question.userResponse), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var answer = _c.value;
                    if (this.selectedAnswer) {
                        this.selectedAnswer = this.selectedAnswer + ',' + (answer ? answer : 'No Response');
                    }
                    else {
                        this.selectedAnswer = answer ? answer : 'No Response';
                    }
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_1) throw e_1.error; }
            }
            this.formattingAnswers();
        }
        return true;
    };
    FillInTheBlanksSummaryComponent.ctorParameters = function () { return [
        { type: SharedService }
    ]; };
    __decorate([
        Input('summaryData')
    ], FillInTheBlanksSummaryComponent.prototype, "question", void 0);
    FillInTheBlanksSummaryComponent = __decorate([
        Component({
            selector: 'lib-fill-in-the-blanks-summary',
            template: "<ng-container *ngIf=\"question.itemType == 3\">\n  <div class=\"wk-row\">\n    <media-carousel\n      [imagePath]=\"question.assets[0].assetPath\"\n      [assetData]=\"question.assets\"\n      [assetsPosition]=\"question.assetsPosition\"\n      *ngIf=\"\n        question &&\n        question.assets &&\n        question.assets.length != 0 &&\n        question.assets != undefined &&\n        question.assetsPosition != AssetPositionValuesEnum.withInText &&\n        question.assetsPosition != AssetPositionValuesEnum.bottom\n      \"\n    ></media-carousel>\n    <div\n      [ngClass]=\"{\n        'wk-col-8 asset-left-width66':\n          question &&\n          question.assets != undefined &&\n          question.assets.length != 0 &&\n          question.assetsPosition != AssetPositionValuesEnum.withInText,\n        'wk-col-12':\n          (question && question.assets == undefined) ||\n          (question && question.assets.length == 0) ||\n          (question &&\n            question.assetsPosition == AssetPositionValuesEnum.withInText),\n        'right-assets-position-question':\n          question &&\n          question.assets != undefined &&\n          question.assets.length != 0 &&\n          question.assetsPosition == AssetPositionValuesEnum.right,\n        'left-assets-position-question':\n          question &&\n          question.assets != undefined &&\n          question.assets.length != 0 &&\n          question.assetsPosition == AssetPositionValuesEnum.left,\n        'top-assets-position-question':\n          question &&\n          question.assets != undefined &&\n          question.assets.length != 0 &&\n          question.assetsPosition == AssetPositionValuesEnum.top,\n        'bottom-assets-position-question':\n          question &&\n          question.assets != undefined &&\n          question.assets.length != 0 &&\n          question.assetsPosition == AssetPositionValuesEnum.bottom\n      }\"\n    >\n      <div class=\"wkqp-layout-item mb20 summary4-mb0 \">\n        <div class=\"summary5-mb0 common-full-width \">\n          <div class=\"wk-row gray-bg-result mb20\">\n            <div class=\"wk-col-8 responsive-pl15\">\n              <!--Question sequence-->\n              <span class=\"wkqb-question-number\">\n                <strong>{{ question.sequence }}</strong>\n              </span>\n              <!--Question prompt text-->\n              <span\n                class=\"qp-ts-number-right\"\n                *ngIf=\"\n                  question.assetsPosition != AssetPositionValuesEnum.withInText\n                \"\n              >\n                <strong class=\"wkqp-prewrap\">\n                  {{ question.promptText }}\n                </strong>\n              </span>\n              <div class=\"common-full-width\">\n                <span\n                  *ngIf=\"\n                    question.assetsPosition ==\n                    AssetPositionValuesEnum.withInText\n                  \"\n                >\n                  <strong>\n                    <item-text-assets\n                      [promptText]=\"question.promptText\"\n                      [assetData]=\"question.assets\"\n                      [assetsPosition]=\"AssetPositionValuesEnum.withInText\"\n                    ></item-text-assets>\n                  </strong>\n                </span>\n              </div>\n            </div>\n            <media-carousel\n              [imagePath]=\"question.assets[0].assetPath\"\n              [assetData]=\"question.assets\"\n              [assetsPosition]=\"question.assetsPosition\"\n              *ngIf=\"\n                question &&\n                question.assets &&\n                question.assets.length != 0 &&\n                question.assets != undefined &&\n                question.assetsPosition != AssetPositionValuesEnum.withInText &&\n                question.assetsPosition == AssetPositionValuesEnum.bottom\n              \"\n            ></media-carousel>\n            <!--Question Time spent-->\n            <div class=\"wk-col-4 responsive-timespent time-qu-pt-remove\">\n              <span\n                class=\"que-mob-left mr10\"\n                [ngClass]=\"getQuestionProgressClass(question)\"\n              ></span>\n              <span\n                class=\"wkqp-badge time-mob-right\"\n                [ngClass]=\"getOvertimelimitClass(question)\"\n              >\n                Time Spent -\n                {{ convertedTime }}</span\n              >\n            </div>\n          </div>\n\n          <div\n            class=\"common-full-width\"\n            *ngIf=\"question.userResponse && question.userResponse.length > 0\"\n          >\n            <!--Your Response-->\n            <p\n              class=\"wkqp-prewrap mb20\"\n              [ngClass]=\"getSelectedResponseClass(question)\"\n            >\n              <strong>Your Response: </strong>\n              {{ selectedAnswer }}\n            </p>\n\n            <!--Correct Response-->\n            <div\n              class=\"wkqp-alert-success wkqp-prewrap wkqp-success correct-response-success-box badge-normal mb20\"\n              *ngIf=\"question.isCorrect != 1\"\n            >\n              <strong class=\"cr-pb10\">Correct Response: </strong>\n              <table\n                class=\"table table-bordered wkqp-table wkqp-table-permit-overflow correct-inline-text table table-bordered cr-table-mb5\"\n                *ngIf=\"!question.correct\"\n              >\n                <tbody>\n                  <tr\n                    *ngFor=\"\n                      let blanks of question.textEntryInteraction.inlineChoices;\n                      let blankNum = index\n                    \"\n                  >\n                    <td width=\"15%\" class=\"ans-response\">\n                      <strong>Blank-{{ blankNum + 1 }}</strong>\n                    </td>\n                    <td\n                      *ngIf=\"question.labelText == 'FILL_IN_THE_BLANK'\"\n                      width=\"85%\"\n                    >\n                      <span\n                        class=\"wkqp-badge\"\n                        *ngFor=\"let choice of blanks; let choiceNum = index\"\n                      >\n                        {{ choice }}\n                      </span>\n                    </td>\n                  </tr>\n                </tbody>\n              </table>\n            </div>\n          </div>\n\n          <!--Unattempted Response-->\n          <div class=\"common-full-width\" *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>\n      </div>\n    </div>\n    <div class=\"common-full-width mb20\">\n      <!--Rationale-->\n      <lib-rationale [itemData]=\"question.modelFeedback\"></lib-rationale>\n      <!-- remediation -->\n      <lib-remediation [itemData]=\"question.remediationLinks\"></lib-remediation>\n    </div>\n  </div>\n</ng-container>\n",
            changeDetection: ChangeDetectionStrategy.OnPush,
            styles: [".wkqp-alert-success.wkqp-prewrap.wkqp-success.correct-response-success-box .cr-pb10{padding-bottom:10px;display:inline-block}.wkqp-alert-success.wkqp-prewrap.wkqp-success.correct-response-success-box .cr-table-mb5{margin-bottom:5px}.badge-normal table tr td span.wkqp-badge{font-style:normal}.badge-normal table tr td.ans-response strong{color:#474747;font-size:.9375rem;font-style:normal}"]
        })
    ], FillInTheBlanksSummaryComponent);
    return FillInTheBlanksSummaryComponent;
}(SummaryBase));
export { FillInTheBlanksSummaryComponent };
//# sourceMappingURL=data:application/json;base64, 