@hirebus/academy
Version:
React component library for academy and learning platforms
81 lines • 257 kB
JavaScript
"use strict";const a=require("react/jsx-runtime"),N=require("react"),ns=require("nuqs"),Go=require("nuqs/adapters/react"),zt=require("@radix-ui/react-slot"),cc=require("@radix-ui/react-collapsible"),Yo=require("react-dom"),uc=require("@radix-ui/react-dropdown-menu");var ln=typeof document<"u"?document.currentScript:null;function Vr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const m=Vr(N),Ko=Vr(cc),Br=Vr(Yo),be=Vr(uc),jt={course:{view:"course",create:"course/create",edit:"course/edit",viewById:e=>`course/${e}`,editById:e=>`course/edit/${e}`},academy:{index:"/academy",viewCourse:e=>`/academy?route=course/${e}`}},Xo=()=>{},Jo=typeof process<"u"&&process.env.NODE_ENV==="production"||typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ln&&ln.tagName.toUpperCase()==="SCRIPT"&&ln.src||new URL("index-BH5PkfxW.cjs",document.baseURI).href}<"u"&&!0,dc=Jo?Xo:(...e)=>console.debug(...e),fc=Jo?Xo:(...e)=>console.info(...e),pc=(...e)=>console.warn(...e),mc=(...e)=>console.error(...e),Qo={debug:dc,info:fc,warn:pc,error:mc},Vs=e=>{let t;const r=new Set,n=(u,f)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const h=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),r.forEach(g=>g(t,h))}},s=()=>t,l={setState:n,getState:s,getInitialState:()=>c,subscribe:u=>(r.add(u),()=>r.delete(u))},c=t=e(n,s,l);return l},hc=e=>e?Vs(e):Vs,gc=e=>e;function yc(e,t=gc){const r=N.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return N.useDebugValue(r),r}const vc=e=>{const t=hc(e),r=n=>yc(t,n);return Object.assign(r,t),r},xc=e=>vc;function ea(e,t){let r;try{r=e()}catch{return}return{getItem:s=>{var o;const i=c=>c===null?null:JSON.parse(c,void 0),l=(o=r.getItem(s))!=null?o:null;return l instanceof Promise?l.then(i):i(l)},setItem:(s,o)=>r.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>r.removeItem(s)}}const Rn=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return Rn(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Rn(n)(r)}}}},bc=(e,t)=>(r,n,s)=>{let o={storage:ea(()=>localStorage),partialize:d=>d,version:0,merge:(d,v)=>({...v,...d}),...t},i=!1;const l=new Set,c=new Set;let u=o.storage;if(!u)return e((...d)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...d)},n,s);const f=()=>{const d=o.partialize({...n()});return u.setItem(o.name,{state:d,version:o.version})},p=s.setState;s.setState=(d,v)=>{p(d,v),f()};const h=e((...d)=>{r(...d),f()},n,s);s.getInitialState=()=>h;let g;const b=()=>{var d,v;if(!u)return;i=!1,l.forEach(y=>{var C;return y((C=n())!=null?C:h)});const w=((v=o.onRehydrateStorage)==null?void 0:v.call(o,(d=n())!=null?d:h))||void 0;return Rn(u.getItem.bind(u))(o.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==o.version){if(o.migrate){const C=o.migrate(y.state,y.version);return C instanceof Promise?C.then(j=>[!0,j]):[!0,C]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var C;const[j,S]=y;if(g=o.merge(S,(C=n())!=null?C:h),r(g,!0),j)return f()}).then(()=>{w==null||w(g,void 0),g=n(),i=!0,c.forEach(y=>y(g))}).catch(y=>{w==null||w(void 0,y)})};return s.persist={setOptions:d=>{o={...o,...d},d.storage&&(u=d.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>b(),hasHydrated:()=>i,onHydrate:d=>(l.add(d),()=>{l.delete(d)}),onFinishHydration:d=>(c.add(d),()=>{c.delete(d)})},o.skipHydration||b(),g||h},wc=bc,Sc={courses:[],editingCourse:null},We=xc()(wc(e=>({...Sc,setInitialCourses:t=>{e({courses:t})},addCourse:t=>{e(r=>({courses:[...r.courses,t]}))},updateCourse:t=>{e(r=>({courses:r.courses.map(n=>n.courseId===t.courseId?{...n,...t}:n)}))},deleteCourse:t=>{e(r=>({courses:r.courses.filter(n=>n.courseId!==t)}))},setVideoProgress:(t,r)=>{e(n=>({courses:n.courses.map(s=>s.courseId===t?{...s,videoProgress:r}:s)}))},setEditingCourse:t=>{e({editingCourse:t})}}),{name:"__academy_storage",storage:ea(()=>({getItem:e=>{const t=localStorage.getItem(e);if(!t)return null;try{const r=JSON.parse(t);if(r.state&&Array.isArray(r.state.courses)){const n=We.getState();r.state.courses=r.state.courses.map(s=>{const o=n.courses.find(i=>i.courseId===s.courseId);return o?{...o,...s}:{...s,courseContent:[],courseFiles:[],enrolledUsers:[],creatorId:0}})}return r}catch(r){return Qo.error("Error parsing stored state:",r),null}},setItem:(e,t)=>localStorage.setItem(e,JSON.stringify(t)),removeItem:e=>localStorage.removeItem(e)})),partialize:e=>({courses:e.courses.map(t=>({courseId:t.courseId,name:t.name,description:t.description,category:t.category,tags:t.tags,status:t.status,createdAt:t.createdAt,updatedAt:t.updatedAt}))})}));var ke=(e=>(e.AllCourses="All Courses",e.ProfessionalDevelopment="Professional Development",e.SkillsDevelopment="Skills Development",e.WorkplaceSuccess="Workplace Success",e.Management="Management",e.Leadership="Leadership",e))(ke||{}),ne=(e=>(e.PDF="application/pdf",e.MP4="video/mp4",e.PNG="image/png",e.WEBP="image/webp",e.JPG="image/jpeg",e))(ne||{}),je=(e=>(e.DRAFT="Draft",e.ACTIVE="Active",e.INACTIVE="Inactive",e))(je||{});function ta(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=ta(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Cc(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=ta(e))&&(n&&(n+=" "),n+=t);return n}const ss="-",jc=e=>{const t=Pc(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{const l=i.split(ss);return l[0]===""&&l.length!==1&&l.shift(),ra(l,t)||Nc(i)},getConflictingClassGroupIds:(i,l)=>{const c=r[i]||[];return l&&n[i]?[...c,...n[i]]:c}}},ra=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?ra(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(ss);return(i=t.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},Bs=/^\[(.+)\]$/,Nc=e=>{if(Bs.test(e)){const t=Bs.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Pc=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return _c(Object.entries(e.classGroups),r).forEach(([o,i])=>{On(i,n,o,t)}),n},On=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:zs(t,s);o.classGroupId=r;return}if(typeof s=="function"){if(Tc(s)){On(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([o,i])=>{On(i,zs(t,o),r,n)})})},zs=(e,t)=>{let r=e;return t.split(ss).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Tc=e=>e.isThemeGetter,_c=(e,t)=>t?e.map(([r,n])=>{const s=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[t+i,l])):o);return[r,s]}):e,Ec=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(o,i)=>{r.set(o,i),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let i=r.get(o);if(i!==void 0)return i;if((i=n.get(o))!==void 0)return s(o,i),i},set(o,i){r.has(o)?r.set(o,i):s(o,i)}}},na="!",Ac=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],o=t.length,i=l=>{const c=[];let u=0,f=0,p;for(let v=0;v<l.length;v++){let w=l[v];if(u===0){if(w===s&&(n||l.slice(v,v+o)===t)){c.push(l.slice(f,v)),f=v+o;continue}if(w==="/"){p=v;continue}}w==="["?u++:w==="]"&&u--}const h=c.length===0?l:l.substring(f),g=h.startsWith(na),b=g?h.substring(1):h,d=p&&p>f?p-f:void 0;return{modifiers:c,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:d}};return r?l=>r({className:l,parseClassName:i}):i},Rc=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},Oc=e=>({cache:Ec(e.cacheSize),parseClassName:Ac(e),...jc(e)}),Ic=/\s+/,kc=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(Ic);let l="";for(let c=i.length-1;c>=0;c-=1){const u=i[c],{modifiers:f,hasImportantModifier:p,baseClassName:h,maybePostfixModifierPosition:g}=r(u);let b=!!g,d=n(b?h.substring(0,g):h);if(!d){if(!b){l=u+(l.length>0?" "+l:l);continue}if(d=n(h),!d){l=u+(l.length>0?" "+l:l);continue}b=!1}const v=Rc(f).join(":"),w=p?v+na:v,y=w+d;if(o.includes(y))continue;o.push(y);const C=s(d,b);for(let j=0;j<C.length;++j){const S=C[j];o.push(w+S)}l=u+(l.length>0?" "+l:l)}return l};function Mc(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=sa(t))&&(n&&(n+=" "),n+=r);return n}const sa=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=sa(e[n]))&&(r&&(r+=" "),r+=t);return r};function Dc(e,...t){let r,n,s,o=i;function i(c){const u=t.reduce((f,p)=>p(f),e());return r=Oc(u),n=r.cache.get,s=r.cache.set,o=l,l(c)}function l(c){const u=n(c);if(u)return u;const f=kc(c,r);return s(c,f),f}return function(){return o(Mc.apply(null,arguments))}}const pe=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},oa=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lc=/^\d+\/\d+$/,Fc=new Set(["px","full","screen"]),$c=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Bc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,at=e=>$t(e)||Fc.has(e)||Lc.test(e),mt=e=>qt(e,"length",Xc),$t=e=>!!e&&!Number.isNaN(Number(e)),cn=e=>qt(e,"number",$t),Xt=e=>!!e&&Number.isInteger(Number(e)),Wc=e=>e.endsWith("%")&&$t(e.slice(0,-1)),le=e=>oa.test(e),ht=e=>$c.test(e),Hc=new Set(["length","size","percentage"]),qc=e=>qt(e,Hc,aa),Zc=e=>qt(e,"position",aa),Gc=new Set(["image","url"]),Yc=e=>qt(e,Gc,Qc),Kc=e=>qt(e,"",Jc),Jt=()=>!0,qt=(e,t,r)=>{const n=oa.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},Xc=e=>Uc.test(e)&&!Vc.test(e),aa=()=>!1,Jc=e=>Bc.test(e),Qc=e=>zc.test(e),eu=()=>{const e=pe("colors"),t=pe("spacing"),r=pe("blur"),n=pe("brightness"),s=pe("borderColor"),o=pe("borderRadius"),i=pe("borderSpacing"),l=pe("borderWidth"),c=pe("contrast"),u=pe("grayscale"),f=pe("hueRotate"),p=pe("invert"),h=pe("gap"),g=pe("gradientColorStops"),b=pe("gradientColorStopPositions"),d=pe("inset"),v=pe("margin"),w=pe("opacity"),y=pe("padding"),C=pe("saturate"),j=pe("scale"),S=pe("sepia"),V=pe("skew"),T=pe("space"),W=pe("translate"),z=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",le,t],E=()=>[le,t],$=()=>["",at,mt],I=()=>["auto",$t,le],K=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],L=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],ie=()=>["","0",le],A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>[$t,le];return{cacheSize:500,separator:":",theme:{colors:[Jt],spacing:[at,mt],blur:["none","",ht,le],brightness:k(),borderColor:[e],borderRadius:["none","","full",ht,le],borderSpacing:E(),borderWidth:$(),contrast:k(),grayscale:ie(),hueRotate:k(),invert:ie(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[Wc,mt],inset:O(),margin:O(),opacity:k(),padding:E(),saturate:k(),scale:k(),sepia:ie(),skew:k(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",le]}],container:["container"],columns:[{columns:[ht]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...K(),le]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[d]}],"inset-x":[{"inset-x":[d]}],"inset-y":[{"inset-y":[d]}],start:[{start:[d]}],end:[{end:[d]}],top:[{top:[d]}],right:[{right:[d]}],bottom:[{bottom:[d]}],left:[{left:[d]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Xt,le]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",le]}],grow:[{grow:ie()}],shrink:[{shrink:ie()}],order:[{order:["first","last","none",Xt,le]}],"grid-cols":[{"grid-cols":[Jt]}],"col-start-end":[{col:["auto",{span:["full",Xt,le]},le]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Jt]}],"row-start-end":[{row:["auto",{span:[Xt,le]},le]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",le]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",le,t]}],"min-w":[{"min-w":[le,t,"min","max","fit"]}],"max-w":[{"max-w":[le,t,"none","full","min","max","fit","prose",{screen:[ht]},ht]}],h:[{h:[le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ht,mt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",cn]}],"font-family":[{font:[Jt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",le]}],"line-clamp":[{"line-clamp":["none",$t,cn]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",at,le]}],"list-image":[{"list-image":["none",le]}],"list-style-type":[{list:["none","disc","decimal",le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",at,mt]}],"underline-offset":[{"underline-offset":["auto",at,le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...K(),Zc]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qc]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Yc]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...L(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:L()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...L()]}],"outline-offset":[{"outline-offset":[at,le]}],"outline-w":[{outline:[at,mt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[at,mt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ht,Kc]}],"shadow-color":[{shadow:[Jt]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ht,le]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",le]}],duration:[{duration:k()}],ease:[{ease:["linear","in","out","in-out",le]}],delay:[{delay:k()}],animate:[{animate:["none","spin","ping","pulse","bounce",le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Xt,le]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[V]}],"skew-y":[{"skew-y":[V]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",le]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[at,mt,cn]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},tu=Dc(eu);function F(...e){return tu(Cc(e))}const nt=[ne.PNG,ne.JPG,ne.WEBP];function ru(e,t){return e.find(r=>r.courseId===t)}const In="videoProgressStorage";function nu(e){if(typeof window>"u")return null;const t=localStorage.getItem(In);return t?JSON.parse(t)[e]??null:null}function su(e,t){if(typeof window>"u")return;const r=localStorage.getItem(In);let n={};r&&(n=JSON.parse(r)),n[e]=t,localStorage.setItem(In,JSON.stringify(n))}function os({className:e,size:t="md"}){const r={sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"};return a.jsx("div",{className:F("flex items-center justify-center py-12",e),"data-testid":"loading-spinner",children:a.jsx("div",{className:F("animate-spin rounded-full border-b-2 border-t-2 border-primary",r[t])})})}function ia(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=ia(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function ou(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=ia(e))&&(n&&(n+=" "),n+=t);return n}const Ws=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,Hs=ou,au=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Hs(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(u=>{const f=r==null?void 0:r[u],p=o==null?void 0:o[u];if(f===null)return null;const h=Ws(f)||Ws(p);return s[u][h]}),l=r&&Object.entries(r).reduce((u,f)=>{let[p,h]=f;return h===void 0||(u[p]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,f)=>{let{class:p,className:h,...g}=f;return Object.entries(g).every(b=>{let[d,v]=b;return Array.isArray(v)?v.includes({...o,...l}[d]):{...o,...l}[d]===v})?[...u,p,h]:u},[]);return Hs(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},iu=au("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary-focus",destructive:"bg-error text-on-primary hover:bg-error/90",outline:"border border-input bg-background hover:bg-base-200 hover:text-base-700",secondary:"bg-secondary text-secondary-content hover:bg-secondary-focus",ghost:"hover:bg-base-200 hover:text-base-700",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ne=m.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},o)=>{const i=n?zt.Slot:"button";return a.jsx(i,{className:F(iu({variant:t,size:r,className:e})),ref:o,...s})});Ne.displayName="Button";function lu({categories:e,activeCategory:t,courseCount:r=0,onSelectCategory:n,className:s}){return a.jsx("div",{className:F("flex flex-wrap items-center gap-2",s),children:e.map(o=>a.jsxs(Ne,{variant:t===o?"default":"outline",className:F("rounded-full",t===o?"text-on-primary bg-primary hover:bg-primary-focus":"bg-base-200 text-base-700 hover:bg-base-300"),onClick:()=>n(o),children:[o,o===ke.AllCourses&&r!==void 0&&a.jsx("span",{className:"ml-1 rounded-full bg-base-100 px-1.5 py-0.5 text-xs text-base-700",children:r})]},`category.${o}`))})}const dt=m.forwardRef(({className:e,...t},r)=>a.jsx("div",{"data-testid":"card",ref:r,className:F("rounded-lg border border-base-300 bg-base-100 text-base-content shadow-sm",e),...t}));dt.displayName="Card";const Zt=m.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:F("flex flex-col space-y-1.5 p-6",e),...t}));Zt.displayName="CardHeader";const ur=m.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:F("text-2xl font-semibold leading-none tracking-tight",e),...t}));ur.displayName="CardTitle";const cu=m.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:F("text-sm text-base-600",e),...t}));cu.displayName="CardDescription";const wt=m.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:F("p-6 pt-0",e),...t}));wt.displayName="CardContent";const zr=m.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:F("flex items-center p-6 pt-0",e),...t}));zr.displayName="CardFooter";function la(e){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})})}function ca(e){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),a.jsx("polyline",{points:"12 5 19 12 12 19"})]})}const ua=({className:e})=>a.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"})});function uu(e){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z",clipRule:"evenodd"})})}const kn=({className:e})=>a.jsxs("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]});function du(e){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",width:"24",height:"24",...e,children:[a.jsx("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}const Tt=m.forwardRef(({className:e,...t},r)=>a.jsxs("svg",{ref:r,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:F("h-4 w-4 animate-spin",e),fill:"none",...t,children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),a.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}));Tt.displayName="LoaderIcon";const fu=({className:e,...t})=>a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:F("size-4",e),...t,children:[a.jsx("circle",{cx:"12",cy:"12",r:"1"}),a.jsx("circle",{cx:"12",cy:"5",r:"1"}),a.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Mn=({className:e})=>a.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"})});function qs(e){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"24",height:"24",...e,children:a.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.427 1.529-2.33 2.779-1.643l11.54 6.347c1.295.712 1.295 2.573 0 3.286L7.28 19.99c-1.25.687-2.779-.217-2.779-1.643V5.653Z",clipRule:"evenodd"})})}const da=({className:e})=>a.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 5v14M5 12h14"})}),pu=({className:e,...t})=>a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:F("size-4",e),...t,children:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("path",{d:"m21 21-4.3-4.3"})]}),Dn=({className:e})=>a.jsxs("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M3 6h18"}),a.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),a.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]});function mu(e){return e<1024?e+" bytes":e<1024*1024?(e/1024).toFixed(2)+" KB":(e/(1024*1024)).toFixed(2)+" MB"}function hu(e){return nt.includes(e)?{icon:"image",color:"text-blue-500"}:e===ne.MP4?{icon:"video",color:"text-purple-500"}:e===ne.PDF?{icon:"pdf",color:"text-red-500"}:{icon:"file",color:"text-gray-500"}}function Zs(e){switch(e){case ne.JPG:case ne.PNG:case ne.WEBP:return"image/jpeg,image/png,image/webp";case ne.MP4:return"video/mp4,video/webm,video/mov";case ne.PDF:return"application/pdf,application/doc,application/docx,application/ppt,application/pptx,application/xls,application/xlsx";default:return""}}function Ln(e){switch(e){case ne.JPG:case ne.PNG:case ne.WEBP:return"JPEG, PNG, WEBP";case ne.MP4:return"MP4, WEBM, MOV";case ne.PDF:return"PDF";default:return""}}const gu=e=>new Promise(t=>{try{const r=document.createElement("video"),n=document.createElement("canvas"),s=n.getContext("2d");if(!s){t(null);return}r.autoplay=!1,r.muted=!0,r.src=URL.createObjectURL(e),r.onloadedmetadata=()=>{n.width=r.videoWidth,n.height=r.videoHeight,r.currentTime=0},r.onseeked=()=>{try{s.drawImage(r,0,0,n.width,n.height),n.toBlob(o=>{if(o){const i=new File([o],`${e.name.split(".")[0]}-thumbnail.png`,{type:"image/png"});URL.revokeObjectURL(r.src),t(i)}else URL.revokeObjectURL(r.src),t(null)},"image/png")}catch{URL.revokeObjectURL(r.src),t(null)}},r.onerror=()=>{URL.revokeObjectURL(r.src),t(null)}}catch{t(null)}}),yu=e=>new Promise(t=>{const r=document.createElement("video");r.preload="metadata";const n=setTimeout(()=>{URL.revokeObjectURL(r.src),t(0)},5e3);r.onloadedmetadata=()=>{clearTimeout(n);const s=r.duration?Math.round(r.duration):0;URL.revokeObjectURL(r.src),t(s)},r.onerror=()=>{clearTimeout(n),URL.revokeObjectURL(r.src),t(0)},r.src=URL.createObjectURL(e)});function vu(e){if(e<60)return`${Math.floor(e)} seconds`;if(e<3600){const t=Math.floor(e/60),r=Math.floor(e%60);return`${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")} min`}else{const t=Math.floor(e/3600),r=Math.floor(e%3600/60);return`${String(t).padStart(2,"0")}:${String(r).padStart(2,"0")} hr`}}/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),Gs=e=>{const t=bu(e);return t.charAt(0).toUpperCase()+t.slice(1)},fa=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var wu={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Su=N.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...l},c)=>N.createElement("svg",{ref:c,...wu,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:fa("lucide",s),...l},[...i.map(([u,f])=>N.createElement(u,f)),...Array.isArray(o)?o:[o]]));/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const He=(e,t)=>{const r=N.forwardRef(({className:n,...s},o)=>N.createElement(Su,{ref:o,iconNode:t,className:fa(`lucide-${xu(Gs(e))}`,`lucide-${e}`,n),...s}));return r.displayName=Gs(e),r};/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Cu=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],pa=He("check",Cu);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ju=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],as=He("chevron-down",ju);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nu=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Pu=He("chevron-right",Nu);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tu=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ma=He("chevron-up",Tu);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _u=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Eu=He("circle",_u);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Au=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],Ru=He("cloud-upload",Au);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ou=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],Iu=He("download",Ou);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ku=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Mu=He("external-link",ku);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Du=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],is=He("file",Du);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lu=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Fu=He("tag",Lu);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $u=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],ha=He("trash-2",$u);/**
* @license lucide-react v0.486.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ga=He("x",Uu);function Vu({course:e,onViewCourse:t,className:r}){const[n,s]=N.useState(!1),o=u=>u.split("_").map(f=>f.charAt(0).toUpperCase()+f.slice(1).toLowerCase()).join(" "),i=()=>{t==null||t(e.courseId)},{videoFile:l,thumbnailFile:c}=N.useMemo(()=>{var u;return(u=e.courseFiles)!=null&&u.length?e.courseFiles.reduce((f,p)=>(p.mimeType===ne.MP4&&!f.videoFile?f.videoFile=p:p.mimeType&&nt.includes(p.mimeType)&&!f.thumbnailFile&&(f.thumbnailFile=p),f),{videoFile:void 0,thumbnailFile:void 0}):{videoFile:void 0,thumbnailFile:void 0}},[e.courseFiles]);return a.jsxs(dt,{className:F("overflow-hidden border border-gray-200 bg-white shadow-sm","cursor-pointer transition-all duration-300 ease-in-out","flex h-full flex-col",n&&"-translate-y-1 transform shadow-lg",r),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onClick:i,children:[a.jsxs("div",{className:"relative",children:[c?a.jsxs("div",{className:"relative",children:[a.jsx("img",{src:c.signedS3Url,alt:e.name,className:"h-[200px] w-full object-cover"}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("button",{className:F("flex h-16 w-16 items-center justify-center rounded-full bg-blue-600 text-white hover:bg-blue-700","transition-opacity duration-200",n?"opacity-100":"opacity-0"),"aria-label":"Play course",onClick:u=>{u.stopPropagation(),t==null||t(e.courseId)},children:a.jsx(qs,{className:"h-8 w-8"})})})]}):a.jsxs("div",{className:"relative flex h-[200px] w-full items-center justify-center bg-gray-300",children:[a.jsx("span",{className:"text-gray-600",children:"No image"}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("button",{className:F("flex h-16 w-16 items-center justify-center rounded-full bg-blue-600 text-white hover:bg-blue-700","transition-opacity duration-200",n?"opacity-100":"opacity-0"),"aria-label":"Play course",onClick:u=>{u.stopPropagation(),t==null||t(e.courseId)},children:a.jsx(qs,{className:"h-8 w-8"})})})]}),(l==null?void 0:l.duration)!==void 0&&a.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-black/50 p-1",children:a.jsx("div",{className:"flex items-center justify-between text-xs text-white",children:a.jsxs("span",{className:"flex items-center text-xs font-medium text-white",children:[a.jsx(uu,{className:"mr-1 h-4 w-4"}),vu(l.duration)]})})})]}),a.jsxs(wt,{className:"flex-grow bg-white p-4",children:[a.jsx("div",{className:"mb-2",children:a.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-blue-600",children:o(e.category)})}),a.jsx("h3",{className:"mb-2 text-base font-semibold text-gray-900",children:e.name}),e.description&&a.jsx("p",{className:"line-clamp-2 text-sm font-normal text-gray-600",children:e.description}),e.tags&&e.tags.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"flex flex-col gap-1.5",children:a.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[a.jsx(Fu,{className:"mr-1.5 h-3.5 w-3.5 text-gray-400"}),a.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,3).map(u=>a.jsx("span",{className:"inline-flex rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-600",children:u},u)),e.tags.length>3&&a.jsxs("span",{className:"inline-flex rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-600",children:["+",e.tags.length-3]})]})]})})})]}),a.jsx(zr,{className:"mt-auto bg-white p-4 pt-0",children:a.jsx(Ne,{className:"w-full bg-blue-600 text-white hover:bg-blue-800",variant:"default",onClick:u=>{u.stopPropagation(),t==null||t(e.courseId)},children:"View"})})]})}function Bu({courses:e,onViewCourse:t,className:r}){return e.length?a.jsx("div",{className:F("grid grid-cols-1 gap-6 md:grid-cols-2 2xl:grid-cols-3",r),children:e.map(n=>a.jsx(Vu,{course:n,onViewCourse:t},`course-card-${n.courseId}`))}):a.jsx("div",{className:"mt-4 flex items-center justify-center rounded-lg p-8 text-gray-500",children:"No courses found"})}const Fn=m.forwardRef(({className:e,type:t,...r},n)=>a.jsx("input",{type:t,className:F("box-border h-[44px] w-full md:w-full","rounded-2xl border border-base-400","px-3 md:px-4","placeholder:text-base-400","focus:border-[2px] focus:border-primary-focus focus:outline-none focus:ring-0 focus:ring-primary-100","disabled:border-base-400 disabled:bg-base-100 disabled:text-base-400",e),ref:n,...r}));Fn.displayName="BaseInput";const dr=m.forwardRef(({className:e,type:t,label:r,error:n,required:s,...o},i)=>r?a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsxs("label",{htmlFor:o.id??r,className:"text-base-600",children:[r,s&&a.jsx("span",{className:"ml-1 text-error",children:"*"})]}),a.jsx(Fn,{ref:i,className:F(e,n&&"border-error"),type:t,...o,id:o.id??r}),n&&a.jsx("p",{className:"text-sm text-error",children:n})]}):a.jsx(Fn,{ref:i,className:e,type:t,...o}));dr.displayName="Input";function zu({onSearch:e,className:t}){const[r,n]=N.useState(""),s=N.useRef(null);N.useEffect(()=>(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(r)},290),()=>{s.current&&clearTimeout(s.current)}),[r,e]);const o=l=>{l.preventDefault(),s.current&&clearTimeout(s.current),e(r)},i=l=>{n(l.target.value)};return a.jsx("div",{className:F("relative w-full",t),children:a.jsxs("form",{onSubmit:o,children:[a.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 z-10 -translate-y-1/2 text-base-500",children:a.jsx(pu,{width:"16",height:"16"})}),a.jsx(dr,{type:"text",placeholder:"Search courses...",value:r,onChange:i,className:"w-full rounded-md border-base-400 bg-base-100 py-2 pl-8 text-base-700 focus:border-primary focus:ring-2 focus:ring-primary-100 md:pl-9"})]})})}function Wu({courses:e=[],categories:t=Object.values(ke),initialActiveCategory:r=ke.AllCourses,onViewCourse:n,isLoading:s=!0,className:o}){const[i,l]=N.useState(r),[c,u]=N.useState(""),f=N.useMemo(()=>e.length,[e]),p=N.useMemo(()=>{let b=e;if(i!==ke.AllCourses&&(b=b.filter(d=>d.category===i)),c.trim()){const d=c.toLowerCase();b=b.filter(v=>{var w;return v.name.toLowerCase().includes(d)||((w=v.description)==null?void 0:w.toLowerCase().includes(d))})}return b},[e,c,i]),h=N.useCallback(b=>{l(b)},[]),g=N.useCallback(b=>{u(b)},[]);return a.jsx("div",{className:F("min-h-screen w-full bg-white text-gray-900",o),children:a.jsxs("div",{className:"container mx-auto px-4 py-6",children:[a.jsx("div",{className:"mb-6",children:a.jsx(lu,{categories:t,activeCategory:i,courseCount:f,onSelectCategory:h})}),a.jsx("div",{className:"mb-6 flex items-center",children:a.jsx("div",{className:"w-full max-w-md",children:a.jsx(zu,{onSearch:g})})}),s?a.jsx(os,{}):a.jsxs(a.Fragment,{children:[a.jsxs("h2",{className:"mb-4 text-lg font-medium text-gray-800",children:[i===ke.AllCourses?"All Courses":t.find(b=>b===i)||"Courses"," ","(",p.length," ",p.length===1?"course":"courses",")"]}),a.jsx(Bu,{courses:p,onViewCourse:n})]})]})})}function Hu({onBack:e,label:t="Back to Courses"}){return a.jsxs(Ne,{onClick:e,variant:"ghost",className:"gap-1 p-0 px-3 py-1 text-base-600 hover:text-base-700",children:[a.jsx(la,{className:"h-5 w-5"}),a.jsx("span",{children:t})]})}const qu=Ko.Root,Zu=Ko.CollapsibleContent;function ya({title:e,children:t,defaultOpen:r=!0,className:n,onOpenChange:s}){const[o,i]=N.useState(r),l=N.useCallback(()=>{i(c=>!c),s==null||s(!o)},[o,s]);return a.jsx(dt,{className:n,children:a.jsxs(qu,{open:o,onOpenChange:l,children:[a.jsx("button",{type:"button",className:"w-full text-left",onClick:l,"aria-expan