package p9; import java.util.Date; import java.util.concurrent.TimeUnit; import n9.e0; import n9.f; import n9.g0; import n9.x; import r9.d; import r9.e; /* loaded from: classes2.dex */ public final class b { /* renamed from: a, reason: collision with root package name */ public final e0 f13278a; /* renamed from: b, reason: collision with root package name */ public final g0 f13279b; public static class a { /* renamed from: a, reason: collision with root package name */ final long f13280a; /* renamed from: b, reason: collision with root package name */ final e0 f13281b; /* renamed from: c, reason: collision with root package name */ final g0 f13282c; /* renamed from: d, reason: collision with root package name */ private Date f13283d; /* renamed from: e, reason: collision with root package name */ private String f13284e; /* renamed from: f, reason: collision with root package name */ private Date f13285f; /* renamed from: g, reason: collision with root package name */ private String f13286g; /* renamed from: h, reason: collision with root package name */ private Date f13287h; /* renamed from: i, reason: collision with root package name */ private long f13288i; /* renamed from: j, reason: collision with root package name */ private long f13289j; /* renamed from: k, reason: collision with root package name */ private String f13290k; /* renamed from: l, reason: collision with root package name */ private int f13291l; public a(long j10, e0 e0Var, g0 g0Var) { this.f13291l = -1; this.f13280a = j10; this.f13281b = e0Var; this.f13282c = g0Var; if (g0Var != null) { this.f13288i = g0Var.m0(); this.f13289j = g0Var.f0(); x R = g0Var.R(); int h10 = R.h(); for (int i10 = 0; i10 < h10; i10++) { String e10 = R.e(i10); String i11 = R.i(i10); if ("Date".equalsIgnoreCase(e10)) { this.f13283d = d.b(i11); this.f13284e = i11; } else if ("Expires".equalsIgnoreCase(e10)) { this.f13287h = d.b(i11); } else if ("Last-Modified".equalsIgnoreCase(e10)) { this.f13285f = d.b(i11); this.f13286g = i11; } else if ("ETag".equalsIgnoreCase(e10)) { this.f13290k = i11; } else if ("Age".equalsIgnoreCase(e10)) { this.f13291l = e.d(i11, -1); } } } } private long a() { Date date = this.f13283d; long max = date != null ? Math.max(0L, this.f13289j - date.getTime()) : 0L; int i10 = this.f13291l; if (i10 != -1) { max = Math.max(max, TimeUnit.SECONDS.toMillis(i10)); } long j10 = this.f13289j; return max + (j10 - this.f13288i) + (this.f13280a - j10); } private long b() { if (this.f13282c.z().d() != -1) { return TimeUnit.SECONDS.toMillis(r0.d()); } if (this.f13287h != null) { Date date = this.f13283d; long time = this.f13287h.getTime() - (date != null ? date.getTime() : this.f13289j); if (time > 0) { return time; } return 0L; } if (this.f13285f == null || this.f13282c.j0().h().z() != null) { return 0L; } Date date2 = this.f13283d; long time2 = (date2 != null ? date2.getTime() : this.f13288i) - this.f13285f.getTime(); if (time2 > 0) { return time2 / 10; } return 0L; } private b d() { String str; if (this.f13282c == null) { return new b(this.f13281b, null); } if (this.f13281b.e() && this.f13282c.I() == null) { return new b(this.f13281b, null); } if (!b.a(this.f13282c, this.f13281b)) { return new b(this.f13281b, null); } f b10 = this.f13281b.b(); if (b10.h() || e(this.f13281b)) { return new b(this.f13281b, null); } f z10 = this.f13282c.z(); long a10 = a(); long b11 = b(); if (b10.d() != -1) { b11 = Math.min(b11, TimeUnit.SECONDS.toMillis(b10.d())); } long j10 = 0; long millis = b10.f() != -1 ? TimeUnit.SECONDS.toMillis(b10.f()) : 0L; if (!z10.g() && b10.e() != -1) { j10 = TimeUnit.SECONDS.toMillis(b10.e()); } if (!z10.h()) { long j11 = millis + a10; if (j11 < j10 + b11) { g0.a a02 = this.f13282c.a0(); if (j11 >= b11) { a02.a("Warning", "110 HttpURLConnection \"Response is stale\""); } if (a10 > 86400000 && f()) { a02.a("Warning", "113 HttpURLConnection \"Heuristic expiration\""); } return new b(null, a02.c()); } } String str2 = this.f13290k; if (str2 != null) { str = "If-None-Match"; } else { if (this.f13285f != null) { str2 = this.f13286g; } else { if (this.f13283d == null) { return new b(this.f13281b, null); } str2 = this.f13284e; } str = "If-Modified-Since"; } x.a f10 = this.f13281b.d().f(); o9.a.f12822a.b(f10, str, str2); return new b(this.f13281b.g().e(f10.d()).b(), this.f13282c); } private static boolean e(e0 e0Var) { return (e0Var.c("If-Modified-Since") == null && e0Var.c("If-None-Match") == null) ? false : true; } private boolean f() { return this.f13282c.z().d() == -1 && this.f13287h == null; } public b c() { b d10 = d(); return (d10.f13278a == null || !this.f13281b.b().j()) ? d10 : new b(null, null); } } b(e0 e0Var, g0 g0Var) { this.f13278a = e0Var; this.f13279b = g0Var; } /* JADX WARN: Code restructure failed: missing block: B:31:0x0056, code lost: if (r3.z().b() == false) goto L33; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public static boolean a(n9.g0 r3, n9.e0 r4) { /* int r0 = r3.G() r1 = 200(0xc8, float:2.8E-43) r2 = 0 if (r0 == r1) goto L5a r1 = 410(0x19a, float:5.75E-43) if (r0 == r1) goto L5a r1 = 414(0x19e, float:5.8E-43) if (r0 == r1) goto L5a r1 = 501(0x1f5, float:7.02E-43) if (r0 == r1) goto L5a r1 = 203(0xcb, float:2.84E-43) if (r0 == r1) goto L5a r1 = 204(0xcc, float:2.86E-43) if (r0 == r1) goto L5a r1 = 307(0x133, float:4.3E-43) if (r0 == r1) goto L31 r1 = 308(0x134, float:4.32E-43) if (r0 == r1) goto L5a r1 = 404(0x194, float:5.66E-43) if (r0 == r1) goto L5a r1 = 405(0x195, float:5.68E-43) if (r0 == r1) goto L5a switch(r0) { case 300: goto L5a; case 301: goto L5a; case 302: goto L31; default: goto L30; } L30: goto L59 L31: java.lang.String r0 = "Expires" java.lang.String r0 = r3.O(r0) if (r0 != 0) goto L5a n9.f r0 = r3.z() int r0 = r0.d() r1 = -1 if (r0 != r1) goto L5a n9.f r0 = r3.z() boolean r0 = r0.c() if (r0 != 0) goto L5a n9.f r0 = r3.z() boolean r0 = r0.b() if (r0 == 0) goto L59 goto L5a L59: return r2 L5a: n9.f r3 = r3.z() boolean r3 = r3.i() if (r3 != 0) goto L6f n9.f r3 = r4.b() boolean r3 = r3.i() if (r3 != 0) goto L6f r2 = 1 L6f: return r2 */ throw new UnsupportedOperationException("Method not decompiled: p9.b.a(n9.g0, n9.e0):boolean"); } }