function $AdfDhtmlDialogManager$$() {
  this.Init()
}
$goog$exportSymbol$$("AdfDhtmlDialogManager", $AdfDhtmlDialogManager$$);
$AdfObject$$.$createSubclass$($AdfDhtmlDialogManager$$);
$AdfDhtmlDialogManager$$.prototype.Init = function $$AdfDhtmlDialogManager$$$$Init$() {
  $AdfDhtmlDialogManager$$.$superclass$.Init.call(this);
  this.$_dialogs$ = [];
  this.$_activationChain$ = [];
  this.$_activeDialog$ = $JSCompiler_alias_NULL$$;
  var $agent$$47$$ = $AdfAgent$$.$AGENT$, $documentElement$$9$$ = $agent$$47$$.$getDomDocument$().documentElement;
  $agent$$47$$.$getDomWindow$();
  this.$_lastScrollLeft$ = $documentElement$$9$$.scrollLeft;
  this.$_lastScrollTop$ = $documentElement$$9$$.scrollTop;
  this.$_primaryWindow$ = {};
  this.$_primaryWindow$.$activate$ = function $this$$_primaryWindow$$$activate$$() {
    var $agent$$47$$ = this.$_prevDomElement$;
    $agent$$47$$ ? $AdfFocusUtils$$.$focusElement$($agent$$47$$) : $AdfFocusUtils$$.$focusFirstDocumentTabStop$()
  };
  this.$_primaryWindow$.$showAsInActive$ = $JSCompiler_emptyFn$$();
  this.$_primaryWindow$.$showAsActive$ = $JSCompiler_emptyFn$$()
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.Init", {Init:$AdfDhtmlDialogManager$$.prototype.Init});
$AdfDhtmlDialogManager$$.prototype.$getElementCount$ = function $$AdfDhtmlDialogManager$$$$$getElementCount$$() {
  return this.$_dialogs$.length
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.getElementCount", {$getElementCount$:$AdfDhtmlDialogManager$$.prototype.$getElementCount$});
$AdfDhtmlDialogManager$$.prototype.$registerDialog$ = function $$AdfDhtmlDialogManager$$$$$registerDialog$$($dialog$$) {
  this.$_dialogs$[this.$_dialogs$.length] = $dialog$$;
  delete this.$_topDialogNavigation$
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.registerDialog", {$registerDialog$:$AdfDhtmlDialogManager$$.prototype.$registerDialog$});
function $JSCompiler_StaticMethods__getTopDialogNavigation$$($JSCompiler_StaticMethods__getTopDialogNavigation$self$$) {
  var $activeIndex$$ = -1, $activeDialog_modalDialog$$ = $JSCompiler_StaticMethods__getTopDialogNavigation$self$$.$_activeDialog$, $topDialogNavigation$$ = $JSCompiler_StaticMethods__getTopDialogNavigation$self$$.$_topDialogNavigation$;
  if($topDialogNavigation$$) {
    return $activeDialog_modalDialog$$ && ($activeIndex$$ = $AdfCollections$$.indexOf($topDialogNavigation$$, $activeDialog_modalDialog$$)), $activeIndex$$
  }
  for(var $topDialogNavigation$$ = [], $dialogs_params$$26$$ = $JSCompiler_StaticMethods__getTopDialogNavigation$self$$.$_dialogs$, $documentUnderGlass$$ = $JSCompiler_alias_FALSE$$, $i$$123$$ = $dialogs_params$$26$$.length - 1;-1 < $i$$123$$;$i$$123$$--) {
    var $dialog$$1$$ = $dialogs_params$$26$$[$i$$123$$];
    if($documentUnderGlass$$) {
      var $JSCompiler_StaticMethods__isMessageDialog$self$$inline_642$$ = $JSCompiler_StaticMethods__getTopDialogNavigation$self$$, $dialogId$$inline_644$$ = $dialog$$1$$.$getContainedComponentClientId$(), $document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$ = $JSCompiler_StaticMethods__isMessageDialog$self$$inline_642$$.$_messageDialogId$;
      if(!$document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$) {
        var $document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$ = $AdfPage$$.$PAGE$, $document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$ = $document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$.$findComponent$($document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$.$_documentClientId$), $documentPeer$$inline_648$$ = $document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$.$getPeer$();
        $documentPeer$$inline_648$$.bind($document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$);
        $document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$ = $JSCompiler_StaticMethods__isMessageDialog$self$$inline_642$$.$_messageDialogId$ = $documentPeer$$inline_648$$.$getMessageDialogId$()
      }
      if($dialogId$$inline_644$$ == $document$$inline_647_messageDialogId$$inline_645_page$$inline_646$$) {
        $topDialogNavigation$$.splice($topDialogNavigation$$.length - 1, 0, $dialog$$1$$);
        $dialog$$1$$.$raiseToFront$();
        $activeDialog_modalDialog$$ = $topDialogNavigation$$[$topDialogNavigation$$.length - 1];
        $activeDialog_modalDialog$$.$isAnimating$() && ($dialogs_params$$26$$ = {}, $dialogs_params$$26$$.msgDialog = $dialog$$1$$, $dialogs_params$$26$$.modalDialog = $activeDialog_modalDialog$$, $activeDialog_modalDialog$$.$addOpenedHandler$($AdfDhtmlDialogManager$$.$_setMessageDialogRestoreFocus$, $dialogs_params$$26$$));
        break
      }
    }else {
      if($dialog$$1$$.getModal() && ($documentUnderGlass$$ = $JSCompiler_alias_TRUE$$, 2 == $dialog$$1$$.$getZorderScope$())) {
        break
      }
      -1 == $activeIndex$$ && $activeDialog_modalDialog$$ && $dialog$$1$$ == $activeDialog_modalDialog$$ && ($activeIndex$$ = $topDialogNavigation$$.length);
      $topDialogNavigation$$[$topDialogNavigation$$.length] = $dialog$$1$$
    }
  }
  $topDialogNavigation$$.reverse();
  -1 < $activeIndex$$ && ($activeIndex$$ = $topDialogNavigation$$.length - 1 - $activeIndex$$);
  $documentUnderGlass$$ || ($topDialogNavigation$$[$topDialogNavigation$$.length] = $JSCompiler_StaticMethods__getTopDialogNavigation$self$$.$_primaryWindow$);
  $JSCompiler_StaticMethods__getTopDialogNavigation$self$$.$_topDialogNavigation$ = $topDialogNavigation$$;
  return $activeIndex$$
}
$AdfDhtmlDialogManager$$.$_setMessageDialogRestoreFocus$ = function $$AdfDhtmlDialogManager$$$$_setMessageDialogRestoreFocus$$($activeDomElement$$1_modalDialog$$1_params$$27$$) {
  $AdfAssert$$.$assertObject$($activeDomElement$$1_modalDialog$$1_params$$27$$, "params is required");
  var $msgDialog$$ = $activeDomElement$$1_modalDialog$$1_params$$27$$.msgDialog;
  $activeDomElement$$1_modalDialog$$1_params$$27$$ = $activeDomElement$$1_modalDialog$$1_params$$27$$.modalDialog;
  $AdfAssert$$.$assertPrototype$($msgDialog$$, $AdfDhtmlSimpleFloat$$, "params.msgDialog]");
  $AdfAssert$$.$assertPrototype$($activeDomElement$$1_modalDialog$$1_params$$27$$, $AdfDhtmlSimpleFloat$$, "params.modalDialog");
  $activeDomElement$$1_modalDialog$$1_params$$27$$ = $activeDomElement$$1_modalDialog$$1_params$$27$$.$getFirstTabStop$();
  $msgDialog$$.$setRestoreFocusId$($activeDomElement$$1_modalDialog$$1_params$$27$$ && $activeDomElement$$1_modalDialog$$1_params$$27$$.id ? $activeDomElement$$1_modalDialog$$1_params$$27$$.id : $JSCompiler_alias_NULL$$)
};
$AdfDhtmlDialogManager$$.prototype.$focusNextModelessDialog$ = function $$AdfDhtmlDialogManager$$$$$focusNextModelessDialog$$($activeIndex$$1_nextDialog_prevDocumentDomElement$$) {
  $activeIndex$$1_nextDialog_prevDocumentDomElement$$ && (this.$_primaryWindow$.$_prevDomElement$ = $activeIndex$$1_nextDialog_prevDocumentDomElement$$);
  $activeIndex$$1_nextDialog_prevDocumentDomElement$$ = $JSCompiler_StaticMethods__getTopDialogNavigation$$(this);
  var $topDialogNavigation$$1$$ = this.$_topDialogNavigation$, $nextIndex$$ = 0;
  if($topDialogNavigation$$1$$ && !(1 >= $topDialogNavigation$$1$$.length) && ($nextIndex$$ = -1 == $activeIndex$$1_nextDialog_prevDocumentDomElement$$ || $activeIndex$$1_nextDialog_prevDocumentDomElement$$ + 1 == $topDialogNavigation$$1$$.length ? 0 : $activeIndex$$1_nextDialog_prevDocumentDomElement$$ + 1, $activeIndex$$1_nextDialog_prevDocumentDomElement$$ = $topDialogNavigation$$1$$[$nextIndex$$])) {
    this.$activateDialog$($activeIndex$$1_nextDialog_prevDocumentDomElement$$), $activeIndex$$1_nextDialog_prevDocumentDomElement$$.$activate$()
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.focusNextModelessDialog", {$focusNextModelessDialog$:$AdfDhtmlDialogManager$$.prototype.$focusNextModelessDialog$});
$AdfDhtmlDialogManager$$.prototype.$unregisterDialog$ = function $$AdfDhtmlDialogManager$$$$$unregisterDialog$$($chainElemCount_dialog$$3$$) {
  var $activationChain$$ = this.$_activationChain$, $dialogs$$1$$ = this.$_dialogs$;
  $JSCompiler_StaticMethods__getTopDialogNavigation$$(this);
  $AdfCollections$$.$removeArrayValue$($dialogs$$1$$, $chainElemCount_dialog$$3$$);
  $AdfCollections$$.$removeArrayValue$($activationChain$$, $chainElemCount_dialog$$3$$);
  if($chainElemCount_dialog$$3$$.getModal()) {
    for(var $page$$33$$ = $AdfPage$$.$PAGE$, $topDialogNavigation$$2$$ = this.$_topDialogNavigation$, $i$$124$$ = $topDialogNavigation$$2$$.length - 1;0 < $i$$124$$;$i$$124$$--) {
      var $childDialog$$ = $topDialogNavigation$$2$$[$i$$124$$];
      if($childDialog$$ != this.$_primaryWindow$) {
        var $peer$$60_windowClientId$$ = $childDialog$$.$getContainedComponentClientId$(), $popup$$6_popupClientId$$2_windowComponent$$ = $page$$33$$.$findComponent$($peer$$60_windowClientId$$);
        if($popup$$6_popupClientId$$2_windowComponent$$ && $popup$$6_popupClientId$$2_windowComponent$$ instanceof AdfRichDialog) {
          var $windowParent$$ = $popup$$6_popupClientId$$2_windowComponent$$.getParent();
          if($windowParent$$ && $windowParent$$ instanceof AdfRichDocument && $windowParent$$.$getPeer$().$getMessageDialogId$() == $peer$$60_windowClientId$$) {
            continue
          }
          $peer$$60_windowClientId$$ = $popup$$6_popupClientId$$2_windowComponent$$.$getPeer$();
          $peer$$60_windowClientId$$.bind($popup$$6_popupClientId$$2_windowComponent$$);
          $peer$$60_windowClientId$$.$fireCancel$()
        }else {
          $popup$$6_popupClientId$$2_windowComponent$$ = $childDialog$$.$getPopupClientId$(), ($popup$$6_popupClientId$$2_windowComponent$$ = $page$$33$$.$findComponent$($popup$$6_popupClientId$$2_windowComponent$$)) && $popup$$6_popupClientId$$2_windowComponent$$ instanceof AdfRichPopup && $popup$$6_popupClientId$$2_windowComponent$$.cancel()
        }
        $AdfCollections$$.$removeArrayValue$($dialogs$$1$$, $childDialog$$);
        $AdfCollections$$.$removeArrayValue$($activationChain$$, $childDialog$$)
      }
    }
  }
  delete this.$_topDialogNavigation$;
  this.$_activeDialog$ == $chainElemCount_dialog$$3$$ && (this.$_activeDialog$ = $JSCompiler_alias_NULL$$, $chainElemCount_dialog$$3$$ = $activationChain$$.length, 1 <= $chainElemCount_dialog$$3$$ && (this.$_activeDialog$ = $activationChain$$[$chainElemCount_dialog$$3$$ - 1]).$activate$())
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.unregisterDialog", {$unregisterDialog$:$AdfDhtmlDialogManager$$.prototype.$unregisterDialog$});
$AdfDhtmlDialogManager$$.prototype.$activateDialog$ = function $$AdfDhtmlDialogManager$$$$$activateDialog$$($dialog$$4$$) {
  var $activationChain$$1_currentActiveDialog$$ = this.$_activeDialog$;
  if($activationChain$$1_currentActiveDialog$$ == $dialog$$4$$) {
    return $JSCompiler_alias_FALSE$$
  }
  $JSCompiler_StaticMethods__getTopDialogNavigation$$(this);
  var $topDialogNavigation$$3$$ = this.$_topDialogNavigation$;
  if($topDialogNavigation$$3$$ && 0 > $AdfCollections$$.indexOf($topDialogNavigation$$3$$, $dialog$$4$$)) {
    return $JSCompiler_alias_FALSE$$
  }
  $activationChain$$1_currentActiveDialog$$ && this.$deactivateCurrentDialog$();
  if($dialog$$4$$ == this.$_primaryWindow$) {
    return $JSCompiler_alias_FALSE$$
  }
  this.$_activeDialog$ = $dialog$$4$$;
  $activationChain$$1_currentActiveDialog$$ = this.$_activationChain$;
  $AdfCollections$$.$removeArrayValue$($activationChain$$1_currentActiveDialog$$, $dialog$$4$$);
  $activationChain$$1_currentActiveDialog$$.push($dialog$$4$$);
  $dialog$$4$$.$showAsActive$();
  return $JSCompiler_alias_TRUE$$
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.activateDialog", {$activateDialog$:$AdfDhtmlDialogManager$$.prototype.$activateDialog$});
$AdfDhtmlDialogManager$$.prototype.$deactivateCurrentDialog$ = function $$AdfDhtmlDialogManager$$$$$deactivateCurrentDialog$$() {
  this.$_activeDialog$ && (this.$_activeDialog$.$showAsInActive$(), this.$_activeDialog$ = $JSCompiler_alias_NULL$$)
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.deactivateCurrentDialog", {$deactivateCurrentDialog$:$AdfDhtmlDialogManager$$.prototype.$deactivateCurrentDialog$});
$AdfDhtmlDialogManager$$.$getInstance$ = function $$AdfDhtmlDialogManager$$$$getInstance$$() {
  this.$_theInstance$ == $JSCompiler_alias_NULL$$ && (this.$_theInstance$ = new $AdfDhtmlDialogManager$$);
  return this.$_theInstance$
};
$goog$exportSymbol$$("AdfDhtmlDialogManager.getInstance", $AdfDhtmlDialogManager$$.$getInstance$);
$AdfDhtmlDialogManager$$.prototype.$getActiveDialog$ = $JSCompiler_get$$("$_activeDialog$");
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlDialogManager.prototype.getActiveDialog", {$getActiveDialog$:$AdfDhtmlDialogManager$$.prototype.$getActiveDialog$});
