discord-jadx/app/src/main/java/g0/o.java

237 lines
9.4 KiB
Java
Raw Normal View History

2021-11-08 18:25:28 +00:00
package g0;
import d0.t.c;
import d0.t.k;
import d0.t.n;
import d0.t.q;
import d0.z.d.m;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.RandomAccess;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import okio.ByteString;
/* compiled from: Options.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes3.dex */
2021-11-08 18:25:28 +00:00
public final class o extends c<ByteString> implements RandomAccess {
2021-12-17 22:03:14 +00:00
public static final a k = new a(null);
public final ByteString[] l;
public final int[] m;
2021-11-08 18:25:28 +00:00
/* compiled from: Options.kt */
2022-03-02 20:59:20 +00:00
/* loaded from: classes3.dex */
2021-11-08 18:25:28 +00:00
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
public final void a(long j, e eVar, int i, List<? extends ByteString> list, int i2, int i3, List<Integer> list2) {
int i4;
int i5;
int i6;
2022-03-02 20:59:20 +00:00
int i7 = i;
2021-11-08 18:25:28 +00:00
if (i2 < i3) {
2022-03-02 20:59:20 +00:00
for (int i8 = i2; i8 < i3; i8++) {
if (!(((ByteString) list.get(i8)).j() >= i7)) {
2021-11-08 18:25:28 +00:00
throw new IllegalArgumentException("Failed requirement.".toString());
}
}
ByteString byteString = (ByteString) list.get(i2);
ByteString byteString2 = (ByteString) list.get(i3 - 1);
2022-03-02 20:59:20 +00:00
if (i7 == byteString.j()) {
2021-11-08 18:25:28 +00:00
i5 = list2.get(i2).intValue();
2022-03-02 20:59:20 +00:00
int i9 = i2 + 1;
byteString = (ByteString) list.get(i9);
i4 = i9;
2021-11-08 18:25:28 +00:00
} else {
i4 = i2;
i5 = -1;
}
2022-03-02 20:59:20 +00:00
if (byteString.m(i7) != byteString2.m(i7)) {
int i10 = 1;
for (int i11 = i4 + 1; i11 < i3; i11++) {
if (((ByteString) list.get(i11 - 1)).m(i7) != ((ByteString) list.get(i11)).m(i7)) {
i10++;
2021-11-08 18:25:28 +00:00
}
}
2022-03-02 20:59:20 +00:00
long b2 = b(eVar) + j + 2 + (i10 * 2);
eVar.W(i10);
2021-11-08 18:25:28 +00:00
eVar.W(i5);
2022-03-02 20:59:20 +00:00
for (int i12 = i4; i12 < i3; i12++) {
byte m = ((ByteString) list.get(i12)).m(i7);
if (i12 == i4 || m != ((ByteString) list.get(i12 - 1)).m(i7)) {
2021-11-08 18:25:28 +00:00
eVar.W(m & 255);
}
}
2022-03-02 20:59:20 +00:00
e eVar2 = new e();
2021-11-08 18:25:28 +00:00
while (i4 < i3) {
2022-03-02 20:59:20 +00:00
byte m2 = ((ByteString) list.get(i4)).m(i7);
int i13 = i4 + 1;
int i14 = i13;
2021-11-08 18:25:28 +00:00
while (true) {
2022-03-02 20:59:20 +00:00
if (i14 >= i3) {
2021-11-08 18:25:28 +00:00
i6 = i3;
break;
2022-03-02 20:59:20 +00:00
} else if (m2 != ((ByteString) list.get(i14)).m(i7)) {
i6 = i14;
2021-11-08 18:25:28 +00:00
break;
} else {
2022-03-02 20:59:20 +00:00
i14++;
2021-11-08 18:25:28 +00:00
}
}
2022-03-02 20:59:20 +00:00
if (i13 == i6 && i7 + 1 == ((ByteString) list.get(i4)).j()) {
2021-11-08 18:25:28 +00:00
eVar.W(list2.get(i4).intValue());
2022-03-02 20:59:20 +00:00
i4 = i6;
eVar2 = eVar2;
2021-11-08 18:25:28 +00:00
} else {
2022-03-02 20:59:20 +00:00
eVar.W(((int) (b(eVar2) + b2)) * (-1));
i4 = i6;
eVar2 = eVar2;
a(b2, eVar2, i7 + 1, list, i4, i6, list2);
2021-11-08 18:25:28 +00:00
}
}
2022-03-02 20:59:20 +00:00
eVar.P(eVar2);
2021-11-08 18:25:28 +00:00
return;
}
int min = Math.min(byteString.j(), byteString2.j());
2022-03-02 20:59:20 +00:00
int i15 = 0;
for (int i16 = i7; i16 < min && byteString.m(i16) == byteString2.m(i16); i16++) {
i15++;
2021-11-08 18:25:28 +00:00
}
2022-03-02 20:59:20 +00:00
long b3 = b(eVar) + j + 2 + i15 + 1;
eVar.W(-i15);
2021-11-08 18:25:28 +00:00
eVar.W(i5);
2022-03-02 20:59:20 +00:00
int i17 = i7 + i15;
while (i7 < i17) {
eVar.W(byteString.m(i7) & 255);
i7++;
2021-11-08 18:25:28 +00:00
}
if (i4 + 1 == i3) {
2022-03-02 20:59:20 +00:00
if (i17 == ((ByteString) list.get(i4)).j()) {
2021-11-08 18:25:28 +00:00
eVar.W(list2.get(i4).intValue());
return;
}
throw new IllegalStateException("Check failed.".toString());
}
2022-03-02 20:59:20 +00:00
e eVar3 = new e();
eVar.W(((int) (b(eVar3) + b3)) * (-1));
a(b3, eVar3, i17, list, i4, i3, list2);
eVar.P(eVar3);
2021-11-08 18:25:28 +00:00
return;
}
throw new IllegalArgumentException("Failed requirement.".toString());
}
public final long b(e eVar) {
2022-03-02 20:59:20 +00:00
return eVar.k / 4;
2021-11-08 18:25:28 +00:00
}
2022-03-02 20:59:20 +00:00
/* JADX WARN: Code restructure failed: missing block: B:58:0x00fa, code lost:
continue;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
2021-11-08 18:25:28 +00:00
public final o c(ByteString... byteStringArr) {
m.checkParameterIsNotNull(byteStringArr, "byteStrings");
int i = 0;
if (byteStringArr.length == 0) {
return new o(new ByteString[0], new int[]{0, -1}, null);
}
List<? extends ByteString> mutableList = k.toMutableList(byteStringArr);
q.sort(mutableList);
ArrayList arrayList = new ArrayList(byteStringArr.length);
for (ByteString byteString : byteStringArr) {
arrayList.add(-1);
}
Object[] array = arrayList.toArray(new Integer[0]);
if (array != null) {
Integer[] numArr = (Integer[]) array;
List<Integer> mutableListOf = n.mutableListOf((Integer[]) Arrays.copyOf(numArr, numArr.length));
int i2 = 0;
2022-03-02 20:59:20 +00:00
for (ByteString byteString2 : byteStringArr) {
2021-11-08 18:25:28 +00:00
i2++;
2022-03-02 20:59:20 +00:00
mutableListOf.set(n.binarySearch$default(mutableList, byteString2, 0, 0, 6, null), Integer.valueOf(i2));
2021-11-08 18:25:28 +00:00
}
if (((ByteString) mutableList.get(0)).j() > 0) {
2022-03-02 20:59:20 +00:00
int i3 = 0;
while (i3 < mutableList.size()) {
ByteString byteString3 = (ByteString) mutableList.get(i3);
int i4 = i3 + 1;
int i5 = i4;
while (i5 < mutableList.size()) {
ByteString byteString4 = (ByteString) mutableList.get(i5);
Objects.requireNonNull(byteString4);
m.checkParameterIsNotNull(byteString3, "prefix");
if (!byteString4.n(0, byteString3, 0, byteString3.j())) {
2021-11-08 18:25:28 +00:00
break;
}
2022-03-02 20:59:20 +00:00
if (!(byteString4.j() != byteString3.j())) {
throw new IllegalArgumentException(("duplicate option: " + byteString4).toString());
} else if (mutableListOf.get(i5).intValue() > mutableListOf.get(i3).intValue()) {
mutableList.remove(i5);
mutableListOf.remove(i5);
2021-11-08 18:25:28 +00:00
} else {
2022-03-02 20:59:20 +00:00
i5++;
2021-11-08 18:25:28 +00:00
}
}
2022-03-02 20:59:20 +00:00
i3 = i4;
2021-11-08 18:25:28 +00:00
}
e eVar = new e();
2022-03-02 20:59:20 +00:00
a(0L, eVar, 0, mutableList, 0, mutableList.size(), mutableListOf);
int[] iArr = new int[(int) b(eVar)];
2021-11-08 18:25:28 +00:00
while (!eVar.w()) {
i++;
2022-03-02 20:59:20 +00:00
iArr[i] = eVar.readInt();
2021-11-08 18:25:28 +00:00
}
Object[] copyOf = Arrays.copyOf(byteStringArr, byteStringArr.length);
m.checkExpressionValueIsNotNull(copyOf, "java.util.Arrays.copyOf(this, size)");
return new o((ByteString[]) copyOf, iArr, null);
}
throw new IllegalArgumentException("the empty byte string is not a supported option".toString());
}
throw new TypeCastException("null cannot be cast to non-null type kotlin.Array<T>");
}
}
public o(ByteString[] byteStringArr, int[] iArr, DefaultConstructorMarker defaultConstructorMarker) {
2021-12-17 22:03:14 +00:00
this.l = byteStringArr;
this.m = iArr;
2021-11-08 18:25:28 +00:00
}
@Override // d0.t.a, java.util.Collection, java.util.List
public final /* bridge */ boolean contains(Object obj) {
if (obj instanceof ByteString) {
return super.contains((ByteString) obj);
}
return false;
}
@Override // d0.t.c, java.util.List
public Object get(int i) {
2021-12-17 22:03:14 +00:00
return this.l[i];
2021-11-08 18:25:28 +00:00
}
@Override // d0.t.a
public int getSize() {
2021-12-17 22:03:14 +00:00
return this.l.length;
2021-11-08 18:25:28 +00:00
}
@Override // d0.t.c, java.util.List
public final /* bridge */ int indexOf(Object obj) {
if (obj instanceof ByteString) {
return super.indexOf((ByteString) obj);
}
return -1;
}
@Override // d0.t.c, java.util.List
public final /* bridge */ int lastIndexOf(Object obj) {
if (obj instanceof ByteString) {
return super.lastIndexOf((ByteString) obj);
}
return -1;
}
}