/* @license GNU-GPL-2.0-or-later https://www.drupal.org/licensing/faq */
(function(Drupal){Drupal.behaviors.eclContextualNavigation={attach:function attach(context,settings){Array.prototype.forEach.call(document.querySelectorAll('[data-ecl-contextual-navigation]'),function(contextualNav){Drupal.contextualNavigation.initialize(contextualNav);});},detach:function detach(context,settings,trigger){Drupal.contextualNavigation.destroy(context);}};Drupal.contextualNavigation={listSelector:'[data-ecl-contextual-navigation-list]',moreItemSelector:'[data-ecl-contextual-navigation-more]',moreItemWrapperSelector:'.ecl-contextual-navigation__item--more',initialize:function(element){var list=element.querySelector(this.listSelector);if(list){var moreItem=list.querySelector(this.moreItemSelector);if(moreItem){moreItem.addEventListener('click',this.handleClickOnMore);moreItem.list=list;moreItem.wrapper=list.querySelector(this.moreItemWrapperSelector);}}},handleClickOnMore:function(){if(this.list){this.list.setAttribute('aria-expanded','true');if(this.wrapper)this.wrapper.parentNode.removeChild(this.wrapper);}},destroy:function(element){var moreItem=element.querySelector(this.moreItemSelector);if(moreItem)moreItem.removeEventListener('click',this.handleClickOnMore);}};})(Drupal);;
((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);;
