/* @license GNU-GPL-2.0-or-later https://www.drupal.org/licensing/faq */
((Drupal,$)=>{Drupal.behaviors.spamspan={attach:(context)=>{$("span.spamspan",context).each(function(){if($("span.o",this).length)$("span.o",this).replaceWith(".");const _mail=`${$("span.u",this).text()}@${$("span.d",this).text()}`.replace(/\s+/g,"");let _mailto=`mailto:${_mail}`;if($("span.h",this).length){const _headerText=$("span.h",this).text().replace(/^ ?\((.*)\) ?$/,"$1");const _headers=$.map(_headerText.split(/, /),(n)=>n.replace(/: /,"="));const _headerString=_headers.join("&");if(_headerString)_mailto+=`?${_headerString}`;}let _anchorContent=$("span.t",this).html();if(_anchorContent){_anchorContent=_anchorContent.replace(/^ ?\(([^]*)\) ?$/,"$1");_anchorContent=_anchorContent.replaceAll("[at]","@").replaceAll("[dot]",".");}let _attributes='';$.each(this.attributes,function(){if(this.specified&&this.name.startsWith("data-spamspan-"))_attributes+=`${this.name.substring("data-spamspan-".length)}="${this.value}" `;});let _tag="<a></a>";if(_attributes)_tag=`<a ${_attributes}></a>`;$(this).after($(_tag).attr("href",_mailto).html(_anchorContent||_mail).addClass("spamspan")).remove();});}};})(Drupal,jQuery);;
(function(ECL,Drupal,$){Drupal.behaviors.eclInPageNavigation={attach:function attach(context,settings){const inpage_navigations=document.querySelectorAll('.oe-theme-ecl-inpage-navigation');if(inpage_navigations.length===0)return;let containers=[].slice.call(document.querySelectorAll('.inpage-navigation-container'));if(containers.length===0)containers.push(document.querySelector('#main-content'));containers.forEach(function(container){const nav=container.querySelector(':scope .oe-theme-ecl-inpage-navigation');if(nav===null)return;let items_markup=Drupal.eclInPageNavigation.generateItems(container,function(id,text){return Drupal.theme('oe_theme_inpage_navigation_item',id,text);});if(items_markup.length===0){Drupal.eclInPageNavigation.handleEmptyInpageNavigation(nav);return;}nav.querySelector('ul').innerHTML=items_markup;const instance=new ECL.InpageNavigation(nav);instance.init();Drupal.eclInPageNavigation.instances.push(instance);});},detach:function detach(context,settings,trigger){Drupal.eclInPageNavigation.instances.forEach(function(instance){instance.destroy();});}};Drupal.eclInPageNavigation={seenIds:{},instances:[],generateItems:function(container,item_cb){Array.prototype.forEach.call(container.querySelectorAll(':scope [data-inpage-navigation-source-area]'),function(area){let selectors=area.getAttribute('data-inpage-navigation-source-area');Array.prototype.forEach.call(area.querySelectorAll(':scope '+selectors),function(element){element.setAttribute('data-inpage-navigation-source-element','');});});if(container.hasAttribute('data-inpage-navigation-source-area')){let selectors=container.getAttribute('data-inpage-navigation-source-area');Array.prototype.forEach.call(container.querySelectorAll(':scope '+selectors),function(element){element.setAttribute('data-inpage-navigation-source-element','');});}let items_markup='';Array.prototype.forEach.call(container.querySelectorAll(':scope [data-inpage-navigation-source-element]'),function(element){let title=element.textContent.trim();if(title.length===0)return;if(!element.hasAttribute('id')){let id=Drupal.eclInPageNavigation.slug(title);if(id===false)return;element.setAttribute('id',id);}element.removeAttribute('data-inpage-navigation-source-element');items_markup+=item_cb(element.getAttribute('id'),title);});return items_markup;},slug:function(value){let originalSlug=value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,'').replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,'').replace(/\s/g,'-');let slug=originalSlug;let occurrenceAccumulator=0;if(slug.length===0)return false;if(!slug[0].match("^[a-zA-Z]*$")){slug='ref-'+slug;originalSlug=slug;}if(!this.seenIds.hasOwnProperty(slug)&&document.querySelector('#'+slug))this.seenIds[slug]=0;if(this.seenIds.hasOwnProperty(slug)){occurrenceAccumulator=this.seenIds[slug];do{occurrenceAccumulator++;slug=originalSlug+'-'+occurrenceAccumulator;}while(this.seenIds.hasOwnProperty(slug)||document.querySelector('#'+slug));}this.seenIds[originalSlug]=occurrenceAccumulator;this.seenIds[slug]=0;return slug;},handleEmptyInpageNavigation:function(block){block.remove();}};Drupal.theme.oe_theme_inpage_navigation_item=function(id,text){return '<li class="ecl-inpage-navigation__item"><a href="#'+id+'" class="ecl-link ecl-link--standalone ecl-inpage-navigation__link" data-ecl-inpage-navigation-link>'+text+'</a></li>';};})(ECL,Drupal,jQuery);;
(function(Drupal,$){Drupal.eclInPageNavigation.handleEmptyInpageNavigation=function(element){if($(element).closest('.oe-theme-left-sidebar').children('.ecl-media-container').length>0){$(element).closest('.ecl-inpage-navigation').remove();return;}$(element).closest('.oe-theme-left-sidebar').next('.ecl-col-l-9').removeClass('ecl-col-l-9').addClass('ecl-col-l-12');$(element).closest('.oe-theme-left-sidebar.ecl-col-12.ecl-col-l-3').remove();};})(Drupal,jQuery);;
