PageSourceSearch

https://www.numerama.com/wp-content/mu-plugins/optimus/build/js/chunks/VideoFeed-Ct8WcGF9.js

js numerama.com collected 2026-09-24 08:38:48 UTC 53,471 bytes, 1 lines download raw bytes

1import{j as h,r as u,a as $e}from"./react-Bs4hDxVO.js";import{d as pe}from"./htmlText-DEssuVVd.js";import{q as Ae,P as ee,b8 as Be,I as Y,b9 as ce,$ as Ne,p as ue}from"./hydrateServerComponents-Du9FxQ3x.js";import{g as je,l as Fe}from"./dailymotionSdk-C2RChZ7S.js";import{s as Le,p as De,a as Oe}from"./videoFeedTracking-CVAKQwFX.js";import{u as de}from"./site-B6KXgbd2.js";function He(r){if(!r)return"";const e=r.match(/^(\d{2})-(\d{2})-(\d{4})[ T](\d{2}):(\d{2}):(\d{2})$/);let t;if(e){const[,p,v,m,g,w,k]=e;t=new Date(`${m}-${v}-${p}T${g}:${w}:${k}`)}else t=new Date(r);if(isNaN(t.getTime()))return"";const s=new Date().getTime()-t.getTime(),o=Math.floor(s/1e3),i=Math.floor(o/60),l=Math.floor(i/60),c=Math.floor(l/24),a=Math.floor(c/7),d=Math.floor(c/30),f=Math.floor(c/365);return o<60?"il y a quelques secondes":i<60?`il y a ${i} minute${i>1?"s":""}`:l<24?`il y a ${l} heure${l>1?"s":""}`:c<7?`il y a ${c} jour${c>1?"s":""}`:a<5?`il y a ${a} semaine${a>1?"s":""}`:d<12?`il y a ${d} mois`:`il y a ${f} an${f>1?"s":""}`}const Ve="videoFooter___HnnSM",ze="progressBar___FUnv-",Ue="progressBarFill___QSODG",We="videoFooterFullscreen___7nGJE",Ye="videoFooterHidden___knKY2",Ke="title___J1KzL",qe="date___a93fG",V={videoFooter:Ve,progressBar:ze,progressBarFill:Ue,videoFooterFullscreen:We,videoFooterHidden:Ye,title:Ke,date:qe};function Ge({title:r,publicationDate:e,isFullscreen:t=!1,isHidden:n=!1,isMobile:s=!1,progressBarRef:o}){if(!r&&!e)return null;const i=pe(r||"");return h.jsxs("div",{className:["relative flex flex-col",V.videoFooter,t?V.videoFooterFullscreen:"",n?V.videoFooterHidden:""].filter(Boolean).join(" "),children:[h.jsx("div",{className:["font-fontFamilyPrimary font-dynamicWeight text-white",V.title].join(" "),children:i},i),e&&h.jsx("div",{className:`font-fontFamilySecondary font-normal text-3xs leading-compact text-white ${V.date}`,children:He(e)},`date-${i}`),s&&h.jsx("div",{className:V.progressBar,children:h.jsx("div",{ref:o??null,className:V.progressBarFill})})]})}function ve(r){return r?`https://img.youtube.com/vi/${r}/maxresdefault.jpg`:void 0}function Xe(r){return r?`https://www.dailymotion.com/thumbnail/video/${r}`:void 0}function Je({youtubeId:r,dailymotionId:e}){return ve(r)??Xe(e)}const Qe="section___z4o0O",Ze="poster___1ahb2",et="posterHidden___SbkQg",tt="footer___FarSB",K={section:Qe,poster:Ze,posterHidden:et,footer:tt},rt=u.forwardRef(function({video:e,index:t,posterHidden:n,placeholder:s,progressFillRef:o,eager:i=!1,unavailable:l=!1},c){if(s)return h.jsx("div",{ref:c,className:K.section,"data-index":t,"aria-hidden":"true"});const a=Je({youtubeId:e.youtube_id,dailymotionId:e.dailymotion_id})??"";return h.jsxs("div",{className:K.section,"data-index":t,ref:c,style:l?{zIndex:3}:void 0,children:[h.jsx("img",{src:a,alt:e.title||"Aperçu vidéo",className:`${K.poster} ${n?K.posterHidden:""}`,loading:i?"eager":"lazy",draggable:!1}),l&&h.jsx("div",{role:"status",style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"2rem",color:"#fff",background:"rgba(0, 0, 0, 0.6)",font:"600 1rem/1.4 system-ui, sans-serif",pointerEvents:"none"},children:"Vidéo indisponible"}),h.jsx("div",{className:K.footer,children:h.jsx(Ge,{title:e.title,publicationDate:e.publication_date,isMobile:!0,progressBarRef:o})})]})}),nt=u.memo(rt),ot="disc___kox0I",st="visible___WJSKk",it="triangle___blvVd",Q={disc:ot,visible:st,triangle:it};function at({size:r=76,className:e="",visible:t}){return h.jsx("div",{className:e,"data-video-layer":"play-icon","aria-hidden":"true",children:h.jsx("div",{className:`${Q.disc} ${t?Q.visible:""}`,style:r!==76?{width:r,height:r}:void 0,children:h.jsx("span",{className:Q.triangle})})})}const lt="root___gaB-r",ct="surface___cnk1K",ut="trigger___rmJfP",dt="surfaceOpen___eZN1a",ft="panel___4t-XV",ht="item___RPD6p",mt="itemLabel___aGkfM",yt="divider___ZjEA5",F={root:lt,surface:ct,trigger:ut,surfaceOpen:dt,panel:ft,item:ht,itemLabel:mt,divider:yt};function pt(r){return{url:`https://www.youtube.com/watch?v=${r}`,label:"Voir sur YouTube"}}function vt({title:r,externalId:e,className:t="",getCurrentTime:n}){const[s,o]=u.useState(!1),i=u.useRef(null),l=u.useId(),c=pt(e),a=u.useCallback(p=>{if(typeof window>"u"||!n)return;const v=Math.floor(n()||0);v<=0||(p.preventDefault(),window.open(`${c.url}&t=${v}s`,"_blank","noopener,noreferrer"))},[n,c.url]),d=u.useCallback(()=>o(!1),[]),f=u.useCallback(async()=>
1{if(!(typeof navigator>"u"||!navigator.share))try{await navigator.share({title:window.location.hostname,text:r,url:c.url})}catch(p){(p==null?void 0:p.name)!=="AbortError"&&console.error("Error while sharing:",p)}},[r,c.url]);return u.useEffect(()=>{if(!s)return;const p=m=>{i.current&&!i.current.contains(m.target)&&d()},v=m=>{m.key==="Escape"&&d()};return document.addEventListener("pointerdown",p),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("keydown",v)}},[s,d]),h.jsx("div",{ref:i,className:[F.root,t].filter(Boolean).join(" "),"data-open":s,children:h.jsxs("div",{className:[F.surface,Be,s?F.surfaceOpen:""].filter(Boolean).join(" "),children:[h.jsx("button",{type:"button",className:F.trigger,"aria-haspopup":"menu","aria-expanded":s,"aria-controls":l,"aria-label":"Plus d'options",onClick:()=>o(p=>!p),children:h.jsx(Ae,{name:"more-dots",size:36,color:"inherit",ariaHidden:!0})}),h.jsxs("div",{className:[F.panel,s?F.panelOpen:""].filter(Boolean).join(" "),id:l,role:"menu","aria-hidden":!s,children:[h.jsxs("button",{type:"button",role:"menuitem",className:F.item,tabIndex:s?0:-1,onClick:f,children:[h.jsx(ee,{name:"share-network",size:18,color:"inherit"}),h.jsx("span",{className:F.itemLabel,children:"Partager"})]}),h.jsx("span",{className:F.divider,"aria-hidden":"true"}),h.jsxs("a",{role:"menuitem",className:F.item,href:c.url,target:"_blank",rel:"noopener noreferrer",tabIndex:s?0:-1,onClick:a,children:[h.jsx(ee,{name:"youtube-logo",size:18,color:"inherit"}),h.jsx("span",{className:F.itemLabel,children:c.label})]})]})]})})}const gt="videoHeader___E0-ED",wt="leftButtons___vSeQk",bt="wideButton___f8Ml0",kt="closeButton___MqywR",_t="videoHeaderHidden___5BJRf",xt="rightButtons___eRy6D",Tt="wideButtonIcon___9lFhf",St="headerButtons___wF6Gz",It="headerButtonGlass___-2FKq",Pt="headerButtonClose___ksSng",Rt="lengthButton___-RdYr",B={videoHeader:gt,leftButtons:wt,wideButton:bt,closeButton:kt,videoHeaderHidden:_t,rightButtons:xt,wideButtonIcon:Tt,headerButtons:St,headerButtonGlass:It,headerButtonClose:Pt,lengthButton:Rt};function Et({onClose:r,isMuted:e,onToggleMute:t,title:n,externalId:s,getCurrentTime:o,lengthVideo:i,isPlaying:l,isWide:c=!1,isHidden:a=!1,onToggleWide:d,portalContainer:f=null}){const[p,v]=u.useState(Number(i)||0),m=u.useRef(null),g=S=>{const $=Math.floor(S/60),y=S%60;return`${$}:${y.toString().padStart(2,"0")}`};u.useEffect(()=>{const S=Number(i)||0;v(S),m.current&&(clearInterval(m.current),m.current=null)},[i]),u.useEffect(()=>(l&&p>0?m.current=setInterval(()=>{v(S=>S>0?S-1:0)},1e3):m.current&&(clearInterval(m.current),m.current=null),()=>{m.current&&(clearInterval(m.current),m.current=null)}),[l,p]),u.useEffect(()=>{v(Number(i)||0),m.current&&(clearInterval(m.current),m.current=null)},[s]);const w=h.jsxs("div",{className:["flex justify-between items-center pointer-events-none",B.videoHeader,a?B.videoHeaderHidden:""].filter(Boolean).join(" "),style:{position:"absolute"},children:[h.jsxs("div",{className:["flex items-center",B.leftButtons].join(" "),children:[h.jsx(vt,{title:n,externalId:s,getCurrentTime:o}),h.jsx(Y,{name:e?"speaker-mute":"speaker-on",size:32,color:"inherit",hoverEffect:!1,ariaLabel:e?"Réactiver le son":"Couper le son",onClick:t,className:`${B.headerButtons} ${B.headerButtonGlass}`})]}),h.jsxs("div",{className:["inline-flex items-center",B.rightButtons].join(" "),children:[h.jsx("button",{className:B.lengthButton,children:g(p)}),d&&h.jsx("div",{className:B.wideButton,children:h.jsx(Y,{name:c?"arrows-in-simple":"arrows-out-simple",size:32,color:"inherit",glass:!0,hoverEffect:!1,ariaLabel:c?"Réduire la vidéo":"Agrandir la vidéo",onClick:d,className:`${B.headerButtons} ${B.wideButtonIcon}`})}),h.jsx("div",{className:B.closeButton,children:h.jsx(Y,{name:"x",size:32,color:"inherit",hoverEffect:!1,ariaLabel:"Fermer la vid\\u00e9o",onClick:r,className:`${B.headerButtons} ${B.headerButtonClose}`})})]})]}),k=f||document.body;return $e.createPortal(w,k)}const Ct=300;function Mt({onSingleTap:r,onDoubleTap:e,isMobile:t=!1,seekStep:n=10}){const s=u.useRef(0),o=u.useRef(null),i=u.useRef(null),l=u.useRef(0),c=u.useRef(!1);u.useEffect(()=>()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]);const a=u.useCallback(v=>{const m=v.currentTarget;if(!m)return"right";const g=m.getBoundingClientRect(),k=v.clientX-g.left,S=g.width/2;return k<S?"left":"right"},[]),d=u.useCallback(()=>{s.current=0,i.current=null,l.current=0,c.current=!1,o.current&&(clearTimeout(o.current),o.current=null)},[]),f=u.useCallback(()=>
1{if(l.current!==0&&e){const v=l.current>0?"forward":"backward";e({direction:v,seekAmount:Math.abs(l.current)})}d()},[e,d]);return{handleTap:u.useCallback(v=>{if(!t){r==null||r();return}const g=a(v)==="right"?"forward":"backward";if(i.current&&i.current!==g&&l.current!==0&&f(),s.current+=1,i.current=g,o.current&&clearTimeout(o.current),s.current===1)r==null||r(),c.current=!0;else{c.current&&(r==null||r(),c.current=!1);const w=g==="forward"?1:-1;l.current+=n*w}o.current=setTimeout(()=>{s.current>=2?f():d()},Ct)},[t,a,r,f,d,n])}}const $t={visible:!1,direction:null,amount:0,key:0};function At(r,e,t){return{visible:!0,direction:e,amount:t,key:r.key+1}}function Bt(r=600){const[e,t]=u.useState($t),n=u.useRef(null),s=u.useCallback((o,i)=>{n.current&&clearTimeout(n.current),t(l=>At(l,o,i)),n.current=setTimeout(()=>{t(l=>({...l,visible:!1}))},r)},[r]);return u.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),{seekIndicator:e,showSeekIndicator:s}}const Nt="chrome___IiIZE",jt="playIcon___GhtzJ",Ft="tapSurface___azUHd",Lt="seekIndicator___4wdVu",Dt="visible___EfuIl",Ot="seekIndicatorLeft___SqZhr",Ht="seekIndicatorRight___V5TeE",Vt="seekRipple___KUNUS",zt="seekRippleCircle___c-0SQ",Ut="seekTimeText___eKWqw",Wt="seekArrows___6zyRa",Yt="seekArrowsLeft___z40-1",Kt="seekArrowsRight___JblE8",qt="seekArrow___rH2BY",Gt="seekArrowLeft___7hS3D",Xt="seekArrowRight___GLKcS",I={chrome:Nt,playIcon:jt,tapSurface:Ft,seekIndicator:Lt,visible:Dt,seekIndicatorLeft:Ot,seekIndicatorRight:Ht,seekRipple:Vt,seekRippleCircle:zt,seekTimeText:Ut,seekArrows:Wt,seekArrowsLeft:Yt,seekArrowsRight:Kt,seekArrow:qt,seekArrowLeft:Gt,seekArrowRight:Xt},Jt=600,Qt=10;function Zt({video:r,isPlaying:e,muted:t,onToggleMute:n,onTogglePlay:s,onSeekBy:o,getCurrentTime:i,scrolling:l=!1,wide:c=!1,canWide:a=!1,isWide:d=!1,onToggleWide:f,onClose:p}){const{seekIndicator:v,showSeekIndicator:m}=Bt(Jt),[g,w]=u.useState(null),[k,S]=u.useState(!1);u.useEffect(()=>{if(e||l){S(!1);return}const _=setTimeout(()=>S(!0),320);return()=>clearTimeout(_)},[e,l]);const $=u.useCallback(()=>{s()},[s]),y=u.useCallback(({direction:_,seekAmount:E})=>{o(_==="forward"?E:-E),m(_,E)},[o,m]),{handleTap:R}=Mt({onSingleTap:$,onDoubleTap:y,isMobile:!0,seekStep:Qt});return r?h.jsxs("div",{ref:w,"data-video-layer":"chrome",className:I.chrome,children:[h.jsx("div",{"data-video-layer":"tap-surface",className:I.tapSurface,onClick:R,style:c?{pointerEvents:"none"}:void 0,role:"presentation","aria-hidden":"true"}),g&&h.jsx(Et,{title:r.title??"",externalId:r.youtube_id??"",dailymotionId:r.dailymotion_id,isMuted:t,onToggleMute:n,getCurrentTime:i,isPlaying:e,isWide:d,onToggleWide:a?f:void 0,onClose:p,portalContainer:g}),h.jsx(at,{className:I.playIcon,visible:k&&!!(r!=null&&r.dailymotion_id)&&!c}),v.visible&&v.direction==="backward"&&h.jsxs("div",{className:`${I.seekIndicator} ${I.seekIndicatorLeft} ${I.visible}`,children:[h.jsxs("div",{className:I.seekRipple,children:[h.jsx("div",{className:I.seekRippleCircle}),h.jsx("div",{className:I.seekRippleCircle}),h.jsx("div",{className:I.seekRippleCircle}),h.jsxs("span",{className:I.seekTimeText,children:["-",v.amount,"s"]})]}),h.jsxs("div",{className:`${I.seekArrows} ${I.seekArrowsLeft}`,children:[h.jsx("div",{className:`${I.seekArrow} ${I.seekArrowLeft}`}),h.jsx("div",{className:`${I.seekArrow} ${I.seekArrowLeft}`})]})]},`seek-left-${v.key}`),v.visible&&v.direction==="forward"&&h.jsxs("div",{className:`${I.seekIndicator} ${I.seekIndicatorRight} ${I.visible}`,children:[h.jsxs("div",{className:I.seekRipple,children:[h.jsx("div",{className:I.seekRippleCircle}),h.jsx("div",{className:I.seekRippleCircle}),h.jsx("div",{className:I.seekRippleCircle}),h.jsxs("span",{className:I.seekTimeText,children:["+",v.amount,"s"]})]}),h.jsxs("div",{className:`${I.seekArrows} ${I.seekArrowsRight}`,children:[h.jsx("div",{className:`${I.seekArrow} ${I.seekArrowRight}`}),h.jsx("div",{className:`${I.seekArrow} ${I.seekArrowRight}`})]})]},`seek-right-${v.key}`)]}):null}const er="https://www.youtube.com/iframe_api";let X=null;function ge(){return typeof window>"u"?Promise.reject(new Error("no window")):window.YT&&window.YT.Player?Promise.resolve(window.YT):X||(X=new Promise(r=>{let e=0;const t=()=>{e&&(clearInterval(e),e=0),r(window.YT)},n=window.onYouTubeIframeAPIReady;if(window.onYouTubeIframeAPIReady=()=>{n==null||n(),t()},!document.querySelector('script[src*="iframe_api"]')){const s=document.createElement("script");s.src=er,s.async=!0,document.head.appendChild(s)}if(window.YT&&window.YT.Player){t();return}e=window.setInterval(()=>{window.YT&&window.YT.Player&&t()},50)}),X)}const tr=500;function rr({youtubeId:r,startAt:e,muted:t,blockPlayback:n,onTime:s,onPlayingChange:o}){const i=u.useRef(null),l=u.useRef(null);return u.useEffect(()=>{if(n||!r)return;const c=i.current;if(!c)return;let a=!1,d;return ge().then(f=>{if(a)return;const p=new f.Player(c,{host:"https://www.youtube-nocookie.com",videoId:r,playerVars:{playsinline:1,rel:0,modestbranding:1,autoplay:1,start:Math.max(0,Math.floor(e)),mute:t?1:0},events:{onReady:v=>{var g,w,k,S;const m=(w=(g=v.target).getIframe)==null?void 0:w.call(g);m&&(m.style.width="100%",m.style.height="100%",m.style.border="0"),t&&v.target.mute(),(S=(k=v.target).playVideo)==null||S.call(k)},onStateChange:v=>{var g;const m=(g=window.YT)==null?void 0:g.PlayerState;m&&(v.data===m.PLAYING?o==null||o(!0):(v.data===m.PAUSED||v.data===m.ENDED)&&(o==null||o(!1)))}}});l.current=p,d=setInterval(()=>{var m,g;const v=(g=(m=l.current)==null?void 0:m.getCurrentTime)==null?void 0:g.call(m);typeof v=="number"&&v>0&&s(v)},tr)}),()=>{var f,p;a=!0,d&&clearInterval(d);try{(p=(f=l.current)==null?void 0:f.destroy)==null||p.call(f)}catch{}l.current=null}},[r,n]),u.useEffect(()=>{var a,d;const c=l.current;
1c&&(t?(a=c.mute)==null||a.call(c):(d=c.unMute)==null||d.call(c))},[t]),h.jsx("div",{ref:i,style:{width:"100%",height:"100%"}})}function nr(r){const e=typeof(r==null?void 0:r.title)=="string"?r.title:"";return pe(e)}const or="liveRegion___QfB0R",sr={liveRegion:or};function ir({video:r}){return h.jsx("p",{className:sr.liveRegion,"aria-live":"polite","aria-atomic":"true","data-video-layer":"a11y-live",children:nr(r)})}const ar=u.memo(ir);function we(r,e,t){if(e<=0||t<=0)return 0;const n=Math.round(r/e);return Math.max(0,Math.min(t-1,n))}function lr(r,e=0,t=!1){const[n,s]=u.useState(e);return u.useEffect(()=>{if(t)return;let o=0;const i=()=>{const c=r.current.filter(Boolean);if(!c.length)return;const a=c[0].getBoundingClientRect().height,d=we(window.scrollY,a,c.length);s(d)},l=()=>{o||(o=requestAnimationFrame(()=>{o=0,i()}))};return i(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),o&&cancelAnimationFrame(o)}},[r,t]),n}function cr({initialIndex:r,getSections:e,onStaleRestore:t,onUnlock:n,target:s=window,settleMs:o=350}){let i=!0,l=null;const c=["touchstart","wheel","keydown","mousedown"],a=()=>{var m;return((m=e()[r])==null?void 0:m.offsetTop)??0},d=()=>Math.abs(s.scrollY-a())>s.innerHeight/2,f=()=>{l&&clearTimeout(l),s.removeEventListener("scroll",v),c.forEach(m=>s.removeEventListener(m,p))},p=()=>{var m;if(i){if(i=!1,f(),d()){const g=e().filter(Boolean),w=((m=g[0])==null?void 0:m.getBoundingClientRect().height)??0,k=we(s.scrollY,w,g.length);k!==r&&(t==null||t(k))}n()}},v=()=>{!i||!d()||(l&&clearTimeout(l),l=setTimeout(p,o))};return{start(){return c.forEach(m=>s.addEventListener(m,p,{passive:!0})),s.addEventListener("scroll",v,{passive:!0}),f},disarm(){i&&(i=!1,f(),n())},isLocked(){return i}}}function ur(r,e,t){const[n,s]=u.useState(!0),o=u.useRef(t);o.current=t;const i=u.useRef(null);u.useEffect(()=>{const c=cr({initialIndex:e,getSections:()=>r.current,onStaleRestore:d=>{var f;return(f=o.current)==null?void 0:f.call(o,d)},onUnlock:()=>s(!1)});i.current=c;const a=c.start();return()=>{a(),i.current=null}},[]);const l=u.useCallback(()=>{var c;return(c=i.current)==null?void 0:c.disarm()},[]);return{locked:n,disarm:l}}async function dr(r,e,t,n,s){const o=s.YT??await ge(),i=document.createElement("div");r.appendChild(i);let l=!1,c=0;const a={},d=m=>{var g;return(g=a[m])==null?void 0:g.forEach(w=>w())},f=await new Promise(m=>{const g=new o.Player(i,{videoId:e,playerVars:{playsinline:1,controls:0,rel:0,modestbranding:1,fs:0,disablekb:1,iv_load_policy:3,cc_load_policy:0,autoplay:s.mode==="play"?1:0},events:{onReady:()=>{var k,S;const w=(k=g.getIframe)==null?void 0:k.call(g);w&&(w.style.width="100%",w.style.height="100%",w.style.border="0"),t&&g.mute(),c=((S=g.getDuration)==null?void 0:S.call(g))??0,n.onReady(Math.floor(c)),s.mode==="play"&&g.playVideo(),m(g)},onStateChange:w=>{var k;if(w.data===o.PlayerState.PLAYING){l=!0;const S=((k=g.getDuration)==null?void 0:k.call(g))??0;S&&S!==c&&(c=S,n.onDurationChange(Math.floor(S))),n.onPlaying(),d("playing")}else w.data===o.PlayerState.PAUSED?(l=!1,n.onPause(),d("pause")):w.data===o.PlayerState.ENDED&&(l=!1,n.onEnded(),d("ended"))}}})}),v=setInterval(()=>{l&&d("timeupdate")},250);return{play:()=>f.playVideo(),pause:()=>f.pauseVideo(),isPlaying:()=>l,getCurrentTime:()=>{var m;return((m=f.getCurrentTime)==null?void 0:m.call(f))??0},getDuration:()=>c,seekTo:m=>f.seekTo(m,!0),setMuted:m=>m?f.mute():f.unMute(),getMuted:()=>typeof f.isMuted=="function"?f.isMuted():null,changeVideo:m=>{c=0,l=!1,f.loadVideoById(m)},destroy:()=>{clearInterval(v);for(const m of Object.values(a))m.clear();try{f.destroy()}catch{}},on:(m,g)=>{(a[m]??(a[m]=new Set)).add(g)},off:(m,g)=>{var w;(w=a[m])==null||w.delete(g)}}}function L(r){const e=`${Math.round(performance.now()/100)/10}s ${r}`;try{const t=window,n=t.__poolLog||(t.__poolLog=[]);n.push(e),n.length>200&&n.shift()}catch{}}const fr=[10,25,50,75,90];async function hr(r,e,t,n,s,o,i=!0){const c=await(await Fe(t)).createPlayer(r,{video:e,player:t,params:{autoplay:i,"queue-enable":!1,"queue-autoplay-next":!1,"sharing-enable":!1,"ui-start-screen-info":!1}});n&&c.setVolume(0);const a=()=>{try{const y=c.setScaleMode("fit");y&&typeof y.catch=="function"&&y.catch(()=>{})}catch{}};let d=!1,f=0,p=0,v=null;c.on("volumechange",y=>{typeof(y==null?void 0:y.playerIsMuted)=="boolean"&&(v=y.playerIsMuted,L(`[dm ${e}] volumechange muted=${y.playerIsMuted}`))}),c.on("playing",()=>{d=!0,L(`[dm ${e}] playing`),s.onPlaying()}),c.on("play",()=>{d=!0,s.onPlaying()}),c.on("pause",()=>{d=!1,L(`[dm ${e}] pause t=${Math.round(f*10)/10}`),s.onPause()}),c.on("video_end",()=>{d=!1,L(`[dm ${e}] ended`),s.onEnded()}),c.on("timeupdate",y=>{(y==null?void 0:y.videoTime)!==void 0&&(f=y.videoTime),(y==null?void 0:y.videoDuration)!==void 0&&y.videoDuration>0&&(p=y.videoDuration)}),c.on("video_durationchange",y=>{(y==null?void 0:y.videoDuration)!==void 0&&y.videoDuration>0&&(p=y.videoDuration,s.onDurationChange(Math.floor(p)))}),c.on("playback_ready",()=>{a(),s.onReady(Math.floor(p))});const m=new Set;let g=!1;const w=`https://www.dailymotion.com/video/${e}`,k=(y,R)=>{De({elementId:r,videoTitle:o.title,videoStatus:y,videoPercent:R,videoUrl:w,videoDuration:Math.floor(p),videoCurrentTime:Math.floor(f),videoMute:o.getMute()})};c.on("video_start",()=>{m.clear(),g=!1}),c.on("video_end",()=>{k("complete",100)}),c.on("pause",()=>{p>0&&k("pause",Math.floor(f/p*100))}),c.on("timeupdate",y=>{if((y==null?void 0:y.videoTime)!==void 0&&(y!=null&&y.videoDuration)&&y.videoDuration>0){g||(g=!0,k("start",0));const R=Math.floor(y.videoTime/y.videoDuration*100);for(const _ of fr)R>=_&&!m.has(_)&&(m.add(_),k("progress",_))}});let S=0;const $=()=>{S&&(clearInterval(S),S=0)};return{play:()=>{$();const y=c.play();y&&typeof y.catch=="function"&&y.catch(()=>{})},pause:()=>{c.pause(),$();let y=0,R=f;S=window.setInterval(()=>{if(Math.abs(f-R)<.01||++y>8){$();return}R=f,c.pause()},300)},isPlaying:()=>d,getCurrentTime:()=>f,getDuration:()=>p,seekTo:y=>{f=y,c.seek(y)},setMuted:y=>c.setVolume(y?0:1),getMuted:()=>v,changeVideo:y=>{f=0,p=0,d=!1,m.clear(),g=!1,c.loadContent({video:y}),a()},destroy:()=>{$();try{c.destroy()}catch{}},on:(y,R)=>c.on(y,R),off:(y,R)=>c.off(y,R)}}function mr(r,e){return()=>{var t;return((t=r())==null?void 0:t.getMuted())??e}}async function yr(r,e,t,n,s){Le(),r.replaceChildren();const o=e.dailymotionId?"dailymotion":"youtube",i=s.mode??"play",l=ve(e.externalId)??"";if(l&&(r.style.backgroundImage=`url(${l})`,r.style.backgroundSize="contain",r.style.backgroundRepeat="no-repeat",r.style.backgroundPosition="center",r.style.backgroundColor="#000"),o==="dailymotion"&&e.dailymotionId){const c=`dm-player-${s.reactId.replace(/:/g,"")}-${s.mountId}`,a=document.createElement("div");a.id=c,a.style.cssText="width:100%;height:100%",r.appendChild(a);const d=s.dmPlayerId||je("videofeed");let f=null;const p=await hr(c,e.dailymotionId,d,t,n,{title:e.title??"",getMute:mr(()=>f,t)},i==="play");return f=p,i!=="play"&&p.pause(),p}return o==="youtube"&&e.externalId?dr(r,e.externalId,t,n,{mode:i}):null}const fe=1.5;let pr=0;const he="unavailable-overlay dbg-2026-07-22g";try{window.__poolBuild=he;const r=window;(r.__poolLog||(r.__poolLog=[])).push(`build ${he}`)}catch{}class vr{constructor(e){this.instanceId=pr++,this.activeIndex=-1,this.muted=!1,this.seq=0,this.userPaused=!1,this.playbackBlocked=!1,this.lastCurIndex=-1,this.frozenTicks=0,this.recoverReloads=0,this.mutedByFallback=!1,this.lastCurTime=-1,this.mountCalled=!1,this.opRunning=!1,this.pendingTarget=null,this.kickSeq=0,this.deps=e,this.applyMutedPref(e.muted??!1),this.playbackBlocked=e.playbackBlocked??!1,this.create=e.createPlayer??yr,this.slots=[{id:0,container:e.containers[0],player:null,index:-1,role:"idle",warmState:"empty",provider:null,buffered:!1}
1,{id:1,container:e.containers[1],player:null,index:-1,role:"idle",warmState:"empty",provider:null,buffered:!1},{id:2,container:e.containers[2],player:null,index:-1,role:"idle",warmState:"empty",provider:null,buffered:!1}];try{window.__poolState=()=>this.debugSnapshot()}catch{}}get canPlay(){return!this.playbackBlocked&&!this.userPaused}applyMutedPref(e){this.muted=e,Oe(e)}debugSnapshot(){return{activeIndex:this.activeIndex,mutedPref:this.muted,userPaused:this.userPaused,playbackBlocked:this.playbackBlocked,stall:{curIndex:this.lastCurIndex,frozenTicks:this.frozenTicks,reloads:this.recoverReloads,lastT:this.lastCurTime},slots:this.slots.map(e=>({id:e.id,index:e.index,role:e.role,warm:e.warmState,buffered:e.buffered,provider:e.provider,playing:e.player?e.player.isPlaying():null,t:e.player?Math.round(e.player.getCurrentTime()*100)/100:null,confirmedMuted:e.player?e.player.getMuted():null,hasFrame:!!e.player&&e.player.getCurrentTime()>.05}))}}isMounted(){return this.mountCalled}getActiveIndex(){return this.activeIndex}getActivePlayer(){var e;return((e=this.slots.find(t=>t.role==="current"))==null?void 0:e.player)??null}isWarm(e){return this.slots.some(t=>t.index===e&&(t.warmState==="warm"||t.warmState==="playing"))}getPlacement(){return this.slots.map(e=>({container:e.container,index:e.index,role:e.role,hasFrame:!!e.player&&(e.role==="current"?e.buffered||e.player.getCurrentTime()>.05:e.buffered)}))}getDebugState(){return{activeIndex:this.activeIndex,slots:this.slots.map(e=>{var t,n;return{id:e.id,index:e.index,role:e.role,warmState:e.warmState,isPlaying:((t=e.player)==null?void 0:t.isPlaying())??!1,currentTime:Math.round((((n=e.player)==null?void 0:n.getCurrentTime())??0)*10)/10}})}}setMuted(e){var n;this.dbg(`setMuted pref=${e}`),this.muted!==e&&(this.mutedByFallback=!1),this.applyMutedPref(e);const t=this.slots.find(s=>s.role==="current");if((n=t==null?void 0:t.player)==null||n.setMuted(e),!e&&(t!=null&&t.player)&&this.verifyUnmute(t,t.player),!e){const s=this.slots.find(o=>o.role==="neighbor"&&o.player);s!=null&&s.player&&(this.dbg(`bless neighbor i${s.index}`),s.player.play())}}setUserPaused(e){this.userPaused=e}async setPlaybackBlocked(e){if(!(e===this.playbackBlocked&&!e)){if(this.playbackBlocked=e,e){for(const t of this.slots)t.player&&(t.player.setMuted(!0),t.player.pause());return}this.mountCalled&&await this.reconcile(this.activeIndex)}}enforceNeighborState(){var s;if(this.playbackBlocked){for(const o of this.slots)o.player&&(o.player.setMuted(!0),o.player.isPlaying()&&o.player.pause());return}const e=((s=this.slots.find(o=>o.role==="current"))==null?void 0:s.index)??this.activeIndex,n=this.slots.filter(o=>o.role!=="current"&&o.player&&!o.buffered).sort((o,i)=>Math.abs(o.index-(e+1))-Math.abs(i.index-(e+1)))[0];for(const o of this.slots)o.role==="current"||!o.player||(o.player.setMuted(!0),o.buffered?o.player.isPlaying()&&(o.player.pause(),o.player.getCurrentTime()>.05&&o.player.seekTo(0)):o===n?o.player.isPlaying()||o.player.play():o.player.isPlaying()&&o.player.pause())}recoverCurrentIfFrozen(){var l,c;if(this.playbackBlocked)return;const e=this.slots.find(a=>a.role==="current");if(!(e!=null&&e.player))return;if(e.index!==this.lastCurIndex){this.lastCurIndex=e.index,this.frozenTicks=0,this.recoverReloads=0,this.lastCurTime=-1;return}if(this.frozenTicks<0)return;const t=e.player.getCurrentTime(),n=e.player.isPlaying();if(n&&t>this.lastCurTime+.05){this.frozenTicks=0,this.lastCurTime=t;return}if(!n&&!this.canPlay){this.frozenTicks=0,this.lastCurTime=t;return}this.lastCurTime=t,this.frozenTicks++;const s=t<=.15,o=s?6:8,i=s?16:40;this.frozenTicks===o?(this.dbg(`stall i${e.index} t=${Math.round(t*10)/10} → muted replay${this.muted?"":" + re-unmute"}`),e.player.setMuted(!0),this.muted||this.unmuteWhenPlaying(e,e.player),e.player.play()):this.frozenTicks>=i&&(this.recoverReloads<1?(this.dbg(`stall i${e.index} t=${Math.round(t*10)/10} → hard reload (RECREATE fresh iframe)`),this.recoverReloads++,this.frozenTicks=0,this.mutedByFallback&&(this.dbg(`recreate i${e.index}: restoring sound preference (was muted by fallback)`),this.muted=!1,this.mutedByFallback=!1),e.player.destroy(),e.player=null,e.provider=null,e.buffered=!1,e.warmState="empty",this.placeInto(e,e.index,"current")):(this.dbg(`stall i${e.index} → give up (unplayable)`),this.frozenTicks=-1,(c=(l=this.deps).onUnplayable)==null||c.call(l,e.index)))}async mount(e,t=!0){this.mountCalled||(this.mountCalled=!0,this.activeIndex=e,this.userPaused=!t,!this.playbackBlocked&&(await this.placeInto(this.slots[0],e,"current"),!this.playbackBlocked&&(this.deps.getVideo(e+1)!==void 0?await this.placeInto(this.slots[1],e+1,"neighbor"):e>0&&this.deps.getVideo(e-1)!==void 0&&await this.placeInto(this.slots[1],e-1,"neighbor"),this.syncSlotDom(),this.dbgState("mount"),window.setTimeout(()=>this.dbgState("settle mount"),2e3))))}async setActive(e){if(this.mountCalled&&(this.pendingTarget=e,!this.opRunning)){this.opRunning=!0;try{for(;this.pendingTarget!==null&&this.pendingTarget!==this.activeIndex;){const t=this.pendingTarget;this.pendingTarget=null,await this._setActive(t),this.dbgState(`swipe→i${t}`),window.setTimeout(()=>this.dbgState(`settle i${t}`),2e3)}}finally{this.opRunning=!1}}}async _setActive(e){this.activeIndex=e,this.userPaused=!1,!this.playbackBlocked&&await this.reconcile(e)}async reconcile(e){var i,l,c;const t=[{index:e,role:"current"}];this.deps.getVideo(e+1)!==void 0?t.push({index:e+1,role:"neighbor"}):e>0&&this.deps.getVideo(e-1)!==void 0&&t.push({index:e-1,role:"neighbor"});const n=new Set(t.map(a=>a.index));for(const a of this.slots)a.role==="current"&&a.index!==e&&((i=a.player)==null||i.setMuted(!0),(l=a.player)==null||l.pause());const s=this.slots.filter(a=>a.player&&!n.has(a.index));for(const a of t){const d=this.slots.find(p=>p.index===a.index&&p.player);if(d){if(a.role==="current"){const p=this.canPlay;d.role="current",d.warmState="playing";const v=d.player.getCurrentTime();this.dbg(`promote i${d.index} warmT=${Math.round(v*10)/10} buffered=${d.buffered}`),v>.05&&v<=fe+.5&&d.player.seekTo(0),p?this.startCurrent(d,d.player):(d.player.setMuted(this.muted),d.player.pause())}else d.role="neighbor",d.warmState="warm",d.buffered=!0,d.player.setMuted(!0),d.player.pause();continue}const f=s.shift()??this.slots.find(p=>!p.player)??this.pickFreeSlot(e);await this.placeInto(f,a.index,a.role)}for(const a of s)(c=a.player)==null||c.destroy(),this.resetSlot(a);const o=this.slots.find(a=>a.role==="current");(!o||!o.player)&&await this.placeInto(o??this.pickFreeSlot(e),e,"current"),this.syncSlotDom()}syncSlotDom(){for(const e of this.slots)e.container.dataset.slot=String(e.id),e.container.dataset.role=e.role,e.container.dataset.videoIndex=String(e.index),e.container.dataset.warm=e.warmState}pickFreeSlot(e){const t=n=>n===e||n===e+1;return this.slots.find(n=>n.warmState==="empty"||n.role==="idle")??this.slots.find(n=>n.role!=="current"&&!t(n.index))??this.slots.find(n=>n.role!=="current")??this.slots[0]}destroy(){var e;this.seq++;for(const t of this.slots)(e=t.player)==null||e.destroy(),t.player=null,t.role="idle",t.warmState="empty",t.index=-1,t.buffered=!1;this.syncSlotDom()}resetSlot(e){e.player=null,e.index=-1,e.role="idle",e.warmState="empty",e.provider=null,e.buffered=!1}callbacksFor(e){return{onPlaying:()=>{},onPause:()=>{},onEnded:()=>{var t,n;(n=(t=this.deps).onEnded)==null||n.call(t,e.index)},onReady:()=>{},onDurationChange:()=>{}}}providerOf(e){return e.dailymotionId?"dailymotion":"youtube"}idFor(e){return e.dailymotionId??e.externalId}placeInto(e,t,n){const s=()=>this.placeIntoLocked(e,t,n),o=e.opChain?e.opChain.then(s,s):s();e.opChain=o;const i=()=>{e.opChain===o&&(e.opChain=void 0)};return o.then(i,i),o}async placeIntoLocked(e,t,n){var d,f,p,v,m,g,w;if(this.playbackBlocked){(d=e.player)==null||d.pause();return}const s=this.deps.getVideo(t);if(!s){(f=e.player)==null||f.destroy(),this.resetSlot(e);return}const o=this.providerOf(s),i=!0;if(e.player&&e.provider===o){e.index=t,e.role=n,e.warmState="loading",e.buffered=!1,this.dbg(`place i${t} as ${n} (reuse slot ${e.id})`);const k=e.player;k.changeVideo(this.idFor(s)),k.setMuted(i),n==="current"?(e.warmState="playing",this.canPlay?this.startCurrent(e,k):k.pause()):(this.canPlay?k.play():k.pause(),e.warmState="warm",this.canPlay&&(this.pauseWhenBuffered(e,k),(v=(p=this.deps).onWarmReady)==null||v.call(p,t)));return}const l=++this.seq;(m=e.player)==null||m.destroy(),e.player=null,e.index=t,e.role=n,e.provider=o,e.warmState="loading",e.buffered=!1,this.dbg(`place i${t} as ${n} (create slot ${e.id})`);
1const c={reactId:`pool-${this.instanceId}-${e.id}`,mountId:l,mode:"play"},a=await this.create(e.container,s,i,this.callbacksFor(e),c);if(l!==this.seq){a==null||a.destroy();return}if(!e.container.isConnected){this.dbg(`create i${t} landed in a detached container → destroyed`),a==null||a.destroy(),e.player=null,e.warmState="empty";return}if(e.player=a,!a){e.warmState="empty";return}a.setMuted(i),n==="current"?(e.warmState="playing",this.canPlay?this.startCurrent(e,a):a.pause()):(this.canPlay||a.pause(),e.warmState="warm",this.canPlay&&(this.pauseWhenBuffered(e,a),(w=(g=this.deps).onWarmReady)==null||w.call(g,t)))}kickPlay(e,t){let n=0;const s=++this.kickSeq;e.kickId=s;const o=window.setInterval(()=>{var i,l;if(e.kickId!==s||e.player!==t||e.role!=="current"||!this.canPlay){clearInterval(o);return}if(++n>5){clearInterval(o),t.isPlaying()||(this.dbg(`kickPlay gave up i${e.index}`),(t.getMuted()===!1||!this.muted)&&(this.dbg(`unmuted resume refused i${e.index} → fallback muted`),this.applyMutedPref(!0),this.mutedByFallback=!0,(l=(i=this.deps).onAutoMuted)==null||l.call(i),t.setMuted(!0),t.play(),this.kickPlay(e,t)));return}t.isPlaying()||(this.dbg(`kickPlay retry ${n} i${e.index}`),t.play())},700)}startCurrent(e,t){if(t.isPlaying()){t.setMuted(this.muted),this.muted||this.verifyUnmute(e,t),this.kickPlay(e,t);return}t.setMuted(!0),this.muted||this.unmuteWhenPlaying(e,t),t.play(),this.kickPlay(e,t)}unmuteWhenPlaying(e,t){const n=()=>{t.off("playing",n),!(e.player!==t||e.role!=="current"||this.muted||!this.canPlay)&&(t.setMuted(!1),this.verifyUnmute(e,t))};t.on("playing",n)}verifyUnmute(e,t){let n=0;const s=10,o=window.setInterval(()=>{var i,l;if(e.player!==t||e.role!=="current"||this.muted||!this.canPlay){clearInterval(o);return}if(t.getMuted()===!1){clearInterval(o),this.dbg(`unmute confirmed i${e.index}`);return}t.setMuted(!1),++n>=s&&(clearInterval(o),this.dbg(`unmute refused i${e.index} (muted=${String(t.getMuted())} playing=${t.isPlaying()}) → fallback muted`),this.applyMutedPref(!0),this.mutedByFallback=!0,(l=(i=this.deps).onAutoMuted)==null||l.call(i),t.setMuted(!0),t.isPlaying()||t.play())},300)}pauseWhenBuffered(e,t){const n=()=>
1{if(e.player!==t||e.role==="current"){t.off("timeupdate",n);return}if(t.getCurrentTime()>=fe){t.off("timeupdate",n),t.seekTo(0);let s=0;const o=()=>{if(e.player!==t||e.role==="current"){t.off("timeupdate",o);return}++s>=2&&(t.off("timeupdate",o),t.pause(),t.seekTo(0),e.buffered=!0,this.dbg(`freeze+rewind i${e.index} (slot ${e.id})`))};t.on("timeupdate",o)}};t.on("timeupdate",n)}dbgState(e){const t=this.slots.map(n=>n.player?`${n.id}:${n.role} i${n.index} ${n.warmState}${n.buffered?"+buf":""} ${n.player.isPlaying()?"play":"pause"} t=${Math.round(n.player.getCurrentTime()*10)/10} m=${String(n.player.getMuted())}`:`${n.id}:${n.role}`).join(" | ");this.dbg(`state[${e}] active=${this.activeIndex} pref=${this.muted?"muted":"sound"} ${t}`)}dbg(e){L(e)}}function gr(r){for(const{container:e,hasFrame:t}of r)e&&(e.style.opacity=t?"1":"0")}function wr(r){return r.filter(e=>e.hasFrame).map(e=>e.index).sort((e,t)=>e-t).join(",")}function br(r){const e=new Set;for(const{index:t,hasFrame:n}of r)n&&e.add(t);return e}function kr(r,e){const t=r.getDuration(),n=t>0?Math.min(1,Math.max(0,r.getCurrentTime()/t)):0;e.style.transform=`scaleX(${n})`}const _r=250;function xr(r){let e=null,t=null,n="";const s=r.pollMs??_r,o=()=>{if(!e)return;const l=e.getPlacement(),c=l.map(({index:a})=>r.getSectionTop(a));l.forEach(({container:a,hasFrame:d},f)=>{if(!a)return;const p=c[f];p!==void 0&&(a.style.top=`${p}px`),a.style.opacity=d?"1":"0"})},i=()=>{if(!e||typeof document<"u"&&document.hidden)return;e.enforceNeighborState(),e.recoverCurrentIfFrozen();const l=e.getPlacement();gr(l);const c=wr(l);c!==n&&(n=c,r.onFrameChange());const a=e.getActiveIndex(),d=e.getActivePlayer(),f=a>=0?r.getProgressFill(a):null;d&&f&&kr(d,f)};return{start(){const[l,c,a]=r.getContainers();return!l||!c||!a?()=>{}:(e=r.createPool({containers:[l,c,a],getVideo:d=>r.getVideo(d),muted:r.muted,playbackBlocked:r.blockPlayback,onWarmReady:()=>{r.onWarm(),o()},onAutoMuted:()=>{var d;return(d=r.onAutoMuted)==null?void 0:d.call(r)},onUnplayable:d=>{var f;return(f=r.onUnplayable)==null?void 0:f.call(r,d)},onEnded:d=>{var f;return(f=r.onEnded)==null?void 0:f.call(r,d)}}),e.mount(r.initialIndex,r.autoplay).then(()=>{r.onWarm(),o()}),t=setInterval(i,s),window.addEventListener("resize",o),o(),()=>{t!==null&&clearInterval(t),t=null,window.removeEventListener("resize",o),e==null||e.destroy(),e=null})},setActive(l){e==null||e.setActive(l).then(()=>{r.onWarm(),o()})},setMuted(l){e==null||e.setMuted(l)},setBlockPlayback(l){e==null||e.setPlaybackBlocked(l)},syncPlayers:o,getActiveCurrentTime(){var l;return((l=e==null?void 0:e.getActivePlayer())==null?void 0:l.getCurrentTime())??0},getPlacement(){return(e==null?void 0:e.getPlacement())??[]},getPool(){return e}}}const Tr=r=>({externalId:r.youtube_id??"",dailymotionId:r.dailymotion_id,title:r.title});function Sr({containers:r,videoListRef:e,muted:t,blockPlayback:n,initialIndex:s,autoplay:o,active:i,listLength:l,callbacks:c,createPool:a}){const d=u.useRef(null),f=u.useRef(null),[p,v]=u.useState(0),[m,g]=u.useState(0),w=u.useRef(c);w.current=c;const k=u.useRef(!1);u.useEffect(()=>{const y=xr({createPool:a??(_=>new vr(_)),getContainers:()=>r.map(_=>_.current),getVideo:_=>e.current[_]?Tr(e.current[_]):void 0,getSectionTop:_=>w.current.getSectionTop(_),getProgressFill:_=>w.current.getProgressFill(_),initialIndex:s,autoplay:o,muted:t,blockPlayback:n,onWarm:()=>v(_=>_+1),onFrameChange:()=>g(_=>_+1),onAutoMuted:()=>{var _,E;k.current=!0,(E=(_=w.current).onAutoMuted)==null||E.call(_)},onUnplayable:_=>{var E,N;return(N=(E=w.current).onUnplayable)==null?void 0:N.call(E,_)},onEnded:_=>{var E,N;return(N=(E=w.current).onEnded)==null?void 0:N.call(E,_)}});f.current=y;const R=y.start();return d.current=y.getPool(),()=>{R(),f.current=null,d.current=null}},[]),u.useEffect(()=>{var y,R,_,E,N;(y=f.current)==null||y.setActive(i),(_=(R=w.current).onActiveChange)==null||_.call(R,i),i>=l-2&&((N=(E=w.current).onEndReached)==null||N.call(E))},[i,l]),u.useEffect(()=>{var y;if(k.current){k.current=!1;return}(y=f.current)==null||y.setMuted(t)},[t]),u.useEffect(()=>{var y;(y=f.current)==null||y.setBlockPlayback(n)},[n]);const S=u.useCallback(()=>{var y;return((y=f.current)==null?void 0:y.getActiveCurrentTime())??0},[]),$=u.useMemo(()=>{var y;return br(((y=f.current)==null?void 0:y.getPlacement())??[])},[m,p]);return{poolRef:d,framedIndices:$,getActiveCurrentTime:S}}const Ir=3,Pr=5;function Rr({save:r,thresholdSeconds:e=Ir,reportInterval:t=Pr}){let n=null,s=-1,o=!1;const i=(a,d)=>d>0?Math.round(a/d*100):0,l=a=>
1s<0?!1:a===s?!0:a%t!==0,c=(a,d,f)=>{s=f,r(a.videoId,a.title,d,f,i(a.currentTime,a.duration))};return{sample(a){if(a.videoId!==n&&(n=a.videoId,s=-1,o=!1),a.currentTime<e){o=!1;return}const d=Math.floor(a.currentTime);if(a.isPlaying){l(d)||c(a,!0,d),o=!0;return}o&&c(a,!1,d),o=!1},reset(){n=null,s=-1,o=!1}}}const Er=1e3;function Cr({poolRef:r,videoListRef:e,save:t,updateLastVisit:n,intervalMs:s=Er}){u.useEffect(()=>{const o=t??de.saveWatchedVideo;(n??de.updateVideosLastVisit)();const l=Rr({save:o}),c=setInterval(()=>{const a=r.current,d=a==null?void 0:a.getActivePlayer();if(!a||!d)return;const f=e.current[a.getActiveIndex()],p=(f==null?void 0:f.ID)??(f==null?void 0:f.id);p!==void 0&&l.sample({videoId:p,title:(f==null?void 0:f.title)??"",isPlaying:d.isPlaying(),currentTime:d.getCurrentTime(),duration:d.getDuration()})},s);return()=>{clearInterval(c),l.reset()}},[])}function Mr({onChange:r,target:e=window,settleMs:t=160}){let n=null;const s=()=>{r(!0),n&&clearTimeout(n),n=setTimeout(()=>r(!1),t)};return{start(){return e.addEventListener("scroll",s,{passive:!0}),()=>{e.removeEventListener("scroll",s),n&&clearTimeout(n)}}}}function $r(r=160){const[e,t]=u.useState(!1);return u.useEffect(()=>Mr({onChange:t,settleMs:r}).start(),[r]),e}function Ar(r){const e=r;return!e||typeof e.tagName!="string"?!1:e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.isContentEditable===!0}function Br({onTogglePlay:r,onToggleMute:e,onClose:t,target:n=window}){const s=o=>{if(!(o.ctrlKey||o.metaKey||o.altKey||o.shiftKey)&&!Ar(o.target))switch(o.key){case" ":case"Spacebar":o.preventDefault(),r();break;case"m":case"M":e();break;case"Escape":t();break}};return{start(){return n.addEventListener("keydown",s),()=>n.removeEventListener("keydown",s)}}}function Nr({onTogglePlay:r,onToggleMute:e,onClose:t}){const n=u.useRef(r);n.current=r;const s=u.useRef(e);s.current=e;const o=u.useRef(t);o.current=t,u.useEffect(()=>Br({onTogglePlay:()=>n.current(),onToggleMute:()=>s.current(),onClose:()=>o.current()}).start(),[])}function jr(r,e=document){const t=e.activeElement;return r.focus(),()=>{t&&typeof t.focus=="function"&&e.contains(t)&&t.focus()}}function Fr(r){u.useEffect(()=>{const e=r.current;if(e)return jr(e)},[])}function me(r){const e=new Map;return t=>{let n=e.get(t);return n===void 0&&(n=r(t),e.set(t,n)),n}}const Lr="feed___U-anK",Dr="playerLayer___pdIU8",Or="active___vTy8X",Hr="wideLayer___F1n3U",Vr="navButtons___nPdMX",zr="navButton___IwjpF",H={feed:Lr,playerLayer:Dr,active:Or,wideLayer:Hr,navButtons:Vr,navButton:zr};function Ur(r){u.useEffect(()=>{ce(r)},[r]),u.useEffect(()=>()=>ce(!1),[])}function Wr(){const r=[...document.querySelectorAll('meta[name="theme-color"]')],e=r.map(n=>n.nextSibling);r.forEach(n=>n.remove());const t=document.createElement("meta");return t.setAttribute("name","theme-color"),t.setAttribute("content","#000000"),document.head.appendChild(t),()=>{t.remove(),r.forEach((n,s)=>{const o=e[s];o&&o.parentNode===document.head?document.head.insertBefore(n,o):document.head.appendChild(n)})}}function Yr(){const r=document.createElement("style");return r.textContent="body::before{display:none!important;content:none!important;}",document.head.appendChild(r),()=>r.remove()}function Kr(){const r=document.createElement("style");return r.textContent="html body{margin-top:0!important;}",document.head.appendChild(r),()=>r.remove()}const qr="data-immersive-keep",ye=`[${qr}]`;function Gr(r){const e=[],t=i=>i===r||i.contains(r),n=i=>{var l;i instanceof HTMLElement&&(i instanceof HTMLScriptElement||i instanceof HTMLStyleElement||i.tagName==="NOSCRIPT"||t(i)||i.matches(ye)||(l=i.querySelector)!=null&&l.call(i,ye)||getComputedStyle(i).display!=="none"&&(e.push({el:i,prevDisplay:i.style.getPropertyValue("display"),prevDisplayPriority:i.style.getPropertyPriority("display"),prevInert:i.hasAttribute("inert")}),i.style.setProperty("display","none","important"),i.setAttribute("inert","")))};let s=r;for(;s&&s.parentElement&&s!==document.body;){const i=s.parentElement;for(const l of Array.from(i.children))n(l);s=i}const o=new MutationObserver(i=>
1{for(const l of i)l.addedNodes.forEach(n)});return o.observe(document.body,{childList:!0}),()=>{o.disconnect(),e.forEach(({el:i,prevDisplay:l,prevDisplayPriority:c,prevInert:a})=>{l?i.style.setProperty("display",l,c):i.style.removeProperty("display"),a?i.setAttribute("inert",""):i.removeAttribute("inert")})}}function Xr(){const r=document.createElement("style");return r.textContent="html{scrollbar-width:none!important;}html::-webkit-scrollbar{display:none!important;}",document.head.appendChild(r),()=>r.remove()}function Jr(){const r=document.documentElement,e=document.body,t={htmlOverflow:r.style.overflow,htmlHeight:r.style.height,htmlSnap:r.style.scrollSnapType,htmlSnapPad:r.style.scrollPaddingTop,htmlOverscroll:r.style.overscrollBehaviorY,bodyOverflow:e.style.overflow,bodyHeight:e.style.height};return r.style.overflow="visible",r.style.height="auto",r.style.scrollSnapType="y mandatory",r.style.scrollPaddingTop="0px",r.style.overscrollBehaviorY="contain",e.style.overflow="visible",e.style.height="auto",()=>{r.style.overflow=t.htmlOverflow,r.style.height=t.htmlHeight,r.style.scrollSnapType=t.htmlSnap,r.style.scrollPaddingTop=t.htmlSnapPad,r.style.overscrollBehaviorY=t.htmlOverscroll,e.style.overflow=t.bodyOverflow,e.style.height=t.bodyHeight}}function Qr(r){const e=[Wr(),Yr(),Kr(),Gr(r),Xr(),Jr()];return()=>{for(let t=e.length-1;t>=0;t--)e[t]()}}const Zr="overlay___cKfaq",en="modal___5nGZJ",tn="title___NRDqL",rn="text___z-FSo",nn="acceptButton___-HxSH",on="manageButton___em9GF",sn="closeCookies___QnxvS",z={overlay:Zr,modal:en,title:tn,text:rn,acceptButton:nn,manageButton:on,closeCookies:sn};function an({isOpen:r,onClose:e}){u.useEffect(()=>{if(!r)return;const s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[r]);const t=()=>{window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(function(s){s.notice.hide(),s.setUserAgreeToAll()})},n=()=>{window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(function(s){s.notice.show()})};return r?h.jsx("div",{className:`${z.overlay} flex justify-center items-center has-default-theme--light`,children:h.jsxs("div",{className:z.modal,children:[h.jsx("div",{style:{position:"absolute",top:103,left:48,zIndex:2},children:h.jsx(Y,{name:"arrowhead-left",size:22,className:`${z.closeCookies} flex items-center justify-center`,"aria-label":"Fermer la modale",onClick:e})}),h.jsxs("div",{className:"flex flex-col items-center gap-300 text-center",children:[h.jsx("div",{className:"flex justify-center items-center mb-[18px]",children:h.jsx(ee,{name:"lock-open",size:64,color:"white"})}),h.jsx("h3",{className:`${z.title} text-left`,children:"Déverrouiller tout notre catalogue vidéo en un clic !"}),h.jsx("p",{className:`${z.text} text-left`,children:"Ce contenu est bloqué car vous n'avez pas accepté les cookies et autres traceurs. Ce contenu est fourni par YouTube. Pour pouvoir le visualiser, vous devez accepter l'usage étant opéré par YouTube avec vos données qui pourront être utilisées pour les finalités suivantes : vous permettre de voir la vidéo et de recevoir des contenus personnalisés."})]}),h.jsxs("div",{className:"flex flex-col gap-400 w-full mt-500",children:[h.jsx("button",{className:z.acceptButton,onClick:t,children:"J'accepte tout"}),h.jsx("button",{className:z.manageButton,onClick:n,children:"Gérer mes choix"})]})]})}):null}const ln="(min-width: 1200px)";function cn({videoList:r,initialIndex:e,autoplay:t=!0,muted:n,onToggleMute:s,onActiveChange:o,onEndReached:i,onClose:l,blockPlayback:c=!1,consentDenied:a=!1,onStaleRestore:d,onAutoMuted:f}){var ae;const p=u.useRef([]),v=u.useRef(null),m=u.useRef(null),g=u.useRef(null),w=u.useRef(null),k=u.useRef(r);k.current=r;const S=u.useRef({}),$=u.useRef(me(T=>b=>{b&&(p.current[T]=b)})).current,y=u.useRef(me(T=>b=>{b?S.current[T]=b:delete S.current[T]})).current,[R,_]=u.useState(!1),E=u.useRef(!1),N=$r(),{locked:q,disarm:P}=ur(p,e,d),x=lr(p,e,q),A=u.useRef(x);A.current=x;const[C,W]=u.useState([]),j=r[x],_e=Ne(ln),te=!!(j!=null&&j.has_wide_source&&(j!=null&&j.youtube_id))&&_e,[xe,re]=u.useState(null),[Te,Se]=u.useState(x);Te!==x&&(Se(x),re(null));const D=te&&(xe??!1),[Ie,ne]=u.useState(!1);
1Ur(D?Ie:!R),Fr(v),u.useEffect(()=>{var M;const T=v.current;if(!T)return;const b=Qr(T);return(M=p.current[e])==null||M.scrollIntoView({block:"start",behavior:"auto"}),b},[]);const{poolRef:O,framedIndices:Pe,getActiveCurrentTime:Re}=Sr({containers:[m,g,w],videoListRef:k,muted:n,blockPlayback:c,initialIndex:e,autoplay:t,active:x,listLength:r.length,callbacks:{getSectionTop:T=>{var b;return(b=p.current[T])==null?void 0:b.offsetTop},getProgressFill:T=>S.current[T]??null,onEnded:T=>{if(T!==A.current)return;const b=A.current+1,M=p.current[b];M&&(P(),M.scrollIntoView({block:"start",behavior:ue()?"auto":"smooth"}))},onAutoMuted:f,onActiveChange:o,onEndReached:i,onUnplayable:T=>W(b=>b.includes(T)?b:[...b,T])}});Cr({poolRef:O,videoListRef:k});const oe=u.useRef(0),G=u.useRef(null),Ee=u.useCallback(T=>{G.current=T},[]),Ce=u.useCallback(()=>{var M;const T=!D,b=(M=O.current)==null?void 0:M.getActivePlayer();T?(oe.current=(b==null?void 0:b.getCurrentTime())??0,G.current=null):b&&G.current!=null&&b.seekTo(G.current),re(T)},[D,O]);u.useEffect(()=>{var b,M;const T=O.current;T&&(D?(T.setUserPaused(!0),(b=T.getActivePlayer())==null||b.pause()):(T.setUserPaused(!1),(M=T.getActivePlayer())==null||M.play(),ne(!1)))},[D,O]);const se=u.useCallback(()=>{var M,le;const T=(M=O.current)==null?void 0:M.getActivePlayer();if(!T)return;const b=!E.current;E.current=b,b?(T.pause(),_(!0)):(T.play(),_(!1)),(le=O.current)==null||le.setUserPaused(b)},[O]);Nr({onTogglePlay:se,onToggleMute:s,onClose:l}),u.useEffect(()=>{E.current=!1,_(!1)},[x]);const Me=2,ie=u.useCallback(T=>{const b=p.current[T];b&&(P(),b.scrollIntoView({block:"start",behavior:ue()?"auto":"smooth"}))},[P]);return h.jsxs("div",{ref:v,"data-video-layer":"scroll-root","data-feed-wide":D?"":void 0,className:H.feed,role:"dialog","aria-modal":"true","aria-label":"Lecteur vidéo",tabIndex:-1,children:[h.jsx(ar,{video:r[x]}),r.map((T,b)=>{const M=Math.abs(b-x)<=Me;return h.jsx(nt,{ref:$(b),video:T,index:b,posterHidden:Pe.has(b),unavailable:C.includes(b),placeholder:!M,eager:Math.abs(b-x)<=1,progressFillRef:y(b)},T.ID??T.id??b)}),h.jsx("div",{ref:m,"data-video-layer":"player-slot","data-slot":"0",className:`${H.playerLayer} ${H.active}`}),h.jsx("div",{ref:g,"data-video-layer":"player-slot","data-slot":"1",className:H.playerLayer}),h.jsx("div",{ref:w,"data-video-layer":"player-slot","data-slot":"2",className:H.playerLayer}),D&&(j==null?void 0:j.youtube_id)&&h.jsx("div",{className:H.wideLayer,"data-video-layer":"wide-player",style:{top:((ae=p.current[x])==null?void 0:ae.offsetTop)??0},children:h.jsx(rr,{youtubeId:j.youtube_id,startAt:oe.current,muted:n,blockPlayback:c,onTime:Ee,onPlayingChange:ne})}),h.jsx(Zt,{video:r[x],isPlaying:!R,muted:n,onToggleMute:s,getCurrentTime:Re,scrolling:N,wide:D,canWide:te,isWide:D,onToggleWide:Ce,onTogglePlay:se,onSeekBy:T=>{var M;const b=(M=O.current)==null?void 0:M.getActivePlayer();b&&b.seekTo(Math.max(0,Math.min(b.getDuration(),b.getCurrentTime()+T)))},onClose:l}),h.jsxs("div",{className:H.navButtons,children:[h.jsx(Y,{name:"caret-up",size:32,color:"inherit",ariaLabel:"Vidéo précédente",disabled:x<=0,onClick:()=>ie(x-1),className:H.navButton}),h.jsx(Y,{name:"caret-down",size:32,color:"inherit",ariaLabel:"Vidéo suivante",disabled:x>=r.length-1,onClick:()=>ie(x+1),className:H.navButton})]}),a&&h.jsx(an,{isOpen:!0,onClose:l})]})}const be="optimus_video_muted";let U=null;function un(r){U=r;try{sessionStorage.setItem(be,r?"1":"0"),L(`[muteMemory] write muted=${r}`)}catch{L(`[muteMemory] write muted=${r} (storage unavailable, cache only)`)}}function Z(r=!0){if(U!==null)return L(`[muteMemory] recall → ${U} (cache)`),U;try{const e=sessionStorage.getItem(be);if(e!==null)return U=e==="1",L(`[muteMemory] recall → ${U} (storage)`),U}catch{}return L(`[muteMemory] recall → ${r} (default, nothing stored)`),r}function dn(r){return{blockPlayback:r!==!0,consentDenied:r===!1}}const fn="cookies";function hn(r){return(r.getUserStatus().purposes.consent.enabled||[]).includes(fn)}function mn({onConsent:r,target:e=window}){let t=!0,n=null,s=null;const o=i=>{t&&(n=i,s=()=>{t&&r(hn(i))},s(),i.on("consent.changed",s))};return e.didomiOnReady=e.didomiOnReady||[],e.didomiOnReady.push(o),()=>{t=!1;const i=e.didomiOnReady;if(Array.isArray(i)){const l=i.indexOf(o);l!==-1&&i.splice(l,1)}n!=null&&n.off&&s&&n.off("consent.changed",s)}}function yn(){const[r,e]=u.useState(null);return u.useEffect(()=>{if(!(typeof window>"u"))return mn({onConsent:e})},[]),{hasConsent:r,...dn(r)}}const J=r=>Number(r.ID??r.id);function pn(r,e){const t=new Set(r.map(J).filter(s=>!Number.isNaN(s))),n=e.filter(s=>{const o=J(s);return Number.isNaN(o)||!t.has(o)});return n.length?[...r,...n]:r}function vn(r,e=10){return r<e?null:Math.floor(r/e)+1}const ke="/actualites";function gn({hasExit:r,isStandalonePage:e,hasSiteHistory:t}){return r?{type:"exit"}:e?t?{type:"back"}:{type:"redirect",href:ke}:{type:"clear"}}function wn(){if(typeof document>"u"||!document.referrer)return!1;try{return new URL(document.referrer).origin===window.location.origin}catch{return!1}}function In({initialVideoId:r=null,initialVideos:e=null,isStandalonePage:t=!1,autoplay:n=!0,onExit:s}){const[o,i]=u.useState(r),[l,c]=u.useState(()=>Array.isArray(e)?e:[]),a=u.useRef(null),d=u.useRef(!1),[f,p]=u.useState(r);f!==r&&(p(r),i(r)),u.useEffect(()=>{if(Array.isArray(e)&&e.length>0){c(e);const P=10,x=vn(e.length,P);a.current=x?`/op-api/videos?page=${x}&per_page=${P}`:null}},[e]);const v=async(P="/op-api/videos")=>{var x;if(!d.current){d.current=!0;try{const C=await(await fetch(P)).json(),W=Array.isArray(C==null?void 0:C.videos)?C.videos:[];W.length&&c(j=>pn(j,W)),a.current=((x=C==null?void 0:C.pagination)==null?void 0:x.next)??null}catch(A){console.error("Erreur fetch",A)}finally{d.current=!1}}};u.useEffect(()=>{(!Array.isArray(e)||e.length===0)&&v()},[]);const m=u.useCallback(()=>{const P=gn({hasExit:!!s,isStandalonePage:t,hasSiteHistory:wn()});switch(P.type){case"exit":s==null||s();return;case"back":if(window.history.length<=1){window.location.href=ke;return}window.history.back();return;case"redirect":window.location.href=P.href;return;case"clear":i(null);return}},[s,t]),g=o!==null?l.findIndex(P=>J(P)===Number(o)):-1,w=u.useCallback(P=>{c(x=>{const A=o!==null?x.findIndex(W=>J(W)===Number(o)):-1;if(A<0||A===P||P<0||P>=x.length)return x;const C=[...x];return[C[A],C[P]]=[C[P],C[A]],C})},[o]),k=u.useCallback(P=>{if(!t)return;const x=l[P];x!=null&&x.permalink&&window.history.replaceState(null,"",x.permalink)},[t,l]),S=u.useCallback(()=>{a.current&&v(a.current)},[]),{blockPlayback:$,consentDenied:y}=yn(),[R,_]=u.useState(()=>Z(!0)),E=u.useCallback(()=>{_(P=>{const x=!P;return un(x),x})},[]),N=u.useCallback(()=>_(!0),[]),q=u.useRef(R);return q.current=R,u.useEffect(()=>{if(Z(!0))return;const P=["pointerdown","touchstart","keydown"],x=()=>P.forEach(C=>window.removeEventListener(C,A)),A=()=>{if(Z(!0)){x();return}q.current&&(_(!1),x())};return P.forEach(C=>window.addEventListener(C,A,{passive:!0})),x},[]),h.jsx(h.Fragment,{children:g>
1=0&&h.jsx(cn,{videoList:l,initialIndex:g,autoplay:n,muted:R,onToggleMute:E,onActiveChange:k,onEndReached:S,onClose:m,blockPlayback:$,consentDenied:y,onStaleRestore:w,onAutoMuted:N})})}export{In as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.