/*! elementor-pro - v3.7.3 - 31-07-2022 */ "use strict";(self.webpackChunkelementor_pro=self.webpackChunkelementor_pro||[]).push([[838],{8208:(e,t,s)=>{var i=s(8003).__;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class TOCHandler extends elementorModules.frontend.handlers.Base{getDefaultSettings(){return{selectors:{widgetContainer:".elementor-widget-container",postContentContainer:'.elementor:not([data-elementor-type="header"]):not([data-elementor-type="footer"]):not([data-elementor-type="popup"])',expandButton:".elementor-toc__toggle-button--expand",collapseButton:".elementor-toc__toggle-button--collapse",body:".elementor-toc__body",headerTitle:".elementor-toc__header-title"},classes:{anchor:"elementor-menu-anchor",listWrapper:"elementor-toc__list-wrapper",listItem:"elementor-toc__list-item",listTextWrapper:"elementor-toc__list-item-text-wrapper",firstLevelListItem:"elementor-toc__top-level",listItemText:"elementor-toc__list-item-text",activeItem:"elementor-item-active",headingAnchor:"elementor-toc__heading-anchor",collapsed:"elementor-toc--collapsed"},listWrapperTag:"numbers"===this.getElementSettings().marker_view?"ol":"ul"}}getDefaultElements(){const e=this.getSettings();return{$pageContainer:this.getContainer(),$widgetContainer:this.$element.find(e.selectors.widgetContainer),$expandButton:this.$element.find(e.selectors.expandButton),$collapseButton:this.$element.find(e.selectors.collapseButton),$tocBody:this.$element.find(e.selectors.body),$listItems:this.$element.find("."+e.classes.listItem)}}getContainer(){const e=this.getElementSettings();if(e.container)return jQuery(e.container);const t=this.$element.parents(".elementor");if("popup"===t.attr("data-elementor-type"))return t;const s=this.getSettings();return jQuery(s.selectors.postContentContainer)}bindEvents(){const e=this.getElementSettings();e.minimize_box&&(this.elements.$expandButton.on("click",(()=>this.expandBox())),this.elements.$collapseButton.on("click",(()=>this.collapseBox()))),e.collapse_subitems&&this.elements.$listItems.on("hover",(e=>jQuery(e.target).slideToggle()))}getHeadings(){const e=this.getElementSettings(),t=e.headings_by_tags.join(","),s=this.getSettings("selectors"),i=e.exclude_headings_by_selector;return this.elements.$pageContainer.find(t).not(s.headerTitle).filter(((e,t)=>!jQuery(t).closest(i).length))}addAnchorsBeforeHeadings(){const e=this.getSettings("classes");this.elements.$headings.before((t=>{if(!jQuery(this.elements.$headings[t]).data("hasOwnID"))return``}))}activateItem(e){const t=this.getSettings("classes");if(this.deactivateActiveItem(e),e.addClass(t.activeItem),this.$activeItem=e,!this.getElementSettings("collapse_subitems"))return;let s;s=e.hasClass(t.firstLevelListItem)?e.parent().next():e.parents("."+t.listWrapper).eq(-2),s.length?(this.$activeList=s,this.$activeList.stop().slideDown()):delete this.$activeList}deactivateActiveItem(e){if(!this.$activeItem||this.$activeItem.is(e))return;const{classes:t}=this.getSettings();this.$activeItem.removeClass(t.activeItem),!this.$activeList||e&&this.$activeList[0].contains(e[0])||this.$activeList.slideUp()}followAnchor(e,t){const s=e[0].hash;let i;try{i=jQuery(decodeURIComponent(s))}catch(e){return}elementorFrontend.waypoint(i,(s=>{if(this.itemClicked)return;const n=i.attr("id");"down"===s?(this.viewportItems[n]=!0,this.activateItem(e)):(delete this.viewportItems[n],this.activateItem(this.$listItemTexts.eq(t-1)))}),{offset:"bottom-in-view",triggerOnce:!1}),elementorFrontend.waypoint(i,(s=>{if(this.itemClicked)return;const n=i.attr("id");"down"===s?(delete this.viewportItems[n],Object.keys(this.viewportItems).length&&this.activateItem(this.$listItemTexts.eq(t+1))):(this.viewportItems[n]=!0,this.activateItem(e))}),{offset:0,triggerOnce:!1})}followAnchors(){this.$listItemTexts.each(((e,t)=>this.followAnchor(jQuery(t),e)))}populateTOC(){this.listItemPointer=0;this.getElementSettings().hierarchical_view?this.createNestedList():this.createFlatList(),this.$listItemTexts=this.$element.find(".elementor-toc__list-item-text"),this.$listItemTexts.on("click",this.onListItemClick.bind(this)),elementorFrontend.isEditMode()||this.followAnchors()}createNestedList(){this.headingsData.forEach(((e,t)=>{e.level=0;for(let s=t-1;s>=0;s--){const t=this.headingsData[s];if(t.tag<=e.tag){e.level=t.level,t.tag`);let l=`<${t.listWrapperTag} class="${t.classes.listWrapper}">`;for(;this.listItemPointero.level)break;if(e===o.level){l+=`
  • `,l+=`
    `;let r=`${o.text}`;"bullets"===s.marker_view&&i&&(r=`${n}${r}`),l+=r,l+="
    ",this.listItemPointer++;const h=this.headingsData[this.listItemPointer];h&&e"}}return l+=``,l}handleNoHeadingsFound(){const e=i("No headings were found on this page.","elementor-pro");return this.elements.$tocBody.html(e)}collapseBodyListener(){const e=elementorFrontend.breakpoints.getActiveBreakpointsList({withDesktop:!0}),t=this.getElementSettings("minimized_on"),s=elementorFrontend.getCurrentDeviceMode(),i=this.$element.hasClass(this.getSettings("classes.collapsed"));"desktop"===t||e.indexOf(t)>=e.indexOf(s)?i||this.collapseBox():i&&this.expandBox()}onElementChange(e){"minimized_on"===e&&this.collapseBodyListener()}getHeadingAnchorLink(e,t){const s=this.elements.$headings[e].id,i=this.elements.$headings[e].closest(".elementor-widget").id;let n="";return s?n=s:i&&(n=i),s||i?jQuery(this.elements.$headings[e]).data("hasOwnID",!0):n=`${t.headingAnchor}-${e}`,n}setHeadingsData(){this.headingsData=[];const e=this.getSettings("classes");this.elements.$headings.each(((t,s)=>{const i=this.getHeadingAnchorLink(t,e);this.headingsData.push({tag:+s.nodeName.slice(1),text:s.textContent,anchorLink:i})}))}run(){if(this.elements.$headings=this.getHeadings(),!this.elements.$headings.length)return this.handleNoHeadingsFound();this.setHeadingsData(),elementorFrontend.isEditMode()||this.addAnchorsBeforeHeadings(),this.populateTOC(),this.getElementSettings("minimize_box")&&this.collapseBodyListener()}expandBox(){const e=this.getCurrentDeviceSetting("min_height");this.$element.removeClass(this.getSettings("classes.collapsed")),this.elements.$tocBody.slideDown(),this.elements.$widgetContainer.css("min-height",e.size+e.unit)}collapseBox(){this.$element.addClass(this.getSettings("classes.collapsed")),this.elements.$tocBody.slideUp(),this.elements.$widgetContainer.css("min-height","0px")}onInit(){super.onInit(...arguments),this.viewportItems=[],jQuery((()=>this.run()))}onListItemClick(e){this.itemClicked=!0,setTimeout((()=>this.itemClicked=!1),2e3);const t=jQuery(e.target),s=t.parent().next(),i=this.getElementSettings("collapse_subitems");let n;i&&t.hasClass(this.getSettings("classes.firstLevelListItem"))&&s.is(":visible")&&(n=!0),this.activateItem(t),i&&n&&s.slideUp()}}t.default=TOCHandler}}]);