package com.fyber.inneractive.sdk.protobuf; /* loaded from: classes2.dex */ public final class b1 implements m0 { public final o0 a; public final String b; public final Object[] c; public final int d; public b1(o0 o0Var, String str, Object[] objArr) { char charAt; this.a = o0Var; this.b = str; this.c = objArr; try { charAt = str.charAt(0); } catch (StringIndexOutOfBoundsException unused) { char[] charArray = str.toCharArray(); String str2 = new String(charArray); try { try { charAt = str2.charAt(0); str = str2; } catch (StringIndexOutOfBoundsException unused2) { char[] cArr = new char[str2.length()]; str2.getChars(0, str2.length(), cArr, 0); String str3 = new String(cArr); try { charAt = str3.charAt(0); str = str3; } catch (ArrayIndexOutOfBoundsException | StringIndexOutOfBoundsException e) { e = e; str2 = str3; throw new IllegalStateException(String.format("Failed parsing '%s' with charArray.length of %d", str2, Integer.valueOf(charArray.length)), e); } } } catch (ArrayIndexOutOfBoundsException e2) { e = e2; throw new IllegalStateException(String.format("Failed parsing '%s' with charArray.length of %d", str2, Integer.valueOf(charArray.length)), e); } catch (StringIndexOutOfBoundsException e3) { e = e3; throw new IllegalStateException(String.format("Failed parsing '%s' with charArray.length of %d", str2, Integer.valueOf(charArray.length)), e); } } if (charAt < 55296) { this.d = charAt; return; } int i = charAt & 8191; int i2 = 13; int i3 = 1; while (true) { int i4 = i3 + 1; char charAt2 = str.charAt(i3); if (charAt2 < 55296) { this.d = i | (charAt2 << i2); return; } else { i |= (charAt2 & 8191) << i2; i2 += 13; i3 = i4; } } } @Override // com.fyber.inneractive.sdk.protobuf.m0 public final boolean a() { return (this.d & 2) == 2; } @Override // com.fyber.inneractive.sdk.protobuf.m0 public final y0 b() { return (this.d & 1) == 1 ? y0.PROTO2 : y0.PROTO3; } @Override // com.fyber.inneractive.sdk.protobuf.m0 public final o0 c() { return this.a; } }