package ir;

import com.amplifyframework.core.model.ModelIdentifier;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;
import kotlin.text.x;
import kotlin.text.y;
import kotlin.text.z;
import uq.u;
import vq.m;

/* loaded from: classes3.dex */
public final class e {

    /* renamed from: g, reason: collision with root package name */
    public static final a f23417g = new a(null);

    /* renamed from: a, reason: collision with root package name */
    public final boolean f23418a;

    /* renamed from: b, reason: collision with root package name */
    public final Integer f23419b;

    /* renamed from: c, reason: collision with root package name */
    public final boolean f23420c;

    /* renamed from: d, reason: collision with root package name */
    public final Integer f23421d;

    /* renamed from: e, reason: collision with root package name */
    public final boolean f23422e;

    /* renamed from: f, reason: collision with root package name */
    public final boolean f23423f;

    /* loaded from: classes3.dex */
    public static final class a {
        private a() {
        }

        public /* synthetic */ a(k kVar) {
            this();
        }

        public final e a(u responseHeaders) {
            boolean z10;
            boolean z11;
            boolean z12;
            Integer m10;
            boolean z13;
            boolean z14;
            Integer m11;
            boolean z15;
            t.g(responseHeaders, "responseHeaders");
            int size = responseHeaders.size();
            boolean z16 = false;
            Integer num = null;
            boolean z17 = false;
            Integer num2 = null;
            boolean z18 = false;
            boolean z19 = false;
            for (int i10 = 0; i10 < size; i10++) {
                z10 = y.z(responseHeaders.i(i10), "Sec-WebSocket-Extensions", true);
                if (z10) {
                    String C = responseHeaders.C(i10);
                    int i11 = 0;
                    while (i11 < C.length()) {
                        int j10 = m.j(C, ',', i11, 0, 4, null);
                        int h10 = m.h(C, ';', i11, j10);
                        String F = m.F(C, i11, h10);
                        int i12 = h10 + 1;
                        z11 = y.z(F, "permessage-deflate", true);
                        if (z11) {
                            if (z16) {
                                z19 = true;
                            }
                            i11 = i12;
                            while (i11 < j10) {
                                int h11 = m.h(C, ';', i11, j10);
                                int h12 = m.h(C, '=', i11, h11);
                                String F2 = m.F(C, i11, h12);
                                String A0 = h12 < h11 ? z.A0(m.F(C, h12 + 1, h11), ModelIdentifier.Helper.PRIMARY_KEY_ENCAPSULATE_CHAR) : null;
                                i11 = h11 + 1;
                                z12 = y.z(F2, "client_max_window_bits", true);
                                if (z12) {
                                    if (num != null) {
                                        z19 = true;
                                    }
                                    if (A0 != null) {
                                        m10 = x.m(A0);
                                        num = m10;
                                    } else {
                                        num = null;
                                    }
                                    if (num == null) {
                                        z19 = true;
                                    }
                                } else {
                                    z13 = y.z(F2, "client_no_context_takeover", true);
                                    if (z13) {
                                        if (z17) {
                                            z19 = true;
                                        }
                                        if (A0 != null) {
                                            z19 = true;
                                        }
                                        z17 = true;
                                    } else {
                                        z14 = y.z(F2, "server_max_window_bits", true);
                                        if (z14) {
                                            if (num2 != null) {
                                                z19 = true;
                                            }
                                            if (A0 != null) {
                                                m11 = x.m(A0);
                                                num2 = m11;
                                            } else {
                                                num2 = null;
                                            }
                                            if (num2 == null) {
                                                z19 = true;
                                            }
                                        } else {
                                            z15 = y.z(F2, "server_no_context_takeover", true);
                                            if (z15) {
                                                if (z18) {
                                                    z19 = true;
                                                }
                                                if (A0 != null) {
                                                    z19 = true;
                                                }
                                                z18 = true;
                                            } else {
                                                z19 = true;
                                            }
                                        }
                                    }
                                }
                            }
                            z16 = true;
                        } else {
                            i11 = i12;
                            z19 = true;
                        }
                    }
                }
            }
            return new e(z16, num, z17, num2, z18, z19);
        }
    }

    public e(boolean z10, Integer num, boolean z11, Integer num2, boolean z12, boolean z13) {
        this.f23418a = z10;
        this.f23419b = num;
        this.f23420c = z11;
        this.f23421d = num2;
        this.f23422e = z12;
        this.f23423f = z13;
    }

    public final boolean a(boolean z10) {
        return z10 ? this.f23420c : this.f23422e;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof e)) {
            return false;
        }
        e eVar = (e) obj;
        return this.f23418a == eVar.f23418a && t.b(this.f23419b, eVar.f23419b) && this.f23420c == eVar.f23420c && t.b(this.f23421d, eVar.f23421d) && this.f23422e == eVar.f23422e && this.f23423f == eVar.f23423f;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v1, types: [int] */
    /* JADX WARN: Type inference failed for: r0v12 */
    /* JADX WARN: Type inference failed for: r0v13 */
    /* JADX WARN: Type inference failed for: r2v3, types: [boolean] */
    /* JADX WARN: Type inference failed for: r2v6, types: [boolean] */
    public int hashCode() {
        boolean z10 = this.f23418a;
        ?? r02 = z10;
        if (z10) {
            r02 = 1;
        }
        int i10 = r02 * 31;
        Integer num = this.f23419b;
        int hashCode = (i10 + (num == null ? 0 : num.hashCode())) * 31;
        ?? r22 = this.f23420c;
        int i11 = r22;
        if (r22 != 0) {
            i11 = 1;
        }
        int i12 = (hashCode + i11) * 31;
        Integer num2 = this.f23421d;
        int hashCode2 = (i12 + (num2 != null ? num2.hashCode() : 0)) * 31;
        ?? r23 = this.f23422e;
        int i13 = r23;
        if (r23 != 0) {
            i13 = 1;
        }
        int i14 = (hashCode2 + i13) * 31;
        boolean z11 = this.f23423f;
        return i14 + (z11 ? 1 : z11 ? 1 : 0);
    }

    public String toString() {
        return "WebSocketExtensions(perMessageDeflate=" + this.f23418a + ", clientMaxWindowBits=" + this.f23419b + ", clientNoContextTakeover=" + this.f23420c + ", serverMaxWindowBits=" + this.f23421d + ", serverNoContextTakeover=" + this.f23422e + ", unknownValues=" + this.f23423f + ')';
    }
}
