"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var sp_extension_base_1 = require("@microsoft/sp-extension-base");
var PlaceholderProvider_1 = tslib_1.__importDefault(require("./placeholder/PlaceholderProvider"));
var ApplicationAccessor_1 = tslib_1.__importDefault(require("./ApplicationAccessor"));
/**
 * The component context for {@link BaseApplicationCustomizer}.
 *
 * @public
 */
var ApplicationCustomizerContext = /** @class */ (function (_super) {
    tslib_1.__extends(ApplicationCustomizerContext, _super);
    /**
     * @internal
     */
    function ApplicationCustomizerContext(extensionContextParameters, applicationCustomizerContextParameters) {
        var _this = _super.call(this, extensionContextParameters) || this;
        _this.serviceScope.finish();
        _this._componentTag =
            "Extension." +
                (extensionContextParameters.manifest.alias + ".") +
                (extensionContextParameters.manifest.id + ".") +
                ((extensionContextParameters.manifest.isInternal ? 'internal' : 'external') + ".") +
                ("" + extensionContextParameters.instanceId);
        _this._placeholderProvider = new PlaceholderProvider_1.default(_this.serviceScope, applicationCustomizerContextParameters, _this._componentTag);
        _this._applicationAccessor = new ApplicationAccessor_1.default(_this.serviceScope);
        return _this;
    }
    Object.defineProperty(ApplicationCustomizerContext.prototype, "placeholderProvider", {
        /**
         * Exposes a collection of content placeholders for use by third parties.
         */
        get: function () {
            return this._placeholderProvider;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ApplicationCustomizerContext.prototype, "application", {
        /**
         * Provides access to the client-side application that is currently running.
         */
        get: function () {
            return this._applicationAccessor;
        },
        enumerable: false,
        configurable: true
    });
    /**
     * @override
     */
    ApplicationCustomizerContext.prototype.dispose = function () {
        if (!this.isDisposed) {
            this._placeholderProvider.dispose();
            delete this._placeholderProvider;
            delete this._applicationAccessor;
        }
        _super.prototype.dispose.call(this);
    };
    return ApplicationCustomizerContext;
}(sp_extension_base_1.ExtensionContext));
exports.default = ApplicationCustomizerContext;
//# sourceMappingURL=ApplicationCustomizerContext.js.map