1import{a6 as we,u as ke,y as ze,a7 as Fe,a as Se,b as Ce,r as d,c as re,d as _e,j as e,L as a,a8 as Ne,p as Ie,a9 as le,F as M,q as v,E as Le,B as q,X as Re,n as Be,t as de,s as D}from"./index-BJijipAU.js";import{r as c,n as ce,s as Te}from"./locale-CY-vkBv4.js";import{L as We}from"./LessonGate-D9b8bGEm.js";import{F as Me}from"./FloatingAccessButton-mtJ6DCIJ.js";import{C as pe}from"./circle-play-Cf6cLXb6.js";import{P as me}from"./play-zQpGLCq7.js";import{D as qe}from"./download-CghP3LF1.js";import{E as De}from"./external-link-DyAUzYp3.js";import"./i18n-DlcS6BNz.js";import"./index-paNpr7jU.js";import"./useRequestAccess-XovFMKjC.js";import"./circle-alert-Cq4_nmop.js";const He="https://s3.eu-central-003.backblazeb2.com/maxskills-dev";function u(n){return n?n.startsWith("http")?n:`${He}/${n}`:""}function Je(){const{slug:n,chapitreId:y}=we(),{t:s,i18n:r}=ke("lms"),ge=ze(),{pathname:xe}=Fe(),he=xe.startsWith("/public/")?"/public/formations":"/formations",S=Se(),ue=!!Ce(t=>t.userId),[p,H]=d.useState(null),[C,P]=d.useState(null),[E,_]=d.useState(!1),[,$]=d.useState(!1),[A,K]=d.useState(!1),[j,V]=d.useState(!1),{data:O,isLoading:fe}=re({queryKey:["chapitre",y],queryFn:()=>D.get(`/api/v1/formations/${n}/chapitres/${y}`).then(t=>t.data),enabled:!!y&&!!n}),{data:Q,isLoading:m}=re({queryKey:["lesson",p],queryFn:()=>D.get(`/api/v1/lessons/${p}`).then(t=>t.data),enabled:!!p}),x=_e({mutationFn:()=>D.post(`/api/v1/lessons/${p}/complete`),onSuccess:()=>{de.success(s("lessons.marked_complete")),S.invalidateQueries({queryKey:["lesson",p]}),S.invalidateQueries({queryKey:["chapitre",y]}),S.invalidateQueries({queryKey:["my-progress"]})},onError:()=>de.error(s("common.error"))}),l=O?.data??O??{},f=l.lessons??[],be=c(l.title,r.language),G=c(l.description,r.language),h=l.cover_img??l.thumbnail_img,U=f.filter(t=>t.completed).length,N=f.length,I=f.reduce((t,i)=>t+(i.video_duration_seconds??0),0),X=Math.floor(I/60),Y=I%60,g=Q?.data??Q??null,o=g??C??null,J=o?c(o.title,r.language):"",L=g?c(g.description,r.language):"",R=g?.links??[],Z=g?.files??[],w=g?.completed??!1,ee=o?.type_lesson==="projet",B=!!o?.video_provider,k=o?.image;function ve(t,i,b){i||(H(t),P(b),_(!1),$(!1),V(!1))}function te(){const t=g??C,i=!!(t?.completed||w),b=!!t?.is_public,F=!!t?.is_intro;if(!i&&ue&&!b&&!F&&!j){K(!0);return}z()}function z(){H(null),P(null),_(!1),$(!1),K(!1)}function ye(){const t=document.querySelector(".v1-lesson-modal");(t?.querySelector("video, iframe")??t)?.requestFullscreen?.()}const[je,T]=d.useState(!1);return d.useEffect(()=>{if(!h){T(!0);return}const t=new window.Image;return t.onload=()=>T(!0),t.onerror=()=>T(!0),t.src=u(h),()=>{t.onload=null,t.onerror=null}},[h]),fe?e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#010211"},children:e.jsx(a,{className:"h-8 w-8 animate-spin",style:{color:"#F8994F"}})}):e.jsxs("div",{className:"-mx-6 -mt-6",style:{minHeight:"100vh",background:"#010211",color:"#fff",fontFamily:"'Inter',sans-serif"},children:[e.jsxs("div",{className:"chapitre-hero",style:{position:"relative",backgroundImage:h?`url('${u(h)}')`:void 0,backgroundSize:"cover",backgroundPosition:"top center",backgroundRepeat:"no-repeat",backgroundColor:"#000"},children:[!je&&h&&e.jsx("div",{className:"animate-pulse",style:{position:"absolute",inset:0,background:"#1e1f25",zIndex:0}}),e.jsx("div",{style:{position:"absolute",inset:0,zIndex:0,background:"linear-gradient(to bottom, rgba(0,0,0,0.50) 0%, rgba(1,2,17,0.88) 80%, #010211 100%)",pointerEvents:"none"}}),e.jsx("div",{className:"chapitre-hero-content",style:{position:"relative",zIndex:1,padding:"260px 5% 80px"},children:e.jsxs("div",{className:"chapitre-hero-text",style:{flex:1,minWidth:0},children:[l.is_fire_chapitre&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"6px 14px",borderRadius:"9999px",background:"linear-gradient(135deg, rgba(255,30,0,0.3) 0%, rgba(255,106,0,0.25) 50%, rgba(255,183,0,0.2) 100%)",border:"1px solid rgba(255,140,0,0.5)",boxShadow:"0 0 20px rgba(255,80,0,0.35)",marginBottom:"14px"},children:[e.jsx(Ne,{size:15,color:"#FFB700",style:{fill:"#FFB700"}}),e.jsx("span",{style:{fontSize:"11.5px",fontWeight:800,textTransform:"uppercase",letterSpacing:"0.5px",color:"#FFD275"},children:"Chapitre En Feu ð¥ â Essentiel"})]}),e.jsx("h1",{style:{fontSize:"2rem",fontWeight:"bold",marginBottom:12,lineHeight:1.3},children:be}),G&&e.jsx("p",{style:{fontSize:"88%",color:"#f5f5f59e",fontWeight:300,marginBottom:12,lineHeight:1.6},dangerouslySetInnerHTML:{__html:ce(G)}}),I>0&&e.jsxs("p",{style:{fontSize:"88%",color:"#f5f5f59e",fontWeight:300,display:"flex",alignItems:"center",gap:8},children:[e.jsx(Ie,{size:16,color:"#F8994F"}),X>0&&e.jsxs("span",{children:[X,"min"]}),Y>0&&e.jsxs("span",{children:[Y,"sec"]})]})]})})]}),e.jsxs("div",{className:"lesson-list-wrap",style:{width:"100%",padding:"0 20px",boxSizing:"border-box"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:20,padding:"20px 0",background:"#010211",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:"bold",textDecoration:"underline",textDecorationColor:"#F8994F",textUnderlineOffset:4,color:"#FF9900"},children:s("lessons.title")||"Leçons"}),n&&e.jsx("span",{style:{color:"#888",cursor:"pointer"},onClick:()=>ge(`${he}/${n}`),children:s("chapters.more_tutorials")||"Plus de tutoriel"}),N>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,width:"100%",justifyContent:"center"},children:[e.jsx("div",{style:{width:192,height:6,background:"rgba(255,255,255,0.1)",borderRadius:99,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",background:"#F8994F",borderRadius:99,width:`${Math.round(U/N*100)}%`}})}),e.jsxs("span",{style:{fontSize:12,color:"rgba(255,255,255,0.4)"},children:[U,"/",N]})]})]}),e.jsx("div",{style:{width:"100%",paddingBottom:"5%",boxSizing:"border-box"},children:f.length===0?e.jsx("p",{style:{textAlign:"center",padding:"48px 0",color:"rgba(255,255,255,0.3)"},children:s("chapters.no_lessons")}):e.jsx("div",{children:f.map(t=>{const i=t.is_locked??!1,b=t.completed??!1,F=t.type_lesson==="projet",se=c(t.title,r.language),ne=c(t.description,r.language),ie=t.image,W=t.video_duration_seconds??0,oe=Math.floor(W/60),ae=W%60;return e.jsxs("div",{onClick:()=>ve(String(t.id),i,t),className:"lesson-card",style:{display:"flex",flexDirection:"row",alignItems:"stretch",opacity:i?.5:1,cursor:i?"not-allowed":"pointer",marginBottom:14,gap:14,width:"100%"},children:[e.jsx("div",{className:"lesson-card-img",style:{flexShrink:0,width:280,minHeight:185,borderRadius:12,overflow:"hidden",background:"#111",position:"relative",display:"grid"},children:ie?e.jsx(le,{src:u(ie),alt:se,style:{display:"block",width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:F?e.jsx(M,{size:40,color:"rgba(96,165,250,0.5)"}):e.jsx(pe,{size:40,color:"rgba(255,255,255,0.2)"})})}),e.jsxs("div",{className:"chapitre-card-hover",style:{flex:1,minWidth:0,borderRadius:12,padding:"14px 16px",display:"flex",flexDirection:"column",transition:"box-shadow .2s"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",ga
1p:6,marginBottom:6},children:[e.jsx("p",{style:{fontWeight:"bold",fontSize:20,flex:1,lineHeight:1.4,margin:0},children:se}),b&&e.jsx(v,{size:16,color:"#4ade80",style:{flexShrink:0,marginTop:2}}),i&&e.jsx(Le,{size:16,color:"rgba(255,255,255,0.3)",style:{flexShrink:0,marginTop:2}})]}),W>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,marginBottom:6},children:[e.jsx(pe,{size:13,color:"#F8994F"}),oe>0&&e.jsxs("span",{style:{fontSize:13,color:"rgba(255,255,255,0.55)"},children:[oe,"min"]}),ae>0&&e.jsxs("span",{style:{fontSize:13,color:"rgba(255,255,255,0.55)"},children:[ae,"sec."]})]}),ne&&e.jsx("p",{style:{fontSize:14,color:"rgba(255,255,255,0.6)",lineHeight:1.7,margin:0,overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical"},children:Te(ne)}),e.jsxs("div",{style:{display:"flex",gap:5,marginTop:"auto",paddingTop:8,flexWrap:"wrap"},children:[t.is_intro&&e.jsx(q,{variant:"outline",className:"border-[#F8994F]/30 text-[#F8994F]/80 text-[10px]",children:s("lessons.intro")}),F&&e.jsx(q,{variant:"outline",className:"border-blue-500/30 text-blue-400 text-[10px]",children:s("lessons.type_projet")})]})]})]},t.id)})})})]}),p&&!A&&e.jsx("div",{style:{position:"fixed",inset:0,zIndex:1050,background:"rgba(0,0,0,0.80)",display:"flex",alignItems:"center",justifyContent:"center",overflowY:"auto",padding:16},onClick:t=>{t.target===t.currentTarget&&te()},children:e.jsxs("div",{style:{position:"relative",background:"#010211",boxShadow:"0px 4px 38px 0px #F8994F0A",borderRadius:25,width:"40%",maxWidth:700,minWidth:320,overflow:"hidden",margin:"auto"},children:[e.jsx("button",{onClick:te,style:{position:"absolute",top:12,right:12,zIndex:10,background:"rgba(0,0,0,0.55)",border:"none",borderRadius:"50%",width:34,height:34,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",cursor:"pointer"},children:e.jsx(Re,{size:18})}),e.jsx("div",{className:"v1-lesson-modal",style:{position:"relative",width:"100%",aspectRatio:"16/9",background:"#000",borderTopLeftRadius:25,borderTopRightRadius:25,overflow:"hidden",display:"flex",alignItems:"stretch"},children:m&&!C?e.jsx(a,{size:36,color:"#F8994F",className:"animate-spin"}):B&&!j?p&&o?.id?e.jsx(We,{lessonId:o.id,formationSlug:o.chapitre?.formation?.slug??n??"",isPublic:o.is_public??!1,videoSrc:o.video_src,lessonImg:k?u(k):null,onNoVideo:()=>V(!0)}):e.jsx(a,{size:36,color:"#F8994F",className:"animate-spin"}):k?e.jsx(le,{src:u(k),alt:J,style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:ee?e.jsx(M,{size:56,color:"rgba(96,165,250,0.35)"}):e.jsx(me,{size:56,color:"rgba(255,255,255,0.15)"})})}),e.jsxs("div",{style:{padding:"30px 53px 40px 53px"},children:[e.jsx("h4",{style:{fontSize:20,fontWeight:"bold",marginTop:10,marginBottom:17,color:"#fff"},children:J||e.jsx("span",{style:{color:"rgba(255,255,255,0.3)"},children:"â¦"})}),w&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#4ade80",fontSize:13,marginBottom:10},children:[e.jsx(v,{size:15})," ",s("lessons.completed")]}),ee&&e.jsxs(q,{variant:"outline",className:"border-blue-500/30 text-blue-400 text-xs capitalize",style:{marginBottom:14},children:[e.jsx(M,{size:12,style:{marginRight:4}})," ",s("lessons.type_projet")]}),B&&!j&&e.jsxs("button",{className:"v1-btn v1-btn-white",style:{width:"100%",marginBottom:16},onClick:ye,disabled:m,children:[m?e.jsx(a,{size:14,className:"animate-spin",style:{marginRight:10}}):e.jsx(me,{size:14,style:{marginRight:10}}),m?s("common.loading")||"Chargementâ¦":s("lessons.play_video")||"Lire la vidéo"]}),m&&!L?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"12px 0"},children:e.jsx(a,{size:20,color:"#F8994F",className:"animate-spin"})}):L?e.jsx("p",{style:{color:"#F5F5F5",fontSize:14,lineHeight:1.7,marginBottom:20},dangerouslySetInnerHTML:{__html:ce(L)}}):null,(m||Z.length>0||R.length>0||!w)&&e.jsx("div",{className:"v1-modal-btns",children:m?e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"v1-btn v1-btn-white",disabled:!0,style:{flex:1},children:[e.jsx(a,{size:14,className:"animate-spin",style:{marginRight:10}}),s("common.loading")||"Chargementâ¦"]}),e.jsxs("button",{className:"v1-btn v1-btn-dark",disabled:!0,style:{flex:1},children:[e.jsx(a,{size:14,className:"animate-spin",style:{marginRight:10}}),s("common.loading")||"Chargementâ¦"]}),e.jsxs("button",{className:"v1-btn v1-btn-green",disabled:!0,style:{flex:1},children:[e.jsx(a,{size:14,className:"animate-spin",style:{marginRight:10}}),s("common.loading")||"Chargementâ¦"]})]}):e.jsxs(e.Fragment,{children:[Z.map(t=>e.jsxs("a",{href:u(t.file_path),target:"_blank",rel:"noopener noreferrer",className:"v1-btn v1-btn-white",children:[e.jsx(qe,{size:14,style:{marginRight:10}}),c(t.label,r.language)||s("lessons.download_source")||"Télécharger la source"]},t.id)),R.length>0&&e.jsxs("div",{className:`v1-links-dropdown${E?" open":""}`,children:[e.jsxs("button",{className:"v1-btn v1-btn-dark v1-links-toggle",onClick:()=>_(!E),children:[s("lessons.links_to_consult")||"Liens à consulter",e.jsx(Be,{size:14,className:"v1-dropdown-arrow",style:{marginLeft:8}})]}),e.jsx("div",{className:"v1-links-menu",children:R.map(t=>e.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"v1-links-item",children:[e.jsx(De,{size:14}),c(t.label,r.language)||t.url]},t.id))})]}),!w&&!(B&&j)&&e.jsxs("button",{className:"v1-btn v1-btn-green",onClick:()=>x.mutate(),disabled:x.isPending,children:[x.isPending?e.jsx(a,{size:14,className:"animate-spin",style:{marginRight:10}}):e.jsx(v,{size:14,style:{marginRight:10}}),s("lessons.mark_complete")||"Marquer comme Terminé"]})]})})]})]})}),A&&e.jsx("div",{style:{position:"fixed",inset:0,zIndex:1100,background:"rgba(0,0,0,0.85)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},onClick:t=>{t.target===t.currentTarget&&z()},children:e.jsxs("div",{style:{background:"#0d0e1a",borderRadius:20,padding:"32px 28px",maxWidth:380,width:"100%",border:"1px solid rgba(255,255,255,0.08)",boxShadow:"0 8px 32px rgba(0,0,0,0.6)",textAlign:"center"},children:[e.jsx(v,{size:40,color:"#F8994F",style:{margin:"0 auto 16px"}}),e.jsx("h3",{style:{fontSize:18,fontWeight:"bold",color:"#fff",marginBottom:8},children:s("lessons.confirm_complete_title")}),e.jsx("p",{style:{fontSize:14,color:"rgba(255,255,255,0.55)",marginBottom:24,lineHeight:1.5},children:s("lessons.confirm_complete_message")}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsxs("button",{className:"v1-btn v1-btn-green",style:{flex:1},disabled:x.isPending,onClick:()=>{x.mutate(void 0,{onSuccess:()=>z()})},children:[x.isPending?e.jsx(a,{size:14,className:"animate-spin",style:{marginRight:8}}):e.jsx(v,{size:14,style:{marginRight:8}}),s("lessons.confirm_yes")]}),e.jsx("button",{className:"v1-btn v1-btn-dark",style:{flex:1},onClick:z,children:s("lessons.confirm_no")})]})]})}),l?.formation_id&&n&&e.jsx(Me,{formationId:l.formation_id,formationSlug:n}),e.jsx("style",{children:` 2 /* ââ Lesson card: mobile â stack vertically (img on top, details below) ââ */ 3 @media (max-width: 640px) { 4 .lesson-card { flex-direction: column !important; margin-bottom: 20px !important; gap: 0 !important; align-items: stretch !important; } 5 .lesson-card-img { width: 100% !important; height: 200px !important; min-height: unset !important; border-radius: 12px 12px 0 0 !important; position: relative !important; } 6 .lesson-card > div:last-child { border-radius: 0 0 12px 12px !important; } 7 } 8 9 /* ââ V1 pill buttons ââ */ 10 .v1-btn { 11 border-radius: 50px; 12 height: 38px; 13 font-size: 14px; 14 font-weight: 600; 15 display: inline-flex; 16 align-items: center; 17 justify-content: center; 18 padding: 7px 24px; 19 white-space: nowrap; 20 cursor: pointer; 21 text-decoration: none; 22 border: none; 23 transition: background-color .3s, transform .2s; 24 } 25 .v1-btn:disabled { opacity: .6;
25 cursor: not-allowed; } 26 .v1-btn-white { 27 background: white; 28 box-shadow: 0px 0px 24px -10px rgba(248,153,79,0.57); 29 color: #black; 30 } 31 .v1-btn-orange { 32 background: radial-gradient(141.42% 141.42% at 0% 0%, rgba(248,153,79,0.57) 0%, rgba(255,255,255,0) 100%); 33 box-shadow: 0px 0px 24px -10px rgba(248,153,79,0.57); 34 color: #fff; 35 } 36 .v1-btn-orange:hover { 37 background: radial-gradient(141.42% 141.42% at 0% 0%, rgba(248,153,79,0.75) 0%, rgba(255,255,255,0) 100%); 38 } 39 .v1-btn-gradient { 40 background: radial-gradient(141.42% 141.42% at 0% 0%, rgba(248,153,79,0.57) 0%, rgba(255,255,255,0) 100%); 41 box-shadow: 0px 0px 24px -10px rgba(248,153,79,0.57); 42 color: #fff; 43 font-weight: bold; 44 } 45 .v1-btn-white { background: #fff; color: #000; border: 1px solid #ccc !important; } 46 .v1-btn-white:hover { background: #f0f0f0; } 47 .v1-btn-dark { background: #010211; color: #fff; border: 1px solid #fff !important; } 48 .v1-btn-dark:hover { background: rgba(255,255,255,0.08); } 49 .v1-btn-green { background: #16a34a; color: #fff; } 50 .v1-btn-green:hover { background: #15803d; } 51 52 /* ââ Modal buttons row ââ */ 53 .v1-modal-btns { 54 display: flex; 55 flex-wrap: wrap; 56 gap: 10px; 57 align-items: center; 58 width: 100%; 59 } 60 .v1-modal-btns > *, 61 .v1-modal-btns .v1-links-dropdown { flex-grow: 1; flex-basis: 100px; } 62 63 /* ââ Links dropdown (opens upward) ââ */ 64 .v1-links-dropdown { position: relative; } 65 .v1-links-toggle { 66 background: #010211 !important; 67 color: #fff !important; 68 border: 1px solid #fff !important; 69 border-radius: 50px !important; 70 height: 38px !important; 71 display: inline-flex !important; 72 align-items: center !important; 73 justify-content: center !important; 74 width: 100%; 75 gap: 8px; 76 } 77 .v1-dropdown-arrow { transition: transform .3s; } 78 .v1-links-dropdown.open .v1-dropdown-arrow { transform: rotate(180deg); } 79 .v1-links-menu { 80 display: none; 81 position: absolute; 82 bottom: 100%; 83 left: 0; 84 margin-bottom: 10px; 85 background: #010211; 86 border: 1px solid rgba(255,255,255,0.5); 87 border-radius: 16px; 88 box-shadow: 0 10px 30px rgba(0,0,0,0.5); 89 width: 260px; 90 z-index: 1056; 91 padding: 10px; 92 } 93 .v1-links-dropdown.open .v1-links-menu { display: block; } 94 .v1-links-item { 95 display: flex; 96 align-items: center; 97 gap: 12px; 98 padding: 12px 15px; 99 color: #e0e0e0; 100 text-decoration: none; 101 border-radius: 8px; 102 transition: background .2s, color .2s; 103 font-size: 15px; 104 font-weight: 500; 105 } 106 .v1-links-item:hover { background: rgba(248,153,79,0.15); color: #fff; } 107 108 /* ââ Video inside modal fills the aspect-ratio container ââ */ 109 .v1-lesson-modal > *, 110 .v1-lesson-modal > * > * { width: 100% !important; height: 100% !important; aspect-ratio: unset !important; } 111 .v1-lesson-modal .plyr, 112 .v1-lesson-modal .plyr--video, 113 .v1-lesson-modal .plyr__video-wrapper, 114 .v1-lesson-modal video, 115 .v1-lesson-modal iframe { width: 100% !important; height: 100% !important; aspect-ratio: unset !important; } 116 117 /* ââ Mobile ââ */ 118 @media (max-width: 768px) { 119 .v1-modal-dialog-inner { width: 95% !important; min-width: unset !important; } 120 121 /* Hero: compact on small screens */ 122 .chapitre-hero-content { 123 padding: 32px 16px !important; 124 } 125 } 126 @media (min-width: 769px) { 127 .chapitre-hero-text { 128 padding-left: 1%; 129 padding-right: 25%; 130 } 131 .lesson-list-wrap { 132 padding-left: 13% !important; 133 padding-right: 13% !important; 134 } 135 } 136 @media (max-width: 576px) { 137 .v1-modal-btns > *, 138 .v1-modal-btns .v1-links-dropdown { flex-basis: 100%; width: 100%; } 139 } 140 `})]})}
140export{Je 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.