var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        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 extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "../../core/AtomBinder", "../styles/AtomStyle", "./AtomControl"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var AtomBinder_1 = require("../../core/AtomBinder");
    var AtomStyle_1 = require("../styles/AtomStyle");
    var AtomControl_1 = require("./AtomControl");
    var AtomContentControl = /** @class */ (function (_super) {
        __extends(AtomContentControl, _super);
        function AtomContentControl() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        Object.defineProperty(AtomContentControl.prototype, "content", {
            get: function () {
                return this.mContent;
            },
            set: function (c) {
                var old = this.mContent;
                if (old) {
                    old.element.remove();
                }
                this.mContent = c;
                if (c) {
                    this.element.appendChild(c.element);
                    var style = c.element.style;
                    c.invalidate();
                }
                AtomBinder_1.AtomBinder.refreshValue(this, "content");
            },
            enumerable: true,
            configurable: true
        });
        AtomContentControl.prototype.preCreate = function () {
            var _this = this;
            _super.prototype.preCreate.call(this);
            this.defaultControlStyle = AtomContentStyle;
            this.runAfterInit(function () {
                _this.element.classList.add(_this.controlStyle.root.className);
            });
        };
        return AtomContentControl;
    }(AtomControl_1.AtomControl));
    exports.AtomContentControl = AtomContentControl;
    var AtomContentStyle = /** @class */ (function (_super) {
        __extends(AtomContentStyle, _super);
        function AtomContentStyle() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        Object.defineProperty(AtomContentStyle.prototype, "root", {
            get: function () {
                return {
                    subclasses: {
                        " > *": {
                            position: "absolute",
                            top: "0",
                            left: "0",
                            right: "0",
                            bottom: "0",
                        }
                    }
                };
            },
            enumerable: true,
            configurable: true
        });
        return AtomContentStyle;
    }(AtomStyle_1.AtomStyle));
    exports.AtomContentStyle = AtomContentStyle;
});
//# sourceMappingURL=AtomContentControl.js.map