package okhttp3; import java.util.concurrent.TimeUnit; /* loaded from: classes5.dex */ public final class CacheControl { public String headerValue; public final boolean immutable; public final boolean isPrivate; public final boolean isPublic; public final int maxAgeSeconds; public final int maxStaleSeconds; public final int minFreshSeconds; public final boolean mustRevalidate; public final boolean noCache; public final boolean noStore; public final boolean noTransform; public final boolean onlyIfCached; public final int sMaxAgeSeconds; public static final CacheControl FORCE_NETWORK = new Builder().noCache().build(); public static final CacheControl FORCE_CACHE = new Builder().onlyIfCached().maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS).build(); public boolean isPrivate() { return this.isPrivate; } public boolean isPublic() { return this.isPublic; } public int maxAgeSeconds() { return this.maxAgeSeconds; } public int maxStaleSeconds() { return this.maxStaleSeconds; } public int minFreshSeconds() { return this.minFreshSeconds; } public boolean mustRevalidate() { return this.mustRevalidate; } public boolean noCache() { return this.noCache; } public boolean noStore() { return this.noStore; } public boolean onlyIfCached() { return this.onlyIfCached; } public CacheControl(boolean z, boolean z2, int i, int i2, boolean z3, boolean z4, boolean z5, int i3, int i4, boolean z6, boolean z7, boolean z8, String str) { this.noCache = z; this.noStore = z2; this.maxAgeSeconds = i; this.sMaxAgeSeconds = i2; this.isPrivate = z3; this.isPublic = z4; this.mustRevalidate = z5; this.maxStaleSeconds = i3; this.minFreshSeconds = i4; this.onlyIfCached = z6; this.noTransform = z7; this.immutable = z8; this.headerValue = str; } public CacheControl(Builder builder) { this.noCache = builder.noCache; this.noStore = builder.noStore; this.maxAgeSeconds = builder.maxAgeSeconds; this.sMaxAgeSeconds = -1; this.isPrivate = false; this.isPublic = false; this.mustRevalidate = false; this.maxStaleSeconds = builder.maxStaleSeconds; this.minFreshSeconds = builder.minFreshSeconds; this.onlyIfCached = builder.onlyIfCached; this.noTransform = builder.noTransform; this.immutable = builder.immutable; } /* JADX WARN: Removed duplicated region for block: B:10:0x0042 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static okhttp3.CacheControl parse(okhttp3.Headers r22) { /* Method dump skipped, instructions count: 341 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: okhttp3.CacheControl.parse(okhttp3.Headers):okhttp3.CacheControl"); } public String toString() { String str = this.headerValue; if (str != null) { return str; } String headerValue = headerValue(); this.headerValue = headerValue; return headerValue; } public final String headerValue() { StringBuilder sb = new StringBuilder(); if (this.noCache) { sb.append("no-cache, "); } if (this.noStore) { sb.append("no-store, "); } if (this.maxAgeSeconds != -1) { sb.append("max-age="); sb.append(this.maxAgeSeconds); sb.append(", "); } if (this.sMaxAgeSeconds != -1) { sb.append("s-maxage="); sb.append(this.sMaxAgeSeconds); sb.append(", "); } if (this.isPrivate) { sb.append("private, "); } if (this.isPublic) { sb.append("public, "); } if (this.mustRevalidate) { sb.append("must-revalidate, "); } if (this.maxStaleSeconds != -1) { sb.append("max-stale="); sb.append(this.maxStaleSeconds); sb.append(", "); } if (this.minFreshSeconds != -1) { sb.append("min-fresh="); sb.append(this.minFreshSeconds); sb.append(", "); } if (this.onlyIfCached) { sb.append("only-if-cached, "); } if (this.noTransform) { sb.append("no-transform, "); } if (this.immutable) { sb.append("immutable, "); } if (sb.length() == 0) { return ""; } sb.delete(sb.length() - 2, sb.length()); return sb.toString(); } public static final class Builder { public boolean immutable; public int maxAgeSeconds = -1; public int maxStaleSeconds = -1; public int minFreshSeconds = -1; public boolean noCache; public boolean noStore; public boolean noTransform; public boolean onlyIfCached; public Builder noCache() { this.noCache = true; return this; } public Builder onlyIfCached() { this.onlyIfCached = true; return this; } public Builder maxStale(int i, TimeUnit timeUnit) { if (i < 0) { throw new IllegalArgumentException("maxStale < 0: " + i); } long seconds = timeUnit.toSeconds(i); this.maxStaleSeconds = seconds > 2147483647L ? Integer.MAX_VALUE : (int) seconds; return this; } public CacheControl build() { return new CacheControl(this); } } }