(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[58],{

/***/ "../ozone/lib/listing/model/ListingLinkModel.js":
/*!******************************************************!*\
  !*** ../ozone/lib/listing/model/ListingLinkModel.js ***!
  \******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var mobx_1 = __webpack_require__(/*! mobx */ "../../node_modules/mobx/lib/mobx.module.js");
var StringUtils_1 = __webpack_require__(/*! @twii/core/lib/StringUtils */ "../core/lib/StringUtils.js");
var ListingLinkModel = /** @class */ (function () {
    function ListingLinkModel(listing, data) {
        this.validationErrors = [];
        this._listing = listing;
        if (data) {
            this.setData(data);
        }
    }
    Object.defineProperty(ListingLinkModel.prototype, "valid", {
        get: function () {
            return this.validationErrors.length === 0;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ListingLinkModel.prototype, "listing", {
        get: function () {
            return this._listing;
        },
        enumerable: true,
        configurable: true
    });
    ListingLinkModel.prototype.validate = function () {
        this.validationErrors = [];
        if (StringUtils_1.isBlank(this.name)) {
            this.validationErrors.push({ prop: "name", propTitle: "Name", message: "Name is required" });
        }
        if (StringUtils_1.isBlank(this.url)) {
            this.validationErrors.push({ prop: "url", propTitle: "URL", message: "URL is required" });
        }
    };
    ListingLinkModel.prototype.setName = function (name) {
        this.name = name;
    };
    ListingLinkModel.prototype.setUrl = function (url) {
        this.url = url;
    };
    ListingLinkModel.prototype.removeFromListing = function () {
        this.listing.removeLink(this);
    };
    Object.defineProperty(ListingLinkModel.prototype, "data", {
        get: function () {
            return { name: this.name, url: this.url };
        },
        set: function (value) {
            this.setData(value);
        },
        enumerable: true,
        configurable: true
    });
    ListingLinkModel.prototype.setData = function (data) {
        this.setName(data ? data.name : undefined);
        this.setUrl(data ? data.url : undefined);
    };
    __decorate([
        mobx_1.observable
    ], ListingLinkModel.prototype, "_listing", void 0);
    __decorate([
        mobx_1.observable
    ], ListingLinkModel.prototype, "validationErrors", void 0);
    __decorate([
        mobx_1.observable
    ], ListingLinkModel.prototype, "name", void 0);
    __decorate([
        mobx_1.observable
    ], ListingLinkModel.prototype, "url", void 0);
    __decorate([
        mobx_1.computed
    ], ListingLinkModel.prototype, "valid", null);
    __decorate([
        mobx_1.computed
    ], ListingLinkModel.prototype, "listing", null);
    __decorate([
        mobx_1.action
    ], ListingLinkModel.prototype, "validate", null);
    __decorate([
        mobx_1.action
    ], ListingLinkModel.prototype, "setName", null);
    __decorate([
        mobx_1.action
    ], ListingLinkModel.prototype, "setUrl", null);
    __decorate([
        mobx_1.action
    ], ListingLinkModel.prototype, "removeFromListing", null);
    __decorate([
        mobx_1.computed
    ], ListingLinkModel.prototype, "data", null);
    __decorate([
        mobx_1.action
    ], ListingLinkModel.prototype, "setData", null);
    return ListingLinkModel;
}());
exports.ListingLinkModel = ListingLinkModel;


/***/ }),

/***/ "../ozone/lib/listing/model/ListingModel.js":
/*!**************************************************!*\
  !*** ../ozone/lib/listing/model/ListingModel.js ***!
  \**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var mobx_1 = __webpack_require__(/*! mobx */ "../../node_modules/mobx/lib/mobx.module.js");
