text: import { DisplayMode, Validate } from '@microsoft/sp-core-library';
  import ClientSideWebPartManagerFactory from '../../core/ClientSideWebPartManagerFactory';
  var MinimalWebPartContainer =  (function () {
      function MinimalWebPartContainer(props) {
          this._validateProps(props);
          this._props = props;
          this._webPartManager = ClientSideWebPartManagerFactory.create(this._props.host);
      }
      Object.defineProperty(MinimalWebPartContainer.prototype, "webPartManager", {
          get: function () {
              return this._webPartManager;
          },
          enumerable: true,
          configurable: true
      });
      MinimalWebPartContainer.prototype.render = function (domElement) {
          var _this = this;
          Validate.isNotNullOrUndefined(domElement, 'domElement');
          this._domElement = domElement;
          if (this._props.openPropertyPane) {
              this._domElement.style.display = 'none';
          }
          else {
              this._domElement.style.display = 'block';
          }
          return this._renderWebPart(this._domElement).then(function () {
              if (_this._props.openPropertyPane) {
                  _this._webPartManager.requestPropertyPaneAction(_this._props.webPartInstanceId, 1 );
              }
              else { 
                  if (_this._props.requestDisplayModeStatus) {
                      _this._props.requestDisplayModeStatus();
                  }
                  if (_this._props.sendDimensionsToParent) {
                      window.setInterval(_this._sendDimensionsCallback.bind(_this), 200);
                  }
              }
          });
      };
      MinimalWebPartContainer.prototype.dispose = function () {
          this._webPartManager.disposeWebparts(this._props.webPartInstanceId);
          this._webPartManager.dispose();
      };
      MinimalWebPartContainer.prototype.setWebPartData = function (webPartData, instanceId) {
          this._webPartManager.setWebPartData(webPartData, instanceId);
      };
      MinimalWebPartContainer.prototype.serialize = function () {
          var serializedResult = this._webPartManager.serialize(this._props.webPartInstanceId);
          var webPartData = serializedResult.get(this._props.webPartInstanceId);
          Validate.isNotNullOrUndefined(webPartData, 'webPartData');
          return webPartData;
      };
      MinimalWebPartContainer.prototype.setDisplayMode = function (displayMode) {
          return this._webPartManager._setDisplayMode(displayMode, this._props.webPartInstanceId);
      };
      MinimalWebPartContainer.prototype.requestPropertyPaneAction = function (instanceId, propertyPaneAction, webPartData) {
          if (webPartData) {
              this._webPartManager.setWebPartData(webPartData, instanceId);
          }
          this._webPartManager.requestPropertyPaneAction(instanceId, propertyPaneAction);
      };
      MinimalWebPartContainer.prototype._getHeight = function () {
          Validate.isNotNullOrUndefined(this._domElement, 'domElement');
          var domElementChild = this._domElement.children.item(0);
          return domElementChild.offsetHeight;
      };
      MinimalWebPartContainer.prototype._getWidth = function () {
          Validate.isNotNullOrUndefined(this._domElement, 'domElement');
          var domElementChild = this._domElement.children.item(0);
          return domElementChild.offsetWidth;
      };
      MinimalWebPartContainer.prototype._sendDimensionsCallback = function () {
          this._props.sendDimensionsToParent(this._getHeight());
      };
      MinimalWebPartContainer.prototype._renderWebPart = function (domElement) {
          var _this = this;
          return this._webPartManager.loadWebPart({
              domElement: domElement,
              instanceId: this._props.webPartInstanceId,
              manifest: this._props.manifest,
              displayMode: this._props.displayMode || (this._props.openPropertyPane ? DisplayMode.Edit : DisplayMode.Read),
              webPartData: this._props.webPartData,
              addedFromPersistedData: true,
              totalWebparts: 1,
              formFactor: this._props.formFactor,
              webpartLoadExtraLogInfo: {
                  pageLayoutType: 'MinimalWebPartContainer',
                  columnType: '0',
                  displayMode: 'Read',
                  webPartContainer: 'MinimalWebPartContainer'
              }
          })
              .catch(function (error) {
              _this._webPartManager.renderError(domElement, error);
          });
      };
      MinimalWebPartContainer.prototype._validateProps = function (props) {
          Validate.isNotNullOrUndefined(props, 'props');
          Validate.isNotNullOrUndefined(props.webPartData, 'props.webPartData');
          Validate.isNotNullOrUndefined(props.webPartInstanceId, 'props.webPartInstanceId');
          Validate.isNotNullOrUndefined(props.manifest, 'props.manifest');
          Validate.isNotNullOrUndefined(props.serviceScope, 'props.applicationContext.serviceScope');
      };
      return MinimalWebPartContainer;
  }());
  export default MinimalWebPartContainer;
  