text: /**
   * @license
   * Copyright Google Inc. All Rights Reserved.
   *
   * Use of this source code is governed by an MIT-style license that can be
   * found in the LICENSE file at https://angular.io/license
   */
  import { isPresent } from '../facade/lang';
  import { DebugElement, DebugNode, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex } from './debug_node';
  export var DebugDomRootRenderer = (function () {
      /**
       * @param {?} _delegate
       */
      function DebugDomRootRenderer(_delegate) {
          this._delegate = _delegate;
      }
      /**
       * @param {?} componentProto
       * @return {?}
       */
      DebugDomRootRenderer.prototype.renderComponent = function (componentProto) {
          return new DebugDomRenderer(this._delegate.renderComponent(componentProto));
      };
      return DebugDomRootRenderer;
  }());
  function DebugDomRootRenderer_tsickle_Closure_declarations() {
      /** @type {?} */
      DebugDomRootRenderer.prototype._delegate;
  }
  export var DebugDomRenderer = (function () {
      /**
       * @param {?} _delegate
       */
      function DebugDomRenderer(_delegate) {
          this._delegate = _delegate;
      }
      /**
       * @param {?} selectorOrNode
       * @param {?=} debugInfo
       * @return {?}
       */
      DebugDomRenderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) {
          var /** @type {?} */ nativeEl = this._delegate.selectRootElement(selectorOrNode, debugInfo);
          var /** @type {?} */ debugEl = new DebugElement(nativeEl, null, debugInfo);
          indexDebugNode(debugEl);
          return nativeEl;
      };
      /**
       * @param {?} parentElement
       * @param {?} name
       * @param {?=} debugInfo
       * @return {?}
       */
      DebugDomRenderer.prototype.createElement = function (parentElement, name, debugInfo) {
          var /** @type {?} */ nativeEl = this._delegate.createElement(parentElement, name, debugInfo);
          var /** @type {?} */ debugEl = new DebugElement(nativeEl, getDebugNode(parentElement), debugInfo);
          debugEl.name = name;
          indexDebugNode(debugEl);
          return nativeEl;
      };
      /**
       * @param {?} hostElement
       * @return {?}
       */
      DebugDomRenderer.prototype.createViewRoot = function (hostElement) { return this._delegate.createViewRoot(hostElement); };
      /**
       * @param {?} parentElement
       * @param {?=} debugInfo
       * @return {?}
       */
      DebugDomRenderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) {
          var /** @type {?} */ comment = this._delegate.createTemplateAnchor(parentElement, debugInfo);
          var /** @type {?} */ debugEl = new DebugNode(comment, getDebugNode(parentElement), debugInfo);
          indexDebugNode(debugEl);
          return comment;
      };
      /**
       * @param {?} parentElement
       * @param {?} value
       * @param {?=} debugInfo
       * @return {?}
       */
      DebugDomRenderer.prototype.createText = function (parentElement, value, debugInfo) {
          var /** @type {?} */ text = this._delegate.createText(parentElement, value, debugInfo);
          var /** @type {?} */ debugEl = new DebugNode(text, getDebugNode(parentElement), debugInfo);
          indexDebugNode(debugEl);
          return text;
      };
      /**
       * @param {?} parentElement
       * @param {?} nodes
       * @return {?}
       */
      DebugDomRenderer.prototype.projectNodes = function (parentElement, nodes) {
          var /** @type {?} */ debugParent = getDebugNode(parentElement);
          if (isPresent(debugParent) && debugParent instanceof DebugElement) {
              var /** @type {?} */ debugElement_1 = debugParent;
              nodes.forEach(function (node) { debugElement_1.addChild(getDebugNode(node)); });
          }
          this._delegate.projectNodes(parentElement, nodes);
      };
      /**
       * @param {?} node
       * @param {?} viewRootNodes
       * @return {?}
       */
      DebugDomRenderer.prototype.attachViewAfter = function (node, viewRootNodes) {
          var /** @type {?} */ debugNode = getDebugNode(node);
          if (isPresent(debugNode)) {
              var /** @type {?} */ debugParent = debugNode.parent;
              if (viewRootNodes.length > 0 && isPresent(debugParent)) {
                  var /** @type {?} */ debugViewRootNodes_1 = [];
                  viewRootNodes.forEach(function (rootNode) { return debugViewRootNodes_1.push(getDebugNode(rootNode)); });
                  debugParent.insertChildrenAfter(debugNode, debugViewRootNodes_1);
              }
          }
          this._delegate.attachViewAfter(node, viewRootNodes);
      };
      /**
       * @param {?} viewRootNodes
       * @return {?}
       */
      DebugDomRenderer.prototype.detachView = function (viewRootNodes) {
          viewRootNodes.forEach(function (node) {
              var /** @type {?} */ debugNode = getDebugNode(node);
              if (isPresent(debugNode) && isPresent(debugNode.parent)) {
                  debugNode.parent.removeChild(debugNode);
              }
          });
          this._delegate.detachView(viewRootNodes);
      };
      /**
       * @param {?} hostElement
       * @param {?} viewAllNodes
       * @return {?}
       */
      DebugDomRenderer.prototype.destroyView = function (hostElement, viewAllNodes) {
          viewAllNodes = viewAllNodes || [];
          viewAllNodes.forEach(function (node) { removeDebugNodeFromIndex(getDebugNode(node)); });
          this._delegate.destroyView(hostElement, viewAllNodes);
      };
      /**
       * @param {?} renderElement
       * @param {?} name
       * @param {?} callback
       * @return {?}
       */
      DebugDomRenderer.prototype.listen = function (renderElement, name, callback) {
          var /** @type {?} */ debugEl = getDebugNode(renderElement);
          if (isPresent(debugEl)) {
              debugEl.listeners.push(new EventListener(name, callback));
          }
          return this._delegate.listen(renderElement, name, callback);
      };
      /**
       * @param {?} target
       * @param {?} name
       * @param {?} callback
       * @return {?}
       */
      DebugDomRenderer.prototype.listenGlobal = function (target, name, callback) {
          return this._delegate.listenGlobal(target, name, callback);
      };
      /**
       * @param {?} renderElement
       * @param {?} propertyName
       * @param {?} propertyValue
       * @return {?}
       */
      DebugDomRenderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
          var /** @type {?} */ debugEl = getDebugNode(renderElement);
          if (isPresent(debugEl) && debugEl instanceof DebugElement) {
              debugEl.properties[propertyName] = propertyValue;
          }
          this._delegate.setElementProperty(renderElement, propertyName, propertyValue);
      };
      /**
       * @param {?} renderElement
       * @param {?} attributeName
       * @param {?} attributeValue
       * @return {?}
       */
      DebugDomRenderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) {
          var /** @type {?} */ debugEl = getDebugNode(renderElement);
          if (isPresent(debugEl) && debugEl instanceof DebugElement) {
              debugEl.attributes[attributeName] = attributeValue;
          }
          this._delegate.setElementAttribute(renderElement, attributeName, attributeValue);
      };
      /**
       * @param {?} renderElement
       * @param {?} propertyName
       * @param {?} propertyValue
       * @return {?}
       */
      DebugDomRenderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) {
          this._delegate.setBindingDebugInfo(renderElement, propertyName, propertyValue);
      };
      /**
       * @param {?} renderElement
       * @param {?} className
       * @param {?} isAdd
       * @return {?}
       */
      DebugDomRenderer.prototype.setElementClass = function (renderElement, className, isAdd) {
          var /** @type {?} */ debugEl = getDebugNode(renderElement);
          if (isPresent(debugEl) && debugEl instanceof DebugElement) {
              debugEl.classes[className] = isAdd;
          }
          this._delegate.setElementClass(renderElement, className, isAdd);
      };
      /**
       * @param {?} renderElement
       * @param {?} styleName
       * @param {?} styleValue
       * @return {?}
       */
      DebugDomRenderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
          var /** @type {?} */ debugEl = getDebugNode(renderElement);
          if (isPresent(debugEl) && debugEl instanceof DebugElement) {
              debugEl.styles[styleName] = styleValue;
          }
          this._delegate.setElementStyle(renderElement, styleName, styleValue);
      };
      /**
       * @param {?} renderElement
       * @param {?} methodName
       * @param {?=} args
       * @return {?}
       */
      DebugDomRenderer.prototype.invokeElementMethod = function (renderElement, methodName, args) {
          this._delegate.invokeElementMethod(renderElement, methodName, args);
      };
      /**
       * @param {?} renderNode
       * @param {?} text
       * @return {?}
       */
      DebugDomRenderer.prototype.setText = function (renderNode, text) { this._delegate.setText(renderNode, text); };
      /**
       * @param {?} element
       * @param {?} startingStyles
       * @param {?} keyframes
       * @param {?} duration
       * @param {?} delay
       * @param {?} easing
       * @param {?=} previousPlayers
       * @return {?}
       */
      DebugDomRenderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) {
          if (previousPlayers === void 0) { previousPlayers = []; }
          return this._delegate.animate(element, startingStyles, keyframes, duration, delay, easing, previousPlayers);
      };
      return DebugDomRenderer;
  }());
  function DebugDomRenderer_tsickle_Closure_declarations() {
      /** @type {?} */
      DebugDomRenderer.prototype._delegate;
  }
  //# sourceMappingURL=debug_renderer.js.map