discord-jadx/app/src/main/java/f0/d.java
2021-09-29 02:45:08 +02:00

280 lines
12 KiB
Java

package f0;
import d0.g0.t;
import d0.g0.w;
import d0.z.d.m;
import f0.e0.c;
import java.util.concurrent.TimeUnit;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import okhttp3.Headers;
/* compiled from: CacheControl.kt */
public final class d {
public static final a a = new a(null);
public final boolean b;
/* renamed from: c reason: collision with root package name */
public final boolean f2792c;
public final int d;
public final int e;
public final boolean f;
public final boolean g;
public final boolean h;
public final int i;
public final int j;
public final boolean k;
public final boolean l;
public final boolean m;
public String n;
/* compiled from: CacheControl.kt */
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
public final int a(String str, String str2, int i) {
int length = str.length();
while (i < length) {
if (w.contains$default((CharSequence) str2, str.charAt(i), false, 2, (Object) null)) {
return i;
}
i++;
}
return str.length();
}
/* JADX WARNING: Removed duplicated region for block: B:12:0x004a */
/* JADX WARNING: Removed duplicated region for block: B:42:0x0104 */
/* JADX WARNING: Removed duplicated region for block: B:43:0x0108 */
public final d b(Headers headers) {
int i;
int i2;
boolean z2;
String str;
int i3;
Headers headers2 = headers;
m.checkParameterIsNotNull(headers2, "headers");
int size = headers.size();
boolean z3 = true;
int i4 = 0;
boolean z4 = true;
String str2 = null;
boolean z5 = false;
boolean z6 = false;
int i5 = -1;
int i6 = -1;
boolean z7 = false;
boolean z8 = false;
boolean z9 = false;
int i7 = -1;
int i8 = -1;
boolean z10 = false;
boolean z11 = false;
boolean z12 = false;
while (i4 < size) {
String d = headers2.d(i4);
String g = headers2.g(i4);
if (t.equals(d, "Cache-Control", z3)) {
if (str2 == null) {
str2 = g;
i2 = 0;
while (i2 < g.length()) {
int a = a(g, "=,;", i2);
String substring = g.substring(i2, a);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
if (substring != null) {
String obj = w.trim(substring).toString();
if (a != g.length()) {
z2 = z4;
if (!(g.charAt(a) == ',' || g.charAt(a) == ';')) {
int i9 = a + 1;
byte[] bArr = c.a;
m.checkParameterIsNotNull(g, "$this$indexOfNonWhitespace");
int length = g.length();
while (true) {
if (i9 < length) {
char charAt = g.charAt(i9);
if (charAt != ' ' && charAt != '\t') {
break;
}
i9++;
length = length;
} else {
i9 = g.length();
break;
}
}
if (i9 >= g.length() || g.charAt(i9) != '\"') {
int a2 = a(g, ",;", i9);
String substring2 = g.substring(i9, a2);
m.checkExpressionValueIsNotNull(substring2, "(this as java.lang.Strin…ing(startIndex, endIndex)");
if (substring2 != null) {
str = w.trim(substring2).toString();
i3 = a2;
z3 = true;
if (t.equals("no-cache", obj, true)) {
z5 = true;
} else if (t.equals("no-store", obj, true)) {
z6 = true;
} else if (t.equals("max-age", obj, true)) {
i5 = c.A(str, -1);
} else if (t.equals("s-maxage", obj, true)) {
i6 = c.A(str, -1);
} else if (t.equals("private", obj, true)) {
z7 = true;
} else if (t.equals("public", obj, true)) {
z8 = true;
} else if (t.equals("must-revalidate", obj, true)) {
z9 = true;
} else if (t.equals("max-stale", obj, true)) {
i7 = c.A(str, Integer.MAX_VALUE);
} else if (t.equals("min-fresh", obj, true)) {
i8 = c.A(str, -1);
} else if (t.equals("only-if-cached", obj, true)) {
z10 = true;
} else if (t.equals("no-transform", obj, true)) {
z11 = true;
} else if (t.equals("immutable", obj, true)) {
z12 = true;
}
i2 = i3;
size = size;
z4 = z2;
} else {
throw new TypeCastException("null cannot be cast to non-null type kotlin.CharSequence");
}
} else {
int i10 = i9 + 1;
int indexOf$default = w.indexOf$default((CharSequence) g, '\"', i10, false, 4, (Object) null);
str = g.substring(i10, indexOf$default);
m.checkExpressionValueIsNotNull(str, "(this as java.lang.Strin…ing(startIndex, endIndex)");
i3 = indexOf$default + 1;
z3 = true;
if (t.equals("no-cache", obj, true)) {
}
i2 = i3;
size = size;
z4 = z2;
}
}
} else {
z2 = z4;
}
i3 = a + 1;
str = null;
z3 = true;
if (t.equals("no-cache", obj, true)) {
}
i2 = i3;
size = size;
z4 = z2;
} else {
throw new TypeCastException("null cannot be cast to non-null type kotlin.CharSequence");
}
}
i = size;
i4++;
headers2 = headers;
size = i;
}
} else if (!t.equals(d, "Pragma", z3)) {
i = size;
i4++;
headers2 = headers;
size = i;
}
z4 = false;
i2 = 0;
while (i2 < g.length()) {
}
i = size;
i4++;
headers2 = headers;
size = i;
}
return new d(z5, z6, i5, i6, z7, z8, z9, i7, i8, z10, z11, z12, !z4 ? null : str2, null);
}
}
static {
TimeUnit timeUnit = TimeUnit.SECONDS;
m.checkParameterIsNotNull(timeUnit, "timeUnit");
timeUnit.toSeconds((long) Integer.MAX_VALUE);
}
public d(boolean z2, boolean z3, int i, int i2, boolean z4, boolean z5, boolean z6, int i3, int i4, boolean z7, boolean z8, boolean z9, String str, DefaultConstructorMarker defaultConstructorMarker) {
this.b = z2;
this.f2792c = z3;
this.d = i;
this.e = i2;
this.f = z4;
this.g = z5;
this.h = z6;
this.i = i3;
this.j = i4;
this.k = z7;
this.l = z8;
this.m = z9;
this.n = str;
}
public String toString() {
String str = this.n;
if (str != null) {
return str;
}
StringBuilder sb = new StringBuilder();
if (this.b) {
sb.append("no-cache, ");
}
if (this.f2792c) {
sb.append("no-store, ");
}
if (this.d != -1) {
sb.append("max-age=");
sb.append(this.d);
sb.append(", ");
}
if (this.e != -1) {
sb.append("s-maxage=");
sb.append(this.e);
sb.append(", ");
}
if (this.f) {
sb.append("private, ");
}
if (this.g) {
sb.append("public, ");
}
if (this.h) {
sb.append("must-revalidate, ");
}
if (this.i != -1) {
sb.append("max-stale=");
sb.append(this.i);
sb.append(", ");
}
if (this.j != -1) {
sb.append("min-fresh=");
sb.append(this.j);
sb.append(", ");
}
if (this.k) {
sb.append("only-if-cached, ");
}
if (this.l) {
sb.append("no-transform, ");
}
if (this.m) {
sb.append("immutable, ");
}
if (sb.length() == 0) {
return "";
}
sb.delete(sb.length() - 2, sb.length());
String sb2 = sb.toString();
m.checkExpressionValueIsNotNull(sb2, "StringBuilder().apply(builderAction).toString()");
this.n = sb2;
return sb2;
}
}