package o; /* loaded from: classes2.dex */ public class nVO implements InterfaceC16012kTv { public int a() { return 1; } @Override // o.InterfaceC16012kTv public void c(C8198dDy c8198dDy) { StringBuilder sb = new StringBuilder(); while (true) { if (c8198dDy.j >= c8198dDy.a.length() - c8198dDy.f) { break; } char charAt = c8198dDy.a.charAt(c8198dDy.j); c8198dDy.j++; int b = b(charAt, sb); int length = c8198dDy.c.length() + ((sb.length() / 3) << 1); c8198dDy.e(length); int i = c8198dDy.i.e - length; if (c8198dDy.j >= c8198dDy.a.length() - c8198dDy.f) { StringBuilder sb2 = new StringBuilder(); if (sb.length() % 3 == 2 && i != 2) { b = b(c8198dDy, sb, sb2, b); } while (sb.length() % 3 == 1 && (b > 3 || i != 1)) { b = b(c8198dDy, sb, sb2, b); } } else if (sb.length() % 3 == 0 && GpJ.a(c8198dDy.a, c8198dDy.j, a()) != a()) { c8198dDy.d = 0; break; } } a(c8198dDy, sb); } private int b(C8198dDy c8198dDy, StringBuilder sb, StringBuilder sb2, int i) { int length = sb.length(); sb.delete(length - i, length); c8198dDy.j--; int b = b(c8198dDy.a.charAt(c8198dDy.j), sb2); c8198dDy.i = null; return b; } public void a(C8198dDy c8198dDy, StringBuilder sb) { int length = sb.length() / 3; int length2 = sb.length() % 3; int length3 = c8198dDy.c.length() + (length << 1); c8198dDy.e(length3); int i = c8198dDy.i.e - length3; if (length2 == 2) { sb.append((char) 0); while (sb.length() >= 3) { d(c8198dDy, sb); } if (c8198dDy.j < c8198dDy.a.length() - c8198dDy.f) { c8198dDy.c.append((char) 254); } } else if (i == 1 && length2 == 1) { while (sb.length() >= 3) { d(c8198dDy, sb); } if (c8198dDy.j < c8198dDy.a.length() - c8198dDy.f) { c8198dDy.c.append((char) 254); } c8198dDy.j--; } else if (length2 == 0) { while (sb.length() >= 3) { d(c8198dDy, sb); } if (i > 0 || c8198dDy.j < c8198dDy.a.length() - c8198dDy.f) { c8198dDy.c.append((char) 254); } } else { throw new IllegalStateException("Unexpected case. Please report!"); } c8198dDy.d = 0; } public int b(char c, StringBuilder sb) { if (c == ' ') { sb.append((char) 3); return 1; } if (c >= '0' && c <= '9') { sb.append((char) (c - ',')); return 1; } if (c >= 'A' && c <= 'Z') { sb.append((char) (c - '3')); return 1; } if (c < ' ') { sb.append((char) 0); sb.append(c); return 2; } if (c <= '/') { sb.append((char) 1); sb.append((char) (c - '!')); return 2; } if (c <= '@') { sb.append((char) 1); sb.append((char) (c - '+')); return 2; } if (c <= '_') { sb.append((char) 1); sb.append((char) (c - 'E')); return 2; } if (c <= 127) { sb.append((char) 2); sb.append((char) (c - '`')); return 2; } sb.append("\u0001\u001e"); return b((char) (c - 128), sb) + 2; } /* JADX INFO: Access modifiers changed from: package-private */ public static void d(C8198dDy c8198dDy, StringBuilder sb) { int charAt = (sb.charAt(0) * 1600) + (sb.charAt(1) * '(') + sb.charAt(2) + 1; c8198dDy.c.append(new String(new char[]{(char) (charAt / 256), (char) (charAt % 256)})); sb.delete(0, 3); } }