@20minutes/hela
Advanced tools
Comparing version 1.17.1 to 1.17.2
@@ -609,7 +609,11 @@ var N = Object.defineProperty; | ||
const Se = () => { | ||
const t = document.querySelector(".taboola"); | ||
if (!t) | ||
return !1; | ||
const { top: e, height: o } = t.getBoundingClientRect(), n = window.innerHeight; | ||
return e < 0 && -(n + o) < e; | ||
const t = [], e = document.querySelectorAll(".taboola"); | ||
return e ? (e.forEach((o, n) => { | ||
const { top: s, height: i } = o.getBoundingClientRect(), c = window.innerHeight; | ||
if (s < 0 && -(c + i) < s) { | ||
t[n] = !0; | ||
return; | ||
} | ||
t[n] = !1; | ||
}), !!t.find((o) => o === !0)) : !1; | ||
}, we = () => { | ||
@@ -616,0 +620,0 @@ const t = document.querySelector(".c-read-also-banner"); |
@@ -1,1 +0,1 @@ | ||
(function(g,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(g=typeof globalThis<"u"?globalThis:g||self,p(g.scripts={}))})(this,function(g){"use strict";var Re=Object.defineProperty;var Oe=(g,p,L)=>p in g?Re(g,p,{enumerable:!0,configurable:!0,writable:!0,value:L}):g[p]=L;var q=(g,p,L)=>Oe(g,typeof p!="symbol"?p+"":p,L);const p=()=>{const t=document.querySelector("#js-election-selector");t&&t.addEventListener("change",e=>{window.location.replace(e.target.value)})},L=()=>{const t=document.querySelector(".c-search-banner");if(t){const e=document.querySelector("#js-search-banner-to-hide"),n=t.querySelector("#js-search-banner-dropdown-btn");n==null||n.addEventListener("click",()=>{const o=n.querySelector("svg"),s=o==null?void 0:o.querySelector("use");switch(s==null?void 0:s.getAttribute("xlink:href")){case"#chevron-up":s==null||s.setAttribute("xlink:href","#chevron-down"),e==null||e.classList.add("u-hidden");break;case"#chevron-down":s==null||s.setAttribute("xlink:href","#chevron-up"),e==null||e.classList.remove("u-hidden");break}})}},K=()=>{const t=document.getElementById("elections-form-search"),e=document.querySelector(".c-search-form__autocomplete");if(!t||!e)return;const n=i=>{e.classList.remove("u-hidden");const c=e.querySelectorAll("li"),r=[];return c.forEach(l=>{const u=l.querySelector("a");u&&u.innerHTML.toLowerCase().includes(i.toLowerCase())&&r.push(l.innerHTML)}),r},o=i=>{e.innerHTML+=`<li>${i}</li>`},s=({target:i})=>{const c=i.value;if(e.classList.add("u-hidden"),c.length>=3){const r=n(c);e.innerHTML="",r.length===0&&e.classList.add("u-hidden"),r.forEach(l=>{o(l)})}};t.addEventListener("input",s),t.addEventListener("focusout",()=>{setTimeout(()=>e.classList.add("u-hidden"),300)}),t.addEventListener("focusin",()=>{e.childElementCount>0&&e.classList.remove("u-hidden")})},G=()=>{const t=document.querySelector("header"),e=document.querySelector(".js-limit-scroll-close-article-btn"),n=document.querySelector(".c-close-article-btn"),o=document.querySelector(".c-header-mobile"),s=o instanceof HTMLElement?o.offsetHeight:0;if(t&&e&&n){const i=new IntersectionObserver(()=>{const c=n.classList,r=c.contains("u-hidden"),l=t.getBoundingClientRect().bottom-s,u=e.getBoundingClientRect().bottom-s;r&&l<=0&&u>=0&&c.remove("u-hidden"),!r&&(l>=0||u<=0)&&c.add("u-hidden")},{root:document,rootMargin:`-${s}px 0px 0px 0px`});i.observe(t),i.observe(e)}},z=t=>{t.stopImmediatePropagation(),t.preventDefault();const e=t.currentTarget;if(e instanceof HTMLButtonElement){const n=e.parentElement,o=n==null?void 0:n.querySelector(`#${e.getAttribute("aria-controls")}`);e.getAttribute("aria-expanded")==="true"?(e.setAttribute("aria-expanded","false"),o==null||o.setAttribute("aria-hidden","true")):(e.setAttribute("aria-expanded","true"),o==null||o.setAttribute("aria-hidden","false"))}},Z=(t=document.querySelector(".js-collapse__button"))=>{t&&document.querySelectorAll(".c-collapse__button").forEach(n=>{n.addEventListener("click",o=>{z(o)})})},Y=(t,e)=>{const n=document.querySelector(`#${e}`);if(n){const o=n.querySelector(".js-countdown-days"),s=n.querySelector(".js-countdown-hours"),i=n.querySelector(".js-countdown-minutes"),c=n.querySelector(".js-countdown-seconds");if(!o||!s||!i||!c)return;window.counters={paralympicsGames:"2024-08-28 20:00:00"};const r=window.counters[t],l=new Date(r).getTime(),u=setInterval(()=>{const f=new Date().getTime(),m=l-f;if(m<=0)clearInterval(u);else{const y=Math.floor(m/864e5),E=Math.floor(m%(1e3*60*60*24)/(1e3*60*60)),d=Math.floor(m%(1e3*60*60)/(1e3*60)),h=Math.floor(m%(1e3*60)/1e3);o.innerHTML=y.toString(),s.innerHTML=E.toString(),i.innerHTML=d.toString(),c.innerHTML=h.toString()}},1e3)}},X=t=>{const e=t.getBBox(),n=e.width/20;return[e.x-n,e.y-n,e.width+n*2,e.height+n*2].join(" ")},J=()=>{const t=document.querySelector(".c-map-districts-container"),e=document.querySelector(".c-map-districts");if(!t||!e)return;const n=document.querySelector(".c-map-districts-container__description"),o=document.querySelector(".c-map-districts-container__department"),s=document.querySelector(".c-map-districts-container__unzoom-button");let i=e;const c=e.getAttribute("viewBox"),r=(d,h)=>{var b;return(b=d.matches)==null?void 0:b.call(d,h)},l=(d,h,b=".c-map-districts__zoomable:not(.js-selected-area)")=>{if(!d)return;let v,S=d.parentElement;for(;S instanceof SVGGraphicsElement&&S!==h;)r(S,b)&&(v=S),S=S.parentElement;return v},u=(d,h,b)=>{if(!d)return;let v=d.parentElement;for(;v instanceof SVGGraphicsElement&&v!==b;){if(h===v)return!0;v=v.parentElement}return b===h},f=(d,h)=>{if(h&&s&&n){t.classList.remove("c-map-districts-container--department-view"),n.classList.remove("u-hidden"),o==null||o.classList.add("u-hidden"),s.classList.add("u-hidden"),h!==c&&(n.classList.add("u-hidden"),s.classList.remove("u-hidden")),i.classList.remove("js-selected-area"),i=d;const b=i.getAttribute("data-info");o&&b&&(t.classList.add("c-map-districts-container--department-view"),o.classList.remove("u-hidden"),o.innerHTML=b),i.classList.add("js-selected-area"),e.setAttribute("viewBox",h)}},m=d=>{d.stopPropagation();const h=d.currentTarget;if(i&&e&&h instanceof SVGGraphicsElement){if(h===i)return;if(d.preventDefault(),i!==e&&!u(h,i,e)){f(e,c);return}const b=l(h,i);f(b||h,X(b||h))}},y=()=>{e&&i!==e&&f(e,c)};e.addEventListener("click",y),s&&s.addEventListener("click",y),document.querySelectorAll(".c-map-districts__zoomable").forEach(d=>{d.addEventListener("click",h=>m(h))})},Q=t=>{var o;t.setAttribute("aria-expanded","true");const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-ellipsis-target");e==null||e.forEach(s=>s.classList.remove("u-ellipsis"));const n=t.querySelector(".js-ellipsis-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir moins")},U=t=>{var o;const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-ellipsis-target");e==null||e.forEach(s=>s.classList.add("u-ellipsis")),t.setAttribute("aria-expanded","false");const n=t.querySelector(".js-ellipsis-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir plus")},ee=t=>{const e=t.currentTarget;return t.preventDefault(),e instanceof HTMLButtonElement?e.getAttribute("aria-expanded")==="true"?U(e):Q(e):null},te=(t=document.querySelector(".js-ellipsis-button"))=>{t&&document.querySelectorAll(".js-ellipsis-button").forEach(n=>n.addEventListener("click",ee))},ne=t=>{var o;t.setAttribute("aria-expanded","true");const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-expand-target");e==null||e.forEach(s=>s.setAttribute("aria-hidden","false"));const n=t.querySelector(".js-expand-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir moins")},oe=t=>{var o;const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-expand-target");e==null||e.forEach(s=>s.setAttribute("aria-hidden","true")),t.setAttribute("aria-expanded","false");const n=t.querySelector(".js-expand-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir plus")},se=t=>{const e=t.currentTarget;return t.preventDefault(),e instanceof HTMLButtonElement?e.getAttribute("aria-expanded")==="true"?oe(e):ne(e):null},ie=(t=document.querySelector(".js-expand-button"))=>{t&&document.querySelectorAll(".js-expand-button").forEach(n=>n.addEventListener("click",se))},re=()=>{const t=document.querySelectorAll(".js-half-donut-result");for(const e of Array.from(t)){const n=e.querySelector(".c-half-donut"),o=e.querySelector(".c-legend");if(!n||!o)return;o.querySelectorAll("[data-color]").forEach(s=>{const i=s.getAttribute("data-color"),c=n.querySelector(`.c-half-donut__zone--${i}`);c==null||c.addEventListener("mouseenter",()=>{s.classList.add("c-legend__item--is-hovered"),n.classList.add("c-half-donut--is-hovered"),o.classList.add("c-legend--is-hovered")}),c==null||c.addEventListener("mouseleave",()=>{s.classList.remove("c-legend__item--is-hovered"),n.classList.remove("c-half-donut--is-hovered"),o.classList.remove("c-legend--is-hovered")}),s.addEventListener("mouseenter",()=>{c==null||c.classList.add("c-half-donut__zone--is-hovered"),o.classList.add("c-legend--is-hovered"),n.classList.add("c-half-donut--is-hovered")}),s.addEventListener("mouseleave",()=>{c==null||c.classList.remove("c-half-donut__zone--is-hovered"),o.classList.remove("c-legend--is-hovered"),n.classList.remove("c-half-donut--is-hovered")})})}},a={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"};var ce=[`a[href]${a.inert}${a.negTabIndex}`,`area[href]${a.inert}${a.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${a.inert}${a.negTabIndex}${a.disabled}`,`input[type="radio"]${a.inert}${a.negTabIndex}${a.disabled}`,`select${a.inert}${a.negTabIndex}${a.disabled}`,`textarea${a.inert}${a.negTabIndex}${a.disabled}`,`button${a.inert}${a.negTabIndex}${a.disabled}`,`details${a.inert} > summary:first-of-type${a.negTabIndex}`,`iframe${a.inert}${a.negTabIndex}`,`audio[controls]${a.inert}${a.negTabIndex}`,`video[controls]${a.inert}${a.negTabIndex}`,`[contenteditable]${a.inert}${a.negTabIndex}`,`[tabindex]${a.inert}${a.negTabIndex}`];function H(t){(t.querySelector("[autofocus]")||t).focus()}function le(t){const e=w(t,!0),n=e?w(t,!1)||e:null;return[e,n]}function w(t,e){if(e&&R(t))return t;if(de(t))if(t.shadowRoot){let n=j(t.shadowRoot,e);for(;n;){const o=w(n,e);if(o)return o;n=D(n,e)}}else if(t.localName==="slot"){const n=t.assignedElements({flatten:!0});e||n.reverse();for(const o of n){const s=w(o,e);if(s)return s}}else{let n=j(t,e);for(;n;){const o=w(n,e);if(o)return o;n=D(n,e)}}return!e&&R(t)?t:null}function j(t,e){return e?t.firstElementChild:t.lastElementChild}function D(t,e){return e?t.nextElementSibling:t.previousElementSibling}const ae=t=>t.matches("details:not([open]) *")&&!t.matches("details>summary:first-of-type")?!0:!(t.offsetWidth||t.offsetHeight||t.getClientRects().length),R=t=>{var e;return(e=t.shadowRoot)!=null&&e.delegatesFocus?!1:t.matches(ce.join(","))&&!ae(t)};function de(t){return t.shadowRoot&&t.getAttribute("tabindex")==="-1"?!1:!t.matches(":disabled,[hidden],[inert]")}function $(t=document){const e=t.activeElement;return e?e.shadowRoot?$(e.shadowRoot)||document.activeElement:e:null}function ue(t,e){const[n,o]=le(t);if(!n)return e.preventDefault();const s=$();e.shiftKey&&s===n?(o.focus(),e.preventDefault()):!e.shiftKey&&s===o&&(n.focus(),e.preventDefault())}function _(t,e){function n(o){return!o||o===document||o===window?null:(o.assignedSlot&&(o=o.assignedSlot),o.closest(t)||n(o.getRootNode().host))}return n(e)}const A="data-a11y-dialog";class O{constructor(e){q(this,"$el");q(this,"id");q(this,"previouslyFocused");q(this,"shown");this.$el=e,this.id=this.$el.getAttribute(A)||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.fire("destroy").defaultPrevented?this:(this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0)),this)}show(e){var o;return this.shown?this:this.fire("show",e).defaultPrevented?this:(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=$(),((o=this.previouslyFocused)==null?void 0:o.tagName)==="BODY"&&(e!=null&&e.target)&&(this.previouslyFocused=e.target),(e==null?void 0:e.type)==="focus"?this.maintainFocus(e):H(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0),this)}hide(e){var o,s;return this.shown?this.fire("hide",e).defaultPrevented?this:(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),(s=(o=this.previouslyFocused)==null?void 0:o.focus)==null||s.call(o),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0),this):this}on(e,n,o){return this.$el.addEventListener(e,n,o),this}off(e,n,o){return this.$el.removeEventListener(e,n,o),this}fire(e,n){const o=new CustomEvent(e,{detail:n,cancelable:!0});return this.$el.dispatchEvent(o),o}handleTriggerClicks(e){const n=e.composedPath()[0],o=_(`[${A}-show="${this.id}"]`,n),s=_(`[${A}-hide="${this.id}"]`,n),i=_(`[${A}-hide]`,n)&&_('[aria-modal="true"]',n)===this.$el;o&&this.show(e),(s||i)&&this.hide(e)}bindKeypress(e){if(_('[aria-modal="true"]',$())!==this.$el)return;let n=!1;try{n=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}e.key==="Escape"&&this.$el.getAttribute("role")!=="alertdialog"&&!n&&(e.preventDefault(),this.hide(e)),e.key==="Tab"&&ue(this.$el,e)}maintainFocus(e){e.target.closest(`[aria-modal="true"], [${A}-ignore-focus-trap]`)||H(this.$el)}}function B(){for(const t of document.querySelectorAll("[data-a11y-dialog]"))new O(t)}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",B):B());const fe=()=>document.querySelectorAll(".js-modal").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=new O(t),n={x:0,y:0};e.on("show",()=>{n.x=window.scrollX,n.y=window.scrollY,document.body.classList.add("noscroll"),document.body.style.top=`-${n.y}px`}).on("hide",()=>{document.body.classList.remove("noscroll"),document.body.style.top="",(window.scrollY!==n.y||window.scrollX!==n.x)&&window.scroll(n.x,n.y)})}),he=({navigatedList:t,nextBtn:e,prevBtn:n})=>{var i,c,r,l,u,f,m,y;const o=t.scrollLeft>0,s=t.scrollLeft+t.clientWidth<t.scrollWidth;o&&s?((i=e.classList)==null||i.add("o-nav-button--visible"),(c=n.classList)==null||c.add("o-nav-button--visible")):o?((r=e.classList)==null||r.remove("o-nav-button--visible"),(l=n.classList)==null||l.add("o-nav-button--visible")):s?((u=e.classList)==null||u.add("o-nav-button--visible"),(f=n.classList)==null||f.remove("o-nav-button--visible")):((m=e.classList)==null||m.remove("o-nav-button--visible"),(y=n.classList)==null||y.remove("o-nav-button--visible"))},me=({navigatedList:t,nextBtn:e,prevBtn:n,sliderVariant:o})=>{if(t){const s=t.closest(".js-overview-bar-container"),i=s==null?void 0:s.querySelector(".c-stepper"),c=i==null?void 0:i.querySelectorAll(".c-stepper__item");if(c){const r=Array.from(c).findIndex(l=>l.classList.contains("c-stepper__item--loading"));if(r<0)c[0].classList.add("c-stepper__item--loading");else{c[r].classList.remove("c-stepper__item--loading"),c[r].classList.add("c-stepper__item--loaded");const l=c[r].querySelector(".c-stepper__loader");l&&l instanceof HTMLElement&&(l.style.transition="width 0s linear"),r+1<c.length&&c[r+1].classList.add("c-stepper__item--loading")}}if(t.scrollWidth-t.clientWidth>t.clientWidth){let r=t.scrollLeft;switch(o){case"three-columns-articles":r+=t.clientWidth+32;break;case"rubrics":r+=t.clientWidth-36;break;default:r+=Math.ceil(t.clientWidth*.6);break}t.scrollTo({left:r,behavior:"smooth"}),n.classList.add("o-nav-button--visible"),r+t.clientWidth>=t.scrollWidth&&e.classList.remove("o-nav-button--visible")}else{const r=t.scrollWidth-t.clientWidth;t.scrollTo({left:r,behavior:"smooth"}),e.classList.remove("o-nav-button--visible"),n.classList.add("o-nav-button--visible")}}},pe=({navigatedList:t,nextBtn:e,prevBtn:n,sliderVariant:o,delay:s})=>{if(t){const i=t.closest(".js-overview-bar-container"),c=i==null?void 0:i.querySelector(".c-stepper"),r=c==null?void 0:c.querySelectorAll(".c-stepper__item");if(r){const l=Array.from(r).findIndex(u=>u.classList.contains("c-stepper__item--loading"));l<0?r[0].classList.add("c-stepper__item--loading"):(r[l].classList.remove("c-stepper__item--loading"),r[l].classList.remove("c-stepper__item--loaded"),l-1>0&&(r[l-1].classList.remove("c-stepper__item--loading"),r[l-1].classList.remove("c-stepper__item--loaded"),setTimeout(()=>{const u=r[l-1].querySelector(".c-stepper__loader");r[l-1].classList.add("c-stepper__item--loading"),u&&u instanceof HTMLElement&&(u.style.transition=`width ${s/1e3}s linear`)},0)))}if(t.clientWidth<t.scrollLeft){let l=t.scrollLeft;switch(o){case"three-columns-articles":l-=t.clientWidth+32;break;case"rubrics":l-=t.clientWidth-36;break;default:l-=Math.ceil(t.clientWidth*.6);break}t.scrollTo({left:l,behavior:"smooth"}),e.classList.add("o-nav-button--visible"),l===0&&n.classList.remove("o-nav-button--visible")}else t.scrollTo({left:0,behavior:"smooth"}),n.classList.remove("o-nav-button--visible"),t.clientWidth<t.scrollWidth&&e.classList.add("o-nav-button--visible")}},be=({navigatedList:t,nextBtn:e,prevBtn:n})=>{he({navigatedList:t,nextBtn:e,prevBtn:n})},ge=()=>{const t=document.querySelectorAll(".js-navigation-container");for(const e of Array.from(t)){const{sliderVariant:n}=e.dataset,{sliderAuto:o}=e.dataset,{sliderDelay:s}=e.dataset,i=s?parseInt(s,10):3e3,c=e.closest(".js-overview-bar-container"),r=c==null?void 0:c.querySelector(".c-stepper"),l=r==null?void 0:r.querySelectorAll(".c-stepper__item");if(e){const u=e.querySelector(".js-navigation-container__list"),f=e.querySelector(".o-nav-button--next-button"),m=e.querySelector(".o-nav-button--previous-button");if(u&&u.clientWidth<u.scrollWidth&&(f==null||f.classList.add("o-nav-button--visible")),u&&f&&m&&(f==null||f.addEventListener("click",me.bind(!1,{navigatedList:u,nextBtn:f,prevBtn:m,sliderVariant:n})),m==null||m.addEventListener("click",pe.bind(!1,{navigatedList:u,nextBtn:f,prevBtn:m,sliderVariant:n,delay:i}))),o==="true"&&f){const y=r?r.querySelector(".c-stepper__item--loading"):null;l&&(l.forEach(E=>{const d=E.querySelector(".c-stepper__loader");d&&d instanceof HTMLElement&&(d.style.transition=`width ${i/1e3}s linear`)}),y||l[0].classList.add("c-stepper__item--loading")),setInterval(()=>{f.classList.contains("o-nav-button--visible")?f.click():u&&m&&(u.scrollLeft=0,l&&(l.forEach(E=>{const d=E.querySelector(".c-stepper__loader");d&&d instanceof HTMLElement&&(d.style.transition="width 0s linear"),E.classList.remove("c-stepper__item--loading"),E.classList.remove("c-stepper__item--loaded"),setTimeout(()=>{d&&d instanceof HTMLElement&&(d.style.transition=`width ${i/1e3}s linear`)},0)}),setTimeout(()=>{l[0].classList.add("c-stepper__item--loading")},0)),m.click())},i)}}}},ye=()=>{const t=document.querySelectorAll(".js-navigation-container");for(const e of Array.from(t))if(e){const n=e.querySelector(".js-navigation-container__list"),o=e.querySelector(".o-nav-button--next-button"),s=e.querySelector(".o-nav-button--previous-button");n&&o&&s&&window.addEventListener("resize",be.bind(!1,{navigatedList:n,nextBtn:o,prevBtn:s}))}},Ee=()=>{const t=document.querySelector(".js-limit-scroll-progress-bar"),e=document.querySelector(".c-progress__bar");if(!e)return;const{documentElement:n}=document;let o=n.scrollHeight-n.clientHeight;if(!o)return;const s=n.scrollTop;t&&(o=t.scrollHeight-n.clientHeight+(window.pageYOffset+t.getBoundingClientRect().top));const i=Math.round(s/o*100);e.style.width=`${i}%`,i>=100&&(e.style.width="100%")},ve=()=>{document.querySelector(".c-progress")&&window.addEventListener("scroll",Ee)};let T,C=0;const Le=()=>{const t=document.querySelector(".taboola");if(!t)return!1;const{top:e,height:n}=t.getBoundingClientRect(),o=window.innerHeight;return e<0&&-(o+n)<e},Se=()=>{const t=document.querySelector(".c-read-also-banner");if(t){if(Le()){t.classList.add("u-hidden");return}t.classList.remove("u-hidden"),T=null,document.body.getBoundingClientRect().top>C+2&&(T="up"),document.body.getBoundingClientRect().top<C-2&&(T="down"),C=document.body.getBoundingClientRect().top;const e=t.dataset.bannerLimitTop||"0";T==="up"&&-document.body.getBoundingClientRect().top>=parseInt(e,10)&&(t.classList.remove("c-read-also-banner__scrolldirection--down"),t.style.paddingTop="0.75em",t.style.paddingBottom="0.75em",t.style.borderWidth="1px",t.classList.contains("c-read-also-banner__scrolldirection--up")||t.classList.add("c-read-also-banner__scrolldirection--up")),(T==="down"||-document.body.getBoundingClientRect().top<=parseInt(e,10))&&(t.classList.remove("c-read-also-banner__scrolldirection--up"),t.style.paddingTop="0",t.style.paddingBottom="0",t.style.borderWidth="0",t.classList.contains("c-read-also-banner__scrolldirection--down")||t.classList.add("c-read-also-banner__scrolldirection--down"))}},we=(t=document.querySelector(".c-read-also-banner"))=>{if(t){let e;window.addEventListener("scroll",()=>{clearTimeout(e),e=setTimeout(Se,100)})}},k="#page-content",I="#text-tooltip",_e=".tooltip-btn",W="c-text-tooltip--show",Ae=["#page-content .c-content p","#page-content .c-content h2","#page-content .c-content h3","#page-content .c-content h4","#page-content .c-content h5","#page-content .c-content h6","#page-content .c-content li","#page-content .c-content span","#page-content header span","#page-content header h1","#page-content header h2"],F=(t,e)=>t instanceof Element?e.some(n=>t.matches(n)):!1,Te=(t,e)=>{const n=t.startContainer.nodeType===Node.ELEMENT_NODE?t.startContainer:t.startContainer.parentElement,o=t.endContainer.nodeType===Node.ELEMENT_NODE?t.endContainer:t.endContainer.parentElement;return!!n&&F(n,e)||!!o&&F(o,e)},qe=t=>{var n;if(!t.focusNode)return null;const e=(n=t.anchorNode)==null?void 0:n.compareDocumentPosition(t.focusNode);return e?(e&4)>0:t.anchorOffset<t.focusOffset},$e=(t,e,n)=>{const o=document.querySelector(`${k} ${I}`),s=document.querySelector(`${k}`),i=document.querySelectorAll(`${k} ${I} ${_e}`);if(!o||!s){console.warn("Text tooltip : Tooltip or it's parent are not found in the DOM");return}Array.from(i).forEach(l=>l.setAttribute("data-selected-text",n));const c=t.getClientRects(),r=c[e?c.length-1:0];o.style.top=`${r.top-s.getBoundingClientRect().top-(o.offsetHeight+10)}px`,r.width<o.offsetWidth?o.style.left=`${r.left-s.getBoundingClientRect().left+r.width/2-o.offsetWidth/2}px`:e?o.style.left=`${r.left-s.getBoundingClientRect().left+r.width-o.offsetWidth}px`:o.style.left=`${r.left-s.getBoundingClientRect().left}px`,o.classList.add(W)},N=()=>{const t=document.querySelector(`${I}`);t&&t.classList.remove(W)},x=({type:t})=>{const e=window.getSelection();if(t==="selectionchange"){N();return}if(!e||!e.rangeCount)return;const n=e.getRangeAt(0),o=e.toString().trim();if(o.length){const s=Te(n,Ae),i=qe(e)||!1;s&&$e(n,i,o);return}N()},xe=()=>{if(!(window!=null&&window.getSelection)){console.warn("Selection API isn't supported");return}document.addEventListener("mouseup",x),document.addEventListener("selectionchange",x),document.addEventListener("touchend",x),document.addEventListener("touchcancel",x)},Ce=t=>{const{target:e}=t;if(e instanceof Element){const n=e.closest(".c-search-form--button");n&&(t.preventDefault(),n.classList.remove("c-search-form--button"))}},ke=(t=document.querySelector(".c-search-form--button"))=>{t&&t.addEventListener("click",e=>{Ce(e)})},Ie=({tabsContainerElement:t,event:e})=>{e.preventDefault();const n=e.target;if(!(n instanceof HTMLButtonElement))return;const o=t.querySelectorAll('[role="tab"]'),s=t.querySelectorAll('[role="tabpanel"]'),i=n.getAttribute("aria-controls"),c=Object.values(s).find(r=>r.id===i);o.forEach(r=>{r.setAttribute("aria-selected","false")}),s.forEach(r=>{r.setAttribute("aria-hidden","true")}),n.setAttribute("aria-selected","true"),c&&c.removeAttribute("aria-hidden")},P=t=>t.code==="ArrowLeft"||t.keyCode===39,V=t=>t.code==="ArrowRight"||t.keyCode===37,Me=(t=document.querySelectorAll(".js-tabs"))=>{t.length>0&&t.forEach(e=>{const n=e.querySelectorAll('[role="tab"]');n.forEach(s=>{s.addEventListener("click",i=>{Ie({tabsContainerElement:e,event:i})})});const o=e.querySelector('[role="tablist"]');if(o&&n.length>0){let s=0;o.addEventListener("keydown",i=>{i instanceof KeyboardEvent&&(P(i)||V(i))&&(n[s].setAttribute("tabindex","-1"),P(i)?(s+=1,s>=n.length&&(s=0)):V(i)&&(s-=1,s<0&&(s=n.length-1)),n[s].setAttribute("tabindex","0"),n[s].focus())})}})},M="c-social-bar-item__container--is-highlighted",He=t=>{const e=t.find(n=>n.classList.contains(M));e==null||e.classList.remove(M)},je=()=>{const t=document.querySelector(".c-toolbar");if(t){const e=window.location.origin+window.location.pathname,n=Array.from(t.querySelectorAll(".c-social-bar-item__container"));He(n);const o=n.find(s=>{var i;return((i=s.querySelector("a"))==null?void 0:i.getAttribute("href"))===e});o==null||o.classList.add(M)}},De=()=>{ie(),Me(),Z(),te(),ve(),fe(),we(),ke(),Y("paralympicsGames","countdown-paralympics-games"),xe(),G(),re(),K(),J(),je(),p(),L(),ge(),ye()};g.initScripts=De,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}); | ||
(function(g,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(g=typeof globalThis<"u"?globalThis:g||self,p(g.scripts={}))})(this,function(g){"use strict";var Re=Object.defineProperty;var Oe=(g,p,L)=>p in g?Re(g,p,{enumerable:!0,configurable:!0,writable:!0,value:L}):g[p]=L;var q=(g,p,L)=>Oe(g,typeof p!="symbol"?p+"":p,L);const p=()=>{const t=document.querySelector("#js-election-selector");t&&t.addEventListener("change",e=>{window.location.replace(e.target.value)})},L=()=>{const t=document.querySelector(".c-search-banner");if(t){const e=document.querySelector("#js-search-banner-to-hide"),n=t.querySelector("#js-search-banner-dropdown-btn");n==null||n.addEventListener("click",()=>{const o=n.querySelector("svg"),s=o==null?void 0:o.querySelector("use");switch(s==null?void 0:s.getAttribute("xlink:href")){case"#chevron-up":s==null||s.setAttribute("xlink:href","#chevron-down"),e==null||e.classList.add("u-hidden");break;case"#chevron-down":s==null||s.setAttribute("xlink:href","#chevron-up"),e==null||e.classList.remove("u-hidden");break}})}},K=()=>{const t=document.getElementById("elections-form-search"),e=document.querySelector(".c-search-form__autocomplete");if(!t||!e)return;const n=i=>{e.classList.remove("u-hidden");const c=e.querySelectorAll("li"),r=[];return c.forEach(l=>{const u=l.querySelector("a");u&&u.innerHTML.toLowerCase().includes(i.toLowerCase())&&r.push(l.innerHTML)}),r},o=i=>{e.innerHTML+=`<li>${i}</li>`},s=({target:i})=>{const c=i.value;if(e.classList.add("u-hidden"),c.length>=3){const r=n(c);e.innerHTML="",r.length===0&&e.classList.add("u-hidden"),r.forEach(l=>{o(l)})}};t.addEventListener("input",s),t.addEventListener("focusout",()=>{setTimeout(()=>e.classList.add("u-hidden"),300)}),t.addEventListener("focusin",()=>{e.childElementCount>0&&e.classList.remove("u-hidden")})},G=()=>{const t=document.querySelector("header"),e=document.querySelector(".js-limit-scroll-close-article-btn"),n=document.querySelector(".c-close-article-btn"),o=document.querySelector(".c-header-mobile"),s=o instanceof HTMLElement?o.offsetHeight:0;if(t&&e&&n){const i=new IntersectionObserver(()=>{const c=n.classList,r=c.contains("u-hidden"),l=t.getBoundingClientRect().bottom-s,u=e.getBoundingClientRect().bottom-s;r&&l<=0&&u>=0&&c.remove("u-hidden"),!r&&(l>=0||u<=0)&&c.add("u-hidden")},{root:document,rootMargin:`-${s}px 0px 0px 0px`});i.observe(t),i.observe(e)}},z=t=>{t.stopImmediatePropagation(),t.preventDefault();const e=t.currentTarget;if(e instanceof HTMLButtonElement){const n=e.parentElement,o=n==null?void 0:n.querySelector(`#${e.getAttribute("aria-controls")}`);e.getAttribute("aria-expanded")==="true"?(e.setAttribute("aria-expanded","false"),o==null||o.setAttribute("aria-hidden","true")):(e.setAttribute("aria-expanded","true"),o==null||o.setAttribute("aria-hidden","false"))}},Z=(t=document.querySelector(".js-collapse__button"))=>{t&&document.querySelectorAll(".c-collapse__button").forEach(n=>{n.addEventListener("click",o=>{z(o)})})},Y=(t,e)=>{const n=document.querySelector(`#${e}`);if(n){const o=n.querySelector(".js-countdown-days"),s=n.querySelector(".js-countdown-hours"),i=n.querySelector(".js-countdown-minutes"),c=n.querySelector(".js-countdown-seconds");if(!o||!s||!i||!c)return;window.counters={paralympicsGames:"2024-08-28 20:00:00"};const r=window.counters[t],l=new Date(r).getTime(),u=setInterval(()=>{const f=new Date().getTime(),m=l-f;if(m<=0)clearInterval(u);else{const y=Math.floor(m/864e5),E=Math.floor(m%(1e3*60*60*24)/(1e3*60*60)),d=Math.floor(m%(1e3*60*60)/(1e3*60)),h=Math.floor(m%(1e3*60)/1e3);o.innerHTML=y.toString(),s.innerHTML=E.toString(),i.innerHTML=d.toString(),c.innerHTML=h.toString()}},1e3)}},X=t=>{const e=t.getBBox(),n=e.width/20;return[e.x-n,e.y-n,e.width+n*2,e.height+n*2].join(" ")},J=()=>{const t=document.querySelector(".c-map-districts-container"),e=document.querySelector(".c-map-districts");if(!t||!e)return;const n=document.querySelector(".c-map-districts-container__description"),o=document.querySelector(".c-map-districts-container__department"),s=document.querySelector(".c-map-districts-container__unzoom-button");let i=e;const c=e.getAttribute("viewBox"),r=(d,h)=>{var b;return(b=d.matches)==null?void 0:b.call(d,h)},l=(d,h,b=".c-map-districts__zoomable:not(.js-selected-area)")=>{if(!d)return;let v,S=d.parentElement;for(;S instanceof SVGGraphicsElement&&S!==h;)r(S,b)&&(v=S),S=S.parentElement;return v},u=(d,h,b)=>{if(!d)return;let v=d.parentElement;for(;v instanceof SVGGraphicsElement&&v!==b;){if(h===v)return!0;v=v.parentElement}return b===h},f=(d,h)=>{if(h&&s&&n){t.classList.remove("c-map-districts-container--department-view"),n.classList.remove("u-hidden"),o==null||o.classList.add("u-hidden"),s.classList.add("u-hidden"),h!==c&&(n.classList.add("u-hidden"),s.classList.remove("u-hidden")),i.classList.remove("js-selected-area"),i=d;const b=i.getAttribute("data-info");o&&b&&(t.classList.add("c-map-districts-container--department-view"),o.classList.remove("u-hidden"),o.innerHTML=b),i.classList.add("js-selected-area"),e.setAttribute("viewBox",h)}},m=d=>{d.stopPropagation();const h=d.currentTarget;if(i&&e&&h instanceof SVGGraphicsElement){if(h===i)return;if(d.preventDefault(),i!==e&&!u(h,i,e)){f(e,c);return}const b=l(h,i);f(b||h,X(b||h))}},y=()=>{e&&i!==e&&f(e,c)};e.addEventListener("click",y),s&&s.addEventListener("click",y),document.querySelectorAll(".c-map-districts__zoomable").forEach(d=>{d.addEventListener("click",h=>m(h))})},Q=t=>{var o;t.setAttribute("aria-expanded","true");const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-ellipsis-target");e==null||e.forEach(s=>s.classList.remove("u-ellipsis"));const n=t.querySelector(".js-ellipsis-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir moins")},U=t=>{var o;const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-ellipsis-target");e==null||e.forEach(s=>s.classList.add("u-ellipsis")),t.setAttribute("aria-expanded","false");const n=t.querySelector(".js-ellipsis-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir plus")},ee=t=>{const e=t.currentTarget;return t.preventDefault(),e instanceof HTMLButtonElement?e.getAttribute("aria-expanded")==="true"?U(e):Q(e):null},te=(t=document.querySelector(".js-ellipsis-button"))=>{t&&document.querySelectorAll(".js-ellipsis-button").forEach(n=>n.addEventListener("click",ee))},ne=t=>{var o;t.setAttribute("aria-expanded","true");const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-expand-target");e==null||e.forEach(s=>s.setAttribute("aria-hidden","false"));const n=t.querySelector(".js-expand-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir moins")},oe=t=>{var o;const e=(o=t.parentNode)==null?void 0:o.querySelectorAll(".js-expand-target");e==null||e.forEach(s=>s.setAttribute("aria-hidden","true")),t.setAttribute("aria-expanded","false");const n=t.querySelector(".js-expand-button__label");n instanceof HTMLSpanElement&&(n.innerHTML="Voir plus")},se=t=>{const e=t.currentTarget;return t.preventDefault(),e instanceof HTMLButtonElement?e.getAttribute("aria-expanded")==="true"?oe(e):ne(e):null},ie=(t=document.querySelector(".js-expand-button"))=>{t&&document.querySelectorAll(".js-expand-button").forEach(n=>n.addEventListener("click",se))},re=()=>{const t=document.querySelectorAll(".js-half-donut-result");for(const e of Array.from(t)){const n=e.querySelector(".c-half-donut"),o=e.querySelector(".c-legend");if(!n||!o)return;o.querySelectorAll("[data-color]").forEach(s=>{const i=s.getAttribute("data-color"),c=n.querySelector(`.c-half-donut__zone--${i}`);c==null||c.addEventListener("mouseenter",()=>{s.classList.add("c-legend__item--is-hovered"),n.classList.add("c-half-donut--is-hovered"),o.classList.add("c-legend--is-hovered")}),c==null||c.addEventListener("mouseleave",()=>{s.classList.remove("c-legend__item--is-hovered"),n.classList.remove("c-half-donut--is-hovered"),o.classList.remove("c-legend--is-hovered")}),s.addEventListener("mouseenter",()=>{c==null||c.classList.add("c-half-donut__zone--is-hovered"),o.classList.add("c-legend--is-hovered"),n.classList.add("c-half-donut--is-hovered")}),s.addEventListener("mouseleave",()=>{c==null||c.classList.remove("c-half-donut__zone--is-hovered"),o.classList.remove("c-legend--is-hovered"),n.classList.remove("c-half-donut--is-hovered")})})}},a={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"};var ce=[`a[href]${a.inert}${a.negTabIndex}`,`area[href]${a.inert}${a.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${a.inert}${a.negTabIndex}${a.disabled}`,`input[type="radio"]${a.inert}${a.negTabIndex}${a.disabled}`,`select${a.inert}${a.negTabIndex}${a.disabled}`,`textarea${a.inert}${a.negTabIndex}${a.disabled}`,`button${a.inert}${a.negTabIndex}${a.disabled}`,`details${a.inert} > summary:first-of-type${a.negTabIndex}`,`iframe${a.inert}${a.negTabIndex}`,`audio[controls]${a.inert}${a.negTabIndex}`,`video[controls]${a.inert}${a.negTabIndex}`,`[contenteditable]${a.inert}${a.negTabIndex}`,`[tabindex]${a.inert}${a.negTabIndex}`];function H(t){(t.querySelector("[autofocus]")||t).focus()}function le(t){const e=w(t,!0),n=e?w(t,!1)||e:null;return[e,n]}function w(t,e){if(e&&R(t))return t;if(de(t))if(t.shadowRoot){let n=j(t.shadowRoot,e);for(;n;){const o=w(n,e);if(o)return o;n=D(n,e)}}else if(t.localName==="slot"){const n=t.assignedElements({flatten:!0});e||n.reverse();for(const o of n){const s=w(o,e);if(s)return s}}else{let n=j(t,e);for(;n;){const o=w(n,e);if(o)return o;n=D(n,e)}}return!e&&R(t)?t:null}function j(t,e){return e?t.firstElementChild:t.lastElementChild}function D(t,e){return e?t.nextElementSibling:t.previousElementSibling}const ae=t=>t.matches("details:not([open]) *")&&!t.matches("details>summary:first-of-type")?!0:!(t.offsetWidth||t.offsetHeight||t.getClientRects().length),R=t=>{var e;return(e=t.shadowRoot)!=null&&e.delegatesFocus?!1:t.matches(ce.join(","))&&!ae(t)};function de(t){return t.shadowRoot&&t.getAttribute("tabindex")==="-1"?!1:!t.matches(":disabled,[hidden],[inert]")}function $(t=document){const e=t.activeElement;return e?e.shadowRoot?$(e.shadowRoot)||document.activeElement:e:null}function ue(t,e){const[n,o]=le(t);if(!n)return e.preventDefault();const s=$();e.shiftKey&&s===n?(o.focus(),e.preventDefault()):!e.shiftKey&&s===o&&(n.focus(),e.preventDefault())}function _(t,e){function n(o){return!o||o===document||o===window?null:(o.assignedSlot&&(o=o.assignedSlot),o.closest(t)||n(o.getRootNode().host))}return n(e)}const A="data-a11y-dialog";class O{constructor(e){q(this,"$el");q(this,"id");q(this,"previouslyFocused");q(this,"shown");this.$el=e,this.id=this.$el.getAttribute(A)||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.fire("destroy").defaultPrevented?this:(this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0)),this)}show(e){var o;return this.shown?this:this.fire("show",e).defaultPrevented?this:(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=$(),((o=this.previouslyFocused)==null?void 0:o.tagName)==="BODY"&&(e!=null&&e.target)&&(this.previouslyFocused=e.target),(e==null?void 0:e.type)==="focus"?this.maintainFocus(e):H(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0),this)}hide(e){var o,s;return this.shown?this.fire("hide",e).defaultPrevented?this:(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),(s=(o=this.previouslyFocused)==null?void 0:o.focus)==null||s.call(o),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0),this):this}on(e,n,o){return this.$el.addEventListener(e,n,o),this}off(e,n,o){return this.$el.removeEventListener(e,n,o),this}fire(e,n){const o=new CustomEvent(e,{detail:n,cancelable:!0});return this.$el.dispatchEvent(o),o}handleTriggerClicks(e){const n=e.composedPath()[0],o=_(`[${A}-show="${this.id}"]`,n),s=_(`[${A}-hide="${this.id}"]`,n),i=_(`[${A}-hide]`,n)&&_('[aria-modal="true"]',n)===this.$el;o&&this.show(e),(s||i)&&this.hide(e)}bindKeypress(e){if(_('[aria-modal="true"]',$())!==this.$el)return;let n=!1;try{n=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}e.key==="Escape"&&this.$el.getAttribute("role")!=="alertdialog"&&!n&&(e.preventDefault(),this.hide(e)),e.key==="Tab"&&ue(this.$el,e)}maintainFocus(e){e.target.closest(`[aria-modal="true"], [${A}-ignore-focus-trap]`)||H(this.$el)}}function B(){for(const t of document.querySelectorAll("[data-a11y-dialog]"))new O(t)}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",B):B());const fe=()=>document.querySelectorAll(".js-modal").forEach(t=>{if(!(t instanceof HTMLElement))return;const e=new O(t),n={x:0,y:0};e.on("show",()=>{n.x=window.scrollX,n.y=window.scrollY,document.body.classList.add("noscroll"),document.body.style.top=`-${n.y}px`}).on("hide",()=>{document.body.classList.remove("noscroll"),document.body.style.top="",(window.scrollY!==n.y||window.scrollX!==n.x)&&window.scroll(n.x,n.y)})}),he=({navigatedList:t,nextBtn:e,prevBtn:n})=>{var i,c,r,l,u,f,m,y;const o=t.scrollLeft>0,s=t.scrollLeft+t.clientWidth<t.scrollWidth;o&&s?((i=e.classList)==null||i.add("o-nav-button--visible"),(c=n.classList)==null||c.add("o-nav-button--visible")):o?((r=e.classList)==null||r.remove("o-nav-button--visible"),(l=n.classList)==null||l.add("o-nav-button--visible")):s?((u=e.classList)==null||u.add("o-nav-button--visible"),(f=n.classList)==null||f.remove("o-nav-button--visible")):((m=e.classList)==null||m.remove("o-nav-button--visible"),(y=n.classList)==null||y.remove("o-nav-button--visible"))},me=({navigatedList:t,nextBtn:e,prevBtn:n,sliderVariant:o})=>{if(t){const s=t.closest(".js-overview-bar-container"),i=s==null?void 0:s.querySelector(".c-stepper"),c=i==null?void 0:i.querySelectorAll(".c-stepper__item");if(c){const r=Array.from(c).findIndex(l=>l.classList.contains("c-stepper__item--loading"));if(r<0)c[0].classList.add("c-stepper__item--loading");else{c[r].classList.remove("c-stepper__item--loading"),c[r].classList.add("c-stepper__item--loaded");const l=c[r].querySelector(".c-stepper__loader");l&&l instanceof HTMLElement&&(l.style.transition="width 0s linear"),r+1<c.length&&c[r+1].classList.add("c-stepper__item--loading")}}if(t.scrollWidth-t.clientWidth>t.clientWidth){let r=t.scrollLeft;switch(o){case"three-columns-articles":r+=t.clientWidth+32;break;case"rubrics":r+=t.clientWidth-36;break;default:r+=Math.ceil(t.clientWidth*.6);break}t.scrollTo({left:r,behavior:"smooth"}),n.classList.add("o-nav-button--visible"),r+t.clientWidth>=t.scrollWidth&&e.classList.remove("o-nav-button--visible")}else{const r=t.scrollWidth-t.clientWidth;t.scrollTo({left:r,behavior:"smooth"}),e.classList.remove("o-nav-button--visible"),n.classList.add("o-nav-button--visible")}}},pe=({navigatedList:t,nextBtn:e,prevBtn:n,sliderVariant:o,delay:s})=>{if(t){const i=t.closest(".js-overview-bar-container"),c=i==null?void 0:i.querySelector(".c-stepper"),r=c==null?void 0:c.querySelectorAll(".c-stepper__item");if(r){const l=Array.from(r).findIndex(u=>u.classList.contains("c-stepper__item--loading"));l<0?r[0].classList.add("c-stepper__item--loading"):(r[l].classList.remove("c-stepper__item--loading"),r[l].classList.remove("c-stepper__item--loaded"),l-1>0&&(r[l-1].classList.remove("c-stepper__item--loading"),r[l-1].classList.remove("c-stepper__item--loaded"),setTimeout(()=>{const u=r[l-1].querySelector(".c-stepper__loader");r[l-1].classList.add("c-stepper__item--loading"),u&&u instanceof HTMLElement&&(u.style.transition=`width ${s/1e3}s linear`)},0)))}if(t.clientWidth<t.scrollLeft){let l=t.scrollLeft;switch(o){case"three-columns-articles":l-=t.clientWidth+32;break;case"rubrics":l-=t.clientWidth-36;break;default:l-=Math.ceil(t.clientWidth*.6);break}t.scrollTo({left:l,behavior:"smooth"}),e.classList.add("o-nav-button--visible"),l===0&&n.classList.remove("o-nav-button--visible")}else t.scrollTo({left:0,behavior:"smooth"}),n.classList.remove("o-nav-button--visible"),t.clientWidth<t.scrollWidth&&e.classList.add("o-nav-button--visible")}},be=({navigatedList:t,nextBtn:e,prevBtn:n})=>{he({navigatedList:t,nextBtn:e,prevBtn:n})},ge=()=>{const t=document.querySelectorAll(".js-navigation-container");for(const e of Array.from(t)){const{sliderVariant:n}=e.dataset,{sliderAuto:o}=e.dataset,{sliderDelay:s}=e.dataset,i=s?parseInt(s,10):3e3,c=e.closest(".js-overview-bar-container"),r=c==null?void 0:c.querySelector(".c-stepper"),l=r==null?void 0:r.querySelectorAll(".c-stepper__item");if(e){const u=e.querySelector(".js-navigation-container__list"),f=e.querySelector(".o-nav-button--next-button"),m=e.querySelector(".o-nav-button--previous-button");if(u&&u.clientWidth<u.scrollWidth&&(f==null||f.classList.add("o-nav-button--visible")),u&&f&&m&&(f==null||f.addEventListener("click",me.bind(!1,{navigatedList:u,nextBtn:f,prevBtn:m,sliderVariant:n})),m==null||m.addEventListener("click",pe.bind(!1,{navigatedList:u,nextBtn:f,prevBtn:m,sliderVariant:n,delay:i}))),o==="true"&&f){const y=r?r.querySelector(".c-stepper__item--loading"):null;l&&(l.forEach(E=>{const d=E.querySelector(".c-stepper__loader");d&&d instanceof HTMLElement&&(d.style.transition=`width ${i/1e3}s linear`)}),y||l[0].classList.add("c-stepper__item--loading")),setInterval(()=>{f.classList.contains("o-nav-button--visible")?f.click():u&&m&&(u.scrollLeft=0,l&&(l.forEach(E=>{const d=E.querySelector(".c-stepper__loader");d&&d instanceof HTMLElement&&(d.style.transition="width 0s linear"),E.classList.remove("c-stepper__item--loading"),E.classList.remove("c-stepper__item--loaded"),setTimeout(()=>{d&&d instanceof HTMLElement&&(d.style.transition=`width ${i/1e3}s linear`)},0)}),setTimeout(()=>{l[0].classList.add("c-stepper__item--loading")},0)),m.click())},i)}}}},ye=()=>{const t=document.querySelectorAll(".js-navigation-container");for(const e of Array.from(t))if(e){const n=e.querySelector(".js-navigation-container__list"),o=e.querySelector(".o-nav-button--next-button"),s=e.querySelector(".o-nav-button--previous-button");n&&o&&s&&window.addEventListener("resize",be.bind(!1,{navigatedList:n,nextBtn:o,prevBtn:s}))}},Ee=()=>{const t=document.querySelector(".js-limit-scroll-progress-bar"),e=document.querySelector(".c-progress__bar");if(!e)return;const{documentElement:n}=document;let o=n.scrollHeight-n.clientHeight;if(!o)return;const s=n.scrollTop;t&&(o=t.scrollHeight-n.clientHeight+(window.pageYOffset+t.getBoundingClientRect().top));const i=Math.round(s/o*100);e.style.width=`${i}%`,i>=100&&(e.style.width="100%")},ve=()=>{document.querySelector(".c-progress")&&window.addEventListener("scroll",Ee)};let T,C=0;const Le=()=>{const t=[],e=document.querySelectorAll(".taboola");return e?(e.forEach((n,o)=>{const{top:s,height:i}=n.getBoundingClientRect(),c=window.innerHeight;if(s<0&&-(c+i)<s){t[o]=!0;return}t[o]=!1}),!!t.find(n=>n===!0)):!1},Se=()=>{const t=document.querySelector(".c-read-also-banner");if(t){if(Le()){t.classList.add("u-hidden");return}t.classList.remove("u-hidden"),T=null,document.body.getBoundingClientRect().top>C+2&&(T="up"),document.body.getBoundingClientRect().top<C-2&&(T="down"),C=document.body.getBoundingClientRect().top;const e=t.dataset.bannerLimitTop||"0";T==="up"&&-document.body.getBoundingClientRect().top>=parseInt(e,10)&&(t.classList.remove("c-read-also-banner__scrolldirection--down"),t.style.paddingTop="0.75em",t.style.paddingBottom="0.75em",t.style.borderWidth="1px",t.classList.contains("c-read-also-banner__scrolldirection--up")||t.classList.add("c-read-also-banner__scrolldirection--up")),(T==="down"||-document.body.getBoundingClientRect().top<=parseInt(e,10))&&(t.classList.remove("c-read-also-banner__scrolldirection--up"),t.style.paddingTop="0",t.style.paddingBottom="0",t.style.borderWidth="0",t.classList.contains("c-read-also-banner__scrolldirection--down")||t.classList.add("c-read-also-banner__scrolldirection--down"))}},we=(t=document.querySelector(".c-read-also-banner"))=>{if(t){let e;window.addEventListener("scroll",()=>{clearTimeout(e),e=setTimeout(Se,100)})}},k="#page-content",I="#text-tooltip",_e=".tooltip-btn",W="c-text-tooltip--show",Ae=["#page-content .c-content p","#page-content .c-content h2","#page-content .c-content h3","#page-content .c-content h4","#page-content .c-content h5","#page-content .c-content h6","#page-content .c-content li","#page-content .c-content span","#page-content header span","#page-content header h1","#page-content header h2"],F=(t,e)=>t instanceof Element?e.some(n=>t.matches(n)):!1,Te=(t,e)=>{const n=t.startContainer.nodeType===Node.ELEMENT_NODE?t.startContainer:t.startContainer.parentElement,o=t.endContainer.nodeType===Node.ELEMENT_NODE?t.endContainer:t.endContainer.parentElement;return!!n&&F(n,e)||!!o&&F(o,e)},qe=t=>{var n;if(!t.focusNode)return null;const e=(n=t.anchorNode)==null?void 0:n.compareDocumentPosition(t.focusNode);return e?(e&4)>0:t.anchorOffset<t.focusOffset},$e=(t,e,n)=>{const o=document.querySelector(`${k} ${I}`),s=document.querySelector(`${k}`),i=document.querySelectorAll(`${k} ${I} ${_e}`);if(!o||!s){console.warn("Text tooltip : Tooltip or it's parent are not found in the DOM");return}Array.from(i).forEach(l=>l.setAttribute("data-selected-text",n));const c=t.getClientRects(),r=c[e?c.length-1:0];o.style.top=`${r.top-s.getBoundingClientRect().top-(o.offsetHeight+10)}px`,r.width<o.offsetWidth?o.style.left=`${r.left-s.getBoundingClientRect().left+r.width/2-o.offsetWidth/2}px`:e?o.style.left=`${r.left-s.getBoundingClientRect().left+r.width-o.offsetWidth}px`:o.style.left=`${r.left-s.getBoundingClientRect().left}px`,o.classList.add(W)},N=()=>{const t=document.querySelector(`${I}`);t&&t.classList.remove(W)},x=({type:t})=>{const e=window.getSelection();if(t==="selectionchange"){N();return}if(!e||!e.rangeCount)return;const n=e.getRangeAt(0),o=e.toString().trim();if(o.length){const s=Te(n,Ae),i=qe(e)||!1;s&&$e(n,i,o);return}N()},xe=()=>{if(!(window!=null&&window.getSelection)){console.warn("Selection API isn't supported");return}document.addEventListener("mouseup",x),document.addEventListener("selectionchange",x),document.addEventListener("touchend",x),document.addEventListener("touchcancel",x)},Ce=t=>{const{target:e}=t;if(e instanceof Element){const n=e.closest(".c-search-form--button");n&&(t.preventDefault(),n.classList.remove("c-search-form--button"))}},ke=(t=document.querySelector(".c-search-form--button"))=>{t&&t.addEventListener("click",e=>{Ce(e)})},Ie=({tabsContainerElement:t,event:e})=>{e.preventDefault();const n=e.target;if(!(n instanceof HTMLButtonElement))return;const o=t.querySelectorAll('[role="tab"]'),s=t.querySelectorAll('[role="tabpanel"]'),i=n.getAttribute("aria-controls"),c=Object.values(s).find(r=>r.id===i);o.forEach(r=>{r.setAttribute("aria-selected","false")}),s.forEach(r=>{r.setAttribute("aria-hidden","true")}),n.setAttribute("aria-selected","true"),c&&c.removeAttribute("aria-hidden")},P=t=>t.code==="ArrowLeft"||t.keyCode===39,V=t=>t.code==="ArrowRight"||t.keyCode===37,Me=(t=document.querySelectorAll(".js-tabs"))=>{t.length>0&&t.forEach(e=>{const n=e.querySelectorAll('[role="tab"]');n.forEach(s=>{s.addEventListener("click",i=>{Ie({tabsContainerElement:e,event:i})})});const o=e.querySelector('[role="tablist"]');if(o&&n.length>0){let s=0;o.addEventListener("keydown",i=>{i instanceof KeyboardEvent&&(P(i)||V(i))&&(n[s].setAttribute("tabindex","-1"),P(i)?(s+=1,s>=n.length&&(s=0)):V(i)&&(s-=1,s<0&&(s=n.length-1)),n[s].setAttribute("tabindex","0"),n[s].focus())})}})},M="c-social-bar-item__container--is-highlighted",He=t=>{const e=t.find(n=>n.classList.contains(M));e==null||e.classList.remove(M)},je=()=>{const t=document.querySelector(".c-toolbar");if(t){const e=window.location.origin+window.location.pathname,n=Array.from(t.querySelectorAll(".c-social-bar-item__container"));He(n);const o=n.find(s=>{var i;return((i=s.querySelector("a"))==null?void 0:i.getAttribute("href"))===e});o==null||o.classList.add(M)}},De=()=>{ie(),Me(),Z(),te(),ve(),fe(),we(),ke(),Y("paralympicsGames","countdown-paralympics-games"),xe(),G(),re(),K(),J(),je(),p(),L(),ge(),ye()};g.initScripts=De,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "@20minutes/hela", | ||
"version": "1.17.1", | ||
"version": "1.17.2", | ||
"repository": "git@github.com:20minutes/hela.git", | ||
@@ -75,12 +75,12 @@ "license": "MIT", | ||
"@20minutes/eslint-config": "^1.2.6", | ||
"@aws-sdk/client-s3": "3.649.0", | ||
"@aws-sdk/client-s3": "3.650.0", | ||
"@csstools/postcss-sass": "^5.1.1", | ||
"@octokit/core": "5.1.0", | ||
"@storybook/addon-actions": "^8.2.9", | ||
"@storybook/addon-essentials": "^8.2.9", | ||
"@storybook/addon-links": "^8.2.9", | ||
"@storybook/blocks": "^8.2.9", | ||
"@storybook/addon-actions": "^8.3.0", | ||
"@storybook/addon-essentials": "^8.3.0", | ||
"@storybook/addon-links": "^8.3.0", | ||
"@storybook/blocks": "^8.3.0", | ||
"@storybook/csf": "0.1.2", | ||
"@storybook/react": "^8.2.9", | ||
"@storybook/react-vite": "^8.2.9", | ||
"@storybook/react": "^8.3.0", | ||
"@storybook/react-vite": "^8.3.0", | ||
"@svgr/cli": "^8.1.0", | ||
@@ -109,3 +109,3 @@ "@testing-library/dom": "^10.4.0", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"husky": "^9.1.5", | ||
"husky": "^9.1.6", | ||
"jsdom": "^25.0.0", | ||
@@ -124,3 +124,3 @@ "lint-staged": "^15.2.10", | ||
"sass": "^1.78.0", | ||
"storybook": "^8.2.9", | ||
"storybook": "^8.3.0", | ||
"style-dictionary": "^3.9.2", | ||
@@ -133,3 +133,3 @@ "stylelint": "^15.11.0", | ||
"typescript": "^4.9.5", | ||
"vite": "^5.4.3", | ||
"vite": "^5.4.4", | ||
"vite-plugin-dts": "^4.2.1", | ||
@@ -136,0 +136,0 @@ "vite-tsconfig-paths": "^5.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4806089
39178