package okhttp3.internal.ws; import java.io.IOException; import kotlin.Metadata; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.text.StringsKt; import okhttp3.Headers; import okhttp3.internal.Util; /* compiled from: WebSocketExtensions.kt */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0002\b\u0015\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0086\b\u0018\u0000 \u001c2\u00020\u0001:\u0001\u001cBE\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0003\u0012\n\b\u0002\u0010\u0007\u001a\u0004\u0018\u00010\u0005\u0012\b\b\u0002\u0010\b\u001a\u00020\u0003\u0012\b\b\u0002\u0010\t\u001a\u00020\u0003¢\u0006\u0002\u0010\nJ\t\u0010\f\u001a\u00020\u0003HÆ\u0003J\u0010\u0010\r\u001a\u0004\u0018\u00010\u0005HÆ\u0003¢\u0006\u0002\u0010\u000eJ\t\u0010\u000f\u001a\u00020\u0003HÆ\u0003J\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0005HÆ\u0003¢\u0006\u0002\u0010\u000eJ\t\u0010\u0011\u001a\u00020\u0003HÆ\u0003J\t\u0010\u0012\u001a\u00020\u0003HÆ\u0003JN\u0010\u0013\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u00052\b\b\u0002\u0010\u0006\u001a\u00020\u00032\n\b\u0002\u0010\u0007\u001a\u0004\u0018\u00010\u00052\b\b\u0002\u0010\b\u001a\u00020\u00032\b\b\u0002\u0010\t\u001a\u00020\u0003HÆ\u0001¢\u0006\u0002\u0010\u0014J\u0013\u0010\u0015\u001a\u00020\u00032\b\u0010\u0016\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u0017\u001a\u00020\u0005HÖ\u0001J\u000e\u0010\u0018\u001a\u00020\u00032\u0006\u0010\u0019\u001a\u00020\u0003J\t\u0010\u001a\u001a\u00020\u001bHÖ\u0001R\u0014\u0010\u0004\u001a\u0004\u0018\u00010\u00058\u0006X\u0087\u0004¢\u0006\u0004\n\u0002\u0010\u000bR\u0010\u0010\u0006\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0007\u001a\u0004\u0018\u00010\u00058\u0006X\u0087\u0004¢\u0006\u0004\n\u0002\u0010\u000bR\u0010\u0010\b\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u001d"}, d2 = {"Lokhttp3/internal/ws/WebSocketExtensions;", "", "perMessageDeflate", "", "clientMaxWindowBits", "", "clientNoContextTakeover", "serverMaxWindowBits", "serverNoContextTakeover", "unknownValues", "(ZLjava/lang/Integer;ZLjava/lang/Integer;ZZ)V", "Ljava/lang/Integer;", "component1", "component2", "()Ljava/lang/Integer;", "component3", "component4", "component5", "component6", "copy", "(ZLjava/lang/Integer;ZLjava/lang/Integer;ZZ)Lokhttp3/internal/ws/WebSocketExtensions;", "equals", "other", "hashCode", "noContextTakeover", "clientOriginated", "toString", "", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0}) /* loaded from: classes3.dex */ public final /* data */ class WebSocketExtensions { /* renamed from: Companion, reason: from kotlin metadata */ public static final Companion INSTANCE = new Companion(null); private static final String HEADER_WEB_SOCKET_EXTENSION = "Sec-WebSocket-Extensions"; public final Integer clientMaxWindowBits; public final boolean clientNoContextTakeover; public final boolean perMessageDeflate; public final Integer serverMaxWindowBits; public final boolean serverNoContextTakeover; public final boolean unknownValues; public WebSocketExtensions() { this(false, null, false, null, false, false, 63, null); } public static /* synthetic */ WebSocketExtensions copy$default(WebSocketExtensions webSocketExtensions, boolean z, Integer num, boolean z2, Integer num2, boolean z3, boolean z4, int i, Object obj) { if ((i & 1) != 0) { z = webSocketExtensions.perMessageDeflate; } if ((i & 2) != 0) { num = webSocketExtensions.clientMaxWindowBits; } Integer num3 = num; if ((i & 4) != 0) { z2 = webSocketExtensions.clientNoContextTakeover; } boolean z5 = z2; if ((i & 8) != 0) { num2 = webSocketExtensions.serverMaxWindowBits; } Integer num4 = num2; if ((i & 16) != 0) { z3 = webSocketExtensions.serverNoContextTakeover; } boolean z6 = z3; if ((i & 32) != 0) { z4 = webSocketExtensions.unknownValues; } return webSocketExtensions.copy(z, num3, z5, num4, z6, z4); } /* renamed from: component1, reason: from getter */ public final boolean getPerMessageDeflate() { return this.perMessageDeflate; } /* renamed from: component2, reason: from getter */ public final Integer getClientMaxWindowBits() { return this.clientMaxWindowBits; } /* renamed from: component3, reason: from getter */ public final boolean getClientNoContextTakeover() { return this.clientNoContextTakeover; } /* renamed from: component4, reason: from getter */ public final Integer getServerMaxWindowBits() { return this.serverMaxWindowBits; } /* renamed from: component5, reason: from getter */ public final boolean getServerNoContextTakeover() { return this.serverNoContextTakeover; } /* renamed from: component6, reason: from getter */ public final boolean getUnknownValues() { return this.unknownValues; } public final WebSocketExtensions copy(boolean perMessageDeflate, Integer clientMaxWindowBits, boolean clientNoContextTakeover, Integer serverMaxWindowBits, boolean serverNoContextTakeover, boolean unknownValues) { return new WebSocketExtensions(perMessageDeflate, clientMaxWindowBits, clientNoContextTakeover, serverMaxWindowBits, serverNoContextTakeover, unknownValues); } public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof WebSocketExtensions)) { return false; } WebSocketExtensions webSocketExtensions = (WebSocketExtensions) other; return this.perMessageDeflate == webSocketExtensions.perMessageDeflate && Intrinsics.areEqual(this.clientMaxWindowBits, webSocketExtensions.clientMaxWindowBits) && this.clientNoContextTakeover == webSocketExtensions.clientNoContextTakeover && Intrinsics.areEqual(this.serverMaxWindowBits, webSocketExtensions.serverMaxWindowBits) && this.serverNoContextTakeover == webSocketExtensions.serverNoContextTakeover && this.unknownValues == webSocketExtensions.unknownValues; } /* 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 z = this.perMessageDeflate; ?? r0 = z; if (z) { r0 = 1; } int i = r0 * 31; Integer num = this.clientMaxWindowBits; int hashCode = (i + (num != null ? num.hashCode() : 0)) * 31; ?? r2 = this.clientNoContextTakeover; int i2 = r2; if (r2 != 0) { i2 = 1; } int i3 = (hashCode + i2) * 31; Integer num2 = this.serverMaxWindowBits; int hashCode2 = (i3 + (num2 != null ? num2.hashCode() : 0)) * 31; ?? r22 = this.serverNoContextTakeover; int i4 = r22; if (r22 != 0) { i4 = 1; } int i5 = (hashCode2 + i4) * 31; boolean z2 = this.unknownValues; return i5 + (z2 ? 1 : z2 ? 1 : 0); } public final boolean noContextTakeover(boolean clientOriginated) { return clientOriginated ? this.clientNoContextTakeover : this.serverNoContextTakeover; } public String toString() { return "WebSocketExtensions(perMessageDeflate=" + this.perMessageDeflate + ", clientMaxWindowBits=" + this.clientMaxWindowBits + ", clientNoContextTakeover=" + this.clientNoContextTakeover + ", serverMaxWindowBits=" + this.serverMaxWindowBits + ", serverNoContextTakeover=" + this.serverNoContextTakeover + ", unknownValues=" + this.unknownValues + ")"; } public WebSocketExtensions(boolean z, Integer num, boolean z2, Integer num2, boolean z3, boolean z4) { this.perMessageDeflate = z; this.clientMaxWindowBits = num; this.clientNoContextTakeover = z2; this.serverMaxWindowBits = num2; this.serverNoContextTakeover = z3; this.unknownValues = z4; } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public /* synthetic */ WebSocketExtensions(boolean r3, java.lang.Integer r4, boolean r5, java.lang.Integer r6, boolean r7, boolean r8, int r9, kotlin.jvm.internal.DefaultConstructorMarker r10) { /* r2 = this; r10 = r9 & 1 r0 = 0 if (r10 == 0) goto L6 r3 = r0 L6: r10 = r9 & 2 r1 = 0 if (r10 == 0) goto Lf r4 = r1 java.lang.Integer r4 = (java.lang.Integer) r4 r4 = r1 Lf: r10 = r9 & 4 if (r10 == 0) goto L14 r5 = r0 L14: r10 = r9 & 8 if (r10 == 0) goto L1c r6 = r1 java.lang.Integer r6 = (java.lang.Integer) r6 r6 = r1 L1c: r10 = r9 & 16 if (r10 == 0) goto L21 r7 = r0 L21: r9 = r9 & 32 if (r9 == 0) goto L26 r8 = r0 L26: r2.(r3, r4, r5, r6, r7, r8) return */ throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.ws.WebSocketExtensions.(boolean, java.lang.Integer, boolean, java.lang.Integer, boolean, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker):void"); } /* compiled from: WebSocketExtensions.kt */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\t"}, d2 = {"Lokhttp3/internal/ws/WebSocketExtensions$Companion;", "", "()V", "HEADER_WEB_SOCKET_EXTENSION", "", "parse", "Lokhttp3/internal/ws/WebSocketExtensions;", "responseHeaders", "Lokhttp3/Headers;", "okhttp"}, k = 1, mv = {1, 4, 0}) /* loaded from: classes3.dex */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final WebSocketExtensions parse(Headers responseHeaders) throws IOException { Intrinsics.checkNotNullParameter(responseHeaders, "responseHeaders"); int size = responseHeaders.size(); Integer num = null; Integer num2 = null; boolean z = false; boolean z2 = false; boolean z3 = false; boolean z4 = false; for (int i = 0; i < size; i++) { if (StringsKt.equals(responseHeaders.name(i), "Sec-WebSocket-Extensions", true)) { String value = responseHeaders.value(i); int i2 = 0; while (i2 < value.length()) { int delimiterOffset$default = Util.delimiterOffset$default(value, ',', i2, 0, 4, (Object) null); int delimiterOffset = Util.delimiterOffset(value, ';', i2, delimiterOffset$default); String trimSubstring = Util.trimSubstring(value, i2, delimiterOffset); int i3 = delimiterOffset + 1; if (StringsKt.equals(trimSubstring, "permessage-deflate", true)) { if (z) { z4 = true; } while (i3 < delimiterOffset$default) { int delimiterOffset2 = Util.delimiterOffset(value, ';', i3, delimiterOffset$default); int delimiterOffset3 = Util.delimiterOffset(value, '=', i3, delimiterOffset2); String trimSubstring2 = Util.trimSubstring(value, i3, delimiterOffset3); String removeSurrounding = delimiterOffset3 < delimiterOffset2 ? StringsKt.removeSurrounding(Util.trimSubstring(value, delimiterOffset3 + 1, delimiterOffset2), (CharSequence) "\"") : null; int i4 = delimiterOffset2 + 1; if (StringsKt.equals(trimSubstring2, "client_max_window_bits", true)) { if (num != null) { z4 = true; } num = removeSurrounding != null ? StringsKt.toIntOrNull(removeSurrounding) : null; if (num != null) { i3 = i4; } z4 = true; i3 = i4; } else { if (StringsKt.equals(trimSubstring2, "client_no_context_takeover", true)) { if (z2) { z4 = true; } if (removeSurrounding != null) { z4 = true; } z2 = true; } else if (StringsKt.equals(trimSubstring2, "server_max_window_bits", true)) { if (num2 != null) { z4 = true; } num2 = removeSurrounding != null ? StringsKt.toIntOrNull(removeSurrounding) : null; if (num2 != null) { } z4 = true; } else { if (StringsKt.equals(trimSubstring2, "server_no_context_takeover", true)) { if (z3) { z4 = true; } if (removeSurrounding != null) { z4 = true; } z3 = true; } z4 = true; } i3 = i4; } } i2 = i3; z = true; } else { i2 = i3; z4 = true; } } } } return new WebSocketExtensions(z, num, z2, num2, z3, z4); } } }