1import{a as le}from"./chunk-6UTUOTXC.js";import"./chunk-76J53O4D.js";import{a as pe}from"./chunk-J5NWFZXF.js";import"./chunk-NEQO7ITA.js";import"./chunk-ILIGNJRC.js";import"./chunk-BYUXZABT.js";import{A as X,Db as ae,gb as ie,hb as se,ib as ne,k as Q,r as z,ra as Z,s as J,sa as ee,va as te,y as S}from"./chunk-CSKO464Y.js";import{A as re,z as oe}from"./chunk-RFZ65DFT.js";import"./chunk-ZAELU3GP.js";import{a as P,i as j}from"./chunk-KCBWTIVH.js";import"./chunk-Q7LOV5U2.js";import"./chunk-ZS7OWNSY.js";import"./chunk-DIZWDXBB.js";import{Q as $,R as q}from"./chunk-Q4MTVQC2.js";import{b as Y,c as U,d as W}from"./chunk-RRAYDVNW.js";import{Na as a,lc as K,yb as G}from"./chunk-WGWIBZ2L.js";import{$b as C,$c as g,Fa as B,Ga as F,Gc as T,Ib as c,Ob as M,Oc as m,Pc as u,Qa as I,Rc as L,Ta as h,Tb as l,Tc as V,Ub as p,Vb as _,Z as v,Zb as D,ac as y,ad as N,gd as x,gf as H,hb as n,pc as b,rc as O,tb as A,td as k,ua as w,ya as d,zb as E}from"./chunk-6LP6WHZQ.js";import"./chunk-5KTCK5IS.js";var de=(()=>{class o{#t;#o;#e;constructor(){this.#t=d(ee),this.#o=d(Z),this.#e=d(P),this.favoriteColors=h([]),this.isLoading=h(!1),N(()=>{if(!this.#e.isBrowser){this.isLoading.set(!0);return}let r=this.#t.favoriteColors();if(r.length===0){this.isLoading.set(!1),this.favoriteColors.set([]);return}this.tryUpdateFavoriteColorsIfDeleted(r)||this.fetchFavoriteColorsData(r)},{allowSignalWrites:!0})}fetchFavoriteColorsData(t){this.isLoading.set(!0);let r=t.map(e=>e.productNumber);this.#o.getColorInfo(r).pipe(v(1)).subscribe(e=>{let s=this.fillMissingColorInfos(t,e);this.favoriteColors.set(s),this.isLoading.set(!1)})}tryUpdateFavoriteColorsIfDeleted(t){let r=new Set(t.map(s=>s.productNumber)),e=!1;return this.favoriteColors.update(s=>{let i=s.filter(R=>r.has(R.productNumber));return i.length===s.length?s:(e=!0,i)}),e}fillMissingColorInfos(t,r){let e=new Set(r.map(i=>i.productNumber));r.forEach(i=>{let R=t.find(me=>me.productNumber===i.productNumber)?.addedToFavoritesAt;i.addedAsFavoriteAt=new Date(R??""),i.isFavorite=!0});let s=t.filter(i=>!e.has(i.productNumber)).map(i=>new X(i.productNumber,!0,new Date(i.addedToFavoritesAt)));return[...r,...s]}static{this.\u0275fac=function(r){return new(r||o)}}static{this.\u0275prov=w({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();var fe=(o,f)=>({"flex flex-row gap-0":o,grid:f}),ge=(o,f)=>({"hidden md:flex flex-grow-1":o,"col-3 hidden md:block":f}),he=(o,f)=>({"flex flex-grow-3":o,"col-12 md:col-9":f});function Ce(o,f){if(o&1&&(l(0,"p-card",15)(1,"h3",16),b(2),m(3,"resourceValue"),p(),l(4,"p",17),_(5,"ppg-resource-item",18),p()()),o&2){let t=y(2);n(2),O(" ",u(3,2,t.resources.gridEmptyMessage)," "),n(3),c("resourceKey",t.resources.gridEmptyMessageGoTo)}}function Se(o,f){if(o&1){let t=D();l(0,"ppg-colors-grid",14),m(1,"sortBy"),C("favoriteColorRemoved",function(e){B(t);let s=y();return F(s.onFavoriteColorRemoved(e))}),E(2,Ce,6,4,"ng-template",null,0,V),p()}if(o&2){let t=y();c("colors",L(1,4,t.favoriteColors(),t.selectedSortOption().key,t.selectedSortOption().type))("title",t.gridTitle())("gridItemStyleClass","flex md:block p-2 w-full md:w-6 lg:w-4 xl:w-4 md:col-6 lg:col-4 xl:col-4")("rows",t.paginatorConfig.rows)}}var ce=(()=>{class o{constructor(){this.#t=d(de),this.#o=d(Q),this.#e=d(Y),this.#r=d(te),this.#i=d(K),this.resources={title:a.COLORS_FAVORITES_TITLE,gridTitle:a.COLORS_FAVORITES_MY_LIST_SUBTITLE,gridEmptyMessage:a.COLORS_FAVORITES_EMPTY_MESSAGE_TITLE,gridEmptyMessageGoTo:a.COLORS_FAVORITES_EMPTY_MESSAGE_CONTENT,sortHeader:a.COLORS_FAVORITES_SORT_BY,sortDateAsc:a.COLORS_FAVORITES_SORT_BY_OLDEST_FIRST,sortDateDesc:a.COLORS_FAVORITES_SORT_BY_NEWEST_FIRST,sortNameAsc:a.COLORS_FAVORITES_SORT_BY_NAME_ASC,sortNameDesc:a.COLORS_FAVORITES_SORT_BY_NAME_DESC,filters:a.COLORS_FAVORITES_FILTERS_SUBTITLE,closeLabel:a.A11Y_CLOSE},this.content=I.required(),this.breadcrumbsHome=g(()=>this.#e.getResourceByKey(a.BREADCRUMB_HOME)),this.breadcrumbs=g(()=>this.content()?.breadcrumbs),this.paginatorConfig=G,this.gridTitle=g(()=>`${this.#e.getResourceByKey(this.resources.gridTitle)} (${this.favoriteColors().length})`),this.favoriteColors=this.#t.favoriteColors,this.isEmptyMessageShown=g(()=>!this.#t.isLoading()),this.sortingOptions=g(()=>[{id:"date-desc",key:"addedAsFavoriteAt",type:S.DESC,label:this.#e.getResourceByKey(this.resources.sortDateDesc)},{id:"date-asc",key:"addedAsFavoriteAt",type:S.ASC,label:this.#e.getResourceByKey(this.resources.sortDateAsc)},{id:"name-asc",key:"colorName",type:S.ASC,label:this.#e.getResourceByKey(this.resources.sortNameAsc)},{id:"name-desc",key:"colorName",type:S.DESC,label:this.#e.getResourceByKey(this.resources.sortNameDesc)}]),this.selectedSortOption=h(this.sortingOptions()[0]),this.showSortBySidebar=!1}#t;#o;#e;#r;#i;onSortingValueChange(t){this.selectedSortOption()!==t&&this.selectedSortOption.set(t)}showSortByWindow(){this.showSortBySidebar||(this.showSortBySidebar=!0,this.sortByDialogRef=this.#o.open(se,{data:{appendToQuerySelector:"#ppg-sort-by-button",header:this.#e.getResourceByKey(this.resources.sortHeader),sortOptions:this.sortingOptions(),selectedSortOption:this.selectedSortOption()},modal:!1,styleClass:"hidden sm:flex md:hidden",closable:!0}),this.sortByDialogRef.onClose.pipe(v(1)).subscribe(t=>{this.showSortBySidebar=!1,t&&this.selectedSortOption.set(t)}))}onFavoriteColorRemoved(t){this.#r.removeColorFromFavoritesGTMtag(t,j.ColorFavorites)}static{this.\u0275fac=function(r){return new(r||o)}}static{this.\u0275cmp=A({type:o,selectors:[["ppg-favorite-colors"]],inputs:{content:[1,"content"]},decls:25,vars:39,consts:[["emptyMessageTemplate",""],[3,"breadcrumbs","rootName"],[1,"section-container","heading-container"],["data-test-id","favoriteColorsPage.mainHeader",1,"page-title"],[1,"section-container","mb-4","block","md:hidden"],["data-test-id","favoriteColorsPage.showSortByWindowButton","id","ppg-sort-by-button","icon","pi pi-chevron-down","iconPos","right",1,"block","w-full","sm:w-max","text-left","sm:text-center",3,"click","label","outlined"],["styleClass","h-auto",1,"block","sm:hidden",3,"onHide","valueChange","visible","header","ariaCloseLabel","selectedOption","options"],[1,"section-container","favorite-colors"],[3,"ngClass"],[1,"flex","flex-auto"],[1,"hidden","md:flex","flex-column","w-full"],["data-test-id","favoriteColorsPage.filtersHeader"],[3,"sortingValueChange","header","sortingOptions","selectedOption"],[1,"w-full",3,"colors","title","gridItemStyleClass","rows"],[1,"w-full",3,"favoriteColorRemoved","colors","title","gridItemStyleClass","rows"],["ngSkipHydration","","styleClass","noBorder",1,"emptyMessageTemplate"],["data-test-id","favoriteColorsPage.emptyPage.gridEmptyMessage"],["data-test-id","favoriteColorsPage.emptyPage.gridEmptyMessageGoTo"],[3,"resourceKey"]],template:function(r,e){r&1&&
1(l(0,"section"),_(1,"ppg-breadcrumbs",1),p(),l(2,"section",2)(3,"h1",3),b(4),m(5,"resourceValue"),p()(),l(6,"section",4)(7,"p-button",5),m(8,"resourceValue"),C("click",function(){return e.showSortByWindow()}),p()(),l(9,"ppg-option-selector-sidebar",6),m(10,"resourceValue"),m(11,"resourceValue"),C("onHide",function(){return e.showSortBySidebar=!1,e.sortByDialogRef==null?null:e.sortByDialogRef.close()})("valueChange",function(i){return e.onSortingValueChange(i)}),p(),l(12,"section",7),_(13,"p-divider"),l(14,"div",8)(15,"div",8)(16,"div",9)(17,"div",10)(18,"h2",11),b(19),m(20,"resourceValue"),p(),l(21,"ppg-sort-by-accordion",12),m(22,"resourceValue"),C("sortingValueChange",function(i){return e.onSortingValueChange(i)}),p()()()(),l(23,"div",8),E(24,Se,4,8,"ppg-colors-grid",13),p()()()),r&2&&(n(),c("breadcrumbs",e.breadcrumbs())("rootName",e.breadcrumbsHome()),n(3),O(" ",u(5,18,e.resources.title)," "),n(3),c("label",u(8,20,e.resources.sortHeader))("outlined",!0),n(2),c("visible",e.showSortBySidebar)("header",u(10,22,e.resources.sortHeader))("ariaCloseLabel",u(11,24,e.resources.closeLabel))("selectedOption",e.selectedSortOption())("options",e.sortingOptions()),n(5),c("ngClass",T(30,fe,e.favoriteColors().length===0,e.favoriteColors().length!==0)),n(),c("ngClass",T(33,ge,e.favoriteColors().length===0,e.favoriteColors().length!==0)),n(4),O(" ",u(20,26,e.resources.filters)," "),n(2),c("header",u(22,28,e.resources.sortHeader))("sortingOptions",e.sortingOptions())("selectedOption",e.selectedSortOption()),n(2),c("ngClass",T(36,he,e.favoriteColors().length===0,e.favoriteColors().length!==0)),n(),M(e.isEmptyMessageShown()?24:-1))},dependencies:[ae,le,pe,q,$,re,oe,H,ie,ne,J,z,k,x,W,U],styles:[`ppg-favorite-colors .emptyMessageTemplate .p-card-body{background:var(--p-pds-surface-neutral-extreme-soft)}ppg-favorite-colors .flex-grow-3{flex-grow:3}ppg-favorite-colors p-button button.p-button.p-component{width:inherit;text-align:inherit} 2`],encapsulation:2})}}return o})();var Ze=[{path:"",children:[{path:"",pathMatch:"full",component:ce}]}];export{ce as FavoriteColorsComponent,Ze as FavoriteColorsRoutes};
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.