var ListingServiceContext_1 = __webpack_require__(/*! ../service/ListingServiceContext */ "../ozone/lib/listing/service/ListingServiceContext.js");
var Sync_1 = __webpack_require__(/*! @twii/core/lib/model/Sync */ "../core/lib/model/Sync.js");
var ListingApprovalStatus_1 = __webpack_require__(/*! ../ListingApprovalStatus */ "../ozone/lib/listing/ListingApprovalStatus.js");
var ImageServiceContext_1 = __webpack_require__(/*! ../../media/service/ImageServiceContext */ "../ozone/lib/media/service/ImageServiceContext.js");
var StringUtils_1 = __webpack_require__(/*! @twii/core/lib/StringUtils */ "../core/lib/StringUtils.js");
var ListingLinkModel_1 = __webpack_require__(/*! ./ListingLinkModel */ "../ozone/lib/listing/model/ListingLinkModel.js");
var StateManager_1 = __webpack_require__(/*! @twii/core/lib/model/StateManager */ "../core/lib/model/StateManager.js");
var ListingModel = /** @class */ (function (_super) {
    __extends(ListingModel, _super);
    function ListingModel(data) {
        var _this = _super.call(this) || this;
        _this.validationErrors = [];
        _this.saveSync = new Sync_1.Sync();
        _this.is_enabled = true;
        _this.is_featured = false;
        _this.is_private = false;
        _this.owners = [];
        _this.version_name = "1";
        _this.approval_status = ListingApprovalStatus_1.ListingApprovalStatus.IN_PROGRESS;
        _this.requirements = "None";
        _this.what_is_new = "Nothing";
        _this.screenshots = [];
        _this.is_bookmarked = false;
        _this.is_deleted = false;
        _this.doc_urls = [];
        _this._onSaveDone = function (data) {
            _this.setData(data);
            _this.saveSync.syncEnd();
        };
        _this._onSyncError = function (error) {
            _this.saveSync.syncError(error);
        };
        _this._onDeleteDone = function () {
            return _this.listingService.getListing({ listingId: _this.id }).then(_this._onSaveDone);
        };
        if (data) {
            _this.setData(data);
        }
        return _this;
    }
    Object.defineProperty(ListingModel.prototype, "listingService", {
        get: function () {
            return this._listingService || ListingServiceContext_1.ListingServiceContext.value;
        },
        set: function (value) {
            this._listingService = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ListingModel.prototype, "valid", {
        get: function () {
            return this.validationErrors.length === 0 &&
                this.doc_urls.every(function (doc) { return doc.valid; });
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ListingModel.prototype, "data", {
        get: function () {
            return {
                id: this.id,
                title: this.title,
                description: this.description,
                description_short: this.description_short,
                is_enabled: this.is_enabled,
                is_featured: this.is_featured,
                is_private: this.is_private,
                launch_url: this.launch_url,
                security_marking: this.security_marking,
                owners: this.owners ? this.owners.slice(0) : [],
                version_name: this.version_name,
                approval_status: this.approval_status,
                small_icon: this.small_icon || null,
                large_icon: this.large_icon || null,
                banner_icon: this.banner_icon || null,
                large_banner_icon: this.large_banner_icon || null,
                requirements: this.requirements,
                what_is_new: this.what_is_new,
                screenshots: this.screenshots ? this.screenshots.slice(0) : [],
                is_bookmarked: this.is_bookmarked,
                is_deleted: this.is_deleted,
                avg_rate: this.avg_rate,
                total_votes: this.total_votes,
                total_rate5: this.total_rate5,
                total_rate4: this.total_rate4,
                total_rate3: this.total_rate3,
                total_rate2: this.total_rate2,
                total_rate1: this.total_rate1,
                total_reviews: this.total_reviews,
                total_review_responses: this.total_review_responses,
                feedback_score: this.feedback_score,
                doc_urls: this.doc_urls.map(function (i) { return i.data; })
            };
        },
        set: function (value) {
            this.setData(value);
        },
        enumerable: true,
        configurable: true
    });
    ListingModel.prototype.setData = function (data) {
        var _this = this;
        this._lastData = data;
        this.id = data ? data.id : undefined;
        this.title = data ? data.title : undefined;
        this.description = data ? data.description : undefined;
        this.description_short = data ? data.description_short : undefined;
        this.is_enabled = data ? data.is_enabled : true;
        this.is_featured = data ? data.is_featured : false;
        this.is_private = data ? data.is_private : false;
        this.launch_url = data ? data.launch_url : undefined;
        this.security_marking = data ? data.security_marking : undefined;
        this.owners = data && data.owners ? data.owners.slice(0) : [];
        this.version_name = data ? data.version_name : undefined;
        this.approval_status = data ? data.approval_status : undefined;
        this.small_icon = data ? data.small_icon : undefined;
        this.large_icon = data ? data.large_icon : undefined;
        this.banner_icon = data ? data.banner_icon : undefined;
        this.large_banner_icon = data ? data.large_banner_icon : undefined;
        this.requirements = data ? data.requirements : "None";
        this.what_is_new = data ? data.what_is_new : "Nothing";
        this.screenshots = data && data.screenshots ? data.screenshots.slice(0) : [],
            this.is_bookmarked = data ? data.is_bookmarked : undefined;
        this.is_deleted = data ? data.is_deleted : undefined;
        this.avg_rate = data ? data.avg_rate : undefined;
        this.total_votes = data ? data.total_votes : undefined;
        this.total_rate5 = data ? data.total_rate5 : undefined;
        this.total_rate4 = data ? data.total_rate4 : undefined;
        this.total_rate3 = data ? data.total_rate3 : undefined;
        this.total_rate2 = data ? data.total_rate2 : undefined;
        this.total_rate1 = data ? data.total_rate1 : undefined;
        this.total_reviews = data ? data.total_reviews : undefined;
        this.total_review_responses = data ? data.total_review_responses : undefined;
        this.feedback_score = data ? data.feedback_score : undefined;
        this.doc_urls = data && data.doc_urls ? data.doc_urls.map(function (i) { return new ListingLinkModel_1.ListingLinkModel(_this, i); }) : [];
    };
    ListingModel.prototype.reset = function () {
        this.setData(this._lastData);
    };
    ListingModel.prototype.setTitle = function (title) {
        this.title = title;
    };
    ListingModel.prototype.setDescription = function (description) {
        this.description = description;
    };
    ListingModel.prototype.setShortDescription = function (shortDescription) {
        this.description_short = shortDescription;
    };
    ListingModel.prototype.setEnabled = function (enabled) {
        this.is_enabled = enabled;
    };
    ListingModel.prototype.setFeatured = function (featured) {
        this.is_featured = featured;
    };
    ListingModel.prototype.setPrivate = function (prv) {
        this.is_private = prv;
    };
    ListingModel.prototype.setLaunchUrl = function (launchUrl) {
        this.launch_url = launchUrl;
    };
    ListingModel.prototype.setSecurityMarking = function (securityMarking) {
        this.security_marking = securityMarking;
    };
    ListingModel.prototype.setVersion = function (version) {
        this.version_name = version;
    };
    ListingModel.prototype.setApprovalStatus = function (approvalStatus) {
        this.approval_status = approvalStatus;
    };
    ListingModel.prototype.setSmallIcon = function (smallIcon) {
        this.small_icon = smallIcon;
    };
    ListingModel.prototype.setLargeIcon = function (largeIcon) {
        this.large_icon = largeIcon;
    };
    ListingModel.prototype.setBannerIcon = function (bannerIcon) {
        this.banner_icon = bannerIcon;
    };
    ListingModel.prototype.setLargeBannerIcon = function (largeBannerIcon) {
        this.large_banner_icon = largeBannerIcon;
    };
    ListingModel.prototype._saveImage = function (image, imageType) {
        var imageForSave = Object.assign({ image_type: imageType, security_marking: "UNCLASSIFIED" }, image);
        return ImageServiceContext_1.ImageServiceContext.value.saveImage(imageForSave).then(function (saved) {
            var r = Object.assign({}, saved, imageForSave, { url: ImageServiceContext_1.ImageServiceContext.value.getImageUrl({ id: saved.id }) });
            delete r.file;
            return r;
        });
    };
    ListingModel.prototype._saveSmallIcon = function () {
        var _this = this;
        return this.small_icon && this.small_icon.file ? this._saveImage(this.small_icon, "small_icon").then(function (image) {
            _this.setSmallIcon(image);
        }) : Promise.resolve();
    };
    ListingModel.prototype._saveLargeIcon = function () {
        var _this = this;
        return this.large_icon && this.large_icon.file ? this._saveImage(this.large_icon, "large_icon").then(function (image) {
            _this.setLargeIcon(image);
        }) : Promise.resolve();
    };
    ListingModel.prototype._saveBannerIcon = function () {
        var _this = this;
        return this.banner_icon && this.banner_icon.file ? this._saveImage(this.banner_icon, "banner_icon").then(function (image) {
            _this.setBannerIcon(image);
        }) : Promise.resolve();
    };
    ListingModel.prototype._saveLargeBannerIcon = function () {
        var _this = this;
        return this.large_banner_icon && this.large_banner_icon.file ? this._saveImage(this.large_banner_icon, "large_banner_icon").then(function (image) {
            _this.setLargeBannerIcon(image);
        }) : Promise.resolve();
    };
    ListingModel.prototype._saveImages = function () {
        return Promise.all([
            this._saveSmallIcon(),
            this._saveLargeIcon(),
            this._saveBannerIcon(),
            this._saveLargeBannerIcon()
        ]).catch(function (error) {
            return Promise.reject({ message: "Unable to save images - " + error.message, cause: error });
        });
    };
    ListingModel.prototype.approve = function () {
        return this._saveInternal("approve", ListingApprovalStatus_1.ListingApprovalStatus.APPROVED);
    };
    ListingModel.prototype.reject = function () {
        return this._saveInternal("reject", ListingApprovalStatus_1.ListingApprovalStatus.REJECTED);
    };
    ListingModel.prototype.submitForApproval = function () {
        return this._saveInternal("submit", ListingApprovalStatus_1.ListingApprovalStatus.PENDING);
    };
    ListingModel.prototype.delete = function () {
        this.saveSync.syncStart({ type: "delete" });
        return this.listingService.deleteListing({ id: this.id }).then(this._onDeleteDone).catch(this._onSyncError);
    };
    ListingModel.prototype.validate = function (approvalStatus) {
        this.validationErrors = [];
        // NOTE that validation errors have to be moved to a core object with codes to access
        // a title is always required
        if (StringUtils_1.isBlank(this.title)) {
            this.validationErrors.push({ prop: "title", propTitle: "Title", message: "Title is required" });
        }
        if (StringUtils_1.isBlank(this.security_marking)) {
            this.validationErrors.push({ prop: "security_marking", propTitle: "Security", message: "Security is required" });
        }
        if (this.id) {
            // launch url required any time trying to save after creation
            if (StringUtils_1.isBlank(this.launch_url)) {
                this.validationErrors.push({ prop: "launch_url", propTitle: "Launch URL", message: "Launch URL is required" });
            }
        }
        // any other state after in progress requires a short description, description and launch url
        if (approvalStatus !== ListingApprovalStatus_1.ListingApprovalStatus.IN_PROGRESS) {
            if (StringUtils_1.isBlank(this.description_short)) {
                this.validationErrors.push({ prop: "description_short", propTitle: "Short Description", message: "Short Description is required" });
            }
            if (StringUtils_1.isBlank(this.description)) {
                this.validationErrors.push({ prop: "description", propTitle: "Description", message: "Description is required" });
            }
        }
        // validate each doc url
        if (this.doc_urls) {
            this.doc_urls.forEach(function (doc) { return doc.validate(); });
        }
    };
    ListingModel.prototype._saveInternal = function (type, approvalStatus) {
        var _this = this;
        this.validate(approvalStatus);
        if (!this.valid) {
            return Promise.reject({ code: "VALIDATION_ERROR", errors: this.validationErrors.slice(0) });
        }
        this.saveSync.syncStart({ type: type });
        return this._saveImages().then(function () {
            var request = Object.assign({}, _this.data, { approval_status: approvalStatus });
            return _this.listingService.saveListing(request);
        }).then(this._onSaveDone).catch(function (err) {
            _this._onSyncError(err);
            return Promise.reject(err);
        });
    };
    ListingModel.prototype.save = function () {
        return this._saveInternal("save", this.approval_status);
    };
    ListingModel.prototype.addLink = function () {
        this.doc_urls.push(new ListingLinkModel_1.ListingLinkModel(this));
    };
    ListingModel.prototype.removeLink = function (doc) {
        var idx = this.doc_urls.indexOf(doc);
        if (idx >= 0) {
            this.doc_urls.splice(idx, 1);
        }
    };
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "validationErrors", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "saveSync", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "id", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "title", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "description", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "description_short", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "is_enabled", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "is_featured", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "is_private", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "launch_url", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "security_marking", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "owners", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "version_name", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "approval_status", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "small_icon", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "large_icon", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "banner_icon", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "large_banner_icon", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "requirements", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "what_is_new", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "screenshots", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "is_bookmarked", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "is_deleted", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "avg_rate", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_votes", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_rate5", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_rate4", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_rate3", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_rate2", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_rate1", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_reviews", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "total_review_responses", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "feedback_score", void 0);
    __decorate([
        mobx_1.observable
    ], ListingModel.prototype, "doc_urls", void 0);
    __decorate([
        mobx_1.computed
    ], ListingModel.prototype, "valid", null);
    __decorate([
        mobx_1.computed
    ], ListingModel.prototype, "data", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setData", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "reset", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setTitle", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setDescription", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setShortDescription", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setEnabled", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setFeatured", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setPrivate", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setLaunchUrl", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setSecurityMarking", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setVersion", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setApprovalStatus", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setSmallIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setLargeIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setBannerIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "setLargeBannerIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_onSaveDone", void 0);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_onSyncError", void 0);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_saveSmallIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_saveLargeIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_saveBannerIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_saveLargeBannerIcon", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_saveImages", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "approve", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "reject", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "submitForApproval", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "delete", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "validate", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "_saveInternal", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "save", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "addLink", null);
    __decorate([
        mobx_1.action
    ], ListingModel.prototype, "removeLink", null);
    return ListingModel;
}(StateManager_1.StateManager));
exports.default = ListingModel;
exports.ListingModel = ListingModel;


/***/ }),

/***/ "../ozone/lib/listing/model/ListingModelSupplier.js":
/*!**********************************************************!*\
  !*** ../ozone/lib/listing/model/ListingModelSupplier.js ***!
  \**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ListingModel_1 = __webpack_require__(/*! ./ListingModel */ "../ozone/lib/listing/model/ListingModel.js");
