package w1; import android.text.TextUtils; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; /* loaded from: classes.dex */ public final class j implements h { /* renamed from: c, reason: collision with root package name */ private final Map f15037c; /* renamed from: d, reason: collision with root package name */ private volatile Map f15038d; public static final class a { /* renamed from: d, reason: collision with root package name */ private static final String f15039d; /* renamed from: e, reason: collision with root package name */ private static final Map f15040e; /* renamed from: a, reason: collision with root package name */ private boolean f15041a = true; /* renamed from: b, reason: collision with root package name */ private Map f15042b = f15040e; /* renamed from: c, reason: collision with root package name */ private boolean f15043c = true; static { String b10 = b(); f15039d = b10; HashMap hashMap = new HashMap(2); if (!TextUtils.isEmpty(b10)) { hashMap.put("User-Agent", Collections.singletonList(new b(b10))); } f15040e = Collections.unmodifiableMap(hashMap); } static String b() { String property = System.getProperty("http.agent"); if (TextUtils.isEmpty(property)) { return property; } int length = property.length(); StringBuilder sb = new StringBuilder(property.length()); for (int i10 = 0; i10 < length; i10++) { char charAt = property.charAt(i10); if ((charAt > 31 || charAt == '\t') && charAt < 127) { sb.append(charAt); } else { sb.append('?'); } } return sb.toString(); } public j a() { this.f15041a = true; return new j(this.f15042b); } } static final class b implements i { /* renamed from: a, reason: collision with root package name */ private final String f15044a; b(String str) { this.f15044a = str; } @Override // w1.i public String a() { return this.f15044a; } public boolean equals(Object obj) { if (obj instanceof b) { return this.f15044a.equals(((b) obj).f15044a); } return false; } public int hashCode() { return this.f15044a.hashCode(); } public String toString() { return "StringHeaderFactory{value='" + this.f15044a + "'}"; } } j(Map map) { this.f15037c = Collections.unmodifiableMap(map); } private String b(List list) { StringBuilder sb = new StringBuilder(); int size = list.size(); for (int i10 = 0; i10 < size; i10++) { String a10 = ((i) list.get(i10)).a(); if (!TextUtils.isEmpty(a10)) { sb.append(a10); if (i10 != list.size() - 1) { sb.append(','); } } } return sb.toString(); } private Map c() { HashMap hashMap = new HashMap(); for (Map.Entry entry : this.f15037c.entrySet()) { String b10 = b((List) entry.getValue()); if (!TextUtils.isEmpty(b10)) { hashMap.put(entry.getKey(), b10); } } return hashMap; } @Override // w1.h public Map a() { if (this.f15038d == null) { synchronized (this) { if (this.f15038d == null) { this.f15038d = Collections.unmodifiableMap(c()); } } } return this.f15038d; } public boolean equals(Object obj) { if (obj instanceof j) { return this.f15037c.equals(((j) obj).f15037c); } return false; } public int hashCode() { return this.f15037c.hashCode(); } public String toString() { return "LazyHeaders{headers=" + this.f15037c + '}'; } }