package hb;

import android.app.AppOpsManager;
import android.content.Context;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Looper;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.StrictMode;
import android.provider.Settings;
import android.util.Log;
import com.google.android.gms.ads.internal.util.client.zzr;
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader$ParseException;
import com.google.android.gms.dynamite.descriptors.com.google.android.gms.ads.dynamite.ModuleDescriptor;
import com.google.android.gms.internal.ads.dz;
import com.google.android.gms.internal.ads.ga2;
import com.google.android.gms.internal.ads.lp;
import com.google.android.gms.internal.ads.ni;
import com.google.android.gms.internal.atv_ads_framework.zzax;
import com.google.android.gms.measurement.internal.u1;
import com.google.common.util.concurrent.w;
import com.google.crypto.tink.shaded.protobuf.ByteString;
import com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException;
import com.google.crypto.tink.shaded.protobuf.a0;
import com.google.crypto.tink.shaded.protobuf.a1;
import com.google.crypto.tink.shaded.protobuf.b0;
import com.google.crypto.tink.shaded.protobuf.f0;
import com.google.crypto.tink.shaded.protobuf.f1;
import com.google.crypto.tink.shaded.protobuf.l;
import com.google.crypto.tink.shaded.protobuf.n1;
import com.google.crypto.tink.shaded.protobuf.o;
import com.google.crypto.tink.shaded.protobuf.r0;
import com.google.crypto.tink.shaded.protobuf.t;
import com.google.crypto.tink.shaded.protobuf.y;
import io.flutter.plugins.pathprovider.Messages$FlutterError;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.util.concurrent.locks.LockSupport;
import kotlin.collections.EmptyList;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.coroutines.intrinsics.CoroutineSingletons;
import kotlin.jvm.functions.Function2;
import kotlin.time.DurationUnit;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.c0;
import kotlinx.coroutines.e0;
import kotlinx.coroutines.g1;
import kotlinx.coroutines.h1;
import kotlinx.coroutines.internal.r;
import kotlinx.coroutines.internal.v;
import kotlinx.coroutines.p;
import kotlinx.coroutines.q;
import kotlinx.coroutines.q0;
import kotlinx.coroutines.q1;
import kotlinx.coroutines.t0;
import kotlinx.coroutines.t1;
import kotlinx.coroutines.u;
import kotlinx.coroutines.v0;
import kotlinx.coroutines.x;
import kotlinx.coroutines.y0;
import q7.j;