var SyncSupplier_1 = __webpack_require__(/*! @twii/core/lib/model/SyncSupplier */ "../core/lib/model/SyncSupplier.js");
var ListingServiceContext_1 = __webpack_require__(/*! ../service/ListingServiceContext */ "../ozone/lib/listing/service/ListingServiceContext.js");
var ListingModelSupplier = /** @class */ (function (_super) {
    __extends(ListingModelSupplier, _super);
    function ListingModelSupplier(listingId) {
        var _this = _super.call(this) || this;
        _this._listingId = listingId;
        return _this;
    }
    Object.defineProperty(ListingModelSupplier.prototype, "listingId", {
        get: function () {
            return this._listingId;
        },
        enumerable: true,
        configurable: true
    });
    ListingModelSupplier.prototype._loadImpl = function () {
        return ListingServiceContext_1.ListingServiceContext.value.getListing({ listingId: this._listingId }).then(function (data) {
            return new ListingModel_1.ListingModel(data);
        });
    };
    return ListingModelSupplier;
}(SyncSupplier_1.SyncSupplier));
exports.ListingModelSupplier = ListingModelSupplier;


/***/ }),

/***/ "../ozone/lib/media/service/ImageServiceContext.js":
/*!*********************************************************!*\
  !*** ../ozone/lib/media/service/ImageServiceContext.js ***!
  \*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var Context_1 = __webpack_require__(/*! @twii/core/lib/Context */ "../core/lib/Context.js");
