1import"./chunk-WNZYFM57.js";import{b as j,e as $,j as W,l as Z}from"./chunk-GQAAGMLF.js";import"./chunk-BSVKWBKY.js";import"./chunk-D3OFKYWJ.js";import{a as q}from"./chunk-QSEQAWSO.js";import"./chunk-6N2YHIRN.js";import{a as z}from"./chunk-Z6PN7CXC.js";import{a as Q}from"./chunk-3OQZNRQA.js";import"./chunk-2TTDTFH3.js";import"./chunk-4NKIOJ5A.js";import"./chunk-ZEFP7VEU.js";import{a as R}from"./chunk-P7KLUOEX.js";import"./chunk-2BSH6HNN.js";import{c as V,g as A,k as x,n as F,x as N}from"./chunk-6VHGE6H7.js";import"./chunk-3YNC7TXE.js";import{e as E}from"./chunk-6SZESQ4T.js";import"./chunk-62EPKSPN.js";import"./chunk-Q7VJMXX4.js";import"./chunk-IFFENYHD.js";import"./chunk-SXK3FCKM.js";import"./chunk-Z25XIT6V.js";import"./chunk-G7G4S2F4.js";import"./chunk-T4G723NK.js";import{a as w}from"./chunk-GJX4D5TO.js";import"./chunk-WPXSK7HX.js";import"./chunk-3NM6VLWR.js";import"./chunk-SJGOHE6R.js";import"./chunk-EG4LWY3V.js";import"./chunk-MCAZH2AM.js";import{H as g,Nb as p,Ob as u,Rb as y,Sb as _,Tb as s,Ub as i,Vb as a,Wb as m,ad as O,bc as S,fb as r,fc as P,ga as v,hc as f,ma as b,na as C,pc as k,qc as D,sa as T,ub as M,wc as l,ya as d,yc as L}from"./chunk-YEWIMTMH.js";import{d as I}from"./chunk-4CLCTAJ7.js";var U=["searchinputctrl"],Y=(t,n)=>n.value,G=(t,n)=>n.id;function J(t,n){t&1&&(i(0,"button",6),l(1,"search"),a())}function K(t,n){if(t&1){let e=S();i(0,"button",20),P("click",function(){b(e);let c=f();return C(c.clearSearch())}),l(1,"clear"),a()}}function X(t,n){if(t&1&&(i(0,"mat-option",16),l(1),a()),t&2){let e=n.$implicit;s("value",e.value),r(),L(" ",e.displayText," ")}}function ee(t,n){if(t&1&&m(0,"app-product-card",18),t&2){let e=n.$implicit;s("product",e)}}function te(t,n){t&1&&(i(0,"section"),m(1,"app-loader",21),a())}function oe(t,n){if(t&1){let e=S();i(0,"div",19)(1,"button",22),P("click",function(){b(e);let c=f();return C(c.getProducts())}),l(2,"Load more"),a()()}if(t&2){let e=f();r(),s("disabled",e.isLoading())}}var B=[{value:"sortPriority|-1",displayText:"Recommended"},{value:"sortTitle|1",displayText:"Alphabetical (A-Z)"},{value:"sortTitle|-1",displayText:"Alphabetical (Z-A)"}],H=class t{searchInputCtrl=O("searchinputctrl");search=new x("");total=d(0);pageIndex=d(1);pageSize=12;products=d([]);isLoading=d(!1);productServe=v(R);destroyRef=v(T);sortOptions=B;sortControl=new x(B[0].value);ngOnInit(){this.getProducts(),this.search.valueChanges.pipe(g(500),w(this.destroyRef)).subscribe(()=>{this.pageIndex.set(1),this.products.set([]),this.getProducts()}),this.sortControl.valueChanges.pipe(g(300),w(this.destroyRef)).subscribe(()=>{this.pageIndex.set(1),this.products.set([]),this.getProducts()})}ngAfterViewInit(){this.searchInputCtrl()?.nativeElement.focus()}getProducts(){return I(this,null,function*(){let[n,e]=this.sortControl.value.split("|");try{this.isLoading.set(!0);let c={offset:this.pageSize*(this.pageIndex()-1),limit:this.pageSize,[n]:e};this.search.value&&(c.search=this.search.value,E(c.search));let h=yield this.productServe.getProducts(c);if(h){this.total.set(h?.total),this.products.set([...this.products(),...h.data]),h?.data.length>0&&this.pageIndex.set(this.pageIndex()+1);return}this.total.set(0),this.products.set([])}catch(o){console.log(o)}finally{this.isLoading.set(!1)}})}onScroll(){this.getProducts()}clearSearch(){this.search.setValue("")}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=M({type:t,selectors:[["app-product-search"]],viewQuery:function(e,o){e&1&&k(o.searchInputCtrl,U,5),e&2&&D()},decls:28,vars:9,consts:[["searchinputctrl",""],[1,"search-bar-section"],[1,"container-fluid"],[1,"row","justify-content-center","search-container"],[1,"col-12","col-lg-4"],["type","search","title","product-search","aria-label","Product search","placeholder","Search",1,"w-100","px-5","mat-elevation-z2",3,"formControl"],[1,"material-icons","position-absolute","search-icon","ps-2","search-btn"],[1,"material-icons","position-absolute","search-icon","ps-2","clear","search-btn"],[1,"container-fluid","product-search-body"],[1,"row","justify-content-center"],[1,"col-12"],[1,"row","justify-content-between","px-md-5","align-items-center","my-5"],[1,"col-6"],[1,"fw-bold"],["appearance","outline","aria-label","Sort Video Lectures",1,"float-end"],[3,"formControl"],[3,"value"],["infiniteScroll","",1,"row",3,"infiniteScrollDistance","infiniteScrollThrottle","scrollWindow"],[1,"col-12","col-sm-6","col-lg-3","mb-3","p-3",3,"product"],[1,"text-center","pb-5","mt-3"],[1,"material-icons","position-absolute","search-icon","ps-2","clear","search-btn",3,"click"],[1,"p-0"],["aria-label","Load more Lectures",1,"btn","btn-primary",3,"click","disabled"]],template:function(e,o){e&1&&(i(0,"section"),m(1,"div",1),i(2,"div",2)(3,"div",3)(4,"div",4),m(5,"input",5,0),p(7,J,2,0,"button",6),p(8,K,2,0,"button",7),a()()()(),i(9,"section",8)(10,"div",9)(11,"div",10)(12,"div",11)(13,"div",12)(14,"h5",13),l(15,"Video Lectures that match your search:"),a()(),i(16,"div",12)(17,"mat-form-field",14)(18,"mat-label"),l(19,"Sort"),a(),i(20,"mat-select",15),y(21,X,2,2,"mat-option",16,Y),a()()()(),i(23,"section",17),y(24,ee,1,1,"app-product-card",18,G),a(),p(26,te,2,0,"section"),p(27,oe,3,1,"div",19),a()()()),e&2&&(r(5),s("formControl",o.search),r(2),u(o.search.value?-1:7),r(),u(o.search.value?8:-1),r(12),s("formControl",o.sortControl),r(),_(o.sortOptions),r(2),s("infiniteScrollDistance",2)("infiniteScrollThrottle",50)("scrollWindow",!0),r(),_(o.products()),r(2),u(o.isLoading()?26:-1),r(),u(o.total()>0&&o.products().length<o.total()?27:-1))},dependencies:[Q,N,V,A,F,q,z,W,Z,$,j],styles:[".search-container[_ngcontent-%COMP%]{transform:translateY(-50%)}input[type=search][_ngcontent-%COMP%]{border:none;background-color:#fff;padding:1rem .5rem;font-size:1.2rem;border-radius:5px;color:#18191f}.search-icon[_ngcontent-%COMP%]{font-size:2rem;top:50%;transform:translate(-150%,-50%);color:#18191f}.sort-btn[_ngcontent-%COMP%]{background-color:var(--app-dark-blue);border-radius:5px;padding:.5rem;color:#fff}.search-bar-section[_ngcontent-%COMP%]{height:15vh;background-color:var(--app-dark-blue)}.clear[_ngcontent-%COMP%]{cursor:pointer}.search-btn[_ngcontent-%COMP%]{border:none;background-color:#fff}"],changeDetection:0})};export{H as ProductSearchComponent};
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.