1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3505,48982],{3505:(e,t,o)=>{o.r(t),o.d(t,{VideoLesson:()=>V});var i=o(54568),r=o(7620),n=o(89099),s=o(37257),l=o(8988),a=o(98342),d=o(41606),c=o(62315),u=o(95953),h=o(54001),p=o(27061),g=o(61698),m=o(1434),f=o(39015);let x=l.styled.div.withConfig({componentId:"sc-8be1b5aa-0"})(["display:flex;align-items:center;gap:16px;width:100%;margin:0 0 20px;","{flex-direction:column;align-items:stretch;}"],(0,m.down)("md")),b=l.styled.div.withConfig({componentId:"sc-8be1b5aa-1"})(["position:relative;width:100%;padding-top:56.25%;background:",";border-radius:20px;overflow:hidden;transform:translate3d(0,0,0);margin:0 0 30px;","{margin:0 0 24px;}& > *{position:absolute !important;top:0;bottom:0;right:0;left:0;}","{border-radius:40px;}","{border-radius:14px;}",""],({pending:e})=>e?"#f0f0f0":"#0b0b0a",(0,m.down)("md"),(0,m.down)("md"),(0,m.down)("sm"),({pending:e})=>e?`${f.iM}`:"");l.styled.iframe.withConfig({componentId:"sc-8be1b5aa-2"})(["position:absolute;top:0;left:0;width:100%;height:100%;max-width:100%;"]),l.styled.span.withConfig({componentId:"sc-8be1b5aa-3"})(["color:",";"],e=>e.theme.color.foreground[100]),l.styled.p.withConfig({componentId:"sc-8be1b5aa-4"})(["margin:0;font-weight:400;font-size:18px;line-height:32px;color:",";a{color:",";font-weight:400;&:hover{color:"," !important;}}","{font-size:14px;}"],e=>e.theme.color.foreground[100],e=>e.theme.color.link[100],e=>e.theme.color.link[50],(0,m.down)("md"));let v=l.styled.div.withConfig({componentId:"sc-8be1b5aa-5"})(["display:flex;align-items:flex-start;gap:60px;flex-wrap:wrap;"]),w=l.styled.p.withConfig({componentId:"sc-8be1b5aa-6"})(["margin:0 0 28px 0;font-weight:500;font-size:24px;color:",";","{font-size:16px;}"],e=>e.theme.color.foreground[100],(0,m.down)("md")),y=l.styled.div.withConfig({componentId:"sc-8be1b5aa-7"})(["display:flex;align-items:center;max-width:100%;"]),j=l.styled.div.withConfig({componentId:"sc-8be1b5aa-8"})(["display:flex;flex-direction:column;justify-content:center;flex-shrink:1;gap:6px;max-width:calc(100% - 76px);","{max-width:calc(100% - 60px);}"],(0,m.down)("md")),C=l.styled.p.withConfig({componentId:"sc-8be1b5aa-9"})(["display:block;font-weight:400;font-size:14px;margin:0;color:",";overflow:hidden;text-overflow:ellipsis;max-width:calc(100%);"],e=>e.theme.color.foreground[100]),_=l.styled.p.withConfig({componentId:"sc-8be1b5aa-10"})(["font-weight:400;font-size:12px;margin:0;color:",";"],e=>e.theme.color.foreground[60]),k=l.styled.a.withConfig({componentId:"sc-8be1b5aa-11"})(["display:flex;align-items:center;justify-content:center;flex-shrink:0;border:none;cursor:pointer;border-radius:14px;width:60px;height:60px;margin-right:16px;color:",";background-color:#e8e8e8;&:hover{background-color:",";}&:focus{background-color:",";}&:active{background-color:",";}svg{font-size:26px;fill:",";","{font-size:19px;}}","{width:44px;height:44px;}"],e=>e.theme.color.foreground[60],e=>e.theme.color.background[80],e=>e.theme.control.secondary,e=>e.theme.control.secondary,e=>e.theme.color.foreground[100],(0,m.down)("md"),(0,m.down)("md"));var I=o(84418),S=o(62636),M=o(42453),T=o(50899);(0,c.d)(["videolesson","filetype"]);let z=({attachments:e})=>{let{t}=(0,c.B)();return e.length?(0,i.jsxs)(d.TextLayer,{children:[(0,i.jsx)(w,{children:t("videolesson:materials")}),(0,i.jsx)(v,{children:e.map(e=>(0,i.jsxs)(y,{children:[(0,i.jsx)(k,{href:e.file_url,download:!0,target:"_blank",rel:"noopener",children:(0,i.jsx)(u.n3C,{})}),(0,i.jsxs)(j,{children:[(0,i.jsx)(C,{children:e.original_file_name||e.title}),(0,i.jsx)(_,{children:`${((e,t)=>t?e===T.pt.image?t("filetype:image"):e===T.pt.document?t("filetype:document"):e===T.pt.audio?t("filetype:audio"):"":"")(e.file_type,t)}, ${(e=>!!e&&Math.round(((e=e/1024/1024)+Number.EPSILON)*100)/100)(e.file_size)} Mb`})]})]},e.id))})]}):null};var L=o(11559);let B=l.styled.iframe.withConfig({componentId:"sc-9b035362-0"})(["position:absolute;top:0;left:0;width:100%;height:100%;max-width:100%;"]),N=({videoLesson:e})=>{let t=e.otp??"20160313versUSE323tDb1lgCMx6vb4FwlqYHxzckL4tXYS8xgw5bcuWemJbtKb5",o=e.playback_info??"eyJ2bWRlb0lkIjoiYzY5ZTM2OWZlMmNmNDA1NGI4MWQ5YWE5YWI2NTVmZGUifQ==",r=`https://player.vdocipher.com/v2/?otp=${t}&playbackInfo=${o}`;return(0,i.jsx)(B,{src:r,allowFullScreen:!0,allow:"encrypted-media"})};
1var O=o(65120),E=o(48982),F=o(45768);let V=({lesson:e,canGoBack:t,canGoForward:o,prevJob:m,nextJob:f,isSeoLesson:v,nextButtonText:w})=>{let{t:y}=(0,c.B)(),{push:j}=(0,n.useRouter)(),{raw:C}=(0,p.useRoutes)(),[_,k]=(0,r.useState)(!0),[T,B]=(0,r.useState)(void 0),[V,R]=(0,r.useState)(!1),[Y,$]=(0,r.useState)(!1),{previewMode:U}=(0,g.H8)(),[W,A]=(0,r.useState)(e?.rating??0),D=(0,l.useTheme)();(0,g.DY)(D.color.background[90]);let{preferredHosting:P}=(0,F.D)(),J=(0,r.useMemo)(()=>!(0,g.Pb)(e.transcript),[e.transcript]),G=(0,r.useMemo)(()=>e.video_urls&&e.video_urls.length>0?e.video_urls:e.video_url?[e.video_url]:[],[e.video_urls,e.video_url]),[H,K]=(0,r.useState)("");(0,r.useEffect)(()=>{(async()=>{if(0!==G.length){if(P)for(let e of G)try{let t=await (0,g.jj)(e);if(t?.hosting===P)return void K(e)}catch(t){console.error("Failed to detect video hosting for URL:",e,t)}K(G[0])}})()},[G,P]);let X=(0,r.useMemo)(()=>{let t=[{title:y("pages:subjects.courses"),href:(0,h.d8)().allCourses().url},{title:e?.subject?.title,href:(0,h.d8)().allCourses().course(e?.subject?.slug).url},{title:e.title,href:(0,h.d8)().allCourses().course(e?.subject?.slug??e?.subject?.id).lesson().url}];if(e?.module){let o={title:e?.module?.title,href:`${C.subjects.index}/course-${e?.subject?.slug}/module-${e?.module?.slug}`};t.splice(2,0,o)}return t},[]),Z=(0,r.useMemo)(()=>{try{return JSON.parse(e?.description)}catch(t){return e?.description.replaceAll("\n","<br/>\n")}},[e]),Q=(0,r.useMemo)(()=>e?.attachments?(0,s.A)(e.attachments,"position"):[],[e]),q=(0,r.useMemo)(()=>{if(e?.theses)return(0,s.A)(e.theses,"position")},[e]),{getImage:ee}=(0,g.ve)(e.files??[],{fallback:"site"}),et=()=>{B(0),R(!0)},eo=()=>{f?f():j((0,h.d8)().allCourses().course(e.subject.slug).lesson().url)},ei=()=>(k(!1),void 0===T&&q?.length)?void et():q&&0!==q.length&&q&&void 0!==T&&q.length>T+1?void B(e=>void 0!==e?e+1:0):void eo(),er=q&&q.length>0?et:void 0,en=W<5&&W&&!e.feedback_given;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(d.LessonContainer,{children:[!U&&v&&(0,i.jsx)(I.B,{items:X}),(0,i.jsxs)(d.LessonContent,{children:[(J||G.length>1)&&(0,i.jsxs)(x,{children:[J&&(0,i.jsx)(d.ModernButton,{appearance:d.ModernButtonAppearance.Secondary,size:"md",iconStart:(0,i.jsx)(u.ayy,{}),onClick:()=>$(!0),children:y("videolesson:transcript_button")}),(0,i.jsx)(E.VideoSourceSelector,{videoUrls:G,selectedUrl:H,onUrlChange:e=>{K(e)}})]}),(0,i.jsx)(b,{children:H?(0,i.jsx)(O.VideoPlayer,{data:{cover:"",src:H},playing:_,onEnded:er},H):e.vdo_cipher_video_id?(0,i.jsx)(N,{videoLesson:e}):null}),(0,i.jsxs)(d.TextLayer,{children:[(0,i.jsx)(d.LessonTitlePrimary,{children:e?.title}),(0,i.jsx)(a.X,{content:Z,getImageById:ee})]}),(0,i.jsx)(z,{attachments:Q}),(0,i.jsx)(L.i,{authors:e.authors}),(0,i.jsx)(M.f,{lesson:e,rating:W,setRating:A})]}),(0,i.jsx)(S.I,{materials:e.materials}),en?(0,i.jsx)(d.LessonFeedback,{lesson:e}):null,(0,i.jsx)(d.LessonNavigation,{canGoBack:t,canGoForward:o,prevJob:m,nextJob:f,onContinue:ei,thesesVisible:V,previewMode:U,subjectSlug:e?.subject?.slug,nextButtonText:w})]}),V&&void 0!==T&&q?.map((e,t)=>T===t&&(0,i.jsx)(d.Thesis,{duration:e.duration,description:e.description,imageSrc:e.image?.file_url,imageAlt:e.image?.title,onContinue:ei},e.id)),J&&(0,i.jsx)(d.ModernModal,{title:y("videolesson:transcript_title"),size:760,maxHeight:640,open:Y,onClose:()=>$(!1),children:(0,i.jsx)(a.X,{content:e.transcript??"",getImageById:ee})})]})}},45768:(e,t,o)=>{o.d(t,{D:()=>s});var i=o(7620),r=o(61698);let n="preferred_video_hosting",s=()=>{let[e,t]=(0,i.useState)(null);return(0,i.useEffect)(()=>{try{let e=localStorage.getItem(n);e&&Object.values(r.OT).includes(e)&&t(e)}catch(e){console.warn("Failed to read video source preference from localStorage:",e)}},[]),{preferredHosting:e,savePreference:e=>{try{localStorage.setItem(n,e),t(e)}catch(e){console.warn("Failed to save video source preference to localStorage:",e)}}}}},48982:(e,t,o)=>{o.r(t),o.d(t,{VideoSourceSelector:()=>p});var i=o(54568),r=o(7620),n=o(62315),s=o(61698),l=o(1434),a=o(8988),d=o(39015);let c=a.styled.div.withConfig({componentId:"sc-d0339e15-0"})(["width:240px;margin:0 0 0 auto;","{width:100%;}"],(0,l.down)(d.Rp.md));var u=o(45768),h=o(85853);let p=({videoUrls:e,selectedUrl:t,onUrlChange:o})=>{let{t:l}=(0,n.B)("videolesson"),{savePreference:a}=(0,u.D)(),[d,p]=(0,r.useState)(e.map(e=>({url:e})));(0,r.useEffect)(()=>{(async()=>{p(await Promise.all(e.map(async e=>{try{let t=await (0,s.jj)(e);return{url:e,hosting:t?.hosting}}catch(t){return console.error("Failed to detect video hosting for URL:",e,t),{url:e,hosting:void 0}}})))})()},[e]);let g=(0,r.useMemo)(()=>d.map((e,t)=>({key:t,label:((e,t)=>{switch(e){case s.OT.Youtube:return t("hosting.youtube");case s.OT.Vimeo:return t("hosting.vimeo");case s.OT.Rutube:return t("hosting.rutube");case s.OT.VK:return t("hosting.vk");case s.OT.Kinescope:return t("hosting.kinescope");default:return t("hosting.default")}})(e.hosting,l),value:e.url})),[d,l]);return e.length<=1?null:(0,i.jsx)(c,{children:(0,i.jsx)(h.Wr,{value:t,onValueChange:e=>{let t=d.find(t=>t.url===e);t?.hosting&&a(t.hosting),o(e,t?.hosting)},options:g,placeholder:l("select_video_source")})})}}}]);
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.