var RestImageService_1 = __webpack_require__(/*! ./RestImageService */ "../ozone/lib/media/service/RestImageService.js");
var ImageServiceContext = new Context_1.Context({
    factory: function () {
        return new RestImageService_1.RestImageService();
    }
});
exports.ImageServiceContext = ImageServiceContext;


/***/ }),

/***/ "../ozone/lib/media/service/RestImageService.js":
/*!******************************************************!*\
  !*** ../ozone/lib/media/service/RestImageService.js ***!
  \******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var axios_1 = __webpack_require__(/*! axios */ "../../node_modules/axios/index.js");
var PathUtils_1 = __webpack_require__(/*! @twii/core/lib/PathUtils */ "../core/lib/PathUtils.js");
var Defaults = {
    baseUrl: "/api",
    auth: undefined
};
var RestImageService = /** @class */ (function () {
    function RestImageService() {
    }
    Object.defineProperty(RestImageService.prototype, "baseUrl", {
        get: function () {
            return this._baseUrl || Defaults.baseUrl;
        },
        set: function (value) {
            this._baseUrl = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RestImageService.prototype, "auth", {
        // NOTE: this would probably only ever be for server side usage
        get: function () {
            return this._authConfig || Defaults.auth;
        },
        set: function (value) {
            this._authConfig = value;
        },
        enumerable: true,
        configurable: true
    });
    RestImageService.prototype.getImageUrl = function (request) {
        return this.baseUrl + "/image/" + request.id + "/";
    };
    RestImageService.prototype.getImages = function (request) {
        return axios_1.default.get(this.baseUrl + "/image/", { params: request, auth: this.auth }).then(function (value) {
            return value.data;
        });
    };
    RestImageService.prototype.saveImage = function (request) {
        var imageFormData = new FormData();
        imageFormData.append("image", request.file);
        if (request.security_marking) {
            imageFormData.append("security_marking", request.security_marking);
        }
        if (request.image_type) {
            imageFormData.append("image_type", request.image_type);
        }
        imageFormData.append("file_extension", PathUtils_1.extname(request.file.name, true).toLowerCase());
        var imagePromise = request.id ?
            axios_1.default.patch(this.baseUrl + "/image/" + request.id + "/", imageFormData, { auth: this.auth }) :
            axios_1.default.post(this.baseUrl + "/image/", imageFormData, { auth: this.auth });
        return imagePromise.then(function (value) {
            return value.data;
        });
    };
    RestImageService.prototype.deleteImage = function (request) {
        return axios_1.default.delete(this.baseUrl + "/image/" + request.id + "/", { auth: this.auth });
    };
    return RestImageService;
}());
exports.RestImageService = RestImageService;


/***/ })

}]);
//# sourceMappingURL=58.js.map