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 DragAndDropSummaryComponent = /** @class */ (function (_super) {
    __extends(DragAndDropSummaryComponent, _super);
    function DragAndDropSummaryComponent(sharedService) {
        var _this = _super.call(this, sharedService) || this;
        _this.sharedService = sharedService;
        return _this;
    }
    DragAndDropSummaryComponent.prototype.ngOnChanges = function (changes) {
        if (this.question) {
            this.getAnswers();
        }
    };
    DragAndDropSummaryComponent.prototype.ngOnInit = function () {
        this.convertedTime = this.convertTime2(this.question.questionTimeSpent, 'time');
    };
    DragAndDropSummaryComponent.prototype.getAnswers = function () {
        var e_1, _a, e_2, _b;
        this.correctAnswer = '';
        this.selectedAnswer = '';
        this.question.correct = false;
        if (this.question) {
            // Create user response order
            if (this.question.userResponse !== undefined && this.question.userResponse !== null) {
                this.question.selectedAnswer = [];
                try {
                    for (var _c = __values(this.question.choiceInteraction.simpleChoices), _d = _c.next(); !_d.done; _d = _c.next()) {
                        var answer = _d.value;
                        var index = this.question.userResponse.indexOf(answer.choiceId);
                        this.question.selectedAnswer[index] = answer;
                    }
                }
                catch (e_1_1) { e_1 = { error: e_1_1 }; }
                finally {
                    try {
                        if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
                    }
                    finally { if (e_1) throw e_1.error; }
                }
                this.selectedAnswer = this.question.selectedAnswer;
            }
            // Create correct answer order
            this.correctAnswer = [];
            try {
                for (var _e = __values(this.question.choiceInteraction.simpleChoices), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var answer = _f.value;
                    var order = answer.order - 1;
                    // Create answer list in correct order
                    this.correctAnswer[order] = answer.label;
                }
            }
            catch (e_2_1) { e_2 = { error: e_2_1 }; }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
                }
                finally { if (e_2) throw e_2.error; }
            }
        }
        return true;
    };
    DragAndDropSummaryComponent.ctorParameters = function () { return [
        { type: SharedService }
    ]; };
    __decorate([
        Input('summaryData')
    ], DragAndDropSummaryComponent.prototype, "question", void 0);
    DragAndDropSummaryComponent = __decorate([
        Component({
            selector: 'lib-drag-and-drop-summary',
            template: "<ng-container *ngIf=\"question.itemType == 13\">\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 summary4-mb0 common-full-width mb20\">\n        <div class=\"wkqp-field-item summary5-mb0\">\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\">{{ question.promptText }}</strong>\n              </span>\n              <span\n                *ngIf=\"\n                  question.assetsPosition == AssetPositionValuesEnum.withInText\n                \"\n              >\n                <item-text-assets\n                  [promptText]=\"question.promptText\"\n                  [assetData]=\"question.assets\"\n                  [assetsPosition]=\"AssetPositionValuesEnum.withInText\"\n                ></item-text-assets>\n              </span>\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              >\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>\n\n          <div\n            class=\"common-full-width mb20\"\n            *ngIf=\"question.userResponse[0] && 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            </p>\n            <div class=\"common-full-width mb20\">\n              <div\n                *ngFor=\"\n                  let userResponseDetails of selectedAnswer;\n                  let i = index\n                \"\n              >\n                <span class=\"dragdrop-correctanslabel\">\n                  <span class=\"pr1rem\">{{ i + 1 }})</span>\n                  <span>{{ userResponseDetails.label }}</span>\n                </span>\n              </div>\n            </div>\n\n            <!--Correct Response-->\n            <div *ngIf=\"question.isCorrect != 1\">\n              <p class=\"wkqp-alert-success wkqp-prewrap wkqp-success  mb20\">\n                <strong>Correct Response: </strong>\n              </p>\n              <div\n                class=\"mb20\"\n                *ngFor=\"let choiceValue of correctAnswer; let i = index\"\n              >\n                <span class=\"dragdrop-correctanslabel\">\n                  <span class=\"pr1rem\">{{ i + 1 }})</span>\n                  <span>{{ choiceValue }}</span>\n                </span>\n              </div>\n            </div>\n          </div>\n\n          <!--Unattempted Response-->\n          <div class=\"common-full-width mb20\" *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: [""]
        })
    ], DragAndDropSummaryComponent);
    return DragAndDropSummaryComponent;
}(SummaryBase));
export { DragAndDropSummaryComponent };
//# sourceMappingURL=data:application/json;base64, 