1import{ct as pt,aO as Ge,t as ft,ae as Pe,cU as gt,ac as bt,h as v,r as i,A as we,a9 as me,cS as jt,j as e,y as yt,B as $,c7 as wt,q as S,W as vt,cV as Nt,Y as kt,b4 as ke,a6 as Ke,$ as Ct,w as he,G as Te,p as _e,X as Ce,x as We,bl as Z,s as St,L as xe,aP as It,I as De,bP as Pt,bQ as Lt,bR as $t,bS as ae,aa as Ut,ag as Bt,bI as Ye,aF as pe,a4 as Ft,T as ve,b2 as At,c5 as Mt,ah as Et,b5 as Rt}from"./index-7Izc5KgZ.js";import{u as Tt,E as _t}from"./edit-page-toolbar-Bu0Q8gi3.js";import{S as Dt}from"./site-footer-B5lZ1oNf.js";import{G as qt,e as Ot,f as Gt,c as Kt}from"./guest-signup-dialog-RrhOFu6s.js";import{T as Wt}from"./theme-toggle-DxWfQCtp.js";import{l as Yt,a as zt,S as Y}from"./separator-CGtSkfMf.js";import{g as Ht}from"./category-icons-un9ReliP.js";import{P as Qt}from"./trending-up-DX_dWBUS.js";import{C as Vt}from"./circle-check-big-BM4PTsQb.js";import{P as ne}from"./package-BDu1nvr8.js";import{C as ee}from"./circle-check-Czj6XfZb.js";import{E as Jt}from"./external-link-B3fdl1zA.js";import{S as Xt}from"./share-2-DaBC4d15.js";import{M as Zt}from"./mail-Dbd14pXQ.js";import{P as oe,C as es}from"./play-D8qdvaSr.js";import{S as Se}from"./shopping-cart-Dfx3PHcd.js";import{C as ts}from"./chevrons-up-down-Bo7EMsLx.js";import{L as ss}from"./layout-grid-C-htEVmA.js";import{H as rs}from"./headphones-CaTs5WCH.js";import{F as as}from"./file-pen-DlePVSN-.js";import"./user-plus-Cab2mlPi.js";import"./arrow-right-BD1ZPN3F.js";import"./hourglass-D9uN3Avk.js";import"./timer-RtDJOPFh.js";import"./activity-DA4Dh5lN.js";import"./waves-CgXcH0xm.js";import"./terminal-DfBFiXt5.js";import"./wind-CTaTMZST.js";import"./filter-B5Lh2qbG.js";import"./wifi-C1sY1KZ1.js";import"./hard-drive-DK3d-GpG.js";import"./file-question-DAcpoMK3.js";import"./laptop-S1ZGmru3.js";import"./badge-dollar-sign-BYTQqE9z.js";import"./receipt-oQmtGLoy.js";import"./credit-card-BVkdbPcQ.js";import"./wallet-CVPebSyF.js";import"./radio-Dux9s0t2.js";import"./wand-sparkles-CJJ_ERpn.js";import"./droplets-CJWNUs2u.js";import"./medal-DpOUPWGW.js";import"./tablet-dbhVTPro.js";import"./mic-DaIF_LHM.js";import"./paintbrush-BzY5_bDJ.js";import"./scissors-C0DfviVh.js";import"./grid-3x3-D4Fqa-hA.js";import"./flag-C_TuqZP2.js";import"./folder-CvnXwfY1.js";import"./gift-DRgQdFB0.js";import"./lightbulb-C33cTmyv.js";import"./pen-tool-ikpWC-3U.js";import"./monitor-CmTS2u90.js";const ns=[{id:"whatYouWillLearn",label:"What You'll Learn"},{id:"curriculum",label:"Course Curriculum"},{id:"gallery",label:"Gallery"},{id:"reviews",label:"Student Reviews"}],Ie={free:"Access all video lessons, resources and project briefs included in this course â completely free.",lifetime:"Pay once and own this course forever, including all future updates with no recurring fees.",pro:"Get instant access to every course, live mentoring and all premium features with one subscription."};function os(s){if(!s)return[];try{return JSON.parse(s)}catch{return[]}}function is(s){if(!s)return[];try{const a=JSON.parse(s);return Array.isArray(a)?a.map(o=>typeof o=="string"?{url:o}:o):[]}catch{return[]}}function ls(s){if(!s)return[];try{return JSON.parse(s)}catch{return[]}}function cs(s){if(!s)return[];try{return JSON.parse(s)}catch{return[]}}function qe(s){if(s<60)return`${s}m`;const a=Math.floor(s/60),o=s%60;return o>0?`${a}h ${o}m`:`${a}h`}function Oe(s){if(!s&&s!==0)return"";let a;if(typeof s=="number")a=s;else{const c=s.split(":").map(Number);if(c.length===3)a=(c[0]||0)*3600+(c[1]||0)*60+(c[2]||0);else if(c.length===2)a=(c[0]||0)*60+(c[1]||0);else return""}if(a<=0)return"";const o=Math.floor(a/3600),d=Math.floor(a%3600/60),l=a%60;return o>0?`${o}:${String(d).padStart(2,"0")}:${String(l).padStart(2,"0")}`:`${d}:${String(l).padStart(2,"0")}`}function ds(s){if(!s&&s!==0)return 0;if(typeof s=="number")return s;const a=s.split(":").map(Number);return a.length===3?(a[0]||0)*3600+(a[1]||0)*60+(a[2]||0):a.length===2?(a[0]||0)*60+(a[1]||0):0}function us(s){const a=s.reduce((l,c)=>l+ds(c.duration),0);if(a===0)return"";const o=Math.floor(a/3600),d=Math.floor(a%3600/60);return o>0&&d>0?`${o} hr ${d} min`:o>0?`${o} hr`:`${d} min`}function ms({contentType:s,className:a}){const o=a??"w-3.5 h-3.5 shrink-0 text-muted-foreground";return s==="Quiz"?e.jsx(es,{className:`${o} text-amber-500`}):s==="Pdf"?e.jsx(At,{className:`${o} text-red-500`}):s==="Multimedia"?e.jsx(ss,{className:`${o} text-blue-500`}):s==="Audio"?e.jsx(rs,{className:`${o} text-purple-500`}):s==="Text"||s==="HtmlItem"?e.jsx(Mt,{className:`${o} text-teal-500`}):s==="Download"?e.jsx(Et,{className:`${o} text-green-500`}):s==="Assignment"?e.jsx(as,{className:`${o} text-amber-500`}):s&&s!=="Video"?e.jsx(Rt,{className:`${o} text-blue-400`}):e.jsx(oe,{className:o})}function hs({curriculum:s,onLessonClick:a}){const[o,d]=i.useState(new Set([0]));if(s.length===0)return null;const l=s.reduce((b,m)=>b+m.lessons.length,0),c=o.size===s.length,p=b=>{d(m=>{const r=new Set(m);return r.has(b)?r.delete(b):r.add(b),r})},f=()=>{d(c?new Set:new Set(s.map((b,m)=>m)))};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.length," ",s.length===1?"chapter":"chapters"," · ",l," ",l===1?"lesson":"lessons"]}),s.length>1&&e.jsxs("button",{onClick:f,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors","data-testid":"button-toggle-all-curriculum",children:[e.jsx(ts,{className:"w-3.5 h-3.5"}),c?"Collapse All":"Expand All"]})]}),s.map((b,m)=>{const r=us(b.lessons);return e.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>p(m),className:"w-full flex items-center gap-2 px-4 py-3 text-left bg-muted/40 hover:bg-muted/70 transition-colors",children:[o.has(m)?e.jsx(Ke,{className:"w-4 h-4 shrink-0 text-muted-foreground"}):e.jsx(We,{className:"w-4 h-4 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"font-medium text-sm flex-1 min-w-0 truncate",children:b.title}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 ml-auto text-right",children:[b.lessons.length," ",b.lessons.length===1?"lesson":"lessons",r?` | ${r}`:""]})]}),o.has(m)&&e.jsx("div",{className:"divide-y divide-border",children:b.lessons.map((g,x)=>e.jsxs("button",{onClick:()=>a?.(g.title),className:S("w-full flex items-center gap-3 px-4 py-2.5 text-left",a?"cursor-pointer hover:bg-muted/50 transition-colors":"cursor-default"),"data-testid":`button-lesson-landing-${m}-${x}`,children:[e.jsx(ms,{contentType:g.contentType}),e.jsx("span",{className:"text-sm flex-1 min-w-0 truncate",children:g.title}),Oe(g.duration)&&e.jsx("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums ml-auto",children:Oe(g.duration)})]},x))})]},m)})]})}function xs({images:s}){const[a,o]=i.useState(null);return s.length===0?null:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:s.map((d,l)=>e.jsx("button",{onClick:()=>o(l),className:"relative aspect-video overflow-hidden rounded-lg bg-muted group","data-testid":`gallery-image-${l}`,children:e.jsx("img",{src:d.url,alt:d.caption||`Gallery image ${l+1}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})},l))}),a!==null&&e.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/90 flex items-center justify-center p-4",onClick:()=>o(null),children:[e.jsx("img",{src:s[a].url,alt:s[a].caption||`Gallery image ${a+1}`,className:"max-w-full max-h-full object-contain",onClick:d=>d.stopPropagation()}),e.jsx("button",{className:"absolute top-4 right-4 text-white/80 hover:text-white",onClick:()=>o(null),children:"â"}),a>0&&e.jsx("button",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-white/80 hover:text-white text-2xl",onClick:d=>{d.stopPropagation(),o(a-1)},children:"â¹"}),a<s.length-1&&e.jsx("button",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-white/80 hover:text-white text-2xl",onClick:d=>{d.stopPropagation(),o(a+1)},children:"âº"})]})]})}function ps({review:s}){const a=typeof s.rating=="number"?s.rating:5;return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 space-y-3",children:[e.jsx("div",{className:"flex gap-0.5",children:Array.from({length:5}).map((o,d)=>e.jsx(Ft,{className:S("w-4 h-4",d<a?"text-yellow-400 fill-yellow-400":"text-muted-foreground")},d))}
1),e.jsx("p",{className:"text-sm leading-relaxed text-foreground/90",children:s.text}),e.jsxs("div",{className:"flex items-center gap-2",children:[s.avatarUrl?e.jsx("img",{src:s.avatarUrl,alt:s.name,className:"w-7 h-7 rounded-full object-cover"}):e.jsx("div",{className:"w-7 h-7 rounded-full bg-primary/20 flex items-center justify-center text-xs font-semibold text-primary",children:s.name.charAt(0).toUpperCase()}),e.jsx("span",{className:"text-sm font-medium",children:s.name})]})]})}function fs({course:s,size:a="default",bundles:o=[],onStartCourse:d,helpers:l}){const{openUpsell:c}=Ye(),{user:p,isAuthenticated:f}=Pe(),b=f,m=p?.isProMember??!1,{data:r}=v({queryKey:["/api/taster/status"],staleTime:6e4}),g=r?.isGroupMember??!1,{data:x}=v({queryKey:["/api/courses",s.id,"purchase-status"],queryFn:()=>fetch(`/api/courses/${s.id}/purchase-status`).then(A=>A.json()),enabled:!!s.id&&b,staleTime:6e4}),U=x?.hasLifetimePurchase??!1,I=(x?.percentComplete??0)>0,{data:B}=v({queryKey:["/api/checkout/products",{courseId:s.id}],queryFn:()=>fetch(`/api/checkout/products?courseId=${s.id}`).then(A=>A.json()),enabled:!!s.id,staleTime:3e5}),y=B?.products?.[0]?.id??null,{data:P}=v({queryKey:["/api/checkout/subscriptions"],enabled:!m&&!g,staleTime:3e5}),C=P?.subscriptions?.[0]?.id??null,w=o[0],F=!!(s.thinkificSlug||s.thinkificCourseId),[q,N]=i.useState(null),z=()=>{if(y){window.location.href=`/checkout/${y}`;return}if(!s.lifetimePurchaseUrl)return;const A=encodeURIComponent(window.location.pathname),_=s.lifetimePurchaseUrl.includes("?")?"&":"?";window.open(`${s.lifetimePurchaseUrl}${_}return=${A}`,"_blank")},O=()=>{w?.checkoutUrl&&window.open(w.checkoutUrl,"_blank","noopener,noreferrer")},H=()=>{C?window.location.href=`/checkout/subscription/${C}`:c("course-landing")},G=I?"Continue Course":m||U?"Start Course":"Start Course for Free",L=l?q==="free"?l.free:q==="lifetime"?l.lifetime:q==="pro"?l.pro:"":"";return e.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[F&&d||(y||s.lifetimePurchaseUrl)&&!g?e.jsxs("div",{className:"flex gap-3 w-full",children:[F&&d&&e.jsxs($,{size:a,variant:"outline",onClick:d,onMouseEnter:()=>N("free"),onMouseLeave:()=>N(null),className:"gap-2 flex-1 border-primary text-primary hover:bg-primary hover:text-primary-foreground","data-testid":"button-start-course",children:[e.jsx(oe,{className:"w-4 h-4"}),G]}),(y||s.lifetimePurchaseUrl)&&!g&&(U?e.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 rounded-md border border-green-500 bg-transparent px-4 text-sm font-medium text-green-600 dark:text-green-400",onMouseEnter:()=>N("lifetime"),onMouseLeave:()=>N(null),"data-testid":"badge-lifetime-unlocked",children:[e.jsx(ee,{className:"w-4 h-4 shrink-0"}),"Lifetime Access Unlocked"]}):e.jsxs($,{size:a,variant:"outline",onClick:z,onMouseEnter:()=>N("lifetime"),onMouseLeave:()=>N(null),className:"gap-2 flex-1 hover:bg-foreground hover:text-background hover:border-foreground","data-testid":"button-buy-course",children:[e.jsx(Se,{className:"w-4 h-4"}),"Buy Lifetime Access"]}))]}):null,w?.checkoutUrl&&!g&&e.jsxs($,{size:a,variant:"outline",onClick:O,onMouseEnter:()=>N("lifetime"),onMouseLeave:()=>N(null),className:"gap-2 w-full","data-testid":"button-buy-bundle",children:[e.jsx(ne,{className:"w-4 h-4"}),"Buy it in Bundle"]}),!m&&!g&&e.jsxs($,{size:a,variant:"outline",onClick:H,onMouseEnter:()=>N("pro"),onMouseLeave:()=>N(null),className:"gap-2 w-full border-amber-500 text-amber-600 dark:text-amber-400 hover:bg-amber-500 hover:text-white hover:border-amber-500 whitespace-normal h-auto py-2","data-testid":"button-subscribe-course",children:[e.jsx(pe,{className:"w-4 h-4"}),"Access All Courses and Mentoring as Pro Member"]}),l&&e.jsx("div",{className:"min-h-[2.75rem] pt-1 px-1",children:e.jsx("p",{className:S("text-sm text-muted-foreground text-center transition-opacity duration-200",q?"opacity-100":"opacity-0 select-none pointer-events-none"),children:L})})]})}function gs({course:s,bundles:a=[],onStartCourse:o,helpers:d,draftHelpers:l,isEditMode:c,isAdmin:p,onDraftHelperChange:f}){const{openUpsell:b}=Ye(),{user:m,isAuthenticated:r}=Pe(),g=m?.isProMember??!1,{data:x}=v({queryKey:["/api/taster/status"],staleTime:6e4}),U=x?.isGroupMember??!1,{data:I}=v({queryKey:["/api/courses",s.id,"purchase-status"],queryFn:()=>fetch(`/api/courses/${s.id}
1/purchase-status`).then(h=>h.json()),enabled:!!s.id&&r,staleTime:6e4}),B=I?.hasLifetimePurchase??!1,y=(I?.percentComplete??0)>0,P=!!(s.thinkificSlug||s.thinkificCourseId),C=a[0],{data:w}=v({queryKey:["/api/checkout/products",{courseId:s.id}],queryFn:()=>fetch(`/api/checkout/products?courseId=${s.id}`).then(h=>h.json()),enabled:!!s.id,staleTime:3e5}),F=w?.products?.[0]?.id??null,{data:q}=v({queryKey:["/api/checkout/subscriptions"],enabled:!g&&!U,staleTime:3e5}),N=q?.subscriptions?.[0]?.id??null,z=y?"Continue Course":g||B?"Start Course":"Start Course for Free",O=()=>{if(F){window.location.href=`/checkout/${F}`;return}if(!s.lifetimePurchaseUrl)return;const h=encodeURIComponent(window.location.pathname),fe=s.lifetimePurchaseUrl.includes("?")?"&":"?";window.open(`${s.lifetimePurchaseUrl}${fe}return=${h}`,"_blank")},H=()=>{N?window.location.href=`/checkout/subscription/${N}`:b("course-landing")},G=(c?l:d)??Ie,L=!U&&(!!F||!!s.lifetimePurchaseUrl||!!C?.checkoutUrl),A=P&&!!o,_=C?.checkoutUrl?()=>window.open(C.checkoutUrl,"_blank","noopener,noreferrer"):O,K=!c&&!!o,W=!c&&!B,Q=!c&&!g;return e.jsxs("section",{className:"py-12",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-2",children:"Ready to get started?"}),e.jsx("p",{className:"text-muted-foreground text-center mb-10",children:"Choose the option that works best for you."}),e.jsxs("div",{className:S("grid gap-6",A&&L?"grid-cols-1 md:grid-cols-3":A||L?"grid-cols-1 md:grid-cols-2":"grid-cols-1 max-w-sm mx-auto"),children:[A&&e.jsxs("div",{className:S("flex flex-col items-center text-center gap-4 p-6 rounded-xl border border-border transition-all duration-200",K&&"cursor-pointer hover:border-primary/50 hover:shadow-md hover:bg-primary/[0.025] dark:hover:bg-primary/[0.04]"),onClick:K?o:void 0,"data-testid":"card-start-course-bottom",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(oe,{className:"w-5 h-5 text-primary"})}),e.jsx("h3",{className:"text-xl font-semibold",children:z}),e.jsxs($,{size:"lg",variant:"outline",onClick:h=>{h.stopPropagation(),o?.()},className:"w-full gap-2 border-primary text-primary hover:bg-primary hover:text-primary-foreground","data-testid":"button-start-course-bottom",children:[e.jsx(oe,{className:"w-4 h-4"}),z]}),c&&p?e.jsx(ve,{value:l.free,onChange:h=>f("free",h.target.value),onClick:h=>h.stopPropagation(),className:"text-sm text-muted-foreground resize-none border-dashed",rows:3}):e.jsx("p",{className:"text-sm text-muted-foreground",children:G.free})]}),L&&e.jsxs("div",{className:S("flex flex-col items-center text-center gap-4 p-6 rounded-xl border border-border transition-all duration-200",W&&"cursor-pointer hover:border-foreground
1/25 hover:shadow-md hover:bg-muted/40"),onClick:W?_:void 0,"data-testid":"card-lifetime-bottom",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-muted flex items-center justify-center shrink-0",children:B?e.jsx(ee,{className:"w-5 h-5 text-green-500"}):e.jsx(Se,{className:"w-5 h-5 text-foreground"})}),e.jsx("h3",{className:"text-xl font-semibold",children:"Lifetime Access"}),B?e.jsxs("div",{className:"w-full flex items-center justify-center gap-2 rounded-md border border-green-500 px-4 py-3 text-sm font-medium text-green-600 dark:text-green-400","data-testid":"badge-lifetime-unlocked-bottom",children:[e.jsx(ee,{className:"w-4 h-4 shrink-0"}),"Lifetime Access Unlocked"]}):C?.checkoutUrl?e.jsxs($,{size:"lg",variant:"outline",onClick:h=>{h.stopPropagation(),window.open(C.checkoutUrl,"_blank","noopener,noreferrer")},className:"w-full gap-2","data-testid":"button-buy-bundle-bottom",children:[e.jsx(ne,{className:"w-4 h-4"}),"Buy it in Bundle"]}):e.jsxs($,{size:"lg",variant:"outline",onClick:h=>{h.stopPropagation(),O()},className:"w-full gap-2 hover:bg-foreground hover:text-background hover:border-foreground","data-testid":"button-buy-course-bottom",children:[e.jsx(Se,{className:"w-4 h-4"}),"Buy Lifetime Access"]}),c&&p?e.jsx(ve,{value:l.lifetime,onChange:h=>f("lifetime",h.target.value),onClick:h=>h.stopPropagation(),className:"text-sm text-muted-foreground resize-none border-dashed",rows:3}):e.jsx("p",{className:"text-sm text-muted-foreground",children:G.lifetime})]}),!U&&e.jsxs("div",{className:S("flex flex-col items-center text-center gap-4 p-6 rounded-xl border border-amber-200 dark:border-amber-800/60 transition-all duration-200",Q&&"cursor-pointer hover:border-amber-400 hover:shadow-md hover:bg-amber-50/50 dark:hover:bg-amber-900/10"),onClick:Q?()=>H():void 0,"data-testid":"card-pro-bottom",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-amber-50 dark:bg-amber-900/20 flex items-center justify-center shrink-0",children:e.jsx(pe,{className:"w-5 h-5 text-amber-500"})}),e.jsx("h3",{className:"text-xl font-semibold",children:"Pro Membership"}),g?e.jsxs("div",{className:"w-full flex items-center justify-center gap-2 rounded-md border border-amber-500 px-4 py-3 text-sm font-medium text-amber-600 dark:text-amber-400","data-testid":"badge-pro-active-bottom",children:[e.jsx(pe,{className:"w-4 h-4 shrink-0"}),"You're a Pro Member"]}):e.jsxs($,{size:"lg",variant:"outline",onClick:h=>{h.stopPropagation(),H()},className:"w-full gap-2 border-amber-500 text-amber-600 dark:text-amber-400 hover:bg-amber-500 hover:text-white whitespace-normal h-auto py-2","data-testid":"button-subscribe-course-bottom",children:[e.jsx(pe,{className:"w-4 h-4"}),"Access All Courses and Mentoring as Pro Member"]}),c&&p?e.jsx(ve,{value:l.pro,onChange:h=>f("pro",h.target.value),onClick:h=>h.stopPropagation(),className:"text-sm text-muted-foreground resize-none border-dashed",rows:3}):e.jsx("p",{className:"text-sm text-muted-foreground",children:G.pro})]})]})]})}function bs({wistiaHashedId:s,thumbnailUrl:a,altText:o}){const[d,l]=i.useState(!1),[c,p]=i.useState(()=>{try{return localStorage.getItem("autoPlayTrailers")!=="false"}catch{return!0}}),[f,b]=i.useState(c),[m,r]=i.useState(!1),g=i.useRef(null),x=i.useRef(null);i.useEffect(()=>{l(!1),b(c),r(!1),g.current=null},[s,c]),i.useEffect(()=>{if(!f)return;const y=window;if(!document.getElementById("wistia-e-v1-script")){const w=document.createElement("script");w.id="wistia-e-v1-script",w.src="https://fast.wistia.com/assets/external/E-v1.js",w.async=!0,document.head.appendChild(w)}const P=`wistia-jsonp-${s}`;if(!document.getElementById(P)){const w=document.createElement("script");w.id=P,w.src=`https://fast.wistia.com/embed/medias/${s}.jsonp`,w.async=!0,document.head.appendChild(w)}y._wq=y._wq||[];const C={id:s,options:{autoPlay:!0,fullscreenButton:!0},onReady(w){g.current=w,w.bind("end",()=>l(!0))}};return y._wq.push(C),()=>{y._wq=(y._wq||[]).filter(w=>w!==C)}},[s,f]),i.useEffect(()=>{const y=x.current;if(!y||!f){r(!1);return}const P=new IntersectionObserver(([C])=>r(!C.isIntersecting),{threshold:.1});return P.observe(y),()=>{P.disconnect(),r(!1)}},[f]);const U=y=>{p(y);try{localStorage.setItem("autoPlayTrailers",y?"true":"false")}catch{}},I=()=>{l(!1),g.current&&(g.current.time(0),g.current.play())},B=e.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-muted-foreground cursor-pointer select-none ml-auto shrink-0",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:y=>U(y.target.checked),"data-testid":"checkbox-autoplay-trailers-landing",className:"rounded"}),"Auto-play trailer"]});return f?e.jsxs("div",{className:"space-y-2","data-testid":"embed-course-trailer-landing",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{ref:x,style:{paddingBottom:"56.25%"}}),e.jsxs("div",{className:S("overflow-hidden rounded-xl shadow-lg bg-black",m?"f
1ixed right-4 w-72 z-50":"absolute inset-0"),style:m?{top:"6.5rem"}:{},children:[m&&e.jsx("button",{onClick:()=>b(!1),className:"absolute top-1.5 right-1.5 z-10 bg-black/60 hover:bg-black/80 rounded-full p-0.5 text-white transition-colors","data-testid":"button-close-sticky-trailer","aria-label":"Close sticky trailer",children:e.jsx(Ce,{className:"w-3.5 h-3.5"})}),e.jsx("div",{style:{padding:"56.25% 0 0 0",position:"relative"},children:e.jsx("div",{style:{height:"100%",left:0,position:"absolute",top:0,width:"100%"},children:e.jsx("div",{className:`wistia_embed wistia_async_${s} videoFoam=true`,style:{height:"100%",position:"relative",width:"100%"}})})}),d&&a&&!m&&e.jsx("div",{className:"absolute inset-0 z-10",children:e.jsx("img",{src:a,alt:o,className:"w-full h-full object-cover"})})]})]}),e.jsxs("div",{className:"flex items-center px-1",children:[d?e.jsxs("button",{onClick:I,className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors","data-testid":"button-replay-trailer-landing",children:[e.jsx(Bt,{className:"w-4 h-4"}),"Replay Course Trailer"]}):e.jsx("span",{}),B]})]}):e.jsxs("div",{className:"space-y-2","data-testid":"embed-course-trailer-landing",children:[a&&e.jsx("div",{className:"w-full rounded-xl overflow-hidden shadow-lg",children:e.jsx("img",{src:a,alt:o,className:"w-full h-auto"})}),e.jsxs("div",{className:"flex items-center px-1",children:[e.jsxs("button",{onClick:()=>b(!0),className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors","data-testid":"button-play-trailer-landing",children:[e.jsx(oe,{className:"w-4 h-4"}),"Play Trailer"]}),B]})]})}function js({course:s,toast:a,fullWidth:o,className:d,testId:l="button-share"}){return e.jsxs(Pt,{children:[e.jsx(Lt,{asChild:!0,children:e.jsxs($,{size:"sm",variant:"outline",className:S("shrink-0 gap-1.5",o&&"flex-1 justify-center",d),"data-testid":l,children:[e.jsx(Xt,{className:"w-3.5 h-3.5"}),"Share"]})}),e.jsxs($t,{align:"end",children:[e.jsxs(ae,{onClick:async()=>{const c=window.location.href;try{await navigator.clipboard.writeText(c),a({title:"Link copied",description:"Course link copied to clipboard"})}catch{a({title:"Copy failed",description:c,variant:"destructive"})}},"data-testid":"button-share-copy-link",children:[e.jsx(Ut,{className:"w-4 h-4 mr-2"}),"Copy link"]}),e.jsxs(ae,{onClick:()=>{const c=window.location.href,p=s.title||"Check out this course";window.open(`https://x.com/intent/tweet?url=${encodeURIComponent(c)}&text=${encodeURIComponent(p)}`,"_blank")},"data-testid":"button-share-twitter",children:[e.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Share on X"]}),e.jsxs(ae,{onClick:()=>{const c=window.location.href;window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(c)}`,"_blank")},"data-testid":"button-share-facebook",children:[e.jsx(Gt,{className:"w-4 h-4 mr-2"}),"Share on Facebook"]}),e.jsxs(ae,{onClick:()=>{const c=window.location.href;window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(c)}`,"_blank")},"data-testid":"button-share-linkedin",children:[e.jsx(Kt,{className:"w-4 h-4 mr-2"}),"Share on LinkedIn"]}),e.jsxs(ae,{onClick:()=>{const c=window.location.href,p=s.title||"Check out this course";window.open(`mailto:?subject=${encodeURIComponent(p)}&body=${encodeURIComponent(c)}`,"_blank")},"data-testid":"button-share-email",children:[e.jsx(Zt,{className:"w-4 h-4 mr-2"}),"Share via email"]})]})]})}function ys({c:s,current:a,onSelect:o}){return e.jsxs("button",{onClick:o,className:S("w-full flex items-center gap-2 px-1 py-1.5 rounded hover:bg-muted/60 transition-colors text-left",s.id===a.id&&"bg-muted"),"data-testid":`course-option-${s.id}`,children:[s.thumbnailUrl?e.jsx("img",{src:s.thumbnailUrl,alt:s.title,className:"w-7 h-[18px] rounded object-cover shrink-0"}):e.jsx("div",{className:"w-7 h-[18px] rounded bg-muted flex items-center justify-center shrink-0",children:e.jsx(ke,{className:"w-3 h-3 text-muted-foreground"})}),e.jsx("span",{className:"text-xs flex-1 leading-snug",children:s.title}),s.id===a.id&&e.jsx(ee,{className:"w-3 h-3 text-primary shrink-0"})]})}const Ne=[{id:"masterclass",label:"MasterClasses",test:s=>/masterclass/i.test(s)},{id:"fasttrack",label:"Fast-Tracks",test:s=>/fast-?track/i.test(s)},{id:"examprep",label:"Exam Prep Courses",test:s=>/adobe certified professional/i.test(s)},{id:"bootcamp",label:"Bootcamps",test:s=>/bootcamp/i.test(s)||/365 days of creativity/i.test(s)},{id:"freecourses",label:"Free Courses",test:s=>/survival kit/i.test(s)},{id:"theory",label:"Design Theory Courses",test:s=>/graphic design theory/i.test(s)||/design theory/i.test(s)},{id:"sprints",label:"Sprints",test:s=>/design sprint/i.test(s)},{id:"motion3d",label:"Motion & 3D Design",test:s=>/cinema 4d/i.test(s)||/\bc4d\b/i.test(s)||/animation principles/i.test(s)},{id:"essentials",label:"Essential Skills",test:s=>/essential skills/i.test(s)}];function ws({current:s,courses:a,onClose:o}){const[,d]=Ge(),l=i.useMemo(()=>a.filter(p=>!p.isProject),[a]),c=i.useMemo(()=>{const p=new Map(Ne.map(m=>[m.id,[]]));p.set("__others__",[]);for(const m of l){const r=Ne.find(g=>g.test(m.title));p.get(r?r.id:"__others__").push(m)}const f=[];for(const m of Ne){const r=p.get(m.id);r.length&&f.push({id:m.id,label:m.label,items:r})}const b=p.get("__others__");return b.length&&f.push({id:"__others__",label:"Others",items:b}),f},[l]);return e.jsx("div",{className:"max-h-[70vh] overflow-y-auto p-3",children:e.jsx("div",{className:"columns-2 sm:columns-3 md:columns-4 lg:columns-5 xl:columns-6",style:{columnGap:"0.75rem",columnFill:"balance"},children:c.map(p=>e.jsxs("div",{className:"break-inside-avoid mb-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground px-1 mb-1",children:p.label}),p.items.map(f=>e.jsx(ys,{c:f,current:s,onSelect:()=>{o(),d(`/courses/${f.thinkificSlug||f.id}/landing`)}},f.id))]}
1,p.id))})})}function yr(){const[,s]=pt("/courses/:id/landing"),[,a]=Ge(),o=s?.id??"",{toast:d}=ft(),{user:l,isLoading:c}=Pe(),{settings:p}=gt(),{branding:f}=bt(),{data:b}=v({queryKey:["/api/thinkific/link-status"],enabled:!!l}),m=!!l?.isAdmin||!!b?.isAdmin,{data:r,isLoading:g}=v({queryKey:["/api/courses",o],queryFn:async()=>{const t=await fetch(`/api/courses/${o}`);if(!t.ok)throw new Error("Course not found");return t.json()},enabled:!!o}),x=r?.id??"",{data:U=[]}=v({queryKey:["/api/courses"]}),{data:I=[]}=v({queryKey:["/api/admin/thinkific-bundles"],queryFn:async()=>{const t=await fetch("/api/admin/thinkific-bundles");return t.ok?t.json():[]},enabled:!!l?.isAdmin}),{data:B={}}=v({queryKey:["/api/captions/trailer-wistia-ids"]}),y=x?B[x]:void 0,{data:P=[]}=v({queryKey:["/api/courses",x,"category-mappings"],queryFn:()=>fetch(`/api/courses/${x}/category-mappings`).then(t=>t.json()),enabled:!!x}),{data:C=[]}=v({queryKey:["/api/category-groups"]}),w=i.useMemo(()=>{const t=new Set(P.map(n=>n.categoryId));return C.flatMap(n=>(n.categories||[]).filter(u=>t.has(u.id)).map(u=>({id:u.id,name:u.name,displayName:u.displayName,icon:u.icon,iconColor:u.iconColor,iconUrl:u.iconUrl??null,groupName:n.name,isApplication:n.name.toLowerCase().includes("application")})))},[P,C]),{data:F}=v({queryKey:["/api/course-landing",x,"sections"],queryFn:async()=>{const t=await fetch(`/api/course-landing/${x}/sections`);if(!t.ok)throw new Error("Failed to fetch sections");return t.json()},enabled:!!x}),N=(F??{}).bundle?.bundleIds??[],{data:z=[]}=v({queryKey:["/api/bundles/by-ids",N.join(",")],queryFn:async()=>{if(N.length===0)return[];const t=await fetch(`/api/bundles/by-ids?ids=${N.join(",")}`);return t.ok?t.json():[]},enabled:!!l&&N.length>0}),{data:O=[]}=v({queryKey:["/api/checkout/courses",x,"bundles"],queryFn:()=>fetch(`/api/checkout/courses/${x}/bundles`).then(t=>t.json()).then(t=>t.bundles??[]),enabled:!!x,staleTime:3e5}),{data:H}=v({queryKey:["/api/courses",x,"purchase-status"],queryFn:()=>fetch(`/api/courses/${x}/purchase-status`).then(t=>t.json()),enabled:!!x&&!!l,staleTime:6e4});H?.hasLifetimePurchase;const{data:G}=v({queryKey:["/api/settings/course-cta-helpers"]}),L=G??Ie,[A,_]=i.useState(!1),[K,W]=i.useState(null),[Q,h]=i.useState(!1),[fe,ie]=i.useState(!1),[ge,be]=i.useState(Ie),ze=i.useCallback(()=>{ie(!0),setTimeout(()=>{h(!1),ie(!1)},400)},[]);i.useEffect(()=>{if(!Q)return;const t=setTimeout(()=>ie(!0),8500),n=setTimeout(()=>{h(!1),ie(!1)},9e3);return()=>{clearTimeout(t),clearTimeout(n)}},[Q]);const je=i.useCallback(()=>{if(r){if(!l){W(null),_(!0);return}a(`/courses?openCourse=${r.id}&startCourse=true`)}},[r,l,a]),He=i.useCallback(t=>{if(r){if(!l){W({title:t}),_(!0);return}a(`/courses?openCourse=${r.id}&lesson=${encodeURIComponent(t)}`)}},[r,l,a]);i.useEffect(()=>{if(new URLSearchParams(window.location.search).get("startCourse")==="true"&&l&&r){const n=window.location.pathname;window.history.replaceState({},"",n),je()}},[l,r]),i.useEffect(()=>{if(!l||!r)return;const t=new URLSearchParams(window.location.search);(t.get("purchased")==="true"||t.get("checkout_success")==="1")&&(window.history.replaceState({},"",window.location.pathname),h(!0),we("POST","/api/orders/check-purchase",{productName:r.title,thinkificSlug:r.thinkificSlug||null}).then(()=>{me.invalidateQueries({queryKey:["/api/taster/status"]}),me.invalidateQueries({queryKey:["/api/courses",r.id,"purchase-status"]})}).catch(()=>{}))},[l,r]),i.useEffect(()=>{if(c||!r)return;const t=new URLSearchParams(window.location.search),n=t.get("lesson"),u=t.get("t");n&&(l?(window.history.replaceState({},"",window.location.pathname),a(`/courses?openCourse=${r.id}&lesson=${encodeURIComponent(n)}${u?`&seek=${u}`:""}`)):(W({title:n,seekSecs:u?Number(u):void 0}),_(!0)))},[c,l,r]);const[Qe,Le]=i.useState(!1),[k,ye]=i.useState(!1),[Ve,$e]=i.useState(!1),{current:j,canUndo:Je,canRedo:Xe,update:Ue,replace:Be,enterEditMode:Fe,discardEdit:Ae,undo:Ze,redo:et}=Tt({});i.useEffect(()=>{F&&Be({...F})},[F,Be]);const M=i.useCallback((t,n)=>{Ue(u=>({...u,[t]:n(u[t]??{})}))},[Ue]),V=i.useMemo(()=>{const t=Object.values(j).flatMap(u=>(u.blocks??[]).map(T=>({id:T.id,label:jt(T)}))),n=new Set;return[...ns,...t].filter(u=>n.has(u.id)?!1:(n.add(u.id),!0))},[j]),tt=i.useCallback(()=>{Fe(),ye(!0),be(L)},[Fe,L]),st=i.useCallback(()=>{Ae(),ye(!1),be(L)},[Ae,L]),rt=i.useCallback(async()=>{$e(!0);try{for(const t of Object.keys(j))try{await(await we("PUT",`/api/admin/course-landing/${x}/sections/${t}`,j[t])).json()}catch(n){throw console.error(`[course-landing saveEdit] Failed to save key "${t}":`,n,"Value:",JSON.stringify(j[t])?.substring(0,200)),n}await we("POST","/api/admin/settings/course-cta-helpers",ge),me.invali
1dateQueries({queryKey:["/api/settings/course-cta-helpers"]}),me.invalidateQueries({queryKey:["/api/course-landing",x,"sections"]}),ye(!1),d({title:"Page saved"})}catch(t){const n=t instanceof Error?t.message:"Unknown error";d({title:"Failed to save",description:n,variant:"destructive"})}finally{$e(!1)}},[j,x,d,ge]),D={hero:i.useRef(null),whatYouWillLearn:i.useRef(null),curriculum:i.useRef(null),whoIsItFor:i.useRef(null),gallery:i.useRef(null),reviews:i.useRef(null),longDescription:i.useRef(null)},at=t=>{D[t].current?.scrollIntoView({behavior:"smooth",block:"start"})},Me=i.useMemo(()=>os(r?.curriculum),[r?.curriculum]),Ee=i.useMemo(()=>is(r?.galleryImages),[r?.galleryImages]),le=i.useMemo(()=>ls(r?.testimonials),[r?.testimonials]),Re=i.useMemo(()=>cs(r?.whatYouWillLearn),[r?.whatYouWillLearn]),nt=i.useMemo(()=>U.filter(t=>!t.hidden),[U]),te=Me.length>0,se=Ee.length>0,re=le.length>0,ce=!!r?.whoIsItFor;r?.longDescription;const de=Re.length>0,J=j.bundle??{},R=J.enabled??!1,X=J.bundleIds??[],ot=I.filter(t=>X.includes(t.id)),ue=k?ot:z,E=ue[0]??null,it=J.ctaLabel||"Buy the Bundle",lt=J.ctaUrl||E?.checkoutUrl||"",ct=i.useMemo(()=>{const t=[{key:"hero",label:"Overview"}];return(de||(j.whatYouWillLearn?.blocks?.length??0)>0)&&t.push({key:"whatYouWillLearn",label:"What You'll Learn"}),(ce||(j.whoIsItFor?.blocks?.length??0)>0)&&t.push({key:"whoIsItFor",label:"Who Is It For"}),(te||(j.curriculum?.blocks?.length??0)>0)&&t.push({key:"curriculum",label:"Curriculum"}),(se||(j.gallery?.blocks?.length??0)>0)&&t.push({key:"gallery",label:"Gallery"}),(re||(j.reviews?.blocks?.length??0)>0)&&t.push({key:"reviews",label:"Reviews"}),t},[de,te,ce,se,re,j]),[dt,ut]=i.useState("hero");if(i.useEffect(()=>{const t=new IntersectionObserver(n=>{for(const u of n)if(u.isIntersecting){ut(u.target.id);break}},{rootMargin:"-20% 0px -60% 0px",threshold:0});return Object.entries(D).forEach(([,n])=>{n.current&&t.observe(n.current)}),()=>t.disconnect()},[r]),g||!r)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx(yt,{className:"w-8 h-8 animate-spin text-primary mx-auto"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading courseâ¦"})]})});const mt={beginner:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",intermediate:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",advanced:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};return e.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col",children:[k&&e.jsx(_t,{canUndo:Je,canRedo:Xe,isSaving:Ve,onUndo:Ze,onRedo:et,onSave:rt,onDiscard:st,testIdPrefix:"course-landing",className:"fixed top-0 left-0 right-0 z-[60]"}),e.jsxs("header",{className:S("sticky z-50 top-0 bg-background/95 backdrop-blur border-b border-border",k&&"top-10"),children:[e.jsxs("div",{className:"max-w-5xl mx-auto px-4 h-14 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>a("/dashboard"),className:"shrink-0 flex items-center focus:outline-none","data-testid":"button-site-logo","aria-label":"Go to dashboard",children:f?.logoUrl?e.jsx("img",{src:f.logoUrl,alt:f.brandText||"Logo",className:"h-8"}):p.sidebar_logoLargeUrl?e.jsx("img",{src:p.sidebar_logoLargeUrl,alt:"Site Logo",className:"h-8"}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:Yt,alt:"Yes I'm a Designer",className:"h-8 dark:hidden"}),e.jsx("img",{src:zt,alt:"Yes I'm a Designer",className:"h-8 hidden dark:block"})]})}),e.jsx(Y,{orientation:"vertical",className:"h-6 shrink-0"}),e.jsxs($,{variant:"ghost",size:"sm",onClick:()=>a("/courses"),className:"gap-1.5 text-muted-foreground hover:text-foreground shrink-0","data-testid":"button-back",children:[e.jsx(wt,{className:"w-4 h-4"}),"Back"]}),e.jsx("nav",{className:"hidden md:flex items-center gap-0.5 ml-auto",children:ct.map(t=>e.jsx("button",{onClick:()=>at(t.key),className:S("px-3 py-1 rounded-md text-xs font-medium transition-colors",dt===t.key?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),"data-testid":`nav-section-${t.key}`,children:t.label},t.key))})]}),e.jsxs(vt,{open:Qe,onOpenChange:Le,children:[e.jsx(Nt,{asChild:!0,children:e.jsx("div",{className:"border-t border-border w-full",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-1.5 flex items-center gap-2",children:[e.jsx(kt,{asChild:!0,children:e.jsxs("button",{className:"flex-1 flex items-center gap-2 min-w-0 hover:bg-muted/50 rounded-lg px-2 py-1.5 transition-colors text-left","data-testid":"button-course-switcher",children:[r.thumbnailUrl?e.jsx("img",{src:r.thumbnailUrl,alt:r.title,className:"w-8 h-8 rounded object-cover shrink-0"}):e.jsx("div",{className:"w-8 h-8 rounded bg-primary/20 flex items-center justify-center shrink-0",children:e.jsx(ke,{className:"w-4 h-4 text-primary"})}),e.jsx("span",{className:"text-sm font-semibold truncate text-foreground",children:r.title}),e.jsx(Ke,{className:"w-4 h-4 shrink-0 text-muted-foreground"})]})}),e.jsx(Wt,{}),e.jsx(js,{course:r,toast:d,testId:"button-share"}),m&&!k&&e.jsxs($,{size:"sm",variant:"outline",onClick:tt,className:"shrink-0 gap-1.5","data-testid":"button-edit-page",children:[e.jsx(Qt,{className:"w-3.5 h-3.5"}),"Edit Page"]})]})})}),e.jsx(Ct,{align:"center",className:"p-0 w-[min(calc(100vw-1rem),1400px)]","data-testid":"course-switcher-dropdown",children:e.jsx(ws,{current:r,courses:nt,onClose:()=>Le(!1)})})]})]}),e.jsxs("main",{className:"flex-1 max-w-5xl mx-auto w-full px-4 pb-16",children:[e.jsxs("div",{id:"hero",ref:D.hero,className:"pt-10 pb-12 scroll-mt-24",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:grid md:grid-cols-2 md:gap-8 md:items-start",children:[(r.category?.name||r.isProject)&&e.jsxs("div",{className:"hidden md:flex flex-wrap gap-2 md:col-start-1",children:[r.category?.name&&e.jsx(he,{variant:"outline",className:"text-xs",children:r.category.name}),r.isProject&&e.jsx(he,{variant:"outline",className:"text-xs",children:"Project"})]}),e.jsx("h1",{className:"text-3xl font-bold leading-tight md:col-start-1","data-testid":"text-course-title",children:r.title}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground md:hidden",children:[r.duration>0&&e.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"text-duration-mobile",children:[e.jsx(Te,{className:"w-4 h-4"}),qe(r.duration)]}),r.lessonCount&&r.lessonCount>0?e.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"text-lesson-count-mobile",children:[e.jsx(_e,{className:"w-4 h-4"}),r.lessonCount," ",r.lessonCount===1?"lesson":"lessons"]}):null]}),(r.difficulty||w.length>0)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 md:col-start-1",children:[r.difficulty&&e.jsx(he,{variant:"secondary",className:S("text-xs",mt[r.difficulty]||""),"data-testid":"badge-difficulty",children:r.difficulty}),w.map(t=>{if(t.isApplication){const n=Ht(t.icon);return e.jsxs("span",{title:t.displayName||t.name,className:"flex items-center gap-1 bg-muted rounded-md px-2 py-1 text-xs font-medium","data-testid":`badge-category-${t.id}`,children:[t.iconUrl?e.jsx("img",{src:t.iconUrl,alt:"",className:"w-3.5 h-3.5 rounded object-cover shrink-0"}):e.jsx(n,{className:"w-3.5 h-3.5 shrink-0",style:t.iconColor?{color:t.iconColor}:void 0}
1),t.displayName||t.name]},t.id)}return e.jsx(he,{variant:"secondary",className:"text-xs","data-testid":`badge-category-${t.id}`,children:t.displayName||t.name},t.id)})]}),e.jsxs("div",{className:"w-full space-y-4 md:col-start-2 md:row-start-1 md:row-span-6",children:[!r.isProject&&y?.wistiaHashedId?e.jsx(bs,{wistiaHashedId:y.wistiaHashedId,thumbnailUrl:r.thumbnailUrl,altText:r.title}):r.thumbnailUrl?e.jsx("img",{src:r.thumbnailUrl,alt:r.title,className:"w-full rounded-xl object-cover shadow-lg aspect-video","data-testid":"img-course-thumbnail"}):e.jsx("div",{className:"w-full aspect-video rounded-xl bg-muted flex items-center justify-center",children:e.jsx(ke,{className:"w-12 h-12 text-muted-foreground"})}),Q&&e.jsxs("div",{className:`flex items-center gap-2.5 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 px-4 py-3 transition-opacity duration-500 ${fe?"opacity-0":"opacity-100"}`,"data-testid":"banner-purchase-confirmed",children:[e.jsx(Vt,{className:"w-4 h-4 shrink-0 text-green-600 dark:text-green-400"}),e.jsx("p",{className:"text-sm font-medium text-green-700 dark:text-green-300 flex-1",children:"Purchase confirmed â you now have full access to this course."}),e.jsx("button",{onClick:ze,className:"shrink-0 text-green-600 dark:text-green-400 hover:text-green-800 dark:hover:text-green-200 transition-colors","aria-label":"Dismiss","data-testid":"button-dismiss-purchase-banner",children:e.jsx(Ce,{className:"w-4 h-4"})})]}),e.jsx(fs,{course:r,size:"lg",bundles:R?ue:[],onStartCourse:je,helpers:L}),O.length>0&&e.jsx("div",{className:"space-y-2","data-testid":"section-bundle-upsell",children:O.map(t=>{const n=xt=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.currency?.toUpperCase()??"USD",minimumFractionDigits:0,maximumFractionDigits:2}).format(xt),u=t.courseCredit??0,T=u>0,ht=T?Math.max(0,t.priceAmount-u):t.priceAmount;return e.jsxs("a",{href:`/checkout/bundle/${t.id}`,className:"flex items-center gap-3 rounded-lg border border-border bg-muted/40 hover:bg-muted/70 transition-colors px-4 py-3 text-sm group","data-testid":`link-bundle-upsell-${t.id}`,children:[e.jsx(ne,{className:"w-4 h-4 shrink-0 text-primary"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[T?e.jsxs("span",{className:"text-foreground font-medium group-hover:text-primary transition-colors",children:["Upgrade to"," ",e.jsx("span",{className:"underline underline-offset-2",children:t.name})]}):e.jsxs("span",{className:"text-foreground font-medium group-hover:text-primary transition-colors",children:["Also available in"," ",e.jsx("span",{className:"underline underline-offset-2",children:t.name})]}),T?e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[n(u)," course credit applied"]}):t.description?e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t.description}):null]}),e.jsxs("div",{className:"shrink-0 text-right",children:[T&&u>0&&e.jsx("p",{className:"text-xs text-muted-foreground line-through",children:n(t.priceAmount)}),e.jsx("span",{className:"font-semibold text-foreground",children:n(ht)})]}),e.jsx(We,{className:"w-4 h-4 shrink-0 text-muted-foreground group-hover:text-primary transition-colors"})]},t.id)})})]}),(r.longDescription||r.description)&&e.jsx("p",{className:"text-muted-foreground leading-relaxed md:col-start-1","data-testid":"text-course-description",children:r.longDescription?r.longDescription.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim():r.description}),e.jsxs("div",{className:"hidden md:flex flex-wrap gap-4 text-sm text-muted-foreground md:col-start-1",children:[r.duration>0&&e.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"text-duration",children:[e.jsx(Te,{className:"w-4 h-4"}),qe(r.duration)]}),r.lessonCount&&r.lessonCount>0?e.jsxs("div",{className:"flex items-center gap-1.5","data-testid":"text-lesson-count",children:[e.jsx(_e,{className:"w-4 h-4"}),r.lessonCount," ",r.lessonCount===1?"lesson":"lessons"]}):null]})]}),e.jsx("div",{className:"mt-8",children:e.jsx(Z,{blocks:j.hero?.blocks??[],isEditMode:k,onChange:t=>M("hero",n=>({...n,blocks:t})),addBlockLabel:"Add Hero Block",anchorSections:V})})]}),e.jsx(Y,{}),(de||ce||k||(j.whatYouWillLearn?.blocks?.length??0)>0||(j.whoIsItFor?.blocks?.length??0)>0)&&e.jsxs(e.Fragment,{children:[e.jsx("section",{id:"whatYouWillLearn",ref:D.whatYouWillLearn,className:"py-12 scroll-mt-24",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-10",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"What You'll Learn"}),de&&e.jsx("div",{className:"space-y-3 mb-6",children:Re.map((t,n)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ee,{className:"w-5 h-5 text-primary shrink-0 mt-0.5"}),e.jsx("span",{className:"text-sm leading-relaxed",children:t})]},n))}),e.jsx(Z,{blocks:j.whatYouWillLearn?.blocks??[],isEditMode:k,onChange:t=>M("whatYouWillLearn",n=>({...n,blocks:t})),addBlockLabel:"Add Block",anchorSections:V})]}),e.jsxs("div",{id:"whoIsItFor",ref:D.whoIsItFor,children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Who Is This For?"}),ce&&e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none leading-relaxed mb-6",dangerouslySetInnerHTML:{__html:St(r.whoIsItFor)}}),e.jsx(Z,{blocks:j.whoIsItFor?.blocks??[],isEditMode:k,onChange:t=>M("whoIsItFor",n=>({...n,blocks:t})),addBlockLabel:"Add Block",anchorSections:V})]})]})}),e.jsx(Y,{})]}),(te||k||(j.curriculum?.blocks?.length??0)>0)&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{id:"curriculum",ref:D.curriculum,className:"py-12 scroll-mt-24",children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Course Curriculum"}),te&&e.jsx(hs,{curriculum:Me,onLessonClick:He}),e.jsx("div",{className:te?"mt-6":"",children:e.jsx(Z,{blocks:j.curriculum?.blocks??[],isEditMode:k,onChange:t=>M("curriculum",n=>({...n,blocks:t})),addBlockLabel:"Add Block",anchorSections:V})})]}),e.jsx(Y,{})]}),(se||k||(j.gallery?.blocks?.length??0)>0)&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{id:"gallery",ref:D.gallery,className:"py-12 scroll-mt-24",children:[e.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Gallery"}),se&&e.jsx(xs,{images:Ee}),e.jsx("div",{className:se?"mt-6":"",children:e.jsx(Z,{blocks:j.gallery?.blocks??[],isEditMode:k,onChange:t=>M("gallery",n=>({...n,blocks:t})),addBlockLabel:"Add Block",anchorSections:V})})]}),e.jsx(Y,{})]}),(re||k||(j.reviews?.blocks?.length??0)>0)&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{id:"reviews",ref:D.reviews,className:"py-12 scroll-mt-24",children:[e.jsxs("h2",{className:"text-2xl font-bold mb-6",children:["Student Reviews",re&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground ml-2",children:["(",le.length," ",le.length===1?"review":"reviews",")"]})]}),re&&e.jsx("div",{className:"grid sm:grid-cols-2 gap-4 mb-6",children:le.map((t,n)=>e.jsx(ps,{review:t},n))}),e.jsx(Z,{blocks:j.reviews?.blocks??[],isEditMode:k,onChange:t=>M("reviews",n=>({...n,blocks:t})),addBlockLabel:"Add Block",anchorSections:V})]}),e.jsx(Y,{})]}),(k||R&&ue.length>0)&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"py-12 scroll-mt-24","data-testid":"section-bundle",children:[k&&e.jsxs("div",{className:S("roun
1ded-xl border-2 border-dashed p-5 mb-6 space-y-4",R?"border-primary/30 bg-primary/5":"border-border bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:"Bundle Section"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:R?"Visible to all visitors":"Hidden from visitors â enable to show"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{htmlFor:"bundle-section-toggle",className:"text-sm",children:R?"Enabled":"Disabled"}),e.jsx(It,{id:"bundle-section-toggle",checked:R,onCheckedChange:t=>M("bundle",n=>({...n,enabled:t})),"data-testid":"toggle-bundle-section"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(xe,{className:"text-xs text-muted-foreground",children:"Featured Bundles"}),X.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:X.map(t=>{const n=I.find(u=>u.id===t);return e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-primary/10 text-primary text-xs font-medium",children:[e.jsx(ne,{className:"w-3 h-3"}),n?.name??t,e.jsx("button",{type:"button",className:"hover:text-destructive transition-colors",onClick:()=>M("bundle",u=>({...u,bundleIds:(u.bundleIds??[]).filter(T=>T!==t)})),"data-testid":`button-remove-bundle-${t}`,children:e.jsx(Ce,{className:"w-3 h-3"})})]},t)})}),I.filter(t=>!X.includes(t.id)).length>0&&e.jsx("div",{className:"flex gap-2",children:e.jsxs("select",{className:"flex-1 h-8 px-2 rounded-md border border-input bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring",defaultValue:"",onChange:t=>{const n=t.target.value;n&&(t.target.value="",M("bundle",u=>({...u,bundleIds:[...u.bundleIds??[],n]})))},"data-testid":"select-add-bundle",children:[e.jsx("option",{value:"",children:"Add a Thinkific bundleâ¦"}),I.filter(t=>!X.includes(t.id)).map(t=>e.jsxs("option",{value:t.id,children:[t.name,t.price?` â ${t.price}`:""]},t.id))]})}),I.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No Thinkific bundles found. Sync them in the Carousel Manager."})]}),R&&X.length>0&&e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 pt-1 border-t border-border",children:[e.jsxs("div",{className:"space-y-1.5 pt-3",children:[e.jsx(xe,{htmlFor:"bundle-cta-label",className:"text-xs",children:"Button Label"}),e.jsx(De,{id:"bundle-cta-label",value:J.ctaLabel??"",placeholder:"Buy the Bundle",onChange:t=>M("bundle",n=>({...n,ctaLabel:t.target.value})),className:"h-8 text-sm","data-testid":"input-bundle-cta-label"})]}),e.jsxs("div",{className:"space-y-1.5 pt-3",children:[e.jsx(xe,{htmlFor:"bundle-cta-url",className:"text-xs",children:"Button URL (leave blank for bundle checkout)"}),e.jsx(De,{id:"bundle-cta-url",value:J.ctaUrl??"",placeholder:E?.checkoutUrl??"https://...",onChange:t=>M("bundle",n=>({...n,ctaUrl:t.target.value})),className:"h-8 text-sm","data-testid":"input-bundle-cta-url"})]})]})]}),R&&E&&e.jsxs("div",{className:"rounded-2xl border border-border bg-card overflow-hidden",children:[e.jsxs("div",{className:"bg-primary/8 border-b border-border px-6 py-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(ne,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium uppercase tracking-wider mb-0.5",children:"Also available as part of"}),e.jsx("h3",{className:"font-semibold truncate","data-testid":"text-bundle-name",children:E.name})]}),E.price&&e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Bundle price"}),e.jsx("p",{className:"font-bold text-lg","data-testid":"text-bundle-price",children:E.price})]})]}),e.jsxs("div",{className:"px-6 py-5 space-y-5",children:[E.courseNames&&E.courseNames.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Courses included in this bundle"}),e.jsx("ul",{className:"space-y-1.5","data-testid":"list-bundle-courses",children:E.courseNames.map((t,n)=>e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ee,{className:"w-3.5 h-3.5 text-primary shrink-0"}),e.jsx("span",{children:t})]},n))})]}),e.jsx("div",{className:"pt-1",children:e.jsxs($,{size:"lg",className:"gap-2",onClick:()=>{const t=lt;t&&window.open(t,"_blank","noopener,noreferrer")},"data-testid":"button-bundle-cta",children:[e.jsx(Jt,{className:"w-4 h-4"}),it,E.price&&e.jsxs("span",{className:"opacity-80",children:["â ",E.price]})]})})]})]})]}),e.jsx(Y,{})]}),e.jsx(gs,{course:r,bundles:R?ue:[],onStartCourse:je,helpers:L,draftHelpers:ge,isEditMode:k,isAdmin:!!l?.isAdmin,onDraftHelperChange:(t,n)=>be(u=>({...u,[t]:n}))})]}),e.jsx(Dt,{}),e.jsx(qt,{open:A,onOpenChange:t=>{_(t),t||W(null)},trigger:"lesson",returnTo:K?`${window.location.pathname}?lesson=${encodeURIComponent(K.title)}${K.seekSecs?`&t=${K.seekSecs}`:""}`:`${window.location.pathname}?startCourse=true`})]})}
1export{yr 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.