text: /*
   * This file is part of the TYPO3 CMS project.
   *
   * It is free software; you can redistribute it and/or modify it under
   * the terms of the GNU General Public License, either version 2
   * of the License, or any later version.
   *
   * For the full copyright and license information, please read the
   * LICENSE.txt file that was distributed with this source code.
   *
   * The TYPO3 project - inspiring people to share!
   */
  var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery","TYPO3/CMS/Core/Event/DebounceEvent","TYPO3/CMS/Core/Event/ThrottleEvent"],(function(t,e,i,o,s){"use strict";i=__importDefault(i);return new class{constructor(){this.$documentHeader=null,this.$documentHeaderBars=null,this.$documentHeaderNavigationBar=null,this.$documentHeaderSearchBar=null,this.$moduleBody=null,this.direction="down",this.reactionRange=300,this.lastPosition=0,this.currentPosition=0,this.changedPosition=0,this.settings={margin:24,offset:100,selectors:{moduleDocumentHeader:".t3js-module-docheader",moduleDocheaderBar:".t3js-module-docheader-bar",moduleNavigationBar:".t3js-module-docheader-bar-navigation",moduleButtonBar:".t3js-module-docheader-bar-buttons",moduleSearchBar:".t3js-module-docheader-bar-search",moduleBody:".t3js-module-body"}},this.reposition=()=>{this.$documentHeader.css("height","auto"),this.$documentHeaderBars.css("height","auto"),this.$moduleBody.css("padding-top",this.$documentHeader.outerHeight()+this.settings.margin)},this.scroll=t=>{this.currentPosition=i.default(t.target).scrollTop(),this.currentPosition>this.lastPosition?"down"!==this.direction&&(this.direction="down",this.changedPosition=this.currentPosition):this.currentPosition<this.lastPosition&&"up"!==this.direction&&(this.direction="up",this.changedPosition=this.currentPosition),"up"===this.direction&&this.changedPosition-this.reactionRange<this.currentPosition&&this.$documentHeader.css("margin-top",0),"down"===this.direction&&this.changedPosition+this.reactionRange<this.currentPosition&&this.$documentHeader.css("margin-top",-1*(this.$documentHeaderNavigationBar.outerHeight()+4)),this.lastPosition=this.currentPosition},i.default(()=>{this.initialize()})}initialize(){this.$documentHeader=i.default(this.settings.selectors.moduleDocumentHeader),this.$documentHeader.length>0&&(this.$documentHeaderBars=i.default(this.settings.selectors.moduleDocheaderBar),this.$documentHeaderNavigationBar=i.default(this.settings.selectors.moduleNavigationBar),this.$documentHeaderSearchBar=i.default(this.settings.selectors.moduleSearchBar).remove(),this.$documentHeaderSearchBar.length>0&&this.$documentHeader.append(this.$documentHeaderSearchBar),this.$moduleBody=i.default(this.settings.selectors.moduleBody),this.start())}start(){this.reposition(),new o("resize",this.reposition).bindTo(window),new s("scroll",this.scroll,100).bindTo(document.querySelector(".t3js-module-docheader + .t3js-module-body"))}}}));