var $AdfDhtmlTogglePeer$$ = $AdfRichUIPeer$$.$createPeerClass$($AdfRichUIPeer$$, "AdfDhtmlTogglePeer");
$goog$exportSymbol$$("AdfDhtmlTogglePeer", $AdfDhtmlTogglePeer$$);
$AdfDhtmlTogglePeer$$.$InitSubclass$ = function $$AdfDhtmlTogglePeer$$$$InitSubclass$$($initializationState$$2$$) {
  $initializationState$$2$$ && ($AdfRichUIPeer$$.$addComponentPropertyChanges$(this, $initializationState$$2$$.$propertyChanges$), $AdfRichUIPeer$$.$addComponentEventHandlers$(this, $initializationState$$2$$.$eventHandlers$));
  this.$_STYLE_CLASS_PROPERTIES$ = ["toggledStyleClass", "untoggledStyleClass"];
  this.$_TRANSLATION_PROPERTIES$ = ["toggledTipResource", "untoggledTipResource"];
  this.$_COPIED_PROPERTIES$ = "propertyName clientEventType ltrToggledIconName ltrUntoggledIconName rtlToggledIconName rtlUntoggledIconName".split(" ");
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.InitSubclass", $AdfDhtmlTogglePeer$$.$InitSubclass$);
$AdfDhtmlTogglePeer$$.$Config$ = function $$AdfDhtmlTogglePeer$$$$Config$$($subclass$$, $config$$6$$) {
  for (var $copiedProps_laf$$131$$ = $AdfPage$$.$PAGE$.$getLookAndFeel$(), $subclassProto$$ = $subclass$$.prototype, $basePropName_styleClassProps$$ = $AdfDhtmlTogglePeer$$.$_STYLE_CLASS_PROPERTIES$, $propCount$$2$$ = $basePropName_styleClassProps$$.length, $i$$663$$ = 0;$i$$663$$ < $propCount$$2$$;$i$$663$$++) {
    var $propName$$34_translationProps$$ = $basePropName_styleClassProps$$[$i$$663$$], $styleClass$$18_translatedString_translationKey$$1$$ = $config$$6$$[$propName$$34_translationProps$$];
    $styleClass$$18_translatedString_translationKey$$1$$ && ($subclassProto$$[$propName$$34_translationProps$$] = $copiedProps_laf$$131$$.getStyleClass($styleClass$$18_translatedString_translationKey$$1$$));
  }
  $propName$$34_translationProps$$ = $AdfDhtmlTogglePeer$$.$_TRANSLATION_PROPERTIES$;
  $propCount$$2$$ = $propName$$34_translationProps$$.length;
  for ($i$$663$$ = 0;$i$$663$$ < $propCount$$2$$;$i$$663$$++) {
    if ($basePropName_styleClassProps$$ = $propName$$34_translationProps$$[$i$$663$$], $styleClass$$18_translatedString_translationKey$$1$$ = $config$$6$$[$basePropName_styleClassProps$$ + "Key"]) {
      $styleClass$$18_translatedString_translationKey$$1$$ = $copiedProps_laf$$131$$.$getTranslatedString$($styleClass$$18_translatedString_translationKey$$1$$), $AdfAssert$$.$assertString$($styleClass$$18_translatedString_translationKey$$1$$), $subclassProto$$[$basePropName_styleClassProps$$] = $styleClass$$18_translatedString_translationKey$$1$$;
    }
  }
  $copiedProps_laf$$131$$ = $AdfDhtmlTogglePeer$$.$_COPIED_PROPERTIES$;
  $propCount$$2$$ = $copiedProps_laf$$131$$.length;
  for ($i$$663$$ = 0;$i$$663$$ < $propCount$$2$$;$i$$663$$++) {
    $propName$$34_translationProps$$ = $copiedProps_laf$$131$$[$i$$663$$], $propName$$34_translationProps$$ in $config$$6$$ && ($subclassProto$$[$propName$$34_translationProps$$] = $config$$6$$[$propName$$34_translationProps$$]);
  }
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.Config", $AdfDhtmlTogglePeer$$.$Config$);
$AdfDhtmlTogglePeer$$.prototype.$QueueClientEvent$ = function $$AdfDhtmlTogglePeer$$$$$QueueClientEvent$$() {
  $AdfAssert$$.$failedInAbstractFunction$();
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.QueueClientEvent", {$QueueClientEvent$:$AdfDhtmlTogglePeer$$.prototype.$QueueClientEvent$});
$AdfDhtmlTogglePeer$$.prototype.$UpdateButton$ = function $$AdfDhtmlTogglePeer$$$$$UpdateButton$$($newTitle_toggled$$1$$) {
  var $buttonElem$$1_imageElement$$ = this.$GetButtonElement$();
  if (!$buttonElem$$1_imageElement$$) {
    return !1;
  }
  var $newImageURL_oldStyleClass$$ = this.$toggledStyleClass$, $newStyleClass$$1$$ = this.$untoggledStyleClass$, $temp$$3_titleFormat$$ = this.$untoggledTipResource$;
  $newTitle_toggled$$1$$ && ($temp$$3_titleFormat$$ = $newImageURL_oldStyleClass$$, $newImageURL_oldStyleClass$$ = $newStyleClass$$1$$, $newStyleClass$$1$$ = $temp$$3_titleFormat$$, $temp$$3_titleFormat$$ = this.$toggledTipResource$);
  if ($newImageURL_oldStyleClass$$) {
    $AdfDomUtils$$.$removeCSSClassName$($buttonElem$$1_imageElement$$, $newImageURL_oldStyleClass$$), $AdfDomUtils$$.$addCSSClassName$($buttonElem$$1_imageElement$$, $newStyleClass$$1$$);
  } else {
    if ($buttonElem$$1_imageElement$$ = this.$GetButtonImageElement$()) {
      if ($newImageURL_oldStyleClass$$ = this.$getIconURL$($newTitle_toggled$$1$$)) {
        $buttonElem$$1_imageElement$$.src = $newImageURL_oldStyleClass$$;
      }
    }
  }
  this.$ApplyAriaExpanded$($newTitle_toggled$$1$$);
  $temp$$3_titleFormat$$ && ($newTitle_toggled$$1$$ = TrFastMessageFormatUtils.format($temp$$3_titleFormat$$, this.$GetTitle$()), this.$ApplyTitle$($newTitle_toggled$$1$$), this.$ApplyAriaLabel$($newTitle_toggled$$1$$));
  return !0;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.UpdateButton", {$UpdateButton$:$AdfDhtmlTogglePeer$$.prototype.$UpdateButton$});
$AdfDhtmlTogglePeer$$.prototype.$ApplyAriaExpanded$ = function $$AdfDhtmlTogglePeer$$$$$ApplyAriaExpanded$$($toggled$$2$$) {
  var $buttonElem$$2$$ = this.$GetButtonElement$();
  $AdfAgent$$.$AGENT$.setAttribute($buttonElem$$2$$, "aria-expanded", $toggled$$2$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.ApplyAriaExpanded", {$ApplyAriaExpanded$:$AdfDhtmlTogglePeer$$.prototype.$ApplyAriaExpanded$});
$AdfDhtmlTogglePeer$$.prototype.$ApplyAriaLabel$ = function $$AdfDhtmlTogglePeer$$$$$ApplyAriaLabel$$($titleText$$2$$) {
  var $buttonElem$$3$$ = this.$GetButtonElement$();
  $AdfAgent$$.$AGENT$.setAttribute($buttonElem$$3$$, "aria-label", $titleText$$2$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.ApplyAriaLabel", {$ApplyAriaLabel$:$AdfDhtmlTogglePeer$$.prototype.$ApplyAriaLabel$});
$AdfDhtmlTogglePeer$$.prototype.$ApplyTitle$ = function $$AdfDhtmlTogglePeer$$$$$ApplyTitle$$($titleText$$3$$) {
  var $buttonElem$$4$$ = this.$GetButtonElement$();
  $AdfAgent$$.$AGENT$.setAttribute($buttonElem$$4$$, "title", $titleText$$3$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.ApplyTitle", {$ApplyTitle$:$AdfDhtmlTogglePeer$$.prototype.$ApplyTitle$});
$AdfDhtmlTogglePeer$$.prototype.$GetTitle$ = function $$AdfDhtmlTogglePeer$$$$$GetTitle$$() {
  return this.$getComponent$().$getProperty$("text");
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetTitle", {$GetTitle$:$AdfDhtmlTogglePeer$$.prototype.$GetTitle$});
$AdfDhtmlTogglePeer$$.prototype.$GetButtonElement$ = function $$AdfDhtmlTogglePeer$$$$$GetButtonElement$$() {
  return this.$getDomElement$();
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetButtonElement", {$GetButtonElement$:$AdfDhtmlTogglePeer$$.prototype.$GetButtonElement$});
$AdfDhtmlTogglePeer$$.prototype.$GetButtonImageElement$ = function $$AdfDhtmlTogglePeer$$$$$GetButtonImageElement$$() {
  var $buttonElement$$2$$ = this.$GetButtonElement$();
  return $buttonElement$$2$$ ? $buttonElement$$2$$.firstChild : null;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetButtonImageElement", {$GetButtonImageElement$:$AdfDhtmlTogglePeer$$.prototype.$GetButtonImageElement$});
$AdfDhtmlTogglePeer$$.prototype.$getIconURL$ = function $$AdfDhtmlTogglePeer$$$$$getIconURL$$($iconName_rawIcon_state$$97$$) {
  $iconName_rawIcon_state$$97$$ = $AdfPage$$.$PAGE$.$getLocaleContext$().$isRightToLeft$() ? $iconName_rawIcon_state$$97$$ ? this.$rtlToggledIconName$ : this.$rtlUntoggledIconName$ : $iconName_rawIcon_state$$97$$ ? this.$ltrToggledIconName$ : this.$ltrUntoggledIconName$;
  return ($iconName_rawIcon_state$$97$$ = $AdfPage$$.$PAGE$.$getLookAndFeel$().$getRawIcon$($iconName_rawIcon_state$$97$$)) ? $iconName_rawIcon_state$$97$$.src : null;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.getIconURL", {$getIconURL$:$AdfDhtmlTogglePeer$$.prototype.$getIconURL$});
$AdfDhtmlTogglePeer$$.prototype.$EventPropagatesToServer$ = function $$AdfDhtmlTogglePeer$$$$$EventPropagatesToServer$$() {
  return !0;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.EventPropagatesToServer", {$EventPropagatesToServer$:$AdfDhtmlTogglePeer$$.prototype.$EventPropagatesToServer$});
$AdfDhtmlTogglePeer$$.prototype.$isEventForButton$ = function $$AdfDhtmlTogglePeer$$$$$isEventForButton$$($evtTarget$$10_evtTargetParent_nativeEvent$$63$$) {
  $evtTarget$$10_evtTargetParent_nativeEvent$$63$$ = $AdfAgent$$.$AGENT$.$getEventTarget$($evtTarget$$10_evtTargetParent_nativeEvent$$63$$);
  $evtTarget$$10_evtTargetParent_nativeEvent$$63$$ = "A" != $evtTarget$$10_evtTargetParent_nativeEvent$$63$$.tagName ? $evtTarget$$10_evtTargetParent_nativeEvent$$63$$.parentNode : $evtTarget$$10_evtTargetParent_nativeEvent$$63$$;
  var $button$$13$$ = this.$GetButtonElement$();
  return $button$$13$$ && $evtTarget$$10_evtTargetParent_nativeEvent$$63$$ == $button$$13$$;
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.isEventForButton", {$isEventForButton$:$AdfDhtmlTogglePeer$$.prototype.$isEventForButton$});
$AdfDhtmlTogglePeer$$.prototype.$HandleClientSideToggle$ = function $$AdfDhtmlTogglePeer$$$$$HandleClientSideToggle$$($toggled$$3$$) {
  return this.$UpdateButton$($toggled$$3$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.HandleClientSideToggle", {$HandleClientSideToggle$:$AdfDhtmlTogglePeer$$.prototype.$HandleClientSideToggle$});
$AdfDhtmlTogglePeer$$.prototype.$HandleComponentClick$ = function $$AdfDhtmlTogglePeer$$$$$HandleComponentClick$$($componentEvent$$500$$) {
  if (!$componentEvent$$500$$.$isCanceled$()) {
    var $nativeEvent$$64$$ = $componentEvent$$500$$.$getNativeEvent$();
    if ($componentEvent$$500$$.$isLeftButtonPressed$() && this.$isEventForButton$($nativeEvent$$64$$)) {
      var $newToggleState$$inline_4845$$ = !this.$GetPropertyValue$();
      this.$QueueClientEvent$($newToggleState$$inline_4845$$, !0);
      $AdfAgent$$.$AGENT$.preventDefault($nativeEvent$$64$$);
      $componentEvent$$500$$.cancel();
    }
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.HandleComponentClick", {$HandleComponentClick$:$AdfDhtmlTogglePeer$$.prototype.$HandleComponentClick$});
$AdfDhtmlTogglePeer$$.prototype.$HandleComponentKeyUp$ = function $$AdfDhtmlTogglePeer$$$$$HandleComponentKeyUp$$($componentEvent$$501$$) {
  if (!$componentEvent$$501$$.$isCanceled$()) {
    var $nativeEvent$$65$$ = $componentEvent$$501$$.$getNativeEvent$();
    if (this.$isEventForButton$($nativeEvent$$65$$)) {
      var $keyCode$$116$$ = $AdfAgent$$.$AGENT$.$getKeyCode$($nativeEvent$$65$$), $toggled$$4$$ = this.$GetPropertyValue$();
      if ($keyCode$$116$$ == $AdfKeyStroke$$.$SPACE_KEY$ || $keyCode$$116$$ == $AdfKeyStroke$$.$ARROWUP_KEY$ && !$toggled$$4$$ || $keyCode$$116$$ == $AdfKeyStroke$$.$ARROWDOWN_KEY$ && $toggled$$4$$) {
        this.$QueueClientEvent$(!$toggled$$4$$, !0), $AdfAgent$$.$AGENT$.preventDefault($nativeEvent$$65$$), $componentEvent$$501$$.cancel();
      }
    }
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.HandleComponentKeyUp", {$HandleComponentKeyUp$:$AdfDhtmlTogglePeer$$.prototype.$HandleComponentKeyUp$});
$AdfDhtmlTogglePeer$$.$TogglePropertyChangedImpl$ = function $$AdfDhtmlTogglePeer$$$$TogglePropertyChangedImpl$$($component$$2243$$, $domElement$$568$$, $newValue$$172$$) {
  this.$_inHandlePropertyChange$ || this.$QueueClientEvent$($newValue$$172$$, !0);
  return !0;
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.TogglePropertyChangedImpl", $AdfDhtmlTogglePeer$$.$TogglePropertyChangedImpl$);
$AdfDhtmlTogglePeer$$.$HandleToggleEventImpl$ = function $$AdfDhtmlTogglePeer$$$$HandleToggleEventImpl$$($componentEvent$$502$$) {
  var $component$$2244$$ = this.$getComponent$();
  if (!$componentEvent$$502$$.$isCanceled$() && $componentEvent$$502$$.getSource() == $component$$2244$$) {
    this.$_inHandlePropertyChange$ = !0;
    try {
      var $newValue$$173$$ = this.$GetNewValueFromEvent$($componentEvent$$502$$);
      $componentEvent$$502$$.$propagatesToServer$() || null == $componentEvent$$502$$.$getDisclosureCounterpart$ || null != $componentEvent$$502$$.$getDisclosureCounterpart$() ? null == $componentEvent$$502$$.$getDisclosureCounterpart$ && $component$$2244$$.setProperty(this.propertyName, $newValue$$173$$, !0) : $component$$2244$$.setProperty(this.propertyName, $newValue$$173$$, !0);
      return this.$HandleClientSideToggle$($newValue$$173$$);
    } finally {
      delete this.$_inHandlePropertyChange$;
    }
  }
  return !1;
};
$goog$exportSymbol$$("AdfDhtmlTogglePeer.HandleToggleEventImpl", $AdfDhtmlTogglePeer$$.$HandleToggleEventImpl$);
$AdfDhtmlTogglePeer$$.prototype.$GetNewValueFromEvent$ = function $$AdfDhtmlTogglePeer$$$$$GetNewValueFromEvent$$() {
  return !this.$GetPropertyValue$();
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetNewValueFromEvent", {$GetNewValueFromEvent$:$AdfDhtmlTogglePeer$$.prototype.$GetNewValueFromEvent$});
$AdfDhtmlTogglePeer$$.prototype.$GetPropertyValue$ = function $$AdfDhtmlTogglePeer$$$$$GetPropertyValue$$() {
  return this.$getComponent$().$getProperty$(this.propertyName);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfDhtmlTogglePeer.prototype.GetPropertyValue", {$GetPropertyValue$:$AdfDhtmlTogglePeer$$.prototype.$GetPropertyValue$});
