import{b as et,c as nt}from"./chunk-R3PUHZUP.js";import"./chunk-3RK6DDJD.js";import{a as tt}from"./chunk-7XDVX5KB.js";import{b as st,g as gt}from"./chunk-TAS7XC6E.js";import{a as mt}from"./chunk-GMUETU5N.js";import"./chunk-3GOV5KJM.js";import"./chunk-TPLZKWZ7.js";import{b as K,e as W,f as X,i as Z}from"./chunk-EGL4ZKWQ.js";import{a as dt}from"./chunk-GPI43RSU.js";import{a as Y,c as H,i as J}from"./chunk-6NRCTHHS.js";import"./chunk-RC3JXGN6.js";import{b as lt}from"./chunk-N6VRXIQE.js";import{b as A,f as B,j as R,n as Q,z as U}from"./chunk-GWD5A44H.js";import"./chunk-52JZ5I3Y.js";import{Aa as ct,C as q,j as N,ua as it,w as G,wa as ot,x as j,ya as rt,za as at}from"./chunk-COFYR5MX.js";import{Bb as h,Cb as T,Db as m,Eb as s,Ec as v,F as w,Gb as z,Hb as M,I as S,Ib as b,Jb as V,Kb as i,Lb as n,Mb as O,Tb as C,U as x,Xb as u,Za as c,Zb as l,da as y,i as k,ia as g,ic as F,ja as _,jc as I,lc as o,mc as f,nc as $,ob as L,ta as E,tc as P,vc as D}from"./chunk-2MUIW2M6.js";var pt=()=>[1,2,3,4,5,6],Ct=(t,r)=>r.id;function ut(t,r){if(t&1){let e=C();i(0,"button",11),u("click",function(){g(e);let d=l();return _(d.searchControl.setValue(""))}),i(1,"mat-icon"),o(2,"close"),n()()}}function ft(t,r){t&1&&(i(0,"mat-card",13)(1,"mat-card-content"),O(2,"div",14)(3,"div",15)(4,"div",16)(5,"div",17),n()())}function xt(t,r){t&1&&(i(0,"div",8)(1,"div",12),M(2,ft,6,0,"mat-card",13,z),n()()),t&2&&(c(2),b(D(0,pt)))}function yt(t,r){if(t&1){let e=C();i(0,"div",9)(1,"mat-icon",18),o(2,"error_outline"),n(),i(3,"h2"),o(4,"Oops! Something went wrong"),n(),i(5,"p"),o(6),n(),i(7,"button",19),u("click",function(){g(e);let d=l();return _(d.retry())}),i(8,"mat-icon"),o(9,"refresh"),n(),o(10," Try Again "),n()()}if(t&2){let e=l();c(6),f(e.error())}}function ht(t,r){t&1&&o(0," No categories match your search. Try a different keyword. ")}function Mt(t,r){t&1&&o(0," No categories are available at the moment. ")}function bt(t,r){if(t&1){let e=C();i(0,"button",19),u("click",function(){g(e);let d=l(3);return _(d.searchControl.setValue(""))}),i(1,"mat-icon"),o(2,"clear"),n(),o(3," Clear Search "),n()}}function Ot(t,r){if(t&1&&(i(0,"div",20)(1,"mat-icon",22),o(2,"folder_open"),n(),i(3,"h2"),o(4,"No Categories Found"),n(),i(5,"p"),m(6,ht,1,0)(7,Mt,1,0),n(),m(8,bt,4,0,"button",23),n()),t&2){let e=l(2);c(6),s(e.searchControl.value?6:7),c(2),s(e.searchControl.value?8:-1)}}function Pt(t,r){t&1&&(i(0,"div",26)(1,"mat-icon"),o(2,"lock"),n(),i(3,"span"),o(4,"Sign up to access"),n()())}function vt(t,r){t&1&&(i(0,"mat-chip",32)(1,"mat-icon"),o(2,"person"),n(),o(3," Members Only "),n())}function kt(t,r){if(t&1){let e=C();i(0,"button",36),u("click",function(d){g(e);let p=l().$implicit;return l(3).viewCategory(p),_(d.stopPropagation())}),o(1," Start Quiz "),i(2,"mat-icon"),o(3,"arrow_forward"),n()()}if(t&2){let e=l().$implicit;h("aria-label",P("Start quiz in ",e.name))}}function wt(t,r){if(t&1&&(i(0,"button",35)(1,"mat-icon"),o(2,"lock"),n(),o(3," Locked "),n()),t&2){let e=l().$implicit;h("aria-label",P("",e.name," is locked"))}}function St(t,r){if(t&1){let e=C();i(0,"mat-card",25),u("click",function(){let d=g(e).$implicit,p=l(3);return _(p.viewCategory(d))})("keydown.enter",function(){let d=g(e).$implicit,p=l(3);return _(p.viewCategory(d))})("keydown.space",function(){let d=g(e).$implicit,p=l(3);return _(p.viewCategory(d))}),m(1,Pt,5,0,"div",26),i(2,"mat-card-content")(3,"div",27)(4,"mat-icon"),o(5),n()(),i(6,"h3",28),o(7),n(),i(8,"p",29),o(9),n(),i(10,"div",30)(11,"div",31)(12,"mat-icon"),o(13,"quiz"),n(),i(14,"span"),o(15),n()(),m(16,vt,4,0,"mat-chip",32),n(),i(17,"div",33),m(18,kt,4,2,"button",34)(19,wt,4,2,"button",35),n()()()}if(t&2){let e=r.$implicit,a=l(3);I("locked",a.isCategoryLocked(e)),T("aria-label",e.name+" - "+e.description),c(),s(a.isCategoryLocked(e)?1:-1),c(2),F("background-color",e.color||"#3f51b5"),c(2),f(a.getCategoryIcon(e)),c(2),f(e.name),c(2),f(e.description),c(6),$("",e.questionCount," questions"),c(),s(e.guestAccessible?-1:16),c(2),s(a.isCategoryLocked(e)?19:18)}}function Et(t,r){if(t&1&&(i(0,"div",21),M(1,St,20,12,"mat-card",24,Ct),n()),t&2){let e=l(2);c(),b(e.filteredCategories())}}function Lt(t,r){if(t&1&&m(0,Ot,9,2,"div",20)(1,Et,3,0,"div",21),t&2){let e=l();s(e.isEmpty()?0:1)}}function Tt(t,r){t&1&&(i(0,"div",10)(1,"mat-icon"),o(2,"info"),n(),i(3,"p"),o(4," You're browsing as a guest. Some categories require registration. "),i(5,"a",37),o(6,"Sign up"),n(),o(7," to access all content! "),n()())}var _t=class t{categoryService=y(mt);guestService=y(dt);router=y(G);destroy$=new k;searchControl=new R("");filteredCategories=E([]);categories=this.categoryService.categoriesByDisplayOrder;isLoading=this.categoryService.isLoading;error=this.categoryService.error;isGuestMode=v(()=>this.guestService.guestState().isGuest);isEmpty=v(()=>!this.isLoading()&&this.filteredCategories().length===0);ngOnInit(){this.categoryService.getCategories().pipe(x(this.destroy$)).subscribe({next:()=>{this.filteredCategories.set(this.categories())}}),this.searchControl.valueChanges.pipe(w(300),S(),x(this.destroy$)).subscribe(r=>{this.handleSearch(r||"")})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}handleSearch(r){if(!r.trim()){this.filteredCategories.set(this.categories());return}let e=this.categoryService.searchCategories(r);this.filteredCategories.set(e)}viewCategory(r){!r.guestAccessible&&this.isGuestMode()||this.router.navigate(["/categories",r.id])}isCategoryLocked(r){return!r.guestAccessible&&this.isGuestMode()}getCategoryIcon(r){return r.icon||"folder"}retry(){this.categoryService.getCategories(!0).pipe(x(this.destroy$)).subscribe({next:()=>{this.filteredCategories.set(this.categories())}})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=L({type:t,selectors:[["app-category-list"]],decls:18,vars:6,consts:[[1,"category-list-container"],[1,"header"],[1,"subtitle"],[1,"search-section"],["appearance","outline",1,"search-field"],["matInput","","placeholder","Search by name or description...","aria-label","Search categories",3,"formControl"],["matPrefix",""],["mat-icon-button","","matSuffix","","aria-label","Clear search"],[1,"loading-container"],[1,"error-container"],[1,"guest-info-banner"],["mat-icon-button","","matSuffix","","aria-label","Clear search",3,"click"],[1,"skeleton-grid"],[1,"skeleton-card"],[1,"skeleton-icon"],[1,"skeleton-title"],[1,"skeleton-description"],[1,"skeleton-meta"],[1,"error-icon"],["mat-raised-button","","color","primary",3,"click"],[1,"empty-container"],["role","list",1,"categories-grid"],[1,"empty-icon"],["mat-raised-button","","color","primary"],["tabindex","0","role","listitem",1,"category-card",3,"locked"],["tabindex","0","role","listitem",1,"category-card",3,"click","keydown.enter","keydown.space"],[1,"locked-badge"],[1,"category-icon"],[1,"category-name"],[1,"category-description"],[1,"category-meta"],[1,"meta-item"],["disabled","",1,"auth-chip"],[1,"card-actions"],["mat-raised-button","","color","primary",3,"aria-label"],["mat-stroked-button","","disabled","",3,"aria-label"],["mat-raised-button","","color","primary",3,"click","aria-label"],["routerLink","/register"]],template:function(e,a){e&1&&(i(0,"div",0)(1,"div",1)(2,"h1"),o(3,"Quiz Categories"),n(),i(4,"p",2),o(5,"Choose a category to start your quiz journey"),n()(),i(6,"div",3)(7,"mat-form-field",4)(8,"mat-label"),o(9,"Search categories"),n(),O(10,"input",5),i(11,"mat-icon",6),o(12,"search"),n(),m(13,ut,3,0,"button",7),n()(),m(14,xt,4,1,"div",8),m(15,yt,11,1,"div",9),m(16,Lt,2,1),m(17,Tt,8,0,"div",10),n()),e&2&&(c(10),V("formControl",a.searchControl),c(3),s(a.searchControl.value?13:-1),c(),s(a.isLoading()?14:-1),c(),s(a.error()&&!a.isLoading()?15:-1),c(),s(!a.isLoading()&&!a.error()?16:-1),c(),s(a.isGuestMode()?17:-1))},dependencies:[N,q,j,U,A,B,Q,J,Y,H,rt,ot,it,ct,at,nt,et,Z,K,W,X,tt,gt,st,lt],styles:['.category-list-container[_ngcontent-%COMP%]{padding:2rem;max-width:1400px;margin:0 auto}@media (max-width: 768px){.category-list-container[_ngcontent-%COMP%]{padding:1rem}}.header[_ngcontent-%COMP%]{text-align:center;margin-bottom:2rem}.header[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-size:2.5rem;font-weight:700;margin-bottom:.5rem;color:var(--primary-color, #3f51b5)}@media (max-width: 768px){.header[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-size:2rem}}.header[_ngcontent-%COMP%] .subtitle[_ngcontent-%COMP%]{font-size:1.1rem;color:var(--text-secondary, #666);margin:0}.search-section[_ngcontent-%COMP%]{margin-bottom:2rem;display:flex;justify-content:center}.search-section[_ngcontent-%COMP%] .search-field[_ngcontent-%COMP%]{width:100%;max-width:600px}.categories-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1.5rem;margin-bottom:2rem}@media (max-width: 768px){.categories-grid[_ngcontent-%COMP%]{grid-template-columns:1fr;gap:1rem}}@media (min-width: 769px) and (max-width: 1024px){.categories-grid[_ngcontent-%COMP%]{grid-template-columns:repeat(2,1fr)}}@media (min-width: 1025px){.categories-grid[_ngcontent-%COMP%]{grid-template-columns:repeat(3,1fr)}}@media (min-width: 1400px){.categories-grid[_ngcontent-%COMP%]{grid-template-columns:repeat(4,1fr)}}.category-card[_ngcontent-%COMP%]{position:relative;cursor:pointer;transition:all .3s ease;border-radius:12px;overflow:hidden}.category-card[_ngcontent-%COMP%]:hover:not(.locked){transform:translateY(-4px);box-shadow:0 8px 24px #00000026}.category-card[_ngcontent-%COMP%]:focus{outline:2px solid var(--primary-color, #3f51b5);outline-offset:2px}.category-card.locked[_ngcontent-%COMP%]{cursor:not-allowed;opacity:.7}.category-card.locked[_ngcontent-%COMP%]:after{content:"";position:absolute;inset:0;background:#0000000d;pointer-events:none}.category-card[_ngcontent-%COMP%] mat-card-content[_ngcontent-%COMP%]{padding:1.5rem;display:flex;flex-direction:column;gap:1rem}.locked-badge[_ngcontent-%COMP%]{position:absolute;top:12px;right:12px;background:#000000b3;color:#fff;padding:.25rem .75rem;border-radius:20px;display:flex;align-items:center;gap:.25rem;font-size:.75rem;z-index:1}.locked-badge[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px}.category-icon[_ngcontent-%COMP%]{width:60px;height:60px;border-radius:12px;display:flex;align-items:center;justify-content:center;margin-bottom:.5rem}.category-icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:32px;width:32px;height:32px;color:#fff}.category-name[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:600;margin:0;color:var(--text-primary, #333)}.category-description[_ngcontent-%COMP%]{font-size:.9rem;color:var(--text-secondary, #666);margin:0;line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.7rem}.category-meta[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex-wrap:wrap}.category-meta[_ngcontent-%COMP%] .meta-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;color:var(--text-secondary, #666);font-size:.875rem}.category-meta[_ngcontent-%COMP%] .meta-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.category-meta[_ngcontent-%COMP%] .auth-chip[_ngcontent-%COMP%]{height:24px;font-size:.75rem}.category-meta[_ngcontent-%COMP%] .auth-chip[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.card-actions[_ngcontent-%COMP%]{margin-top:.5rem}.card-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:100%}.card-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-left:.5rem}.loading-container[_ngcontent-%COMP%]{margin:2rem 0}.skeleton-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1.5rem}@media (max-width: 768px){.skeleton-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.skeleton-card[_ngcontent-%COMP%] mat-card-content[_ngcontent-%COMP%]{padding:1.5rem}.skeleton-card[_ngcontent-%COMP%] .skeleton-icon[_ngcontent-%COMP%]{width:60px;height:60px;border-radius:12px;background:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0,#f0f0f0 75%);background-size:200% 100%;animation:_ngcontent-%COMP%_shimmer 1.5s infinite;margin-bottom:1rem}.skeleton-card[_ngcontent-%COMP%] .skeleton-title[_ngcontent-%COMP%]{width:70%;height:24px;border-radius:4px;background:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0,#f0f0f0 75%);background-size:200% 100%;animation:_ngcontent-%COMP%_shimmer 1.5s infinite;margin-bottom:.75rem}.skeleton-card[_ngcontent-%COMP%] .skeleton-description[_ngcontent-%COMP%]{width:100%;height:40px;border-radius:4px;background:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0,#f0f0f0 75%);background-size:200% 100%;animation:_ngcontent-%COMP%_shimmer 1.5s infinite;margin-bottom:.75rem}.skeleton-card[_ngcontent-%COMP%] .skeleton-meta[_ngcontent-%COMP%]{width:50%;height:20px;border-radius:4px;background:linear-gradient(90deg,#f0f0f0 25%,#e0e0e0,#f0f0f0 75%);background-size:200% 100%;animation:_ngcontent-%COMP%_shimmer 1.5s infinite}@keyframes _ngcontent-%COMP%_shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.error-container[_ngcontent-%COMP%]{text-align:center;padding:3rem 1rem}.error-container[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{font-size:64px;width:64px;height:64px;color:var(--error-color, #f44336);margin-bottom:1rem}.error-container[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:1.5rem;margin-bottom:.5rem}.error-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:var(--text-secondary, #666);margin-bottom:1.5rem}.error-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-right:.5rem}.empty-container[_ngcontent-%COMP%]{text-align:center;padding:3rem 1rem}.empty-container[_ngcontent-%COMP%] .empty-icon[_ngcontent-%COMP%]{font-size:64px;width:64px;height:64px;color:var(--text-secondary, #999);margin-bottom:1rem}.empty-container[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:1.5rem;margin-bottom:.5rem}.empty-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:var(--text-secondary, #666);margin-bottom:1.5rem}.empty-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-right:.5rem}.guest-info-banner[_ngcontent-%COMP%]{background:#e3f2fd;border:1px solid #90caf9;border-radius:8px;padding:1rem;display:flex;align-items:center;gap:1rem;margin-top:2rem}.guest-info-banner[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#1976d2;flex-shrink:0}.guest-info-banner[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;color:#1565c0;font-size:.9rem}.guest-info-banner[_ngcontent-%COMP%] p[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:#1976d2;font-weight:600;text-decoration:underline}.guest-info-banner[_ngcontent-%COMP%] p[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{color:#0d47a1}']})};export{_t as CategoryListComponent};