/* JADX INFO: loaded from: classes2.dex */
public abstract /* synthetic */ class a {
    public static int A(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        com.google.crypto.tink.shaded.protobuf.e eVar = (com.google.crypto.tink.shaded.protobuf.e) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a + iR;
        while (iR < i11) {
            iR = T(bArr, iR, ga2Var);
            eVar.g(ga2Var.f11679b != 0);
        }
        if (iR == i11) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static void A0(int i10, Parcel parcel) {
        parcel.setDataPosition(parcel.dataPosition() + w0(i10, parcel));
    }

    public static int B(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        o oVar = (o) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a;
        int i12 = iR + i11;
        if (i12 > bArr.length) {
            throw InvalidProtocolBufferException.j();
        }
        oVar.getClass();
        int i13 = (i11 / 8) + 0;
        double[] dArr = oVar.f23951b;
        if (i13 > dArr.length) {
            if (dArr.length == 0) {
                oVar.f23951b = new double[Math.max(i13, 10)];
            } else {
                int length = dArr.length;
                while (length < i13) {
                    length = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.c(length, 3, 2, 1, 10);
                }
                oVar.f23951b = Arrays.copyOf(oVar.f23951b, length);
            }
        }
        while (iR < i12) {
            oVar.g(Double.longBitsToDouble(u(iR, bArr)));
            iR += 8;
        }
        if (iR == i12) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static void B0(Object obj, String str) {
        ClassCastException classCastException = new ClassCastException(defpackage.e.j(obj == null ? "null" : obj.getClass().getName(), " cannot be cast to ", str));
        nb.g.Q(a.class.getName(), classCastException);
        throw classCastException;
    }

    public static int C(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        y yVar = (y) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a;
        int i12 = iR + i11;
        if (i12 > bArr.length) {
            throw InvalidProtocolBufferException.j();
        }
        yVar.getClass();
        int i13 = (i11 / 4) + 0;
        int[] iArr = yVar.f23990b;
        if (i13 > iArr.length) {
            if (iArr.length == 0) {
                yVar.f23990b = new int[Math.max(i13, 10)];
            } else {
                int length = iArr.length;
                while (length < i13) {
                    length = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.c(length, 3, 2, 1, 10);
                }
                yVar.f23990b = Arrays.copyOf(yVar.f23990b, length);
            }
        }
        while (iR < i12) {
            yVar.g(s(iR, bArr));
            iR += 4;
        }
        if (iR == i12) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static void C0() {
        throw new ArithmeticException("Index overflow has happened.");
    }

    public static int D(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        f0 f0Var = (f0) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a;
        int i12 = iR + i11;
        if (i12 > bArr.length) {
            throw InvalidProtocolBufferException.j();
        }
        f0Var.getClass();
        int i13 = (i11 / 8) + 0;
        long[] jArr = f0Var.f23896b;
        if (i13 > jArr.length) {
            if (jArr.length == 0) {
                f0Var.f23896b = new long[Math.max(i13, 10)];
            } else {
                int length = jArr.length;
                while (length < i13) {
                    length = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.c(length, 3, 2, 1, 10);
                }
                f0Var.f23896b = Arrays.copyOf(f0Var.f23896b, length);
            }
        }
        while (iR < i12) {
            f0Var.g(u(iR, bArr));
            iR += 8;
        }
        if (iR == i12) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static final long D0(long j10, DurationUnit durationUnit) {
        nb.g.i(durationUnit, "unit");
        DurationUnit durationUnit2 = DurationUnit.NANOSECONDS;
        long jM = ua.b.m(4611686018426999999L, durationUnit2, durationUnit);
        if (!new xd.f(-jM, jM).f(j10)) {
            DurationUnit durationUnit3 = DurationUnit.MILLISECONDS;
            nb.g.i(durationUnit3, "targetUnit");
            return V(ua.b.i(durationUnit3.getTimeUnit().convert(j10, durationUnit.getTimeUnit())));
        }
        long jM2 = ua.b.m(j10, durationUnit, durationUnit2) << 1;
        int i10 = zd.a.f37168c;
        int i11 = zd.b.f37169a;
        return jM2;
    }

    public static int E(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        t tVar = (t) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a;
        int i12 = iR + i11;
        if (i12 > bArr.length) {
            throw InvalidProtocolBufferException.j();
        }
        tVar.getClass();
        int i13 = (i11 / 4) + 0;
        float[] fArr = tVar.f23977b;
        if (i13 > fArr.length) {
            if (fArr.length == 0) {
                tVar.f23977b = new float[Math.max(i13, 10)];
            } else {
                int length = fArr.length;
                while (length < i13) {
                    length = com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.c(length, 3, 2, 1, 10);
                }
                tVar.f23977b = Arrays.copyOf(tVar.f23977b, length);
            }
        }
        while (iR < i12) {
            tVar.g(Float.intBitsToFloat(s(iR, bArr)));
            iR += 4;
        }
        if (iR == i12) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static boolean E0(Context context, int i10, String str) {
        j8.d dVarA = j8.e.a(context);
        dVarA.getClass();
        try {
            AppOpsManager appOpsManager = (AppOpsManager) dVarA.f28722a.getSystemService("appops");
            if (appOpsManager == null) {
                throw new NullPointerException("context.getSystemService(Context.APP_OPS_SERVICE) is null");
            }
            appOpsManager.checkPackage(i10, str);
            return true;
        } catch (SecurityException unused) {
            return false;
        }
    }

    public static int F(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        y yVar = (y) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a + iR;
        while (iR < i11) {
            iR = R(bArr, iR, ga2Var);
            yVar.g(l.b(ga2Var.f11678a));
        }
        if (iR == i11) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static int F0(Parcel parcel) {
        int i10 = parcel.readInt();
        int iW0 = w0(i10, parcel);
        char c6 = (char) i10;
        int iDataPosition = parcel.dataPosition();
        if (c6 != 20293) {
            throw new SafeParcelReader$ParseException("Expected object header. Got 0x".concat(String.valueOf(Integer.toHexString(i10))), parcel);
        }
        int i11 = iW0 + iDataPosition;
        if (i11 >= iDataPosition && i11 <= parcel.dataSize()) {
            return i11;
        }
        throw new SafeParcelReader$ParseException(u1.m(new StringBuilder(String.valueOf(iDataPosition).length() + 32 + String.valueOf(i11).length()), "Size read is invalid start=", iDataPosition, " end=", i11), parcel);
    }

    public static int G(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        f0 f0Var = (f0) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a + iR;
        while (iR < i11) {
            iR = T(bArr, iR, ga2Var);
            f0Var.g(l.c(ga2Var.f11679b));
        }
        if (iR == i11) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static final Object G0(Continuation continuation, kotlin.coroutines.h hVar, Function2 function2) throws Throwable {
        AtomicIntegerFieldUpdater atomicIntegerFieldUpdater;
        kotlin.coroutines.h context = continuation.getContext();
        kotlin.coroutines.h hVarO = kotlinx.coroutines.y.O(context, hVar);
        y0 y0Var = (y0) hVarO.m(u.f29565b);
        if (y0Var != null && !y0Var.isActive()) {
            throw ((g1) y0Var).z();
        }
        if (hVarO == context) {
            r rVar = new r(continuation, hVarO);
            return kotlinx.coroutines.y.c0(rVar, rVar, function2);
        }
        kotlin.coroutines.c cVar = kotlin.coroutines.c.f29225a;
        if (nb.g.c(hVarO.m(cVar), context.m(cVar))) {
            t1 t1Var = new t1(continuation, hVarO);
            kotlin.coroutines.h hVar2 = t1Var.f29289c;
            Object objC = v.c(hVar2, null);
            try {
                return kotlinx.coroutines.y.c0(t1Var, t1Var, function2);
            } finally {
                v.a(hVar2, objC);
            }
        }
        e0 e0Var = new e0(continuation, hVarO);
        kotlinx.coroutines.flow.h.N(function2, e0Var, e0Var);
        do {
            atomicIntegerFieldUpdater = e0.f29351e;
            int i10 = atomicIntegerFieldUpdater.get(e0Var);
            if (i10 != 0) {
                if (i10 != 2) {
                    throw new IllegalStateException("Already suspended".toString());
                }
                Object objG0 = kotlinx.coroutines.y.g0(e0Var.G());
                if (objG0 instanceof q) {
                    throw ((q) objG0).f29523a;
                }
                return objG0;
            }
        } while (!atomicIntegerFieldUpdater.compareAndSet(e0Var, 0, 1));
        return CoroutineSingletons.f29226a;
    }

    public static int H(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        y yVar = (y) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a + iR;
        while (iR < i11) {
            iR = R(bArr, iR, ga2Var);
            yVar.g(ga2Var.f11678a);
        }
        if (iR == i11) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static ArrayList H0(Throwable th) {
        ArrayList arrayList = new ArrayList(3);
        if (th instanceof Messages$FlutterError) {
            Messages$FlutterError messages$FlutterError = (Messages$FlutterError) th;
            arrayList.add(messages$FlutterError.code);
            arrayList.add(messages$FlutterError.getMessage());
            arrayList.add(messages$FlutterError.details);
        } else {
            arrayList.add(th.toString());
            arrayList.add(th.getClass().getSimpleName());
            arrayList.add("Cause: " + th.getCause() + ", Stacktrace: " + Log.getStackTraceString(th));
        }
        return arrayList;
    }

    public static int I(byte[] bArr, int i10, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        f0 f0Var = (f0) a0Var;
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a + iR;
        while (iR < i11) {
            iR = T(bArr, iR, ga2Var);
            f0Var.g(ga2Var.f11679b);
        }
        if (iR == i11) {
            return iR;
        }
        throw InvalidProtocolBufferException.j();
    }

    public static ArrayList I0(Throwable th) {
        ArrayList arrayList = new ArrayList(3);
        if (th instanceof io.flutter.plugins.urllauncher.Messages$FlutterError) {
            io.flutter.plugins.urllauncher.Messages$FlutterError messages$FlutterError = (io.flutter.plugins.urllauncher.Messages$FlutterError) th;
            arrayList.add(messages$FlutterError.code);
            arrayList.add(messages$FlutterError.getMessage());
            arrayList.add(messages$FlutterError.details);
        } else {
            arrayList.add(th.toString());
            arrayList.add(th.getClass().getSimpleName());
            arrayList.add("Cause: " + th.getCause() + ", Stacktrace: " + Log.getStackTraceString(th));
        }
        return arrayList;
    }

    public static int J(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        y yVar = (y) a0Var;
        int iR = R(bArr, i11, ga2Var);
        yVar.g(l.b(ga2Var.f11678a));
        while (iR < i12) {
            int iR2 = R(bArr, iR, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iR = R(bArr, iR2, ga2Var);
            yVar.g(l.b(ga2Var.f11678a));
        }
        return iR;
    }

    public static int J0(int i10) {
        int[] iArr = {1, 2, 3, 4, 5, 6};
        for (int i11 = 0; i11 < 6; i11++) {
            int i12 = iArr[i11];
            int i13 = i12 - 1;
            if (i12 == 0) {
                throw null;
            }
            if (i13 == i10) {
                return i12;
            }
        }
        return 1;
    }

    public static int K(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        f0 f0Var = (f0) a0Var;
        int iT = T(bArr, i11, ga2Var);
        f0Var.g(l.c(ga2Var.f11679b));
        while (iT < i12) {
            int iR = R(bArr, iT, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iT = T(bArr, iR, ga2Var);
            f0Var.g(l.c(ga2Var.f11679b));
        }
        return iT;
    }

    public static Object K0(Context context, String str, q7.l lVar) throws zzr {
        try {
            return lVar.f(U0(context).b(str));
        } catch (Exception e10) {
            throw new zzr(e10);
        }
    }

    public static int L(byte[] bArr, int i10, ga2 ga2Var) throws InvalidProtocolBufferException {
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a;
        if (i11 < 0) {
            throw InvalidProtocolBufferException.f();
        }
        if (i11 == 0) {
            ga2Var.f11680c = "";
            return iR;
        }
        ga2Var.f11680c = new String(bArr, iR, i11, b0.f23882a);
        return iR + i11;
    }

    public static Object L0(Context context, Callable callable) {
        try {
            StrictMode.ThreadPolicy threadPolicy = StrictMode.getThreadPolicy();
            try {
                StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder(threadPolicy).permitDiskReads().permitDiskWrites().build());
                return callable.call();
            } finally {
                StrictMode.setThreadPolicy(threadPolicy);
            }
        } catch (Throwable th) {
            dz.a(context).d("StrictModeUtil.runWithLaxStrictMode", th);
            return null;
        }
    }

    public static int M(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        int iR = R(bArr, i11, ga2Var);
        int i13 = ga2Var.f11678a;
        if (i13 < 0) {
            throw InvalidProtocolBufferException.f();
        }
        if (i13 == 0) {
            a0Var.add("");
        } else {
            a0Var.add(new String(bArr, iR, i13, b0.f23882a));
            iR += i13;
        }
        while (iR < i12) {
            int iR2 = R(bArr, iR, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iR = R(bArr, iR2, ga2Var);
            int i14 = ga2Var.f11678a;
            if (i14 < 0) {
                throw InvalidProtocolBufferException.f();
            }
            if (i14 == 0) {
                a0Var.add("");
            } else {
                a0Var.add(new String(bArr, iR, i14, b0.f23882a));
                iR += i14;
            }
        }
        return iR;
    }

    public static String M0(String str) {
        int length = str.length();
        int i10 = 0;
        while (i10 < length) {
            char cCharAt = str.charAt(i10);
            if (cCharAt >= 'A' && cCharAt <= 'Z') {
                char[] charArray = str.toCharArray();
                while (i10 < length) {
                    char c6 = charArray[i10];
                    if (c6 >= 'A' && c6 <= 'Z') {
                        charArray[i10] = (char) (c6 ^ ' ');
                    }
                    i10++;
                }
                return String.valueOf(charArray);
            }
            i10++;
        }
        return str;
    }

    public static int N(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        int iR = R(bArr, i11, ga2Var);
        int i13 = ga2Var.f11678a;
        if (i13 < 0) {
            throw InvalidProtocolBufferException.f();
        }
        if (i13 == 0) {
            a0Var.add("");
        } else {
            int i14 = iR + i13;
            if (!n1.e(iR, i14, bArr)) {
                throw InvalidProtocolBufferException.c();
            }
            a0Var.add(new String(bArr, iR, i13, b0.f23882a));
            iR = i14;
        }
        while (iR < i12) {
            int iR2 = R(bArr, iR, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iR = R(bArr, iR2, ga2Var);
            int i15 = ga2Var.f11678a;
            if (i15 < 0) {
                throw InvalidProtocolBufferException.f();
            }
            if (i15 == 0) {
                a0Var.add("");
            } else {
                int i16 = iR + i15;
                if (!n1.e(iR, i16, bArr)) {
                    throw InvalidProtocolBufferException.c();
                }
                a0Var.add(new String(bArr, iR, i15, b0.f23882a));
                iR = i16;
            }
        }
        return iR;
    }

    public static void N0(int i10, int i11) {
        String strY;
        if (i10 < 0 || i10 >= i11) {
            if (i10 < 0) {
                strY = com.bumptech.glide.g.y("%s (%s) must not be negative", "index", Integer.valueOf(i10));
            } else {
                if (i11 < 0) {
                    throw new IllegalArgumentException(u1.g("negative size: ", i11));
                }
                strY = com.bumptech.glide.g.y("%s (%s) must be less than size (%s)", "index", Integer.valueOf(i10), Integer.valueOf(i11));
            }
            throw new IndexOutOfBoundsException(strY);
        }
    }

    public static int O(byte[] bArr, int i10, ga2 ga2Var) throws InvalidProtocolBufferException {
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a;
        if (i11 < 0) {
            throw InvalidProtocolBufferException.f();
        }
        if (i11 == 0) {
            ga2Var.f11680c = "";
            return iR;
        }
        ga2Var.f11680c = n1.f23950a.W(iR, i11, bArr);
        return iR + i11;
    }

    public static void O0(Context context) {
        boolean z10;
        Object obj = q7.g.f32230b;
        if (((Boolean) lp.f13823a.j()).booleanValue()) {
            try {
                if (Settings.Global.getInt(context.getContentResolver(), "development_settings_enabled", 0) != 0) {
                    synchronized (q7.g.f32230b) {
                        z10 = q7.g.f32231c;
                    }
                    if (z10) {
                        return;
                    }
                    w wVarB = new p7.f0(context).b();
                    j.c("Updating ad debug logging enablement.");
                    ni.k(wVarB, "AdDebugLogUpdater.updateEnablement");
                }
            } catch (Exception unused) {
            }
        }
    }

    public static int P(int i10, byte[] bArr, int i11, int i12, f1 f1Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        if ((i10 >>> 3) == 0) {
            throw InvalidProtocolBufferException.b();
        }
        int i13 = i10 & 7;
        if (i13 == 0) {
            int iT = T(bArr, i11, ga2Var);
            f1Var.d(i10, Long.valueOf(ga2Var.f11679b));
            return iT;
        }
        if (i13 == 1) {
            f1Var.d(i10, Long.valueOf(u(i11, bArr)));
            return i11 + 8;
        }
        if (i13 == 2) {
            int iR = R(bArr, i11, ga2Var);
            int i14 = ga2Var.f11678a;
            if (i14 < 0) {
                throw InvalidProtocolBufferException.f();
            }
            if (i14 > bArr.length - iR) {
                throw InvalidProtocolBufferException.j();
            }
            if (i14 == 0) {
                f1Var.d(i10, ByteString.f23846a);
            } else {
                f1Var.d(i10, ByteString.g(iR, i14, bArr));
            }
            return iR + i14;
        }
        if (i13 != 3) {
            if (i13 != 5) {
                throw InvalidProtocolBufferException.b();
            }
            f1Var.d(i10, Integer.valueOf(s(i11, bArr)));
            return i11 + 4;
        }
        f1 f1VarC = f1.c();
        int i15 = (i10 & (-8)) | 4;
        int i16 = ga2Var.f11681d + 1;
        ga2Var.f11681d = i16;
        if (i16 >= 100) {
            throw new InvalidProtocolBufferException("Protocol message had too many levels of nesting.  May be malicious.  Use setRecursionLimit() to increase the recursion depth limit.");
        }
        int i17 = 0;
        while (true) {
            if (i11 >= i12) {
                break;
            }
            int iR2 = R(bArr, i11, ga2Var);
            int i18 = ga2Var.f11678a;
            if (i18 == i15) {
                i17 = i18;
                i11 = iR2;
                break;
            }
            i17 = i18;
            i11 = P(i18, bArr, iR2, i12, f1VarC, ga2Var);
        }
        ga2Var.f11681d--;
        if (i11 > i12 || i17 != i15) {
            throw InvalidProtocolBufferException.g();
        }
        f1Var.d(i10, f1VarC);
        return i11;
    }

    public static void P0(Parcel parcel, int i10, int i11) {
        int iW0 = w0(i10, parcel);
        if (iW0 == i11) {
            return;
        }
        String hexString = Integer.toHexString(iW0);
        int length = String.valueOf(i11).length();
        StringBuilder sb = new StringBuilder(String.valueOf(hexString).length() + length + 19 + String.valueOf(iW0).length() + 4 + 1);
        u1.y(sb, "Expected size ", i11, " got ", iW0);
        throw new SafeParcelReader$ParseException(defpackage.e.p(sb, " (0x", hexString, ")"), parcel);
    }

    public static int Q(int i10, byte[] bArr, int i11, ga2 ga2Var) {
        int i12 = i10 & 127;
        int i13 = i11 + 1;
        byte b10 = bArr[i11];
        if (b10 >= 0) {
            ga2Var.f11678a = i12 | (b10 << 7);
            return i13;
        }
        int i14 = i12 | ((b10 & 127) << 7);
        int i15 = i11 + 2;
        byte b11 = bArr[i13];
        if (b11 >= 0) {
            ga2Var.f11678a = i14 | (b11 << 14);
            return i15;
        }
        int i16 = i14 | ((b11 & 127) << 14);
        int i17 = i11 + 3;
        byte b12 = bArr[i15];
        if (b12 >= 0) {
            ga2Var.f11678a = i16 | (b12 << 21);
            return i17;
        }
        int i18 = i16 | ((b12 & 127) << 21);
        int i19 = i11 + 4;
        byte b13 = bArr[i17];
        if (b13 >= 0) {
            ga2Var.f11678a = i18 | (b13 << 28);
            return i19;
        }
        int i20 = i18 | ((b13 & 127) << 28);
        while (true) {
            int i21 = i19 + 1;
            if (bArr[i19] >= 0) {
                ga2Var.f11678a = i20;
                return i21;
            }
            i19 = i21;
        }
    }

    public static void Q0(Object obj) {
        Object[] objArr = new Object[0];
        if (obj == null) {
            throw new zzax(com.bumptech.glide.g.y("expected a non-null reference", objArr));
        }
    }

    public static int R(byte[] bArr, int i10, ga2 ga2Var) {
        int i11 = i10 + 1;
        byte b10 = bArr[i10];
        if (b10 < 0) {
            return Q(b10, bArr, i11, ga2Var);
        }
        ga2Var.f11678a = b10;
        return i11;
    }

    public static void R0(int i10, int i11) {
        if (i10 < 0 || i10 > i11) {
            throw new IndexOutOfBoundsException(W0(i10, i11, "index"));
        }
    }

    public static int S(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        y yVar = (y) a0Var;
        int iR = R(bArr, i11, ga2Var);
        yVar.g(ga2Var.f11678a);
        while (iR < i12) {
            int iR2 = R(bArr, iR, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iR = R(bArr, iR2, ga2Var);
            yVar.g(ga2Var.f11678a);
        }
        return iR;
    }

    public static void S0(Parcel parcel, int i10, int i11) {
        if (i10 == i11) {
            return;
        }
        String hexString = Integer.toHexString(i10);
        int length = String.valueOf(i11).length();
        StringBuilder sb = new StringBuilder(String.valueOf(hexString).length() + length + 19 + String.valueOf(i10).length() + 4 + 1);
        u1.y(sb, "Expected size ", i11, " got ", i10);
        throw new SafeParcelReader$ParseException(defpackage.e.p(sb, " (0x", hexString, ")"), parcel);
    }

    public static int T(byte[] bArr, int i10, ga2 ga2Var) {
        int i11 = i10 + 1;
        long j10 = bArr[i10];
        if (j10 >= 0) {
            ga2Var.f11679b = j10;
            return i11;
        }
        int i12 = i10 + 2;
        byte b10 = bArr[i11];
        long j11 = (j10 & 127) | (((long) (b10 & 127)) << 7);
        int i13 = 7;
        while (b10 < 0) {
            int i14 = i12 + 1;
            byte b11 = bArr[i12];
            i13 += 7;
            j11 |= ((long) (b11 & 127)) << i13;
            b10 = b11;
            i12 = i14;
        }
        ga2Var.f11679b = j11;
        return i12;
    }

    public static void T0(int i10, int i11) {
        String strG;
        if (i10 < 0 || i10 >= i11) {
            if (i10 < 0) {
                strG = com.bumptech.glide.g.G("%s (%s) must not be negative", "index", Integer.valueOf(i10));
            } else {
                if (i11 < 0) {
                    throw new IllegalArgumentException(defpackage.e.n(new StringBuilder(String.valueOf(i11).length() + 15), "negative size: ", i11));
                }
                strG = com.bumptech.glide.g.G("%s (%s) must be less than size (%s)", "index", Integer.valueOf(i10), Integer.valueOf(i11));
            }
            throw new IndexOutOfBoundsException(strG);
        }
    }

    public static int U(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        f0 f0Var = (f0) a0Var;
        int iT = T(bArr, i11, ga2Var);
        f0Var.g(ga2Var.f11679b);
        while (iT < i12) {
            int iR = R(bArr, iT, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iT = T(bArr, iR, ga2Var);
            f0Var.g(ga2Var.f11679b);
        }
        return iT;
    }

    public static l8.c U0(Context context) throws zzr {
        try {
            return l8.c.c(context, l8.c.f30167b, ModuleDescriptor.MODULE_ID);
        } catch (Exception e10) {
            throw new zzr(e10);
        }
    }

    public static final long V(long j10) {
        long j11 = (j10 << 1) + 1;
        int i10 = zd.a.f37168c;
        int i11 = zd.b.f37169a;
        return j11;
    }

    public static void V0(int i10, int i11, int i12) {
        if (i10 < 0 || i11 < i10 || i11 > i12) {
            throw new IndexOutOfBoundsException((i10 < 0 || i10 > i12) ? W0(i10, i12, "start index") : (i11 < 0 || i11 > i12) ? W0(i11, i12, "end index") : com.bumptech.glide.g.y("end index (%s) must not be less than start index (%s)", Integer.valueOf(i11), Integer.valueOf(i10)));
        }
    }

    public static EmptyList W() {
        return EmptyList.f29203a;
    }

    public static String W0(int i10, int i11, String str) {
        if (i10 < 0) {
            return com.bumptech.glide.g.y("%s (%s) must not be negative", str, Integer.valueOf(i10));
        }
        if (i11 >= 0) {
            return com.bumptech.glide.g.y("%s (%s) must not be greater than size (%s)", str, Integer.valueOf(i10), Integer.valueOf(i11));
        }
        throw new IllegalArgumentException(u1.g("negative size: ", i11));
    }

    public static void X(int i10, Parcel parcel) {
        if (parcel.dataPosition() != i10) {
            throw new SafeParcelReader$ParseException(defpackage.e.n(new StringBuilder(String.valueOf(i10).length() + 26), "Overread allowed size end=", i10), parcel);
        }
    }

    public static void X0(int i10, int i11, int i12) {
        if (i10 < 0 || i11 < i10 || i11 > i12) {
            throw new IndexOutOfBoundsException((i10 < 0 || i10 > i12) ? Y0(i10, i12, "start index") : (i11 < 0 || i11 > i12) ? Y0(i11, i12, "end index") : com.bumptech.glide.g.G("end index (%s) must not be less than start index (%s)", Integer.valueOf(i11), Integer.valueOf(i10)));
        }
    }

    public static String Y(androidx.datastore.preferences.protobuf.ByteString byteString) {
        byte bC;
        nb.c cVar = new nb.c(byteString, 5);
        StringBuilder sb = new StringBuilder(cVar.o());
        for (int i10 = 0; i10 < cVar.o(); i10++) {
            int i11 = cVar.f31182a;
            Object obj = cVar.f31183b;
            switch (i11) {
                case 5:
                    bC = ((androidx.datastore.preferences.protobuf.ByteString) obj).c(i10);
                    break;
                default:
                    bC = ((ByteString) obj).c(i10);
                    break;
            }
            if (bC == 34) {
                sb.append("\\\"");
            } else if (bC == 39) {
                sb.append("\\'");
            } else if (bC != 92) {
                switch (bC) {
                    case 7:
                        sb.append("\\a");
                        break;
                    case 8:
                        sb.append("\\b");
                        break;
                    case 9:
                        sb.append("\\t");
                        break;
                    case 10:
                        sb.append("\\n");
                        break;
                    case 11:
                        sb.append("\\v");
                        break;
                    case 12:
                        sb.append("\\f");
                        break;
                    case 13:
                        sb.append("\\r");
                        break;
                    default:
                        if (bC < 32 || bC > 126) {
                            sb.append('\\');
                            sb.append((char) (((bC >>> 6) & 3) + 48));
                            sb.append((char) (((bC >>> 3) & 7) + 48));
                            sb.append((char) ((bC & 7) + 48));
                        } else {
                            sb.append((char) bC);
                        }
                        break;
                }
            } else {
                sb.append("\\\\");
            }
        }
        return sb.toString();
    }

    public static String Y0(int i10, int i11, String str) {
        if (i10 < 0) {
            return com.bumptech.glide.g.G("%s (%s) must not be negative", str, Integer.valueOf(i10));
        }
        if (i11 >= 0) {
            return com.bumptech.glide.g.G("%s (%s) must not be greater than size (%s)", str, Integer.valueOf(i10), Integer.valueOf(i11));
        }
        throw new IllegalArgumentException(defpackage.e.n(new StringBuilder(String.valueOf(i11).length() + 15), "negative size: ", i11));
    }

    public static float Z(boolean z10) {
        long jMaxMemory = Runtime.getRuntime().maxMemory();
        int iFreeMemory = jMaxMemory == 0 ? -1 : 100 - ((int) (((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) * 100.0f) / jMaxMemory));
        if (iFreeMemory < 0) {
            return 1.0f;
        }
        if (iFreeMemory < 30) {
            return z10 ? 0.1f : 2.0f;
        }
        if (iFreeMemory < 60) {
            return z10 ? 0.5f : 1.5f;
        }
        return 1.0f;
    }

    public static List a(Object obj) {
        if ((obj instanceof td.a) && !(obj instanceof td.b)) {
            B0(obj, "kotlin.collections.MutableList");
            throw null;
        }
        try {
            return (List) obj;
        } catch (ClassCastException e10) {
            nb.g.Q(a.class.getName(), e10);
            throw e10;
        }
    }

    public static boolean a0() {
        return Thread.currentThread() == Looper.getMainLooper().getThread();
    }

    public static c0 b(kotlinx.coroutines.internal.e eVar, Function2 function2) {
        EmptyCoroutineContext emptyCoroutineContext = EmptyCoroutineContext.f29221a;
        CoroutineStart coroutineStart = CoroutineStart.f29281a;
        kotlin.coroutines.h hVarP = kotlinx.coroutines.y.P(eVar, emptyCoroutineContext);
        CoroutineStart coroutineStart2 = CoroutineStart.f29281a;
        c0 c0Var = new c0(hVarP, true);
        c0Var.a0(coroutineStart, c0Var, function2);
        return c0Var;
    }

    public static int b0(List list) {
        nb.g.i(list, "<this>");
        return list.size() - 1;
    }

    public static void c(int i10, Object obj) {
        if (obj == null || h0(i10, obj)) {
            return;
        }
        B0(obj, "kotlin.jvm.functions.Function" + i10);
        throw null;
    }

    public static final kotlinx.coroutines.h c0(Continuation continuation) {
        kotlinx.coroutines.h hVar;
        kotlinx.coroutines.h hVar2;
        if (!(continuation instanceof kotlinx.coroutines.internal.g)) {
            return new kotlinx.coroutines.h(1, continuation);
        }
        kotlinx.coroutines.internal.g gVar = (kotlinx.coroutines.internal.g) continuation;
        loop0: while (true) {
            AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = kotlinx.coroutines.internal.g.f29460h;
            Object obj = atomicReferenceFieldUpdater.get(gVar);
            la.e eVar = kotlinx.coroutines.internal.a.f29452d;
            hVar = null;
            if (obj == null) {
                atomicReferenceFieldUpdater.set(gVar, eVar);
                hVar2 = null;
                break;
            }
            if (obj instanceof kotlinx.coroutines.h) {
                while (!atomicReferenceFieldUpdater.compareAndSet(gVar, obj, eVar)) {
                    if (atomicReferenceFieldUpdater.get(gVar) != obj) {
                        break;
                    }
                }
                hVar2 = (kotlinx.coroutines.h) obj;
                break loop0;
            }
            if (obj != eVar && !(obj instanceof Throwable)) {
                throw new IllegalStateException(("Inconsistent state " + obj).toString());
            }
        }
        if (hVar2 != null) {
            AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = kotlinx.coroutines.h.f29436g;
            Object obj2 = atomicReferenceFieldUpdater2.get(hVar2);
            if (!(obj2 instanceof p) || ((p) obj2).f29517d == null) {
                kotlinx.coroutines.h.f29435f.set(hVar2, 536870911);
                atomicReferenceFieldUpdater2.set(hVar2, kotlinx.coroutines.b.f29292a);
                hVar = hVar2;
            } else {
                hVar2.p();
            }
            if (hVar != null) {
                return hVar;
            }
        }
        return new kotlinx.coroutines.h(2, continuation);
    }

    public static void d(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException unused) {
            }
        }
    }

    public static final int d0(int i10, int i11, int i12) {
        if (i12 > 0) {
            if (i10 >= i11) {
                return i11;
            }
            int i13 = i11 % i12;
            if (i13 < 0) {
                i13 += i12;
            }
            int i14 = i10 % i12;
            if (i14 < 0) {
                i14 += i12;
            }
            int i15 = (i13 - i14) % i12;
            if (i15 < 0) {
                i15 += i12;
            }
            return i11 - i15;
        }
        if (i12 >= 0) {
            throw new IllegalArgumentException("Step is zero.");
        }
        if (i10 <= i11) {
            return i11;
        }
        int i16 = -i12;
        int i17 = i10 % i16;
        if (i17 < 0) {
            i17 += i16;
        }
        int i18 = i11 % i16;
        if (i18 < 0) {
            i18 += i16;
        }
        int i19 = (i17 - i18) % i16;
        if (i19 < 0) {
            i19 += i16;
        }
        return i11 + i19;
    }

    public static long e(InputStream inputStream, OutputStream outputStream, boolean z10) {
        byte[] bArr = new byte[1024];
        long j10 = 0;
        while (true) {
            try {
                int i10 = inputStream.read(bArr, 0, 1024);
                if (i10 == -1) {
                    break;
                }
                j10 += (long) i10;
                outputStream.write(bArr, 0, i10);
            } catch (Throwable th) {
                if (z10) {
                    d(inputStream);
                    d(outputStream);
                }
                throw th;
            }
        }
        if (z10) {
            d(inputStream);
            d(outputStream);
        }
        return j10;
    }

    public static String e0(int i10) {
        switch (i10) {
            case -1:
                return "SUCCESS_CACHE";
            case 0:
                return "SUCCESS";
            case 1:
            case 9:
            case 11:
            case 12:
            default:
                return defpackage.e.n(new StringBuilder(String.valueOf(i10).length() + 21), "unknown status code: ", i10);
            case 2:
                return "SERVICE_VERSION_UPDATE_REQUIRED";
            case 3:
                return "SERVICE_DISABLED";
            case 4:
                return "SIGN_IN_REQUIRED";
            case 5:
                return "INVALID_ACCOUNT";
            case 6:
                return "RESOLUTION_REQUIRED";
            case 7:
                return "NETWORK_ERROR";
            case 8:
                return "INTERNAL_ERROR";
            case 10:
                return "DEVELOPER_ERROR";
            case 13:
                return "ERROR";
            case 14:
                return "INTERRUPTED";
            case 15:
                return "TIMEOUT";
            case 16:
                return "CANCELED";
            case 17:
                return "API_NOT_CONNECTED";
            case 18:
                return "DEAD_CLIENT";
            case 19:
                return "REMOTE_EXCEPTION";
            case 20:
                return "CONNECTION_SUSPENDED_DURING_CALL";
            case 21:
                return "RECONNECTION_TIMED_OUT_DURING_UPDATE";
            case 22:
                return "RECONNECTION_TIMED_OUT";
        }
    }

    public static Bundle f(int i10, Parcel parcel) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        Bundle bundle = parcel.readBundle();
        parcel.setDataPosition(iDataPosition + iW0);
        return bundle;
    }

    public static final double f0(AudioManager audioManager) {
        nb.g.i(audioManager, "<this>");
        double d10 = 10000;
        return Math.rint((((double) audioManager.getStreamVolume(3)) / ((double) audioManager.getStreamMaxVolume(3))) * d10) / d10;
    }

    public static byte[] g(int i10, Parcel parcel) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        byte[] bArrCreateByteArray = parcel.createByteArray();
        parcel.setDataPosition(iDataPosition + iW0);
        return bArrCreateByteArray;
    }

    public static final void g0(kotlin.coroutines.h hVar, Throwable th) {
        try {
            kotlinx.coroutines.v vVar = (kotlinx.coroutines.v) hVar.m(u.f29564a);
            if (vVar != null) {
                ((ae.b) vVar).L(hVar, th);
            } else {
                kotlinx.coroutines.y.E(hVar, th);
            }
        } catch (Throwable th2) {
            if (th != th2) {
                RuntimeException runtimeException = new RuntimeException("Exception while trying to handle coroutine exception", th2);
                kotlin.a.a(runtimeException, th);
                th = runtimeException;
            }
            kotlinx.coroutines.y.E(hVar, th);
        }
    }

    public static Parcelable h(Parcel parcel, int i10, Parcelable.Creator creator) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        Parcelable parcelable = (Parcelable) creator.createFromParcel(parcel);
        parcel.setDataPosition(iDataPosition + iW0);
        return parcelable;
    }

    public static boolean h0(int i10, Object obj) {
        if (obj instanceof kd.a) {
            return (obj instanceof kotlin.jvm.internal.e ? ((kotlin.jvm.internal.e) obj).getArity() : obj instanceof sd.a ? 0 : obj instanceof sd.l ? 1 : obj instanceof Function2 ? 2 : obj instanceof sd.p ? 3 : obj instanceof m3.b ? 4 : -1) == i10;
        }
        return false;
    }

    public static String i(int i10, Parcel parcel) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        String string = parcel.readString();
        parcel.setDataPosition(iDataPosition + iW0);
        return string;
    }

    public static boolean i0(byte b10) {
        return b10 > -65;
    }

    public static String[] j(int i10, Parcel parcel) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        String[] strArrCreateStringArray = parcel.createStringArray();
        parcel.setDataPosition(iDataPosition + iW0);
        return strArrCreateStringArray;
    }

    public static final androidx.core.view.u1 j0(Object[] objArr) {
        nb.g.i(objArr, "array");
        return new androidx.core.view.u1(objArr);
    }

    public static ArrayList k(int i10, Parcel parcel) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        ArrayList<String> arrayListCreateStringArrayList = parcel.createStringArrayList();
        parcel.setDataPosition(iDataPosition + iW0);
        return arrayListCreateStringArrayList;
    }

    public static kotlinx.coroutines.n1 k0(x xVar, kotlin.coroutines.a aVar, Function2 function2, int i10) {
        kotlin.coroutines.h hVar = aVar;
        if ((i10 & 1) != 0) {
            hVar = EmptyCoroutineContext.f29221a;
        }
        CoroutineStart coroutineStart = (i10 & 2) != 0 ? CoroutineStart.f29281a : null;
        kotlin.coroutines.h hVarP = kotlinx.coroutines.y.P(xVar, hVar);
        coroutineStart.getClass();
        kotlinx.coroutines.n1 h1Var = coroutineStart == CoroutineStart.f29282b ? new h1(hVarP, function2) : new kotlinx.coroutines.n1(hVarP, true);
        h1Var.a0(coroutineStart, h1Var, function2);
        return h1Var;
    }

    public static Object[] l(Parcel parcel, int i10, Parcelable.Creator creator) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        Object[] objArrCreateTypedArray = parcel.createTypedArray(creator);
        parcel.setDataPosition(iDataPosition + iW0);
        return objArrCreateTypedArray;
    }

    public static List l0(Object obj) {
        List listSingletonList = Collections.singletonList(obj);
        nb.g.h(listSingletonList, "singletonList(element)");
        return listSingletonList;
    }

    public static ArrayList m(Parcel parcel, int i10, Parcelable.Creator creator) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        ArrayList arrayListCreateTypedArrayList = parcel.createTypedArrayList(creator);
        parcel.setDataPosition(iDataPosition + iW0);
        return arrayListCreateTypedArrayList;
    }

    public static List m0(Object... objArr) {
        nb.g.i(objArr, "elements");
        return objArr.length > 0 ? kotlin.collections.q.O(objArr) : EmptyList.f29203a;
    }

    public static int n(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        com.google.crypto.tink.shaded.protobuf.e eVar = (com.google.crypto.tink.shaded.protobuf.e) a0Var;
        int iT = T(bArr, i11, ga2Var);
        eVar.g(ga2Var.f11679b != 0);
        while (iT < i12) {
            int iR = R(bArr, iT, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iT = T(bArr, iR, ga2Var);
            eVar.g(ga2Var.f11679b != 0);
        }
        return iT;
    }

    public static int n0(Object obj, a1 a1Var, byte[] bArr, int i10, int i11, int i12, ga2 ga2Var) throws InvalidProtocolBufferException {
        r0 r0Var = (r0) a1Var;
        int i13 = ga2Var.f11681d + 1;
        ga2Var.f11681d = i13;
        if (i13 >= 100) {
            throw new InvalidProtocolBufferException("Protocol message had too many levels of nesting.  May be malicious.  Use setRecursionLimit() to increase the recursion depth limit.");
        }
        int iF = r0Var.F(obj, bArr, i10, i11, i12, ga2Var);
        ga2Var.f11681d--;
        ga2Var.f11680c = obj;
        return iF;
    }

    public static int o(byte[] bArr, int i10, ga2 ga2Var) throws InvalidProtocolBufferException {
        int iR = R(bArr, i10, ga2Var);
        int i11 = ga2Var.f11678a;
        if (i11 < 0) {
            throw InvalidProtocolBufferException.f();
        }
        if (i11 > bArr.length - iR) {
            throw InvalidProtocolBufferException.j();
        }
        if (i11 == 0) {
            ga2Var.f11680c = ByteString.f23846a;
            return iR;
        }
        ga2Var.f11680c = ByteString.g(iR, i11, bArr);
        return iR + i11;
    }

    public static int o0(Object obj, a1 a1Var, byte[] bArr, int i10, int i11, ga2 ga2Var) throws InvalidProtocolBufferException {
        int iQ = i10 + 1;
        int i12 = bArr[i10];
        if (i12 < 0) {
            iQ = Q(i12, bArr, iQ, ga2Var);
            i12 = ga2Var.f11678a;
        }
        int i13 = iQ;
        if (i12 < 0 || i12 > i11 - i13) {
            throw InvalidProtocolBufferException.j();
        }
        int i14 = ga2Var.f11681d + 1;
        ga2Var.f11681d = i14;
        if (i14 >= 100) {
            throw new InvalidProtocolBufferException("Protocol message had too many levels of nesting.  May be malicious.  Use setRecursionLimit() to increase the recursion depth limit.");
        }
        int i15 = i12 + i13;
        a1Var.h(obj, bArr, i13, i15, ga2Var);
        ga2Var.f11681d--;
        ga2Var.f11680c = obj;
        return i15;
    }

    public static int p(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        int iR = R(bArr, i11, ga2Var);
        int i13 = ga2Var.f11678a;
        if (i13 < 0) {
            throw InvalidProtocolBufferException.f();
        }
        if (i13 > bArr.length - iR) {
            throw InvalidProtocolBufferException.j();
        }
        if (i13 == 0) {
            a0Var.add(ByteString.f23846a);
        } else {
            a0Var.add(ByteString.g(iR, i13, bArr));
            iR += i13;
        }
        while (iR < i12) {
            int iR2 = R(bArr, iR, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            iR = R(bArr, iR2, ga2Var);
            int i14 = ga2Var.f11678a;
            if (i14 < 0) {
                throw InvalidProtocolBufferException.f();
            }
            if (i14 > bArr.length - iR) {
                throw InvalidProtocolBufferException.j();
            }
            if (i14 == 0) {
                a0Var.add(ByteString.f23846a);
            } else {
                a0Var.add(ByteString.g(iR, i14, bArr));
                iR += i14;
            }
        }
        return iR;
    }

    public static String p0(String str, String str2) {
        int length = str.length() - str2.length();
        if (length < 0 || length > 1) {
            throw new IllegalArgumentException("Invalid input received");
        }
        StringBuilder sb = new StringBuilder(str2.length() + str.length());
        for (int i10 = 0; i10 < str.length(); i10++) {
            sb.append(str.charAt(i10));
            if (str2.length() > i10) {
                sb.append(str2.charAt(i10));
            }
        }
        return sb.toString();
    }

    public static double q(int i10, byte[] bArr) {
        return Double.longBitsToDouble(u(i10, bArr));
    }

    public static ArrayList q0(Object... objArr) {
        nb.g.i(objArr, "elements");
        return objArr.length == 0 ? new ArrayList() : new ArrayList(new kotlin.collections.g(objArr, true));
    }

    public static int r(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        o oVar = (o) a0Var;
        oVar.g(Double.longBitsToDouble(u(i11, bArr)));
        int i13 = i11 + 8;
        while (i13 < i12) {
            int iR = R(bArr, i13, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            oVar.g(Double.longBitsToDouble(u(iR, bArr)));
            i13 = iR + 8;
        }
        return i13;
    }

    public static List r0(List list) {
        int size = list.size();
        return size != 0 ? size != 1 ? list : l0(list.get(0)) : EmptyList.f29203a;
    }

    public static int s(int i10, byte[] bArr) {
        return ((bArr[i10 + 3] & 255) << 24) | (bArr[i10] & 255) | ((bArr[i10 + 1] & 255) << 8) | ((bArr[i10 + 2] & 255) << 16);
    }

    public static boolean s0(int i10, Parcel parcel) {
        P0(parcel, i10, 4);
        return parcel.readInt() != 0;
    }

    public static int t(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        y yVar = (y) a0Var;
        yVar.g(s(i11, bArr));
        int i13 = i11 + 4;
        while (i13 < i12) {
            int iR = R(bArr, i13, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            yVar.g(s(iR, bArr));
            i13 = iR + 4;
        }
        return i13;
    }

    public static IBinder t0(int i10, Parcel parcel) {
        int iW0 = w0(i10, parcel);
        int iDataPosition = parcel.dataPosition();
        if (iW0 == 0) {
            return null;
        }
        IBinder strongBinder = parcel.readStrongBinder();
        parcel.setDataPosition(iDataPosition + iW0);
        return strongBinder;
    }

    public static long u(int i10, byte[] bArr) {
        return ((((long) bArr[i10 + 7]) & 255) << 56) | (((long) bArr[i10]) & 255) | ((((long) bArr[i10 + 1]) & 255) << 8) | ((((long) bArr[i10 + 2]) & 255) << 16) | ((((long) bArr[i10 + 3]) & 255) << 24) | ((((long) bArr[i10 + 4]) & 255) << 32) | ((((long) bArr[i10 + 5]) & 255) << 40) | ((((long) bArr[i10 + 6]) & 255) << 48);
    }

    public static int u0(int i10, Parcel parcel) {
        P0(parcel, i10, 4);
        return parcel.readInt();
    }

    public static int v(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        f0 f0Var = (f0) a0Var;
        f0Var.g(u(i11, bArr));
        int i13 = i11 + 8;
        while (i13 < i12) {
            int iR = R(bArr, i13, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            f0Var.g(u(iR, bArr));
            i13 = iR + 8;
        }
        return i13;
    }

    public static long v0(int i10, Parcel parcel) {
        P0(parcel, i10, 8);
        return parcel.readLong();
    }

    public static float w(int i10, byte[] bArr) {
        return Float.intBitsToFloat(s(i10, bArr));
    }

    public static int w0(int i10, Parcel parcel) {
        return (i10 & (-65536)) != -65536 ? (char) (i10 >> 16) : parcel.readInt();
    }

    public static int x(int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) {
        t tVar = (t) a0Var;
        tVar.g(Float.intBitsToFloat(s(i11, bArr)));
        int i13 = i11 + 4;
        while (i13 < i12) {
            int iR = R(bArr, i13, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            tVar.g(Float.intBitsToFloat(s(iR, bArr)));
            i13 = iR + 4;
        }
        return i13;
    }

    public static final void x0(Object[] objArr, int i10, int i11) {
        nb.g.i(objArr, "<this>");
        while (i10 < i11) {
            objArr[i10] = null;
            i10++;
        }
    }

    public static int y(a1 a1Var, int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        int i13 = (i10 & (-8)) | 4;
        Object objF = a1Var.f();
        int iN0 = n0(objF, a1Var, bArr, i11, i12, i13, ga2Var);
        a1Var.b(objF);
        ga2Var.f11680c = objF;
        a0Var.add(objF);
        while (iN0 < i12) {
            int iR = R(bArr, iN0, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            Object objF2 = a1Var.f();
            int iN02 = n0(objF2, a1Var, bArr, iR, i12, i13, ga2Var);
            a1Var.b(objF2);
            ga2Var.f11680c = objF2;
            a0Var.add(objF2);
            iN0 = iN02;
        }
        return iN0;
    }

    public static final Object y0(kotlin.coroutines.h hVar, Function2 function2) throws Throwable {
        q0 q0VarA;
        kotlin.coroutines.h hVarP;
        Thread threadCurrentThread = Thread.currentThread();
        kotlin.coroutines.d dVar = (kotlin.coroutines.d) hVar.m(kotlin.coroutines.c.f29225a);
        t0 t0Var = t0.f29562a;
        if (dVar == null) {
            q0VarA = q1.a();
            hVarP = kotlinx.coroutines.y.P(t0Var, hVar.p(q0VarA));
        } else {
            if (dVar instanceof q0) {
            }
            q0VarA = (q0) q1.f29528a.get();
            hVarP = kotlinx.coroutines.y.P(t0Var, hVar);
        }
        kotlinx.coroutines.c cVar = new kotlinx.coroutines.c(hVarP, threadCurrentThread, q0VarA);
        cVar.a0(CoroutineStart.f29281a, cVar, function2);
        q0 q0Var = cVar.f29295e;
        if (q0Var != null) {
            int i10 = q0.f29524f;
            q0Var.Q(false);
        }
        while (!Thread.interrupted()) {
            try {
                long jR = q0Var != null ? q0Var.R() : Long.MAX_VALUE;
                if (!(cVar.G() instanceof v0)) {
                    if (q0Var != null) {
                        int i11 = q0.f29524f;
                        q0Var.O(false);
                    }
                    Object objG0 = kotlinx.coroutines.y.g0(cVar.G());
                    q qVar = objG0 instanceof q ? (q) objG0 : null;
                    if (qVar == null) {
                        return objG0;
                    }
                    throw qVar.f29523a;
                }
                LockSupport.parkNanos(cVar, jR);
            } catch (Throwable th) {
                if (q0Var != null) {
                    int i12 = q0.f29524f;
                    q0Var.O(false);
                }
                throw th;
            }
        }
        InterruptedException interruptedException = new InterruptedException();
        cVar.q(interruptedException);
        throw interruptedException;
    }

    public static int z(a1 a1Var, int i10, byte[] bArr, int i11, int i12, a0 a0Var, ga2 ga2Var) throws InvalidProtocolBufferException {
        Object objF = a1Var.f();
        int iO0 = o0(objF, a1Var, bArr, i11, i12, ga2Var);
        a1Var.b(objF);
        ga2Var.f11680c = objF;
        a0Var.add(objF);
        while (iO0 < i12) {
            int iR = R(bArr, iO0, ga2Var);
            if (i10 != ga2Var.f11678a) {
                break;
            }
            Object objF2 = a1Var.f();
            int iO02 = o0(objF2, a1Var, bArr, iR, i12, ga2Var);
            a1Var.b(objF2);
            ga2Var.f11680c = objF2;
            a0Var.add(objF2);
            iO0 = iO02;
        }
        return iO0;
    }
}
