function $AdfResizeTrackManager$$($element$$55$$) {
  this.Init($element$$55$$);
}
$goog$exportSymbol$$("AdfResizeTrackManager", $AdfResizeTrackManager$$);
$AdfObject$$.$createSubclass$($AdfResizeTrackManager$$);
$AdfResizeTrackManager$$.prototype.Init = function $$AdfResizeTrackManager$$$$Init$($element$$56$$) {
  $AdfResizeTrackManager$$.$superclass$.Init.call(this);
  this.$_listeners$ = [];
  this.$_element$ = $element$$56$$;
  this.$_RETRY_MAX_COUNT$ = 2;
  this.$_retrySetScroll$ = 0;
  this.$_onResizeTimeout$ = this.$_scrollListener$ = this.$_resizeListener$ = this.$_detectContraction$ = this.$_detectExpansion$ = this.$_oldHeight$ = this.$_oldWidth$ = this.$_invokeId$ = null;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfResizeTrackManager.prototype.Init", {Init:$AdfResizeTrackManager$$.prototype.Init});
$AdfResizeTrackManager$$.prototype.addListener = function $$AdfResizeTrackManager$$$$addListener$($listener$$54$$) {
  this.$_listeners$.push($listener$$54$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfResizeTrackManager.prototype.addListener", {addListener:$AdfResizeTrackManager$$.prototype.addListener});
$AdfResizeTrackManager$$.prototype.removeListener = function $$AdfResizeTrackManager$$$$removeListener$($listener$$55$$) {
  for (var $i$$22$$ = this.$_listeners$.length - 1;0 <= $i$$22$$;$i$$22$$--) {
    if (this.$_listeners$[$i$$22$$] === $listener$$55$$) {
      this.$_listeners$.splice($i$$22$$, 1);
      break;
    }
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfResizeTrackManager.prototype.removeListener", {removeListener:$AdfResizeTrackManager$$.prototype.removeListener});
$AdfResizeTrackManager$$.prototype.$isEmpty$ = function $$AdfResizeTrackManager$$$$$isEmpty$$() {
  return 0 == this.$_listeners$.length;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfResizeTrackManager.prototype.isEmpty", {$isEmpty$:$AdfResizeTrackManager$$.prototype.$isEmpty$});
$AdfResizeTrackManager$$.prototype.start = function $$AdfResizeTrackManager$$$$start$() {
  this.$_scrollListener$ = this.$createCallback$($AdfResizeTrackManager$$.$_handleScroll$);
  if (this.$_element$.attachEvent) {
    this.$_resizeListener$ = this.$createCallback$($AdfResizeTrackManager$$.$_handleResize$), this.$_element$.attachEvent("onresize", this.$_resizeListener$);
  } else {
    var $contractionChild_firstChild$$ = this.$_element$.childNodes[0];
    this.$_detectExpansion$ = document.createElement("div");
    $AdfDomUtils$$.$addInlineStyle$(this.$_detectExpansion$, "position:absolute; overflow:hidden; visibility:hidden; top:0; left:0; right:0; bottom:0; direction:ltr;");
    this.$_detectExpansion$.className = "AFDetectExpansion";
    this.$_detectExpansion$.appendChild(document.createElement("div"));
    null != $contractionChild_firstChild$$ ? this.$_element$.insertBefore(this.$_detectExpansion$, $contractionChild_firstChild$$) : this.$_element$.appendChild(this.$_detectExpansion$);
    this.$_detectExpansion$.addEventListener("scroll", this.$_scrollListener$, !1);
    this.$_detectContraction$ = document.createElement("div");
    this.$_detectContraction$.className = "AFDetectContraction";
    $AdfDomUtils$$.$addInlineStyle$(this.$_detectContraction$, "position:absolute; overflow:hidden; visibility:hidden; top:0; left:0; right:0; bottom:0; direction:ltr;");
    $contractionChild_firstChild$$ = document.createElement("div");
    $contractionChild_firstChild$$.style.width = "200%";
    $contractionChild_firstChild$$.style.height = "200%";
    this.$_detectContraction$.appendChild($contractionChild_firstChild$$);
    this.$_element$.insertBefore(this.$_detectContraction$, this.$_detectExpansion$);
    this.$_detectContraction$.addEventListener("scroll", this.$_scrollListener$, !1);
    this.$initializeElements$(!1);
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfResizeTrackManager.prototype.start", {start:$AdfResizeTrackManager$$.prototype.start});
$AdfResizeTrackManager$$.prototype.stop = function $$AdfResizeTrackManager$$$$stop$() {
  null != this.$_invokeId$ && ($AdfResizeTrackManager$$.$_cancelInvokeAfterPaint$(this.$_invokeId$), this.$_invokeId$ = null);
  null != this.$_detectExpansion$ ? (this.$_detectExpansion$.removeEventListener("scroll", this.$_scrollListener$, !1), this.$_detectContraction$.removeEventListener("scroll", this.$_scrollListener$, !1), this.$_element$.removeChild(this.$_detectExpansion$), this.$_element$.removeChild(this.$_detectContraction$)) : this.$_element$.detachEvent("onresize", this.$_resizeListener$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfResizeTrackManager.prototype.stop", {stop:$AdfResizeTrackManager$$.prototype.stop});
$AdfResizeTrackManager$$.prototype.$initializeElements$ = function $$AdfResizeTrackManager$$$$$initializeElements$$($isFixup$$) {
  var $adjusted$$ = $JSCompiler_StaticMethods__checkSize$$(this, $isFixup$$);
  $isFixup$$ && !$adjusted$$ && null != this.$_detectExpansion$.offsetParent && $JSCompiler_StaticMethods__adjust$$(this, this.$_oldWidth$, this.$_oldHeight$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfResizeTrackManager.prototype.initializeElements", {$initializeElements$:$AdfResizeTrackManager$$.prototype.$initializeElements$});
function $JSCompiler_StaticMethods__checkSize$$($JSCompiler_StaticMethods__checkSize$self$$, $fireEvent$$) {
  var $adjusted$$1$$ = !1;
  if (null != $JSCompiler_StaticMethods__checkSize$self$$.$_detectExpansion$.offsetParent) {
    var $newWidth$$ = $JSCompiler_StaticMethods__checkSize$self$$.$_detectExpansion$.offsetWidth, $newHeight$$1$$ = $JSCompiler_StaticMethods__checkSize$self$$.$_detectExpansion$.offsetHeight, $innerWindowHeight$$ = $AdfAgent$$.$AGENT$.$getDomWindow$().innerHeight;
    if ($JSCompiler_StaticMethods__checkSize$self$$.$_oldWidth$ !== $newWidth$$ || $JSCompiler_StaticMethods__checkSize$self$$.$_oldHeight$ !== $newHeight$$1$$ && $newHeight$$1$$ < $innerWindowHeight$$) {
      $JSCompiler_StaticMethods__checkSize$self$$.$_retrySetScroll$ = $JSCompiler_StaticMethods__checkSize$self$$.$_RETRY_MAX_COUNT$, $JSCompiler_StaticMethods__adjust$$($JSCompiler_StaticMethods__checkSize$self$$, $newWidth$$, $newHeight$$1$$), $adjusted$$1$$ = !0, $fireEvent$$ && $JSCompiler_StaticMethods__checkSize$self$$.$_notifyListeners$(!0);
    }
  }
  return $adjusted$$1$$;
}
$AdfResizeTrackManager$$.prototype.$_notifyListeners$ = function $$AdfResizeTrackManager$$$$$_notifyListeners$$($i$$23_useAfterPaint$$) {
  if (0 < this.$_listeners$.length) {
    if ($i$$23_useAfterPaint$$) {
      null !== this.$_invokeId$ && $AdfResizeTrackManager$$.$_cancelInvokeAfterPaint$(this.$_invokeId$);
      var $myself$$ = this;
      this.$_invokeId$ = $AdfResizeTrackManager$$.$_invokeAfterPaint$(function() {
        $myself$$.$_invokeId$ = null;
        for (var $i$$23_useAfterPaint$$ = 0;$i$$23_useAfterPaint$$ < $myself$$.$_listeners$.length;$i$$23_useAfterPaint$$++) {
          $myself$$.$_listeners$[$i$$23_useAfterPaint$$]();
        }
      });
    } else {
      for ($i$$23_useAfterPaint$$ = 0;$i$$23_useAfterPaint$$ < this.$_listeners$.length;$i$$23_useAfterPaint$$++) {
        this.$_listeners$[$i$$23_useAfterPaint$$]();
      }
    }
  }
};
$AdfResizeTrackManager$$.$_handleScroll$ = function $$AdfResizeTrackManager$$$$_handleScroll$$($evt$$30$$) {
  $evt$$30$$.stopPropagation();
  this.$_onResizeTimeout$ || (this.$_onResizeTimeout$ = $AdfPage$$.$PAGE$.$scheduleTimer$(this, $AdfResizeTrackManager$$.$_onResizeHandlerTimeout$, {}, 100));
};
$AdfResizeTrackManager$$.$_onResizeHandlerTimeout$ = function $$AdfResizeTrackManager$$$$_onResizeHandlerTimeout$$() {
  !$JSCompiler_StaticMethods__checkSize$$(this, !0) && 0 < this.$_retrySetScroll$ && null != this.$_detectExpansion$.offsetParent && (0 == this.$_detectExpansion$.scrollLeft || 0 == this.$_detectExpansion$.scrollTop) && (this.$_retrySetScroll$--, $JSCompiler_StaticMethods__adjust$$(this, this.$_oldWidth$, this.$_oldHeight$));
  this.$_onResizeTimeout$ = null;
};
$AdfResizeTrackManager$$.$_handleResize$ = function $$AdfResizeTrackManager$$$$_handleResize$$() {
  this.$_notifyListeners$(!1);
};
function $JSCompiler_StaticMethods__adjust$$($JSCompiler_StaticMethods__adjust$self$$, $width$$16$$, $height$$16$$) {
  $JSCompiler_StaticMethods__adjust$self$$.$_oldWidth$ = $width$$16$$;
  $JSCompiler_StaticMethods__adjust$self$$.$_oldHeight$ = $height$$16$$;
  var $expansionChildStyle$$ = $JSCompiler_StaticMethods__adjust$self$$.$_detectExpansion$.firstChild.style, $delta$$2$$ = 1;
  do {
    $expansionChildStyle$$.width = $width$$16$$ + $delta$$2$$ + "px", $expansionChildStyle$$.height = $height$$16$$ + $delta$$2$$ + "px", $JSCompiler_StaticMethods__adjust$self$$.$_detectExpansion$.scrollLeft = $JSCompiler_StaticMethods__adjust$self$$.$_detectExpansion$.scrollTop = $delta$$2$$, $delta$$2$$++;
  } while ((0 == $JSCompiler_StaticMethods__adjust$self$$.$_detectExpansion$.scrollTop || 0 == $JSCompiler_StaticMethods__adjust$self$$.$_detectExpansion$.scrollLeft) && 5 >= $delta$$2$$);
  $JSCompiler_StaticMethods__adjust$self$$.$_detectContraction$.scrollLeft = $width$$16$$;
  $JSCompiler_StaticMethods__adjust$self$$.$_detectContraction$.scrollTop = $height$$16$$;
}
$AdfResizeTrackManager$$.$_invokeAfterPaint$ = function $$AdfResizeTrackManager$$$$_invokeAfterPaint$$($callback$$64$$) {
  var $agent$$2$$ = $AdfAgent$$.$AGENT$;
  return $agent$$2$$.$getDomWindow$().requestAnimationFrame ? $agent$$2$$.$getDomWindow$().requestAnimationFrame($callback$$64$$) : $agent$$2$$.$getDomWindow$().mozRequestAnimationFrame ? $agent$$2$$.$getDomWindow$().mozRequestAnimationFrame($callback$$64$$) : $agent$$2$$.$getDomWindow$().webkitRequestAnimationFrame ? $agent$$2$$.$getDomWindow$().webkitRequestAnimationFrame($callback$$64$$) : $agent$$2$$.$getDomWindow$().setTimeout($callback$$64$$, 0);
};
$AdfResizeTrackManager$$.$_cancelInvokeAfterPaint$ = function $$AdfResizeTrackManager$$$$_cancelInvokeAfterPaint$$($id$$184$$) {
  var $agent$$3$$ = $AdfAgent$$.$AGENT$;
  $agent$$3$$.$getDomWindow$().cancelAnimationFrame ? $agent$$3$$.$getDomWindow$().cancelAnimationFrame($id$$184$$) : $agent$$3$$.$getDomWindow$().mozCancelAnimationFrame ? $agent$$3$$.$getDomWindow$().mozCancelAnimationFrame($id$$184$$) : $agent$$3$$.$getDomWindow$().webkitCancelAnimationFrame ? $agent$$3$$.$getDomWindow$().webkitCancelAnimationFrame($id$$184$$) : $agent$$3$$.$getDomWindow$().clearTimeout($id$$184$$);
};
