1function mainPageData(allLawyers, allCities, allSpecializations) { 2 return { 3 selectedCity: 'all', 4 selectedSpec: 'all', 5 sortBy: 'rating', 6 lawyers: allLawyers, 7 cities: allCities, 8 specializations: allSpecializations, 9 pluralize(number, one, two, five) { 10 number = Math.abs(number); 11 number %= 100; 12 if (number >= 5 && number <= 20) return five; 13 number %= 10; 14 if (number === 1) return one; 15 if (number >= 2 && number <= 4) return two; 16 return five; 17 }, 18 getCityNames(cityId) { 19 const ids = Array.isArray(cityId) ? cityId : [cityId]; 20 return ids.map(id => { 21 const city = this.cities.find(c => c.id === id); 22 return city ? `<span class="inline-flex items-center gap-1"><i data-lucide="${city.icon}" class="w-4 h-4"></i> ${city.name}</span>` : ''; 23 }).join(' '); 24 }, 25 getSpecName(specId) { 26 const spec = this.specializations.find(s => s.id === specId); 27 return spec ? spec.name : ''; 28 }, 29 get sortedAndFilteredLawyers() { 30 let filtered = this.lawyers; 31 if (this.selectedCity !== 'all') { 32 filtered = filtered.filter(lawyer => Array.isArray(lawyer.cityId) ? lawyer.cityId.includes(this.selectedCity) : lawyer.cityId === this.selectedCity); 33 } 34 if (this.selectedSpec !== 'all') { 35 filtered = filtered.filter(lawyer => lawyer.specializationIds.includes(this.selectedSpec)); 36 } 37 return filtered.sort((a, b) => { 38 if (a.rating.position === 1) return -1; 39 if (b.rating.position === 1) return 1; 40 if (this.sortBy === 'reviews') return b.rating.reviews - a.rating.reviews; 41 if (this.sortBy === 'experience') return b.experience - a.experience; 42 return b.rating.stars - a.rating.stars; 43 }); 44 } 45 }; 46}
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.